@apolitical/component-library 4.7.18-SW.0 → 4.8.0-4707.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cards/card-block/card-block.d.ts +2 -2
- package/cards/card-block/index.d.ts +0 -1
- package/discussion/sections/activity-section/activity-section.d.ts +2 -2
- package/discussion/sections/activity-section/index.d.ts +0 -1
- package/form/components/form/index.d.ts +1 -1
- package/form/types/profile-form/profile-form.d.ts +3 -3
- package/index.js +2 -2
- package/index.mjs +3 -3
- package/layout/content-layout/columns/columns.d.ts +2 -2
- package/layout/content-layout/columns/index.d.ts +0 -1
- package/navigation/load-more/index.d.ts +1 -1
- package/navigation/load-more/load-more.d.ts +3 -3
- package/navigation/tabs/index.d.ts +0 -1
- package/navigation/tabs/tabs.d.ts +6 -6
- package/package.json +1 -1
- package/sections/edit-section/edit-section.d.ts +2 -2
- package/sections/edit-section/index.d.ts +0 -1
- package/text/empty-state-box/empty-state-box.d.ts +2 -2
- package/text/empty-state-box/index.d.ts +0 -1
- package/text/hide-show-text-box/hide-show-text-box.d.ts +2 -2
- package/text/hide-show-text-box/index.d.ts +0 -1
- package/text/highlighted-text-box/highlighted-text-box.d.ts +2 -2
- package/text/highlighted-text-box/index.d.ts +0 -1
- package/user/profile-picture/index.d.ts +0 -1
- package/user/profile-picture/profile-picture.d.ts +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CardType, CardContentType, BuildCardDataType } from '../../cards/cards.types';
|
|
2
|
-
|
|
2
|
+
interface Props {
|
|
3
3
|
/** The card data, from Contentful */
|
|
4
4
|
cards: CardType[];
|
|
5
5
|
/** The types for each card, from Contentful */
|
|
@@ -12,5 +12,5 @@ export interface ICardBlockProps {
|
|
|
12
12
|
className?: string;
|
|
13
13
|
focusCardIndex?: number;
|
|
14
14
|
}
|
|
15
|
-
declare const CardBlock: ({ cards, cardTypes, className, ...props }:
|
|
15
|
+
declare const CardBlock: ({ cards, cardTypes, className, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export default CardBlock;
|
|
@@ -6,7 +6,7 @@ import { type IQueryFns } from './cache';
|
|
|
6
6
|
interface IActivitySectionQueryFns extends IQueryFns {
|
|
7
7
|
remove: () => Promise<void>;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
interface Props {
|
|
10
10
|
basePath: string;
|
|
11
11
|
parentId: string;
|
|
12
12
|
activityId: string;
|
|
@@ -21,5 +21,5 @@ export interface IActivitySectionProps {
|
|
|
21
21
|
};
|
|
22
22
|
profile: IProfileFormProps;
|
|
23
23
|
}
|
|
24
|
-
declare const ActivitySection: React.FC<
|
|
24
|
+
declare const ActivitySection: React.FC<Props>;
|
|
25
25
|
export default ActivitySection;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as Form } from './form';
|
|
2
|
-
export type { IField, FormValues, IFormMeta
|
|
2
|
+
export type { IField, FormValues, IFormMeta } from './form.types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IFormValues, IFormMeta } from './../../components/form/form.types';
|
|
2
|
-
export interface IProfileFormProps
|
|
2
|
+
export interface IProfileFormProps {
|
|
3
3
|
/** The hooks used in the form */
|
|
4
4
|
hooks: {
|
|
5
5
|
/** The hook to predict the user's location */
|
|
@@ -16,9 +16,9 @@ export interface IProfileFormProps<OnSuccessArgs = IFormValues> {
|
|
|
16
16
|
/** The functions to call */
|
|
17
17
|
functions: {
|
|
18
18
|
/** The function to upload the user's profile image */
|
|
19
|
-
uploadImage: () => Promise<
|
|
19
|
+
uploadImage: () => Promise<void>;
|
|
20
20
|
/** The function to call on success */
|
|
21
|
-
onSuccess?: (data:
|
|
21
|
+
onSuccess?: (data: IFormValues) => Promise<void>;
|
|
22
22
|
/** The function to call when the form is cancelled, e.g. the user presses a cancel button */
|
|
23
23
|
onCancel?: () => void;
|
|
24
24
|
/** The function to call on failure */
|
package/index.js
CHANGED
|
@@ -61,7 +61,7 @@ Valid keys: `+JSON.stringify(Object.keys(C),null," "));var X=de(U,ie,T,$,R+"."+
|
|
|
61
61
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
62
62
|
*/function yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Du(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yu(Object(n),!0).forEach(function(r){dp(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function dp(e,t,n){return t=hp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fp(e,t){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hp(e){var t=fp(e,"string");return typeof t=="symbol"?t:String(t)}var Cu={activateTrap:function(t,n){if(t.length>0){var r=t[t.length-1];r!==n&&r.pause()}var a=t.indexOf(n);a===-1||t.splice(a,1),t.push(n)},deactivateTrap:function(t,n){var r=t.indexOf(n);r!==-1&&t.splice(r,1),t.length>0&&t[t.length-1].unpause()}},mp=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},pp=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},xr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},gp=function(t){return xr(t)&&!t.shiftKey},vp=function(t){return xr(t)&&t.shiftKey},xu=function(t){return setTimeout(t,0)},wu=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},fr=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return typeof t=="function"?t.apply(void 0,r):t},Xr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},bp=[],yp=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||bp,i=Du({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:gp,isKeyBackward:vp},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(k,A,j){return k&&k[A]!==void 0?k[A]:i[j||A]},u=function(k,A){var j=typeof(A==null?void 0:A.composedPath)=="function"?A.composedPath():void 0;return s.containerGroups.findIndex(function(L){var H=L.container,Y=L.tabbableNodes;return H.contains(k)||(j==null?void 0:j.includes(H))||Y.find(function(Q){return Q===k})})},d=function(k){var A=i[k];if(typeof A=="function"){for(var j=arguments.length,L=new Array(j>1?j-1:0),H=1;H<j;H++)L[H-1]=arguments[H];A=A.apply(void 0,L)}if(A===!0&&(A=void 0),!A){if(A===void 0||A===!1)return A;throw new Error("`".concat(k,"` was specified but was not a node, or did not return a node"))}var Y=A;if(typeof A=="string"&&(Y=r.querySelector(A),!Y))throw new Error("`".concat(k,"` as selector refers to no known node"));return Y},m=function(){var k=d("initialFocus");if(k===!1)return!1;if(k===void 0||!Ca(k,i.tabbableOptions))if(u(r.activeElement)>=0)k=r.activeElement;else{var A=s.tabbableGroups[0],j=A&&A.firstTabbableNode;k=j||d("fallbackFocus")}if(!k)throw new Error("Your focus-trap needs to have at least one focusable element");return k},p=function(){if(s.containerGroups=s.containers.map(function(k){var A=xd(k,i.tabbableOptions),j=wd(k,i.tabbableOptions),L=A.length>0?A[0]:void 0,H=A.length>0?A[A.length-1]:void 0,Y=j.find(function(C){return bn(C)}),Q=j.slice().reverse().find(function(C){return bn(C)}),re=!!A.find(function(C){return sn(C)>0});return{container:k,tabbableNodes:A,focusableNodes:j,posTabIndexesFound:re,firstTabbableNode:L,lastTabbableNode:H,firstDomTabbableNode:Y,lastDomTabbableNode:Q,nextTabbableNode:function(q){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,E=A.indexOf(q);return E<0?K?j.slice(j.indexOf(q)+1).find(function(T){return bn(T)}):j.slice(0,j.indexOf(q)).reverse().find(function(T){return bn(T)}):A[E+(K?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(k){return k.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(k){return k.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},h=function M(k){var A=k.activeElement;if(A)return A.shadowRoot&&A.shadowRoot.activeElement!==null?M(A.shadowRoot):A},g=function M(k){if(k!==!1&&k!==h(document)){if(!k||!k.focus){M(m());return}k.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=k,mp(k)&&k.select()}},f=function(k){var A=d("setReturnFocus",k);return A||(A===!1?!1:k)},b=function(k){var A=k.target,j=k.event,L=k.isBackward,H=L===void 0?!1:L;A=A||Xr(j),p();var Y=null;if(s.tabbableGroups.length>0){var Q=u(A,j),re=Q>=0?s.containerGroups[Q]:void 0;if(Q<0)H?Y=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:Y=s.tabbableGroups[0].firstTabbableNode;else if(H){var C=wu(s.tabbableGroups,function(R){var U=R.firstTabbableNode;return A===U});if(C<0&&(re.container===A||Ca(A,i.tabbableOptions)&&!bn(A,i.tabbableOptions)&&!re.nextTabbableNode(A,!1))&&(C=Q),C>=0){var q=C===0?s.tabbableGroups.length-1:C-1,K=s.tabbableGroups[q];Y=sn(A)>=0?K.lastTabbableNode:K.lastDomTabbableNode}else xr(j)||(Y=re.nextTabbableNode(A,!1))}else{var E=wu(s.tabbableGroups,function(R){var U=R.lastTabbableNode;return A===U});if(E<0&&(re.container===A||Ca(A,i.tabbableOptions)&&!bn(A,i.tabbableOptions)&&!re.nextTabbableNode(A))&&(E=Q),E>=0){var T=E===s.tabbableGroups.length-1?0:E+1,$=s.tabbableGroups[T];Y=sn(A)>=0?$.firstTabbableNode:$.firstDomTabbableNode}else xr(j)||(Y=re.nextTabbableNode(A))}}else Y=d("fallbackFocus");return Y},v=function(k){var A=Xr(k);if(!(u(A,k)>=0)){if(fr(i.clickOutsideDeactivates,k)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}fr(i.allowOutsideClick,k)||k.preventDefault()}},_=function(k){var A=Xr(k),j=u(A,k)>=0;if(j||A instanceof Document)j&&(s.mostRecentlyFocusedNode=A);else{k.stopImmediatePropagation();var L,H=!0;if(s.mostRecentlyFocusedNode)if(sn(s.mostRecentlyFocusedNode)>0){var Y=u(s.mostRecentlyFocusedNode),Q=s.containerGroups[Y].tabbableNodes;if(Q.length>0){var re=Q.findIndex(function(C){return C===s.mostRecentlyFocusedNode});re>=0&&(i.isKeyForward(s.recentNavEvent)?re+1<Q.length&&(L=Q[re+1],H=!1):re-1>=0&&(L=Q[re-1],H=!1))}}else s.containerGroups.some(function(C){return C.tabbableNodes.some(function(q){return sn(q)>0})})||(H=!1);else H=!1;H&&(L=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(L||s.mostRecentlyFocusedNode||m())}s.recentNavEvent=void 0},F=function(k){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=k;var j=b({event:k,isBackward:A});j&&(xr(k)&&k.preventDefault(),g(j))},x=function(k){if(pp(k)&&fr(i.escapeDeactivates,k)!==!1){k.preventDefault(),o.deactivate();return}(i.isKeyForward(k)||i.isKeyBackward(k))&&F(k,i.isKeyBackward(k))},w=function(k){var A=Xr(k);u(A,k)>=0||fr(i.clickOutsideDeactivates,k)||fr(i.allowOutsideClick,k)||(k.preventDefault(),k.stopImmediatePropagation())},B=function(){if(s.active)return Cu.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?xu(function(){g(m())}):g(m()),r.addEventListener("focusin",_,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",w,{capture:!0,passive:!1}),r.addEventListener("keydown",x,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",_,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",w,!0),r.removeEventListener("keydown",x,!0),o},z=function(k){var A=k.some(function(j){var L=Array.from(j.removedNodes);return L.some(function(H){return H===s.mostRecentlyFocusedNode})});A&&g(m())},N=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(z):void 0,I=function(){N&&(N.disconnect(),s.active&&!s.paused&&s.containers.map(function(k){N.observe(k,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(k){if(s.active)return this;var A=l(k,"onActivate"),j=l(k,"onPostActivate"),L=l(k,"checkCanFocusTrap");L||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,A==null||A();var H=function(){L&&p(),B(),I(),j==null||j()};return L?(L(s.containers.concat()).then(H,H),this):(H(),this)},deactivate:function(k){if(!s.active)return this;var A=Du({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},k);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,I(),Cu.deactivateTrap(a,o);var j=l(A,"onDeactivate"),L=l(A,"onPostDeactivate"),H=l(A,"checkCanReturnFocus"),Y=l(A,"returnFocus","returnFocusOnDeactivate");j==null||j();var Q=function(){xu(function(){Y&&g(f(s.nodeFocusedBeforeActivation)),L==null||L()})};return Y&&H?(H(f(s.nodeFocusedBeforeActivation)).then(Q,Q),this):(Q(),this)},pause:function(k){if(s.paused||!s.active)return this;var A=l(k,"onPause"),j=l(k,"onPostPause");return s.paused=!0,A==null||A(),S(),I(),j==null||j(),this},unpause:function(k){if(!s.paused||!s.active)return this;var A=l(k,"onUnpause"),j=l(k,"onPostUnpause");return s.paused=!1,A==null||A(),p(),B(),I(),j==null||j(),this},updateContainerElements:function(k){var A=[].concat(k).filter(Boolean);return s.containers=A.map(function(j){return typeof j=="string"?r.querySelector(j):j}),s.active&&p(),I(),this}},o.updateContainerElements(t),o};const Dp=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:yp},Symbol.toStringTag,{value:"Module"})),Cp=Nc(Dp),xp=Nc(cp);function er(e){"@babel/helpers - typeof";return er=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},er(e)}function wp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Eu(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ed(r.key),r)}}function Ep(e,t,n){return t&&Eu(e.prototype,t),n&&Eu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _p(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ws(e,t)}function ws(e,t){return ws=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},ws(e,t)}function kp(e){var t=Bp();return function(){var r=Pa(e),a;if(t){var i=Pa(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return Fp(this,a)}}function Fp(e,t){if(t&&(er(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Dr(e)}function Dr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Bp(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Pa(e){return Pa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Pa(e)}function Ap(e,t,n){return t=Ed(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ed(e){var t=Tp(e,"string");return er(t)==="symbol"?t:String(t)}function Tp(e,t){if(er(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(er(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ea=y,ge=Zm,Sp=Cp,jp=Sp.createFocusTrap,Op=xp,Pp=Op.isFocusable,io=function(e){_p(n,e);var t=kp(n);function n(r){var a;wp(this,n),a=t.call(this,r),Ap(Dr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var d=arguments.length,m=new Array(d>1?d-1:0),p=1;p<d;p++)m[p-1]=arguments[p];u=u.apply(void 0,m)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var h=u;if(typeof u=="string"){var g;if(h=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!h)throw new Error("`".concat(o,"` as selector refers to no known node"))}return h}),a.handleDeactivate=a.handleDeactivate.bind(Dr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(Dr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(Dr(a)),a.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:a.handleDeactivate,onPostDeactivate:a.handlePostDeactivate,clickOutsideDeactivates:a.handleClickOutsideDeactivates},a.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){a.originalOptions[s]=i[s];continue}a.internalOptions[s]=i[s]}return a.outsideClick=null,a.focusTrapElements=r.containerElements||[],a.updatePreviousElement(),a}return Ep(n,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var a=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return a||(a===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var a=this.getDocument();a&&(this.previouslyFocusedElement=a.activeElement)}},{key:"deactivateTrap",value:function(){!this.focusTrap||!this.focusTrap.active||this.focusTrap.deactivate({returnFocus:!1,checkCanReturnFocus:null,onDeactivate:this.originalOptions.onDeactivate})}},{key:"handleClickOutsideDeactivates",value:function(a){var i=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,a):this.originalOptions.clickOutsideDeactivates;return i&&(this.outsideClick={target:a.target,allowDeactivation:i}),i}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var a=this,i=function(){var o=a.getReturnFocusNode(),l=!!(a.originalOptions.returnFocusOnDeactivate&&o!==null&&o!==void 0&&o.focus&&(!a.outsideClick||a.outsideClick.allowDeactivation&&!Pp(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,d=u===void 0?!1:u;l&&o.focus({preventScroll:d}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?ea.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===ea.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var d=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=d||[u]},o=ea.cloneElement(i,{ref:s});return o}return null}}]),n}(ea.Component),hr=typeof Element>"u"?Function:Element;io.propTypes={active:ge.bool,paused:ge.bool,focusTrapOptions:ge.shape({document:ge.object,onActivate:ge.func,onPostActivate:ge.func,checkCanFocusTrap:ge.func,onPause:ge.func,onPostPause:ge.func,onUnpause:ge.func,onPostUnpause:ge.func,onDeactivate:ge.func,onPostDeactivate:ge.func,checkCanReturnFocus:ge.func,initialFocus:ge.oneOfType([ge.instanceOf(hr),ge.string,ge.bool,ge.func]),fallbackFocus:ge.oneOfType([ge.instanceOf(hr),ge.string,ge.func]),escapeDeactivates:ge.oneOfType([ge.bool,ge.func]),clickOutsideDeactivates:ge.oneOfType([ge.bool,ge.func]),returnFocusOnDeactivate:ge.bool,setReturnFocus:ge.oneOfType([ge.instanceOf(hr),ge.string,ge.bool,ge.func]),allowOutsideClick:ge.oneOfType([ge.bool,ge.func]),preventScroll:ge.bool,tabbableOptions:ge.shape({displayCheck:ge.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:ge.oneOfType([ge.bool,ge.func])}),trapStack:ge.array,isKeyForward:ge.func,isKeyBackward:ge.func}),containerElements:ge.arrayOf(ge.instanceOf(hr)),children:ge.oneOfType([ge.element,ge.instanceOf(hr)])};io.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:jp};var Np=io;const Mp=jn(Np);const mn=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:d="",gtmContext:m="Modal"})=>{const p=se.useIntl(),{registerOverlay:h,unregisterOverlay:g}=fd(),[f,b]=y.useState(t),[v,_]=y.useState(null),F=y.useRef(null),x=N=>{N.key==="Escape"&&S(!1)},w=N=>{_(N.target)},B=N=>{v===F.current&&N.target===F.current&&S(!1),_(null)};y.useEffect(()=>(window.addEventListener("keyup",x),()=>{window.removeEventListener("keyup",x)})),y.useEffect(()=>{const N=F.current;return N&&(N.addEventListener("mousedown",w),N.addEventListener("mouseup",B)),()=>{N&&(N.removeEventListener("mousedown",w),N.removeEventListener("mouseup",B))}},[v]);const S=N=>{if(b(N),N)a(),h(e);else{if(f===N)return;i(),g(e)}};y.useEffect(()=>(S(t),()=>{f&&g(e)}),[t]);const z=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:F,className:G("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(ro,{id:e,className:G("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:z,children:t&&c.jsx(Mp,{containerElements:[F.current],children:c.jsxs("div",{className:"overlay-content",children:[c.jsxs("div",{className:"top",children:[o&&c.jsx("h2",{className:"modal-title",children:o}),c.jsx(_e,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>S(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":m,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(qt,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(qt,{}),c.jsx(sr,{buttons:u})]}),s&&c.jsx(jr,{className:"error",children:s})]})})})})},_d=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const mr="joinCommunityButton",so=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=se.useIntl(),o=y.useContext(mt),l=o&&typeof o.id=="string",u=r||!l,[d,m]=y.useState(e),[p,h]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{p==="joining"?h("joined"):p==="leaving"&&h("notJoined")},[d]);const g={},f={};return d&&p!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${mr}_leave`}),g["aria-label"]=s.formatMessage({id:`${mr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(_e,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&p!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${mr}_closed_tooltip`}):"",onClick:async b=>{if(u)return;b.currentTarget.blur(),h(d?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${mr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(v);const _=d?i:a;typeof _=="function"&&setTimeout(async()=>{await _()},500),m(!d)},className:G("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...g,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${mr}${["joining","leaving"].includes(p)?`_${p}`:d?"_member":n?"_short":""}`})})})};const _i="communityDetails_",Ip=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=se.useIntl(),u=5,d=a||i.length,m=i.length?i:Array(u).fill({}),p=`/communities/${r}/members`===window.location.pathname,h=t||n,g=!n&&!t;return c.jsxs("div",{className:G("community-details",e),children:[h&&c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[l.formatMessage({id:`${_i}members`}),c.jsx("span",{className:"count",children:d})]}),!p&&c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${_i}viewAll`})})})]}),c.jsx(no,{contributors:{total:a,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:d===0},cutoff:u})]}),c.jsx(so,{isMember:t,isOpen:n,disabled:g,functions:{...o}}),t&&c.jsx(_e,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${_i}invite`})})]})};const Rp=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=se.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Ie,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:G("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),c.jsxs("li",{children:[s&&c.jsx(Ie,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(dn,{href:s?void 0:i,...l,children:Jn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const $p=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=se.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=y.useState(t?["all"]:[]),u=(d,m)=>{let p=[];o.includes(d)?p=o.filter(h=>h!==d):d==="all"?p=["all"]:n?p=[...o.filter(h=>h!=="all"),d]:p=[d],l(h=>(r&&typeof r=="function"&&r({current:p,previous:h}),p)),m&&typeof m=="function"&&m()};return c.jsx("ul",{className:G("filters",a),children:s.map(({id:d,text:m,disabled:p=!1,callback:h=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:m})}),c.jsx("li",{children:c.jsx("button",{className:G(d,{selected:o.includes(d)}),onClick:f=>{f.preventDefault(),f.stopPropagation(),u(d,h)},...g,children:m})},d)})})},Lp=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let a="",i=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(a+=`/${s}`,i=!0):(a.includes(`/${r}/`)||(a+=`/${r}`),a+=`/${s}`)}),a.includes(`/${r}/`)||(a+=`/${r}`),t&&(a+=`/${t}`),i?{url:a,urlForRouter:`/${a.split("/").slice(2).join("/")}`}:a};const ta="languageSwitcher_",zp=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=se.useIntl(),{updateLanguage:d=()=>{}}=y.useContext(eo),[m,p]=y.useState(e);if(y.useEffect(()=>{e!==m&&p(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const g=Object.keys(r),f=m!==e;return c.jsxs("div",{className:G("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${ta}label`})}),c.jsx("ul",{children:g.map(b=>{var F;if(!Da[b])return null;const v=(F=r[b])==null?void 0:F.post_name;let _={className:b};if(m===b)_["aria-label"]=u.formatMessage({id:`${ta}selected`},{language:Da[b]});else{const x=Lp(b,v,i);_={..._,href:typeof x=="string"?x:x.url,onClick:w=>{p(b),d(b),typeof a<"u"&&(w.preventDefault(),w.stopPropagation(),a(b,typeof x=="string"?x:x.urlForRouter))}}}return c.jsx("li",{children:c.jsx(dn,{..._,fallbackElement:"span",children:Da[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${ta}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${ta}disclaimer`},{email:Wn.support,link:b=>{const v=`mailto:${b}`;return c.jsx("a",{href:v,children:b})}})})]})};const ki=se.createIntl({locale:"en",messages:ir}),Ur=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:a="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:ki.formatMessage({id:"loadMore_button"}),endOfFeed:ki.formatMessage({id:"loadMore_endOfFeed"}),error:ki.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,m]=y.useState(""),p=async h=>{if(!n)try{await t(h)}catch(g){g instanceof Error?m(g.message):m("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:G("load-more",l),children:!d&&e?c.jsx(_e,{variant:r,size:a,styling:i,icon:s,onClick:p,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const oo=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:G("logo",e,t,n),...r,children:c.jsx(Ie,{children:c.jsx(se.FormattedMessage,{id:"apolitical"})})})});let na=!1;const kd=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=se.useIntl(),i=y.useRef(null),[s,o]=y.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:i,className:G("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(_e,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:d,text:m,icon:p,...h},g)=>{const f={...h,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{na&&(clearTimeout(na),na=!1)},onBlur:()=>{na=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(_e,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...f,children:m})},`${window.btoa(m)}_${g}`)})})]})})},qp=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Wp=y.lazy(()=>Promise.resolve().then(()=>$m)),Up=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Fd=({activeLink:e,profile:t})=>{const n=se.useIntl(),r=y.useContext(mt),a=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Up.map(({key:i,href:s})=>{const o=qp(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:G(i,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${i}`})})},i)}),a&&t&&c.jsx(Wp,{element:"li",member:r,styling:{variant:"card",isCondensed:!1},functions:{profile:t},className:"profile gtm-trackable","data-testid":"profile-link",alt:"",gtmContext:"NavigationMenu",gtmType:"profile-click"})]})},pr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Hp=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${pr(t,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(e)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${pr(t,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(e)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${pr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
|
|
63
63
|
|
|
64
|
-
${pr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:pr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const Vp="shareLinks_",Kp=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=se.useIntl(),l=Hp({title:e,link:t,referrer:n});return c.jsxs("aside",{className:G("share-links",a,i,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:l.map(({key:u,icon:d,url:m,shouldRender:p=!0,onClick:h})=>{if(typeof p=="function"&&!p())return null;const g={};return h&&(g.onClick=f=>h(f,m)),c.jsx("li",{children:c.jsx(_e,{size:a,variant:"tertiary",icon:{icon:d||u},href:m,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${Vp}link_${u}`}),...g})},u)})})]})};const Zp=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(f,b,v)=>(f||(f=`panel-${window.btoa(b)}-${v}`),f),a=On(!0)||0;let i=e.findIndex(f=>f.current===!0);if(i<0&&(i=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(v=>v.id===f)){for(let v=0;v<e.length;v++)if(r(e[v].id,e[v].text,v)===f){i=v;break}}}const[s,o]=y.useState((g=e[i])!=null&&g.id?e[i].id:r(e[i].id,e[i].text,i)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let v=b;f.key==="ArrowLeft"?b>0?v=b-1:v=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?v=b+1:v=0);const _=r(e[v].id,e[v].text,v),F=document.getElementById(`tab-${_}`);F==null||F.focus(),u(_);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},m=f=>{let b=!1;return f.target==="min-width"&&a>=f.value&&(b=!0),f.target==="max-width"&&a<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const p=[],h=[];return e.forEach(({id:f,text:b,content:v,href:_,hasCarousel:F,breakpoint:x},w)=>{if(x&&!m(x))return;f=r(f,b,w);const B=s===f,S={};_||(S["aria-controls"]=f,S.onClick=z=>{z.preventDefault(),z.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},h.push(c.jsx("section",{id:f,hidden:!B,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":B?"assertive":"off",children:typeof v=="string"?c.jsx("p",{children:v}):v},`section-${f}`))),p.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:_||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:G({selected:B}),role:"tab",tabIndex:B?0:-1,"aria-selected":B,onKeyDown:z=>d(z,w),...S,children:b})},`tab-${f}`))}),c.jsxs("div",{className:G("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:p}),c.jsx("div",{className:"tab-content",children:h})]})};const Yp={"2-1":901,"1-3":769,"1-1":769},Bd=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=On(!0);let s=a;return y.Children.count(a)===1&&(s=y.Children.toArray(a)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:G("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Yp[e]?null:o)})};const uo=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=se.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:G("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":d?"":a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:a.formatMessage({id:i})}),n," / ",t]})}),c.jsx(Ie,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},ti=e=>(e==null?void 0:e.toString().length)||0,Ad=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{ti(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const ra="emailHelperTextBox_",Td=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=se.useIntl(),[s,o]=y.useState({path:`${ra}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=b=>{o({path:`${ra}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>d(v),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:b})};if(typeof a!="function"){f(i.formatMessage({id:`${ra}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let g=ra,f="default",b={},v={};switch(t){case"gov":g+="autoApproved",f="success";break;case"nonGov":g+="unrecognisedEmail",f="error",b={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",f="error",v={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",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:_=>d(_),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",b={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:g,type:f,link:b,mail:v})},[t]);const m={};return["link","mail"].forEach(g=>{m[g]=Object.keys(s[g]).length?f=>c.jsx("a",{...s[g],children:f}):f=>f}),c.jsx(nd,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),children:l?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{element:"span"}),c.jsx(Ft,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...m,strong:g=>c.jsx("strong",{children:g}),em:g=>c.jsx("em",{children:g}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Un=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,autoFocus:u,...d})=>{const m=y.useRef(),p=r||m;return y.useEffect(()=>{var h;u&&((h=p.current)==null||h.focus())},[]),!(d!=null&&d.autoComplete)&&["email"].includes(o)&&(d.autoComplete="email"),y.createElement(t,{ref:p,...d,type:o,id:n,name:i,className:G(e,t,{"has-scrollbar":o==="textarea"&&p.current&&p.current.clientHeight<p.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:h=>{const g=h.target;a.onChange(g.value)}})};const Rn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Gp=500,Qp=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:d},m]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:h,isPredictionSelected:g},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=se.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const x=setTimeout(()=>{g||m(w=>({...w,debouncedInput:l}))},Gp);return()=>{clearTimeout(x)}},[l,g]),y.useEffect(()=>{d&&!g?(async()=>{try{const w=await o(d)||[];f(B=>({...B,predictions:w}))}catch(w){console.error("Error fetching predictions:",w),f(B=>({...B,predictions:[]}))}})():f(x=>({...x,predictions:[]}))},[d,g]),y.useEffect(()=>{h>=0&&p[h]&&m(x=>({...x,displayInput:p[h].description}))},[h,p]);const v=x=>{[Rn.DOWN,Rn.UP,Rn.ENTER].includes(x.key)&&(x.preventDefault(),x.key===Rn.DOWN&&h<p.length-1?f(w=>({...w,activePredictionIndex:h+1})):x.key===Rn.UP&&h>0?f(w=>({...w,activePredictionIndex:h-1})):x.key===Rn.ENTER&&h>-1&&(s(p[h].description),m(w=>({...w,input:p[h].description})),f(w=>({...w,predictions:[],isPredictionSelected:!0}))))},_=x=>{s(x.target.value),m(w=>({...w,input:x.target.value,displayInput:x.target.value})),f(w=>({...w,activePredictionIndex:-1,isPredictionSelected:!1}))},F=x=>{s(x.description),m(w=>({...w,input:x.description,displayInput:x.description})),f(w=>({...w,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:_,onKeyDown:v,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:p.map((x,w)=>c.jsx("li",{onClick:()=>F(x),onMouseEnter:()=>f(B=>({...B,activePredictionIndex:w})),className:G("predictions-list-item",{active:w===h}),children:x.description},w))})]})};const Sd=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:d,...m})=>{const p=se.useIntl(),{onChange:h,...g}=r,f=()=>{t||h(d?null:l)},b=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:d,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),f())},readOnly:!0,disabled:t}),c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:a,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return y.createElement(n,{onClick:v=>{const _=v.target;_.nodeName.toLowerCase()==="a"||_.parentNode&&_.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),f())},className:G("checkbox-wrapper",e),...m,...g},b)};const Jp=y.memo(function({direction:t="down"}){return c.jsx(Ga,{className:G("rotating-chevron",`direction-${t}`)})});const Xp=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const d=se.useIntl(),[m,p]=y.useState(!1),h=r||n,g=Array.isArray(h)?[...h]:h?[h]:[],[f,b]=y.useState(g);let v;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?v=t&&f?t.find(S=>S.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?v=f[0]:v={id:"",label:""},y.useEffect(()=>{b(g)},[r,n]);const{onChange:_,onMultiSelectSubmit:F,...x}=a,w=S=>{if(o){let z=[];f!=null&&f.includes(S.id)?z=f.filter(N=>N!==S.id):z=[...f,S.id],b([...z]),_&&_([...z])}else b([S]),_&&_(S.id),p(!1)},B=S=>{if(S==="all"){const z=(t==null?void 0:t.map(N=>N.id))||[];b(z),_&&_(z)}else b([]),_&&_([])};return c.jsxs("div",{className:G("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":m,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),p(!m)},"data-testid":"dropdown-selector",...x,children:[o?`${s} · ${f.length}`:v.label,c.jsx(Jp,{direction:m?"up":"down"})]}),c.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const z=t&&t.find(N=>N.id===S.target.value);w(z)},hidden:!m,...x,children:t==null?void 0:t.map(S=>c.jsx("option",{value:S.id,className:"gtm-trackable","data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,children:S.label},S.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!m,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${f==null?void 0:f.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>B("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>B("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(S=>{const z=S.id===v.id||(f==null?void 0:f.includes(S))||(f==null?void 0:f.includes(S.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:G("gtm-trackable",{selected:z,"selected-single":z&&!o}),"data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,onClick:N=>{N.preventDefault(),N.stopPropagation(),w(S)},role:"menuitem","aria-current":z,"data-testid":z?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:G({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(_e,{variant:"secondary",onClick:()=>{F&&F(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),p(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})};const eg=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:d,...m})=>{const p=se.useIntl(),h=i?d:[],g=d;return c.jsx("ul",{...m,className:G("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:f,label:b=!1,value:v=f,disabled:_=!1})=>{const F=`${r}_${f}`,x=()=>{if(_)return;let w;if(i){const B=h==null?void 0:h.indexOf(v);Array.isArray(h)&&B>=0?(w=h,w.splice(B,1)):(!h||h.length===0?w=[]:w=h,w.push(v))}else w=g===v?void 0:v;t.onChange(w)};return c.jsx(Sd,{element:"li",id:F,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?h==null?void 0:h.includes(v):g===v,functions:{...t,onChange:x},intlPath:n,label:b||p.formatMessage({id:n?`${n}_${f}`:f}),disabled:_},F)})})};const tg=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=se.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,m]=y.useState(t),p=()=>{var h;u(!l),m(l?"password":"text"),(h=o.current)==null||h.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:G("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:p,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Un,{inputRef:o,type:d,autoComplete:r,...a})]})};const $n={text:{component:Un},email:{component:Un},url:{component:Un},textarea:{component:Un,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Sd},checkboxes:{component:eg,props:{multiSelect:!0}},select:{component:Xp},password:{component:tg},autocomplete:{component:Qp}},ng=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:d,...m})=>{const p=se.useIntl(),h=l&&l.some(({condition:I})=>I==="required"),g=ti(u),f=o&&$n[o]&&$n[o].component?$n[o].component:Un,b=o&&["checkboxes"].includes(o),v=o&&["autocomplete"].includes(o),_=r&&`error-${e}`,F=`character-limit-${e}`,x={};b?x.element="legend":x.htmlFor=e;let w={...m,id:e,name:e,className:r?"error":"",type:o,required:h,"aria-required":h,functions:xn(a),value:u};const B=I=>{w["aria-describedby"]?w["aria-describedby"]+=` ${I}`:w["aria-describedby"]=I};if(i>0){const I=Ad(i,a.onChange);B(`${F}-info`),w={...w,...I},I.functions&&typeof I.functions=="object"&&(w.functions={...w.functions,...I.functions})}o&&$n[o]&&$n[o].props&&(w={...w,...$n[o].props}),b&&(w.intlPath=`${t}_${e}`),r&&(w["aria-invalid"]=!0,w["aria-errormessage"]=_,B(_));const S=m.label||p.formatMessage({id:t?`${t}_${e}`:e}),z=({...I})=>r?y.createElement(I.as||"p",{id:_,className:"error text-small",...I},r):null;if(o&&["checkbox"].includes(o))return c.jsxs(c.Fragment,{children:[c.jsx(f,{...w,label:S,className:G("field-wrapper",n)}),c.jsx(z,{as:"p"})]});const N=I=>y.createElement(I.element||"label",{...I,className:"checkboxes-label text-small","data-testid":`label-${e}`});return c.jsx(c.Fragment,{children:y.createElement(b?"fieldset":"div",{className:G("field-wrapper text-medium",n)},c.jsxs(c.Fragment,{children:[y.createElement(b?"div":"p",{className:"field-label"},c.jsx(c.Fragment,{children:c.jsxs(N,{...x,children:[S,h&&s&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})})),y.createElement(b||v?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(f,{...w}),c.jsx(uo,{id:F,limit:i,valueLength:g})]})),c.jsx(z,{})]}))})},rg=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?xn(e.errors):{},i=e.values?xn(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:d}=r,m=xn(Object.keys(a));for(const p of s)if(p.validation)for(let h=0;h<p.validation.length;h++){const{condition:g="required",error:f=!1}=p.validation[h];let b=!1;if(typeof g=="function"){const v=g(i);v&&(b=f||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:p.id,value:b}}),m.push(p.id);break}}return m.length===0?l(i):u(i,m),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Fi=null;const Jt=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:m,...p})=>{const{customOnSubmit:h,hideButton:g,...f}=s,b=40,{shouldShowCancelButton:v=!1,shouldReset:_=!0,shouldHide:F=!0,showRequiredLabels:x=!0,showSuccessMessage:w=!1}=l||{},{onSuccess:B=async()=>{},onCancel:S=()=>{},onCatch:z=()=>{},onFailure:N=()=>{}}=m||{},I=se.useIntl(),M={};t.length&&t.forEach(T=>{const $=T.id||T.name;$&&(M[$]=T.value||"")});const[k,A]=y.useReducer(rg,{isSubmitting:!1,formSubmitted:!1,errors:{},values:M}),{errors:j,isSubmitting:L,formSubmitted:H,values:Y}=k;y.useEffect(()=>{_&&H&&(Fi=setTimeout(()=>{A({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[H]),y.useEffect(()=>()=>{Fi&&clearTimeout(Fi)},[]),y.useEffect(()=>{const T=$=>{A({type:"updateValue",payload:{key:$.detail.id,value:$.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",T),()=>{document.removeEventListener("dropdownMultiSelectSubmit",T)}},[]);const Q=y.useRef(null),re=a||Q;if(!t.length)return null;const C={};s.children&&(C.default=s.children),f.text&&typeof f.text=="string"&&(C.default=f.text),["default","submitting","submitted"].forEach(T=>{f.text&&typeof f.text!="string"&&T in f.text?C[T]=f.text[T]:C[T]||(C[T]=I.formatMessage({id:`form_${T==="default"?"submit":T}`}))}),delete f.text;const q=()=>{if(!L){if(A({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&A({type:"submitForm",payload:{fields:t,dispatch:A,intl:I}});return}A({type:"submitForm",payload:{fields:t,dispatch:A,onSuccess:async T=>{try{await B(T),A({type:_?"formSubmittedAndReset":"formSubmitted"})}catch($){z($),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(T,$)=>{N(T,$),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:I}})}},E=[{...f,icon:H?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:T=>{var U;if(T.preventDefault(),T.stopPropagation(),L)return;let $=0;if((U=re==null?void 0:re.current)!=null&&U.id){const ae=document.getElementById(re.current.id);ae&&($=ae.getBoundingClientRect().top+window.scrollY)}const R=document.getElementById("header");R&&($=$-R.offsetHeight-b),$<0&&($=0),window.scrollTo({top:$,behavior:"smooth"}),q()},disabled:L||H||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:C[L?"submitting":H?"submitted":"default"]}];return v&&E.unshift({...o,className:"gtm-trackable","data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:L||H,onClick:S,children:o.text||I.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...p,id:r,className:G("form",n),ref:re},c.jsxs(c.Fragment,{children:[j!=null&&j.general?c.jsx(fn,{variant:"error",text:I.formatMessage({id:"form_error_generalError"})}):null,u,(!F||!L&&!H||h)&&t.map((T,$)=>{const{id:R=T.name||$,component:U,functions:ae={onChange:()=>{}},submitOnEnter:J=!1}=T;if(U)return c.jsx(U,{...T.props||{}},`component-${R}-${$}`);const ie=(Y==null?void 0:Y[R])||"",de={...ae,onChange:X=>{A({type:"updateValue",payload:{key:R,value:X}}),ae.onChange(X&&X.toString(),A)}};return J&&(de.onKeyDown=X=>{X.key==="Enter"&&(X.stopPropagation(),X.preventDefault(),q()),ae.onKeyDown&&ae.onKeyDown(X)}),c.jsx(ng,{intlPath:i,...T,showRequiredLabels:x,value:ie,error:j==null?void 0:j[R],functions:de},R)}),g?null:(L||H)&&h?h:c.jsx(sr,{className:G("cta",{center:L||H,submitted:H}),buttons:E})]})),w&&H&&c.jsx(jr,{className:"success",children:typeof w=="string"?w:I.formatMessage({id:"form_success"})})]})};const aa="passwordRules_",jd="isMoreThanEightCharacters",Od="includesNumberAndSymbol",Pd="includesLowerAndUppercase",ag={[jd]:"8Characters",[Od]:"numberSymbol",[Pd]:"lowercaseUppercase"},ig=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=se.useIntl();return c.jsxs("aside",{className:G("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${aa}intro`})}),c.jsx("ul",{children:[jd,Od,Pd].map(r=>c.jsxs("li",{className:G({matches:e[r]}),children:[c.jsxs(Ie,{children:[n.formatMessage({id:`${aa}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${aa}rule_${ag[r]}`})}),!e[r]&&c.jsxs(Ie,{element:"strong",children:[" ",n.formatMessage({id:`${aa}notMet`})]})]},`rule-${r}`))})]})},Nd=y.memo(ig);const sg=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=se.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const v=await n();u(_=>({..._,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(_=>({..._,setUp:!0,disabled:!0})),a(v)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Ft,{className:"rating-placeholder"});const{id:m,rating:p,disabled:h}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},b=async v=>{if(!(!m||h))try{u(_=>({..._,rating:v,disabled:!0})),await r({id:m,value:v})}catch(_){u(F=>({...F,rating:null})),a(_)}finally{u(_=>({..._,disabled:!1}))}};return c.jsxs("div",{className:G("rating",i),children:[c.jsx("span",{className:"label",children:f[p?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const _=v+1;return c.jsx("li",{className:G({selected:p&&_<=p}),children:c.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:`star${!p||_>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:_,total:t})}${_===1||_===t?` - ${f[_===1?"low":"high"]}`:""}`,onClick:F=>{F.preventDefault(),F.stopPropagation(),b(_)},disabled:h})},`rating-${_}`)})})]})};function og(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}function Es(e,t){return Array(t+1).join(e)}function ug(e){return e.replace(/^\n*/,"")}function lg(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
64
|
+
${pr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:pr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const Vp="shareLinks_",Kp=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=se.useIntl(),l=Hp({title:e,link:t,referrer:n});return c.jsxs("aside",{className:G("share-links",a,i,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:l.map(({key:u,icon:d,url:m,shouldRender:p=!0,onClick:h})=>{if(typeof p=="function"&&!p())return null;const g={};return h&&(g.onClick=f=>h(f,m)),c.jsx("li",{children:c.jsx(_e,{size:a,variant:"tertiary",icon:{icon:d||u},href:m,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${Vp}link_${u}`}),...g})},u)})})]})};const Zp=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(f,b,v)=>(f||(f=`panel-${window.btoa(b)}-${v}`),f),a=On(!0)||0;let i=e.findIndex(f=>f.current===!0);if(i<0&&(i=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(v=>v.id===f)){for(let v=0;v<e.length;v++)if(r(e[v].id,e[v].text,v)===f){i=v;break}}}const[s,o]=y.useState((g=e[i])!=null&&g.id?e[i].id:r(e[i].id,e[i].text,i)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let v=b;f.key==="ArrowLeft"?b>0?v=b-1:v=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?v=b+1:v=0);const _=r(e[v].id,e[v].text,v),F=document.getElementById(`tab-${_}`);F==null||F.focus(),u(_);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},m=f=>{let b=!1;return f.target==="min-width"&&a>=f.value&&(b=!0),f.target==="max-width"&&a<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const p=[],h=[];return e.forEach(({id:f,text:b,content:v,href:_,hasCarousel:F,breakpoint:x},w)=>{if(x&&!m(x))return;f=r(f,b,w);const B=s===f,S={};_||(S["aria-controls"]=f,S.onClick=z=>{z.preventDefault(),z.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},h.push(c.jsx("section",{id:f,hidden:!B,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":B?"assertive":"off",children:typeof v=="string"?c.jsx("p",{children:v}):v},`section-${f}`))),p.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:_||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:G({selected:B}),role:"tab",tabIndex:B?0:-1,"aria-selected":B,onKeyDown:z=>d(z,w),...S,children:b})},`tab-${f}`))}),c.jsxs("div",{className:G("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:p}),c.jsx("div",{className:"tab-content",children:h})]})};const Yp={"2-1":901,"1-3":769,"1-1":769},Bd=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=On(!0);let s=a;return y.Children.count(a)===1&&(s=y.Children.toArray(a)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:G("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Yp[e]?null:o)})};const uo=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=se.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:G("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":d?"":a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:a.formatMessage({id:i})}),n," / ",t]})}),c.jsx(Ie,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},ti=e=>(e==null?void 0:e.toString().length)||0,Ad=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{ti(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const ra="emailHelperTextBox_",Td=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=se.useIntl(),[s,o]=y.useState({path:`${ra}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=b=>{o({path:`${ra}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>d(v),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:b})};if(typeof a!="function"){f(i.formatMessage({id:`${ra}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let g=ra,f="default",b={},v={};switch(t){case"gov":g+="autoApproved",f="success";break;case"nonGov":g+="unrecognisedEmail",f="error",b={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",f="error",v={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",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:_=>d(_),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",b={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:g,type:f,link:b,mail:v})},[t]);const m={};return["link","mail"].forEach(g=>{m[g]=Object.keys(s[g]).length?f=>c.jsx("a",{...s[g],children:f}):f=>f}),c.jsx(nd,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),children:l?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{element:"span"}),c.jsx(Ft,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...m,strong:g=>c.jsx("strong",{children:g}),em:g=>c.jsx("em",{children:g}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Un=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,autoFocus:u,...d})=>{const m=y.useRef(),p=r||m;return y.useEffect(()=>{var h;u&&((h=p.current)==null||h.focus())},[]),!(d!=null&&d.autoComplete)&&["email"].includes(o)&&(d.autoComplete="email"),y.createElement(t,{ref:p,...d,type:o,id:n,name:i,className:G(e,t,{"has-scrollbar":o==="textarea"&&p.current&&p.current.clientHeight<p.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:h=>{const g=h.target;a.onChange(g.value)}})};const Rn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Gp=500,Qp=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:d},m]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:h,isPredictionSelected:g},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=se.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const x=setTimeout(()=>{g||m(w=>({...w,debouncedInput:l}))},Gp);return()=>{clearTimeout(x)}},[l,g]),y.useEffect(()=>{d&&!g?(async()=>{try{const w=await o(d)||[];f(B=>({...B,predictions:w}))}catch(w){console.error("Error fetching predictions:",w),f(B=>({...B,predictions:[]}))}})():f(x=>({...x,predictions:[]}))},[d,g]),y.useEffect(()=>{h>=0&&p[h]&&m(x=>({...x,displayInput:p[h].description}))},[h,p]);const v=x=>{[Rn.DOWN,Rn.UP,Rn.ENTER].includes(x.key)&&(x.preventDefault(),x.key===Rn.DOWN&&h<p.length-1?f(w=>({...w,activePredictionIndex:h+1})):x.key===Rn.UP&&h>0?f(w=>({...w,activePredictionIndex:h-1})):x.key===Rn.ENTER&&h>-1&&(s(p[h].description),m(w=>({...w,input:p[h].description})),f(w=>({...w,predictions:[],isPredictionSelected:!0}))))},_=x=>{s(x.target.value),m(w=>({...w,input:x.target.value,displayInput:x.target.value})),f(w=>({...w,activePredictionIndex:-1,isPredictionSelected:!1}))},F=x=>{s(x.description),m(w=>({...w,input:x.description,displayInput:x.description})),f(w=>({...w,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:_,onKeyDown:v,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:p.map((x,w)=>c.jsx("li",{onClick:()=>F(x),onMouseEnter:()=>f(B=>({...B,activePredictionIndex:w})),className:G("predictions-list-item",{active:w===h}),children:x.description},w))})]})};const Sd=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:d,...m})=>{const p=se.useIntl(),{onChange:h,...g}=r,f=()=>{t||h(d?null:l)},b=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:d,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),f())},readOnly:!0,disabled:t}),c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:a,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return y.createElement(n,{onClick:v=>{const _=v.target;_.nodeName.toLowerCase()==="a"||_.parentNode&&_.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),f())},className:G("checkbox-wrapper",e),...m,...g},b)};const Jp=y.memo(function({direction:t="down"}){return c.jsx(Ga,{className:G("rotating-chevron",`direction-${t}`)})});const Xp=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const d=se.useIntl(),[m,p]=y.useState(!1),h=r||n,g=Array.isArray(h)?[...h]:h?[h]:[],[f,b]=y.useState(g);let v;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?v=t&&f?t.find(S=>S.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?v=f[0]:v={id:"",label:""},y.useEffect(()=>{b(g)},[r,n]);const{onChange:_,onMultiSelectSubmit:F,...x}=a,w=S=>{if(o){let z=[];f!=null&&f.includes(S.id)?z=f.filter(N=>N!==S.id):z=[...f,S.id],b([...z]),_&&_([...z])}else b([S]),_&&_(S.id),p(!1)},B=S=>{if(S==="all"){const z=(t==null?void 0:t.map(N=>N.id))||[];b(z),_&&_(z)}else b([]),_&&_([])};return c.jsxs("div",{className:G("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":m,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),p(!m)},"data-testid":"dropdown-selector",...x,children:[o?`${s} · ${f.length}`:v.label,c.jsx(Jp,{direction:m?"up":"down"})]}),c.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const z=t&&t.find(N=>N.id===S.target.value);w(z)},hidden:!m,...x,children:t==null?void 0:t.map(S=>c.jsx("option",{value:S.id,className:"gtm-trackable","data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,children:S.label},S.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!m,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${f==null?void 0:f.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>B("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>B("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(S=>{const z=S.id===v.id||(f==null?void 0:f.includes(S))||(f==null?void 0:f.includes(S.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:G("gtm-trackable",{selected:z,"selected-single":z&&!o}),"data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,onClick:N=>{N.preventDefault(),N.stopPropagation(),w(S)},role:"menuitem","aria-current":z,"data-testid":z?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:G({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(_e,{variant:"secondary",onClick:()=>{F&&F(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),p(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})};const eg=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:d,...m})=>{const p=se.useIntl(),h=i?d:[],g=d;return c.jsx("ul",{...m,className:G("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:f,label:b=!1,value:v=f,disabled:_=!1})=>{const F=`${r}_${f}`,x=()=>{if(_)return;let w;if(i){const B=h==null?void 0:h.indexOf(v);Array.isArray(h)&&B>=0?(w=h,w.splice(B,1)):(!h||h.length===0?w=[]:w=h,w.push(v))}else w=g===v?void 0:v;t.onChange(w)};return c.jsx(Sd,{element:"li",id:F,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?h==null?void 0:h.includes(v):g===v,functions:{...t,onChange:x},intlPath:n,label:b||p.formatMessage({id:n?`${n}_${f}`:f}),disabled:_},F)})})};const tg=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=se.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,m]=y.useState(t),p=()=>{var h;u(!l),m(l?"password":"text"),(h=o.current)==null||h.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:G("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:p,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Un,{inputRef:o,type:d,autoComplete:r,...a})]})};const $n={text:{component:Un},email:{component:Un},url:{component:Un},textarea:{component:Un,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Sd},checkboxes:{component:eg,props:{multiSelect:!0}},select:{component:Xp},password:{component:tg},autocomplete:{component:Qp}},ng=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:d,...m})=>{const p=se.useIntl(),h=l&&l.some(({condition:I})=>I==="required"),g=ti(u),f=o&&$n[o]&&$n[o].component?$n[o].component:Un,b=o&&["checkboxes"].includes(o),v=o&&["autocomplete"].includes(o),_=r&&`error-${e}`,F=`character-limit-${e}`,x={};b?x.element="legend":x.htmlFor=e;let w={...m,id:e,name:e,className:r?"error":"",type:o,required:h,"aria-required":h,functions:xn(a),value:u};const B=I=>{w["aria-describedby"]?w["aria-describedby"]+=` ${I}`:w["aria-describedby"]=I};if(i>0){const I=Ad(i,a.onChange);B(`${F}-info`),w={...w,...I},I.functions&&typeof I.functions=="object"&&(w.functions={...w.functions,...I.functions})}o&&$n[o]&&$n[o].props&&(w={...w,...$n[o].props}),b&&(w.intlPath=`${t}_${e}`),r&&(w["aria-invalid"]=!0,w["aria-errormessage"]=_,B(_));const S=m.label||p.formatMessage({id:t?`${t}_${e}`:e}),z=({...I})=>r?y.createElement(I.as||"p",{id:_,className:"error text-small",...I},r):null;if(o&&["checkbox"].includes(o))return c.jsxs(c.Fragment,{children:[c.jsx(f,{...w,label:S,className:G("field-wrapper",n)}),c.jsx(z,{as:"p"})]});const N=I=>y.createElement(I.element||"label",{...I,className:"checkboxes-label text-small","data-testid":`label-${e}`});return c.jsx(c.Fragment,{children:y.createElement(b?"fieldset":"div",{className:G("field-wrapper text-medium",n)},c.jsxs(c.Fragment,{children:[y.createElement(b?"div":"p",{className:"field-label"},c.jsx(c.Fragment,{children:c.jsxs(N,{...x,children:[S,h&&s&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})})),y.createElement(b||v?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(f,{...w}),c.jsx(uo,{id:F,limit:i,valueLength:g})]})),c.jsx(z,{})]}))})},rg=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?xn(e.errors):{},i=e.values?xn(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:d}=r,m=xn(Object.keys(a));for(const p of s)if(p.validation)for(let h=0;h<p.validation.length;h++){const{condition:g="required",error:f=!1}=p.validation[h];let b=!1;if(typeof g=="function"){const v=g(i);v&&(b=f||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:p.id,value:b}}),m.push(p.id);break}}return m.length===0?l(i):u(i,m),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Fi=null;const Jt=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:m,...p})=>{const{customOnSubmit:h,hideButton:g,...f}=s,b=40,{shouldShowCancelButton:v=!1,shouldReset:_=!0,shouldHide:F=!0,showRequiredLabels:x=!0,showSuccessMessage:w=!1}=l||{},{onSuccess:B=async()=>{},onCancel:S=()=>{},onCatch:z=()=>{},onFailure:N=()=>{}}=m||{},I=se.useIntl(),M={};t.length&&t.forEach(T=>{const $=T.id||T.name;$&&(M[$]=T.value||"")});const[k,A]=y.useReducer(rg,{isSubmitting:!1,formSubmitted:!1,errors:{},values:M}),{errors:j,isSubmitting:L,formSubmitted:H,values:Y}=k;y.useEffect(()=>{_&&H&&(Fi=setTimeout(()=>{A({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[H]),y.useEffect(()=>()=>{Fi&&clearTimeout(Fi)},[]),y.useEffect(()=>{const T=$=>{A({type:"updateValue",payload:{key:$.detail.id,value:$.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",T),()=>{document.removeEventListener("dropdownMultiSelectSubmit",T)}},[]);const Q=y.useRef(null),re=a||Q;if(!t.length)return null;const C={};s.children&&(C.default=s.children),f.text&&typeof f.text=="string"&&(C.default=f.text),["default","submitting","submitted"].forEach(T=>{f.text&&typeof f.text!="string"&&T in f.text?C[T]=f.text[T]:C[T]||(C[T]=I.formatMessage({id:`form_${T==="default"?"submit":T}`}))}),delete f.text;const q=()=>{if(!L){if(A({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&A({type:"submitForm",payload:{fields:t,dispatch:A,intl:I}});return}A({type:"submitForm",payload:{fields:t,dispatch:A,onSuccess:async T=>{try{await B(T),A({type:_?"formSubmittedAndReset":"formSubmitted"})}catch($){z($),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(T,$)=>{N(T,$),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:I}})}},E=[{...f,icon:H?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:T=>{var U;if(T.preventDefault(),T.stopPropagation(),L)return;let $=0;if((U=re==null?void 0:re.current)!=null&&U.id){const ae=document.getElementById(re.current.id);ae&&($=ae.getBoundingClientRect().top+window.scrollY)}const R=document.getElementById("header");R&&($=$-R.offsetHeight-b),$<0&&($=0),window.scrollTo({top:$,behavior:"smooth"}),q()},disabled:L||H||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:C[L?"submitting":H?"submitted":"default"]}];return v&&E.unshift({...o,className:"gtm-trackable","data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:L||H,onClick:S,children:o.text||I.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...p,id:r,className:G("form",n),ref:re},c.jsxs(c.Fragment,{children:[j!=null&&j.general?c.jsx(fn,{variant:"error",text:I.formatMessage({id:"form_error_generalError"})}):null,u,(!F||!L&&!H||h)&&t.map((T,$)=>{const{id:R=T.name||$,component:U,functions:ae={onChange:()=>{}},submitOnEnter:J=!1}=T;if(U)return c.jsx(U,{...T.props||{}},`component-${R}-${$}`);const ie=(Y==null?void 0:Y[R])||"",de={...ae,onChange:X=>{A({type:"updateValue",payload:{key:R,value:X}}),ae.onChange(X&&X.toString(),A)}};return J&&(de.onKeyDown=X=>{X.key==="Enter"&&(X.stopPropagation(),X.preventDefault(),q()),ae.onKeyDown&&ae.onKeyDown(X)}),c.jsx(ng,{intlPath:i,...T,showRequiredLabels:x,value:ie,error:j==null?void 0:j[R],functions:de},R)}),g?null:(L||H)&&h?h:c.jsx(sr,{className:G("cta",{center:L||H,submitted:H}),buttons:E})]})),w&&H&&c.jsx(jr,{className:"success",children:typeof w=="string"?w:I.formatMessage({id:"form_success"})})]})};const aa="passwordRules_",jd="isMoreThanEightCharacters",Od="includesNumberAndSymbol",Pd="includesLowerAndUppercase",ag={[jd]:"8Characters",[Od]:"numberSymbol",[Pd]:"lowercaseUppercase"},ig=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=se.useIntl();return c.jsxs("aside",{className:G("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${aa}intro`})}),c.jsx("ul",{children:[jd,Od,Pd].map(r=>c.jsxs("li",{className:G({matches:e[r]}),children:[c.jsxs(Ie,{children:[n.formatMessage({id:`${aa}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${aa}rule_${ag[r]}`})}),!e[r]&&c.jsxs(Ie,{element:"strong",children:[" ",n.formatMessage({id:`${aa}notMet`})]})]},`rule-${r}`))})]})},Nd=y.memo(ig);const sg=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=se.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const v=await n();u(_=>({..._,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(_=>({..._,setUp:!0,disabled:!0})),a(v)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Ft,{className:"rating-placeholder"});const{id:m,rating:p,disabled:h}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},b=async v=>{if(!(!m||h))try{u(_=>({..._,rating:v,disabled:!0})),await r({id:m,value:v})}catch(_){u(F=>({...F,rating:null})),a(_)}finally{u(_=>({..._,disabled:!1}))}};return c.jsxs("div",{className:G("rating",i),children:[c.jsx("span",{className:"label",children:f[p?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const _=v+1;return c.jsx("li",{className:G({selected:p&&_<=p}),children:c.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:`star${!p||_>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:_,total:t})}${_===1||_===t?` - ${f[_===1?"low":"high"]}`:""}`,onClick:F=>{F.preventDefault(),F.stopPropagation(),b(_)},disabled:h})},`rating-${_}`)})})]})};function og(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}function Es(e,t){return Array(t+1).join(e)}function ug(e){return e.replace(/^\n*/,"")}function lg(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
65
65
|
`;)t--;return e.substring(0,t)}var cg=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function lo(e){return co(e,cg)}var Md=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Id(e){return co(e,Md)}function dg(e){return $d(e,Md)}var Rd=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function fg(e){return co(e,Rd)}function hg(e){return $d(e,Rd)}function co(e,t){return t.indexOf(e.nodeName)>=0}function $d(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var at={};at.paragraph={filter:"p",replacement:function(e){return`
|
|
66
66
|
|
|
67
67
|
`+e+`
|
|
@@ -160,6 +160,6 @@ ${h}${m?"1.":"-"} ${u}${p?`
|
|
|
160
160
|
`;case o[Z.hr]:return`---
|
|
161
161
|
`;default:return u}}function qn(e,t){const n=e.trim(),r=n,a=`${t}${r}${Dc(t)}`;if(r.length===e.length)return a;const i=t+r+Dc(t);return e.replace(n,i)}const Dc=e=>e.split("").reverse().join(""),sw=e=>e.map(t=>eh(t)).join("").trim();const ow=({onFallbackClick:e=()=>{}})=>{const t=se.useIntl(),n=Nn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(en),{show:l,selectedUser:u,possibleUsers:d}=i,m=Mf(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const p=Xf(a);return c.jsx(Wr,{parent:p,children:c.jsx(Xc,{ref:m,className:"mention-popover",onKeyDown:h=>{h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:h,user:g},f)=>c.jsx(Yt,{element:"li",className:G({selected:f===u}),member:{id:h,...g,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const v={...i,selectedUser:f};r([{type:"mentionPopover",value:v}]),Jf(n,v,r,s),o&&o({id:h||"",name:g.name||""})}}},h)),c.jsx(Yt,{element:"li",className:G("fallback",{selected:d.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${zt}icons/invite-user.svg`},link:!1},functions:{onClick:h=>{h.preventDefault(),h.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})},Po=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=se.useIntl(),l=Nn(),{id:u,tabbableOption:d,setFocus:m,openTooltip:p,dispatch:h}=y.useContext(en),g={};return e!==d&&(g.tabIndex=-1),c.jsxs("li",{id:`${u}-${e}`,className:G(e,{"has-divider":n}),onMouseEnter:()=>{h([{type:"openTooltip",value:e}])},onMouseLeave:()=>{h([{type:"openTooltip",value:null}])},onFocus:()=>{h([{type:"openTooltip",value:e}])},onBlur:f=>{f.stopPropagation();const b=[{type:"openTooltip",value:null}];l.selection&&b.push({type:"lastAnchor",value:l.selection.anchor}),h(b)},contentEditable:!1,children:[c.jsxs("button",{...s,...g,className:G(e,a,{active:t}),onClick:f=>{f.stopPropagation(),f.preventDefault()},onMouseDown:f=>{f.stopPropagation(),f.preventDefault(),r()},onKeyDown:f=>{var b,v,_,F;if(f.key!=="Tab")switch(f.key){case"Enter":f.stopPropagation(),f.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":f.stopPropagation(),f.preventDefault();const x=f.currentTarget.closest("li");let w=x==null?void 0:x.nextElementSibling;if(f.key==="ArrowLeft"){const z=x==null?void 0:x.previousElementSibling;z?w=z:w=(b=x==null?void 0:x.parentElement)==null?void 0:b.lastElementChild}else w||(w=(v=x==null?void 0:x.parentElement)==null?void 0:v.firstElementChild);const B=w==null?void 0:w.className.split(" ")[0];B&&(m(B),(_=w==null?void 0:w.querySelector("button"))==null||_.focus());break;default:const S=f.currentTarget.closest("fieldset");if(S){(F=S==null?void 0:S.previousElementSibling)==null||F.focus();break}}},children:[c.jsx(Ie,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(Pn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Cc=[Z.ol,Z.ul],th=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(D.nodes(e,{at:D.unhangRange(e,n),match:a=>{const i=a;return!D.isEditor(a)&&ce.isElement(a)&&i.type===t}}));return!!r},uw=e=>{const[t]=D.nodes(e,{match:n=>n.type===Z.blockquote});return!!t},nh=(e,t,n)=>{try{const r=uw(e),a=th(e,t),i=Cc.includes(t);ee.unwrapNodes(e,{match:l=>{const u=l;return!D.isEditor(u)&&ce.isElement(u)&&Cc.includes(u.type)},split:!0});const o={type:a?Z.paragraph:i?Z.li:t};if(ee.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=D.parent(e,l,{edge:"end"});Array.from(D.nodes(e,{at:d,match:p=>{const h=p;return!D.isEditor(p)&&ce.isElement(p)&&h.type===Z.li}})).forEach(([p,h])=>{ue.string(p).trim()===""&&ee.removeNodes(e,{at:h})})}else{if(r){const u={type:Z.blockquote,children:[]};ee.wrapNodes(e,u)}const l={type:t,children:[]};ee.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},lw=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(en),a=Nn(),i=th(a,e);return c.jsx(Po,{id:e,active:i,hasDivider:t,callback:()=>{nh(a,e,r),n(i?null:e)}})},Br=e=>{const[t]=D.nodes(e,{match:n=>{const r=n;return!D.isEditor(n)&&ce.isElement(n)&&r.type===Z.link}});return!!t},cw=(e,t,n,r)=>{e.selection&&No(e,t,n,r)},dw=(e,t,n,r)=>{const{selection:a}=e;if(a&&V.isCollapsed(a)){const[s]=D.nodes(e,{match:o=>{const l=o;return!D.isEditor(o)&&ce.isElement(o)&&l.type===Z.link}});if(s){const[o,l]=s,u={link:t};ee.setNodes(e,u,{at:l}),Oo(n)}}else No(e,t,n,r)},No=(e,t,n,r=a=>{console.error(a)})=>{try{Br(e)&&rh(e);const{selection:a}=e,i=a&&V.isCollapsed(a),s={type:Z.link,link:t,children:i?[{text:t}]:[]};i?(ee.insertNodes(e,s),ee.move(e,{distance:1,unit:"offset"})):(ee.wrapNodes(e,s,{split:!0}),ee.collapse(e,{edge:"end"}),ee.insertNodes(e,{text:""}),ee.move(e,{distance:1,unit:"offset"})),Oo(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},rh=e=>{ee.unwrapNodes(e,{match:t=>{const n=t;return!D.isEditor(t)&&ce.isElement(t)&&n.type===Z.link}})};let Xi=null;const fw=()=>{const e=se.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,dispatch:i,reportError:s}=y.useContext(en),o=Nn(),l=_D(o),u=(l==null?void 0:l.text)||nw(o),[d,m]=y.useState(Br(o)),p=Mf(o,"link-editor",`${n}-link`),h=y.useRef(null);y.useEffect(()=>{var _;!d&&r&&((_=h.current)==null||_.focus())},[d]),y.useEffect(()=>{Xi&&clearTimeout(Xi),Xi=setTimeout(()=>{m(Br(o))},500)},[o.selection]);const g=[],f=["open","edit","remove"].map(_=>{const F={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${_}`},{link:l==null?void 0:l.pretty})};switch(g.push({className:_}),_){case"open":F.href=(l==null?void 0:l.full)||"",F.onClick=x=>{x.preventDefault(),x.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),i([{type:"showLinkEditor",value:!1}])},F.children=c.jsxs(c.Fragment,{children:[F.children,c.jsx(Ie,{children:e.formatMessage({id:`${t}${_}_text`})})]});break;case"edit":F.onClick=()=>{m(!1)};break;case"remove":F.onClick=()=>{const x=[{type:"showLinkEditor",value:!1}];Br(o)&&(rh(o),x.push({type:"lastAnchor",value:null})),i(x)};break}return F}),b=[{id:"url",type:"url",inputRef:h,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(l==null?void 0:l.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];u&&b.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",u]})});const v=Xf(a);return c.jsx(Wr,{parent:v,children:c.jsx(Pn,{ref:p,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!d},functions:{onBlur:()=>{i([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var _;return(_=h.current)==null?void 0:_.focus()})}},children:d?c.jsx(sr,{wrappers:g,buttons:f}):c.jsx(Jt,{element:"fieldset",id:`${n}-link-editor`,className:G({"show-labels":u}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async _=>{setTimeout(()=>{const F=[{type:"showLinkEditor",value:!1}];if(_.url){const{full:x}=Qc(_.url);l!=null&&l.full?dw(o,x,n,s):cw(o,x,n,s),F.push({type:"lastAnchor",value:null})}i(F)})}},fields:b,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},hw=()=>{const e=Nn(),{setFocus:t,dispatch:n}=y.useContext(en),[r,a]=y.useState(!1);return y.useEffect(()=>{a(Br(e))},[e.selection]),c.jsx(Po,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},mw=e=>[Z.bold,Z.italic,Z.strikethrough].includes(e),ah=(e,t)=>{const n=D.marks(e);return n?n[t]===!0:!1},ih=(e,t,n)=>{try{ah(e,t)?D.removeMark(e,t):D.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},pw=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(en),a=Nn(),i=ah(a,e);return c.jsx(Po,{id:e,active:i,hasDivider:t,callback:()=>{ih(a,e,r),n(i?null:e)}})},qa=[Z.bold,Z.italic,Z.strikethrough],gw=[Z.ol,Z.ul,Z.blockquote];const vw=({...e})=>{const t=se.useIntl(),{id:n}=y.useContext(en);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[c.jsx(Ie,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[qa.map((r,a)=>c.jsx(pw,{format:r,hasDivider:a===qa.length-1},r)),c.jsx(hw,{}),gw.map((r,a)=>c.jsx(lw,{format:r,hasDivider:a===1},r))]})]}),c.jsx(fw,{})]})};var bw=xw,yw=/^(?:\w+:)?\/\/(\S+)$/,Dw=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,Cw=/^[^\s\.]+\.\S{2,}$/;function xw(e){if(typeof e!="string")return!1;var t=e.match(yw);if(!t)return!1;var n=t[1];return n?!!(Dw.test(n)||Cw.test(n)):!1}const ww=jn(bw),Ew=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[Z.link].includes(s.type)||a(i)},e.insertText=i=>{i&&ww(i)?No(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},_w=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===Z.mention?!0:n(i),e.isVoid=i=>i.type===Z.mention?!0:r(i),e.markableVoid=i=>i.type===Z.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},kw=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===Z.link&&ue.string(r).trim()===""){ee.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const sh=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,...l})=>{const u=se.useIntl(),d=nm();typeof s>"u"&&(s=!0);const{isInOverlay:m=!1}=a||{},{listMembers:p,clickMentionFallback:h,onChange:g=()=>{},onMention:f=()=>{},reportError:b=q=>{console.error(q)}}=i||{},v=[{type:Z.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const _={editorKey:null,originalValue:t||"",initialValue:t?null:v,tabbableOption:qa[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[F,x]=y.useReducer(qr,_),{editorKey:w,originalValue:B,initialValue:S,stringValue:z,lastAnchor:N,lastKey:I,hasInteracted:M,hasLoaded:k,mentionPopover:A}=F,j=q=>{const K=q||qa[0];q&&x([{type:"tabbableOption",value:K}])},L=`rte-${e}`,H=y.useCallback(q=>c.jsx(wD,{...q}),[]),Y=y.useCallback(q=>c.jsx(ED,{...q}),[]),Q=y.useMemo(()=>Ew(_w(kw(cb(CD(ub())),b),b),L,b),[]);y.useEffect(()=>{if(!t)return;Sr.lastIndex=0;const q=t.match(Sr);!q||q.length>1||q[0].length!==t.length||M||x([{type:"originalValue",value:t}])},[t]);const re=q=>{if(!Q||q!==L)return;const K=D.end(Q,[]);ee.select(Q,K),te.focus(Q)};y.useEffect(()=>{const q=K=>{var $;const E=K,T=(($=E==null?void 0:E.detail)==null?void 0:$.id)||null;T&&re(T)};return window.addEventListener("focusEditor",q),()=>{window.removeEventListener("focusEditor",q)}},[]),y.useEffect(()=>{if(Q.children.length>0&&!k){if(x([{type:"hasLoaded",value:!0}]),!s)return;re(L)}},[Q.children.length,S]),y.useEffect(()=>{B&&(async()=>{let K=xn(B);if(K.includes("<")){Or.prototype.escape=T=>T;const E=new Or;E.addRule("br",{filter:["br"],replacement:T=>T+`
|
|
162
162
|
|
|
163
|
-
`}),K=E.turndown(K)}o&&o.mentions&&(K=await Gc({text:K,template:`[${$s}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),ew(K,E=>{x([{type:"initialValue",value:E},{type:"editorKey",value:B.toString()}]),setTimeout(()=>{x([{type:"stringValue",value:vc(Q)}])},150)})})()},[B]),y.useEffect(()=>{t!==""||!Q||hs(B,t)&&!M||(D.withoutNormalizing(Q,()=>{ee.delete(Q,{at:{anchor:D.start(Q,[]),focus:D.end(Q,[])}}),ee.deselect(Q),Q.children.length!==0&&ee.unwrapNodes(Q,{at:[0]}),ee.insertNodes(Q,v,{at:[0]})}),x([{type:"initialValue",value:v},{type:"lastAnchor",value:null}]))},[t]);const C=Rc(()=>{aw({editor:Q,isShowing:A.show,numberOfUsers:A.numberOfUsers,listMembers:p,dispatch:x})},100);return S?c.jsx("div",{id:L,className:"rich-text-editor",children:c.jsxs(en.Provider,{value:{...F,id:L,isInOverlay:m,setFocus:j,dispatch:x,onMention:f,reportError:b},children:[c.jsxs(yD,{editor:Q,initialValue:S,onChange:q=>{if(Q.operations.some(E=>E.type!=="set_selection")){const E=sw(q);g(E),x([{type:"stringValue",value:vc(Q)}]),M||x([{type:"hasInteracted",value:!0}]),C(),d&&console.log({serialized:E,json:q})}},...l,children:[c.jsx(cD,{className:"input",renderElement:H,renderLeaf:Y,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onKeyDown:q=>{if(q.key==="Enter"){A.show&&(q.preventDefault(),q.stopPropagation(),Jf(Q,A,x,L));const{selection:K}=Q;if(K){const E=V.isCollapsed(K),[T,$]=D.node(Q,K,{depth:1});let R=T,U=R.type;const ae=R.children[0];if(ae&&[Z.ol,Z.ul].includes(ae.type)&&(R=ae,U=ae.type),R&&ce.isElement(R)&&U!==Z.paragraph){if(U===Z.blockquote&&!q.shiftKey){q.stopPropagation(),q.preventDefault(),ee.insertNodes(Q,v);return}if(E){const[J,ie]=D.parent(Q,K,{edge:"end"}),X=J.type;if([Z.ul,Z.ol].includes(U))if(q.stopPropagation(),q.preventDefault(),X===Z.li&&I==="Enter"){J.children.length===1&&"text"in J.children[0]&&J.children[0].text===""&&ee.removeNodes(Q,{at:ie}),ee.insertNodes(Q,v,{at:P.next($)}),ee.select(Q,D.end(Q,P.next($)));return}else{const[ye,me]=tw(Q,Z.li),xe={type:Z.li,children:[{text:""}]};ee.insertNodes(Q,xe,{at:P.next(me)}),ee.select(Q,D.end(Q,P.next(me)))}}}}}else if(q.key==="Escape"){if(A.show){q.preventDefault(),q.stopPropagation(),x([{type:"mentionPopover",value:{...A,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(q.key)&&A.show){q.preventDefault(),q.stopPropagation();const{selectedUser:K,possibleUsers:E}=A;let T=q.key==="ArrowUp"?K-1:K+1;T<0&&(T=E.length-1),T>=E.length+1&&(T=0),x([{type:"mentionPopover",value:{...A,selectedUser:T}}])}x([{type:"lastKey",value:q.key}]),rw(q,Q,x,b)},onBlur:()=>{Q.selection&&x([{type:"lastAnchor",value:Q.selection.anchor}])},onFocus:()=>{if(N){if(!P.isPath(N.path)||!ue.has(Q,N.path))return;const q=ue.get(Q,N.path);let K=0;if(fe.isText(q)?K=q.text.length:q.children&&(K=q.children.length),N.offset>K)return;try{ee.select(Q,{anchor:N,focus:N})}catch(E){const T=E.message;b(`Error focusing editor: ${T}`)}}}}),c.jsx(vw,{}),p?c.jsx(ow,{onFallbackClick:h}):null]},w),c.jsx(uo,{id:`character-limit-${e}`,limit:r,valueLength:ti(z)})]})}):c.jsx(c.Fragment,{})};const Fw=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:G("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:G("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const m=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:m,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:m,children:d.label})]},m)})})]})};function oh({className:e="",userId:t,userName:n,src:r,uploadImage:a,button:i,callback:s}){const o=se.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[m,p]=y.useState(!1),[h,g]=y.useState(!1),f=y.useRef(null),b=async x=>{p(!0),g(!1);try{const w=x.target.files&&x.target.files[0];if(!w||!t)throw p(!1),new Error("Image file or userID is missing");const B=await a({fileObject:w,userId:t}),S={thumbnail:B.thumbnailURL,full:B.originalURL};d(S),s(S)}catch{g(!0)}finally{p(!1)}p(!1)},{upload:v=o.formatMessage({id:`${l}cta_upload`}),change:_=o.formatMessage({id:`${l}cta_change`}),uploading:F=o.formatMessage({id:`${l}cta_uploading`})}=(i==null?void 0:i.text)||{};return c.jsxs("div",{className:G("profile-image-change-figure",e),children:[c.jsx(hn,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),h&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(_e,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:m,children:m?F:u?_:v})]})}const uh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(Jt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const lh=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[d,m]=y.useState([]),[p,h]=y.useState(!0),[g,f]=y.useState(u),{formatMessage:b}=se.useIntl(),v=async x=>{x.preventDefault();try{await l(d),m([]),f("SUCCESS")}catch(w){f("ERROR"),o(w)}},_=x=>{x.preventDefault(),f("NOT_SUBMITTED"),h(!0),m([])},F=x=>{x.preventDefault(),s(),f("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:g==="SUCCESS"?c.jsx("h2",{className:"success-title",children:b({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",b({id:"inviteForm_error"})]})}),c.jsx(qt,{}),c.jsx("div",{className:"footer",children:g==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(_e,{variant:"secondary",onClick:_,children:b({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(_e,{onClick:F,children:b({id:"inviteForm_ctaDone"})})]}):c.jsx(_e,{onClick:_,children:b({id:"inviteForm_ctaTryAgain"})})})]}):c.jsx("div",{className:"invite-form-wrapper",children:c.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:G("invite-form gtm-trackable"),children:[c.jsxs("fieldset",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:r},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),c.jsx(qh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:b({id:"inviteForm_email_placeholder"}),emails:d,onChange:x=>{m(x),h(!x.length)},autoFocus:!1,getLabel:(x,w,B)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:x}),c.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{B(w),h(!d.length)},className:"remove-email-button",screenreaderText:b({id:"overlay_close"})})]},w)})]}),c.jsx(qt,{}),c.jsx("fieldset",{className:"footer",children:c.jsx(_e,{className:"sendEmailsButton",disabled:p,children:n})})]})})},Ba=e=>e.map(t=>({condition:t})),xt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},Bw=({functions:e,...t})=>{const{formatMessage:n}=se.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=h=>h[xt.NEW_PASSWORD]!==h[xt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=h=>!vs(h[xt.NEW_PASSWORD]).isValid,m=[{"data-testid":xt.NEW_PASSWORD,id:xt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Ba(["required",d]),functions:{onChange:h=>l(vs(h).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":xt.CONFIRMED_PASSWORD,id:xt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Ba(["required",u])}];t.isPasswordChange&&m.unshift({"data-testid":xt.CURRENT_PASSWORD,id:xt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Ba(["required"])}),i&&m.push({component:Nd,props:{matchingRules:o}});const p={id:xt.FORM_ID,fields:m,functions:{...e,onSuccess:async h=>(e.createPassword(h),e.onSuccess&&e.onSuccess(h)),onCatch:h=>a(h==null?void 0:h.statusCode),onFailure:(h,g)=>{(g.includes(xt.NEW_PASSWORD)||g.includes(xt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Jt,{...p}),r&&c.jsx(fn,{variant:"error",text:r})]})};const ch=({hooks:e,functions:t,meta:n={},gtm:r})=>{var x,w;const a=se.useIntl(),i="profileForm_",s=y.useContext(mt),[o,l]=y.useState(s.image),[u,d]=y.useState(!1),{uploadImage:m,onSuccess:p=async B=>{},onCancel:h=()=>{},onFailure:g=()=>{}}=t,{buildLocation:f,isValidPlace:b,predictPlaces:v}=e.useMaps(),{context:_="ProfileForm",event:F="profile-form-submit-click"}=r||{};return c.jsx(Jt,{id:"profile-details-form",fields:[{component:oh,props:{userName:s.name,userId:s.id,src:o,uploadImage:m,callback:l,button:{text:{upload:a.formatMessage({id:`${i}image`})}}}},{id:"name",type:"text",label:a.formatMessage({id:`${i}name`}),placeholder:a.formatMessage({id:`${i}name_placeholder`}),value:s.name,autoComplete:"name",validation:[{condition:"required"}]},{id:"jobTitle",type:"text",label:a.formatMessage({id:`${i}jobTitle`}),placeholder:a.formatMessage({id:`${i}jobTitle_placeholder`}),value:s.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:a.formatMessage({id:`${i}organization`}),placeholder:a.formatMessage({id:`${i}organization_placeholder`}),value:s.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:a.formatMessage({id:`${i}location`}),placeholder:a.formatMessage({id:`${i}location_placeholder`}),value:((x=s.location)==null?void 0:x.en)||((w=s.location)==null?void 0:w.country),validation:[{condition:"required"},{condition:({location:B})=>B&&!u?!1:!b(B),error:a.formatMessage({id:`${i}location_error`})}],functions:{onChange:()=>{u||d(!0)},onKeyInput:v}},{id:"biography",type:"textarea",label:a.formatMessage({id:`${i}bio`}),placeholder:a.formatMessage({id:`${i}bio_placeholder`}),limit:1e3,value:s.biography},{component:qt}],meta:{shouldShowCancelButton:!0,shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,...n},intlPath:i,gtm:{context:_,event:F},functions:{onSuccess:async B=>{try{const S={...B,image:o||null,location:u?await f(B==null?void 0:B.location):s.location};s.updateDetails&&s.updateDetails(z=>({...z,...S})),await p(S)}catch{g()}},onCancel:h,onFailure:g},button:{size:"large",text:{default:a.formatMessage({id:`${i}cta`}),submitting:a.formatMessage({id:`${i}cta_submitting`}),submitted:a.formatMessage({id:`${i}cta_submitted`})}}})};const dh=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=se.useIntl(),u=y.useRef(null);Xn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=m=>{m.preventDefault(),m.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:G("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Ie,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:m=>{m.key==="Enter"&&d(m)}}),c.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Ie,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Ie,{children:l.formatMessage({id:"search_cta"})})})]})})})},xc=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},Aw=e=>{const t={};for(const n of e.entries())t[n[0]]=n[1];return{name:t.full_name.toString().trim(),email:t.email_address.toString().toLowerCase().trim(),jobTitle:t.job_title,organization:t.organization,bioLink:t.url,optIn:!0,expectation:t.expectation,page:window.location.pathname,"g-recaptcha-response":t["g-recaptcha-response"]}},Tw=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:a,state:i})=>{if(!e.form||!e.form.current)throw new Error("No refs.form");if(!e.form.current.checkValidity()){e.hiddenValidation&&e.hiddenValidation.current&&e.hiddenValidation.current.click();return}const s=Aw(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...i.values}),a([{type:"showSuccessMessage",value:!0}])},Sw=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,m=(h,g)=>{h.current&&s.validFields[g]!==h.current.validity.valid&&o([{type:`validFields.${g}`,value:h.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>m(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{xc({ref:i.email,validateEmail:r,dispatch:o})},onChange:(h,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Td,props:{email:d.email,type:d.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>m(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{m(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:h=>c.jsx("small",{children:h})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:h=>c.jsx("small",{className:"notes text-small",children:h})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:h=>c.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:h}),privacy:h=>c.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:h})}),shownValue:"accepted",functions:{onChange:h=>{if(!h)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&xc({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const jw=({className:e=""})=>c.jsxs("div",{className:G("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(se.FormattedMessage,{id:"signup_success_title"})}),c.jsx(se.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const Ow={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},Pw=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=se.useIntl(),{title:u=!0,expectation:d=!1,url:m=!0,logInButton:p=!0,successMessage:h=!0}=a,g={title:u,expectation:d,url:m,logInButton:p,successMessage:h},[f,b]=y.useReducer(qr,Ow),{validFields:v,emailDetails:_,shouldManuallyApprove:F,shouldDisableButton:x,showSuccessMessage:w,showError:B}=f,[S,z]=Ks.useCookies(["signup-this-session","functional-cookie-consent"]),N={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{F===!0&&N.jobTitle.current&&N.jobTitle.current.focus()},[F]),y.useEffect(()=>{S["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[S]),y.useEffect(()=>{w&&S["functional-cookie-consent"]&&z("signup-this-session","true",{path:"/",maxAge:3600})},[w]);const I=y.useMemo(()=>Sw({placeholders:n,labels:t,shouldShow:g,functions:r,refs:N,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,N,g,f]),M=x?!0:F?!Object.values(v).every(k=>k===!0):!v.name||!v.email||["exists","pending","verify"].includes(_.boxType);return g.successMessage&&w?c.jsx(jw,{className:e}):c.jsxs("fieldset",{className:G("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&c.jsx("p",{className:"signup-title",children:c.jsx(se.FormattedMessage,{id:"signup_title"})}),B&&c.jsx(fn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Jt,{className:"signup-form",formRef:N.form,id:"sign-up-form",fields:I,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:M?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await Tw({refs:N,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:k=>{r.handleError(k),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:N.hiddenValidation})]})};const vn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return c.jsx("section",{className:G("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const Nw=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),c.jsx(vn,{className:G("download-section",n),children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(sr,{buttons:r})]})})};const Vs="editSection_";function fh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const Mw=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=se.useIntl();return c.jsxs(jt,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${Vs}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(_e,{href:r,variant:"secondary",size:"small",onClick:()=>fh({href:r,setShowModal:i}),children:n||s({id:`${Vs}placeholder_cta`})})})]})},Iw=({children:e,className:t="",formProps:n,formComponent:r,href:a,title:i,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=se.useIntl(),[m,p]=y.useState(!1),h=()=>p(!1),g=!!n||!!r,f=typeof a=="string"||g;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{h()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),h()}}})),c.jsxs("section",{className:G("edit-section",t),children:[g&&c.jsx(mn,{title:o||`Edit ${i}`,isOpen:m,showDivider:!1,showIcon:!1,functions:{onClose:h},className:G("edit-section-modal"),children:b||(n?c.jsx(Jt,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async v=>{var _,F;(_=n==null?void 0:n.functions)!=null&&_.onSuccess&&await((F=n==null?void 0:n.functions)==null?void 0:F.onSuccess(v)),p(!1)},onCancel:h}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:G("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:i}),f&&c.jsx(_e,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>fh({href:a,setShowModal:p}),children:d({id:`${Vs}edit`})})]}),e||c.jsx(Mw,{...l,href:a,setShowModal:p,showEditButton:f}),u&&c.jsx(qt,{})]})};const Rw=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:G("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:G("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:G({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:d,nameOfBusiness:m,link:p=!1,description:h=!1},g)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:m});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:p?c.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),h&&c.jsx("small",{children:h})]},window.btoa(`${d.url}_${g}`))})})]})};let es;const ts="contactFooter_",$w=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,a]=y.useState(0),[i,s]=y.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(es),es=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(es),window.removeEventListener("resize",l)}),[]),c.jsx(vn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(se.FormattedMessage,{id:`${ts}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(se.FormattedMessage,{id:`${ts}text`})}),c.jsx(dn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(se.FormattedMessage,{id:`${ts}email`})})]}),c.jsx(uh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Lw=({activeLink:e,profile:t,...n})=>c.jsx(vn,{children:c.jsx(Bd,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(Fd,{activeLink:e,profile:t}),c.jsx(ad,{...n})]})})});const ns="cookieBanner_",rs=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],as=new Date(Date.now()+12*30*24*60*60*1e3),hh=()=>{const e=se.useIntl(),[t,n,r]=Ks.useCookies(rs),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{rs.forEach(d=>{n(d,!0,{path:"/",expires:as,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:as}),rs.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:as});return}r(d)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${ns}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${ns}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ns}text`})}),c.jsx(sr,{buttons:u})]})},Kt={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-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:["news","insights","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},insights:{href:"/learning-hub/global-insights/",gtmType:"insights-click"},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","ai"],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"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Wn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Wn["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:Wn.support,gtmType:"concierge-email-click"},business:{email:Wn.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 Yn="footer_",Wa="SiteFooter",wc=({group:e})=>{const t=Kt[e].order||[];let n=!1;return"text"in Kt[e]&&(n=Kt[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(se.FormattedMessage,{id:`${Yn}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=Kt[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Wa,"data-gtm-event-type":i,...s,children:c.jsx(se.FormattedMessage,{id:`${Yn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(se.FormattedMessage,{id:`${Yn}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(se.FormattedMessage,{id:`${Yn}${e}_${r}_address`,values:{br:c.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&c.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Wa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Mo=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(Ga,{element:"hr"}),c.jsx(oo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Wa,"data-gtm-event-type":"logo-homepage-link"}),c.jsx("footer",{children:["platform","community","company","contact"].map(e=>c.jsxs("div",{className:"group",children:[c.jsx(wc,{group:e}),Object.keys(Kt[e]).includes("child")&&c.jsx(wc,{group:Kt[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(Kt.social.order)&&Kt.social.order.map(e=>{const t=Kt.social[e];return c.jsx("li",{className:e,children:c.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Wa,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(se.FormattedMessage,{id:`${Yn}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(se.FormattedMessage,{id:`${Yn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Re={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e===bt.ACCOUNT&&t===!1&&n[bt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&Re.handlerCalled[e]&&i-Re.handlerCalled[e]<500)return;Re.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case bt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case bt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case bt.ACCOUNT:o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=Pc(e[r],t);if(!(typeof a>"u")&&(!n||a[t]&&a[t].includes(n)||a.value&&a.value.includes(n)||a.toString().includes(n)))return e[r]}return e[0].children?Re.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case bt.SITE:if(n){const u=Re.findFirstChild(t.current.children,"attributes.aria-controls",bt.SITE);s=Re.findFirstChild(u.children,"href")}else s=Re.findFirstChild(t.current.children,"href");break;case bt.ACCOUNT:if(o=Re.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Re.findFirstChild(o.children,"href");break;default:return}s&&(a([{type:`focusElements.${e}.${i}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Re.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Re.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Re.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Re.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},zr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},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:{menuId:"account-navigation",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"}}}},Ua=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=se.useIntl(),o=Pc(zr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,d=e.includes("buttons.");let m=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(m+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let F=o.gtmType||`${e}-click`;if(F.includes(".")){const x=F.split("."),w=x[x.length-2];F=`${w==="topics"?`${w}-`:""}${x[x.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":F,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const h=o.order&&o.order[0]&&o[o.order[0]],g=h&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let b={},v={},_={};if(f&&(b={...b,"aria-current":"page"}),h){const F=o.menuId||e,x={onClick:w=>Re.events.onClick(w,{id:F,callback:a,isOpen:r[F]}),onFocus:()=>Re.events.onFocus({id:F}),onBlur:()=>Re.events.onBlur({id:F,callback:a}),onMouseLeave:()=>Re.events.onBlur({id:F,callback:a}),onMouseEnter:()=>Re.events.onMouseEnter({id:F,callback:a})};v={...x,id:F===bt.SITE?bt.SITE:bt.ACCOUNT},n&&(g&&(_={...x,className:"navigation-button",onKeyPress:w=>{w.key==="Enter"&&Re.events.onClick(w,{id:F,callback:a,isOpen:r[F]})},"aria-haspopup":!0,"aria-expanded":r[F],"aria-controls":F}),v={...v,hidden:F in r?!r[F]:!0}),g||(v={...v})}return c.jsxs("li",{className:G({[o.className]:o.className,"has-submenu":h,parent:g,active:f}),...b,children:[p?y.createElement(d?_e:"a",p,s.formatMessage({id:m})):n&&o.order&&g?c.jsxs("button",{..._,children:[s.formatMessage({id:m}),c.jsx(Ie,{children:s.formatMessage({id:`header_menu_${r[bt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:m}),o.order&&c.jsx("ul",{...v,children:o.order.map(F=>{if(!o[F])return null;const x={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[F].order?c.jsxs("li",{className:G({[o[F].className]:o[F].className}),children:[s.formatMessage({id:`${m}_${F}`}),c.jsx("ul",{children:o[F].order.map(w=>c.jsx(Ua,{id:`${e}.${F}.${w}`,...x},w))})]},F):c.jsx(Ua,{id:`${e}.${F}`,...x},F)})})]},e)};const zw={height:67,height_desktop:83};var bt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(bt||{});const Io=({showNavigation:e=!0})=>{const t=se.useIntl(),n=y.useContext(mt),r=On(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>Re.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(qr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,m=y.useRef(s);y.useEffect(()=>{m.current=s},[s]),Lc({scrollPosition:zw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const v=m.current.menus;!i&&v["site-navigation"]||Re.shouldChangeHeaderIsVisible(!0,v,o)},scrollDown:()=>{const v=m.current.menus;!i&&v["site-navigation"]||Re.shouldChangeHeaderIsVisible(!1,v,o)}}});const p=(v,_,F=!1)=>{Re.handleMenus({id:v,value:_,menus:m.current.menus,dispatch:o,forceHandle:F})},h=y.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(_=>{m.current.menus[_]&&p(_,!1,!0)})};y.useEffect(()=>{var v;return(v=document.getElementById("header"))==null||v.addEventListener("keydown",g),()=>{var _;(_=document.getElementById("header"))==null||_.removeEventListener("keydown",g)}},[]),Xn(()=>{u["site-navigation"]&&Re.autoFocus({menu:"site-navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),Xn(()=>{u["account-navigation"]&&Re.autoFocus({menu:"account-navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Ie,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(dh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Ie,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:h,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:zr.order.map(v=>c.jsx(Ua,{id:v,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},v))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:G({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(Ie,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(oo,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),a?c.jsxs("button",{className:"account-button",onClick:v=>Re.events.onClick(v,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>Re.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>Re.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Ie,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(hn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:zr.buttons.order.map(v=>c.jsx(Ua,{id:`buttons.${v}`},v))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:G("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const qw=()=>{const e=se.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Io,{}),c.jsx("div",{id:"content",children:c.jsx(fn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(Mo,{})]})},mh=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:d="default",variant:m="default",circle:p="default",modal:h="default"}=i,g=Ic(),[f,b]=y.useState(""),v=B=>{const{detail:{message:S}}=B;b(S)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const _=ya(e,{locale:o}),F=ya(t,{locale:o}),x=ya(n,{locale:o}),w={};return d!=="default"&&(w[d]=!0),m!=="default"&&(w[m]=!0),p!=="default"&&(w[p]=!0),c.jsx(Wh.ErrorBoundary,{onError:r,fallback:c.jsx(qw,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:G(s,w,{"has-footer":u}),children:[c.jsx(Io,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[F&&c.jsx("div",{className:G("additional-content prepended",{"large-modal":h==="large"}),children:F}),y.createElement(d==="bold"?ro:"div",{id:"content",children:_,className:G({"large-modal":h==="large"})})]}),x&&c.jsx("div",{className:"additional-content appended",children:x}),u&&c.jsx(Mo,{}),c.jsx(hh,{})]}),f&&c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Ec={default:"tags_",headerTopics:"header_topics_topics_"},is={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"},Ww={getTagDetails:e=>{if(e.includes("topic_")){if(e=is.topic[e.replace("topic_","")],e){const t=zr.topics.topics[e].href;return t?{id:e,href:t,text:`${Ec.headerTopics}${e}`}:null}return null}return is[e]?(e=is[e],{id:e,text:`${Ec.default}${e}`}):null}};const Uw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=se.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=Ww.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:G("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:d}):d},u.id)})})};const Hw=({members:{data:e=[],total:t=e.length},isMember:n=!1,hasNextPage:r=!1,loadNextPage:a=()=>{},profile:i,gtmContext:s="member",gtmType:o="member-click",className:l=""})=>{const u=se.useIntl(),d="membersList",m=y.useContext(mt),[p,h]=y.useState(!1);return e.length===0?null:c.jsxs("div",{className:G("members-list",l),children:[c.jsxs("h1",{children:[u.formatMessage({id:d}),c.jsx("span",{className:"count",children:t})]}),c.jsxs("ul",{children:[n?c.jsxs("li",{children:[c.jsx(Yt,{member:m,gtmContext:s,gtmType:o}),c.jsx(dn,{href:"/profiles/me",className:"text-small",onClick:g=>{g==null||g.preventDefault(),g==null||g.stopPropagation(),h(!0)},children:u.formatMessage({id:`${d}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((g,f)=>c.jsxs("li",{children:[c.jsx(Yt,{member:g,gtmContext:s,gtmType:o}),g.isAdmin&&c.jsx(ln,{children:u.formatMessage({id:`${d}_admin`})})]},f))]}),r&&c.jsx(Ur,{hasNextPage:r,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:s}),i?c.jsx(di,{form:i,showModal:p,content:{title:u.formatMessage({id:`${d}_modal_title`})},functions:{onClose:()=>{h(!1)}}}):c.jsx(c.Fragment,{})]})},Vw={showForm:!1},li=y.createContext(Vw),ph=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(li.Provider,{value:{...t,updateConversation:n},children:e})},_c=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},ci=e=>{var t,n,r,a,i;return e&&!e.error?{id:e==null?void 0:e.id,name:(t=e==null?void 0:e.data)==null?void 0:t.name,organization:(n=e==null?void 0:e.data)==null?void 0:n.organization,jobTitle:(r=e==null?void 0:e.data)==null?void 0:r.jobTitle,location:(a=e==null?void 0:e.data)==null?void 0:a.location,image:{thumbnail:((i=e==null?void 0:e.data)==null?void 0:i.thumbnail)||void 0}}:"deleted"},Kw=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=se.useIntl();return t?c.jsx("small",{children:At(a.formatMessage,`${e}explainer`,n,"action",{a:i=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):c.jsx(c.Fragment,{})},Zw=({formID:e,intlPath:t,showLabel:n,type:r})=>{const a=se.useIntl();return n?c.jsx("label",{htmlFor:`${e}-input`,className:"text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:a.formatMessage({id:`${t}label`})}):c.jsx(Ie,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:At(a.formatMessage,`${t}label_action`,r,"action")})};let ma=null;const Je="discussion_form_",Vr=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r,placeholder:a,maxLength:i=0,buttons:s,forceShow:o={cancel:!1,error:!1},isCommunity:l=!1,functions:u,data:d={},gtmContext:m="DiscussionForm"})=>{var Te,Se,He;const p=se.useIntl(),h=y.useContext(mt),[g,f]=y.useState(""),{isLoading:b=!1,isInWrapper:v=!1,isInOverlay:_=!1,isAutoFocused:F=!1,isEditing:x=!1,hasTitleField:w=!1,isPrepopulated:B=!1,showTitle:S=!1,showGuidelines:z=!0,showDivider:N=!1,showSuccessMessage:I=!0}=r||{},{onChange:M=()=>{},create:k=()=>{},handleSaveEdit:A=()=>{},handleCancel:j=()=>{},callback:L=()=>{},onMention:H=()=>{},listMembers:Y=()=>Promise.resolve([]),clickMentionFallback:Q=()=>{},props:re={create:{projectNames:["questions-answers"]}}}=u,[C,q]=y.useState({title:w&&w.text||"",body:x&&x.text||B&&B.text||""}),[K,E]=y.useState(o.error||!1),[T,$]=y.useState(!1);if(y.useEffect(()=>{l&&!x&&B&&B!==C.body&&q({...C,body:B.text||""})},[B]),b)return c.jsx(Ft,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const R=Be=>{q({...C,body:Be}),M({body:Be});let Fe;!h||!h.id?Fe=At(p.formatMessage,`${Je}error_loggedOut`,t.type,"action"):n?i>0&&Be.length>=i&&(Fe=`${Je}error_tooLong`):Fe=At(p.formatMessage,`${Je}error_noPermission`,t.type,"action"),Fe?E(Fe):K&&E(!1)};let U=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const Be=((Te=t.slugs)==null?void 0:Te.reply)||((Se=t.slugs)==null?void 0:Se.answer)||((He=t.slugs)==null?void 0:He.question)||"";Be&&(U=`${U}-${Be.slice(-15)}`)}e&&(U=`${e}-${U}`);const ae=async()=>{if(!h||!h.id||!n||X)return;ma&&clearTimeout(ma),$("submitting");const Be=window.location.pathname;try{let Fe;switch(t.type){case"post":Fe=await k({title:C.title,content:C.body});break;case"question":Fe=await k({title:C.body,authorId:h&&h.id,...re==null?void 0:re.create});break;case"response":Fe=await k({questionSlug:t.slugs.question},{body:C.body,authorId:h&&h.id,contentPath:Be});break;case"reply":Fe=await k({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:C.body,authorId:h&&h.id,contentPath:Be});break;default:break}await tm(1e3),L&&await L(Fe),ma=setTimeout(()=>{q({title:"",body:""}),$("submitted"),f(At(p.formatMessage,`${Je}success`,t.type,"action"));const Pe=new Event(Xe.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(Pe),J()},500)}catch(Fe){const Pe=Fe;let Ee=`${Je}error`;Pe!=null&&Pe.message.includes("entry already exists")&&(Ee=At(p.formatMessage,`${Je}error_alreadyExists`,t.type,"action")),Pe!=null&&Pe.message.includes("429")?Ee=At(p.formatMessage,`${Je}error_tooMany`,t.type,"action"):Pe!=null&&Pe.message.includes("400")&&(Ee=`${Je}error`),E(Ee),J()}},J=()=>{ma=setTimeout(()=>{E(!1),$(!1),f("")},5e3)},ie=!C.title||!eu(C.title),de=!C.body||!eu(C.body);let X=de;w&&(X=ie&&de);const ye=T==="submitting",me=[{component:Zw,props:{formID:U,intlPath:Je,showLabel:w!==!1,type:t.type}},{component:sh,props:{id:`${U}-input`,value:T==="submitting"&&!K?"":C.body,placeholder:a||At(p.formatMessage,`${Je}placeholder`,t.type,"action"),maxLength:i,meta:{isInOverlay:_},functions:{onChange:R,onMention:H,listMembers:Y,clickMentionFallback:Q},data:d,autoFocus:x!==!1||F&&!w,"aria-invalid":!!K,"aria-errormessage":"error-message"}},{component:Kw,props:{intlPath:Je,showGuidelines:z,type:t.type,gtmContext:m}}];N&&me.push({component:qt}),w&&me.unshift({id:"title",type:"text",value:w.text,limit:250,autoFocus:F,label:p.formatMessage({id:`${Je}titleField_label`}),placeholder:p.formatMessage({id:`${Je}titleField_placeholder`}),functions:{onChange:Be=>{q({...C,title:Be}),M({title:Be})}},validation:[{condition:()=>X,error:p.formatMessage({id:`${Je}titleField_error`})}]});let xe=!h||!h.id||!n||X||ye;return x&&(w?xe=xe||C.body===x.text&&C.title===w.text:xe=xe||C.body===x.text),c.jsxs(c.Fragment,{children:[c.jsxs(Jt,{id:U,className:G("discussion-card discussion-form",{"no-styling":v&&x}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:x&&!ye||o.cancel},functions:{onSuccess:async()=>{if(x){$("submitting"),A(C);return}await ae()},onCancel:j},fields:me,intlPath:Je,button:{variant:"primary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":`${x?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:xe,text:{default:!x&&(s!=null&&s.submit)?s==null?void 0:s.submit:p.formatMessage({id:`${Je}${x?"save":"post"}`}),submitting:p.formatMessage({id:`${Je}${x?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!o.cancel&&(!h||!h.id||!C.body),text:s!=null&&s.cancel?s==null?void 0:s.cancel:p.formatMessage({id:`${Je}cancel`})},gtm:{context:m,event:`${t.type}-form`},"data-testid":`discussion-${t.type}-form`,children:[S&&!x&&["question"].includes(t.type)&&c.jsx("h2",{children:At(p.formatMessage,`${Je}title`,t.type,"action")}),c.jsx(Yt,{member:h?{...h,link:!1}:"community",gtmContext:m,gtmType:"profile-click"})]}),T==="submitted"&&I&&c.jsx(jr,{className:"success","data-testid":"success",children:At(p.formatMessage,`${Je}success`,t.type,"action")}),K&&c.jsx(jr,{id:"error-message",className:"error","data-testid":"error",children:o.error?o.error:typeof K=="string"?K.includes(" ")?K:p.formatMessage({id:K},{action:p.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):K}),g&&c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:g})]})},Yw=Object.freeze(Object.defineProperty({__proto__:null,default:Vr},Symbol.toStringTag,{value:"Module"})),Gw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Qw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Ha=({icon:e,className:t="",...n})=>c.jsx(_e,{className:G("discussion-button",t),variant:"tertiary",icon:e,...n});let Ar=!1;const ss=()=>{Ar!==!1&&(clearTimeout(Ar),Ar=!1)},os=5;let us=null;const gh=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const u=se.useIntl(),d={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[m,p]=y.useReducer(qr,d),{numberOfLikes:h,userLikedContent:g,ignoreInteractions:f,showLikers:b,tabbableLink:v}=m;y.useEffect(()=>{p([{type:"userLikedContent",value:a}])},[a]);const _=y.useMemo(()=>Qw(n,os),[n]),F=S=>{if(S.preventDefault(),S.stopPropagation(),p([{type:"showLikers",value:!1}]),Ar)return ss(),!1;if(ss(),f||!s)return!1;Ar=setTimeout(x,350)},x=async()=>{if(ss(),f||!s)return!1;let S=g?h-1:h+1;S<0&&(S=0),p([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const z=Gw(i.slugs);g?await l(z):await o({...z,payload:{contentPath:window.location.pathname}})}}catch{p([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{p([{type:"ignoreInteractions",value:!1}])}},w=()=>{us=setTimeout(()=>{p([{type:"showLikers",value:!1}])},500)},B=()=>{us&&clearTimeout(us)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&p([{type:"showLikers",value:!1}])},onMouseEnter:()=>{B(),p([{type:"showLikers",value:!0}])},onMouseLeave:()=>{w()}},c.jsxs(c.Fragment,{children:[c.jsx(Ha,{className:G("discussion-button text-medium action-button",{"show-spinner":f,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:F,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:h})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Ie,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{B()},onBlur:()=>w,onClick:S=>{var N;S.preventDefault(),S.stopPropagation(),B(),p([{type:"showLikers",value:!0}]);const z=(N=S.currentTarget.nextSibling)==null?void 0:N.childNodes[0];if(z){const I=z.querySelector("li:first-child a");I&&(p([{type:"tabbableLink",value:0}]),setTimeout(()=>{I.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),w())},"aria-expanded":b,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Ie,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(Pn,{id:`likes-tooltip-${i.slug}`,isOpen:b,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[_.map((S,z)=>{if(typeof S=="string")return null;const N={};return v!==z&&(N.tabIndex=-1),c.jsx("li",{"data-index":z,children:c.jsx(dn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:I=>I==null?void 0:I.stopPropagation(),onFocus:()=>B(),onKeyDown:I=>{var L,H,Y,Q;if(!I||!["ArrowUp","ArrowDown"].includes(I.key||""))return;I.stopPropagation(),I.preventDefault();const M=I.key==="ArrowUp"?"up":"down",k=(L=I.currentTarget)==null?void 0:L.parentElement;let A=k==null?void 0:k.nextElementSibling;if(M==="up"){const re=k==null?void 0:k.previousElementSibling;re?A=re:(A=(H=k==null?void 0:k.parentElement)==null?void 0:H.lastElementChild,(A==null?void 0:A.getAttribute("data-index"))==="-1"&&(A=A==null?void 0:A.previousElementSibling))}else(!A||(A==null?void 0:A.getAttribute("data-index"))==="-1")&&(A=(Y=k==null?void 0:k.parentElement)==null?void 0:Y.firstElementChild);if(!A)return;const j=(A==null?void 0:A.getAttribute("data-index"))||"0";p([{type:"tabbableLink",value:j}]),(Q=A==null?void 0:A.querySelector("a"))==null||Q.focus()},...N,children:S.name?S.name:c.jsx("span",{className:"deleted-user",children:u.formatMessage({id:"member_deleted"})})})},S.id||window.btoa(S.name||""))}),t>os&&c.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-os})})]})})]})]}))},ls=({children:e,class:t,...n})=>{const r={...n,class:G("subtle",t)};return c.jsx("blockquote",{...r,children:e})},Jw=280,Ro=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Jn(e,typeof t=="number"?t:Jw):e;a=a.trim();const i=`<br>
|
|
163
|
+
`}),K=E.turndown(K)}o&&o.mentions&&(K=await Gc({text:K,template:`[${$s}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),ew(K,E=>{x([{type:"initialValue",value:E},{type:"editorKey",value:B.toString()}]),setTimeout(()=>{x([{type:"stringValue",value:vc(Q)}])},150)})})()},[B]),y.useEffect(()=>{t!==""||!Q||hs(B,t)&&!M||(D.withoutNormalizing(Q,()=>{ee.delete(Q,{at:{anchor:D.start(Q,[]),focus:D.end(Q,[])}}),ee.deselect(Q),Q.children.length!==0&&ee.unwrapNodes(Q,{at:[0]}),ee.insertNodes(Q,v,{at:[0]})}),x([{type:"initialValue",value:v},{type:"lastAnchor",value:null}]))},[t]);const C=Rc(()=>{aw({editor:Q,isShowing:A.show,numberOfUsers:A.numberOfUsers,listMembers:p,dispatch:x})},100);return S?c.jsx("div",{id:L,className:"rich-text-editor",children:c.jsxs(en.Provider,{value:{...F,id:L,isInOverlay:m,setFocus:j,dispatch:x,onMention:f,reportError:b},children:[c.jsxs(yD,{editor:Q,initialValue:S,onChange:q=>{if(Q.operations.some(E=>E.type!=="set_selection")){const E=sw(q);g(E),x([{type:"stringValue",value:vc(Q)}]),M||x([{type:"hasInteracted",value:!0}]),C(),d&&console.log({serialized:E,json:q})}},...l,children:[c.jsx(cD,{className:"input",renderElement:H,renderLeaf:Y,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onKeyDown:q=>{if(q.key==="Enter"){A.show&&(q.preventDefault(),q.stopPropagation(),Jf(Q,A,x,L));const{selection:K}=Q;if(K){const E=V.isCollapsed(K),[T,$]=D.node(Q,K,{depth:1});let R=T,U=R.type;const ae=R.children[0];if(ae&&[Z.ol,Z.ul].includes(ae.type)&&(R=ae,U=ae.type),R&&ce.isElement(R)&&U!==Z.paragraph){if(U===Z.blockquote&&!q.shiftKey){q.stopPropagation(),q.preventDefault(),ee.insertNodes(Q,v);return}if(E){const[J,ie]=D.parent(Q,K,{edge:"end"}),X=J.type;if([Z.ul,Z.ol].includes(U))if(q.stopPropagation(),q.preventDefault(),X===Z.li&&I==="Enter"){J.children.length===1&&"text"in J.children[0]&&J.children[0].text===""&&ee.removeNodes(Q,{at:ie}),ee.insertNodes(Q,v,{at:P.next($)}),ee.select(Q,D.end(Q,P.next($)));return}else{const[ye,me]=tw(Q,Z.li),xe={type:Z.li,children:[{text:""}]};ee.insertNodes(Q,xe,{at:P.next(me)}),ee.select(Q,D.end(Q,P.next(me)))}}}}}else if(q.key==="Escape"){if(A.show){q.preventDefault(),q.stopPropagation(),x([{type:"mentionPopover",value:{...A,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(q.key)&&A.show){q.preventDefault(),q.stopPropagation();const{selectedUser:K,possibleUsers:E}=A;let T=q.key==="ArrowUp"?K-1:K+1;T<0&&(T=E.length-1),T>=E.length+1&&(T=0),x([{type:"mentionPopover",value:{...A,selectedUser:T}}])}x([{type:"lastKey",value:q.key}]),rw(q,Q,x,b)},onBlur:()=>{Q.selection&&x([{type:"lastAnchor",value:Q.selection.anchor}])},onFocus:()=>{if(N){if(!P.isPath(N.path)||!ue.has(Q,N.path))return;const q=ue.get(Q,N.path);let K=0;if(fe.isText(q)?K=q.text.length:q.children&&(K=q.children.length),N.offset>K)return;try{ee.select(Q,{anchor:N,focus:N})}catch(E){const T=E.message;b(`Error focusing editor: ${T}`)}}}}),c.jsx(vw,{}),p?c.jsx(ow,{onFallbackClick:h}):null]},w),c.jsx(uo,{id:`character-limit-${e}`,limit:r,valueLength:ti(z)})]})}):c.jsx(c.Fragment,{})};const Fw=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:G("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:G("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const m=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:m,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:m,children:d.label})]},m)})})]})};function oh({className:e="",userId:t,userName:n,src:r,uploadImage:a,button:i,callback:s}){const o=se.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[m,p]=y.useState(!1),[h,g]=y.useState(!1),f=y.useRef(null),b=async x=>{p(!0),g(!1);try{const w=x.target.files&&x.target.files[0];if(!w||!t)throw p(!1),new Error("Image file or userID is missing");const B=await a({fileObject:w,userId:t}),S={thumbnail:B.thumbnailURL,full:B.originalURL};d(S),s(S)}catch{g(!0)}finally{p(!1)}p(!1)},{upload:v=o.formatMessage({id:`${l}cta_upload`}),change:_=o.formatMessage({id:`${l}cta_change`}),uploading:F=o.formatMessage({id:`${l}cta_uploading`})}=(i==null?void 0:i.text)||{};return c.jsxs("div",{className:G("profile-image-change-figure",e),children:[c.jsx(hn,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),h&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(_e,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:m,children:m?F:u?_:v})]})}const uh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(Jt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const lh=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[d,m]=y.useState([]),[p,h]=y.useState(!0),[g,f]=y.useState(u),{formatMessage:b}=se.useIntl(),v=async x=>{x.preventDefault();try{await l(d),m([]),f("SUCCESS")}catch(w){f("ERROR"),o(w)}},_=x=>{x.preventDefault(),f("NOT_SUBMITTED"),h(!0),m([])},F=x=>{x.preventDefault(),s(),f("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:g==="SUCCESS"?c.jsx("h2",{className:"success-title",children:b({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",b({id:"inviteForm_error"})]})}),c.jsx(qt,{}),c.jsx("div",{className:"footer",children:g==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(_e,{variant:"secondary",onClick:_,children:b({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(_e,{onClick:F,children:b({id:"inviteForm_ctaDone"})})]}):c.jsx(_e,{onClick:_,children:b({id:"inviteForm_ctaTryAgain"})})})]}):c.jsx("div",{className:"invite-form-wrapper",children:c.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:G("invite-form gtm-trackable"),children:[c.jsxs("fieldset",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:r},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),c.jsx(qh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:b({id:"inviteForm_email_placeholder"}),emails:d,onChange:x=>{m(x),h(!x.length)},autoFocus:!1,getLabel:(x,w,B)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:x}),c.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{B(w),h(!d.length)},className:"remove-email-button",screenreaderText:b({id:"overlay_close"})})]},w)})]}),c.jsx(qt,{}),c.jsx("fieldset",{className:"footer",children:c.jsx(_e,{className:"sendEmailsButton",disabled:p,children:n})})]})})},Ba=e=>e.map(t=>({condition:t})),xt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},Bw=({functions:e,...t})=>{const{formatMessage:n}=se.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=h=>h[xt.NEW_PASSWORD]!==h[xt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=h=>!vs(h[xt.NEW_PASSWORD]).isValid,m=[{"data-testid":xt.NEW_PASSWORD,id:xt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Ba(["required",d]),functions:{onChange:h=>l(vs(h).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":xt.CONFIRMED_PASSWORD,id:xt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Ba(["required",u])}];t.isPasswordChange&&m.unshift({"data-testid":xt.CURRENT_PASSWORD,id:xt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Ba(["required"])}),i&&m.push({component:Nd,props:{matchingRules:o}});const p={id:xt.FORM_ID,fields:m,functions:{...e,onSuccess:async h=>(e.createPassword(h),e.onSuccess&&e.onSuccess(h)),onCatch:h=>a(h==null?void 0:h.statusCode),onFailure:(h,g)=>{(g.includes(xt.NEW_PASSWORD)||g.includes(xt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Jt,{...p}),r&&c.jsx(fn,{variant:"error",text:r})]})};const ch=({hooks:e,functions:t,meta:n={},gtm:r})=>{var x,w;const a=se.useIntl(),i="profileForm_",s=y.useContext(mt),[o,l]=y.useState(s.image),[u,d]=y.useState(!1),{uploadImage:m,onSuccess:p=async B=>{},onCancel:h=()=>{},onFailure:g=()=>{}}=t,{buildLocation:f,isValidPlace:b,predictPlaces:v}=e.useMaps(),{context:_="ProfileForm",event:F="profile-form-submit-click"}=r||{};return c.jsx(Jt,{id:"profile-details-form",fields:[{component:oh,props:{userName:s.name,userId:s.id,src:o,uploadImage:m,callback:l,button:{text:{upload:a.formatMessage({id:`${i}image`})}}}},{id:"name",type:"text",label:a.formatMessage({id:`${i}name`}),placeholder:a.formatMessage({id:`${i}name_placeholder`}),value:s.name,autoComplete:"name",validation:[{condition:"required"}]},{id:"jobTitle",type:"text",label:a.formatMessage({id:`${i}jobTitle`}),placeholder:a.formatMessage({id:`${i}jobTitle_placeholder`}),value:s.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:a.formatMessage({id:`${i}organization`}),placeholder:a.formatMessage({id:`${i}organization_placeholder`}),value:s.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:a.formatMessage({id:`${i}location`}),placeholder:a.formatMessage({id:`${i}location_placeholder`}),value:((x=s.location)==null?void 0:x.en)||((w=s.location)==null?void 0:w.country),validation:[{condition:"required"},{condition:({location:B})=>B&&!u?!1:!b(B),error:a.formatMessage({id:`${i}location_error`})}],functions:{onChange:()=>{u||d(!0)},onKeyInput:v}},{id:"biography",type:"textarea",label:a.formatMessage({id:`${i}bio`}),placeholder:a.formatMessage({id:`${i}bio_placeholder`}),limit:1e3,value:s.biography},{component:qt}],meta:{shouldShowCancelButton:!0,shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,...n},intlPath:i,gtm:{context:_,event:F},functions:{onSuccess:async B=>{try{const S={...B,image:o||null,location:u?await f(B==null?void 0:B.location):s.location};s.updateDetails&&s.updateDetails(z=>({...z,...S})),await p(S)}catch{g()}},onCancel:h,onFailure:g},button:{size:"large",text:{default:a.formatMessage({id:`${i}cta`}),submitting:a.formatMessage({id:`${i}cta_submitting`}),submitted:a.formatMessage({id:`${i}cta_submitted`})}}})};const dh=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=se.useIntl(),u=y.useRef(null);Xn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=m=>{m.preventDefault(),m.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:G("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Ie,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:m=>{m.key==="Enter"&&d(m)}}),c.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Ie,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Ie,{children:l.formatMessage({id:"search_cta"})})})]})})})},xc=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},Aw=e=>{const t={};for(const n of e.entries())t[n[0]]=n[1];return{name:t.full_name.toString().trim(),email:t.email_address.toString().toLowerCase().trim(),jobTitle:t.job_title,organization:t.organization,bioLink:t.url,optIn:!0,expectation:t.expectation,page:window.location.pathname,"g-recaptcha-response":t["g-recaptcha-response"]}},Tw=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:a,state:i})=>{if(!e.form||!e.form.current)throw new Error("No refs.form");if(!e.form.current.checkValidity()){e.hiddenValidation&&e.hiddenValidation.current&&e.hiddenValidation.current.click();return}const s=Aw(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...i.values}),a([{type:"showSuccessMessage",value:!0}])},Sw=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,m=(h,g)=>{h.current&&s.validFields[g]!==h.current.validity.valid&&o([{type:`validFields.${g}`,value:h.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>m(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{xc({ref:i.email,validateEmail:r,dispatch:o})},onChange:(h,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Td,props:{email:d.email,type:d.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>m(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{m(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:h=>c.jsx("small",{children:h})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:h=>c.jsx("small",{className:"notes text-small",children:h})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:h=>c.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:h}),privacy:h=>c.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:h})}),shownValue:"accepted",functions:{onChange:h=>{if(!h)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&xc({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const jw=({className:e=""})=>c.jsxs("div",{className:G("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(se.FormattedMessage,{id:"signup_success_title"})}),c.jsx(se.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const Ow={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},Pw=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=se.useIntl(),{title:u=!0,expectation:d=!1,url:m=!0,logInButton:p=!0,successMessage:h=!0}=a,g={title:u,expectation:d,url:m,logInButton:p,successMessage:h},[f,b]=y.useReducer(qr,Ow),{validFields:v,emailDetails:_,shouldManuallyApprove:F,shouldDisableButton:x,showSuccessMessage:w,showError:B}=f,[S,z]=Ks.useCookies(["signup-this-session","functional-cookie-consent"]),N={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{F===!0&&N.jobTitle.current&&N.jobTitle.current.focus()},[F]),y.useEffect(()=>{S["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[S]),y.useEffect(()=>{w&&S["functional-cookie-consent"]&&z("signup-this-session","true",{path:"/",maxAge:3600})},[w]);const I=y.useMemo(()=>Sw({placeholders:n,labels:t,shouldShow:g,functions:r,refs:N,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,N,g,f]),M=x?!0:F?!Object.values(v).every(k=>k===!0):!v.name||!v.email||["exists","pending","verify"].includes(_.boxType);return g.successMessage&&w?c.jsx(jw,{className:e}):c.jsxs("fieldset",{className:G("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&c.jsx("p",{className:"signup-title",children:c.jsx(se.FormattedMessage,{id:"signup_title"})}),B&&c.jsx(fn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Jt,{className:"signup-form",formRef:N.form,id:"sign-up-form",fields:I,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:M?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/api/next-ui/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await Tw({refs:N,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:k=>{r.handleError(k),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:N.hiddenValidation})]})};const vn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return c.jsx("section",{className:G("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const Nw=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),c.jsx(vn,{className:G("download-section",n),children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(sr,{buttons:r})]})})};const Vs="editSection_";function fh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const Mw=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=se.useIntl();return c.jsxs(jt,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${Vs}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(_e,{href:r,variant:"secondary",size:"small",onClick:()=>fh({href:r,setShowModal:i}),children:n||s({id:`${Vs}placeholder_cta`})})})]})},Iw=({children:e,className:t="",formProps:n,formComponent:r,href:a,title:i,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=se.useIntl(),[m,p]=y.useState(!1),h=()=>p(!1),g=!!n||!!r,f=typeof a=="string"||g;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{h()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),h()}}})),c.jsxs("section",{className:G("edit-section",t),children:[g&&c.jsx(mn,{title:o||`Edit ${i}`,isOpen:m,showDivider:!1,showIcon:!1,functions:{onClose:h},className:G("edit-section-modal"),children:b||(n?c.jsx(Jt,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async v=>{var _,F;(_=n==null?void 0:n.functions)!=null&&_.onSuccess&&await((F=n==null?void 0:n.functions)==null?void 0:F.onSuccess(v)),p(!1)},onCancel:h}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:G("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:i}),f&&c.jsx(_e,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>fh({href:a,setShowModal:p}),children:d({id:`${Vs}edit`})})]}),e||c.jsx(Mw,{...l,href:a,setShowModal:p,showEditButton:f}),u&&c.jsx(qt,{})]})};const Rw=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:G("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:G("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:G({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:d,nameOfBusiness:m,link:p=!1,description:h=!1},g)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:m});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:p?c.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),h&&c.jsx("small",{children:h})]},window.btoa(`${d.url}_${g}`))})})]})};let es;const ts="contactFooter_",$w=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,a]=y.useState(0),[i,s]=y.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(es),es=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(es),window.removeEventListener("resize",l)}),[]),c.jsx(vn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(se.FormattedMessage,{id:`${ts}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(se.FormattedMessage,{id:`${ts}text`})}),c.jsx(dn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(se.FormattedMessage,{id:`${ts}email`})})]}),c.jsx(uh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Lw=({activeLink:e,profile:t,...n})=>c.jsx(vn,{children:c.jsx(Bd,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(Fd,{activeLink:e,profile:t}),c.jsx(ad,{...n})]})})});const ns="cookieBanner_",rs=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],as=new Date(Date.now()+12*30*24*60*60*1e3),hh=()=>{const e=se.useIntl(),[t,n,r]=Ks.useCookies(rs),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{rs.forEach(d=>{n(d,!0,{path:"/",expires:as,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:as}),rs.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:as});return}r(d)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${ns}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${ns}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ns}text`})}),c.jsx(sr,{buttons:u})]})},Kt={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-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:["news","insights","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},insights:{href:"/learning-hub/global-insights/",gtmType:"insights-click"},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","ai"],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"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Wn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Wn["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:Wn.support,gtmType:"concierge-email-click"},business:{email:Wn.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 Yn="footer_",Wa="SiteFooter",wc=({group:e})=>{const t=Kt[e].order||[];let n=!1;return"text"in Kt[e]&&(n=Kt[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(se.FormattedMessage,{id:`${Yn}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=Kt[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Wa,"data-gtm-event-type":i,...s,children:c.jsx(se.FormattedMessage,{id:`${Yn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(se.FormattedMessage,{id:`${Yn}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(se.FormattedMessage,{id:`${Yn}${e}_${r}_address`,values:{br:c.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&c.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Wa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Mo=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(Ga,{element:"hr"}),c.jsx(oo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Wa,"data-gtm-event-type":"logo-homepage-link"}),c.jsx("footer",{children:["platform","community","company","contact"].map(e=>c.jsxs("div",{className:"group",children:[c.jsx(wc,{group:e}),Object.keys(Kt[e]).includes("child")&&c.jsx(wc,{group:Kt[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(Kt.social.order)&&Kt.social.order.map(e=>{const t=Kt.social[e];return c.jsx("li",{className:e,children:c.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Wa,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(se.FormattedMessage,{id:`${Yn}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(se.FormattedMessage,{id:`${Yn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Re={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e===bt.ACCOUNT&&t===!1&&n[bt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&Re.handlerCalled[e]&&i-Re.handlerCalled[e]<500)return;Re.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case bt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case bt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case bt.ACCOUNT:o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=Pc(e[r],t);if(!(typeof a>"u")&&(!n||a[t]&&a[t].includes(n)||a.value&&a.value.includes(n)||a.toString().includes(n)))return e[r]}return e[0].children?Re.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case bt.SITE:if(n){const u=Re.findFirstChild(t.current.children,"attributes.aria-controls",bt.SITE);s=Re.findFirstChild(u.children,"href")}else s=Re.findFirstChild(t.current.children,"href");break;case bt.ACCOUNT:if(o=Re.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Re.findFirstChild(o.children,"href");break;default:return}s&&(a([{type:`focusElements.${e}.${i}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Re.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Re.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Re.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Re.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},zr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},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:{menuId:"account-navigation",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:"/api/next-ui/login"},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},Ua=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=se.useIntl(),o=Pc(zr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,d=e.includes("buttons.");let m=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(m+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let F=o.gtmType||`${e}-click`;if(F.includes(".")){const x=F.split("."),w=x[x.length-2];F=`${w==="topics"?`${w}-`:""}${x[x.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":F,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const h=o.order&&o.order[0]&&o[o.order[0]],g=h&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let b={},v={},_={};if(f&&(b={...b,"aria-current":"page"}),h){const F=o.menuId||e,x={onClick:w=>Re.events.onClick(w,{id:F,callback:a,isOpen:r[F]}),onFocus:()=>Re.events.onFocus({id:F}),onBlur:()=>Re.events.onBlur({id:F,callback:a}),onMouseLeave:()=>Re.events.onBlur({id:F,callback:a}),onMouseEnter:()=>Re.events.onMouseEnter({id:F,callback:a})};v={...x,id:F===bt.SITE?bt.SITE:bt.ACCOUNT},n&&(g&&(_={...x,className:"navigation-button",onKeyPress:w=>{w.key==="Enter"&&Re.events.onClick(w,{id:F,callback:a,isOpen:r[F]})},"aria-haspopup":!0,"aria-expanded":r[F],"aria-controls":F}),v={...v,hidden:F in r?!r[F]:!0}),g||(v={...v})}return c.jsxs("li",{className:G({[o.className]:o.className,"has-submenu":h,parent:g,active:f}),...b,children:[p?y.createElement(d?_e:"a",p,s.formatMessage({id:m})):n&&o.order&&g?c.jsxs("button",{..._,children:[s.formatMessage({id:m}),c.jsx(Ie,{children:s.formatMessage({id:`header_menu_${r[bt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:m}),o.order&&c.jsx("ul",{...v,children:o.order.map(F=>{if(!o[F])return null;const x={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[F].order?c.jsxs("li",{className:G({[o[F].className]:o[F].className}),children:[s.formatMessage({id:`${m}_${F}`}),c.jsx("ul",{children:o[F].order.map(w=>c.jsx(Ua,{id:`${e}.${F}.${w}`,...x},w))})]},F):c.jsx(Ua,{id:`${e}.${F}`,...x},F)})})]},e)};const zw={height:67,height_desktop:83};var bt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(bt||{});const Io=({showNavigation:e=!0})=>{const t=se.useIntl(),n=y.useContext(mt),r=On(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>Re.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(qr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,m=y.useRef(s);y.useEffect(()=>{m.current=s},[s]),Lc({scrollPosition:zw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const v=m.current.menus;!i&&v["site-navigation"]||Re.shouldChangeHeaderIsVisible(!0,v,o)},scrollDown:()=>{const v=m.current.menus;!i&&v["site-navigation"]||Re.shouldChangeHeaderIsVisible(!1,v,o)}}});const p=(v,_,F=!1)=>{Re.handleMenus({id:v,value:_,menus:m.current.menus,dispatch:o,forceHandle:F})},h=y.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(_=>{m.current.menus[_]&&p(_,!1,!0)})};y.useEffect(()=>{var v;return(v=document.getElementById("header"))==null||v.addEventListener("keydown",g),()=>{var _;(_=document.getElementById("header"))==null||_.removeEventListener("keydown",g)}},[]),Xn(()=>{u["site-navigation"]&&Re.autoFocus({menu:"site-navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),Xn(()=>{u["account-navigation"]&&Re.autoFocus({menu:"account-navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Ie,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(dh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Ie,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:h,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:zr.order.map(v=>c.jsx(Ua,{id:v,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},v))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:G({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(Ie,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(oo,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),a?c.jsxs("button",{className:"account-button",onClick:v=>Re.events.onClick(v,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>Re.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>Re.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Ie,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(hn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:zr.buttons.order.map(v=>c.jsx(Ua,{id:`buttons.${v}`},v))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:G("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const qw=()=>{const e=se.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Io,{}),c.jsx("div",{id:"content",children:c.jsx(fn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(Mo,{})]})},mh=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:d="default",variant:m="default",circle:p="default",modal:h="default"}=i,g=Ic(),[f,b]=y.useState(""),v=B=>{const{detail:{message:S}}=B;b(S)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const _=ya(e,{locale:o}),F=ya(t,{locale:o}),x=ya(n,{locale:o}),w={};return d!=="default"&&(w[d]=!0),m!=="default"&&(w[m]=!0),p!=="default"&&(w[p]=!0),c.jsx(Wh.ErrorBoundary,{onError:r,fallback:c.jsx(qw,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:G(s,w,{"has-footer":u}),children:[c.jsx(Io,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[F&&c.jsx("div",{className:G("additional-content prepended",{"large-modal":h==="large"}),children:F}),y.createElement(d==="bold"?ro:"div",{id:"content",children:_,className:G({"large-modal":h==="large"})})]}),x&&c.jsx("div",{className:"additional-content appended",children:x}),u&&c.jsx(Mo,{}),c.jsx(hh,{})]}),f&&c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Ec={default:"tags_",headerTopics:"header_topics_topics_"},is={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"},Ww={getTagDetails:e=>{if(e.includes("topic_")){if(e=is.topic[e.replace("topic_","")],e){const t=zr.topics.topics[e].href;return t?{id:e,href:t,text:`${Ec.headerTopics}${e}`}:null}return null}return is[e]?(e=is[e],{id:e,text:`${Ec.default}${e}`}):null}};const Uw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=se.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=Ww.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:G("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:d}):d},u.id)})})};const Hw=({members:{data:e=[],total:t=e.length},isMember:n=!1,hasNextPage:r=!1,loadNextPage:a=()=>{},profile:i,gtmContext:s="member",gtmType:o="member-click",className:l=""})=>{const u=se.useIntl(),d="membersList",m=y.useContext(mt),[p,h]=y.useState(!1);return e.length===0?null:c.jsxs("div",{className:G("members-list",l),children:[c.jsxs("h1",{children:[u.formatMessage({id:d}),c.jsx("span",{className:"count",children:t})]}),c.jsxs("ul",{children:[n?c.jsxs("li",{children:[c.jsx(Yt,{member:m,gtmContext:s,gtmType:o}),c.jsx(dn,{href:"/profiles/me",className:"text-small",onClick:g=>{g==null||g.preventDefault(),g==null||g.stopPropagation(),h(!0)},children:u.formatMessage({id:`${d}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((g,f)=>c.jsxs("li",{children:[c.jsx(Yt,{member:g,gtmContext:s,gtmType:o}),g.isAdmin&&c.jsx(ln,{children:u.formatMessage({id:`${d}_admin`})})]},f))]}),r&&c.jsx(Ur,{hasNextPage:r,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:s}),i?c.jsx(di,{form:i,showModal:p,content:{title:u.formatMessage({id:`${d}_modal_title`})},functions:{onClose:()=>{h(!1)}}}):c.jsx(c.Fragment,{})]})},Vw={showForm:!1},li=y.createContext(Vw),ph=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(li.Provider,{value:{...t,updateConversation:n},children:e})},_c=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},ci=e=>{var t,n,r,a,i;return e&&!e.error?{id:e==null?void 0:e.id,name:(t=e==null?void 0:e.data)==null?void 0:t.name,organization:(n=e==null?void 0:e.data)==null?void 0:n.organization,jobTitle:(r=e==null?void 0:e.data)==null?void 0:r.jobTitle,location:(a=e==null?void 0:e.data)==null?void 0:a.location,image:{thumbnail:((i=e==null?void 0:e.data)==null?void 0:i.thumbnail)||void 0}}:"deleted"},Kw=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=se.useIntl();return t?c.jsx("small",{children:At(a.formatMessage,`${e}explainer`,n,"action",{a:i=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):c.jsx(c.Fragment,{})},Zw=({formID:e,intlPath:t,showLabel:n,type:r})=>{const a=se.useIntl();return n?c.jsx("label",{htmlFor:`${e}-input`,className:"text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:a.formatMessage({id:`${t}label`})}):c.jsx(Ie,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:At(a.formatMessage,`${t}label_action`,r,"action")})};let ma=null;const Je="discussion_form_",Vr=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r,placeholder:a,maxLength:i=0,buttons:s,forceShow:o={cancel:!1,error:!1},isCommunity:l=!1,functions:u,data:d={},gtmContext:m="DiscussionForm"})=>{var Te,Se,He;const p=se.useIntl(),h=y.useContext(mt),[g,f]=y.useState(""),{isLoading:b=!1,isInWrapper:v=!1,isInOverlay:_=!1,isAutoFocused:F=!1,isEditing:x=!1,hasTitleField:w=!1,isPrepopulated:B=!1,showTitle:S=!1,showGuidelines:z=!0,showDivider:N=!1,showSuccessMessage:I=!0}=r||{},{onChange:M=()=>{},create:k=()=>{},handleSaveEdit:A=()=>{},handleCancel:j=()=>{},callback:L=()=>{},onMention:H=()=>{},listMembers:Y=()=>Promise.resolve([]),clickMentionFallback:Q=()=>{},props:re={create:{projectNames:["questions-answers"]}}}=u,[C,q]=y.useState({title:w&&w.text||"",body:x&&x.text||B&&B.text||""}),[K,E]=y.useState(o.error||!1),[T,$]=y.useState(!1);if(y.useEffect(()=>{l&&!x&&B&&B!==C.body&&q({...C,body:B.text||""})},[B]),b)return c.jsx(Ft,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const R=Be=>{q({...C,body:Be}),M({body:Be});let Fe;!h||!h.id?Fe=At(p.formatMessage,`${Je}error_loggedOut`,t.type,"action"):n?i>0&&Be.length>=i&&(Fe=`${Je}error_tooLong`):Fe=At(p.formatMessage,`${Je}error_noPermission`,t.type,"action"),Fe?E(Fe):K&&E(!1)};let U=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const Be=((Te=t.slugs)==null?void 0:Te.reply)||((Se=t.slugs)==null?void 0:Se.answer)||((He=t.slugs)==null?void 0:He.question)||"";Be&&(U=`${U}-${Be.slice(-15)}`)}e&&(U=`${e}-${U}`);const ae=async()=>{if(!h||!h.id||!n||X)return;ma&&clearTimeout(ma),$("submitting");const Be=window.location.pathname;try{let Fe;switch(t.type){case"post":Fe=await k({title:C.title,content:C.body});break;case"question":Fe=await k({title:C.body,authorId:h&&h.id,...re==null?void 0:re.create});break;case"response":Fe=await k({questionSlug:t.slugs.question},{body:C.body,authorId:h&&h.id,contentPath:Be});break;case"reply":Fe=await k({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:C.body,authorId:h&&h.id,contentPath:Be});break;default:break}await tm(1e3),L&&await L(Fe),ma=setTimeout(()=>{q({title:"",body:""}),$("submitted"),f(At(p.formatMessage,`${Je}success`,t.type,"action"));const Pe=new Event(Xe.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(Pe),J()},500)}catch(Fe){const Pe=Fe;let Ee=`${Je}error`;Pe!=null&&Pe.message.includes("entry already exists")&&(Ee=At(p.formatMessage,`${Je}error_alreadyExists`,t.type,"action")),Pe!=null&&Pe.message.includes("429")?Ee=At(p.formatMessage,`${Je}error_tooMany`,t.type,"action"):Pe!=null&&Pe.message.includes("400")&&(Ee=`${Je}error`),E(Ee),J()}},J=()=>{ma=setTimeout(()=>{E(!1),$(!1),f("")},5e3)},ie=!C.title||!eu(C.title),de=!C.body||!eu(C.body);let X=de;w&&(X=ie&&de);const ye=T==="submitting",me=[{component:Zw,props:{formID:U,intlPath:Je,showLabel:w!==!1,type:t.type}},{component:sh,props:{id:`${U}-input`,value:T==="submitting"&&!K?"":C.body,placeholder:a||At(p.formatMessage,`${Je}placeholder`,t.type,"action"),maxLength:i,meta:{isInOverlay:_},functions:{onChange:R,onMention:H,listMembers:Y,clickMentionFallback:Q},data:d,autoFocus:x!==!1||F&&!w,"aria-invalid":!!K,"aria-errormessage":"error-message"}},{component:Kw,props:{intlPath:Je,showGuidelines:z,type:t.type,gtmContext:m}}];N&&me.push({component:qt}),w&&me.unshift({id:"title",type:"text",value:w.text,limit:250,autoFocus:F,label:p.formatMessage({id:`${Je}titleField_label`}),placeholder:p.formatMessage({id:`${Je}titleField_placeholder`}),functions:{onChange:Be=>{q({...C,title:Be}),M({title:Be})}},validation:[{condition:()=>X,error:p.formatMessage({id:`${Je}titleField_error`})}]});let xe=!h||!h.id||!n||X||ye;return x&&(w?xe=xe||C.body===x.text&&C.title===w.text:xe=xe||C.body===x.text),c.jsxs(c.Fragment,{children:[c.jsxs(Jt,{id:U,className:G("discussion-card discussion-form",{"no-styling":v&&x}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:x&&!ye||o.cancel},functions:{onSuccess:async()=>{if(x){$("submitting"),A(C);return}await ae()},onCancel:j},fields:me,intlPath:Je,button:{variant:"primary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":`${x?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:xe,text:{default:!x&&(s!=null&&s.submit)?s==null?void 0:s.submit:p.formatMessage({id:`${Je}${x?"save":"post"}`}),submitting:p.formatMessage({id:`${Je}${x?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!o.cancel&&(!h||!h.id||!C.body),text:s!=null&&s.cancel?s==null?void 0:s.cancel:p.formatMessage({id:`${Je}cancel`})},gtm:{context:m,event:`${t.type}-form`},"data-testid":`discussion-${t.type}-form`,children:[S&&!x&&["question"].includes(t.type)&&c.jsx("h2",{children:At(p.formatMessage,`${Je}title`,t.type,"action")}),c.jsx(Yt,{member:h?{...h,link:!1}:"community",gtmContext:m,gtmType:"profile-click"})]}),T==="submitted"&&I&&c.jsx(jr,{className:"success","data-testid":"success",children:At(p.formatMessage,`${Je}success`,t.type,"action")}),K&&c.jsx(jr,{id:"error-message",className:"error","data-testid":"error",children:o.error?o.error:typeof K=="string"?K.includes(" ")?K:p.formatMessage({id:K},{action:p.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):K}),g&&c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:g})]})},Yw=Object.freeze(Object.defineProperty({__proto__:null,default:Vr},Symbol.toStringTag,{value:"Module"})),Gw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Qw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Ha=({icon:e,className:t="",...n})=>c.jsx(_e,{className:G("discussion-button",t),variant:"tertiary",icon:e,...n});let Ar=!1;const ss=()=>{Ar!==!1&&(clearTimeout(Ar),Ar=!1)},os=5;let us=null;const gh=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const u=se.useIntl(),d={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[m,p]=y.useReducer(qr,d),{numberOfLikes:h,userLikedContent:g,ignoreInteractions:f,showLikers:b,tabbableLink:v}=m;y.useEffect(()=>{p([{type:"userLikedContent",value:a}])},[a]);const _=y.useMemo(()=>Qw(n,os),[n]),F=S=>{if(S.preventDefault(),S.stopPropagation(),p([{type:"showLikers",value:!1}]),Ar)return ss(),!1;if(ss(),f||!s)return!1;Ar=setTimeout(x,350)},x=async()=>{if(ss(),f||!s)return!1;let S=g?h-1:h+1;S<0&&(S=0),p([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const z=Gw(i.slugs);g?await l(z):await o({...z,payload:{contentPath:window.location.pathname}})}}catch{p([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{p([{type:"ignoreInteractions",value:!1}])}},w=()=>{us=setTimeout(()=>{p([{type:"showLikers",value:!1}])},500)},B=()=>{us&&clearTimeout(us)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&p([{type:"showLikers",value:!1}])},onMouseEnter:()=>{B(),p([{type:"showLikers",value:!0}])},onMouseLeave:()=>{w()}},c.jsxs(c.Fragment,{children:[c.jsx(Ha,{className:G("discussion-button text-medium action-button",{"show-spinner":f,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:F,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:h})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Ie,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{B()},onBlur:()=>w,onClick:S=>{var N;S.preventDefault(),S.stopPropagation(),B(),p([{type:"showLikers",value:!0}]);const z=(N=S.currentTarget.nextSibling)==null?void 0:N.childNodes[0];if(z){const I=z.querySelector("li:first-child a");I&&(p([{type:"tabbableLink",value:0}]),setTimeout(()=>{I.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),w())},"aria-expanded":b,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Ie,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(Pn,{id:`likes-tooltip-${i.slug}`,isOpen:b,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[_.map((S,z)=>{if(typeof S=="string")return null;const N={};return v!==z&&(N.tabIndex=-1),c.jsx("li",{"data-index":z,children:c.jsx(dn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:I=>I==null?void 0:I.stopPropagation(),onFocus:()=>B(),onKeyDown:I=>{var L,H,Y,Q;if(!I||!["ArrowUp","ArrowDown"].includes(I.key||""))return;I.stopPropagation(),I.preventDefault();const M=I.key==="ArrowUp"?"up":"down",k=(L=I.currentTarget)==null?void 0:L.parentElement;let A=k==null?void 0:k.nextElementSibling;if(M==="up"){const re=k==null?void 0:k.previousElementSibling;re?A=re:(A=(H=k==null?void 0:k.parentElement)==null?void 0:H.lastElementChild,(A==null?void 0:A.getAttribute("data-index"))==="-1"&&(A=A==null?void 0:A.previousElementSibling))}else(!A||(A==null?void 0:A.getAttribute("data-index"))==="-1")&&(A=(Y=k==null?void 0:k.parentElement)==null?void 0:Y.firstElementChild);if(!A)return;const j=(A==null?void 0:A.getAttribute("data-index"))||"0";p([{type:"tabbableLink",value:j}]),(Q=A==null?void 0:A.querySelector("a"))==null||Q.focus()},...N,children:S.name?S.name:c.jsx("span",{className:"deleted-user",children:u.formatMessage({id:"member_deleted"})})})},S.id||window.btoa(S.name||""))}),t>os&&c.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-os})})]})})]})]}))},ls=({children:e,class:t,...n})=>{const r={...n,class:G("subtle",t)};return c.jsx("blockquote",{...r,children:e})},Jw=280,Ro=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Jn(e,typeof t=="number"?t:Jw):e;a=a.trim();const i=`<br>
|
|
164
164
|
|
|
165
165
|
`;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await Gc({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const Xw=3e3,eE=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=se.useIntl(),[r,a]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{children:[c.jsx(Pn,{className:G("tooltip-share-link",{"tooltip-share-link-copied":r.isCopied}),isOpen:r.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:r.isCopied?n.formatMessage({id:"discussion_share_copy_link_success"}):n.formatMessage({id:"discussion_share_copy_link"})}),c.jsx(Ha,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>a({...r,isOpen:!0}),onFocus:()=>a({...r,isOpen:!0}),onMouseOut:()=>a({isOpen:!1,isCopied:!1}),onBlur:()=>a({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{a({isOpen:!0,isCopied:!0}),setTimeout(()=>{a({isOpen:!1,isCopied:!1})},Xw)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event})]})},Nt="discussion_",tE=195;let pa=null;const Kr=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:a=!1,originalAuthorId:i,forceHide:s={actionBar:!1,comments:!1,likes:!1},functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:m,isTruncated:p=!1,styling:{showShareLinkButton:h=!1}={},setFocus:g=!1,isCommunity:f=!1})=>{var Se,He,Be,Fe,Pe,Ee,Ve,ze;const b=se.useIntl(),v=y.useContext(mt),_=y.useContext(li),{createContent:F=async()=>{},deleteContent:x=async()=>{},updateContent:w=async()=>{}}=o.content||{},{createLike:B=()=>{},deleteLike:S=()=>{}}=o.likes||{},{openComments:z=()=>{}}=o.comments||{},{listMembers:N=()=>Promise.resolve([]),clickMentionFallback:I=()=>{}}=o.mentions||{},{author:M,canLike:k,createdAt:A,id:j,likes:L=0,userLiked:H,comments:Y=0,mentions:Q}=t,re=v&&v.id&&typeof M!="string"&&M.id&&M.id===v.id||!1,C=typeof k=="boolean"?k:!0,q=re&&(!t.createdAt||Xh(t.createdAt,10,"seconds")),K=y.useRef(null),[E,T]=y.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[$,R]=y.useState(!1),[U,ae]=y.useState(q?"highlighted":"default"),[J,ie]=y.useState("");y.useEffect(()=>{const W=K.current;if(!(!W||U==="default"))return document.addEventListener(Xe.DISCUSSION_FORM_SUBMITTED,de),W.addEventListener("transitionend",X),()=>{document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,de),W.removeEventListener("transitionend",X)}},[]),y.useEffect(()=>{T({...E,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),y.useEffect(()=>{(async()=>{const ne=await Ro(E.body,p,Q,N);T({...E,postBody:ne})})()},[E.body,Q]);const de=()=>{setTimeout(()=>{ae("fading")},1e3)},X=({propertyName:W})=>{W==="background-color"&&ae(ne=>(ne==="default"&&(document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,de),K.current&&K.current.removeEventListener("transitionend",X)),ne==="fading"?"default":ne))};if(a||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||E.postBody===""&&t.title==="")return c.jsx(Ft,{className:"discussion-card"});const ye=async({title:W,body:ne})=>{W||(W=""),ne||(ne=""),ie("");try{if(!hs(W,E.title)||!hs(ne,E.body)){const he=t.type==="question"?{title:ne}:{title:W,body:ne};await w(_c(t.slugs),he)}T({...E,title:W,body:ne,isEditing:!1,didEdit:!0})}catch{ie(`${Nt}form_error`)}},me=()=>{if(_&&_.updateConversation){const W={showForm:!0},ne=t.author;ne&&ne.id&&(f&&(W.prepopulateForm=`@{{${ne.id}}}`),W.mentionData={id:ne.id,name:ne.name}),_.updateConversation(W)}setTimeout(()=>{var Ce,Ze,Ye;const ne=`reply-form-${(t.type==="answer"?t.slug:((Ce=t.slugs)==null?void 0:Ce.reply)||((Ze=t.slugs)==null?void 0:Ze.answer)||((Ye=t.slugs)==null?void 0:Ye.question)||"").toLowerCase().slice(-15)}`,he=document.getElementById(ne),pe=document.getElementById(`${ne}-input`);pe&&pe.focus(),he&&he.scrollIntoView({behavior:"smooth"})},0)},xe=async()=>{R(!1);try{await x(_c(t.slugs))}catch{ie("delete-error")}},Te=[{text:b.formatMessage({id:`${Nt}moreMenu_report`}),onClick:W=>{W.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(b.formatMessage({id:`${Nt}report_subject`}))}&body=${encodeURI(b.formatMessage({id:`${Nt}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&&re&&Te.push({text:b.formatMessage({id:`${Nt}moreMenu_edit`}),onClick:()=>T({...E,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`},{text:b.formatMessage({id:`${Nt}moreMenu_delete`}),onClick:W=>{W.preventDefault(),W.stopPropagation(),R(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,..._d(`delete-${t.slug}-modal`,$)}),r&&o.pins&&Te.push({text:b.formatMessage({id:`${Nt}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),g&&((Se=K==null?void 0:K.current)==null||Se.focus(),(He=K==null?void 0:K.current)==null||He.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:G("discussion-post",u,{[U]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!E.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:K,tabIndex:g?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:W=>{if(!l.post||E.isEditing)return;W.preventDefault(),W.stopPropagation(),pa&&clearTimeout(pa),pa=setTimeout(()=>{window.location.href=l.post},150);const ne=new CustomEvent(Xe.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:pa}});document.dispatchEvent(ne)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:j||t.slug,className:G("discussion-card",t.type,{editing:E.isEditing,"has-link":l.post&&!E.isEditing}),children:[!E.isEditing&&c.jsxs("div",{className:"author-section",children:[c.jsx(Yt,{member:M,additionalContent:{createdAt:A,didEdit:E.didEdit},className:typeof M!="string"&&M.id===i?"highlighted":"",gtmContext:d,gtmType:"profile-click"}),t.pinned&&c.jsx(ln,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Ie,{children:"Pinned Post"})})]}),E.isEditing?c.jsx(Vr,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:E.title!==""?{text:E.title}:!1,isEditing:{text:E.body},isPrepopulated:!1},isCommunity:f,maxLength:t.type==="question"?250:5e4,forceShow:{error:J!==""&&J!=="delete-error"?b.formatMessage({id:J},{action:b.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:F,handleSaveEdit:ye,handleCancel:()=>{ie(""),T({...E,isEditing:!1})},listMembers:N,clickMentionFallback:I},gtmContext:`${d}Form`,data:{mentions:t.mentions}}):l.post?c.jsxs("a",{href:l.post,children:[(E==null?void 0:E.title)&&c.jsx("p",{className:"content-title",children:E==null?void 0:E.title}),E.postBody.length>tE?c.jsx(rd,{text:E.postBody,markdownOptions:{overrides:{a:ys,blockquote:{component:ls}}}}):c.jsx(kn,{options:{overrides:{a:ys,blockquote:{component:ls}}},children:E.postBody})]}):c.jsxs(c.Fragment,{children:[(E==null?void 0:E.title)&&c.jsx("p",{className:"content-title",children:E==null?void 0:E.title}),c.jsx(kn,{options:{wrapper:t.type==="question"?"h1":y.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:ls}}},children:E.postBody})]}),!E.isEditing&&!(s!=null&&s.actionBar)&&c.jsxs("ul",{className:G("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!s.likes&&c.jsx(gh,{element:"li",likes:L,isShort:!1,userLiked:H,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:C,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:B,deleteLike:S}}),!s.comments&&(["question","post"].includes(t.type)||l.comments)&&c.jsx("li",{children:c.jsx(Ha,{onClick:W=>{W.preventDefault(),W.stopPropagation(),l.comments&&(window.location.href=l.comments),typeof z=="function"&&z()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":d,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:b.formatMessage({id:`${Nt}comments_screenReader`},{count:Y}),children:b.formatMessage({id:`${Nt}comments`},{count:Y})})}),(t.type==="answer"||t.type==="reply")&&c.jsx("li",{children:c.jsx(Ha,{styling:{muted:!0},onClick:me,icon:{icon:"speech-bubble_square"},children:b.formatMessage({id:`${Nt}reply`})})}),h&&c.jsx(eE,{url:(Be=t.slugs)!=null&&Be.reply?`${window.location.origin}${(Fe=t.slugs)==null?void 0:Fe.question}/${(Pe=t.slugs)==null?void 0:Pe.answer}#${(Ee=t.slugs)==null?void 0:Ee.reply}`:`${window.location.origin}${(Ve=t.slugs)==null?void 0:Ve.question}/${(ze=t.slugs)==null?void 0:ze.answer}`,gtm:{context:d,event:`copy-link-${t.type}-click`}}),c.jsx(kd,{element:"li",id:`more-${t.slug}`,options:Te})]})]}),m,c.jsx(mn,{id:`delete-${t.slug}-modal`,isOpen:$,functions:{onOpen:()=>{},onClose:()=>R(!1)},forceShow:{error:J==="delete-error"?b.formatMessage({id:"discussion_delete_error"},{action:b.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:b.formatMessage({id:"discussion_delete_title"},{action:b.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>R(!1),children:b.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:xe,children:b.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:c.jsx(se.FormattedMessage,{id:"discussion_delete_text",values:{p:W=>c.jsx("p",{children:W}),action:b.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const nE=y.lazy(()=>Promise.resolve().then(()=>ZE)),rE=65,vh=({forceShow:e,form:t,className:n})=>{const r=se.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(mt)||"community",l=ei(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,m]=y.useState({form:u||Jc("showPost")==="true"||!1,warning:!1}),[p,h]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!p.showCachedText)return;(async()=>{const v=await Ro(p.title||p.body||"",rE,p.mentions);h(_=>({..._,prettifiedText:v}))})()},[p.showCachedText,p.title,p.body]);const g=b=>{if(!p.showCachedText||typeof d.warning=="string")return;let v;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),v=b.detail.link;else{const _=b;_.preventDefault(),_.stopPropagation();const x=_.target.closest("a");v=x&&x.getAttribute("href")}m(_=>({..._,warning:v||!1}))};y.useEffect(()=>{if(!p.showCachedText){document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g);return}return document.addEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.addEventListener(Xe.MEMBER_CLICKED,g),document.addEventListener("click",g),()=>{document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g)}},[p.showCachedText]),y.useEffect(()=>{const b=v=>{if(!(!p.showCachedText||d.warning!==!1))return v.preventDefault(),v.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[p.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return p.showCachedText&&(p.title||p.body)&&(f=p.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:G("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),m(v=>({...v,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(hn,{name:l.name,src:l.image,alt:""}),c.jsx(kn,{className:G("input",{placeholder:!p.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:wt,blockquote:wt,br:wt,em:wt,li:wt,ol:wt,p:wt,s:wt,span:wt,strong:wt,ul:wt}},children:f})]}),c.jsxs(Wr,{children:[c.jsx(nE,{showModal:d.form,functions:{cacheText:h,onClose:()=>{m(b=>({...b,form:!1}))}},form:t,cachedText:p,className:"in-portal"}),c.jsx(mn,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{m(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{m({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":i}],children:c.jsx("p",{children:r.formatMessage({id:`${a}overlay_text`})})})]})]})},aE=y.lazy(()=>Promise.resolve().then(()=>Yw)),$o=({isCard:e=!1,form:t,membershipRequiredToPost:{isMember:n,required:r,join:a,leave:i,notMemberStateText:s}})=>{if(r&&!n)return c.jsx(fn,{text:s,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(so,{isShort:!0,functions:{join:a,leave:i}})}});const{content:o,functions:l,meta:u,...d}=t,m={content:{type:(o==null?void 0:o.type)||"reply",slugs:(o==null?void 0:o.slugs)||{}},functions:{...l,create:(l==null?void 0:l.create)||(()=>{})},meta:{...u,isEditing:(u==null?void 0:u.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1},...d,id:`add-post-${d.id||""}`};return e?c.jsx(vh,{form:m}):c.jsx(aE,{...m})},Lo=({form:e})=>{const t=y.useContext(mt),n=se.useIntl(),[r,a]=y.useState(!1),i=()=>{um(t)||a(!0)};y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(di,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const cs="discussion_responses_",bh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=se.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${cs}title`},{action:r.formatMessage({id:`${cs}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:At(r.formatMessage,`${cs}empty`,e,e)})]})};const yh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=se.useIntl(),s=y.useContext(li),o=ya(a,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:G("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(Ur,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx(Vr,{...r})]})},iE="post",sE="reply",Dh="00000000-0000-0000-0000-000000000000";function zo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function qo({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return e.setQueryData(t,r),a}return n}function oE(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function uE(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Ch(e){const{id:t="",name:n="",organization:r="",jobTitle:a="",image:i={}}=e,{thumbnail:s=""}=i;return{id:t,data:{name:n,organization:r,jobTitle:a,thumbnail:s}}}function lE({title:e,content:t}){return{title:e,content:t,id:Dh,time:new Date().toISOString(),verb:iE}}function kc({activity:e,user:t}){return{...e,actor:Ch(t),...oE()}}function Va({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((a=e.own_reactions)==null?void 0:a.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function xh({activity:e,user:t}){var n,r,a;e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like-1:0},t!=null&&t.id&&(e.latest_reactions={...e.latest_reactions||{},like:(((r=e.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((a=e.own_reactions)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function Ka({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},pin:[...((r=e.latest_reactions)==null?void 0:r.pin)||[],t]},e.own_reactions={...e.own_reactions||{},pin:[...((a=e.own_reactions)==null?void 0:a.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function wh({activity:e}){var t;e.reaction_counts={...e.reaction_counts||{},pin:(t=e.reaction_counts)!=null&&t.pin?e.reaction_counts.pin-1:0},e.latest_reactions={...e.latest_reactions||{},pin:[]},e.own_reactions={...e.own_reactions||{},pin:[]}}function cE({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Dh,kind:sE,parent:t||""}}function Fc({reply:e,user:t}){const n=Ch(t);return{...e,user_id:n.id,user:n,...uE()}}function Bc({reply:e,reaction:t}){var n,r,a;t?(e.latest_children={...e.latest_children||{},like:[...((r=e.latest_children)==null?void 0:r.like)||[],t]},e.own_children={...e.own_children||{},like:[...((a=e.own_children)==null?void 0:a.like)||[],t]}):e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like+1:1}}function dE({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}const Eh=(e,t)=>{const n=new CustomEvent(Xe.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let Ac,ds=0;const _h=()=>{y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(Ac);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),ds=0;return}ds++,!(ds>10)&&(Ac=setTimeout(()=>{e(t)},50))}},ar=Object.freeze({id:"some-user-id-1",name:"some user name 1",organization:"some user organization 1",jobTitle:"some user job title 1",image:{thumbnail:"https://some-user-thumbnail.com/avatar1.png"},isLoading:!1}),Wt=Object.freeze({id:"some-user-id-2",name:"some user name 2",organization:"some user organization 2",jobTitle:"some user job title 2",image:{thumbnail:"https://some-user-thumbnail.com/avatar2.png"},isLoading:!1}),Wo=Object.freeze({actor:`SU:${ar.id}`,content:"some content 1",duration:"5.53ms",feed_id:"some-feed-id-1",foreign_id:"post:some-foriegn-id-1",id:"some-activity-id-1",object:"comment",time:"2023-11-24T17:52:36.162000",verb:"post"}),fE=Object.freeze({actor:`SU:${Wt.id}`,content:"some content 2",duration:"5.53ms",feed_id:"some-feed-id-2",foreign_id:"post:some-foriegn-id-2",id:"some-activity-id-2",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"}),hE=Object.freeze({actor:`SU:${ar.id}`,content:"some content 3",duration:"5.53ms",feed_id:"some-feed-id-3",foreign_id:"post:some-foriegn-id-3",id:"some-activity-id-3",object:"comment",time:"2023-11-24T17:56:36.162000",verb:"post"}),mE=Object.freeze({actor:`SU:${Wt.id}`,content:"some content 4",duration:"5.53ms",feed_id:"some-feed-id-4",foreign_id:"post:some-foriegn-id-4",id:"some-activity-id-4",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"});Object.freeze({id:"some-reaction-id-1",activity_id:Wo.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Wt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Wt.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({id:"some-reaction-id-1",activity_id:Wo.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Wt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Wt.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-1",user_id:Wt.id,user:{id:Wt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Wo.id,data:{content:"Some content 1..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-2",user_id:ar.id,user:{id:ar.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:fE.id,data:{content:"Some content 2..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Wt.id,user:{id:Wt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:hE.id,data:{content:"Some content 3..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:ar.id,user:{id:ar.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:mE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function pE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=kc({activity:lE(o),user:i});return Tc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=kc({activity:o,user:i});r.setQueryData(a,Tc(d,u,!0)),setTimeout(()=>{Eh(d.id,"activity")},0)}});return s}function gE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Sn(a,s);return o&&(o.content=i),s}),onError:n});return r}function vE({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i,pin:s,unpin:o},queryKey:l,rankingMethod:u}){const d=qe.useQueryClient(),m=Xa(),p={queryClient:d,queryKey:l},h={mutationHandlers:{error:zo(p),mutate:qo(p)},user:m,...p},g=pE({...h,mutationFn:e}),f=gE({...h,mutationFn:t}),b=bE({...h,mutationFn:n}),v=CE({...h,mutationFn:a}),_=xE({...h,mutationFn:i}),F=DE({...h,mutationFn:s}),x=wE({...h,mutationFn:o}),{activities:w,...B}=yE({queryKey:l,queryFn:r,rankingMethod:u});return{activities:w,mutations:{create:g,edit:f,remove:v,like:b,unlike:_,pin:F,unpin:x},user:m,...B}}function bE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Sn(s,o);return l&&Va({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Sn(o,l);u&&Va({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function yE({queryFn:e,queryKey:t,rankingMethod:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`ranking=${n}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&ranking=${n}`:null});return{activities:_E(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function DE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Sn(s,o);return l&&Ka({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Sn(o,l);u&&Ka({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function CE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>EE(a,i)),onError:n});return r}function xE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Sn(i,s);return o&&xh({activity:o,user:r}),s}),onError:n});return a}function wE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Sn(i,s);return o&&wh({activity:o,user:r}),s}),onError:n});return a}function Tc(e,t,n=!1){return t?(n?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t):{pages:[{next:"",results:[e]}],pageParams:[""]}}function Sn(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function EE(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function _E(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const kE=({basePath:e,parentId:t,isMember:n,isOwner:r,functions:{activities:a,mentions:i,join:s,leave:o},profile:l})=>{const u=Pm(Xs.COMMUNITY_RANKING),d=se.useIntl(),[m,p]=y.useState("community_feed_live"),[h,g]=y.useState([{id:"recent_with_pin",label:"recent"},{id:"community_feed_live",label:"popular"}]),{activities:f,error:b,fetchNextPage:v,hasNextPage:_,isLoading:F,mutations:{create:x,edit:w,remove:B,like:S,unlike:z,pin:N,unpin:I}}=vE({queryKey:[e,t,"activities",m],queryFns:a,rankingMethod:m});y.useEffect(()=>{u&&g(h.concat(u))},[u]);const[M,k]=y.useState(null),A=()=>{k(f.length),v()};return _h(),b?c.jsx(fn,{variant:"error",text:b.message}):c.jsxs("section",{children:[c.jsx($o,{isCard:!0,form:{content:{type:"post",slugs:{}},functions:{create:x,...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:s,leave:o,notMemberStateText:d.formatMessage({id:"community_joinToPost"})}}),c.jsx(Jt,{className:"activities-feed-sorting-form",fields:[{id:"feed-sorting",label:d.formatMessage({id:"activitiesFeed_sorting_label"}),type:"select",options:h.map(({id:j,label:L})=>({id:j,label:d.formatMessage({id:`activitiesFeed_rankingMethod_${L}`})})),initialValue:m,functions:{onChange:j=>p(j)},gtm:{context:"Community Sorting",event:"community-sorting-click"}}],button:{hideButton:!0},functions:{onCatch:()=>{},onFailure:()=>{},onSuccess:async()=>{},onCancel:()=>{}},id:"activities-feed-sorting-form"}),f==null?void 0:f.map((j,L)=>{var $,R,U;const{id:H,own_reactions:Y,latest_reactions:Q,reaction_counts:re,mentioned_users:C}=j,q=((($=Q==null?void 0:Q.like)==null?void 0:$.length)||0)>0,K=(((R=Y==null?void 0:Y.like)==null?void 0:R.length)||0)>0,E=K?Y==null?void 0:Y.like[0].id:"",T=q?(U=Q==null?void 0:Q.like)==null?void 0:U.map(ae=>{var J,ie,de;return{id:(J=ae==null?void 0:ae.user)==null?void 0:J.id,name:(de=(ie=ae==null?void 0:ae.user)==null?void 0:ie.data)==null?void 0:de.name}}):!1;return c.jsx(y.Fragment,{children:c.jsx(Kr,{content:{type:"post",title:j==null?void 0:j.title,body:j==null?void 0:j.content,canLike:n,createdAt:(j==null?void 0:j.time)||"",slugs:{question:`${e}/${t}`,answer:H},slug:H,author:ci(j==null?void 0:j.actor),userLiked:K,likes:(re==null?void 0:re.like)||0,comments:(re==null?void 0:re.reply)||0,peopleWhoLiked:T,mentions:C,pinned:(re==null?void 0:re.pin)&&(re==null?void 0:re.pin)>0||!1},links:{post:`${e}/${t}/${H}`,comments:`${e}/${t}/${H}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>B({activityId:H}),updateContent:(ae,{body:J})=>w({activityId:H,content:J})},likes:{createLike:()=>S({activityId:H}),deleteLike:()=>z({activityId:H,reactionId:E})},comments:{openComments:()=>null},pins:{createPin:()=>N({activityId:H}),deletePin:()=>I({activityId:H,reactionId:Q==null?void 0:Q.pin[0].id})},mentions:i},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:L===M,userHasOwnerPermissions:r})},H)}),!F&&c.jsx(Ur,{hasNextPage:_,loadNextPage:A,icon:{icon:"arrow-down",position:"right"},messages:{button:d.formatMessage({id:"loadMore_button"}),error:d.formatMessage({id:"loadMore_error"})}}),c.jsx(Lo,{form:l})]})},FE={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function BE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Fc({reply:cE(o),user:i});return Sc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=Fc({reply:o,user:i});r.setQueryData(a,Sc(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Eh(d.id,"reply")},0)}});return s}function AE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Za(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function kh({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=Xa(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:zo(u),mutate:qo(u)},user:l,...u},m=BE({...d,mutationFn:e}),p=AE({...d,mutationFn:t}),h=TE({...d,mutationFn:n}),g=jE({...d,mutationFn:a}),f=OE({...d,mutationFn:i}),{replies:b,...v}=SE({queryKey:s,queryFn:r});return{replies:b,mutations:{create:m,edit:p,remove:g,like:h,unlike:f},user:l,...v}}function TE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Za(s,o);return l&&Bc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Za(o,l);u&&Bc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function SE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=RE(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function jE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>IE(a,i)),onError:n});return r}function OE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Za(i,s);return o&&dE({reply:o,user:r}),s}),onError:n});return a}function PE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function NE(e,t,n){const r=t.pages.length-1,a=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[a]=e:t.pages[r].results.push(e),t}function ME(e,t,n){return n!=null&&n.replace?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t}function Sc(e,t,n){return t?n!=null&&n.append?NE(e,t,n):ME(e,t,n):PE(e)}function Za(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function IE(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function RE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const $E=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=se.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:d,isLoading:m,mutations:{create:p,edit:h,like:g,remove:f,unlike:b},user:v}=kh({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:x=>i.list({...x,reactionId:r})}});Zs([m]);const[_,F]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(l==null?void 0:l.length)>=o&&c.jsx(_e,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${_?"up_left":"down_right"}`,position:"left"},onClick:()=>F(!_),children:s.formatMessage({id:`discussion_thread_${_?"hide":"show"}`},{count:l==null?void 0:l.length})}),_&&c.jsx(yh,{loadMore:{isLoading:m,hasNextPage:d,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(x,{body:w})=>p({activityId:n,replyId:r,content:w}),listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(x=>{var Y,Q,re,C,q,K,E;const{id:w,own_children:B,latest_children:S,children_counts:z,data:{mentioned_users:N}}=x,M=(((Y=B==null?void 0:B.like)==null?void 0:Y.length)||0)>0?(Q=B==null?void 0:B.like)==null?void 0:Q.find(T=>{var $;return(($=T==null?void 0:T.user)==null?void 0:$.id)===(v==null?void 0:v.id)}):!1,k=M?M==null?void 0:M.id:"",A=!!M,L=(((re=S==null?void 0:S.like)==null?void 0:re.length)||0)>0?(C=S==null?void 0:S.like)==null?void 0:C.map(T=>{var $,R,U;return{id:($=T==null?void 0:T.user)==null?void 0:$.id,name:(U=(R=T==null?void 0:T.user)==null?void 0:R.data)==null?void 0:U.name}}):!1,H=typeof x.data.content=="string"?(q=x==null?void 0:x.data)==null?void 0:q.content:((E=(K=x==null?void 0:x.data)==null?void 0:K.content)==null?void 0:E.text)||"";return c.jsx(Kr,{isCommunity:!0,content:{id:w,type:"reply",body:H,canLike:a,createdAt:x==null?void 0:x.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:x==null?void 0:x.parent},slug:"",author:ci(x==null?void 0:x.user),userLiked:A,likes:(z==null?void 0:z.like)||0,peopleWhoLiked:L,mentions:N},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:w}),updateContent:(T,{body:$})=>h({replyId:w,content:$})},likes:{createLike:()=>g({replyId:w}),deleteLike:()=>b({replyId:w,reactionId:k})},comments:{},mentions:{listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback}},styling:{showShareLinkButton:!0}},w)}):null})]})};const Fh=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,mentions:i,join:s,leave:o},profile:l})=>{const u=se.useIntl(),{replies:d,repliesCount:m,fetchNextPage:p,hasNextPage:h,isLoading:g,mutations:{create:f,edit:b,like:v,remove:_,unlike:F},user:x}=kh({queryKey:[e,t,n,"replies"],queryFns:a}),w=()=>{S(d.length),p()},[B,S]=y.useState(null);return Zs([g]),_h(),c.jsxs("section",{className:"replies-feed",children:[c.jsx(bh,{type:"comment",responses:m,isLoading:g}),c.jsx($o,{form:{content:{type:"reply",slugs:{}},functions:{create:(z,{body:N})=>f({activityId:n,content:N}),...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:u.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:s,leave:o,notMemberStateText:u.formatMessage({id:"community_joinToPost"})}}),d==null?void 0:d.map((z,N)=>{var K,E,T,$,R,U,ae;const{id:I,own_children:M,latest_children:k,children_counts:A,data:{mentioned_users:j}}=z,H=(((K=M==null?void 0:M.like)==null?void 0:K.length)||0)>0?(E=M==null?void 0:M.like)==null?void 0:E.find(J=>{var ie;return((ie=J==null?void 0:J.user)==null?void 0:ie.id)===(x==null?void 0:x.id)}):!1,Y=H?H==null?void 0:H.id:"",Q=!!H,C=(((T=k==null?void 0:k.like)==null?void 0:T.length)||0)>0?($=k==null?void 0:k.like)==null?void 0:$.map(J=>{var ie,de,X;return{id:(ie=J==null?void 0:J.user)==null?void 0:ie.id,name:(X=(de=J==null?void 0:J.user)==null?void 0:de.data)==null?void 0:X.name}}):!1,q=typeof z.data.content=="string"?(R=z==null?void 0:z.data)==null?void 0:R.content:((ae=(U=z==null?void 0:z.data)==null?void 0:U.content)==null?void 0:ae.text)||"";return c.jsx(ph,{children:c.jsx(Kr,{isCommunity:!0,content:{id:I,type:"reply",body:q,canLike:r,createdAt:z==null?void 0:z.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:I},slug:I,author:ci(z==null?void 0:z.user),userLiked:Q,likes:(A==null?void 0:A.like)||0,peopleWhoLiked:C,mentions:j},functions:{content:{createContent:()=>null,deleteContent:()=>_({replyId:I}),updateContent:(J,{body:ie})=>b({replyId:I,content:ie})},likes:{createLike:()=>v({replyId:I}),deleteLike:()=>F({replyId:I,reactionId:Y})},comments:{},mentions:i},children:c.jsx($E,{basePath:e,parentId:t,activityId:n,replyId:I,isMember:r,functions:{...a,...i}}),styling:{showShareLinkButton:!0},setFocus:N===B},I)},I)}),!g&&c.jsx(Ur,{hasNextPage:h,loadNextPage:w,icon:{icon:"arrow-down",position:"right"},messages:{button:u.formatMessage({id:"loadMore_button"}),error:u.formatMessage({id:"loadMore_error"})}}),c.jsx(Lo,{form:l})]})};function LE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({content:a,title:i})=>t(s=>(s&&(a!=null&&(s.content=a),i!=null&&(s.title=i)),s)),onError:n});return r}function zE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=qe.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function qE({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=qe.useQueryClient(),l=Xa(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:zo(u),mutate:qo(u)},user:l,...u},m=LE({...d,mutationFn:t}),p=WE({...d,mutationFn:n}),h=UE({...d,mutationFn:r}),g=HE({...d,mutationFn:a}),f=VE({...d,mutationFn:i}),{activity:b,...v}=zE({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:m,like:p,unlike:h,pin:g,unpin:f},user:l,...v}}function WE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Va({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Va({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function UE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&xh({activity:s,user:r}),s)),onError:n});return a}function HE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ka({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ka({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function VE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&wh({activity:s,user:r}),s))),onError:n});return a}const KE=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},reactions:o,mentions:l,join:u,leave:d},profile:m})=>{var A,j,L,H,Y,Q,re;const p=se.useIntl(),{activity:h,error:g,isLoading:f,mutations:{edit:b,like:v,unlike:_,pin:F,unpin:x}}=qE({queryFns:s,queryKey:[e,t,n]});if(f)return c.jsx(Ft,{style:{height:"400px"}});if(g||!h)return c.jsx(fn,{variant:"error",text:p.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:w,latest_reactions:B,mentioned_users:S}=h,z=(((A=B==null?void 0:B.like)==null?void 0:A.length)||0)>0,N=(((j=w==null?void 0:w.like)==null?void 0:j.length)||0)>0,I=N?w==null?void 0:w.like[0].id:"",M=z?(L=B==null?void 0:B.like)==null?void 0:L.map(C=>{var q,K,E;return{id:(q=C==null?void 0:C.user)==null?void 0:q.id,name:(E=(K=C==null?void 0:C.user)==null?void 0:K.data)==null?void 0:E.name}}):!1,k=h==null?void 0:h.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(Kr,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:h==null?void 0:h.title,body:h==null?void 0:h.content,canLike:r,createdAt:(h==null?void 0:h.time)||"",slugs:{question:`${e}/${t}`,answer:h==null?void 0:h.id},slug:n,author:ci(k),userLiked:N,likes:((H=h==null?void 0:h.reaction_counts)==null?void 0:H.like)||0,comments:((Y=h==null?void 0:h.reaction_counts)==null?void 0:Y.reply)||0,peopleWhoLiked:M,mentions:S,pinned:((Q=h==null?void 0:h.reaction_counts)==null?void 0:Q.pin)&&((re=h==null?void 0:h.reaction_counts)==null?void 0:re.pin)>0||!1},originalAuthorId:k==null?void 0:k.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(C,{title:q,body:K})=>b({title:q,content:K})},likes:{createLike:()=>v({activityId:n}),deleteLike:()=>_({activityId:n,reactionId:I})},comments:{openComments:()=>{}},pins:{createPin:()=>F({activityId:n}),deletePin:()=>{var C;return x({activityId:n,reactionId:(C=B==null?void 0:B.pin)==null?void 0:C[0].id})}},mentions:l},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a},n),c.jsx(Fh,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:o,mentions:l,join:u,leave:d},profile:m})]})};const Bh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=se.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:m}=n,{title:p="",body:h="",mentions:g}=r||{},f="discussion-form-modal";return c.jsx(mn,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(p!==""||h!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:G("discussion-form-modal",a),children:c.jsx(Vr,{...n,data:{...u,mentions:g||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:h||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...m,onChange:b=>{l(v=>({...v,...b}))},onMention:({id:b,name:v}={})=>{if(!b||!v)return;const _=g||{};_[b]={created_at:"",updated_at:"",id:b,data:{name:v}},l(F=>({...F,mentions:_}))},create:async b=>{o(),m.create&&await m.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),m.handleSaveEdit&&await m.handleSaveEdit(b),l({showCachedText:!1})}}})})},ZE=Object.freeze(Object.defineProperty({__proto__:null,default:Bh},Symbol.toStringTag,{value:"Module"}));const YE=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const d=se.useIntl();return r||(r=d.formatMessage({id:"inviteModal_formTitle"})),a||(a=d.formatMessage({id:"inviteModal_formLabel"})),i||(i=d.formatMessage({id:"inviteModal_cta"})),c.jsx(mn,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:G("invite-modal",e,{success:!!n}),children:c.jsx(lh,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const di=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=se.useIntl(),[l,u]=y.useState(Jc("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(mn,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:G("profile-modal",s,{success:!!t}),maxWidth:700,children:c.jsxs(c.Fragment,{children:[t&&n||r?c.jsxs("div",{className:"intro",children:[t&&n?c.jsx("h3",{children:n}):"",r?c.jsx("p",{children:r}):""]}):null,c.jsx(ch,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async m=>{var p;try{(p=i==null?void 0:i.functions)!=null&&p.onSuccess&&await i.functions.onSuccess(m)}finally{d()}}}})]})})},GE=Object.freeze(Object.defineProperty({__proto__:null,default:di},Symbol.toStringTag,{value:"Module"}));const QE=({members:e})=>{const[t,n]=y.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return c.jsxs(c.Fragment,{children:[c.jsx(hn,{name:i,src:l}),c.jsx("p",{children:i}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(a=>c.jsx("li",{children:c.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),c.jsx(mn,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(kn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const JE=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:G("testimonial-block",a),children:[c.jsx(Lt,{className:"testimonial",children:n}),r?c.jsx(Yt,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:G("author",{"text-small":!a.includes("new")}),children:e}),t&&c.jsx("p",{className:G("author-cite",{"text-small":!a.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),XE=y.memo(JE);const e_=({items:e=[],selector:t="",className:n=""})=>{const r=se.useIntl(),[a,i]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&c.jsxs(jt,{variant:"subtle",className:G("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:a.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const fi=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=se.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const m=d/60,p=Math.floor(m),h=(m-p)*60,g=Math.round(h),f=`${i.formatMessage({id:`${s}hours`},{time:p})}${p>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${p>0?`${i.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:m}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:m})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:G("time-to-complete",a),"aria-label":u,children:l})};const t_=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",c.jsx(or,{...n,className:G("banner",e),image:{...t,aspect:"banner"}})):null;const n_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],r_=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],m={eyebrow:"small",title:"h1",text:"p"},p={};d.forEach(b=>{if(!t[b]){p[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){p[b]=t[b];const{text:v,element:_}=t[b];if(_&&n_.includes(_.toLowerCase()))return;p[b]={text:v,element:m[b]};return}p[b]={text:t[b],element:m[b]}}});const h=o&&o.text&&o.link;return h&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),c.jsx(vn,{className:G("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":h,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(p[b]&&typeof p[b]=="object"){const{text:v,element:_=""}=p[b];return b==="text"?c.jsx(kn,{overrideType:"text-only",className:"text",children:v},b):y.createElement(_,{key:b,className:b},v)}return null}),l,h&&c.jsx(_e,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:G({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&c.jsx(or,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},a_=y.memo(r_);const i_=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(vn,{className:G("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const s_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(kn,{children:n}):n;return c.jsxs(vn,{className:G("highlight-section",t),children:[r&&c.jsx("div",{className:G("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(or,{image:{...r,description:""}})}),c.jsx("div",{className:G("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:G("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:c.jsx("div",{className:"content-default",children:a})})})]})},o_=y.memo(s_);const u_=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:c.jsxs("aside",{className:G("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(_e,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),l_=({type:e,data:t})=>{const n=se.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const m=a&&gs(a);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):Gs(d)});if(o)return c.jsx(ln,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const m=u&&gs(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})})]})}return null},c_={title:66,text:3e3,secondaryText:1e3,partner:34},Ya={communityPage:{basePath:"/communities/",className:"communityPage",gtmEvent:"community"},customCard:{className:"custom",gtmEvent:"custom",length:{text:335,secondaryText:150}},event:{basePath:"/events/",className:"event",gtmEvent:"event"},microcourse:{basePath:"/microcourses/en/",className:"course",gtmEvent:"microcourse-overview"},solutionArticle:{basePath:"/solution-articles/en/",className:"article",length:{title:60},gtmEvent:"article"},qaQuestion:{basePath:"/questions-answers/",className:"question",length:{title:190},gtmEvent:"q-and-a-question"},listPage:{basePath:"/list/en/",className:"list",gtmEvent:"list"},people:{basePath:"/profiles/",className:"people",length:{people:1e3},gtmEvent:"person"},learningHub:{basePath:"/learning-hub/",className:"learning-hub",length:{title:190},gtmEvent:"learning-hub"}},d_=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const a=se.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:m}=e,p=e.contentType;let h="";if((f=Ya[p])!=null&&f.gtmEvent&&(h=Ya[p].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${h}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?c.jsx(_e,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(p)&&d!=="premium"){const v=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),_=async F=>{if(F.preventDefault(),F.stopPropagation(),!(v||!t||!t.onClick)){s(x=>({...x,loading:!0}));try{const x=await t.onClick(e);s(x==="success"?()=>({registered:!0,loading:!1}):w=>({...w,loading:!1}))}catch{s(w=>({...w,loading:!1}))}}};return c.jsx("p",{className:G("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(_e,{onClick:_,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${p}: ${m}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${p}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};function f_({buildMemberData:e,communitySlug:t}){const n=se.useIntl(),[r,a]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t).then(i=>{if(!i)return;const{membersCount:s,role:o=""}=i;a({count:s==null?void 0:s.toString(),isMember:!!o,memberType:o})})},[t,e]),c.jsxs("span",{className:"member-information",children:[r.isMember&&c.jsx(ln,{size:"small",variant:"registered",icon:(r==null?void 0:r.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${r.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:r.count})})]})}const Uo=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,setFocus:l=!1})=>{var M,k;const u=se.useIntl(),d=y.useContext(mt),m=!!(d!=null&&d.id),p=y.useRef(null),[h,g]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,m).then(A=>{g({data:A,isLoading:!1})}).catch(()=>g(A=>({...A,isLoading:!1})))},[a,m,n]);const{data:f,isLoading:b}=h;if(b||!f)return c.jsx(Ft,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:v}=f;if(!v||!Ya[v])return c.jsx(Ft,{element:"li",className:"card-wrapper"});const{basePath:_="",className:F,length:x,gtmEvent:w}=Ya[v];let B=f.slug?`${_}${f.slug}`:!1;f.slug&&(f.slug.slice(0,4)==="http"||f.slug.slice(0,2)==="//"||f.slug.slice(0,6)==="mailto"||f.slug.slice(0,3)==="tel")&&(B=f.slug);const S=A=>{B&&(A.preventDefault(),A.stopPropagation(),window.location.href=B)},z={...c_,...x};let N={className:"card"},I={};return B&&(I={href:B,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${w}-click`,"data-testid":"link"},f.openInNewTab&&(I.target="_blank"),N={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${w}-click`}),l&&(N={...N,tabIndex:"0"},(M=p==null?void 0:p.current)==null||M.focus(),(k=p==null?void 0:p.current)==null||k.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:G("card-wrapper text-medium",F,t,{"has-link":B,"no-link":!B,"has-image":f.banner}),"data-testid":`${v}-card`,children:c.jsxs("div",{...N,ref:p,children:[c.jsx(ed,{className:"card-label",contentType:v,customIcon:f.isPrivate?"lock-locked":f.customIcon,customLabel:f.customLabel}),v==="communityPage"&&(f==null?void 0:f.createdAt)&&em(f==null?void 0:f.createdAt,60)&&c.jsx(ln,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),f.startDate&&!f.isOngoingEvent&&c.jsx(ln,{size:"small",variant:f.dateHasPassed?"default":"information","data-testid":"date",children:f.dateHasPassed?u.formatMessage({id:"card_ended"}):Zc(f.startDate)}),f.banner?c.jsxs("p",{className:"img",children:[f.registered&&c.jsx(ln,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(or,{image:{...f.banner,description:""}})]}):F==="people"?c.jsx(hn,{name:f.title||"",src:f.profile,"data-testid":"people-profile-picture"}):null,f.contributors&&c.jsx(no,{contributors:{data:f.contributors},styling:{size:"small",showGap:F!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(v)?u.formatMessage({id:`card_contributors_${v}`}):void 0,"data-testid":"contributors"}),f.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:f.partner.length>1?u.formatMessage({id:"card_partner"},{partner:f.partner[0],number:f.partner.length-1}):Jn(f.partner[0],z.partner)}),["title","text","secondaryText"].map(A=>{const j=f[A];if(!j)return null;const L=Wc(A),H={key:A,className:L,"data-testid":L},Y={wrapper:"p",forceWrapper:!0,forceInline:!0},Q=Jn(j,z[A]);return["title","text"].includes(A)&&B?(Y.wrapper="a",c.jsx("p",{...H,children:c.jsx(Lt,{options:Y,...I,children:Q})})):c.jsx(Lt,{options:Y,...H,children:Q})}),a.contentType==="communityPage"&&(a.slug||f.slug)&&r&&c.jsx(f_,{communitySlug:a.slug||f.slug,buildMemberData:r}),c.jsx(l_,{type:F||"",data:f}),c.jsx(d_,{data:f,cta:i,link:B||"",gtmContext:s})]})})};const Ah=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:G("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return c.jsx(Uo,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),h_=(e,t,n,r)=>{const a=t*n<=e,i=e<t*(n+1),s=r.includes(Math.floor(e/t));return a&&i||s},m_=({id:e,title:t})=>{const n=se.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return y.createElement(a,{className:G("title",i,s,{"highlighted-title":i==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const fs={fourCards:1024,threeCards:769,twoCards:480};let ga=null;const p_=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=se.useIntl(),[u,d]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:m,isLoading:p}=u,[h,g]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:f,loadedPages:b}=h,[v,_]=y.useState(""),F=t.length,x=Math.ceil(F/m),w=y.useRef(null),B=On(!0,!0,w==null?void 0:w.current);y.useEffect(()=>{let k=1;B&&(B>=fs.fourCards?k=4:B>=fs.threeCards?k=3:B>=fs.twoCards&&(k=2),k>F&&(k=F)),d(A=>({...A,cardsPerPage:k,isLoading:!1}))},[B,F]);const S=(k="next")=>{let A=f;if(typeof k=="string")if(k==="next")if(f<x-1)A=f+1;else return;else if(f>0)A=f-1;else return;else A=k;g(L=>({...L,currentPage:A,loadedPages:[...new Set([...b,A])]}));const j=()=>{const L=A*u.cardsPerPage,H=L+u.cardsPerPage;return t.slice(L,H).length};_(l.formatMessage({id:"carousel_pagination_aria_live"},{direction:k,count:j()}))},z=k=>{ga=k.touches[0].clientX},N=k=>{if(ga===null)return;const A=k.touches[0].clientX,j=ga-A;j>5?S("next"):j<-5&&S("previous"),ga=null},I={"--width":`${B||0}px`,"--total-cards":F,"--cards-per-page":m,"--page":f};if(p)return c.jsx(Js,{layout:`carousel${a?"-with-title":""}`});const M=(k,A)=>{var L;let j=null;return(L=k==null?void 0:k.sys)!=null&&L.id?j=`card-${k.sys.id}`:k!=null&&k.slug?j=`card-${k.slug}`:[n[A],k.contentType].includes("customCard")&&(j=`card-${window.btoa(`${k.title} ${k.createdAt}`)}-${A}`),j};return c.jsxs("section",{ref:w,className:G("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(m_,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:z,onTouchMove:N,style:I,"data-testid":"carousel-list",children:t.map((k,A)=>{let j=M(k,A);return j&&h_(A,m,f,b)?c.jsx(Uo,{id:j,card:{...k,contentType:n[A]},buildCardData:r,gtmContext:s,...o},j):(j=j||`${e}-card-${A}`,c.jsx(Ft,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},j))})}),x<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(_e,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:k=>{k.preventDefault(),k.stopPropagation(),S("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:f<=0})}),[...Array(x)].map((k,A)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:G("page-indicator",{selected:A===f}),onClick:j=>{j.preventDefault(),j.stopPropagation(),S(A)},children:c.jsx(Ie,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:A+1,total:x})})})},`page-indicator-${A}`)),c.jsx("li",{className:"arrow next",children:c.jsx(_e,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:k=>{k.preventDefault(),k.stopPropagation(),S("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:f>=x-1})})]}),c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:v})]})]})},g_=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=i?window.btoa(i):`carousel-${u}`,m=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(Js,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:c.jsx(qt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(p_,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),m?null:c.jsx(qt,{})]},`carousel-${d}`)});const v_=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=se.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return y.createElement(e,{className:G("course-progression",o,{"highlight-percentage":d,"has-circle-graph":i==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:m=>c.jsx("strong",{children:m}),number:u})}),u<100&&a&&c.jsx(fi,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(Qs,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Th=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>y.createElement(e,{className:G("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Sh=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=se.useIntl(),o=Qa(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Hc(a||"");return c.jsxs("small",{className:G("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:G("type",n),children:o})," ",t>0&&!r&&c.jsx(fi,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const b_=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const m=se.useIntl(),p="courseStructure_",h=u.toLowerCase().includes("course conclusion");return c.jsxs(Ja,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[m.formatMessage({id:`${p}section${h?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?m.formatMessage({id:`${p}time_completed`}):c.jsx(fi,{time:s,appendedText:a?m.formatMessage({id:`${p}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:f,contentType:b,icon:v,image:_,isIntroduction:F,optional:x,slug:w,subsectionId:B,title:S,type:z})=>{const N=a&&t||F,I={};return _&&(I.style={"--image":`url(${_})`}),c.jsx("li",{className:G({article:b===yr.ARTICLE,discussion:b===yr.DISCUSSION,quiz:b===yr.QUIZ,completed:g&&b===yr.ARTICLE,locked:!N}),...I,children:c.jsx(dn,{href:N?`/microcourses/en/${o}/${w}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Uc(S)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(Th,{sectionId:i,subsectionId:B,title:S,className:"course-title"})," ",c.jsx(Sh,{completionTime:f,icon:v,optional:x,type:z,children:d&&d[w]&&c.jsx("span",{className:"quiz-score",children:`${d[w]}%`})})]})})},w)})})]})};const y_=({isComplete:e=!1,onClick:t,...n})=>{const r=se.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(_e,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className:G("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},D_=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),jc=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const va="notFoundError_",C_=()=>{const e=se.useIntl(),t=[];return jc.forEach((n,r)=>{n.title=e.formatMessage({id:`${va}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(mh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(vn,{children:[c.jsx(Ah,{cards:jc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(_e,{href:"/solution-articles/",children:e.formatMessage({id:`${va}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${va}title`})}),c.jsx("p",{children:e.formatMessage({id:`${va}text`})})]})};exports.ASSETS_BUCKET=zt;exports.ActivitiesFeed=kE;exports.ActivitySection=KE;exports.AddPost=$o;exports.Banner=t_;exports.BannerSection=a_;exports.Breadcrumbs=Rp;exports.Buckets=gm;exports.Button=_e;exports.ButtonWrapper=sr;exports.COURSE_CONTENT_TYPES=yr;exports.CacheProvider=od;exports.Card=Uo;exports.CardBlock=Ah;exports.Carousel=g_;exports.CharacterLimit=uo;exports.CollapsibleSection=Ja;exports.Columns=Bd;exports.CommunityDetails=Ip;exports.ContactFooter=$w;exports.ContactForm=uh;exports.ContentTypeLabel=ed;exports.Contributors=no;exports.ConversationContext=li;exports.CookieBanner=hh;exports.CourseProgression=v_;exports.CourseStructure=b_;exports.CustomContentBanner=i_;exports.CustomEvents=Xe;exports.DELETED_USER_ID=Tr;exports.Directory=QE;exports.DiscussionConversation=ph;exports.DiscussionForm=Vr;exports.DiscussionFormCard=vh;exports.DiscussionFormModal=Bh;exports.DiscussionLikes=gh;exports.DiscussionPost=Kr;exports.DiscussionThread=yh;exports.Divider=qt;exports.DownloadSection=Nw;exports.EMAILS=Wn;exports.EditSection=Iw;exports.EmailHelperTextBox=Td;exports.EmptyStateBox=fn;exports.FeatureFlags=Xs;exports.Filters=$p;exports.FlagsProvider=ld;exports.Footer=Mo;exports.Form=Jt;exports.Formatting=Z;exports.Fragment=wt;exports.FullWidthSection=vn;exports.GET_STREAM_USER_PREFIX=ps;exports.GlobalProviders=Nm;exports.Header=Io;exports.HelperTextBox=nd;exports.HiddenFromScreenReaders=Ga;exports.HideShowTextBox=rd;exports.HighlightSection=o_;exports.HighlightedTextBox=jt;exports.INVALID_TOKEN=Vc;exports.IconBulletedList=ym;exports.ImageContainer=fm;exports.IntlProvider=cd;exports.InviteForm=lh;exports.InviteModal=YE;exports.JoinButton=so;exports.LanguageContext=eo;exports.LanguageSwitcher=zp;exports.LessonName=Th;exports.LessonType=Sh;exports.Link=dn;exports.LoadMore=Ur;exports.LoadingBlock=Tm;exports.LoadingPlaceholder=Ft;exports.LoadingState=Js;exports.Logo=oo;exports.LogoSection=Rw;exports.MENTION_REGEX=Kc;exports.MarkCompleteButton=y_;exports.MarkdownText=kn;exports.MarketingBlock=u_;exports.Marks=$t;exports.Member=Yt;exports.MembersList=Hw;exports.Modal=ro;exports.MoreMenu=kd;exports.NUMBER_OF_COUNTRIES=Qh;exports.NUMBER_OF_USERS=Gh;exports.NavigationMenu=Fd;exports.NotFoundError=C_;exports.Overlay=mn;exports.OverlayContext=to;exports.OverlayProvider=hd;exports.PageHeading=ad;exports.PageLayout=mh;exports.PasswordForm=Bw;exports.PasswordRules=Nd;exports.Pill=ln;exports.Popover=Xc;exports.Portal=Wr;exports.ProfileForm=ch;exports.ProfileImageChange=oh;exports.ProfileModal=di;exports.ProfileModalLauncher=Lo;exports.ProfilePicture=hn;exports.ProgressBar=Qs;exports.ProgressTracker=mm;exports.Rating=sg;exports.RepliesFeed=Fh;exports.ResponsesHeading=bh;exports.ResponsiveImage=or;exports.ReturnToNavButton=pm;exports.RichTextEditor=sh;exports.SearchForm=dh;exports.ShareLinks=Kp;exports.SignupForm=Pw;exports.Span=ys;exports.StatusBanner=jr;exports.TableOfContents=e_;exports.Tabs=Zp;exports.Tags=Uw;exports.TestimonialBlock=XE;exports.TimeToComplete=fi;exports.Toggle=Fw;exports.Tooltip=Pn;exports.TopLevelPage=Lw;exports.UUID_V4_REGEX=Sr;exports.UserContext=mt;exports.UserProvider=dd;exports.VisuallyHidden=Ie;exports.addAriaProps=_d;exports.basicReducer=qr;exports.camelCaseToDashCase=Wc;exports.checkIntlPathExists=Qa;exports.generateConditions=Ba;exports.generateCssIcon=Jh;exports.getCharacterLimitProps=Ad;exports.getLongDate=Gs;exports.getMember=ei;exports.getPostBody=Ro;exports.getShortDate=Zc;exports.getValueLength=ti;exports.headerData=zr;exports.mapGetStreamData=D_;exports.pageReady=Yc;exports.passwordValidator=vs;exports.repliesFeedMock=FE;exports.supportedLanguages=Da;exports.toCamelCase=Uc;exports.toCapitalisedCase=Yh;exports.toSentenceCase=Hc;exports.useCurrentPath=Ic;exports.useEffectAfterMount=Xn;exports.useElementWidth=On;exports.useOverlay=fd;exports.useScrollListener=Lc;exports.useScrollToHash=Zs;exports.useTooltips=Ys;exports.useUser=Xa;
|
package/index.mjs
CHANGED
|
@@ -5442,7 +5442,7 @@ const si = "emailHelperTextBox_", Ip = ({
|
|
|
5442
5442
|
break;
|
|
5443
5443
|
case "exists":
|
|
5444
5444
|
g += "emailAlreadyExists", f = "error", b = {
|
|
5445
|
-
href: "/
|
|
5445
|
+
href: "/api/next-ui/login",
|
|
5446
5446
|
"data-gtm-event-context": "EmailExistsBox",
|
|
5447
5447
|
"data-gtm-event-type": "login-click"
|
|
5448
5448
|
}, v = {
|
|
@@ -21416,7 +21416,7 @@ const kC = {
|
|
|
21416
21416
|
styling: { fullWidth: !0 },
|
|
21417
21417
|
variant: "tertiary",
|
|
21418
21418
|
size: "medium",
|
|
21419
|
-
href: "/
|
|
21419
|
+
href: "/api/next-ui/login",
|
|
21420
21420
|
"data-gtm-event-context": "SignupForm",
|
|
21421
21421
|
"data-gtm-event-type": "login-click",
|
|
21422
21422
|
text: l.formatMessage({ id: "signup_button_login" })
|
|
@@ -22153,7 +22153,7 @@ const er = "footer_", Ki = "SiteFooter", bc = ({ group: e }) => {
|
|
|
22153
22153
|
},
|
|
22154
22154
|
buttons: {
|
|
22155
22155
|
order: ["login", "signup"],
|
|
22156
|
-
login: { href: "/
|
|
22156
|
+
login: { href: "/api/next-ui/login" },
|
|
22157
22157
|
signup: {
|
|
22158
22158
|
href: "/signup?ref=header-banner",
|
|
22159
22159
|
props: { variant: "primary" }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
interface Props {
|
|
3
3
|
/** The layout for the columns */
|
|
4
4
|
layout?: '2-1' | '1-3' | '1-1';
|
|
5
5
|
/** If the columns should be hidden until they'd show in a row */
|
|
@@ -11,5 +11,5 @@ export interface IColumnsProps {
|
|
|
11
11
|
/** The content to be rendered */
|
|
12
12
|
children: React.ReactElement;
|
|
13
13
|
}
|
|
14
|
-
declare const Columns: ({ layout, hideOnMobile, hasCSSContainers, className, children, }:
|
|
14
|
+
declare const Columns: ({ layout, hideOnMobile, hasCSSContainers, className, children, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
export default Columns;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { PaginationType } from './load-more';
|
|
2
2
|
export { default as LoadMore } from './load-more';
|
|
@@ -13,13 +13,13 @@ export interface PaginationType {
|
|
|
13
13
|
error: string;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
interface Props extends PaginationType {
|
|
17
17
|
/** Additional classes */
|
|
18
18
|
className?: string;
|
|
19
19
|
/** GTM event context */
|
|
20
20
|
gtmContext?: string;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
interface Props extends ButtonPropsType {
|
|
23
23
|
}
|
|
24
|
-
declare const LoadMore: ({ hasNextPage, loadNextPage, isLoading, variant, size, styling, icon, messages, className, gtmContext, }:
|
|
24
|
+
declare const LoadMore: ({ hasNextPage, loadNextPage, isLoading, variant, size, styling, icon, messages, className, gtmContext, }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
25
25
|
export default LoadMore;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
interface TabBreakPoint {
|
|
3
3
|
target: 'min-width' | 'max-width';
|
|
4
4
|
value: number;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
interface TabType {
|
|
7
7
|
/** An ID for the tab - this is used to create an anchor on the page */
|
|
8
8
|
id?: string;
|
|
9
9
|
/** The text to show for the tab */
|
|
@@ -17,15 +17,15 @@ export interface ITab {
|
|
|
17
17
|
/** Whether the tab has carousels - this is needed to ensure the carousel width loads as expected */
|
|
18
18
|
hasCarousel?: boolean;
|
|
19
19
|
/** The breakpoint at which the tab should be shown. If not specified, always show */
|
|
20
|
-
breakpoint?:
|
|
20
|
+
breakpoint?: TabBreakPoint;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
interface Props {
|
|
23
23
|
/** The tab details */
|
|
24
|
-
tabs:
|
|
24
|
+
tabs: TabType[];
|
|
25
25
|
/** Additional classes */
|
|
26
26
|
className?: string;
|
|
27
27
|
/** Prevent window move by not jumping to the tab on click */
|
|
28
28
|
preventLocationChange?: boolean;
|
|
29
29
|
}
|
|
30
|
-
declare const Tabs: ({ tabs, className, preventLocationChange }:
|
|
30
|
+
declare const Tabs: ({ tabs, className, preventLocationChange }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
31
31
|
export default Tabs;
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@ interface IPlaceholder {
|
|
|
9
9
|
/** Cta message showing on a button */
|
|
10
10
|
ctaMessage?: string;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
interface Props {
|
|
13
13
|
/** Additional classes */
|
|
14
14
|
className?: string;
|
|
15
15
|
/** Content to be rendered */
|
|
@@ -33,5 +33,5 @@ export interface IEditSectionProps {
|
|
|
33
33
|
/** Placeholder settings */
|
|
34
34
|
placeholder?: IPlaceholder;
|
|
35
35
|
}
|
|
36
|
-
declare const EditSection: ({ children, className, formProps, formComponent: originalFormComponent, href, title, showTitle, modalTitle, placeholder, showDivider, }:
|
|
36
|
+
declare const EditSection: ({ children, className, formProps, formComponent: originalFormComponent, href, title, showTitle, modalTitle, placeholder, showDivider, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
37
37
|
export default EditSection;
|
|
@@ -7,7 +7,7 @@ interface ButtonType extends ButtonPropsType {
|
|
|
7
7
|
};
|
|
8
8
|
component?: React.ReactNode;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
interface Props {
|
|
11
11
|
/** Box styling */
|
|
12
12
|
variant?: 'empty' | 'error';
|
|
13
13
|
/** Optional text */
|
|
@@ -17,5 +17,5 @@ export interface IEmptyStateBoxProps {
|
|
|
17
17
|
/** Additional classes */
|
|
18
18
|
className?: string;
|
|
19
19
|
}
|
|
20
|
-
declare const EmptyStateBox: ({ variant, text, button, className, }:
|
|
20
|
+
declare const EmptyStateBox: ({ variant, text, button, className, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
21
21
|
export default EmptyStateBox;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MarkdownToJSX } from 'markdown-to-jsx';
|
|
3
|
-
|
|
3
|
+
interface Props {
|
|
4
4
|
/** The language for the box text */
|
|
5
5
|
locale?: string;
|
|
6
6
|
/** An optional id for the box */
|
|
@@ -16,5 +16,5 @@ export interface IHideShowTextBoxProps {
|
|
|
16
16
|
markdownOptions?: MarkdownToJSX.Options;
|
|
17
17
|
children?: React.ReactNode;
|
|
18
18
|
}
|
|
19
|
-
declare const HideShowTextBox: ({ id, className, show, hide, text, markdownOptions, children, }:
|
|
19
|
+
declare const HideShowTextBox: ({ id, className, show, hide, text, markdownOptions, children, }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
20
20
|
export default HideShowTextBox;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
interface Props {
|
|
3
3
|
/** The style of box being rendered */
|
|
4
4
|
variant?: 'primary' | 'secondary' | 'tertiary' | 'quaternary' | 'subtle' | 'subtle-alt' | 'bold' | 'muted';
|
|
5
5
|
/** The name of an icon file to display at the top */
|
|
@@ -18,5 +18,5 @@ export interface IHighlightedTextBoxProps {
|
|
|
18
18
|
/** Additional props to pass to the box */
|
|
19
19
|
style?: React.CSSProperties;
|
|
20
20
|
}
|
|
21
|
-
declare const HighlightedTextBoxWrapper: ({ variant, icon, styling, className, children, ...props }:
|
|
21
|
+
declare const HighlightedTextBoxWrapper: ({ variant, icon, styling, className, children, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
22
22
|
export default HighlightedTextBoxWrapper;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
interface Props {
|
|
2
2
|
/** The user's name, to create initials */
|
|
3
3
|
name: string;
|
|
4
4
|
/** The user's image */
|
|
@@ -16,5 +16,5 @@ export interface IProfilePictureProps {
|
|
|
16
16
|
/** Optional test ID */
|
|
17
17
|
'data-testid'?: string;
|
|
18
18
|
}
|
|
19
|
-
declare const ProfilePicture: ({ className, src, name, alt, width, height, showInitials, ...props }:
|
|
19
|
+
declare const ProfilePicture: ({ className, src, name, alt, width, height, showInitials, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
export default ProfilePicture;
|