@apolitical/component-library 8.2.1-ac.1 → 8.2.1-ac.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * This source code is licensed under the MIT license found in the
12
12
  * LICENSE file in the root directory of this source tree.
13
- */var Fu;function Vh(){if(Fu)return Dr;Fu=1;var e=x,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function s(o,u,l){var d,m={},h=null,p=null;l!==void 0&&(h=""+l),u.key!==void 0&&(h=""+u.key),u.ref!==void 0&&(p=u.ref);for(d in u)r.call(u,d)&&!a.hasOwnProperty(d)&&(m[d]=u[d]);if(o&&o.defaultProps)for(d in u=o.defaultProps,u)m[d]===void 0&&(m[d]=u[d]);return{$$typeof:t,type:o,key:h,ref:p,props:m,_owner:i.current}}return Dr.Fragment=n,Dr.jsx=s,Dr.jsxs=s,Dr}var Er={};/**
13
+ */var Fu;function Vh(){if(Fu)return Dr;Fu=1;var e=x,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function s(o,u,l){var d,h={},m=null,p=null;l!==void 0&&(m=""+l),u.key!==void 0&&(m=""+u.key),u.ref!==void 0&&(p=u.ref);for(d in u)r.call(u,d)&&!a.hasOwnProperty(d)&&(h[d]=u[d]);if(o&&o.defaultProps)for(d in u=o.defaultProps,u)h[d]===void 0&&(h[d]=u[d]);return{$$typeof:t,type:o,key:m,ref:p,props:h,_owner:i.current}}return Dr.Fragment=n,Dr.jsx=s,Dr.jsxs=s,Dr}var Er={};/**
14
14
  * @license React
15
15
  * react-jsx-runtime.development.js
16
16
  *
@@ -18,69 +18,69 @@
18
18
  *
19
19
  * This source code is licensed under the MIT license found in the
20
20
  * LICENSE file in the root directory of this source tree.
21
- */var Au;function Hh(){return Au||(Au=1,process.env.NODE_ENV!=="production"&&function(){var e=x,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function b($){if($===null||typeof $!="object")return null;var ue=g&&$[g]||$[f];return typeof ue=="function"?ue:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y($){{for(var ue=arguments.length,fe=new Array(ue>1?ue-1:0),ke=1;ke<ue;ke++)fe[ke-1]=arguments[ke];C("error",$,fe)}}function C($,ue,fe){{var ke=v.ReactDebugCurrentFrame,Ne=ke.getStackAddendum();Ne!==""&&(ue+="%s",fe=fe.concat([Ne]));var Ve=fe.map(function(Pe){return String(Pe)});Ve.unshift("Warning: "+ue),Function.prototype.apply.call(console[$],console,Ve)}}var k=!1,D=!1,_=!1,B=!1,P=!1,N;N=Symbol.for("react.module.reference");function z($){return!!(typeof $=="string"||typeof $=="function"||$===r||$===a||P||$===i||$===l||$===d||B||$===p||k||D||_||typeof $=="object"&&$!==null&&($.$$typeof===h||$.$$typeof===m||$.$$typeof===s||$.$$typeof===o||$.$$typeof===u||$.$$typeof===N||$.getModuleId!==void 0))}function O($,ue,fe){var ke=$.displayName;if(ke)return ke;var Ne=ue.displayName||ue.name||"";return Ne!==""?fe+"("+Ne+")":fe}function A($){return $.displayName||"Context"}function F($){if($==null)return null;if(typeof $.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof $=="function")return $.displayName||$.name||null;if(typeof $=="string")return $;switch($){case r:return"Fragment";case n:return"Portal";case a:return"Profiler";case i:return"StrictMode";case l:return"Suspense";case d:return"SuspenseList"}if(typeof $=="object")switch($.$$typeof){case o:var ue=$;return A(ue)+".Consumer";case s:var fe=$;return A(fe._context)+".Provider";case u:return O($,$.render,"ForwardRef");case m:var ke=$.displayName||null;return ke!==null?ke:F($.type)||"Memo";case h:{var Ne=$,Ve=Ne._payload,Pe=Ne._init;try{return F(Pe(Ve))}catch{return null}}}return null}var S=Object.assign,I=0,H,V,ae,ne,E,Y,q;function T(){}T.__reactDisabledLog=!0;function j(){{if(I===0){H=console.log,V=console.info,ae=console.warn,ne=console.error,E=console.group,Y=console.groupCollapsed,q=console.groupEnd;var $={configurable:!0,enumerable:!0,value:T,writable:!0};Object.defineProperties(console,{info:$,log:$,warn:$,error:$,group:$,groupCollapsed:$,groupEnd:$})}I++}}function R(){{if(I--,I===0){var $={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},$,{value:H}),info:S({},$,{value:V}),warn:S({},$,{value:ae}),error:S({},$,{value:ne}),group:S({},$,{value:E}),groupCollapsed:S({},$,{value:Y}),groupEnd:S({},$,{value:q})})}I<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var M=v.ReactCurrentDispatcher,U;function X($,ue,fe){{if(U===void 0)try{throw Error()}catch(Ne){var ke=Ne.stack.trim().match(/\n( *(at )?)/);U=ke&&ke[1]||""}return`
22
- `+U+$}}var W=!1,te;{var de=typeof WeakMap=="function"?WeakMap:Map;te=new de}function J($,ue){if(!$||W)return"";{var fe=te.get($);if(fe!==void 0)return fe}var ke;W=!0;var Ne=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ve;Ve=M.current,M.current=null,j();try{if(ue){var Pe=function(){throw Error()};if(Object.defineProperty(Pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Pe,[])}catch(en){ke=en}Reflect.construct($,[],Pe)}else{try{Pe.call()}catch(en){ke=en}$.call(Pe.prototype)}}else{try{throw Error()}catch(en){ke=en}$()}}catch(en){if(en&&ke&&typeof en.stack=="string"){for(var je=en.stack.split(`
21
+ */var Au;function Hh(){return Au||(Au=1,process.env.NODE_ENV!=="production"&&function(){var e=x,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function b($){if($===null||typeof $!="object")return null;var ue=g&&$[g]||$[f];return typeof ue=="function"?ue:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y($){{for(var ue=arguments.length,fe=new Array(ue>1?ue-1:0),ke=1;ke<ue;ke++)fe[ke-1]=arguments[ke];C("error",$,fe)}}function C($,ue,fe){{var ke=v.ReactDebugCurrentFrame,Ne=ke.getStackAddendum();Ne!==""&&(ue+="%s",fe=fe.concat([Ne]));var Ve=fe.map(function(Pe){return String(Pe)});Ve.unshift("Warning: "+ue),Function.prototype.apply.call(console[$],console,Ve)}}var k=!1,D=!1,_=!1,B=!1,M=!1,P;P=Symbol.for("react.module.reference");function z($){return!!(typeof $=="string"||typeof $=="function"||$===r||$===a||M||$===i||$===l||$===d||B||$===p||k||D||_||typeof $=="object"&&$!==null&&($.$$typeof===m||$.$$typeof===h||$.$$typeof===s||$.$$typeof===o||$.$$typeof===u||$.$$typeof===P||$.getModuleId!==void 0))}function O($,ue,fe){var ke=$.displayName;if(ke)return ke;var Ne=ue.displayName||ue.name||"";return Ne!==""?fe+"("+Ne+")":fe}function A($){return $.displayName||"Context"}function F($){if($==null)return null;if(typeof $.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof $=="function")return $.displayName||$.name||null;if(typeof $=="string")return $;switch($){case r:return"Fragment";case n:return"Portal";case a:return"Profiler";case i:return"StrictMode";case l:return"Suspense";case d:return"SuspenseList"}if(typeof $=="object")switch($.$$typeof){case o:var ue=$;return A(ue)+".Consumer";case s:var fe=$;return A(fe._context)+".Provider";case u:return O($,$.render,"ForwardRef");case h:var ke=$.displayName||null;return ke!==null?ke:F($.type)||"Memo";case m:{var Ne=$,Ve=Ne._payload,Pe=Ne._init;try{return F(Pe(Ve))}catch{return null}}}return null}var S=Object.assign,I=0,H,V,ae,ne,E,Y,q;function T(){}T.__reactDisabledLog=!0;function j(){{if(I===0){H=console.log,V=console.info,ae=console.warn,ne=console.error,E=console.group,Y=console.groupCollapsed,q=console.groupEnd;var $={configurable:!0,enumerable:!0,value:T,writable:!0};Object.defineProperties(console,{info:$,log:$,warn:$,error:$,group:$,groupCollapsed:$,groupEnd:$})}I++}}function R(){{if(I--,I===0){var $={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},$,{value:H}),info:S({},$,{value:V}),warn:S({},$,{value:ae}),error:S({},$,{value:ne}),group:S({},$,{value:E}),groupCollapsed:S({},$,{value:Y}),groupEnd:S({},$,{value:q})})}I<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var N=v.ReactCurrentDispatcher,U;function X($,ue,fe){{if(U===void 0)try{throw Error()}catch(Ne){var ke=Ne.stack.trim().match(/\n( *(at )?)/);U=ke&&ke[1]||""}return`
22
+ `+U+$}}var W=!1,te;{var de=typeof WeakMap=="function"?WeakMap:Map;te=new de}function J($,ue){if(!$||W)return"";{var fe=te.get($);if(fe!==void 0)return fe}var ke;W=!0;var Ne=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ve;Ve=N.current,N.current=null,j();try{if(ue){var Pe=function(){throw Error()};if(Object.defineProperty(Pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Pe,[])}catch(en){ke=en}Reflect.construct($,[],Pe)}else{try{Pe.call()}catch(en){ke=en}$.call(Pe.prototype)}}else{try{throw Error()}catch(en){ke=en}$()}}catch(en){if(en&&ke&&typeof en.stack=="string"){for(var je=en.stack.split(`
23
23
  `),ct=ke.stack.split(`
24
24
  `),Xe=je.length-1,nt=ct.length-1;Xe>=1&&nt>=0&&je[Xe]!==ct[nt];)nt--;for(;Xe>=1&&nt>=0;Xe--,nt--)if(je[Xe]!==ct[nt]){if(Xe!==1||nt!==1)do if(Xe--,nt--,nt<0||je[Xe]!==ct[nt]){var Tt=`
25
- `+je[Xe].replace(" at new "," at ");return $.displayName&&Tt.includes("<anonymous>")&&(Tt=Tt.replace("<anonymous>",$.displayName)),typeof $=="function"&&te.set($,Tt),Tt}while(Xe>=1&&nt>=0);break}}}finally{W=!1,M.current=Ve,R(),Error.prepareStackTrace=Ne}var Un=$?$.displayName||$.name:"",ku=Un?X(Un):"";return typeof $=="function"&&te.set($,ku),ku}function ve($,ue,fe){return J($,!1)}function me($){var ue=$.prototype;return!!(ue&&ue.isReactComponent)}function ye($,ue,fe){if($==null)return"";if(typeof $=="function")return J($,me($));if(typeof $=="string")return X($);switch($){case l:return X("Suspense");case d:return X("SuspenseList")}if(typeof $=="object")switch($.$$typeof){case u:return ve($.render);case m:return ye($.type,ue,fe);case h:{var ke=$,Ne=ke._payload,Ve=ke._init;try{return ye(Ve(Ne),ue,fe)}catch{}}}return""}var _e=Object.prototype.hasOwnProperty,De={},ze=v.ReactDebugCurrentFrame;function We($){if($){var ue=$._owner,fe=ye($.type,$._source,ue?ue.type:null);ze.setExtraStackFrame(fe)}else ze.setExtraStackFrame(null)}function He($,ue,fe,ke,Ne){{var Ve=Function.call.bind(_e);for(var Pe in $)if(Ve($,Pe)){var je=void 0;try{if(typeof $[Pe]!="function"){var ct=Error((ke||"React class")+": "+fe+" type `"+Pe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof $[Pe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ct.name="Invariant Violation",ct}je=$[Pe](ue,Pe,ke,fe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Xe){je=Xe}je&&!(je instanceof Error)&&(We(Ne),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ke||"React class",fe,Pe,typeof je),We(null)),je instanceof Error&&!(je.message in De)&&(De[je.message]=!0,We(Ne),y("Failed %s type: %s",fe,je.message),We(null))}}}var Ke=Array.isArray;function Be($){return Ke($)}function Me($){{var ue=typeof Symbol=="function"&&Symbol.toStringTag,fe=ue&&$[Symbol.toStringTag]||$.constructor.name||"Object";return fe}}function Ce($){try{return G($),!1}catch{return!0}}function G($){return""+$}function se($){if(Ce($))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Me($)),G($)}var be=v.ReactCurrentOwner,oe={key:!0,ref:!0,__self:!0,__source:!0},ce,pe,Fe;Fe={};function qe($){if(_e.call($,"ref")){var ue=Object.getOwnPropertyDescriptor($,"ref").get;if(ue&&ue.isReactWarning)return!1}return $.ref!==void 0}function At($){if(_e.call($,"key")){var ue=Object.getOwnPropertyDescriptor($,"key").get;if(ue&&ue.isReactWarning)return!1}return $.key!==void 0}function pt($,ue){if(typeof $.ref=="string"&&be.current&&ue&&be.current.stateNode!==ue){var fe=F(be.current.type);Fe[fe]||(y('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',F(be.current.type),$.ref),Fe[fe]=!0)}}function tt($,ue){{var fe=function(){ce||(ce=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ue))};fe.isReactWarning=!0,Object.defineProperty($,"key",{get:fe,configurable:!0})}}function qt($,ue){{var fe=function(){pe||(pe=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ue))};fe.isReactWarning=!0,Object.defineProperty($,"ref",{get:fe,configurable:!0})}}var Dt=function($,ue,fe,ke,Ne,Ve,Pe){var je={$$typeof:t,type:$,key:ue,ref:fe,props:Pe,_owner:Ve};return je._store={},Object.defineProperty(je._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(je,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ke}),Object.defineProperty(je,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ne}),Object.freeze&&(Object.freeze(je.props),Object.freeze(je)),je};function Ta($,ue,fe,ke,Ne){{var Ve,Pe={},je=null,ct=null;fe!==void 0&&(se(fe),je=""+fe),At(ue)&&(se(ue.key),je=""+ue.key),qe(ue)&&(ct=ue.ref,pt(ue,Ne));for(Ve in ue)_e.call(ue,Ve)&&!oe.hasOwnProperty(Ve)&&(Pe[Ve]=ue[Ve]);if($&&$.defaultProps){var Xe=$.defaultProps;for(Ve in Xe)Pe[Ve]===void 0&&(Pe[Ve]=Xe[Ve])}if(je||ct){var nt=typeof $=="function"?$.displayName||$.name||"Unknown":$;je&&tt(Pe,nt),ct&&qt(Pe,nt)}return Dt($,je,ct,Ne,ke,be.current,Pe)}}var Cr=v.ReactCurrentOwner,li=v.ReactDebugCurrentFrame;function qn($){if($){var ue=$._owner,fe=ye($.type,$._source,ue?ue.type:null);li.setExtraStackFrame(fe)}else li.setExtraStackFrame(null)}var Ba;Ba=!1;function Sa($){return typeof $=="object"&&$!==null&&$.$$typeof===t}function wu(){{if(Cr.current){var $=F(Cr.current.type);if($)return`
25
+ `+je[Xe].replace(" at new "," at ");return $.displayName&&Tt.includes("<anonymous>")&&(Tt=Tt.replace("<anonymous>",$.displayName)),typeof $=="function"&&te.set($,Tt),Tt}while(Xe>=1&&nt>=0);break}}}finally{W=!1,N.current=Ve,R(),Error.prepareStackTrace=Ne}var Un=$?$.displayName||$.name:"",ku=Un?X(Un):"";return typeof $=="function"&&te.set($,ku),ku}function ve($,ue,fe){return J($,!1)}function me($){var ue=$.prototype;return!!(ue&&ue.isReactComponent)}function ye($,ue,fe){if($==null)return"";if(typeof $=="function")return J($,me($));if(typeof $=="string")return X($);switch($){case l:return X("Suspense");case d:return X("SuspenseList")}if(typeof $=="object")switch($.$$typeof){case u:return ve($.render);case h:return ye($.type,ue,fe);case m:{var ke=$,Ne=ke._payload,Ve=ke._init;try{return ye(Ve(Ne),ue,fe)}catch{}}}return""}var _e=Object.prototype.hasOwnProperty,De={},ze=v.ReactDebugCurrentFrame;function We($){if($){var ue=$._owner,fe=ye($.type,$._source,ue?ue.type:null);ze.setExtraStackFrame(fe)}else ze.setExtraStackFrame(null)}function He($,ue,fe,ke,Ne){{var Ve=Function.call.bind(_e);for(var Pe in $)if(Ve($,Pe)){var je=void 0;try{if(typeof $[Pe]!="function"){var ct=Error((ke||"React class")+": "+fe+" type `"+Pe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof $[Pe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ct.name="Invariant Violation",ct}je=$[Pe](ue,Pe,ke,fe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Xe){je=Xe}je&&!(je instanceof Error)&&(We(Ne),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ke||"React class",fe,Pe,typeof je),We(null)),je instanceof Error&&!(je.message in De)&&(De[je.message]=!0,We(Ne),y("Failed %s type: %s",fe,je.message),We(null))}}}var Ke=Array.isArray;function Be($){return Ke($)}function Me($){{var ue=typeof Symbol=="function"&&Symbol.toStringTag,fe=ue&&$[Symbol.toStringTag]||$.constructor.name||"Object";return fe}}function Ce($){try{return G($),!1}catch{return!0}}function G($){return""+$}function se($){if(Ce($))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Me($)),G($)}var be=v.ReactCurrentOwner,oe={key:!0,ref:!0,__self:!0,__source:!0},ce,pe,Fe;Fe={};function qe($){if(_e.call($,"ref")){var ue=Object.getOwnPropertyDescriptor($,"ref").get;if(ue&&ue.isReactWarning)return!1}return $.ref!==void 0}function At($){if(_e.call($,"key")){var ue=Object.getOwnPropertyDescriptor($,"key").get;if(ue&&ue.isReactWarning)return!1}return $.key!==void 0}function pt($,ue){if(typeof $.ref=="string"&&be.current&&ue&&be.current.stateNode!==ue){var fe=F(be.current.type);Fe[fe]||(y('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',F(be.current.type),$.ref),Fe[fe]=!0)}}function tt($,ue){{var fe=function(){ce||(ce=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ue))};fe.isReactWarning=!0,Object.defineProperty($,"key",{get:fe,configurable:!0})}}function qt($,ue){{var fe=function(){pe||(pe=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ue))};fe.isReactWarning=!0,Object.defineProperty($,"ref",{get:fe,configurable:!0})}}var Dt=function($,ue,fe,ke,Ne,Ve,Pe){var je={$$typeof:t,type:$,key:ue,ref:fe,props:Pe,_owner:Ve};return je._store={},Object.defineProperty(je._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(je,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ke}),Object.defineProperty(je,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ne}),Object.freeze&&(Object.freeze(je.props),Object.freeze(je)),je};function Ta($,ue,fe,ke,Ne){{var Ve,Pe={},je=null,ct=null;fe!==void 0&&(se(fe),je=""+fe),At(ue)&&(se(ue.key),je=""+ue.key),qe(ue)&&(ct=ue.ref,pt(ue,Ne));for(Ve in ue)_e.call(ue,Ve)&&!oe.hasOwnProperty(Ve)&&(Pe[Ve]=ue[Ve]);if($&&$.defaultProps){var Xe=$.defaultProps;for(Ve in Xe)Pe[Ve]===void 0&&(Pe[Ve]=Xe[Ve])}if(je||ct){var nt=typeof $=="function"?$.displayName||$.name||"Unknown":$;je&&tt(Pe,nt),ct&&qt(Pe,nt)}return Dt($,je,ct,Ne,ke,be.current,Pe)}}var Cr=v.ReactCurrentOwner,li=v.ReactDebugCurrentFrame;function qn($){if($){var ue=$._owner,fe=ye($.type,$._source,ue?ue.type:null);li.setExtraStackFrame(fe)}else li.setExtraStackFrame(null)}var Ba;Ba=!1;function Sa($){return typeof $=="object"&&$!==null&&$.$$typeof===t}function wu(){{if(Cr.current){var $=F(Cr.current.type);if($)return`
26
26
 
27
27
  Check the render method of \``+$+"`."}return""}}function Bh($){{if($!==void 0){var ue=$.fileName.replace(/^.*[\\\/]/,""),fe=$.lineNumber;return`
28
28
 
29
29
  Check your code at `+ue+":"+fe+"."}return""}}var Cu={};function Sh($){{var ue=wu();if(!ue){var fe=typeof $=="string"?$:$.displayName||$.name;fe&&(ue=`
30
30
 
31
- Check the top-level render call using <`+fe+">.")}return ue}}function Du($,ue){{if(!$._store||$._store.validated||$.key!=null)return;$._store.validated=!0;var fe=Sh(ue);if(Cu[fe])return;Cu[fe]=!0;var ke="";$&&$._owner&&$._owner!==Cr.current&&(ke=" It was passed a child from "+F($._owner.type)+"."),qn($),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',fe,ke),qn(null)}}function Eu($,ue){{if(typeof $!="object")return;if(Be($))for(var fe=0;fe<$.length;fe++){var ke=$[fe];Sa(ke)&&Du(ke,ue)}else if(Sa($))$._store&&($._store.validated=!0);else if($){var Ne=b($);if(typeof Ne=="function"&&Ne!==$.entries)for(var Ve=Ne.call($),Pe;!(Pe=Ve.next()).done;)Sa(Pe.value)&&Du(Pe.value,ue)}}}function jh($){{var ue=$.type;if(ue==null||typeof ue=="string")return;var fe;if(typeof ue=="function")fe=ue.propTypes;else if(typeof ue=="object"&&(ue.$$typeof===u||ue.$$typeof===m))fe=ue.propTypes;else return;if(fe){var ke=F(ue);He(fe,$.props,"prop",ke,$)}else if(ue.PropTypes!==void 0&&!Ba){Ba=!0;var Ne=F(ue);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ne||"Unknown")}typeof ue.getDefaultProps=="function"&&!ue.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ph($){{for(var ue=Object.keys($.props),fe=0;fe<ue.length;fe++){var ke=ue[fe];if(ke!=="children"&&ke!=="key"){qn($),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ke),qn(null);break}}$.ref!==null&&(qn($),y("Invalid attribute `ref` supplied to `React.Fragment`."),qn(null))}}function _u($,ue,fe,ke,Ne,Ve){{var Pe=z($);if(!Pe){var je="";($===void 0||typeof $=="object"&&$!==null&&Object.keys($).length===0)&&(je+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ct=Bh(Ne);ct?je+=ct:je+=wu();var Xe;$===null?Xe="null":Be($)?Xe="array":$!==void 0&&$.$$typeof===t?(Xe="<"+(F($.type)||"Unknown")+" />",je=" Did you accidentally export a JSX literal instead of a component?"):Xe=typeof $,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Xe,je)}var nt=Ta($,ue,fe,Ne,Ve);if(nt==null)return nt;if(Pe){var Tt=ue.children;if(Tt!==void 0)if(ke)if(Be(Tt)){for(var Un=0;Un<Tt.length;Un++)Eu(Tt[Un],$);Object.freeze&&Object.freeze(Tt)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Eu(Tt,$)}return $===r?Ph(nt):jh(nt),nt}}function Oh($,ue,fe){return _u($,ue,fe,!0)}function Mh($,ue,fe){return _u($,ue,fe,!1)}var Nh=Mh,Ih=Oh;Er.Fragment=r,Er.jsx=Nh,Er.jsxs=Ih}()),Er}process.env.NODE_ENV==="production"?Ps.exports=Vh():Ps.exports=Hh();var c=Ps.exports;const Kh=50,Zh=8,xd=(e,t)=>{if(!e)return!1;const n=x.useRef(null),r=t||n;return x.useEffect(()=>{const i=r.current,a=()=>{if(i){const s=parseInt(i.style.height.replace("px",""))||0,o=i.scrollHeight,u=Math.abs(o-s);o!==s&&u>Zh&&(i.style.height=`${o}px`,i.scrollHeight>=Kh?i.classList.contains("single-line")&&i.classList.remove("single-line"):i.classList.contains("single-line")||i.classList.add("single-line"))}};if(i)return a(),i.addEventListener("input",a),()=>i.removeEventListener("input",a)},[]),r},wd=()=>{const[e,t]=x.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return x.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},or=(e,t)=>{const n=x.useRef(!1);x.useEffect(()=>{n.current?e():n.current=!0},t)};function Wr(e,t,n){var r=this,i=x.useRef(null),a=x.useRef(0),s=x.useRef(null),o=x.useRef([]),u=x.useRef(),l=x.useRef(),d=x.useRef(e),m=x.useRef(!0);d.current=e;var h=typeof window<"u",p=!t&&t!==0&&h;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,b="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,y=b?Math.max(+n.maxWait||0,t):null;x.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var C=x.useMemo(function(){var k=function(z){var O=o.current,A=u.current;return o.current=u.current=null,a.current=z,l.current=d.current.apply(A,O)},D=function(z,O){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(z):setTimeout(z,O)},_=function(z){if(!m.current)return!1;var O=z-i.current;return!i.current||O>=t||O<0||b&&z-a.current>=y},B=function(z){return s.current=null,f&&o.current?k(z):(o.current=u.current=null,l.current)},P=function z(){var O=Date.now();if(_(O))return B(O);if(m.current){var A=t-(O-i.current),F=b?Math.min(A,y-(O-a.current)):A;D(z,F)}},N=function(){if(h||v){var z=Date.now(),O=_(z);if(o.current=[].slice.call(arguments),u.current=r,i.current=z,O){if(!s.current&&m.current)return a.current=i.current,D(P,t),g?k(i.current):l.current;if(b)return D(P,t),k(i.current)}return s.current||D(P,t),l.current}};return N.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),a.current=0,o.current=i.current=u.current=s.current=null},N.isPending=function(){return!!s.current},N.flush=function(){return s.current?B(Date.now()):l.current},N},[g,b,t,y,f,p,h,v]);return C}function Cd(e,t,n){var r=n===void 0?{}:n,i=r.leading,a=r.trailing;return Wr(e,t,{maxWait:t,leading:i===void 0||i,trailing:a===void 0||a})}let ja;const wn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,i]=x.useState(0)||[!1,()=>{}],a=n==="window"?[]:[n];x.useEffect(()=>(o(),window.addEventListener("resize",l),window.addEventListener("hashchange",l),window.addEventListener("hiddenSectionVisible",u),()=>{clearTimeout(ja),l.flush(),window.removeEventListener("resize",l),window.removeEventListener("hashchange",l),window.removeEventListener("hiddenSectionVisible",u)}),a);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{i(s())},u=({detail:d})=>{const{id:m}=d;n==="window"||!n.closest(`#${m}`)||s()===r||o()},l=Cd(()=>{s()!==r&&(t&&(clearTimeout(ja),document.body.classList.add("is-resizing"),ja=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Dd=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[i,a]=x.useState({current:0,past:0})||[!1,()=>{}],[s,o]=x.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];x.useEffect(()=>(u(),window.addEventListener("scroll",l),()=>{l.flush(),window.removeEventListener("scroll",l)}),[]);const u=()=>{const d=window.scrollY,m=i.current,h=d-m,p=h>0?"down":"up";if(a({current:d,past:m}),p==="down"){d>=e+t.down&&!s.scrollDown&&(!s.scrollUp||h>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(h)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},l=Cd(()=>{u()},250);return i},po=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=x.useRef(!1);or(()=>{if(window&&window.location&&window.location.hash){if(n.current)return;const r=document.getElementById(window.location.hash.replace("#",""));r&&(r.scrollIntoView(t?{behavior:"smooth"}:null),n.current=!0)}},e)},go=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=x.useState(!1);return{showTooltip:t,tooltipProps:{onClick:()=>n(!0),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),r.stopPropagation(),n(!t))},onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1)}}};const Tu={},Yh=x.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:i,className:a="",functions:s={},callbacks:o={},accessibility:u={},...l},d)=>{const m=ie.useIntl(),[h]=x.useState(e||Date.now().toString()),p=x.useRef(null),g=d||p,[f,b]=x.useState(n?"open":"hidden"),{extraPadding:v=!0,hasPointer:y=!1,hasForm:C=!1}=t,{onOpen:k=()=>{},onClose:D=()=>{}}=o,{readToScreenreadersWhenClosed:_=!1,...B}=u,P=Tu[h];x.useEffect(()=>{const A=g==null?void 0:g.current;if(A)return A.addEventListener("transitionend",N),()=>{A.removeEventListener("transitionend",N)}},[]),x.useEffect(()=>{if(f!=="open")return;const A=F=>{F.key==="Escape"&&(F.stopPropagation(),F.preventDefault(),b("closed"))};return document.addEventListener("keyup",A),()=>{document.removeEventListener("keyup",A)}},[f]);const N=({propertyName:A})=>{A==="opacity"&&(P!==!1&&clearTimeout(P),b(F=>(F==="open"?k():F==="closed"&&D(),F==="opening"?"open":F==="closing"?"closed":F==="closed"?"hidden":F)))};or(()=>{P!==!1&&clearTimeout(P);let A="open";n?b("opening"):(b("closing"),A="hidden"),Tu[h||""]=setTimeout(()=>{b(A)},300)},[n]);const z={"aria-live":"polite",...l,...B};s&&s.onBlur&&(z.onBlur=s.onBlur);const O={className:"content"};return _?O.className=K("content",{hidden:f==="hidden"}):O.hidden=f==="hidden",c.jsx("aside",{ref:g,id:h,className:K("tooltip text-medium",f,a,{loading:r,"extra-padding":v,"has-pointer":y,bottom:y==="bottom","has-form":C}),...z,children:c.jsx("div",{...O,children:r?c.jsx("p",{children:m.formatMessage({id:"tooltip_loading"})}):typeof i=="string"?c.jsx("p",{children:i}):i})})}),Ln=x.memo(Yh),pr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Pt(e);return t.forEach(({type:r,value:i})=>{Rh(n,r,i)}),n},Ed=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},_d=(e,t,n)=>{let r=n.mobile;for(const i in t){const a=parseInt(String(t[i]));if(e>=a)r=n[a];else if(e<a)break}return r},kd=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Fd=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Ad=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Gh=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Gt="https://assets.apolitical.co/",Qn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},jr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},Os="SU:",Vr="DELETED",Td="Invalid token error: Logging user out...",Qh="250,000+",Jh="160+",Hr=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Bd=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function Xh(e){return e?{"--icon":`url(${Gt}icons/${e}.svg)`}:{}}const Tn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Sd=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),vo=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Ms=e=>{let t;const n=Vi(),r=Vi(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const i=t/Tn.milliseconds.inHour,a=Math.floor(t/Tn.milliseconds.inDay);if(a<1)return i<1?{path:"now"}:{path:"hours",number:Math.floor(i)};if(a<7)return{path:"days",number:a};const s=Math.floor(a/7);return s<=Tn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(a/Tn.year.days)}},Vi=e=>{const n=(e||new Date).toUTCString();return new Date(n)},ep=(e,t,n)=>{let r;const i=Vi(),a=Vi(new Date(e));try{r=i.getTime()-a.getTime()}catch{return!1}switch(n){case"seconds":return r/Tn.milliseconds.inSecond<=t;case"minutes":return r/Tn.milliseconds.inMinute<=t;case"hours":return r/Tn.milliseconds.inHour<=t}return!1},tp=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},np=e=>new Promise(t=>setTimeout(t,e)),rp=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},gr={apolitical:"Apolitical",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",card_carousel_viewAll:"View all",card_label_communityPage:"Community",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_new:"New",card_registered:"Registered",card_partner:"{partner} and {number} more",card_contributors_event:"Multiple speakers",card_contributors_solutionArticle:"Multiple authors",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_member_type_owner:"Admin",card_member_type_member:"Member",card_member_count:"{count} members",card_cta_people:"View profile",card_cta_communityPage:"Join now",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_communityPage_loading:"Joining...",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_communityPage_done:"Joined",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"previous",carousel_pagination_previousSlide:"Previous slide",carousel_pagination_next:"next",carousel_pagination_nextSlide:"Next slide",carousel_pagination_slide:"Slide {number} of {total}",carousel_pagination_ariaLive:"On {direction} slide: {count, plural, one {1 card} other {# cards}} available",carousel_pagination_ariaLive_slide:"On slide {slide}: {count, plural, one {1 card} other {# cards}} available",activitySection_notFoundError:"Post not found",activitiesFeed_sorting_label:"Choose feed sorting method",activitiesFeed_rankingMethod_recent:"Recent",activitiesFeed_rankingMethod_popular:"Popular",activitiesFeed_rankingMethod_internalTesting:"Testing",activitiesFeed_noActivities_inCategories:"There are no posts of this type yet.",activitiesFeed_noActivities:"Activities will appear here.",activitiesFeed_noActivities_button:"Explore Communities",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",community_sortSuccess:"Feed ordered by {order}",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",joinCommunityButton_closed_tooltip:"Please contact the admin of this closed community if you would like to join it.",joinCommunityButton_aria_live:"You are {action} this community",member_apolitical:"Apolitical",member_community:"Community post",member_deleted:"Deleted user",member_profile:"Update profile",member_createdAt_community:"{time} ago in <link>{community}</link>",membersList:"Members",membersList_admin:"Admin",membersList_profile:"Update profile",membersList_modal_title:"Update profile",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_poll:"poll",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_pinned_post:"Pinned Post",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
31
+ Check the top-level render call using <`+fe+">.")}return ue}}function Du($,ue){{if(!$._store||$._store.validated||$.key!=null)return;$._store.validated=!0;var fe=Sh(ue);if(Cu[fe])return;Cu[fe]=!0;var ke="";$&&$._owner&&$._owner!==Cr.current&&(ke=" It was passed a child from "+F($._owner.type)+"."),qn($),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',fe,ke),qn(null)}}function Eu($,ue){{if(typeof $!="object")return;if(Be($))for(var fe=0;fe<$.length;fe++){var ke=$[fe];Sa(ke)&&Du(ke,ue)}else if(Sa($))$._store&&($._store.validated=!0);else if($){var Ne=b($);if(typeof Ne=="function"&&Ne!==$.entries)for(var Ve=Ne.call($),Pe;!(Pe=Ve.next()).done;)Sa(Pe.value)&&Du(Pe.value,ue)}}}function jh($){{var ue=$.type;if(ue==null||typeof ue=="string")return;var fe;if(typeof ue=="function")fe=ue.propTypes;else if(typeof ue=="object"&&(ue.$$typeof===u||ue.$$typeof===h))fe=ue.propTypes;else return;if(fe){var ke=F(ue);He(fe,$.props,"prop",ke,$)}else if(ue.PropTypes!==void 0&&!Ba){Ba=!0;var Ne=F(ue);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ne||"Unknown")}typeof ue.getDefaultProps=="function"&&!ue.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ph($){{for(var ue=Object.keys($.props),fe=0;fe<ue.length;fe++){var ke=ue[fe];if(ke!=="children"&&ke!=="key"){qn($),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ke),qn(null);break}}$.ref!==null&&(qn($),y("Invalid attribute `ref` supplied to `React.Fragment`."),qn(null))}}function _u($,ue,fe,ke,Ne,Ve){{var Pe=z($);if(!Pe){var je="";($===void 0||typeof $=="object"&&$!==null&&Object.keys($).length===0)&&(je+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ct=Bh(Ne);ct?je+=ct:je+=wu();var Xe;$===null?Xe="null":Be($)?Xe="array":$!==void 0&&$.$$typeof===t?(Xe="<"+(F($.type)||"Unknown")+" />",je=" Did you accidentally export a JSX literal instead of a component?"):Xe=typeof $,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Xe,je)}var nt=Ta($,ue,fe,Ne,Ve);if(nt==null)return nt;if(Pe){var Tt=ue.children;if(Tt!==void 0)if(ke)if(Be(Tt)){for(var Un=0;Un<Tt.length;Un++)Eu(Tt[Un],$);Object.freeze&&Object.freeze(Tt)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Eu(Tt,$)}return $===r?Ph(nt):jh(nt),nt}}function Oh($,ue,fe){return _u($,ue,fe,!0)}function Mh($,ue,fe){return _u($,ue,fe,!1)}var Nh=Mh,Ih=Oh;Er.Fragment=r,Er.jsx=Nh,Er.jsxs=Ih}()),Er}process.env.NODE_ENV==="production"?Ps.exports=Vh():Ps.exports=Hh();var c=Ps.exports;const Kh=50,Zh=8,xd=(e,t)=>{if(!e)return!1;const n=x.useRef(null),r=t||n;return x.useEffect(()=>{const i=r.current,a=()=>{if(i){const s=parseInt(i.style.height.replace("px",""))||0,o=i.scrollHeight,u=Math.abs(o-s);o!==s&&u>Zh&&(i.style.height=`${o}px`,i.scrollHeight>=Kh?i.classList.contains("single-line")&&i.classList.remove("single-line"):i.classList.contains("single-line")||i.classList.add("single-line"))}};if(i)return a(),i.addEventListener("input",a),()=>i.removeEventListener("input",a)},[]),r},wd=()=>{const[e,t]=x.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return x.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},or=(e,t)=>{const n=x.useRef(!1);x.useEffect(()=>{n.current?e():n.current=!0},t)};function Wr(e,t,n){var r=this,i=x.useRef(null),a=x.useRef(0),s=x.useRef(null),o=x.useRef([]),u=x.useRef(),l=x.useRef(),d=x.useRef(e),h=x.useRef(!0);d.current=e;var m=typeof window<"u",p=!t&&t!==0&&m;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,b="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,y=b?Math.max(+n.maxWait||0,t):null;x.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var C=x.useMemo(function(){var k=function(z){var O=o.current,A=u.current;return o.current=u.current=null,a.current=z,l.current=d.current.apply(A,O)},D=function(z,O){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(z):setTimeout(z,O)},_=function(z){if(!h.current)return!1;var O=z-i.current;return!i.current||O>=t||O<0||b&&z-a.current>=y},B=function(z){return s.current=null,f&&o.current?k(z):(o.current=u.current=null,l.current)},M=function z(){var O=Date.now();if(_(O))return B(O);if(h.current){var A=t-(O-i.current),F=b?Math.min(A,y-(O-a.current)):A;D(z,F)}},P=function(){if(m||v){var z=Date.now(),O=_(z);if(o.current=[].slice.call(arguments),u.current=r,i.current=z,O){if(!s.current&&h.current)return a.current=i.current,D(M,t),g?k(i.current):l.current;if(b)return D(M,t),k(i.current)}return s.current||D(M,t),l.current}};return P.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),a.current=0,o.current=i.current=u.current=s.current=null},P.isPending=function(){return!!s.current},P.flush=function(){return s.current?B(Date.now()):l.current},P},[g,b,t,y,f,p,m,v]);return C}function Cd(e,t,n){var r=n===void 0?{}:n,i=r.leading,a=r.trailing;return Wr(e,t,{maxWait:t,leading:i===void 0||i,trailing:a===void 0||a})}let ja;const wn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,i]=x.useState(0)||[!1,()=>{}],a=n==="window"?[]:[n];x.useEffect(()=>(o(),window.addEventListener("resize",l),window.addEventListener("hashchange",l),window.addEventListener("hiddenSectionVisible",u),()=>{clearTimeout(ja),l.flush(),window.removeEventListener("resize",l),window.removeEventListener("hashchange",l),window.removeEventListener("hiddenSectionVisible",u)}),a);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{i(s())},u=({detail:d})=>{const{id:h}=d;n==="window"||!n.closest(`#${h}`)||s()===r||o()},l=Cd(()=>{s()!==r&&(t&&(clearTimeout(ja),document.body.classList.add("is-resizing"),ja=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Dd=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[i,a]=x.useState({current:0,past:0})||[!1,()=>{}],[s,o]=x.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];x.useEffect(()=>(u(),window.addEventListener("scroll",l),()=>{l.flush(),window.removeEventListener("scroll",l)}),[]);const u=()=>{const d=window.scrollY,h=i.current,m=d-h,p=m>0?"down":"up";if(a({current:d,past:h}),p==="down"){d>=e+t.down&&!s.scrollDown&&(!s.scrollUp||m>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(m)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},l=Cd(()=>{u()},250);return i},po=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=x.useRef(!1);or(()=>{if(window&&window.location&&window.location.hash){if(n.current)return;const r=document.getElementById(window.location.hash.replace("#",""));r&&(r.scrollIntoView(t?{behavior:"smooth"}:null),n.current=!0)}},e)},go=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=x.useState(!1);return{showTooltip:t,tooltipProps:{onClick:()=>n(!0),onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),r.stopPropagation(),n(!t))},onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1)}}};const Tu={},Yh=x.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:i,className:a="",functions:s={},callbacks:o={},accessibility:u={},...l},d)=>{const h=ie.useIntl(),[m]=x.useState(e||Date.now().toString()),p=x.useRef(null),g=d||p,[f,b]=x.useState(n?"open":"hidden"),{extraPadding:v=!0,hasPointer:y=!1,hasForm:C=!1}=t,{onOpen:k=()=>{},onClose:D=()=>{}}=o,{readToScreenreadersWhenClosed:_=!1,...B}=u,M=Tu[m];x.useEffect(()=>{const A=g==null?void 0:g.current;if(A)return A.addEventListener("transitionend",P),()=>{A.removeEventListener("transitionend",P)}},[]),x.useEffect(()=>{if(f!=="open")return;const A=F=>{F.key==="Escape"&&(F.stopPropagation(),F.preventDefault(),b("closed"))};return document.addEventListener("keyup",A),()=>{document.removeEventListener("keyup",A)}},[f]);const P=({propertyName:A})=>{A==="opacity"&&(M!==!1&&clearTimeout(M),b(F=>(F==="open"?k():F==="closed"&&D(),F==="opening"?"open":F==="closing"?"closed":F==="closed"?"hidden":F)))};or(()=>{M!==!1&&clearTimeout(M);let A="open";n?b("opening"):(b("closing"),A="hidden"),Tu[m||""]=setTimeout(()=>{b(A)},300)},[n]);const z={"aria-live":"polite",...l,...B};s&&s.onBlur&&(z.onBlur=s.onBlur);const O={className:"content"};return _?O.className=K("content",{hidden:f==="hidden"}):O.hidden=f==="hidden",c.jsx("aside",{ref:g,id:m,className:K("tooltip text-medium",f,a,{loading:r,"extra-padding":v,"has-pointer":y,bottom:y==="bottom","has-form":C}),...z,children:c.jsx("div",{...O,children:r?c.jsx("p",{children:h.formatMessage({id:"tooltip_loading"})}):typeof i=="string"?c.jsx("p",{children:i}):i})})}),Ln=x.memo(Yh),pr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Pt(e);return t.forEach(({type:r,value:i})=>{Rh(n,r,i)}),n},Ed=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},_d=(e,t,n)=>{let r=n.mobile;for(const i in t){const a=parseInt(String(t[i]));if(e>=a)r=n[a];else if(e<a)break}return r},kd=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Fd=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Ad=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Gh=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Gt="https://assets.apolitical.co/",Qn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},jr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},Os="SU:",Vr="DELETED",Td="Invalid token error: Logging user out...",Qh="250,000+",Jh="160+",Hr=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Bd=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function Xh(e){return e?{"--icon":`url(${Gt}icons/${e}.svg)`}:{}}const Tn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Sd=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),vo=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Ms=e=>{let t;const n=Vi(),r=Vi(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const i=t/Tn.milliseconds.inHour,a=Math.floor(t/Tn.milliseconds.inDay);if(a<1)return i<1?{path:"now"}:{path:"hours",number:Math.floor(i)};if(a<7)return{path:"days",number:a};const s=Math.floor(a/7);return s<=Tn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(a/Tn.year.days)}},Vi=e=>{const n=(e||new Date).toUTCString();return new Date(n)},ep=(e,t,n)=>{let r;const i=Vi(),a=Vi(new Date(e));try{r=i.getTime()-a.getTime()}catch{return!1}switch(n){case"seconds":return r/Tn.milliseconds.inSecond<=t;case"minutes":return r/Tn.milliseconds.inMinute<=t;case"hours":return r/Tn.milliseconds.inHour<=t}return!1},tp=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},np=e=>new Promise(t=>setTimeout(t,e)),rp=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},gr={apolitical:"Apolitical",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",card_carousel_viewAll:"View all",card_label_communityPage:"Community",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_new:"New",card_registered:"Registered",card_partner:"{partner} and {number} more",card_contributors_event:"Multiple speakers",card_contributors_solutionArticle:"Multiple authors",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_member_type_owner:"Admin",card_member_type_member:"Member",card_member_count:"{count} members",card_cta_people:"View profile",card_cta_communityPage:"Join now",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_communityPage_loading:"Joining...",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_communityPage_done:"Joined",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"previous",carousel_pagination_previousSlide:"Previous slide",carousel_pagination_next:"next",carousel_pagination_nextSlide:"Next slide",carousel_pagination_slide:"Slide {number} of {total}",carousel_pagination_ariaLive:"On {direction} slide: {count, plural, one {1 card} other {# cards}} available",carousel_pagination_ariaLive_slide:"On slide {slide}: {count, plural, one {1 card} other {# cards}} available",activitySection_notFoundError:"Post not found",activitiesFeed_sorting_label:"Choose feed sorting method",activitiesFeed_rankingMethod_recent:"Recent",activitiesFeed_rankingMethod_popular:"Popular",activitiesFeed_rankingMethod_internalTesting:"Testing",activitiesFeed_noActivities_inCategories:"There are no posts of this type yet.",activitiesFeed_noActivities:"Activities will appear here.",activitiesFeed_noActivities_button:"Explore Communities",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",community_sortSuccess:"Feed ordered by {order}",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",joinCommunityButton_closed_tooltip:"Please contact the admin of this closed community if you would like to join it.",joinCommunityButton_aria_live:"You are {action} this community",member_apolitical:"Apolitical",member_community:"Community post",member_deleted:"Deleted user",member_profile:"Update profile",member_createdAt_community:"{time} ago in <link>{community}</link>",membersList:"Members",membersList_admin:"Admin",membersList_profile:"Update profile",membersList_modal_title:"Update profile",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_poll:"poll",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_pinned_post:"Pinned Post",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
32
32
 
33
33
  Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
34
34
 
35
- Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Create post",discussionFormCard_placeholder_long:"Write a post or ask a question...",discussionFormCard_overlay_title:"Discard post",discussionFormCard_overlay_text:"Are you sure you want to leave without posting? Changes you have made will not be saved.",discussionFormCard_overlay_cta_discard:"Discard",discussionFormCard_overlay_cta_continue:"Continue editing",discussion_form_postType_label:"Post type","discussion_form__postType_no-category":"Post",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_question_label:"Question",discussion_form_question_placeholder:"Question",discussion_form_option_label:"Options",discussion_form_option_placeholder:"Option {number}",discussion_form_option_cta:"Add option",discussion_form_multiplePollAnswers:"Allow multiple answers",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Create post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Share a question, insight, or announcement with the community",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_showAll:"Show all...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_pin:"Pin post",discussion_moreMenu_unpin:"Unpin post",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments_loading:"... comments",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_share_copy_link:"Copy link",discussion_share_copy_link_success:"Link copied to clipboard",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",profileModalLauncher_successMessage:"Your post has been created",profileModalLauncher_title:"Your profile is incomplete",profileModalLauncher_text:"A complete profile builds trust and amplifies your voice across the community. Ensure all your details are up to date including a photo and a bio.",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_error_multipleInputs_same:"Please enter a unique value into each field",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",form_multipleInputs_label:"Input {number}",form_multipleInputs_filledInCount:"{number}/{total}",form_multipleInputs_filledInCount_aria:"{number} out of {total} available inputs have been filled in",form_multipleInputs_remove:"Remove this input",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their email addresses below",inviteForm_message_label:"Add an invitation note",inviteForm_message_placeholder:"Add a personal note to your invitation...",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profileForm_image:"Upload photo",profileForm_name:"Full name",profileForm_name_placeholder:"What's your name, so people can recognise you?",profileForm_jobTitle:"Job title",profileForm_jobTitle_placeholder:"What's your current job title?",profileForm_organization:"Organisation",profileForm_organization_placeholder:"Where do you work?",profileForm_location:"Location",profileForm_location_placeholder:"Add your city",profileForm_location_error:"Please choose a location from the list.",profileForm_bio:"Bio",profileForm_bio_placeholder:"Tell us more about yourself...",profileForm_cta:"Save",profileForm_cta_submitting:"Saving...",profileForm_cta_submitted:"Saved",profileImageChange_cta_uploading:"Uploading image...",profileImageChange_cta_change:"Change photo",profileImageChange_cta_upload:"+ Add profile photo",profileImageChange_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",publishArticleForm_title_label:"Title",publishArticleForm_title_placeholder:"Write a snappy title",publishArticleForm_subtitle_label:"Subtitle",publishArticleForm_subtitle_placeholder:"Your topic, in a nutshell",publishArticleForm_body_label:"Body",publishArticleForm_body_placeholder:"Type or paste your article here",publishArticleForm_tags_label:"Tags (select up to three)",publishArticleForm_cover_image_label:"Cover image",publishArticleForm__tags_topic_CitiesAndLocalGovernment:"Cities and local government",publishArticleForm__tags_topic_Climate:"Climate",publishArticleForm__tags_topic_DigitalAndData:"Digital, data and AI",publishArticleForm__tags_topic_Education:"Education",publishArticleForm__tags_topic_EquityJusticeAndInclusion:"Equity, justice and inclusion",publishArticleForm__tags_topic_HealthAndSocialCare:"Health and social care",publishArticleForm__tags_topic_Innovation:"Innovation",publishArticleForm__tags_topic_LeadershipAndSkills:"Leadership and skills",publishArticleForm__tags_topic_LifeInGovernment:"Life in government",publishArticleForm__tags_topic_Policymaking:"Policymaking",publishArticleForm__tags_topic_TransportAndInfrastructure:"Transport and infrastructure",publishArticleForm__tags_topic_WorkAndTheEconomy:"Work and the economy",publishArticleForm_tags_error_over_three:"You must select no more than three options.",publishArticleForm_tags_error_required:"Please select at least one option.",publishArticleForm_disclaimer:"Ready to publish? Before you do, consider the following: Have you thoroughly proofread your writing? Are you confident in your arguments? Have you included hyperlinks to the necessary resources to support your article?",publishArticleForm_cta_submit:"Publish article",publishArticleForm_cta_submitting:"Publishing...",publishArticleForm_cta_submitted:"Published!",publishArticleForm_aria_success:"Your article is being published. You will be redirected to your article in a moment.",publishArticleForm_error:"Sorry, something went wrong.",publishArticleForm_error_underMinLength:"Please add at least {length, plural, one {1 character} other {# characters}}.",publishArticleForm_error_loggedOut:"You need to be logged in to publish an article. Please log in and try again.",publishArticleForm_progressBar:"Your article is being published",publishArticleForm_selectImage_button:"Select a cover image",publishArticleForm_replaceImage_button:"Replace Image",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_heading_three:"Heading",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"Link:",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_link_enrichedUrl_aria:"Remove this preview for {title}",richTextEditor_link_enrichedUrl_aria_fallback:"the link",richTextEditor_link_enrichedUrl_aria_live:"The link preview has been removed from your post",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",poll_instructions:"Select one{allowMultipleVotes, select, true { or more} other {}}",poll_num_votes:"{number, plural, one {# vote} other {# votes}}",poll_remove_vote_button:"Remove vote{number, plural, =0 {} one {} other {s}}",poll_aria_votes:"You have {number, plural, =0 {not voted on this poll} other {voted for:}}",replies_feed_missing_polls_vote_message:"Please vote above to view all the comments",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_insights:"Insights",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_london:"London address",footer_contact_london_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_washington:"Washington DC Address",footer_contact_washington_address:"1100 15th St NW{br}Washington, DC 20005{br}United States",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_language_switcher:"Change language",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_communities:"Communities",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital, data and AI",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",header_language_unavailable:"This page is not available in the selected language. <link>Learn more →</link>",pageLayout_browserTooSmall:"Sorry, your device is too small to view this content properly. Please change to a different orientation or another device.",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",discussionFormModal_title:"Create a post",discussionFormModal_cta:"Create post",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their email addresses below.",inviteModal_cta:"Send",overlay_close:"Close",profileModal_title:"Update your profile",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",editSection_placeholder_description:"Add some details",editSection_placeholder_cta:"add",editSection_edit:"Edit",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip_survey:"Skip past survey",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll",markdown_iframe_survey:"Survey",member_connection_accept:"Accept",member_connection_cancel:"Cancel Request",member_connection_connect:"Connect",member_connection_connected:"Connected",member_connection_pending:"Pending",member_connection_remove:"Remove Connection",member_connection_requested:"Requested",member_show_email_hide:"Email visible only to connections",member_show_email_private:"Private profile email hidden",member_show_email_show:"Show contact info",member_show_email_tooltip:"Copy email address",member_show_email_tooltip_copied:"Email copied to clipboard",member_show_email_tooltip_mine:"Visible only to your connections",member_show_email_tooltip_private:"The privacy setting for this profile is private"},ip={...gr,languageSwitcher_label:"Me gustaría leer este artículo en...",languageSwitcher_translation_original:"idioma original",languageSwitcher_translation_human:"traducido por un humano",languageSwitcher_translation_machine:"traducido por máquina",languageSwitcher_disclaimer:"Este contenido fue traducido automáticamente y ocasionalmente tendrá errores de género u otras traducciones directas. Estamos intentando resolver este problema, pero mientras tanto, si notas algún error grave, escríbenos a <link>{email}</link>"},ap={...gr,languageSwitcher_label:"Je voudrais lire cet article dans...",languageSwitcher_translation_original:"langue originale",languageSwitcher_translation_human:"traduit par un humain",languageSwitcher_translation_machine:"traduit par machine",languageSwitcher_disclaimer:"Ce contenu est traduit automatiquement et contiendra d’évantuelles erreurs de genre ou d’autres traductions directes. Nous essayons de résoudre ce problème, mais en attendant, si vous remarquez une erreur importante, faites-le nous savoir à <link>{email}</link>",collapsibleSection_summary:"En savoir plus"},sp={...gr,languageSwitcher_label:"Eu gostaria de ler este artigo em...",languageSwitcher_translation_original:"linguagem original",languageSwitcher_translation_human:"traduzido por um humano",languageSwitcher_translation_machine:"traduzido por máquina",languageSwitcher_disclaimer:"Este conteúdo foi traduzido automaticamente e, ocasionalmente, poderão ocorrer erros de linguagem de gênero ou outras traduções diretas. Estamos tentando resolver isso, porém se perceber algo errado por favor nos avise em <link>{email}</link>"},op=Object.freeze(Object.defineProperty({__proto__:null,en:gr,es:ip,fr:ap,pt:sp},Symbol.toStringTag,{value:"Module"})),ma=(e,t=gr)=>e in t,Rt=(e,t,n,r,i={})=>{let a="";return ma(`${t}_${n}`)?a=e({id:`${t}_${n}`},i):a=e({id:t},{[r]:n,...i}),a},up=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let i=n.length-1;i>=0;i--){const a=Math.pow(10,(i+1)*3);if(a<=e){e=Math.round(e*t/a)/t,e===1e3&&i<n.length-1&&(e=1,i++),r=`${e}${n[i]}`;break}}return r},Oi=(e,t)=>x.Children.map(e,n=>Object.is(n,null)?n:x.cloneElement(n,{...t})),jd=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},lp=e=>{var a,s;const n=["name","organization","jobTitle","biography"].every(o=>{const u=e[o];return u!=null&&u!==""}),r=((a=e.image)==null?void 0:a.thumbnail)!==void 0,i=((s=e.location)==null?void 0:s.en)!==void 0;return n&&r&&i},cp=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,Vr).replace(/{{id}}/g,Vr):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Pd=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var a;if(!n)return e;const i=e.match(Hr);if(!i)return e;for(const s of i){const o=s.replace(Hr,(d,m)=>m),u=n[o];if(!u)continue;const l={};if(typeof u=="object")l.name=u.error?u.error:((a=u==null?void 0:u.data)==null?void 0:a.name)||"",l.id=u.id||"",l.error=u.error;else{const d=u;if(d.startsWith(Os))try{const m=d.replace(Os,"");l.id=m,await r({id:m}).then(h=>{const{name:p,error:g}=h;l.name=g||p||"",l.error=g})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,l.name?cp(e,l,t):s)}return e},bo=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Od=e=>new URLSearchParams(window.location.search).get(e),Kr=(e="")=>e.replace(/\s+/g,"").length>0,Ns=e=>{const t=e.length>8,n=/[0-9]/.test(e)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(e),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(e);return{isValid:t&&n&&r,matchingRules:{isMoreThanEightCharacters:t,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}};const we=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:i=!1,element:a="button",onClick:s=!1,className:o="",disabled:u=!1,tooltip:l="",forceTooltip:d=!1,screenreaderText:m=!1,children:h=!1,...p})=>{const f=wn(typeof t=="object"),{showTooltip:b,tooltipProps:v}=go(!!l);if(typeof t=="object"&&typeof f=="number"){const D=Object.assign({},t),_=Ed(Object.keys(D));t=_d(f,_,D)}!u&&l&&!d&&(l="");const y=[];typeof t=="string"&&y.push(t),r&&(y.push("icon"),typeof r=="object"?(y.push(r.icon),r.position?y.push(r.position):y.push("left"),r.hover&&y.push(`hover_${r.hover}`),r.animate&&(y.push("animate"),typeof r.animate=="string"&&y.push(r.animate))):(y.push(r),!r.includes("right")&&!r.includes("left")&&y.push("left")));const C={...p,className:K(e,o,y,{"no-text":!h,disabled:u,button:i,muted:n.muted,"full-width":n.fullWidth}),onClick:D=>{(!i||i[0]==="#")&&s&&(D.preventDefault(),D.stopPropagation()),s&&s(D)},disabled:typeof u=="object"&&"isClickable"in u?!u.isClickable:u};i&&(a="a",C.href=i);const k=x.createElement(a,C,h||(m?c.jsx(Oe,{showOnFocus:!1,children:m}):null));return d||u&&l?c.jsxs("span",{className:"button-container",...v,children:[c.jsx(Ln,{isOpen:b,accessibility:{readToScreenreadersWhenClosed:!0},children:l}),k]}):k},vr=({buttons:e,wrappers:t=[],className:n="",...r})=>{const i=e.length>1?"ul":"p",a=e.map((s,o)=>{var u;return i==="p"?c.jsx(we,{...s},o):c.jsx("li",{className:((u=t[o])==null?void 0:u.className)||"",children:c.jsx(we,{...s})},o)});return x.createElement(i,{className:K("button-wrapper",n),...r,children:a})};const zt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:K(e,{"has-max-width":t}),style:n})},Bu={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},highlightSection:{range:[{height:200,width:674},{height:400,width:1348},{height:1e3,width:1e3},{height:2e3,width:2e3}],sizes:"(max-width: 500px) 674px, (max-width: 1024px) 1348px, (max-width: 1200px) 1000px, 2000px"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"}},dp=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:i}=e?Bu[e]:Bu.fallback;return{range:t&&t.length>0?t:r,sizes:n||i}},fp=({format:e,height:t,query:n,width:r})=>{let i=`w=${r}&h=${t}`;return i=e?`${i}&fm=${e}`:i,i=n?`${i}&${n}`:i,i},Pa=({format:e,range:t,url:n,query:r})=>t.map(({height:i,width:a})=>`${n}?${fp({format:e,height:i,query:r,width:a})} ${a}w`).join(", ");const Cn=({image:e,className:t,testId:n})=>{const{description:r,height:i,type:a,color:s,query:o,url:u,width:l,loading:d,decoding:m,fetchPriority:h}=e,{range:p,sizes:g}=dp(e),f=Pa({format:"avif",query:o,range:p,url:u}),b=Pa({format:"webp",query:o,range:p,url:u}),v=Pa({format:"",query:o,range:p,url:u});let y={};return s&&(y={"--color":s}),a&&a.includes("svg")?c.jsx("picture",{className:t,style:y,children:c.jsx("img",{src:u,alt:r,loading:d||"lazy",decoding:m||"async",fetchpriority:h||"auto",width:l,height:i,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,style:y,children:[a!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:f,sizes:g,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:b,sizes:g,"data-testid":"source"}),c.jsx("img",{srcSet:v,sizes:g,src:u,alt:r,loading:d||"lazy",decoding:m||"async",fetchpriority:h||"auto",width:l,height:i,"data-testid":n||"image"})]})};const mp=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(Cn,{image:{...e},className:"image"})}),Dn=({href:e,children:t,fallbackElement:n,meta:r,className:i="",onClick:a,gtmContext:s,gtmType:o,...u})=>{const{forceOnClick:l=!1}=r||{};if(e){const m={...u};return a&&(m.onClick=a),s&&(m["data-gtm-event-context"]=s),o&&(m["data-gtm-event-type"]=o),c.jsx("a",{href:e,className:K("gtm-trackable",i),...m,children:t})}const d={};return l&&(d.onClick=a),n?x.createElement(n,{children:t,className:i,...u,...d}):c.jsx(c.Fragment,{children:t})};const Md=x.forwardRef(({className:e="",children:t},n)=>{const r=x.useRef(null),i=n||r;return c.jsx("aside",{ref:i,className:K("popover",e),"aria-live":"polite",children:t})}),br=({parent:e=document.body,children:t})=>typeof document=="object"?gd.createPortal(t,e):null,hp=Object.freeze(Object.defineProperty({__proto__:null,default:br},Symbol.toStringTag,{value:"Module"}));const pp=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Oe,{children:c.jsx(ie.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),c.jsx("div",{className:"progress-tracker",children:c.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const i=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:K("dot",{active:i===e,completed:i<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:K("line",{active:i<e})})]},r)})})})]});const gp=({elementId:e,offset:t=20})=>{const n=ie.useIntl(),r=()=>{const i=document.getElementById(e);if(!i)return;const a=document.getElementById("header");a&&window.scrollTo({top:i.offsetTop-a.clientHeight-t})};return c.jsx(we,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const vp=({items:e,className:t="",...n})=>c.jsx("ul",{className:K("buckets",t),...n,children:e.map(({title:r,text:i,link:a,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:a,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:i})]})},o))}),Su=300,ju="ease-in-out";class bp{constructor(t){this.el=t,this.summary=t.querySelector("summary"),this.content=t.querySelector(".content"),this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.summary.addEventListener("click",n=>this.onClick(n))}cleanUp(){this.summary.removeEventListener("click",t=>this.onClick(t))}onClick(t){t.preventDefault(),t.stopPropagation(),this.el.style.overflow="hidden",this.isClosing||!this.el.open?this.open():(this.isExpanding||this.el.open)&&this.shrink()}shrink(){this.isClosing=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:Su,easing:ju}),this.animation.onfinish=()=>this.onAnimationFinish(!1),this.animation.oncancel=()=>this.isClosing=!1}open(){this.el.style.height=`${this.el.offsetHeight}px`,this.el.open=!0,window.requestAnimationFrame(()=>this.expand())}expand(){this.isExpanding=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight+this.content.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:Su,easing:ju}),this.animation.onfinish=()=>this.onAnimationFinish(!0),this.animation.oncancel=()=>this.isExpanding=!1}onAnimationFinish(t){this.el.open=t,this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.el.style.height=this.el.style.overflow=""}}const ha=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const i=ie.useIntl(),a=x.useRef(null);return x.useEffect(()=>{let s;return r&&(s=new bp(a.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:a,className:K("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||i.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},Pu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},yp=e=>{let t=e;return Object.keys(Pu).includes(e)&&(t=Pu[e]),`url(${Gt}icons/${t}.svg)`};const Ou={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Nd=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const i=ie.useIntl(),a=t?{"--custom-icon":yp(t)}:{},s=ma(`contentTypeLabel_${e}`)?i.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:K("content-type-label text-small",e in Ou?Ou[e]:e,r,{"has-custom-icon":t}),style:a,"data-testid":"content-type-label",children:n||s})};const _t=({variant:e="primary",icon:t,styling:n={},className:r="",children:i,...a})=>{const{showHighlight:s=!1,background:o="default"}=n,u=t?{"--icon":`url(${Gt}icons/${t}.svg)`}:{};return c.jsx("div",{className:K("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:u,...a,children:i})};const Qt=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let i=n&&!!Object.keys(n).length;const a=typeof n=="object"&&"breakpoints"in n,s=wn(a);if(a&&typeof n=="object"&&typeof s=="number"){const m=Object.assign({},n.breakpoints),h=Ed(Object.keys(m));i=_d(s,h,m)}const{breakpoints:o,text:u="",component:l,...d}=n;return c.jsx(_t,{variant:"subtle",className:K("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(Zt,{options:{forceBlock:!0},children:t}):t,i&&typeof n=="object"&&(l||c.jsx(we,{...d,variant:n.variant?n.variant:"secondary",children:u}))]})})};const Is=({children:e,...t})=>c.jsx("p",{...t,children:e}),Id={q:Is,blockquote:Is};for(let e=1;e<=6;e++)Id[`h${e}`]={component:Is,props:{className:"title"}};const Rd=({type:e="default",className:t="",heading:n=!1,children:r,...i})=>c.jsxs("div",{...i,className:K("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(Zt,{options:{wrapper:x.Fragment,forceBlock:!0,overrides:Id},children:r}):c.jsx("p",{children:r})]});const $d=({id:e,className:t="",show:n=!1,hide:r=!1,text:i,markdownOptions:a,fadeStyle:s="default",children:o})=>{const u=ie.useIntl(),l=x.useRef(null);e||(e=Date.now().toString());const[d,m]=x.useState(""),[h,p]=x.useState("closed");x.useEffect(()=>{const b=l.current;if(b)return b.addEventListener("transitionend",g),()=>{b.removeEventListener("transitionend",g)}},[]),x.useEffect(()=>{if(!i||typeof i!="string")return;const b=i.split(`
36
- `);m(b.length<3?`${i.substring(0,400)}...`:b.slice(0,3).join(`
37
- `))},[i]),x.useEffect(()=>{h==="ready-to-close"&&p("closing")},[h]);const g=({propertyName:b})=>{b==="max-height"&&p(v=>v==="opening"?"open":v==="closing"?"closed":v)},f=["opening","open"].includes(h);return c.jsxs(_t,{variant:"subtle",className:K("hide-show-text-box",t),children:[c.jsx("div",{ref:l,id:e,className:K("content",h,s),children:i?c.jsxs(c.Fragment,{children:[c.jsx(Zt,{options:{forceBlock:!0,...a},children:h==="closed"?d:i}),h!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(we,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:K({"rotate-180":f}),onClick:()=>{p(f?"ready-to-close":"opening")},"aria-expanded":f,"aria-controls":e,children:f?r||u.formatMessage({id:"hideShowTextBox_hide"}):n||u.formatMessage({id:"hideShowTextBox_show"})})})]})};const xp=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:i={},className:a=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=i;return x.createElement(e,{className:K("icon-bulleted-list text-medium",n,a,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((u,l)=>{const d={wrapper:x.Fragment,forceInline:!0},m={"--icon":`url(${Gt}icons/${u.icon}.svg)`};return e==="dl"?c.jsxs(x.Fragment,{children:[c.jsx("dt",{style:m,children:c.jsx(Zt,{options:d,children:u.dt||""})},`dt-${l}`),c.jsx("dd",{children:typeof u.text=="string"?c.jsx(Zt,{options:d,children:u.text}):u.text},`dd-${l}`)]},`dl-${l}`):c.jsx("li",{style:m,children:typeof u.text=="string"?c.jsx(Zt,{options:d,children:u.text}):u.text},l)})})},st=()=>x.Fragment,wp=({children:e})=>c.jsx(_t,{variant:"secondary",children:e}),Cp=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),Dp=["span","strong","h1","h2","h3","h4","h5","h6","p"],Ep=({children:e})=>{const t=ie.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const a of x.Children.toArray(e))if(!(!a||typeof a=="string"||typeof a=="number"))if(x.isValidElement(a)&&a.type==="summary"){if(a.props&&a.props.children){for(const s of x.Children.toArray(a.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&x.isValidElement(s)){const o=s.type;if(Dp.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(a);const i=n?n.toString():"";return c.jsx(ha,{label:i,className:["Sources","Resources"].includes(i)?"discrete-links":"",children:r.map(a=>a)})},_p=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(_t,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(_t,{variant:"primary",children:e});case"pink-textbox":return c.jsx(_t,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{children:e}):e;default:return c.jsx("div",{...t,children:e})}return c.jsx("div",{...t,children:e})},St=({children:e})=>c.jsx(c.Fragment,{children:e}),yo=x.createContext({badges:[],isLoading:!0});function Ld(){return x.useContext(yo)}const zd=({children:e,badges:t})=>c.jsx(yo.Provider,{value:t,children:e}),qd=({showDevTools:e=!0,children:t})=>{const n=new Re.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(Re.QueryClientProvider,{client:n,children:[t,e&&c.jsx($h.ReactQueryDevtools,{initialIsOpen:!1})]})};var kp=x.createContext({client:Pi});function Fp(e){var t=e.children,n=e.client,r=e.apiKey,i=e.options,a=x.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&i&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(Pi.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Pi.init(r,i)),Pi)},[n,r]);return x.createElement(kp.Provider,{value:{client:a}},t)}const Ud=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(Fp,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):c.jsx(c.Fragment,{children:e});var Wd=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(Wd||{});const Vd=({children:e,locale:t,messages:n})=>{const r=t||"en",i={...op[r],...n||{}};return c.jsx(ie.IntlProvider,{locale:r,messages:i,children:e})},xo=x.createContext({}),Mi={en:"English",es:"Español",fr:"Français",pt:"Português"},rt=x.createContext({isLoading:!0});function pa(){return x.useContext(rt)}const Hd=({children:e,user:t,updateDetails:n})=>c.jsx(rt.Provider,{value:{...t,updateDetails:n},children:e}),wo=x.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Kd=()=>x.useContext(wo),Zd=({children:e})=>{const[t,n]=x.useState([]);x.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=x.useCallback(a=>{n(s=>[...s,a])},[]),i=x.useCallback(a=>{n(s=>s.filter(o=>o!==a))},[]);return c.jsx(wo.Provider,{value:{registerOverlay:r,unregisterOverlay:i},children:e})},Ap=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[i,a]=x.useState({isLoading:!0}),[s,o]=x.useState({badges:[],isLoading:!0}),u=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[l,d]=x.useState(u),m=h=>{localStorage.setItem("language",h),d(h)};return x.useEffect(()=>{e().then(h=>{Array.isArray(h)?(a({...h[0],isLoading:!1}),o({badges:h[1],isLoading:!1})):a({...h,isLoading:!1}),jd(5e3)}).catch(h=>{h.message===Td&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),a({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(xo.Provider,{value:{language:l,updateLanguage:m},children:c.jsx(Vd,{locale:l,messages:n==null?void 0:n.messages,children:c.jsx(ho.CookiesProvider,{children:c.jsx(Hd,{user:i,updateDetails:a,children:c.jsx(zd,{badges:s,children:c.jsx(Zd,{children:c.jsx(qd,{showDevTools:r,children:c.jsx(Ud,{user:i,children:t})})})})})})})})},Tp=e=>{const t=ie.useIntl(),n=Date.now().toString(),r=x.useContext(rt);let i="default",a=e.src;a.includes("youtube")||a.includes("vimeo")?i="video":a.includes("riddle")||a.includes("sli.do")?i="poll":a.includes("padlet")?i="padlet":a.includes("surveysparrow")&&(i="survey",r!=null&&r.id&&(a=`${a}&user_id=${r.id}`));const s=`content-after-iframe-${n}`;return c.jsxs(c.Fragment,{children:[c.jsx(Oe,{element:"a",href:`#${s}`,onClick:o=>{o.preventDefault(),o.stopPropagation();const u=document.getElementById(s);u==null||u.scrollIntoView({behavior:"smooth"}),u==null||u.focus()},children:t.formatMessage({id:`markdown_skip${i==="default"?"":`_${i}`}`})}),c.jsx("iframe",{...e,src:a,title:t.formatMessage({id:`markdown_iframe${i==="default"?"":`_${i}`}`})}),c.jsx("span",{id:s,tabIndex:0})]})},Mu=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Bp=({children:e,...t})=>{const n=ie.useIntl();let r={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(r.target="_blank");let i=e,a=!1;for(const o of x.Children.toArray(e))if(!(!o||typeof o=="string"||typeof o=="number")&&x.isValidElement(o)){const u=o.type;if(["button","center","span","strong"].includes(u)&&o.props&&o.props.children&&o.props.children[0])for((u==="button"||Mu(o.props.children[0])==="button")&&(a=!0),i=o.props.children[0];i&&typeof i!="string"&&!(typeof i=="boolean"||typeof i=="number"||!x.isValidElement(i));)if(i.props&&i.props.children&&i.props.children[0])i=i.props.children[0],i&&Mu(i)==="button"&&(a=!0);else break}const s=`@${Vr}`;return i===s||Array.isArray(i)&&i[0]===s?(delete r.href,delete r.target,c.jsxs("span",{...r,className:"mention deleted-user",children:["@",n.formatMessage({id:"member_deleted"})]})):a?(r={...r,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(we,{variant:"primary",size:"medium",...r,children:i})})):c.jsx("a",{...r,children:i})},Rs=({children:e,...t})=>c.jsx("span",{className:K({url:t==null?void 0:t.href}),children:e});const Sp={default:{a:Bp,CollapsibleSection:ha,TextBox:_t,CaseStudy:wp,style:st,details:Ep,div:_p,iframe:Tp,center:Cp,script:st},"text-only":{h1:st,h2:st,h3:st,h4:st,h5:st,h6:st,style:st,details:st,div:st,TextBox:st,CollapsibleSection:st,CaseStudy:st,blockquote:st,iframe:st,button:st}},On=({element:e="div",className:t="",options:n={},children:r,overrideType:i="default",styling:a={}})=>{if(!r)return null;const{highlightTitles:s=!1}=a;r=r.replace(/^<br\/?>/,"");const o={wrapper:x.Fragment,forceBlock:!0};let u=Sp[i];return n.overrides&&(u={...u,...n.overrides}),x.createElement(e,{className:K("markdown-text",t,{"highlight-titles":s}),children:c.jsx(Zt,{options:{...o,...n,overrides:u},children:r})})};const Yd=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:i="",ctaButton:a})=>{const s=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:K("page-heading",i),children:[c.jsxs("div",{className:K("content",{"has-max-width":e}),style:s,children:[c.jsxs("div",{className:K("content-wrapper",{"has-max-width":e}),children:[t&&t.text&&x.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&x.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),a&&c.jsx(we,{...a,className:K("cta-button","gtm-trackable"),"data-gtm-event-context":"CreateNewArticle","data-gtm-event-type":"create-article-click",children:a.text})]}),r]})};const Yt=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:i="",children:a,element:s="span",...o})=>{const u={"--icon":`url(${Gt}icons/${r}.svg)`},{showTooltip:l,tooltipProps:d}=go(!!i),m={},h=i?typeof i=="string"?`tooltip-${window.btoa(i)}`:i.id:void 0,p=i?typeof i=="string"?i:i.text:void 0;i&&h&&(m["aria-describedby"]=h);const g=x.createElement(i?"button":s,{className:K("pill",e,t,n,{"has-icon":r}),style:u,children:a,...d,...m,...o});return i?x.createElement(s,{className:"pill-wrapper"},c.jsxs(c.Fragment,{children:[g,c.jsx(Ln,{id:h,isOpen:l,children:p})]})):g};const ur=({element:e="p",children:t=null,className:n="",...r})=>x.createElement(e,{...r,className:K("status-banner text-small",n),"aria-live":"assertive"},t),jp={globe:"globe",heart:"heart_empty_thick",pencil:"pencil",star:"star_empty","speech-bubble":"speech-bubble_round"};const Gd=({slug:e})=>{const{badges:t}=Ld(),n=t==null?void 0:t.find(o=>o.slug===e);if(!n)return null;const{name:r,icon:i,colour:a,description:s}=n;return c.jsx(Yt,{className:K("user-badge",a==null?void 0:a.toLowerCase()),icon:i&&jp[i],element:"li",tooltip:s,children:r})};var ut=(e=>(e.Communities="communities",e.Platform="platform",e))(ut||{});const Qd=({element:e="ul",userBadges:t,badgeOptions:n})=>{if(Object.keys(t).length!==0)return x.createElement(e,{className:"badges-list",children:(n==null?void 0:n.scopes)&&(n==null?void 0:n.scopes.map(r=>{var i,a;return(a=(i=t==null?void 0:t[r.scope])==null?void 0:i[r.area])==null?void 0:a.map((s,o)=>c.jsx(Gd,{slug:s},o))}))})};var Co=(e=>(e.Accepted="accepted",e.Cancelled="cancelled",e.Declined="declined",e.Pending="pending",e.Removed="removed",e))(Co||{}),Do=(e=>(e.In="in",e.Out="out",e))(Do||{});const{In:Pp,Out:Nu}=Do,{Pending:Oa,Accepted:Iu,Cancelled:Op,Removed:Mp}=Co,Jd=({functions:e,connection:t={status:null,direction:null},disableConnect:n=!1,meta:{topLevelButton:r=!1}={},...i})=>{const{formatMessage:a}=ie.useIntl(),{status:s,direction:o}=t,{onAccept:u,onCancel:l,onRemove:d,onRequest:m}=e,[h,p]=x.useState(!1),[g,f]=x.useState(s),[b,v]=x.useState(o);x.useEffect(()=>{f(s),v(o)},[s,o]);const y=async(C,k)=>{try{p(!0),await C()&&(k!=null&&k.status&&f(k.status),k!=null&&k.direction&&v(k.direction))}finally{p(!1)}};return g===Oa&&b===Nu?c.jsx(we,{onClick:async()=>{await y(u,{status:Iu})},disabled:h,variant:r?"primary":"secondary",size:"small",icon:{icon:"user-plus"},...i,children:a({id:"member_connection_accept"})}):g===Oa&&b===Pp?c.jsxs("div",{className:"connection-cta-wrapper",children:[c.jsx("span",{className:"button secondary connection-cta pending small icon clock left",...i,children:a({id:"member_connection_pending"})}),l&&c.jsx(Xi,{options:[{onClick:async()=>{await y(l,{status:Op})},text:a({id:"member_connection_cancel"})}]})]}):g===Iu?c.jsxs("div",{className:"connection-cta-wrapper",children:[c.jsx("span",{className:"button secondary connection-cta connected small icon tick left",...i,children:a({id:"member_connection_connected"})}),d&&c.jsx(Xi,{options:[{onClick:async()=>{await y(d,{status:Mp})},text:a({id:"member_connection_remove"})}]})]}):!g&&m&&!n?c.jsx(we,{onClick:async()=>{await y(m,{status:Oa,direction:Nu})},variant:r?"primary":"secondary",size:"small",disabled:h,icon:{icon:"user-plus"},...i,children:a({id:"member_connection_connect"})}):c.jsx(c.Fragment,{})};const Np=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const i=ie.useIntl(),{showText:a=!1,layout:s="bar",size:o="default",color:u="default"}=e,l=t>75?100:t>50?75:t>25?50:t>5?25:0,d={"--progress":`${t}%`};return c.jsx("span",{className:K(`progress-bar section-${l}`,s,r,{[o]:o!=="default",[u!=="default"?u:""]:u!=="default"}),style:d,children:x.createElement(a?"span":Oe,{className:a?"text":"",children:n||i.formatMessage({id:"progressBar"},{number:t})})})},Eo=x.memo(Np);const Ma="loadingBlock_",Ip=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ie.useIntl();t||(t={0:{text:r.formatMessage({id:`${Ma}loading`})},75:{text:r.formatMessage({id:`${Ma}almostDone`})},100:{text:r.formatMessage({id:`${Ma}complete`})}});let i=null;const a=Object.keys(t);for(let o=0;o<a.length&&!(e<parseInt(a[o]));o++)i=a[o];const s=i&&t[i].icon?{"--icon":`url(${Gt}icons/${t[i].icon}.svg)`}:{};return c.jsxs(_t,{className:K("loading-block",n,{"has-icon":i&&t[i].icon}),variant:"subtle",style:s,children:[i&&c.jsx("span",{className:"step",children:t[i].text}),c.jsx(Eo,{progress:e})]})},Xd=x.memo(Ip);const Nt=({element:e="div",className:t="",...n})=>c.jsx(fa,{element:e,className:K("loading-placeholder",t),...n});const $s={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],member:["profile-picture","text","text"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},ef=(e,t)=>e in $s?c.jsx("div",{className:e,children:$s[e].map((n,r)=>ef(n,r))},t):c.jsx(Nt,{className:e},t),ga=({layout:e="overview-page",...t})=>c.jsx("div",{className:K("loading-state",e),...t,children:$s[e].map((n,r)=>ef(n,r))}),tf=e=>{const t=e&&e.toUpperCase().trim().split(" ");return Array.isArray(t)&&t.length>1&&t[0]!==""?t[1]===""?t[0][0]:t[0][0]+t[t.length-1][0]:e?e.substr(0,1):""},di=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Rp=e=>{const t=Math.ceil(26/di.length),n=tf(e).toLowerCase();if(n==="")return di[0];const r=n.charCodeAt(0)-96;for(let i=0;i<di.length;i++)if(r<=t*(i+1))return di[i]};const Ru=256,un=({className:e="",src:t="",name:n,alt:r,width:i=Ru,height:a=Ru,showInitials:s=!0,...o})=>{const[u,l]=x.useState(!1),d=x.useRef(null),m=r??n;x.useEffect(()=>{const p=d.current;if(!p)return;const g=p.getContext("2d");if(!g)return;const f=i,b=a;typeof window<"u"&&window.devicePixelRatio&&(p.width=f*window.devicePixelRatio,p.height=b*window.devicePixelRatio,g.scale(window.devicePixelRatio,window.devicePixelRatio)),g.fillStyle=Rp(n),g.fillRect(0,0,f,b),g.font=`${f/3}px Arial`,g.textAlign="center",g.fillStyle="white",g.fillText(tf(n),f/2,b/1.6)},[n]);let h=!1;return t&&t!==""&&!u&&(t.includes("http")||t.includes("//"))&&(h=!0),c.jsx("figure",{className:K("profile-picture",e,{error:u}),...o,children:h?c.jsx("img",{src:t,alt:m,onError:()=>{l(!0)},width:i,height:a}):s?c.jsx("canvas",{ref:d}):c.jsx("span",{className:"fallback"})})};var it=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(it||{});const va=e=>e==="apolitical"?{image:`${Gt}logos/member_apolitical.svg`}:e==="community"||e==="deleted"||typeof e=="object"&&!e.name?{image:`${Gt}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.en||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail,badges:e.badges},$p=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const i=e!=="",a=t!=="",s=n!=="";if(!i&&!a&&!s)return"";const o=`${e}${i&&a?` — ${t}`:t}`;let u=`${o}${(i||a)&&s?`, ${n}`:n}`;return u.length>r&&(u=o),u.length>r&&(u=sr(u,r)),u};const Lp=x.lazy(()=>Promise.resolve().then(()=>hp)),zp=x.lazy(()=>Promise.resolve().then(()=>Ak));let fi=null;const an=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:i={},functions:a={},gtmContext:s="member",gtmType:o="member-click",className:u="",badges:l,connection:d,...m})=>{var H,V,ae,ne,E;const h=ie.useIntl(),{profile:p,connections:g,...f}=a,{size:b="medium",variant:v="inline",isCondensed:y=!0,additionalContentNewLine:C=!1}=i,k=x.useContext(rt),D=p&&k&&typeof k.id=="string",[_,B]=x.useState(!1),P=va(t);P.name||(P.name=h.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:N,image:z}=P;let{url:O}=P;typeof t=="object"&&t.link!==void 0&&(t.link===!1?O=void 0:O=t.link);const A=$p(P),F=r&&r.createdAt?Ms(r.createdAt):!1,S=r&&r.createdAt?vo(r.createdAt):"",I=!O&&D;return x.createElement(e,{...m,className:K("member text-medium",b,v,u,{"has-profile-link":D}),...f,children:c.jsxs(c.Fragment,{children:[c.jsxs(Dn,{href:O,className:K({"details-wrapper":I}),fallbackElement:I?"div":void 0,gtmType:o,gtmContext:s,meta:{forceOnClick:!0},onClick:Y=>{if(Y==null||Y.preventDefault(),Y==null||Y.stopPropagation(),!O){I&&B(!0);return}fi&&clearTimeout(fi),fi=setTimeout(()=>{window.location.href=O},150);const q=new CustomEvent(it.MEMBER_CLICKED,{detail:{link:O,timeout:fi}});document.dispatchEvent(q)},children:[c.jsx(un,{name:N,src:z,alt:n}),c.jsxs("div",{className:"details",children:[c.jsxs("div",{className:K("name",{"new-line":C}),"data-testid":"member-name",children:[c.jsx("span",{children:N}),(l==null?void 0:l.showBadges)&&(P==null?void 0:P.badges)&&c.jsx(Qd,{userBadges:P.badges,badgeOptions:l}),r&&c.jsxs("span",{className:K("additional-content",{"new-line":C}),children:[r.createdAt&&F&&!((H=r==null?void 0:r.customMessage)!=null&&H.text)&&c.jsx("span",{className:"date",title:S,"aria-label":S,"data-testid":"date",children:h.formatMessage({id:`dates_${F.path}`},{number:F.number})}),r.createdAt&&F&&((V=r==null?void 0:r.customMessage)==null?void 0:V.text)&&c.jsx("span",{children:h.formatMessage({id:(ae=r.customMessage)==null?void 0:ae.text},{time:h.formatMessage({id:`dates_${F.path}`},{number:F.number}),community:(E=(ne=r.customMessage)==null?void 0:ne.link)==null?void 0:E.text,link:Y=>{var q,T;return c.jsx("a",{href:`${(T=(q=r.customMessage)==null?void 0:q.link)==null?void 0:T.url}`,onClick:j=>j.stopPropagation(),children:Y})}})}),r.didEdit&&c.jsx("em",{children:h.formatMessage({id:"discussion_edited"})})]})]}),A&&!C&&c.jsx("small",{className:K({"text-medium":b==="large"}),"data-testid":"member-details",children:y?A:c.jsxs(c.Fragment,{children:[P.role,P.organisation?` — ${P.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:P.country})]})})]})]}),g&&c.jsx(Jd,{connection:d,functions:g}),A&&p&&D?c.jsxs(c.Fragment,{children:[c.jsx(we,{variant:"tertiary",size:"small",onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),B(!0)},"data-testid":"profile-button",children:h.formatMessage({id:"member_profile"})}),c.jsx(Lp,{children:c.jsx(zp,{form:p,showModal:_,content:{title:h.formatMessage({id:"member_profile"})},functions:{onClose:()=>{B(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},qp=Object.freeze(Object.defineProperty({__proto__:null,default:an},Symbol.toStringTag,{value:"Module"}));const $u={small:24,medium:48},_o=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:i,showGap:a,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:u,className:l="",...d})=>{const m=ie.useIntl();return!n||n.length===0?null:x.createElement(e,{...d,className:K("contributors",l,i,{"has-gap":a}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((h,p)=>{let g,f="";if(p<o){const{name:b="",image:v=""}=va(h);if(s)return c.jsx(Nt,{element:"li",className:"contributor"},p);g=c.jsx(un,{name:b,src:v,width:$u[i||"medium"],height:$u[i||"medium"]})}else if(p===o){const b=(t||n.length)-o;g=c.jsxs("small",{className:K({"large-number":b>99}),children:["+",up(b,0)]}),f="number-left"}return g?c.jsx("li",{className:K("contributor",f),children:g},p):null})}),r&&c.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?m.formatMessage({id:`member_${n[0]}`}):sr(n[0].name||"",20):u||null})]})})};const ko=({element:e="section",children:t,className:n,variant:r,additionalContent:i,...a})=>{let s=typeof t=="string"?c.jsx("p",{children:t}):t;return i&&(s=c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"modal-content",children:typeof t=="string"?c.jsx("p",{children:t}):t}),c.jsx("div",{className:"modal-additional-content",children:typeof i=="string"?c.jsx("p",{children:i}):i})]})),x.createElement(e,{className:K("modal",n,{"success-section":r==="success"}),children:s,...a})};var Ls={exports:{}},mi={exports:{}},$e={};/** @license React v16.13.1
35
+ Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Create post",discussionFormCard_placeholder_long:"Write a post or ask a question...",discussionFormCard_overlay_title:"Discard post",discussionFormCard_overlay_text:"Are you sure you want to leave without posting? Changes you have made will not be saved.",discussionFormCard_overlay_cta_discard:"Discard",discussionFormCard_overlay_cta_continue:"Continue editing",discussion_form_postType_label:"Post type","discussion_form__postType_no-category":"Post",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_question_label:"Question",discussion_form_question_placeholder:"Question",discussion_form_option_label:"Options",discussion_form_option_placeholder:"Option {number}",discussion_form_option_cta:"Add option",discussion_form_multiplePollAnswers:"Allow multiple answers",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Create post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Share a question, insight, or announcement with the community",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_showAll:"Show all...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_pin:"Pin post",discussion_moreMenu_unpin:"Unpin post",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments_loading:"... comments",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_share_copy_link:"Copy link",discussion_share_copy_link_success:"Link copied to clipboard",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",profileModalLauncher_successMessage:"Your post has been created",profileModalLauncher_title:"Your profile is incomplete",profileModalLauncher_text:"A complete profile builds trust and amplifies your voice across the community. Ensure all your details are up to date including a photo and a bio.",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_error_multipleInputs_same:"Please enter a unique value into each field",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",form_multipleInputs_label:"Input {number}",form_multipleInputs_filledInCount:"{number}/{total}",form_multipleInputs_filledInCount_aria:"{number} out of {total} available inputs have been filled in",form_multipleInputs_remove:"Remove this input",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their email addresses below",inviteForm_message_label:"Add an invitation note",inviteForm_message_placeholder:"Add a personal note to your invitation...",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profileForm_image:"Upload photo",profileForm_name:"Full name",profileForm_name_placeholder:"What's your name, so people can recognise you?",profileForm_jobTitle:"Job title",profileForm_jobTitle_placeholder:"What's your current job title?",profileForm_organization:"Organisation",profileForm_organization_placeholder:"Where do you work?",profileForm_location:"Location",profileForm_location_placeholder:"Add your city",profileForm_location_error:"Please choose a location from the list.",profileForm_bio:"Bio",profileForm_bio_placeholder:"Tell us more about yourself...",profileForm_cta:"Save",profileForm_cta_submitting:"Saving...",profileForm_cta_submitted:"Saved",profileImageChange_cta_uploading:"Uploading image...",profileImageChange_cta_change:"Change photo",profileImageChange_cta_upload:"+ Add profile photo",profileImageChange_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",publishArticleForm_title_label:"Title",publishArticleForm_title_placeholder:"Write a snappy title",publishArticleForm_subtitle_label:"Subtitle",publishArticleForm_subtitle_placeholder:"Your topic, in a nutshell",publishArticleForm_body_label:"Body",publishArticleForm_body_placeholder:"Type or paste your article here",publishArticleForm_tags_label:"Tags (select up to three)",publishArticleForm_cover_image_label:"Cover image",publishArticleForm__tags_topic_CitiesAndLocalGovernment:"Cities and local government",publishArticleForm__tags_topic_Climate:"Climate",publishArticleForm__tags_topic_DigitalAndData:"Digital, data and AI",publishArticleForm__tags_topic_Education:"Education",publishArticleForm__tags_topic_EquityJusticeAndInclusion:"Equity, justice and inclusion",publishArticleForm__tags_topic_HealthAndSocialCare:"Health and social care",publishArticleForm__tags_topic_Innovation:"Innovation",publishArticleForm__tags_topic_LeadershipAndSkills:"Leadership and skills",publishArticleForm__tags_topic_LifeInGovernment:"Life in government",publishArticleForm__tags_topic_Policymaking:"Policymaking",publishArticleForm__tags_topic_TransportAndInfrastructure:"Transport and infrastructure",publishArticleForm__tags_topic_WorkAndTheEconomy:"Work and the economy",publishArticleForm_tags_error_over_three:"You must select no more than three options.",publishArticleForm_tags_error_required:"Please select at least one option.",publishArticleForm_disclaimer:"Ready to publish? Before you do, consider the following: Have you thoroughly proofread your writing? Are you confident in your arguments? Have you included hyperlinks to the necessary resources to support your article?",publishArticleForm_cta_submit:"Publish article",publishArticleForm_cta_submitting:"Publishing...",publishArticleForm_cta_submitted:"Published!",publishArticleForm_aria_success:"Your article is being published. You will be redirected to your article in a moment.",publishArticleForm_error:"Sorry, something went wrong.",publishArticleForm_error_underMinLength:"Please add at least {length, plural, one {1 character} other {# characters}}.",publishArticleForm_error_loggedOut:"You need to be logged in to publish an article. Please log in and try again.",publishArticleForm_progressBar:"Your article is being published",publishArticleForm_selectImage_button:"Select a cover image",publishArticleForm_replaceImage_button:"Replace Image",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_heading_three:"Heading",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"Link:",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_link_enrichedUrl_aria:"Remove this preview for {title}",richTextEditor_link_enrichedUrl_aria_fallback:"the link",richTextEditor_link_enrichedUrl_aria_live:"The link preview has been removed from your post",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",poll_instructions:"Select one{allowMultipleVotes, select, true { or more} other {}}",poll_num_votes:"{number, plural, one {# vote} other {# votes}}",poll_remove_vote_button:"Remove vote{number, plural, =0 {} one {} other {s}}",poll_aria_votes:"You have {number, plural, =0 {not voted on this poll} other {voted for:}}",replies_feed_missing_polls_vote_message:"Please vote above to view all the comments",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_insights:"Insights",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_london:"London address",footer_contact_london_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_washington:"Washington DC Address",footer_contact_washington_address:"1100 15th St NW{br}Washington, DC 20005{br}United States",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_language_switcher:"Change language",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_communities:"Communities",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital, data and AI",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",header_language_unavailable:"This page is not available in the selected language. <link>Learn more →</link>",pageLayout_browserTooSmall:"Sorry, your device is too small to view this content properly. Please change to a different orientation or another device.",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",discussionFormModal_title:"Create a post",discussionFormModal_cta:"Create post",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their email addresses below.",inviteModal_cta:"Send",overlay_close:"Close",profileModal_title:"Update your profile",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",editSection_placeholder_description:"Add some details",editSection_placeholder_cta:"add",editSection_edit:"Edit",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip_survey:"Skip past survey",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll",markdown_iframe_survey:"Survey",member_connection_accept:"Accept",member_connection_cancel:"Cancel Request",member_connection_connect:"Connect",member_connection_connected:"Connected",member_connection_pending:"Pending",member_connection_remove:"Remove Connection",member_connection_requested:"Requested",member_show_email_hide:"Email visible only to connections",member_show_email_private:"Private profile email hidden",member_show_email_show:"Show contact info",member_show_email_tooltip:"Copy email address",member_show_email_tooltip_copied:"Email copied to clipboard",member_show_email_tooltip_mine:"Visible only to your connections",member_show_email_tooltip_private:"The privacy setting for this profile is private"},ip={...gr,languageSwitcher_label:"Me gustaría leer este artículo en...",languageSwitcher_translation_original:"idioma original",languageSwitcher_translation_human:"traducido por un humano",languageSwitcher_translation_machine:"traducido por máquina",languageSwitcher_disclaimer:"Este contenido fue traducido automáticamente y ocasionalmente tendrá errores de género u otras traducciones directas. Estamos intentando resolver este problema, pero mientras tanto, si notas algún error grave, escríbenos a <link>{email}</link>"},ap={...gr,languageSwitcher_label:"Je voudrais lire cet article dans...",languageSwitcher_translation_original:"langue originale",languageSwitcher_translation_human:"traduit par un humain",languageSwitcher_translation_machine:"traduit par machine",languageSwitcher_disclaimer:"Ce contenu est traduit automatiquement et contiendra d’évantuelles erreurs de genre ou d’autres traductions directes. Nous essayons de résoudre ce problème, mais en attendant, si vous remarquez une erreur importante, faites-le nous savoir à <link>{email}</link>",collapsibleSection_summary:"En savoir plus"},sp={...gr,languageSwitcher_label:"Eu gostaria de ler este artigo em...",languageSwitcher_translation_original:"linguagem original",languageSwitcher_translation_human:"traduzido por um humano",languageSwitcher_translation_machine:"traduzido por máquina",languageSwitcher_disclaimer:"Este conteúdo foi traduzido automaticamente e, ocasionalmente, poderão ocorrer erros de linguagem de gênero ou outras traduções diretas. Estamos tentando resolver isso, porém se perceber algo errado por favor nos avise em <link>{email}</link>"},op=Object.freeze(Object.defineProperty({__proto__:null,en:gr,es:ip,fr:ap,pt:sp},Symbol.toStringTag,{value:"Module"})),ma=(e,t=gr)=>e in t,Rt=(e,t,n,r,i={})=>{let a="";return ma(`${t}_${n}`)?a=e({id:`${t}_${n}`},i):a=e({id:t},{[r]:n,...i}),a},up=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let i=n.length-1;i>=0;i--){const a=Math.pow(10,(i+1)*3);if(a<=e){e=Math.round(e*t/a)/t,e===1e3&&i<n.length-1&&(e=1,i++),r=`${e}${n[i]}`;break}}return r},Oi=(e,t)=>x.Children.map(e,n=>Object.is(n,null)?n:x.cloneElement(n,{...t})),jd=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},lp=e=>{var a,s;const n=["name","organization","jobTitle","biography"].every(o=>{const u=e[o];return u!=null&&u!==""}),r=((a=e.image)==null?void 0:a.thumbnail)!==void 0,i=((s=e.location)==null?void 0:s.en)!==void 0;return n&&r&&i},cp=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,Vr).replace(/{{id}}/g,Vr):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Pd=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var a;if(!n)return e;const i=e.match(Hr);if(!i)return e;for(const s of i){const o=s.replace(Hr,(d,h)=>h),u=n[o];if(!u)continue;const l={};if(typeof u=="object")l.name=u.error?u.error:((a=u==null?void 0:u.data)==null?void 0:a.name)||"",l.id=u.id||"",l.error=u.error;else{const d=u;if(d.startsWith(Os))try{const h=d.replace(Os,"");l.id=h,await r({id:h}).then(m=>{const{name:p,error:g}=m;l.name=g||p||"",l.error=g})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,l.name?cp(e,l,t):s)}return e},bo=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Od=e=>new URLSearchParams(window.location.search).get(e),Kr=(e="")=>e.replace(/\s+/g,"").length>0,Ns=e=>{const t=e.length>8,n=/[0-9]/.test(e)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(e),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(e);return{isValid:t&&n&&r,matchingRules:{isMoreThanEightCharacters:t,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}};const we=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:i=!1,element:a="button",onClick:s=!1,className:o="",disabled:u=!1,tooltip:l="",forceTooltip:d=!1,screenreaderText:h=!1,children:m=!1,...p})=>{const f=wn(typeof t=="object"),{showTooltip:b,tooltipProps:v}=go(!!l);if(typeof t=="object"&&typeof f=="number"){const D=Object.assign({},t),_=Ed(Object.keys(D));t=_d(f,_,D)}!u&&l&&!d&&(l="");const y=[];typeof t=="string"&&y.push(t),r&&(y.push("icon"),typeof r=="object"?(y.push(r.icon),r.position?y.push(r.position):y.push("left"),r.hover&&y.push(`hover_${r.hover}`),r.animate&&(y.push("animate"),typeof r.animate=="string"&&y.push(r.animate))):(y.push(r),!r.includes("right")&&!r.includes("left")&&y.push("left")));const C={...p,className:K(e,o,y,{"no-text":!m,disabled:u,button:i,muted:n.muted,"full-width":n.fullWidth}),onClick:D=>{(!i||i[0]==="#")&&s&&(D.preventDefault(),D.stopPropagation()),s&&s(D)},disabled:typeof u=="object"&&"isClickable"in u?!u.isClickable:u};i&&(a="a",C.href=i);const k=x.createElement(a,C,m||(h?c.jsx(Oe,{showOnFocus:!1,children:h}):null));return d||u&&l?c.jsxs("span",{className:"button-container",...v,children:[c.jsx(Ln,{isOpen:b,accessibility:{readToScreenreadersWhenClosed:!0},children:l}),k]}):k},vr=({buttons:e,wrappers:t=[],className:n="",...r})=>{const i=e.length>1?"ul":"p",a=e.map((s,o)=>{var u;return i==="p"?c.jsx(we,{...s},o):c.jsx("li",{className:((u=t[o])==null?void 0:u.className)||"",children:c.jsx(we,{...s})},o)});return x.createElement(i,{className:K("button-wrapper",n),...r,children:a})};const zt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:K(e,{"has-max-width":t}),style:n})},Bu={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},highlightSection:{range:[{height:200,width:674},{height:400,width:1348},{height:1e3,width:1e3},{height:2e3,width:2e3}],sizes:"(max-width: 500px) 674px, (max-width: 1024px) 1348px, (max-width: 1200px) 1000px, 2000px"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"}},dp=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:i}=e?Bu[e]:Bu.fallback;return{range:t&&t.length>0?t:r,sizes:n||i}},fp=({format:e,height:t,query:n,width:r})=>{let i=`w=${r}&h=${t}`;return i=e?`${i}&fm=${e}`:i,i=n?`${i}&${n}`:i,i},Pa=({format:e,range:t,url:n,query:r})=>t.map(({height:i,width:a})=>`${n}?${fp({format:e,height:i,query:r,width:a})} ${a}w`).join(", ");const Cn=({image:e,className:t,testId:n})=>{const{description:r,height:i,type:a,color:s,query:o,url:u,width:l,loading:d,decoding:h,fetchPriority:m}=e,{range:p,sizes:g}=dp(e),f=Pa({format:"avif",query:o,range:p,url:u}),b=Pa({format:"webp",query:o,range:p,url:u}),v=Pa({format:"",query:o,range:p,url:u});let y={};return s&&(y={"--color":s}),a&&a.includes("svg")?c.jsx("picture",{className:t,style:y,children:c.jsx("img",{src:u,alt:r,loading:d||"lazy",decoding:h||"async",fetchpriority:m||"auto",width:l,height:i,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,style:y,children:[a!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:f,sizes:g,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:b,sizes:g,"data-testid":"source"}),c.jsx("img",{srcSet:v,sizes:g,src:u,alt:r,loading:d||"lazy",decoding:h||"async",fetchpriority:m||"auto",width:l,height:i,"data-testid":n||"image"})]})};const mp=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(Cn,{image:{...e},className:"image"})}),Dn=({href:e,children:t,fallbackElement:n,meta:r,className:i="",onClick:a,gtmContext:s,gtmType:o,...u})=>{const{forceOnClick:l=!1}=r||{};if(e){const h={...u};return a&&(h.onClick=a),s&&(h["data-gtm-event-context"]=s),o&&(h["data-gtm-event-type"]=o),c.jsx("a",{href:e,className:K("gtm-trackable",i),...h,children:t})}const d={};return l&&(d.onClick=a),n?x.createElement(n,{children:t,className:i,...u,...d}):c.jsx(c.Fragment,{children:t})};const Md=x.forwardRef(({className:e="",children:t},n)=>{const r=x.useRef(null),i=n||r;return c.jsx("aside",{ref:i,className:K("popover",e),"aria-live":"polite",children:t})}),br=({parent:e=document.body,children:t})=>typeof document=="object"?gd.createPortal(t,e):null,hp=Object.freeze(Object.defineProperty({__proto__:null,default:br},Symbol.toStringTag,{value:"Module"}));const pp=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Oe,{children:c.jsx(ie.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),c.jsx("div",{className:"progress-tracker",children:c.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const i=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:K("dot",{active:i===e,completed:i<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:K("line",{active:i<e})})]},r)})})})]});const gp=({elementId:e,offset:t=20})=>{const n=ie.useIntl(),r=()=>{const i=document.getElementById(e);if(!i)return;const a=document.getElementById("header");a&&window.scrollTo({top:i.offsetTop-a.clientHeight-t})};return c.jsx(we,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const vp=({items:e,className:t="",...n})=>c.jsx("ul",{className:K("buckets",t),...n,children:e.map(({title:r,text:i,link:a,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:a,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:i})]})},o))}),Su=300,ju="ease-in-out";class bp{constructor(t){this.el=t,this.summary=t.querySelector("summary"),this.content=t.querySelector(".content"),this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.summary.addEventListener("click",n=>this.onClick(n))}cleanUp(){this.summary.removeEventListener("click",t=>this.onClick(t))}onClick(t){t.preventDefault(),t.stopPropagation(),this.el.style.overflow="hidden",this.isClosing||!this.el.open?this.open():(this.isExpanding||this.el.open)&&this.shrink()}shrink(){this.isClosing=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:Su,easing:ju}),this.animation.onfinish=()=>this.onAnimationFinish(!1),this.animation.oncancel=()=>this.isClosing=!1}open(){this.el.style.height=`${this.el.offsetHeight}px`,this.el.open=!0,window.requestAnimationFrame(()=>this.expand())}expand(){this.isExpanding=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight+this.content.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:Su,easing:ju}),this.animation.onfinish=()=>this.onAnimationFinish(!0),this.animation.oncancel=()=>this.isExpanding=!1}onAnimationFinish(t){this.el.open=t,this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.el.style.height=this.el.style.overflow=""}}const ha=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const i=ie.useIntl(),a=x.useRef(null);return x.useEffect(()=>{let s;return r&&(s=new bp(a.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:a,className:K("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||i.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},Pu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},yp=e=>{let t=e;return Object.keys(Pu).includes(e)&&(t=Pu[e]),`url(${Gt}icons/${t}.svg)`};const Ou={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Nd=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const i=ie.useIntl(),a=t?{"--custom-icon":yp(t)}:{},s=ma(`contentTypeLabel_${e}`)?i.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:K("content-type-label text-small",e in Ou?Ou[e]:e,r,{"has-custom-icon":t}),style:a,"data-testid":"content-type-label",children:n||s})};const _t=({variant:e="primary",icon:t,styling:n={},className:r="",children:i,...a})=>{const{showHighlight:s=!1,background:o="default"}=n,u=t?{"--icon":`url(${Gt}icons/${t}.svg)`}:{};return c.jsx("div",{className:K("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:u,...a,children:i})};const Qt=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let i=n&&!!Object.keys(n).length;const a=typeof n=="object"&&"breakpoints"in n,s=wn(a);if(a&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),m=Ed(Object.keys(h));i=_d(s,m,h)}const{breakpoints:o,text:u="",component:l,...d}=n;return c.jsx(_t,{variant:"subtle",className:K("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(Zt,{options:{forceBlock:!0},children:t}):t,i&&typeof n=="object"&&(l||c.jsx(we,{...d,variant:n.variant?n.variant:"secondary",children:u}))]})})};const Is=({children:e,...t})=>c.jsx("p",{...t,children:e}),Id={q:Is,blockquote:Is};for(let e=1;e<=6;e++)Id[`h${e}`]={component:Is,props:{className:"title"}};const Rd=({type:e="default",className:t="",heading:n=!1,children:r,...i})=>c.jsxs("div",{...i,className:K("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(Zt,{options:{wrapper:x.Fragment,forceBlock:!0,overrides:Id},children:r}):c.jsx("p",{children:r})]});const $d=({id:e,className:t="",show:n=!1,hide:r=!1,text:i,markdownOptions:a,fadeStyle:s="default",children:o})=>{const u=ie.useIntl(),l=x.useRef(null);e||(e=Date.now().toString());const[d,h]=x.useState(""),[m,p]=x.useState("closed");x.useEffect(()=>{const b=l.current;if(b)return b.addEventListener("transitionend",g),()=>{b.removeEventListener("transitionend",g)}},[]),x.useEffect(()=>{if(!i||typeof i!="string")return;const b=i.split(`
36
+ `);h(b.length<3?`${i.substring(0,400)}...`:b.slice(0,3).join(`
37
+ `))},[i]),x.useEffect(()=>{m==="ready-to-close"&&p("closing")},[m]);const g=({propertyName:b})=>{b==="max-height"&&p(v=>v==="opening"?"open":v==="closing"?"closed":v)},f=["opening","open"].includes(m);return c.jsxs(_t,{variant:"subtle",className:K("hide-show-text-box",t),children:[c.jsx("div",{ref:l,id:e,className:K("content",m,s),children:i?c.jsxs(c.Fragment,{children:[c.jsx(Zt,{options:{forceBlock:!0,...a},children:m==="closed"?d:i}),m!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(we,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:K({"rotate-180":f}),onClick:()=>{p(f?"ready-to-close":"opening")},"aria-expanded":f,"aria-controls":e,children:f?r||u.formatMessage({id:"hideShowTextBox_hide"}):n||u.formatMessage({id:"hideShowTextBox_show"})})})]})};const xp=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:i={},className:a=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=i;return x.createElement(e,{className:K("icon-bulleted-list text-medium",n,a,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((u,l)=>{const d={wrapper:x.Fragment,forceInline:!0},h={"--icon":`url(${Gt}icons/${u.icon}.svg)`};return e==="dl"?c.jsxs(x.Fragment,{children:[c.jsx("dt",{style:h,children:c.jsx(Zt,{options:d,children:u.dt||""})},`dt-${l}`),c.jsx("dd",{children:typeof u.text=="string"?c.jsx(Zt,{options:d,children:u.text}):u.text},`dd-${l}`)]},`dl-${l}`):c.jsx("li",{style:h,children:typeof u.text=="string"?c.jsx(Zt,{options:d,children:u.text}):u.text},l)})})},st=()=>x.Fragment,wp=({children:e})=>c.jsx(_t,{variant:"secondary",children:e}),Cp=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),Dp=["span","strong","h1","h2","h3","h4","h5","h6","p"],Ep=({children:e})=>{const t=ie.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const a of x.Children.toArray(e))if(!(!a||typeof a=="string"||typeof a=="number"))if(x.isValidElement(a)&&a.type==="summary"){if(a.props&&a.props.children){for(const s of x.Children.toArray(a.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&x.isValidElement(s)){const o=s.type;if(Dp.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(a);const i=n?n.toString():"";return c.jsx(ha,{label:i,className:["Sources","Resources"].includes(i)?"discrete-links":"",children:r.map(a=>a)})},_p=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(_t,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(_t,{variant:"primary",children:e});case"pink-textbox":return c.jsx(_t,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{children:e}):e;default:return c.jsx("div",{...t,children:e})}return c.jsx("div",{...t,children:e})},St=({children:e})=>c.jsx(c.Fragment,{children:e}),yo=x.createContext({badges:[],isLoading:!0});function Ld(){return x.useContext(yo)}const zd=({children:e,badges:t})=>c.jsx(yo.Provider,{value:t,children:e}),qd=({showDevTools:e=!0,children:t})=>{const n=new Re.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(Re.QueryClientProvider,{client:n,children:[t,e&&c.jsx($h.ReactQueryDevtools,{initialIsOpen:!1})]})};var kp=x.createContext({client:Pi});function Fp(e){var t=e.children,n=e.client,r=e.apiKey,i=e.options,a=x.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&i&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(Pi.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Pi.init(r,i)),Pi)},[n,r]);return x.createElement(kp.Provider,{value:{client:a}},t)}const Ud=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(Fp,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):c.jsx(c.Fragment,{children:e});var Wd=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(Wd||{});const Vd=({children:e,locale:t,messages:n})=>{const r=t||"en",i={...op[r],...n||{}};return c.jsx(ie.IntlProvider,{locale:r,messages:i,children:e})},xo=x.createContext({}),Mi={en:"English",es:"Español",fr:"Français",pt:"Português"},rt=x.createContext({isLoading:!0});function pa(){return x.useContext(rt)}const Hd=({children:e,user:t,updateDetails:n})=>c.jsx(rt.Provider,{value:{...t,updateDetails:n},children:e}),wo=x.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Kd=()=>x.useContext(wo),Zd=({children:e})=>{const[t,n]=x.useState([]);x.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=x.useCallback(a=>{n(s=>[...s,a])},[]),i=x.useCallback(a=>{n(s=>s.filter(o=>o!==a))},[]);return c.jsx(wo.Provider,{value:{registerOverlay:r,unregisterOverlay:i},children:e})},Ap=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[i,a]=x.useState({isLoading:!0}),[s,o]=x.useState({badges:[],isLoading:!0}),u=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[l,d]=x.useState(u),h=m=>{localStorage.setItem("language",m),d(m)};return x.useEffect(()=>{e().then(m=>{Array.isArray(m)?(a({...m[0],isLoading:!1}),o({badges:m[1],isLoading:!1})):a({...m,isLoading:!1}),jd(5e3)}).catch(m=>{m.message===Td&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),a({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(xo.Provider,{value:{language:l,updateLanguage:h},children:c.jsx(Vd,{locale:l,messages:n==null?void 0:n.messages,children:c.jsx(ho.CookiesProvider,{children:c.jsx(Hd,{user:i,updateDetails:a,children:c.jsx(zd,{badges:s,children:c.jsx(Zd,{children:c.jsx(qd,{showDevTools:r,children:c.jsx(Ud,{user:i,children:t})})})})})})})})},Tp=e=>{const t=ie.useIntl(),n=Date.now().toString(),r=x.useContext(rt);let i="default",a=e.src;a.includes("youtube")||a.includes("vimeo")?i="video":a.includes("riddle")||a.includes("sli.do")?i="poll":a.includes("padlet")?i="padlet":a.includes("surveysparrow")&&(i="survey",r!=null&&r.id&&(a=`${a}&user_id=${r.id}`));const s=`content-after-iframe-${n}`;return c.jsxs(c.Fragment,{children:[c.jsx(Oe,{element:"a",href:`#${s}`,onClick:o=>{o.preventDefault(),o.stopPropagation();const u=document.getElementById(s);u==null||u.scrollIntoView({behavior:"smooth"}),u==null||u.focus()},children:t.formatMessage({id:`markdown_skip${i==="default"?"":`_${i}`}`})}),c.jsx("iframe",{...e,src:a,title:t.formatMessage({id:`markdown_iframe${i==="default"?"":`_${i}`}`})}),c.jsx("span",{id:s,tabIndex:0})]})},Mu=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Bp=({children:e,...t})=>{const n=ie.useIntl();let r={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(r.target="_blank");let i=e,a=!1;for(const o of x.Children.toArray(e))if(!(!o||typeof o=="string"||typeof o=="number")&&x.isValidElement(o)){const u=o.type;if(["button","center","span","strong"].includes(u)&&o.props&&o.props.children&&o.props.children[0])for((u==="button"||Mu(o.props.children[0])==="button")&&(a=!0),i=o.props.children[0];i&&typeof i!="string"&&!(typeof i=="boolean"||typeof i=="number"||!x.isValidElement(i));)if(i.props&&i.props.children&&i.props.children[0])i=i.props.children[0],i&&Mu(i)==="button"&&(a=!0);else break}const s=`@${Vr}`;return i===s||Array.isArray(i)&&i[0]===s?(delete r.href,delete r.target,c.jsxs("span",{...r,className:"mention deleted-user",children:["@",n.formatMessage({id:"member_deleted"})]})):a?(r={...r,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(we,{variant:"primary",size:"medium",...r,children:i})})):c.jsx("a",{...r,children:i})},Rs=({children:e,...t})=>c.jsx("span",{className:K({url:t==null?void 0:t.href}),children:e});const Sp={default:{a:Bp,CollapsibleSection:ha,TextBox:_t,CaseStudy:wp,style:st,details:Ep,div:_p,iframe:Tp,center:Cp,script:st},"text-only":{h1:st,h2:st,h3:st,h4:st,h5:st,h6:st,style:st,details:st,div:st,TextBox:st,CollapsibleSection:st,CaseStudy:st,blockquote:st,iframe:st,button:st}},On=({element:e="div",className:t="",options:n={},children:r,overrideType:i="default",styling:a={}})=>{if(!r)return null;const{highlightTitles:s=!1}=a;r=r.replace(/^<br\/?>/,"");const o={wrapper:x.Fragment,forceBlock:!0};let u=Sp[i];return n.overrides&&(u={...u,...n.overrides}),x.createElement(e,{className:K("markdown-text",t,{"highlight-titles":s}),children:c.jsx(Zt,{options:{...o,...n,overrides:u},children:r})})};const Yd=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:i="",ctaButton:a})=>{const s=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:K("page-heading",i),children:[c.jsxs("div",{className:K("content",{"has-max-width":e}),style:s,children:[c.jsxs("div",{className:K("content-wrapper",{"has-max-width":e}),children:[t&&t.text&&x.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&x.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),a&&c.jsx(we,{...a,className:K("cta-button","gtm-trackable"),"data-gtm-event-context":"CreateNewArticle","data-gtm-event-type":"create-article-click",children:a.text})]}),r]})};const Yt=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:i="",children:a,element:s="span",...o})=>{const u={"--icon":`url(${Gt}icons/${r}.svg)`},{showTooltip:l,tooltipProps:d}=go(!!i),h={},m=i?typeof i=="string"?`tooltip-${window.btoa(i)}`:i.id:void 0,p=i?typeof i=="string"?i:i.text:void 0;i&&m&&(h["aria-describedby"]=m);const g=x.createElement(i?"button":s,{className:K("pill",e,t,n,{"has-icon":r}),style:u,children:a,...d,...h,...o});return i?x.createElement(s,{className:"pill-wrapper"},c.jsxs(c.Fragment,{children:[g,c.jsx(Ln,{id:m,isOpen:l,children:p})]})):g};const ur=({element:e="p",children:t=null,className:n="",...r})=>x.createElement(e,{...r,className:K("status-banner text-small",n),"aria-live":"assertive"},t),jp={globe:"globe",heart:"heart_empty_thick",pencil:"pencil",star:"star_empty","speech-bubble":"speech-bubble_round"};const Gd=({slug:e})=>{const{badges:t}=Ld(),n=t==null?void 0:t.find(o=>o.slug===e);if(!n)return null;const{name:r,icon:i,colour:a,description:s}=n;return c.jsx(Yt,{className:K("user-badge",a==null?void 0:a.toLowerCase()),icon:i&&jp[i],element:"li",tooltip:s,children:r})};var ut=(e=>(e.Communities="communities",e.Platform="platform",e))(ut||{});const Qd=({element:e="ul",userBadges:t,badgeOptions:n})=>{if(Object.keys(t).length!==0)return x.createElement(e,{className:"badges-list",children:(n==null?void 0:n.scopes)&&(n==null?void 0:n.scopes.map(r=>{var i,a;return(a=(i=t==null?void 0:t[r.scope])==null?void 0:i[r.area])==null?void 0:a.map((s,o)=>c.jsx(Gd,{slug:s},o))}))})};var Co=(e=>(e.Accepted="accepted",e.Cancelled="cancelled",e.Declined="declined",e.Pending="pending",e.Removed="removed",e))(Co||{}),Do=(e=>(e.In="in",e.Out="out",e))(Do||{});const{In:Pp,Out:Nu}=Do,{Pending:Oa,Accepted:Iu,Cancelled:Op,Removed:Mp}=Co,Jd=({functions:e,connection:t={status:null,direction:null},disableConnect:n=!1,meta:{topLevelButton:r=!1}={},...i})=>{const{formatMessage:a}=ie.useIntl(),{status:s,direction:o}=t,{onAccept:u,onCancel:l,onRemove:d,onRequest:h}=e,[m,p]=x.useState(!1),[g,f]=x.useState(s),[b,v]=x.useState(o);x.useEffect(()=>{f(s),v(o)},[s,o]);const y=async(C,k)=>{try{p(!0),await C()&&(k!=null&&k.status&&f(k.status),k!=null&&k.direction&&v(k.direction))}finally{p(!1)}};return g===Oa&&b===Nu?c.jsx(we,{onClick:async()=>{await y(u,{status:Iu})},disabled:m,variant:r?"primary":"secondary",size:"small",icon:{icon:"user-plus"},...i,children:a({id:"member_connection_accept"})}):g===Oa&&b===Pp?c.jsxs("div",{className:"connection-cta-wrapper",children:[c.jsx("span",{className:"button secondary connection-cta pending small icon clock left",...i,children:a({id:"member_connection_pending"})}),l&&c.jsx(Xi,{options:[{onClick:async()=>{await y(l,{status:Op})},text:a({id:"member_connection_cancel"})}]})]}):g===Iu?c.jsxs("div",{className:"connection-cta-wrapper",children:[c.jsx("span",{className:"button secondary connection-cta connected small icon tick left",...i,children:a({id:"member_connection_connected"})}),d&&c.jsx(Xi,{options:[{onClick:async()=>{await y(d,{status:Mp})},text:a({id:"member_connection_remove"})}]})]}):!g&&h&&!n?c.jsx(we,{onClick:async()=>{await y(h,{status:Oa,direction:Nu})},variant:r?"primary":"secondary",size:"small",disabled:m,icon:{icon:"user-plus"},...i,children:a({id:"member_connection_connect"})}):c.jsx(c.Fragment,{})};const Np=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const i=ie.useIntl(),{showText:a=!1,layout:s="bar",size:o="default",color:u="default"}=e,l=t>75?100:t>50?75:t>25?50:t>5?25:0,d={"--progress":`${t}%`};return c.jsx("span",{className:K(`progress-bar section-${l}`,s,r,{[o]:o!=="default",[u!=="default"?u:""]:u!=="default"}),style:d,children:x.createElement(a?"span":Oe,{className:a?"text":"",children:n||i.formatMessage({id:"progressBar"},{number:t})})})},Eo=x.memo(Np);const Ma="loadingBlock_",Ip=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ie.useIntl();t||(t={0:{text:r.formatMessage({id:`${Ma}loading`})},75:{text:r.formatMessage({id:`${Ma}almostDone`})},100:{text:r.formatMessage({id:`${Ma}complete`})}});let i=null;const a=Object.keys(t);for(let o=0;o<a.length&&!(e<parseInt(a[o]));o++)i=a[o];const s=i&&t[i].icon?{"--icon":`url(${Gt}icons/${t[i].icon}.svg)`}:{};return c.jsxs(_t,{className:K("loading-block",n,{"has-icon":i&&t[i].icon}),variant:"subtle",style:s,children:[i&&c.jsx("span",{className:"step",children:t[i].text}),c.jsx(Eo,{progress:e})]})},Xd=x.memo(Ip);const Nt=({element:e="div",className:t="",...n})=>c.jsx(fa,{element:e,className:K("loading-placeholder",t),...n});const $s={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],member:["profile-picture","text","text"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},ef=(e,t)=>e in $s?c.jsx("div",{className:e,children:$s[e].map((n,r)=>ef(n,r))},t):c.jsx(Nt,{className:e},t),ga=({layout:e="overview-page",...t})=>c.jsx("div",{className:K("loading-state",e),...t,children:$s[e].map((n,r)=>ef(n,r))}),tf=e=>{const t=e&&e.toUpperCase().trim().split(" ");return Array.isArray(t)&&t.length>1&&t[0]!==""?t[1]===""?t[0][0]:t[0][0]+t[t.length-1][0]:e?e.substr(0,1):""},di=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Rp=e=>{const t=Math.ceil(26/di.length),n=tf(e).toLowerCase();if(n==="")return di[0];const r=n.charCodeAt(0)-96;for(let i=0;i<di.length;i++)if(r<=t*(i+1))return di[i]};const Ru=256,un=({className:e="",src:t="",name:n,alt:r,width:i=Ru,height:a=Ru,showInitials:s=!0,...o})=>{const[u,l]=x.useState(!1),d=x.useRef(null),h=r??n;x.useEffect(()=>{const p=d.current;if(!p)return;const g=p.getContext("2d");if(!g)return;const f=i,b=a;typeof window<"u"&&window.devicePixelRatio&&(p.width=f*window.devicePixelRatio,p.height=b*window.devicePixelRatio,g.scale(window.devicePixelRatio,window.devicePixelRatio)),g.fillStyle=Rp(n),g.fillRect(0,0,f,b),g.font=`${f/3}px Arial`,g.textAlign="center",g.fillStyle="white",g.fillText(tf(n),f/2,b/1.6)},[n]);let m=!1;return t&&t!==""&&!u&&(t.includes("http")||t.includes("//"))&&(m=!0),c.jsx("figure",{className:K("profile-picture",e,{error:u}),...o,children:m?c.jsx("img",{src:t,alt:h,onError:()=>{l(!0)},width:i,height:a}):s?c.jsx("canvas",{ref:d}):c.jsx("span",{className:"fallback"})})};var it=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(it||{});const va=e=>e==="apolitical"?{image:`${Gt}logos/member_apolitical.svg`}:e==="community"||e==="deleted"||typeof e=="object"&&!e.name?{image:`${Gt}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.en||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail,badges:e.badges},$p=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const i=e!=="",a=t!=="",s=n!=="";if(!i&&!a&&!s)return"";const o=`${e}${i&&a?` — ${t}`:t}`;let u=`${o}${(i||a)&&s?`, ${n}`:n}`;return u.length>r&&(u=o),u.length>r&&(u=sr(u,r)),u};const Lp=x.lazy(()=>Promise.resolve().then(()=>hp)),zp=x.lazy(()=>Promise.resolve().then(()=>Ak));let fi=null;const an=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:i={},functions:a={},gtmContext:s="member",gtmType:o="member-click",className:u="",badges:l,connection:d,...h})=>{var H,V,ae,ne,E;const m=ie.useIntl(),{profile:p,connections:g,...f}=a,{size:b="medium",variant:v="inline",isCondensed:y=!0,additionalContentNewLine:C=!1}=i,k=x.useContext(rt),D=p&&k&&typeof k.id=="string",[_,B]=x.useState(!1),M=va(t);M.name||(M.name=m.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:P,image:z}=M;let{url:O}=M;typeof t=="object"&&t.link!==void 0&&(t.link===!1?O=void 0:O=t.link);const A=$p(M),F=r&&r.createdAt?Ms(r.createdAt):!1,S=r&&r.createdAt?vo(r.createdAt):"",I=!O&&D;return x.createElement(e,{...h,className:K("member text-medium",b,v,u,{"has-profile-link":D}),...f,children:c.jsxs(c.Fragment,{children:[c.jsxs(Dn,{href:O,className:K({"details-wrapper":I}),fallbackElement:I?"div":void 0,gtmType:o,gtmContext:s,meta:{forceOnClick:!0},onClick:Y=>{if(Y==null||Y.preventDefault(),Y==null||Y.stopPropagation(),!O){I&&B(!0);return}fi&&clearTimeout(fi),fi=setTimeout(()=>{window.location.href=O},150);const q=new CustomEvent(it.MEMBER_CLICKED,{detail:{link:O,timeout:fi}});document.dispatchEvent(q)},children:[c.jsx(un,{name:P,src:z,alt:n}),c.jsxs("div",{className:"details",children:[c.jsxs("div",{className:K("name",{"new-line":C}),"data-testid":"member-name",children:[c.jsx("span",{children:P}),(l==null?void 0:l.showBadges)&&(M==null?void 0:M.badges)&&c.jsx(Qd,{userBadges:M.badges,badgeOptions:l}),r&&c.jsxs("span",{className:K("additional-content",{"new-line":C}),children:[r.createdAt&&F&&!((H=r==null?void 0:r.customMessage)!=null&&H.text)&&c.jsx("span",{className:"date",title:S,"aria-label":S,"data-testid":"date",children:m.formatMessage({id:`dates_${F.path}`},{number:F.number})}),r.createdAt&&F&&((V=r==null?void 0:r.customMessage)==null?void 0:V.text)&&c.jsx("span",{children:m.formatMessage({id:(ae=r.customMessage)==null?void 0:ae.text},{time:m.formatMessage({id:`dates_${F.path}`},{number:F.number}),community:(E=(ne=r.customMessage)==null?void 0:ne.link)==null?void 0:E.text,link:Y=>{var q,T;return c.jsx("a",{href:`${(T=(q=r.customMessage)==null?void 0:q.link)==null?void 0:T.url}`,onClick:j=>j.stopPropagation(),children:Y})}})}),r.didEdit&&c.jsx("em",{children:m.formatMessage({id:"discussion_edited"})})]})]}),A&&!C&&c.jsx("small",{className:K({"text-medium":b==="large"}),"data-testid":"member-details",children:y?A:c.jsxs(c.Fragment,{children:[M.role,M.organisation?` — ${M.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:M.country})]})})]})]}),g&&c.jsx(Jd,{connection:d,functions:g}),A&&p&&D?c.jsxs(c.Fragment,{children:[c.jsx(we,{variant:"tertiary",size:"small",onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),B(!0)},"data-testid":"profile-button",children:m.formatMessage({id:"member_profile"})}),c.jsx(Lp,{children:c.jsx(zp,{form:p,showModal:_,content:{title:m.formatMessage({id:"member_profile"})},functions:{onClose:()=>{B(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},qp=Object.freeze(Object.defineProperty({__proto__:null,default:an},Symbol.toStringTag,{value:"Module"}));const $u={small:24,medium:48},_o=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:i,showGap:a,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:u,className:l="",...d})=>{const h=ie.useIntl();return!n||n.length===0?null:x.createElement(e,{...d,className:K("contributors",l,i,{"has-gap":a}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((m,p)=>{let g,f="";if(p<o){const{name:b="",image:v=""}=va(m);if(s)return c.jsx(Nt,{element:"li",className:"contributor"},p);g=c.jsx(un,{name:b,src:v,width:$u[i||"medium"],height:$u[i||"medium"]})}else if(p===o){const b=(t||n.length)-o;g=c.jsxs("small",{className:K({"large-number":b>99}),children:["+",up(b,0)]}),f="number-left"}return g?c.jsx("li",{className:K("contributor",f),children:g},p):null})}),r&&c.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?h.formatMessage({id:`member_${n[0]}`}):sr(n[0].name||"",20):u||null})]})})};const ko=({element:e="section",children:t,className:n,variant:r,additionalContent:i,...a})=>{let s=typeof t=="string"?c.jsx("p",{children:t}):t;return i&&(s=c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"modal-content",children:typeof t=="string"?c.jsx("p",{children:t}):t}),c.jsx("div",{className:"modal-additional-content",children:typeof i=="string"?c.jsx("p",{children:i}):i})]})),x.createElement(e,{className:K("modal",n,{"success-section":r==="success"}),children:s,...a})};var Ls={exports:{}},mi={exports:{}},$e={};/** @license React v16.13.1
38
38
  * react-is.production.min.js
39
39
  *
40
40
  * Copyright (c) Facebook, Inc. and its affiliates.
41
41
  *
42
42
  * This source code is licensed under the MIT license found in the
43
43
  * LICENSE file in the root directory of this source tree.
44
- */var Lu;function Up(){if(Lu)return $e;Lu=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,m=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function C(D){if(typeof D=="object"&&D!==null){var _=D.$$typeof;switch(_){case t:switch(D=D.type,D){case u:case l:case r:case a:case i:case m:return D;default:switch(D=D&&D.$$typeof,D){case o:case d:case g:case p:case s:return D;default:return _}}case n:return _}}}function k(D){return C(D)===l}return $e.AsyncMode=u,$e.ConcurrentMode=l,$e.ContextConsumer=o,$e.ContextProvider=s,$e.Element=t,$e.ForwardRef=d,$e.Fragment=r,$e.Lazy=g,$e.Memo=p,$e.Portal=n,$e.Profiler=a,$e.StrictMode=i,$e.Suspense=m,$e.isAsyncMode=function(D){return k(D)||C(D)===u},$e.isConcurrentMode=k,$e.isContextConsumer=function(D){return C(D)===o},$e.isContextProvider=function(D){return C(D)===s},$e.isElement=function(D){return typeof D=="object"&&D!==null&&D.$$typeof===t},$e.isForwardRef=function(D){return C(D)===d},$e.isFragment=function(D){return C(D)===r},$e.isLazy=function(D){return C(D)===g},$e.isMemo=function(D){return C(D)===p},$e.isPortal=function(D){return C(D)===n},$e.isProfiler=function(D){return C(D)===a},$e.isStrictMode=function(D){return C(D)===i},$e.isSuspense=function(D){return C(D)===m},$e.isValidElementType=function(D){return typeof D=="string"||typeof D=="function"||D===r||D===l||D===a||D===i||D===m||D===h||typeof D=="object"&&D!==null&&(D.$$typeof===g||D.$$typeof===p||D.$$typeof===s||D.$$typeof===o||D.$$typeof===d||D.$$typeof===b||D.$$typeof===v||D.$$typeof===y||D.$$typeof===f)},$e.typeOf=C,$e}var Le={};/** @license React v16.13.1
44
+ */var Lu;function Up(){if(Lu)return $e;Lu=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function C(D){if(typeof D=="object"&&D!==null){var _=D.$$typeof;switch(_){case t:switch(D=D.type,D){case u:case l:case r:case a:case i:case h:return D;default:switch(D=D&&D.$$typeof,D){case o:case d:case g:case p:case s:return D;default:return _}}case n:return _}}}function k(D){return C(D)===l}return $e.AsyncMode=u,$e.ConcurrentMode=l,$e.ContextConsumer=o,$e.ContextProvider=s,$e.Element=t,$e.ForwardRef=d,$e.Fragment=r,$e.Lazy=g,$e.Memo=p,$e.Portal=n,$e.Profiler=a,$e.StrictMode=i,$e.Suspense=h,$e.isAsyncMode=function(D){return k(D)||C(D)===u},$e.isConcurrentMode=k,$e.isContextConsumer=function(D){return C(D)===o},$e.isContextProvider=function(D){return C(D)===s},$e.isElement=function(D){return typeof D=="object"&&D!==null&&D.$$typeof===t},$e.isForwardRef=function(D){return C(D)===d},$e.isFragment=function(D){return C(D)===r},$e.isLazy=function(D){return C(D)===g},$e.isMemo=function(D){return C(D)===p},$e.isPortal=function(D){return C(D)===n},$e.isProfiler=function(D){return C(D)===a},$e.isStrictMode=function(D){return C(D)===i},$e.isSuspense=function(D){return C(D)===h},$e.isValidElementType=function(D){return typeof D=="string"||typeof D=="function"||D===r||D===l||D===a||D===i||D===h||D===m||typeof D=="object"&&D!==null&&(D.$$typeof===g||D.$$typeof===p||D.$$typeof===s||D.$$typeof===o||D.$$typeof===d||D.$$typeof===b||D.$$typeof===v||D.$$typeof===y||D.$$typeof===f)},$e.typeOf=C,$e}var Le={};/** @license React v16.13.1
45
45
  * react-is.development.js
46
46
  *
47
47
  * Copyright (c) Facebook, Inc. and its affiliates.
48
48
  *
49
49
  * This source code is licensed under the MIT license found in the
50
50
  * LICENSE file in the root directory of this source tree.
51
- */var zu;function Wp(){return zu||(zu=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,m=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function C(J){return typeof J=="string"||typeof J=="function"||J===r||J===l||J===a||J===i||J===m||J===h||typeof J=="object"&&J!==null&&(J.$$typeof===g||J.$$typeof===p||J.$$typeof===s||J.$$typeof===o||J.$$typeof===d||J.$$typeof===b||J.$$typeof===v||J.$$typeof===y||J.$$typeof===f)}function k(J){if(typeof J=="object"&&J!==null){var ve=J.$$typeof;switch(ve){case t:var me=J.type;switch(me){case u:case l:case r:case a:case i:case m:return me;default:var ye=me&&me.$$typeof;switch(ye){case o:case d:case g:case p:case s:return ye;default:return ve}}case n:return ve}}}var D=u,_=l,B=o,P=s,N=t,z=d,O=r,A=g,F=p,S=n,I=a,H=i,V=m,ae=!1;function ne(J){return ae||(ae=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),E(J)||k(J)===u}function E(J){return k(J)===l}function Y(J){return k(J)===o}function q(J){return k(J)===s}function T(J){return typeof J=="object"&&J!==null&&J.$$typeof===t}function j(J){return k(J)===d}function R(J){return k(J)===r}function M(J){return k(J)===g}function U(J){return k(J)===p}function X(J){return k(J)===n}function W(J){return k(J)===a}function te(J){return k(J)===i}function de(J){return k(J)===m}Le.AsyncMode=D,Le.ConcurrentMode=_,Le.ContextConsumer=B,Le.ContextProvider=P,Le.Element=N,Le.ForwardRef=z,Le.Fragment=O,Le.Lazy=A,Le.Memo=F,Le.Portal=S,Le.Profiler=I,Le.StrictMode=H,Le.Suspense=V,Le.isAsyncMode=ne,Le.isConcurrentMode=E,Le.isContextConsumer=Y,Le.isContextProvider=q,Le.isElement=T,Le.isForwardRef=j,Le.isFragment=R,Le.isLazy=M,Le.isMemo=U,Le.isPortal=X,Le.isProfiler=W,Le.isStrictMode=te,Le.isSuspense=de,Le.isValidElementType=C,Le.typeOf=k}()),Le}var qu;function nf(){return qu||(qu=1,process.env.NODE_ENV==="production"?mi.exports=Up():mi.exports=Wp()),mi.exports}/*
51
+ */var zu;function Wp(){return zu||(zu=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,l=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function C(J){return typeof J=="string"||typeof J=="function"||J===r||J===l||J===a||J===i||J===h||J===m||typeof J=="object"&&J!==null&&(J.$$typeof===g||J.$$typeof===p||J.$$typeof===s||J.$$typeof===o||J.$$typeof===d||J.$$typeof===b||J.$$typeof===v||J.$$typeof===y||J.$$typeof===f)}function k(J){if(typeof J=="object"&&J!==null){var ve=J.$$typeof;switch(ve){case t:var me=J.type;switch(me){case u:case l:case r:case a:case i:case h:return me;default:var ye=me&&me.$$typeof;switch(ye){case o:case d:case g:case p:case s:return ye;default:return ve}}case n:return ve}}}var D=u,_=l,B=o,M=s,P=t,z=d,O=r,A=g,F=p,S=n,I=a,H=i,V=h,ae=!1;function ne(J){return ae||(ae=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),E(J)||k(J)===u}function E(J){return k(J)===l}function Y(J){return k(J)===o}function q(J){return k(J)===s}function T(J){return typeof J=="object"&&J!==null&&J.$$typeof===t}function j(J){return k(J)===d}function R(J){return k(J)===r}function N(J){return k(J)===g}function U(J){return k(J)===p}function X(J){return k(J)===n}function W(J){return k(J)===a}function te(J){return k(J)===i}function de(J){return k(J)===h}Le.AsyncMode=D,Le.ConcurrentMode=_,Le.ContextConsumer=B,Le.ContextProvider=M,Le.Element=P,Le.ForwardRef=z,Le.Fragment=O,Le.Lazy=A,Le.Memo=F,Le.Portal=S,Le.Profiler=I,Le.StrictMode=H,Le.Suspense=V,Le.isAsyncMode=ne,Le.isConcurrentMode=E,Le.isContextConsumer=Y,Le.isContextProvider=q,Le.isElement=T,Le.isForwardRef=j,Le.isFragment=R,Le.isLazy=N,Le.isMemo=U,Le.isPortal=X,Le.isProfiler=W,Le.isStrictMode=te,Le.isSuspense=de,Le.isValidElementType=C,Le.typeOf=k}()),Le}var qu;function nf(){return qu||(qu=1,process.env.NODE_ENV==="production"?mi.exports=Up():mi.exports=Wp()),mi.exports}/*
52
52
  object-assign
53
53
  (c) Sindre Sorhus
54
54
  @license MIT
55
- */var Na,Uu;function Vp(){if(Uu)return Na;Uu=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(a){if(a==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(a)}function i(){try{if(!Object.assign)return!1;var a=new String("abc");if(a[5]="de",Object.getOwnPropertyNames(a)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var u=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(u.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(d){l[d]=d}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Na=i()?Object.assign:function(a,s){for(var o,u=r(a),l,d=1;d<arguments.length;d++){o=Object(arguments[d]);for(var m in o)t.call(o,m)&&(u[m]=o[m]);if(e){l=e(o);for(var h=0;h<l.length;h++)n.call(o,l[h])&&(u[l[h]]=o[l[h]])}}return u},Na}var Ia,Wu;function Fo(){if(Wu)return Ia;Wu=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ia=e,Ia}var Ra,Vu;function rf(){return Vu||(Vu=1,Ra=Function.call.bind(Object.prototype.hasOwnProperty)),Ra}var $a,Hu;function Hp(){if(Hu)return $a;Hu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Fo(),n={},r=rf();e=function(a){var s="Warning: "+a;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(a,s,o,u,l){if(process.env.NODE_ENV!=="production"){for(var d in a)if(r(a,d)){var m;try{if(typeof a[d]!="function"){var h=Error((u||"React class")+": "+o+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}m=a[d](s,d,u,o,null,t)}catch(g){m=g}if(m&&!(m instanceof Error)&&e((u||"React class")+": type specification of "+o+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof m+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),m instanceof Error&&!(m.message in n)){n[m.message]=!0;var p=l?l():"";e("Failed "+o+" type: "+m.message+(p??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},$a=i,$a}var La,Ku;function Kp(){if(Ku)return La;Ku=1;var e=nf(),t=Vp(),n=Fo(),r=rf(),i=Hp(),a=function(){};process.env.NODE_ENV!=="production"&&(a=function(o){var u="Warning: "+o;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}});function s(){return null}return La=function(o,u){var l=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function m(E){var Y=E&&(l&&E[l]||E[d]);if(typeof Y=="function")return Y}var h="<<anonymous>>",p={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:y(),arrayOf:C,element:k(),elementType:D(),instanceOf:_,node:z(),objectOf:P,oneOf:B,oneOfType:N,shape:A,exact:F};function g(E,Y){return E===Y?E!==0||1/E===1/Y:E!==E&&Y!==Y}function f(E,Y){this.message=E,this.data=Y&&typeof Y=="object"?Y:{},this.stack=""}f.prototype=Error.prototype;function b(E){if(process.env.NODE_ENV!=="production")var Y={},q=0;function T(R,M,U,X,W,te,de){if(X=X||h,te=te||U,de!==n){if(u){var J=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw J.name="Invariant Violation",J}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ve=X+":"+U;!Y[ve]&&q<3&&(a("You are manually calling a React.PropTypes validation function for the `"+te+"` prop on `"+X+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),Y[ve]=!0,q++)}}return M[U]==null?R?M[U]===null?new f("The "+W+" `"+te+"` is marked as required "+("in `"+X+"`, but its value is `null`.")):new f("The "+W+" `"+te+"` is marked as required in "+("`"+X+"`, but its value is `undefined`.")):null:E(M,U,X,W,te)}var j=T.bind(null,!1);return j.isRequired=T.bind(null,!0),j}function v(E){function Y(q,T,j,R,M,U){var X=q[T],W=H(X);if(W!==E){var te=V(X);return new f("Invalid "+R+" `"+M+"` of type "+("`"+te+"` supplied to `"+j+"`, expected ")+("`"+E+"`."),{expectedType:E})}return null}return b(Y)}function y(){return b(s)}function C(E){function Y(q,T,j,R,M){if(typeof E!="function")return new f("Property `"+M+"` of component `"+j+"` has invalid PropType notation inside arrayOf.");var U=q[T];if(!Array.isArray(U)){var X=H(U);return new f("Invalid "+R+" `"+M+"` of type "+("`"+X+"` supplied to `"+j+"`, expected an array."))}for(var W=0;W<U.length;W++){var te=E(U,W,j,R,M+"["+W+"]",n);if(te instanceof Error)return te}return null}return b(Y)}function k(){function E(Y,q,T,j,R){var M=Y[q];if(!o(M)){var U=H(M);return new f("Invalid "+j+" `"+R+"` of type "+("`"+U+"` supplied to `"+T+"`, expected a single ReactElement."))}return null}return b(E)}function D(){function E(Y,q,T,j,R){var M=Y[q];if(!e.isValidElementType(M)){var U=H(M);return new f("Invalid "+j+" `"+R+"` of type "+("`"+U+"` supplied to `"+T+"`, expected a single ReactElement type."))}return null}return b(E)}function _(E){function Y(q,T,j,R,M){if(!(q[T]instanceof E)){var U=E.name||h,X=ne(q[T]);return new f("Invalid "+R+" `"+M+"` of type "+("`"+X+"` supplied to `"+j+"`, expected ")+("instance of `"+U+"`."))}return null}return b(Y)}function B(E){if(!Array.isArray(E))return process.env.NODE_ENV!=="production"&&(arguments.length>1?a("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):a("Invalid argument supplied to oneOf, expected an array.")),s;function Y(q,T,j,R,M){for(var U=q[T],X=0;X<E.length;X++)if(g(U,E[X]))return null;var W=JSON.stringify(E,function(de,J){var ve=V(J);return ve==="symbol"?String(J):J});return new f("Invalid "+R+" `"+M+"` of value `"+String(U)+"` "+("supplied to `"+j+"`, expected one of "+W+"."))}return b(Y)}function P(E){function Y(q,T,j,R,M){if(typeof E!="function")return new f("Property `"+M+"` of component `"+j+"` has invalid PropType notation inside objectOf.");var U=q[T],X=H(U);if(X!=="object")return new f("Invalid "+R+" `"+M+"` of type "+("`"+X+"` supplied to `"+j+"`, expected an object."));for(var W in U)if(r(U,W)){var te=E(U,W,j,R,M+"."+W,n);if(te instanceof Error)return te}return null}return b(Y)}function N(E){if(!Array.isArray(E))return process.env.NODE_ENV!=="production"&&a("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var Y=0;Y<E.length;Y++){var q=E[Y];if(typeof q!="function")return a("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ae(q)+" at index "+Y+"."),s}function T(j,R,M,U,X){for(var W=[],te=0;te<E.length;te++){var de=E[te],J=de(j,R,M,U,X,n);if(J==null)return null;J.data&&r(J.data,"expectedType")&&W.push(J.data.expectedType)}var ve=W.length>0?", expected one of type ["+W.join(", ")+"]":"";return new f("Invalid "+U+" `"+X+"` supplied to "+("`"+M+"`"+ve+"."))}return b(T)}function z(){function E(Y,q,T,j,R){return S(Y[q])?null:new f("Invalid "+j+" `"+R+"` supplied to "+("`"+T+"`, expected a ReactNode."))}return b(E)}function O(E,Y,q,T,j){return new f((E||"React class")+": "+Y+" type `"+q+"."+T+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+j+"`.")}function A(E){function Y(q,T,j,R,M){var U=q[T],X=H(U);if(X!=="object")return new f("Invalid "+R+" `"+M+"` of type `"+X+"` "+("supplied to `"+j+"`, expected `object`."));for(var W in E){var te=E[W];if(typeof te!="function")return O(j,R,M,W,V(te));var de=te(U,W,j,R,M+"."+W,n);if(de)return de}return null}return b(Y)}function F(E){function Y(q,T,j,R,M){var U=q[T],X=H(U);if(X!=="object")return new f("Invalid "+R+" `"+M+"` of type `"+X+"` "+("supplied to `"+j+"`, expected `object`."));var W=t({},q[T],E);for(var te in W){var de=E[te];if(r(E,te)&&typeof de!="function")return O(j,R,M,te,V(de));if(!de)return new f("Invalid "+R+" `"+M+"` key `"+te+"` supplied to `"+j+"`.\nBad object: "+JSON.stringify(q[T],null," ")+`
56
- Valid keys: `+JSON.stringify(Object.keys(E),null," "));var J=de(U,te,j,R,M+"."+te,n);if(J)return J}return null}return b(Y)}function S(E){switch(typeof E){case"number":case"string":case"undefined":return!0;case"boolean":return!E;case"object":if(Array.isArray(E))return E.every(S);if(E===null||o(E))return!0;var Y=m(E);if(Y){var q=Y.call(E),T;if(Y!==E.entries){for(;!(T=q.next()).done;)if(!S(T.value))return!1}else for(;!(T=q.next()).done;){var j=T.value;if(j&&!S(j[1]))return!1}}else return!1;return!0;default:return!1}}function I(E,Y){return E==="symbol"?!0:Y?Y["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&Y instanceof Symbol:!1}function H(E){var Y=typeof E;return Array.isArray(E)?"array":E instanceof RegExp?"object":I(Y,E)?"symbol":Y}function V(E){if(typeof E>"u"||E===null)return""+E;var Y=H(E);if(Y==="object"){if(E instanceof Date)return"date";if(E instanceof RegExp)return"regexp"}return Y}function ae(E){var Y=V(E);switch(Y){case"array":case"object":return"an "+Y;case"boolean":case"date":case"regexp":return"a "+Y;default:return Y}}function ne(E){return!E.constructor||!E.constructor.name?h:E.constructor.name}return p.checkPropTypes=i,p.resetWarningCache=i.resetWarningCache,p.PropTypes=p,p},La}var za,Zu;function Zp(){if(Zu)return za;Zu=1;var e=Fo();function t(){}function n(){}return n.resetWarningCache=t,za=function(){function r(s,o,u,l,d,m){if(m!==e){var h=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw h.name="Invariant Violation",h}}r.isRequired=r;function i(){return r}var a={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return a.PropTypes=a,a},za}if(process.env.NODE_ENV!=="production"){var Yp=nf(),Gp=!0;Ls.exports=Kp()(Yp.isElement,Gp)}else Ls.exports=Zp()();var Qp=Ls.exports;/*!
55
+ */var Na,Uu;function Vp(){if(Uu)return Na;Uu=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(a){if(a==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(a)}function i(){try{if(!Object.assign)return!1;var a=new String("abc");if(a[5]="de",Object.getOwnPropertyNames(a)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var u=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(u.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(d){l[d]=d}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Na=i()?Object.assign:function(a,s){for(var o,u=r(a),l,d=1;d<arguments.length;d++){o=Object(arguments[d]);for(var h in o)t.call(o,h)&&(u[h]=o[h]);if(e){l=e(o);for(var m=0;m<l.length;m++)n.call(o,l[m])&&(u[l[m]]=o[l[m]])}}return u},Na}var Ia,Wu;function Fo(){if(Wu)return Ia;Wu=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ia=e,Ia}var Ra,Vu;function rf(){return Vu||(Vu=1,Ra=Function.call.bind(Object.prototype.hasOwnProperty)),Ra}var $a,Hu;function Hp(){if(Hu)return $a;Hu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Fo(),n={},r=rf();e=function(a){var s="Warning: "+a;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(a,s,o,u,l){if(process.env.NODE_ENV!=="production"){for(var d in a)if(r(a,d)){var h;try{if(typeof a[d]!="function"){var m=Error((u||"React class")+": "+o+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}h=a[d](s,d,u,o,null,t)}catch(g){h=g}if(h&&!(h instanceof Error)&&e((u||"React class")+": type specification of "+o+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof h+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),h instanceof Error&&!(h.message in n)){n[h.message]=!0;var p=l?l():"";e("Failed "+o+" type: "+h.message+(p??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},$a=i,$a}var La,Ku;function Kp(){if(Ku)return La;Ku=1;var e=nf(),t=Vp(),n=Fo(),r=rf(),i=Hp(),a=function(){};process.env.NODE_ENV!=="production"&&(a=function(o){var u="Warning: "+o;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}});function s(){return null}return La=function(o,u){var l=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function h(E){var Y=E&&(l&&E[l]||E[d]);if(typeof Y=="function")return Y}var m="<<anonymous>>",p={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:y(),arrayOf:C,element:k(),elementType:D(),instanceOf:_,node:z(),objectOf:M,oneOf:B,oneOfType:P,shape:A,exact:F};function g(E,Y){return E===Y?E!==0||1/E===1/Y:E!==E&&Y!==Y}function f(E,Y){this.message=E,this.data=Y&&typeof Y=="object"?Y:{},this.stack=""}f.prototype=Error.prototype;function b(E){if(process.env.NODE_ENV!=="production")var Y={},q=0;function T(R,N,U,X,W,te,de){if(X=X||m,te=te||U,de!==n){if(u){var J=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw J.name="Invariant Violation",J}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ve=X+":"+U;!Y[ve]&&q<3&&(a("You are manually calling a React.PropTypes validation function for the `"+te+"` prop on `"+X+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),Y[ve]=!0,q++)}}return N[U]==null?R?N[U]===null?new f("The "+W+" `"+te+"` is marked as required "+("in `"+X+"`, but its value is `null`.")):new f("The "+W+" `"+te+"` is marked as required in "+("`"+X+"`, but its value is `undefined`.")):null:E(N,U,X,W,te)}var j=T.bind(null,!1);return j.isRequired=T.bind(null,!0),j}function v(E){function Y(q,T,j,R,N,U){var X=q[T],W=H(X);if(W!==E){var te=V(X);return new f("Invalid "+R+" `"+N+"` of type "+("`"+te+"` supplied to `"+j+"`, expected ")+("`"+E+"`."),{expectedType:E})}return null}return b(Y)}function y(){return b(s)}function C(E){function Y(q,T,j,R,N){if(typeof E!="function")return new f("Property `"+N+"` of component `"+j+"` has invalid PropType notation inside arrayOf.");var U=q[T];if(!Array.isArray(U)){var X=H(U);return new f("Invalid "+R+" `"+N+"` of type "+("`"+X+"` supplied to `"+j+"`, expected an array."))}for(var W=0;W<U.length;W++){var te=E(U,W,j,R,N+"["+W+"]",n);if(te instanceof Error)return te}return null}return b(Y)}function k(){function E(Y,q,T,j,R){var N=Y[q];if(!o(N)){var U=H(N);return new f("Invalid "+j+" `"+R+"` of type "+("`"+U+"` supplied to `"+T+"`, expected a single ReactElement."))}return null}return b(E)}function D(){function E(Y,q,T,j,R){var N=Y[q];if(!e.isValidElementType(N)){var U=H(N);return new f("Invalid "+j+" `"+R+"` of type "+("`"+U+"` supplied to `"+T+"`, expected a single ReactElement type."))}return null}return b(E)}function _(E){function Y(q,T,j,R,N){if(!(q[T]instanceof E)){var U=E.name||m,X=ne(q[T]);return new f("Invalid "+R+" `"+N+"` of type "+("`"+X+"` supplied to `"+j+"`, expected ")+("instance of `"+U+"`."))}return null}return b(Y)}function B(E){if(!Array.isArray(E))return process.env.NODE_ENV!=="production"&&(arguments.length>1?a("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):a("Invalid argument supplied to oneOf, expected an array.")),s;function Y(q,T,j,R,N){for(var U=q[T],X=0;X<E.length;X++)if(g(U,E[X]))return null;var W=JSON.stringify(E,function(de,J){var ve=V(J);return ve==="symbol"?String(J):J});return new f("Invalid "+R+" `"+N+"` of value `"+String(U)+"` "+("supplied to `"+j+"`, expected one of "+W+"."))}return b(Y)}function M(E){function Y(q,T,j,R,N){if(typeof E!="function")return new f("Property `"+N+"` of component `"+j+"` has invalid PropType notation inside objectOf.");var U=q[T],X=H(U);if(X!=="object")return new f("Invalid "+R+" `"+N+"` of type "+("`"+X+"` supplied to `"+j+"`, expected an object."));for(var W in U)if(r(U,W)){var te=E(U,W,j,R,N+"."+W,n);if(te instanceof Error)return te}return null}return b(Y)}function P(E){if(!Array.isArray(E))return process.env.NODE_ENV!=="production"&&a("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var Y=0;Y<E.length;Y++){var q=E[Y];if(typeof q!="function")return a("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ae(q)+" at index "+Y+"."),s}function T(j,R,N,U,X){for(var W=[],te=0;te<E.length;te++){var de=E[te],J=de(j,R,N,U,X,n);if(J==null)return null;J.data&&r(J.data,"expectedType")&&W.push(J.data.expectedType)}var ve=W.length>0?", expected one of type ["+W.join(", ")+"]":"";return new f("Invalid "+U+" `"+X+"` supplied to "+("`"+N+"`"+ve+"."))}return b(T)}function z(){function E(Y,q,T,j,R){return S(Y[q])?null:new f("Invalid "+j+" `"+R+"` supplied to "+("`"+T+"`, expected a ReactNode."))}return b(E)}function O(E,Y,q,T,j){return new f((E||"React class")+": "+Y+" type `"+q+"."+T+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+j+"`.")}function A(E){function Y(q,T,j,R,N){var U=q[T],X=H(U);if(X!=="object")return new f("Invalid "+R+" `"+N+"` of type `"+X+"` "+("supplied to `"+j+"`, expected `object`."));for(var W in E){var te=E[W];if(typeof te!="function")return O(j,R,N,W,V(te));var de=te(U,W,j,R,N+"."+W,n);if(de)return de}return null}return b(Y)}function F(E){function Y(q,T,j,R,N){var U=q[T],X=H(U);if(X!=="object")return new f("Invalid "+R+" `"+N+"` of type `"+X+"` "+("supplied to `"+j+"`, expected `object`."));var W=t({},q[T],E);for(var te in W){var de=E[te];if(r(E,te)&&typeof de!="function")return O(j,R,N,te,V(de));if(!de)return new f("Invalid "+R+" `"+N+"` key `"+te+"` supplied to `"+j+"`.\nBad object: "+JSON.stringify(q[T],null," ")+`
56
+ Valid keys: `+JSON.stringify(Object.keys(E),null," "));var J=de(U,te,j,R,N+"."+te,n);if(J)return J}return null}return b(Y)}function S(E){switch(typeof E){case"number":case"string":case"undefined":return!0;case"boolean":return!E;case"object":if(Array.isArray(E))return E.every(S);if(E===null||o(E))return!0;var Y=h(E);if(Y){var q=Y.call(E),T;if(Y!==E.entries){for(;!(T=q.next()).done;)if(!S(T.value))return!1}else for(;!(T=q.next()).done;){var j=T.value;if(j&&!S(j[1]))return!1}}else return!1;return!0;default:return!1}}function I(E,Y){return E==="symbol"?!0:Y?Y["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&Y instanceof Symbol:!1}function H(E){var Y=typeof E;return Array.isArray(E)?"array":E instanceof RegExp?"object":I(Y,E)?"symbol":Y}function V(E){if(typeof E>"u"||E===null)return""+E;var Y=H(E);if(Y==="object"){if(E instanceof Date)return"date";if(E instanceof RegExp)return"regexp"}return Y}function ae(E){var Y=V(E);switch(Y){case"array":case"object":return"an "+Y;case"boolean":case"date":case"regexp":return"a "+Y;default:return Y}}function ne(E){return!E.constructor||!E.constructor.name?m:E.constructor.name}return p.checkPropTypes=i,p.resetWarningCache=i.resetWarningCache,p.PropTypes=p,p},La}var za,Zu;function Zp(){if(Zu)return za;Zu=1;var e=Fo();function t(){}function n(){}return n.resetWarningCache=t,za=function(){function r(s,o,u,l,d,h){if(h!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function i(){return r}var a={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return a.PropTypes=a,a},za}if(process.env.NODE_ENV!=="production"){var Yp=nf(),Gp=!0;Ls.exports=Kp()(Yp.isElement,Gp)}else Ls.exports=Zp()();var Qp=Ls.exports;/*!
57
57
  * tabbable 6.2.0
58
58
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
59
- */var af=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Hi=af.join(","),sf=typeof Element>"u",Mn=sf?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ki=!sf&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},Zi=function e(t,n){var r;n===void 0&&(n=!0);var i=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),a=i===""||i==="true",s=a||n&&t&&e(t.parentNode);return s},Jp=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},of=function(t,n,r){if(Zi(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(Hi));return n&&Mn.call(t,Hi)&&i.unshift(t),i=i.filter(r),i},uf=function e(t,n,r){for(var i=[],a=Array.from(t);a.length;){var s=a.shift();if(!Zi(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),u=o.length?o:s.children,l=e(u,!0,r);r.flatten?i.push.apply(i,l):i.push({scopeParent:s,candidates:l})}else{var d=Mn.call(s,Hi);d&&r.filter(s)&&(n||!t.includes(s))&&i.push(s);var m=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),h=!Zi(m,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(m&&h){var p=e(m===!0?s.children:m.children,!0,r);r.flatten?i.push.apply(i,p):i.push({scopeParent:s,candidates:p})}else a.unshift.apply(a,s.children)}}return i},lf=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},gn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Jp(t))&&!lf(t)?0:t.tabIndex},Xp=function(t,n){var r=gn(t);return r<0&&n&&!lf(t)?0:r},eg=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},cf=function(t){return t.tagName==="INPUT"},tg=function(t){return cf(t)&&t.type==="hidden"},ng=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},rg=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},ig=function(t){if(!t.name)return!0;var n=t.form||Ki(t),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(t.name));else try{i=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var a=rg(i,t.form);return!a||a===t},ag=function(t){return cf(t)&&t.type==="radio"},sg=function(t){return ag(t)&&!ig(t)},og=function(t){var n,r=t&&Ki(t),i=(n=r)===null||n===void 0?void 0:n.host,a=!1;if(r&&r!==t){var s,o,u;for(a=!!((s=i)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(i)||t!=null&&(u=t.ownerDocument)!==null&&u!==void 0&&u.contains(t));!a&&i;){var l,d,m;r=Ki(i),i=(l=r)===null||l===void 0?void 0:l.host,a=!!((d=i)!==null&&d!==void 0&&(m=d.ownerDocument)!==null&&m!==void 0&&m.contains(i))}}return a},Yu=function(t){var n=t.getBoundingClientRect(),r=n.width,i=n.height;return r===0&&i===0},ug=function(t,n){var r=n.displayCheck,i=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var a=Mn.call(t,"details>summary:first-of-type"),s=a?t.parentElement:t;if(Mn.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof i=="function"){for(var o=t;t;){var u=t.parentElement,l=Ki(t);if(u&&!u.shadowRoot&&i(u)===!0)return Yu(t);t.assignedSlot?t=t.assignedSlot:!u&&l!==t.ownerDocument?t=l.host:t=u}t=o}if(og(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Yu(t);return!1},lg=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var i=n.children.item(r);if(i.tagName==="LEGEND")return Mn.call(n,"fieldset[disabled] *")?!0:!i.contains(t)}return!0}n=n.parentElement}return!1},Yi=function(t,n){return!(n.disabled||Zi(n)||tg(n)||ug(n,t)||ng(n)||lg(n))},zs=function(t,n){return!(sg(n)||gn(n)<0||!Yi(t,n))},cg=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},dg=function e(t){var n=[],r=[];return t.forEach(function(i,a){var s=!!i.scopeParent,o=s?i.scopeParent:i,u=Xp(o,s),l=s?e(i.candidates):o;u===0?s?n.push.apply(n,l):n.push(o):r.push({documentOrder:a,tabIndex:u,item:i,isScope:s,content:l})}),r.sort(eg).reduce(function(i,a){return a.isScope?i.push.apply(i,a.content):i.push(a.content),i},[]).concat(n)},df=function(t,n){n=n||{};var r;return n.getShadowRoot?r=uf([t],n.includeContainer,{filter:zs.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:cg}):r=of(t,n.includeContainer,zs.bind(null,n)),dg(r)},ff=function(t,n){n=n||{};var r;return n.getShadowRoot?r=uf([t],n.includeContainer,{filter:Yi.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=of(t,n.includeContainer,Yi.bind(null,n)),r},Fn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Mn.call(t,Hi)===!1?!1:zs(n,t)},fg=af.concat("iframe").join(","),Ni=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Mn.call(t,fg)===!1?!1:Yi(n,t)};const mg=Object.freeze(Object.defineProperty({__proto__:null,focusable:ff,getTabIndex:gn,isFocusable:Ni,isTabbable:Fn,tabbable:df},Symbol.toStringTag,{value:"Module"}));/*!
59
+ */var af=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Hi=af.join(","),sf=typeof Element>"u",Mn=sf?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ki=!sf&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},Zi=function e(t,n){var r;n===void 0&&(n=!0);var i=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),a=i===""||i==="true",s=a||n&&t&&e(t.parentNode);return s},Jp=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},of=function(t,n,r){if(Zi(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(Hi));return n&&Mn.call(t,Hi)&&i.unshift(t),i=i.filter(r),i},uf=function e(t,n,r){for(var i=[],a=Array.from(t);a.length;){var s=a.shift();if(!Zi(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),u=o.length?o:s.children,l=e(u,!0,r);r.flatten?i.push.apply(i,l):i.push({scopeParent:s,candidates:l})}else{var d=Mn.call(s,Hi);d&&r.filter(s)&&(n||!t.includes(s))&&i.push(s);var h=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),m=!Zi(h,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(h&&m){var p=e(h===!0?s.children:h.children,!0,r);r.flatten?i.push.apply(i,p):i.push({scopeParent:s,candidates:p})}else a.unshift.apply(a,s.children)}}return i},lf=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},gn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Jp(t))&&!lf(t)?0:t.tabIndex},Xp=function(t,n){var r=gn(t);return r<0&&n&&!lf(t)?0:r},eg=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},cf=function(t){return t.tagName==="INPUT"},tg=function(t){return cf(t)&&t.type==="hidden"},ng=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},rg=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},ig=function(t){if(!t.name)return!0;var n=t.form||Ki(t),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(t.name));else try{i=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var a=rg(i,t.form);return!a||a===t},ag=function(t){return cf(t)&&t.type==="radio"},sg=function(t){return ag(t)&&!ig(t)},og=function(t){var n,r=t&&Ki(t),i=(n=r)===null||n===void 0?void 0:n.host,a=!1;if(r&&r!==t){var s,o,u;for(a=!!((s=i)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(i)||t!=null&&(u=t.ownerDocument)!==null&&u!==void 0&&u.contains(t));!a&&i;){var l,d,h;r=Ki(i),i=(l=r)===null||l===void 0?void 0:l.host,a=!!((d=i)!==null&&d!==void 0&&(h=d.ownerDocument)!==null&&h!==void 0&&h.contains(i))}}return a},Yu=function(t){var n=t.getBoundingClientRect(),r=n.width,i=n.height;return r===0&&i===0},ug=function(t,n){var r=n.displayCheck,i=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var a=Mn.call(t,"details>summary:first-of-type"),s=a?t.parentElement:t;if(Mn.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof i=="function"){for(var o=t;t;){var u=t.parentElement,l=Ki(t);if(u&&!u.shadowRoot&&i(u)===!0)return Yu(t);t.assignedSlot?t=t.assignedSlot:!u&&l!==t.ownerDocument?t=l.host:t=u}t=o}if(og(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Yu(t);return!1},lg=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var i=n.children.item(r);if(i.tagName==="LEGEND")return Mn.call(n,"fieldset[disabled] *")?!0:!i.contains(t)}return!0}n=n.parentElement}return!1},Yi=function(t,n){return!(n.disabled||Zi(n)||tg(n)||ug(n,t)||ng(n)||lg(n))},zs=function(t,n){return!(sg(n)||gn(n)<0||!Yi(t,n))},cg=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},dg=function e(t){var n=[],r=[];return t.forEach(function(i,a){var s=!!i.scopeParent,o=s?i.scopeParent:i,u=Xp(o,s),l=s?e(i.candidates):o;u===0?s?n.push.apply(n,l):n.push(o):r.push({documentOrder:a,tabIndex:u,item:i,isScope:s,content:l})}),r.sort(eg).reduce(function(i,a){return a.isScope?i.push.apply(i,a.content):i.push(a.content),i},[]).concat(n)},df=function(t,n){n=n||{};var r;return n.getShadowRoot?r=uf([t],n.includeContainer,{filter:zs.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:cg}):r=of(t,n.includeContainer,zs.bind(null,n)),dg(r)},ff=function(t,n){n=n||{};var r;return n.getShadowRoot?r=uf([t],n.includeContainer,{filter:Yi.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=of(t,n.includeContainer,Yi.bind(null,n)),r},Fn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Mn.call(t,Hi)===!1?!1:zs(n,t)},fg=af.concat("iframe").join(","),Ni=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Mn.call(t,fg)===!1?!1:Yi(n,t)};const mg=Object.freeze(Object.defineProperty({__proto__:null,focusable:ff,getTabIndex:gn,isFocusable:Ni,isTabbable:Fn,tabbable:df},Symbol.toStringTag,{value:"Module"}));/*!
60
60
  * focus-trap 7.5.4
61
61
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
62
- */function Gu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Qu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gu(Object(n),!0).forEach(function(r){hg(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hg(e,t,n){return t=gg(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pg(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 gg(e){var t=pg(e,"string");return typeof t=="symbol"?t:String(t)}var Ju={activateTrap:function(t,n){if(t.length>0){var r=t[t.length-1];r!==n&&r.pause()}var i=t.indexOf(n);i===-1||t.splice(i,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()}},vg=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},bg=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},Nr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},yg=function(t){return Nr(t)&&!t.shiftKey},xg=function(t){return Nr(t)&&t.shiftKey},Xu=function(t){return setTimeout(t,0)},el=function(t,n){var r=-1;return t.every(function(i,a){return n(i)?(r=a,!1):!0}),r},_r=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return typeof t=="function"?t.apply(void 0,r):t},hi=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},wg=[],Cg=function(t,n){var r=(n==null?void 0:n.document)||document,i=(n==null?void 0:n.trapStack)||wg,a=Qu({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:yg,isKeyBackward:xg},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,u=function(A,F,S){return A&&A[F]!==void 0?A[F]:a[S||F]},l=function(A,F){var S=typeof(F==null?void 0:F.composedPath)=="function"?F.composedPath():void 0;return s.containerGroups.findIndex(function(I){var H=I.container,V=I.tabbableNodes;return H.contains(A)||(S==null?void 0:S.includes(H))||V.find(function(ae){return ae===A})})},d=function(A){var F=a[A];if(typeof F=="function"){for(var S=arguments.length,I=new Array(S>1?S-1:0),H=1;H<S;H++)I[H-1]=arguments[H];F=F.apply(void 0,I)}if(F===!0&&(F=void 0),!F){if(F===void 0||F===!1)return F;throw new Error("`".concat(A,"` was specified but was not a node, or did not return a node"))}var V=F;if(typeof F=="string"&&(V=r.querySelector(F),!V))throw new Error("`".concat(A,"` as selector refers to no known node"));return V},m=function(){var A=d("initialFocus");if(A===!1)return!1;if(A===void 0||!Ni(A,a.tabbableOptions))if(l(r.activeElement)>=0)A=r.activeElement;else{var F=s.tabbableGroups[0],S=F&&F.firstTabbableNode;A=S||d("fallbackFocus")}if(!A)throw new Error("Your focus-trap needs to have at least one focusable element");return A},h=function(){if(s.containerGroups=s.containers.map(function(A){var F=df(A,a.tabbableOptions),S=ff(A,a.tabbableOptions),I=F.length>0?F[0]:void 0,H=F.length>0?F[F.length-1]:void 0,V=S.find(function(E){return Fn(E)}),ae=S.slice().reverse().find(function(E){return Fn(E)}),ne=!!F.find(function(E){return gn(E)>0});return{container:A,tabbableNodes:F,focusableNodes:S,posTabIndexesFound:ne,firstTabbableNode:I,lastTabbableNode:H,firstDomTabbableNode:V,lastDomTabbableNode:ae,nextTabbableNode:function(Y){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,T=F.indexOf(Y);return T<0?q?S.slice(S.indexOf(Y)+1).find(function(j){return Fn(j)}):S.slice(0,S.indexOf(Y)).reverse().find(function(j){return Fn(j)}):F[T+(q?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(A){return A.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(A){return A.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.")},p=function O(A){var F=A.activeElement;if(F)return F.shadowRoot&&F.shadowRoot.activeElement!==null?O(F.shadowRoot):F},g=function O(A){if(A!==!1&&A!==p(document)){if(!A||!A.focus){O(m());return}A.focus({preventScroll:!!a.preventScroll}),s.mostRecentlyFocusedNode=A,vg(A)&&A.select()}},f=function(A){var F=d("setReturnFocus",A);return F||(F===!1?!1:A)},b=function(A){var F=A.target,S=A.event,I=A.isBackward,H=I===void 0?!1:I;F=F||hi(S),h();var V=null;if(s.tabbableGroups.length>0){var ae=l(F,S),ne=ae>=0?s.containerGroups[ae]:void 0;if(ae<0)H?V=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:V=s.tabbableGroups[0].firstTabbableNode;else if(H){var E=el(s.tabbableGroups,function(M){var U=M.firstTabbableNode;return F===U});if(E<0&&(ne.container===F||Ni(F,a.tabbableOptions)&&!Fn(F,a.tabbableOptions)&&!ne.nextTabbableNode(F,!1))&&(E=ae),E>=0){var Y=E===0?s.tabbableGroups.length-1:E-1,q=s.tabbableGroups[Y];V=gn(F)>=0?q.lastTabbableNode:q.lastDomTabbableNode}else Nr(S)||(V=ne.nextTabbableNode(F,!1))}else{var T=el(s.tabbableGroups,function(M){var U=M.lastTabbableNode;return F===U});if(T<0&&(ne.container===F||Ni(F,a.tabbableOptions)&&!Fn(F,a.tabbableOptions)&&!ne.nextTabbableNode(F))&&(T=ae),T>=0){var j=T===s.tabbableGroups.length-1?0:T+1,R=s.tabbableGroups[j];V=gn(F)>=0?R.firstTabbableNode:R.firstDomTabbableNode}else Nr(S)||(V=ne.nextTabbableNode(F))}}else V=d("fallbackFocus");return V},v=function(A){var F=hi(A);if(!(l(F,A)>=0)){if(_r(a.clickOutsideDeactivates,A)){o.deactivate({returnFocus:a.returnFocusOnDeactivate});return}_r(a.allowOutsideClick,A)||A.preventDefault()}},y=function(A){var F=hi(A),S=l(F,A)>=0;if(S||F instanceof Document)S&&(s.mostRecentlyFocusedNode=F);else{A.stopImmediatePropagation();var I,H=!0;if(s.mostRecentlyFocusedNode)if(gn(s.mostRecentlyFocusedNode)>0){var V=l(s.mostRecentlyFocusedNode),ae=s.containerGroups[V].tabbableNodes;if(ae.length>0){var ne=ae.findIndex(function(E){return E===s.mostRecentlyFocusedNode});ne>=0&&(a.isKeyForward(s.recentNavEvent)?ne+1<ae.length&&(I=ae[ne+1],H=!1):ne-1>=0&&(I=ae[ne-1],H=!1))}}else s.containerGroups.some(function(E){return E.tabbableNodes.some(function(Y){return gn(Y)>0})})||(H=!1);else H=!1;H&&(I=b({target:s.mostRecentlyFocusedNode,isBackward:a.isKeyBackward(s.recentNavEvent)})),g(I||s.mostRecentlyFocusedNode||m())}s.recentNavEvent=void 0},C=function(A){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=A;var S=b({event:A,isBackward:F});S&&(Nr(A)&&A.preventDefault(),g(S))},k=function(A){if(bg(A)&&_r(a.escapeDeactivates,A)!==!1){A.preventDefault(),o.deactivate();return}(a.isKeyForward(A)||a.isKeyBackward(A))&&C(A,a.isKeyBackward(A))},D=function(A){var F=hi(A);l(F,A)>=0||_r(a.clickOutsideDeactivates,A)||_r(a.allowOutsideClick,A)||(A.preventDefault(),A.stopImmediatePropagation())},_=function(){if(s.active)return Ju.activateTrap(i,o),s.delayInitialFocusTimer=a.delayInitialFocus?Xu(function(){g(m())}):g(m()),r.addEventListener("focusin",y,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",D,{capture:!0,passive:!1}),r.addEventListener("keydown",k,{capture:!0,passive:!1}),o},B=function(){if(s.active)return r.removeEventListener("focusin",y,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",D,!0),r.removeEventListener("keydown",k,!0),o},P=function(A){var F=A.some(function(S){var I=Array.from(S.removedNodes);return I.some(function(H){return H===s.mostRecentlyFocusedNode})});F&&g(m())},N=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(P):void 0,z=function(){N&&(N.disconnect(),s.active&&!s.paused&&s.containers.map(function(A){N.observe(A,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(A){if(s.active)return this;var F=u(A,"onActivate"),S=u(A,"onPostActivate"),I=u(A,"checkCanFocusTrap");I||h(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,F==null||F();var H=function(){I&&h(),_(),z(),S==null||S()};return I?(I(s.containers.concat()).then(H,H),this):(H(),this)},deactivate:function(A){if(!s.active)return this;var F=Qu({onDeactivate:a.onDeactivate,onPostDeactivate:a.onPostDeactivate,checkCanReturnFocus:a.checkCanReturnFocus},A);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,B(),s.active=!1,s.paused=!1,z(),Ju.deactivateTrap(i,o);var S=u(F,"onDeactivate"),I=u(F,"onPostDeactivate"),H=u(F,"checkCanReturnFocus"),V=u(F,"returnFocus","returnFocusOnDeactivate");S==null||S();var ae=function(){Xu(function(){V&&g(f(s.nodeFocusedBeforeActivation)),I==null||I()})};return V&&H?(H(f(s.nodeFocusedBeforeActivation)).then(ae,ae),this):(ae(),this)},pause:function(A){if(s.paused||!s.active)return this;var F=u(A,"onPause"),S=u(A,"onPostPause");return s.paused=!0,F==null||F(),B(),z(),S==null||S(),this},unpause:function(A){if(!s.paused||!s.active)return this;var F=u(A,"onUnpause"),S=u(A,"onPostUnpause");return s.paused=!1,F==null||F(),h(),_(),z(),S==null||S(),this},updateContainerElements:function(A){var F=[].concat(A).filter(Boolean);return s.containers=F.map(function(S){return typeof S=="string"?r.querySelector(S):S}),s.active&&h(),z(),this}},o.updateContainerElements(t),o};const Dg=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Cg},Symbol.toStringTag,{value:"Module"})),Eg=bd(Dg),_g=bd(mg);function lr(e){"@babel/helpers - typeof";return lr=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},lr(e)}function kg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tl(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,mf(r.key),r)}}function Fg(e,t,n){return t&&tl(e.prototype,t),n&&tl(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ag(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&&qs(e,t)}function qs(e,t){return qs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},qs(e,t)}function Tg(e){var t=Sg();return function(){var r=Gi(e),i;if(t){var a=Gi(this).constructor;i=Reflect.construct(r,arguments,a)}else i=r.apply(this,arguments);return Bg(this,i)}}function Bg(e,t){if(t&&(lr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pr(e)}function Pr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Sg(){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 Gi(e){return Gi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Gi(e)}function jg(e,t,n){return t=mf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mf(e){var t=Pg(e,"string");return lr(t)==="symbol"?t:String(t)}function Pg(e,t){if(lr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(lr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var pi=x,xe=Qp,Og=Eg,Mg=Og.createFocusTrap,Ng=_g,Ig=Ng.isFocusable,Ao=function(e){Ag(n,e);var t=Tg(n);function n(r){var i;kg(this,n),i=t.call(this,r),jg(Pr(i),"getNodeForOption",function(o){var u,l=(u=this.internalOptions[o])!==null&&u!==void 0?u:this.originalOptions[o];if(typeof l=="function"){for(var d=arguments.length,m=new Array(d>1?d-1:0),h=1;h<d;h++)m[h-1]=arguments[h];l=l.apply(void 0,m)}if(l===!0&&(l=void 0),!l){if(l===void 0||l===!1)return l;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var p=l;if(typeof l=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(l),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),i.handleDeactivate=i.handleDeactivate.bind(Pr(i)),i.handlePostDeactivate=i.handlePostDeactivate.bind(Pr(i)),i.handleClickOutsideDeactivates=i.handleClickOutsideDeactivates.bind(Pr(i)),i.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:i.handleDeactivate,onPostDeactivate:i.handlePostDeactivate,clickOutsideDeactivates:i.handleClickOutsideDeactivates},i.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var a=r.focusTrapOptions;for(var s in a)if(Object.prototype.hasOwnProperty.call(a,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){i.originalOptions[s]=a[s];continue}i.internalOptions[s]=a[s]}return i.outsideClick=null,i.focusTrapElements=r.containerElements||[],i.updatePreviousElement(),i}return Fg(n,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var i=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return i||(i===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var i=this.getDocument();i&&(this.previouslyFocusedElement=i.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(i){var a=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,i):this.originalOptions.clickOutsideDeactivates;return a&&(this.outsideClick={target:i.target,allowDeactivation:a}),a}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var i=this,a=function(){var o=i.getReturnFocusNode(),u=!!(i.originalOptions.returnFocusOnDeactivate&&o!==null&&o!==void 0&&o.focus&&(!i.outsideClick||i.outsideClick.allowDeactivation&&!Ig(i.outsideClick.target,i.internalOptions.tabbableOptions))),l=i.internalOptions.preventScroll,d=l===void 0?!1:l;u&&o.focus({preventScroll:d}),i.originalOptions.onPostDeactivate&&i.originalOptions.onPostDeactivate.call(null),i.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(a,a):a()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var i=this.focusTrapElements.some(Boolean);i&&(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(i){if(this.focusTrap){i.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var a=!i.active&&this.props.active,s=i.active&&!this.props.active,o=!i.paused&&this.props.paused,u=i.paused&&!this.props.paused;if(a&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),u&&this.focusTrap.unpause()}else i.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 i=this,a=this.props.children?pi.Children.only(this.props.children):void 0;if(a){if(a.type&&a.type===pi.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(l){var d=i.props.containerElements;a&&(typeof a.ref=="function"?a.ref(l):a.ref&&(a.ref.current=l)),i.focusTrapElements=d||[l]},o=pi.cloneElement(a,{ref:s});return o}return null}}]),n}(pi.Component),kr=typeof Element>"u"?Function:Element;Ao.propTypes={active:xe.bool,paused:xe.bool,focusTrapOptions:xe.shape({document:xe.object,onActivate:xe.func,onPostActivate:xe.func,checkCanFocusTrap:xe.func,onPause:xe.func,onPostPause:xe.func,onUnpause:xe.func,onPostUnpause:xe.func,onDeactivate:xe.func,onPostDeactivate:xe.func,checkCanReturnFocus:xe.func,initialFocus:xe.oneOfType([xe.instanceOf(kr),xe.string,xe.bool,xe.func]),fallbackFocus:xe.oneOfType([xe.instanceOf(kr),xe.string,xe.func]),escapeDeactivates:xe.oneOfType([xe.bool,xe.func]),clickOutsideDeactivates:xe.oneOfType([xe.bool,xe.func]),returnFocusOnDeactivate:xe.bool,setReturnFocus:xe.oneOfType([xe.instanceOf(kr),xe.string,xe.bool,xe.func]),allowOutsideClick:xe.oneOfType([xe.bool,xe.func]),preventScroll:xe.bool,tabbableOptions:xe.shape({displayCheck:xe.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:xe.oneOfType([xe.bool,xe.func])}),trapStack:xe.array,isKeyForward:xe.func,isKeyBackward:xe.func}),containerElements:xe.arrayOf(xe.instanceOf(kr)),children:xe.oneOfType([xe.element,xe.instanceOf(kr)])};Ao.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:Mg};var Rg=Ao;const $g=$n(Rg);const ln=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:i=()=>{},onClose:a=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:u,buttons:l,className:d="",gtmContext:m="Modal"})=>{const h=ie.useIntl(),{registerOverlay:p,unregisterOverlay:g}=Kd(),[f,b]=x.useState(t),[v,y]=x.useState(null),C=x.useRef(null),k=N=>{f&&N.key==="Escape"&&B(!1)},D=N=>{y(N.target)},_=N=>{v===C.current&&N.target===C.current&&B(!1),y(null)};x.useEffect(()=>{if(f)return window.addEventListener("keyup",k),()=>{window.removeEventListener("keyup",k)}},[f]),x.useEffect(()=>{const N=C.current;return N&&(N.addEventListener("mousedown",D),N.addEventListener("mouseup",_)),()=>{N&&(N.removeEventListener("mousedown",D),N.removeEventListener("mouseup",_))}},[v]);const B=N=>{if(b(N),N)i(),p(e);else{if(f===N)return;a(),g(e)}};x.useEffect(()=>(B(t),()=>{f&&g(e)}),[t]);const P=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:C,className:K("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(ko,{id:e,className:K("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:P,children:t&&c.jsx($g,{containerElements:[C.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(we,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>B(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":m,screenreaderText:h.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(zt,{}),u,l&&c.jsxs("div",{className:"bottom",children:[c.jsx(zt,{}),c.jsx(vr,{buttons:l})]}),s&&c.jsx(ur,{className:"error",children:s})]})})})})},hf=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Fr="joinCommunityButton",To=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:i,leave:a}={join:()=>{},leave:()=>{}}})=>{const s=ie.useIntl(),o=x.useContext(rt),u=o&&typeof o.id=="string",l=r||!u,[d,m]=x.useState(e),[h,p]=x.useState(e?"joined":"notJoined");x.useEffect(()=>{h==="joining"?p("joined"):h==="leaving"&&p("notJoined")},[d]);const g={},f={};return d&&h!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${Fr}_leave`}),g["aria-label"]=s.formatMessage({id:`${Fr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(we,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&h!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${Fr}_closed_tooltip`}):"",onClick:async b=>{if(l)return;b.currentTarget.blur(),p(d?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${Fr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(v);const y=d?a:i;typeof y=="function"&&setTimeout(async()=>{await y()},500),m(!d)},className:K("join-community-button",h,{active:h==="joining"}),disabled:l,"data-testid":"join-button",...g,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${Fr}${["joining","leaving"].includes(h)?`_${h}`:d?"_member":n?"_short":""}`})})})};const qa="communityDetails_",Lg=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:i=0,data:a=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const u=ie.useIntl(),{id:l}=x.useContext(rt),d=l,m=5,h=i||a.length,p=a.length?a:Array(m).fill({}),g=`/communities/${r}/members`===window.location.pathname,f=t||n,b=!n&&!t;return c.jsxs("div",{className:K("community-details",e),children:[f?c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[u.formatMessage({id:`${qa}members`}),c.jsx("span",{className:"count",children:h})]}),g?c.jsx(c.Fragment,{}):c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:u.formatMessage({id:`${qa}viewAll`})})})]}),d&&c.jsx(_o,{contributors:{total:i,data:p},styling:{size:"medium",showGap:!0,showPlaceholders:h===0},cutoff:m})]}):c.jsx(c.Fragment,{}),d?c.jsxs(c.Fragment,{children:[c.jsx(To,{isMember:t,isOpen:n,disabled:b,functions:{...o}}),t&&c.jsx(we,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:u.formatMessage({id:`${qa}invite`})})]}):c.jsx(c.Fragment,{})]})};const Zr=({icon:e,className:t="",children:n,shortText:r,...i})=>{const a={};return r&&(a["data-short-text"]=r),c.jsx(we,{className:K("action-button",t),variant:"tertiary",size:{mobile:"small",769:"medium"},icon:e,...i,...a,children:c.jsx("span",{className:"inner-text",children:n})})},zg="reply",yn="00000000-0000-0000-0000-000000000000",Bo="en";function So({queryClient:e,queryKey:t}){function n(r,i,a){e.setQueryData(t,a)}return n}function jo({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const i=e.getQueryData(t);return e.setQueryData(t,r),i}return n}var yr=(e=>(e.Post="post",e.Poll="poll",e))(yr||{});const vt="poll-vote",pf=(e,t="en")=>{var r;return e.verb!==yr.Poll?[]:(((r=e==null?void 0:e.latest_reactions)==null?void 0:r["poll-option"])||[]).map(i=>{var o,u,l,d,m;const a=((o=i==null?void 0:i.own_children)==null?void 0:o["poll-vote"])||[],s=((u=i.data)==null?void 0:u.description)||{[t]:""};return{id:i.id,label:s[t],numVotes:((l=i==null?void 0:i.children_counts)==null?void 0:l["poll-vote"])||0,hasUserVoted:a.length>0,userVote:{id:(d=a[0])==null?void 0:d.id},position:((m=i.data)==null?void 0:m.position)||0}}).sort((i,a)=>i.position-a.position)};function gf({activity:e,reactionId:t,user:n}){var a;const r=n==null?void 0:n.id;if(!r)return;const i=(a=e.latest_reactions)==null?void 0:a["poll-option"];if(i){for(const s of i)if(s.id===t){const o={id:yn,activity_id:e.id,kind:vt,data:{},created_at:new Date().toISOString(),updated_at:new Date().toISOString(),user_id:r,parent:s.id,latest_children:{},own_children:{},children_counts:{}};s.latest_children=s.latest_children||{},s.latest_children[vt]=s.latest_children[vt]||[],s.latest_children[vt].push(o),s.own_children=s.own_children||{},s.own_children[vt]=s.own_children[vt]||[],s.own_children[vt].push(o),s.children_counts=s.children_counts||{},s.children_counts[vt]=(s.children_counts[vt]||0)+1;break}}}function vf({activity:e,reactionId:t,correctReactionId:n,user:r}){var i;(i=e.latest_reactions)==null||i["poll-option"].forEach(a=>{var s;a.id===t&&(a.latest_children[vt].forEach(o=>{o.id===yn&&o.user_id===(r==null?void 0:r.id)&&(o.id=n)}),(s=a.own_children)==null||s[vt].forEach(o=>{o.id===yn&&o.user_id===(r==null?void 0:r.id)&&(o.id=n)}))})}function bf({activity:e,reactionId:t}){var r,i,a;const n=(r=e.latest_reactions)==null?void 0:r["poll-option"];if(n)for(const s of n){const o=(i=s.own_children)==null?void 0:i[vt],u=(a=s.latest_children)==null?void 0:a[vt];if(u){const l=u.findIndex(d=>d.id===t);l!==-1&&(u.splice(l,1),s.children_counts[vt]--)}if(o){const l=o.findIndex(d=>d.id===t);l!==-1&&o.splice(l,1)}}}function qg({id:e,position:t,description:n},r){if(r!=null&&r.id)return{created_at:new Date().toISOString(),updated_at:new Date().toISOString(),id:e||yn,kind:"poll-option",data:{description:n,position:t},parent:""}}function Ug(){return{latest_reactions:{like:[],reply:[],"poll-option":[]},reaction_counts:{like:0,reply:0,"poll-option":0},own_reactions:{like:[],reply:[],"poll-option":[]}}}function Wg(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Vg(e,t){const n=e.map(r=>qg(r,t));return{latest_reactions:{like:[],reply:[],"poll-option":n},reaction_counts:{like:0,reply:0,"poll-option":0},own_reactions:{like:[],reply:[],"poll-option":[]}}}function Po(e){const{id:t="",name:n="",organization:r="",jobTitle:i="",image:a={}}=e,{thumbnail:s=""}=a;return{id:t,data:{name:n,organization:r,jobTitle:i,thumbnail:s}}}function Hg({title:e,content:t,categories:n}){const r=[];return n&&!["no-category",""].includes(n)&&r.push(n),{title:e,content:t,categories:r,id:yn,time:new Date().toISOString(),verb:yr.Post}}function nl({title:e,options:t,settings:n,user:r,correctActivityId:i}){return{title:e,content:"",id:i||yn,time:new Date().toISOString(),verb:yr.Poll}}function rl({activity:e,user:t}){return{...e,actor:Po(t),...Ug()}}function il({activity:e,options:t,user:n}){return{...e,actor:Po(n),...Vg(t,n)}}function Qi({activity:e,reaction:t}){var n,r,i;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:[...((i=e.own_reactions)==null?void 0:i.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function yf({activity:e,user:t}){var n,r,i;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:a})=>a!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((i=e.own_reactions)==null?void 0:i.like)||[]).filter(({user_id:a})=>a!==t.id)})}function Ji({activity:e,reaction:t}){var n,r,i;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:[...((i=e.own_reactions)==null?void 0:i.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function xf({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 Kg(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function Zg(e,t,n){const r=t.pages.length-1,i=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[i]=e:t.pages[r].results.push(e),t}function Yg(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 cr(e,t,n){return t?n!=null&&n.append?Zg(e,t,n):Yg(e,t,n):Kg(e)}function wt(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:i})=>i===e);if(r)return r}}function wf(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:i})=>i===e);if(r!==-1){n.splice(r,1);break}}return t}function Oo(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],[]))||[]}function Gg({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:yn,kind:zg,parent:t||""}}function al({reply:e,user:t}){const n=Po(t);return{...e,user_id:n.id,user:n,...Wg()}}function sl({reply:e,reaction:t}){var n,r,i;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:[...((i=e.own_children)==null?void 0:i.like)||[],t]}):e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like+1:1}}function Qg({reply:e,user:t}){var n,r,i;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:a})=>a!==t.id)},e.own_children={...e.own_children||{},like:(((i=e.own_children)==null?void 0:i.like)||[]).filter(({user_id:a})=>a!==t.id)})}const Mo=(e,t)=>{const n=new CustomEvent(it.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let ol,Ua=0;const Cf=()=>{x.useEffect(()=>(document.addEventListener(it.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(it.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(ol);const i=document.getElementById(n);if(i){i.scrollIntoView({behavior:"smooth",block:"start"}),Ua=0;return}Ua++,!(Ua>10)&&(ol=setTimeout(()=>{e(t)},50))}};var Te=(e=>(e.Answer="answer",e.Poll="poll",e.Post="post",e.Response="response",e.Reply="reply",e.Question="question",e))(Te||{});const dr=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}),Jt=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}),No=Object.freeze({actor:`SU:${dr.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"}),Jg=Object.freeze({actor:`SU:${Jt.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"}),Xg=Object.freeze({actor:`SU:${dr.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"}),ev=Object.freeze({actor:`SU:${Jt.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:No.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Jt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Jt.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:No.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Jt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Jt.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:Jt.id,user:{id:Jt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:No.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:dr.id,user:{id:dr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Jg.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:Jt.id,user:{id:Jt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Xg.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:dr.id,user:{id:dr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:ev.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});const tv=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),nv=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);function rv(e){return x.useCallback(t=>{var s,o,u,l;if(!t||!["ArrowUp","ArrowDown"].includes(t.key||""))return;t.stopPropagation(),t.preventDefault();const n=t.key==="ArrowUp"?"up":"down",r=(s=t.currentTarget)==null?void 0:s.parentElement;let i=r==null?void 0:r.nextElementSibling;if(n==="up"){const d=r==null?void 0:r.previousElementSibling;d?i=d:(i=(o=r==null?void 0:r.parentElement)==null?void 0:o.lastElementChild,(i==null?void 0:i.getAttribute("data-index"))==="-1"&&(i=i==null?void 0:i.previousElementSibling))}else(!i||(i==null?void 0:i.getAttribute("data-index"))==="-1")&&(i=(u=r==null?void 0:r.parentElement)==null?void 0:u.firstElementChild);if(!i)return;const a=Number((i==null?void 0:i.getAttribute("data-index"))||"0");e([{type:"tabbableLink",value:a}]),(l=i==null?void 0:i.querySelector("a,button"))==null||l.focus()},[e])}const iv=x.lazy(()=>Promise.resolve().then(()=>Iv));let Ir=!1;const Wa=()=>{Ir!==!1&&(clearTimeout(Ir),Ir=!1)},av=5;let Va=null;const Df=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:i=!1,content:a={type:Te.Reply,slugs:{}},canLike:s=!0,activityId:o,basePath:u,parentId:l,functions:{createLike:d=()=>{},deleteLike:m=()=>{},listLikes:h=async()=>({next:"",results:[]})}})=>{const p=ie.useIntl(),g={numberOfLikes:t,userLikedContent:i,ignoreInteractions:!1,showLikers:!1,tabbableLink:0,showLikesModal:!1},[f,b]=x.useReducer(pr,g),{numberOfLikes:v,userLikedContent:y,ignoreInteractions:C,showLikers:k,tabbableLink:D,showLikesModal:_}=f,B=rv(b);x.useEffect(()=>{b([{type:"userLikedContent",value:i}])},[i]);const P=x.useMemo(()=>nv(n,av),[n]),N=F=>{if(F.preventDefault(),F.stopPropagation(),b([{type:"showLikers",value:!1}]),Ir)return Wa(),!1;if(Wa(),C||!s)return!1;Ir=setTimeout(z,350)},z=async()=>{if(Wa(),C||!s)return!1;let F=y?v-1:v+1;F<0&&(F=0),b([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:F},{type:"userLikedContent",value:!y}]);try{if(a&&a.slugs){const S=tv(a.slugs);y?await m(S):await d({...S,payload:{contentPath:window.location.pathname}})}}catch{b([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:i}])}finally{b([{type:"ignoreInteractions",value:!1}])}},O=()=>{Va=setTimeout(()=>{b([{type:"showLikers",value:!1}])},500)},A=()=>{Va&&clearTimeout(Va)};return x.createElement(e,{className:"likes-wrapper",onKeyDown:F=>{F.key==="Escape"&&b([{type:"showLikers",value:!1}])},onMouseEnter:()=>{A(),b([{type:"showLikers",value:!0}])},onMouseLeave:()=>{O()}},c.jsxs(c.Fragment,{children:[c.jsx(Zr,{className:K("discussion-button text-medium action-button likes-button",{"show-spinner":C,"is-liked":y,disabled:!s}),icon:{icon:y?"heart":"heart_empty",animate:"bounce"},shortText:`${v}`,disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${a.type}-click`,onClick:N,screenreaderText:s?p.formatMessage({id:`discussion_likes_${y?"unlike":"like"}`},{action:p.formatMessage({id:`discussion_action_${a.type}`})}):!1,"aria-pressed":y,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:p.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:v})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Oe,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{A()},onBlur:()=>O,onClick:F=>{var I;F.preventDefault(),F.stopPropagation(),A(),b([{type:"showLikers",value:!0}]);const S=(I=F.currentTarget.nextSibling)==null?void 0:I.childNodes[0];if(S){const H=S.querySelector("li:first-child a");H&&(b([{type:"tabbableLink",value:0}]),setTimeout(()=>{H.focus()},100))}},onKeyDown:F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),O())},"aria-expanded":k,"aria-controls":`likes-tooltip-${a.slug}`,children:c.jsx(Oe,{showOnFocus:!1,children:p.formatMessage({id:"discussion_likes_show"},{action:a.type})})}),c.jsx(Ln,{id:`likes-tooltip-${a.slug}`,isOpen:k,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[P.map((F,S)=>{if(typeof F=="string")return null;const I={};return D!==S&&(I.tabIndex=-1),c.jsx("li",{"data-index":S,children:c.jsx(Dn,{href:F.id?`/profiles/${F.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onFocus:()=>A(),onKeyDown:B,...I,children:F.name?F.name:c.jsx("span",{className:"deleted-user",children:p.formatMessage({id:"member_deleted"})})})},F.id||window.btoa(F.name||""))}),c.jsx("li",{"data-index":P.length,className:"show-all",children:c.jsx(we,{variant:"tertiary",size:{mobile:"small",769:"medium"},onClick:()=>{A(),O(),b([{type:"showLikesModal",value:!0}])},onKeyDown:B,children:p.formatMessage({id:"discussion_likes_showAll"})})})]})}),_&&c.jsx(br,{children:c.jsx(x.Suspense,{children:c.jsx(iv,{activityId:o,basePath:u,parentId:l,likeCount:t,showModal:_,functions:{onClose:()=>b([{type:"showLikesModal",value:!1}]),likes:{list:h}}})})})]})]}))},Us=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},xr=e=>{var t,n,r,i,a,s;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:(i=e==null?void 0:e.data)==null?void 0:i.location,image:{thumbnail:((a=e==null?void 0:e.data)==null?void 0:a.thumbnail)||void 0},badges:(s=e==null?void 0:e.data)==null?void 0:s.badges}:"deleted"};function sv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=Re.useMutation({mutationFn:e,onMutate:o=>t(u=>{const l=rl({activity:Hg(o),user:a});return cr(l,u)}),onError:n,onSuccess:(o,u,l)=>{const d=rl({activity:o,user:a});r.setQueryData(i,cr(d,l,{replace:!0})),setTimeout(()=>{Mo(d.id,"activity")},0)}});return s}function ov({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutateAsync:s}=Re.useMutation({mutationFn:e,onMutate:({options:o,title:u,settings:l})=>t(d=>{const m=il({activity:nl({title:u,options:o,settings:l,user:a}),options:o,user:a});return cr(m,d)}),onError:(o,u,l)=>{const d=m=>{const h=m.pages;return h.forEach(p=>{p.results=p.results.filter(g=>g.id!==yn)}),{...m,pages:h}};r.setQueryData(i,m=>d(m)),n&&n(o,u,l)},onSuccess:async(o,{options:u,title:l,settings:d},m)=>{const h=o,p=il({activity:nl({title:l,options:u,settings:d,user:a,correctActivityId:h.body.id}),options:u.map((g,f)=>({...g,id:h.body.options[f]})),user:a});r.setQueryData(i,cr(p,m,{replace:!0})),setTimeout(()=>{Mo(h.body.id,"activity")},0)}});return s}function uv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=Re.useMutation({mutationFn:e,onMutate:({activityId:o,reactionId:u})=>t(l=>{const d=wt(o,l);return d&&gf({activity:d,reactionId:u,user:a}),l}),onError:n,onSuccess:(o,{activityId:u,reactionId:l},d)=>{const m=wt(u,d);m&&vf({activity:m,reactionId:l,correctReactionId:o.body.id,user:a}),r.setQueryData(i,d)}});return s}function lv({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Re.useMutation({mutationFn:e,onMutate:({activityId:i,content:a})=>t(s=>{const o=wt(i,s);return o&&(o.content=a),s}),onError:n});return r}function cv({queryFns:{create:e,edit:t,like:n,list:r,remove:i,unlike:a,pin:s,unpin:o,createVote:u,createPoll:l,removeVote:d,removePoll:m},queryKey:h,filterOption:p}){const g=Re.useQueryClient(),f=pa(),b={queryClient:g,queryKey:h},v={mutationHandlers:{error:So(b),mutate:jo(b)},user:f,...b},y=sv({...v,mutationFn:e}),C=lv({...v,mutationFn:t}),k=dv({...v,mutationFn:n}),D=ul({...v,mutationFn:i}),_=pv({...v,mutationFn:a}),B=mv({...v,mutationFn:s}),P=gv({...v,mutationFn:o}),N=uv({...v,mutationFn:u}),z=ov({...v,mutationFn:l}),O=hv({...v,mutationFn:d}),A=ul({...v,mutationFn:m}),{activities:F,...S}=fv({queryKey:h,queryFn:r,filterOption:p});return{activities:F,mutations:{create:y,edit:C,remove:D,like:k,unlike:_,pin:B,unpin:P,createVote:N,createPoll:z,removeVote:O,removePoll:A},user:f,...S}}function dv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Re.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const u=wt(s,o);return u&&Qi({activity:u}),o}),onError:n,onSuccess:(s,{activityId:o},u)=>{const l=wt(o,u);l&&Qi({activity:l,reaction:s}),r.setQueryData(i,u)}});return a}function fv({queryFn:e,queryKey:t,filterOption:n}){const{data:r,error:i,isLoading:a,hasNextPage:s,fetchNextPage:o}=Re.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`${n==null?void 0:n.type}=${n==null?void 0:n.id}`,getNextPageParam:u=>u!=null&&u.next?`${u==null?void 0:u.next}&${n==null?void 0:n.type}=${n==null?void 0:n.id}`:null});return{activities:Oo(r),error:i,isLoading:a,hasNextPage:s,fetchNextPage:o}}function mv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Re.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const u=wt(s,o);return u&&Ji({activity:u}),o}),onError:n,onSuccess:(s,{activityId:o},u)=>{const l=wt(o,u);l&&Ji({activity:l,reaction:s}),r.setQueryData(i,u)}});return a}function ul({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Re.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(a=>wf(i,a)),onError:n});return r}function hv({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:({activityId:a,reactionId:s})=>t(o=>{const u=wt(a,o);return u&&bf({activity:u,reactionId:s}),o}),onError:n});return i}function pv({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(s=>{const o=wt(a,s);return o&&yf({activity:o,user:r}),s}),onError:n});return i}function gv({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(s=>{const o=wt(a,s);return o&&xf({activity:o,user:r}),s}),onError:n});return i}const vv=280,Io=async(e,t,n,r=()=>Promise.resolve([]))=>{let i=t?sr(e,typeof t=="number"?t:vv):e;i=i.trim();const a=`<br>
62
+ */function Gu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Qu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gu(Object(n),!0).forEach(function(r){hg(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hg(e,t,n){return t=gg(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pg(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 gg(e){var t=pg(e,"string");return typeof t=="symbol"?t:String(t)}var Ju={activateTrap:function(t,n){if(t.length>0){var r=t[t.length-1];r!==n&&r.pause()}var i=t.indexOf(n);i===-1||t.splice(i,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()}},vg=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},bg=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},Nr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},yg=function(t){return Nr(t)&&!t.shiftKey},xg=function(t){return Nr(t)&&t.shiftKey},Xu=function(t){return setTimeout(t,0)},el=function(t,n){var r=-1;return t.every(function(i,a){return n(i)?(r=a,!1):!0}),r},_r=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return typeof t=="function"?t.apply(void 0,r):t},hi=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},wg=[],Cg=function(t,n){var r=(n==null?void 0:n.document)||document,i=(n==null?void 0:n.trapStack)||wg,a=Qu({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:yg,isKeyBackward:xg},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,u=function(A,F,S){return A&&A[F]!==void 0?A[F]:a[S||F]},l=function(A,F){var S=typeof(F==null?void 0:F.composedPath)=="function"?F.composedPath():void 0;return s.containerGroups.findIndex(function(I){var H=I.container,V=I.tabbableNodes;return H.contains(A)||(S==null?void 0:S.includes(H))||V.find(function(ae){return ae===A})})},d=function(A){var F=a[A];if(typeof F=="function"){for(var S=arguments.length,I=new Array(S>1?S-1:0),H=1;H<S;H++)I[H-1]=arguments[H];F=F.apply(void 0,I)}if(F===!0&&(F=void 0),!F){if(F===void 0||F===!1)return F;throw new Error("`".concat(A,"` was specified but was not a node, or did not return a node"))}var V=F;if(typeof F=="string"&&(V=r.querySelector(F),!V))throw new Error("`".concat(A,"` as selector refers to no known node"));return V},h=function(){var A=d("initialFocus");if(A===!1)return!1;if(A===void 0||!Ni(A,a.tabbableOptions))if(l(r.activeElement)>=0)A=r.activeElement;else{var F=s.tabbableGroups[0],S=F&&F.firstTabbableNode;A=S||d("fallbackFocus")}if(!A)throw new Error("Your focus-trap needs to have at least one focusable element");return A},m=function(){if(s.containerGroups=s.containers.map(function(A){var F=df(A,a.tabbableOptions),S=ff(A,a.tabbableOptions),I=F.length>0?F[0]:void 0,H=F.length>0?F[F.length-1]:void 0,V=S.find(function(E){return Fn(E)}),ae=S.slice().reverse().find(function(E){return Fn(E)}),ne=!!F.find(function(E){return gn(E)>0});return{container:A,tabbableNodes:F,focusableNodes:S,posTabIndexesFound:ne,firstTabbableNode:I,lastTabbableNode:H,firstDomTabbableNode:V,lastDomTabbableNode:ae,nextTabbableNode:function(Y){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,T=F.indexOf(Y);return T<0?q?S.slice(S.indexOf(Y)+1).find(function(j){return Fn(j)}):S.slice(0,S.indexOf(Y)).reverse().find(function(j){return Fn(j)}):F[T+(q?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(A){return A.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(A){return A.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.")},p=function O(A){var F=A.activeElement;if(F)return F.shadowRoot&&F.shadowRoot.activeElement!==null?O(F.shadowRoot):F},g=function O(A){if(A!==!1&&A!==p(document)){if(!A||!A.focus){O(h());return}A.focus({preventScroll:!!a.preventScroll}),s.mostRecentlyFocusedNode=A,vg(A)&&A.select()}},f=function(A){var F=d("setReturnFocus",A);return F||(F===!1?!1:A)},b=function(A){var F=A.target,S=A.event,I=A.isBackward,H=I===void 0?!1:I;F=F||hi(S),m();var V=null;if(s.tabbableGroups.length>0){var ae=l(F,S),ne=ae>=0?s.containerGroups[ae]:void 0;if(ae<0)H?V=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:V=s.tabbableGroups[0].firstTabbableNode;else if(H){var E=el(s.tabbableGroups,function(N){var U=N.firstTabbableNode;return F===U});if(E<0&&(ne.container===F||Ni(F,a.tabbableOptions)&&!Fn(F,a.tabbableOptions)&&!ne.nextTabbableNode(F,!1))&&(E=ae),E>=0){var Y=E===0?s.tabbableGroups.length-1:E-1,q=s.tabbableGroups[Y];V=gn(F)>=0?q.lastTabbableNode:q.lastDomTabbableNode}else Nr(S)||(V=ne.nextTabbableNode(F,!1))}else{var T=el(s.tabbableGroups,function(N){var U=N.lastTabbableNode;return F===U});if(T<0&&(ne.container===F||Ni(F,a.tabbableOptions)&&!Fn(F,a.tabbableOptions)&&!ne.nextTabbableNode(F))&&(T=ae),T>=0){var j=T===s.tabbableGroups.length-1?0:T+1,R=s.tabbableGroups[j];V=gn(F)>=0?R.firstTabbableNode:R.firstDomTabbableNode}else Nr(S)||(V=ne.nextTabbableNode(F))}}else V=d("fallbackFocus");return V},v=function(A){var F=hi(A);if(!(l(F,A)>=0)){if(_r(a.clickOutsideDeactivates,A)){o.deactivate({returnFocus:a.returnFocusOnDeactivate});return}_r(a.allowOutsideClick,A)||A.preventDefault()}},y=function(A){var F=hi(A),S=l(F,A)>=0;if(S||F instanceof Document)S&&(s.mostRecentlyFocusedNode=F);else{A.stopImmediatePropagation();var I,H=!0;if(s.mostRecentlyFocusedNode)if(gn(s.mostRecentlyFocusedNode)>0){var V=l(s.mostRecentlyFocusedNode),ae=s.containerGroups[V].tabbableNodes;if(ae.length>0){var ne=ae.findIndex(function(E){return E===s.mostRecentlyFocusedNode});ne>=0&&(a.isKeyForward(s.recentNavEvent)?ne+1<ae.length&&(I=ae[ne+1],H=!1):ne-1>=0&&(I=ae[ne-1],H=!1))}}else s.containerGroups.some(function(E){return E.tabbableNodes.some(function(Y){return gn(Y)>0})})||(H=!1);else H=!1;H&&(I=b({target:s.mostRecentlyFocusedNode,isBackward:a.isKeyBackward(s.recentNavEvent)})),g(I||s.mostRecentlyFocusedNode||h())}s.recentNavEvent=void 0},C=function(A){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=A;var S=b({event:A,isBackward:F});S&&(Nr(A)&&A.preventDefault(),g(S))},k=function(A){if(bg(A)&&_r(a.escapeDeactivates,A)!==!1){A.preventDefault(),o.deactivate();return}(a.isKeyForward(A)||a.isKeyBackward(A))&&C(A,a.isKeyBackward(A))},D=function(A){var F=hi(A);l(F,A)>=0||_r(a.clickOutsideDeactivates,A)||_r(a.allowOutsideClick,A)||(A.preventDefault(),A.stopImmediatePropagation())},_=function(){if(s.active)return Ju.activateTrap(i,o),s.delayInitialFocusTimer=a.delayInitialFocus?Xu(function(){g(h())}):g(h()),r.addEventListener("focusin",y,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",D,{capture:!0,passive:!1}),r.addEventListener("keydown",k,{capture:!0,passive:!1}),o},B=function(){if(s.active)return r.removeEventListener("focusin",y,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",D,!0),r.removeEventListener("keydown",k,!0),o},M=function(A){var F=A.some(function(S){var I=Array.from(S.removedNodes);return I.some(function(H){return H===s.mostRecentlyFocusedNode})});F&&g(h())},P=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(M):void 0,z=function(){P&&(P.disconnect(),s.active&&!s.paused&&s.containers.map(function(A){P.observe(A,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(A){if(s.active)return this;var F=u(A,"onActivate"),S=u(A,"onPostActivate"),I=u(A,"checkCanFocusTrap");I||m(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,F==null||F();var H=function(){I&&m(),_(),z(),S==null||S()};return I?(I(s.containers.concat()).then(H,H),this):(H(),this)},deactivate:function(A){if(!s.active)return this;var F=Qu({onDeactivate:a.onDeactivate,onPostDeactivate:a.onPostDeactivate,checkCanReturnFocus:a.checkCanReturnFocus},A);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,B(),s.active=!1,s.paused=!1,z(),Ju.deactivateTrap(i,o);var S=u(F,"onDeactivate"),I=u(F,"onPostDeactivate"),H=u(F,"checkCanReturnFocus"),V=u(F,"returnFocus","returnFocusOnDeactivate");S==null||S();var ae=function(){Xu(function(){V&&g(f(s.nodeFocusedBeforeActivation)),I==null||I()})};return V&&H?(H(f(s.nodeFocusedBeforeActivation)).then(ae,ae),this):(ae(),this)},pause:function(A){if(s.paused||!s.active)return this;var F=u(A,"onPause"),S=u(A,"onPostPause");return s.paused=!0,F==null||F(),B(),z(),S==null||S(),this},unpause:function(A){if(!s.paused||!s.active)return this;var F=u(A,"onUnpause"),S=u(A,"onPostUnpause");return s.paused=!1,F==null||F(),m(),_(),z(),S==null||S(),this},updateContainerElements:function(A){var F=[].concat(A).filter(Boolean);return s.containers=F.map(function(S){return typeof S=="string"?r.querySelector(S):S}),s.active&&m(),z(),this}},o.updateContainerElements(t),o};const Dg=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Cg},Symbol.toStringTag,{value:"Module"})),Eg=bd(Dg),_g=bd(mg);function lr(e){"@babel/helpers - typeof";return lr=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},lr(e)}function kg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tl(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,mf(r.key),r)}}function Fg(e,t,n){return t&&tl(e.prototype,t),n&&tl(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ag(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&&qs(e,t)}function qs(e,t){return qs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},qs(e,t)}function Tg(e){var t=Sg();return function(){var r=Gi(e),i;if(t){var a=Gi(this).constructor;i=Reflect.construct(r,arguments,a)}else i=r.apply(this,arguments);return Bg(this,i)}}function Bg(e,t){if(t&&(lr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pr(e)}function Pr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Sg(){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 Gi(e){return Gi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Gi(e)}function jg(e,t,n){return t=mf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mf(e){var t=Pg(e,"string");return lr(t)==="symbol"?t:String(t)}function Pg(e,t){if(lr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(lr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var pi=x,xe=Qp,Og=Eg,Mg=Og.createFocusTrap,Ng=_g,Ig=Ng.isFocusable,Ao=function(e){Ag(n,e);var t=Tg(n);function n(r){var i;kg(this,n),i=t.call(this,r),jg(Pr(i),"getNodeForOption",function(o){var u,l=(u=this.internalOptions[o])!==null&&u!==void 0?u:this.originalOptions[o];if(typeof l=="function"){for(var d=arguments.length,h=new Array(d>1?d-1:0),m=1;m<d;m++)h[m-1]=arguments[m];l=l.apply(void 0,h)}if(l===!0&&(l=void 0),!l){if(l===void 0||l===!1)return l;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var p=l;if(typeof l=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(l),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),i.handleDeactivate=i.handleDeactivate.bind(Pr(i)),i.handlePostDeactivate=i.handlePostDeactivate.bind(Pr(i)),i.handleClickOutsideDeactivates=i.handleClickOutsideDeactivates.bind(Pr(i)),i.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:i.handleDeactivate,onPostDeactivate:i.handlePostDeactivate,clickOutsideDeactivates:i.handleClickOutsideDeactivates},i.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var a=r.focusTrapOptions;for(var s in a)if(Object.prototype.hasOwnProperty.call(a,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){i.originalOptions[s]=a[s];continue}i.internalOptions[s]=a[s]}return i.outsideClick=null,i.focusTrapElements=r.containerElements||[],i.updatePreviousElement(),i}return Fg(n,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var i=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return i||(i===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var i=this.getDocument();i&&(this.previouslyFocusedElement=i.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(i){var a=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,i):this.originalOptions.clickOutsideDeactivates;return a&&(this.outsideClick={target:i.target,allowDeactivation:a}),a}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var i=this,a=function(){var o=i.getReturnFocusNode(),u=!!(i.originalOptions.returnFocusOnDeactivate&&o!==null&&o!==void 0&&o.focus&&(!i.outsideClick||i.outsideClick.allowDeactivation&&!Ig(i.outsideClick.target,i.internalOptions.tabbableOptions))),l=i.internalOptions.preventScroll,d=l===void 0?!1:l;u&&o.focus({preventScroll:d}),i.originalOptions.onPostDeactivate&&i.originalOptions.onPostDeactivate.call(null),i.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(a,a):a()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var i=this.focusTrapElements.some(Boolean);i&&(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(i){if(this.focusTrap){i.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var a=!i.active&&this.props.active,s=i.active&&!this.props.active,o=!i.paused&&this.props.paused,u=i.paused&&!this.props.paused;if(a&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),u&&this.focusTrap.unpause()}else i.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 i=this,a=this.props.children?pi.Children.only(this.props.children):void 0;if(a){if(a.type&&a.type===pi.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(l){var d=i.props.containerElements;a&&(typeof a.ref=="function"?a.ref(l):a.ref&&(a.ref.current=l)),i.focusTrapElements=d||[l]},o=pi.cloneElement(a,{ref:s});return o}return null}}]),n}(pi.Component),kr=typeof Element>"u"?Function:Element;Ao.propTypes={active:xe.bool,paused:xe.bool,focusTrapOptions:xe.shape({document:xe.object,onActivate:xe.func,onPostActivate:xe.func,checkCanFocusTrap:xe.func,onPause:xe.func,onPostPause:xe.func,onUnpause:xe.func,onPostUnpause:xe.func,onDeactivate:xe.func,onPostDeactivate:xe.func,checkCanReturnFocus:xe.func,initialFocus:xe.oneOfType([xe.instanceOf(kr),xe.string,xe.bool,xe.func]),fallbackFocus:xe.oneOfType([xe.instanceOf(kr),xe.string,xe.func]),escapeDeactivates:xe.oneOfType([xe.bool,xe.func]),clickOutsideDeactivates:xe.oneOfType([xe.bool,xe.func]),returnFocusOnDeactivate:xe.bool,setReturnFocus:xe.oneOfType([xe.instanceOf(kr),xe.string,xe.bool,xe.func]),allowOutsideClick:xe.oneOfType([xe.bool,xe.func]),preventScroll:xe.bool,tabbableOptions:xe.shape({displayCheck:xe.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:xe.oneOfType([xe.bool,xe.func])}),trapStack:xe.array,isKeyForward:xe.func,isKeyBackward:xe.func}),containerElements:xe.arrayOf(xe.instanceOf(kr)),children:xe.oneOfType([xe.element,xe.instanceOf(kr)])};Ao.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:Mg};var Rg=Ao;const $g=$n(Rg);const ln=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:i=()=>{},onClose:a=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:u,buttons:l,className:d="",gtmContext:h="Modal"})=>{const m=ie.useIntl(),{registerOverlay:p,unregisterOverlay:g}=Kd(),[f,b]=x.useState(t),[v,y]=x.useState(null),C=x.useRef(null),k=P=>{f&&P.key==="Escape"&&B(!1)},D=P=>{y(P.target)},_=P=>{v===C.current&&P.target===C.current&&B(!1),y(null)};x.useEffect(()=>{if(f)return window.addEventListener("keyup",k),()=>{window.removeEventListener("keyup",k)}},[f]),x.useEffect(()=>{const P=C.current;return P&&(P.addEventListener("mousedown",D),P.addEventListener("mouseup",_)),()=>{P&&(P.removeEventListener("mousedown",D),P.removeEventListener("mouseup",_))}},[v]);const B=P=>{if(b(P),P)i(),p(e);else{if(f===P)return;a(),g(e)}};x.useEffect(()=>(B(t),()=>{f&&g(e)}),[t]);const M=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:C,className:K("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(ko,{id:e,className:K("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:M,children:t&&c.jsx($g,{containerElements:[C.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(we,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>B(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":h,screenreaderText:m.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(zt,{}),u,l&&c.jsxs("div",{className:"bottom",children:[c.jsx(zt,{}),c.jsx(vr,{buttons:l})]}),s&&c.jsx(ur,{className:"error",children:s})]})})})})},hf=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Fr="joinCommunityButton",To=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:i,leave:a}={join:()=>{},leave:()=>{}}})=>{const s=ie.useIntl(),o=x.useContext(rt),u=o&&typeof o.id=="string",l=r||!u,[d,h]=x.useState(e),[m,p]=x.useState(e?"joined":"notJoined");x.useEffect(()=>{m==="joining"?p("joined"):m==="leaving"&&p("notJoined")},[d]);const g={},f={};return d&&m!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${Fr}_leave`}),g["aria-label"]=s.formatMessage({id:`${Fr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(we,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&m!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${Fr}_closed_tooltip`}):"",onClick:async b=>{if(l)return;b.currentTarget.blur(),p(d?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${Fr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(v);const y=d?a:i;typeof y=="function"&&setTimeout(async()=>{await y()},500),h(!d)},className:K("join-community-button",m,{active:m==="joining"}),disabled:l,"data-testid":"join-button",...g,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${Fr}${["joining","leaving"].includes(m)?`_${m}`:d?"_member":n?"_short":""}`})})})};const qa="communityDetails_",Lg=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:i=0,data:a=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const u=ie.useIntl(),{id:l}=x.useContext(rt),d=l,h=5,m=i||a.length,p=a.length?a:Array(h).fill({}),g=`/communities/${r}/members`===window.location.pathname,f=t||n,b=!n&&!t;return c.jsxs("div",{className:K("community-details",e),children:[f?c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[u.formatMessage({id:`${qa}members`}),c.jsx("span",{className:"count",children:m})]}),g?c.jsx(c.Fragment,{}):c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:u.formatMessage({id:`${qa}viewAll`})})})]}),d&&c.jsx(_o,{contributors:{total:i,data:p},styling:{size:"medium",showGap:!0,showPlaceholders:m===0},cutoff:h})]}):c.jsx(c.Fragment,{}),d?c.jsxs(c.Fragment,{children:[c.jsx(To,{isMember:t,isOpen:n,disabled:b,functions:{...o}}),t&&c.jsx(we,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:u.formatMessage({id:`${qa}invite`})})]}):c.jsx(c.Fragment,{})]})};const Zr=({icon:e,className:t="",children:n,shortText:r,...i})=>{const a={};return r&&(a["data-short-text"]=r),c.jsx(we,{className:K("action-button",t),variant:"tertiary",size:{mobile:"small",769:"medium"},icon:e,...i,...a,children:c.jsx("span",{className:"inner-text",children:n})})},zg="reply",yn="00000000-0000-0000-0000-000000000000",Bo="en";function So({queryClient:e,queryKey:t}){function n(r,i,a){e.setQueryData(t,a)}return n}function jo({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const i=e.getQueryData(t);return e.setQueryData(t,r),i}return n}var yr=(e=>(e.Post="post",e.Poll="poll",e))(yr||{});const vt="poll-vote",pf=(e,t="en")=>{var r;return e.verb!==yr.Poll?[]:(((r=e==null?void 0:e.latest_reactions)==null?void 0:r["poll-option"])||[]).map(i=>{var o,u,l,d,h;const a=((o=i==null?void 0:i.own_children)==null?void 0:o["poll-vote"])||[],s=((u=i.data)==null?void 0:u.description)||{[t]:""};return{id:i.id,label:s[t],numVotes:((l=i==null?void 0:i.children_counts)==null?void 0:l["poll-vote"])||0,hasUserVoted:a.length>0,userVote:{id:(d=a[0])==null?void 0:d.id},position:((h=i.data)==null?void 0:h.position)||0}}).sort((i,a)=>i.position-a.position)};function gf({activity:e,reactionId:t,user:n}){var a;const r=n==null?void 0:n.id;if(!r)return;const i=(a=e.latest_reactions)==null?void 0:a["poll-option"];if(i){for(const s of i)if(s.id===t){const o={id:yn,activity_id:e.id,kind:vt,data:{},created_at:new Date().toISOString(),updated_at:new Date().toISOString(),user_id:r,parent:s.id,latest_children:{},own_children:{},children_counts:{}};s.latest_children=s.latest_children||{},s.latest_children[vt]=s.latest_children[vt]||[],s.latest_children[vt].push(o),s.own_children=s.own_children||{},s.own_children[vt]=s.own_children[vt]||[],s.own_children[vt].push(o),s.children_counts=s.children_counts||{},s.children_counts[vt]=(s.children_counts[vt]||0)+1;break}}}function vf({activity:e,reactionId:t,correctReactionId:n,user:r}){var i;(i=e.latest_reactions)==null||i["poll-option"].forEach(a=>{var s;a.id===t&&(a.latest_children[vt].forEach(o=>{o.id===yn&&o.user_id===(r==null?void 0:r.id)&&(o.id=n)}),(s=a.own_children)==null||s[vt].forEach(o=>{o.id===yn&&o.user_id===(r==null?void 0:r.id)&&(o.id=n)}))})}function bf({activity:e,reactionId:t}){var r,i,a;const n=(r=e.latest_reactions)==null?void 0:r["poll-option"];if(n)for(const s of n){const o=(i=s.own_children)==null?void 0:i[vt],u=(a=s.latest_children)==null?void 0:a[vt];if(u){const l=u.findIndex(d=>d.id===t);l!==-1&&(u.splice(l,1),s.children_counts[vt]--)}if(o){const l=o.findIndex(d=>d.id===t);l!==-1&&o.splice(l,1)}}}function qg({id:e,position:t,description:n},r){if(r!=null&&r.id)return{created_at:new Date().toISOString(),updated_at:new Date().toISOString(),id:e||yn,kind:"poll-option",data:{description:n,position:t},parent:""}}function Ug(){return{latest_reactions:{like:[],reply:[],"poll-option":[]},reaction_counts:{like:0,reply:0,"poll-option":0},own_reactions:{like:[],reply:[],"poll-option":[]}}}function Wg(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Vg(e,t){const n=e.map(r=>qg(r,t));return{latest_reactions:{like:[],reply:[],"poll-option":n},reaction_counts:{like:0,reply:0,"poll-option":0},own_reactions:{like:[],reply:[],"poll-option":[]}}}function Po(e){const{id:t="",name:n="",organization:r="",jobTitle:i="",image:a={}}=e,{thumbnail:s=""}=a;return{id:t,data:{name:n,organization:r,jobTitle:i,thumbnail:s}}}function Hg({title:e,content:t,categories:n}){const r=[];return n&&!["no-category",""].includes(n)&&r.push(n),{title:e,content:t,categories:r,id:yn,time:new Date().toISOString(),verb:yr.Post}}function nl({title:e,options:t,settings:n,user:r,correctActivityId:i}){return{title:e,content:"",id:i||yn,time:new Date().toISOString(),verb:yr.Poll}}function rl({activity:e,user:t}){return{...e,actor:Po(t),...Ug()}}function il({activity:e,options:t,user:n}){return{...e,actor:Po(n),...Vg(t,n)}}function Qi({activity:e,reaction:t}){var n,r,i;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:[...((i=e.own_reactions)==null?void 0:i.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function yf({activity:e,user:t}){var n,r,i;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:a})=>a!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((i=e.own_reactions)==null?void 0:i.like)||[]).filter(({user_id:a})=>a!==t.id)})}function Ji({activity:e,reaction:t}){var n,r,i;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:[...((i=e.own_reactions)==null?void 0:i.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function xf({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 Kg(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function Zg(e,t,n){const r=t.pages.length-1,i=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[i]=e:t.pages[r].results.push(e),t}function Yg(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 cr(e,t,n){return t?n!=null&&n.append?Zg(e,t,n):Yg(e,t,n):Kg(e)}function wt(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:i})=>i===e);if(r)return r}}function wf(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:i})=>i===e);if(r!==-1){n.splice(r,1);break}}return t}function Oo(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],[]))||[]}function Gg({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:yn,kind:zg,parent:t||""}}function al({reply:e,user:t}){const n=Po(t);return{...e,user_id:n.id,user:n,...Wg()}}function sl({reply:e,reaction:t}){var n,r,i;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:[...((i=e.own_children)==null?void 0:i.like)||[],t]}):e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like+1:1}}function Qg({reply:e,user:t}){var n,r,i;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:a})=>a!==t.id)},e.own_children={...e.own_children||{},like:(((i=e.own_children)==null?void 0:i.like)||[]).filter(({user_id:a})=>a!==t.id)})}const Mo=(e,t)=>{const n=new CustomEvent(it.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let ol,Ua=0;const Cf=()=>{x.useEffect(()=>(document.addEventListener(it.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(it.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(ol);const i=document.getElementById(n);if(i){i.scrollIntoView({behavior:"smooth",block:"start"}),Ua=0;return}Ua++,!(Ua>10)&&(ol=setTimeout(()=>{e(t)},50))}};var Te=(e=>(e.Answer="answer",e.Poll="poll",e.Post="post",e.Response="response",e.Reply="reply",e.Question="question",e))(Te||{});const dr=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}),Jt=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}),No=Object.freeze({actor:`SU:${dr.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"}),Jg=Object.freeze({actor:`SU:${Jt.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"}),Xg=Object.freeze({actor:`SU:${dr.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"}),ev=Object.freeze({actor:`SU:${Jt.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:No.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Jt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Jt.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:No.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Jt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Jt.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:Jt.id,user:{id:Jt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:No.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:dr.id,user:{id:dr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Jg.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:Jt.id,user:{id:Jt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Xg.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:dr.id,user:{id:dr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:ev.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});const tv=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),nv=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);function rv(e){return x.useCallback(t=>{var s,o,u,l;if(!t||!["ArrowUp","ArrowDown"].includes(t.key||""))return;t.stopPropagation(),t.preventDefault();const n=t.key==="ArrowUp"?"up":"down",r=(s=t.currentTarget)==null?void 0:s.parentElement;let i=r==null?void 0:r.nextElementSibling;if(n==="up"){const d=r==null?void 0:r.previousElementSibling;d?i=d:(i=(o=r==null?void 0:r.parentElement)==null?void 0:o.lastElementChild,(i==null?void 0:i.getAttribute("data-index"))==="-1"&&(i=i==null?void 0:i.previousElementSibling))}else(!i||(i==null?void 0:i.getAttribute("data-index"))==="-1")&&(i=(u=r==null?void 0:r.parentElement)==null?void 0:u.firstElementChild);if(!i)return;const a=Number((i==null?void 0:i.getAttribute("data-index"))||"0");e([{type:"tabbableLink",value:a}]),(l=i==null?void 0:i.querySelector("a,button"))==null||l.focus()},[e])}const iv=x.lazy(()=>Promise.resolve().then(()=>Iv));let Ir=!1;const Wa=()=>{Ir!==!1&&(clearTimeout(Ir),Ir=!1)},av=5;let Va=null;const Df=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:i=!1,content:a={type:Te.Reply,slugs:{}},canLike:s=!0,activityId:o,basePath:u,parentId:l,functions:{createLike:d=()=>{},deleteLike:h=()=>{},listLikes:m=async()=>({next:"",results:[]})}})=>{const p=ie.useIntl(),g={numberOfLikes:t,userLikedContent:i,ignoreInteractions:!1,showLikers:!1,tabbableLink:0,showLikesModal:!1},[f,b]=x.useReducer(pr,g),{numberOfLikes:v,userLikedContent:y,ignoreInteractions:C,showLikers:k,tabbableLink:D,showLikesModal:_}=f,B=rv(b);x.useEffect(()=>{b([{type:"userLikedContent",value:i}])},[i]);const M=x.useMemo(()=>nv(n,av),[n]),P=F=>{if(F.preventDefault(),F.stopPropagation(),b([{type:"showLikers",value:!1}]),Ir)return Wa(),!1;if(Wa(),C||!s)return!1;Ir=setTimeout(z,350)},z=async()=>{if(Wa(),C||!s)return!1;let F=y?v-1:v+1;F<0&&(F=0),b([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:F},{type:"userLikedContent",value:!y}]);try{if(a&&a.slugs){const S=tv(a.slugs);y?await h(S):await d({...S,payload:{contentPath:window.location.pathname}})}}catch{b([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:i}])}finally{b([{type:"ignoreInteractions",value:!1}])}},O=()=>{Va=setTimeout(()=>{b([{type:"showLikers",value:!1}])},500)},A=()=>{Va&&clearTimeout(Va)};return x.createElement(e,{className:"likes-wrapper",onKeyDown:F=>{F.key==="Escape"&&b([{type:"showLikers",value:!1}])},onMouseEnter:()=>{A(),b([{type:"showLikers",value:!0}])},onMouseLeave:()=>{O()}},c.jsxs(c.Fragment,{children:[c.jsx(Zr,{className:K("discussion-button text-medium action-button likes-button",{"show-spinner":C,"is-liked":y,disabled:!s}),icon:{icon:y?"heart":"heart_empty",animate:"bounce"},shortText:`${v}`,disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${a.type}-click`,onClick:P,screenreaderText:s?p.formatMessage({id:`discussion_likes_${y?"unlike":"like"}`},{action:p.formatMessage({id:`discussion_action_${a.type}`})}):!1,"aria-pressed":y,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:p.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:v})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Oe,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{A()},onBlur:()=>O,onClick:F=>{var I;F.preventDefault(),F.stopPropagation(),A(),b([{type:"showLikers",value:!0}]);const S=(I=F.currentTarget.nextSibling)==null?void 0:I.childNodes[0];if(S){const H=S.querySelector("li:first-child a");H&&(b([{type:"tabbableLink",value:0}]),setTimeout(()=>{H.focus()},100))}},onKeyDown:F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),O())},"aria-expanded":k,"aria-controls":`likes-tooltip-${a.slug}`,children:c.jsx(Oe,{showOnFocus:!1,children:p.formatMessage({id:"discussion_likes_show"},{action:a.type})})}),c.jsx(Ln,{id:`likes-tooltip-${a.slug}`,isOpen:k,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[M.map((F,S)=>{if(typeof F=="string")return null;const I={};return D!==S&&(I.tabIndex=-1),c.jsx("li",{"data-index":S,children:c.jsx(Dn,{href:F.id?`/profiles/${F.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onFocus:()=>A(),onKeyDown:B,...I,children:F.name?F.name:c.jsx("span",{className:"deleted-user",children:p.formatMessage({id:"member_deleted"})})})},F.id||window.btoa(F.name||""))}),c.jsx("li",{"data-index":M.length,className:"show-all",children:c.jsx(we,{variant:"tertiary",size:{mobile:"small",769:"medium"},onClick:()=>{A(),O(),b([{type:"showLikesModal",value:!0}])},onKeyDown:B,children:p.formatMessage({id:"discussion_likes_showAll"})})})]})}),_&&c.jsx(br,{children:c.jsx(x.Suspense,{children:c.jsx(iv,{activityId:o,basePath:u,parentId:l,likeCount:t,showModal:_,functions:{onClose:()=>b([{type:"showLikesModal",value:!1}]),likes:{list:m}}})})})]})]}))},Us=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},xr=e=>{var t,n,r,i,a,s;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:(i=e==null?void 0:e.data)==null?void 0:i.location,image:{thumbnail:((a=e==null?void 0:e.data)==null?void 0:a.thumbnail)||void 0},badges:(s=e==null?void 0:e.data)==null?void 0:s.badges}:"deleted"};function sv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=Re.useMutation({mutationFn:e,onMutate:o=>t(u=>{const l=rl({activity:Hg(o),user:a});return cr(l,u)}),onError:n,onSuccess:(o,u,l)=>{const d=rl({activity:o,user:a});r.setQueryData(i,cr(d,l,{replace:!0})),setTimeout(()=>{Mo(d.id,"activity")},0)}});return s}function ov({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutateAsync:s}=Re.useMutation({mutationFn:e,onMutate:({options:o,title:u,settings:l})=>t(d=>{const h=il({activity:nl({title:u,options:o,settings:l,user:a}),options:o,user:a});return cr(h,d)}),onError:(o,u,l)=>{const d=h=>{const m=h.pages;return m.forEach(p=>{p.results=p.results.filter(g=>g.id!==yn)}),{...h,pages:m}};r.setQueryData(i,h=>d(h)),n&&n(o,u,l)},onSuccess:async(o,{options:u,title:l,settings:d},h)=>{const m=o,p=il({activity:nl({title:l,options:u,settings:d,user:a,correctActivityId:m.body.id}),options:u.map((g,f)=>({...g,id:m.body.options[f]})),user:a});r.setQueryData(i,cr(p,h,{replace:!0})),setTimeout(()=>{Mo(m.body.id,"activity")},0)}});return s}function uv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=Re.useMutation({mutationFn:e,onMutate:({activityId:o,reactionId:u})=>t(l=>{const d=wt(o,l);return d&&gf({activity:d,reactionId:u,user:a}),l}),onError:n,onSuccess:(o,{activityId:u,reactionId:l},d)=>{const h=wt(u,d);h&&vf({activity:h,reactionId:l,correctReactionId:o.body.id,user:a}),r.setQueryData(i,d)}});return s}function lv({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Re.useMutation({mutationFn:e,onMutate:({activityId:i,content:a})=>t(s=>{const o=wt(i,s);return o&&(o.content=a),s}),onError:n});return r}function cv({queryFns:{create:e,edit:t,like:n,list:r,remove:i,unlike:a,pin:s,unpin:o,createVote:u,createPoll:l,removeVote:d,removePoll:h},queryKey:m,filterOption:p}){const g=Re.useQueryClient(),f=pa(),b={queryClient:g,queryKey:m},v={mutationHandlers:{error:So(b),mutate:jo(b)},user:f,...b},y=sv({...v,mutationFn:e}),C=lv({...v,mutationFn:t}),k=dv({...v,mutationFn:n}),D=ul({...v,mutationFn:i}),_=pv({...v,mutationFn:a}),B=mv({...v,mutationFn:s}),M=gv({...v,mutationFn:o}),P=uv({...v,mutationFn:u}),z=ov({...v,mutationFn:l}),O=hv({...v,mutationFn:d}),A=ul({...v,mutationFn:h}),{activities:F,...S}=fv({queryKey:m,queryFn:r,filterOption:p});return{activities:F,mutations:{create:y,edit:C,remove:D,like:k,unlike:_,pin:B,unpin:M,createVote:P,createPoll:z,removeVote:O,removePoll:A},user:f,...S}}function dv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Re.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const u=wt(s,o);return u&&Qi({activity:u}),o}),onError:n,onSuccess:(s,{activityId:o},u)=>{const l=wt(o,u);l&&Qi({activity:l,reaction:s}),r.setQueryData(i,u)}});return a}function fv({queryFn:e,queryKey:t,filterOption:n}){const{data:r,error:i,isLoading:a,hasNextPage:s,fetchNextPage:o}=Re.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`${n==null?void 0:n.type}=${n==null?void 0:n.id}`,getNextPageParam:u=>u!=null&&u.next?`${u==null?void 0:u.next}&${n==null?void 0:n.type}=${n==null?void 0:n.id}`:null});return{activities:Oo(r),error:i,isLoading:a,hasNextPage:s,fetchNextPage:o}}function mv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Re.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const u=wt(s,o);return u&&Ji({activity:u}),o}),onError:n,onSuccess:(s,{activityId:o},u)=>{const l=wt(o,u);l&&Ji({activity:l,reaction:s}),r.setQueryData(i,u)}});return a}function ul({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Re.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(a=>wf(i,a)),onError:n});return r}function hv({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:({activityId:a,reactionId:s})=>t(o=>{const u=wt(a,o);return u&&bf({activity:u,reactionId:s}),o}),onError:n});return i}function pv({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(s=>{const o=wt(a,s);return o&&yf({activity:o,user:r}),s}),onError:n});return i}function gv({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(s=>{const o=wt(a,s);return o&&xf({activity:o,user:r}),s}),onError:n});return i}const vv=280,Io=async(e,t,n,r=()=>Promise.resolve([]))=>{let i=t?sr(e,typeof t=="number"?t:vv):e;i=i.trim();const a=`<br>
63
63
 
64
- `;return i.slice(0,a.length)===a&&(i=i.slice(a.length)),n?await Pd({text:i,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):i},Ro=(e,t)=>t.length===0||e.length===0?[]:e.map(n=>t.find(r=>r.slug===n)).filter(n=>n!==void 0),bv=(e,t,n)=>{let r=!1;function i(a){let s=30;for(;a||s<=0;){if(t.some(o=>Array.from(a==null?void 0:a.classList).includes(o))){r=!0;break}if(Array.from(a==null?void 0:a.classList).includes(n))break;a=a.parentElement,s--}}return i(e.target),r},yv=(e,t)=>e?typeof e=="string"?e:e[t]:"";const xv=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:i,functions:{activities:a,form:s,join:o,leave:u,likes:l,polls:d},profile:m,locale:h=Bo})=>{const p=ie.useIntl(),[g,f]=x.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[b,v]=x.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),y={...a,...d},{activities:C,error:k,fetchNextPage:D,hasNextPage:_,isLoading:B,mutations:{create:P,edit:N,remove:z,like:O,unlike:A,pin:F,unpin:S,createPoll:I,createVote:H,removeVote:V,removePoll:ae}}=cv({queryKey:[e,t,"activities",g],queryFns:y,filterOption:g[0]});x.useEffect(()=>{i&&v(b.concat(i==null?void 0:i.map(({slug:q,name:T})=>({id:q,text:T,type:"category"}))))},[i]);const[ne,E]=x.useState(null),Y=()=>{E(C.length),D()};return Cf(),k?c.jsx(Qt,{variant:"error",text:k.message}):c.jsxs("section",{className:"activities-feed",children:[c.jsx(bu,{isCard:!0,parentId:t,categories:i,form:{content:{type:yr.Post,slugs:{}},functions:{create:P,createPoll:I,...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:u,notMemberStateText:p.formatMessage({id:"community_joinToPost"})}}),c.jsx(Bf,{className:"activities-feed-filtering",options:b.map(({id:q,text:T})=>({id:q,text:p.formatMessage({id:`activitiesFeed_rankingMethod_${T}`,defaultMessage:T})})),defaultOptions:g.map(({id:q,text:T})=>({id:q,text:p.formatMessage({id:`activitiesFeed_rankingMethod_${T}`,defaultMessage:T})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:q,previous:T})=>{if(q[0]===T[0])return;f([b.find(M=>M.id===q[0])]);const j=b.find(M=>M.id===q[0]);if(!j)return;const R=new CustomEvent("ariaLive",{detail:{message:p.formatMessage({id:"community_sortSuccess"},{order:p.formatMessage({id:`activitiesFeed_rankingMethod_${j.text}`,defaultMessage:j.text})})}});document.dispatchEvent(R)},gtm:{context:"activitiesFeed_sorting"}}),C==null?void 0:C.map((q,T)=>{var ye,_e,De,ze,We,He,Ke,Be,Me;const{id:j,own_reactions:R,latest_reactions:M,reaction_counts:U,mentioned_users:X,total_replies:W,additional_data:te}=q,de=(((ye=M==null?void 0:M.like)==null?void 0:ye.length)||0)>0,J=(((_e=R==null?void 0:R.like)==null?void 0:_e.length)||0)>0,ve=J?R==null?void 0:R.like[0].id:"",me=de?(De=M==null?void 0:M.like)==null?void 0:De.map(Ce=>{var G,se,be;return{id:(G=Ce==null?void 0:Ce.user)==null?void 0:G.id,name:(be=(se=Ce==null?void 0:Ce.user)==null?void 0:se.data)==null?void 0:be.name}}):!1;return c.jsx(x.Fragment,{children:c.jsx(ui,{content:{type:q.verb,title:q==null?void 0:q.title,body:q==null?void 0:q.content,createdAt:(q==null?void 0:q.time)||"",slugs:{question:`${e}/${t}`,answer:j},slug:j,author:xr(q==null?void 0:q.actor),userLiked:J,likes:(U==null?void 0:U.like)||0,comments:W||0,peopleWhoLiked:me,data:{mentions:X,...te||{}},pinned:(U==null?void 0:U.pin)&&(U==null?void 0:U.pin)>0||!1,categories:Ro((q==null?void 0:q.categories)||[],i||[]),pollOptions:pf(q,h),pollSettings:{showRemoveVote:(ze=q==null?void 0:q.settings)==null?void 0:ze.show_remove_vote,allowMultipleVotes:(We=q==null?void 0:q.settings)==null?void 0:We.allow_multiple_votes,deadlineAt:(He=q==null?void 0:q.settings)==null?void 0:He.deadline_at,hideParticipants:(Ke=q==null?void 0:q.settings)==null?void 0:Ke.hide_participants,numberOfWinners:(Be=q==null?void 0:q.settings)==null?void 0:Be.number_of_winners,resultsVisibility:(Me=q==null?void 0:q.settings)==null?void 0:Me.results_visibility}},links:{post:`${e}/${t}/${j}`,comments:`${e}/${t}/${j}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>z({activityId:j}),updateContent:(Ce,{body:G})=>N({activityId:j,content:G})},likes:{createLike:()=>O({activityId:j}),deleteLike:()=>A({activityId:j,reactionId:ve}),listLikes:Ce=>l.list({activityId:j,...Ce})},comments:{openComments:()=>null},pins:{createPin:()=>F({activityId:j}),deletePin:()=>S({activityId:j,reactionId:M==null?void 0:M.pin[0].id})},polls:{createVote:({reactionId:Ce})=>H({activityId:j,reactionId:Ce}),removeVote:({reactionId:Ce})=>V({activityId:j,reactionId:Ce}),removePoll:()=>ae({activityId:j})},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:T===ne,userHasOwnerPermissions:r,userHasPermissions:n,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:t||""},{scope:ut.Platform,area:"all"}]},basePath:e,parentId:t})},j)}),!B&&c.jsx(ii,{hasNextPage:_,loadNextPage:Y,icon:{icon:"arrow-down",position:"right"},messages:{button:p.formatMessage({id:"loadMore_button"}),error:p.formatMessage({id:"loadMore_error"})}}),C.length===0&&!B&&c.jsx(_t,{className:"no-activities",variant:"muted",icon:"text--input",children:g[0].type==="category"?c.jsx("p",{children:p.formatMessage({id:"activitiesFeed_noActivities_inCategories"})}):c.jsxs(c.Fragment,{children:[c.jsx("p",{children:p.formatMessage({id:"activitiesFeed_noActivities"})}),c.jsx("p",{children:c.jsx(we,{variant:"secondary",size:"small",href:"/communities",children:p.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),c.jsx(yu,{form:m})]})},wv={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",badges:{communities:{"community-slug":["orange-badge","badge-with-heart"]}}}},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 Cv({parentId:e,isMember:t,formFunctions:n,leave:r,join:i}){const a=ie.useIntl();return c.jsx(bu,{form:{content:{type:Te.Reply,slugs:{}},functions:n,meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:a.formatMessage({id:"discussion_responses_placeholder"})},parentId:e,membershipRequiredToPost:{isMember:t,required:!0,join:i,leave:r,notMemberStateText:a.formatMessage({id:"community_joinToPost"})}})}function Dv({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const i=ie.useIntl(),a=()=>{n(r),t()};return c.jsx(ii,{hasNextPage:e,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},messages:{button:i.formatMessage({id:"loadMore_button"}),error:i.formatMessage({id:"loadMore_error"})}})}function Ev({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=Re.useMutation({mutationFn:e,onMutate:o=>t(u=>{const l=al({reply:Gg(o),user:a});return cr(l,u,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,u,l)=>{const d=al({reply:o,user:a});r.setQueryData(i,cr(d,l,{replace:!0,append:(u==null?void 0:u.replyId)!==void 0})),setTimeout(()=>{Mo(d.id,"reply")},0)}});return s}function _v({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Re.useMutation({mutationFn:e,onMutate:({replyId:i,content:a})=>t(s=>{const o=wt(i,s);return o&&(o.data.content=a),s}),onError:n});return r}function kv({replies:e,user:t}){return!e||!(t!=null&&t.id)?[]:e.map(({id:n,own_children:r,latest_children:i,children_counts:a,data:s,created_at:o,parent:u,...l})=>{var f,b,v,y;const d=(((f=r==null?void 0:r.like)==null?void 0:f.length)||0)>0,m=(((b=i==null?void 0:i.like)==null?void 0:b.length)||0)>0,h=d?(v=r==null?void 0:r.like)==null?void 0:v.find(C=>{var k;return((k=C==null?void 0:C.user)==null?void 0:k.id)===(t==null?void 0:t.id)}):!1,p=typeof h=="object"?(h==null?void 0:h.id)??"":"",g=m?(y=i==null?void 0:i.like)==null?void 0:y.map(C=>{var k,D,_;return{id:(k=C==null?void 0:C.user)==null?void 0:k.id,name:(_=(D=C==null?void 0:C.user)==null?void 0:D.data)==null?void 0:_.name}}):!1;return{user:l==null?void 0:l.user,body:Av(s),createdAt:o,data:Fv(s),likeId:p,liked:m,likes:(a==null?void 0:a.like)||0,peopleWhoLiked:g,replyId:n,parent:u,userLiked:!!h}})}function Fv(e){if(!e||!e.mentioned_users)return{};const t=e==null?void 0:e.mentioned_users,n=(e==null?void 0:e.additional_data)||{};return{mentions:t,...n}}function Av(e){var t;return e?typeof e.content=="string"?e.content:((t=e==null?void 0:e.content)==null?void 0:t.text)||"":""}function Ef({queryFns:{create:e,edit:t,like:n,list:r,remove:i,unlike:a},queryKey:s}){const o=Re.useQueryClient(),u=pa(),l={queryClient:o,queryKey:s},d={mutationHandlers:{error:So(l),mutate:jo(l)},user:u,...l},m=Ev({...d,mutationFn:e}),h=_v({...d,mutationFn:t}),p=Tv({...d,mutationFn:n}),g=Sv({...d,mutationFn:i}),f=jv({...d,mutationFn:a}),{replies:b,...v}=Bv({queryKey:s,queryFn:r});return{replies:kv({replies:b,user:u}),mutations:{create:m,edit:h,remove:g,like:p,unlike:f},user:u,...v}}function Tv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Re.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const u=wt(s,o);return u&&sl({reply:u}),o}),onError:n,onSuccess:(s,{replyId:o},u)=>{const l=wt(o,u);l&&sl({reply:l,reaction:s}),r.setQueryData(i,u)}});return a}function Bv({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}=Re.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:Oo(n),error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}}function Sv({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Re.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(a=>wf(i,a)),onError:n});return r}function jv({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(s=>{const o=wt(a,s);return o&&Qg({reply:o,user:r}),s}),onError:n});return i}const Pv=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:i,functions:{reactions:a,form:s,likes:o}})=>{const u=ie.useIntl(),l=3,{replies:d,fetchNextPage:m,hasNextPage:h,isLoading:p,mutations:{create:g,edit:f,like:b,remove:v,unlike:y}}=Ef({queryKey:[t,r,e,i,"replies"],queryFns:{...a,list:D=>a.list({...D,reactionId:i})}});po([p]);const[C,k]=x.useState(!0);return c.jsxs(c.Fragment,{children:[(d==null?void 0:d.length)>=l&&c.jsx(we,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-${C?"up_left":"down_right"}`,position:"left"},onClick:()=>k(!C),children:u.formatMessage({id:`discussion_thread_${C?"hide":"show"}`},{count:d==null?void 0:d.length})}),C&&c.jsx(_h,{loadMore:{isLoading:p,hasNextPage:h,loadNextPage:()=>m()},form:{parentId:r,content:{type:Te.Reply,slugs:{question:`${t}/${r}`,answer:e,reply:i}},functions:{create:(D,{body:_})=>g({activityId:e,replyId:i,content:_}),...s},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:d&&d.length>0?d==null?void 0:d.map(({replyId:D,likes:_,data:B,body:P,createdAt:N,userLiked:z,peopleWhoLiked:O,parent:A,user:F,likeId:S})=>c.jsx(ui,{isCommunity:!0,content:{id:D,type:Te.Reply,body:P,createdAt:N,slugs:{question:`${t}/${r}`,answer:e,reply:A},slug:"",author:xr(F),userLiked:z,likes:_,peopleWhoLiked:O,data:B},userHasPermissions:n,functions:{content:{createContent:()=>null,deleteContent:()=>v({replyId:D}),updateContent:(I,{body:H})=>f({replyId:D,content:H})},likes:{createLike:()=>b({replyId:D}),deleteLike:()=>y({replyId:D,reactionId:S}),listLikes:I=>o.list({replyId:D,...I})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:r||""},{scope:ut.Platform,area:"all"}]},basePath:t,parentId:r},D)):null})]})};function Ov({formFns:e,activityId:t,basePath:n,focus:r,isMember:i,parentId:a,reply:s}){const{body:o,data:u,likeId:l,likes:d,peopleWhoLiked:m,replyId:h,createdAt:p,user:g,userLiked:f}=s,{edit:b,like:v,remove:y,unlike:C}=e.mutations;return c.jsx(wh,{children:c.jsx(ui,{isCommunity:!0,content:{id:h,type:Te.Reply,body:o,createdAt:p,slugs:{question:`${n}/${a}`,answer:t,reply:h},slug:h,author:xr(g),userLiked:f,likes:d,peopleWhoLiked:m,data:u},userHasPermissions:i,functions:{content:{createContent:()=>null,deleteContent:()=>y({replyId:h}),updateContent:(k,{body:D})=>b({replyId:h,content:D})},likes:{createLike:()=>v({replyId:h}),deleteLike:()=>C({replyId:h,reactionId:l}),listLikes:k=>e.likes.list({replyId:h,...k})},comments:{},form:e.form},badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:a||""},{scope:ut.Platform,area:"all"}]},children:c.jsx(Pv,{basePath:n,parentId:a,activityId:t,replyId:h,isMember:i,functions:e}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:a},h)},h)}const _f=({activityId:e,basePath:t,parentId:n,activityTotalReplies:r,isMember:i,functions:{form:a,join:s,leave:o,likes:u,reactions:l},profile:d,showReplies:m})=>{const{fetchNextPage:h,hasNextPage:p,isLoading:g,replies:f,mutations:{create:b,remove:v,edit:y,like:C,unlike:k}}=Ef({queryKey:[t,n,e,"replies"],queryFns:l}),[D,_]=x.useState(null);po([g]),Cf();const B={create:(P,N)=>{const{body:z}=N;b({activityId:e,content:z})},...a};return c.jsxs("section",{className:"replies-feed",children:[c.jsx(Eh,{type:"comment",responses:r,isLoading:g}),m?c.jsxs(c.Fragment,{children:[c.jsx(Cv,{parentId:n,isMember:i,join:s,leave:o,formFunctions:B}),f==null?void 0:f.map((P,N)=>c.jsx(Ov,{activityId:e,basePath:t,focus:D===N,formFns:{form:a,likes:u,reactions:l,mutations:{remove:v,edit:y,like:C,unlike:k}},isMember:i,parentId:n,reply:P},P.replyId)),g?c.jsx(c.Fragment,{children:" "}):c.jsx(Dv,{hasNextPage:p,fetchNextPage:h,setFocusReplyIndex:_,totalReplies:f.length})]}):c.jsx(_t,{children:c.jsx(ie.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),c.jsx(yu,{form:d})]})};function Mv({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}=Re.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:d=>(d==null?void 0:d.next)||null}),u=Oo(n),l=`${u.length||0}${a?"+":""}`;return{likes:u,likesCount:l,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}}function Nv({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=Mv({queryKey:t,queryFn:e});return{likes:n,...r}}function kf({basePath:e,parentId:t,activityId:n,likeCount:r,functions:i}){const{likes:a,fetchNextPage:s,hasNextPage:o,refetch:u}=Nv({queryKey:[e,t,n,"likes"],queryFns:i.likes});x.useEffect(()=>{u()},[u]);const l=a.map(({user:d})=>d).map(d=>d?xr(d):void 0).filter(d=>d&&typeof d!="string");return c.jsx("section",{className:"likes-feed",children:c.jsx(xh,{members:{data:l,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&l.length<r,loadNextPage:s})})}const Ff=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:i,...a})=>{const s=ie.useIntl();return c.jsx(ln,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:K("profile-modal in-portal",i,{open:e}),maxWidth:600,children:c.jsx(kf,{...a,likeCount:r??0,functions:{likes:n}})})},Iv=Object.freeze(Object.defineProperty({__proto__:null,default:Ff},Symbol.toStringTag,{value:"Module"})),Rv={results:[{created_at:"2024-05-16T13:17:45.940899Z",updated_at:"2024-05-16T13:17:45.940899Z",id:"ab4b7ab0-f4fe-469f-a8e7-5a52b3e55333",user_id:"9ed21585-63be-4446-96ce-3e703820eb73",user:{id:"1234",data:{name:"Han Solo",thumbnail:"https://placehold.co/400x400",jobTitle:"Smuggler",organization:"Rebel Alliance",badges:{communities:{"endor-alumni":["blue-badge"]}}}},kind:"like",activity_id:"869e5a90-0eba-11ef-8080-80017b714aaf",data:{mentioned_users:null},parent:"",latest_children:{},children_counts:{}},{created_at:"2024-05-16T13:17:45.940899Z",updated_at:"2024-05-16T13:17:45.940899Z",id:"db4b7ab0-f4fe-469f-a8e7-5a52b3e55373",user_id:"9ed21585-63be-4446-96ce-3e703820eb73",user:{created_at:"2023-08-22T11:56:10.585365Z",updated_at:"2024-03-13T11:31:49.447916Z",id:"9ed21585-63be-4446-96ce-3e703820eb73",data:{jobTitle:"Admiral",name:"Princess Leia",organization:"Rebela Alliance",thumbnail:"https://placehold.co/400x400",badges:{platform:{all:["orange-badge"]}}}},kind:"pin",activity_id:"769e5a90-0eba-11ef-8080-80017b714aaf",data:{mentioned_users:null},parent:"",latest_children:{},children_counts:{}}],next:"xy12345"};const $v=3e3,Af=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ie.useIntl(),r="discussion_share_copy_link",[i,a]=x.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(Zr,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>a({...i,isOpen:!0}),onFocus:()=>a({...i,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});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{a({isOpen:!1,isCopied:!1})},$v)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,"data-testid":"share-link",screenreaderText:n.formatMessage({id:r})}),c.jsx(Ln,{className:K({copied:i.isCopied}),isOpen:i.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${i.isCopied?"_success":""}`})})]})};const Wn="discussion_",Tf=({className:e,gtmContext:t,contentType:n,likes:r,comments:i,replies:a,shareLink:s,moreMenu:o})=>{const u=ie.useIntl(),l=[];return o&&o.reportData&&l.push({text:u.formatMessage({id:`${Wn}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(u.formatMessage({id:`${Wn}report_subject`}))}&body=${encodeURI(u.formatMessage({id:`${Wn}report_body`},{contentType:n||"",contentSlug:o&&o.reportData&&o.contentSlug||"",contentUrl:o&&o.reportData&&o.reportData.contentUrl||""}))}`,icon:"flag"}),c.jsxs("ul",{className:K("actions text-medium",e),"data-testid":`${n}-actions`,children:[r?c.jsx(Df,{element:"li",likes:r.count,isShort:!1,userLiked:r.userLiked,content:{type:n,slugs:r.content.slugs,slug:r.content.slug},canLike:r.canLike,peopleWhoLiked:r.peopleWhoLiked,activityId:r.activityId,functions:r.functions,basePath:r.basePath||"",parentId:r.parentId||""}):c.jsx(c.Fragment,{}),i?c.jsx("li",{children:c.jsx(Zr,{shortText:`${i.count??0}`,onClick:d=>{d.preventDefault(),d.stopPropagation(),i.functions.onClick()},icon:{icon:"speech-bubble_square"},"data-testid":"comment","data-gtm-event-context":t,"data-gtm-event-type":`answer-${n}-click`,screenreaderText:u.formatMessage({id:`${Wn}comments_screenReader`},{count:i.count}),children:u.formatMessage({id:`${Wn}comments${i.count===null?"_loading":""}`},{count:i.count})})}):c.jsx(c.Fragment,{}),a?c.jsx("li",{children:c.jsx(Zr,{styling:{muted:!0},onClick:a.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",disabled:!a.canReply,children:u.formatMessage({id:`${Wn}reply`})})}):c.jsx(c.Fragment,{}),s?c.jsx(Af,{url:s.url,gtm:{context:t||"",event:`copy-link-${n}-click`}}):c.jsx(c.Fragment,{}),o?c.jsx(Xi,{element:"li",id:`more-${o.contentSlug}`,options:[...o.options||[],...l]}):c.jsx(c.Fragment,{})]})};const Lv=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Oe,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:K("breadcrumbs text-small",n),children:e.map(({text:i,href:a,current:s=!1},o)=>{const u={};return s&&(u["aria-current"]="location"),c.jsxs("li",{children:[s&&c.jsx(Oe,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(Dn,{href:s?void 0:a,...u,children:sr(i,t)})]},`${window.btoa(i)}_${o}`)})})]})};const $o=({variant:e="default",data:{image:t,url:n,title:r,description:i},onClick:a,gtm:s,...o})=>{if(!n)return c.jsx(c.Fragment,{});let u=n.split("//");u.length>1?u=u[1]:u=u[0],u=u.split("/"),u=u[0];const{context:l="EnrichedLink",event:d="enriched-link-click"}=s??{};return c.jsxs("aside",{className:K("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:m=>{if(m.preventDefault(),m.stopPropagation(),a){a(m);return}window.open(n,"_blank")},"data-gtm-event-context":l,"data-gtm-event-type":d,children:[c.jsx("small",{children:u}),c.jsx("p",{className:"title text-medium",children:c.jsx("a",{...o,href:n,target:"_blank",rel:"noreferrer",children:r})}),i&&e!=="condensed"?c.jsx("p",{className:"text-small",children:i}):c.jsx(c.Fragment,{}),t&&t.src?c.jsx("p",{className:"img",children:c.jsx("img",{src:t.src,alt:t.alt||"",loading:"lazy",fetchpriority:"low",width:t.width||"auto",height:t.height||"100%"})}):c.jsx(c.Fragment,{})]})};const Bf=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:i=()=>{},preventNoOptionSelected:a=!1,className:s="",gtm:o})=>{const u=ie.useIntl(),l=n?[{id:"all",text:typeof n!="boolean"&&n.text||u.formatMessage({id:"filters_all"})},...e]:e,[d,m]=x.useState(n?["all"]:t.length?t.map(f=>f.id):[]),[h,p]=x.useState(0),g=(f,b)=>{let v=[];d.includes(f)&&!a?v=d.filter(y=>y!==f):f==="all"?v=["all"]:r?v=[...d.filter(y=>y!=="all"),f]:v=[f],m(y=>(i&&typeof i=="function"&&i({current:v,previous:y}),v)),b&&typeof b=="function"&&b()};return c.jsx("ul",{className:K("filters",s),children:l.map(({id:f,text:b,disabled:v=!1,callback:y=()=>{}},C)=>{let k={tabIndex:h===C?0:-1};return v&&(k={disabled:!0,"aria-label":u.formatMessage({id:"filters_disabled"},{name:b})}),c.jsx("li",{children:c.jsx("button",{"data-gtm-event-context":(o==null?void 0:o.context)||"filters","data-gtm-event-type":(o==null?void 0:o.type)||`${b.toLowerCase().replace(" ","-")}-click`,className:K(f,{selected:d.includes(f)}),onClick:D=>{D.preventDefault(),D.stopPropagation(),g(f,y)},onKeyDown:D=>{var N,z;let _=C+1,B,P;switch(D.code){case"Enter":case"Space":D.preventDefault(),D.stopPropagation(),g(f,y);break;case"ArrowLeft":case"ArrowRight":D.preventDefault(),D.stopPropagation(),D.code==="ArrowLeft"?(_=C-1,_<0&&(_=l.length-1)):_>=l.length&&(_=0),p(_),B=D.currentTarget.closest("li"),P=(N=B==null?void 0:B.parentElement)==null?void 0:N.children[_],(z=P==null?void 0:P.querySelector("button"))==null||z.focus();break}},"aria-selected":d.includes(f),...k,children:b})},f)})})},zv=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let i="",a=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(i+=`/${s}`,a=!0):(i.includes(`/${r}/`)||(i+=`/${r}`),i+=`/${s}`)}),i.includes(`/${r}/`)||(i+=`/${r}`),t&&(i+=`/${t}`),a?{url:i,urlForRouter:`/${i.split("/").slice(2).join("/")}`}:i};const gi="languageSwitcher_",qv=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:i,urlParts:a,variant:s="default",label:o,className:u=""})=>{const l=ie.useIntl(),{updateLanguage:d=()=>{}}=x.useContext(xo),[m,h]=x.useState(e);if(x.useEffect(()=>{e!==m&&h(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:K("language-switcher text-small",s,u),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||l.formatMessage({id:`${gi}label`})}),c.jsx("ul",{children:g.map(b=>{var C;if(!Mi[b])return null;const v=(C=r[b])==null?void 0:C.post_name;let y={className:b};if(m===b)y["aria-label"]=l.formatMessage({id:`${gi}selected`},{language:Mi[b]});else{const k=zv(b,v,a);y={...y,href:typeof k=="string"?k:k.url,onClick:D=>{h(b),d(b),typeof i<"u"&&(D.preventDefault(),D.stopPropagation(),i(b,typeof k=="string"?k:k.urlForRouter))}}}return c.jsx("li",{children:c.jsx(Dn,{...y,fallbackElement:"span",children:Mi[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:l.formatMessage({id:`${gi}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:l.formatMessage({id:`${gi}disclaimer`},{email:Qn.support,link:b=>{const v=`mailto:${b}`;return c.jsx("a",{href:v,children:b})}})})]})};const Ha=ie.createIntl({locale:"en",messages:gr}),ii=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:i="medium",styling:a={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:Ha.formatMessage({id:"loadMore_button"}),endOfFeed:Ha.formatMessage({id:"loadMore_endOfFeed"}),error:Ha.formatMessage({id:"loadMore_error"})},className:u="",gtmContext:l="LoadMore"})=>{const[d,m]=x.useState(""),h=async p=>{if(!n)try{await t(p)}catch(g){g instanceof Error?m(g.message):m("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:K("load-more",u),children:!d&&e?c.jsx(we,{variant:r,size:i,styling:a,icon:s,onClick:h,"data-gtm-event-context":l,"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 Lo=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:K("logo",e,t,n),...r,children:c.jsx(Oe,{children:c.jsx(ie.FormattedMessage,{id:"apolitical"})})})});let vi=!1;const Xi=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const i=ie.useIntl(),a=x.useRef(null),[s,o]=x.useState(!1),u=l=>{a.current&&l.target instanceof HTMLElement&&!a.current.contains(l.target)&&o(!1)};return x.useEffect(()=>(document.addEventListener("click",u,!0),()=>{document.removeEventListener("click",u,!0)})),x.createElement(e,{ref:a,className:K("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(we,{variant:"tertiary",size:"medium","data-testid":"more-menu",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:i.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:l,onClick:d,text:m,icon:h,...p},g)=>{const f={...p,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{vi&&(clearTimeout(vi),vi=!1)},onBlur:()=>{vi=setTimeout(()=>{o(!1)},100)}};return l&&(f.href=l),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(we,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...f,children:m})},`${window.btoa(m)}_${g}`)})})]})})},Uv=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Wv=x.lazy(()=>Promise.resolve().then(()=>qp)),Vv=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Sf=({activeLink:e,profile:t})=>{const n=ie.useIntl(),r=x.useContext(rt),i=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Vv.map(({key:a,href:s})=>{const o=Uv(s,e),u={};return o&&(u["aria-current"]="page"),c.jsx("li",{className:K(a,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...u,children:n.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),i&&t&&c.jsx(Wv,{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"})]})},Ar=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Hv=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${Ar(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(`${Ar(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(`${Ar(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
64
+ `;return i.slice(0,a.length)===a&&(i=i.slice(a.length)),n?await Pd({text:i,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):i},Ro=(e,t)=>t.length===0||e.length===0?[]:e.map(n=>t.find(r=>r.slug===n)).filter(n=>n!==void 0),bv=(e,t,n)=>{let r=!1;function i(a){let s=30;for(;a||s<=0;){if(t.some(o=>Array.from(a==null?void 0:a.classList).includes(o))){r=!0;break}if(Array.from(a==null?void 0:a.classList).includes(n))break;a=a.parentElement,s--}}return i(e.target),r},yv=(e,t)=>e?typeof e=="string"?e:e[t]:"";const xv=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:i,functions:{activities:a,form:s,join:o,leave:u,likes:l,polls:d},profile:h,locale:m=Bo})=>{const p=ie.useIntl(),[g,f]=x.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[b,v]=x.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),y={...a,...d},{activities:C,error:k,fetchNextPage:D,hasNextPage:_,isLoading:B,mutations:{create:M,edit:P,remove:z,like:O,unlike:A,pin:F,unpin:S,createPoll:I,createVote:H,removeVote:V,removePoll:ae}}=cv({queryKey:[e,t,"activities",g],queryFns:y,filterOption:g[0]});x.useEffect(()=>{i&&v(b.concat(i==null?void 0:i.map(({slug:q,name:T})=>({id:q,text:T,type:"category"}))))},[i]);const[ne,E]=x.useState(null),Y=()=>{E(C.length),D()};return Cf(),k?c.jsx(Qt,{variant:"error",text:k.message}):c.jsxs("section",{className:"activities-feed",children:[c.jsx(bu,{isCard:!0,parentId:t,categories:i,form:{content:{type:yr.Post,slugs:{}},functions:{create:M,createPoll:I,...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:u,notMemberStateText:p.formatMessage({id:"community_joinToPost"})}}),c.jsx(Bf,{className:"activities-feed-filtering",options:b.map(({id:q,text:T})=>({id:q,text:p.formatMessage({id:`activitiesFeed_rankingMethod_${T}`,defaultMessage:T})})),defaultOptions:g.map(({id:q,text:T})=>({id:q,text:p.formatMessage({id:`activitiesFeed_rankingMethod_${T}`,defaultMessage:T})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:q,previous:T})=>{if(q[0]===T[0])return;f([b.find(N=>N.id===q[0])]);const j=b.find(N=>N.id===q[0]);if(!j)return;const R=new CustomEvent("ariaLive",{detail:{message:p.formatMessage({id:"community_sortSuccess"},{order:p.formatMessage({id:`activitiesFeed_rankingMethod_${j.text}`,defaultMessage:j.text})})}});document.dispatchEvent(R)},gtm:{context:"activitiesFeed_sorting"}}),C==null?void 0:C.map((q,T)=>{var ye,_e,De,ze,We,He,Ke,Be,Me;const{id:j,own_reactions:R,latest_reactions:N,reaction_counts:U,mentioned_users:X,total_replies:W,additional_data:te}=q,de=(((ye=N==null?void 0:N.like)==null?void 0:ye.length)||0)>0,J=(((_e=R==null?void 0:R.like)==null?void 0:_e.length)||0)>0,ve=J?R==null?void 0:R.like[0].id:"",me=de?(De=N==null?void 0:N.like)==null?void 0:De.map(Ce=>{var G,se,be;return{id:(G=Ce==null?void 0:Ce.user)==null?void 0:G.id,name:(be=(se=Ce==null?void 0:Ce.user)==null?void 0:se.data)==null?void 0:be.name}}):!1;return c.jsx(x.Fragment,{children:c.jsx(ui,{content:{type:q.verb,title:q==null?void 0:q.title,body:q==null?void 0:q.content,createdAt:(q==null?void 0:q.time)||"",slugs:{question:`${e}/${t}`,answer:j},slug:j,author:xr(q==null?void 0:q.actor),userLiked:J,likes:(U==null?void 0:U.like)||0,comments:W||0,peopleWhoLiked:me,data:{mentions:X,...te||{}},pinned:(U==null?void 0:U.pin)&&(U==null?void 0:U.pin)>0||!1,categories:Ro((q==null?void 0:q.categories)||[],i||[]),pollOptions:pf(q,m),pollSettings:{showRemoveVote:(ze=q==null?void 0:q.settings)==null?void 0:ze.show_remove_vote,allowMultipleVotes:(We=q==null?void 0:q.settings)==null?void 0:We.allow_multiple_votes,deadlineAt:(He=q==null?void 0:q.settings)==null?void 0:He.deadline_at,hideParticipants:(Ke=q==null?void 0:q.settings)==null?void 0:Ke.hide_participants,numberOfWinners:(Be=q==null?void 0:q.settings)==null?void 0:Be.number_of_winners,resultsVisibility:(Me=q==null?void 0:q.settings)==null?void 0:Me.results_visibility}},links:{post:`${e}/${t}/${j}`,comments:`${e}/${t}/${j}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>z({activityId:j}),updateContent:(Ce,{body:G})=>P({activityId:j,content:G})},likes:{createLike:()=>O({activityId:j}),deleteLike:()=>A({activityId:j,reactionId:ve}),listLikes:Ce=>l.list({activityId:j,...Ce})},comments:{openComments:()=>null},pins:{createPin:()=>F({activityId:j}),deletePin:()=>S({activityId:j,reactionId:N==null?void 0:N.pin[0].id})},polls:{createVote:({reactionId:Ce})=>H({activityId:j,reactionId:Ce}),removeVote:({reactionId:Ce})=>V({activityId:j,reactionId:Ce}),removePoll:()=>ae({activityId:j})},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:T===ne,userHasOwnerPermissions:r,userHasPermissions:n,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:t||""},{scope:ut.Platform,area:"all"}]},basePath:e,parentId:t})},j)}),!B&&c.jsx(ii,{hasNextPage:_,loadNextPage:Y,icon:{icon:"arrow-down",position:"right"},messages:{button:p.formatMessage({id:"loadMore_button"}),error:p.formatMessage({id:"loadMore_error"})}}),C.length===0&&!B&&c.jsx(_t,{className:"no-activities",variant:"muted",icon:"text--input",children:g[0].type==="category"?c.jsx("p",{children:p.formatMessage({id:"activitiesFeed_noActivities_inCategories"})}):c.jsxs(c.Fragment,{children:[c.jsx("p",{children:p.formatMessage({id:"activitiesFeed_noActivities"})}),c.jsx("p",{children:c.jsx(we,{variant:"secondary",size:"small",href:"/communities",children:p.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),c.jsx(yu,{form:h})]})},wv={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",badges:{communities:{"community-slug":["orange-badge","badge-with-heart"]}}}},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 Cv({parentId:e,isMember:t,formFunctions:n,leave:r,join:i}){const a=ie.useIntl();return c.jsx(bu,{form:{content:{type:Te.Reply,slugs:{}},functions:n,meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:a.formatMessage({id:"discussion_responses_placeholder"})},parentId:e,membershipRequiredToPost:{isMember:t,required:!0,join:i,leave:r,notMemberStateText:a.formatMessage({id:"community_joinToPost"})}})}function Dv({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const i=ie.useIntl(),a=()=>{n(r),t()};return c.jsx(ii,{hasNextPage:e,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},messages:{button:i.formatMessage({id:"loadMore_button"}),error:i.formatMessage({id:"loadMore_error"})}})}function Ev({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=Re.useMutation({mutationFn:e,onMutate:o=>t(u=>{const l=al({reply:Gg(o),user:a});return cr(l,u,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,u,l)=>{const d=al({reply:o,user:a});r.setQueryData(i,cr(d,l,{replace:!0,append:(u==null?void 0:u.replyId)!==void 0})),setTimeout(()=>{Mo(d.id,"reply")},0)}});return s}function _v({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Re.useMutation({mutationFn:e,onMutate:({replyId:i,content:a})=>t(s=>{const o=wt(i,s);return o&&(o.data.content=a),s}),onError:n});return r}function kv({replies:e,user:t}){return!e||!(t!=null&&t.id)?[]:e.map(({id:n,own_children:r,latest_children:i,children_counts:a,data:s,created_at:o,parent:u,...l})=>{var f,b,v,y;const d=(((f=r==null?void 0:r.like)==null?void 0:f.length)||0)>0,h=(((b=i==null?void 0:i.like)==null?void 0:b.length)||0)>0,m=d?(v=r==null?void 0:r.like)==null?void 0:v.find(C=>{var k;return((k=C==null?void 0:C.user)==null?void 0:k.id)===(t==null?void 0:t.id)}):!1,p=typeof m=="object"?(m==null?void 0:m.id)??"":"",g=h?(y=i==null?void 0:i.like)==null?void 0:y.map(C=>{var k,D,_;return{id:(k=C==null?void 0:C.user)==null?void 0:k.id,name:(_=(D=C==null?void 0:C.user)==null?void 0:D.data)==null?void 0:_.name}}):!1;return{user:l==null?void 0:l.user,body:Av(s),createdAt:o,data:Fv(s),likeId:p,liked:h,likes:(a==null?void 0:a.like)||0,peopleWhoLiked:g,replyId:n,parent:u,userLiked:!!m}})}function Fv(e){if(!e||!e.mentioned_users)return{};const t=e==null?void 0:e.mentioned_users,n=(e==null?void 0:e.additional_data)||{};return{mentions:t,...n}}function Av(e){var t;return e?typeof e.content=="string"?e.content:((t=e==null?void 0:e.content)==null?void 0:t.text)||"":""}function Ef({queryFns:{create:e,edit:t,like:n,list:r,remove:i,unlike:a},queryKey:s}){const o=Re.useQueryClient(),u=pa(),l={queryClient:o,queryKey:s},d={mutationHandlers:{error:So(l),mutate:jo(l)},user:u,...l},h=Ev({...d,mutationFn:e}),m=_v({...d,mutationFn:t}),p=Tv({...d,mutationFn:n}),g=Sv({...d,mutationFn:i}),f=jv({...d,mutationFn:a}),{replies:b,...v}=Bv({queryKey:s,queryFn:r});return{replies:kv({replies:b,user:u}),mutations:{create:h,edit:m,remove:g,like:p,unlike:f},user:u,...v}}function Tv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Re.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const u=wt(s,o);return u&&sl({reply:u}),o}),onError:n,onSuccess:(s,{replyId:o},u)=>{const l=wt(o,u);l&&sl({reply:l,reaction:s}),r.setQueryData(i,u)}});return a}function Bv({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}=Re.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:Oo(n),error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}}function Sv({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Re.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(a=>wf(i,a)),onError:n});return r}function jv({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(s=>{const o=wt(a,s);return o&&Qg({reply:o,user:r}),s}),onError:n});return i}const Pv=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:i,functions:{reactions:a,form:s,likes:o}})=>{const u=ie.useIntl(),l=3,{replies:d,fetchNextPage:h,hasNextPage:m,isLoading:p,mutations:{create:g,edit:f,like:b,remove:v,unlike:y}}=Ef({queryKey:[t,r,e,i,"replies"],queryFns:{...a,list:D=>a.list({...D,reactionId:i})}});po([p]);const[C,k]=x.useState(!0);return c.jsxs(c.Fragment,{children:[(d==null?void 0:d.length)>=l&&c.jsx(we,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",styling:{muted:!0},icon:{icon:`arrow_corner-${C?"up_left":"down_right"}`,position:"left"},onClick:()=>k(!C),children:u.formatMessage({id:`discussion_thread_${C?"hide":"show"}`},{count:d==null?void 0:d.length})}),C&&c.jsx(_h,{loadMore:{isLoading:p,hasNextPage:m,loadNextPage:()=>h()},form:{parentId:r,content:{type:Te.Reply,slugs:{question:`${t}/${r}`,answer:e,reply:i}},functions:{create:(D,{body:_})=>g({activityId:e,replyId:i,content:_}),...s},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:d&&d.length>0?d==null?void 0:d.map(({replyId:D,likes:_,data:B,body:M,createdAt:P,userLiked:z,peopleWhoLiked:O,parent:A,user:F,likeId:S})=>c.jsx(ui,{isCommunity:!0,content:{id:D,type:Te.Reply,body:M,createdAt:P,slugs:{question:`${t}/${r}`,answer:e,reply:A},slug:"",author:xr(F),userLiked:z,likes:_,peopleWhoLiked:O,data:B},userHasPermissions:n,functions:{content:{createContent:()=>null,deleteContent:()=>v({replyId:D}),updateContent:(I,{body:H})=>f({replyId:D,content:H})},likes:{createLike:()=>b({replyId:D}),deleteLike:()=>y({replyId:D,reactionId:S}),listLikes:I=>o.list({replyId:D,...I})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:r||""},{scope:ut.Platform,area:"all"}]},basePath:t,parentId:r},D)):null})]})};function Ov({formFns:e,activityId:t,basePath:n,focus:r,isMember:i,parentId:a,reply:s}){const{body:o,data:u,likeId:l,likes:d,peopleWhoLiked:h,replyId:m,createdAt:p,user:g,userLiked:f}=s,{edit:b,like:v,remove:y,unlike:C}=e.mutations;return c.jsx(wh,{children:c.jsx(ui,{isCommunity:!0,content:{id:m,type:Te.Reply,body:o,createdAt:p,slugs:{question:`${n}/${a}`,answer:t,reply:m},slug:m,author:xr(g),userLiked:f,likes:d,peopleWhoLiked:h,data:u},userHasPermissions:i,functions:{content:{createContent:()=>null,deleteContent:()=>y({replyId:m}),updateContent:(k,{body:D})=>b({replyId:m,content:D})},likes:{createLike:()=>v({replyId:m}),deleteLike:()=>C({replyId:m,reactionId:l}),listLikes:k=>e.likes.list({replyId:m,...k})},comments:{},form:e.form},badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:a||""},{scope:ut.Platform,area:"all"}]},children:c.jsx(Pv,{basePath:n,parentId:a,activityId:t,replyId:m,isMember:i,functions:e}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:a},m)},m)}const _f=({activityId:e,basePath:t,parentId:n,activityTotalReplies:r,isMember:i,functions:{form:a,join:s,leave:o,likes:u,reactions:l},profile:d,showReplies:h})=>{const{fetchNextPage:m,hasNextPage:p,isLoading:g,replies:f,mutations:{create:b,remove:v,edit:y,like:C,unlike:k}}=Ef({queryKey:[t,n,e,"replies"],queryFns:l}),[D,_]=x.useState(null);po([g]),Cf();const B={create:(M,P)=>{const{body:z}=P;b({activityId:e,content:z})},...a};return c.jsxs("section",{className:"replies-feed",children:[c.jsx(Eh,{type:"comment",responses:r,isLoading:g}),h?c.jsxs(c.Fragment,{children:[c.jsx(Cv,{parentId:n,isMember:i,join:s,leave:o,formFunctions:B}),f==null?void 0:f.map((M,P)=>c.jsx(Ov,{activityId:e,basePath:t,focus:D===P,formFns:{form:a,likes:u,reactions:l,mutations:{remove:v,edit:y,like:C,unlike:k}},isMember:i,parentId:n,reply:M},M.replyId)),g?c.jsx(c.Fragment,{children:" "}):c.jsx(Dv,{hasNextPage:p,fetchNextPage:m,setFocusReplyIndex:_,totalReplies:f.length})]}):c.jsx(_t,{children:c.jsx(ie.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),c.jsx(yu,{form:d})]})};function Mv({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}=Re.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:d=>(d==null?void 0:d.next)||null}),u=Oo(n),l=`${u.length||0}${a?"+":""}`;return{likes:u,likesCount:l,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}}function Nv({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=Mv({queryKey:t,queryFn:e});return{likes:n,...r}}function kf({basePath:e,parentId:t,activityId:n,likeCount:r,functions:i}){const{likes:a,fetchNextPage:s,hasNextPage:o,refetch:u}=Nv({queryKey:[e,t,n,"likes"],queryFns:i.likes});x.useEffect(()=>{u()},[u]);const l=a.map(({user:d})=>d).map(d=>d?xr(d):void 0).filter(d=>d&&typeof d!="string");return c.jsx("section",{className:"likes-feed",children:c.jsx(xh,{members:{data:l,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&l.length<r,loadNextPage:s})})}const Ff=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:i,...a})=>{const s=ie.useIntl();return c.jsx(ln,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:K("profile-modal in-portal",i,{open:e}),maxWidth:600,children:c.jsx(kf,{...a,likeCount:r??0,functions:{likes:n}})})},Iv=Object.freeze(Object.defineProperty({__proto__:null,default:Ff},Symbol.toStringTag,{value:"Module"})),Rv={results:[{created_at:"2024-05-16T13:17:45.940899Z",updated_at:"2024-05-16T13:17:45.940899Z",id:"ab4b7ab0-f4fe-469f-a8e7-5a52b3e55333",user_id:"9ed21585-63be-4446-96ce-3e703820eb73",user:{id:"1234",data:{name:"Han Solo",thumbnail:"https://placehold.co/400x400",jobTitle:"Smuggler",organization:"Rebel Alliance",badges:{communities:{"endor-alumni":["blue-badge"]}}}},kind:"like",activity_id:"869e5a90-0eba-11ef-8080-80017b714aaf",data:{mentioned_users:null},parent:"",latest_children:{},children_counts:{}},{created_at:"2024-05-16T13:17:45.940899Z",updated_at:"2024-05-16T13:17:45.940899Z",id:"db4b7ab0-f4fe-469f-a8e7-5a52b3e55373",user_id:"9ed21585-63be-4446-96ce-3e703820eb73",user:{created_at:"2023-08-22T11:56:10.585365Z",updated_at:"2024-03-13T11:31:49.447916Z",id:"9ed21585-63be-4446-96ce-3e703820eb73",data:{jobTitle:"Admiral",name:"Princess Leia",organization:"Rebela Alliance",thumbnail:"https://placehold.co/400x400",badges:{platform:{all:["orange-badge"]}}}},kind:"pin",activity_id:"769e5a90-0eba-11ef-8080-80017b714aaf",data:{mentioned_users:null},parent:"",latest_children:{},children_counts:{}}],next:"xy12345"};const $v=3e3,Af=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ie.useIntl(),r="discussion_share_copy_link",[i,a]=x.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(Zr,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>a({...i,isOpen:!0}),onFocus:()=>a({...i,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});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{a({isOpen:!1,isCopied:!1})},$v)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,"data-testid":"share-link",screenreaderText:n.formatMessage({id:r})}),c.jsx(Ln,{className:K({copied:i.isCopied}),isOpen:i.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${i.isCopied?"_success":""}`})})]})};const Wn="discussion_",Tf=({className:e,gtmContext:t,contentType:n,likes:r,comments:i,replies:a,shareLink:s,moreMenu:o})=>{const u=ie.useIntl(),l=[];return o&&o.reportData&&l.push({text:u.formatMessage({id:`${Wn}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(u.formatMessage({id:`${Wn}report_subject`}))}&body=${encodeURI(u.formatMessage({id:`${Wn}report_body`},{contentType:n||"",contentSlug:o&&o.reportData&&o.contentSlug||"",contentUrl:o&&o.reportData&&o.reportData.contentUrl||""}))}`,icon:"flag"}),c.jsxs("ul",{className:K("actions text-medium",e),"data-testid":`${n}-actions`,children:[r?c.jsx(Df,{element:"li",likes:r.count,isShort:!1,userLiked:r.userLiked,content:{type:n,slugs:r.content.slugs,slug:r.content.slug},canLike:r.canLike,peopleWhoLiked:r.peopleWhoLiked,activityId:r.activityId,functions:r.functions,basePath:r.basePath||"",parentId:r.parentId||""}):c.jsx(c.Fragment,{}),i?c.jsx("li",{children:c.jsx(Zr,{shortText:`${i.count??0}`,onClick:d=>{d.preventDefault(),d.stopPropagation(),i.functions.onClick()},icon:{icon:"speech-bubble_square"},"data-testid":"comment","data-gtm-event-context":t,"data-gtm-event-type":`answer-${n}-click`,screenreaderText:u.formatMessage({id:`${Wn}comments_screenReader`},{count:i.count}),children:u.formatMessage({id:`${Wn}comments${i.count===null?"_loading":""}`},{count:i.count})})}):c.jsx(c.Fragment,{}),a?c.jsx("li",{children:c.jsx(Zr,{styling:{muted:!0},onClick:a.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",disabled:!a.canReply,children:u.formatMessage({id:`${Wn}reply`})})}):c.jsx(c.Fragment,{}),s?c.jsx(Af,{url:s.url,gtm:{context:t||"",event:`copy-link-${n}-click`}}):c.jsx(c.Fragment,{}),o?c.jsx(Xi,{element:"li",id:`more-${o.contentSlug}`,options:[...o.options||[],...l]}):c.jsx(c.Fragment,{})]})};const Lv=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Oe,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:K("breadcrumbs text-small",n),children:e.map(({text:i,href:a,current:s=!1},o)=>{const u={};return s&&(u["aria-current"]="location"),c.jsxs("li",{children:[s&&c.jsx(Oe,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(Dn,{href:s?void 0:a,...u,children:sr(i,t)})]},`${window.btoa(i)}_${o}`)})})]})};const $o=({variant:e="default",data:{image:t,url:n,title:r,description:i},onClick:a,gtm:s,...o})=>{if(!n)return c.jsx(c.Fragment,{});let u=n.split("//");u.length>1?u=u[1]:u=u[0],u=u.split("/"),u=u[0];const{context:l="EnrichedLink",event:d="enriched-link-click"}=s??{};return c.jsxs("aside",{className:K("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:h=>{if(h.preventDefault(),h.stopPropagation(),a){a(h);return}window.open(n,"_blank")},"data-gtm-event-context":l,"data-gtm-event-type":d,children:[c.jsx("small",{children:u}),c.jsx("p",{className:"title text-medium",children:c.jsx("a",{...o,href:n,target:"_blank",rel:"noreferrer",children:r})}),i&&e!=="condensed"?c.jsx("p",{className:"text-small",children:i}):c.jsx(c.Fragment,{}),t&&t.src?c.jsx("p",{className:"img",children:c.jsx("img",{src:t.src,alt:t.alt||"",loading:"lazy",fetchpriority:"low",width:t.width||"auto",height:t.height||"100%"})}):c.jsx(c.Fragment,{})]})};const Bf=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:i=()=>{},preventNoOptionSelected:a=!1,className:s="",styling:o,gtm:u})=>{const l=ie.useIntl(),{muted:d,large:h}=o||{},m=n?[{id:"all",text:typeof n!="boolean"&&n.text||l.formatMessage({id:"filters_all"})},...e]:e,[p,g]=x.useState(n?["all"]:t.length?t.map(y=>y.id):[]),[f,b]=x.useState(0),v=(y,C)=>{let k=[];p.includes(y)&&!a?k=p.filter(D=>D!==y):y==="all"?k=["all"]:r?k=[...p.filter(D=>D!=="all"),y]:k=[y],g(D=>(i&&typeof i=="function"&&i({current:k,previous:D}),k)),C&&typeof C=="function"&&C()};return c.jsx("ul",{className:K("filters",s),children:m.map(({id:y,text:C,disabled:k=!1,callback:D=()=>{},content:_},B)=>{let M={tabIndex:f===B?0:-1};return k&&(M={disabled:!0,"aria-label":l.formatMessage({id:"filters_disabled"},{name:C})}),c.jsx("li",{children:c.jsx("button",{"data-gtm-event-context":(u==null?void 0:u.context)||"filters","data-gtm-event-type":(u==null?void 0:u.type)||`${C.toLowerCase().replace(" ","-")}-click`,className:K(y,{selected:p.includes(y),large:h,muted:d}),onClick:P=>{P.preventDefault(),P.stopPropagation(),v(y,D)},onKeyDown:P=>{var F,S;let z=B+1,O,A;switch(P.code){case"Enter":case"Space":P.preventDefault(),P.stopPropagation(),v(y,D);break;case"ArrowLeft":case"ArrowRight":P.preventDefault(),P.stopPropagation(),P.code==="ArrowLeft"?(z=B-1,z<0&&(z=m.length-1)):z>=m.length&&(z=0),b(z),O=P.currentTarget.closest("li"),A=(F=O==null?void 0:O.parentElement)==null?void 0:F.children[z],(S=A==null?void 0:A.querySelector("button"))==null||S.focus();break}},"aria-selected":p.includes(y),...M,children:_||C})},y)})})},zv=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let i="",a=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(i+=`/${s}`,a=!0):(i.includes(`/${r}/`)||(i+=`/${r}`),i+=`/${s}`)}),i.includes(`/${r}/`)||(i+=`/${r}`),t&&(i+=`/${t}`),a?{url:i,urlForRouter:`/${i.split("/").slice(2).join("/")}`}:i};const gi="languageSwitcher_",qv=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:i,urlParts:a,variant:s="default",label:o,className:u=""})=>{const l=ie.useIntl(),{updateLanguage:d=()=>{}}=x.useContext(xo),[h,m]=x.useState(e);if(x.useEffect(()=>{e!==h&&m(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const g=Object.keys(r),f=h!==e;return c.jsxs("div",{className:K("language-switcher text-small",s,u),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||l.formatMessage({id:`${gi}label`})}),c.jsx("ul",{children:g.map(b=>{var C;if(!Mi[b])return null;const v=(C=r[b])==null?void 0:C.post_name;let y={className:b};if(h===b)y["aria-label"]=l.formatMessage({id:`${gi}selected`},{language:Mi[b]});else{const k=zv(b,v,a);y={...y,href:typeof k=="string"?k:k.url,onClick:D=>{m(b),d(b),typeof i<"u"&&(D.preventDefault(),D.stopPropagation(),i(b,typeof k=="string"?k:k.urlForRouter))}}}return c.jsx("li",{children:c.jsx(Dn,{...y,fallbackElement:"span",children:Mi[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:l.formatMessage({id:`${gi}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:l.formatMessage({id:`${gi}disclaimer`},{email:Qn.support,link:b=>{const v=`mailto:${b}`;return c.jsx("a",{href:v,children:b})}})})]})};const Ha=ie.createIntl({locale:"en",messages:gr}),ii=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:i="medium",styling:a={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:Ha.formatMessage({id:"loadMore_button"}),endOfFeed:Ha.formatMessage({id:"loadMore_endOfFeed"}),error:Ha.formatMessage({id:"loadMore_error"})},className:u="",gtmContext:l="LoadMore"})=>{const[d,h]=x.useState(""),m=async p=>{if(!n)try{await t(p)}catch(g){g instanceof Error?h(g.message):h("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:K("load-more",u),children:!d&&e?c.jsx(we,{variant:r,size:i,styling:a,icon:s,onClick:m,"data-gtm-event-context":l,"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 Lo=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:K("logo",e,t,n),...r,children:c.jsx(Oe,{children:c.jsx(ie.FormattedMessage,{id:"apolitical"})})})});let vi=!1;const Xi=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const i=ie.useIntl(),a=x.useRef(null),[s,o]=x.useState(!1),u=l=>{a.current&&l.target instanceof HTMLElement&&!a.current.contains(l.target)&&o(!1)};return x.useEffect(()=>(document.addEventListener("click",u,!0),()=>{document.removeEventListener("click",u,!0)})),x.createElement(e,{ref:a,className:K("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(we,{variant:"tertiary",size:"medium","data-testid":"more-menu",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:i.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:l,onClick:d,text:h,icon:m,...p},g)=>{const f={...p,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{vi&&(clearTimeout(vi),vi=!1)},onBlur:()=>{vi=setTimeout(()=>{o(!1)},100)}};return l&&(f.href=l),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(we,{variant:"tertiary",size:"medium",icon:m?{icon:m,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${g}`)})})]})})},Uv=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Wv=x.lazy(()=>Promise.resolve().then(()=>qp)),Vv=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Sf=({activeLink:e,profile:t})=>{const n=ie.useIntl(),r=x.useContext(rt),i=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Vv.map(({key:a,href:s})=>{const o=Uv(s,e),u={};return o&&(u["aria-current"]="page"),c.jsx("li",{className:K(a,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...u,children:n.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),i&&t&&c.jsx(Wv,{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"})]})},Ar=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Hv=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${Ar(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(`${Ar(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(`${Ar(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
65
65
 
66
- ${Ar(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Ar(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,i)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(i))}];const Kv="shareLinks_",Zv=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:i="large",variant:a="default",className:s=""})=>{const o=ie.useIntl(),u=Hv({title:e,link:t,referrer:n});return c.jsxs("aside",{className:K("share-links",i,a,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:u.map(({key:l,icon:d,url:m,shouldRender:h=!0,onClick:p})=>{if(typeof h=="function"&&!h())return null;const g={};return p&&(g.onClick=f=>p(f,m)),c.jsx("li",{children:c.jsx(we,{size:i,variant:"tertiary",icon:{icon:d||l},href:m,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${l}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${Kv}link_${l}`}),...g})},l)})})]})};const Yv=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(f,b,v)=>(f||(f=`panel-${window.btoa(b)}-${v}`),f),i=wn(!0)||0;let a=e.findIndex(f=>f.current===!0);if(a<0&&(a=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){a=v;break}}}const[s,o]=x.useState((g=e[a])!=null&&g.id?e[a].id:r(e[a].id,e[a].text,a)),[u,l]=x.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 y=r(e[v].id,e[v].text,v),C=document.getElementById(`tab-${y}`);C==null||C.focus(),l(y);break}case"Enter":o(u),window.location.hash=`#${u}`;break}},m=f=>{let b=!1;return f.target==="min-width"&&i>=f.value&&(b=!0),f.target==="max-width"&&i<=f.value&&(b=!0),b};x.useEffect(()=>{if(e[a].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const h=[],p=[];return e.forEach(({id:f,text:b,content:v,href:y,hasCarousel:C,breakpoint:k},D)=>{if(k&&!m(k))return;f=r(f,b,D);const _=s===f,B={};y||(B["aria-controls"]=f,B.onClick=P=>{P.preventDefault(),P.stopPropagation(),o(f),!n&&window.history.replaceState(null,"",`#${f}`)},p.push(c.jsx("section",{id:f,hidden:!_,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":_?"assertive":"off",children:typeof v=="string"?c.jsx("p",{children:v}):v},`section-${f}`))),h.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:y||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:K({selected:_}),role:"tab",tabIndex:_?0:-1,"aria-selected":_,onKeyDown:P=>d(P,D),...B,children:b})},`tab-${f}`))}),c.jsxs("div",{className:K("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:h}),c.jsx("div",{className:"tab-content",children:p})]})};const Gv={"2-1":901,"1-3":769,"1-1":769},jf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:i})=>{const a=wn(!0);let s=i;return x.Children.count(i)===1&&(s=x.Children.toArray(i)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:K("columns",`layout-${e}`,r,{"has-containers":n}),children:x.Children.map(s,(o,u)=>t!==!1&&u===t&&a&&a<Gv[e]?null:o)})};const zo=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const i=ie.useIntl(),a="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),u=n>=.99*t,l=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:K("character-limit",{"near-limit":u,"approaching-limit":l}),"aria-live":"polite","aria-label":d?"":i.formatMessage({id:`${a}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?i.formatMessage({id:`${a}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:i.formatMessage({id:a})}),n," / ",t]})}),c.jsx(Oe,{showOnFocus:!1,id:`${e}-info`,children:i.formatMessage({id:`${a}_info`},{limit:t})})]})},ba=e=>(e==null?void 0:e.toString().length)||0,Pf=(e,t)=>{const n={};return e===0||(n["data-character-limit"]=e,n.functions={...t,onChange:r=>{ba(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t.onChange(r)}}),n};const bi="emailHelperTextBox_",Of=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:i})=>{const a=ie.useIntl(),[s,o]=x.useState({path:`${bi}default`,type:"default",link:{},mail:{},error:""}),[u,l]=x.useState(!1),d=x.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=b=>{o({path:`${bi}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 i!="function"){f(a.formatMessage({id:`${bi}error_noFunction`}));return}l(!0),i(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{l(!1)})},[n,r,i]);x.useEffect(()=>{let g=bi,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:y=>d(y),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",b={href:"/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(Rd,{id:e,type:s.type,heading:u?!1:a.formatMessage({id:`${s.path}_title`}),"aria-live":"assertive",children:u?c.jsxs(c.Fragment,{children:[c.jsx(Nt,{element:"span"}),c.jsx(Nt,{element:"span"})]}):a.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})})},Jn=({className:e="",element:t="input",id:n,inputRef:r,functions:i={onChange:()=>{}},name:a=n,placeholder:s,type:o="text",value:u,autoFocus:l,label:d,styling:m={},...h})=>{const p=x.useRef(),g=r||p,{autosizeToFit:f=!1}=m;xd(f&&t==="textarea",g),x.useEffect(()=>{var v;l&&((v=g.current)==null||v.focus())},[]),!(h!=null&&h.autoComplete)&&["email"].includes(o)&&(h.autoComplete="email");const b={};return t==="input"&&(b.type=o),x.createElement(t,{ref:g,...h,...b,id:n,name:a,className:K(e,t,{autoresize:f}),value:u,placeholder:s,autoFocus:l,...i,onChange:v=>{const y=v.target;i.onChange(y.value)}})};const Vn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Qv=500,Jv=({id:e,name:t=e,value:n,placeholder:r,functions:i={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...a})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=i,[{input:u,displayInput:l,debouncedInput:d},m]=x.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:h,activePredictionIndex:p,isPredictionSelected:g},f]=x.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=ie.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),x.useEffect(()=>{const k=setTimeout(()=>{g||m(D=>({...D,debouncedInput:u}))},Qv);return()=>{clearTimeout(k)}},[u,g]),x.useEffect(()=>{d&&!g?(async()=>{try{const D=await o(d)||[];f(_=>({..._,predictions:D}))}catch(D){console.error("Error fetching predictions:",D),f(_=>({..._,predictions:[]}))}})():f(k=>({...k,predictions:[]}))},[d,g]),x.useEffect(()=>{p>=0&&h[p]&&m(k=>({...k,displayInput:h[p].description}))},[p,h]);const v=k=>{[Vn.DOWN,Vn.UP,Vn.ENTER].includes(k.key)&&(k.preventDefault(),k.key===Vn.DOWN&&p<h.length-1?f(D=>({...D,activePredictionIndex:p+1})):k.key===Vn.UP&&p>0?f(D=>({...D,activePredictionIndex:p-1})):k.key===Vn.ENTER&&p>-1&&(s(h[p].description),m(D=>({...D,input:h[p].description})),f(D=>({...D,predictions:[],isPredictionSelected:!0}))))},y=k=>{s(k.target.value),m(D=>({...D,input:k.target.value,displayInput:k.target.value})),f(D=>({...D,activePredictionIndex:-1,isPredictionSelected:!1}))},C=k=>{s(k.description),m(D=>({...D,input:k.description,displayInput:k.description})),f(D=>({...D,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:l,onChange:y,onKeyDown:v,placeholder:r,name:t,id:e,...a}),c.jsx("ul",{className:"predictions-list",children:h.map((k,D)=>c.jsx("li",{onClick:()=>C(k),onMouseEnter:()=>f(_=>({..._,activePredictionIndex:D})),className:K("predictions-list-item",{active:D===p}),children:k.description},D))})]})};const qo=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:i,inputRef:a,intlPath:s=!1,label:o,shownValue:u=!0,type:l="checkbox",value:d,accessibilityOptions:{checkboxes:{navigateWithArrowKeys:m=!1}={}}={},...h})=>{const p=ie.useIntl(),{onChange:g,...f}=r,b=()=>{t||g(d?null:u)},v=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:a,id:i,name:i,type:l,value:u,checked:d,readOnly:!0,disabled:t,tabIndex:-1}),c.jsx("span",{className:K("pretty-checkbox",{radio:l==="radio"}),"data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:i,onKeyDown:y=>{(y.key==="Enter"||y.code==="Space")&&(y.preventDefault(),y.stopPropagation(),b())},tabIndex:d||!m?0:-1,children:o||p.formatMessage({id:s?`${s}_${i}`:i})})]});return x.createElement(n,{onClick:y=>{const C=y.target;C.nodeName.toLowerCase()==="a"||C.parentNode&&C.parentNode.nodeName.toLowerCase()==="a"||(y.preventDefault(),y.stopPropagation(),b())},onKeyDown:m?y=>{var C,k,D;if(y.key!=="Tab")switch(y.code){case"Enter":case"Space":y.stopPropagation(),y.preventDefault(),b();break;case"ArrowLeft":case"ArrowRight":y.stopPropagation(),y.preventDefault();const _=y.currentTarget;let B=_==null?void 0:_.nextElementSibling;if(y.key==="ArrowLeft"){const P=_==null?void 0:_.previousElementSibling;P?B=P:B=(C=_==null?void 0:_.parentElement)==null?void 0:C.lastElementChild}else B||(B=(k=_==null?void 0:_.parentElement)==null?void 0:k.firstElementChild);B&&((D=B==null?void 0:B.querySelector("label"))==null||D.focus());break}}:void 0,className:K(i,"checkbox-wrapper",e,{"is-checked":d}),...h,...f},v)};const Xv=x.memo(function({direction:t="down"}){return c.jsx(fa,{className:K("rotating-chevron",`direction-${t}`)})});const eb=({className:e,options:t,initialValue:n,value:r,functions:i={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:a}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:u,id:l})=>{const d=ie.useIntl(),[m,h]=x.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[f,b]=x.useState(g);let v;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?v=t&&f?t.find(B=>B.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?v=f[0]:v={id:"",label:""},x.useEffect(()=>{b(g)},[r,n]);const{onChange:y,onMultiSelectSubmit:C,...k}=i,D=B=>{if(o){let P=[];f!=null&&f.includes(B.id)?P=f.filter(N=>N!==B.id):P=[...f,B.id],b([...P]),y&&y([...P])}else b([B]),y&&y(B.id),h(!1)},_=B=>{if(B==="all"){const P=(t==null?void 0:t.map(N=>N.id))||[];b(P),y&&y(P)}else b([]),y&&y([])};return c.jsxs("div",{className:K("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":m,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:B=>{B.preventDefault(),B.stopPropagation(),h(!m)},"data-testid":"dropdown-selector",...k,children:[o?`${s} · ${f.length}`:v.label,c.jsx(Xv,{direction:m?"up":"down"})]}),c.jsx("select",{defaultValue:v.id,onChange:B=>{B.preventDefault(),B.stopPropagation();const P=t&&t.find(N=>N.id===B.target.value);D(P)},hidden:!m,...k,children:t==null?void 0:t.map(B=>c.jsx("option",{value:B.id,className:"gtm-trackable","data-gtm-event-type":`${B.id}-click`,"data-gtm-event-context":a,children:B.label},B.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!m,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(u==null?void 0:u.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(we,{variant:"tertiary",size:"small",onClick:()=>_("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":a,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(we,{variant:"tertiary",size:"small",onClick:()=>_("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":a,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(B=>{const P=B.id===v.id||(f==null?void 0:f.includes(B))||(f==null?void 0:f.includes(B.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:K("gtm-trackable",{selected:P,"selected-single":P&&!o}),"data-gtm-event-type":`${B.id}-click`,"data-gtm-event-context":a,onClick:N=>{N.preventDefault(),N.stopPropagation(),D(B)},role:"menuitem","aria-current":P,"data-testid":P?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:K({"menu-option-label":o}),children:B.label})]})},B.id)})})]}),(u==null?void 0:u.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(we,{variant:"secondary",onClick:()=>{C&&C(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:l||"dropdown-multi-select",value:f}})),h(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})},Or=(e,t)=>{switch(e){case"required":if(!t||typeof t=="string"&&t.trim().length===0)return!0;break;case"no-numbers":if(t&&!/^([^0-9]*)$/.test(t))return!0;break;case"valid-email":if(t&&!/^(([^<>()[\]\\.,;:\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(t))return!0;break;case"valid-url":if(t&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=%]+$/i.test(t))return!0;break;default:return!1}return!1};let Ka=null;const tb=({id:e,label:t,limit:n,value:r,placeholder:i,functions:a,error:s,multipleInputs:o,validation:u,fieldData:l,type:d,...m})=>{const h=ie.useIntl(),{showCount:p=!1,label:g,defaultInputs:f=1,maxInputs:b=100,hasButton:v=!1,allowDuplicateValues:y=!1}=o||{},[C,k]=x.useState(r?Array.isArray(r)?r:[r]:Array(f).fill("")),D=C.filter(z=>z!==""),_=()=>{if(!l)return;const z=Pt(l.fields).filter(({id:F,name:S})=>(F||(F=S||""),F!==e&&!F.includes(`${e}-`))),O=[];C.map((F,S)=>{if(b&&S>=b)return;const I=Pt(u??[]);e&&(y||I.push({condition:H=>{var E;const V=H[e].toLowerCase(),ae=((E=H[`${e}-all`])==null?void 0:E.length)??0,ne=new Set(H[`${e}-all`].map(Y=>Y.toLowerCase()));return ne.has(V)&&ne.size<ae},error:h==null?void 0:h.formatMessage({id:"form_error_multipleInputs_same"})}),I.forEach(H=>{const{condition:V,error:ae}=H;if(typeof V=="function")H.condition=ne=>{var q;let E=(q=ne==null?void 0:ne[e])==null?void 0:q[S];E||(ne[e]&&!Array.isArray(ne[e])?E=ne[e]:E="");const Y=Pt(ne);return Y[e]=E,Y[`${e}-all`]=ne[e],typeof V=="function"&&V(Y)?ae:!1};else{const ne=V;H.condition=E=>{var q;let Y=(q=E==null?void 0:E[e])==null?void 0:q[S];switch(Y||(E[e]&&!Array.isArray(E[e])?Y=E[e]:Y=""),ne){case"required":ae||(H.error=h==null?void 0:h.formatMessage({id:"form_error_required"}));break;case"no-numbers":ae||(H.error=h==null?void 0:h.formatMessage({id:"form_error_numbers"}));break;case"valid-email":ae||(H.error=ae||(h==null?void 0:h.formatMessage({id:"form_error_email"})));break;case"valid-url":ae||(H.error=h==null?void 0:h.formatMessage({id:"form_error_url"}));break;default:console.warn("WARNING! No field validation condition has been set")}return Or(ne,Y)?H.error:!1}}}),O.push({id:`${e}-${S}`,validation:I,value:F}))});const A={fieldsToValidate:z.concat(O)};l.multipleInputs.includes(e)&&(A.multipleInputs=l.multipleInputs.filter(F=>F!==e)),l.setFields(F=>({...F,...A}))};x.useEffect(()=>{_()},[C.length]),x.useEffect(()=>{!l||!l.multipleInputs||l.multipleInputs.includes(e)&&_()},[l==null?void 0:l.multipleInputs]);const B=()=>{(!b||C.length<b)&&k([...C,""])},P=z=>{const O=document.getElementById(`${e}-${z+1}`);O==null||O.focus()},N=(z,O)=>z.replace("{number}",O+1);return c.jsxs("fieldset",{className:K("multiple-inputs field-wrapper",{"has-button":v,"has-legend":t}),children:[t?c.jsxs("legend",{className:"legend-as-label text-small",children:[t,p?c.jsxs(c.Fragment,{children:[" ",c.jsx("small",{className:"filled-in-count","aria-label":h.formatMessage({id:"form_multipleInputs_filledInCount_aria"},{number:D.length,total:b}),children:h.formatMessage({id:"form_multipleInputs_filledInCount"},{number:D.length,total:b})})]}):""]}):c.jsx(c.Fragment,{}),C.map((z,O)=>{if(b&&O>=b)return c.jsx(c.Fragment,{});let A=!1;t?A=c.jsx(Oe,{showOnFocus:!1,children:h.formatMessage({id:"form_multipleInputs_label"},{number:O+1})}):g&&(A=N(g,O));const F=`${e}-${O}`,S=O+1>f;return c.jsx(Nf,{id:F,type:"text",label:A,value:z,placeholder:i?N(i,O):void 0,className:K({"has-remove-button":S}),limit:n,error:s&&typeof s!="string"?s==null?void 0:s[F]:void 0,functions:{...a,onFocus:()=>{v||O!==C.length-1||B()},onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),I.stopPropagation(),Ka&&clearTimeout(Ka),O!==C.length-1?P(O):(B(),Ka=setTimeout(()=>P(O),100)))},onChange:I=>{const H=C[O].toLowerCase(),V=Pt(C);V[O]=I,k(V),l==null||l.dispatch({type:"removeError",payload:{key:F}}),y||V.forEach((ae,ne)=>{Kr(ae)&&ne!==O&&ae.toLowerCase()===H&&(l==null||l.dispatch({type:"removeError",payload:{key:`${e}-${ne}`}}))}),a==null||a.onChange(V)}},siblings:S?c.jsx(we,{variant:"tertiary",size:"small",icon:"close",screenreaderText:h.formatMessage({id:"form_multipleInputs_remove"}),onClick:()=>{const I=Pt(C);I.splice(O,1),k(I),l==null||l.dispatch({type:"removeError",payload:{key:F}}),a==null||a.onChange(I)}}):void 0,...m},F)}),v?c.jsx(we,{...v,onClick:B,disabled:!!(b&&b<=C.length)}):c.jsx(c.Fragment,{})]})};const ll=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:i,multiSelect:a=!1,name:s,options:o,required:u,type:l="checkboxes",value:d,accessibilityOptions:m,styling:{displayOptionsAsPills:h=!1}={},multipleOptions:p,...g})=>{const f=ie.useIntl(),b=a?d:[],v=d;return c.jsx("ul",{...g,className:K("options-wrapper",e,{"with-pills filters":h}),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:y,label:C=!1,value:k=y,disabled:D=void 0})=>{const _=`${r}_${y}`;D===void 0&&(D=p!=null&&p.limit?b.length>=p.limit&&!b.includes(k):!1);const B=()=>{if(D)return;let P;if(a){const N=b==null?void 0:b.indexOf(k);Array.isArray(b)&&N>=0?(P=b,P.splice(N,1)):(!b||b.length===0?P=[]:P=b,P.push(k))}else P=v===k?void 0:k;t.onChange(P)};return c.jsx(qo,{element:"li",id:_,type:l==="checkboxes"?"checkbox":"radio",shownValue:k,value:a?b==null?void 0:b.includes(k):v===k,functions:{...t,onChange:B},intlPath:n,label:C||f.formatMessage({id:n?`${n}_${y}`:y}),disabled:D,accessibilityOptions:m,className:K({disabled:D})},_)})})};const Mf=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...i})=>{const a=ie.useIntl(),s=x.useRef(),o=e||s,[u,l]=x.useState(!1),[d,m]=x.useState(t),h=()=>{var p;l(!u),m(u?"password":"text"),(p=o.current)==null||p.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:K("show-password gtm-trackable",{"password-visible":u}),"data-gtm-event-context":n,"data-gtm-event-type":`${u?"hide":"show"}-password-click`,onClick:h,"aria-label":a.formatMessage({id:`showpassword_aria_${u?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${u?"hide":"show"}`})}),c.jsx(Jn,{inputRef:o,type:d,autoComplete:r,...i})]})};const Hn={text:{component:Jn},email:{component:Jn},url:{component:Jn},textarea:{component:Jn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:qo},checkboxes:{component:ll,props:{multiSelect:!0}},radio:{component:ll,props:{multiSelect:!1}},select:{component:eb},password:{component:Mf},autocomplete:{component:Jv},"multiple-inputs":{component:c.jsx(c.Fragment,{})}},Nf=e=>{const t=ie.useIntl(),{id:n,intlPath:r=!1,className:i="",error:a,functions:s={onChange:()=>{}},limit:o=0,showRequiredLabels:u=!0,type:l,validation:d,value:m,submitOnEnter:h,fieldData:p,siblings:g,...f}=e;if(l&&l==="multiple-inputs")return c.jsx(tb,{...e});const b=d&&d.some(({condition:S})=>S==="required"),v=ba(m),y=l&&Hn[l]&&Hn[l].component?Hn[l].component:Jn,C=l&&["checkboxes","radio"].includes(l),k=l&&["autocomplete"].includes(l),D=a&&`error-${n}`,_=`character-limit-${n}`,B={};C?B.element="legend":B.htmlFor=n;let P={...f,id:n,name:n,className:a?"error":"",type:l,required:b,"aria-required":b,functions:Pt(s),value:m};const N=S=>{P["aria-describedby"]?P["aria-describedby"]+=` ${S}`:P["aria-describedby"]=S};if(o>0){const S=Pf(o,s);N(`${_}-info`),P={...P,...S},S.functions&&typeof S.functions=="object"&&(P.functions={...P.functions,...S.functions})}l&&Hn[l]&&Hn[l].props&&(P={...P,...Hn[l].props}),C&&(P.intlPath=`${r}_${n}`),a&&(P["aria-invalid"]=!0,P["aria-errormessage"]=D,N(D));const z=f.label||t.formatMessage({id:r?`${r}_${n}`:n}),O=({...S})=>a?x.createElement(S.as||"p",{id:D,className:"error text-small",...S},a):null;if(l&&["checkbox"].includes(l))return c.jsxs(c.Fragment,{children:[c.jsx(y,{...P,label:z,className:K("field-wrapper",i)}),c.jsx(O,{as:"p"})]});const A={};C?B.className="legend-as-label text-small":A.className="field-label";const F=({element:S,...I})=>x.createElement(S||"label",{...I,"data-testid":`label-${n}`});return c.jsx(c.Fragment,{children:x.createElement(C?"fieldset":"div",{className:K("field-wrapper text-small",i,`${l}-wrapper`,{"multiple-options-wrapper":C})},c.jsxs(c.Fragment,{children:[f.label===!1?c.jsx(c.Fragment,{}):x.createElement(C?x.Fragment:"p",A,c.jsxs(F,{...B,children:[z,b&&u&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",t.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),x.createElement(C||k?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(y,{...P}),c.jsx(zo,{id:_,limit:o,valueLength:v}),g]})),c.jsx(O,{})]}))})},nb=(e,t)=>{const{type:n,payload:r}=t,i=e.errors?Pt(e.errors):{},a=e.values?Pt(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:i,[r==null?void 0:r.key]:r==null?void 0:r.value};a[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:i,values:a};case"addError":return r!=null&&r.key&&!i[r==null?void 0:r.key]&&(i[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:i};case"removeError":return r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],{...e,errors:i};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:u=()=>{},onFailure:l=()=>{},intl:d}=r,m=Pt(Object.keys(i));for(const h of s)if(h.validation)for(let p=0;p<h.validation.length;p++){const{condition:g="required",error:f=!1}=h.validation[p];let b=!1;if(typeof g=="function"){const v=g(a);v&&(b=f||v)}else{const v=a[h.id],y=g;switch(y){case"required":Or(y,v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{Or(y,v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{Or(y,v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{Or(y,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:h.id,value:b}}),m.push(h.id);break}}return m.length===0?u(a):l(a,m),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Za=null;const Xt=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:i,intlPath:a=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:u,children:l,gtm:d={context:"Form",event:"form-submit-click"},functions:m,...h})=>{const p=(t||[]).filter(W=>W.type==="multiple-inputs").map(W=>W.id),[g,f]=x.useState({fieldsToValidate:t,multipleInputs:p});x.useEffect(()=>{g.multipleInputs.length||f(W=>({...W,fieldsToValidate:t,multipleInputs:p}))},[t.length]);const{customOnSubmit:b,hideButton:v,...y}=s,C=40,{shouldShowCancelButton:k=!1,shouldReset:D=!0,shouldHide:_=!0,showRequiredLabels:B=!0,showSuccessMessage:P=!1,shouldScrollOnSuccess:N=!0}=u||{},{onSuccess:z=async()=>{},onCancel:O=()=>{},onCatch:A=()=>{},onFailure:F=()=>{}}=m||{},S=ie.useIntl(),I={};t.length&&t.forEach(W=>{const te=W.id||W.name;te&&(I[te]=W.value||"")});const[H,V]=x.useReducer(nb,{isSubmitting:!1,formSubmitted:!1,errors:{},values:I}),{errors:ae,isSubmitting:ne,formSubmitted:E,values:Y}=H;x.useEffect(()=>{D&&E&&(Za=setTimeout(()=>{V({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[E]),x.useEffect(()=>()=>{Za&&clearTimeout(Za)},[]),x.useEffect(()=>{const W=te=>{V({type:"updateValue",payload:{key:te.detail.id,value:te.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",W),()=>{document.removeEventListener("dropdownMultiSelectSubmit",W)}},[]);const q=x.useRef(null),T=i||q,j=Wr(()=>{if(!ne){if(V({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&V({type:"submitForm",payload:{fields:g.fieldsToValidate,dispatch:V,intl:S}});return}V({type:"submitForm",payload:{fields:g.fieldsToValidate,dispatch:V,onSuccess:async W=>{N&&M();try{await z(W),V({type:D?"formSubmittedAndReset":"formSubmitted"})}catch(te){A(te),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(W,te)=>{M(),F(W,te),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:S}})}},100);if(!t.length)return null;const R={};s.children&&(R.default=s.children),y.text&&typeof y.text=="string"&&(R.default=y.text),["default","submitting","submitted"].forEach(W=>{y.text&&typeof y.text!="string"&&W in y.text?R[W]=y.text[W]:R[W]||(R[W]=S.formatMessage({id:`form_${W==="default"?"submit":W}`}))}),delete y.text;const M=()=>{var de;let W=0;if((de=T==null?void 0:T.current)!=null&&de.id){const J=document.getElementById(T.current.id);J&&(W=J.getBoundingClientRect().top+window.scrollY)}const te=document.getElementById("header");te&&(W=W-te.offsetHeight-C),W<0&&(W=0),window.scrollTo({top:W,behavior:"smooth"})},U=W=>{W.preventDefault(),W.stopPropagation(),!ne&&j()},X=[{...y,icon:E?{icon:"tick",position:"left"}:!1,className:K("gtm-trackable",y.className),onClick:U,disabled:ne||E||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:R[ne?"submitting":E?"submitted":"default"]}];return k&&X.unshift({...o,className:K("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:ne||E,onClick:O,children:o.text||S.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[x.createElement(e,{...h,id:r,className:K("form",n),ref:T},c.jsxs(c.Fragment,{children:[ae!=null&&ae.general?c.jsx(Qt,{variant:"error",text:S.formatMessage({id:"form_error_generalError"})}):null,l,(!_||!ne&&!E||b)&&t.map((W,te)=>{const{id:de=W.name||te,component:J,functions:ve={onChange:()=>{}},submitOnEnter:me=!1}=W;if(J)return c.jsx(J,{...W.props||{}},`component-${de}-${te}`);const ye=(Y==null?void 0:Y[de])||"",_e={...ve,onChange:De=>{V({type:"updateValue",payload:{key:de,value:De}}),ve.onChange(De,V)}};return me&&(_e.onKeyDown=De=>{De.key==="Enter"&&(De.stopPropagation(),De.preventDefault(),j()),ve.onKeyDown&&ve.onKeyDown(De)}),c.jsx(Nf,{intlPath:a,...W,showRequiredLabels:B,value:ye,error:W.type==="multiple-inputs"?ae:ae==null?void 0:ae[de],functions:_e,fieldData:{fields:g.fieldsToValidate,multipleInputs:g.multipleInputs,setFields:f,dispatch:V}},de)}),v?null:(ne||E)&&b?b:c.jsx(vr,{className:K("cta",{center:ne||E,submitted:E}),buttons:X})]})),P&&E&&c.jsx(ur,{className:"success",children:typeof P=="string"?P:S.formatMessage({id:"form_success"})})]})};const yi="passwordRules_",If="isMoreThanEightCharacters",Rf="includesNumberAndSymbol",$f="includesLowerAndUppercase",rb={[If]:"8Characters",[Rf]:"numberSymbol",[$f]:"lowercaseUppercase"},ib=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ie.useIntl();return c.jsxs("aside",{className:K("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${yi}intro`})}),c.jsx("ul",{children:[If,Rf,$f].map(r=>c.jsxs("li",{className:K({matches:e[r]}),children:[c.jsxs(Oe,{children:[n.formatMessage({id:`${yi}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${yi}rule_${rb[r]}`})}),!e[r]&&c.jsxs(Oe,{element:"strong",children:[" ",n.formatMessage({id:`${yi}notMet`})]})]},`rule-${r}`))})]})},Lf=x.memo(ib);const ab=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:i=()=>{}},className:a="",hasLoaded:s=!1})=>{const o=ie.useIntl(),[u,l]=x.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const v=await n();l(y=>({...y,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){l(y=>({...y,setUp:!0,disabled:!0})),i(v)}};if(x.useEffect(()=>{s&&!u.setUp&&d()},[s]),!s)return c.jsx(Nt,{className:"rating-placeholder"});const{id:m,rating:h,disabled:p}=u,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||p))try{l(y=>({...y,rating:v,disabled:!0})),await r({id:m,value:v})}catch(y){l(C=>({...C,rating:null})),i(y)}finally{l(y=>({...y,disabled:!1}))}};return c.jsxs("div",{className:K("rating",a),children:[c.jsx("span",{className:"label",children:f[h?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const y=v+1;return c.jsx("li",{className:K({selected:h&&y<=h}),children:c.jsx(we,{variant:"tertiary",size:"small",icon:{icon:`star${!h||y>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:y,total:t})}${y===1||y===t?` - ${f[y===1?"low":"high"]}`:""}`,onClick:C=>{C.preventDefault(),C.stopPropagation(),b(y)},disabled:p})},`rating-${y}`)})})]})},sb={id:"",showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},enrichedUrl:void 0,onMention:()=>{},getLinkPreview:()=>Promise.resolve({}),reportError:e=>{console.error(e)}},cn=x.createContext(sb),ob={tabbableOption:"",setFocus:()=>{},openTooltip:null,dispatch:()=>{}},ai=x.createContext(ob);var Z=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e.h3="heading_three",e))(Z||{}),Kt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Kt||{});const ub=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case Z.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case Z.link:return c.jsx("a",{...e,children:t});case Z.li:return c.jsx("li",{...e,children:t});case Z.mention:const i=r;return i!=null&&i.name&&i.name===Vr?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(ie.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(i==null?void 0:i.name)||"",t]});case Z.ol:return c.jsx("ol",{...e,children:t});case Z.ul:return c.jsx("ul",{...e,children:t});case Z.span:return c.jsx("span",{...e,children:t});case Z.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},lb=({attributes:e,children:t,leaf:n})=>{const r=n;return r[Z.bold]&&(t=c.jsx("strong",{children:t})),r[Z.italic]&&(t=c.jsx("em",{children:t})),r[Z.strikethrough]&&(t=c.jsx("s",{children:t})),r[Z.h3]&&(t=c.jsx("h3",{children:t})),c.jsx("span",{...e,children:t})};var cb=mb,zf="֑-߿יִ-﷽ﹰ-ﻼ",qf="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",db=new RegExp("^[^"+qf+"]*["+zf+"]"),fb=new RegExp("^[^"+zf+"]*["+qf+"]");function mb(e){return e=String(e||""),db.test(e)?"rtl":fb.test(e)?"ltr":"neutral"}const Uf=$n(cb);function hb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Uo=hb,pb=typeof ci=="object"&&ci&&ci.Object===Object&&ci,gb=pb,vb=gb,bb=typeof self=="object"&&self&&self.Object===Object&&self,yb=vb||bb||Function("return this")(),Wf=yb,xb=Wf,wb=function(){return xb.Date.now()},Cb=wb,Db=/\s/;function Eb(e){for(var t=e.length;t--&&Db.test(e.charAt(t)););return t}var _b=Eb,kb=_b,Fb=/^\s+/;function Ab(e){return e&&e.slice(0,kb(e)+1).replace(Fb,"")}var Tb=Ab,Bb=Wf,Sb=Bb.Symbol,Vf=Sb,cl=Vf,Hf=Object.prototype,jb=Hf.hasOwnProperty,Pb=Hf.toString,Tr=cl?cl.toStringTag:void 0;function Ob(e){var t=jb.call(e,Tr),n=e[Tr];try{e[Tr]=void 0;var r=!0}catch{}var i=Pb.call(e);return r&&(t?e[Tr]=n:delete e[Tr]),i}var Mb=Ob,Nb=Object.prototype,Ib=Nb.toString;function Rb(e){return Ib.call(e)}var $b=Rb,dl=Vf,Lb=Mb,zb=$b,qb="[object Null]",Ub="[object Undefined]",fl=dl?dl.toStringTag:void 0;function Wb(e){return e==null?e===void 0?Ub:qb:fl&&fl in Object(e)?Lb(e):zb(e)}var Vb=Wb;function Hb(e){return e!=null&&typeof e=="object"}var Kb=Hb,Zb=Vb,Yb=Kb,Gb="[object Symbol]";function Qb(e){return typeof e=="symbol"||Yb(e)&&Zb(e)==Gb}var Jb=Qb,Xb=Tb,ml=Uo,e0=Jb,hl=0/0,t0=/^[-+]0x[0-9a-f]+$/i,n0=/^0b[01]+$/i,r0=/^0o[0-7]+$/i,i0=parseInt;function a0(e){if(typeof e=="number")return e;if(e0(e))return hl;if(ml(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ml(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Xb(e);var n=n0.test(e);return n||r0.test(e)?i0(e.slice(2),n?2:8):t0.test(e)?hl:+e}var s0=a0,o0=Uo,Ya=Cb,pl=s0,u0="Expected a function",l0=Math.max,c0=Math.min;function d0(e,t,n){var r,i,a,s,o,u,l=0,d=!1,m=!1,h=!0;if(typeof e!="function")throw new TypeError(u0);t=pl(t)||0,o0(n)&&(d=!!n.leading,m="maxWait"in n,a=m?l0(pl(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h);function p(_){var B=r,P=i;return r=i=void 0,l=_,s=e.apply(P,B),s}function g(_){return l=_,o=setTimeout(v,t),d?p(_):s}function f(_){var B=_-u,P=_-l,N=t-B;return m?c0(N,a-P):N}function b(_){var B=_-u,P=_-l;return u===void 0||B>=t||B<0||m&&P>=a}function v(){var _=Ya();if(b(_))return y(_);o=setTimeout(v,f(_))}function y(_){return o=void 0,h&&r?p(_):(r=i=void 0,s)}function C(){o!==void 0&&clearTimeout(o),l=0,r=u=i=o=void 0}function k(){return o===void 0?s:y(Ya())}function D(){var _=Ya(),B=b(_);if(r=arguments,i=this,u=_,B){if(o===void 0)return g(u);if(m)return clearTimeout(o),o=setTimeout(v,t),p(u)}return o===void 0&&(o=setTimeout(v,t)),s}return D.cancel=C,D.flush=k,D}var Kf=d0;const f0=$n(Kf);var m0=Kf,h0=Uo,p0="Expected a function";function g0(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(p0);return h0(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),m0(e,t,{leading:r,maxWait:t,trailing:i})}var v0=g0;const b0=$n(v0),gl=e=>typeof e=="object"&&e!=null&&e.nodeType===1,vl=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Ga=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return vl(n.overflowY,t)||vl(n.overflowX,t)||(r=>{const i=(a=>{if(!a.ownerDocument||!a.ownerDocument.defaultView)return null;try{return a.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!i&&(i.clientHeight<r.scrollHeight||i.clientWidth<r.scrollWidth)})(e)}return!1},xi=(e,t,n,r,i,a,s,o)=>a<e&&s>t||a>e&&s<t?0:a<=e&&o<=n||s>=t&&o>=n?a-e-r:s>t&&o<n||a<e&&o>n?s-t+i:0,y0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},bl=(e,t)=>{var n,r,i,a;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:u,boundary:l,skipOverflowHiddenElements:d}=t,m=typeof l=="function"?l:H=>H!==l;if(!gl(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let g=e;for(;gl(g)&&m(g);){if(g=y0(g),g===h){p.push(g);break}g!=null&&g===document.body&&Ga(g)&&!Ga(document.documentElement)||g!=null&&Ga(g,d)&&p.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(a=(i=window.visualViewport)==null?void 0:i.height)!=null?a:innerHeight,{scrollX:v,scrollY:y}=window,{height:C,width:k,top:D,right:_,bottom:B,left:P}=e.getBoundingClientRect(),{top:N,right:z,bottom:O,left:A}=(H=>{const V=window.getComputedStyle(H);return{top:parseFloat(V.scrollMarginTop)||0,right:parseFloat(V.scrollMarginRight)||0,bottom:parseFloat(V.scrollMarginBottom)||0,left:parseFloat(V.scrollMarginLeft)||0}})(e);let F=o==="start"||o==="nearest"?D-N:o==="end"?B+O:D+C/2-N+O,S=u==="center"?P+k/2-A+z:u==="end"?_+z:P-A;const I=[];for(let H=0;H<p.length;H++){const V=p[H],{height:ae,width:ne,top:E,right:Y,bottom:q,left:T}=V.getBoundingClientRect();if(s==="if-needed"&&D>=0&&P>=0&&B<=b&&_<=f&&D>=E&&B<=q&&P>=T&&_<=Y)return I;const j=getComputedStyle(V),R=parseInt(j.borderLeftWidth,10),M=parseInt(j.borderTopWidth,10),U=parseInt(j.borderRightWidth,10),X=parseInt(j.borderBottomWidth,10);let W=0,te=0;const de="offsetWidth"in V?V.offsetWidth-V.clientWidth-R-U:0,J="offsetHeight"in V?V.offsetHeight-V.clientHeight-M-X:0,ve="offsetWidth"in V?V.offsetWidth===0?0:ne/V.offsetWidth:0,me="offsetHeight"in V?V.offsetHeight===0?0:ae/V.offsetHeight:0;if(h===V)W=o==="start"?F:o==="end"?F-b:o==="nearest"?xi(y,y+b,b,M,X,y+F,y+F+C,C):F-b/2,te=u==="start"?S:u==="center"?S-f/2:u==="end"?S-f:xi(v,v+f,f,R,U,v+S,v+S+k,k),W=Math.max(0,W+y),te=Math.max(0,te+v);else{W=o==="start"?F-E-M:o==="end"?F-q+X+J:o==="nearest"?xi(E,q,ae,M,X+J,F,F+C,C):F-(E+ae/2)+J/2,te=u==="start"?S-T-R:u==="center"?S-(T+ne/2)+de/2:u==="end"?S-Y+U+de:xi(T,Y,ne,R,U+de,S,S+k,k);const{scrollLeft:ye,scrollTop:_e}=V;W=me===0?0:Math.max(0,Math.min(_e+W/me,V.scrollHeight-ae/me+J)),te=ve===0?0:Math.max(0,Math.min(ye+te/ve,V.scrollWidth-ne/ve+de)),F+=_e-W,S+=ye-te}I.push({el:V,top:W,left:te})}return I},x0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function w0(e,t){if(!e.isConnected||!(i=>{let a=i;for(;a&&a.parentNode;){if(a.parentNode===document)return!0;a=a.parentNode instanceof ShadowRoot?a.parentNode.host:a.parentNode}return!1})(e))return;const n=(i=>{const a=window.getComputedStyle(i);return{top:parseFloat(a.scrollMarginTop)||0,right:parseFloat(a.scrollMarginRight)||0,bottom:parseFloat(a.scrollMarginBottom)||0,left:parseFloat(a.scrollMarginLeft)||0}})(e);if((i=>typeof i=="object"&&typeof i.behavior=="function")(t))return t.behavior(bl(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:i,top:a,left:s}of bl(e,x0(t))){const o=a-n.top+n.bottom,u=s-n.left+n.right;i.scroll({top:o,left:u,behavior:r})}}/*!
66
+ ${Ar(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Ar(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,i)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(i))}];const Kv="shareLinks_",Zv=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:i="large",variant:a="default",className:s=""})=>{const o=ie.useIntl(),u=Hv({title:e,link:t,referrer:n});return c.jsxs("aside",{className:K("share-links",i,a,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:u.map(({key:l,icon:d,url:h,shouldRender:m=!0,onClick:p})=>{if(typeof m=="function"&&!m())return null;const g={};return p&&(g.onClick=f=>p(f,h)),c.jsx("li",{children:c.jsx(we,{size:i,variant:"tertiary",icon:{icon:d||l},href:h,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${l}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${Kv}link_${l}`}),...g})},l)})})]})};const Yv=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(f,b,v)=>(f||(f=`panel-${window.btoa(b)}-${v}`),f),i=wn(!0)||0;let a=e.findIndex(f=>f.current===!0);if(a<0&&(a=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){a=v;break}}}const[s,o]=x.useState((g=e[a])!=null&&g.id?e[a].id:r(e[a].id,e[a].text,a)),[u,l]=x.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 y=r(e[v].id,e[v].text,v),C=document.getElementById(`tab-${y}`);C==null||C.focus(),l(y);break}case"Enter":o(u),window.location.hash=`#${u}`;break}},h=f=>{let b=!1;return f.target==="min-width"&&i>=f.value&&(b=!0),f.target==="max-width"&&i<=f.value&&(b=!0),b};x.useEffect(()=>{if(e[a].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const m=[],p=[];return e.forEach(({id:f,text:b,content:v,href:y,hasCarousel:C,breakpoint:k},D)=>{if(k&&!h(k))return;f=r(f,b,D);const _=s===f,B={};y||(B["aria-controls"]=f,B.onClick=M=>{M.preventDefault(),M.stopPropagation(),o(f),!n&&window.history.replaceState(null,"",`#${f}`)},p.push(c.jsx("section",{id:f,hidden:!_,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":_?"assertive":"off",children:typeof v=="string"?c.jsx("p",{children:v}):v},`section-${f}`))),m.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:y||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:K({selected:_}),role:"tab",tabIndex:_?0:-1,"aria-selected":_,onKeyDown:M=>d(M,D),...B,children:b})},`tab-${f}`))}),c.jsxs("div",{className:K("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:m}),c.jsx("div",{className:"tab-content",children:p})]})};const Gv={"2-1":901,"1-3":769,"1-1":769},jf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:i})=>{const a=wn(!0);let s=i;return x.Children.count(i)===1&&(s=x.Children.toArray(i)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:K("columns",`layout-${e}`,r,{"has-containers":n}),children:x.Children.map(s,(o,u)=>t!==!1&&u===t&&a&&a<Gv[e]?null:o)})};const zo=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const i=ie.useIntl(),a="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),u=n>=.99*t,l=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:K("character-limit",{"near-limit":u,"approaching-limit":l}),"aria-live":"polite","aria-label":d?"":i.formatMessage({id:`${a}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?i.formatMessage({id:`${a}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:i.formatMessage({id:a})}),n," / ",t]})}),c.jsx(Oe,{showOnFocus:!1,id:`${e}-info`,children:i.formatMessage({id:`${a}_info`},{limit:t})})]})},ba=e=>(e==null?void 0:e.toString().length)||0,Pf=(e,t)=>{const n={};return e===0||(n["data-character-limit"]=e,n.functions={...t,onChange:r=>{ba(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t.onChange(r)}}),n};const bi="emailHelperTextBox_",Of=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:i})=>{const a=ie.useIntl(),[s,o]=x.useState({path:`${bi}default`,type:"default",link:{},mail:{},error:""}),[u,l]=x.useState(!1),d=x.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=b=>{o({path:`${bi}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 i!="function"){f(a.formatMessage({id:`${bi}error_noFunction`}));return}l(!0),i(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{l(!1)})},[n,r,i]);x.useEffect(()=>{let g=bi,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:y=>d(y),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",b={href:"/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 h={};return["link","mail"].forEach(g=>{h[g]=Object.keys(s[g]).length?f=>c.jsx("a",{...s[g],children:f}):f=>f}),c.jsx(Rd,{id:e,type:s.type,heading:u?!1:a.formatMessage({id:`${s.path}_title`}),"aria-live":"assertive",children:u?c.jsxs(c.Fragment,{children:[c.jsx(Nt,{element:"span"}),c.jsx(Nt,{element:"span"})]}):a.formatMessage({id:`${s.path}_text`},{...h,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})})},Jn=({className:e="",element:t="input",id:n,inputRef:r,functions:i={onChange:()=>{}},name:a=n,placeholder:s,type:o="text",value:u,autoFocus:l,label:d,styling:h={},...m})=>{const p=x.useRef(),g=r||p,{autosizeToFit:f=!1}=h;xd(f&&t==="textarea",g),x.useEffect(()=>{var v;l&&((v=g.current)==null||v.focus())},[]),!(m!=null&&m.autoComplete)&&["email"].includes(o)&&(m.autoComplete="email");const b={};return t==="input"&&(b.type=o),x.createElement(t,{ref:g,...m,...b,id:n,name:a,className:K(e,t,{autoresize:f}),value:u,placeholder:s,autoFocus:l,...i,onChange:v=>{const y=v.target;i.onChange(y.value)}})};const Vn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Qv=500,Jv=({id:e,name:t=e,value:n,placeholder:r,functions:i={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...a})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=i,[{input:u,displayInput:l,debouncedInput:d},h]=x.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:m,activePredictionIndex:p,isPredictionSelected:g},f]=x.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=ie.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),x.useEffect(()=>{const k=setTimeout(()=>{g||h(D=>({...D,debouncedInput:u}))},Qv);return()=>{clearTimeout(k)}},[u,g]),x.useEffect(()=>{d&&!g?(async()=>{try{const D=await o(d)||[];f(_=>({..._,predictions:D}))}catch(D){console.error("Error fetching predictions:",D),f(_=>({..._,predictions:[]}))}})():f(k=>({...k,predictions:[]}))},[d,g]),x.useEffect(()=>{p>=0&&m[p]&&h(k=>({...k,displayInput:m[p].description}))},[p,m]);const v=k=>{[Vn.DOWN,Vn.UP,Vn.ENTER].includes(k.key)&&(k.preventDefault(),k.key===Vn.DOWN&&p<m.length-1?f(D=>({...D,activePredictionIndex:p+1})):k.key===Vn.UP&&p>0?f(D=>({...D,activePredictionIndex:p-1})):k.key===Vn.ENTER&&p>-1&&(s(m[p].description),h(D=>({...D,input:m[p].description})),f(D=>({...D,predictions:[],isPredictionSelected:!0}))))},y=k=>{s(k.target.value),h(D=>({...D,input:k.target.value,displayInput:k.target.value})),f(D=>({...D,activePredictionIndex:-1,isPredictionSelected:!1}))},C=k=>{s(k.description),h(D=>({...D,input:k.description,displayInput:k.description})),f(D=>({...D,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:l,onChange:y,onKeyDown:v,placeholder:r,name:t,id:e,...a}),c.jsx("ul",{className:"predictions-list",children:m.map((k,D)=>c.jsx("li",{onClick:()=>C(k),onMouseEnter:()=>f(_=>({..._,activePredictionIndex:D})),className:K("predictions-list-item",{active:D===p}),children:k.description},D))})]})};const qo=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:i,inputRef:a,intlPath:s=!1,label:o,shownValue:u=!0,type:l="checkbox",value:d,accessibilityOptions:{checkboxes:{navigateWithArrowKeys:h=!1}={}}={},...m})=>{const p=ie.useIntl(),{onChange:g,...f}=r,b=()=>{t||g(d?null:u)},v=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:a,id:i,name:i,type:l,value:u,checked:d,readOnly:!0,disabled:t,tabIndex:-1}),c.jsx("span",{className:K("pretty-checkbox",{radio:l==="radio"}),"data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:i,onKeyDown:y=>{(y.key==="Enter"||y.code==="Space")&&(y.preventDefault(),y.stopPropagation(),b())},tabIndex:d||!h?0:-1,children:o||p.formatMessage({id:s?`${s}_${i}`:i})})]});return x.createElement(n,{onClick:y=>{const C=y.target;C.nodeName.toLowerCase()==="a"||C.parentNode&&C.parentNode.nodeName.toLowerCase()==="a"||(y.preventDefault(),y.stopPropagation(),b())},onKeyDown:h?y=>{var C,k,D;if(y.key!=="Tab")switch(y.code){case"Enter":case"Space":y.stopPropagation(),y.preventDefault(),b();break;case"ArrowLeft":case"ArrowRight":y.stopPropagation(),y.preventDefault();const _=y.currentTarget;let B=_==null?void 0:_.nextElementSibling;if(y.key==="ArrowLeft"){const M=_==null?void 0:_.previousElementSibling;M?B=M:B=(C=_==null?void 0:_.parentElement)==null?void 0:C.lastElementChild}else B||(B=(k=_==null?void 0:_.parentElement)==null?void 0:k.firstElementChild);B&&((D=B==null?void 0:B.querySelector("label"))==null||D.focus());break}}:void 0,className:K(i,"checkbox-wrapper",e,{"is-checked":d}),...m,...f},v)};const Xv=x.memo(function({direction:t="down"}){return c.jsx(fa,{className:K("rotating-chevron",`direction-${t}`)})});const eb=({className:e,options:t,initialValue:n,value:r,functions:i={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:a}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:u,id:l})=>{const d=ie.useIntl(),[h,m]=x.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[f,b]=x.useState(g);let v;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?v=t&&f?t.find(B=>B.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?v=f[0]:v={id:"",label:""},x.useEffect(()=>{b(g)},[r,n]);const{onChange:y,onMultiSelectSubmit:C,...k}=i,D=B=>{if(o){let M=[];f!=null&&f.includes(B.id)?M=f.filter(P=>P!==B.id):M=[...f,B.id],b([...M]),y&&y([...M])}else b([B]),y&&y(B.id),m(!1)},_=B=>{if(B==="all"){const M=(t==null?void 0:t.map(P=>P.id))||[];b(M),y&&y(M)}else b([]),y&&y([])};return c.jsxs("div",{className:K("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":h,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:B=>{B.preventDefault(),B.stopPropagation(),m(!h)},"data-testid":"dropdown-selector",...k,children:[o?`${s} · ${f.length}`:v.label,c.jsx(Xv,{direction:h?"up":"down"})]}),c.jsx("select",{defaultValue:v.id,onChange:B=>{B.preventDefault(),B.stopPropagation();const M=t&&t.find(P=>P.id===B.target.value);D(M)},hidden:!h,...k,children:t==null?void 0:t.map(B=>c.jsx("option",{value:B.id,className:"gtm-trackable","data-gtm-event-type":`${B.id}-click`,"data-gtm-event-context":a,children:B.label},B.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!h,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(u==null?void 0:u.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(we,{variant:"tertiary",size:"small",onClick:()=>_("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":a,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(we,{variant:"tertiary",size:"small",onClick:()=>_("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":a,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(B=>{const M=B.id===v.id||(f==null?void 0:f.includes(B))||(f==null?void 0:f.includes(B.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:K("gtm-trackable",{selected:M,"selected-single":M&&!o}),"data-gtm-event-type":`${B.id}-click`,"data-gtm-event-context":a,onClick:P=>{P.preventDefault(),P.stopPropagation(),D(B)},role:"menuitem","aria-current":M,"data-testid":M?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:K({"menu-option-label":o}),children:B.label})]})},B.id)})})]}),(u==null?void 0:u.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(we,{variant:"secondary",onClick:()=>{C&&C(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:l||"dropdown-multi-select",value:f}})),m(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})},Or=(e,t)=>{switch(e){case"required":if(!t||typeof t=="string"&&t.trim().length===0)return!0;break;case"no-numbers":if(t&&!/^([^0-9]*)$/.test(t))return!0;break;case"valid-email":if(t&&!/^(([^<>()[\]\\.,;:\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(t))return!0;break;case"valid-url":if(t&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=%]+$/i.test(t))return!0;break;default:return!1}return!1};let Ka=null;const tb=({id:e,label:t,limit:n,value:r,placeholder:i,functions:a,error:s,multipleInputs:o,validation:u,fieldData:l,type:d,...h})=>{const m=ie.useIntl(),{showCount:p=!1,label:g,defaultInputs:f=1,maxInputs:b=100,hasButton:v=!1,allowDuplicateValues:y=!1}=o||{},[C,k]=x.useState(r?Array.isArray(r)?r:[r]:Array(f).fill("")),D=C.filter(z=>z!==""),_=()=>{if(!l)return;const z=Pt(l.fields).filter(({id:F,name:S})=>(F||(F=S||""),F!==e&&!F.includes(`${e}-`))),O=[];C.map((F,S)=>{if(b&&S>=b)return;const I=Pt(u??[]);e&&(y||I.push({condition:H=>{var E;const V=H[e].toLowerCase(),ae=((E=H[`${e}-all`])==null?void 0:E.length)??0,ne=new Set(H[`${e}-all`].map(Y=>Y.toLowerCase()));return ne.has(V)&&ne.size<ae},error:m==null?void 0:m.formatMessage({id:"form_error_multipleInputs_same"})}),I.forEach(H=>{const{condition:V,error:ae}=H;if(typeof V=="function")H.condition=ne=>{var q;let E=(q=ne==null?void 0:ne[e])==null?void 0:q[S];E||(ne[e]&&!Array.isArray(ne[e])?E=ne[e]:E="");const Y=Pt(ne);return Y[e]=E,Y[`${e}-all`]=ne[e],typeof V=="function"&&V(Y)?ae:!1};else{const ne=V;H.condition=E=>{var q;let Y=(q=E==null?void 0:E[e])==null?void 0:q[S];switch(Y||(E[e]&&!Array.isArray(E[e])?Y=E[e]:Y=""),ne){case"required":ae||(H.error=m==null?void 0:m.formatMessage({id:"form_error_required"}));break;case"no-numbers":ae||(H.error=m==null?void 0:m.formatMessage({id:"form_error_numbers"}));break;case"valid-email":ae||(H.error=ae||(m==null?void 0:m.formatMessage({id:"form_error_email"})));break;case"valid-url":ae||(H.error=m==null?void 0:m.formatMessage({id:"form_error_url"}));break;default:console.warn("WARNING! No field validation condition has been set")}return Or(ne,Y)?H.error:!1}}}),O.push({id:`${e}-${S}`,validation:I,value:F}))});const A={fieldsToValidate:z.concat(O)};l.multipleInputs.includes(e)&&(A.multipleInputs=l.multipleInputs.filter(F=>F!==e)),l.setFields(F=>({...F,...A}))};x.useEffect(()=>{_()},[C.length]),x.useEffect(()=>{!l||!l.multipleInputs||l.multipleInputs.includes(e)&&_()},[l==null?void 0:l.multipleInputs]);const B=()=>{(!b||C.length<b)&&k([...C,""])},M=z=>{const O=document.getElementById(`${e}-${z+1}`);O==null||O.focus()},P=(z,O)=>z.replace("{number}",O+1);return c.jsxs("fieldset",{className:K("multiple-inputs field-wrapper",{"has-button":v,"has-legend":t}),children:[t?c.jsxs("legend",{className:"legend-as-label text-small",children:[t,p?c.jsxs(c.Fragment,{children:[" ",c.jsx("small",{className:"filled-in-count","aria-label":m.formatMessage({id:"form_multipleInputs_filledInCount_aria"},{number:D.length,total:b}),children:m.formatMessage({id:"form_multipleInputs_filledInCount"},{number:D.length,total:b})})]}):""]}):c.jsx(c.Fragment,{}),C.map((z,O)=>{if(b&&O>=b)return c.jsx(c.Fragment,{});let A=!1;t?A=c.jsx(Oe,{showOnFocus:!1,children:m.formatMessage({id:"form_multipleInputs_label"},{number:O+1})}):g&&(A=P(g,O));const F=`${e}-${O}`,S=O+1>f;return c.jsx(Nf,{id:F,type:"text",label:A,value:z,placeholder:i?P(i,O):void 0,className:K({"has-remove-button":S}),limit:n,error:s&&typeof s!="string"?s==null?void 0:s[F]:void 0,functions:{...a,onFocus:()=>{v||O!==C.length-1||B()},onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),I.stopPropagation(),Ka&&clearTimeout(Ka),O!==C.length-1?M(O):(B(),Ka=setTimeout(()=>M(O),100)))},onChange:I=>{const H=C[O].toLowerCase(),V=Pt(C);V[O]=I,k(V),l==null||l.dispatch({type:"removeError",payload:{key:F}}),y||V.forEach((ae,ne)=>{Kr(ae)&&ne!==O&&ae.toLowerCase()===H&&(l==null||l.dispatch({type:"removeError",payload:{key:`${e}-${ne}`}}))}),a==null||a.onChange(V)}},siblings:S?c.jsx(we,{variant:"tertiary",size:"small",icon:"close",screenreaderText:m.formatMessage({id:"form_multipleInputs_remove"}),onClick:()=>{const I=Pt(C);I.splice(O,1),k(I),l==null||l.dispatch({type:"removeError",payload:{key:F}}),a==null||a.onChange(I)}}):void 0,...h},F)}),v?c.jsx(we,{...v,onClick:B,disabled:!!(b&&b<=C.length)}):c.jsx(c.Fragment,{})]})};const ll=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:i,multiSelect:a=!1,name:s,options:o,required:u,type:l="checkboxes",value:d,accessibilityOptions:h,styling:{displayOptionsAsPills:m=!1}={},multipleOptions:p,...g})=>{const f=ie.useIntl(),b=a?d:[],v=d;return c.jsx("ul",{...g,className:K("options-wrapper",e,{"with-pills filters":m}),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:y,label:C=!1,value:k=y,disabled:D=void 0})=>{const _=`${r}_${y}`;D===void 0&&(D=p!=null&&p.limit?b.length>=p.limit&&!b.includes(k):!1);const B=()=>{if(D)return;let M;if(a){const P=b==null?void 0:b.indexOf(k);Array.isArray(b)&&P>=0?(M=b,M.splice(P,1)):(!b||b.length===0?M=[]:M=b,M.push(k))}else M=v===k?void 0:k;t.onChange(M)};return c.jsx(qo,{element:"li",id:_,type:l==="checkboxes"?"checkbox":"radio",shownValue:k,value:a?b==null?void 0:b.includes(k):v===k,functions:{...t,onChange:B},intlPath:n,label:C||f.formatMessage({id:n?`${n}_${y}`:y}),disabled:D,accessibilityOptions:h,className:K({disabled:D})},_)})})};const Mf=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...i})=>{const a=ie.useIntl(),s=x.useRef(),o=e||s,[u,l]=x.useState(!1),[d,h]=x.useState(t),m=()=>{var p;l(!u),h(u?"password":"text"),(p=o.current)==null||p.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:K("show-password gtm-trackable",{"password-visible":u}),"data-gtm-event-context":n,"data-gtm-event-type":`${u?"hide":"show"}-password-click`,onClick:m,"aria-label":a.formatMessage({id:`showpassword_aria_${u?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${u?"hide":"show"}`})}),c.jsx(Jn,{inputRef:o,type:d,autoComplete:r,...i})]})};const Hn={text:{component:Jn},email:{component:Jn},url:{component:Jn},textarea:{component:Jn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:qo},checkboxes:{component:ll,props:{multiSelect:!0}},radio:{component:ll,props:{multiSelect:!1}},select:{component:eb},password:{component:Mf},autocomplete:{component:Jv},"multiple-inputs":{component:c.jsx(c.Fragment,{})}},Nf=e=>{const t=ie.useIntl(),{id:n,intlPath:r=!1,className:i="",error:a,functions:s={onChange:()=>{}},limit:o=0,showRequiredLabels:u=!0,type:l,validation:d,value:h,submitOnEnter:m,fieldData:p,siblings:g,...f}=e;if(l&&l==="multiple-inputs")return c.jsx(tb,{...e});const b=d&&d.some(({condition:S})=>S==="required"),v=ba(h),y=l&&Hn[l]&&Hn[l].component?Hn[l].component:Jn,C=l&&["checkboxes","radio"].includes(l),k=l&&["autocomplete"].includes(l),D=a&&`error-${n}`,_=`character-limit-${n}`,B={};C?B.element="legend":B.htmlFor=n;let M={...f,id:n,name:n,className:a?"error":"",type:l,required:b,"aria-required":b,functions:Pt(s),value:h};const P=S=>{M["aria-describedby"]?M["aria-describedby"]+=` ${S}`:M["aria-describedby"]=S};if(o>0){const S=Pf(o,s);P(`${_}-info`),M={...M,...S},S.functions&&typeof S.functions=="object"&&(M.functions={...M.functions,...S.functions})}l&&Hn[l]&&Hn[l].props&&(M={...M,...Hn[l].props}),C&&(M.intlPath=`${r}_${n}`),a&&(M["aria-invalid"]=!0,M["aria-errormessage"]=D,P(D));const z=f.label||t.formatMessage({id:r?`${r}_${n}`:n}),O=({...S})=>a?x.createElement(S.as||"p",{id:D,className:"error text-small",...S},a):null;if(l&&["checkbox"].includes(l))return c.jsxs(c.Fragment,{children:[c.jsx(y,{...M,label:z,className:K("field-wrapper",i)}),c.jsx(O,{as:"p"})]});const A={};C?B.className="legend-as-label text-small":A.className="field-label";const F=({element:S,...I})=>x.createElement(S||"label",{...I,"data-testid":`label-${n}`});return c.jsx(c.Fragment,{children:x.createElement(C?"fieldset":"div",{className:K("field-wrapper text-small",i,`${l}-wrapper`,{"multiple-options-wrapper":C})},c.jsxs(c.Fragment,{children:[f.label===!1?c.jsx(c.Fragment,{}):x.createElement(C?x.Fragment:"p",A,c.jsxs(F,{...B,children:[z,b&&u&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",t.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),x.createElement(C||k?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(y,{...M}),c.jsx(zo,{id:_,limit:o,valueLength:v}),g]})),c.jsx(O,{})]}))})},nb=(e,t)=>{const{type:n,payload:r}=t,i=e.errors?Pt(e.errors):{},a=e.values?Pt(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:i,[r==null?void 0:r.key]:r==null?void 0:r.value};a[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:i,values:a};case"addError":return r!=null&&r.key&&!i[r==null?void 0:r.key]&&(i[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:i};case"removeError":return r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],{...e,errors:i};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:u=()=>{},onFailure:l=()=>{},intl:d}=r,h=Pt(Object.keys(i));for(const m of s)if(m.validation)for(let p=0;p<m.validation.length;p++){const{condition:g="required",error:f=!1}=m.validation[p];let b=!1;if(typeof g=="function"){const v=g(a);v&&(b=f||v)}else{const v=a[m.id],y=g;switch(y){case"required":Or(y,v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{Or(y,v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{Or(y,v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{Or(y,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:m.id,value:b}}),h.push(m.id);break}}return h.length===0?u(a):l(a,h),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Za=null;const Xt=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:i,intlPath:a=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:u,children:l,gtm:d={context:"Form",event:"form-submit-click"},functions:h,...m})=>{const p=(t||[]).filter(W=>W.type==="multiple-inputs").map(W=>W.id),[g,f]=x.useState({fieldsToValidate:t,multipleInputs:p});x.useEffect(()=>{g.multipleInputs.length||f(W=>({...W,fieldsToValidate:t,multipleInputs:p}))},[t.length]);const{customOnSubmit:b,hideButton:v,...y}=s,C=40,{shouldShowCancelButton:k=!1,shouldReset:D=!0,shouldHide:_=!0,showRequiredLabels:B=!0,showSuccessMessage:M=!1,shouldScrollOnSuccess:P=!0}=u||{},{onSuccess:z=async()=>{},onCancel:O=()=>{},onCatch:A=()=>{},onFailure:F=()=>{}}=h||{},S=ie.useIntl(),I={};t.length&&t.forEach(W=>{const te=W.id||W.name;te&&(I[te]=W.value||"")});const[H,V]=x.useReducer(nb,{isSubmitting:!1,formSubmitted:!1,errors:{},values:I}),{errors:ae,isSubmitting:ne,formSubmitted:E,values:Y}=H;x.useEffect(()=>{D&&E&&(Za=setTimeout(()=>{V({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[E]),x.useEffect(()=>()=>{Za&&clearTimeout(Za)},[]),x.useEffect(()=>{const W=te=>{V({type:"updateValue",payload:{key:te.detail.id,value:te.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",W),()=>{document.removeEventListener("dropdownMultiSelectSubmit",W)}},[]);const q=x.useRef(null),T=i||q,j=Wr(()=>{if(!ne){if(V({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&V({type:"submitForm",payload:{fields:g.fieldsToValidate,dispatch:V,intl:S}});return}V({type:"submitForm",payload:{fields:g.fieldsToValidate,dispatch:V,onSuccess:async W=>{P&&N();try{await z(W),V({type:D?"formSubmittedAndReset":"formSubmitted"})}catch(te){A(te),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(W,te)=>{N(),F(W,te),V({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:S}})}},100);if(!t.length)return null;const R={};s.children&&(R.default=s.children),y.text&&typeof y.text=="string"&&(R.default=y.text),["default","submitting","submitted"].forEach(W=>{y.text&&typeof y.text!="string"&&W in y.text?R[W]=y.text[W]:R[W]||(R[W]=S.formatMessage({id:`form_${W==="default"?"submit":W}`}))}),delete y.text;const N=()=>{var de;let W=0;if((de=T==null?void 0:T.current)!=null&&de.id){const J=document.getElementById(T.current.id);J&&(W=J.getBoundingClientRect().top+window.scrollY)}const te=document.getElementById("header");te&&(W=W-te.offsetHeight-C),W<0&&(W=0),window.scrollTo({top:W,behavior:"smooth"})},U=W=>{W.preventDefault(),W.stopPropagation(),!ne&&j()},X=[{...y,icon:E?{icon:"tick",position:"left"}:!1,className:K("gtm-trackable",y.className),onClick:U,disabled:ne||E||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:R[ne?"submitting":E?"submitted":"default"]}];return k&&X.unshift({...o,className:K("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:ne||E,onClick:O,children:o.text||S.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[x.createElement(e,{...m,id:r,className:K("form",n),ref:T},c.jsxs(c.Fragment,{children:[ae!=null&&ae.general?c.jsx(Qt,{variant:"error",text:S.formatMessage({id:"form_error_generalError"})}):null,l,(!_||!ne&&!E||b)&&t.map((W,te)=>{const{id:de=W.name||te,component:J,functions:ve={onChange:()=>{}},submitOnEnter:me=!1}=W;if(J)return c.jsx(J,{...W.props||{}},`component-${de}-${te}`);const ye=(Y==null?void 0:Y[de])||"",_e={...ve,onChange:De=>{V({type:"updateValue",payload:{key:de,value:De}}),ve.onChange(De,V)}};return me&&(_e.onKeyDown=De=>{De.key==="Enter"&&(De.stopPropagation(),De.preventDefault(),j()),ve.onKeyDown&&ve.onKeyDown(De)}),c.jsx(Nf,{intlPath:a,...W,showRequiredLabels:B,value:ye,error:W.type==="multiple-inputs"?ae:ae==null?void 0:ae[de],functions:_e,fieldData:{fields:g.fieldsToValidate,multipleInputs:g.multipleInputs,setFields:f,dispatch:V}},de)}),v?null:(ne||E)&&b?b:c.jsx(vr,{className:K("cta",{center:ne||E,submitted:E}),buttons:X})]})),M&&E&&c.jsx(ur,{className:"success",children:typeof M=="string"?M:S.formatMessage({id:"form_success"})})]})};const yi="passwordRules_",If="isMoreThanEightCharacters",Rf="includesNumberAndSymbol",$f="includesLowerAndUppercase",rb={[If]:"8Characters",[Rf]:"numberSymbol",[$f]:"lowercaseUppercase"},ib=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ie.useIntl();return c.jsxs("aside",{className:K("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${yi}intro`})}),c.jsx("ul",{children:[If,Rf,$f].map(r=>c.jsxs("li",{className:K({matches:e[r]}),children:[c.jsxs(Oe,{children:[n.formatMessage({id:`${yi}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${yi}rule_${rb[r]}`})}),!e[r]&&c.jsxs(Oe,{element:"strong",children:[" ",n.formatMessage({id:`${yi}notMet`})]})]},`rule-${r}`))})]})},Lf=x.memo(ib);const ab=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:i=()=>{}},className:a="",hasLoaded:s=!1})=>{const o=ie.useIntl(),[u,l]=x.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const v=await n();l(y=>({...y,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){l(y=>({...y,setUp:!0,disabled:!0})),i(v)}};if(x.useEffect(()=>{s&&!u.setUp&&d()},[s]),!s)return c.jsx(Nt,{className:"rating-placeholder"});const{id:h,rating:m,disabled:p}=u,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(!(!h||p))try{l(y=>({...y,rating:v,disabled:!0})),await r({id:h,value:v})}catch(y){l(C=>({...C,rating:null})),i(y)}finally{l(y=>({...y,disabled:!1}))}};return c.jsxs("div",{className:K("rating",a),children:[c.jsx("span",{className:"label",children:f[m?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const y=v+1;return c.jsx("li",{className:K({selected:m&&y<=m}),children:c.jsx(we,{variant:"tertiary",size:"small",icon:{icon:`star${!m||y>m?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:y,total:t})}${y===1||y===t?` - ${f[y===1?"low":"high"]}`:""}`,onClick:C=>{C.preventDefault(),C.stopPropagation(),b(y)},disabled:p})},`rating-${y}`)})})]})},sb={id:"",showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},enrichedUrl:void 0,onMention:()=>{},getLinkPreview:()=>Promise.resolve({}),reportError:e=>{console.error(e)}},cn=x.createContext(sb),ob={tabbableOption:"",setFocus:()=>{},openTooltip:null,dispatch:()=>{}},ai=x.createContext(ob);var Z=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e.h3="heading_three",e))(Z||{}),Kt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Kt||{});const ub=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case Z.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case Z.link:return c.jsx("a",{...e,children:t});case Z.li:return c.jsx("li",{...e,children:t});case Z.mention:const i=r;return i!=null&&i.name&&i.name===Vr?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(ie.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(i==null?void 0:i.name)||"",t]});case Z.ol:return c.jsx("ol",{...e,children:t});case Z.ul:return c.jsx("ul",{...e,children:t});case Z.span:return c.jsx("span",{...e,children:t});case Z.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},lb=({attributes:e,children:t,leaf:n})=>{const r=n;return r[Z.bold]&&(t=c.jsx("strong",{children:t})),r[Z.italic]&&(t=c.jsx("em",{children:t})),r[Z.strikethrough]&&(t=c.jsx("s",{children:t})),r[Z.h3]&&(t=c.jsx("h3",{children:t})),c.jsx("span",{...e,children:t})};var cb=mb,zf="֑-߿יִ-﷽ﹰ-ﻼ",qf="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",db=new RegExp("^[^"+qf+"]*["+zf+"]"),fb=new RegExp("^[^"+zf+"]*["+qf+"]");function mb(e){return e=String(e||""),db.test(e)?"rtl":fb.test(e)?"ltr":"neutral"}const Uf=$n(cb);function hb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Uo=hb,pb=typeof ci=="object"&&ci&&ci.Object===Object&&ci,gb=pb,vb=gb,bb=typeof self=="object"&&self&&self.Object===Object&&self,yb=vb||bb||Function("return this")(),Wf=yb,xb=Wf,wb=function(){return xb.Date.now()},Cb=wb,Db=/\s/;function Eb(e){for(var t=e.length;t--&&Db.test(e.charAt(t)););return t}var _b=Eb,kb=_b,Fb=/^\s+/;function Ab(e){return e&&e.slice(0,kb(e)+1).replace(Fb,"")}var Tb=Ab,Bb=Wf,Sb=Bb.Symbol,Vf=Sb,cl=Vf,Hf=Object.prototype,jb=Hf.hasOwnProperty,Pb=Hf.toString,Tr=cl?cl.toStringTag:void 0;function Ob(e){var t=jb.call(e,Tr),n=e[Tr];try{e[Tr]=void 0;var r=!0}catch{}var i=Pb.call(e);return r&&(t?e[Tr]=n:delete e[Tr]),i}var Mb=Ob,Nb=Object.prototype,Ib=Nb.toString;function Rb(e){return Ib.call(e)}var $b=Rb,dl=Vf,Lb=Mb,zb=$b,qb="[object Null]",Ub="[object Undefined]",fl=dl?dl.toStringTag:void 0;function Wb(e){return e==null?e===void 0?Ub:qb:fl&&fl in Object(e)?Lb(e):zb(e)}var Vb=Wb;function Hb(e){return e!=null&&typeof e=="object"}var Kb=Hb,Zb=Vb,Yb=Kb,Gb="[object Symbol]";function Qb(e){return typeof e=="symbol"||Yb(e)&&Zb(e)==Gb}var Jb=Qb,Xb=Tb,ml=Uo,e0=Jb,hl=0/0,t0=/^[-+]0x[0-9a-f]+$/i,n0=/^0b[01]+$/i,r0=/^0o[0-7]+$/i,i0=parseInt;function a0(e){if(typeof e=="number")return e;if(e0(e))return hl;if(ml(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=ml(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Xb(e);var n=n0.test(e);return n||r0.test(e)?i0(e.slice(2),n?2:8):t0.test(e)?hl:+e}var s0=a0,o0=Uo,Ya=Cb,pl=s0,u0="Expected a function",l0=Math.max,c0=Math.min;function d0(e,t,n){var r,i,a,s,o,u,l=0,d=!1,h=!1,m=!0;if(typeof e!="function")throw new TypeError(u0);t=pl(t)||0,o0(n)&&(d=!!n.leading,h="maxWait"in n,a=h?l0(pl(n.maxWait)||0,t):a,m="trailing"in n?!!n.trailing:m);function p(_){var B=r,M=i;return r=i=void 0,l=_,s=e.apply(M,B),s}function g(_){return l=_,o=setTimeout(v,t),d?p(_):s}function f(_){var B=_-u,M=_-l,P=t-B;return h?c0(P,a-M):P}function b(_){var B=_-u,M=_-l;return u===void 0||B>=t||B<0||h&&M>=a}function v(){var _=Ya();if(b(_))return y(_);o=setTimeout(v,f(_))}function y(_){return o=void 0,m&&r?p(_):(r=i=void 0,s)}function C(){o!==void 0&&clearTimeout(o),l=0,r=u=i=o=void 0}function k(){return o===void 0?s:y(Ya())}function D(){var _=Ya(),B=b(_);if(r=arguments,i=this,u=_,B){if(o===void 0)return g(u);if(h)return clearTimeout(o),o=setTimeout(v,t),p(u)}return o===void 0&&(o=setTimeout(v,t)),s}return D.cancel=C,D.flush=k,D}var Kf=d0;const f0=$n(Kf);var m0=Kf,h0=Uo,p0="Expected a function";function g0(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(p0);return h0(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),m0(e,t,{leading:r,maxWait:t,trailing:i})}var v0=g0;const b0=$n(v0),gl=e=>typeof e=="object"&&e!=null&&e.nodeType===1,vl=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Ga=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return vl(n.overflowY,t)||vl(n.overflowX,t)||(r=>{const i=(a=>{if(!a.ownerDocument||!a.ownerDocument.defaultView)return null;try{return a.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!i&&(i.clientHeight<r.scrollHeight||i.clientWidth<r.scrollWidth)})(e)}return!1},xi=(e,t,n,r,i,a,s,o)=>a<e&&s>t||a>e&&s<t?0:a<=e&&o<=n||s>=t&&o>=n?a-e-r:s>t&&o<n||a<e&&o>n?s-t+i:0,y0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},bl=(e,t)=>{var n,r,i,a;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:u,boundary:l,skipOverflowHiddenElements:d}=t,h=typeof l=="function"?l:H=>H!==l;if(!gl(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let g=e;for(;gl(g)&&h(g);){if(g=y0(g),g===m){p.push(g);break}g!=null&&g===document.body&&Ga(g)&&!Ga(document.documentElement)||g!=null&&Ga(g,d)&&p.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(a=(i=window.visualViewport)==null?void 0:i.height)!=null?a:innerHeight,{scrollX:v,scrollY:y}=window,{height:C,width:k,top:D,right:_,bottom:B,left:M}=e.getBoundingClientRect(),{top:P,right:z,bottom:O,left:A}=(H=>{const V=window.getComputedStyle(H);return{top:parseFloat(V.scrollMarginTop)||0,right:parseFloat(V.scrollMarginRight)||0,bottom:parseFloat(V.scrollMarginBottom)||0,left:parseFloat(V.scrollMarginLeft)||0}})(e);let F=o==="start"||o==="nearest"?D-P:o==="end"?B+O:D+C/2-P+O,S=u==="center"?M+k/2-A+z:u==="end"?_+z:M-A;const I=[];for(let H=0;H<p.length;H++){const V=p[H],{height:ae,width:ne,top:E,right:Y,bottom:q,left:T}=V.getBoundingClientRect();if(s==="if-needed"&&D>=0&&M>=0&&B<=b&&_<=f&&D>=E&&B<=q&&M>=T&&_<=Y)return I;const j=getComputedStyle(V),R=parseInt(j.borderLeftWidth,10),N=parseInt(j.borderTopWidth,10),U=parseInt(j.borderRightWidth,10),X=parseInt(j.borderBottomWidth,10);let W=0,te=0;const de="offsetWidth"in V?V.offsetWidth-V.clientWidth-R-U:0,J="offsetHeight"in V?V.offsetHeight-V.clientHeight-N-X:0,ve="offsetWidth"in V?V.offsetWidth===0?0:ne/V.offsetWidth:0,me="offsetHeight"in V?V.offsetHeight===0?0:ae/V.offsetHeight:0;if(m===V)W=o==="start"?F:o==="end"?F-b:o==="nearest"?xi(y,y+b,b,N,X,y+F,y+F+C,C):F-b/2,te=u==="start"?S:u==="center"?S-f/2:u==="end"?S-f:xi(v,v+f,f,R,U,v+S,v+S+k,k),W=Math.max(0,W+y),te=Math.max(0,te+v);else{W=o==="start"?F-E-N:o==="end"?F-q+X+J:o==="nearest"?xi(E,q,ae,N,X+J,F,F+C,C):F-(E+ae/2)+J/2,te=u==="start"?S-T-R:u==="center"?S-(T+ne/2)+de/2:u==="end"?S-Y+U+de:xi(T,Y,ne,R,U+de,S,S+k,k);const{scrollLeft:ye,scrollTop:_e}=V;W=me===0?0:Math.max(0,Math.min(_e+W/me,V.scrollHeight-ae/me+J)),te=ve===0?0:Math.max(0,Math.min(ye+te/ve,V.scrollWidth-ne/ve+de)),F+=_e-W,S+=ye-te}I.push({el:V,top:W,left:te})}return I},x0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function w0(e,t){if(!e.isConnected||!(i=>{let a=i;for(;a&&a.parentNode;){if(a.parentNode===document)return!0;a=a.parentNode instanceof ShadowRoot?a.parentNode.host:a.parentNode}return!1})(e))return;const n=(i=>{const a=window.getComputedStyle(i);return{top:parseFloat(a.scrollMarginTop)||0,right:parseFloat(a.scrollMarginRight)||0,bottom:parseFloat(a.scrollMarginBottom)||0,left:parseFloat(a.scrollMarginLeft)||0}})(e);if((i=>typeof i=="object"&&typeof i.behavior=="function")(t))return t.behavior(bl(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:i,top:a,left:s}of bl(e,x0(t))){const o=a-n.top+n.bottom,u=s-n.left+n.right;i.scroll({top:o,left:u,behavior:r})}}/*!
67
67
  * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
68
68
  *
69
69
  * Copyright (c) 2014-2017, Jon Schlinkert.
70
70
  * Released under the MIT License.
71
- */function yl(e){return Object.prototype.toString.call(e)==="[object Object]"}function ot(e){var t,n;return yl(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(yl(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Zf=Symbol.for("immer-nothing"),xl=Symbol.for("immer-draftable"),kt=Symbol.for("immer-state"),C0=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function yt(e,...t){if(process.env.NODE_ENV!=="production"){const n=C0[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var fr=Object.getPrototypeOf;function Nn(e){return!!e&&!!e[kt]}function In(e){var t;return e?Yf(e)||Array.isArray(e)||!!e[xl]||!!((t=e.constructor)!=null&&t[xl])||xa(e)||wa(e):!1}var D0=Object.prototype.constructor.toString();function Yf(e){if(!e||typeof e!="object")return!1;const t=fr(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===D0}function ea(e,t){ya(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ya(e){const t=e[kt];return t?t.type_:Array.isArray(e)?1:xa(e)?2:wa(e)?3:0}function Ws(e,t){return ya(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Gf(e,t,n){const r=ya(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function E0(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function xa(e){return e instanceof Map}function wa(e){return e instanceof Set}function An(e){return e.copy_||e.base_}function Vs(e,t){if(xa(e))return new Map(e);if(wa(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Yf(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[kt];let i=Reflect.ownKeys(r);for(let a=0;a<i.length;a++){const s=i[a],o=r[s];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[s]})}return Object.create(fr(e),r)}else{const r=fr(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function Wo(e,t=!1){return Ca(e)||Nn(e)||!In(e)||(ya(e)>1&&(e.set=e.add=e.clear=e.delete=_0),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Wo(r,!0))),e}function _0(){yt(2)}function Ca(e){return Object.isFrozen(e)}var k0={};function Rn(e){const t=k0[e];return t||yt(0,e),t}var Yr;function Qf(){return Yr}function F0(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function wl(e,t){t&&(Rn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Hs(e){Ks(e),e.drafts_.forEach(A0),e.drafts_=null}function Ks(e){e===Yr&&(Yr=e.parent_)}function Cl(e){return Yr=F0(Yr,e)}function A0(e){const t=e[kt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Dl(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[kt].modified_&&(Hs(t),yt(4)),In(e)&&(e=ta(t,e),t.parent_||na(t,e)),t.patches_&&Rn("Patches").generateReplacementPatches_(n[kt].base_,e,t.patches_,t.inversePatches_)):e=ta(t,n,[]),Hs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Zf?e:void 0}function ta(e,t,n){if(Ca(t))return t;const r=t[kt];if(!r)return ea(t,(i,a)=>El(e,r,t,i,a,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return na(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let a=i,s=!1;r.type_===3&&(a=new Set(i),i.clear(),s=!0),ea(a,(o,u)=>El(e,r,i,o,u,n,s)),na(e,i,!1),n&&e.patches_&&Rn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function El(e,t,n,r,i,a,s){if(process.env.NODE_ENV!=="production"&&i===n&&yt(5),Nn(i)){const o=a&&t&&t.type_!==3&&!Ws(t.assigned_,r)?a.concat(r):void 0,u=ta(e,i,o);if(Gf(n,r,u),Nn(u))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(In(i)&&!Ca(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ta(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&na(e,i)}}function na(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Wo(t,n)}function T0(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Qf(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=Vo;n&&(i=[r],a=Gr);const{revoke:s,proxy:o}=Proxy.revocable(i,a);return r.draft_=o,r.revoke_=s,o}var Vo={get(e,t){if(t===kt)return e;const n=An(e);if(!Ws(n,t))return B0(e,n,t);const r=n[t];return e.finalized_||!In(r)?r:r===Qa(e.base_,t)?(Ja(e),e.copy_[t]=Ys(r,e)):r},has(e,t){return t in An(e)},ownKeys(e){return Reflect.ownKeys(An(e))},set(e,t,n){const r=Jf(An(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Qa(An(e),t),a=i==null?void 0:i[kt];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(E0(n,i)&&(n!==void 0||Ws(e.base_,t)))return!0;Ja(e),Zs(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Qa(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ja(e),Zs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=An(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){yt(11)},getPrototypeOf(e){return fr(e.base_)},setPrototypeOf(){yt(12)}},Gr={};ea(Vo,(e,t)=>{Gr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Gr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&yt(13),Gr.set.call(this,e,t,void 0)};Gr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&yt(14),Vo.set.call(this,e[0],t,n,e[0])};function Qa(e,t){const n=e[kt];return(n?An(n):e)[t]}function B0(e,t,n){var i;const r=Jf(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Jf(e,t){if(!(t in e))return;let n=fr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=fr(n)}}function Zs(e){e.modified_||(e.modified_=!0,e.parent_&&Zs(e.parent_))}function Ja(e){e.copy_||(e.copy_=Vs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var S0=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const a=n;n=t;const s=this;return function(u=a,...l){return s.produce(u,d=>n.call(this,d,...l))}}typeof n!="function"&&yt(6),r!==void 0&&typeof r!="function"&&yt(7);let i;if(In(t)){const a=Cl(this),s=Ys(t,void 0);let o=!0;try{i=n(s),o=!1}finally{o?Hs(a):Ks(a)}return wl(a,r),Dl(i,a)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Zf&&(i=void 0),this.autoFreeze_&&Wo(i,!0),r){const a=[],s=[];Rn("Patches").generateReplacementPatches_(t,i,a,s),r(a,s)}return i}else yt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,u=>t(u,...o));let r,i;return[this.produce(t,n,(s,o)=>{r=s,i=o}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){In(e)||yt(8),Nn(e)&&(e=j0(e));const t=Cl(this),n=Ys(e,void 0);return n[kt].isManual_=!0,Ks(t),n}finishDraft(e,t){const n=e&&e[kt];(!n||!n.isManual_)&&yt(9);const{scope_:r}=n;return wl(r,t),Dl(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=Rn("Patches").applyPatches_;return Nn(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Ys(e,t){const n=xa(e)?Rn("MapSet").proxyMap_(e,t):wa(e)?Rn("MapSet").proxySet_(e,t):T0(e,t);return(t?t.scope_:Qf()).drafts_.push(n),n}function j0(e){return Nn(e)||yt(10,e),Xf(e)}function Xf(e){if(!In(e)||Ca(e))return e;const t=e[kt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Vs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Vs(e,!0);return ea(n,(r,i)=>{Gf(n,r,Xf(i))}),t&&(t.finalized_=!1),n}var Ft=new S0,Ho=Ft.produce;Ft.produceWithPatches.bind(Ft);Ft.setAutoFreeze.bind(Ft);Ft.setUseStrictShallowCopy.bind(Ft);Ft.applyPatches.bind(Ft);var _l=Ft.createDraft.bind(Ft),kl=Ft.finishDraft.bind(Ft),P0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var i=L.transform(n,t,{affinity:r});e.current=i,i==null&&e.unref()}}},O0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var i=Se.transform(n,t,{affinity:r});e.current=i,i==null&&e.unref()}}},M0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var i=Q.transform(n,t,{affinity:r});e.current=i,i==null&&e.unref()}}},ra=new WeakMap,ia=new WeakMap,Rr=new WeakMap,em=new WeakMap,Fl=new WeakMap,Al=new WeakMap,Tl=new WeakMap,L={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=L.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var i=e[r],a=t[r];if(i!==a)break;n.push(i)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),i=t.slice(0,n),a=e[n],s=t[n];return L.equals(r,i)&&a>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),i=t.slice(0,n);return L.equals(r,i)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),i=t.slice(0,n),a=e[n],s=t[n];return L.equals(r,i)&&a<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return L.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&L.compare(e,t)===0},isBefore(e,t){return L.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&L.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&L.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&L.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&L.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),i=e[e.length-1],a=t[t.length-1];return i!==a&&L.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],i=0;i<=e.length;i++)r.push(e.slice(0,i));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!L.isAncestor(t,e)&&!L.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:i="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:a}=t;(L.equals(a,r)||L.endsBefore(a,r)||L.isAncestor(a,r))&&(r[a.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(L.equals(s,r)||L.isAncestor(s,r))return null;L.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:u}=t;L.equals(o,r)||L.endsBefore(o,r)?r[o.length-1]-=1:L.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=u);break}case"split_node":{var{path:l,position:d}=t;if(L.equals(l,r)){if(i==="forward")r[r.length-1]+=1;else if(i!=="backward")return null}else L.endsBefore(l,r)?r[l.length-1]+=1:L.isAncestor(l,r)&&e[l.length]>=d&&(r[l.length-1]+=1,r[l.length]-=d);break}case"move_node":{var{path:m,newPath:h}=t;if(L.equals(m,h))return r;if(L.isAncestor(m,r)||L.equals(m,r)){var p=h.slice();return L.endsBefore(m,h)&&m.length<h.length&&(p[m.length-1]-=1),p.concat(r.slice(m.length))}else L.isSibling(m,h)&&(L.isAncestor(h,r)||L.equals(h,r))?L.endsBefore(m,r)?r[m.length-1]-=1:r[m.length-1]+=1:L.endsBefore(h,r)||L.equals(h,r)||L.isAncestor(h,r)?(L.endsBefore(m,r)&&(r[m.length-1]-=1),r[h.length-1]+=1):L.endsBefore(m,r)&&(L.equals(h,r)&&(r[h.length-1]+=1),r[m.length-1]-=1);break}}return r}};function Qr(e){"@babel/helpers - typeof";return Qr=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},Qr(e)}function N0(e,t){if(Qr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Qr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function I0(e){var t=N0(e,"string");return Qr(t)==="symbol"?t:String(t)}function ht(e,t,n){return t=I0(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Br(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Bl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var R0=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:i}=n,a=le.parent(e,r),s=r[r.length-1];if(s>a.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(a.children.splice(s,0,i),t)for(var[o,u]of Q.points(t))t[u]=Se.transform(o,n);break}case"insert_text":{var{path:l,offset:d,text:m}=n;if(m.length===0)break;var h=le.leaf(e,l),p=h.text.slice(0,d),g=h.text.slice(d);if(h.text=p+m+g,t)for(var[f,b]of Q.points(t))t[b]=Se.transform(f,n);break}case"merge_node":{var{path:v}=n,y=le.get(e,v),C=L.previous(v),k=le.get(e,C),D=le.parent(e,v),_=v[v.length-1];if(ge.isText(y)&&ge.isText(k))k.text+=y.text;else if(!ge.isText(y)&&!ge.isText(k))k.children.push(...y.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(at.stringify(y)," ").concat(at.stringify(k)));if(D.children.splice(_,1),t)for(var[B,P]of Q.points(t))t[P]=Se.transform(B,n);break}case"move_node":{var{path:N,newPath:z}=n;if(L.isAncestor(N,z))throw new Error("Cannot move a path [".concat(N,"] to new path [").concat(z,"] because the destination is inside itself."));var O=le.get(e,N),A=le.parent(e,N),F=N[N.length-1];A.children.splice(F,1);var S=L.transform(N,n),I=le.get(e,L.parent(S)),H=S[S.length-1];if(I.children.splice(H,0,O),t)for(var[V,ae]of Q.points(t))t[ae]=Se.transform(V,n);break}case"remove_node":{var{path:ne}=n,E=ne[ne.length-1],Y=le.parent(e,ne);if(Y.children.splice(E,1),t)for(var[q,T]of Q.points(t)){var j=Se.transform(q,n);if(t!=null&&j!=null)t[T]=j;else{var R=void 0,M=void 0;for(var[U,X]of le.texts(e))if(L.compare(X,ne)===-1)R=[U,X];else{M=[U,X];break}var W=!1;R&&M&&(L.equals(M[1],ne)?W=!L.hasPrevious(M[1]):W=L.common(R[1],ne).length<L.common(M[1],ne).length),R&&!W?(q.path=R[1],q.offset=R[0].text.length):M?(q.path=M[1],q.offset=0):t=null}}break}case"remove_text":{var{path:te,offset:de,text:J}=n;if(J.length===0)break;var ve=le.leaf(e,te),me=ve.text.slice(0,de),ye=ve.text.slice(de+J.length);if(ve.text=me+ye,t)for(var[_e,De]of Q.points(t))t[De]=Se.transform(_e,n);break}case"set_node":{var{path:ze,properties:We,newProperties:He}=n;if(ze.length===0)throw new Error("Cannot set properties on the root node!");var Ke=le.get(e,ze);for(var Be in He){if(Be==="children"||Be==="text")throw new Error('Cannot set the "'.concat(Be,'" property of nodes!'));var Me=He[Be];Me==null?delete Ke[Be]:Ke[Be]=Me}for(var Ce in We)He.hasOwnProperty(Ce)||delete Ke[Ce];break}case"set_selection":{var{newProperties:G}=n;if(G==null)t=G;else{if(t==null){if(!Q.isRange(G))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(at.stringify(G)," when there is no current selection."));t=Br({},G)}for(var se in G){var be=G[se];if(be==null){if(se==="anchor"||se==="focus")throw new Error('Cannot remove the "'.concat(se,'" selection property'));delete t[se]}else t[se]=be}}break}case"split_node":{var{path:oe,position:ce,properties:pe}=n;if(oe.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(oe,"] because the root node cannot be split."));var Fe=le.get(e,oe),qe=le.parent(e,oe),At=oe[oe.length-1],pt;if(ge.isText(Fe)){var tt=Fe.text.slice(0,ce),qt=Fe.text.slice(ce);Fe.text=tt,pt=Br(Br({},pe),{},{text:qt})}else{var Dt=Fe.children.slice(0,ce),Ta=Fe.children.slice(ce);Fe.children=Dt,pt=Br(Br({},pe),{},{children:Ta})}if(qe.children.splice(At+1,0,pt),t)for(var[Cr,li]of Q.points(t))t[li]=Se.transform(Cr,n);break}}return t},$0={transform(e,t){e.children=_l(e.children);var n=e.selection&&_l(e.selection);try{n=R0(e,n,t)}finally{e.children=kl(e.children),n?e.selection=Nn(n)?kl(n):n:e.selection=null}}},L0={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},z0={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},tm=(e,t)=>{for(var n in e){var r=e[n],i=t[n];if(ot(r)&&ot(i)){if(!tm(r,i))return!1}else if(Array.isArray(r)&&Array.isArray(i)){if(r.length!==i.length)return!1;for(var a=0;a<r.length;a++)if(r[a]!==i[a])return!1}else if(r!==i)return!1}for(var s in t)if(e[s]===void 0&&t[s]!==void 0)return!1;return!0};function q0(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function sn(e,t){if(e==null)return{};var n=q0(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var U0=["anchor","focus"];function Sl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function W0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Sl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Q={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:i}=e;return Q.isBackward(e)===n?[r,i]:[i,r]},end(e){var[,t]=Q.edges(e);return t},equals(e,t){return Se.equals(e.anchor,t.anchor)&&Se.equals(e.focus,t.focus)},includes(e,t){if(Q.isRange(t)){if(Q.includes(e,t.anchor)||Q.includes(e,t.focus))return!0;var[n,r]=Q.edges(e),[i,a]=Q.edges(t);return Se.isBefore(n,i)&&Se.isAfter(r,a)}var[s,o]=Q.edges(e),u=!1,l=!1;return Se.isPoint(t)?(u=Se.compare(t,s)>=0,l=Se.compare(t,o)<=0):(u=L.compare(t,s.path)>=0,l=L.compare(t,o.path)<=0),u&&l},intersection(e,t){var n=sn(e,U0),[r,i]=Q.edges(e),[a,s]=Q.edges(t),o=Se.isBefore(r,a)?a:r,u=Se.isBefore(i,s)?i:s;return Se.isBefore(u,o)?null:W0({anchor:o,focus:u},n)},isBackward(e){var{anchor:t,focus:n}=e;return Se.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Se.equals(t,n)},isExpanded(e){return!Q.isCollapsed(e)},isForward(e){return!Q.isBackward(e)},isRange(e){return ot(e)&&Se.isPoint(e.anchor)&&Se.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Q.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ho(e,r=>{if(r===null)return null;var{affinity:i="inward"}=n,a,s;if(i==="inward"){var o=Q.isCollapsed(r);Q.isForward(r)?(a="forward",s=o?a:"backward"):(a="backward",s=o?a:"forward")}else i==="outward"?Q.isForward(r)?(a="backward",s="forward"):(a="forward",s="backward"):(a=i,s=i);var u=Se.transform(r.anchor,t,{affinity:a}),l=Se.transform(r.focus,t,{affinity:s});if(!u||!l)return null;r.anchor=u,r.focus=l})}},jl=e=>ot(e)&&le.isNodeList(e.children)&&!w.isEditor(e),he={isAncestor(e){return ot(e)&&le.isNodeList(e.children)},isElement:jl,isElementList(e){return Array.isArray(e)&&e.every(t=>he.isElement(t))},isElementProps(e){return e.children!==void 0},isElementType:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"type";return jl(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},V0=["children"],H0=["text"],Pl=new WeakMap,le={ancestor(e,t){var n=le.get(e,t);if(ge.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(at.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of L.ancestors(t,n)){var i=le.ancestor(e,r),a=[i,r];yield a}}()},child(e,t){if(ge.isText(e))throw new Error("Cannot get the child of a text node: ".concat(at.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(at.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,i=le.ancestor(e,t),{children:a}=i,s=r?a.length-1:0;r?s>=0:s<a.length;){var o=le.child(i,s),u=t.concat(s);yield[o,u],s=r?s-1:s+1}}()},common(e,t,n){var r=L.common(t,n),i=le.get(e,r);return[i,r]},descendant(e,t){var n=le.get(e,t);if(w.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(at.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of le.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of le.nodes(e,t))he.isElement(n)&&(yield[n,r])}()},extractProps(e){if(he.isAncestor(e)){var t=sn(e,V0);return t}else{var t=sn(e,H0);return t}},first(e,t){for(var n=t.slice(),r=le.get(e,n);r&&!(ge.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(ge.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(at.stringify(e)));var n=Ho({children:e.children},r=>{var[i,a]=Q.edges(t),s=le.nodes(r,{reverse:!0,pass:h=>{var[,p]=h;return!Q.includes(t,p)}});for(var[,o]of s){if(!Q.includes(t,o)){var u=le.parent(r,o),l=o[o.length-1];u.children.splice(l,1)}if(L.equals(o,a.path)){var d=le.leaf(r,o);d.text=d.text.slice(0,a.offset)}if(L.equals(o,i.path)){var m=le.leaf(r,o);m.text=m.text.slice(i.offset)}}w.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var i=t[r];if(ge.isText(n)||!n.children[i])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(at.stringify(e)));n=n.children[i]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var i=t[r];if(ge.isText(n)||!n.children[i])return!1;n=n.children[i]}return!0},isNode(e){return ge.isText(e)||he.isElement(e)||w.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=Pl.get(e);if(t!==void 0)return t;var n=e.every(r=>le.isNode(r));return Pl.set(e,n),n},last(e,t){for(var n=t.slice(),r=le.get(e,n);r&&!(ge.isText(r)||r.children.length===0);){var i=r.children.length-1;r=r.children[i],n.push(i)}return[r,n]},leaf(e,t){var n=le.get(e,t);if(!ge.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(at.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of L.levels(t,n)){var i=le.get(e,r);yield[i,r]}}()},matches(e,t){return he.isElement(e)&&he.isElementProps(t)&&he.matches(e,t)||ge.isText(e)&&ge.isTextProps(t)&&ge.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:i=[],to:a}=t,s=new Set,o=[],u=e;!(a&&(r?L.isBefore(o,a):L.isAfter(o,a)));){if(s.has(u)||(yield[u,o]),!s.has(u)&&!ge.isText(u)&&u.children.length!==0&&(n==null||n([u,o])===!1)){s.add(u);var l=r?u.children.length-1:0;L.isAncestor(o,i)&&(l=i[o.length]),o=o.concat(l),u=le.get(e,o);continue}if(o.length===0)break;if(!r){var d=L.next(o);if(le.has(e,d)){o=d,u=le.get(e,o);continue}}if(r&&o[o.length-1]!==0){var m=L.previous(o);o=m,u=le.get(e,o);continue}o=L.parent(o),u=le.get(e,o),s.add(u)}}()},parent(e,t){var n=L.parent(t),r=le.get(e,n);if(ge.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string(e){return ge.isText(e)?e.text:e.children.map(le.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of le.nodes(e,t))ge.isText(n)&&(yield[n,r])}()}};function Ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ye(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ol(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ol(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var vn={isNodeOperation(e){return vn.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!ot(e))return!1;switch(e.type){case"insert_node":return L.isPath(e.path)&&le.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&L.isPath(e.path);case"merge_node":return typeof e.position=="number"&&L.isPath(e.path)&&ot(e.properties);case"move_node":return L.isPath(e.path)&&L.isPath(e.newPath);case"remove_node":return L.isPath(e.path)&&le.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&L.isPath(e.path);case"set_node":return L.isPath(e.path)&&ot(e.properties)&&ot(e.newProperties);case"set_selection":return e.properties===null&&Q.isRange(e.newProperties)||e.newProperties===null&&Q.isRange(e.properties)||ot(e.properties)&&ot(e.newProperties);case"split_node":return L.isPath(e.path)&&typeof e.position=="number"&&ot(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>vn.isOperation(t))},isSelectionOperation(e){return vn.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return vn.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Ye(Ye({},e),{},{type:"remove_node"});case"insert_text":return Ye(Ye({},e),{},{type:"remove_text"});case"merge_node":return Ye(Ye({},e),{},{type:"split_node",path:L.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(L.equals(t,n))return e;if(L.isSibling(n,t))return Ye(Ye({},e),{},{path:t,newPath:n});var r=L.transform(n,e),i=L.transform(L.next(n),e);return Ye(Ye({},e),{},{path:r,newPath:i})}case"remove_node":return Ye(Ye({},e),{},{type:"insert_node"});case"remove_text":return Ye(Ye({},e),{},{type:"insert_text"});case"set_node":{var{properties:a,newProperties:s}=e;return Ye(Ye({},e),{},{properties:s,newProperties:a})}case"set_selection":{var{properties:o,newProperties:u}=e;return o==null?Ye(Ye({},e),{},{properties:u,newProperties:null}):u==null?Ye(Ye({},e),{},{properties:null,newProperties:o}):Ye(Ye({},e),{},{properties:u,newProperties:o})}case"split_node":return Ye(Ye({},e),{},{type:"merge_node",path:L.next(e.path)})}}},Ml=new WeakMap,K0=e=>{var t=Ml.get(e);if(t!==void 0)return t;if(!ot(e))return!1;var n=typeof e.addMark=="function"&&typeof e.apply=="function"&&typeof e.deleteFragment=="function"&&typeof e.insertBreak=="function"&&typeof e.insertSoftBreak=="function"&&typeof e.insertFragment=="function"&&typeof e.insertNode=="function"&&typeof e.insertText=="function"&&typeof e.isElementReadOnly=="function"&&typeof e.isInline=="function"&&typeof e.isSelectable=="function"&&typeof e.isVoid=="function"&&typeof e.normalizeNode=="function"&&typeof e.onChange=="function"&&typeof e.removeMark=="function"&&typeof e.getDirtyPaths=="function"&&(e.marks===null||ot(e.marks))&&(e.selection===null||Q.isRange(e.selection))&&le.isNodeList(e.children)&&vn.isOperationList(e.operations);return Ml.set(e,n),n},w={above(e,t){return e.above(t)},addMark(e,t,n){e.addMark(t,n)},after(e,t,n){return e.after(t,n)},before(e,t,n){return e.before(t,n)},deleteBackward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges(e,t){return e.edges(t)},elementReadOnly(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.elementReadOnly(t)},end(e,t){return e.end(t)},first(e,t){return e.first(t)},fragment(e,t){return e.fragment(t)},hasBlocks(e,t){return e.hasBlocks(t)},hasInlines(e,t){return e.hasInlines(t)},hasPath(e,t){return e.hasPath(t)},hasTexts(e,t){return e.hasTexts(t)},insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock(e,t){return e.isBlock(t)},isEdge(e,t,n){return e.isEdge(t,n)},isEditor(e){return K0(e)},isElementReadOnly(e,t){return e.isElementReadOnly(t)},isEmpty(e,t){return e.isEmpty(t)},isEnd(e,t,n){return e.isEnd(t,n)},isInline(e,t){return e.isInline(t)},isNormalizing(e){return e.isNormalizing()},isSelectable(e,t){return e.isSelectable(t)},isStart(e,t,n){return e.isStart(t,n)},isVoid(e,t){return e.isVoid(t)},last(e,t){return e.last(t)},leaf(e,t,n){return e.leaf(t,n)},levels(e,t){return e.levels(t)},marks(e){return e.getMarks()},next(e,t){return e.next(t)},node(e,t,n){return e.node(t,n)},nodes(e,t){return e.nodes(t)},normalize(e,t){e.normalize(t)},parent(e,t,n){return e.parent(t,n)},path(e,t,n){return e.path(t,n)},pathRef(e,t,n){return e.pathRef(t,n)},pathRefs(e){return e.pathRefs()},point(e,t,n){return e.point(t,n)},pointRef(e,t,n){return e.pointRef(t,n)},pointRefs(e){return e.pointRefs()},positions(e,t){return e.positions(t)},previous(e,t){return e.previous(t)},range(e,t,n){return e.range(t,n)},rangeRef(e,t,n){return e.rangeRef(t,n)},rangeRefs(e){return e.rangeRefs()},removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start(e,t){return e.start(t)},string(e,t,n){return e.string(t,n)},unhangRange(e,t,n){return e.unhangRange(t,n)},void(e,t){return e.void(t)},withoutNormalizing(e,t){e.withoutNormalizing(t)}},Z0={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(L.isPath)}};function Nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Il(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Se={compare(e,t){var n=L.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return Se.compare(e,t)===1},isBefore(e,t){return Se.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&L.equals(e.path,t.path)},isPoint(e){return ot(e)&&typeof e.offset=="number"&&L.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ho(e,r=>{if(r===null)return null;var{affinity:i="forward"}=n,{path:a,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=L.transform(a,t,n);break}case"insert_text":{L.equals(t.path,a)&&(t.offset<s||t.offset===s&&i==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{L.equals(t.path,a)&&(r.offset+=t.position),r.path=L.transform(a,t,n);break}case"remove_text":{L.equals(t.path,a)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(L.equals(t.path,a)||L.isAncestor(t.path,a))return null;r.path=L.transform(a,t,n);break}case"split_node":{if(L.equals(t.path,a)){if(t.position===s&&i==null)return null;(t.position<s||t.position===s&&i==="forward")&&(r.offset-=t.position,r.path=L.transform(a,t,Il(Il({},n),{},{affinity:"forward"})))}else r.path=L.transform(a,t,n);break}}})}},Rl=void 0,at={setScrubber(e){Rl=e},stringify(e){return JSON.stringify(e,Rl)}},Y0=["text"],G0=["anchor","focus"];function $l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$l(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$l(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ge={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function i(a){var s=sn(a,Y0);return s}return tm(r?i(e):e,r?i(t):t)},isText(e){return ot(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>ge.isText(t))},isTextProps(e){return e.text!==void 0},matches(e,t){for(var n in t)if(n!=="text"&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[tn({},e)];for(var r of t){var i=sn(r,G0),[a,s]=Q.edges(r),o=[],u=0,l=a.offset,d=s.offset;for(var m of n){var{length:h}=m.text,p=u;if(u+=h,l<=p&&u<=d){Object.assign(m,i),o.push(m);continue}if(l!==d&&(l===u||d===p)||l>u||d<p||d===p&&p!==0){o.push(m);continue}var g=m,f=void 0,b=void 0;if(d<u){var v=d-p;b=tn(tn({},g),{},{text:g.text.slice(v)}),g=tn(tn({},g),{},{text:g.text.slice(0,v)})}if(l>p){var y=l-p;f=tn(tn({},g),{},{text:g.text.slice(0,y)}),g=tn(tn({},g),{},{text:g.text.slice(y)})}Object.assign(g,i),f&&o.push(f),o.push(g),b&&o.push(b)}n=o}return n}},Ko=e=>e.selection?e.selection:e.children.length>0?w.end(e,[]):[0],wr=(e,t)=>{var[n]=w.node(e,t);return r=>r===n},Zo=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,i=n?ny(t):t,a=Ae.None,s=Ae.None,o=0,u=null,l=null;for(var d of i){var m=d.codePointAt(0);if(!m)break;var h=hy(d,m);if([a,s]=r?[s,h]:[h,a],Xn(a,Ae.ZWJ)&&Xn(s,Ae.ExtPict)&&(r?u=Ll(t.substring(0,o)):u=Ll(t.substring(0,t.length-o)),!u)||Xn(a,Ae.RI)&&Xn(s,Ae.RI)&&(l!==null?l=!l:r?l=!0:l=yy(t.substring(0,t.length-o)),!l)||a!==Ae.None&&s!==Ae.None&&gy(a,s))break;o+=d.length}return o||1},Q0=/\s/,J0=/[\u002B\u0021-\u0023\u0025-\u002A\u002C-\u002F\u003A\u003B\u003F\u0040\u005B-\u005D\u005F\u007B\u007D\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E3B\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/,X0=/['\u2018\u2019]/,ey=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,i=!1;t.length>0;){var a=Zo(t,n),[s,o]=Yo(t,a,n);if(ty(s,o,n))i=!0,r+=a;else if(!i)r+=a;else break;t=o}return r},Yo=(e,t,n)=>{if(n){var r=e.length-t;return[e.slice(r,e.length),e.slice(0,r)]}return[e.slice(0,t),e.slice(t)]},ty=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(Q0.test(t))return!1;if(X0.test(t)){var i=Zo(n,r),[a,s]=Yo(n,i,r);if(e(a,s,r))return!0}return!J0.test(t)},ny=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var i=t.charAt(n-r);if(iy(i.charCodeAt(0))){var a=t.charAt(n-r-1);if(ry(a.charCodeAt(0))){yield a+i,r++;continue}}yield i}},ry=e=>e>=55296&&e<=56319,iy=e=>e>=56320&&e<=57343,Ae;(function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"})(Ae||(Ae={}));var ay=/^(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC01\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDE41\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4\uDF00\uDF01\uDF36-\uDF3A\uDF40\uDF42]|\uD80D[\uDC40\uDC47-\uDC55]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])$/,sy=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,oy=/^(?:[\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E\u094F\u0982\u0983\u09BF\u09C0\u09C7\u09C8\u09CB\u09CC\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB\u0ACC\u0B02\u0B03\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0C01-\u0C03\u0C41-\u0C44\u0C82\u0C83\u0CBE\u0CC0\u0CC1\u0CC3\u0CC4\u0CC7\u0CC8\u0CCA\u0CCB\u0D02\u0D03\u0D3F\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D82\u0D83\u0DD0\u0DD1\u0DD8-\u0DDE\u0DF2\u0DF3\u0E33\u0EB3\u0F3E\u0F3F\u0F7F\u1031\u103B\u103C\u1056\u1057\u1084\u1715\u1734\u17B6\u17BE-\u17C5\u17C7\u17C8\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u1A19\u1A1A\u1A55\u1A57\u1A6D-\u1A72\u1B04\u1B3B\u1B3D-\u1B41\u1B43\u1B44\u1B82\u1BA1\u1BA6\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1C24-\u1C2B\u1C34\u1C35\u1CE1\u1CF7\uA823\uA824\uA827\uA880\uA881\uA8B4-\uA8C3\uA952\uA953\uA983\uA9B4\uA9B5\uA9BA\uA9BB\uA9BE-\uA9C0\uAA2F\uAA30\uAA33\uAA34\uAA4D\uAAEB\uAAEE\uAAEF\uAAF5\uABE3\uABE4\uABE6\uABE7\uABE9\uABEA\uABEC]|\uD804[\uDC00\uDC02\uDC82\uDCB0-\uDCB2\uDCB7\uDCB8\uDD2C\uDD45\uDD46\uDD82\uDDB3-\uDDB5\uDDBF\uDDC0\uDDCE\uDE2C-\uDE2E\uDE32\uDE33\uDE35\uDEE0-\uDEE2\uDF02\uDF03\uDF3F\uDF41-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF62\uDF63]|\uD805[\uDC35-\uDC37\uDC40\uDC41\uDC45\uDCB1\uDCB2\uDCB9\uDCBB\uDCBC\uDCBE\uDCC1\uDDB0\uDDB1\uDDB8-\uDDBB\uDDBE\uDE30-\uDE32\uDE3B\uDE3C\uDE3E\uDEAC\uDEAE\uDEAF\uDEB6\uDF26]|\uD806[\uDC2C-\uDC2E\uDC38\uDD31-\uDD35\uDD37\uDD38\uDD3D\uDD40\uDD42\uDDD1-\uDDD3\uDDDC-\uDDDF\uDDE4\uDE39\uDE57\uDE58\uDE97]|\uD807[\uDC2F\uDC3E\uDCA9\uDCB1\uDCB4\uDD8A-\uDD8E\uDD93\uDD94\uDD96\uDEF5\uDEF6]|\uD81B[\uDF51-\uDF87\uDFF0\uDFF1]|\uD834[\uDD66\uDD6D])$/,uy=/^[\u1100-\u115F\uA960-\uA97C]$/,ly=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,cy=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,dy=/^[\uAC00\uAC1C\uAC38\uAC54\uAC70\uAC8C\uACA8\uACC4\uACE0\uACFC\uAD18\uAD34\uAD50\uAD6C\uAD88\uADA4\uADC0\uADDC\uADF8\uAE14\uAE30\uAE4C\uAE68\uAE84\uAEA0\uAEBC\uAED8\uAEF4\uAF10\uAF2C\uAF48\uAF64\uAF80\uAF9C\uAFB8\uAFD4\uAFF0\uB00C\uB028\uB044\uB060\uB07C\uB098\uB0B4\uB0D0\uB0EC\uB108\uB124\uB140\uB15C\uB178\uB194\uB1B0\uB1CC\uB1E8\uB204\uB220\uB23C\uB258\uB274\uB290\uB2AC\uB2C8\uB2E4\uB300\uB31C\uB338\uB354\uB370\uB38C\uB3A8\uB3C4\uB3E0\uB3FC\uB418\uB434\uB450\uB46C\uB488\uB4A4\uB4C0\uB4DC\uB4F8\uB514\uB530\uB54C\uB568\uB584\uB5A0\uB5BC\uB5D8\uB5F4\uB610\uB62C\uB648\uB664\uB680\uB69C\uB6B8\uB6D4\uB6F0\uB70C\uB728\uB744\uB760\uB77C\uB798\uB7B4\uB7D0\uB7EC\uB808\uB824\uB840\uB85C\uB878\uB894\uB8B0\uB8CC\uB8E8\uB904\uB920\uB93C\uB958\uB974\uB990\uB9AC\uB9C8\uB9E4\uBA00\uBA1C\uBA38\uBA54\uBA70\uBA8C\uBAA8\uBAC4\uBAE0\uBAFC\uBB18\uBB34\uBB50\uBB6C\uBB88\uBBA4\uBBC0\uBBDC\uBBF8\uBC14\uBC30\uBC4C\uBC68\uBC84\uBCA0\uBCBC\uBCD8\uBCF4\uBD10\uBD2C\uBD48\uBD64\uBD80\uBD9C\uBDB8\uBDD4\uBDF0\uBE0C\uBE28\uBE44\uBE60\uBE7C\uBE98\uBEB4\uBED0\uBEEC\uBF08\uBF24\uBF40\uBF5C\uBF78\uBF94\uBFB0\uBFCC\uBFE8\uC004\uC020\uC03C\uC058\uC074\uC090\uC0AC\uC0C8\uC0E4\uC100\uC11C\uC138\uC154\uC170\uC18C\uC1A8\uC1C4\uC1E0\uC1FC\uC218\uC234\uC250\uC26C\uC288\uC2A4\uC2C0\uC2DC\uC2F8\uC314\uC330\uC34C\uC368\uC384\uC3A0\uC3BC\uC3D8\uC3F4\uC410\uC42C\uC448\uC464\uC480\uC49C\uC4B8\uC4D4\uC4F0\uC50C\uC528\uC544\uC560\uC57C\uC598\uC5B4\uC5D0\uC5EC\uC608\uC624\uC640\uC65C\uC678\uC694\uC6B0\uC6CC\uC6E8\uC704\uC720\uC73C\uC758\uC774\uC790\uC7AC\uC7C8\uC7E4\uC800\uC81C\uC838\uC854\uC870\uC88C\uC8A8\uC8C4\uC8E0\uC8FC\uC918\uC934\uC950\uC96C\uC988\uC9A4\uC9C0\uC9DC\uC9F8\uCA14\uCA30\uCA4C\uCA68\uCA84\uCAA0\uCABC\uCAD8\uCAF4\uCB10\uCB2C\uCB48\uCB64\uCB80\uCB9C\uCBB8\uCBD4\uCBF0\uCC0C\uCC28\uCC44\uCC60\uCC7C\uCC98\uCCB4\uCCD0\uCCEC\uCD08\uCD24\uCD40\uCD5C\uCD78\uCD94\uCDB0\uCDCC\uCDE8\uCE04\uCE20\uCE3C\uCE58\uCE74\uCE90\uCEAC\uCEC8\uCEE4\uCF00\uCF1C\uCF38\uCF54\uCF70\uCF8C\uCFA8\uCFC4\uCFE0\uCFFC\uD018\uD034\uD050\uD06C\uD088\uD0A4\uD0C0\uD0DC\uD0F8\uD114\uD130\uD14C\uD168\uD184\uD1A0\uD1BC\uD1D8\uD1F4\uD210\uD22C\uD248\uD264\uD280\uD29C\uD2B8\uD2D4\uD2F0\uD30C\uD328\uD344\uD360\uD37C\uD398\uD3B4\uD3D0\uD3EC\uD408\uD424\uD440\uD45C\uD478\uD494\uD4B0\uD4CC\uD4E8\uD504\uD520\uD53C\uD558\uD574\uD590\uD5AC\uD5C8\uD5E4\uD600\uD61C\uD638\uD654\uD670\uD68C\uD6A8\uD6C4\uD6E0\uD6FC\uD718\uD734\uD750\uD76C\uD788]$/,fy=/^[\uAC01-\uAC1B\uAC1D-\uAC37\uAC39-\uAC53\uAC55-\uAC6F\uAC71-\uAC8B\uAC8D-\uACA7\uACA9-\uACC3\uACC5-\uACDF\uACE1-\uACFB\uACFD-\uAD17\uAD19-\uAD33\uAD35-\uAD4F\uAD51-\uAD6B\uAD6D-\uAD87\uAD89-\uADA3\uADA5-\uADBF\uADC1-\uADDB\uADDD-\uADF7\uADF9-\uAE13\uAE15-\uAE2F\uAE31-\uAE4B\uAE4D-\uAE67\uAE69-\uAE83\uAE85-\uAE9F\uAEA1-\uAEBB\uAEBD-\uAED7\uAED9-\uAEF3\uAEF5-\uAF0F\uAF11-\uAF2B\uAF2D-\uAF47\uAF49-\uAF63\uAF65-\uAF7F\uAF81-\uAF9B\uAF9D-\uAFB7\uAFB9-\uAFD3\uAFD5-\uAFEF\uAFF1-\uB00B\uB00D-\uB027\uB029-\uB043\uB045-\uB05F\uB061-\uB07B\uB07D-\uB097\uB099-\uB0B3\uB0B5-\uB0CF\uB0D1-\uB0EB\uB0ED-\uB107\uB109-\uB123\uB125-\uB13F\uB141-\uB15B\uB15D-\uB177\uB179-\uB193\uB195-\uB1AF\uB1B1-\uB1CB\uB1CD-\uB1E7\uB1E9-\uB203\uB205-\uB21F\uB221-\uB23B\uB23D-\uB257\uB259-\uB273\uB275-\uB28F\uB291-\uB2AB\uB2AD-\uB2C7\uB2C9-\uB2E3\uB2E5-\uB2FF\uB301-\uB31B\uB31D-\uB337\uB339-\uB353\uB355-\uB36F\uB371-\uB38B\uB38D-\uB3A7\uB3A9-\uB3C3\uB3C5-\uB3DF\uB3E1-\uB3FB\uB3FD-\uB417\uB419-\uB433\uB435-\uB44F\uB451-\uB46B\uB46D-\uB487\uB489-\uB4A3\uB4A5-\uB4BF\uB4C1-\uB4DB\uB4DD-\uB4F7\uB4F9-\uB513\uB515-\uB52F\uB531-\uB54B\uB54D-\uB567\uB569-\uB583\uB585-\uB59F\uB5A1-\uB5BB\uB5BD-\uB5D7\uB5D9-\uB5F3\uB5F5-\uB60F\uB611-\uB62B\uB62D-\uB647\uB649-\uB663\uB665-\uB67F\uB681-\uB69B\uB69D-\uB6B7\uB6B9-\uB6D3\uB6D5-\uB6EF\uB6F1-\uB70B\uB70D-\uB727\uB729-\uB743\uB745-\uB75F\uB761-\uB77B\uB77D-\uB797\uB799-\uB7B3\uB7B5-\uB7CF\uB7D1-\uB7EB\uB7ED-\uB807\uB809-\uB823\uB825-\uB83F\uB841-\uB85B\uB85D-\uB877\uB879-\uB893\uB895-\uB8AF\uB8B1-\uB8CB\uB8CD-\uB8E7\uB8E9-\uB903\uB905-\uB91F\uB921-\uB93B\uB93D-\uB957\uB959-\uB973\uB975-\uB98F\uB991-\uB9AB\uB9AD-\uB9C7\uB9C9-\uB9E3\uB9E5-\uB9FF\uBA01-\uBA1B\uBA1D-\uBA37\uBA39-\uBA53\uBA55-\uBA6F\uBA71-\uBA8B\uBA8D-\uBAA7\uBAA9-\uBAC3\uBAC5-\uBADF\uBAE1-\uBAFB\uBAFD-\uBB17\uBB19-\uBB33\uBB35-\uBB4F\uBB51-\uBB6B\uBB6D-\uBB87\uBB89-\uBBA3\uBBA5-\uBBBF\uBBC1-\uBBDB\uBBDD-\uBBF7\uBBF9-\uBC13\uBC15-\uBC2F\uBC31-\uBC4B\uBC4D-\uBC67\uBC69-\uBC83\uBC85-\uBC9F\uBCA1-\uBCBB\uBCBD-\uBCD7\uBCD9-\uBCF3\uBCF5-\uBD0F\uBD11-\uBD2B\uBD2D-\uBD47\uBD49-\uBD63\uBD65-\uBD7F\uBD81-\uBD9B\uBD9D-\uBDB7\uBDB9-\uBDD3\uBDD5-\uBDEF\uBDF1-\uBE0B\uBE0D-\uBE27\uBE29-\uBE43\uBE45-\uBE5F\uBE61-\uBE7B\uBE7D-\uBE97\uBE99-\uBEB3\uBEB5-\uBECF\uBED1-\uBEEB\uBEED-\uBF07\uBF09-\uBF23\uBF25-\uBF3F\uBF41-\uBF5B\uBF5D-\uBF77\uBF79-\uBF93\uBF95-\uBFAF\uBFB1-\uBFCB\uBFCD-\uBFE7\uBFE9-\uC003\uC005-\uC01F\uC021-\uC03B\uC03D-\uC057\uC059-\uC073\uC075-\uC08F\uC091-\uC0AB\uC0AD-\uC0C7\uC0C9-\uC0E3\uC0E5-\uC0FF\uC101-\uC11B\uC11D-\uC137\uC139-\uC153\uC155-\uC16F\uC171-\uC18B\uC18D-\uC1A7\uC1A9-\uC1C3\uC1C5-\uC1DF\uC1E1-\uC1FB\uC1FD-\uC217\uC219-\uC233\uC235-\uC24F\uC251-\uC26B\uC26D-\uC287\uC289-\uC2A3\uC2A5-\uC2BF\uC2C1-\uC2DB\uC2DD-\uC2F7\uC2F9-\uC313\uC315-\uC32F\uC331-\uC34B\uC34D-\uC367\uC369-\uC383\uC385-\uC39F\uC3A1-\uC3BB\uC3BD-\uC3D7\uC3D9-\uC3F3\uC3F5-\uC40F\uC411-\uC42B\uC42D-\uC447\uC449-\uC463\uC465-\uC47F\uC481-\uC49B\uC49D-\uC4B7\uC4B9-\uC4D3\uC4D5-\uC4EF\uC4F1-\uC50B\uC50D-\uC527\uC529-\uC543\uC545-\uC55F\uC561-\uC57B\uC57D-\uC597\uC599-\uC5B3\uC5B5-\uC5CF\uC5D1-\uC5EB\uC5ED-\uC607\uC609-\uC623\uC625-\uC63F\uC641-\uC65B\uC65D-\uC677\uC679-\uC693\uC695-\uC6AF\uC6B1-\uC6CB\uC6CD-\uC6E7\uC6E9-\uC703\uC705-\uC71F\uC721-\uC73B\uC73D-\uC757\uC759-\uC773\uC775-\uC78F\uC791-\uC7AB\uC7AD-\uC7C7\uC7C9-\uC7E3\uC7E5-\uC7FF\uC801-\uC81B\uC81D-\uC837\uC839-\uC853\uC855-\uC86F\uC871-\uC88B\uC88D-\uC8A7\uC8A9-\uC8C3\uC8C5-\uC8DF\uC8E1-\uC8FB\uC8FD-\uC917\uC919-\uC933\uC935-\uC94F\uC951-\uC96B\uC96D-\uC987\uC989-\uC9A3\uC9A5-\uC9BF\uC9C1-\uC9DB\uC9DD-\uC9F7\uC9F9-\uCA13\uCA15-\uCA2F\uCA31-\uCA4B\uCA4D-\uCA67\uCA69-\uCA83\uCA85-\uCA9F\uCAA1-\uCABB\uCABD-\uCAD7\uCAD9-\uCAF3\uCAF5-\uCB0F\uCB11-\uCB2B\uCB2D-\uCB47\uCB49-\uCB63\uCB65-\uCB7F\uCB81-\uCB9B\uCB9D-\uCBB7\uCBB9-\uCBD3\uCBD5-\uCBEF\uCBF1-\uCC0B\uCC0D-\uCC27\uCC29-\uCC43\uCC45-\uCC5F\uCC61-\uCC7B\uCC7D-\uCC97\uCC99-\uCCB3\uCCB5-\uCCCF\uCCD1-\uCCEB\uCCED-\uCD07\uCD09-\uCD23\uCD25-\uCD3F\uCD41-\uCD5B\uCD5D-\uCD77\uCD79-\uCD93\uCD95-\uCDAF\uCDB1-\uCDCB\uCDCD-\uCDE7\uCDE9-\uCE03\uCE05-\uCE1F\uCE21-\uCE3B\uCE3D-\uCE57\uCE59-\uCE73\uCE75-\uCE8F\uCE91-\uCEAB\uCEAD-\uCEC7\uCEC9-\uCEE3\uCEE5-\uCEFF\uCF01-\uCF1B\uCF1D-\uCF37\uCF39-\uCF53\uCF55-\uCF6F\uCF71-\uCF8B\uCF8D-\uCFA7\uCFA9-\uCFC3\uCFC5-\uCFDF\uCFE1-\uCFFB\uCFFD-\uD017\uD019-\uD033\uD035-\uD04F\uD051-\uD06B\uD06D-\uD087\uD089-\uD0A3\uD0A5-\uD0BF\uD0C1-\uD0DB\uD0DD-\uD0F7\uD0F9-\uD113\uD115-\uD12F\uD131-\uD14B\uD14D-\uD167\uD169-\uD183\uD185-\uD19F\uD1A1-\uD1BB\uD1BD-\uD1D7\uD1D9-\uD1F3\uD1F5-\uD20F\uD211-\uD22B\uD22D-\uD247\uD249-\uD263\uD265-\uD27F\uD281-\uD29B\uD29D-\uD2B7\uD2B9-\uD2D3\uD2D5-\uD2EF\uD2F1-\uD30B\uD30D-\uD327\uD329-\uD343\uD345-\uD35F\uD361-\uD37B\uD37D-\uD397\uD399-\uD3B3\uD3B5-\uD3CF\uD3D1-\uD3EB\uD3ED-\uD407\uD409-\uD423\uD425-\uD43F\uD441-\uD45B\uD45D-\uD477\uD479-\uD493\uD495-\uD4AF\uD4B1-\uD4CB\uD4CD-\uD4E7\uD4E9-\uD503\uD505-\uD51F\uD521-\uD53B\uD53D-\uD557\uD559-\uD573\uD575-\uD58F\uD591-\uD5AB\uD5AD-\uD5C7\uD5C9-\uD5E3\uD5E5-\uD5FF\uD601-\uD61B\uD61D-\uD637\uD639-\uD653\uD655-\uD66F\uD671-\uD68B\uD68D-\uD6A7\uD6A9-\uD6C3\uD6C5-\uD6DF\uD6E1-\uD6FB\uD6FD-\uD717\uD719-\uD733\uD735-\uD74F\uD751-\uD76B\uD76D-\uD787\uD789-\uD7A3]$/,my=/^(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])$/,hy=(e,t)=>{var n=Ae.Any;return e.search(ay)!==-1&&(n|=Ae.Extend),t===8205&&(n|=Ae.ZWJ),t>=127462&&t<=127487&&(n|=Ae.RI),e.search(sy)!==-1&&(n|=Ae.Prepend),e.search(oy)!==-1&&(n|=Ae.SpacingMark),e.search(uy)!==-1&&(n|=Ae.L),e.search(ly)!==-1&&(n|=Ae.V),e.search(cy)!==-1&&(n|=Ae.T),e.search(dy)!==-1&&(n|=Ae.LV),e.search(fy)!==-1&&(n|=Ae.LVT),e.search(my)!==-1&&(n|=Ae.ExtPict),n};function Xn(e,t){return(e&t)!==0}var py=[[Ae.L,Ae.L|Ae.V|Ae.LV|Ae.LVT],[Ae.LV|Ae.V,Ae.V|Ae.T],[Ae.LVT|Ae.T,Ae.T],[Ae.Any,Ae.Extend|Ae.ZWJ],[Ae.Any,Ae.SpacingMark],[Ae.Prepend,Ae.Any],[Ae.ZWJ,Ae.ExtPict],[Ae.RI,Ae.RI]];function gy(e,t){return py.findIndex(n=>Xn(e,n[0])&&Xn(t,n[1]))===-1}var vy=/(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC01\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDE41\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4\uDF00\uDF01\uDF36-\uDF3A\uDF40\uDF42]|\uD80D[\uDC40\uDC47-\uDC55]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])*\u200D$/,Ll=e=>e.search(vy)!==-1,by=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,yy=e=>{var t=e.match(by);if(t===null)return!1;var n=t[0].length/2;return n%2===1},xy={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};w.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:i=Ko(e)}=n;if(L.isPath(i)&&(i=w.range(e,i)),Q.isRange(i))if(Q.isCollapsed(i))i=i.anchor;else{var a=Q.end(i);if(!r&&w.void(e,{at:a}))return;var s=Q.start(i),o=w.pointRef(e,s),u=w.pointRef(e,a);ee.delete(e,{at:i,voids:r});var l=o.unref(),d=u.unref();i=l||d,ee.setSelection(e,{anchor:i,focus:i})}if(!(!r&&w.void(e,{at:i})||w.elementReadOnly(e,{at:i}))){var{path:m,offset:h}=i;t.length>0&&e.apply({type:"insert_text",path:m,offset:h,text:t})}})}};function zl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function wi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ee=wi(wi(wi(wi({},$0),L0),z0),xy),Ii=new WeakMap,wy=e=>Ii.get(e)||!1,Cy=(e,t,n)=>{var r=Ii.get(e)||!1;Ii.set(e,!0);try{t(),n()}finally{Ii.set(e,r)}};function nm(e,t,n){var r=ra.get(e)||[],i=ia.get(e)||new Set,a,s,o=m=>{if(m){var h=m.join(",");s.has(h)||(s.add(h),a.push(m))}};if(n){a=[],s=new Set;for(var u of r){var l=n(u);o(l)}}else a=r,s=i;for(var d of t)o(d);ra.set(e,a),ia.set(e,s)}var Dy=(e,t)=>{for(var n of w.pathRefs(e))P0.transform(n,t);for(var r of w.pointRefs(e))O0.transform(r,t);for(var i of w.rangeRefs(e))M0.transform(i,t);if(!wy(e)){var a=L.operationCanTransformPath(t)?s=>L.transform(s,t):void 0;nm(e,e.getDirtyPaths(t),a)}ee.transform(e,t),e.operations.push(t),w.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),Rr.get(e)||(Rr.set(e,!0),Promise.resolve().then(()=>{Rr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Ey=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return L.levels(n)}case"insert_node":{var{node:r,path:i}=t,a=L.levels(i),s=ge.isText(r)?[]:Array.from(le.nodes(r),z=>{var[,O]=z;return i.concat(O)});return[...a,...s]}case"merge_node":{var{path:o}=t,u=L.ancestors(o),l=L.previous(o);return[...u,l]}case"move_node":{var{path:d,newPath:m}=t;if(L.equals(d,m))return[];var h=[],p=[];for(var g of L.ancestors(d)){var f=L.transform(g,t);h.push(f)}for(var b of L.ancestors(m)){var v=L.transform(b,t);p.push(v)}var y=p[p.length-1],C=m[m.length-1],k=y.concat(C);return[...h,...p,k]}case"remove_node":{var{path:D}=t,_=L.ancestors(D);return[..._]}case"split_node":{var{path:B}=t,P=L.levels(B),N=L.next(B);return[...P,N]}default:return[]}},_y=e=>{var{selection:t}=e;return t?le.fragment(e,t):[]},ky=(e,t)=>{var[n,r]=t;if(!ge.isText(n)){if(he.isElement(n)&&n.children.length===0){var i={text:""};ee.insertNodes(e,i,{at:r.concat(0),voids:!0});return}for(var a=w.isEditor(n)?!1:he.isElement(n)&&(e.isInline(n)||n.children.length===0||ge.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var u=le.get(e,r);if(!ge.isText(u)){var l=u.children[s],d=u.children[s-1],m=o===n.children.length-1,h=ge.isText(l)||he.isElement(l)&&e.isInline(l);if(h!==a)ee.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(he.isElement(l)){if(e.isInline(l)){if(d==null||!ge.isText(d)){var p={text:""};ee.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(m){var g={text:""};ee.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&ge.isText(d)&&(ge.equals(l,d,{loose:!0})?(ee.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(ee.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):l.text===""&&(ee.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Fy=(e,t)=>{var{iteration:n,initialDirtyPathsLength:r}=t,i=r*42;if(n>i)throw new Error("Could not completely normalize the editor after ".concat(i," iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state."));return!0},Ay=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:i="lowest",at:a=t.selection,match:s}=n;if(a){var o=w.path(t,a),u=i==="lowest";for(var[l,d]of w.levels(t,{at:o,voids:r,match:s,reverse:u}))if(!ge.isText(l)){if(Q.isRange(a)){if(L.isAncestor(d,a.anchor.path)&&L.isAncestor(d,a.focus.path))return[l,d]}else if(!L.equals(o,d))return[l,d]}}};function ql(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ul(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ql(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ql(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ty=(e,t,n)=>{var{selection:r}=e;if(r){var i=(m,h)=>{if(!ge.isText(m))return!1;var[p,g]=w.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},a=Q.isExpanded(r),s=!1;if(!a){var[o,u]=w.node(e,r);if(o&&i(o,u)){var[l]=w.parent(e,u);s=l&&e.markableVoid(l)}}if(a||s)ee.setNodes(e,{[t]:n},{match:i,split:!0,voids:!0});else{var d=Ul(Ul({},w.marks(e)||{}),{},{[t]:n});e.marks=d,Rr.get(e)||e.onChange()}}};function Wl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Vl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Wl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var By=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=w.point(t,n,{edge:"end"}),a=w.end(t,[]),s={anchor:i,focus:a},{distance:o=1}=r,u=0,l;for(var d of w.positions(t,Vl(Vl({},r),{},{at:s}))){if(u>o)break;u!==0&&(l=d),u++}return l};function Hl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Kl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Hl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Sy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=w.start(t,[]),a=w.point(t,n,{edge:"start"}),s={anchor:i,focus:a},{distance:o=1}=r,u=0,l;for(var d of w.positions(t,Kl(Kl({},r),{},{at:s,reverse:!0}))){if(u>o)break;u!==0&&(l=d),u++}return l},jy=(e,t)=>{var{selection:n}=e;n&&Q.isCollapsed(n)&&ee.delete(e,{unit:t,reverse:!0})},Py=(e,t)=>{var{selection:n}=e;n&&Q.isCollapsed(n)&&ee.delete(e,{unit:t})},Oy=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&Q.isExpanded(r)&&ee.delete(t,{reverse:n==="backward"})},My=(e,t)=>[w.start(e,t),w.end(e,t)];function Zl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Yl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ny=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return w.above(t,Yl(Yl({},n),{},{match:r=>he.isElement(r)&&w.isElementReadOnly(t,r)}))},Iy=(e,t)=>w.point(e,t,{edge:"end"}),Ry=(e,t)=>{var n=w.path(e,t,{edge:"start"});return w.node(e,n)},$y=(e,t)=>{var n=w.range(e,t);return le.fragment(e,n)};function Gl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ql(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ly=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return w.above(t,Ql(Ql({},n),{},{match:r=>he.isElement(r)&&w.isVoid(t,r)}))},zy=(e,t)=>t.children.some(n=>he.isElement(n)&&w.isBlock(e,n)),qy=(e,t)=>t.children.some(n=>ge.isText(n)||w.isInline(e,n)),Uy=(e,t)=>le.has(e,t),Wy=(e,t)=>t.children.every(n=>ge.isText(n)),Vy=e=>{ee.splitNodes(e,{always:!0})},Hy=(e,t,n)=>{ee.insertNodes(e,t,n)},Ky=e=>{ee.splitNodes(e,{always:!0})};function Jl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Zy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Jl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Yy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:i,marks:a}=t;if(i){if(a){var s=Zy({text:n},a);ee.insertNodes(t,s,{at:r.at,voids:r.voids})}else ee.insertText(t,n,r);t.marks=null}},Gy=(e,t)=>!e.isInline(t),Qy=(e,t,n)=>w.isStart(e,t,n)||w.isEnd(e,t,n),Jy=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&ge.isText(r)&&r.text===""&&!e.isVoid(t)},Xy=(e,t,n)=>{var r=w.end(e,n);return Se.equals(t,r)},ex=e=>{var t=em.get(e);return t===void 0?!0:t},tx=(e,t,n)=>{if(t.offset!==0)return!1;var r=w.start(e,n);return Se.equals(t,r)},nx=(e,t)=>{var n=w.path(e,t,{edge:"end"});return w.node(e,n)},rx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=w.path(t,n,r),a=le.leaf(t,i);return[a,i]};function ix(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:i=!1}=t,{match:a}=t;if(a==null&&(a=()=>!0),!!n){var s=[],o=w.path(e,n);for(var[u,l]of le.levels(e,o))if(a(u,l)&&(s.push([u,l]),!i&&he.isElement(u)&&w.isVoid(e,u)))break;r&&s.reverse(),yield*s}}()}var ax=["text"],sx=["text"],ox=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:i,focus:a}=r;if(n)return n;if(Q.isExpanded(r)){var s=w.isEnd(t,i,i.path);if(s){var o=w.after(t,i);o&&(i=o)}var[u]=w.nodes(t,{match:ge.isText,at:{anchor:i,focus:a}});if(u){var[l]=u,d=sn(l,ax);return d}else return{}}var{path:m}=i,[h]=w.leaf(t,m);if(i.offset===0){var p=w.previous(t,{at:m,match:ge.isText}),g=w.above(t,{match:k=>he.isElement(k)&&w.isVoid(t,k)&&t.markableVoid(k)});if(!g){var f=w.above(t,{match:k=>he.isElement(k)&&w.isBlock(t,k)});if(p&&f){var[b,v]=p,[,y]=f;L.isAncestor(y,v)&&(h=b)}}}var C=sn(h,sx);return C},ux=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:i=!1}=n,{match:a,at:s=t.selection}=n;if(s){var o=w.after(t,s,{voids:i});if(o){var[,u]=w.last(t,[]),l=[o.path,u];if(L.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(a==null)if(L.isPath(s)){var[d]=w.parent(t,s);a=h=>d.children.includes(h)}else a=()=>!0;var[m]=w.nodes(t,{at:l,match:a,mode:r,voids:i});return m}}},lx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=w.path(t,n,r),a=le.get(t,i);return[a,i]};function cx(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:i=!1,reverse:a=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:u}=t;if(u||(u=()=>!0),!!n){var l,d;if(Z0.isSpan(n))l=n[0],d=n[1];else{var m=w.path(e,n,{edge:"start"}),h=w.path(e,n,{edge:"end"});l=a?h:m,d=a?m:h}var p=le.nodes(e,{reverse:a,from:l,to:d,pass:k=>{var[D]=k;return he.isElement(D)?!!(!s&&(w.isVoid(e,D)||w.isElementReadOnly(e,D))||o&&!w.isSelectable(e,D)):!1}}),g=[],f;for(var[b,v]of p)if(!(o&&he.isElement(b)&&!w.isSelectable(e,b))){var y=f&&L.compare(v,f[1])===0;if(!(r==="highest"&&y)){if(!u(b,v)){if(i&&!y&&ge.isText(b))return;continue}if(r==="lowest"&&y){f=[b,v];continue}var C=r==="lowest"?f:[b,v];C&&(i?g.push(C):yield C),f=[b,v]}}r==="lowest"&&f&&(i?g.push(f):yield f),i&&(yield*g)}}()}var dx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:i}=n,a=d=>ra.get(d)||[],s=d=>ia.get(d)||new Set,o=d=>{var m=a(d).pop(),h=m.join(",");return s(d).delete(h),m};if(w.isNormalizing(t)){if(r){var u=Array.from(le.nodes(t),d=>{var[,m]=d;return m}),l=new Set(u.map(d=>d.join(",")));ra.set(t,u),ia.set(t,l)}a(t).length!==0&&w.withoutNormalizing(t,()=>{for(var d of a(t))if(le.has(t,d)){var m=w.node(t,d),[h,p]=m;he.isElement(h)&&h.children.length===0&&t.normalizeNode(m,{operation:i})}for(var g=a(t),f=g.length,b=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:b,initialDirtyPathsLength:f,operation:i}))return;var v=o(t);if(le.has(t,v)){var y=w.node(t,v);t.normalizeNode(y,{operation:i})}b++,g=a(t)}})}},fx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=w.path(t,n,r),a=L.parent(i),s=w.node(t,a);return s},mx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:i="forward"}=r,a={current:n,affinity:i,unref(){var{current:o}=a,u=w.pathRefs(t);return u.delete(a),a.current=null,o}},s=w.pathRefs(t);return s.add(a),a},hx=e=>{var t=Fl.get(e);return t||(t=new Set,Fl.set(e,t)),t},px=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:i,edge:a}=r;if(L.isPath(n)){if(a==="start"){var[,s]=le.first(t,n);n=s}else if(a==="end"){var[,o]=le.last(t,n);n=o}}return Q.isRange(n)&&(a==="start"?n=Q.start(n):a==="end"?n=Q.end(n):n=L.common(n.anchor.path,n.focus.path)),Se.isPoint(n)&&(n=n.path),i!=null&&(n=n.slice(0,i)),n},gx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:i="forward"}=r,a={current:n,affinity:i,unref(){var{current:o}=a,u=w.pointRefs(t);return u.delete(a),a.current=null,o}},s=w.pointRefs(t);return s.add(a),a},vx=e=>{var t=Al.get(e);return t||(t=new Set,Al.set(e,t)),t},bx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:i="start"}=r;if(L.isPath(n)){var a;if(i==="end"){var[,s]=le.last(t,n);a=s}else{var[,o]=le.first(t,n);a=o}var u=le.get(t,a);if(!ge.isText(u))throw new Error("Cannot get the ".concat(i," point in the node at path [").concat(n,"] because it has no ").concat(i," text node."));return{path:a,offset:i==="end"?u.text.length:0}}if(Q.isRange(n)){var[l,d]=Q.edges(n);return i==="start"?l:d}return n};function yx(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:i=!1,voids:a=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=w.range(e,n),[u,l]=Q.edges(o),d=i?l:u,m=!1,h="",p=0,g=0,f=0;for(var[b,v]of w.nodes(e,{at:n,reverse:i,voids:a,ignoreNonSelectable:s})){if(he.isElement(b)){if(!a&&(e.isVoid(b)||e.isElementReadOnly(b))){yield w.start(e,v);continue}if(e.isInline(b))continue;if(w.hasInlines(e,b)){var y=L.isAncestor(v,l.path)?l:w.end(e,v),C=L.isAncestor(v,u.path)?u:w.start(e,v);h=w.string(e,{anchor:C,focus:y},{voids:a}),m=!0}}if(ge.isText(b)){var k=L.equals(v,d.path);for(k?(g=i?d.offset:b.text.length-d.offset,f=d.offset):(g=b.text.length,f=i?g:0),(k||m||r==="offset")&&(yield{path:v,offset:f},m=!1);;){if(p===0){if(h==="")break;p=D(h,r,i),h=Yo(h,p,i)[1]}if(f=i?f-p:f+p,g=g-p,g<0){p=-g;break}p=0,yield{path:v,offset:f}}}}function D(_,B,P){return B==="character"?Zo(_,P):B==="word"?ey(_,P):B==="line"||B==="block"?_.length:1}}()}var xx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:i=!1}=n,{match:a,at:s=t.selection}=n;if(s){var o=w.before(t,s,{voids:i});if(o){var[,u]=w.first(t,[]),l=[o.path,u];if(L.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(a==null)if(L.isPath(s)){var[d]=w.parent(t,s);a=h=>d.children.includes(h)}else a=()=>!0;var[m]=w.nodes(t,{reverse:!0,at:l,match:a,mode:r,voids:i});return m}}},wx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:i="forward"}=r,a={current:n,affinity:i,unref(){var{current:o}=a,u=w.rangeRefs(t);return u.delete(a),a.current=null,o}},s=w.rangeRefs(t);return s.add(a),a},Cx=e=>{var t=Tl.get(e);return t||(t=new Set,Tl.set(e,t)),t},Dx=(e,t,n)=>{if(Q.isRange(t)&&!n)return t;var r=w.start(e,t),i=w.end(e,n||t);return{anchor:r,focus:i}};function Xl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ex(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var _x=(e,t)=>{var{selection:n}=e;if(n){var r=(d,m)=>{if(!ge.isText(d))return!1;var[h,p]=w.parent(e,m);return!e.isVoid(h)||e.markableVoid(h)},i=Q.isExpanded(n),a=!1;if(!i){var[s,o]=w.node(e,n);if(s&&r(s,o)){var[u]=w.parent(e,o);a=u&&e.markableVoid(u)}}if(i||a)ee.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var l=Ex({},w.marks(e)||{});delete l[t],e.marks=l,Rr.get(e)||e.onChange()}}},kx=(e,t)=>{em.set(e,t)},Fx=(e,t)=>w.point(e,t,{edge:"start"}),Ax=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:i=!1}=r,a=w.range(t,n),[s,o]=Q.edges(a),u="";for(var[l,d]of w.nodes(t,{at:a,match:ge.isText,voids:i})){var m=l.text;L.equals(d,o.path)&&(m=m.slice(0,o.offset)),L.equals(d,s.path)&&(m=m.slice(s.offset)),u+=m}return u},Tx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:i=!1}=r,[a,s]=Q.edges(n);if(a.offset!==0||s.offset!==0||Q.isCollapsed(n)||L.hasPrevious(s.path))return n;var o=w.above(t,{at:s,match:g=>he.isElement(g)&&w.isBlock(t,g),voids:i}),u=o?o[1]:[],l=w.start(t,a),d={anchor:l,focus:s},m=!0;for(var[h,p]of w.nodes(t,{at:d,match:ge.isText,reverse:!0,voids:i})){if(m){m=!1;continue}if(h.text!==""||L.isBefore(p,u)){s={path:p,offset:h.text.length};break}}return{anchor:a,focus:s}},Bx=(e,t)=>{var n=w.isNormalizing(e);w.setNormalizing(e,!1);try{t()}finally{w.setNormalizing(e,n)}w.normalize(e)},Sx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var r,i,{reverse:a=!1,unit:s="character",distance:o=1,voids:u=!1}=n,{at:l=t.selection,hanging:d=!1}=n;if(l){var m=!1;if(Q.isRange(l)&&Q.isCollapsed(l)&&(m=!0,l=l.anchor),Se.isPoint(l)){var h=w.void(t,{at:l,mode:"highest"});if(!u&&h){var[,p]=h;l=p}else{var g={unit:s,distance:o},f=a?w.before(t,l,g)||w.start(t,[]):w.after(t,l,g)||w.end(t,[]);l={anchor:l,focus:f},d=!0}}if(L.isPath(l)){ee.removeNodes(t,{at:l,voids:u});return}if(!Q.isCollapsed(l)){if(!d){var[,b]=Q.edges(l),v=w.end(t,[]);Se.equals(b,v)||(l=w.unhangRange(t,l,{voids:u}))}var[y,C]=Q.edges(l),k=w.above(t,{match:me=>he.isElement(me)&&w.isBlock(t,me),at:y,voids:u}),D=w.above(t,{match:me=>he.isElement(me)&&w.isBlock(t,me),at:C,voids:u}),_=k&&D&&!L.equals(k[1],D[1]),B=L.equals(y.path,C.path),P=u?null:(r=w.void(t,{at:y,mode:"highest"}))!==null&&r!==void 0?r:w.elementReadOnly(t,{at:y,mode:"highest"}),N=u?null:(i=w.void(t,{at:C,mode:"highest"}))!==null&&i!==void 0?i:w.elementReadOnly(t,{at:C,mode:"highest"});if(P){var z=w.before(t,y);z&&k&&L.isAncestor(k[1],z.path)&&(y=z)}if(N){var O=w.after(t,C);O&&D&&L.isAncestor(D[1],O.path)&&(C=O)}var A=[],F;for(var S of w.nodes(t,{at:l,voids:u})){var[I,H]=S;F&&L.compare(H,F)===0||(!u&&he.isElement(I)&&(w.isVoid(t,I)||w.isElementReadOnly(t,I))||!L.isCommon(H,y.path)&&!L.isCommon(H,C.path))&&(A.push(S),F=H)}var V=Array.from(A,me=>{var[,ye]=me;return w.pathRef(t,ye)}),ae=w.pointRef(t,y),ne=w.pointRef(t,C),E="";if(!B&&!P){var Y=ae.current,[q]=w.leaf(t,Y),{path:T}=Y,{offset:j}=y,R=q.text.slice(j);R.length>0&&(t.apply({type:"remove_text",path:T,offset:j,text:R}),E=R)}if(V.reverse().map(me=>me.unref()).filter(me=>me!==null).forEach(me=>ee.removeNodes(t,{at:me,voids:u})),!N){var M=ne.current,[U]=w.leaf(t,M),{path:X}=M,W=B?y.offset:0,te=U.text.slice(W,C.offset);te.length>0&&(t.apply({type:"remove_text",path:X,offset:W,text:te}),E=te)}!B&&_&&ne.current&&ae.current&&ee.mergeNodes(t,{at:ne.current,hanging:!0,voids:u}),m&&a&&s==="character"&&E.length>1&&E.match(/[\u0E00-\u0E7F]+/)&&ee.insertText(t,E.slice(0,E.length-o));var de=ae.unref(),J=ne.unref(),ve=a?de||J:J||de;n.at==null&&ve&&ee.select(t,ve)}}})},jx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};w.withoutNormalizing(t,()=>{var{hanging:i=!1,voids:a=!1}=r,{at:s=Ko(t),batchDirty:o=!0}=r;if(n.length){if(Q.isRange(s))if(i||(s=w.unhangRange(t,s,{voids:a})),Q.isCollapsed(s))s=s.anchor;else{var[,u]=Q.edges(s);if(!a&&w.void(t,{at:u}))return;var l=w.pointRef(t,u);ee.delete(t,{at:s}),s=l.unref()}else L.isPath(s)&&(s=w.start(t,s));if(!(!a&&w.void(t,{at:s}))){var d=w.above(t,{at:s,match:R=>he.isElement(R)&&w.isInline(t,R),mode:"highest",voids:a});if(d){var[,m]=d;if(w.isEnd(t,s,m)){var h=w.after(t,m);s=h}else if(w.isStart(t,s,m)){var p=w.before(t,m);s=p}}var g=w.above(t,{match:R=>he.isElement(R)&&w.isBlock(t,R),at:s,voids:a}),[,f]=g,b=w.isStart(t,s,f),v=w.isEnd(t,s,f),y=b&&v,C=!b||b&&v,k=!v,[,D]=le.first({children:n},[]),[,_]=le.last({children:n},[]),B=[],P=R=>{var[M,U]=R,X=U.length===0;return X?!1:y?!0:!(C&&L.isAncestor(U,D)&&he.isElement(M)&&!t.isVoid(M)&&!t.isInline(M)||k&&L.isAncestor(U,_)&&he.isElement(M)&&!t.isVoid(M)&&!t.isInline(M))};for(var N of le.nodes({children:n},{pass:P}))P(N)&&B.push(N);var z=[],O=[],A=[],F=!0,S=!1;for(var[I]of B)he.isElement(I)&&!t.isInline(I)?(F=!1,S=!0,O.push(I)):F?z.push(I):A.push(I);var[H]=w.nodes(t,{at:s,match:R=>ge.isText(R)||w.isInline(t,R),mode:"highest",voids:a}),[,V]=H,ae=w.isStart(t,s,V),ne=w.isEnd(t,s,V),E=w.pathRef(t,v&&!A.length?L.next(f):f),Y=w.pathRef(t,ne?L.next(V):V);ee.splitNodes(t,{at:s,match:R=>S?he.isElement(R)&&w.isBlock(t,R):ge.isText(R)||w.isInline(t,R),mode:S?"lowest":"highest",always:S&&(!b||z.length>0)&&(!v||A.length>0),voids:a});var q=w.pathRef(t,!ae||ae&&ne?L.next(V):V);if(ee.insertNodes(t,z,{at:q.current,match:R=>ge.isText(R)||w.isInline(t,R),mode:"highest",voids:a,batchDirty:o}),y&&!z.length&&O.length&&!A.length&&ee.delete(t,{at:f,voids:a}),ee.insertNodes(t,O,{at:E.current,match:R=>he.isElement(R)&&w.isBlock(t,R),mode:"lowest",voids:a,batchDirty:o}),ee.insertNodes(t,A,{at:Y.current,match:R=>ge.isText(R)||w.isInline(t,R),mode:"highest",voids:a,batchDirty:o}),!r.at){var T;if(A.length>0&&Y.current?T=L.previous(Y.current):O.length>0&&E.current?T=L.previous(E.current):q.current&&(T=L.previous(q.current)),T){var j=w.end(t,T);ee.select(t,j)}}q.unref(),E.unref(),Y.unref()}}})},Px=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:i}=t;if(i){if(r==="anchor")ee.select(t,i.anchor);else if(r==="focus")ee.select(t,i.focus);else if(r==="start"){var[a]=Q.edges(i);ee.select(t,a)}else if(r==="end"){var[,s]=Q.edges(i);ee.select(t,s)}}else return},Ox=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},Mx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:i=1,unit:a="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=Q.isBackward(r)?"focus":"anchor"),o==="end"&&(o=Q.isBackward(r)?"anchor":"focus");var{anchor:u,focus:l}=r,d={distance:i,unit:a,ignoreNonSelectable:!0},m={};if(o==null||o==="anchor"){var h=s?w.before(t,u,d):w.after(t,u,d);h&&(m.anchor=h)}if(o==null||o==="focus"){var p=s?w.before(t,l,d):w.after(t,l,d);p&&(m.focus=p)}ee.setSelection(t,m)}},Nx=(e,t)=>{var{selection:n}=e;if(t=w.range(e,t),n){ee.setSelection(e,t);return}if(!Q.isRange(t))throw new Error("When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: ".concat(at.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function ec(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ec(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ec(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ix=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:i}=t,{edge:a="both"}=r;if(i){a==="start"&&(a=Q.isBackward(i)?"focus":"anchor"),a==="end"&&(a=Q.isBackward(i)?"anchor":"focus");var{anchor:s,focus:o}=i,u=a==="anchor"?s:o;ee.setSelection(t,{[a==="anchor"?"anchor":"focus"]:tc(tc({},u),n)})}},Rx=(e,t)=>{var{selection:n}=e,r={},i={};if(n){for(var a in t)(a==="anchor"&&t.anchor!=null&&!Se.equals(t.anchor,n.anchor)||a==="focus"&&t.focus!=null&&!Se.equals(t.focus,n.focus)||a!=="anchor"&&a!=="focus"&&t[a]!==n[a])&&(r[a]=n[a],i[a]=t[a]);Object.keys(r).length>0&&e.apply({type:"set_selection",properties:r,newProperties:i})}},$x=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};w.withoutNormalizing(t,()=>{var{hanging:i=!1,voids:a=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:u,match:l,select:d}=r;if(le.isNode(n)&&(n=[n]),n.length!==0){var[m]=n;if(u||(u=Ko(t),d!==!1&&(d=!0)),d==null&&(d=!1),Q.isRange(u))if(i||(u=w.unhangRange(t,u,{voids:a})),Q.isCollapsed(u))u=u.anchor;else{var[,h]=Q.edges(u),p=w.pointRef(t,h);ee.delete(t,{at:u}),u=p.unref()}if(Se.isPoint(u)){l==null&&(ge.isText(m)?l=z=>ge.isText(z):t.isInline(m)?l=z=>ge.isText(z)||w.isInline(t,z):l=z=>he.isElement(z)&&w.isBlock(t,z));var[g]=w.nodes(t,{at:u.path,match:l,mode:s,voids:a});if(g){var[,f]=g,b=w.pathRef(t,f),v=w.isEnd(t,u,f);ee.splitNodes(t,{at:u,match:l,mode:s,voids:a});var y=b.unref();u=v?L.next(y):y}else return}var C=L.parent(u),k=u[u.length-1];if(!(!a&&w.void(t,{at:C}))){if(o){var D=[],_=L.levels(C);Cy(t,()=>{var z=function(){var F=C.concat(k);k++;var S={type:"insert_node",path:F,node:O};t.apply(S),u=L.next(u),D.push(S),ge.isText?_.push(...Array.from(le.nodes(O),I=>{var[,H]=I;return F.concat(H)})):_.push(F)};for(var O of n)z()},()=>{nm(t,_,z=>{var O=z;for(var A of D)if(L.operationCanTransformPath(A)&&(O=L.transform(O,A),!O))return null;return O})})}else for(var B of n){var P=C.concat(k);k++,t.apply({type:"insert_node",path:P,node:B}),u=L.next(u)}if(u=L.previous(u),d){var N=w.end(t,u);N&&ee.select(t,N)}}}})},Lx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:i="lowest",voids:a=!1}=n,{match:s}=n;if(s==null&&(s=L.isPath(r)?wr(t,r):k=>he.isElement(k)&&w.isBlock(t,k)),!!r){var o=w.nodes(t,{at:r,match:s,mode:i,voids:a}),u=Array.from(o,k=>{var[,D]=k;return w.pathRef(t,D)});for(var l of u){var d=l.unref();if(d.length<2)throw new Error("Cannot lift node at a path [".concat(d,"] because it has a depth of less than `2`."));var m=w.node(t,L.parent(d)),[h,p]=m,g=d[d.length-1],{length:f}=h.children;if(f===1){var b=L.next(p);ee.moveNodes(t,{at:d,to:b,voids:a}),ee.removeNodes(t,{at:p,voids:a})}else if(g===0)ee.moveNodes(t,{at:d,to:p,voids:a});else if(g===f-1){var v=L.next(p);ee.moveNodes(t,{at:d,to:v,voids:a})}else{var y=L.next(d),C=L.next(p);ee.splitNodes(t,{at:y,voids:a}),ee.moveNodes(t,{at:d,to:C,voids:a})}}}})},zx=["text"],qx=["children"],rm=(e,t)=>{if(he.isElement(t)){var n=t;return w.isVoid(e,t)?!0:n.children.length===1?rm(e,n.children[0]):!1}else return!w.isEditor(t)},Ux=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var{match:r,at:i=t.selection}=n,{hanging:a=!1,voids:s=!1,mode:o="lowest"}=n;if(i){if(r==null)if(L.isPath(i)){var[u]=w.parent(t,i);r=z=>u.children.includes(z)}else r=z=>he.isElement(z)&&w.isBlock(t,z);if(!a&&Q.isRange(i)&&(i=w.unhangRange(t,i,{voids:s})),Q.isRange(i))if(Q.isCollapsed(i))i=i.anchor;else{var[,l]=Q.edges(i),d=w.pointRef(t,l);ee.delete(t,{at:i}),i=d.unref(),n.at==null&&ee.select(t,i)}var[m]=w.nodes(t,{at:i,match:r,voids:s,mode:o}),h=w.previous(t,{at:i,match:r,voids:s,mode:o});if(!(!m||!h)){var[p,g]=m,[f,b]=h;if(!(g.length===0||b.length===0)){var v=L.next(b),y=L.common(g,b),C=L.isSibling(g,b),k=Array.from(w.levels(t,{at:g}),z=>{var[O]=z;return O}).slice(y.length).slice(0,-1),D=w.above(t,{at:g,mode:"highest",match:z=>k.includes(z)&&rm(t,z)}),_=D&&w.pathRef(t,D[1]),B,P;if(ge.isText(p)&&ge.isText(f)){var N=sn(p,zx);P=f.text.length,B=N}else if(he.isElement(p)&&he.isElement(f)){var N=sn(p,qx);P=f.children.length,B=N}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(at.stringify(p)," ").concat(at.stringify(f)));C||ee.moveNodes(t,{at:g,to:v,voids:s}),_&&ee.removeNodes(t,{at:_.current,voids:s}),he.isElement(f)&&w.isEmpty(t,f)||ge.isText(f)&&f.text===""&&b[b.length-1]!==0?ee.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:v,position:P,properties:B}),_&&_.unref()}}}})},Wx=(e,t)=>{w.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:i="lowest",voids:a=!1}=t,{match:s}=t;if(r){s==null&&(s=L.isPath(r)?wr(e,r):p=>he.isElement(p)&&w.isBlock(e,p));var o=w.pathRef(e,n),u=w.nodes(e,{at:r,match:s,mode:i,voids:a}),l=Array.from(u,p=>{var[,g]=p;return w.pathRef(e,g)});for(var d of l){var m=d.unref(),h=o.current;m.length!==0&&e.apply({type:"move_node",path:m,newPath:h}),o.current&&L.isSibling(h,m)&&L.isAfter(h,m)&&(o.current=L.next(o.current))}o.unref()}})},Vx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:i=!1,mode:a="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=L.isPath(s)?wr(t,s):p=>he.isElement(p)&&w.isBlock(t,p)),!r&&Q.isRange(s)&&(s=w.unhangRange(t,s,{voids:i}));var u=w.nodes(t,{at:s,match:o,mode:a,voids:i}),l=Array.from(u,p=>{var[,g]=p;return w.pathRef(t,g)});for(var d of l){var m=d.unref();if(m){var[h]=w.node(t,m);t.apply({type:"remove_node",path:m,node:h})}}}})},Hx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};w.withoutNormalizing(t,()=>{var{match:i,at:a=t.selection,compare:s,merge:o}=r,{hanging:u=!1,mode:l="lowest",split:d=!1,voids:m=!1}=r;if(a){if(i==null&&(i=L.isPath(a)?wr(t,a):P=>he.isElement(P)&&w.isBlock(t,P)),!u&&Q.isRange(a)&&(a=w.unhangRange(t,a,{voids:m})),d&&Q.isRange(a)){if(Q.isCollapsed(a)&&w.leaf(t,a.anchor)[0].text.length>0)return;var h=w.rangeRef(t,a,{affinity:"inward"}),[p,g]=Q.edges(a),f=l==="lowest"?"lowest":"highest",b=w.isEnd(t,g,g.path);ee.splitNodes(t,{at:g,match:i,mode:f,voids:m,always:!b});var v=w.isStart(t,p,p.path);ee.splitNodes(t,{at:p,match:i,mode:f,voids:m,always:!v}),a=h.unref(),r.at==null&&ee.select(t,a)}s||(s=(P,N)=>P!==N);for(var[y,C]of w.nodes(t,{at:a,match:i,mode:l,voids:m})){var k={},D={};if(C.length!==0){var _=!1;for(var B in n)B==="children"||B==="text"||s(n[B],y[B])&&(_=!0,y.hasOwnProperty(B)&&(k[B]=y[B]),o?n[B]!=null&&(D[B]=o(y[B],n[B])):n[B]!=null&&(D[B]=n[B]));_&&t.apply({type:"set_node",path:C,properties:k,newProperties:D})}}}})},Kx=(e,t)=>{if(Q.isCollapsed(t))return t.anchor;var[,n]=Q.edges(t),r=w.pointRef(e,n);return ee.delete(e,{at:t}),r.unref()},Zx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:i=!1}=n,{match:a,at:s=t.selection,height:o=0,always:u=!1}=n;if(a==null&&(a=ne=>he.isElement(ne)&&w.isBlock(t,ne)),Q.isRange(s)&&(s=Kx(t,s)),L.isPath(s)){var l=s,d=w.point(t,l),[m]=w.parent(t,l);a=ne=>ne===m,o=d.path.length-l.length+1,s=d,u=!0}if(s){var h=w.pointRef(t,s,{affinity:"backward"}),p;try{var[g]=w.nodes(t,{at:s,match:a,mode:r,voids:i});if(!g)return;var f=w.void(t,{at:s,mode:"highest"}),b=0;if(!i&&f){var[v,y]=f;if(he.isElement(v)&&t.isInline(v)){var C=w.after(t,y);if(!C){var k={text:""},D=L.next(y);ee.insertNodes(t,k,{at:D,voids:i}),C=w.point(t,D)}s=C,u=!0}var _=s.path.length-y.length;o=_+1,u=!0}p=w.pointRef(t,s);var B=s.path.length-o,[,P]=g,N=s.path.slice(0,B),z=o===0?s.offset:s.path[B]+b;for(var[O,A]of w.levels(t,{at:N,reverse:!0,voids:i})){var F=!1;if(A.length<P.length||A.length===0||!i&&he.isElement(O)&&w.isVoid(t,O))break;var S=h.current,I=w.isEnd(t,S,A);if(u||!h||!w.isEdge(t,S,A)){F=!0;var H=le.extractProps(O);t.apply({type:"split_node",path:A,position:z,properties:H})}z=A[A.length-1]+(F||I?1:0)}if(n.at==null){var V=p.current||w.end(t,[]);ee.select(t,V)}}finally{var ae;h.unref(),(ae=p)===null||ae===void 0||ae.unref()}}})},Yx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var i={};for(var a of n)i[a]=null;ee.setNodes(t,i,r)},Gx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var{mode:r="lowest",split:i=!1,voids:a=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=L.isPath(s)?wr(t,s):p=>he.isElement(p)&&w.isBlock(t,p)),L.isPath(s)&&(s=w.range(t,s));var u=Q.isRange(s)?w.rangeRef(t,s):null,l=w.nodes(t,{at:s,match:o,mode:r,voids:a}),d=Array.from(l,p=>{var[,g]=p;return w.pathRef(t,g)}).reverse(),m=function(){var g=h.unref(),[f]=w.node(t,g),b=w.range(t,g);i&&u&&(b=Q.intersection(u.current,b)),ee.liftNodes(t,{at:b,match:v=>he.isAncestor(f)&&f.children.includes(v),voids:a})};for(var h of d)m();u&&u.unref()}})};function nc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nc(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Qx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};w.withoutNormalizing(t,()=>{var{mode:i="lowest",split:a=!1,voids:s=!1}=r,{match:o,at:u=t.selection}=r;if(u){if(o==null&&(L.isPath(u)?o=wr(t,u):t.isInline(n)?o=b=>he.isElement(b)&&w.isInline(t,b)||ge.isText(b):o=b=>he.isElement(b)&&w.isBlock(t,b)),a&&Q.isRange(u)){var[l,d]=Q.edges(u),m=w.rangeRef(t,u,{affinity:"inward"});ee.splitNodes(t,{at:d,match:o,voids:s}),ee.splitNodes(t,{at:l,match:o,voids:s}),u=m.unref(),r.at==null&&ee.select(t,u)}var h=Array.from(w.nodes(t,{at:u,match:t.isInline(n)?b=>he.isElement(b)&&w.isBlock(t,b):b=>w.isEditor(b),mode:"lowest",voids:s})),p=function(){var v=Q.isRange(u)?Q.intersection(u,w.range(t,f)):u;if(!v)return 0;var y=Array.from(w.nodes(t,{at:v,match:o,mode:i,voids:s}));if(y.length>0){var[C]=y,k=y[y.length-1],[,D]=C,[,_]=k;if(D.length===0&&_.length===0)return 0;var B=L.equals(D,_)?L.parent(D):L.common(D,_),P=w.range(t,D,_),N=w.node(t,B),[z]=N,O=B.length+1,A=L.next(_.slice(0,O)),F=rc(rc({},n),{},{children:[]});ee.insertNodes(t,F,{at:A,voids:s}),ee.moveNodes(t,{at:P,match:S=>he.isAncestor(z)&&z.children.includes(S),to:A.concat(0),voids:s})}},g;for(var[,f]of h)g=p()}})},Jx=()=>{var e={children:[],operations:[],selection:null,marks:null,isElementReadOnly:()=>!1,isInline:()=>!1,isSelectable:()=>!0,isVoid:()=>!1,markableVoid:()=>!1,onChange:()=>{},apply:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Dy(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ty(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return jy(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Py(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Oy(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return _y(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Vy(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ky(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return jx(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Hy(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Yy(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ky(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return _x(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ey(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Fy(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ay(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return By(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Sy(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Px(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Sx(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ox(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return My(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ny(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Iy(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ry(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return $y(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ox(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return zy(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return qy(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Uy(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Wy(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return $x(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Gy(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Qy(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Jy(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Xy(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ex(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return tx(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return nx(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return rx(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ix(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Lx(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ux(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Mx(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Wx(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ux(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return lx(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return cx(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return dx(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return fx(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return px(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return mx(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return hx(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return bx(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return gx(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return vx(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return yx(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return xx(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Dx(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return wx(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Cx(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Vx(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Nx(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Hx(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return kx(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ix(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Rx(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Zx(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Fx(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ax(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Tx(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Yx(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Gx(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ly(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Bx(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Qx(e,...r)}};return e},Sn=[],Xx=function(){return Sn.some(function(e){return e.activeTargets.length>0})},e1=function(){return Sn.some(function(e){return e.skippedTargets.length>0})},ic="ResizeObserver loop completed with undelivered notifications.",t1=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:ic}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=ic),window.dispatchEvent(e)},Jr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Jr||(Jr={}));var jn=function(e){return Object.freeze(e)},n1=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,jn(this)}return e}(),im=function(){function e(t,n,r,i){return this.x=t,this.y=n,this.width=r,this.height=i,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,jn(this)}return e.prototype.toJSON=function(){var t=this,n=t.x,r=t.y,i=t.top,a=t.right,s=t.bottom,o=t.left,u=t.width,l=t.height;return{x:n,y:r,top:i,right:a,bottom:s,left:o,width:u,height:l}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),Go=function(e){return e instanceof SVGElement&&"getBBox"in e},am=function(e){if(Go(e)){var t=e.getBBox(),n=t.width,r=t.height;return!n&&!r}var i=e,a=i.offsetWidth,s=i.offsetHeight;return!(a||s||e.getClientRects().length)},ac=function(e){var t;if(e instanceof Element)return!0;var n=(t=e==null?void 0:e.ownerDocument)===null||t===void 0?void 0:t.defaultView;return!!(n&&e instanceof n.Element)},r1=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},$r=typeof window<"u"?window:{},Ci=new WeakMap,sc=/auto|scroll/,i1=/^tb|vertical/,a1=/msie|trident/i.test($r.navigator&&$r.navigator.userAgent),Ut=function(e){return parseFloat(e||"0")},ir=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new n1((n?t:e)||0,(n?e:t)||0)},oc=jn({devicePixelContentBoxSize:ir(),borderBoxSize:ir(),contentBoxSize:ir(),contentRect:new im(0,0,0,0)}),sm=function(e,t){if(t===void 0&&(t=!1),Ci.has(e)&&!t)return Ci.get(e);if(am(e))return Ci.set(e,oc),oc;var n=getComputedStyle(e),r=Go(e)&&e.ownerSVGElement&&e.getBBox(),i=!a1&&n.boxSizing==="border-box",a=i1.test(n.writingMode||""),s=!r&&sc.test(n.overflowY||""),o=!r&&sc.test(n.overflowX||""),u=r?0:Ut(n.paddingTop),l=r?0:Ut(n.paddingRight),d=r?0:Ut(n.paddingBottom),m=r?0:Ut(n.paddingLeft),h=r?0:Ut(n.borderTopWidth),p=r?0:Ut(n.borderRightWidth),g=r?0:Ut(n.borderBottomWidth),f=r?0:Ut(n.borderLeftWidth),b=m+l,v=u+d,y=f+p,C=h+g,k=o?e.offsetHeight-C-e.clientHeight:0,D=s?e.offsetWidth-y-e.clientWidth:0,_=i?b+y:0,B=i?v+C:0,P=r?r.width:Ut(n.width)-_-D,N=r?r.height:Ut(n.height)-B-k,z=P+b+D+y,O=N+v+k+C,A=jn({devicePixelContentBoxSize:ir(Math.round(P*devicePixelRatio),Math.round(N*devicePixelRatio),a),borderBoxSize:ir(z,O,a),contentBoxSize:ir(P,N,a),contentRect:new im(m,u,P,N)});return Ci.set(e,A),A},om=function(e,t,n){var r=sm(e,n),i=r.borderBoxSize,a=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Jr.DEVICE_PIXEL_CONTENT_BOX:return s;case Jr.BORDER_BOX:return i;default:return a}},s1=function(){function e(t){var n=sm(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=jn([n.borderBoxSize]),this.contentBoxSize=jn([n.contentBoxSize]),this.devicePixelContentBoxSize=jn([n.devicePixelContentBoxSize])}return e}(),um=function(e){if(am(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},o1=function(){var e=1/0,t=[];Sn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(l){var d=new s1(l.target),m=um(l.target);o.push(d),l.lastReportedSize=om(l.target,l.observedBox),m<e&&(e=m)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var i=r[n];i()}return e},uc=function(e){Sn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(i){i.isActive()&&(um(i.target)>e?n.activeTargets.push(i):n.skippedTargets.push(i))})})},u1=function(){var e=0;for(uc(e);Xx();)e=o1(),uc(e);return e1()&&t1(),e>0},Xa,lm=[],l1=function(){return lm.splice(0).forEach(function(e){return e()})},c1=function(e){if(!Xa){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return l1()}).observe(n,r),Xa=function(){n.textContent="".concat(t?t--:t++)}}lm.push(e),Xa()},d1=function(e){c1(function(){requestAnimationFrame(e)})},Ri=0,f1=function(){return!!Ri},m1=250,h1={attributes:!0,characterData:!0,childList:!0,subtree:!0},lc=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],cc=function(e){return e===void 0&&(e=0),Date.now()+e},es=!1,p1=function(){function e(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return e.prototype.run=function(t){var n=this;if(t===void 0&&(t=m1),!es){es=!0;var r=cc(t);d1(function(){var i=!1;try{i=u1()}finally{if(es=!1,t=r-cc(),!f1())return;i?n.run(1e3):t>0?n.run(t):n.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var t=this,n=function(){return t.observer&&t.observer.observe(document.body,h1)};document.body?n():$r.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),lc.forEach(function(n){return $r.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),lc.forEach(function(n){return $r.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),Gs=new p1,dc=function(e){!Ri&&e>0&&Gs.start(),Ri+=e,!Ri&&Gs.stop()},g1=function(e){return!Go(e)&&!r1(e)&&getComputedStyle(e).display==="inline"},v1=function(){function e(t,n){this.target=t,this.observedBox=n||Jr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=om(this.target,this.observedBox,!0);return g1(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),b1=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Di=new WeakMap,fc=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Ei=function(){function e(){}return e.connect=function(t,n){var r=new b1(t,n);Di.set(t,r)},e.observe=function(t,n,r){var i=Di.get(t),a=i.observationTargets.length===0;fc(i.observationTargets,n)<0&&(a&&Sn.push(i),i.observationTargets.push(new v1(n,r&&r.box)),dc(1),Gs.schedule())},e.unobserve=function(t,n){var r=Di.get(t),i=fc(r.observationTargets,n),a=r.observationTargets.length===1;i>=0&&(a&&Sn.splice(Sn.indexOf(r),1),r.observationTargets.splice(i,1),dc(-1))},e.disconnect=function(t){var n=this,r=Di.get(t);r.observationTargets.slice().forEach(function(i){return n.unobserve(t,i.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),y1=function(){function e(t){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof t!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Ei.connect(this,t)}return e.prototype.observe=function(t,n){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ac(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Ei.observe(this,t,n)},e.prototype.unobserve=function(t){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ac(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Ei.unobserve(this,t)},e.prototype.disconnect=function(){Ei.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),dn={};Object.defineProperty(dn,"__esModule",{value:!0});var x1=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),ts={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},cm={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:x1?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Qo={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222};for(var _i=1;_i<20;_i++)Qo["f"+_i]=111+_i;function Da(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return dm(s,t)}),i=function(o){return r.some(function(u){return fm(u,o)})},a=n==null?i:i(n);return a}function w1(e,t){return Da(e,t)}function C1(e,t){return Da(e,{byKey:!0},t)}function dm(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var i=e.split("+"),a=i.length;for(var s in ts)r[ts[s]]=!1;var o=!0,u=!1,l=void 0;try{for(var d=i[Symbol.iterator](),m;!(o=(m=d.next()).done);o=!0){var h=m.value,p=h.endsWith("?")&&h.length>1;p&&(h=h.slice(0,-1));var g=Jo(h),f=ts[g];if(h.length>1&&!f&&!cm[h]&&!Qo[g])throw new TypeError('Unknown modifier: "'+h+'"');(a===1||!f)&&(n?r.key=g:r.which=mm(h)),f&&(r[f]=p?null:!0)}}catch(b){u=!0,l=b}finally{try{!o&&d.return&&d.return()}finally{if(u)throw l}}return r}function fm(e,t){for(var n in e){var r=e[n],i=void 0;if(r!=null&&(n==="key"&&t.key!=null?i=t.key.toLowerCase():n==="which"?i=r===91&&t.which===93?91:t.which:i=t[n],!(i==null&&r===!1)&&i!==r))return!1}return!0}function mm(e){e=Jo(e);var t=Qo[e]||e.toUpperCase().charCodeAt(0);return t}function Jo(e){return e=e.toLowerCase(),e=cm[e]||e,e}var D1=dn.default=Da,ns=dn.isHotkey=Da;dn.isCodeHotkey=w1;dn.isKeyHotkey=C1;dn.parseHotkey=dm;dn.compareHotkey=fm;dn.toKeyCode=mm;dn.toKeyName=Jo;function E1(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function mr(e,t){if(e==null)return{};var n=E1(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Xr(e){"@babel/helpers - typeof";return Xr=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},Xr(e)}function _1(e,t){if(Xr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Xr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function k1(e){var t=_1(e,"string");return Xr(t)==="symbol"?t:String(t)}function Mt(e,t,n){return t=k1(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xo=x.createContext(null),En=()=>{var e=x.useContext(Xo);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},hm=parseInt(x.version.split(".")[0],10),F1=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,mc=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),mt=typeof navigator<"u"&&/Android/.test(navigator.userAgent),er=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Mr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),A1=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),pm=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),T1=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),B1=mt&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),S1=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),j1=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),P1=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),$i=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",fn=(!T1||!B1)&&!A1&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",eu=new WeakMap,tu=new WeakMap,gm=new WeakMap,Li=new WeakMap,Qs=new WeakMap,ei=new WeakMap,Pn=new WeakMap,aa=new WeakMap,Ea=new WeakMap,Js=new WeakMap,bn=new WeakMap,Bn=new WeakMap,Lr=new WeakMap,Xs=new WeakMap,nu=new WeakMap,$t=new WeakMap,rn=new WeakMap,bt=new WeakMap,hn=new WeakMap,pn=new WeakMap,vm=new WeakMap,hr=Symbol("placeholder"),bm=Symbol("mark-placeholder"),O1=globalThis.Text,ru=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,M1=e=>xn(e)&&e.nodeType===8,Ot=e=>xn(e)&&e.nodeType===1,xn=e=>{var t=ru(e);return!!t&&e instanceof t.Node},eo=e=>{var t=e&&e.anchorNode&&ru(e.anchorNode);return!!t&&e instanceof t.Selection},ym=e=>xn(e)&&e.nodeType===3,N1=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,I1=e=>{var[t,n]=e;if(Ot(t)&&t.childNodes.length){var r=n===t.childNodes.length,i=r?n-1:n;for([t,i]=xm(t,i,r?"backward":"forward"),r=i<n;Ot(t)&&t.childNodes.length;){var a=r?t.childNodes.length-1:0;t=$1(t,a,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},R1=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},xm=(e,t,n)=>{for(var{childNodes:r}=e,i=r[t],a=t,s=!1,o=!1;(M1(i)||Ot(i)&&i.childNodes.length===0||Ot(i)&&i.getAttribute("contenteditable")==="false")&&!(s&&o);){if(a>=r.length){s=!0,a=t-1,n="backward";continue}if(a<0){o=!0,a=t+1,n="forward";continue}i=r[a],t=a,a+=n==="forward"?1:-1}return[i,t]},$1=(e,t,n)=>{var[r]=xm(e,t,n);return r},wm=e=>{var t="";if(ym(e)&&e.nodeValue)return e.nodeValue;if(Ot(e)){for(var n of Array.from(e.childNodes))t+=wm(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
72
- `)}return t},L1=/data-slate-fragment="(.+?)"/m,z1=e=>{var t=e.getData("text/html"),[,n]=t.match(L1)||[];return n},iu=(e,t,n)=>{var{target:r}=t;if(Ot(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:i}=re.getWindow(e);if(i.contains(r))return re.hasDOMNode(e,r,{editable:!0});var a=n.find(s=>{var{addedNodes:o,removedNodes:u}=s;for(var l of o)if(l===r||l.contains(r))return!0;for(var d of u)if(d===r||d.contains(r))return!0});return!a||a===t?!1:iu(e,a,n)},q1=0;class U1{constructor(){Mt(this,"id",void 0),this.id="".concat(q1++)}}var re={androidPendingDiffs:e=>bt.get(e),androidScheduleFlush:e=>{var t;(t=nu.get(e))===null||t===void 0||t()},blur:e=>{var t=re.toDOMNode(e,e),n=re.findDocumentOrShadowRoot(e);bn.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=re.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&ee.deselect(e)},findDocumentOrShadowRoot:e=>{var t=re.toDOMNode(e,e),n=t.getRootNode();return(n instanceof Document||n instanceof ShadowRoot)&&n.getSelection!=null?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:i}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var a=re.toSlateNode(e,t.target),s=re.findPath(e,a);if(he.isElement(a)&&w.isVoid(e,a)){var o=i.getBoundingClientRect(),u=e.isInline(a)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,l=w.point(e,s,{edge:u?"start":"end"}),d=u?w.before(e,l):w.after(e,l);if(d){var m=w.range(e,d);return m}}var h,{document:p}=re.getWindow(e);if(p.caretRangeFromPoint)h=p.caretRangeFromPoint(n,r);else{var g=p.caretPositionFromPoint(n,r);g&&(h=p.createRange(),h.setStart(g.offsetNode,g.offset),h.setEnd(g.offsetNode,g.offset))}if(!h)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=re.toSlateRange(e,h,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=aa.get(t);return n||(n=new U1,aa.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var i=tu.get(r);if(i==null){if(w.isEditor(r))return n;break}var a=eu.get(r);if(a==null)break;n.unshift(a),r=i}throw new Error("Unable to find the path for Slate node: ".concat(at.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!bn.get(t)){if(n.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(t.operations.length>0){setTimeout(()=>{re.focus(t,{retries:n.retries-1})},10);return}var r=re.toDOMNode(t,t),i=re.findDocumentOrShadowRoot(t);if(i.activeElement!==r){if(t.selection&&i instanceof Document){var a=i.getSelection(),s=re.toDOMRange(t,t.selection);a==null||a.removeAllRanges(),a==null||a.addRange(s)}t.selection||(ee.select(t,w.start(t,[])),t.onChange()),bn.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=gm.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{editable:i=!1}=r,a=re.toDOMNode(t,t),s;try{s=Ot(n)?n:n.parentElement}catch(o){if(o instanceof Error&&!o.message.includes('Permission denied to access property "nodeType"'))throw o}return s?s.closest("[data-slate-editor]")===a&&(!i||s.isContentEditable?!0:typeof s.isContentEditable=="boolean"&&s.closest('[contenteditable="false"]')===a||!!s.getAttribute("data-slate-zero-width")):!1},hasEditableTarget:(e,t)=>xn(t)&&re.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return w.hasPath(e,n.path)&&w.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>re.hasEditableTarget(e,t)||re.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>xn(t)&&re.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!Bn.get(e),isFocused:e=>!!bn.get(e),isReadOnly:e=>!!Js.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Js.get(e))return!1;var n=re.hasTarget(e,t)&&re.toSlateNode(e,t);return he.isElement(n)&&w.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=Ea.get(e),r=w.isEditor(t)?Li.get(e):n==null?void 0:n.get(re.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(at.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=w.node(e,t.path),r=re.toDOMNode(e,n),i;w.void(e,{at:t})&&(t={path:t.path,offset:0});for(var a="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(a)),o=0,u=0;u<s.length;u++){var l=s[u],d=l.childNodes[0];if(!(d==null||d.textContent==null)){var{length:m}=d.textContent,h=l.getAttribute("data-slate-length"),p=h==null?m:parseInt(h,10),g=o+p,f=s[u+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var b,v=f.childNodes[0];i=[v instanceof O1?v:f,(b=f.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var y=Math.min(m,Math.max(0,t.offset-o));i=[d,y];break}o=g}}if(!i)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(at.stringify(t)));return i},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,i=Q.isBackward(t),a=re.toDOMPoint(e,n),s=Q.isCollapsed(t)?a:re.toDOMPoint(e,r),o=re.getWindow(e),u=o.document.createRange(),[l,d]=i?s:a,[m,h]=i?a:s,p=Ot(l)?l:l.parentElement,g=!!p.getAttribute("data-slate-zero-width"),f=Ot(m)?m:m.parentElement,b=!!f.getAttribute("data-slate-zero-width");return u.setStart(l,g?1:d),u.setEnd(m,b?1:h),u},toSlateNode:(e,t)=>{var n=Ot(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?ei.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},toSlatePoint:(e,t,n)=>{var{exactMatch:r,suppressThrow:i}=n,[a,s]=r?t:I1(t),o=a.parentNode,u=null,l=0;if(o){var d,m,h=re.toDOMNode(e,e),p=o.closest('[data-slate-void="true"]'),g=p&&h.contains(p)?p:null,f=o.closest("[data-slate-leaf]"),b=null;if(f){if(u=f.closest('[data-slate-node="text"]'),u){var v=re.getWindow(e),y=v.document.createRange();y.setStart(u,0),y.setEnd(a,s);var C=y.cloneContents(),k=[...Array.prototype.slice.call(C.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(C.querySelectorAll("[contenteditable=false]"))];k.forEach(S=>{if(mt&&!r&&S.hasAttribute("data-slate-zero-width")&&S.textContent.length>0&&S.textContext!=="\uFEFF"){S.textContent.startsWith("\uFEFF")&&(S.textContent=S.textContent.slice(1));return}S.parentNode.removeChild(S)}),l=C.textContent.length,b=u}}else if(g){for(var D=g.querySelectorAll("[data-slate-leaf]"),_=0;_<D.length;_++){var B=D[_];if(re.hasDOMNode(e,B)){f=B;break}}f?(u=f.closest('[data-slate-node="text"]'),b=f,l=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(S=>{l-=S.textContent.length})):l=1}b&&l===b.textContent.length&&mt&&b.getAttribute("data-slate-zero-width")==="z"&&(d=b.textContent)!==null&&d!==void 0&&d.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||er&&(m=b.textContent)!==null&&m!==void 0&&m.endsWith(`
71
+ */function yl(e){return Object.prototype.toString.call(e)==="[object Object]"}function ot(e){var t,n;return yl(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(yl(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Zf=Symbol.for("immer-nothing"),xl=Symbol.for("immer-draftable"),kt=Symbol.for("immer-state"),C0=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function yt(e,...t){if(process.env.NODE_ENV!=="production"){const n=C0[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var fr=Object.getPrototypeOf;function Nn(e){return!!e&&!!e[kt]}function In(e){var t;return e?Yf(e)||Array.isArray(e)||!!e[xl]||!!((t=e.constructor)!=null&&t[xl])||xa(e)||wa(e):!1}var D0=Object.prototype.constructor.toString();function Yf(e){if(!e||typeof e!="object")return!1;const t=fr(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===D0}function ea(e,t){ya(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ya(e){const t=e[kt];return t?t.type_:Array.isArray(e)?1:xa(e)?2:wa(e)?3:0}function Ws(e,t){return ya(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Gf(e,t,n){const r=ya(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function E0(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function xa(e){return e instanceof Map}function wa(e){return e instanceof Set}function An(e){return e.copy_||e.base_}function Vs(e,t){if(xa(e))return new Map(e);if(wa(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Yf(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[kt];let i=Reflect.ownKeys(r);for(let a=0;a<i.length;a++){const s=i[a],o=r[s];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[s]})}return Object.create(fr(e),r)}else{const r=fr(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function Wo(e,t=!1){return Ca(e)||Nn(e)||!In(e)||(ya(e)>1&&(e.set=e.add=e.clear=e.delete=_0),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Wo(r,!0))),e}function _0(){yt(2)}function Ca(e){return Object.isFrozen(e)}var k0={};function Rn(e){const t=k0[e];return t||yt(0,e),t}var Yr;function Qf(){return Yr}function F0(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function wl(e,t){t&&(Rn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Hs(e){Ks(e),e.drafts_.forEach(A0),e.drafts_=null}function Ks(e){e===Yr&&(Yr=e.parent_)}function Cl(e){return Yr=F0(Yr,e)}function A0(e){const t=e[kt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Dl(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[kt].modified_&&(Hs(t),yt(4)),In(e)&&(e=ta(t,e),t.parent_||na(t,e)),t.patches_&&Rn("Patches").generateReplacementPatches_(n[kt].base_,e,t.patches_,t.inversePatches_)):e=ta(t,n,[]),Hs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Zf?e:void 0}function ta(e,t,n){if(Ca(t))return t;const r=t[kt];if(!r)return ea(t,(i,a)=>El(e,r,t,i,a,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return na(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let a=i,s=!1;r.type_===3&&(a=new Set(i),i.clear(),s=!0),ea(a,(o,u)=>El(e,r,i,o,u,n,s)),na(e,i,!1),n&&e.patches_&&Rn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function El(e,t,n,r,i,a,s){if(process.env.NODE_ENV!=="production"&&i===n&&yt(5),Nn(i)){const o=a&&t&&t.type_!==3&&!Ws(t.assigned_,r)?a.concat(r):void 0,u=ta(e,i,o);if(Gf(n,r,u),Nn(u))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(In(i)&&!Ca(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ta(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&na(e,i)}}function na(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Wo(t,n)}function T0(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Qf(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=Vo;n&&(i=[r],a=Gr);const{revoke:s,proxy:o}=Proxy.revocable(i,a);return r.draft_=o,r.revoke_=s,o}var Vo={get(e,t){if(t===kt)return e;const n=An(e);if(!Ws(n,t))return B0(e,n,t);const r=n[t];return e.finalized_||!In(r)?r:r===Qa(e.base_,t)?(Ja(e),e.copy_[t]=Ys(r,e)):r},has(e,t){return t in An(e)},ownKeys(e){return Reflect.ownKeys(An(e))},set(e,t,n){const r=Jf(An(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Qa(An(e),t),a=i==null?void 0:i[kt];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(E0(n,i)&&(n!==void 0||Ws(e.base_,t)))return!0;Ja(e),Zs(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Qa(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ja(e),Zs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=An(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){yt(11)},getPrototypeOf(e){return fr(e.base_)},setPrototypeOf(){yt(12)}},Gr={};ea(Vo,(e,t)=>{Gr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Gr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&yt(13),Gr.set.call(this,e,t,void 0)};Gr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&yt(14),Vo.set.call(this,e[0],t,n,e[0])};function Qa(e,t){const n=e[kt];return(n?An(n):e)[t]}function B0(e,t,n){var i;const r=Jf(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Jf(e,t){if(!(t in e))return;let n=fr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=fr(n)}}function Zs(e){e.modified_||(e.modified_=!0,e.parent_&&Zs(e.parent_))}function Ja(e){e.copy_||(e.copy_=Vs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var S0=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const a=n;n=t;const s=this;return function(u=a,...l){return s.produce(u,d=>n.call(this,d,...l))}}typeof n!="function"&&yt(6),r!==void 0&&typeof r!="function"&&yt(7);let i;if(In(t)){const a=Cl(this),s=Ys(t,void 0);let o=!0;try{i=n(s),o=!1}finally{o?Hs(a):Ks(a)}return wl(a,r),Dl(i,a)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Zf&&(i=void 0),this.autoFreeze_&&Wo(i,!0),r){const a=[],s=[];Rn("Patches").generateReplacementPatches_(t,i,a,s),r(a,s)}return i}else yt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,u=>t(u,...o));let r,i;return[this.produce(t,n,(s,o)=>{r=s,i=o}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){In(e)||yt(8),Nn(e)&&(e=j0(e));const t=Cl(this),n=Ys(e,void 0);return n[kt].isManual_=!0,Ks(t),n}finishDraft(e,t){const n=e&&e[kt];(!n||!n.isManual_)&&yt(9);const{scope_:r}=n;return wl(r,t),Dl(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=Rn("Patches").applyPatches_;return Nn(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Ys(e,t){const n=xa(e)?Rn("MapSet").proxyMap_(e,t):wa(e)?Rn("MapSet").proxySet_(e,t):T0(e,t);return(t?t.scope_:Qf()).drafts_.push(n),n}function j0(e){return Nn(e)||yt(10,e),Xf(e)}function Xf(e){if(!In(e)||Ca(e))return e;const t=e[kt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Vs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Vs(e,!0);return ea(n,(r,i)=>{Gf(n,r,Xf(i))}),t&&(t.finalized_=!1),n}var Ft=new S0,Ho=Ft.produce;Ft.produceWithPatches.bind(Ft);Ft.setAutoFreeze.bind(Ft);Ft.setUseStrictShallowCopy.bind(Ft);Ft.applyPatches.bind(Ft);var _l=Ft.createDraft.bind(Ft),kl=Ft.finishDraft.bind(Ft),P0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var i=L.transform(n,t,{affinity:r});e.current=i,i==null&&e.unref()}}},O0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var i=Se.transform(n,t,{affinity:r});e.current=i,i==null&&e.unref()}}},M0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var i=Q.transform(n,t,{affinity:r});e.current=i,i==null&&e.unref()}}},ra=new WeakMap,ia=new WeakMap,Rr=new WeakMap,em=new WeakMap,Fl=new WeakMap,Al=new WeakMap,Tl=new WeakMap,L={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=L.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var i=e[r],a=t[r];if(i!==a)break;n.push(i)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),i=t.slice(0,n),a=e[n],s=t[n];return L.equals(r,i)&&a>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),i=t.slice(0,n);return L.equals(r,i)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),i=t.slice(0,n),a=e[n],s=t[n];return L.equals(r,i)&&a<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return L.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&L.compare(e,t)===0},isBefore(e,t){return L.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&L.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&L.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&L.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&L.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),i=e[e.length-1],a=t[t.length-1];return i!==a&&L.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],i=0;i<=e.length;i++)r.push(e.slice(0,i));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!L.isAncestor(t,e)&&!L.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:i="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:a}=t;(L.equals(a,r)||L.endsBefore(a,r)||L.isAncestor(a,r))&&(r[a.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(L.equals(s,r)||L.isAncestor(s,r))return null;L.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:u}=t;L.equals(o,r)||L.endsBefore(o,r)?r[o.length-1]-=1:L.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=u);break}case"split_node":{var{path:l,position:d}=t;if(L.equals(l,r)){if(i==="forward")r[r.length-1]+=1;else if(i!=="backward")return null}else L.endsBefore(l,r)?r[l.length-1]+=1:L.isAncestor(l,r)&&e[l.length]>=d&&(r[l.length-1]+=1,r[l.length]-=d);break}case"move_node":{var{path:h,newPath:m}=t;if(L.equals(h,m))return r;if(L.isAncestor(h,r)||L.equals(h,r)){var p=m.slice();return L.endsBefore(h,m)&&h.length<m.length&&(p[h.length-1]-=1),p.concat(r.slice(h.length))}else L.isSibling(h,m)&&(L.isAncestor(m,r)||L.equals(m,r))?L.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:L.endsBefore(m,r)||L.equals(m,r)||L.isAncestor(m,r)?(L.endsBefore(h,r)&&(r[h.length-1]-=1),r[m.length-1]+=1):L.endsBefore(h,r)&&(L.equals(m,r)&&(r[m.length-1]+=1),r[h.length-1]-=1);break}}return r}};function Qr(e){"@babel/helpers - typeof";return Qr=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},Qr(e)}function N0(e,t){if(Qr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Qr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function I0(e){var t=N0(e,"string");return Qr(t)==="symbol"?t:String(t)}function ht(e,t,n){return t=I0(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Br(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Bl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var R0=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:i}=n,a=le.parent(e,r),s=r[r.length-1];if(s>a.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(a.children.splice(s,0,i),t)for(var[o,u]of Q.points(t))t[u]=Se.transform(o,n);break}case"insert_text":{var{path:l,offset:d,text:h}=n;if(h.length===0)break;var m=le.leaf(e,l),p=m.text.slice(0,d),g=m.text.slice(d);if(m.text=p+h+g,t)for(var[f,b]of Q.points(t))t[b]=Se.transform(f,n);break}case"merge_node":{var{path:v}=n,y=le.get(e,v),C=L.previous(v),k=le.get(e,C),D=le.parent(e,v),_=v[v.length-1];if(ge.isText(y)&&ge.isText(k))k.text+=y.text;else if(!ge.isText(y)&&!ge.isText(k))k.children.push(...y.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(at.stringify(y)," ").concat(at.stringify(k)));if(D.children.splice(_,1),t)for(var[B,M]of Q.points(t))t[M]=Se.transform(B,n);break}case"move_node":{var{path:P,newPath:z}=n;if(L.isAncestor(P,z))throw new Error("Cannot move a path [".concat(P,"] to new path [").concat(z,"] because the destination is inside itself."));var O=le.get(e,P),A=le.parent(e,P),F=P[P.length-1];A.children.splice(F,1);var S=L.transform(P,n),I=le.get(e,L.parent(S)),H=S[S.length-1];if(I.children.splice(H,0,O),t)for(var[V,ae]of Q.points(t))t[ae]=Se.transform(V,n);break}case"remove_node":{var{path:ne}=n,E=ne[ne.length-1],Y=le.parent(e,ne);if(Y.children.splice(E,1),t)for(var[q,T]of Q.points(t)){var j=Se.transform(q,n);if(t!=null&&j!=null)t[T]=j;else{var R=void 0,N=void 0;for(var[U,X]of le.texts(e))if(L.compare(X,ne)===-1)R=[U,X];else{N=[U,X];break}var W=!1;R&&N&&(L.equals(N[1],ne)?W=!L.hasPrevious(N[1]):W=L.common(R[1],ne).length<L.common(N[1],ne).length),R&&!W?(q.path=R[1],q.offset=R[0].text.length):N?(q.path=N[1],q.offset=0):t=null}}break}case"remove_text":{var{path:te,offset:de,text:J}=n;if(J.length===0)break;var ve=le.leaf(e,te),me=ve.text.slice(0,de),ye=ve.text.slice(de+J.length);if(ve.text=me+ye,t)for(var[_e,De]of Q.points(t))t[De]=Se.transform(_e,n);break}case"set_node":{var{path:ze,properties:We,newProperties:He}=n;if(ze.length===0)throw new Error("Cannot set properties on the root node!");var Ke=le.get(e,ze);for(var Be in He){if(Be==="children"||Be==="text")throw new Error('Cannot set the "'.concat(Be,'" property of nodes!'));var Me=He[Be];Me==null?delete Ke[Be]:Ke[Be]=Me}for(var Ce in We)He.hasOwnProperty(Ce)||delete Ke[Ce];break}case"set_selection":{var{newProperties:G}=n;if(G==null)t=G;else{if(t==null){if(!Q.isRange(G))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(at.stringify(G)," when there is no current selection."));t=Br({},G)}for(var se in G){var be=G[se];if(be==null){if(se==="anchor"||se==="focus")throw new Error('Cannot remove the "'.concat(se,'" selection property'));delete t[se]}else t[se]=be}}break}case"split_node":{var{path:oe,position:ce,properties:pe}=n;if(oe.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(oe,"] because the root node cannot be split."));var Fe=le.get(e,oe),qe=le.parent(e,oe),At=oe[oe.length-1],pt;if(ge.isText(Fe)){var tt=Fe.text.slice(0,ce),qt=Fe.text.slice(ce);Fe.text=tt,pt=Br(Br({},pe),{},{text:qt})}else{var Dt=Fe.children.slice(0,ce),Ta=Fe.children.slice(ce);Fe.children=Dt,pt=Br(Br({},pe),{},{children:Ta})}if(qe.children.splice(At+1,0,pt),t)for(var[Cr,li]of Q.points(t))t[li]=Se.transform(Cr,n);break}}return t},$0={transform(e,t){e.children=_l(e.children);var n=e.selection&&_l(e.selection);try{n=R0(e,n,t)}finally{e.children=kl(e.children),n?e.selection=Nn(n)?kl(n):n:e.selection=null}}},L0={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},z0={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},tm=(e,t)=>{for(var n in e){var r=e[n],i=t[n];if(ot(r)&&ot(i)){if(!tm(r,i))return!1}else if(Array.isArray(r)&&Array.isArray(i)){if(r.length!==i.length)return!1;for(var a=0;a<r.length;a++)if(r[a]!==i[a])return!1}else if(r!==i)return!1}for(var s in t)if(e[s]===void 0&&t[s]!==void 0)return!1;return!0};function q0(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function sn(e,t){if(e==null)return{};var n=q0(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var U0=["anchor","focus"];function Sl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function W0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Sl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Q={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:i}=e;return Q.isBackward(e)===n?[r,i]:[i,r]},end(e){var[,t]=Q.edges(e);return t},equals(e,t){return Se.equals(e.anchor,t.anchor)&&Se.equals(e.focus,t.focus)},includes(e,t){if(Q.isRange(t)){if(Q.includes(e,t.anchor)||Q.includes(e,t.focus))return!0;var[n,r]=Q.edges(e),[i,a]=Q.edges(t);return Se.isBefore(n,i)&&Se.isAfter(r,a)}var[s,o]=Q.edges(e),u=!1,l=!1;return Se.isPoint(t)?(u=Se.compare(t,s)>=0,l=Se.compare(t,o)<=0):(u=L.compare(t,s.path)>=0,l=L.compare(t,o.path)<=0),u&&l},intersection(e,t){var n=sn(e,U0),[r,i]=Q.edges(e),[a,s]=Q.edges(t),o=Se.isBefore(r,a)?a:r,u=Se.isBefore(i,s)?i:s;return Se.isBefore(u,o)?null:W0({anchor:o,focus:u},n)},isBackward(e){var{anchor:t,focus:n}=e;return Se.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Se.equals(t,n)},isExpanded(e){return!Q.isCollapsed(e)},isForward(e){return!Q.isBackward(e)},isRange(e){return ot(e)&&Se.isPoint(e.anchor)&&Se.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Q.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ho(e,r=>{if(r===null)return null;var{affinity:i="inward"}=n,a,s;if(i==="inward"){var o=Q.isCollapsed(r);Q.isForward(r)?(a="forward",s=o?a:"backward"):(a="backward",s=o?a:"forward")}else i==="outward"?Q.isForward(r)?(a="backward",s="forward"):(a="forward",s="backward"):(a=i,s=i);var u=Se.transform(r.anchor,t,{affinity:a}),l=Se.transform(r.focus,t,{affinity:s});if(!u||!l)return null;r.anchor=u,r.focus=l})}},jl=e=>ot(e)&&le.isNodeList(e.children)&&!w.isEditor(e),he={isAncestor(e){return ot(e)&&le.isNodeList(e.children)},isElement:jl,isElementList(e){return Array.isArray(e)&&e.every(t=>he.isElement(t))},isElementProps(e){return e.children!==void 0},isElementType:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"type";return jl(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},V0=["children"],H0=["text"],Pl=new WeakMap,le={ancestor(e,t){var n=le.get(e,t);if(ge.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(at.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of L.ancestors(t,n)){var i=le.ancestor(e,r),a=[i,r];yield a}}()},child(e,t){if(ge.isText(e))throw new Error("Cannot get the child of a text node: ".concat(at.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(at.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,i=le.ancestor(e,t),{children:a}=i,s=r?a.length-1:0;r?s>=0:s<a.length;){var o=le.child(i,s),u=t.concat(s);yield[o,u],s=r?s-1:s+1}}()},common(e,t,n){var r=L.common(t,n),i=le.get(e,r);return[i,r]},descendant(e,t){var n=le.get(e,t);if(w.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(at.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of le.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of le.nodes(e,t))he.isElement(n)&&(yield[n,r])}()},extractProps(e){if(he.isAncestor(e)){var t=sn(e,V0);return t}else{var t=sn(e,H0);return t}},first(e,t){for(var n=t.slice(),r=le.get(e,n);r&&!(ge.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(ge.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(at.stringify(e)));var n=Ho({children:e.children},r=>{var[i,a]=Q.edges(t),s=le.nodes(r,{reverse:!0,pass:m=>{var[,p]=m;return!Q.includes(t,p)}});for(var[,o]of s){if(!Q.includes(t,o)){var u=le.parent(r,o),l=o[o.length-1];u.children.splice(l,1)}if(L.equals(o,a.path)){var d=le.leaf(r,o);d.text=d.text.slice(0,a.offset)}if(L.equals(o,i.path)){var h=le.leaf(r,o);h.text=h.text.slice(i.offset)}}w.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var i=t[r];if(ge.isText(n)||!n.children[i])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(at.stringify(e)));n=n.children[i]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var i=t[r];if(ge.isText(n)||!n.children[i])return!1;n=n.children[i]}return!0},isNode(e){return ge.isText(e)||he.isElement(e)||w.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=Pl.get(e);if(t!==void 0)return t;var n=e.every(r=>le.isNode(r));return Pl.set(e,n),n},last(e,t){for(var n=t.slice(),r=le.get(e,n);r&&!(ge.isText(r)||r.children.length===0);){var i=r.children.length-1;r=r.children[i],n.push(i)}return[r,n]},leaf(e,t){var n=le.get(e,t);if(!ge.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(at.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of L.levels(t,n)){var i=le.get(e,r);yield[i,r]}}()},matches(e,t){return he.isElement(e)&&he.isElementProps(t)&&he.matches(e,t)||ge.isText(e)&&ge.isTextProps(t)&&ge.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:i=[],to:a}=t,s=new Set,o=[],u=e;!(a&&(r?L.isBefore(o,a):L.isAfter(o,a)));){if(s.has(u)||(yield[u,o]),!s.has(u)&&!ge.isText(u)&&u.children.length!==0&&(n==null||n([u,o])===!1)){s.add(u);var l=r?u.children.length-1:0;L.isAncestor(o,i)&&(l=i[o.length]),o=o.concat(l),u=le.get(e,o);continue}if(o.length===0)break;if(!r){var d=L.next(o);if(le.has(e,d)){o=d,u=le.get(e,o);continue}}if(r&&o[o.length-1]!==0){var h=L.previous(o);o=h,u=le.get(e,o);continue}o=L.parent(o),u=le.get(e,o),s.add(u)}}()},parent(e,t){var n=L.parent(t),r=le.get(e,n);if(ge.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string(e){return ge.isText(e)?e.text:e.children.map(le.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of le.nodes(e,t))ge.isText(n)&&(yield[n,r])}()}};function Ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ye(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ol(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ol(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var vn={isNodeOperation(e){return vn.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!ot(e))return!1;switch(e.type){case"insert_node":return L.isPath(e.path)&&le.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&L.isPath(e.path);case"merge_node":return typeof e.position=="number"&&L.isPath(e.path)&&ot(e.properties);case"move_node":return L.isPath(e.path)&&L.isPath(e.newPath);case"remove_node":return L.isPath(e.path)&&le.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&L.isPath(e.path);case"set_node":return L.isPath(e.path)&&ot(e.properties)&&ot(e.newProperties);case"set_selection":return e.properties===null&&Q.isRange(e.newProperties)||e.newProperties===null&&Q.isRange(e.properties)||ot(e.properties)&&ot(e.newProperties);case"split_node":return L.isPath(e.path)&&typeof e.position=="number"&&ot(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>vn.isOperation(t))},isSelectionOperation(e){return vn.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return vn.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Ye(Ye({},e),{},{type:"remove_node"});case"insert_text":return Ye(Ye({},e),{},{type:"remove_text"});case"merge_node":return Ye(Ye({},e),{},{type:"split_node",path:L.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(L.equals(t,n))return e;if(L.isSibling(n,t))return Ye(Ye({},e),{},{path:t,newPath:n});var r=L.transform(n,e),i=L.transform(L.next(n),e);return Ye(Ye({},e),{},{path:r,newPath:i})}case"remove_node":return Ye(Ye({},e),{},{type:"insert_node"});case"remove_text":return Ye(Ye({},e),{},{type:"insert_text"});case"set_node":{var{properties:a,newProperties:s}=e;return Ye(Ye({},e),{},{properties:s,newProperties:a})}case"set_selection":{var{properties:o,newProperties:u}=e;return o==null?Ye(Ye({},e),{},{properties:u,newProperties:null}):u==null?Ye(Ye({},e),{},{properties:null,newProperties:o}):Ye(Ye({},e),{},{properties:u,newProperties:o})}case"split_node":return Ye(Ye({},e),{},{type:"merge_node",path:L.next(e.path)})}}},Ml=new WeakMap,K0=e=>{var t=Ml.get(e);if(t!==void 0)return t;if(!ot(e))return!1;var n=typeof e.addMark=="function"&&typeof e.apply=="function"&&typeof e.deleteFragment=="function"&&typeof e.insertBreak=="function"&&typeof e.insertSoftBreak=="function"&&typeof e.insertFragment=="function"&&typeof e.insertNode=="function"&&typeof e.insertText=="function"&&typeof e.isElementReadOnly=="function"&&typeof e.isInline=="function"&&typeof e.isSelectable=="function"&&typeof e.isVoid=="function"&&typeof e.normalizeNode=="function"&&typeof e.onChange=="function"&&typeof e.removeMark=="function"&&typeof e.getDirtyPaths=="function"&&(e.marks===null||ot(e.marks))&&(e.selection===null||Q.isRange(e.selection))&&le.isNodeList(e.children)&&vn.isOperationList(e.operations);return Ml.set(e,n),n},w={above(e,t){return e.above(t)},addMark(e,t,n){e.addMark(t,n)},after(e,t,n){return e.after(t,n)},before(e,t,n){return e.before(t,n)},deleteBackward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges(e,t){return e.edges(t)},elementReadOnly(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.elementReadOnly(t)},end(e,t){return e.end(t)},first(e,t){return e.first(t)},fragment(e,t){return e.fragment(t)},hasBlocks(e,t){return e.hasBlocks(t)},hasInlines(e,t){return e.hasInlines(t)},hasPath(e,t){return e.hasPath(t)},hasTexts(e,t){return e.hasTexts(t)},insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock(e,t){return e.isBlock(t)},isEdge(e,t,n){return e.isEdge(t,n)},isEditor(e){return K0(e)},isElementReadOnly(e,t){return e.isElementReadOnly(t)},isEmpty(e,t){return e.isEmpty(t)},isEnd(e,t,n){return e.isEnd(t,n)},isInline(e,t){return e.isInline(t)},isNormalizing(e){return e.isNormalizing()},isSelectable(e,t){return e.isSelectable(t)},isStart(e,t,n){return e.isStart(t,n)},isVoid(e,t){return e.isVoid(t)},last(e,t){return e.last(t)},leaf(e,t,n){return e.leaf(t,n)},levels(e,t){return e.levels(t)},marks(e){return e.getMarks()},next(e,t){return e.next(t)},node(e,t,n){return e.node(t,n)},nodes(e,t){return e.nodes(t)},normalize(e,t){e.normalize(t)},parent(e,t,n){return e.parent(t,n)},path(e,t,n){return e.path(t,n)},pathRef(e,t,n){return e.pathRef(t,n)},pathRefs(e){return e.pathRefs()},point(e,t,n){return e.point(t,n)},pointRef(e,t,n){return e.pointRef(t,n)},pointRefs(e){return e.pointRefs()},positions(e,t){return e.positions(t)},previous(e,t){return e.previous(t)},range(e,t,n){return e.range(t,n)},rangeRef(e,t,n){return e.rangeRef(t,n)},rangeRefs(e){return e.rangeRefs()},removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start(e,t){return e.start(t)},string(e,t,n){return e.string(t,n)},unhangRange(e,t,n){return e.unhangRange(t,n)},void(e,t){return e.void(t)},withoutNormalizing(e,t){e.withoutNormalizing(t)}},Z0={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(L.isPath)}};function Nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Il(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Se={compare(e,t){var n=L.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return Se.compare(e,t)===1},isBefore(e,t){return Se.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&L.equals(e.path,t.path)},isPoint(e){return ot(e)&&typeof e.offset=="number"&&L.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ho(e,r=>{if(r===null)return null;var{affinity:i="forward"}=n,{path:a,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=L.transform(a,t,n);break}case"insert_text":{L.equals(t.path,a)&&(t.offset<s||t.offset===s&&i==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{L.equals(t.path,a)&&(r.offset+=t.position),r.path=L.transform(a,t,n);break}case"remove_text":{L.equals(t.path,a)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(L.equals(t.path,a)||L.isAncestor(t.path,a))return null;r.path=L.transform(a,t,n);break}case"split_node":{if(L.equals(t.path,a)){if(t.position===s&&i==null)return null;(t.position<s||t.position===s&&i==="forward")&&(r.offset-=t.position,r.path=L.transform(a,t,Il(Il({},n),{},{affinity:"forward"})))}else r.path=L.transform(a,t,n);break}}})}},Rl=void 0,at={setScrubber(e){Rl=e},stringify(e){return JSON.stringify(e,Rl)}},Y0=["text"],G0=["anchor","focus"];function $l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$l(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$l(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ge={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function i(a){var s=sn(a,Y0);return s}return tm(r?i(e):e,r?i(t):t)},isText(e){return ot(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>ge.isText(t))},isTextProps(e){return e.text!==void 0},matches(e,t){for(var n in t)if(n!=="text"&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[tn({},e)];for(var r of t){var i=sn(r,G0),[a,s]=Q.edges(r),o=[],u=0,l=a.offset,d=s.offset;for(var h of n){var{length:m}=h.text,p=u;if(u+=m,l<=p&&u<=d){Object.assign(h,i),o.push(h);continue}if(l!==d&&(l===u||d===p)||l>u||d<p||d===p&&p!==0){o.push(h);continue}var g=h,f=void 0,b=void 0;if(d<u){var v=d-p;b=tn(tn({},g),{},{text:g.text.slice(v)}),g=tn(tn({},g),{},{text:g.text.slice(0,v)})}if(l>p){var y=l-p;f=tn(tn({},g),{},{text:g.text.slice(0,y)}),g=tn(tn({},g),{},{text:g.text.slice(y)})}Object.assign(g,i),f&&o.push(f),o.push(g),b&&o.push(b)}n=o}return n}},Ko=e=>e.selection?e.selection:e.children.length>0?w.end(e,[]):[0],wr=(e,t)=>{var[n]=w.node(e,t);return r=>r===n},Zo=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,i=n?ny(t):t,a=Ae.None,s=Ae.None,o=0,u=null,l=null;for(var d of i){var h=d.codePointAt(0);if(!h)break;var m=hy(d,h);if([a,s]=r?[s,m]:[m,a],Xn(a,Ae.ZWJ)&&Xn(s,Ae.ExtPict)&&(r?u=Ll(t.substring(0,o)):u=Ll(t.substring(0,t.length-o)),!u)||Xn(a,Ae.RI)&&Xn(s,Ae.RI)&&(l!==null?l=!l:r?l=!0:l=yy(t.substring(0,t.length-o)),!l)||a!==Ae.None&&s!==Ae.None&&gy(a,s))break;o+=d.length}return o||1},Q0=/\s/,J0=/[\u002B\u0021-\u0023\u0025-\u002A\u002C-\u002F\u003A\u003B\u003F\u0040\u005B-\u005D\u005F\u007B\u007D\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E3B\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/,X0=/['\u2018\u2019]/,ey=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,i=!1;t.length>0;){var a=Zo(t,n),[s,o]=Yo(t,a,n);if(ty(s,o,n))i=!0,r+=a;else if(!i)r+=a;else break;t=o}return r},Yo=(e,t,n)=>{if(n){var r=e.length-t;return[e.slice(r,e.length),e.slice(0,r)]}return[e.slice(0,t),e.slice(t)]},ty=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(Q0.test(t))return!1;if(X0.test(t)){var i=Zo(n,r),[a,s]=Yo(n,i,r);if(e(a,s,r))return!0}return!J0.test(t)},ny=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var i=t.charAt(n-r);if(iy(i.charCodeAt(0))){var a=t.charAt(n-r-1);if(ry(a.charCodeAt(0))){yield a+i,r++;continue}}yield i}},ry=e=>e>=55296&&e<=56319,iy=e=>e>=56320&&e<=57343,Ae;(function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"})(Ae||(Ae={}));var ay=/^(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC01\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDE41\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4\uDF00\uDF01\uDF36-\uDF3A\uDF40\uDF42]|\uD80D[\uDC40\uDC47-\uDC55]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])$/,sy=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,oy=/^(?:[\u0903\u093B\u093E-\u0940\u0949-\u094C\u094E\u094F\u0982\u0983\u09BF\u09C0\u09C7\u09C8\u09CB\u09CC\u0A03\u0A3E-\u0A40\u0A83\u0ABE-\u0AC0\u0AC9\u0ACB\u0ACC\u0B02\u0B03\u0B40\u0B47\u0B48\u0B4B\u0B4C\u0BBF\u0BC1\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0C01-\u0C03\u0C41-\u0C44\u0C82\u0C83\u0CBE\u0CC0\u0CC1\u0CC3\u0CC4\u0CC7\u0CC8\u0CCA\u0CCB\u0D02\u0D03\u0D3F\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D82\u0D83\u0DD0\u0DD1\u0DD8-\u0DDE\u0DF2\u0DF3\u0E33\u0EB3\u0F3E\u0F3F\u0F7F\u1031\u103B\u103C\u1056\u1057\u1084\u1715\u1734\u17B6\u17BE-\u17C5\u17C7\u17C8\u1923-\u1926\u1929-\u192B\u1930\u1931\u1933-\u1938\u1A19\u1A1A\u1A55\u1A57\u1A6D-\u1A72\u1B04\u1B3B\u1B3D-\u1B41\u1B43\u1B44\u1B82\u1BA1\u1BA6\u1BA7\u1BAA\u1BE7\u1BEA-\u1BEC\u1BEE\u1BF2\u1BF3\u1C24-\u1C2B\u1C34\u1C35\u1CE1\u1CF7\uA823\uA824\uA827\uA880\uA881\uA8B4-\uA8C3\uA952\uA953\uA983\uA9B4\uA9B5\uA9BA\uA9BB\uA9BE-\uA9C0\uAA2F\uAA30\uAA33\uAA34\uAA4D\uAAEB\uAAEE\uAAEF\uAAF5\uABE3\uABE4\uABE6\uABE7\uABE9\uABEA\uABEC]|\uD804[\uDC00\uDC02\uDC82\uDCB0-\uDCB2\uDCB7\uDCB8\uDD2C\uDD45\uDD46\uDD82\uDDB3-\uDDB5\uDDBF\uDDC0\uDDCE\uDE2C-\uDE2E\uDE32\uDE33\uDE35\uDEE0-\uDEE2\uDF02\uDF03\uDF3F\uDF41-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF62\uDF63]|\uD805[\uDC35-\uDC37\uDC40\uDC41\uDC45\uDCB1\uDCB2\uDCB9\uDCBB\uDCBC\uDCBE\uDCC1\uDDB0\uDDB1\uDDB8-\uDDBB\uDDBE\uDE30-\uDE32\uDE3B\uDE3C\uDE3E\uDEAC\uDEAE\uDEAF\uDEB6\uDF26]|\uD806[\uDC2C-\uDC2E\uDC38\uDD31-\uDD35\uDD37\uDD38\uDD3D\uDD40\uDD42\uDDD1-\uDDD3\uDDDC-\uDDDF\uDDE4\uDE39\uDE57\uDE58\uDE97]|\uD807[\uDC2F\uDC3E\uDCA9\uDCB1\uDCB4\uDD8A-\uDD8E\uDD93\uDD94\uDD96\uDEF5\uDEF6]|\uD81B[\uDF51-\uDF87\uDFF0\uDFF1]|\uD834[\uDD66\uDD6D])$/,uy=/^[\u1100-\u115F\uA960-\uA97C]$/,ly=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,cy=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,dy=/^[\uAC00\uAC1C\uAC38\uAC54\uAC70\uAC8C\uACA8\uACC4\uACE0\uACFC\uAD18\uAD34\uAD50\uAD6C\uAD88\uADA4\uADC0\uADDC\uADF8\uAE14\uAE30\uAE4C\uAE68\uAE84\uAEA0\uAEBC\uAED8\uAEF4\uAF10\uAF2C\uAF48\uAF64\uAF80\uAF9C\uAFB8\uAFD4\uAFF0\uB00C\uB028\uB044\uB060\uB07C\uB098\uB0B4\uB0D0\uB0EC\uB108\uB124\uB140\uB15C\uB178\uB194\uB1B0\uB1CC\uB1E8\uB204\uB220\uB23C\uB258\uB274\uB290\uB2AC\uB2C8\uB2E4\uB300\uB31C\uB338\uB354\uB370\uB38C\uB3A8\uB3C4\uB3E0\uB3FC\uB418\uB434\uB450\uB46C\uB488\uB4A4\uB4C0\uB4DC\uB4F8\uB514\uB530\uB54C\uB568\uB584\uB5A0\uB5BC\uB5D8\uB5F4\uB610\uB62C\uB648\uB664\uB680\uB69C\uB6B8\uB6D4\uB6F0\uB70C\uB728\uB744\uB760\uB77C\uB798\uB7B4\uB7D0\uB7EC\uB808\uB824\uB840\uB85C\uB878\uB894\uB8B0\uB8CC\uB8E8\uB904\uB920\uB93C\uB958\uB974\uB990\uB9AC\uB9C8\uB9E4\uBA00\uBA1C\uBA38\uBA54\uBA70\uBA8C\uBAA8\uBAC4\uBAE0\uBAFC\uBB18\uBB34\uBB50\uBB6C\uBB88\uBBA4\uBBC0\uBBDC\uBBF8\uBC14\uBC30\uBC4C\uBC68\uBC84\uBCA0\uBCBC\uBCD8\uBCF4\uBD10\uBD2C\uBD48\uBD64\uBD80\uBD9C\uBDB8\uBDD4\uBDF0\uBE0C\uBE28\uBE44\uBE60\uBE7C\uBE98\uBEB4\uBED0\uBEEC\uBF08\uBF24\uBF40\uBF5C\uBF78\uBF94\uBFB0\uBFCC\uBFE8\uC004\uC020\uC03C\uC058\uC074\uC090\uC0AC\uC0C8\uC0E4\uC100\uC11C\uC138\uC154\uC170\uC18C\uC1A8\uC1C4\uC1E0\uC1FC\uC218\uC234\uC250\uC26C\uC288\uC2A4\uC2C0\uC2DC\uC2F8\uC314\uC330\uC34C\uC368\uC384\uC3A0\uC3BC\uC3D8\uC3F4\uC410\uC42C\uC448\uC464\uC480\uC49C\uC4B8\uC4D4\uC4F0\uC50C\uC528\uC544\uC560\uC57C\uC598\uC5B4\uC5D0\uC5EC\uC608\uC624\uC640\uC65C\uC678\uC694\uC6B0\uC6CC\uC6E8\uC704\uC720\uC73C\uC758\uC774\uC790\uC7AC\uC7C8\uC7E4\uC800\uC81C\uC838\uC854\uC870\uC88C\uC8A8\uC8C4\uC8E0\uC8FC\uC918\uC934\uC950\uC96C\uC988\uC9A4\uC9C0\uC9DC\uC9F8\uCA14\uCA30\uCA4C\uCA68\uCA84\uCAA0\uCABC\uCAD8\uCAF4\uCB10\uCB2C\uCB48\uCB64\uCB80\uCB9C\uCBB8\uCBD4\uCBF0\uCC0C\uCC28\uCC44\uCC60\uCC7C\uCC98\uCCB4\uCCD0\uCCEC\uCD08\uCD24\uCD40\uCD5C\uCD78\uCD94\uCDB0\uCDCC\uCDE8\uCE04\uCE20\uCE3C\uCE58\uCE74\uCE90\uCEAC\uCEC8\uCEE4\uCF00\uCF1C\uCF38\uCF54\uCF70\uCF8C\uCFA8\uCFC4\uCFE0\uCFFC\uD018\uD034\uD050\uD06C\uD088\uD0A4\uD0C0\uD0DC\uD0F8\uD114\uD130\uD14C\uD168\uD184\uD1A0\uD1BC\uD1D8\uD1F4\uD210\uD22C\uD248\uD264\uD280\uD29C\uD2B8\uD2D4\uD2F0\uD30C\uD328\uD344\uD360\uD37C\uD398\uD3B4\uD3D0\uD3EC\uD408\uD424\uD440\uD45C\uD478\uD494\uD4B0\uD4CC\uD4E8\uD504\uD520\uD53C\uD558\uD574\uD590\uD5AC\uD5C8\uD5E4\uD600\uD61C\uD638\uD654\uD670\uD68C\uD6A8\uD6C4\uD6E0\uD6FC\uD718\uD734\uD750\uD76C\uD788]$/,fy=/^[\uAC01-\uAC1B\uAC1D-\uAC37\uAC39-\uAC53\uAC55-\uAC6F\uAC71-\uAC8B\uAC8D-\uACA7\uACA9-\uACC3\uACC5-\uACDF\uACE1-\uACFB\uACFD-\uAD17\uAD19-\uAD33\uAD35-\uAD4F\uAD51-\uAD6B\uAD6D-\uAD87\uAD89-\uADA3\uADA5-\uADBF\uADC1-\uADDB\uADDD-\uADF7\uADF9-\uAE13\uAE15-\uAE2F\uAE31-\uAE4B\uAE4D-\uAE67\uAE69-\uAE83\uAE85-\uAE9F\uAEA1-\uAEBB\uAEBD-\uAED7\uAED9-\uAEF3\uAEF5-\uAF0F\uAF11-\uAF2B\uAF2D-\uAF47\uAF49-\uAF63\uAF65-\uAF7F\uAF81-\uAF9B\uAF9D-\uAFB7\uAFB9-\uAFD3\uAFD5-\uAFEF\uAFF1-\uB00B\uB00D-\uB027\uB029-\uB043\uB045-\uB05F\uB061-\uB07B\uB07D-\uB097\uB099-\uB0B3\uB0B5-\uB0CF\uB0D1-\uB0EB\uB0ED-\uB107\uB109-\uB123\uB125-\uB13F\uB141-\uB15B\uB15D-\uB177\uB179-\uB193\uB195-\uB1AF\uB1B1-\uB1CB\uB1CD-\uB1E7\uB1E9-\uB203\uB205-\uB21F\uB221-\uB23B\uB23D-\uB257\uB259-\uB273\uB275-\uB28F\uB291-\uB2AB\uB2AD-\uB2C7\uB2C9-\uB2E3\uB2E5-\uB2FF\uB301-\uB31B\uB31D-\uB337\uB339-\uB353\uB355-\uB36F\uB371-\uB38B\uB38D-\uB3A7\uB3A9-\uB3C3\uB3C5-\uB3DF\uB3E1-\uB3FB\uB3FD-\uB417\uB419-\uB433\uB435-\uB44F\uB451-\uB46B\uB46D-\uB487\uB489-\uB4A3\uB4A5-\uB4BF\uB4C1-\uB4DB\uB4DD-\uB4F7\uB4F9-\uB513\uB515-\uB52F\uB531-\uB54B\uB54D-\uB567\uB569-\uB583\uB585-\uB59F\uB5A1-\uB5BB\uB5BD-\uB5D7\uB5D9-\uB5F3\uB5F5-\uB60F\uB611-\uB62B\uB62D-\uB647\uB649-\uB663\uB665-\uB67F\uB681-\uB69B\uB69D-\uB6B7\uB6B9-\uB6D3\uB6D5-\uB6EF\uB6F1-\uB70B\uB70D-\uB727\uB729-\uB743\uB745-\uB75F\uB761-\uB77B\uB77D-\uB797\uB799-\uB7B3\uB7B5-\uB7CF\uB7D1-\uB7EB\uB7ED-\uB807\uB809-\uB823\uB825-\uB83F\uB841-\uB85B\uB85D-\uB877\uB879-\uB893\uB895-\uB8AF\uB8B1-\uB8CB\uB8CD-\uB8E7\uB8E9-\uB903\uB905-\uB91F\uB921-\uB93B\uB93D-\uB957\uB959-\uB973\uB975-\uB98F\uB991-\uB9AB\uB9AD-\uB9C7\uB9C9-\uB9E3\uB9E5-\uB9FF\uBA01-\uBA1B\uBA1D-\uBA37\uBA39-\uBA53\uBA55-\uBA6F\uBA71-\uBA8B\uBA8D-\uBAA7\uBAA9-\uBAC3\uBAC5-\uBADF\uBAE1-\uBAFB\uBAFD-\uBB17\uBB19-\uBB33\uBB35-\uBB4F\uBB51-\uBB6B\uBB6D-\uBB87\uBB89-\uBBA3\uBBA5-\uBBBF\uBBC1-\uBBDB\uBBDD-\uBBF7\uBBF9-\uBC13\uBC15-\uBC2F\uBC31-\uBC4B\uBC4D-\uBC67\uBC69-\uBC83\uBC85-\uBC9F\uBCA1-\uBCBB\uBCBD-\uBCD7\uBCD9-\uBCF3\uBCF5-\uBD0F\uBD11-\uBD2B\uBD2D-\uBD47\uBD49-\uBD63\uBD65-\uBD7F\uBD81-\uBD9B\uBD9D-\uBDB7\uBDB9-\uBDD3\uBDD5-\uBDEF\uBDF1-\uBE0B\uBE0D-\uBE27\uBE29-\uBE43\uBE45-\uBE5F\uBE61-\uBE7B\uBE7D-\uBE97\uBE99-\uBEB3\uBEB5-\uBECF\uBED1-\uBEEB\uBEED-\uBF07\uBF09-\uBF23\uBF25-\uBF3F\uBF41-\uBF5B\uBF5D-\uBF77\uBF79-\uBF93\uBF95-\uBFAF\uBFB1-\uBFCB\uBFCD-\uBFE7\uBFE9-\uC003\uC005-\uC01F\uC021-\uC03B\uC03D-\uC057\uC059-\uC073\uC075-\uC08F\uC091-\uC0AB\uC0AD-\uC0C7\uC0C9-\uC0E3\uC0E5-\uC0FF\uC101-\uC11B\uC11D-\uC137\uC139-\uC153\uC155-\uC16F\uC171-\uC18B\uC18D-\uC1A7\uC1A9-\uC1C3\uC1C5-\uC1DF\uC1E1-\uC1FB\uC1FD-\uC217\uC219-\uC233\uC235-\uC24F\uC251-\uC26B\uC26D-\uC287\uC289-\uC2A3\uC2A5-\uC2BF\uC2C1-\uC2DB\uC2DD-\uC2F7\uC2F9-\uC313\uC315-\uC32F\uC331-\uC34B\uC34D-\uC367\uC369-\uC383\uC385-\uC39F\uC3A1-\uC3BB\uC3BD-\uC3D7\uC3D9-\uC3F3\uC3F5-\uC40F\uC411-\uC42B\uC42D-\uC447\uC449-\uC463\uC465-\uC47F\uC481-\uC49B\uC49D-\uC4B7\uC4B9-\uC4D3\uC4D5-\uC4EF\uC4F1-\uC50B\uC50D-\uC527\uC529-\uC543\uC545-\uC55F\uC561-\uC57B\uC57D-\uC597\uC599-\uC5B3\uC5B5-\uC5CF\uC5D1-\uC5EB\uC5ED-\uC607\uC609-\uC623\uC625-\uC63F\uC641-\uC65B\uC65D-\uC677\uC679-\uC693\uC695-\uC6AF\uC6B1-\uC6CB\uC6CD-\uC6E7\uC6E9-\uC703\uC705-\uC71F\uC721-\uC73B\uC73D-\uC757\uC759-\uC773\uC775-\uC78F\uC791-\uC7AB\uC7AD-\uC7C7\uC7C9-\uC7E3\uC7E5-\uC7FF\uC801-\uC81B\uC81D-\uC837\uC839-\uC853\uC855-\uC86F\uC871-\uC88B\uC88D-\uC8A7\uC8A9-\uC8C3\uC8C5-\uC8DF\uC8E1-\uC8FB\uC8FD-\uC917\uC919-\uC933\uC935-\uC94F\uC951-\uC96B\uC96D-\uC987\uC989-\uC9A3\uC9A5-\uC9BF\uC9C1-\uC9DB\uC9DD-\uC9F7\uC9F9-\uCA13\uCA15-\uCA2F\uCA31-\uCA4B\uCA4D-\uCA67\uCA69-\uCA83\uCA85-\uCA9F\uCAA1-\uCABB\uCABD-\uCAD7\uCAD9-\uCAF3\uCAF5-\uCB0F\uCB11-\uCB2B\uCB2D-\uCB47\uCB49-\uCB63\uCB65-\uCB7F\uCB81-\uCB9B\uCB9D-\uCBB7\uCBB9-\uCBD3\uCBD5-\uCBEF\uCBF1-\uCC0B\uCC0D-\uCC27\uCC29-\uCC43\uCC45-\uCC5F\uCC61-\uCC7B\uCC7D-\uCC97\uCC99-\uCCB3\uCCB5-\uCCCF\uCCD1-\uCCEB\uCCED-\uCD07\uCD09-\uCD23\uCD25-\uCD3F\uCD41-\uCD5B\uCD5D-\uCD77\uCD79-\uCD93\uCD95-\uCDAF\uCDB1-\uCDCB\uCDCD-\uCDE7\uCDE9-\uCE03\uCE05-\uCE1F\uCE21-\uCE3B\uCE3D-\uCE57\uCE59-\uCE73\uCE75-\uCE8F\uCE91-\uCEAB\uCEAD-\uCEC7\uCEC9-\uCEE3\uCEE5-\uCEFF\uCF01-\uCF1B\uCF1D-\uCF37\uCF39-\uCF53\uCF55-\uCF6F\uCF71-\uCF8B\uCF8D-\uCFA7\uCFA9-\uCFC3\uCFC5-\uCFDF\uCFE1-\uCFFB\uCFFD-\uD017\uD019-\uD033\uD035-\uD04F\uD051-\uD06B\uD06D-\uD087\uD089-\uD0A3\uD0A5-\uD0BF\uD0C1-\uD0DB\uD0DD-\uD0F7\uD0F9-\uD113\uD115-\uD12F\uD131-\uD14B\uD14D-\uD167\uD169-\uD183\uD185-\uD19F\uD1A1-\uD1BB\uD1BD-\uD1D7\uD1D9-\uD1F3\uD1F5-\uD20F\uD211-\uD22B\uD22D-\uD247\uD249-\uD263\uD265-\uD27F\uD281-\uD29B\uD29D-\uD2B7\uD2B9-\uD2D3\uD2D5-\uD2EF\uD2F1-\uD30B\uD30D-\uD327\uD329-\uD343\uD345-\uD35F\uD361-\uD37B\uD37D-\uD397\uD399-\uD3B3\uD3B5-\uD3CF\uD3D1-\uD3EB\uD3ED-\uD407\uD409-\uD423\uD425-\uD43F\uD441-\uD45B\uD45D-\uD477\uD479-\uD493\uD495-\uD4AF\uD4B1-\uD4CB\uD4CD-\uD4E7\uD4E9-\uD503\uD505-\uD51F\uD521-\uD53B\uD53D-\uD557\uD559-\uD573\uD575-\uD58F\uD591-\uD5AB\uD5AD-\uD5C7\uD5C9-\uD5E3\uD5E5-\uD5FF\uD601-\uD61B\uD61D-\uD637\uD639-\uD653\uD655-\uD66F\uD671-\uD68B\uD68D-\uD6A7\uD6A9-\uD6C3\uD6C5-\uD6DF\uD6E1-\uD6FB\uD6FD-\uD717\uD719-\uD733\uD735-\uD74F\uD751-\uD76B\uD76D-\uD787\uD789-\uD7A3]$/,my=/^(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])$/,hy=(e,t)=>{var n=Ae.Any;return e.search(ay)!==-1&&(n|=Ae.Extend),t===8205&&(n|=Ae.ZWJ),t>=127462&&t<=127487&&(n|=Ae.RI),e.search(sy)!==-1&&(n|=Ae.Prepend),e.search(oy)!==-1&&(n|=Ae.SpacingMark),e.search(uy)!==-1&&(n|=Ae.L),e.search(ly)!==-1&&(n|=Ae.V),e.search(cy)!==-1&&(n|=Ae.T),e.search(dy)!==-1&&(n|=Ae.LV),e.search(fy)!==-1&&(n|=Ae.LVT),e.search(my)!==-1&&(n|=Ae.ExtPict),n};function Xn(e,t){return(e&t)!==0}var py=[[Ae.L,Ae.L|Ae.V|Ae.LV|Ae.LVT],[Ae.LV|Ae.V,Ae.V|Ae.T],[Ae.LVT|Ae.T,Ae.T],[Ae.Any,Ae.Extend|Ae.ZWJ],[Ae.Any,Ae.SpacingMark],[Ae.Prepend,Ae.Any],[Ae.ZWJ,Ae.ExtPict],[Ae.RI,Ae.RI]];function gy(e,t){return py.findIndex(n=>Xn(e,n[0])&&Xn(t,n[1]))===-1}var vy=/(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC01\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDE41\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4\uDF00\uDF01\uDF36-\uDF3A\uDF40\uDF42]|\uD80D[\uDC40\uDC47-\uDC55]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])*\u200D$/,Ll=e=>e.search(vy)!==-1,by=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,yy=e=>{var t=e.match(by);if(t===null)return!1;var n=t[0].length/2;return n%2===1},xy={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};w.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:i=Ko(e)}=n;if(L.isPath(i)&&(i=w.range(e,i)),Q.isRange(i))if(Q.isCollapsed(i))i=i.anchor;else{var a=Q.end(i);if(!r&&w.void(e,{at:a}))return;var s=Q.start(i),o=w.pointRef(e,s),u=w.pointRef(e,a);ee.delete(e,{at:i,voids:r});var l=o.unref(),d=u.unref();i=l||d,ee.setSelection(e,{anchor:i,focus:i})}if(!(!r&&w.void(e,{at:i})||w.elementReadOnly(e,{at:i}))){var{path:h,offset:m}=i;t.length>0&&e.apply({type:"insert_text",path:h,offset:m,text:t})}})}};function zl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function wi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ee=wi(wi(wi(wi({},$0),L0),z0),xy),Ii=new WeakMap,wy=e=>Ii.get(e)||!1,Cy=(e,t,n)=>{var r=Ii.get(e)||!1;Ii.set(e,!0);try{t(),n()}finally{Ii.set(e,r)}};function nm(e,t,n){var r=ra.get(e)||[],i=ia.get(e)||new Set,a,s,o=h=>{if(h){var m=h.join(",");s.has(m)||(s.add(m),a.push(h))}};if(n){a=[],s=new Set;for(var u of r){var l=n(u);o(l)}}else a=r,s=i;for(var d of t)o(d);ra.set(e,a),ia.set(e,s)}var Dy=(e,t)=>{for(var n of w.pathRefs(e))P0.transform(n,t);for(var r of w.pointRefs(e))O0.transform(r,t);for(var i of w.rangeRefs(e))M0.transform(i,t);if(!wy(e)){var a=L.operationCanTransformPath(t)?s=>L.transform(s,t):void 0;nm(e,e.getDirtyPaths(t),a)}ee.transform(e,t),e.operations.push(t),w.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),Rr.get(e)||(Rr.set(e,!0),Promise.resolve().then(()=>{Rr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Ey=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return L.levels(n)}case"insert_node":{var{node:r,path:i}=t,a=L.levels(i),s=ge.isText(r)?[]:Array.from(le.nodes(r),z=>{var[,O]=z;return i.concat(O)});return[...a,...s]}case"merge_node":{var{path:o}=t,u=L.ancestors(o),l=L.previous(o);return[...u,l]}case"move_node":{var{path:d,newPath:h}=t;if(L.equals(d,h))return[];var m=[],p=[];for(var g of L.ancestors(d)){var f=L.transform(g,t);m.push(f)}for(var b of L.ancestors(h)){var v=L.transform(b,t);p.push(v)}var y=p[p.length-1],C=h[h.length-1],k=y.concat(C);return[...m,...p,k]}case"remove_node":{var{path:D}=t,_=L.ancestors(D);return[..._]}case"split_node":{var{path:B}=t,M=L.levels(B),P=L.next(B);return[...M,P]}default:return[]}},_y=e=>{var{selection:t}=e;return t?le.fragment(e,t):[]},ky=(e,t)=>{var[n,r]=t;if(!ge.isText(n)){if(he.isElement(n)&&n.children.length===0){var i={text:""};ee.insertNodes(e,i,{at:r.concat(0),voids:!0});return}for(var a=w.isEditor(n)?!1:he.isElement(n)&&(e.isInline(n)||n.children.length===0||ge.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var u=le.get(e,r);if(!ge.isText(u)){var l=u.children[s],d=u.children[s-1],h=o===n.children.length-1,m=ge.isText(l)||he.isElement(l)&&e.isInline(l);if(m!==a)ee.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(he.isElement(l)){if(e.isInline(l)){if(d==null||!ge.isText(d)){var p={text:""};ee.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(h){var g={text:""};ee.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&ge.isText(d)&&(ge.equals(l,d,{loose:!0})?(ee.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(ee.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):l.text===""&&(ee.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Fy=(e,t)=>{var{iteration:n,initialDirtyPathsLength:r}=t,i=r*42;if(n>i)throw new Error("Could not completely normalize the editor after ".concat(i," iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state."));return!0},Ay=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:i="lowest",at:a=t.selection,match:s}=n;if(a){var o=w.path(t,a),u=i==="lowest";for(var[l,d]of w.levels(t,{at:o,voids:r,match:s,reverse:u}))if(!ge.isText(l)){if(Q.isRange(a)){if(L.isAncestor(d,a.anchor.path)&&L.isAncestor(d,a.focus.path))return[l,d]}else if(!L.equals(o,d))return[l,d]}}};function ql(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ul(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ql(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ql(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ty=(e,t,n)=>{var{selection:r}=e;if(r){var i=(h,m)=>{if(!ge.isText(h))return!1;var[p,g]=w.parent(e,m);return!e.isVoid(p)||e.markableVoid(p)},a=Q.isExpanded(r),s=!1;if(!a){var[o,u]=w.node(e,r);if(o&&i(o,u)){var[l]=w.parent(e,u);s=l&&e.markableVoid(l)}}if(a||s)ee.setNodes(e,{[t]:n},{match:i,split:!0,voids:!0});else{var d=Ul(Ul({},w.marks(e)||{}),{},{[t]:n});e.marks=d,Rr.get(e)||e.onChange()}}};function Wl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Vl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Wl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var By=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=w.point(t,n,{edge:"end"}),a=w.end(t,[]),s={anchor:i,focus:a},{distance:o=1}=r,u=0,l;for(var d of w.positions(t,Vl(Vl({},r),{},{at:s}))){if(u>o)break;u!==0&&(l=d),u++}return l};function Hl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Kl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Hl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Sy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=w.start(t,[]),a=w.point(t,n,{edge:"start"}),s={anchor:i,focus:a},{distance:o=1}=r,u=0,l;for(var d of w.positions(t,Kl(Kl({},r),{},{at:s,reverse:!0}))){if(u>o)break;u!==0&&(l=d),u++}return l},jy=(e,t)=>{var{selection:n}=e;n&&Q.isCollapsed(n)&&ee.delete(e,{unit:t,reverse:!0})},Py=(e,t)=>{var{selection:n}=e;n&&Q.isCollapsed(n)&&ee.delete(e,{unit:t})},Oy=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&Q.isExpanded(r)&&ee.delete(t,{reverse:n==="backward"})},My=(e,t)=>[w.start(e,t),w.end(e,t)];function Zl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Yl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ny=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return w.above(t,Yl(Yl({},n),{},{match:r=>he.isElement(r)&&w.isElementReadOnly(t,r)}))},Iy=(e,t)=>w.point(e,t,{edge:"end"}),Ry=(e,t)=>{var n=w.path(e,t,{edge:"start"});return w.node(e,n)},$y=(e,t)=>{var n=w.range(e,t);return le.fragment(e,n)};function Gl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ql(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ly=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return w.above(t,Ql(Ql({},n),{},{match:r=>he.isElement(r)&&w.isVoid(t,r)}))},zy=(e,t)=>t.children.some(n=>he.isElement(n)&&w.isBlock(e,n)),qy=(e,t)=>t.children.some(n=>ge.isText(n)||w.isInline(e,n)),Uy=(e,t)=>le.has(e,t),Wy=(e,t)=>t.children.every(n=>ge.isText(n)),Vy=e=>{ee.splitNodes(e,{always:!0})},Hy=(e,t,n)=>{ee.insertNodes(e,t,n)},Ky=e=>{ee.splitNodes(e,{always:!0})};function Jl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Zy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Jl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Yy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:i,marks:a}=t;if(i){if(a){var s=Zy({text:n},a);ee.insertNodes(t,s,{at:r.at,voids:r.voids})}else ee.insertText(t,n,r);t.marks=null}},Gy=(e,t)=>!e.isInline(t),Qy=(e,t,n)=>w.isStart(e,t,n)||w.isEnd(e,t,n),Jy=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&ge.isText(r)&&r.text===""&&!e.isVoid(t)},Xy=(e,t,n)=>{var r=w.end(e,n);return Se.equals(t,r)},ex=e=>{var t=em.get(e);return t===void 0?!0:t},tx=(e,t,n)=>{if(t.offset!==0)return!1;var r=w.start(e,n);return Se.equals(t,r)},nx=(e,t)=>{var n=w.path(e,t,{edge:"end"});return w.node(e,n)},rx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=w.path(t,n,r),a=le.leaf(t,i);return[a,i]};function ix(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:i=!1}=t,{match:a}=t;if(a==null&&(a=()=>!0),!!n){var s=[],o=w.path(e,n);for(var[u,l]of le.levels(e,o))if(a(u,l)&&(s.push([u,l]),!i&&he.isElement(u)&&w.isVoid(e,u)))break;r&&s.reverse(),yield*s}}()}var ax=["text"],sx=["text"],ox=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:i,focus:a}=r;if(n)return n;if(Q.isExpanded(r)){var s=w.isEnd(t,i,i.path);if(s){var o=w.after(t,i);o&&(i=o)}var[u]=w.nodes(t,{match:ge.isText,at:{anchor:i,focus:a}});if(u){var[l]=u,d=sn(l,ax);return d}else return{}}var{path:h}=i,[m]=w.leaf(t,h);if(i.offset===0){var p=w.previous(t,{at:h,match:ge.isText}),g=w.above(t,{match:k=>he.isElement(k)&&w.isVoid(t,k)&&t.markableVoid(k)});if(!g){var f=w.above(t,{match:k=>he.isElement(k)&&w.isBlock(t,k)});if(p&&f){var[b,v]=p,[,y]=f;L.isAncestor(y,v)&&(m=b)}}}var C=sn(m,sx);return C},ux=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:i=!1}=n,{match:a,at:s=t.selection}=n;if(s){var o=w.after(t,s,{voids:i});if(o){var[,u]=w.last(t,[]),l=[o.path,u];if(L.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(a==null)if(L.isPath(s)){var[d]=w.parent(t,s);a=m=>d.children.includes(m)}else a=()=>!0;var[h]=w.nodes(t,{at:l,match:a,mode:r,voids:i});return h}}},lx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=w.path(t,n,r),a=le.get(t,i);return[a,i]};function cx(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:i=!1,reverse:a=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:u}=t;if(u||(u=()=>!0),!!n){var l,d;if(Z0.isSpan(n))l=n[0],d=n[1];else{var h=w.path(e,n,{edge:"start"}),m=w.path(e,n,{edge:"end"});l=a?m:h,d=a?h:m}var p=le.nodes(e,{reverse:a,from:l,to:d,pass:k=>{var[D]=k;return he.isElement(D)?!!(!s&&(w.isVoid(e,D)||w.isElementReadOnly(e,D))||o&&!w.isSelectable(e,D)):!1}}),g=[],f;for(var[b,v]of p)if(!(o&&he.isElement(b)&&!w.isSelectable(e,b))){var y=f&&L.compare(v,f[1])===0;if(!(r==="highest"&&y)){if(!u(b,v)){if(i&&!y&&ge.isText(b))return;continue}if(r==="lowest"&&y){f=[b,v];continue}var C=r==="lowest"?f:[b,v];C&&(i?g.push(C):yield C),f=[b,v]}}r==="lowest"&&f&&(i?g.push(f):yield f),i&&(yield*g)}}()}var dx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:i}=n,a=d=>ra.get(d)||[],s=d=>ia.get(d)||new Set,o=d=>{var h=a(d).pop(),m=h.join(",");return s(d).delete(m),h};if(w.isNormalizing(t)){if(r){var u=Array.from(le.nodes(t),d=>{var[,h]=d;return h}),l=new Set(u.map(d=>d.join(",")));ra.set(t,u),ia.set(t,l)}a(t).length!==0&&w.withoutNormalizing(t,()=>{for(var d of a(t))if(le.has(t,d)){var h=w.node(t,d),[m,p]=h;he.isElement(m)&&m.children.length===0&&t.normalizeNode(h,{operation:i})}for(var g=a(t),f=g.length,b=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:b,initialDirtyPathsLength:f,operation:i}))return;var v=o(t);if(le.has(t,v)){var y=w.node(t,v);t.normalizeNode(y,{operation:i})}b++,g=a(t)}})}},fx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=w.path(t,n,r),a=L.parent(i),s=w.node(t,a);return s},mx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:i="forward"}=r,a={current:n,affinity:i,unref(){var{current:o}=a,u=w.pathRefs(t);return u.delete(a),a.current=null,o}},s=w.pathRefs(t);return s.add(a),a},hx=e=>{var t=Fl.get(e);return t||(t=new Set,Fl.set(e,t)),t},px=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:i,edge:a}=r;if(L.isPath(n)){if(a==="start"){var[,s]=le.first(t,n);n=s}else if(a==="end"){var[,o]=le.last(t,n);n=o}}return Q.isRange(n)&&(a==="start"?n=Q.start(n):a==="end"?n=Q.end(n):n=L.common(n.anchor.path,n.focus.path)),Se.isPoint(n)&&(n=n.path),i!=null&&(n=n.slice(0,i)),n},gx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:i="forward"}=r,a={current:n,affinity:i,unref(){var{current:o}=a,u=w.pointRefs(t);return u.delete(a),a.current=null,o}},s=w.pointRefs(t);return s.add(a),a},vx=e=>{var t=Al.get(e);return t||(t=new Set,Al.set(e,t)),t},bx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:i="start"}=r;if(L.isPath(n)){var a;if(i==="end"){var[,s]=le.last(t,n);a=s}else{var[,o]=le.first(t,n);a=o}var u=le.get(t,a);if(!ge.isText(u))throw new Error("Cannot get the ".concat(i," point in the node at path [").concat(n,"] because it has no ").concat(i," text node."));return{path:a,offset:i==="end"?u.text.length:0}}if(Q.isRange(n)){var[l,d]=Q.edges(n);return i==="start"?l:d}return n};function yx(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:i=!1,voids:a=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=w.range(e,n),[u,l]=Q.edges(o),d=i?l:u,h=!1,m="",p=0,g=0,f=0;for(var[b,v]of w.nodes(e,{at:n,reverse:i,voids:a,ignoreNonSelectable:s})){if(he.isElement(b)){if(!a&&(e.isVoid(b)||e.isElementReadOnly(b))){yield w.start(e,v);continue}if(e.isInline(b))continue;if(w.hasInlines(e,b)){var y=L.isAncestor(v,l.path)?l:w.end(e,v),C=L.isAncestor(v,u.path)?u:w.start(e,v);m=w.string(e,{anchor:C,focus:y},{voids:a}),h=!0}}if(ge.isText(b)){var k=L.equals(v,d.path);for(k?(g=i?d.offset:b.text.length-d.offset,f=d.offset):(g=b.text.length,f=i?g:0),(k||h||r==="offset")&&(yield{path:v,offset:f},h=!1);;){if(p===0){if(m==="")break;p=D(m,r,i),m=Yo(m,p,i)[1]}if(f=i?f-p:f+p,g=g-p,g<0){p=-g;break}p=0,yield{path:v,offset:f}}}}function D(_,B,M){return B==="character"?Zo(_,M):B==="word"?ey(_,M):B==="line"||B==="block"?_.length:1}}()}var xx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:i=!1}=n,{match:a,at:s=t.selection}=n;if(s){var o=w.before(t,s,{voids:i});if(o){var[,u]=w.first(t,[]),l=[o.path,u];if(L.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(a==null)if(L.isPath(s)){var[d]=w.parent(t,s);a=m=>d.children.includes(m)}else a=()=>!0;var[h]=w.nodes(t,{reverse:!0,at:l,match:a,mode:r,voids:i});return h}}},wx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:i="forward"}=r,a={current:n,affinity:i,unref(){var{current:o}=a,u=w.rangeRefs(t);return u.delete(a),a.current=null,o}},s=w.rangeRefs(t);return s.add(a),a},Cx=e=>{var t=Tl.get(e);return t||(t=new Set,Tl.set(e,t)),t},Dx=(e,t,n)=>{if(Q.isRange(t)&&!n)return t;var r=w.start(e,t),i=w.end(e,n||t);return{anchor:r,focus:i}};function Xl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ex(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xl(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var _x=(e,t)=>{var{selection:n}=e;if(n){var r=(d,h)=>{if(!ge.isText(d))return!1;var[m,p]=w.parent(e,h);return!e.isVoid(m)||e.markableVoid(m)},i=Q.isExpanded(n),a=!1;if(!i){var[s,o]=w.node(e,n);if(s&&r(s,o)){var[u]=w.parent(e,o);a=u&&e.markableVoid(u)}}if(i||a)ee.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var l=Ex({},w.marks(e)||{});delete l[t],e.marks=l,Rr.get(e)||e.onChange()}}},kx=(e,t)=>{em.set(e,t)},Fx=(e,t)=>w.point(e,t,{edge:"start"}),Ax=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:i=!1}=r,a=w.range(t,n),[s,o]=Q.edges(a),u="";for(var[l,d]of w.nodes(t,{at:a,match:ge.isText,voids:i})){var h=l.text;L.equals(d,o.path)&&(h=h.slice(0,o.offset)),L.equals(d,s.path)&&(h=h.slice(s.offset)),u+=h}return u},Tx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:i=!1}=r,[a,s]=Q.edges(n);if(a.offset!==0||s.offset!==0||Q.isCollapsed(n)||L.hasPrevious(s.path))return n;var o=w.above(t,{at:s,match:g=>he.isElement(g)&&w.isBlock(t,g),voids:i}),u=o?o[1]:[],l=w.start(t,a),d={anchor:l,focus:s},h=!0;for(var[m,p]of w.nodes(t,{at:d,match:ge.isText,reverse:!0,voids:i})){if(h){h=!1;continue}if(m.text!==""||L.isBefore(p,u)){s={path:p,offset:m.text.length};break}}return{anchor:a,focus:s}},Bx=(e,t)=>{var n=w.isNormalizing(e);w.setNormalizing(e,!1);try{t()}finally{w.setNormalizing(e,n)}w.normalize(e)},Sx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var r,i,{reverse:a=!1,unit:s="character",distance:o=1,voids:u=!1}=n,{at:l=t.selection,hanging:d=!1}=n;if(l){var h=!1;if(Q.isRange(l)&&Q.isCollapsed(l)&&(h=!0,l=l.anchor),Se.isPoint(l)){var m=w.void(t,{at:l,mode:"highest"});if(!u&&m){var[,p]=m;l=p}else{var g={unit:s,distance:o},f=a?w.before(t,l,g)||w.start(t,[]):w.after(t,l,g)||w.end(t,[]);l={anchor:l,focus:f},d=!0}}if(L.isPath(l)){ee.removeNodes(t,{at:l,voids:u});return}if(!Q.isCollapsed(l)){if(!d){var[,b]=Q.edges(l),v=w.end(t,[]);Se.equals(b,v)||(l=w.unhangRange(t,l,{voids:u}))}var[y,C]=Q.edges(l),k=w.above(t,{match:me=>he.isElement(me)&&w.isBlock(t,me),at:y,voids:u}),D=w.above(t,{match:me=>he.isElement(me)&&w.isBlock(t,me),at:C,voids:u}),_=k&&D&&!L.equals(k[1],D[1]),B=L.equals(y.path,C.path),M=u?null:(r=w.void(t,{at:y,mode:"highest"}))!==null&&r!==void 0?r:w.elementReadOnly(t,{at:y,mode:"highest"}),P=u?null:(i=w.void(t,{at:C,mode:"highest"}))!==null&&i!==void 0?i:w.elementReadOnly(t,{at:C,mode:"highest"});if(M){var z=w.before(t,y);z&&k&&L.isAncestor(k[1],z.path)&&(y=z)}if(P){var O=w.after(t,C);O&&D&&L.isAncestor(D[1],O.path)&&(C=O)}var A=[],F;for(var S of w.nodes(t,{at:l,voids:u})){var[I,H]=S;F&&L.compare(H,F)===0||(!u&&he.isElement(I)&&(w.isVoid(t,I)||w.isElementReadOnly(t,I))||!L.isCommon(H,y.path)&&!L.isCommon(H,C.path))&&(A.push(S),F=H)}var V=Array.from(A,me=>{var[,ye]=me;return w.pathRef(t,ye)}),ae=w.pointRef(t,y),ne=w.pointRef(t,C),E="";if(!B&&!M){var Y=ae.current,[q]=w.leaf(t,Y),{path:T}=Y,{offset:j}=y,R=q.text.slice(j);R.length>0&&(t.apply({type:"remove_text",path:T,offset:j,text:R}),E=R)}if(V.reverse().map(me=>me.unref()).filter(me=>me!==null).forEach(me=>ee.removeNodes(t,{at:me,voids:u})),!P){var N=ne.current,[U]=w.leaf(t,N),{path:X}=N,W=B?y.offset:0,te=U.text.slice(W,C.offset);te.length>0&&(t.apply({type:"remove_text",path:X,offset:W,text:te}),E=te)}!B&&_&&ne.current&&ae.current&&ee.mergeNodes(t,{at:ne.current,hanging:!0,voids:u}),h&&a&&s==="character"&&E.length>1&&E.match(/[\u0E00-\u0E7F]+/)&&ee.insertText(t,E.slice(0,E.length-o));var de=ae.unref(),J=ne.unref(),ve=a?de||J:J||de;n.at==null&&ve&&ee.select(t,ve)}}})},jx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};w.withoutNormalizing(t,()=>{var{hanging:i=!1,voids:a=!1}=r,{at:s=Ko(t),batchDirty:o=!0}=r;if(n.length){if(Q.isRange(s))if(i||(s=w.unhangRange(t,s,{voids:a})),Q.isCollapsed(s))s=s.anchor;else{var[,u]=Q.edges(s);if(!a&&w.void(t,{at:u}))return;var l=w.pointRef(t,u);ee.delete(t,{at:s}),s=l.unref()}else L.isPath(s)&&(s=w.start(t,s));if(!(!a&&w.void(t,{at:s}))){var d=w.above(t,{at:s,match:R=>he.isElement(R)&&w.isInline(t,R),mode:"highest",voids:a});if(d){var[,h]=d;if(w.isEnd(t,s,h)){var m=w.after(t,h);s=m}else if(w.isStart(t,s,h)){var p=w.before(t,h);s=p}}var g=w.above(t,{match:R=>he.isElement(R)&&w.isBlock(t,R),at:s,voids:a}),[,f]=g,b=w.isStart(t,s,f),v=w.isEnd(t,s,f),y=b&&v,C=!b||b&&v,k=!v,[,D]=le.first({children:n},[]),[,_]=le.last({children:n},[]),B=[],M=R=>{var[N,U]=R,X=U.length===0;return X?!1:y?!0:!(C&&L.isAncestor(U,D)&&he.isElement(N)&&!t.isVoid(N)&&!t.isInline(N)||k&&L.isAncestor(U,_)&&he.isElement(N)&&!t.isVoid(N)&&!t.isInline(N))};for(var P of le.nodes({children:n},{pass:M}))M(P)&&B.push(P);var z=[],O=[],A=[],F=!0,S=!1;for(var[I]of B)he.isElement(I)&&!t.isInline(I)?(F=!1,S=!0,O.push(I)):F?z.push(I):A.push(I);var[H]=w.nodes(t,{at:s,match:R=>ge.isText(R)||w.isInline(t,R),mode:"highest",voids:a}),[,V]=H,ae=w.isStart(t,s,V),ne=w.isEnd(t,s,V),E=w.pathRef(t,v&&!A.length?L.next(f):f),Y=w.pathRef(t,ne?L.next(V):V);ee.splitNodes(t,{at:s,match:R=>S?he.isElement(R)&&w.isBlock(t,R):ge.isText(R)||w.isInline(t,R),mode:S?"lowest":"highest",always:S&&(!b||z.length>0)&&(!v||A.length>0),voids:a});var q=w.pathRef(t,!ae||ae&&ne?L.next(V):V);if(ee.insertNodes(t,z,{at:q.current,match:R=>ge.isText(R)||w.isInline(t,R),mode:"highest",voids:a,batchDirty:o}),y&&!z.length&&O.length&&!A.length&&ee.delete(t,{at:f,voids:a}),ee.insertNodes(t,O,{at:E.current,match:R=>he.isElement(R)&&w.isBlock(t,R),mode:"lowest",voids:a,batchDirty:o}),ee.insertNodes(t,A,{at:Y.current,match:R=>ge.isText(R)||w.isInline(t,R),mode:"highest",voids:a,batchDirty:o}),!r.at){var T;if(A.length>0&&Y.current?T=L.previous(Y.current):O.length>0&&E.current?T=L.previous(E.current):q.current&&(T=L.previous(q.current)),T){var j=w.end(t,T);ee.select(t,j)}}q.unref(),E.unref(),Y.unref()}}})},Px=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:i}=t;if(i){if(r==="anchor")ee.select(t,i.anchor);else if(r==="focus")ee.select(t,i.focus);else if(r==="start"){var[a]=Q.edges(i);ee.select(t,a)}else if(r==="end"){var[,s]=Q.edges(i);ee.select(t,s)}}else return},Ox=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},Mx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:i=1,unit:a="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=Q.isBackward(r)?"focus":"anchor"),o==="end"&&(o=Q.isBackward(r)?"anchor":"focus");var{anchor:u,focus:l}=r,d={distance:i,unit:a,ignoreNonSelectable:!0},h={};if(o==null||o==="anchor"){var m=s?w.before(t,u,d):w.after(t,u,d);m&&(h.anchor=m)}if(o==null||o==="focus"){var p=s?w.before(t,l,d):w.after(t,l,d);p&&(h.focus=p)}ee.setSelection(t,h)}},Nx=(e,t)=>{var{selection:n}=e;if(t=w.range(e,t),n){ee.setSelection(e,t);return}if(!Q.isRange(t))throw new Error("When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: ".concat(at.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function ec(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ec(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ec(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ix=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:i}=t,{edge:a="both"}=r;if(i){a==="start"&&(a=Q.isBackward(i)?"focus":"anchor"),a==="end"&&(a=Q.isBackward(i)?"anchor":"focus");var{anchor:s,focus:o}=i,u=a==="anchor"?s:o;ee.setSelection(t,{[a==="anchor"?"anchor":"focus"]:tc(tc({},u),n)})}},Rx=(e,t)=>{var{selection:n}=e,r={},i={};if(n){for(var a in t)(a==="anchor"&&t.anchor!=null&&!Se.equals(t.anchor,n.anchor)||a==="focus"&&t.focus!=null&&!Se.equals(t.focus,n.focus)||a!=="anchor"&&a!=="focus"&&t[a]!==n[a])&&(r[a]=n[a],i[a]=t[a]);Object.keys(r).length>0&&e.apply({type:"set_selection",properties:r,newProperties:i})}},$x=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};w.withoutNormalizing(t,()=>{var{hanging:i=!1,voids:a=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:u,match:l,select:d}=r;if(le.isNode(n)&&(n=[n]),n.length!==0){var[h]=n;if(u||(u=Ko(t),d!==!1&&(d=!0)),d==null&&(d=!1),Q.isRange(u))if(i||(u=w.unhangRange(t,u,{voids:a})),Q.isCollapsed(u))u=u.anchor;else{var[,m]=Q.edges(u),p=w.pointRef(t,m);ee.delete(t,{at:u}),u=p.unref()}if(Se.isPoint(u)){l==null&&(ge.isText(h)?l=z=>ge.isText(z):t.isInline(h)?l=z=>ge.isText(z)||w.isInline(t,z):l=z=>he.isElement(z)&&w.isBlock(t,z));var[g]=w.nodes(t,{at:u.path,match:l,mode:s,voids:a});if(g){var[,f]=g,b=w.pathRef(t,f),v=w.isEnd(t,u,f);ee.splitNodes(t,{at:u,match:l,mode:s,voids:a});var y=b.unref();u=v?L.next(y):y}else return}var C=L.parent(u),k=u[u.length-1];if(!(!a&&w.void(t,{at:C}))){if(o){var D=[],_=L.levels(C);Cy(t,()=>{var z=function(){var F=C.concat(k);k++;var S={type:"insert_node",path:F,node:O};t.apply(S),u=L.next(u),D.push(S),ge.isText?_.push(...Array.from(le.nodes(O),I=>{var[,H]=I;return F.concat(H)})):_.push(F)};for(var O of n)z()},()=>{nm(t,_,z=>{var O=z;for(var A of D)if(L.operationCanTransformPath(A)&&(O=L.transform(O,A),!O))return null;return O})})}else for(var B of n){var M=C.concat(k);k++,t.apply({type:"insert_node",path:M,node:B}),u=L.next(u)}if(u=L.previous(u),d){var P=w.end(t,u);P&&ee.select(t,P)}}}})},Lx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:i="lowest",voids:a=!1}=n,{match:s}=n;if(s==null&&(s=L.isPath(r)?wr(t,r):k=>he.isElement(k)&&w.isBlock(t,k)),!!r){var o=w.nodes(t,{at:r,match:s,mode:i,voids:a}),u=Array.from(o,k=>{var[,D]=k;return w.pathRef(t,D)});for(var l of u){var d=l.unref();if(d.length<2)throw new Error("Cannot lift node at a path [".concat(d,"] because it has a depth of less than `2`."));var h=w.node(t,L.parent(d)),[m,p]=h,g=d[d.length-1],{length:f}=m.children;if(f===1){var b=L.next(p);ee.moveNodes(t,{at:d,to:b,voids:a}),ee.removeNodes(t,{at:p,voids:a})}else if(g===0)ee.moveNodes(t,{at:d,to:p,voids:a});else if(g===f-1){var v=L.next(p);ee.moveNodes(t,{at:d,to:v,voids:a})}else{var y=L.next(d),C=L.next(p);ee.splitNodes(t,{at:y,voids:a}),ee.moveNodes(t,{at:d,to:C,voids:a})}}}})},zx=["text"],qx=["children"],rm=(e,t)=>{if(he.isElement(t)){var n=t;return w.isVoid(e,t)?!0:n.children.length===1?rm(e,n.children[0]):!1}else return!w.isEditor(t)},Ux=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var{match:r,at:i=t.selection}=n,{hanging:a=!1,voids:s=!1,mode:o="lowest"}=n;if(i){if(r==null)if(L.isPath(i)){var[u]=w.parent(t,i);r=z=>u.children.includes(z)}else r=z=>he.isElement(z)&&w.isBlock(t,z);if(!a&&Q.isRange(i)&&(i=w.unhangRange(t,i,{voids:s})),Q.isRange(i))if(Q.isCollapsed(i))i=i.anchor;else{var[,l]=Q.edges(i),d=w.pointRef(t,l);ee.delete(t,{at:i}),i=d.unref(),n.at==null&&ee.select(t,i)}var[h]=w.nodes(t,{at:i,match:r,voids:s,mode:o}),m=w.previous(t,{at:i,match:r,voids:s,mode:o});if(!(!h||!m)){var[p,g]=h,[f,b]=m;if(!(g.length===0||b.length===0)){var v=L.next(b),y=L.common(g,b),C=L.isSibling(g,b),k=Array.from(w.levels(t,{at:g}),z=>{var[O]=z;return O}).slice(y.length).slice(0,-1),D=w.above(t,{at:g,mode:"highest",match:z=>k.includes(z)&&rm(t,z)}),_=D&&w.pathRef(t,D[1]),B,M;if(ge.isText(p)&&ge.isText(f)){var P=sn(p,zx);M=f.text.length,B=P}else if(he.isElement(p)&&he.isElement(f)){var P=sn(p,qx);M=f.children.length,B=P}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(at.stringify(p)," ").concat(at.stringify(f)));C||ee.moveNodes(t,{at:g,to:v,voids:s}),_&&ee.removeNodes(t,{at:_.current,voids:s}),he.isElement(f)&&w.isEmpty(t,f)||ge.isText(f)&&f.text===""&&b[b.length-1]!==0?ee.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:v,position:M,properties:B}),_&&_.unref()}}}})},Wx=(e,t)=>{w.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:i="lowest",voids:a=!1}=t,{match:s}=t;if(r){s==null&&(s=L.isPath(r)?wr(e,r):p=>he.isElement(p)&&w.isBlock(e,p));var o=w.pathRef(e,n),u=w.nodes(e,{at:r,match:s,mode:i,voids:a}),l=Array.from(u,p=>{var[,g]=p;return w.pathRef(e,g)});for(var d of l){var h=d.unref(),m=o.current;h.length!==0&&e.apply({type:"move_node",path:h,newPath:m}),o.current&&L.isSibling(m,h)&&L.isAfter(m,h)&&(o.current=L.next(o.current))}o.unref()}})},Vx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:i=!1,mode:a="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=L.isPath(s)?wr(t,s):p=>he.isElement(p)&&w.isBlock(t,p)),!r&&Q.isRange(s)&&(s=w.unhangRange(t,s,{voids:i}));var u=w.nodes(t,{at:s,match:o,mode:a,voids:i}),l=Array.from(u,p=>{var[,g]=p;return w.pathRef(t,g)});for(var d of l){var h=d.unref();if(h){var[m]=w.node(t,h);t.apply({type:"remove_node",path:h,node:m})}}}})},Hx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};w.withoutNormalizing(t,()=>{var{match:i,at:a=t.selection,compare:s,merge:o}=r,{hanging:u=!1,mode:l="lowest",split:d=!1,voids:h=!1}=r;if(a){if(i==null&&(i=L.isPath(a)?wr(t,a):M=>he.isElement(M)&&w.isBlock(t,M)),!u&&Q.isRange(a)&&(a=w.unhangRange(t,a,{voids:h})),d&&Q.isRange(a)){if(Q.isCollapsed(a)&&w.leaf(t,a.anchor)[0].text.length>0)return;var m=w.rangeRef(t,a,{affinity:"inward"}),[p,g]=Q.edges(a),f=l==="lowest"?"lowest":"highest",b=w.isEnd(t,g,g.path);ee.splitNodes(t,{at:g,match:i,mode:f,voids:h,always:!b});var v=w.isStart(t,p,p.path);ee.splitNodes(t,{at:p,match:i,mode:f,voids:h,always:!v}),a=m.unref(),r.at==null&&ee.select(t,a)}s||(s=(M,P)=>M!==P);for(var[y,C]of w.nodes(t,{at:a,match:i,mode:l,voids:h})){var k={},D={};if(C.length!==0){var _=!1;for(var B in n)B==="children"||B==="text"||s(n[B],y[B])&&(_=!0,y.hasOwnProperty(B)&&(k[B]=y[B]),o?n[B]!=null&&(D[B]=o(y[B],n[B])):n[B]!=null&&(D[B]=n[B]));_&&t.apply({type:"set_node",path:C,properties:k,newProperties:D})}}}})},Kx=(e,t)=>{if(Q.isCollapsed(t))return t.anchor;var[,n]=Q.edges(t),r=w.pointRef(e,n);return ee.delete(e,{at:t}),r.unref()},Zx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:i=!1}=n,{match:a,at:s=t.selection,height:o=0,always:u=!1}=n;if(a==null&&(a=ne=>he.isElement(ne)&&w.isBlock(t,ne)),Q.isRange(s)&&(s=Kx(t,s)),L.isPath(s)){var l=s,d=w.point(t,l),[h]=w.parent(t,l);a=ne=>ne===h,o=d.path.length-l.length+1,s=d,u=!0}if(s){var m=w.pointRef(t,s,{affinity:"backward"}),p;try{var[g]=w.nodes(t,{at:s,match:a,mode:r,voids:i});if(!g)return;var f=w.void(t,{at:s,mode:"highest"}),b=0;if(!i&&f){var[v,y]=f;if(he.isElement(v)&&t.isInline(v)){var C=w.after(t,y);if(!C){var k={text:""},D=L.next(y);ee.insertNodes(t,k,{at:D,voids:i}),C=w.point(t,D)}s=C,u=!0}var _=s.path.length-y.length;o=_+1,u=!0}p=w.pointRef(t,s);var B=s.path.length-o,[,M]=g,P=s.path.slice(0,B),z=o===0?s.offset:s.path[B]+b;for(var[O,A]of w.levels(t,{at:P,reverse:!0,voids:i})){var F=!1;if(A.length<M.length||A.length===0||!i&&he.isElement(O)&&w.isVoid(t,O))break;var S=m.current,I=w.isEnd(t,S,A);if(u||!m||!w.isEdge(t,S,A)){F=!0;var H=le.extractProps(O);t.apply({type:"split_node",path:A,position:z,properties:H})}z=A[A.length-1]+(F||I?1:0)}if(n.at==null){var V=p.current||w.end(t,[]);ee.select(t,V)}}finally{var ae;m.unref(),(ae=p)===null||ae===void 0||ae.unref()}}})},Yx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var i={};for(var a of n)i[a]=null;ee.setNodes(t,i,r)},Gx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var{mode:r="lowest",split:i=!1,voids:a=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=L.isPath(s)?wr(t,s):p=>he.isElement(p)&&w.isBlock(t,p)),L.isPath(s)&&(s=w.range(t,s));var u=Q.isRange(s)?w.rangeRef(t,s):null,l=w.nodes(t,{at:s,match:o,mode:r,voids:a}),d=Array.from(l,p=>{var[,g]=p;return w.pathRef(t,g)}).reverse(),h=function(){var g=m.unref(),[f]=w.node(t,g),b=w.range(t,g);i&&u&&(b=Q.intersection(u.current,b)),ee.liftNodes(t,{at:b,match:v=>he.isAncestor(f)&&f.children.includes(v),voids:a})};for(var m of d)h();u&&u.unref()}})};function nc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nc(Object(n),!0).forEach(function(r){ht(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Qx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};w.withoutNormalizing(t,()=>{var{mode:i="lowest",split:a=!1,voids:s=!1}=r,{match:o,at:u=t.selection}=r;if(u){if(o==null&&(L.isPath(u)?o=wr(t,u):t.isInline(n)?o=b=>he.isElement(b)&&w.isInline(t,b)||ge.isText(b):o=b=>he.isElement(b)&&w.isBlock(t,b)),a&&Q.isRange(u)){var[l,d]=Q.edges(u),h=w.rangeRef(t,u,{affinity:"inward"});ee.splitNodes(t,{at:d,match:o,voids:s}),ee.splitNodes(t,{at:l,match:o,voids:s}),u=h.unref(),r.at==null&&ee.select(t,u)}var m=Array.from(w.nodes(t,{at:u,match:t.isInline(n)?b=>he.isElement(b)&&w.isBlock(t,b):b=>w.isEditor(b),mode:"lowest",voids:s})),p=function(){var v=Q.isRange(u)?Q.intersection(u,w.range(t,f)):u;if(!v)return 0;var y=Array.from(w.nodes(t,{at:v,match:o,mode:i,voids:s}));if(y.length>0){var[C]=y,k=y[y.length-1],[,D]=C,[,_]=k;if(D.length===0&&_.length===0)return 0;var B=L.equals(D,_)?L.parent(D):L.common(D,_),M=w.range(t,D,_),P=w.node(t,B),[z]=P,O=B.length+1,A=L.next(_.slice(0,O)),F=rc(rc({},n),{},{children:[]});ee.insertNodes(t,F,{at:A,voids:s}),ee.moveNodes(t,{at:M,match:S=>he.isAncestor(z)&&z.children.includes(S),to:A.concat(0),voids:s})}},g;for(var[,f]of m)g=p()}})},Jx=()=>{var e={children:[],operations:[],selection:null,marks:null,isElementReadOnly:()=>!1,isInline:()=>!1,isSelectable:()=>!0,isVoid:()=>!1,markableVoid:()=>!1,onChange:()=>{},apply:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Dy(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ty(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return jy(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Py(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Oy(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return _y(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Vy(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ky(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return jx(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Hy(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Yy(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ky(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return _x(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ey(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Fy(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ay(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return By(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Sy(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Px(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Sx(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ox(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return My(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ny(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Iy(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ry(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return $y(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ox(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return zy(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return qy(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Uy(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Wy(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return $x(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Gy(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Qy(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Jy(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Xy(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ex(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return tx(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return nx(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return rx(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ix(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Lx(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ux(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Mx(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Wx(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ux(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return lx(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return cx(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return dx(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return fx(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return px(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return mx(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return hx(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return bx(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return gx(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return vx(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return yx(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return xx(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Dx(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return wx(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Cx(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Vx(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Nx(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Hx(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return kx(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ix(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Rx(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Zx(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Fx(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ax(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Tx(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Yx(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Gx(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ly(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Bx(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Qx(e,...r)}};return e},Sn=[],Xx=function(){return Sn.some(function(e){return e.activeTargets.length>0})},e1=function(){return Sn.some(function(e){return e.skippedTargets.length>0})},ic="ResizeObserver loop completed with undelivered notifications.",t1=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:ic}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=ic),window.dispatchEvent(e)},Jr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Jr||(Jr={}));var jn=function(e){return Object.freeze(e)},n1=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,jn(this)}return e}(),im=function(){function e(t,n,r,i){return this.x=t,this.y=n,this.width=r,this.height=i,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,jn(this)}return e.prototype.toJSON=function(){var t=this,n=t.x,r=t.y,i=t.top,a=t.right,s=t.bottom,o=t.left,u=t.width,l=t.height;return{x:n,y:r,top:i,right:a,bottom:s,left:o,width:u,height:l}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),Go=function(e){return e instanceof SVGElement&&"getBBox"in e},am=function(e){if(Go(e)){var t=e.getBBox(),n=t.width,r=t.height;return!n&&!r}var i=e,a=i.offsetWidth,s=i.offsetHeight;return!(a||s||e.getClientRects().length)},ac=function(e){var t;if(e instanceof Element)return!0;var n=(t=e==null?void 0:e.ownerDocument)===null||t===void 0?void 0:t.defaultView;return!!(n&&e instanceof n.Element)},r1=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},$r=typeof window<"u"?window:{},Ci=new WeakMap,sc=/auto|scroll/,i1=/^tb|vertical/,a1=/msie|trident/i.test($r.navigator&&$r.navigator.userAgent),Ut=function(e){return parseFloat(e||"0")},ir=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new n1((n?t:e)||0,(n?e:t)||0)},oc=jn({devicePixelContentBoxSize:ir(),borderBoxSize:ir(),contentBoxSize:ir(),contentRect:new im(0,0,0,0)}),sm=function(e,t){if(t===void 0&&(t=!1),Ci.has(e)&&!t)return Ci.get(e);if(am(e))return Ci.set(e,oc),oc;var n=getComputedStyle(e),r=Go(e)&&e.ownerSVGElement&&e.getBBox(),i=!a1&&n.boxSizing==="border-box",a=i1.test(n.writingMode||""),s=!r&&sc.test(n.overflowY||""),o=!r&&sc.test(n.overflowX||""),u=r?0:Ut(n.paddingTop),l=r?0:Ut(n.paddingRight),d=r?0:Ut(n.paddingBottom),h=r?0:Ut(n.paddingLeft),m=r?0:Ut(n.borderTopWidth),p=r?0:Ut(n.borderRightWidth),g=r?0:Ut(n.borderBottomWidth),f=r?0:Ut(n.borderLeftWidth),b=h+l,v=u+d,y=f+p,C=m+g,k=o?e.offsetHeight-C-e.clientHeight:0,D=s?e.offsetWidth-y-e.clientWidth:0,_=i?b+y:0,B=i?v+C:0,M=r?r.width:Ut(n.width)-_-D,P=r?r.height:Ut(n.height)-B-k,z=M+b+D+y,O=P+v+k+C,A=jn({devicePixelContentBoxSize:ir(Math.round(M*devicePixelRatio),Math.round(P*devicePixelRatio),a),borderBoxSize:ir(z,O,a),contentBoxSize:ir(M,P,a),contentRect:new im(h,u,M,P)});return Ci.set(e,A),A},om=function(e,t,n){var r=sm(e,n),i=r.borderBoxSize,a=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Jr.DEVICE_PIXEL_CONTENT_BOX:return s;case Jr.BORDER_BOX:return i;default:return a}},s1=function(){function e(t){var n=sm(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=jn([n.borderBoxSize]),this.contentBoxSize=jn([n.contentBoxSize]),this.devicePixelContentBoxSize=jn([n.devicePixelContentBoxSize])}return e}(),um=function(e){if(am(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},o1=function(){var e=1/0,t=[];Sn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(l){var d=new s1(l.target),h=um(l.target);o.push(d),l.lastReportedSize=om(l.target,l.observedBox),h<e&&(e=h)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var i=r[n];i()}return e},uc=function(e){Sn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(i){i.isActive()&&(um(i.target)>e?n.activeTargets.push(i):n.skippedTargets.push(i))})})},u1=function(){var e=0;for(uc(e);Xx();)e=o1(),uc(e);return e1()&&t1(),e>0},Xa,lm=[],l1=function(){return lm.splice(0).forEach(function(e){return e()})},c1=function(e){if(!Xa){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return l1()}).observe(n,r),Xa=function(){n.textContent="".concat(t?t--:t++)}}lm.push(e),Xa()},d1=function(e){c1(function(){requestAnimationFrame(e)})},Ri=0,f1=function(){return!!Ri},m1=250,h1={attributes:!0,characterData:!0,childList:!0,subtree:!0},lc=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],cc=function(e){return e===void 0&&(e=0),Date.now()+e},es=!1,p1=function(){function e(){var t=this;this.stopped=!0,this.listener=function(){return t.schedule()}}return e.prototype.run=function(t){var n=this;if(t===void 0&&(t=m1),!es){es=!0;var r=cc(t);d1(function(){var i=!1;try{i=u1()}finally{if(es=!1,t=r-cc(),!f1())return;i?n.run(1e3):t>0?n.run(t):n.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var t=this,n=function(){return t.observer&&t.observer.observe(document.body,h1)};document.body?n():$r.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),lc.forEach(function(n){return $r.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),lc.forEach(function(n){return $r.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),Gs=new p1,dc=function(e){!Ri&&e>0&&Gs.start(),Ri+=e,!Ri&&Gs.stop()},g1=function(e){return!Go(e)&&!r1(e)&&getComputedStyle(e).display==="inline"},v1=function(){function e(t,n){this.target=t,this.observedBox=n||Jr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=om(this.target,this.observedBox,!0);return g1(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),b1=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Di=new WeakMap,fc=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Ei=function(){function e(){}return e.connect=function(t,n){var r=new b1(t,n);Di.set(t,r)},e.observe=function(t,n,r){var i=Di.get(t),a=i.observationTargets.length===0;fc(i.observationTargets,n)<0&&(a&&Sn.push(i),i.observationTargets.push(new v1(n,r&&r.box)),dc(1),Gs.schedule())},e.unobserve=function(t,n){var r=Di.get(t),i=fc(r.observationTargets,n),a=r.observationTargets.length===1;i>=0&&(a&&Sn.splice(Sn.indexOf(r),1),r.observationTargets.splice(i,1),dc(-1))},e.disconnect=function(t){var n=this,r=Di.get(t);r.observationTargets.slice().forEach(function(i){return n.unobserve(t,i.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),y1=function(){function e(t){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof t!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Ei.connect(this,t)}return e.prototype.observe=function(t,n){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ac(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Ei.observe(this,t,n)},e.prototype.unobserve=function(t){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!ac(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Ei.unobserve(this,t)},e.prototype.disconnect=function(){Ei.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),dn={};Object.defineProperty(dn,"__esModule",{value:!0});var x1=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),ts={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},cm={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:x1?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Qo={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222};for(var _i=1;_i<20;_i++)Qo["f"+_i]=111+_i;function Da(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return dm(s,t)}),i=function(o){return r.some(function(u){return fm(u,o)})},a=n==null?i:i(n);return a}function w1(e,t){return Da(e,t)}function C1(e,t){return Da(e,{byKey:!0},t)}function dm(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var i=e.split("+"),a=i.length;for(var s in ts)r[ts[s]]=!1;var o=!0,u=!1,l=void 0;try{for(var d=i[Symbol.iterator](),h;!(o=(h=d.next()).done);o=!0){var m=h.value,p=m.endsWith("?")&&m.length>1;p&&(m=m.slice(0,-1));var g=Jo(m),f=ts[g];if(m.length>1&&!f&&!cm[m]&&!Qo[g])throw new TypeError('Unknown modifier: "'+m+'"');(a===1||!f)&&(n?r.key=g:r.which=mm(m)),f&&(r[f]=p?null:!0)}}catch(b){u=!0,l=b}finally{try{!o&&d.return&&d.return()}finally{if(u)throw l}}return r}function fm(e,t){for(var n in e){var r=e[n],i=void 0;if(r!=null&&(n==="key"&&t.key!=null?i=t.key.toLowerCase():n==="which"?i=r===91&&t.which===93?91:t.which:i=t[n],!(i==null&&r===!1)&&i!==r))return!1}return!0}function mm(e){e=Jo(e);var t=Qo[e]||e.toUpperCase().charCodeAt(0);return t}function Jo(e){return e=e.toLowerCase(),e=cm[e]||e,e}var D1=dn.default=Da,ns=dn.isHotkey=Da;dn.isCodeHotkey=w1;dn.isKeyHotkey=C1;dn.parseHotkey=dm;dn.compareHotkey=fm;dn.toKeyCode=mm;dn.toKeyName=Jo;function E1(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function mr(e,t){if(e==null)return{};var n=E1(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Xr(e){"@babel/helpers - typeof";return Xr=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},Xr(e)}function _1(e,t){if(Xr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Xr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function k1(e){var t=_1(e,"string");return Xr(t)==="symbol"?t:String(t)}function Mt(e,t,n){return t=k1(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xo=x.createContext(null),En=()=>{var e=x.useContext(Xo);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},hm=parseInt(x.version.split(".")[0],10),F1=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,mc=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),mt=typeof navigator<"u"&&/Android/.test(navigator.userAgent),er=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Mr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),A1=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),pm=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),T1=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),B1=mt&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),S1=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),j1=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),P1=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),$i=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",fn=(!T1||!B1)&&!A1&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",eu=new WeakMap,tu=new WeakMap,gm=new WeakMap,Li=new WeakMap,Qs=new WeakMap,ei=new WeakMap,Pn=new WeakMap,aa=new WeakMap,Ea=new WeakMap,Js=new WeakMap,bn=new WeakMap,Bn=new WeakMap,Lr=new WeakMap,Xs=new WeakMap,nu=new WeakMap,$t=new WeakMap,rn=new WeakMap,bt=new WeakMap,hn=new WeakMap,pn=new WeakMap,vm=new WeakMap,hr=Symbol("placeholder"),bm=Symbol("mark-placeholder"),O1=globalThis.Text,ru=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,M1=e=>xn(e)&&e.nodeType===8,Ot=e=>xn(e)&&e.nodeType===1,xn=e=>{var t=ru(e);return!!t&&e instanceof t.Node},eo=e=>{var t=e&&e.anchorNode&&ru(e.anchorNode);return!!t&&e instanceof t.Selection},ym=e=>xn(e)&&e.nodeType===3,N1=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,I1=e=>{var[t,n]=e;if(Ot(t)&&t.childNodes.length){var r=n===t.childNodes.length,i=r?n-1:n;for([t,i]=xm(t,i,r?"backward":"forward"),r=i<n;Ot(t)&&t.childNodes.length;){var a=r?t.childNodes.length-1:0;t=$1(t,a,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},R1=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},xm=(e,t,n)=>{for(var{childNodes:r}=e,i=r[t],a=t,s=!1,o=!1;(M1(i)||Ot(i)&&i.childNodes.length===0||Ot(i)&&i.getAttribute("contenteditable")==="false")&&!(s&&o);){if(a>=r.length){s=!0,a=t-1,n="backward";continue}if(a<0){o=!0,a=t+1,n="forward";continue}i=r[a],t=a,a+=n==="forward"?1:-1}return[i,t]},$1=(e,t,n)=>{var[r]=xm(e,t,n);return r},wm=e=>{var t="";if(ym(e)&&e.nodeValue)return e.nodeValue;if(Ot(e)){for(var n of Array.from(e.childNodes))t+=wm(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
72
+ `)}return t},L1=/data-slate-fragment="(.+?)"/m,z1=e=>{var t=e.getData("text/html"),[,n]=t.match(L1)||[];return n},iu=(e,t,n)=>{var{target:r}=t;if(Ot(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:i}=re.getWindow(e);if(i.contains(r))return re.hasDOMNode(e,r,{editable:!0});var a=n.find(s=>{var{addedNodes:o,removedNodes:u}=s;for(var l of o)if(l===r||l.contains(r))return!0;for(var d of u)if(d===r||d.contains(r))return!0});return!a||a===t?!1:iu(e,a,n)},q1=0;class U1{constructor(){Mt(this,"id",void 0),this.id="".concat(q1++)}}var re={androidPendingDiffs:e=>bt.get(e),androidScheduleFlush:e=>{var t;(t=nu.get(e))===null||t===void 0||t()},blur:e=>{var t=re.toDOMNode(e,e),n=re.findDocumentOrShadowRoot(e);bn.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=re.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&ee.deselect(e)},findDocumentOrShadowRoot:e=>{var t=re.toDOMNode(e,e),n=t.getRootNode();return(n instanceof Document||n instanceof ShadowRoot)&&n.getSelection!=null?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:i}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var a=re.toSlateNode(e,t.target),s=re.findPath(e,a);if(he.isElement(a)&&w.isVoid(e,a)){var o=i.getBoundingClientRect(),u=e.isInline(a)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,l=w.point(e,s,{edge:u?"start":"end"}),d=u?w.before(e,l):w.after(e,l);if(d){var h=w.range(e,d);return h}}var m,{document:p}=re.getWindow(e);if(p.caretRangeFromPoint)m=p.caretRangeFromPoint(n,r);else{var g=p.caretPositionFromPoint(n,r);g&&(m=p.createRange(),m.setStart(g.offsetNode,g.offset),m.setEnd(g.offsetNode,g.offset))}if(!m)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=re.toSlateRange(e,m,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=aa.get(t);return n||(n=new U1,aa.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var i=tu.get(r);if(i==null){if(w.isEditor(r))return n;break}var a=eu.get(r);if(a==null)break;n.unshift(a),r=i}throw new Error("Unable to find the path for Slate node: ".concat(at.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!bn.get(t)){if(n.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(t.operations.length>0){setTimeout(()=>{re.focus(t,{retries:n.retries-1})},10);return}var r=re.toDOMNode(t,t),i=re.findDocumentOrShadowRoot(t);if(i.activeElement!==r){if(t.selection&&i instanceof Document){var a=i.getSelection(),s=re.toDOMRange(t,t.selection);a==null||a.removeAllRanges(),a==null||a.addRange(s)}t.selection||(ee.select(t,w.start(t,[])),t.onChange()),bn.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=gm.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{editable:i=!1}=r,a=re.toDOMNode(t,t),s;try{s=Ot(n)?n:n.parentElement}catch(o){if(o instanceof Error&&!o.message.includes('Permission denied to access property "nodeType"'))throw o}return s?s.closest("[data-slate-editor]")===a&&(!i||s.isContentEditable?!0:typeof s.isContentEditable=="boolean"&&s.closest('[contenteditable="false"]')===a||!!s.getAttribute("data-slate-zero-width")):!1},hasEditableTarget:(e,t)=>xn(t)&&re.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return w.hasPath(e,n.path)&&w.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>re.hasEditableTarget(e,t)||re.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>xn(t)&&re.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!Bn.get(e),isFocused:e=>!!bn.get(e),isReadOnly:e=>!!Js.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Js.get(e))return!1;var n=re.hasTarget(e,t)&&re.toSlateNode(e,t);return he.isElement(n)&&w.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=Ea.get(e),r=w.isEditor(t)?Li.get(e):n==null?void 0:n.get(re.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(at.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=w.node(e,t.path),r=re.toDOMNode(e,n),i;w.void(e,{at:t})&&(t={path:t.path,offset:0});for(var a="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(a)),o=0,u=0;u<s.length;u++){var l=s[u],d=l.childNodes[0];if(!(d==null||d.textContent==null)){var{length:h}=d.textContent,m=l.getAttribute("data-slate-length"),p=m==null?h:parseInt(m,10),g=o+p,f=s[u+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var b,v=f.childNodes[0];i=[v instanceof O1?v:f,(b=f.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var y=Math.min(h,Math.max(0,t.offset-o));i=[d,y];break}o=g}}if(!i)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(at.stringify(t)));return i},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,i=Q.isBackward(t),a=re.toDOMPoint(e,n),s=Q.isCollapsed(t)?a:re.toDOMPoint(e,r),o=re.getWindow(e),u=o.document.createRange(),[l,d]=i?s:a,[h,m]=i?a:s,p=Ot(l)?l:l.parentElement,g=!!p.getAttribute("data-slate-zero-width"),f=Ot(h)?h:h.parentElement,b=!!f.getAttribute("data-slate-zero-width");return u.setStart(l,g?1:d),u.setEnd(h,b?1:m),u},toSlateNode:(e,t)=>{var n=Ot(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?ei.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},toSlatePoint:(e,t,n)=>{var{exactMatch:r,suppressThrow:i}=n,[a,s]=r?t:I1(t),o=a.parentNode,u=null,l=0;if(o){var d,h,m=re.toDOMNode(e,e),p=o.closest('[data-slate-void="true"]'),g=p&&m.contains(p)?p:null,f=o.closest("[data-slate-leaf]"),b=null;if(f){if(u=f.closest('[data-slate-node="text"]'),u){var v=re.getWindow(e),y=v.document.createRange();y.setStart(u,0),y.setEnd(a,s);var C=y.cloneContents(),k=[...Array.prototype.slice.call(C.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(C.querySelectorAll("[contenteditable=false]"))];k.forEach(S=>{if(mt&&!r&&S.hasAttribute("data-slate-zero-width")&&S.textContent.length>0&&S.textContext!=="\uFEFF"){S.textContent.startsWith("\uFEFF")&&(S.textContent=S.textContent.slice(1));return}S.parentNode.removeChild(S)}),l=C.textContent.length,b=u}}else if(g){for(var D=g.querySelectorAll("[data-slate-leaf]"),_=0;_<D.length;_++){var B=D[_];if(re.hasDOMNode(e,B)){f=B;break}}f?(u=f.closest('[data-slate-node="text"]'),b=f,l=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(S=>{l-=S.textContent.length})):l=1}b&&l===b.textContent.length&&mt&&b.getAttribute("data-slate-zero-width")==="z"&&(d=b.textContent)!==null&&d!==void 0&&d.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||er&&(h=b.textContent)!==null&&h!==void 0&&h.endsWith(`
73
73
 
74
- `))&&l--}if(mt&&!u&&!r){var P=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(P&&re.hasDOMNode(e,P,{editable:!0})){var N=re.toSlateNode(e,P),{path:z,offset:O}=w.start(e,re.findPath(e,N));return P.querySelector("[data-slate-leaf]")||(O=s),{path:z,offset:O}}}if(!u){if(i)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var A=re.toSlateNode(e,u),F=re.findPath(e,A);return{path:F,offset:l}},toSlateRange:(e,t,n)=>{var r,{exactMatch:i,suppressThrow:a}=n,s=eo(t)?t.anchorNode:t.startContainer,o,u,l,d,m;if(s)if(eo(t)){if(er&&t.rangeCount>1){l=t.focusNode;var h=t.getRangeAt(0),p=t.getRangeAt(t.rangeCount-1);if(l instanceof HTMLTableRowElement&&h.startContainer instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement){let _=function(B){return B.childElementCount>0?_(B.children[0]):B};var g=h.startContainer,f=p.startContainer,b=_(g.children[h.startOffset]),v=_(f.children[p.startOffset]);d=0,v.childNodes.length>0?o=v.childNodes[0]:o=v,b.childNodes.length>0?l=b.childNodes[0]:l=b,v instanceof HTMLElement?u=v.innerHTML.length:u=0}else h.startContainer===l?(o=p.endContainer,u=p.endOffset,d=h.startOffset):(o=h.startContainer,u=h.endOffset,d=p.startOffset)}else o=t.anchorNode,u=t.anchorOffset,l=t.focusNode,d=t.focusOffset;pm&&R1(o)||er?m=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:m=t.isCollapsed}else o=t.startContainer,u=t.startOffset,l=t.endContainer,d=t.endOffset,m=t.collapsed;if(o==null||l==null||u==null||d==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(er&&(r=l.textContent)!==null&&r!==void 0&&r.endsWith(`
74
+ `))&&l--}if(mt&&!u&&!r){var M=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(M&&re.hasDOMNode(e,M,{editable:!0})){var P=re.toSlateNode(e,M),{path:z,offset:O}=w.start(e,re.findPath(e,P));return M.querySelector("[data-slate-leaf]")||(O=s),{path:z,offset:O}}}if(!u){if(i)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var A=re.toSlateNode(e,u),F=re.findPath(e,A);return{path:F,offset:l}},toSlateRange:(e,t,n)=>{var r,{exactMatch:i,suppressThrow:a}=n,s=eo(t)?t.anchorNode:t.startContainer,o,u,l,d,h;if(s)if(eo(t)){if(er&&t.rangeCount>1){l=t.focusNode;var m=t.getRangeAt(0),p=t.getRangeAt(t.rangeCount-1);if(l instanceof HTMLTableRowElement&&m.startContainer instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement){let _=function(B){return B.childElementCount>0?_(B.children[0]):B};var g=m.startContainer,f=p.startContainer,b=_(g.children[m.startOffset]),v=_(f.children[p.startOffset]);d=0,v.childNodes.length>0?o=v.childNodes[0]:o=v,b.childNodes.length>0?l=b.childNodes[0]:l=b,v instanceof HTMLElement?u=v.innerHTML.length:u=0}else m.startContainer===l?(o=p.endContainer,u=p.endOffset,d=m.startOffset):(o=m.startContainer,u=m.endOffset,d=p.startOffset)}else o=t.anchorNode,u=t.anchorOffset,l=t.focusNode,d=t.focusOffset;pm&&R1(o)||er?h=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:h=t.isCollapsed}else o=t.startContainer,u=t.startOffset,l=t.endContainer,d=t.endOffset,h=t.collapsed;if(o==null||l==null||u==null||d==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(er&&(r=l.textContent)!==null&&r!==void 0&&r.endsWith(`
75
75
 
76
- `)&&d===l.textContent.length&&d--,"getAttribute"in l&&l.getAttribute("contenteditable")==="false"&&l.getAttribute("data-slate-void")!=="true"){var y;l=o,d=((y=o.textContent)===null||y===void 0?void 0:y.length)||0}var C=re.toSlatePoint(e,[o,u],{exactMatch:i,suppressThrow:a});if(!C)return null;var k=m?C:re.toSlatePoint(e,[l,d],{exactMatch:i,suppressThrow:a});if(!k)return null;var D={anchor:C,focus:k};return Q.isExpanded(D)&&Q.isForward(D)&&Ot(l)&&w.void(e,{at:D.focus,mode:"highest"})&&(D=w.unhangRange(e,D,{voids:!0})),D}};function W1(e,t){var{path:n,diff:r}=t;if(!w.hasPath(e,n))return!1;var i=le.get(e,n);if(!ge.isText(i))return!1;if(r.start!==i.text.length||r.text.length===0)return i.text.slice(r.start,r.start+r.text.length)===r.text;var a=L.next(n);if(!w.hasPath(e,a))return!1;var s=le.get(e,a);return ge.isText(s)&&s.text.startsWith(r.text)}function Cm(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.reduce((i,a)=>i.slice(0,a.start)+a.text+i.slice(a.end),e)}function V1(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++)if(e.charAt(r)!==t.charAt(r))return r;return n}function H1(e,t,n){for(var r=Math.min(e.length,t.length,n),i=0;i<r;i++)if(e.charAt(e.length-i-1)!==t.charAt(t.length-i-1))return i;return r}function Dm(e,t){var{start:n,end:r,text:i}=t,a=e.slice(n,r),s=V1(a,i),o=Math.min(a.length-s,i.length-s),u=H1(a,i,o),l={start:n+s,end:r-u,text:i.slice(s,i.length-u)};return l.start===l.end&&l.text.length===0?null:l}function K1(e,t,n){var r=Math.min(t.start,n.start),i=Math.max(0,Math.min(t.start+t.text.length,n.end)-n.start),a=Cm(e,t,n),s=Math.max(n.start+n.text.length,t.start+t.text.length+(t.start+t.text.length>n.start?n.text.length:0)-i),o=a.slice(r,s),u=Math.max(t.end,n.end-t.text.length+(t.end-t.start));return Dm(e,{start:r,end:u,text:o})}function Z1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function to(e,t){var{path:n,offset:r}=t;if(!w.hasPath(e,n))return null;var i=le.get(e,n);if(!ge.isText(i))return null;var a=w.above(e,{match:o=>he.isElement(o)&&w.isBlock(e,o),at:n});if(!a)return null;for(;r>i.text.length;){var s=w.next(e,{at:n,match:ge.isText});if(!s||!L.isDescendant(s[1],a[1]))return null;r-=i.text.length,i=s[0],n=s[1]}return{path:n,offset:r}}function hc(e,t){var n=to(e,t.anchor);if(!n)return null;if(Q.isCollapsed(t))return{anchor:n,focus:n};var r=to(e,t.focus);return r?{anchor:n,focus:r}:null}function no(e,t,n){var r=bt.get(e),i=r==null?void 0:r.find(d=>{var{path:m}=d;return L.equals(m,t.path)});if(!i||t.offset<=i.diff.start)return Se.transform(t,n,{affinity:"backward"});var{diff:a}=i;if(t.offset<=a.start+a.text.length){var s={path:t.path,offset:a.start},o=Se.transform(s,n,{affinity:"backward"});return o?{path:o.path,offset:o.offset+t.offset-a.start}:null}var u={path:t.path,offset:t.offset-a.text.length+a.end-a.start},l=Se.transform(u,n,{affinity:"backward"});return l?n.type==="split_node"&&L.equals(n.path,t.path)&&u.offset<n.position&&a.start<n.position?l:{path:l.path,offset:l.offset+a.text.length-a.end+a.start}:null}function pc(e,t,n){var r=no(e,t.anchor,n);if(!r)return null;if(Q.isCollapsed(t))return{anchor:r,focus:r};var i=no(e,t.focus,n);return i?{anchor:r,focus:i}:null}function Y1(e,t){var{path:n,diff:r,id:i}=e;switch(t.type){case"insert_text":return!L.equals(t.path,n)||t.offset>=r.end?e:t.offset<=r.start?{diff:{start:t.text.length+r.start,end:t.text.length+r.end,text:r.text},id:i,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:i,path:n};case"remove_text":return!L.equals(t.path,n)||t.offset>=r.end?e:t.offset+t.text.length<=r.start?{diff:{start:r.start-t.text.length,end:r.end-t.text.length,text:r.text},id:i,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:i,path:n};case"split_node":return!L.equals(t.path,n)||t.position>=r.end?{diff:r,id:i,path:L.transform(n,t,{affinity:"backward"})}:t.position>r.start?{diff:{start:r.start,end:Math.min(t.position,r.end),text:r.text},id:i,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:i,path:L.transform(n,t,{affinity:"forward"})};case"merge_node":return L.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:i,path:L.transform(n,t)}:{diff:r,id:i,path:L.transform(n,t)}}var a=L.transform(n,t);return a?{diff:r,path:a,id:i}:null}function gc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ki(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var G1=25,Q1=200,J1=function(){},X1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function ew(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,i=!1,a=null,s=null,o=null,u=0,l=!1,d=()=>{var A=pn.get(t);if(pn.delete(t),A){var{selection:F}=t,S=hc(t,A);S&&(!F||!Q.equals(S,F))&&ee.select(t,S)}},m=()=>{var A=hn.get(t);if(hn.delete(t),!!A){if(A.at){var F=Se.isPoint(A.at)?to(t,A.at):hc(t,A.at);if(!F)return;var S=w.range(t,F);(!t.selection||!Q.equals(t.selection,S))&&ee.select(t,F)}A.run()}},h=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!k()&&!C()){d();return}i||(i=!0,setTimeout(()=>i=!1)),C()&&(i="action");var A=t.selection&&w.rangeRef(t,t.selection,{affinity:"forward"});rn.set(t,t.marks),J1("flush",hn.get(t),bt.get(t));for(var F=k(),S;S=(I=bt.get(t))===null||I===void 0?void 0:I[0];){var I,H,V=$t.get(t);V!==void 0&&($t.delete(t),t.marks=V),V&&l===!1&&(l=null);var ae=Z1(S);(!t.selection||!Q.equals(t.selection,ae))&&ee.select(t,ae),S.diff.text?w.insertText(t,S.diff.text):w.deleteFragment(t),bt.set(t,(H=bt.get(t))===null||H===void 0?void 0:H.filter(Y=>{var{id:q}=Y;return q!==S.id})),W1(t,S)||(F=!1,hn.delete(t),rn.delete(t),i="action",pn.delete(t),n.cancel(),r.cancel(),A==null||A.unref())}var ne=A==null?void 0:A.unref();if(ne&&!pn.get(t)&&(!t.selection||!Q.equals(ne,t.selection))&&ee.select(t,ne),C()){m();return}F&&n(),n.flush(),r.flush(),d();var E=rn.get(t);rn.delete(t),E!==void 0&&(t.marks=E,t.onChange())},p=A=>{a&&clearTimeout(a),a=setTimeout(()=>{Bn.set(t,!1),h()},G1)},g=A=>{Bn.set(t,!0),a&&(clearTimeout(a),a=null)},f=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,S=Qs.get(t);if(S){if(k()||F){S.style.display="none";return}S.style.removeProperty("display")}},b=(A,F)=>{var S,I=(S=bt.get(t))!==null&&S!==void 0?S:[];bt.set(t,I);var H=le.leaf(t,A),V=I.findIndex(E=>L.equals(E.path,A));if(V<0){var ae=Dm(H.text,F);ae&&I.push({path:A,diff:F,id:u++}),f();return}var ne=K1(H.text,I[V].diff,F);if(!ne){I.splice(V,1),f();return}I[V]=ki(ki({},I[V]),{},{diff:ne})},v=function(F){var{at:S}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};l=!1,pn.delete(t),n.cancel(),r.cancel(),C()&&h(),hn.set(t,{at:S,run:F}),o=setTimeout(h)},y=A=>{var F;s&&(clearTimeout(s),s=null);var{inputType:S}=A,I=null,H=A.dataTransfer||A.data||void 0;l!==!1&&S!=="insertText"&&S!=="insertCompositionText"&&(l=!1);var[V]=A.getTargetRanges();V&&(I=re.toSlateRange(t,V,{exactMatch:!1,suppressThrow:!0}));var ae=re.getWindow(t),ne=ae.getSelection();if(!I&&ne&&(V=ne,I=re.toSlateRange(t,ne,{exactMatch:!1,suppressThrow:!0})),I=(F=I)!==null&&F!==void 0?F:t.selection,!!I){var E=!0;if(S.startsWith("delete")){if(Q.isExpanded(I)){var[Y,q]=Q.edges(I),T=le.leaf(t,Y.path);if(T.text.length===Y.offset&&q.offset===0){var j=w.next(t,{at:Y.path,match:ge.isText});j&&L.equals(j[1],q.path)&&(I={anchor:q,focus:q})}}var R=S.endsWith("Backward")?"backward":"forward",[M,U]=Q.edges(I),[X,W]=w.leaf(t,M.path),te={text:"",start:M.offset,end:U.offset},de=bt.get(t),J=de==null?void 0:de.find(oe=>L.equals(oe.path,W)),ve=J?[J.diff,te]:[te],me=Cm(X.text,...ve);if(me.length===0&&(E=!1),Q.isExpanded(I)){if(E&&L.equals(I.anchor.path,I.focus.path)){var ye={path:I.anchor.path,offset:M.offset},_e=w.range(t,ye,ye);return B(_e),b(I.anchor.path,{text:"",end:U.offset,start:M.offset})}return v(()=>w.deleteFragment(t,{direction:R}),{at:I})}}switch(S){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>w.deleteFragment(t),{at:I});case"deleteContent":case"deleteContentForward":{var{anchor:De}=I;if(E&&Q.isCollapsed(I)){var ze=le.leaf(t,De.path);if(De.offset<ze.text.length)return b(De.path,{text:"",start:De.offset,end:De.offset+1})}return v(()=>w.deleteForward(t),{at:I})}case"deleteContentBackward":{var We,{anchor:He}=I,Ke=eo(V)?V.isCollapsed:!!((We=V)!==null&&We!==void 0&&We.collapsed);return E&&Ke&&Q.isCollapsed(I)&&He.offset>0?b(He.path,{text:"",start:He.offset-1,end:He.offset}):v(()=>w.deleteBackward(t),{at:I})}case"deleteEntireSoftLine":return v(()=>{w.deleteBackward(t,{unit:"line"}),w.deleteForward(t,{unit:"line"})},{at:I});case"deleteHardLineBackward":return v(()=>w.deleteBackward(t,{unit:"block"}),{at:I});case"deleteSoftLineBackward":return v(()=>w.deleteBackward(t,{unit:"line"}),{at:I});case"deleteHardLineForward":return v(()=>w.deleteForward(t,{unit:"block"}),{at:I});case"deleteSoftLineForward":return v(()=>w.deleteForward(t,{unit:"line"}),{at:I});case"deleteWordBackward":return v(()=>w.deleteBackward(t,{unit:"word"}),{at:I});case"deleteWordForward":return v(()=>w.deleteForward(t,{unit:"word"}),{at:I});case"insertLineBreak":return v(()=>w.insertSoftBreak(t),{at:I});case"insertParagraph":return v(()=>w.insertBreak(t),{at:I});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(X1(H))return v(()=>re.insertData(t,H),{at:I});var Be=H??"";if($t.get(t)&&(Be=Be.replace("\uFEFF","")),S==="insertText"&&/.*\n.*\n$/.test(Be)&&(Be=Be.slice(0,-1)),Be.includes(`
76
+ `)&&d===l.textContent.length&&d--,"getAttribute"in l&&l.getAttribute("contenteditable")==="false"&&l.getAttribute("data-slate-void")!=="true"){var y;l=o,d=((y=o.textContent)===null||y===void 0?void 0:y.length)||0}var C=re.toSlatePoint(e,[o,u],{exactMatch:i,suppressThrow:a});if(!C)return null;var k=h?C:re.toSlatePoint(e,[l,d],{exactMatch:i,suppressThrow:a});if(!k)return null;var D={anchor:C,focus:k};return Q.isExpanded(D)&&Q.isForward(D)&&Ot(l)&&w.void(e,{at:D.focus,mode:"highest"})&&(D=w.unhangRange(e,D,{voids:!0})),D}};function W1(e,t){var{path:n,diff:r}=t;if(!w.hasPath(e,n))return!1;var i=le.get(e,n);if(!ge.isText(i))return!1;if(r.start!==i.text.length||r.text.length===0)return i.text.slice(r.start,r.start+r.text.length)===r.text;var a=L.next(n);if(!w.hasPath(e,a))return!1;var s=le.get(e,a);return ge.isText(s)&&s.text.startsWith(r.text)}function Cm(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.reduce((i,a)=>i.slice(0,a.start)+a.text+i.slice(a.end),e)}function V1(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++)if(e.charAt(r)!==t.charAt(r))return r;return n}function H1(e,t,n){for(var r=Math.min(e.length,t.length,n),i=0;i<r;i++)if(e.charAt(e.length-i-1)!==t.charAt(t.length-i-1))return i;return r}function Dm(e,t){var{start:n,end:r,text:i}=t,a=e.slice(n,r),s=V1(a,i),o=Math.min(a.length-s,i.length-s),u=H1(a,i,o),l={start:n+s,end:r-u,text:i.slice(s,i.length-u)};return l.start===l.end&&l.text.length===0?null:l}function K1(e,t,n){var r=Math.min(t.start,n.start),i=Math.max(0,Math.min(t.start+t.text.length,n.end)-n.start),a=Cm(e,t,n),s=Math.max(n.start+n.text.length,t.start+t.text.length+(t.start+t.text.length>n.start?n.text.length:0)-i),o=a.slice(r,s),u=Math.max(t.end,n.end-t.text.length+(t.end-t.start));return Dm(e,{start:r,end:u,text:o})}function Z1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function to(e,t){var{path:n,offset:r}=t;if(!w.hasPath(e,n))return null;var i=le.get(e,n);if(!ge.isText(i))return null;var a=w.above(e,{match:o=>he.isElement(o)&&w.isBlock(e,o),at:n});if(!a)return null;for(;r>i.text.length;){var s=w.next(e,{at:n,match:ge.isText});if(!s||!L.isDescendant(s[1],a[1]))return null;r-=i.text.length,i=s[0],n=s[1]}return{path:n,offset:r}}function hc(e,t){var n=to(e,t.anchor);if(!n)return null;if(Q.isCollapsed(t))return{anchor:n,focus:n};var r=to(e,t.focus);return r?{anchor:n,focus:r}:null}function no(e,t,n){var r=bt.get(e),i=r==null?void 0:r.find(d=>{var{path:h}=d;return L.equals(h,t.path)});if(!i||t.offset<=i.diff.start)return Se.transform(t,n,{affinity:"backward"});var{diff:a}=i;if(t.offset<=a.start+a.text.length){var s={path:t.path,offset:a.start},o=Se.transform(s,n,{affinity:"backward"});return o?{path:o.path,offset:o.offset+t.offset-a.start}:null}var u={path:t.path,offset:t.offset-a.text.length+a.end-a.start},l=Se.transform(u,n,{affinity:"backward"});return l?n.type==="split_node"&&L.equals(n.path,t.path)&&u.offset<n.position&&a.start<n.position?l:{path:l.path,offset:l.offset+a.text.length-a.end+a.start}:null}function pc(e,t,n){var r=no(e,t.anchor,n);if(!r)return null;if(Q.isCollapsed(t))return{anchor:r,focus:r};var i=no(e,t.focus,n);return i?{anchor:r,focus:i}:null}function Y1(e,t){var{path:n,diff:r,id:i}=e;switch(t.type){case"insert_text":return!L.equals(t.path,n)||t.offset>=r.end?e:t.offset<=r.start?{diff:{start:t.text.length+r.start,end:t.text.length+r.end,text:r.text},id:i,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:i,path:n};case"remove_text":return!L.equals(t.path,n)||t.offset>=r.end?e:t.offset+t.text.length<=r.start?{diff:{start:r.start-t.text.length,end:r.end-t.text.length,text:r.text},id:i,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:i,path:n};case"split_node":return!L.equals(t.path,n)||t.position>=r.end?{diff:r,id:i,path:L.transform(n,t,{affinity:"backward"})}:t.position>r.start?{diff:{start:r.start,end:Math.min(t.position,r.end),text:r.text},id:i,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:i,path:L.transform(n,t,{affinity:"forward"})};case"merge_node":return L.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:i,path:L.transform(n,t)}:{diff:r,id:i,path:L.transform(n,t)}}var a=L.transform(n,t);return a?{diff:r,path:a,id:i}:null}function gc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ki(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var G1=25,Q1=200,J1=function(){},X1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function ew(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,i=!1,a=null,s=null,o=null,u=0,l=!1,d=()=>{var A=pn.get(t);if(pn.delete(t),A){var{selection:F}=t,S=hc(t,A);S&&(!F||!Q.equals(S,F))&&ee.select(t,S)}},h=()=>{var A=hn.get(t);if(hn.delete(t),!!A){if(A.at){var F=Se.isPoint(A.at)?to(t,A.at):hc(t,A.at);if(!F)return;var S=w.range(t,F);(!t.selection||!Q.equals(t.selection,S))&&ee.select(t,F)}A.run()}},m=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!k()&&!C()){d();return}i||(i=!0,setTimeout(()=>i=!1)),C()&&(i="action");var A=t.selection&&w.rangeRef(t,t.selection,{affinity:"forward"});rn.set(t,t.marks),J1("flush",hn.get(t),bt.get(t));for(var F=k(),S;S=(I=bt.get(t))===null||I===void 0?void 0:I[0];){var I,H,V=$t.get(t);V!==void 0&&($t.delete(t),t.marks=V),V&&l===!1&&(l=null);var ae=Z1(S);(!t.selection||!Q.equals(t.selection,ae))&&ee.select(t,ae),S.diff.text?w.insertText(t,S.diff.text):w.deleteFragment(t),bt.set(t,(H=bt.get(t))===null||H===void 0?void 0:H.filter(Y=>{var{id:q}=Y;return q!==S.id})),W1(t,S)||(F=!1,hn.delete(t),rn.delete(t),i="action",pn.delete(t),n.cancel(),r.cancel(),A==null||A.unref())}var ne=A==null?void 0:A.unref();if(ne&&!pn.get(t)&&(!t.selection||!Q.equals(ne,t.selection))&&ee.select(t,ne),C()){h();return}F&&n(),n.flush(),r.flush(),d();var E=rn.get(t);rn.delete(t),E!==void 0&&(t.marks=E,t.onChange())},p=A=>{a&&clearTimeout(a),a=setTimeout(()=>{Bn.set(t,!1),m()},G1)},g=A=>{Bn.set(t,!0),a&&(clearTimeout(a),a=null)},f=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,S=Qs.get(t);if(S){if(k()||F){S.style.display="none";return}S.style.removeProperty("display")}},b=(A,F)=>{var S,I=(S=bt.get(t))!==null&&S!==void 0?S:[];bt.set(t,I);var H=le.leaf(t,A),V=I.findIndex(E=>L.equals(E.path,A));if(V<0){var ae=Dm(H.text,F);ae&&I.push({path:A,diff:F,id:u++}),f();return}var ne=K1(H.text,I[V].diff,F);if(!ne){I.splice(V,1),f();return}I[V]=ki(ki({},I[V]),{},{diff:ne})},v=function(F){var{at:S}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};l=!1,pn.delete(t),n.cancel(),r.cancel(),C()&&m(),hn.set(t,{at:S,run:F}),o=setTimeout(m)},y=A=>{var F;s&&(clearTimeout(s),s=null);var{inputType:S}=A,I=null,H=A.dataTransfer||A.data||void 0;l!==!1&&S!=="insertText"&&S!=="insertCompositionText"&&(l=!1);var[V]=A.getTargetRanges();V&&(I=re.toSlateRange(t,V,{exactMatch:!1,suppressThrow:!0}));var ae=re.getWindow(t),ne=ae.getSelection();if(!I&&ne&&(V=ne,I=re.toSlateRange(t,ne,{exactMatch:!1,suppressThrow:!0})),I=(F=I)!==null&&F!==void 0?F:t.selection,!!I){var E=!0;if(S.startsWith("delete")){if(Q.isExpanded(I)){var[Y,q]=Q.edges(I),T=le.leaf(t,Y.path);if(T.text.length===Y.offset&&q.offset===0){var j=w.next(t,{at:Y.path,match:ge.isText});j&&L.equals(j[1],q.path)&&(I={anchor:q,focus:q})}}var R=S.endsWith("Backward")?"backward":"forward",[N,U]=Q.edges(I),[X,W]=w.leaf(t,N.path),te={text:"",start:N.offset,end:U.offset},de=bt.get(t),J=de==null?void 0:de.find(oe=>L.equals(oe.path,W)),ve=J?[J.diff,te]:[te],me=Cm(X.text,...ve);if(me.length===0&&(E=!1),Q.isExpanded(I)){if(E&&L.equals(I.anchor.path,I.focus.path)){var ye={path:I.anchor.path,offset:N.offset},_e=w.range(t,ye,ye);return B(_e),b(I.anchor.path,{text:"",end:U.offset,start:N.offset})}return v(()=>w.deleteFragment(t,{direction:R}),{at:I})}}switch(S){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>w.deleteFragment(t),{at:I});case"deleteContent":case"deleteContentForward":{var{anchor:De}=I;if(E&&Q.isCollapsed(I)){var ze=le.leaf(t,De.path);if(De.offset<ze.text.length)return b(De.path,{text:"",start:De.offset,end:De.offset+1})}return v(()=>w.deleteForward(t),{at:I})}case"deleteContentBackward":{var We,{anchor:He}=I,Ke=eo(V)?V.isCollapsed:!!((We=V)!==null&&We!==void 0&&We.collapsed);return E&&Ke&&Q.isCollapsed(I)&&He.offset>0?b(He.path,{text:"",start:He.offset-1,end:He.offset}):v(()=>w.deleteBackward(t),{at:I})}case"deleteEntireSoftLine":return v(()=>{w.deleteBackward(t,{unit:"line"}),w.deleteForward(t,{unit:"line"})},{at:I});case"deleteHardLineBackward":return v(()=>w.deleteBackward(t,{unit:"block"}),{at:I});case"deleteSoftLineBackward":return v(()=>w.deleteBackward(t,{unit:"line"}),{at:I});case"deleteHardLineForward":return v(()=>w.deleteForward(t,{unit:"block"}),{at:I});case"deleteSoftLineForward":return v(()=>w.deleteForward(t,{unit:"line"}),{at:I});case"deleteWordBackward":return v(()=>w.deleteBackward(t,{unit:"word"}),{at:I});case"deleteWordForward":return v(()=>w.deleteForward(t,{unit:"word"}),{at:I});case"insertLineBreak":return v(()=>w.insertSoftBreak(t),{at:I});case"insertParagraph":return v(()=>w.insertBreak(t),{at:I});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(X1(H))return v(()=>re.insertData(t,H),{at:I});var Be=H??"";if($t.get(t)&&(Be=Be.replace("\uFEFF","")),S==="insertText"&&/.*\n.*\n$/.test(Be)&&(Be=Be.slice(0,-1)),Be.includes(`
77
77
  `))return v(()=>{var oe=Be.split(`
78
- `);oe.forEach((ce,pe)=>{ce&&w.insertText(t,ce),pe!==oe.length-1&&w.insertSoftBreak(t)})},{at:I});if(L.equals(I.anchor.path,I.focus.path)){var[Me,Ce]=Q.edges(I),G={start:Me.offset,end:Ce.offset,text:Be};if(Be&&l&&S==="insertCompositionText"){var se=l.start+l.text.search(/\S|$/),be=G.start+G.text.search(/\S|$/);be===se+1&&G.end===l.start+l.text.length?(G.start-=1,l=null,z()):l=!1}else S==="insertText"?l===null?l=G:l&&Q.isCollapsed(I)&&l.end+l.text.length===Me.offset?l=ki(ki({},l),{},{text:l.text+Be}):l=!1:l=!1;if(E){b(Me.path,G);return}}return v(()=>w.insertText(t,Be),{at:I})}}}},C=()=>!!hn.get(t),k=()=>{var A;return!!((A=bt.get(t))!==null&&A!==void 0&&A.length)},D=()=>C()||k(),_=()=>i,B=A=>{pn.set(t,A),s&&(clearTimeout(s),s=null);var{selection:F}=t;if(A){var S=!F||!L.equals(F.anchor.path,A.anchor.path),I=!F||!L.equals(F.anchor.path.slice(0,-1),A.anchor.path.slice(0,-1));(S&&l||I)&&(l=!1),(S||k())&&(s=setTimeout(h,Q1))}},P=()=>{(C()||!k())&&h()},N=A=>{k()||(f(!0),setTimeout(f))},z=()=>{C()||(o=setTimeout(h))},O=A=>{if(!(k()||C())&&A.some(S=>iu(t,S,A))){var F;(F=vm.get(t))===null||F===void 0||F()}};return{flush:h,scheduleFlush:z,hasPendingDiffs:k,hasPendingAction:C,hasPendingChanges:D,isFlushing:_,handleUserSelect:B,handleCompositionEnd:p,handleCompositionStart:g,handleDOMBeforeInput:y,handleKeyDown:N,handleDomMutations:O,handleInput:P}}function tw(){var e=x.useRef(!1);return x.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var ti=$i?x.useLayoutEffect:x.useEffect;function nw(e,t,n){var[r]=x.useState(()=>new MutationObserver(t));ti(()=>{r.takeRecords()}),x.useEffect(()=>{if(!e.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");return r.observe(e.current,n),()=>r.disconnect()},[r,e,n])}var rw=["node"];function vc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function iw(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var aw={subtree:!0,childList:!0,characterData:!0},sw=mt?e=>{var{node:t}=e,n=mr(e,rw);if(!mt)return null;var r=En(),i=tw(),[a]=x.useState(()=>ew(iw({editor:r},n)));return nw(t,a.handleDomMutations,aw),nu.set(r,a.scheduleFlush),i&&a.flush(),a}:()=>null,ow=["anchor","focus"],uw=["anchor","focus"],lw=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),Em=(e,t)=>{var n=mr(e,ow),r=mr(t,uw);return e[hr]===t[hr]&&lw(n,r)},cw=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],i=t[n];if(!Q.equals(r,i)||!Em(r,i))return!1}return!0},dw=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],i=t[n];if(r.anchor.offset!==i.anchor.offset||r.focus.offset!==i.focus.offset||!Em(r,i))return!1}return!0};function bc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function fw(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var mw=e=>{var{isLast:t,leaf:n,parent:r,text:i}=e,a=En(),s=re.findPath(a,i),o=L.parent(s),u=!!n[bm];return a.isVoid(r)?x.createElement(rs,{length:le.string(r).length}):n.text===""&&r.children[r.children.length-1]===i&&!a.isInline(r)&&w.string(a,o)===""?x.createElement(rs,{isLineBreak:!0,isMarkPlaceholder:u}):n.text===""?x.createElement(rs,{isMarkPlaceholder:u}):t&&n.text.slice(-1)===`
78
+ `);oe.forEach((ce,pe)=>{ce&&w.insertText(t,ce),pe!==oe.length-1&&w.insertSoftBreak(t)})},{at:I});if(L.equals(I.anchor.path,I.focus.path)){var[Me,Ce]=Q.edges(I),G={start:Me.offset,end:Ce.offset,text:Be};if(Be&&l&&S==="insertCompositionText"){var se=l.start+l.text.search(/\S|$/),be=G.start+G.text.search(/\S|$/);be===se+1&&G.end===l.start+l.text.length?(G.start-=1,l=null,z()):l=!1}else S==="insertText"?l===null?l=G:l&&Q.isCollapsed(I)&&l.end+l.text.length===Me.offset?l=ki(ki({},l),{},{text:l.text+Be}):l=!1:l=!1;if(E){b(Me.path,G);return}}return v(()=>w.insertText(t,Be),{at:I})}}}},C=()=>!!hn.get(t),k=()=>{var A;return!!((A=bt.get(t))!==null&&A!==void 0&&A.length)},D=()=>C()||k(),_=()=>i,B=A=>{pn.set(t,A),s&&(clearTimeout(s),s=null);var{selection:F}=t;if(A){var S=!F||!L.equals(F.anchor.path,A.anchor.path),I=!F||!L.equals(F.anchor.path.slice(0,-1),A.anchor.path.slice(0,-1));(S&&l||I)&&(l=!1),(S||k())&&(s=setTimeout(m,Q1))}},M=()=>{(C()||!k())&&m()},P=A=>{k()||(f(!0),setTimeout(f))},z=()=>{C()||(o=setTimeout(m))},O=A=>{if(!(k()||C())&&A.some(S=>iu(t,S,A))){var F;(F=vm.get(t))===null||F===void 0||F()}};return{flush:m,scheduleFlush:z,hasPendingDiffs:k,hasPendingAction:C,hasPendingChanges:D,isFlushing:_,handleUserSelect:B,handleCompositionEnd:p,handleCompositionStart:g,handleDOMBeforeInput:y,handleKeyDown:P,handleDomMutations:O,handleInput:M}}function tw(){var e=x.useRef(!1);return x.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var ti=$i?x.useLayoutEffect:x.useEffect;function nw(e,t,n){var[r]=x.useState(()=>new MutationObserver(t));ti(()=>{r.takeRecords()}),x.useEffect(()=>{if(!e.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");return r.observe(e.current,n),()=>r.disconnect()},[r,e,n])}var rw=["node"];function vc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function iw(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var aw={subtree:!0,childList:!0,characterData:!0},sw=mt?e=>{var{node:t}=e,n=mr(e,rw);if(!mt)return null;var r=En(),i=tw(),[a]=x.useState(()=>ew(iw({editor:r},n)));return nw(t,a.handleDomMutations,aw),nu.set(r,a.scheduleFlush),i&&a.flush(),a}:()=>null,ow=["anchor","focus"],uw=["anchor","focus"],lw=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),Em=(e,t)=>{var n=mr(e,ow),r=mr(t,uw);return e[hr]===t[hr]&&lw(n,r)},cw=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],i=t[n];if(!Q.equals(r,i)||!Em(r,i))return!1}return!0},dw=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],i=t[n];if(r.anchor.offset!==i.anchor.offset||r.focus.offset!==i.focus.offset||!Em(r,i))return!1}return!0};function bc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function fw(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var mw=e=>{var{isLast:t,leaf:n,parent:r,text:i}=e,a=En(),s=re.findPath(a,i),o=L.parent(s),u=!!n[bm];return a.isVoid(r)?x.createElement(rs,{length:le.string(r).length}):n.text===""&&r.children[r.children.length-1]===i&&!a.isInline(r)&&w.string(a,o)===""?x.createElement(rs,{isLineBreak:!0,isMarkPlaceholder:u}):n.text===""?x.createElement(rs,{isMarkPlaceholder:u}):t&&n.text.slice(-1)===`
79
79
  `?x.createElement(yc,{isTrailing:!0,text:n.text}):x.createElement(yc,{text:n.text})},yc=e=>{var{text:t,isTrailing:n=!1}=e,r=x.useRef(null),i=()=>"".concat(t??"").concat(n?`
80
- `:""),[a]=x.useState(i);return ti(()=>{var s=i();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),x.createElement(hw,{ref:r},a)},hw=x.memo(x.forwardRef((e,t)=>x.createElement("span",{"data-slate-string":!0,ref:t},e.children))),rs=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,i={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(i["data-slate-mark-placeholder"]=!0),x.createElement("span",fw({},i),!mt||!n?"\uFEFF":null,n?x.createElement("br",null):null)};function xc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _m(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var pw=mt?300:0;function gw(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function wc(e){e.current&&(clearTimeout(e.current),e.current=null)}var vw=e=>{var{leaf:t,isLast:n,text:r,parent:i,renderPlaceholder:a,renderLeaf:s=y=>x.createElement(yw,_m({},y))}=e,o=En(),u=x.useRef(null),l=x.useRef(null),[d,m]=x.useState(!1),h=x.useRef(null),p=x.useCallback(y=>{if(gw(u,y==null),y==null){var C;Qs.delete(o),(C=t.onPlaceholderResize)===null||C===void 0||C.call(t,null)}else{if(Qs.set(o,y),!u.current){var k=window.ResizeObserver||y1;u.current=new k(()=>{var D;(D=t.onPlaceholderResize)===null||D===void 0||D.call(t,y)})}u.current.observe(y),l.current=y}},[l,t,o]),g=x.createElement(mw,{isLast:n,leaf:t,parent:i,text:r}),f=!!t[hr];if(x.useEffect(()=>(f?h.current||(h.current=setTimeout(()=>{m(!0),h.current=null},pw)):(wc(h),m(!1)),()=>wc(h)),[f,m]),f&&d){var b={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:Mr?"inherit":void 0},contentEditable:!1,ref:p}};g=x.createElement(x.Fragment,null,a(b),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},bw=x.memo(vw,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&ge.equals(t.leaf,e.leaf)&&t.leaf[hr]===e.leaf[hr]),yw=e=>{var{attributes:t,children:n}=e;return x.createElement("span",_m({},t),n)},xw=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:i,renderLeaf:a,text:s}=e,o=En(),u=x.useRef(null),l=ge.decorations(s,t),d=re.findKey(o,s),m=[],h=0;h<l.length;h++){var p=l[h];m.push(x.createElement(bw,{isLast:n&&h===l.length-1,key:"".concat(d.id,"-").concat(h),renderPlaceholder:i,leaf:p,text:s,parent:r,renderLeaf:a}))}var g=x.useCallback(f=>{var b=Ea.get(o);f?(b==null||b.set(d,f),Pn.set(s,f),ei.set(f,s)):(b==null||b.delete(d),Pn.delete(s),u.current&&ei.delete(u.current)),u.current=f},[u,o,d,s]);return x.createElement("span",{"data-slate-node":"text",ref:g},m)},km=x.memo(xw,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&dw(t.decorations,e.decorations));function Cc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ro(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ww=e=>{var{decorations:t,element:n,renderElement:r=y=>x.createElement(Dw,ro({},y)),renderPlaceholder:i,renderLeaf:a,selection:s}=e,o=En(),u=kw(),l=o.isInline(n),d=re.findKey(o,n),m=x.useCallback(y=>{var C=Ea.get(o);y?(C==null||C.set(d,y),Pn.set(n,y),ei.set(y,n)):(C==null||C.delete(d),Pn.delete(n))},[o,d,n]),h=Am({decorations:t,node:n,renderElement:r,renderPlaceholder:i,renderLeaf:a,selection:s}),p={"data-slate-node":"element",ref:m};if(l&&(p["data-slate-inline"]=!0),!l&&w.hasInlines(o,n)){var g=le.string(n),f=Uf(g);f==="rtl"&&(p.dir=f)}if(w.isVoid(o,n)){p["data-slate-void"]=!0,!u&&l&&(p.contentEditable=!1);var b=l?"span":"div",[[v]]=le.texts(n);h=x.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},x.createElement(km,{renderPlaceholder:i,decorations:[],isLast:!1,parent:n,text:v})),eu.set(v,0),tu.set(v,n)}return r({attributes:p,children:h,element:n})},Cw=x.memo(ww,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&cw(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&Q.equals(e.selection,t.selection))),Dw=e=>{var{attributes:t,children:n,element:r}=e,i=En(),a=i.isInline(r)?"span":"div";return x.createElement(a,ro(ro({},t),{},{style:{position:"relative"}}),n)},Fm=x.createContext(()=>[]),Ew=()=>x.useContext(Fm),_w=x.createContext(!1),Am=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:i,renderLeaf:a,selection:s}=e,o=Ew(),u=En(),l=re.findPath(u,n),d=[],m=he.isElement(n)&&!u.isInline(n)&&w.hasInlines(u,n),h=0;h<n.children.length;h++){var p=l.concat(h),g=n.children[h],f=re.findKey(u,g),b=w.range(u,p),v=s&&Q.intersection(b,s),y=o([g,p]);for(var C of t){var k=Q.intersection(C,b);k&&y.push(k)}he.isElement(g)?d.push(x.createElement(_w.Provider,{key:"provider-".concat(f.id),value:!!v},x.createElement(Cw,{decorations:y,element:g,key:f.id,renderElement:r,renderPlaceholder:i,renderLeaf:a,selection:v}))):d.push(x.createElement(km,{decorations:y,key:f.id,isLast:m&&h===n.children.length-1,parent:n,renderPlaceholder:i,renderLeaf:a,text:g})),eu.set(g,h),tu.set(g,n)}return d},Tm=x.createContext(!1),kw=()=>x.useContext(Tm),Bm=x.createContext(null),zn=()=>{var e=x.useContext(Bm);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function Fw(){var e=En(),t=x.useRef(!1),n=x.useRef(0),r=x.useCallback(()=>{if(!t.current){t.current=!0;var i=re.getWindow(e);i.cancelAnimationFrame(n.current),n.current=i.requestAnimationFrame(()=>{t.current=!1})}},[e]);return x.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var Aw=3,Tw={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",insertSoftBreak:"shift+enter",splitBlock:"enter",undo:"mod+z"},Bw={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},Sw={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ge=e=>{var t=Tw[e],n=Bw[e],r=Sw[e],i=t&&ns(t),a=n&&ns(n),s=r&&ns(r);return o=>!!(i&&i(o)||mc&&a&&a(o)||!mc&&s&&s(o))},Je={isBold:Ge("bold"),isCompose:Ge("compose"),isMoveBackward:Ge("moveBackward"),isMoveForward:Ge("moveForward"),isDeleteBackward:Ge("deleteBackward"),isDeleteForward:Ge("deleteForward"),isDeleteLineBackward:Ge("deleteLineBackward"),isDeleteLineForward:Ge("deleteLineForward"),isDeleteWordBackward:Ge("deleteWordBackward"),isDeleteWordForward:Ge("deleteWordForward"),isExtendBackward:Ge("extendBackward"),isExtendForward:Ge("extendForward"),isExtendLineBackward:Ge("extendLineBackward"),isExtendLineForward:Ge("extendLineForward"),isItalic:Ge("italic"),isMoveLineBackward:Ge("moveLineBackward"),isMoveLineForward:Ge("moveLineForward"),isMoveWordBackward:Ge("moveWordBackward"),isMoveWordForward:Ge("moveWordForward"),isRedo:Ge("redo"),isSoftBreak:Ge("insertSoftBreak"),isSplitBlock:Ge("splitBlock"),isTransposeCharacter:Ge("transposeCharacter"),isUndo:Ge("undo")},jw=(e,t)=>{var n=[],r=()=>{n=[]},i=s=>{if(t.current){var o=s.filter(u=>iu(e,u,s));n.push(...o)}};function a(){n.length>0&&(n.reverse().forEach(s=>{s.type!=="characterData"&&(s.removedNodes.forEach(o=>{s.target.insertBefore(o,s.nextSibling)}),s.addedNodes.forEach(o=>{s.target.removeChild(o)}))}),r())}return{registerMutations:i,restoreDOM:a,clear:r}},Pw={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Sm extends x.Component{constructor(){super(...arguments),Mt(this,"context",null),Mt(this,"manager",null),Mt(this,"mutationObserver",null)}observe(){var t,{node:n}=this.props;if(!n.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");(t=this.mutationObserver)===null||t===void 0||t.observe(n.current,Pw)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=jw(n,t),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var t,n,r,i=(t=this.mutationObserver)===null||t===void 0?void 0:t.takeRecords();if(i!=null&&i.length){var a;(a=this.manager)===null||a===void 0||a.registerMutations(i)}return(n=this.mutationObserver)===null||n===void 0||n.disconnect(),(r=this.manager)===null||r===void 0||r.restoreDOM(),null}componentDidUpdate(){var t;(t=this.manager)===null||t===void 0||t.clear(),this.observe()}componentWillUnmount(){var t;(t=this.mutationObserver)===null||t===void 0||t.disconnect()}render(){return this.props.children}}Mt(Sm,"contextType",Xo);var Ow=mt?Sm:e=>{var{children:t}=e;return x.createElement(x.Fragment,null,t)},Mw=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],Nw=["text"];function Dc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Wt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Dc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Iw=e=>x.createElement(x.Fragment,null,Am(e)),Rw=e=>{var t=x.useCallback(j=>x.createElement($w,Wt({},j)),[]),{autoFocus:n,decorate:r=Lw,onDOMBeforeInput:i,placeholder:a,readOnly:s=!1,renderElement:o,renderLeaf:u,renderPlaceholder:l=t,scrollSelectionIntoView:d=zw,style:m={},as:h="div",disableDefaultStyles:p=!1}=e,g=mr(e,Mw),f=zn(),[b,v]=x.useState(!1),y=x.useRef(null),C=x.useRef([]),[k,D]=x.useState(),{onUserInput:_,receivedUserInput:B}=Fw(),[,P]=x.useReducer(j=>j+1,0);vm.set(f,P),Js.set(f,s);var N=x.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);x.useEffect(()=>{y.current&&n&&y.current.focus()},[n]);var z=x.useRef(),O=x.useMemo(()=>b0(()=>{var j=z.current;if((mt||!re.isComposing(f))&&(!N.isUpdatingSelection||j!=null&&j.isFlushing())&&!N.isDraggingInternally){var R=re.findDocumentOrShadowRoot(f),{activeElement:M}=R,U=re.toDOMNode(f,f),X=R.getSelection();if(M===U?(N.latestElement=M,bn.set(f,!0)):bn.delete(f),!X)return ee.deselect(f);var{anchorNode:W,focusNode:te}=X,de=re.hasEditableTarget(f,W)||re.isTargetInsideNonReadonlyVoid(f,W),J=re.hasEditableTarget(f,te)||re.isTargetInsideNonReadonlyVoid(f,te);if(de&&J){var ve=re.toSlateRange(f,X,{exactMatch:!1,suppressThrow:!0});ve&&(!re.isComposing(f)&&!(j!=null&&j.hasPendingChanges())&&!(j!=null&&j.isFlushing())?ee.select(f,ve):j==null||j.handleUserSelect(ve))}s&&(!de||!J)&&ee.deselect(f)}},100),[f,s,N]),A=x.useMemo(()=>f0(O,0),[O]);z.current=sw({node:y,onDOMSelectionChange:O,scheduleOnDOMSelectionChange:A}),ti(()=>{var j,R,M;y.current&&(M=ru(y.current))?(gm.set(f,M),Li.set(f,y.current),Pn.set(f,y.current),ei.set(y.current,f)):Pn.delete(f);var{selection:U}=f,X=re.findDocumentOrShadowRoot(f),W=X.getSelection();if(!(!W||!re.isFocused(f)||(j=z.current)!==null&&j!==void 0&&j.hasPendingAction())){var te=me=>{var ye=W.type!=="None";if(!(!U&&!ye)){var _e=W.focusNode,De;if(er&&W.rangeCount>1){var ze=W.getRangeAt(0),We=W.getRangeAt(W.rangeCount-1);ze.startContainer===_e?De=We.endContainer:De=ze.startContainer}else De=W.anchorNode;var He=Li.get(f),Ke=!1;if(He.contains(De)&&He.contains(_e)&&(Ke=!0),ye&&Ke&&U&&!me){var Be=re.toSlateRange(f,W,{exactMatch:!0,suppressThrow:!0});if(Be&&Q.equals(Be,U)){var Me;if(!N.hasMarkPlaceholder||(Me=De)!==null&&Me!==void 0&&(Me=Me.parentElement)!==null&&Me!==void 0&&Me.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!re.hasRange(f,U)){f.selection=re.toSlateRange(f,W,{exactMatch:!1,suppressThrow:!0});return}N.isUpdatingSelection=!0;var Ce=U&&re.toDOMRange(f,U);return Ce?(re.isComposing(f)&&!mt?W.collapseToEnd():Q.isBackward(U)?W.setBaseAndExtent(Ce.endContainer,Ce.endOffset,Ce.startContainer,Ce.startOffset):W.setBaseAndExtent(Ce.startContainer,Ce.startOffset,Ce.endContainer,Ce.endOffset),d(f,Ce)):W.removeAllRanges(),Ce}};W.rangeCount<=1&&te();var de=((R=z.current)===null||R===void 0?void 0:R.isFlushing())==="action";if(!mt||!de){setTimeout(()=>{N.isUpdatingSelection=!1});return}var J=null,ve=requestAnimationFrame(()=>{if(de){var me=ye=>{try{var _e=re.toDOMNode(f,f);_e.focus(),te(ye)}catch{}};me(),J=setTimeout(()=>{me(!0),N.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ve),J&&clearTimeout(J)}}});var F=x.useCallback(j=>{if(_(),!s&&re.hasEditableTarget(f,j.target)&&!qw(j,i)){var R;if(z.current)return z.current.handleDOMBeforeInput(j);A.flush(),O.flush();var{selection:M}=f,{inputType:U}=j,X=j.dataTransfer||j.data||void 0,W=U==="insertCompositionText"||U==="deleteCompositionText";if(W&&re.isComposing(f))return;var te=!1;if(U==="insertText"&&M&&Q.isCollapsed(M)&&j.data&&j.data.length===1&&/[a-z ]/i.test(j.data)&&M.anchor.offset!==0){var de,J;te=!0,f.marks&&(te=!1);var{anchor:ve}=M,[me,ye]=re.toDOMPoint(f,ve),_e=(de=me.parentElement)===null||de===void 0?void 0:de.closest("a"),De=re.getWindow(f);if(te&&_e&&re.hasDOMNode(f,_e)){var ze,We=De==null?void 0:De.document.createTreeWalker(_e,NodeFilter.SHOW_TEXT).lastChild();We===me&&((ze=We.textContent)===null||ze===void 0?void 0:ze.length)===ye&&(te=!1)}if(te&&me.parentElement&&(De==null||(J=De.getComputedStyle(me.parentElement))===null||J===void 0?void 0:J.whiteSpace)==="pre"){var He=w.above(f,{at:ve.path,match:se=>he.isElement(se)&&w.isBlock(f,se)});He&&le.string(He[0]).includes(" ")&&(te=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[Ke]=j.getTargetRanges();if(Ke){var Be=re.toSlateRange(f,Ke,{exactMatch:!1,suppressThrow:!1});if(!M||!Q.equals(M,Be)){te=!1;var Me=!W&&f.selection&&w.rangeRef(f,f.selection);ee.select(f,Be),Me&&Lr.set(f,Me)}}}if(W)return;if(te||j.preventDefault(),M&&Q.isExpanded(M)&&U.startsWith("delete")){var Ce=U.endsWith("Backward")?"backward":"forward";w.deleteFragment(f,{direction:Ce});return}switch(U){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{w.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{w.deleteForward(f);break}case"deleteContentBackward":{w.deleteBackward(f);break}case"deleteEntireSoftLine":{w.deleteBackward(f,{unit:"line"}),w.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{w.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{w.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{w.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{w.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{w.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{w.deleteForward(f,{unit:"word"});break}case"insertLineBreak":w.insertSoftBreak(f);break;case"insertParagraph":{w.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{U==="insertFromComposition"&&re.isComposing(f)&&(v(!1),Bn.set(f,!1)),(X==null?void 0:X.constructor.name)==="DataTransfer"?re.insertData(f,X):typeof X=="string"&&(te?C.current.push(()=>w.insertText(f,X)):w.insertText(f,X));break}}var G=(R=Lr.get(f))===null||R===void 0?void 0:R.unref();Lr.delete(f),G&&(!f.selection||!Q.equals(f.selection,G))&&ee.select(f,G)}},[f,O,_,i,s,A]),S=x.useCallback(j=>{j==null?(O.cancel(),A.cancel(),Li.delete(f),Pn.delete(f),y.current&&fn&&y.current.removeEventListener("beforeinput",F)):fn&&j.addEventListener("beforeinput",F),y.current=j},[O,A,f,F]);ti(()=>{var j=re.getWindow(f);return j.document.addEventListener("selectionchange",A),()=>{j.document.removeEventListener("selectionchange",A)}},[A]);var I=r([f,[]]),H=a&&f.children.length===1&&Array.from(le.texts(f)).length===1&&le.string(f)===""&&!b,V=x.useCallback(j=>{if(j&&H){var R;D((R=j.getBoundingClientRect())===null||R===void 0?void 0:R.height)}else D(void 0)},[H]);if(H){var ae=w.start(f,[]);I.push({[hr]:!0,placeholder:a,onPlaceholderResize:V,anchor:ae,focus:ae})}var{marks:ne}=f;if(N.hasMarkPlaceholder=!1,f.selection&&Q.isCollapsed(f.selection)&&ne){var{anchor:E}=f.selection,Y=le.leaf(f,E.path),q=mr(Y,Nw);if(!ge.equals(Y,ne,{loose:!0})){N.hasMarkPlaceholder=!0;var T=Object.fromEntries(Object.keys(q).map(j=>[j,null]));I.push(Wt(Wt(Wt({[bm]:!0},T),ne),{},{anchor:E,focus:E}))}}return x.useEffect(()=>{setTimeout(()=>{var{selection:j}=f;if(j){var{anchor:R}=j,M=le.leaf(f,R.path);if(ne&&!ge.equals(M,ne,{loose:!0})){$t.set(f,ne);return}}$t.delete(f)})}),x.createElement(Tm.Provider,{value:s},x.createElement(Fm.Provider,{value:r},x.createElement(Ow,{node:y,receivedUserInput:B},x.createElement(h,Wt(Wt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:fn||!$i?g.spellCheck:!1,autoCorrect:fn||!$i?g.autoCorrect:"false",autoCapitalize:fn||!$i?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:S,style:Wt(Wt({},p?{}:Wt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},k?{minHeight:k}:{})),m),onBeforeInput:x.useCallback(j=>{if(!fn&&!s&&!dt(j,g.onBeforeInput)&&re.hasSelectableTarget(f,j.target)&&(j.preventDefault(),!re.isComposing(f))){var R=j.data;w.insertText(f,R)}},[g.onBeforeInput,f,s]),onInput:x.useCallback(j=>{if(!dt(j,g.onInput)){if(z.current){z.current.handleInput();return}for(var R of C.current)R();C.current=[]}},[g.onInput]),onBlur:x.useCallback(j=>{if(!(s||N.isUpdatingSelection||!re.hasSelectableTarget(f,j.target)||dt(j,g.onBlur))){var R=re.findDocumentOrShadowRoot(f);if(N.latestElement!==R.activeElement){var{relatedTarget:M}=j,U=re.toDOMNode(f,f);if(M!==U&&!(Ot(M)&&M.hasAttribute("data-slate-spacer"))){if(M!=null&&xn(M)&&re.hasDOMNode(f,M)){var X=re.toSlateNode(f,M);if(he.isElement(X)&&!f.isVoid(X))return}if(Mr){var W=R.getSelection();W==null||W.removeAllRanges()}bn.delete(f)}}}},[s,N.isUpdatingSelection,N.latestElement,f,g.onBlur]),onClick:x.useCallback(j=>{if(re.hasTarget(f,j.target)&&!dt(j,g.onClick)&&xn(j.target)){var R=re.toSlateNode(f,j.target),M=re.findPath(f,R);if(!w.hasPath(f,M)||le.get(f,M)!==R)return;if(j.detail===Aw&&M.length>=1){var U=M;if(!(he.isElement(R)&&w.isBlock(f,R))){var X,W=w.above(f,{match:_e=>he.isElement(_e)&&w.isBlock(f,_e),at:M});U=(X=W==null?void 0:W[1])!==null&&X!==void 0?X:M.slice(0,1)}var te=w.range(f,U);ee.select(f,te);return}if(s)return;var de=w.start(f,M),J=w.end(f,M),ve=w.void(f,{at:de}),me=w.void(f,{at:J});if(ve&&me&&L.equals(ve[1],me[1])){var ye=w.range(f,de);ee.select(f,ye)}}},[f,g.onClick,s]),onCompositionEnd:x.useCallback(j=>{if(re.hasSelectableTarget(f,j.target)){var R;if(re.isComposing(f)&&Promise.resolve().then(()=>{v(!1),Bn.set(f,!1)}),(R=z.current)===null||R===void 0||R.handleCompositionEnd(j),dt(j,g.onCompositionEnd)||mt)return;if(!Mr&&!S1&&!F1&&!P1&&!j1&&j.data){var M=$t.get(f);$t.delete(f),M!==void 0&&(rn.set(f,f.marks),f.marks=M),w.insertText(f,j.data);var U=rn.get(f);rn.delete(f),U!==void 0&&(f.marks=U)}}},[g.onCompositionEnd,f]),onCompositionUpdate:x.useCallback(j=>{re.hasSelectableTarget(f,j.target)&&!dt(j,g.onCompositionUpdate)&&(re.isComposing(f)||(v(!0),Bn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:x.useCallback(j=>{if(re.hasSelectableTarget(f,j.target)){var R;if((R=z.current)===null||R===void 0||R.handleCompositionStart(j),dt(j,g.onCompositionStart)||mt)return;v(!0);var{selection:M}=f;if(M&&Q.isExpanded(M)){w.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:x.useCallback(j=>{re.hasSelectableTarget(f,j.target)&&!dt(j,g.onCopy)&&!Ec(j)&&(j.preventDefault(),re.setFragmentData(f,j.clipboardData,"copy"))},[g.onCopy,f]),onCut:x.useCallback(j=>{if(!s&&re.hasSelectableTarget(f,j.target)&&!dt(j,g.onCut)&&!Ec(j)){j.preventDefault(),re.setFragmentData(f,j.clipboardData,"cut");var{selection:R}=f;if(R)if(Q.isExpanded(R))w.deleteFragment(f);else{var M=le.parent(f,R.anchor.path);w.isVoid(f,M)&&ee.delete(f)}}},[s,f,g.onCut]),onDragOver:x.useCallback(j=>{if(re.hasTarget(f,j.target)&&!dt(j,g.onDragOver)){var R=re.toSlateNode(f,j.target);he.isElement(R)&&w.isVoid(f,R)&&j.preventDefault()}},[g.onDragOver,f]),onDragStart:x.useCallback(j=>{if(!s&&re.hasTarget(f,j.target)&&!dt(j,g.onDragStart)){var R=re.toSlateNode(f,j.target),M=re.findPath(f,R),U=he.isElement(R)&&w.isVoid(f,R)||w.void(f,{at:M,voids:!0});if(U){var X=w.range(f,M);ee.select(f,X)}N.isDraggingInternally=!0,re.setFragmentData(f,j.dataTransfer,"drag")}},[s,f,g.onDragStart,N]),onDrop:x.useCallback(j=>{if(!s&&re.hasTarget(f,j.target)&&!dt(j,g.onDrop)){j.preventDefault();var R=f.selection,M=re.findEventRange(f,j),U=j.dataTransfer;ee.select(f,M),N.isDraggingInternally&&R&&!Q.equals(R,M)&&!w.void(f,{at:M,voids:!0})&&ee.delete(f,{at:R}),re.insertData(f,U),re.isFocused(f)||re.focus(f)}N.isDraggingInternally=!1},[s,f,g.onDrop,N]),onDragEnd:x.useCallback(j=>{!s&&N.isDraggingInternally&&g.onDragEnd&&re.hasTarget(f,j.target)&&g.onDragEnd(j),N.isDraggingInternally=!1},[s,N,g,f]),onFocus:x.useCallback(j=>{if(!s&&!N.isUpdatingSelection&&re.hasEditableTarget(f,j.target)&&!dt(j,g.onFocus)){var R=re.toDOMNode(f,f),M=re.findDocumentOrShadowRoot(f);if(N.latestElement=M.activeElement,er&&j.target!==R){R.focus();return}bn.set(f,!0)}},[s,N,f,g.onFocus]),onKeyDown:x.useCallback(j=>{if(!s&&re.hasEditableTarget(f,j.target)){var R;(R=z.current)===null||R===void 0||R.handleKeyDown(j);var{nativeEvent:M}=j;if(re.isComposing(f)&&M.isComposing===!1&&(Bn.set(f,!1),v(!1)),dt(j,g.onKeyDown)||re.isComposing(f))return;var{selection:U}=f,X=f.children[U!==null?U.focus.path[0]:0],W=Uf(le.string(X))==="rtl";if(Je.isRedo(M)){j.preventDefault();var te=f;typeof te.redo=="function"&&te.redo();return}if(Je.isUndo(M)){j.preventDefault();var de=f;typeof de.undo=="function"&&de.undo();return}if(Je.isMoveLineBackward(M)){j.preventDefault(),ee.move(f,{unit:"line",reverse:!0});return}if(Je.isMoveLineForward(M)){j.preventDefault(),ee.move(f,{unit:"line"});return}if(Je.isExtendLineBackward(M)){j.preventDefault(),ee.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Je.isExtendLineForward(M)){j.preventDefault(),ee.move(f,{unit:"line",edge:"focus"});return}if(Je.isMoveBackward(M)){j.preventDefault(),U&&Q.isCollapsed(U)?ee.move(f,{reverse:!W}):ee.collapse(f,{edge:W?"end":"start"});return}if(Je.isMoveForward(M)){j.preventDefault(),U&&Q.isCollapsed(U)?ee.move(f,{reverse:W}):ee.collapse(f,{edge:W?"start":"end"});return}if(Je.isMoveWordBackward(M)){j.preventDefault(),U&&Q.isExpanded(U)&&ee.collapse(f,{edge:"focus"}),ee.move(f,{unit:"word",reverse:!W});return}if(Je.isMoveWordForward(M)){j.preventDefault(),U&&Q.isExpanded(U)&&ee.collapse(f,{edge:"focus"}),ee.move(f,{unit:"word",reverse:W});return}if(fn){if((pm||Mr)&&U&&(Je.isDeleteBackward(M)||Je.isDeleteForward(M))&&Q.isCollapsed(U)){var J=le.parent(f,U.anchor.path);if(he.isElement(J)&&w.isVoid(f,J)&&(w.isInline(f,J)||w.isBlock(f,J))){j.preventDefault(),w.deleteBackward(f,{unit:"block"});return}}}else{if(Je.isBold(M)||Je.isItalic(M)||Je.isTransposeCharacter(M)){j.preventDefault();return}if(Je.isSoftBreak(M)){j.preventDefault(),w.insertSoftBreak(f);return}if(Je.isSplitBlock(M)){j.preventDefault(),w.insertBreak(f);return}if(Je.isDeleteBackward(M)){j.preventDefault(),U&&Q.isExpanded(U)?w.deleteFragment(f,{direction:"backward"}):w.deleteBackward(f);return}if(Je.isDeleteForward(M)){j.preventDefault(),U&&Q.isExpanded(U)?w.deleteFragment(f,{direction:"forward"}):w.deleteForward(f);return}if(Je.isDeleteLineBackward(M)){j.preventDefault(),U&&Q.isExpanded(U)?w.deleteFragment(f,{direction:"backward"}):w.deleteBackward(f,{unit:"line"});return}if(Je.isDeleteLineForward(M)){j.preventDefault(),U&&Q.isExpanded(U)?w.deleteFragment(f,{direction:"forward"}):w.deleteForward(f,{unit:"line"});return}if(Je.isDeleteWordBackward(M)){j.preventDefault(),U&&Q.isExpanded(U)?w.deleteFragment(f,{direction:"backward"}):w.deleteBackward(f,{unit:"word"});return}if(Je.isDeleteWordForward(M)){j.preventDefault(),U&&Q.isExpanded(U)?w.deleteFragment(f,{direction:"forward"}):w.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:x.useCallback(j=>{!s&&re.hasEditableTarget(f,j.target)&&!dt(j,g.onPaste)&&(!fn||N1(j.nativeEvent)||Mr)&&(j.preventDefault(),re.insertData(f,j.clipboardData))},[s,f,g.onPaste])}),x.createElement(Iw,{decorations:I,node:f,renderElement:o,renderPlaceholder:l,renderLeaf:u,selection:f.selection})))))},$w=e=>{var{attributes:t,children:n}=e;return x.createElement("span",Wt({},t),n,mt&&x.createElement("br",null))},Lw=()=>[],zw=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&Q.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),w0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},dt=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},Ec=e=>xn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),qw=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},Uw=x.createContext(!1),Ww=x.createContext({});function Vw(e){var t=x.useRef([]).current,n=x.useRef({editor:e}).current,r=x.useCallback(a=>{n.editor=a,t.forEach(s=>s(a))},[t,n]),i=x.useMemo(()=>({getSlate:()=>n.editor,addEventListener:a=>(t.push(a),()=>{t.splice(t.indexOf(a),1)})}),[t,n]);return{selectorContext:i,onChange:r}}var Hw=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],Kw=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:i,onValueChange:a,initialValue:s}=e,o=mr(e,Hw),[u,l]=x.useState(()=>{if(!le.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(at.stringify(s)));if(!w.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(at.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:m}=Vw(t),h=x.useCallback(f=>{var b;switch(r&&r(t.children),f==null||(b=f.operation)===null||b===void 0?void 0:b.type){case"set_selection":i==null||i(t.selection);break;default:a==null||a(t.children)}l(v=>({v:v.v+1,editor:t})),m(t)},[t,m,r,i,a]);x.useEffect(()=>(Xs.set(t,h),()=>{Xs.set(t,()=>{})}),[t,h]);var[p,g]=x.useState(re.isFocused(t));return x.useEffect(()=>{g(re.isFocused(t))},[t]),ti(()=>{var f=()=>g(re.isFocused(t));return hm>=17?(document.addEventListener("focusin",f),document.addEventListener("focusout",f),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",f)}):(document.addEventListener("focus",f,!0),document.addEventListener("blur",f,!0),()=>{document.removeEventListener("focus",f,!0),document.removeEventListener("blur",f,!0)})},[]),x.createElement(Ww.Provider,{value:d},x.createElement(Bm.Provider,{value:u},x.createElement(Xo.Provider,{value:u.editor},x.createElement(Uw.Provider,{value:p},n))))},_c=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},kc=(e,t,n)=>{var r=re.toDOMRange(e,t).getBoundingClientRect(),i=re.toDOMRange(e,n).getBoundingClientRect();return _c(r,i)&&_c(i,r)},Zw=(e,t)=>{var n=w.range(e,Q.end(t)),r=Array.from(w.positions(e,{at:t})),i=0,a=r.length,s=Math.floor(a/2);if(kc(e,w.range(e,r[i]),n))return w.range(e,r[i],n);if(r.length<2)return w.range(e,r[r.length-1],n);for(;s!==r.length&&s!==i;)kc(e,w.range(e,r[s]),n)?a=s:i=s,s=Math.floor((i+a)/2);return w.range(e,r[a],n)};function Fc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ac(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Fc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Yw=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",r=t,{apply:i,onChange:a,deleteBackward:s,addMark:o,removeMark:u}=r;return Ea.set(r,new WeakMap),r.addMark=(l,d)=>{var m,h;(m=nu.get(r))===null||m===void 0||m(),!$t.get(r)&&(h=bt.get(r))!==null&&h!==void 0&&h.length&&$t.set(r,null),rn.delete(r),o(l,d)},r.removeMark=l=>{var d;!$t.get(r)&&(d=bt.get(r))!==null&&d!==void 0&&d.length&&$t.set(r,null),rn.delete(r),u(l)},r.deleteBackward=l=>{if(l!=="line")return s(l);if(r.selection&&Q.isCollapsed(r.selection)){var d=w.above(r,{match:g=>he.isElement(g)&&w.isBlock(r,g),at:r.selection});if(d){var[,m]=d,h=w.range(r,m,r.selection.anchor),p=Zw(r,h);Q.isCollapsed(p)||ee.delete(r,{at:p})}}},r.apply=l=>{var d=[],m=[],h=bt.get(r);if(h!=null&&h.length){var p=h.map(S=>Y1(S,l)).filter(Boolean);bt.set(r,p)}var g=pn.get(r);g&&pn.set(r,pc(r,g,l));var f=hn.get(r);if(f!=null&&f.at){var b=Se.isPoint(f==null?void 0:f.at)?no(r,f.at,l):pc(r,f.at,l);hn.set(r,b?Ac(Ac({},f),{},{at:b}):null)}switch(l.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Kn(r,l.path));break}case"set_selection":{var v;(v=Lr.get(r))===null||v===void 0||v.unref(),Lr.delete(r);break}case"insert_node":case"remove_node":{d.push(...Kn(r,L.parent(l.path)));break}case"merge_node":{var y=L.previous(l.path);d.push(...Kn(r,y));break}case"move_node":{var C=L.common(L.parent(l.path),L.parent(l.newPath));d.push(...Kn(r,C));var k;L.isBefore(l.path,l.newPath)?(d.push(...Kn(r,L.parent(l.path))),k=l.newPath):(d.push(...Kn(r,L.parent(l.newPath))),k=l.path);var D=le.get(t,L.parent(k)),_=re.findKey(r,D),B=w.pathRef(r,L.parent(k));m.push([B,_]);break}}i(l);for(var[P,N]of d){var[z]=w.node(r,P);aa.set(z,N)}for(var[O,A]of m)if(O.current){var[F]=w.node(r,O.current);aa.set(F,A)}},r.setFragmentData=l=>{var{selection:d}=r;if(d){var[m,h]=Q.edges(d),p=w.void(r,{at:m.path}),g=w.void(r,{at:h.path});if(!(Q.isCollapsed(d)&&!p)){var f=re.toDOMRange(r,d),b=f.cloneContents(),v=b.childNodes[0];if(b.childNodes.forEach(z=>{z.textContent&&z.textContent.trim()!==""&&(v=z)}),g){var[y]=g,C=f.cloneRange(),k=re.toDOMNode(r,y);C.setEndAfter(k),b=C.cloneContents()}if(p&&(v=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(z=>{var O=z.getAttribute("data-slate-zero-width")==="n";z.textContent=O?`
81
- `:""}),ym(v)){var D=v.ownerDocument.createElement("span");D.style.whiteSpace="pre",D.appendChild(v),b.appendChild(D),v=D}var _=r.getFragment(),B=JSON.stringify(_),P=window.btoa(encodeURIComponent(B));v.setAttribute("data-slate-fragment",P),l.setData("application/".concat(n),P);var N=b.ownerDocument.createElement("div");return N.appendChild(b),N.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(N),l.setData("text/html",N.innerHTML),l.setData("text/plain",wm(N)),b.ownerDocument.body.removeChild(N),l}}},r.insertData=l=>{r.insertFragmentData(l)||r.insertTextData(l)},r.insertFragmentData=l=>{var d=l.getData("application/".concat(n))||z1(l);if(d){var m=decodeURIComponent(window.atob(d)),h=JSON.parse(m);return r.insertFragment(h),!0}return!1},r.insertTextData=l=>{var d=l.getData("text/plain");if(d){var m=d.split(/\r\n|\r|\n/),h=!1;for(var p of m)h&&ee.splitNodes(r,{always:!0}),r.insertText(p),h=!0;return!0}return!1},r.onChange=l=>{var d=hm<18?gd.unstable_batchedUpdates:m=>m();d(()=>{var m=Xs.get(r);m&&m(l),a(l)})},r},Kn=(e,t)=>{var n=[];for(var[r,i]of w.levels(e,{at:t})){var a=re.findKey(e,r);n.push([i,a])}return n};const io="MENTION: ",jm={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},Tc={"mention-popover":35,default:-52},is=16,Pm=(e,t,n)=>{const r=x.useRef(null),{showLinkEditor:i,mentionPopover:a}=x.useContext(cn),s=t==="link-editor"?i:a.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),x.useEffect(()=>{var p,g;if(!(r!=null&&r.current)||!s)return;const u=r==null?void 0:r.current;if(!u)return;let l,d=0;if(t==="mention-popover"){const{position:f}=a,b=C=>{if(!w.hasPath(e,C.path))return!1;const k=le.get(e,C.path);return w.isEditor(k)||he.isElement(k)?C.offset<=k.children.length:ge.isText(k)?C.offset<=k.text.length:!1};if(f&&(!b(f==null?void 0:f.anchor)||!b(f==null?void 0:f.focus)))return;l=re.toDOMRange(e,f||jm).getBoundingClientRect();const y=(p=document.getElementById(n))==null?void 0:p.getBoundingClientRect();u.style.setProperty("--width",`${((y==null?void 0:y.width)||0)/is}rem`),d=(y==null?void 0:y.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(l=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}l||(l=(g=document.getElementById(n))==null?void 0:g.getBoundingClientRect());const m=Tc[t]||Tc.default,h=((l==null?void 0:l.top)||0)+window.scrollY+m;d===0&&(d=Math.max(((l==null?void 0:l.left)||0)-(u.offsetWidth-((l==null?void 0:l.width)||0)),0)),u.style.top=`${h/is}rem`,u.style.left=`${d/is}rem`},o),r},Gw=e=>{const[t,n]=x.useState(null);return x.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[i]=w.nodes(e,{at:r,match:a=>a.type===Z.link});if(i){const a=i[0],s=bo(a.link),o=a.children[0],u=(o==null?void 0:o.text)||"";n({...s,text:u})}else n(null)},[e,e.selection]),t};var ft=(e=>(e.paragraph="paragraph",e.heading="heading",e.list="list",e.listItem="listItem",e.link="link",e.mention="mention",e.image="image",e.blockquote="blockquote",e.code="code",e.html="html",e.emphasis="emphasis",e.strong="strong",e.delete="delete",e.inlineCode="inlineCode",e.thematicBreak="thematicBreak",e.text="text",e.h3="heading_three",e))(ft||{});const tr={[Z.paragraph]:Z.paragraph,[Z.blockquote]:Z.blockquote,[Z.codeblock]:Z.codeblock,[Z.link]:Z.link,[Z.ul]:Z.ul,[Z.ol]:Z.ol,[Z.li]:Z.li,[Z.mention]:Z.mention,[Z.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Kt.emphasis]:Z.italic,[Kt.strong]:Z.bold,[Kt.delete]:Z.strikethrough,[Kt.code]:Z.code,[Z.hr]:Z.hr,[Z.image]:Z.image,[Z.h3]:Z.h3};function Bc(e){if(e)throw e}var zi=Object.prototype.hasOwnProperty,Om=Object.prototype.toString,Sc=Object.defineProperty,jc=Object.getOwnPropertyDescriptor,Pc=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Om.call(t)==="[object Array]"},Oc=function(t){if(!t||Om.call(t)!=="[object Object]")return!1;var n=zi.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&zi.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||zi.call(t,i)},Mc=function(t,n){Sc&&n.name==="__proto__"?Sc(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Nc=function(t,n){if(n==="__proto__")if(zi.call(t,n)){if(jc)return jc(t,n).value}else return;return t[n]},Qw=function e(){var t,n,r,i,a,s,o=arguments[0],u=1,l=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},u=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});u<l;++u)if(t=arguments[u],t!=null)for(n in t)r=Nc(o,n),i=Nc(t,n),o!==i&&(d&&i&&(Oc(i)||(a=Pc(i)))?(a?(a=!1,s=r&&Pc(r)?r:[]):s=r&&Oc(r)?r:{},Mc(o,{name:n,newValue:e(d,s,i)})):typeof i<"u"&&Mc(o,{name:n,newValue:i}));return o};const as=$n(Qw);function ao(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Jw(){const e=[],t={run:n,use:r};return t;function n(...i){let a=-1;const s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...i);function o(u,...l){const d=e[++a];let m=-1;if(u){s(u);return}for(;++m<i.length;)(l[m]===null||l[m]===void 0)&&(l[m]=i[m]);i=l,d?Xw(d,o)(...l):s(null,...l)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Xw(e,t){let n;return r;function r(...s){const o=e.length>s.length;let u;o&&s.push(i);try{u=e.apply(this,s)}catch(l){const d=l;if(o&&n)throw d;return i(d)}o||(u&&u.then&&typeof u.then=="function"?u.then(a,i):u instanceof Error?i(u):a(u))}function i(s,...o){n||(n=!0,t(s,...o))}function a(s){i(null,s)}}function zr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ic(e.position):"start"in e||"end"in e?Ic(e):"line"in e||"column"in e?so(e):""}function so(e){return Rc(e&&e.line)+":"+Rc(e&&e.column)}function Ic(e){return so(e&&e.start)+"-"+so(e&&e.end)}function Rc(e){return e&&typeof e=="number"?e:1}class Ct extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},s=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?i=t:!a.cause&&t&&(s=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?a.ruleId=r:(a.source=r.slice(0,u),a.ruleId=r.slice(u+1))}if(!a.place&&a.ancestors&&a.ancestors){const u=a.ancestors[a.ancestors.length-1];u&&(a.place=u.position)}const o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=o?o.line:void 0,this.name=zr(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=s&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual,this.expected,this.note,this.url}}Ct.prototype.file="";Ct.prototype.name="";Ct.prototype.reason="";Ct.prototype.message="";Ct.prototype.stack="";Ct.prototype.column=void 0;Ct.prototype.line=void 0;Ct.prototype.ancestors=void 0;Ct.prototype.cause=void 0;Ct.prototype.fatal=void 0;Ct.prototype.place=void 0;Ct.prototype.ruleId=void 0;Ct.prototype.source=void 0;const Vt={basename:eC,dirname:tC,extname:nC,join:rC,sep:"/"};function eC(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');si(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else s<0&&(a=!0,s=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(r=i):(o=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function tC(e){if(si(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function nC(e){si(e);let t=e.length,n=-1,r=0,i=-1,a=0,s;for(;t--;){const o=e.codePointAt(t);if(o===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),o===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function rC(...e){let t=-1,n;for(;++t<e.length;)si(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":iC(n)}function iC(e){si(e);const t=e.codePointAt(0)===47;let n=aC(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function aC(e,t){let n="",r=0,i=-1,a=0,s=-1,o,u;for(;++s<=e.length;){if(s<e.length)o=e.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=s,a=0;continue}}else if(n.length>0){n="",r=0,i=s,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a>-1?a++:a=-1}return n}function si(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const sC={cwd:oC};function oC(){return"/"}function oo(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function uC(e){if(typeof e=="string")e=new URL(e);else if(!oo(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return lC(e)}function lC(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const ss=["history","path","basename","stem","extname","dirname"];class cC{constructor(t){let n;t?oo(t)?n={path:t}:typeof t=="string"||dC(t)?n={value:t}:n=t:n={},this.cwd=sC.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ss.length;){const a=ss[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let i;for(i in n)ss.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Vt.basename(this.path):void 0}set basename(t){us(t,"basename"),os(t,"basename"),this.path=Vt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Vt.dirname(this.path):void 0}set dirname(t){$c(this.basename,"dirname"),this.path=Vt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Vt.extname(this.path):void 0}set extname(t){if(os(t,"extname"),$c(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Vt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){oo(t)&&(t=uC(t)),us(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Vt.basename(this.path,this.extname):void 0}set stem(t){us(t,"stem"),os(t,"stem"),this.path=Vt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Ct(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function os(e,t){if(e&&e.includes(Vt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Vt.sep+"`")}function us(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function $c(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function dC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const fC=function(e){const r=this.constructor.prototype,i=r[e],a=function(){return i.apply(a,arguments)};Object.setPrototypeOf(a,r);const s=Object.getOwnPropertyNames(i);for(const o of s){const u=Object.getOwnPropertyDescriptor(i,o);u&&Object.defineProperty(a,o,u)}return a},mC={}.hasOwnProperty;class au extends fC{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Jw()}copy(){const t=new au;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(as(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(ds("data",this.frozen),this.namespace[t]=n,this):mC.call(this.namespace,t)&&this.namespace[t]||void 0:t?(ds("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Fi(t),r=this.parser||this.Parser;return ls("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ls("process",this.parser||this.Parser),cs("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(a,s){const o=Fi(t),u=r.parse(o);r.run(u,o,function(d,m,h){if(d||!m||!h)return l(d);const p=m,g=r.stringify(p,h);gC(g)?h.value=g:h.result=g,l(d,h)});function l(d,m){d||!m?s(d):a?a(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),ls("processSync",this.parser||this.Parser),cs("processSync",this.compiler||this.Compiler),this.process(t,i),zc("processSync","process",n),r;function i(a,s){n=!0,Bc(a),r=s}}run(t,n,r){Lc(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(s,o){const u=Fi(n);i.run(t,u,l);function l(d,m,h){const p=m||t;d?o(d):s?s(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,i;return this.run(t,n,a),zc("runSync","run",r),i;function a(s,o){Bc(s),i=o,r=!0}}stringify(t,n){this.freeze();const r=Fi(n),i=this.compiler||this.Compiler;return cs("stringify",i),Lc(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(ds("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(l){if(typeof l=="function")u(l,[]);else if(typeof l=="object")if(Array.isArray(l)){const[d,...m]=l;u(d,m)}else s(l);else throw new TypeError("Expected usable value, not `"+l+"`")}function s(l){if(!("plugins"in l)&&!("settings"in l))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(l.plugins),l.settings&&(i.settings=as(!0,i.settings,l.settings))}function o(l){let d=-1;if(l!=null)if(Array.isArray(l))for(;++d<l.length;){const m=l[d];a(m)}else throw new TypeError("Expected a list of plugins, not `"+l+"`")}function u(l,d){let m=-1,h=-1;for(;++m<r.length;)if(r[m][0]===l){h=m;break}if(h===-1)r.push([l,...d]);else if(d.length>0){let[p,...g]=d;const f=r[h][1];ao(f)&&ao(p)&&(p=as(!0,f,p)),r[h]=[l,p,...g]}}}}const hC=new au().freeze();function ls(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function cs(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ds(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Lc(e){if(!ao(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function zc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Fi(e){return pC(e)?e:new cC(e)}function pC(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function gC(e){return typeof e=="string"||vC(e)}function vC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const bC={};function yC(e,t){const n=t||bC,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Mm(e,r,i)}function Mm(e,t,n){if(xC(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return qc(e.children,t,n)}return Array.isArray(e)?qc(e,t,n):""}function qc(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Mm(e[i],t,n);return r.join("")}function xC(e){return!!(e&&typeof e=="object")}const Uc=document.createElement("i");function su(e){const t="&"+e+";";Uc.innerHTML=t;const n=Uc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function on(e,t,n,r){const i=e.length;let a=0,s;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);a<r.length;)s=r.slice(a,a+1e4),s.unshift(t,0),e.splice(...s),a+=1e4,t+=1e4}function jt(e,t){return e.length>0?(on(e,e.length,0,t),e):t}const Wc={}.hasOwnProperty;function wC(e){const t={};let n=-1;for(;++n<e.length;)CC(t,e[n]);return t}function CC(e,t){let n;for(n in t){const i=(Wc.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let s;if(a)for(s in a){Wc.call(i,s)||(i[s]=[]);const o=a[s];DC(i[s],Array.isArray(o)?o:o?[o]:[])}}}function DC(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);on(e,0,0,r)}function Nm(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ar(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ht=_n(/[A-Za-z]/),Lt=_n(/[\dA-Za-z]/),EC=_n(/[#-'*+\--9=?A-Z^-~]/);function uo(e){return e!==null&&(e<32||e===127)}const lo=_n(/\d/),_C=_n(/[\dA-Fa-f]/),kC=_n(/[!-/:-@[-`{-~]/);function Ee(e){return e!==null&&e<-2}function xt(e){return e!==null&&(e<0||e===32)}function Ie(e){return e===-2||e===-1||e===32}const FC=_n(/\p{P}|\p{S}/u),AC=_n(/\s/);function _n(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ze(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let a=0;return s;function s(u){return Ie(u)?(e.enter(n),o(u)):t(u)}function o(u){return Ie(u)&&a++<i?(e.consume(u),o):(e.exit(n),t(u))}}const TC={tokenize:BC};function BC(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ze(e,t,"linePrefix")}function i(o){return e.enter("paragraph"),a(o)}function a(o){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return Ee(o)?(e.consume(o),e.exit("chunkText"),a):(e.consume(o),s)}}const SC={tokenize:jC},Vc={tokenize:PC};function jC(e){const t=this,n=[];let r=0,i,a,s;return o;function o(C){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,u,l)(C)}return l(C)}function u(C){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&y();const k=t.events.length;let D=k,_;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){_=t.events[D][1].end;break}v(r);let B=k;for(;B<t.events.length;)t.events[B][1].end=Object.assign({},_),B++;return on(t.events,D+1,0,t.events.slice(k)),t.events.length=B,l(C)}return o(C)}function l(C){if(r===n.length){if(!i)return h(C);if(i.currentConstruct&&i.currentConstruct.concrete)return g(C);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Vc,d,m)(C)}function d(C){return i&&y(),v(r),h(C)}function m(C){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(C)}function h(C){return t.containerState={},e.attempt(Vc,p,g)(C)}function p(C){return r++,n.push([t.currentConstruct,t.containerState]),h(C)}function g(C){if(C===null){i&&y(),v(0),e.consume(C);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:a,_tokenizer:i}),f(C)}function f(C){if(C===null){b(e.exit("chunkFlow"),!0),v(0),e.consume(C);return}return Ee(C)?(e.consume(C),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(C),f)}function b(C,k){const D=t.sliceStream(C);if(k&&D.push(null),C.previous=a,a&&(a.next=C),a=C,i.defineSkip(C.start),i.write(D),t.parser.lazy[C.start.line]){let _=i.events.length;for(;_--;)if(i.events[_][1].start.offset<s&&(!i.events[_][1].end||i.events[_][1].end.offset>s))return;const B=t.events.length;let P=B,N,z;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(N){z=t.events[P][1].end;break}N=!0}for(v(r),_=B;_<t.events.length;)t.events[_][1].end=Object.assign({},z),_++;on(t.events,P+1,0,t.events.slice(B)),t.events.length=_}}function v(C){let k=n.length;for(;k-- >C;){const D=n[k];t.containerState=D[1],D[0].exit.call(t,e)}n.length=C}function y(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function PC(e,t,n){return Ze(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Hc(e){if(e===null||xt(e)||AC(e))return 1;if(FC(e))return 2}function ou(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const co={name:"attention",tokenize:MC,resolveAll:OC};function OC(e,t){let n=-1,r,i,a,s,o,u,l,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m=Object.assign({},e[r][1].end),h=Object.assign({},e[n][1].start);Kc(m,-u),Kc(h,u),s={type:u>1?"strongSequence":"emphasisSequence",start:m,end:Object.assign({},e[r][1].end)},o={type:u>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:h},a={type:u>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},i={type:u>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=jt(l,[["enter",e[r][1],t],["exit",e[r][1],t]])),l=jt(l,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",a,t]]),l=jt(l,ou(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=jt(l,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,l=jt(l,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,on(e,r-1,n-r+3,l),n=r+l.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function MC(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Hc(r);let a;return s;function s(u){return a=u,e.enter("attentionSequence"),o(u)}function o(u){if(u===a)return e.consume(u),o;const l=e.exit("attentionSequence"),d=Hc(u),m=!d||d===2&&i||n.includes(u),h=!i||i===2&&d||n.includes(r);return l._open=!!(a===42?m:m&&(i||!h)),l._close=!!(a===42?h:h&&(d||!m)),t(u)}}function Kc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const NC={name:"autolink",tokenize:IC};function IC(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(p){return Ht(p)?(e.consume(p),s):p===64?n(p):l(p)}function s(p){return p===43||p===45||p===46||Lt(p)?(r=1,o(p)):l(p)}function o(p){return p===58?(e.consume(p),r=0,u):(p===43||p===45||p===46||Lt(p))&&r++<32?(e.consume(p),o):(r=0,l(p))}function u(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||uo(p)?n(p):(e.consume(p),u)}function l(p){return p===64?(e.consume(p),d):EC(p)?(e.consume(p),l):n(p)}function d(p){return Lt(p)?m(p):n(p)}function m(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||Lt(p))&&r++<63){const g=p===45?h:m;return e.consume(p),g}return n(p)}}const _a={tokenize:RC,partial:!0};function RC(e,t,n){return r;function r(a){return Ie(a)?Ze(e,i,"linePrefix")(a):i(a)}function i(a){return a===null||Ee(a)?t(a):n(a)}}const Im={name:"blockQuote",tokenize:$C,continuation:{tokenize:LC},exit:zC};function $C(e,t,n){const r=this;return i;function i(s){if(s===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),a}return n(s)}function a(s){return Ie(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function LC(e,t,n){const r=this;return i;function i(s){return Ie(s)?Ze(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):a(s)}function a(s){return e.attempt(Im,t,n)(s)}}function zC(e){e.exit("blockQuote")}const Rm={name:"characterEscape",tokenize:qC};function qC(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),i}function i(a){return kC(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const $m={name:"characterReference",tokenize:UC};function UC(e,t,n){const r=this;let i=0,a,s;return o;function o(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),u}function u(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),a=31,s=Lt,d(m))}function l(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,s=_C,d):(e.enter("characterReferenceValue"),a=7,s=lo,d(m))}function d(m){if(m===59&&i){const h=e.exit("characterReferenceValue");return s===Lt&&!su(r.sliceSerialize(h))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(m)&&i++<a?(e.consume(m),d):n(m)}}const Zc={tokenize:VC,partial:!0},Yc={name:"codeFenced",tokenize:WC,concrete:!0};function WC(e,t,n){const r=this,i={tokenize:D,partial:!0};let a=0,s=0,o;return u;function u(_){return l(_)}function l(_){const B=r.events[r.events.length-1];return a=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,o=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(_)}function d(_){return _===o?(s++,e.consume(_),d):s<3?n(_):(e.exit("codeFencedFenceSequence"),Ie(_)?Ze(e,m,"whitespace")(_):m(_))}function m(_){return _===null||Ee(_)?(e.exit("codeFencedFence"),r.interrupt?t(_):e.check(Zc,f,k)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(_))}function h(_){return _===null||Ee(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(_)):Ie(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ze(e,p,"whitespace")(_)):_===96&&_===o?n(_):(e.consume(_),h)}function p(_){return _===null||Ee(_)?m(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(_))}function g(_){return _===null||Ee(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(_)):_===96&&_===o?n(_):(e.consume(_),g)}function f(_){return e.attempt(i,k,b)(_)}function b(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),v}function v(_){return a>0&&Ie(_)?Ze(e,y,"linePrefix",a+1)(_):y(_)}function y(_){return _===null||Ee(_)?e.check(Zc,f,k)(_):(e.enter("codeFlowValue"),C(_))}function C(_){return _===null||Ee(_)?(e.exit("codeFlowValue"),y(_)):(e.consume(_),C)}function k(_){return e.exit("codeFenced"),t(_)}function D(_,B,P){let N=0;return z;function z(I){return _.enter("lineEnding"),_.consume(I),_.exit("lineEnding"),O}function O(I){return _.enter("codeFencedFence"),Ie(I)?Ze(_,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):A(I)}function A(I){return I===o?(_.enter("codeFencedFenceSequence"),F(I)):P(I)}function F(I){return I===o?(N++,_.consume(I),F):N>=s?(_.exit("codeFencedFenceSequence"),Ie(I)?Ze(_,S,"whitespace")(I):S(I)):P(I)}function S(I){return I===null||Ee(I)?(_.exit("codeFencedFence"),B(I)):P(I)}}}function VC(e,t,n){const r=this;return i;function i(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a)}function a(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const fs={name:"codeIndented",tokenize:KC},HC={tokenize:ZC,partial:!0};function KC(e,t,n){const r=this;return i;function i(l){return e.enter("codeIndented"),Ze(e,a,"linePrefix",4+1)(l)}function a(l){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(l):n(l)}function s(l){return l===null?u(l):Ee(l)?e.attempt(HC,s,u)(l):(e.enter("codeFlowValue"),o(l))}function o(l){return l===null||Ee(l)?(e.exit("codeFlowValue"),s(l)):(e.consume(l),o)}function u(l){return e.exit("codeIndented"),t(l)}}function ZC(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):Ee(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):Ze(e,a,"linePrefix",4+1)(s)}function a(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):Ee(s)?i(s):n(s)}}const YC={name:"codeText",tokenize:JC,resolve:GC,previous:QC};function GC(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function QC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function JC(e,t,n){let r=0,i,a;return s;function s(m){return e.enter("codeText"),e.enter("codeTextSequence"),o(m)}function o(m){return m===96?(e.consume(m),r++,o):(e.exit("codeTextSequence"),u(m))}function u(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),u):m===96?(a=e.enter("codeTextSequence"),i=0,d(m)):Ee(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),u):(e.enter("codeTextData"),l(m))}function l(m){return m===null||m===32||m===96||Ee(m)?(e.exit("codeTextData"),u(m)):(e.consume(m),l)}function d(m){return m===96?(e.consume(m),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(a.type="codeTextData",l(m))}}class XC{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Sr(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Sr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Sr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Sr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Sr(this.left,n.reverse())}}}function Sr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Lm(e){const t={};let n=-1,r,i,a,s,o,u,l;const d=new XC(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,a=0,a<u.length&&u[a][1].type==="lineEndingBlank"&&(a+=2),a<u.length&&u[a][1].type==="content"))for(;++a<u.length&&u[a][1].type!=="content";)u[a][1].type==="chunkText"&&(u[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,eD(d,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--&&(s=d.get(a),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=a);i&&(r[1].end=Object.assign({},d.get(i)[1].start),o=d.slice(i,n),o.unshift(r),d.splice(i,n-i+1,o))}}return on(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!l}function eD(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const a=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,u=[],l={};let d,m,h=-1,p=n,g=0,f=0;const b=[f];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),m&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),m=p,p=p.next}for(p=n;++h<o.length;)o[h][0]==="exit"&&o[h-1][0]==="enter"&&o[h][1].type===o[h-1][1].type&&o[h][1].start.line!==o[h][1].end.line&&(f=h+1,b.push(f),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):b.pop(),h=b.length;h--;){const v=o.slice(b[h],b[h+1]),y=a.pop();u.push([y,y+v.length-1]),e.splice(y,2,v)}for(u.reverse(),h=-1;++h<u.length;)l[g+u[h][0]]=g+u[h][1],g+=u[h][1]-u[h][0]-1;return l}const tD={tokenize:iD,resolve:rD},nD={tokenize:aD,partial:!0};function rD(e){return Lm(e),e}function iD(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?a(o):Ee(o)?e.check(nD,s,a)(o):(e.consume(o),i)}function a(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function s(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function aD(e,t,n){const r=this;return i;function i(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ze(e,a,"linePrefix")}function a(s){if(s===null||Ee(s))return n(s);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function zm(e,t,n,r,i,a,s,o,u){const l=u||Number.POSITIVE_INFINITY;let d=0;return m;function m(v){return v===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(v),e.exit(a),h):v===null||v===32||v===41||uo(v)?n(v):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(v))}function h(v){return v===62?(e.enter(a),e.consume(v),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===62?(e.exit("chunkString"),e.exit(o),h(v)):v===null||v===60||Ee(v)?n(v):(e.consume(v),v===92?g:p)}function g(v){return v===60||v===62||v===92?(e.consume(v),p):p(v)}function f(v){return!d&&(v===null||v===41||xt(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):d<l&&v===40?(e.consume(v),d++,f):v===41?(e.consume(v),d--,f):v===null||v===32||v===40||uo(v)?n(v):(e.consume(v),v===92?b:f)}function b(v){return v===40||v===41||v===92?(e.consume(v),f):f(v)}}function qm(e,t,n,r,i,a){const s=this;let o=0,u;return l;function l(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(a),d}function d(p){return o>999||p===null||p===91||p===93&&!u||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(a),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):Ee(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),m(p))}function m(p){return p===null||p===91||p===93||Ee(p)||o++>999?(e.exit("chunkString"),d(p)):(e.consume(p),u||(u=!Ie(p)),p===92?h:m)}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,m):m(p)}}function Um(e,t,n,r,i,a){let s;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),s=h===40?41:h,u):n(h)}function u(h){return h===s?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(a),l(h))}function l(h){return h===s?(e.exit(a),u(s)):h===null?n(h):Ee(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Ze(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===s||h===null||Ee(h)?(e.exit("chunkString"),l(h)):(e.consume(h),h===92?m:d)}function m(h){return h===s||h===92?(e.consume(h),d):d(h)}}function qr(e,t){let n;return r;function r(i){return Ee(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ie(i)?Ze(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const sD={name:"definition",tokenize:uD},oD={tokenize:lD,partial:!0};function uD(e,t,n){const r=this;let i;return a;function a(p){return e.enter("definition"),s(p)}function s(p){return qm.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return i=ar(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),u):n(p)}function u(p){return xt(p)?qr(e,l)(p):l(p)}function l(p){return zm(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(oD,m,m)(p)}function m(p){return Ie(p)?Ze(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Ee(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function lD(e,t,n){return r;function r(o){return xt(o)?qr(e,i)(o):n(o)}function i(o){return Um(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function a(o){return Ie(o)?Ze(e,s,"whitespace")(o):s(o)}function s(o){return o===null||Ee(o)?t(o):n(o)}}const cD={name:"hardBreakEscape",tokenize:dD};function dD(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return Ee(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const fD={name:"headingAtx",tokenize:hD,resolve:mD};function mD(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},on(e,r,n-r+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function hD(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),a(d)}function a(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||xt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),u(d)):d===null||Ee(d)?(e.exit("atxHeading"),t(d)):Ie(d)?Ze(e,o,"whitespace")(d):(e.enter("atxHeadingText"),l(d))}function u(d){return d===35?(e.consume(d),u):(e.exit("atxHeadingSequence"),o(d))}function l(d){return d===null||d===35||xt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),l)}}const pD=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Gc=["pre","script","style","textarea"],gD={name:"htmlFlow",tokenize:xD,resolveTo:yD,concrete:!0},vD={tokenize:CD,partial:!0},bD={tokenize:wD,partial:!0};function yD(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function xD(e,t,n){const r=this;let i,a,s,o,u;return l;function l(T){return d(T)}function d(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),m}function m(T){return T===33?(e.consume(T),h):T===47?(e.consume(T),a=!0,f):T===63?(e.consume(T),i=3,r.interrupt?t:E):Ht(T)?(e.consume(T),s=String.fromCharCode(T),b):n(T)}function h(T){return T===45?(e.consume(T),i=2,p):T===91?(e.consume(T),i=5,o=0,g):Ht(T)?(e.consume(T),i=4,r.interrupt?t:E):n(T)}function p(T){return T===45?(e.consume(T),r.interrupt?t:E):n(T)}function g(T){const j="CDATA[";return T===j.charCodeAt(o++)?(e.consume(T),o===j.length?r.interrupt?t:A:g):n(T)}function f(T){return Ht(T)?(e.consume(T),s=String.fromCharCode(T),b):n(T)}function b(T){if(T===null||T===47||T===62||xt(T)){const j=T===47,R=s.toLowerCase();return!j&&!a&&Gc.includes(R)?(i=1,r.interrupt?t(T):A(T)):pD.includes(s.toLowerCase())?(i=6,j?(e.consume(T),v):r.interrupt?t(T):A(T)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(T):a?y(T):C(T))}return T===45||Lt(T)?(e.consume(T),s+=String.fromCharCode(T),b):n(T)}function v(T){return T===62?(e.consume(T),r.interrupt?t:A):n(T)}function y(T){return Ie(T)?(e.consume(T),y):z(T)}function C(T){return T===47?(e.consume(T),z):T===58||T===95||Ht(T)?(e.consume(T),k):Ie(T)?(e.consume(T),C):z(T)}function k(T){return T===45||T===46||T===58||T===95||Lt(T)?(e.consume(T),k):D(T)}function D(T){return T===61?(e.consume(T),_):Ie(T)?(e.consume(T),D):C(T)}function _(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),u=T,B):Ie(T)?(e.consume(T),_):P(T)}function B(T){return T===u?(e.consume(T),u=null,N):T===null||Ee(T)?n(T):(e.consume(T),B)}function P(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||xt(T)?D(T):(e.consume(T),P)}function N(T){return T===47||T===62||Ie(T)?C(T):n(T)}function z(T){return T===62?(e.consume(T),O):n(T)}function O(T){return T===null||Ee(T)?A(T):Ie(T)?(e.consume(T),O):n(T)}function A(T){return T===45&&i===2?(e.consume(T),H):T===60&&i===1?(e.consume(T),V):T===62&&i===4?(e.consume(T),Y):T===63&&i===3?(e.consume(T),E):T===93&&i===5?(e.consume(T),ne):Ee(T)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(vD,q,F)(T)):T===null||Ee(T)?(e.exit("htmlFlowData"),F(T)):(e.consume(T),A)}function F(T){return e.check(bD,S,q)(T)}function S(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),I}function I(T){return T===null||Ee(T)?F(T):(e.enter("htmlFlowData"),A(T))}function H(T){return T===45?(e.consume(T),E):A(T)}function V(T){return T===47?(e.consume(T),s="",ae):A(T)}function ae(T){if(T===62){const j=s.toLowerCase();return Gc.includes(j)?(e.consume(T),Y):A(T)}return Ht(T)&&s.length<8?(e.consume(T),s+=String.fromCharCode(T),ae):A(T)}function ne(T){return T===93?(e.consume(T),E):A(T)}function E(T){return T===62?(e.consume(T),Y):T===45&&i===2?(e.consume(T),E):A(T)}function Y(T){return T===null||Ee(T)?(e.exit("htmlFlowData"),q(T)):(e.consume(T),Y)}function q(T){return e.exit("htmlFlow"),t(T)}}function wD(e,t,n){const r=this;return i;function i(s){return Ee(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):n(s)}function a(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function CD(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(_a,t,n)}}const DD={name:"htmlText",tokenize:ED};function ED(e,t,n){const r=this;let i,a,s;return o;function o(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),u}function u(E){return E===33?(e.consume(E),l):E===47?(e.consume(E),D):E===63?(e.consume(E),C):Ht(E)?(e.consume(E),P):n(E)}function l(E){return E===45?(e.consume(E),d):E===91?(e.consume(E),a=0,g):Ht(E)?(e.consume(E),y):n(E)}function d(E){return E===45?(e.consume(E),p):n(E)}function m(E){return E===null?n(E):E===45?(e.consume(E),h):Ee(E)?(s=m,V(E)):(e.consume(E),m)}function h(E){return E===45?(e.consume(E),p):m(E)}function p(E){return E===62?H(E):E===45?h(E):m(E)}function g(E){const Y="CDATA[";return E===Y.charCodeAt(a++)?(e.consume(E),a===Y.length?f:g):n(E)}function f(E){return E===null?n(E):E===93?(e.consume(E),b):Ee(E)?(s=f,V(E)):(e.consume(E),f)}function b(E){return E===93?(e.consume(E),v):f(E)}function v(E){return E===62?H(E):E===93?(e.consume(E),v):f(E)}function y(E){return E===null||E===62?H(E):Ee(E)?(s=y,V(E)):(e.consume(E),y)}function C(E){return E===null?n(E):E===63?(e.consume(E),k):Ee(E)?(s=C,V(E)):(e.consume(E),C)}function k(E){return E===62?H(E):C(E)}function D(E){return Ht(E)?(e.consume(E),_):n(E)}function _(E){return E===45||Lt(E)?(e.consume(E),_):B(E)}function B(E){return Ee(E)?(s=B,V(E)):Ie(E)?(e.consume(E),B):H(E)}function P(E){return E===45||Lt(E)?(e.consume(E),P):E===47||E===62||xt(E)?N(E):n(E)}function N(E){return E===47?(e.consume(E),H):E===58||E===95||Ht(E)?(e.consume(E),z):Ee(E)?(s=N,V(E)):Ie(E)?(e.consume(E),N):H(E)}function z(E){return E===45||E===46||E===58||E===95||Lt(E)?(e.consume(E),z):O(E)}function O(E){return E===61?(e.consume(E),A):Ee(E)?(s=O,V(E)):Ie(E)?(e.consume(E),O):N(E)}function A(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),i=E,F):Ee(E)?(s=A,V(E)):Ie(E)?(e.consume(E),A):(e.consume(E),S)}function F(E){return E===i?(e.consume(E),i=void 0,I):E===null?n(E):Ee(E)?(s=F,V(E)):(e.consume(E),F)}function S(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||xt(E)?N(E):(e.consume(E),S)}function I(E){return E===47||E===62||xt(E)?N(E):n(E)}function H(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function V(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),ae}function ae(E){return Ie(E)?Ze(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):ne(E)}function ne(E){return e.enter("htmlTextData"),s(E)}}const uu={name:"labelEnd",tokenize:BD,resolveTo:TD,resolveAll:AD},_D={tokenize:SD},kD={tokenize:jD},FD={tokenize:PD};function AD(e){let t=-1;for(;++t<e.length;){const n=e[t][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(e.splice(t+1,n.type==="labelImage"?4:2),n.type="data",t++)}return e}function TD(e,t){let n=e.length,r=0,i,a,s,o;for(;n--;)if(i=e[n][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=n);const u={type:e[a][1].type==="labelLink"?"link":"image",start:Object.assign({},e[a][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"label",start:Object.assign({},e[a][1].start),end:Object.assign({},e[s][1].end)},d={type:"labelText",start:Object.assign({},e[a+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",u,t],["enter",l,t]],o=jt(o,e.slice(a+1,a+r+3)),o=jt(o,[["enter",d,t]]),o=jt(o,ou(t.parser.constructs.insideSpan.null,e.slice(a+r+4,s-3),t)),o=jt(o,[["exit",d,t],e[s-2],e[s-1],["exit",l,t]]),o=jt(o,e.slice(s+1)),o=jt(o,[["exit",u,t]]),on(e,a,e.length,o),e}function BD(e,t,n){const r=this;let i=r.events.length,a,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){a=r.events[i][1];break}return o;function o(h){return a?a._inactive?m(h):(s=r.parser.defined.includes(ar(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),u):n(h)}function u(h){return h===40?e.attempt(_D,d,s?d:m)(h):h===91?e.attempt(kD,d,s?l:m)(h):s?d(h):m(h)}function l(h){return e.attempt(FD,d,m)(h)}function d(h){return t(h)}function m(h){return a._balanced=!0,n(h)}}function SD(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),i}function i(m){return xt(m)?qr(e,a)(m):a(m)}function a(m){return m===41?d(m):zm(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function s(m){return xt(m)?qr(e,u)(m):d(m)}function o(m){return n(m)}function u(m){return m===34||m===39||m===40?Um(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):d(m)}function l(m){return xt(m)?qr(e,d)(m):d(m)}function d(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function jD(e,t,n){const r=this;return i;function i(o){return qm.call(r,e,a,s,"reference","referenceMarker","referenceString")(o)}function a(o){return r.parser.defined.includes(ar(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function PD(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),i}function i(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const OD={name:"labelStartImage",tokenize:MD,resolveAll:uu.resolveAll};function MD(e,t,n){const r=this;return i;function i(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),a}function a(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),s):n(o)}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const ND={name:"labelStartLink",tokenize:ID,resolveAll:uu.resolveAll};function ID(e,t,n){const r=this;return i;function i(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),a}function a(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const ms={name:"lineEnding",tokenize:RD};function RD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ze(e,t,"linePrefix")}}const qi={name:"thematicBreak",tokenize:$D};function $D(e,t,n){let r=0,i;return a;function a(l){return e.enter("thematicBreak"),s(l)}function s(l){return i=l,o(l)}function o(l){return l===i?(e.enter("thematicBreakSequence"),u(l)):r>=3&&(l===null||Ee(l))?(e.exit("thematicBreak"),t(l)):n(l)}function u(l){return l===i?(e.consume(l),r++,u):(e.exit("thematicBreakSequence"),Ie(l)?Ze(e,o,"whitespace")(l):o(l))}}const gt={name:"list",tokenize:qD,continuation:{tokenize:UD},exit:VD},LD={tokenize:HD,partial:!0},zD={tokenize:WD,partial:!0};function qD(e,t,n){const r=this,i=r.events[r.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return o;function o(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:lo(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(qi,n,l)(p):l(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(p)}return n(p)}function u(p){return lo(p)&&++s<10?(e.consume(p),u):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),l(p)):n(p)}function l(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(_a,r.interrupt?n:d,e.attempt(LD,h,m))}function d(p){return r.containerState.initialBlankLine=!0,a++,h(p)}function m(p){return Ie(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function UD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(_a,i,a);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ze(e,t,"listItemIndent",r.containerState.size+1)(o)}function a(o){return r.containerState.furtherBlankLines||!Ie(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(zD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ze(e,e.attempt(gt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function WD(e,t,n){const r=this;return Ze(e,i,"listItemIndent",r.containerState.size+1);function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(a):n(a)}}function VD(e){e.exit(this.containerState.type)}function HD(e,t,n){const r=this;return Ze(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function i(a){const s=r.events[r.events.length-1];return!Ie(a)&&s&&s[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const Qc={name:"setextUnderline",tokenize:ZD,resolveTo:KD};function KD(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const s={type:"setextHeading",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",s,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[a][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}function ZD(e,t,n){const r=this;let i;return a;function a(l){let d=r.events.length,m;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){m=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),i=l,s(l)):n(l)}function s(l){return e.enter("setextHeadingLineSequence"),o(l)}function o(l){return l===i?(e.consume(l),o):(e.exit("setextHeadingLineSequence"),Ie(l)?Ze(e,u,"lineSuffix")(l):u(l))}function u(l){return l===null||Ee(l)?(e.exit("setextHeadingLine"),t(l)):n(l)}}const YD={tokenize:GD};function GD(e){const t=this,n=e.attempt(_a,r,e.attempt(this.parser.constructs.flowInitial,i,Ze(e,e.attempt(this.parser.constructs.flow,i,e.attempt(tD,i)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const QD={resolveAll:Vm()},JD=Wm("string"),XD=Wm("text");function Wm(e){return{tokenize:t,resolveAll:Vm(e==="text"?eE:void 0)};function t(n){const r=this,i=this.parser.constructs[e],a=n.attempt(i,s,o);return s;function s(d){return l(d)?a(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),u}function u(d){return l(d)?(n.exit("data"),a(d)):(n.consume(d),u)}function l(d){if(d===null)return!0;const m=i[d];let h=-1;if(m)for(;++h<m.length;){const p=m[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function Vm(e){return t;function t(n,r){let i=-1,a;for(;++i<=n.length;)a===void 0?n[i]&&n[i][1].type==="data"&&(a=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==a+2&&(n[a][1].end=n[i-1][1].end,n.splice(a+2,i-a-2),i=a+2),a=void 0);return e?e(n,r):n}}function eE(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let a=i.length,s=-1,o=0,u;for(;a--;){const l=i[a];if(typeof l=="string"){for(s=l.length;l.charCodeAt(s-1)===32;)o++,s--;if(s)break;s=-1}else if(l===-2)u=!0,o++;else if(l!==-1){a++;break}}if(o){const l={type:n===e.length||u||o<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-o,offset:r.end.offset-o,_index:r.start._index+a,_bufferIndex:a?s:r.start._bufferIndex+s},end:Object.assign({},r.end)};r.end=Object.assign({},l.start),r.start.offset===r.end.offset?Object.assign(r,l):(e.splice(n,0,["enter",l,t],["exit",l,t]),n+=2)}n++}return e}function tE(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const i={},a=[];let s=[],o=[];const u={consume:y,enter:C,exit:k,attempt:B(D),check:B(_),interrupt:B(_,{interrupt:!0})},l={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:h,now:g,defineSkip:f,write:m};let d=t.tokenize.call(l,u);return t.resolveAll&&a.push(t),l;function m(O){return s=jt(s,O),b(),s[s.length-1]!==null?[]:(P(t,0),l.events=ou(a,l.events,l),l.events)}function h(O,A){return rE(p(O),A)}function p(O){return nE(s,O)}function g(){const{line:O,column:A,offset:F,_index:S,_bufferIndex:I}=r;return{line:O,column:A,offset:F,_index:S,_bufferIndex:I}}function f(O){i[O.line]=O.column,z()}function b(){let O;for(;r._index<s.length;){const A=s[r._index];if(typeof A=="string")for(O=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===O&&r._bufferIndex<A.length;)v(A.charCodeAt(r._bufferIndex));else v(A)}}function v(O){d=d(O)}function y(O){Ee(O)?(r.line++,r.column=1,r.offset+=O===-3?2:1,z()):O!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=O}function C(O,A){const F=A||{};return F.type=O,F.start=g(),l.events.push(["enter",F,l]),o.push(F),F}function k(O){const A=o.pop();return A.end=g(),l.events.push(["exit",A,l]),A}function D(O,A){P(O,A.from)}function _(O,A){A.restore()}function B(O,A){return F;function F(S,I,H){let V,ae,ne,E;return Array.isArray(S)?q(S):"tokenize"in S?q([S]):Y(S);function Y(M){return U;function U(X){const W=X!==null&&M[X],te=X!==null&&M.null,de=[...Array.isArray(W)?W:W?[W]:[],...Array.isArray(te)?te:te?[te]:[]];return q(de)(X)}}function q(M){return V=M,ae=0,M.length===0?H:T(M[ae])}function T(M){return U;function U(X){return E=N(),ne=M,M.partial||(l.currentConstruct=M),M.name&&l.parser.constructs.disable.null.includes(M.name)?R():M.tokenize.call(A?Object.assign(Object.create(l),A):l,u,j,R)(X)}}function j(M){return O(ne,E),I}function R(M){return E.restore(),++ae<V.length?T(V[ae]):H}}}function P(O,A){O.resolveAll&&!a.includes(O)&&a.push(O),O.resolve&&on(l.events,A,l.events.length-A,O.resolve(l.events.slice(A),l)),O.resolveTo&&(l.events=O.resolveTo(l.events,l))}function N(){const O=g(),A=l.previous,F=l.currentConstruct,S=l.events.length,I=Array.from(o);return{restore:H,from:S};function H(){r=O,l.previous=A,l.currentConstruct=F,l.events.length=S,o=I,z()}}function z(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function nE(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,a)];else{if(s=e.slice(n,i),r>-1){const o=s[0];typeof o=="string"?s[0]=o.slice(r):s.shift()}a>0&&s.push(e[i].slice(0,a))}return s}function rE(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const a=e[n];let s;if(typeof a=="string")s=a;else switch(a){case-5:{s="\r";break}case-4:{s=`
80
+ `:""),[a]=x.useState(i);return ti(()=>{var s=i();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),x.createElement(hw,{ref:r},a)},hw=x.memo(x.forwardRef((e,t)=>x.createElement("span",{"data-slate-string":!0,ref:t},e.children))),rs=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,i={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(i["data-slate-mark-placeholder"]=!0),x.createElement("span",fw({},i),!mt||!n?"\uFEFF":null,n?x.createElement("br",null):null)};function xc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _m(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var pw=mt?300:0;function gw(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function wc(e){e.current&&(clearTimeout(e.current),e.current=null)}var vw=e=>{var{leaf:t,isLast:n,text:r,parent:i,renderPlaceholder:a,renderLeaf:s=y=>x.createElement(yw,_m({},y))}=e,o=En(),u=x.useRef(null),l=x.useRef(null),[d,h]=x.useState(!1),m=x.useRef(null),p=x.useCallback(y=>{if(gw(u,y==null),y==null){var C;Qs.delete(o),(C=t.onPlaceholderResize)===null||C===void 0||C.call(t,null)}else{if(Qs.set(o,y),!u.current){var k=window.ResizeObserver||y1;u.current=new k(()=>{var D;(D=t.onPlaceholderResize)===null||D===void 0||D.call(t,y)})}u.current.observe(y),l.current=y}},[l,t,o]),g=x.createElement(mw,{isLast:n,leaf:t,parent:i,text:r}),f=!!t[hr];if(x.useEffect(()=>(f?m.current||(m.current=setTimeout(()=>{h(!0),m.current=null},pw)):(wc(m),h(!1)),()=>wc(m)),[f,h]),f&&d){var b={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:Mr?"inherit":void 0},contentEditable:!1,ref:p}};g=x.createElement(x.Fragment,null,a(b),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},bw=x.memo(vw,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&ge.equals(t.leaf,e.leaf)&&t.leaf[hr]===e.leaf[hr]),yw=e=>{var{attributes:t,children:n}=e;return x.createElement("span",_m({},t),n)},xw=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:i,renderLeaf:a,text:s}=e,o=En(),u=x.useRef(null),l=ge.decorations(s,t),d=re.findKey(o,s),h=[],m=0;m<l.length;m++){var p=l[m];h.push(x.createElement(bw,{isLast:n&&m===l.length-1,key:"".concat(d.id,"-").concat(m),renderPlaceholder:i,leaf:p,text:s,parent:r,renderLeaf:a}))}var g=x.useCallback(f=>{var b=Ea.get(o);f?(b==null||b.set(d,f),Pn.set(s,f),ei.set(f,s)):(b==null||b.delete(d),Pn.delete(s),u.current&&ei.delete(u.current)),u.current=f},[u,o,d,s]);return x.createElement("span",{"data-slate-node":"text",ref:g},h)},km=x.memo(xw,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&dw(t.decorations,e.decorations));function Cc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ro(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ww=e=>{var{decorations:t,element:n,renderElement:r=y=>x.createElement(Dw,ro({},y)),renderPlaceholder:i,renderLeaf:a,selection:s}=e,o=En(),u=kw(),l=o.isInline(n),d=re.findKey(o,n),h=x.useCallback(y=>{var C=Ea.get(o);y?(C==null||C.set(d,y),Pn.set(n,y),ei.set(y,n)):(C==null||C.delete(d),Pn.delete(n))},[o,d,n]),m=Am({decorations:t,node:n,renderElement:r,renderPlaceholder:i,renderLeaf:a,selection:s}),p={"data-slate-node":"element",ref:h};if(l&&(p["data-slate-inline"]=!0),!l&&w.hasInlines(o,n)){var g=le.string(n),f=Uf(g);f==="rtl"&&(p.dir=f)}if(w.isVoid(o,n)){p["data-slate-void"]=!0,!u&&l&&(p.contentEditable=!1);var b=l?"span":"div",[[v]]=le.texts(n);m=x.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},x.createElement(km,{renderPlaceholder:i,decorations:[],isLast:!1,parent:n,text:v})),eu.set(v,0),tu.set(v,n)}return r({attributes:p,children:m,element:n})},Cw=x.memo(ww,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&cw(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&Q.equals(e.selection,t.selection))),Dw=e=>{var{attributes:t,children:n,element:r}=e,i=En(),a=i.isInline(r)?"span":"div";return x.createElement(a,ro(ro({},t),{},{style:{position:"relative"}}),n)},Fm=x.createContext(()=>[]),Ew=()=>x.useContext(Fm),_w=x.createContext(!1),Am=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:i,renderLeaf:a,selection:s}=e,o=Ew(),u=En(),l=re.findPath(u,n),d=[],h=he.isElement(n)&&!u.isInline(n)&&w.hasInlines(u,n),m=0;m<n.children.length;m++){var p=l.concat(m),g=n.children[m],f=re.findKey(u,g),b=w.range(u,p),v=s&&Q.intersection(b,s),y=o([g,p]);for(var C of t){var k=Q.intersection(C,b);k&&y.push(k)}he.isElement(g)?d.push(x.createElement(_w.Provider,{key:"provider-".concat(f.id),value:!!v},x.createElement(Cw,{decorations:y,element:g,key:f.id,renderElement:r,renderPlaceholder:i,renderLeaf:a,selection:v}))):d.push(x.createElement(km,{decorations:y,key:f.id,isLast:h&&m===n.children.length-1,parent:n,renderPlaceholder:i,renderLeaf:a,text:g})),eu.set(g,m),tu.set(g,n)}return d},Tm=x.createContext(!1),kw=()=>x.useContext(Tm),Bm=x.createContext(null),zn=()=>{var e=x.useContext(Bm);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function Fw(){var e=En(),t=x.useRef(!1),n=x.useRef(0),r=x.useCallback(()=>{if(!t.current){t.current=!0;var i=re.getWindow(e);i.cancelAnimationFrame(n.current),n.current=i.requestAnimationFrame(()=>{t.current=!1})}},[e]);return x.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var Aw=3,Tw={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",insertSoftBreak:"shift+enter",splitBlock:"enter",undo:"mod+z"},Bw={moveLineBackward:"opt+up",moveLineForward:"opt+down",moveWordBackward:"opt+left",moveWordForward:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},Sw={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ge=e=>{var t=Tw[e],n=Bw[e],r=Sw[e],i=t&&ns(t),a=n&&ns(n),s=r&&ns(r);return o=>!!(i&&i(o)||mc&&a&&a(o)||!mc&&s&&s(o))},Je={isBold:Ge("bold"),isCompose:Ge("compose"),isMoveBackward:Ge("moveBackward"),isMoveForward:Ge("moveForward"),isDeleteBackward:Ge("deleteBackward"),isDeleteForward:Ge("deleteForward"),isDeleteLineBackward:Ge("deleteLineBackward"),isDeleteLineForward:Ge("deleteLineForward"),isDeleteWordBackward:Ge("deleteWordBackward"),isDeleteWordForward:Ge("deleteWordForward"),isExtendBackward:Ge("extendBackward"),isExtendForward:Ge("extendForward"),isExtendLineBackward:Ge("extendLineBackward"),isExtendLineForward:Ge("extendLineForward"),isItalic:Ge("italic"),isMoveLineBackward:Ge("moveLineBackward"),isMoveLineForward:Ge("moveLineForward"),isMoveWordBackward:Ge("moveWordBackward"),isMoveWordForward:Ge("moveWordForward"),isRedo:Ge("redo"),isSoftBreak:Ge("insertSoftBreak"),isSplitBlock:Ge("splitBlock"),isTransposeCharacter:Ge("transposeCharacter"),isUndo:Ge("undo")},jw=(e,t)=>{var n=[],r=()=>{n=[]},i=s=>{if(t.current){var o=s.filter(u=>iu(e,u,s));n.push(...o)}};function a(){n.length>0&&(n.reverse().forEach(s=>{s.type!=="characterData"&&(s.removedNodes.forEach(o=>{s.target.insertBefore(o,s.nextSibling)}),s.addedNodes.forEach(o=>{s.target.removeChild(o)}))}),r())}return{registerMutations:i,restoreDOM:a,clear:r}},Pw={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Sm extends x.Component{constructor(){super(...arguments),Mt(this,"context",null),Mt(this,"manager",null),Mt(this,"mutationObserver",null)}observe(){var t,{node:n}=this.props;if(!n.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");(t=this.mutationObserver)===null||t===void 0||t.observe(n.current,Pw)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=jw(n,t),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var t,n,r,i=(t=this.mutationObserver)===null||t===void 0?void 0:t.takeRecords();if(i!=null&&i.length){var a;(a=this.manager)===null||a===void 0||a.registerMutations(i)}return(n=this.mutationObserver)===null||n===void 0||n.disconnect(),(r=this.manager)===null||r===void 0||r.restoreDOM(),null}componentDidUpdate(){var t;(t=this.manager)===null||t===void 0||t.clear(),this.observe()}componentWillUnmount(){var t;(t=this.mutationObserver)===null||t===void 0||t.disconnect()}render(){return this.props.children}}Mt(Sm,"contextType",Xo);var Ow=mt?Sm:e=>{var{children:t}=e;return x.createElement(x.Fragment,null,t)},Mw=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],Nw=["text"];function Dc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Wt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Dc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Iw=e=>x.createElement(x.Fragment,null,Am(e)),Rw=e=>{var t=x.useCallback(j=>x.createElement($w,Wt({},j)),[]),{autoFocus:n,decorate:r=Lw,onDOMBeforeInput:i,placeholder:a,readOnly:s=!1,renderElement:o,renderLeaf:u,renderPlaceholder:l=t,scrollSelectionIntoView:d=zw,style:h={},as:m="div",disableDefaultStyles:p=!1}=e,g=mr(e,Mw),f=zn(),[b,v]=x.useState(!1),y=x.useRef(null),C=x.useRef([]),[k,D]=x.useState(),{onUserInput:_,receivedUserInput:B}=Fw(),[,M]=x.useReducer(j=>j+1,0);vm.set(f,M),Js.set(f,s);var P=x.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);x.useEffect(()=>{y.current&&n&&y.current.focus()},[n]);var z=x.useRef(),O=x.useMemo(()=>b0(()=>{var j=z.current;if((mt||!re.isComposing(f))&&(!P.isUpdatingSelection||j!=null&&j.isFlushing())&&!P.isDraggingInternally){var R=re.findDocumentOrShadowRoot(f),{activeElement:N}=R,U=re.toDOMNode(f,f),X=R.getSelection();if(N===U?(P.latestElement=N,bn.set(f,!0)):bn.delete(f),!X)return ee.deselect(f);var{anchorNode:W,focusNode:te}=X,de=re.hasEditableTarget(f,W)||re.isTargetInsideNonReadonlyVoid(f,W),J=re.hasEditableTarget(f,te)||re.isTargetInsideNonReadonlyVoid(f,te);if(de&&J){var ve=re.toSlateRange(f,X,{exactMatch:!1,suppressThrow:!0});ve&&(!re.isComposing(f)&&!(j!=null&&j.hasPendingChanges())&&!(j!=null&&j.isFlushing())?ee.select(f,ve):j==null||j.handleUserSelect(ve))}s&&(!de||!J)&&ee.deselect(f)}},100),[f,s,P]),A=x.useMemo(()=>f0(O,0),[O]);z.current=sw({node:y,onDOMSelectionChange:O,scheduleOnDOMSelectionChange:A}),ti(()=>{var j,R,N;y.current&&(N=ru(y.current))?(gm.set(f,N),Li.set(f,y.current),Pn.set(f,y.current),ei.set(y.current,f)):Pn.delete(f);var{selection:U}=f,X=re.findDocumentOrShadowRoot(f),W=X.getSelection();if(!(!W||!re.isFocused(f)||(j=z.current)!==null&&j!==void 0&&j.hasPendingAction())){var te=me=>{var ye=W.type!=="None";if(!(!U&&!ye)){var _e=W.focusNode,De;if(er&&W.rangeCount>1){var ze=W.getRangeAt(0),We=W.getRangeAt(W.rangeCount-1);ze.startContainer===_e?De=We.endContainer:De=ze.startContainer}else De=W.anchorNode;var He=Li.get(f),Ke=!1;if(He.contains(De)&&He.contains(_e)&&(Ke=!0),ye&&Ke&&U&&!me){var Be=re.toSlateRange(f,W,{exactMatch:!0,suppressThrow:!0});if(Be&&Q.equals(Be,U)){var Me;if(!P.hasMarkPlaceholder||(Me=De)!==null&&Me!==void 0&&(Me=Me.parentElement)!==null&&Me!==void 0&&Me.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!re.hasRange(f,U)){f.selection=re.toSlateRange(f,W,{exactMatch:!1,suppressThrow:!0});return}P.isUpdatingSelection=!0;var Ce=U&&re.toDOMRange(f,U);return Ce?(re.isComposing(f)&&!mt?W.collapseToEnd():Q.isBackward(U)?W.setBaseAndExtent(Ce.endContainer,Ce.endOffset,Ce.startContainer,Ce.startOffset):W.setBaseAndExtent(Ce.startContainer,Ce.startOffset,Ce.endContainer,Ce.endOffset),d(f,Ce)):W.removeAllRanges(),Ce}};W.rangeCount<=1&&te();var de=((R=z.current)===null||R===void 0?void 0:R.isFlushing())==="action";if(!mt||!de){setTimeout(()=>{P.isUpdatingSelection=!1});return}var J=null,ve=requestAnimationFrame(()=>{if(de){var me=ye=>{try{var _e=re.toDOMNode(f,f);_e.focus(),te(ye)}catch{}};me(),J=setTimeout(()=>{me(!0),P.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ve),J&&clearTimeout(J)}}});var F=x.useCallback(j=>{if(_(),!s&&re.hasEditableTarget(f,j.target)&&!qw(j,i)){var R;if(z.current)return z.current.handleDOMBeforeInput(j);A.flush(),O.flush();var{selection:N}=f,{inputType:U}=j,X=j.dataTransfer||j.data||void 0,W=U==="insertCompositionText"||U==="deleteCompositionText";if(W&&re.isComposing(f))return;var te=!1;if(U==="insertText"&&N&&Q.isCollapsed(N)&&j.data&&j.data.length===1&&/[a-z ]/i.test(j.data)&&N.anchor.offset!==0){var de,J;te=!0,f.marks&&(te=!1);var{anchor:ve}=N,[me,ye]=re.toDOMPoint(f,ve),_e=(de=me.parentElement)===null||de===void 0?void 0:de.closest("a"),De=re.getWindow(f);if(te&&_e&&re.hasDOMNode(f,_e)){var ze,We=De==null?void 0:De.document.createTreeWalker(_e,NodeFilter.SHOW_TEXT).lastChild();We===me&&((ze=We.textContent)===null||ze===void 0?void 0:ze.length)===ye&&(te=!1)}if(te&&me.parentElement&&(De==null||(J=De.getComputedStyle(me.parentElement))===null||J===void 0?void 0:J.whiteSpace)==="pre"){var He=w.above(f,{at:ve.path,match:se=>he.isElement(se)&&w.isBlock(f,se)});He&&le.string(He[0]).includes(" ")&&(te=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[Ke]=j.getTargetRanges();if(Ke){var Be=re.toSlateRange(f,Ke,{exactMatch:!1,suppressThrow:!1});if(!N||!Q.equals(N,Be)){te=!1;var Me=!W&&f.selection&&w.rangeRef(f,f.selection);ee.select(f,Be),Me&&Lr.set(f,Me)}}}if(W)return;if(te||j.preventDefault(),N&&Q.isExpanded(N)&&U.startsWith("delete")){var Ce=U.endsWith("Backward")?"backward":"forward";w.deleteFragment(f,{direction:Ce});return}switch(U){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{w.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{w.deleteForward(f);break}case"deleteContentBackward":{w.deleteBackward(f);break}case"deleteEntireSoftLine":{w.deleteBackward(f,{unit:"line"}),w.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{w.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{w.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{w.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{w.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{w.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{w.deleteForward(f,{unit:"word"});break}case"insertLineBreak":w.insertSoftBreak(f);break;case"insertParagraph":{w.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{U==="insertFromComposition"&&re.isComposing(f)&&(v(!1),Bn.set(f,!1)),(X==null?void 0:X.constructor.name)==="DataTransfer"?re.insertData(f,X):typeof X=="string"&&(te?C.current.push(()=>w.insertText(f,X)):w.insertText(f,X));break}}var G=(R=Lr.get(f))===null||R===void 0?void 0:R.unref();Lr.delete(f),G&&(!f.selection||!Q.equals(f.selection,G))&&ee.select(f,G)}},[f,O,_,i,s,A]),S=x.useCallback(j=>{j==null?(O.cancel(),A.cancel(),Li.delete(f),Pn.delete(f),y.current&&fn&&y.current.removeEventListener("beforeinput",F)):fn&&j.addEventListener("beforeinput",F),y.current=j},[O,A,f,F]);ti(()=>{var j=re.getWindow(f);return j.document.addEventListener("selectionchange",A),()=>{j.document.removeEventListener("selectionchange",A)}},[A]);var I=r([f,[]]),H=a&&f.children.length===1&&Array.from(le.texts(f)).length===1&&le.string(f)===""&&!b,V=x.useCallback(j=>{if(j&&H){var R;D((R=j.getBoundingClientRect())===null||R===void 0?void 0:R.height)}else D(void 0)},[H]);if(H){var ae=w.start(f,[]);I.push({[hr]:!0,placeholder:a,onPlaceholderResize:V,anchor:ae,focus:ae})}var{marks:ne}=f;if(P.hasMarkPlaceholder=!1,f.selection&&Q.isCollapsed(f.selection)&&ne){var{anchor:E}=f.selection,Y=le.leaf(f,E.path),q=mr(Y,Nw);if(!ge.equals(Y,ne,{loose:!0})){P.hasMarkPlaceholder=!0;var T=Object.fromEntries(Object.keys(q).map(j=>[j,null]));I.push(Wt(Wt(Wt({[bm]:!0},T),ne),{},{anchor:E,focus:E}))}}return x.useEffect(()=>{setTimeout(()=>{var{selection:j}=f;if(j){var{anchor:R}=j,N=le.leaf(f,R.path);if(ne&&!ge.equals(N,ne,{loose:!0})){$t.set(f,ne);return}}$t.delete(f)})}),x.createElement(Tm.Provider,{value:s},x.createElement(Fm.Provider,{value:r},x.createElement(Ow,{node:y,receivedUserInput:B},x.createElement(m,Wt(Wt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:fn||!$i?g.spellCheck:!1,autoCorrect:fn||!$i?g.autoCorrect:"false",autoCapitalize:fn||!$i?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:S,style:Wt(Wt({},p?{}:Wt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},k?{minHeight:k}:{})),h),onBeforeInput:x.useCallback(j=>{if(!fn&&!s&&!dt(j,g.onBeforeInput)&&re.hasSelectableTarget(f,j.target)&&(j.preventDefault(),!re.isComposing(f))){var R=j.data;w.insertText(f,R)}},[g.onBeforeInput,f,s]),onInput:x.useCallback(j=>{if(!dt(j,g.onInput)){if(z.current){z.current.handleInput();return}for(var R of C.current)R();C.current=[]}},[g.onInput]),onBlur:x.useCallback(j=>{if(!(s||P.isUpdatingSelection||!re.hasSelectableTarget(f,j.target)||dt(j,g.onBlur))){var R=re.findDocumentOrShadowRoot(f);if(P.latestElement!==R.activeElement){var{relatedTarget:N}=j,U=re.toDOMNode(f,f);if(N!==U&&!(Ot(N)&&N.hasAttribute("data-slate-spacer"))){if(N!=null&&xn(N)&&re.hasDOMNode(f,N)){var X=re.toSlateNode(f,N);if(he.isElement(X)&&!f.isVoid(X))return}if(Mr){var W=R.getSelection();W==null||W.removeAllRanges()}bn.delete(f)}}}},[s,P.isUpdatingSelection,P.latestElement,f,g.onBlur]),onClick:x.useCallback(j=>{if(re.hasTarget(f,j.target)&&!dt(j,g.onClick)&&xn(j.target)){var R=re.toSlateNode(f,j.target),N=re.findPath(f,R);if(!w.hasPath(f,N)||le.get(f,N)!==R)return;if(j.detail===Aw&&N.length>=1){var U=N;if(!(he.isElement(R)&&w.isBlock(f,R))){var X,W=w.above(f,{match:_e=>he.isElement(_e)&&w.isBlock(f,_e),at:N});U=(X=W==null?void 0:W[1])!==null&&X!==void 0?X:N.slice(0,1)}var te=w.range(f,U);ee.select(f,te);return}if(s)return;var de=w.start(f,N),J=w.end(f,N),ve=w.void(f,{at:de}),me=w.void(f,{at:J});if(ve&&me&&L.equals(ve[1],me[1])){var ye=w.range(f,de);ee.select(f,ye)}}},[f,g.onClick,s]),onCompositionEnd:x.useCallback(j=>{if(re.hasSelectableTarget(f,j.target)){var R;if(re.isComposing(f)&&Promise.resolve().then(()=>{v(!1),Bn.set(f,!1)}),(R=z.current)===null||R===void 0||R.handleCompositionEnd(j),dt(j,g.onCompositionEnd)||mt)return;if(!Mr&&!S1&&!F1&&!P1&&!j1&&j.data){var N=$t.get(f);$t.delete(f),N!==void 0&&(rn.set(f,f.marks),f.marks=N),w.insertText(f,j.data);var U=rn.get(f);rn.delete(f),U!==void 0&&(f.marks=U)}}},[g.onCompositionEnd,f]),onCompositionUpdate:x.useCallback(j=>{re.hasSelectableTarget(f,j.target)&&!dt(j,g.onCompositionUpdate)&&(re.isComposing(f)||(v(!0),Bn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:x.useCallback(j=>{if(re.hasSelectableTarget(f,j.target)){var R;if((R=z.current)===null||R===void 0||R.handleCompositionStart(j),dt(j,g.onCompositionStart)||mt)return;v(!0);var{selection:N}=f;if(N&&Q.isExpanded(N)){w.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:x.useCallback(j=>{re.hasSelectableTarget(f,j.target)&&!dt(j,g.onCopy)&&!Ec(j)&&(j.preventDefault(),re.setFragmentData(f,j.clipboardData,"copy"))},[g.onCopy,f]),onCut:x.useCallback(j=>{if(!s&&re.hasSelectableTarget(f,j.target)&&!dt(j,g.onCut)&&!Ec(j)){j.preventDefault(),re.setFragmentData(f,j.clipboardData,"cut");var{selection:R}=f;if(R)if(Q.isExpanded(R))w.deleteFragment(f);else{var N=le.parent(f,R.anchor.path);w.isVoid(f,N)&&ee.delete(f)}}},[s,f,g.onCut]),onDragOver:x.useCallback(j=>{if(re.hasTarget(f,j.target)&&!dt(j,g.onDragOver)){var R=re.toSlateNode(f,j.target);he.isElement(R)&&w.isVoid(f,R)&&j.preventDefault()}},[g.onDragOver,f]),onDragStart:x.useCallback(j=>{if(!s&&re.hasTarget(f,j.target)&&!dt(j,g.onDragStart)){var R=re.toSlateNode(f,j.target),N=re.findPath(f,R),U=he.isElement(R)&&w.isVoid(f,R)||w.void(f,{at:N,voids:!0});if(U){var X=w.range(f,N);ee.select(f,X)}P.isDraggingInternally=!0,re.setFragmentData(f,j.dataTransfer,"drag")}},[s,f,g.onDragStart,P]),onDrop:x.useCallback(j=>{if(!s&&re.hasTarget(f,j.target)&&!dt(j,g.onDrop)){j.preventDefault();var R=f.selection,N=re.findEventRange(f,j),U=j.dataTransfer;ee.select(f,N),P.isDraggingInternally&&R&&!Q.equals(R,N)&&!w.void(f,{at:N,voids:!0})&&ee.delete(f,{at:R}),re.insertData(f,U),re.isFocused(f)||re.focus(f)}P.isDraggingInternally=!1},[s,f,g.onDrop,P]),onDragEnd:x.useCallback(j=>{!s&&P.isDraggingInternally&&g.onDragEnd&&re.hasTarget(f,j.target)&&g.onDragEnd(j),P.isDraggingInternally=!1},[s,P,g,f]),onFocus:x.useCallback(j=>{if(!s&&!P.isUpdatingSelection&&re.hasEditableTarget(f,j.target)&&!dt(j,g.onFocus)){var R=re.toDOMNode(f,f),N=re.findDocumentOrShadowRoot(f);if(P.latestElement=N.activeElement,er&&j.target!==R){R.focus();return}bn.set(f,!0)}},[s,P,f,g.onFocus]),onKeyDown:x.useCallback(j=>{if(!s&&re.hasEditableTarget(f,j.target)){var R;(R=z.current)===null||R===void 0||R.handleKeyDown(j);var{nativeEvent:N}=j;if(re.isComposing(f)&&N.isComposing===!1&&(Bn.set(f,!1),v(!1)),dt(j,g.onKeyDown)||re.isComposing(f))return;var{selection:U}=f,X=f.children[U!==null?U.focus.path[0]:0],W=Uf(le.string(X))==="rtl";if(Je.isRedo(N)){j.preventDefault();var te=f;typeof te.redo=="function"&&te.redo();return}if(Je.isUndo(N)){j.preventDefault();var de=f;typeof de.undo=="function"&&de.undo();return}if(Je.isMoveLineBackward(N)){j.preventDefault(),ee.move(f,{unit:"line",reverse:!0});return}if(Je.isMoveLineForward(N)){j.preventDefault(),ee.move(f,{unit:"line"});return}if(Je.isExtendLineBackward(N)){j.preventDefault(),ee.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Je.isExtendLineForward(N)){j.preventDefault(),ee.move(f,{unit:"line",edge:"focus"});return}if(Je.isMoveBackward(N)){j.preventDefault(),U&&Q.isCollapsed(U)?ee.move(f,{reverse:!W}):ee.collapse(f,{edge:W?"end":"start"});return}if(Je.isMoveForward(N)){j.preventDefault(),U&&Q.isCollapsed(U)?ee.move(f,{reverse:W}):ee.collapse(f,{edge:W?"start":"end"});return}if(Je.isMoveWordBackward(N)){j.preventDefault(),U&&Q.isExpanded(U)&&ee.collapse(f,{edge:"focus"}),ee.move(f,{unit:"word",reverse:!W});return}if(Je.isMoveWordForward(N)){j.preventDefault(),U&&Q.isExpanded(U)&&ee.collapse(f,{edge:"focus"}),ee.move(f,{unit:"word",reverse:W});return}if(fn){if((pm||Mr)&&U&&(Je.isDeleteBackward(N)||Je.isDeleteForward(N))&&Q.isCollapsed(U)){var J=le.parent(f,U.anchor.path);if(he.isElement(J)&&w.isVoid(f,J)&&(w.isInline(f,J)||w.isBlock(f,J))){j.preventDefault(),w.deleteBackward(f,{unit:"block"});return}}}else{if(Je.isBold(N)||Je.isItalic(N)||Je.isTransposeCharacter(N)){j.preventDefault();return}if(Je.isSoftBreak(N)){j.preventDefault(),w.insertSoftBreak(f);return}if(Je.isSplitBlock(N)){j.preventDefault(),w.insertBreak(f);return}if(Je.isDeleteBackward(N)){j.preventDefault(),U&&Q.isExpanded(U)?w.deleteFragment(f,{direction:"backward"}):w.deleteBackward(f);return}if(Je.isDeleteForward(N)){j.preventDefault(),U&&Q.isExpanded(U)?w.deleteFragment(f,{direction:"forward"}):w.deleteForward(f);return}if(Je.isDeleteLineBackward(N)){j.preventDefault(),U&&Q.isExpanded(U)?w.deleteFragment(f,{direction:"backward"}):w.deleteBackward(f,{unit:"line"});return}if(Je.isDeleteLineForward(N)){j.preventDefault(),U&&Q.isExpanded(U)?w.deleteFragment(f,{direction:"forward"}):w.deleteForward(f,{unit:"line"});return}if(Je.isDeleteWordBackward(N)){j.preventDefault(),U&&Q.isExpanded(U)?w.deleteFragment(f,{direction:"backward"}):w.deleteBackward(f,{unit:"word"});return}if(Je.isDeleteWordForward(N)){j.preventDefault(),U&&Q.isExpanded(U)?w.deleteFragment(f,{direction:"forward"}):w.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:x.useCallback(j=>{!s&&re.hasEditableTarget(f,j.target)&&!dt(j,g.onPaste)&&(!fn||N1(j.nativeEvent)||Mr)&&(j.preventDefault(),re.insertData(f,j.clipboardData))},[s,f,g.onPaste])}),x.createElement(Iw,{decorations:I,node:f,renderElement:o,renderPlaceholder:l,renderLeaf:u,selection:f.selection})))))},$w=e=>{var{attributes:t,children:n}=e;return x.createElement("span",Wt({},t),n,mt&&x.createElement("br",null))},Lw=()=>[],zw=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&Q.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),w0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},dt=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},Ec=e=>xn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),qw=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},Uw=x.createContext(!1),Ww=x.createContext({});function Vw(e){var t=x.useRef([]).current,n=x.useRef({editor:e}).current,r=x.useCallback(a=>{n.editor=a,t.forEach(s=>s(a))},[t,n]),i=x.useMemo(()=>({getSlate:()=>n.editor,addEventListener:a=>(t.push(a),()=>{t.splice(t.indexOf(a),1)})}),[t,n]);return{selectorContext:i,onChange:r}}var Hw=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],Kw=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:i,onValueChange:a,initialValue:s}=e,o=mr(e,Hw),[u,l]=x.useState(()=>{if(!le.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(at.stringify(s)));if(!w.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(at.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:h}=Vw(t),m=x.useCallback(f=>{var b;switch(r&&r(t.children),f==null||(b=f.operation)===null||b===void 0?void 0:b.type){case"set_selection":i==null||i(t.selection);break;default:a==null||a(t.children)}l(v=>({v:v.v+1,editor:t})),h(t)},[t,h,r,i,a]);x.useEffect(()=>(Xs.set(t,m),()=>{Xs.set(t,()=>{})}),[t,m]);var[p,g]=x.useState(re.isFocused(t));return x.useEffect(()=>{g(re.isFocused(t))},[t]),ti(()=>{var f=()=>g(re.isFocused(t));return hm>=17?(document.addEventListener("focusin",f),document.addEventListener("focusout",f),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",f)}):(document.addEventListener("focus",f,!0),document.addEventListener("blur",f,!0),()=>{document.removeEventListener("focus",f,!0),document.removeEventListener("blur",f,!0)})},[]),x.createElement(Ww.Provider,{value:d},x.createElement(Bm.Provider,{value:u},x.createElement(Xo.Provider,{value:u.editor},x.createElement(Uw.Provider,{value:p},n))))},_c=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},kc=(e,t,n)=>{var r=re.toDOMRange(e,t).getBoundingClientRect(),i=re.toDOMRange(e,n).getBoundingClientRect();return _c(r,i)&&_c(i,r)},Zw=(e,t)=>{var n=w.range(e,Q.end(t)),r=Array.from(w.positions(e,{at:t})),i=0,a=r.length,s=Math.floor(a/2);if(kc(e,w.range(e,r[i]),n))return w.range(e,r[i],n);if(r.length<2)return w.range(e,r[r.length-1],n);for(;s!==r.length&&s!==i;)kc(e,w.range(e,r[s]),n)?a=s:i=s,s=Math.floor((i+a)/2);return w.range(e,r[a],n)};function Fc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ac(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Fc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Yw=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",r=t,{apply:i,onChange:a,deleteBackward:s,addMark:o,removeMark:u}=r;return Ea.set(r,new WeakMap),r.addMark=(l,d)=>{var h,m;(h=nu.get(r))===null||h===void 0||h(),!$t.get(r)&&(m=bt.get(r))!==null&&m!==void 0&&m.length&&$t.set(r,null),rn.delete(r),o(l,d)},r.removeMark=l=>{var d;!$t.get(r)&&(d=bt.get(r))!==null&&d!==void 0&&d.length&&$t.set(r,null),rn.delete(r),u(l)},r.deleteBackward=l=>{if(l!=="line")return s(l);if(r.selection&&Q.isCollapsed(r.selection)){var d=w.above(r,{match:g=>he.isElement(g)&&w.isBlock(r,g),at:r.selection});if(d){var[,h]=d,m=w.range(r,h,r.selection.anchor),p=Zw(r,m);Q.isCollapsed(p)||ee.delete(r,{at:p})}}},r.apply=l=>{var d=[],h=[],m=bt.get(r);if(m!=null&&m.length){var p=m.map(S=>Y1(S,l)).filter(Boolean);bt.set(r,p)}var g=pn.get(r);g&&pn.set(r,pc(r,g,l));var f=hn.get(r);if(f!=null&&f.at){var b=Se.isPoint(f==null?void 0:f.at)?no(r,f.at,l):pc(r,f.at,l);hn.set(r,b?Ac(Ac({},f),{},{at:b}):null)}switch(l.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Kn(r,l.path));break}case"set_selection":{var v;(v=Lr.get(r))===null||v===void 0||v.unref(),Lr.delete(r);break}case"insert_node":case"remove_node":{d.push(...Kn(r,L.parent(l.path)));break}case"merge_node":{var y=L.previous(l.path);d.push(...Kn(r,y));break}case"move_node":{var C=L.common(L.parent(l.path),L.parent(l.newPath));d.push(...Kn(r,C));var k;L.isBefore(l.path,l.newPath)?(d.push(...Kn(r,L.parent(l.path))),k=l.newPath):(d.push(...Kn(r,L.parent(l.newPath))),k=l.path);var D=le.get(t,L.parent(k)),_=re.findKey(r,D),B=w.pathRef(r,L.parent(k));h.push([B,_]);break}}i(l);for(var[M,P]of d){var[z]=w.node(r,M);aa.set(z,P)}for(var[O,A]of h)if(O.current){var[F]=w.node(r,O.current);aa.set(F,A)}},r.setFragmentData=l=>{var{selection:d}=r;if(d){var[h,m]=Q.edges(d),p=w.void(r,{at:h.path}),g=w.void(r,{at:m.path});if(!(Q.isCollapsed(d)&&!p)){var f=re.toDOMRange(r,d),b=f.cloneContents(),v=b.childNodes[0];if(b.childNodes.forEach(z=>{z.textContent&&z.textContent.trim()!==""&&(v=z)}),g){var[y]=g,C=f.cloneRange(),k=re.toDOMNode(r,y);C.setEndAfter(k),b=C.cloneContents()}if(p&&(v=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(z=>{var O=z.getAttribute("data-slate-zero-width")==="n";z.textContent=O?`
81
+ `:""}),ym(v)){var D=v.ownerDocument.createElement("span");D.style.whiteSpace="pre",D.appendChild(v),b.appendChild(D),v=D}var _=r.getFragment(),B=JSON.stringify(_),M=window.btoa(encodeURIComponent(B));v.setAttribute("data-slate-fragment",M),l.setData("application/".concat(n),M);var P=b.ownerDocument.createElement("div");return P.appendChild(b),P.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(P),l.setData("text/html",P.innerHTML),l.setData("text/plain",wm(P)),b.ownerDocument.body.removeChild(P),l}}},r.insertData=l=>{r.insertFragmentData(l)||r.insertTextData(l)},r.insertFragmentData=l=>{var d=l.getData("application/".concat(n))||z1(l);if(d){var h=decodeURIComponent(window.atob(d)),m=JSON.parse(h);return r.insertFragment(m),!0}return!1},r.insertTextData=l=>{var d=l.getData("text/plain");if(d){var h=d.split(/\r\n|\r|\n/),m=!1;for(var p of h)m&&ee.splitNodes(r,{always:!0}),r.insertText(p),m=!0;return!0}return!1},r.onChange=l=>{var d=hm<18?gd.unstable_batchedUpdates:h=>h();d(()=>{var h=Xs.get(r);h&&h(l),a(l)})},r},Kn=(e,t)=>{var n=[];for(var[r,i]of w.levels(e,{at:t})){var a=re.findKey(e,r);n.push([i,a])}return n};const io="MENTION: ",jm={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},Tc={"mention-popover":35,default:-52},is=16,Pm=(e,t,n)=>{const r=x.useRef(null),{showLinkEditor:i,mentionPopover:a}=x.useContext(cn),s=t==="link-editor"?i:a.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),x.useEffect(()=>{var p,g;if(!(r!=null&&r.current)||!s)return;const u=r==null?void 0:r.current;if(!u)return;let l,d=0;if(t==="mention-popover"){const{position:f}=a,b=C=>{if(!w.hasPath(e,C.path))return!1;const k=le.get(e,C.path);return w.isEditor(k)||he.isElement(k)?C.offset<=k.children.length:ge.isText(k)?C.offset<=k.text.length:!1};if(f&&(!b(f==null?void 0:f.anchor)||!b(f==null?void 0:f.focus)))return;l=re.toDOMRange(e,f||jm).getBoundingClientRect();const y=(p=document.getElementById(n))==null?void 0:p.getBoundingClientRect();u.style.setProperty("--width",`${((y==null?void 0:y.width)||0)/is}rem`),d=(y==null?void 0:y.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(l=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}l||(l=(g=document.getElementById(n))==null?void 0:g.getBoundingClientRect());const h=Tc[t]||Tc.default,m=((l==null?void 0:l.top)||0)+window.scrollY+h;d===0&&(d=Math.max(((l==null?void 0:l.left)||0)-(u.offsetWidth-((l==null?void 0:l.width)||0)),0)),u.style.top=`${m/is}rem`,u.style.left=`${d/is}rem`},o),r},Gw=e=>{const[t,n]=x.useState(null);return x.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[i]=w.nodes(e,{at:r,match:a=>a.type===Z.link});if(i){const a=i[0],s=bo(a.link),o=a.children[0],u=(o==null?void 0:o.text)||"";n({...s,text:u})}else n(null)},[e,e.selection]),t};var ft=(e=>(e.paragraph="paragraph",e.heading="heading",e.list="list",e.listItem="listItem",e.link="link",e.mention="mention",e.image="image",e.blockquote="blockquote",e.code="code",e.html="html",e.emphasis="emphasis",e.strong="strong",e.delete="delete",e.inlineCode="inlineCode",e.thematicBreak="thematicBreak",e.text="text",e.h3="heading_three",e))(ft||{});const tr={[Z.paragraph]:Z.paragraph,[Z.blockquote]:Z.blockquote,[Z.codeblock]:Z.codeblock,[Z.link]:Z.link,[Z.ul]:Z.ul,[Z.ol]:Z.ol,[Z.li]:Z.li,[Z.mention]:Z.mention,[Z.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Kt.emphasis]:Z.italic,[Kt.strong]:Z.bold,[Kt.delete]:Z.strikethrough,[Kt.code]:Z.code,[Z.hr]:Z.hr,[Z.image]:Z.image,[Z.h3]:Z.h3};function Bc(e){if(e)throw e}var zi=Object.prototype.hasOwnProperty,Om=Object.prototype.toString,Sc=Object.defineProperty,jc=Object.getOwnPropertyDescriptor,Pc=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Om.call(t)==="[object Array]"},Oc=function(t){if(!t||Om.call(t)!=="[object Object]")return!1;var n=zi.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&zi.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||zi.call(t,i)},Mc=function(t,n){Sc&&n.name==="__proto__"?Sc(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Nc=function(t,n){if(n==="__proto__")if(zi.call(t,n)){if(jc)return jc(t,n).value}else return;return t[n]},Qw=function e(){var t,n,r,i,a,s,o=arguments[0],u=1,l=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},u=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});u<l;++u)if(t=arguments[u],t!=null)for(n in t)r=Nc(o,n),i=Nc(t,n),o!==i&&(d&&i&&(Oc(i)||(a=Pc(i)))?(a?(a=!1,s=r&&Pc(r)?r:[]):s=r&&Oc(r)?r:{},Mc(o,{name:n,newValue:e(d,s,i)})):typeof i<"u"&&Mc(o,{name:n,newValue:i}));return o};const as=$n(Qw);function ao(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Jw(){const e=[],t={run:n,use:r};return t;function n(...i){let a=-1;const s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...i);function o(u,...l){const d=e[++a];let h=-1;if(u){s(u);return}for(;++h<i.length;)(l[h]===null||l[h]===void 0)&&(l[h]=i[h]);i=l,d?Xw(d,o)(...l):s(null,...l)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Xw(e,t){let n;return r;function r(...s){const o=e.length>s.length;let u;o&&s.push(i);try{u=e.apply(this,s)}catch(l){const d=l;if(o&&n)throw d;return i(d)}o||(u&&u.then&&typeof u.then=="function"?u.then(a,i):u instanceof Error?i(u):a(u))}function i(s,...o){n||(n=!0,t(s,...o))}function a(s){i(null,s)}}function zr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ic(e.position):"start"in e||"end"in e?Ic(e):"line"in e||"column"in e?so(e):""}function so(e){return Rc(e&&e.line)+":"+Rc(e&&e.column)}function Ic(e){return so(e&&e.start)+"-"+so(e&&e.end)}function Rc(e){return e&&typeof e=="number"?e:1}class Ct extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},s=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?i=t:!a.cause&&t&&(s=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?a.ruleId=r:(a.source=r.slice(0,u),a.ruleId=r.slice(u+1))}if(!a.place&&a.ancestors&&a.ancestors){const u=a.ancestors[a.ancestors.length-1];u&&(a.place=u.position)}const o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=o?o.line:void 0,this.name=zr(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=s&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual,this.expected,this.note,this.url}}Ct.prototype.file="";Ct.prototype.name="";Ct.prototype.reason="";Ct.prototype.message="";Ct.prototype.stack="";Ct.prototype.column=void 0;Ct.prototype.line=void 0;Ct.prototype.ancestors=void 0;Ct.prototype.cause=void 0;Ct.prototype.fatal=void 0;Ct.prototype.place=void 0;Ct.prototype.ruleId=void 0;Ct.prototype.source=void 0;const Vt={basename:eC,dirname:tC,extname:nC,join:rC,sep:"/"};function eC(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');si(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else s<0&&(a=!0,s=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(r=i):(o=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function tC(e){if(si(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function nC(e){si(e);let t=e.length,n=-1,r=0,i=-1,a=0,s;for(;t--;){const o=e.codePointAt(t);if(o===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),o===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function rC(...e){let t=-1,n;for(;++t<e.length;)si(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":iC(n)}function iC(e){si(e);const t=e.codePointAt(0)===47;let n=aC(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function aC(e,t){let n="",r=0,i=-1,a=0,s=-1,o,u;for(;++s<=e.length;){if(s<e.length)o=e.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(i===s-1||a===1))if(i!==s-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=s,a=0;continue}}else if(n.length>0){n="",r=0,i=s,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a>-1?a++:a=-1}return n}function si(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const sC={cwd:oC};function oC(){return"/"}function oo(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function uC(e){if(typeof e=="string")e=new URL(e);else if(!oo(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return lC(e)}function lC(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const ss=["history","path","basename","stem","extname","dirname"];class cC{constructor(t){let n;t?oo(t)?n={path:t}:typeof t=="string"||dC(t)?n={value:t}:n=t:n={},this.cwd=sC.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ss.length;){const a=ss[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let i;for(i in n)ss.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Vt.basename(this.path):void 0}set basename(t){us(t,"basename"),os(t,"basename"),this.path=Vt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Vt.dirname(this.path):void 0}set dirname(t){$c(this.basename,"dirname"),this.path=Vt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Vt.extname(this.path):void 0}set extname(t){if(os(t,"extname"),$c(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Vt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){oo(t)&&(t=uC(t)),us(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Vt.basename(this.path,this.extname):void 0}set stem(t){us(t,"stem"),os(t,"stem"),this.path=Vt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Ct(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function os(e,t){if(e&&e.includes(Vt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Vt.sep+"`")}function us(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function $c(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function dC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const fC=function(e){const r=this.constructor.prototype,i=r[e],a=function(){return i.apply(a,arguments)};Object.setPrototypeOf(a,r);const s=Object.getOwnPropertyNames(i);for(const o of s){const u=Object.getOwnPropertyDescriptor(i,o);u&&Object.defineProperty(a,o,u)}return a},mC={}.hasOwnProperty;class au extends fC{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Jw()}copy(){const t=new au;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(as(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(ds("data",this.frozen),this.namespace[t]=n,this):mC.call(this.namespace,t)&&this.namespace[t]||void 0:t?(ds("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Fi(t),r=this.parser||this.Parser;return ls("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ls("process",this.parser||this.Parser),cs("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(a,s){const o=Fi(t),u=r.parse(o);r.run(u,o,function(d,h,m){if(d||!h||!m)return l(d);const p=h,g=r.stringify(p,m);gC(g)?m.value=g:m.result=g,l(d,m)});function l(d,h){d||!h?s(d):a?a(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),ls("processSync",this.parser||this.Parser),cs("processSync",this.compiler||this.Compiler),this.process(t,i),zc("processSync","process",n),r;function i(a,s){n=!0,Bc(a),r=s}}run(t,n,r){Lc(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(s,o){const u=Fi(n);i.run(t,u,l);function l(d,h,m){const p=h||t;d?o(d):s?s(p):r(void 0,p,m)}}}runSync(t,n){let r=!1,i;return this.run(t,n,a),zc("runSync","run",r),i;function a(s,o){Bc(s),i=o,r=!0}}stringify(t,n){this.freeze();const r=Fi(n),i=this.compiler||this.Compiler;return cs("stringify",i),Lc(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(ds("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(l){if(typeof l=="function")u(l,[]);else if(typeof l=="object")if(Array.isArray(l)){const[d,...h]=l;u(d,h)}else s(l);else throw new TypeError("Expected usable value, not `"+l+"`")}function s(l){if(!("plugins"in l)&&!("settings"in l))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(l.plugins),l.settings&&(i.settings=as(!0,i.settings,l.settings))}function o(l){let d=-1;if(l!=null)if(Array.isArray(l))for(;++d<l.length;){const h=l[d];a(h)}else throw new TypeError("Expected a list of plugins, not `"+l+"`")}function u(l,d){let h=-1,m=-1;for(;++h<r.length;)if(r[h][0]===l){m=h;break}if(m===-1)r.push([l,...d]);else if(d.length>0){let[p,...g]=d;const f=r[m][1];ao(f)&&ao(p)&&(p=as(!0,f,p)),r[m]=[l,p,...g]}}}}const hC=new au().freeze();function ls(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function cs(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ds(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Lc(e){if(!ao(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function zc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Fi(e){return pC(e)?e:new cC(e)}function pC(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function gC(e){return typeof e=="string"||vC(e)}function vC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const bC={};function yC(e,t){const n=t||bC,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Mm(e,r,i)}function Mm(e,t,n){if(xC(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return qc(e.children,t,n)}return Array.isArray(e)?qc(e,t,n):""}function qc(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Mm(e[i],t,n);return r.join("")}function xC(e){return!!(e&&typeof e=="object")}const Uc=document.createElement("i");function su(e){const t="&"+e+";";Uc.innerHTML=t;const n=Uc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function on(e,t,n,r){const i=e.length;let a=0,s;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);a<r.length;)s=r.slice(a,a+1e4),s.unshift(t,0),e.splice(...s),a+=1e4,t+=1e4}function jt(e,t){return e.length>0?(on(e,e.length,0,t),e):t}const Wc={}.hasOwnProperty;function wC(e){const t={};let n=-1;for(;++n<e.length;)CC(t,e[n]);return t}function CC(e,t){let n;for(n in t){const i=(Wc.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let s;if(a)for(s in a){Wc.call(i,s)||(i[s]=[]);const o=a[s];DC(i[s],Array.isArray(o)?o:o?[o]:[])}}}function DC(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);on(e,0,0,r)}function Nm(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ar(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ht=_n(/[A-Za-z]/),Lt=_n(/[\dA-Za-z]/),EC=_n(/[#-'*+\--9=?A-Z^-~]/);function uo(e){return e!==null&&(e<32||e===127)}const lo=_n(/\d/),_C=_n(/[\dA-Fa-f]/),kC=_n(/[!-/:-@[-`{-~]/);function Ee(e){return e!==null&&e<-2}function xt(e){return e!==null&&(e<0||e===32)}function Ie(e){return e===-2||e===-1||e===32}const FC=_n(/\p{P}|\p{S}/u),AC=_n(/\s/);function _n(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ze(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let a=0;return s;function s(u){return Ie(u)?(e.enter(n),o(u)):t(u)}function o(u){return Ie(u)&&a++<i?(e.consume(u),o):(e.exit(n),t(u))}}const TC={tokenize:BC};function BC(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ze(e,t,"linePrefix")}function i(o){return e.enter("paragraph"),a(o)}function a(o){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return Ee(o)?(e.consume(o),e.exit("chunkText"),a):(e.consume(o),s)}}const SC={tokenize:jC},Vc={tokenize:PC};function jC(e){const t=this,n=[];let r=0,i,a,s;return o;function o(C){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,u,l)(C)}return l(C)}function u(C){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&y();const k=t.events.length;let D=k,_;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){_=t.events[D][1].end;break}v(r);let B=k;for(;B<t.events.length;)t.events[B][1].end=Object.assign({},_),B++;return on(t.events,D+1,0,t.events.slice(k)),t.events.length=B,l(C)}return o(C)}function l(C){if(r===n.length){if(!i)return m(C);if(i.currentConstruct&&i.currentConstruct.concrete)return g(C);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Vc,d,h)(C)}function d(C){return i&&y(),v(r),m(C)}function h(C){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(C)}function m(C){return t.containerState={},e.attempt(Vc,p,g)(C)}function p(C){return r++,n.push([t.currentConstruct,t.containerState]),m(C)}function g(C){if(C===null){i&&y(),v(0),e.consume(C);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:a,_tokenizer:i}),f(C)}function f(C){if(C===null){b(e.exit("chunkFlow"),!0),v(0),e.consume(C);return}return Ee(C)?(e.consume(C),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(C),f)}function b(C,k){const D=t.sliceStream(C);if(k&&D.push(null),C.previous=a,a&&(a.next=C),a=C,i.defineSkip(C.start),i.write(D),t.parser.lazy[C.start.line]){let _=i.events.length;for(;_--;)if(i.events[_][1].start.offset<s&&(!i.events[_][1].end||i.events[_][1].end.offset>s))return;const B=t.events.length;let M=B,P,z;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){if(P){z=t.events[M][1].end;break}P=!0}for(v(r),_=B;_<t.events.length;)t.events[_][1].end=Object.assign({},z),_++;on(t.events,M+1,0,t.events.slice(B)),t.events.length=_}}function v(C){let k=n.length;for(;k-- >C;){const D=n[k];t.containerState=D[1],D[0].exit.call(t,e)}n.length=C}function y(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function PC(e,t,n){return Ze(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Hc(e){if(e===null||xt(e)||AC(e))return 1;if(FC(e))return 2}function ou(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const co={name:"attention",tokenize:MC,resolveAll:OC};function OC(e,t){let n=-1,r,i,a,s,o,u,l,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h=Object.assign({},e[r][1].end),m=Object.assign({},e[n][1].start);Kc(h,-u),Kc(m,u),s={type:u>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[r][1].end)},o={type:u>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:m},a={type:u>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},i={type:u>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=jt(l,[["enter",e[r][1],t],["exit",e[r][1],t]])),l=jt(l,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",a,t]]),l=jt(l,ou(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=jt(l,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,l=jt(l,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,on(e,r-1,n-r+3,l),n=r+l.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function MC(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Hc(r);let a;return s;function s(u){return a=u,e.enter("attentionSequence"),o(u)}function o(u){if(u===a)return e.consume(u),o;const l=e.exit("attentionSequence"),d=Hc(u),h=!d||d===2&&i||n.includes(u),m=!i||i===2&&d||n.includes(r);return l._open=!!(a===42?h:h&&(i||!m)),l._close=!!(a===42?m:m&&(d||!h)),t(u)}}function Kc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const NC={name:"autolink",tokenize:IC};function IC(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(p){return Ht(p)?(e.consume(p),s):p===64?n(p):l(p)}function s(p){return p===43||p===45||p===46||Lt(p)?(r=1,o(p)):l(p)}function o(p){return p===58?(e.consume(p),r=0,u):(p===43||p===45||p===46||Lt(p))&&r++<32?(e.consume(p),o):(r=0,l(p))}function u(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||uo(p)?n(p):(e.consume(p),u)}function l(p){return p===64?(e.consume(p),d):EC(p)?(e.consume(p),l):n(p)}function d(p){return Lt(p)?h(p):n(p)}function h(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):m(p)}function m(p){if((p===45||Lt(p))&&r++<63){const g=p===45?m:h;return e.consume(p),g}return n(p)}}const _a={tokenize:RC,partial:!0};function RC(e,t,n){return r;function r(a){return Ie(a)?Ze(e,i,"linePrefix")(a):i(a)}function i(a){return a===null||Ee(a)?t(a):n(a)}}const Im={name:"blockQuote",tokenize:$C,continuation:{tokenize:LC},exit:zC};function $C(e,t,n){const r=this;return i;function i(s){if(s===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),a}return n(s)}function a(s){return Ie(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function LC(e,t,n){const r=this;return i;function i(s){return Ie(s)?Ze(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):a(s)}function a(s){return e.attempt(Im,t,n)(s)}}function zC(e){e.exit("blockQuote")}const Rm={name:"characterEscape",tokenize:qC};function qC(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),i}function i(a){return kC(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const $m={name:"characterReference",tokenize:UC};function UC(e,t,n){const r=this;let i=0,a,s;return o;function o(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),u}function u(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),a=31,s=Lt,d(h))}function l(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,s=_C,d):(e.enter("characterReferenceValue"),a=7,s=lo,d(h))}function d(h){if(h===59&&i){const m=e.exit("characterReferenceValue");return s===Lt&&!su(r.sliceSerialize(m))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&i++<a?(e.consume(h),d):n(h)}}const Zc={tokenize:VC,partial:!0},Yc={name:"codeFenced",tokenize:WC,concrete:!0};function WC(e,t,n){const r=this,i={tokenize:D,partial:!0};let a=0,s=0,o;return u;function u(_){return l(_)}function l(_){const B=r.events[r.events.length-1];return a=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,o=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(_)}function d(_){return _===o?(s++,e.consume(_),d):s<3?n(_):(e.exit("codeFencedFenceSequence"),Ie(_)?Ze(e,h,"whitespace")(_):h(_))}function h(_){return _===null||Ee(_)?(e.exit("codeFencedFence"),r.interrupt?t(_):e.check(Zc,f,k)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(_))}function m(_){return _===null||Ee(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(_)):Ie(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ze(e,p,"whitespace")(_)):_===96&&_===o?n(_):(e.consume(_),m)}function p(_){return _===null||Ee(_)?h(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(_))}function g(_){return _===null||Ee(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(_)):_===96&&_===o?n(_):(e.consume(_),g)}function f(_){return e.attempt(i,k,b)(_)}function b(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),v}function v(_){return a>0&&Ie(_)?Ze(e,y,"linePrefix",a+1)(_):y(_)}function y(_){return _===null||Ee(_)?e.check(Zc,f,k)(_):(e.enter("codeFlowValue"),C(_))}function C(_){return _===null||Ee(_)?(e.exit("codeFlowValue"),y(_)):(e.consume(_),C)}function k(_){return e.exit("codeFenced"),t(_)}function D(_,B,M){let P=0;return z;function z(I){return _.enter("lineEnding"),_.consume(I),_.exit("lineEnding"),O}function O(I){return _.enter("codeFencedFence"),Ie(I)?Ze(_,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):A(I)}function A(I){return I===o?(_.enter("codeFencedFenceSequence"),F(I)):M(I)}function F(I){return I===o?(P++,_.consume(I),F):P>=s?(_.exit("codeFencedFenceSequence"),Ie(I)?Ze(_,S,"whitespace")(I):S(I)):M(I)}function S(I){return I===null||Ee(I)?(_.exit("codeFencedFence"),B(I)):M(I)}}}function VC(e,t,n){const r=this;return i;function i(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a)}function a(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const fs={name:"codeIndented",tokenize:KC},HC={tokenize:ZC,partial:!0};function KC(e,t,n){const r=this;return i;function i(l){return e.enter("codeIndented"),Ze(e,a,"linePrefix",4+1)(l)}function a(l){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(l):n(l)}function s(l){return l===null?u(l):Ee(l)?e.attempt(HC,s,u)(l):(e.enter("codeFlowValue"),o(l))}function o(l){return l===null||Ee(l)?(e.exit("codeFlowValue"),s(l)):(e.consume(l),o)}function u(l){return e.exit("codeIndented"),t(l)}}function ZC(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):Ee(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):Ze(e,a,"linePrefix",4+1)(s)}function a(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):Ee(s)?i(s):n(s)}}const YC={name:"codeText",tokenize:JC,resolve:GC,previous:QC};function GC(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function QC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function JC(e,t,n){let r=0,i,a;return s;function s(h){return e.enter("codeText"),e.enter("codeTextSequence"),o(h)}function o(h){return h===96?(e.consume(h),r++,o):(e.exit("codeTextSequence"),u(h))}function u(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),u):h===96?(a=e.enter("codeTextSequence"),i=0,d(h)):Ee(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):(e.enter("codeTextData"),l(h))}function l(h){return h===null||h===32||h===96||Ee(h)?(e.exit("codeTextData"),u(h)):(e.consume(h),l)}function d(h){return h===96?(e.consume(h),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(a.type="codeTextData",l(h))}}class XC{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Sr(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Sr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Sr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Sr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Sr(this.left,n.reverse())}}}function Sr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Lm(e){const t={};let n=-1,r,i,a,s,o,u,l;const d=new XC(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,a=0,a<u.length&&u[a][1].type==="lineEndingBlank"&&(a+=2),a<u.length&&u[a][1].type==="content"))for(;++a<u.length&&u[a][1].type!=="content";)u[a][1].type==="chunkText"&&(u[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,eD(d,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--&&(s=d.get(a),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=a);i&&(r[1].end=Object.assign({},d.get(i)[1].start),o=d.slice(i,n),o.unshift(r),d.splice(i,n-i+1,o))}}return on(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!l}function eD(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const a=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,u=[],l={};let d,h,m=-1,p=n,g=0,f=0;const b=[f];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),h&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=n;++m<o.length;)o[m][0]==="exit"&&o[m-1][0]==="enter"&&o[m][1].type===o[m-1][1].type&&o[m][1].start.line!==o[m][1].end.line&&(f=m+1,b.push(f),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):b.pop(),m=b.length;m--;){const v=o.slice(b[m],b[m+1]),y=a.pop();u.push([y,y+v.length-1]),e.splice(y,2,v)}for(u.reverse(),m=-1;++m<u.length;)l[g+u[m][0]]=g+u[m][1],g+=u[m][1]-u[m][0]-1;return l}const tD={tokenize:iD,resolve:rD},nD={tokenize:aD,partial:!0};function rD(e){return Lm(e),e}function iD(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?a(o):Ee(o)?e.check(nD,s,a)(o):(e.consume(o),i)}function a(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function s(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function aD(e,t,n){const r=this;return i;function i(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ze(e,a,"linePrefix")}function a(s){if(s===null||Ee(s))return n(s);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function zm(e,t,n,r,i,a,s,o,u){const l=u||Number.POSITIVE_INFINITY;let d=0;return h;function h(v){return v===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(v),e.exit(a),m):v===null||v===32||v===41||uo(v)?n(v):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(v))}function m(v){return v===62?(e.enter(a),e.consume(v),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===62?(e.exit("chunkString"),e.exit(o),m(v)):v===null||v===60||Ee(v)?n(v):(e.consume(v),v===92?g:p)}function g(v){return v===60||v===62||v===92?(e.consume(v),p):p(v)}function f(v){return!d&&(v===null||v===41||xt(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):d<l&&v===40?(e.consume(v),d++,f):v===41?(e.consume(v),d--,f):v===null||v===32||v===40||uo(v)?n(v):(e.consume(v),v===92?b:f)}function b(v){return v===40||v===41||v===92?(e.consume(v),f):f(v)}}function qm(e,t,n,r,i,a){const s=this;let o=0,u;return l;function l(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(a),d}function d(p){return o>999||p===null||p===91||p===93&&!u||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(a),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):Ee(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||Ee(p)||o++>999?(e.exit("chunkString"),d(p)):(e.consume(p),u||(u=!Ie(p)),p===92?m:h)}function m(p){return p===91||p===92||p===93?(e.consume(p),o++,h):h(p)}}function Um(e,t,n,r,i,a){let s;return o;function o(m){return m===34||m===39||m===40?(e.enter(r),e.enter(i),e.consume(m),e.exit(i),s=m===40?41:m,u):n(m)}function u(m){return m===s?(e.enter(i),e.consume(m),e.exit(i),e.exit(r),t):(e.enter(a),l(m))}function l(m){return m===s?(e.exit(a),u(s)):m===null?n(m):Ee(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Ze(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===s||m===null||Ee(m)?(e.exit("chunkString"),l(m)):(e.consume(m),m===92?h:d)}function h(m){return m===s||m===92?(e.consume(m),d):d(m)}}function qr(e,t){let n;return r;function r(i){return Ee(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ie(i)?Ze(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const sD={name:"definition",tokenize:uD},oD={tokenize:lD,partial:!0};function uD(e,t,n){const r=this;let i;return a;function a(p){return e.enter("definition"),s(p)}function s(p){return qm.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return i=ar(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),u):n(p)}function u(p){return xt(p)?qr(e,l)(p):l(p)}function l(p){return zm(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(oD,h,h)(p)}function h(p){return Ie(p)?Ze(e,m,"whitespace")(p):m(p)}function m(p){return p===null||Ee(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function lD(e,t,n){return r;function r(o){return xt(o)?qr(e,i)(o):n(o)}function i(o){return Um(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function a(o){return Ie(o)?Ze(e,s,"whitespace")(o):s(o)}function s(o){return o===null||Ee(o)?t(o):n(o)}}const cD={name:"hardBreakEscape",tokenize:dD};function dD(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return Ee(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const fD={name:"headingAtx",tokenize:hD,resolve:mD};function mD(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},on(e,r,n-r+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function hD(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),a(d)}function a(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||xt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),u(d)):d===null||Ee(d)?(e.exit("atxHeading"),t(d)):Ie(d)?Ze(e,o,"whitespace")(d):(e.enter("atxHeadingText"),l(d))}function u(d){return d===35?(e.consume(d),u):(e.exit("atxHeadingSequence"),o(d))}function l(d){return d===null||d===35||xt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),l)}}const pD=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Gc=["pre","script","style","textarea"],gD={name:"htmlFlow",tokenize:xD,resolveTo:yD,concrete:!0},vD={tokenize:CD,partial:!0},bD={tokenize:wD,partial:!0};function yD(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function xD(e,t,n){const r=this;let i,a,s,o,u;return l;function l(T){return d(T)}function d(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),h}function h(T){return T===33?(e.consume(T),m):T===47?(e.consume(T),a=!0,f):T===63?(e.consume(T),i=3,r.interrupt?t:E):Ht(T)?(e.consume(T),s=String.fromCharCode(T),b):n(T)}function m(T){return T===45?(e.consume(T),i=2,p):T===91?(e.consume(T),i=5,o=0,g):Ht(T)?(e.consume(T),i=4,r.interrupt?t:E):n(T)}function p(T){return T===45?(e.consume(T),r.interrupt?t:E):n(T)}function g(T){const j="CDATA[";return T===j.charCodeAt(o++)?(e.consume(T),o===j.length?r.interrupt?t:A:g):n(T)}function f(T){return Ht(T)?(e.consume(T),s=String.fromCharCode(T),b):n(T)}function b(T){if(T===null||T===47||T===62||xt(T)){const j=T===47,R=s.toLowerCase();return!j&&!a&&Gc.includes(R)?(i=1,r.interrupt?t(T):A(T)):pD.includes(s.toLowerCase())?(i=6,j?(e.consume(T),v):r.interrupt?t(T):A(T)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(T):a?y(T):C(T))}return T===45||Lt(T)?(e.consume(T),s+=String.fromCharCode(T),b):n(T)}function v(T){return T===62?(e.consume(T),r.interrupt?t:A):n(T)}function y(T){return Ie(T)?(e.consume(T),y):z(T)}function C(T){return T===47?(e.consume(T),z):T===58||T===95||Ht(T)?(e.consume(T),k):Ie(T)?(e.consume(T),C):z(T)}function k(T){return T===45||T===46||T===58||T===95||Lt(T)?(e.consume(T),k):D(T)}function D(T){return T===61?(e.consume(T),_):Ie(T)?(e.consume(T),D):C(T)}function _(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),u=T,B):Ie(T)?(e.consume(T),_):M(T)}function B(T){return T===u?(e.consume(T),u=null,P):T===null||Ee(T)?n(T):(e.consume(T),B)}function M(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||xt(T)?D(T):(e.consume(T),M)}function P(T){return T===47||T===62||Ie(T)?C(T):n(T)}function z(T){return T===62?(e.consume(T),O):n(T)}function O(T){return T===null||Ee(T)?A(T):Ie(T)?(e.consume(T),O):n(T)}function A(T){return T===45&&i===2?(e.consume(T),H):T===60&&i===1?(e.consume(T),V):T===62&&i===4?(e.consume(T),Y):T===63&&i===3?(e.consume(T),E):T===93&&i===5?(e.consume(T),ne):Ee(T)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(vD,q,F)(T)):T===null||Ee(T)?(e.exit("htmlFlowData"),F(T)):(e.consume(T),A)}function F(T){return e.check(bD,S,q)(T)}function S(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),I}function I(T){return T===null||Ee(T)?F(T):(e.enter("htmlFlowData"),A(T))}function H(T){return T===45?(e.consume(T),E):A(T)}function V(T){return T===47?(e.consume(T),s="",ae):A(T)}function ae(T){if(T===62){const j=s.toLowerCase();return Gc.includes(j)?(e.consume(T),Y):A(T)}return Ht(T)&&s.length<8?(e.consume(T),s+=String.fromCharCode(T),ae):A(T)}function ne(T){return T===93?(e.consume(T),E):A(T)}function E(T){return T===62?(e.consume(T),Y):T===45&&i===2?(e.consume(T),E):A(T)}function Y(T){return T===null||Ee(T)?(e.exit("htmlFlowData"),q(T)):(e.consume(T),Y)}function q(T){return e.exit("htmlFlow"),t(T)}}function wD(e,t,n){const r=this;return i;function i(s){return Ee(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):n(s)}function a(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function CD(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(_a,t,n)}}const DD={name:"htmlText",tokenize:ED};function ED(e,t,n){const r=this;let i,a,s;return o;function o(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),u}function u(E){return E===33?(e.consume(E),l):E===47?(e.consume(E),D):E===63?(e.consume(E),C):Ht(E)?(e.consume(E),M):n(E)}function l(E){return E===45?(e.consume(E),d):E===91?(e.consume(E),a=0,g):Ht(E)?(e.consume(E),y):n(E)}function d(E){return E===45?(e.consume(E),p):n(E)}function h(E){return E===null?n(E):E===45?(e.consume(E),m):Ee(E)?(s=h,V(E)):(e.consume(E),h)}function m(E){return E===45?(e.consume(E),p):h(E)}function p(E){return E===62?H(E):E===45?m(E):h(E)}function g(E){const Y="CDATA[";return E===Y.charCodeAt(a++)?(e.consume(E),a===Y.length?f:g):n(E)}function f(E){return E===null?n(E):E===93?(e.consume(E),b):Ee(E)?(s=f,V(E)):(e.consume(E),f)}function b(E){return E===93?(e.consume(E),v):f(E)}function v(E){return E===62?H(E):E===93?(e.consume(E),v):f(E)}function y(E){return E===null||E===62?H(E):Ee(E)?(s=y,V(E)):(e.consume(E),y)}function C(E){return E===null?n(E):E===63?(e.consume(E),k):Ee(E)?(s=C,V(E)):(e.consume(E),C)}function k(E){return E===62?H(E):C(E)}function D(E){return Ht(E)?(e.consume(E),_):n(E)}function _(E){return E===45||Lt(E)?(e.consume(E),_):B(E)}function B(E){return Ee(E)?(s=B,V(E)):Ie(E)?(e.consume(E),B):H(E)}function M(E){return E===45||Lt(E)?(e.consume(E),M):E===47||E===62||xt(E)?P(E):n(E)}function P(E){return E===47?(e.consume(E),H):E===58||E===95||Ht(E)?(e.consume(E),z):Ee(E)?(s=P,V(E)):Ie(E)?(e.consume(E),P):H(E)}function z(E){return E===45||E===46||E===58||E===95||Lt(E)?(e.consume(E),z):O(E)}function O(E){return E===61?(e.consume(E),A):Ee(E)?(s=O,V(E)):Ie(E)?(e.consume(E),O):P(E)}function A(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),i=E,F):Ee(E)?(s=A,V(E)):Ie(E)?(e.consume(E),A):(e.consume(E),S)}function F(E){return E===i?(e.consume(E),i=void 0,I):E===null?n(E):Ee(E)?(s=F,V(E)):(e.consume(E),F)}function S(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||xt(E)?P(E):(e.consume(E),S)}function I(E){return E===47||E===62||xt(E)?P(E):n(E)}function H(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function V(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),ae}function ae(E){return Ie(E)?Ze(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):ne(E)}function ne(E){return e.enter("htmlTextData"),s(E)}}const uu={name:"labelEnd",tokenize:BD,resolveTo:TD,resolveAll:AD},_D={tokenize:SD},kD={tokenize:jD},FD={tokenize:PD};function AD(e){let t=-1;for(;++t<e.length;){const n=e[t][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(e.splice(t+1,n.type==="labelImage"?4:2),n.type="data",t++)}return e}function TD(e,t){let n=e.length,r=0,i,a,s,o;for(;n--;)if(i=e[n][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=n);const u={type:e[a][1].type==="labelLink"?"link":"image",start:Object.assign({},e[a][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"label",start:Object.assign({},e[a][1].start),end:Object.assign({},e[s][1].end)},d={type:"labelText",start:Object.assign({},e[a+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",u,t],["enter",l,t]],o=jt(o,e.slice(a+1,a+r+3)),o=jt(o,[["enter",d,t]]),o=jt(o,ou(t.parser.constructs.insideSpan.null,e.slice(a+r+4,s-3),t)),o=jt(o,[["exit",d,t],e[s-2],e[s-1],["exit",l,t]]),o=jt(o,e.slice(s+1)),o=jt(o,[["exit",u,t]]),on(e,a,e.length,o),e}function BD(e,t,n){const r=this;let i=r.events.length,a,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){a=r.events[i][1];break}return o;function o(m){return a?a._inactive?h(m):(s=r.parser.defined.includes(ar(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),u):n(m)}function u(m){return m===40?e.attempt(_D,d,s?d:h)(m):m===91?e.attempt(kD,d,s?l:h)(m):s?d(m):h(m)}function l(m){return e.attempt(FD,d,h)(m)}function d(m){return t(m)}function h(m){return a._balanced=!0,n(m)}}function SD(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return xt(h)?qr(e,a)(h):a(h)}function a(h){return h===41?d(h):zm(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return xt(h)?qr(e,u)(h):d(h)}function o(h){return n(h)}function u(h){return h===34||h===39||h===40?Um(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function l(h){return xt(h)?qr(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function jD(e,t,n){const r=this;return i;function i(o){return qm.call(r,e,a,s,"reference","referenceMarker","referenceString")(o)}function a(o){return r.parser.defined.includes(ar(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function PD(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),i}function i(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const OD={name:"labelStartImage",tokenize:MD,resolveAll:uu.resolveAll};function MD(e,t,n){const r=this;return i;function i(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),a}function a(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),s):n(o)}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const ND={name:"labelStartLink",tokenize:ID,resolveAll:uu.resolveAll};function ID(e,t,n){const r=this;return i;function i(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),a}function a(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const ms={name:"lineEnding",tokenize:RD};function RD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ze(e,t,"linePrefix")}}const qi={name:"thematicBreak",tokenize:$D};function $D(e,t,n){let r=0,i;return a;function a(l){return e.enter("thematicBreak"),s(l)}function s(l){return i=l,o(l)}function o(l){return l===i?(e.enter("thematicBreakSequence"),u(l)):r>=3&&(l===null||Ee(l))?(e.exit("thematicBreak"),t(l)):n(l)}function u(l){return l===i?(e.consume(l),r++,u):(e.exit("thematicBreakSequence"),Ie(l)?Ze(e,o,"whitespace")(l):o(l))}}const gt={name:"list",tokenize:qD,continuation:{tokenize:UD},exit:VD},LD={tokenize:HD,partial:!0},zD={tokenize:WD,partial:!0};function qD(e,t,n){const r=this,i=r.events[r.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return o;function o(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:lo(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(qi,n,l)(p):l(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(p)}return n(p)}function u(p){return lo(p)&&++s<10?(e.consume(p),u):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),l(p)):n(p)}function l(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(_a,r.interrupt?n:d,e.attempt(LD,m,h))}function d(p){return r.containerState.initialBlankLine=!0,a++,m(p)}function h(p){return Ie(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function UD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(_a,i,a);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ze(e,t,"listItemIndent",r.containerState.size+1)(o)}function a(o){return r.containerState.furtherBlankLines||!Ie(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(zD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ze(e,e.attempt(gt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function WD(e,t,n){const r=this;return Ze(e,i,"listItemIndent",r.containerState.size+1);function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(a):n(a)}}function VD(e){e.exit(this.containerState.type)}function HD(e,t,n){const r=this;return Ze(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function i(a){const s=r.events[r.events.length-1];return!Ie(a)&&s&&s[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const Qc={name:"setextUnderline",tokenize:ZD,resolveTo:KD};function KD(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const s={type:"setextHeading",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",s,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[a][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}function ZD(e,t,n){const r=this;let i;return a;function a(l){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),i=l,s(l)):n(l)}function s(l){return e.enter("setextHeadingLineSequence"),o(l)}function o(l){return l===i?(e.consume(l),o):(e.exit("setextHeadingLineSequence"),Ie(l)?Ze(e,u,"lineSuffix")(l):u(l))}function u(l){return l===null||Ee(l)?(e.exit("setextHeadingLine"),t(l)):n(l)}}const YD={tokenize:GD};function GD(e){const t=this,n=e.attempt(_a,r,e.attempt(this.parser.constructs.flowInitial,i,Ze(e,e.attempt(this.parser.constructs.flow,i,e.attempt(tD,i)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const QD={resolveAll:Vm()},JD=Wm("string"),XD=Wm("text");function Wm(e){return{tokenize:t,resolveAll:Vm(e==="text"?eE:void 0)};function t(n){const r=this,i=this.parser.constructs[e],a=n.attempt(i,s,o);return s;function s(d){return l(d)?a(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),u}function u(d){return l(d)?(n.exit("data"),a(d)):(n.consume(d),u)}function l(d){if(d===null)return!0;const h=i[d];let m=-1;if(h)for(;++m<h.length;){const p=h[m];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function Vm(e){return t;function t(n,r){let i=-1,a;for(;++i<=n.length;)a===void 0?n[i]&&n[i][1].type==="data"&&(a=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==a+2&&(n[a][1].end=n[i-1][1].end,n.splice(a+2,i-a-2),i=a+2),a=void 0);return e?e(n,r):n}}function eE(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let a=i.length,s=-1,o=0,u;for(;a--;){const l=i[a];if(typeof l=="string"){for(s=l.length;l.charCodeAt(s-1)===32;)o++,s--;if(s)break;s=-1}else if(l===-2)u=!0,o++;else if(l!==-1){a++;break}}if(o){const l={type:n===e.length||u||o<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-o,offset:r.end.offset-o,_index:r.start._index+a,_bufferIndex:a?s:r.start._bufferIndex+s},end:Object.assign({},r.end)};r.end=Object.assign({},l.start),r.start.offset===r.end.offset?Object.assign(r,l):(e.splice(n,0,["enter",l,t],["exit",l,t]),n+=2)}n++}return e}function tE(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const i={},a=[];let s=[],o=[];const u={consume:y,enter:C,exit:k,attempt:B(D),check:B(_),interrupt:B(_,{interrupt:!0})},l={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:m,now:g,defineSkip:f,write:h};let d=t.tokenize.call(l,u);return t.resolveAll&&a.push(t),l;function h(O){return s=jt(s,O),b(),s[s.length-1]!==null?[]:(M(t,0),l.events=ou(a,l.events,l),l.events)}function m(O,A){return rE(p(O),A)}function p(O){return nE(s,O)}function g(){const{line:O,column:A,offset:F,_index:S,_bufferIndex:I}=r;return{line:O,column:A,offset:F,_index:S,_bufferIndex:I}}function f(O){i[O.line]=O.column,z()}function b(){let O;for(;r._index<s.length;){const A=s[r._index];if(typeof A=="string")for(O=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===O&&r._bufferIndex<A.length;)v(A.charCodeAt(r._bufferIndex));else v(A)}}function v(O){d=d(O)}function y(O){Ee(O)?(r.line++,r.column=1,r.offset+=O===-3?2:1,z()):O!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=O}function C(O,A){const F=A||{};return F.type=O,F.start=g(),l.events.push(["enter",F,l]),o.push(F),F}function k(O){const A=o.pop();return A.end=g(),l.events.push(["exit",A,l]),A}function D(O,A){M(O,A.from)}function _(O,A){A.restore()}function B(O,A){return F;function F(S,I,H){let V,ae,ne,E;return Array.isArray(S)?q(S):"tokenize"in S?q([S]):Y(S);function Y(N){return U;function U(X){const W=X!==null&&N[X],te=X!==null&&N.null,de=[...Array.isArray(W)?W:W?[W]:[],...Array.isArray(te)?te:te?[te]:[]];return q(de)(X)}}function q(N){return V=N,ae=0,N.length===0?H:T(N[ae])}function T(N){return U;function U(X){return E=P(),ne=N,N.partial||(l.currentConstruct=N),N.name&&l.parser.constructs.disable.null.includes(N.name)?R():N.tokenize.call(A?Object.assign(Object.create(l),A):l,u,j,R)(X)}}function j(N){return O(ne,E),I}function R(N){return E.restore(),++ae<V.length?T(V[ae]):H}}}function M(O,A){O.resolveAll&&!a.includes(O)&&a.push(O),O.resolve&&on(l.events,A,l.events.length-A,O.resolve(l.events.slice(A),l)),O.resolveTo&&(l.events=O.resolveTo(l.events,l))}function P(){const O=g(),A=l.previous,F=l.currentConstruct,S=l.events.length,I=Array.from(o);return{restore:H,from:S};function H(){r=O,l.previous=A,l.currentConstruct=F,l.events.length=S,o=I,z()}}function z(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function nE(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,a)];else{if(s=e.slice(n,i),r>-1){const o=s[0];typeof o=="string"?s[0]=o.slice(r):s.shift()}a>0&&s.push(e[i].slice(0,a))}return s}function rE(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const a=e[n];let s;if(typeof a=="string")s=a;else switch(a){case-5:{s="\r";break}case-4:{s=`
82
82
  `;break}case-3:{s=`\r
83
- `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&i)continue;s=" ";break}default:s=String.fromCharCode(a)}i=a===-2,r.push(s)}return r.join("")}const iE={42:gt,43:gt,45:gt,48:gt,49:gt,50:gt,51:gt,52:gt,53:gt,54:gt,55:gt,56:gt,57:gt,62:Im},aE={91:sD},sE={[-2]:fs,[-1]:fs,32:fs},oE={35:fD,42:qi,45:[Qc,qi],60:gD,61:Qc,95:qi,96:Yc,126:Yc},uE={38:$m,92:Rm},lE={[-5]:ms,[-4]:ms,[-3]:ms,33:OD,38:$m,42:co,60:[NC,DD],91:ND,92:[cD,Rm],93:uu,95:co,96:YC},cE={null:[co,QD]},dE={null:[42,95]},fE={null:[]},mE=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:dE,contentInitial:aE,disable:fE,document:iE,flow:oE,flowInitial:sE,insideSpan:cE,string:uE,text:lE},Symbol.toStringTag,{value:"Module"}));function hE(e){const n=wC([mE,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:i(TC),document:i(SC),flow:i(YD),string:i(JD),text:i(XD)};return r;function i(a){return s;function s(o){return tE(r,a,o)}}}function pE(e){for(;!Lm(e););return e}const Jc=/[\0\t\n\r]/g;function gE(){let e=1,t="",n=!0,r;return i;function i(a,s,o){const u=[];let l,d,m,h,p;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(s||void 0).decode(a)),m=0,t="",n&&(a.charCodeAt(0)===65279&&m++,n=void 0);m<a.length;){if(Jc.lastIndex=m,l=Jc.exec(a),h=l&&l.index!==void 0?l.index:a.length,p=a.charCodeAt(h),!l){t=a.slice(m);break}if(p===10&&m===h&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),m<h&&(u.push(a.slice(m,h)),e+=h-m),p){case 0:{u.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,u.push(-2);e++<d;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}m=h+1}return o&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const vE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function bE(e){return e.replace(vE,yE)}function yE(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),a=i===120||i===88;return Nm(n.slice(a?2:1),a?16:10)}return su(n)||e}const Hm={}.hasOwnProperty;function xE(e,t,n){return typeof t!="string"&&(n=t,t=void 0),wE(n)(pE(hE(n).document().write(gE()(e,t,!0))))}function wE(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(ze),autolinkProtocol:N,autolinkEmail:N,atxHeading:a(me),blockQuote:a(W),characterEscape:N,characterReference:N,codeFenced:a(te),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:a(te,s),codeText:a(de,s),codeTextData:N,data:N,codeFlowValue:N,definition:a(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:a(ve),hardBreakEscape:a(ye),hardBreakTrailing:a(ye),htmlFlow:a(_e,s),htmlFlowData:N,htmlText:a(_e,s),htmlTextData:N,image:a(De),label:s,link:a(ze),listItem:a(He),listItemValue:h,listOrdered:a(We,m),listUnordered:a(We),paragraph:a(Ke),reference:T,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:a(me),strong:a(Be),thematicBreak:a(Ce)},exit:{atxHeading:u(),atxHeadingSequence:D,autolink:u(),autolinkEmail:X,autolinkProtocol:U,blockQuote:u(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:R,characterReferenceMarkerNumeric:R,characterReferenceValue:M,codeFenced:u(b),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:z,codeIndented:u(v),codeText:u(I),codeTextData:z,data:z,definition:u(),definitionDestinationString:k,definitionLabelString:y,definitionTitleString:C,emphasis:u(),hardBreakEscape:u(A),hardBreakTrailing:u(A),htmlFlow:u(F),htmlFlowData:z,htmlText:u(S),htmlTextData:z,image:u(V),label:ne,labelText:ae,lineEnding:O,link:u(H),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:j,resourceDestinationString:E,resourceTitleString:Y,resource:q,setextHeading:u(P),setextHeadingLineSequence:B,setextHeadingText:_,strong:u(),thematicBreak:u()}};Km(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(G){let se={type:"root",children:[]};const be={stack:[se],tokenStack:[],config:t,enter:o,exit:l,buffer:s,resume:d,data:n},oe=[];let ce=-1;for(;++ce<G.length;)if(G[ce][1].type==="listOrdered"||G[ce][1].type==="listUnordered")if(G[ce][0]==="enter")oe.push(ce);else{const pe=oe.pop();ce=i(G,pe,ce)}for(ce=-1;++ce<G.length;){const pe=t[G[ce][0]];Hm.call(pe,G[ce][1].type)&&pe[G[ce][1].type].call(Object.assign({sliceSerialize:G[ce][2].sliceSerialize},be),G[ce][1])}if(be.tokenStack.length>0){const pe=be.tokenStack[be.tokenStack.length-1];(pe[1]||Xc).call(be,void 0,pe[0])}for(se.position={start:mn(G.length>0?G[0][1].start:{line:1,column:1,offset:0}),end:mn(G.length>0?G[G.length-2][1].end:{line:1,column:1,offset:0})},ce=-1;++ce<t.transforms.length;)se=t.transforms[ce](se)||se;return se}function i(G,se,be){let oe=se-1,ce=-1,pe=!1,Fe,qe,At,pt;for(;++oe<=be;){const tt=G[oe];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?ce++:ce--,pt=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(Fe&&!pt&&!ce&&!At&&(At=oe),pt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:pt=void 0}if(!ce&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||ce===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(Fe){let qt=oe;for(qe=void 0;qt--;){const Dt=G[qt];if(Dt[1].type==="lineEnding"||Dt[1].type==="lineEndingBlank"){if(Dt[0]==="exit")continue;qe&&(G[qe][1].type="lineEndingBlank",pe=!0),Dt[1].type="lineEnding",qe=qt}else if(!(Dt[1].type==="linePrefix"||Dt[1].type==="blockQuotePrefix"||Dt[1].type==="blockQuotePrefixWhitespace"||Dt[1].type==="blockQuoteMarker"||Dt[1].type==="listItemIndent"))break}At&&(!qe||At<qe)&&(Fe._spread=!0),Fe.end=Object.assign({},qe?G[qe][1].start:tt[1].end),G.splice(qe||oe,0,["exit",Fe,tt[2]]),oe++,be++}if(tt[1].type==="listItemPrefix"){const qt={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};Fe=qt,G.splice(oe,0,["enter",qt,tt[2]]),oe++,be++,At=void 0,pt=!0}}}return G[se][1]._spread=pe,be}function a(G,se){return be;function be(oe){o.call(this,G(oe),oe),se&&se.call(this,oe)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(G,se,be){this.stack[this.stack.length-1].children.push(G),this.stack.push(G),this.tokenStack.push([se,be]),G.position={start:mn(se.start),end:void 0}}function u(G){return se;function se(be){G&&G.call(this,be),l.call(this,be)}}function l(G,se){const be=this.stack.pop(),oe=this.tokenStack.pop();if(oe)oe[0].type!==G.type&&(se?se.call(this,G,oe[0]):(oe[1]||Xc).call(this,G,oe[0]));else throw new Error("Cannot close `"+G.type+"` ("+zr({start:G.start,end:G.end})+"): it’s not open");be.position.end=mn(G.end)}function d(){return yC(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function h(G){if(this.data.expectingFirstListItemValue){const se=this.stack[this.stack.length-2];se.start=Number.parseInt(this.sliceSerialize(G),10),this.data.expectingFirstListItemValue=void 0}}function p(){const G=this.resume(),se=this.stack[this.stack.length-1];se.lang=G}function g(){const G=this.resume(),se=this.stack[this.stack.length-1];se.meta=G}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const G=this.resume(),se=this.stack[this.stack.length-1];se.value=G.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const G=this.resume(),se=this.stack[this.stack.length-1];se.value=G.replace(/(\r?\n|\r)$/g,"")}function y(G){const se=this.resume(),be=this.stack[this.stack.length-1];be.label=se,be.identifier=ar(this.sliceSerialize(G)).toLowerCase()}function C(){const G=this.resume(),se=this.stack[this.stack.length-1];se.title=G}function k(){const G=this.resume(),se=this.stack[this.stack.length-1];se.url=G}function D(G){const se=this.stack[this.stack.length-1];if(!se.depth){const be=this.sliceSerialize(G).length;se.depth=be}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function B(G){const se=this.stack[this.stack.length-1];se.depth=this.sliceSerialize(G).codePointAt(0)===61?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function N(G){const be=this.stack[this.stack.length-1].children;let oe=be[be.length-1];(!oe||oe.type!=="text")&&(oe=Me(),oe.position={start:mn(G.start),end:void 0},be.push(oe)),this.stack.push(oe)}function z(G){const se=this.stack.pop();se.value+=this.sliceSerialize(G),se.position.end=mn(G.end)}function O(G){const se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=se.children[se.children.length-1];be.position.end=mn(G.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(se.type)&&(N.call(this,G),z.call(this,G))}function A(){this.data.atHardBreak=!0}function F(){const G=this.resume(),se=this.stack[this.stack.length-1];se.value=G}function S(){const G=this.resume(),se=this.stack[this.stack.length-1];se.value=G}function I(){const G=this.resume(),se=this.stack[this.stack.length-1];se.value=G}function H(){const G=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";G.type+="Reference",G.referenceType=se,delete G.url,delete G.title}else delete G.identifier,delete G.label;this.data.referenceType=void 0}function V(){const G=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";G.type+="Reference",G.referenceType=se,delete G.url,delete G.title}else delete G.identifier,delete G.label;this.data.referenceType=void 0}function ae(G){const se=this.sliceSerialize(G),be=this.stack[this.stack.length-2];be.label=bE(se),be.identifier=ar(se).toLowerCase()}function ne(){const G=this.stack[this.stack.length-1],se=this.resume(),be=this.stack[this.stack.length-1];if(this.data.inReference=!0,be.type==="link"){const oe=G.children;be.children=oe}else be.alt=se}function E(){const G=this.resume(),se=this.stack[this.stack.length-1];se.url=G}function Y(){const G=this.resume(),se=this.stack[this.stack.length-1];se.title=G}function q(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function j(G){const se=this.resume(),be=this.stack[this.stack.length-1];be.label=se,be.identifier=ar(this.sliceSerialize(G)).toLowerCase(),this.data.referenceType="full"}function R(G){this.data.characterReferenceType=G.type}function M(G){const se=this.sliceSerialize(G),be=this.data.characterReferenceType;let oe;be?(oe=Nm(se,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):oe=su(se);const ce=this.stack.pop();ce.value+=oe,ce.position.end=mn(G.end)}function U(G){z.call(this,G);const se=this.stack[this.stack.length-1];se.url=this.sliceSerialize(G)}function X(G){z.call(this,G);const se=this.stack[this.stack.length-1];se.url="mailto:"+this.sliceSerialize(G)}function W(){return{type:"blockquote",children:[]}}function te(){return{type:"code",lang:null,meta:null,value:""}}function de(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ve(){return{type:"emphasis",children:[]}}function me(){return{type:"heading",depth:0,children:[]}}function ye(){return{type:"break"}}function _e(){return{type:"html",value:""}}function De(){return{type:"image",title:null,url:"",alt:null}}function ze(){return{type:"link",title:null,url:"",children:[]}}function We(G){return{type:"list",ordered:G.type==="listOrdered",start:null,spread:G._spread,children:[]}}function He(G){return{type:"listItem",spread:G._spread,checked:null,children:[]}}function Ke(){return{type:"paragraph",children:[]}}function Be(){return{type:"strong",children:[]}}function Me(){return{type:"text",value:""}}function Ce(){return{type:"thematicBreak"}}}function mn(e){return{line:e.line,column:e.column,offset:e.offset}}function Km(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Km(e,r):CE(e,r)}}function CE(e,t){let n;for(n in t)if(Hm.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Xc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+zr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+zr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+zr({start:t.start,end:t.end})+") is still open")}function DE(e){const t=this;t.parser=n;function n(r){return xE(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Zm(e,t){var u,l,d;const n={...tr,...t==null?void 0:t.nodeTypes,[Z.heading]:{...tr[Z.heading],...(u=t==null?void 0:t.nodeTypes)==null?void 0:u[Z.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",i=(t==null?void 0:t.imageSourceKey)??"link",a=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(m=>Zm({...m,ordered:e.ordered||!1},t))),e.type){case ft.heading:return{type:n[Z.heading][e.depth||1],children:s.map(m=>({...m,[n[Z.heading][e.depth||1]]:!0}))};case ft.list:return{type:e.ordered?n[Z.ol]:n[Z.ul],children:s};case ft.listItem:return{type:n[Z.li],children:s};case ft.paragraph:return{type:n[Z.paragraph],children:s};case ft.link:return{type:n[Z.link],[r]:e.url,children:s};case ft.image:return{type:n[Z.image],children:[{text:""}],[i]:e.url,[a]:e.alt};case ft.blockquote:return{type:n[Z.blockquote],children:s};case ft.code:return{type:n[Z.codeblock],language:e.lang,children:[{text:e.value}]};case ft.html:return(l=e.value)!=null&&l.includes("<br>")?{break:!0,type:n[Z.paragraph],children:[{text:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:Z.paragraph,children:[{text:e.value||""}]};case ft.emphasis:return{[n[Kt.emphasis]]:!0,...hs(s),...Ai(s)};case ft.strong:return{[n[Kt.strong]]:!0,...hs(s),...Ai(s)};case ft.delete:return{[n[Kt.delete]]:!0,...hs(s),...Ai(s)};case ft.inlineCode:return{[n[Kt.code]]:!0,text:e.value,...Ai(s)};case ft.thematicBreak:return{type:n[Z.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const hs=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Ai(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const EE=function(t){const n=r=>r.children.map(i=>Zm(i,t));this.Compiler=n},_E=(e,t=n=>{})=>{hC().use(DE).use(EE).process(e).then(n=>{const r=Pt(n.result),i=s=>{const o=s;[Z.li,Z.blockquote].includes(o.type)&&o.children.map((u,l)=>{const d=u;d.type===Z.paragraph&&o.children.splice(l,1,...d.children)}),"children"in s&&s.children&&s.children.forEach(u=>i(u))};r.forEach(i);const a=s=>{for(let o=0;o<s.length;o++){const u=s[o],l=u;if(l.type===Z.link){const d=l.children&&l.children[0];if(d&&"text"in d&&d.text.includes(io)){const m=l,h=d.text.replace(io,""),p="link"in m&&m.link?m.link:"";m.type=Z.mention,m.id=p,m.name=h,m.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in u&&u.children&&a(u.children)}};a(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,u)=>{if("text"in o&&o.text){const l=o.text.match(/~~(.*?)~~/g);l&&l.map(d=>{const m=d.replace(/~~/g,""),h=o.text.indexOf(d),p=o.text.substring(0,h),g=o.text.substring(h+d.length),f=[{text:p},{text:m,[Z.strikethrough]:!0},{text:g}];s.children.splice(u,1,...f)})}})}),t(r)})},lu=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},kE=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,i]=w.parent(e,n,{edge:"end"}),a=r;for(;a.type!==t&&i.length>0&&i.length!==1;)i=L.parent(i),r=le.get(e,i),a=r;return a.type===t?[r,i]:[null,null]},FE=e=>{const{selection:t}=e;return t?w.string(e,t):null},ed=e=>{let t="";for(const n of le.descendants(e)){const[r]=n,i=r;i.text&&(t+=i.text)}return t},AE=e=>{for(const[t]of le.descendants(e)){const n=t;if(n.type===Z.link)return n.link}return null},td={"mod+b":Z.bold,"mod+i":Z.italic,"mod+shift+x":Z.strikethrough,"mod+k":Z.link,"mod+shift+7":Z.ol,"mod+shift+8":Z.ul,"mod+shift+9":Z.blockquote},TE=(e,t,n,r)=>{for(const i in td)if(D1(i,e)){e.stopPropagation(),e.preventDefault();const a=td[i];if(a===Z.link){n([{type:"showLinkEditor",value:!0}]);return}if($E(a)){nh(t,a,r);return}Xm(t,a,r)}},Ym=(e,t,n,r)=>{var d;const{selectedUser:i,possibleUsers:a}=t,s=a[i];if(!s)return;const o=s.userId||"",u=(d=s.user)==null?void 0:d.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const l={type:Z.mention,id:o,name:u,children:[{text:""}]};ee.select(e,(t==null?void 0:t.position)||jm),ee.insertNodes(e,[l,{text:" "}]),ee.move(e,{distance:1,unit:"offset"}),lu(r)},BE=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:i})=>{const{selection:a}=e;if(a&&Q.isCollapsed(a)){const[s]=Q.edges(a),o=w.start(e,s.path),u=w.range(e,o,s),d=w.string(e,u).match(Bd);if(d){const m=d.index||0,h={path:s.path,offset:m},p={path:s.path,offset:m+d[0].length},g=w.range(e,h,p),f=w.after(e,s),b=w.range(e,s,f);if(w.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const C=d[1];let k=[];r&&(k=await r({name:C})),i([{type:"mentionPopover",value:{show:k.length>0?!0:n!==null,selectedUser:0,possibleUsers:k,position:k.length>0?g:null,numberOfUsers:k.length>0?k.length:null}}]);return}}}t&&i([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},Gm=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},Zn=e=>typeof e.text=="string",SE=[Z.hr,Z.image,Z.mention],nd="<br>";function Qm(e,t={nodeTypes:tr}){const{nodeTypes:n=tr,ignoreParagraphNewline:r=!1,listDepth:i=0}=t,a=e.text||"";let s=e.type||"";const o={...tr,...n,heading:{...tr[Z.heading],...n[Z.heading]}},u=[o[Z.ul],o[Z.ol]];let l=a;if(!Zn(e)&&s!==Z.mention&&(l=e.children.map(d=>{const m=Zn(d)?!1:u.includes(d.type||""),h=u.includes(e.type||"");let p=!1;return!Zn(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!Zn(g)&&g.type===o.link)),Qm({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||m||h||p)&&!d.break,listDepth:u.includes(d.type||"")?i+1:i,inBlockquote:s===o[Z.blockquote]||e.parentType===o[Z.blockquote]})}).join("")),!r&&(a===""||a===`
83
+ `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&i)continue;s=" ";break}default:s=String.fromCharCode(a)}i=a===-2,r.push(s)}return r.join("")}const iE={42:gt,43:gt,45:gt,48:gt,49:gt,50:gt,51:gt,52:gt,53:gt,54:gt,55:gt,56:gt,57:gt,62:Im},aE={91:sD},sE={[-2]:fs,[-1]:fs,32:fs},oE={35:fD,42:qi,45:[Qc,qi],60:gD,61:Qc,95:qi,96:Yc,126:Yc},uE={38:$m,92:Rm},lE={[-5]:ms,[-4]:ms,[-3]:ms,33:OD,38:$m,42:co,60:[NC,DD],91:ND,92:[cD,Rm],93:uu,95:co,96:YC},cE={null:[co,QD]},dE={null:[42,95]},fE={null:[]},mE=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:dE,contentInitial:aE,disable:fE,document:iE,flow:oE,flowInitial:sE,insideSpan:cE,string:uE,text:lE},Symbol.toStringTag,{value:"Module"}));function hE(e){const n=wC([mE,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:i(TC),document:i(SC),flow:i(YD),string:i(JD),text:i(XD)};return r;function i(a){return s;function s(o){return tE(r,a,o)}}}function pE(e){for(;!Lm(e););return e}const Jc=/[\0\t\n\r]/g;function gE(){let e=1,t="",n=!0,r;return i;function i(a,s,o){const u=[];let l,d,h,m,p;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(s||void 0).decode(a)),h=0,t="",n&&(a.charCodeAt(0)===65279&&h++,n=void 0);h<a.length;){if(Jc.lastIndex=h,l=Jc.exec(a),m=l&&l.index!==void 0?l.index:a.length,p=a.charCodeAt(m),!l){t=a.slice(h);break}if(p===10&&h===m&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),h<m&&(u.push(a.slice(h,m)),e+=m-h),p){case 0:{u.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,u.push(-2);e++<d;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}h=m+1}return o&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const vE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function bE(e){return e.replace(vE,yE)}function yE(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),a=i===120||i===88;return Nm(n.slice(a?2:1),a?16:10)}return su(n)||e}const Hm={}.hasOwnProperty;function xE(e,t,n){return typeof t!="string"&&(n=t,t=void 0),wE(n)(pE(hE(n).document().write(gE()(e,t,!0))))}function wE(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(ze),autolinkProtocol:P,autolinkEmail:P,atxHeading:a(me),blockQuote:a(W),characterEscape:P,characterReference:P,codeFenced:a(te),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:a(te,s),codeText:a(de,s),codeTextData:P,data:P,codeFlowValue:P,definition:a(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:a(ve),hardBreakEscape:a(ye),hardBreakTrailing:a(ye),htmlFlow:a(_e,s),htmlFlowData:P,htmlText:a(_e,s),htmlTextData:P,image:a(De),label:s,link:a(ze),listItem:a(He),listItemValue:m,listOrdered:a(We,h),listUnordered:a(We),paragraph:a(Ke),reference:T,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:a(me),strong:a(Be),thematicBreak:a(Ce)},exit:{atxHeading:u(),atxHeadingSequence:D,autolink:u(),autolinkEmail:X,autolinkProtocol:U,blockQuote:u(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:R,characterReferenceMarkerNumeric:R,characterReferenceValue:N,codeFenced:u(b),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:z,codeIndented:u(v),codeText:u(I),codeTextData:z,data:z,definition:u(),definitionDestinationString:k,definitionLabelString:y,definitionTitleString:C,emphasis:u(),hardBreakEscape:u(A),hardBreakTrailing:u(A),htmlFlow:u(F),htmlFlowData:z,htmlText:u(S),htmlTextData:z,image:u(V),label:ne,labelText:ae,lineEnding:O,link:u(H),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:j,resourceDestinationString:E,resourceTitleString:Y,resource:q,setextHeading:u(M),setextHeadingLineSequence:B,setextHeadingText:_,strong:u(),thematicBreak:u()}};Km(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(G){let se={type:"root",children:[]};const be={stack:[se],tokenStack:[],config:t,enter:o,exit:l,buffer:s,resume:d,data:n},oe=[];let ce=-1;for(;++ce<G.length;)if(G[ce][1].type==="listOrdered"||G[ce][1].type==="listUnordered")if(G[ce][0]==="enter")oe.push(ce);else{const pe=oe.pop();ce=i(G,pe,ce)}for(ce=-1;++ce<G.length;){const pe=t[G[ce][0]];Hm.call(pe,G[ce][1].type)&&pe[G[ce][1].type].call(Object.assign({sliceSerialize:G[ce][2].sliceSerialize},be),G[ce][1])}if(be.tokenStack.length>0){const pe=be.tokenStack[be.tokenStack.length-1];(pe[1]||Xc).call(be,void 0,pe[0])}for(se.position={start:mn(G.length>0?G[0][1].start:{line:1,column:1,offset:0}),end:mn(G.length>0?G[G.length-2][1].end:{line:1,column:1,offset:0})},ce=-1;++ce<t.transforms.length;)se=t.transforms[ce](se)||se;return se}function i(G,se,be){let oe=se-1,ce=-1,pe=!1,Fe,qe,At,pt;for(;++oe<=be;){const tt=G[oe];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?ce++:ce--,pt=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(Fe&&!pt&&!ce&&!At&&(At=oe),pt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:pt=void 0}if(!ce&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||ce===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(Fe){let qt=oe;for(qe=void 0;qt--;){const Dt=G[qt];if(Dt[1].type==="lineEnding"||Dt[1].type==="lineEndingBlank"){if(Dt[0]==="exit")continue;qe&&(G[qe][1].type="lineEndingBlank",pe=!0),Dt[1].type="lineEnding",qe=qt}else if(!(Dt[1].type==="linePrefix"||Dt[1].type==="blockQuotePrefix"||Dt[1].type==="blockQuotePrefixWhitespace"||Dt[1].type==="blockQuoteMarker"||Dt[1].type==="listItemIndent"))break}At&&(!qe||At<qe)&&(Fe._spread=!0),Fe.end=Object.assign({},qe?G[qe][1].start:tt[1].end),G.splice(qe||oe,0,["exit",Fe,tt[2]]),oe++,be++}if(tt[1].type==="listItemPrefix"){const qt={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};Fe=qt,G.splice(oe,0,["enter",qt,tt[2]]),oe++,be++,At=void 0,pt=!0}}}return G[se][1]._spread=pe,be}function a(G,se){return be;function be(oe){o.call(this,G(oe),oe),se&&se.call(this,oe)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(G,se,be){this.stack[this.stack.length-1].children.push(G),this.stack.push(G),this.tokenStack.push([se,be]),G.position={start:mn(se.start),end:void 0}}function u(G){return se;function se(be){G&&G.call(this,be),l.call(this,be)}}function l(G,se){const be=this.stack.pop(),oe=this.tokenStack.pop();if(oe)oe[0].type!==G.type&&(se?se.call(this,G,oe[0]):(oe[1]||Xc).call(this,G,oe[0]));else throw new Error("Cannot close `"+G.type+"` ("+zr({start:G.start,end:G.end})+"): it’s not open");be.position.end=mn(G.end)}function d(){return yC(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function m(G){if(this.data.expectingFirstListItemValue){const se=this.stack[this.stack.length-2];se.start=Number.parseInt(this.sliceSerialize(G),10),this.data.expectingFirstListItemValue=void 0}}function p(){const G=this.resume(),se=this.stack[this.stack.length-1];se.lang=G}function g(){const G=this.resume(),se=this.stack[this.stack.length-1];se.meta=G}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const G=this.resume(),se=this.stack[this.stack.length-1];se.value=G.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const G=this.resume(),se=this.stack[this.stack.length-1];se.value=G.replace(/(\r?\n|\r)$/g,"")}function y(G){const se=this.resume(),be=this.stack[this.stack.length-1];be.label=se,be.identifier=ar(this.sliceSerialize(G)).toLowerCase()}function C(){const G=this.resume(),se=this.stack[this.stack.length-1];se.title=G}function k(){const G=this.resume(),se=this.stack[this.stack.length-1];se.url=G}function D(G){const se=this.stack[this.stack.length-1];if(!se.depth){const be=this.sliceSerialize(G).length;se.depth=be}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function B(G){const se=this.stack[this.stack.length-1];se.depth=this.sliceSerialize(G).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function P(G){const be=this.stack[this.stack.length-1].children;let oe=be[be.length-1];(!oe||oe.type!=="text")&&(oe=Me(),oe.position={start:mn(G.start),end:void 0},be.push(oe)),this.stack.push(oe)}function z(G){const se=this.stack.pop();se.value+=this.sliceSerialize(G),se.position.end=mn(G.end)}function O(G){const se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=se.children[se.children.length-1];be.position.end=mn(G.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(se.type)&&(P.call(this,G),z.call(this,G))}function A(){this.data.atHardBreak=!0}function F(){const G=this.resume(),se=this.stack[this.stack.length-1];se.value=G}function S(){const G=this.resume(),se=this.stack[this.stack.length-1];se.value=G}function I(){const G=this.resume(),se=this.stack[this.stack.length-1];se.value=G}function H(){const G=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";G.type+="Reference",G.referenceType=se,delete G.url,delete G.title}else delete G.identifier,delete G.label;this.data.referenceType=void 0}function V(){const G=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";G.type+="Reference",G.referenceType=se,delete G.url,delete G.title}else delete G.identifier,delete G.label;this.data.referenceType=void 0}function ae(G){const se=this.sliceSerialize(G),be=this.stack[this.stack.length-2];be.label=bE(se),be.identifier=ar(se).toLowerCase()}function ne(){const G=this.stack[this.stack.length-1],se=this.resume(),be=this.stack[this.stack.length-1];if(this.data.inReference=!0,be.type==="link"){const oe=G.children;be.children=oe}else be.alt=se}function E(){const G=this.resume(),se=this.stack[this.stack.length-1];se.url=G}function Y(){const G=this.resume(),se=this.stack[this.stack.length-1];se.title=G}function q(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function j(G){const se=this.resume(),be=this.stack[this.stack.length-1];be.label=se,be.identifier=ar(this.sliceSerialize(G)).toLowerCase(),this.data.referenceType="full"}function R(G){this.data.characterReferenceType=G.type}function N(G){const se=this.sliceSerialize(G),be=this.data.characterReferenceType;let oe;be?(oe=Nm(se,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):oe=su(se);const ce=this.stack.pop();ce.value+=oe,ce.position.end=mn(G.end)}function U(G){z.call(this,G);const se=this.stack[this.stack.length-1];se.url=this.sliceSerialize(G)}function X(G){z.call(this,G);const se=this.stack[this.stack.length-1];se.url="mailto:"+this.sliceSerialize(G)}function W(){return{type:"blockquote",children:[]}}function te(){return{type:"code",lang:null,meta:null,value:""}}function de(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ve(){return{type:"emphasis",children:[]}}function me(){return{type:"heading",depth:0,children:[]}}function ye(){return{type:"break"}}function _e(){return{type:"html",value:""}}function De(){return{type:"image",title:null,url:"",alt:null}}function ze(){return{type:"link",title:null,url:"",children:[]}}function We(G){return{type:"list",ordered:G.type==="listOrdered",start:null,spread:G._spread,children:[]}}function He(G){return{type:"listItem",spread:G._spread,checked:null,children:[]}}function Ke(){return{type:"paragraph",children:[]}}function Be(){return{type:"strong",children:[]}}function Me(){return{type:"text",value:""}}function Ce(){return{type:"thematicBreak"}}}function mn(e){return{line:e.line,column:e.column,offset:e.offset}}function Km(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Km(e,r):CE(e,r)}}function CE(e,t){let n;for(n in t)if(Hm.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Xc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+zr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+zr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+zr({start:t.start,end:t.end})+") is still open")}function DE(e){const t=this;t.parser=n;function n(r){return xE(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Zm(e,t){var u,l,d;const n={...tr,...t==null?void 0:t.nodeTypes,[Z.heading]:{...tr[Z.heading],...(u=t==null?void 0:t.nodeTypes)==null?void 0:u[Z.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",i=(t==null?void 0:t.imageSourceKey)??"link",a=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(h=>Zm({...h,ordered:e.ordered||!1},t))),e.type){case ft.heading:return{type:n[Z.heading][e.depth||1],children:s.map(h=>({...h,[n[Z.heading][e.depth||1]]:!0}))};case ft.list:return{type:e.ordered?n[Z.ol]:n[Z.ul],children:s};case ft.listItem:return{type:n[Z.li],children:s};case ft.paragraph:return{type:n[Z.paragraph],children:s};case ft.link:return{type:n[Z.link],[r]:e.url,children:s};case ft.image:return{type:n[Z.image],children:[{text:""}],[i]:e.url,[a]:e.alt};case ft.blockquote:return{type:n[Z.blockquote],children:s};case ft.code:return{type:n[Z.codeblock],language:e.lang,children:[{text:e.value}]};case ft.html:return(l=e.value)!=null&&l.includes("<br>")?{break:!0,type:n[Z.paragraph],children:[{text:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:Z.paragraph,children:[{text:e.value||""}]};case ft.emphasis:return{[n[Kt.emphasis]]:!0,...hs(s),...Ai(s)};case ft.strong:return{[n[Kt.strong]]:!0,...hs(s),...Ai(s)};case ft.delete:return{[n[Kt.delete]]:!0,...hs(s),...Ai(s)};case ft.inlineCode:return{[n[Kt.code]]:!0,text:e.value,...Ai(s)};case ft.thematicBreak:return{type:n[Z.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const hs=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Ai(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const EE=function(t){const n=r=>r.children.map(i=>Zm(i,t));this.Compiler=n},_E=(e,t=n=>{})=>{hC().use(DE).use(EE).process(e).then(n=>{const r=Pt(n.result),i=s=>{const o=s;[Z.li,Z.blockquote].includes(o.type)&&o.children.map((u,l)=>{const d=u;d.type===Z.paragraph&&o.children.splice(l,1,...d.children)}),"children"in s&&s.children&&s.children.forEach(u=>i(u))};r.forEach(i);const a=s=>{for(let o=0;o<s.length;o++){const u=s[o],l=u;if(l.type===Z.link){const d=l.children&&l.children[0];if(d&&"text"in d&&d.text.includes(io)){const h=l,m=d.text.replace(io,""),p="link"in h&&h.link?h.link:"";h.type=Z.mention,h.id=p,h.name=m,h.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in u&&u.children&&a(u.children)}};a(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,u)=>{if("text"in o&&o.text){const l=o.text.match(/~~(.*?)~~/g);l&&l.map(d=>{const h=d.replace(/~~/g,""),m=o.text.indexOf(d),p=o.text.substring(0,m),g=o.text.substring(m+d.length),f=[{text:p},{text:h,[Z.strikethrough]:!0},{text:g}];s.children.splice(u,1,...f)})}})}),t(r)})},lu=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},kE=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,i]=w.parent(e,n,{edge:"end"}),a=r;for(;a.type!==t&&i.length>0&&i.length!==1;)i=L.parent(i),r=le.get(e,i),a=r;return a.type===t?[r,i]:[null,null]},FE=e=>{const{selection:t}=e;return t?w.string(e,t):null},ed=e=>{let t="";for(const n of le.descendants(e)){const[r]=n,i=r;i.text&&(t+=i.text)}return t},AE=e=>{for(const[t]of le.descendants(e)){const n=t;if(n.type===Z.link)return n.link}return null},td={"mod+b":Z.bold,"mod+i":Z.italic,"mod+shift+x":Z.strikethrough,"mod+k":Z.link,"mod+shift+7":Z.ol,"mod+shift+8":Z.ul,"mod+shift+9":Z.blockquote},TE=(e,t,n,r)=>{for(const i in td)if(D1(i,e)){e.stopPropagation(),e.preventDefault();const a=td[i];if(a===Z.link){n([{type:"showLinkEditor",value:!0}]);return}if($E(a)){nh(t,a,r);return}Xm(t,a,r)}},Ym=(e,t,n,r)=>{var d;const{selectedUser:i,possibleUsers:a}=t,s=a[i];if(!s)return;const o=s.userId||"",u=(d=s.user)==null?void 0:d.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const l={type:Z.mention,id:o,name:u,children:[{text:""}]};ee.select(e,(t==null?void 0:t.position)||jm),ee.insertNodes(e,[l,{text:" "}]),ee.move(e,{distance:1,unit:"offset"}),lu(r)},BE=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:i})=>{const{selection:a}=e;if(a&&Q.isCollapsed(a)){const[s]=Q.edges(a),o=w.start(e,s.path),u=w.range(e,o,s),d=w.string(e,u).match(Bd);if(d){const h=d.index||0,m={path:s.path,offset:h},p={path:s.path,offset:h+d[0].length},g=w.range(e,m,p),f=w.after(e,s),b=w.range(e,s,f);if(w.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const C=d[1];let k=[];r&&(k=await r({name:C})),i([{type:"mentionPopover",value:{show:k.length>0?!0:n!==null,selectedUser:0,possibleUsers:k,position:k.length>0?g:null,numberOfUsers:k.length>0?k.length:null}}]);return}}}t&&i([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},Gm=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},Zn=e=>typeof e.text=="string",SE=[Z.hr,Z.image,Z.mention],nd="<br>";function Qm(e,t={nodeTypes:tr}){const{nodeTypes:n=tr,ignoreParagraphNewline:r=!1,listDepth:i=0}=t,a=e.text||"";let s=e.type||"";const o={...tr,...n,heading:{...tr[Z.heading],...n[Z.heading]}},u=[o[Z.ul],o[Z.ol]];let l=a;if(!Zn(e)&&s!==Z.mention&&(l=e.children.map(d=>{const h=Zn(d)?!1:u.includes(d.type||""),m=u.includes(e.type||"");let p=!1;return!Zn(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!Zn(g)&&g.type===o.link)),Qm({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||h||m||p)&&!d.break,listDepth:u.includes(d.type||"")?i+1:i,inBlockquote:s===o[Z.blockquote]||e.parentType===o[Z.blockquote]})}).join("")),!r&&(a===""||a===`
84
84
  `)&&e.parentType===o[Z.paragraph]&&s!==o[Z.mention]&&(s=o[Z.paragraph],l=nd),!(l===""&&!SE.find(d=>o[d]===s)))switch(l!==nd&&Zn(e)&&(e[Z.strikethrough]&&e[Z.bold]&&e[Z.italic]?l=Yn(l,"~~***"):e[Z.bold]&&e[Z.italic]?l=Yn(l,"***"):(e[Z.bold]&&(l=Yn(l,"**")),e[Z.italic]&&(l=Yn(l,"_")),e[Z.strikethrough]&&(l=Yn(l,"~~")),e[Z.code]&&(l=Yn(l,"`")))),s){case o[Z.heading][1]:return`# ${l}
85
85
  `;case o[Z.heading][2]:return`## ${l}
86
86
  `;case o[Z.heading][3]:return`### ${l}
@@ -95,12 +95,12 @@ ${l}
95
95
  `;case o[Z.link]:return`[${l}](${e.link||""})`;case o.image:return`![${e.caption}](${e.link||""})`;case o[Z.mention]:const{id:d}=e;return e?`@{{${d}}}`:l;case o[Z.ul]:case o[Z.ol]:return`
96
96
  ${l}
97
97
 
98
- `;case o[Z.li]:const m=e&&e.parentType===o[Z.ol],h=e.children.length===1&&Zn(e.children[0]);let p="";for(let g=0;i>g;g++)m?p+=" ":p+=" ";return t.inBlockquote&&(p="> "+p),`
99
- ${p}${m?"1.":"-"} ${l}${h?`
98
+ `;case o[Z.li]:const h=e&&e.parentType===o[Z.ol],m=e.children.length===1&&Zn(e.children[0]);let p="";for(let g=0;i>g;g++)h?p+=" ":p+=" ";return t.inBlockquote&&(p="> "+p),`
99
+ ${p}${h?"1.":"-"} ${l}${m?`
100
100
  `:""}`;case o[Z.paragraph]:return`${l}
101
101
 
102
102
  `;case o[Z.hr]:return`---
103
- `;default:return l}}function Yn(e,t){const n=e.trim(),r=n,i=`${t}${r}${rd(t)}`;if(r.length===e.length)return i;const a=t+r+rd(t);return e.replace(n,a)}const rd=e=>e.split("").reverse().join(""),jE=e=>e.map(t=>Qm(t)).join("").trim();const PE=({onFallbackClick:e=()=>{}})=>{const t=ie.useIntl(),n=zn(),{dispatch:r,isInOverlay:i,mentionPopover:a,id:s,onMention:o}=x.useContext(cn),{show:u,selectedUser:l,possibleUsers:d}=a,m=Pm(n,"mention-popover",`toolbar-${s}`);if(!u)return c.jsx(c.Fragment,{});const h=Gm(i);return c.jsx(br,{parent:h,children:c.jsx(Md,{ref:m,className:"mention-popover",onKeyDown:p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:p,user:g},f)=>c.jsx(an,{element:"li",className:K({selected:f===l}),member:{id:p,...g,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const v={...a,selectedUser:f};r([{type:"mentionPopover",value:v}]),Ym(n,v,r,s),o&&o({id:p||"",name:g.name||""})}}},p)),c.jsx(an,{element:"li",className:K("fallback",{selected:d.length===l}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${Gt}icons/invite-user.svg`},link:!1},functions:{onClick:p=>{p.preventDefault(),p.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})};const sa=({formID:e,label:t,showLabel:n})=>{const{visible:r="",screenreader:i=""}=t||{};return n?c.jsx("label",{htmlFor:`${e}-input`,className:"rte-label text-small",onClick:a=>{a.preventDefault(),a.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:r}):c.jsx(Oe,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:i})},cu=({id:e,active:t,hasDivider:n=!1,callback:r,className:i="",children:a,"aria-pressed":s,...o})=>{const u=ie.useIntl(),l=zn(),{id:d,dispatch:m}=x.useContext(cn),{tabbableOption:h,setFocus:p,openTooltip:g,dispatch:f}=x.useContext(ai),b={};return e!==h&&(b.tabIndex=-1),s!==null&&(b["aria-pressed"]=typeof s=="boolean"?s:t),c.jsxs("li",{id:`${d}-${e}`,className:K(e,{"has-divider":n}),onMouseEnter:()=>{f([{type:"openTooltip",value:e}])},onMouseLeave:()=>{f([{type:"openTooltip",value:null}])},onFocus:()=>{f([{type:"openTooltip",value:e}])},onBlur:v=>{v.stopPropagation(),f([{type:"openTooltip",value:null}]),l.selection&&m({type:"lastAnchor",value:l.selection.anchor})},contentEditable:!1,children:[c.jsxs("button",{...o,...b,className:K(e,i,{active:t}),onClick:v=>{v.stopPropagation(),v.preventDefault()},onMouseDown:v=>{v.stopPropagation(),v.preventDefault(),r()},onKeyDown:v=>{var y,C,k,D;if(v.key!=="Tab")switch(v.key){case"Enter":v.stopPropagation(),v.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":v.stopPropagation(),v.preventDefault();const _=v.currentTarget.closest("li");let B=_==null?void 0:_.nextElementSibling;if(v.key==="ArrowLeft"){const z=_==null?void 0:_.previousElementSibling;z?B=z:B=(y=_==null?void 0:_.parentElement)==null?void 0:y.lastElementChild}else B||(B=(C=_==null?void 0:_.parentElement)==null?void 0:C.firstElementChild);const P=B==null?void 0:B.className.split(" ")[0];P&&(p(P),(k=B==null?void 0:B.querySelector("button"))==null||k.focus());break;default:const N=v.currentTarget.closest("fieldset");if(N){(D=N==null?void 0:N.previousElementSibling)==null||D.focus();break}}},children:[c.jsx(Oe,{showOnFocus:!1,children:u.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(Ln,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:g===e,accessibility:{"aria-hidden":!0},children:u.formatMessage({id:`richTextEditor_${e}`})})]}),a]})},id=[Z.ol,Z.ul],Jm=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(w.nodes(e,{at:w.unhangRange(e,n),match:i=>{const a=i;return!w.isEditor(i)&&he.isElement(i)&&a.type===t}}));return!!r},OE=e=>{const[t]=w.nodes(e,{match:n=>n.type===Z.blockquote});return!!t},Xm=(e,t,n)=>{try{const r=OE(e),i=Jm(e,t),a=id.includes(t);ee.unwrapNodes(e,{match:u=>{const l=u;return!w.isEditor(l)&&he.isElement(l)&&id.includes(l.type)},split:!0});const o={type:i?Z.paragraph:a?Z.li:t};if(ee.setNodes(e,o),t===Z.h3){const u={type:t};i?w.removeMark(e,t):w.addMark(e,t,!0),ee.setNodes(e,u)}if(a)if(i){const{selection:u}=e;if(!u)return;const[l,d]=w.parent(e,u,{edge:"end"});Array.from(w.nodes(e,{at:d,match:h=>{const p=h;return!w.isEditor(h)&&he.isElement(h)&&p.type===Z.li}})).forEach(([h,p])=>{le.string(h).trim()===""&&ee.removeNodes(e,{at:p})})}else{if(r){const l={type:Z.blockquote,children:[]};ee.wrapNodes(e,l)}const u={type:t,children:[]};ee.wrapNodes(e,u)}}catch(r){const i=r.message;n(`Error toggling block: ${i}`)}},ad=({format:e,hasDivider:t=!1})=>{const{reportError:n}=x.useContext(cn),{setFocus:r}=x.useContext(ai),i=zn(),a=Jm(i,e);return c.jsx(cu,{id:e,active:a,hasDivider:t,callback:()=>{Xm(i,e,n),r(a?null:e)}})},Ur=e=>{const[t]=w.nodes(e,{match:n=>{const r=n;return!w.isEditor(n)&&he.isElement(n)&&r.type===Z.link}});return!!t},ME=(e,t,n,r)=>{e.selection&&du(e,t,n,r)},NE=(e,t,n,r)=>{const{selection:i}=e;if(i&&Q.isCollapsed(i)){const[s]=w.nodes(e,{match:o=>{const u=o;return!w.isEditor(o)&&he.isElement(o)&&u.type===Z.link}});if(s){const[o,u]=s,l={link:t};ee.setNodes(e,l,{at:u}),lu(n)}}else du(e,t,n,r)},du=(e,t,n,r=i=>{console.error(i)})=>{try{Ur(e)&&eh(e);const{selection:i}=e,a=i&&Q.isCollapsed(i),s={type:Z.link,link:t,children:a?[{text:t}]:[]};a?(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"})),lu(n)}catch(i){const a=i.message;r(`Error in wrapLink: ${a}`)}},eh=e=>{ee.unwrapNodes(e,{match:t=>{const n=t;return!w.isEditor(t)&&he.isElement(t)&&n.type===Z.link}})};let ps=null;const IE=()=>{const e=ie.useIntl(),t="richTextEditor_link_",{id:n,isInOverlay:r,enrichedUrl:i,dispatch:a,getLinkPreview:s,showLinkEditor:o,reportError:u}=x.useContext(cn),l=zn(),d=Gw(l),m=(d==null?void 0:d.text)||FE(l),h=i!==!1,[p,g]=x.useState(Ur(l)),f=Pm(l,"link-editor",`${n}-link`),b=x.useRef(null);x.useEffect(()=>{var D;!p&&o&&((D=b.current)==null||D.focus())},[p]),x.useEffect(()=>{ps&&clearTimeout(ps),ps=setTimeout(()=>{g(Ur(l))},500)},[l.selection]);const v=[],y=["open","edit","remove"].map(D=>{const _={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${D}`},{link:d==null?void 0:d.pretty})};switch(v.push({className:D}),D){case"open":_.href=(d==null?void 0:d.full)||"",_.onClick=B=>{B.preventDefault(),B.stopPropagation(),window.open((d==null?void 0:d.full)||"","_blank"),a([{type:"showLinkEditor",value:!1}])},_.children=c.jsxs(c.Fragment,{children:[_.children,c.jsx(Oe,{children:e.formatMessage({id:`${t}${D}_text`})})]});break;case"edit":_.onClick=()=>{g(!1)};break;case"remove":_.onClick=()=>{const B=[{type:"showLinkEditor",value:!1}];Ur(l)&&(eh(l),B.push({type:"lastAnchor",value:null}),i&&(d==null?void 0:d.full)===(i==null?void 0:i.url)&&B.push({type:"enrichedUrl",value:!1})),a(B)};break}return _}),C=[{id:"url",type:"url",inputRef:b,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(d==null?void 0:d.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0,functions:{onChange:()=>{},onKeyDown:D=>{if(D.key==="Tab"){if(!l)return;D.preventDefault(),D.stopPropagation();const _=w.end(l,[]);ee.select(l,_),re.focus(l)}}}}];m&&C.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",m]})});const k=Gm(r);return c.jsx(br,{parent:k,children:c.jsx(Ln,{ref:f,id:`${n}-link-editor`,className:"link-editor",isOpen:o,styling:{extraPadding:!1,hasForm:!p},functions:{onBlur:()=>{a([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var D;return(D=b.current)==null?void 0:D.focus()})}},children:p?c.jsx(vr,{wrappers:v,buttons:y}):c.jsx(Xt,{element:"fieldset",id:`${n}-link-editor`,className:K({"show-labels":m}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async D=>{setTimeout(async()=>{a([{type:"showLinkEditor",value:!1}]);let _=D.url;if(D.url){const{full:B}=bo(D.url);_=B,d!=null&&d.full?NE(l,_,n,u):ME(l,_,n,u),a({type:"lastAnchor",value:null})}if(D.url&&s&&(!h||i&&(d==null?void 0:d.full)===i.url)){const B=await s(_);B.url&&a([{type:"enrichedUrl",value:B}])}})}},fields:C,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},RE=()=>{const e=zn(),{dispatch:t}=x.useContext(cn),{setFocus:n}=x.useContext(ai),[r,i]=x.useState(!1);return x.useEffect(()=>{i(Ur(e))},[e.selection]),c.jsx(cu,{id:"link",active:r,hasDivider:!0,callback:()=>{t([{type:"showLinkEditor",value:!0}]),n(r?null:"link"),i(!0)},"aria-pressed":null})},$E=e=>[Z.bold,Z.italic,Z.strikethrough].includes(e),th=(e,t)=>{const n=w.marks(e);return n?n[t]===!0:!1},nh=(e,t,n)=>{try{th(e,t)?w.removeMark(e,t):w.addMark(e,t,!0)}catch(r){const i=r.message;n(`Error toggling mark: ${i}`)}},LE=({format:e,hasDivider:t=!1})=>{const{reportError:n}=x.useContext(cn),{setFocus:r}=x.useContext(ai),i=zn(),a=th(i,e);return c.jsx(cu,{id:e,active:a,hasDivider:t,callback:()=>{nh(i,e,n),r(a?null:e)}})},Ti=[Z.bold,Z.italic,Z.strikethrough],zE=[Z.ol,Z.ul,Z.blockquote];const qE=({styling:e={showHeadingOption:!1},...t})=>{const n=ie.useIntl(),{id:r}=x.useContext(cn),i={tabbableOption:Ti[0],openTooltip:null},[a,s]=x.useReducer(pr,i),o=u=>{u&&s([{type:"tabbableOption",value:u||Ti[0]}])};return c.jsxs(ai.Provider,{value:{...a,setFocus:o,dispatch:s},children:[c.jsxs("fieldset",{id:`toolbar-${r}`,className:"toolbar",...t,children:[c.jsx(Oe,{element:"legend",showOnFocus:!1,children:n.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[(e==null?void 0:e.showHeadingOption)&&c.jsx(ad,{format:Z.h3,hasDivider:!0},Z.h3),Ti.map((u,l)=>c.jsx(LE,{format:u,hasDivider:l===Ti.length-1},u)),c.jsx(RE,{}),zE.map((u,l)=>c.jsx(ad,{format:u,hasDivider:l===1},u))]})]}),c.jsx(IE,{})]})},UE=x.memo(qE);function WE(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 fo(e,t){return Array(t+1).join(e)}function VE(e){return e.replace(/^\n*/,"")}function HE(e){for(var t=e.length;t>0&&e[t-1]===`
103
+ `;default:return l}}function Yn(e,t){const n=e.trim(),r=n,i=`${t}${r}${rd(t)}`;if(r.length===e.length)return i;const a=t+r+rd(t);return e.replace(n,a)}const rd=e=>e.split("").reverse().join(""),jE=e=>e.map(t=>Qm(t)).join("").trim();const PE=({onFallbackClick:e=()=>{}})=>{const t=ie.useIntl(),n=zn(),{dispatch:r,isInOverlay:i,mentionPopover:a,id:s,onMention:o}=x.useContext(cn),{show:u,selectedUser:l,possibleUsers:d}=a,h=Pm(n,"mention-popover",`toolbar-${s}`);if(!u)return c.jsx(c.Fragment,{});const m=Gm(i);return c.jsx(br,{parent:m,children:c.jsx(Md,{ref:h,className:"mention-popover",onKeyDown:p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:p,user:g},f)=>c.jsx(an,{element:"li",className:K({selected:f===l}),member:{id:p,...g,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const v={...a,selectedUser:f};r([{type:"mentionPopover",value:v}]),Ym(n,v,r,s),o&&o({id:p||"",name:g.name||""})}}},p)),c.jsx(an,{element:"li",className:K("fallback",{selected:d.length===l}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${Gt}icons/invite-user.svg`},link:!1},functions:{onClick:p=>{p.preventDefault(),p.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})};const sa=({formID:e,label:t,showLabel:n})=>{const{visible:r="",screenreader:i=""}=t||{};return n?c.jsx("label",{htmlFor:`${e}-input`,className:"rte-label text-small",onClick:a=>{a.preventDefault(),a.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:r}):c.jsx(Oe,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:i})},cu=({id:e,active:t,hasDivider:n=!1,callback:r,className:i="",children:a,"aria-pressed":s,...o})=>{const u=ie.useIntl(),l=zn(),{id:d,dispatch:h}=x.useContext(cn),{tabbableOption:m,setFocus:p,openTooltip:g,dispatch:f}=x.useContext(ai),b={};return e!==m&&(b.tabIndex=-1),s!==null&&(b["aria-pressed"]=typeof s=="boolean"?s:t),c.jsxs("li",{id:`${d}-${e}`,className:K(e,{"has-divider":n}),onMouseEnter:()=>{f([{type:"openTooltip",value:e}])},onMouseLeave:()=>{f([{type:"openTooltip",value:null}])},onFocus:()=>{f([{type:"openTooltip",value:e}])},onBlur:v=>{v.stopPropagation(),f([{type:"openTooltip",value:null}]),l.selection&&h({type:"lastAnchor",value:l.selection.anchor})},contentEditable:!1,children:[c.jsxs("button",{...o,...b,className:K(e,i,{active:t}),onClick:v=>{v.stopPropagation(),v.preventDefault()},onMouseDown:v=>{v.stopPropagation(),v.preventDefault(),r()},onKeyDown:v=>{var y,C,k,D;if(v.key!=="Tab")switch(v.key){case"Enter":v.stopPropagation(),v.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":v.stopPropagation(),v.preventDefault();const _=v.currentTarget.closest("li");let B=_==null?void 0:_.nextElementSibling;if(v.key==="ArrowLeft"){const z=_==null?void 0:_.previousElementSibling;z?B=z:B=(y=_==null?void 0:_.parentElement)==null?void 0:y.lastElementChild}else B||(B=(C=_==null?void 0:_.parentElement)==null?void 0:C.firstElementChild);const M=B==null?void 0:B.className.split(" ")[0];M&&(p(M),(k=B==null?void 0:B.querySelector("button"))==null||k.focus());break;default:const P=v.currentTarget.closest("fieldset");if(P){(D=P==null?void 0:P.previousElementSibling)==null||D.focus();break}}},children:[c.jsx(Oe,{showOnFocus:!1,children:u.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(Ln,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:g===e,accessibility:{"aria-hidden":!0},children:u.formatMessage({id:`richTextEditor_${e}`})})]}),a]})},id=[Z.ol,Z.ul],Jm=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(w.nodes(e,{at:w.unhangRange(e,n),match:i=>{const a=i;return!w.isEditor(i)&&he.isElement(i)&&a.type===t}}));return!!r},OE=e=>{const[t]=w.nodes(e,{match:n=>n.type===Z.blockquote});return!!t},Xm=(e,t,n)=>{try{const r=OE(e),i=Jm(e,t),a=id.includes(t);ee.unwrapNodes(e,{match:u=>{const l=u;return!w.isEditor(l)&&he.isElement(l)&&id.includes(l.type)},split:!0});const o={type:i?Z.paragraph:a?Z.li:t};if(ee.setNodes(e,o),t===Z.h3){const u={type:t};i?w.removeMark(e,t):w.addMark(e,t,!0),ee.setNodes(e,u)}if(a)if(i){const{selection:u}=e;if(!u)return;const[l,d]=w.parent(e,u,{edge:"end"});Array.from(w.nodes(e,{at:d,match:m=>{const p=m;return!w.isEditor(m)&&he.isElement(m)&&p.type===Z.li}})).forEach(([m,p])=>{le.string(m).trim()===""&&ee.removeNodes(e,{at:p})})}else{if(r){const l={type:Z.blockquote,children:[]};ee.wrapNodes(e,l)}const u={type:t,children:[]};ee.wrapNodes(e,u)}}catch(r){const i=r.message;n(`Error toggling block: ${i}`)}},ad=({format:e,hasDivider:t=!1})=>{const{reportError:n}=x.useContext(cn),{setFocus:r}=x.useContext(ai),i=zn(),a=Jm(i,e);return c.jsx(cu,{id:e,active:a,hasDivider:t,callback:()=>{Xm(i,e,n),r(a?null:e)}})},Ur=e=>{const[t]=w.nodes(e,{match:n=>{const r=n;return!w.isEditor(n)&&he.isElement(n)&&r.type===Z.link}});return!!t},ME=(e,t,n,r)=>{e.selection&&du(e,t,n,r)},NE=(e,t,n,r)=>{const{selection:i}=e;if(i&&Q.isCollapsed(i)){const[s]=w.nodes(e,{match:o=>{const u=o;return!w.isEditor(o)&&he.isElement(o)&&u.type===Z.link}});if(s){const[o,u]=s,l={link:t};ee.setNodes(e,l,{at:u}),lu(n)}}else du(e,t,n,r)},du=(e,t,n,r=i=>{console.error(i)})=>{try{Ur(e)&&eh(e);const{selection:i}=e,a=i&&Q.isCollapsed(i),s={type:Z.link,link:t,children:a?[{text:t}]:[]};a?(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"})),lu(n)}catch(i){const a=i.message;r(`Error in wrapLink: ${a}`)}},eh=e=>{ee.unwrapNodes(e,{match:t=>{const n=t;return!w.isEditor(t)&&he.isElement(t)&&n.type===Z.link}})};let ps=null;const IE=()=>{const e=ie.useIntl(),t="richTextEditor_link_",{id:n,isInOverlay:r,enrichedUrl:i,dispatch:a,getLinkPreview:s,showLinkEditor:o,reportError:u}=x.useContext(cn),l=zn(),d=Gw(l),h=(d==null?void 0:d.text)||FE(l),m=i!==!1,[p,g]=x.useState(Ur(l)),f=Pm(l,"link-editor",`${n}-link`),b=x.useRef(null);x.useEffect(()=>{var D;!p&&o&&((D=b.current)==null||D.focus())},[p]),x.useEffect(()=>{ps&&clearTimeout(ps),ps=setTimeout(()=>{g(Ur(l))},500)},[l.selection]);const v=[],y=["open","edit","remove"].map(D=>{const _={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${D}`},{link:d==null?void 0:d.pretty})};switch(v.push({className:D}),D){case"open":_.href=(d==null?void 0:d.full)||"",_.onClick=B=>{B.preventDefault(),B.stopPropagation(),window.open((d==null?void 0:d.full)||"","_blank"),a([{type:"showLinkEditor",value:!1}])},_.children=c.jsxs(c.Fragment,{children:[_.children,c.jsx(Oe,{children:e.formatMessage({id:`${t}${D}_text`})})]});break;case"edit":_.onClick=()=>{g(!1)};break;case"remove":_.onClick=()=>{const B=[{type:"showLinkEditor",value:!1}];Ur(l)&&(eh(l),B.push({type:"lastAnchor",value:null}),i&&(d==null?void 0:d.full)===(i==null?void 0:i.url)&&B.push({type:"enrichedUrl",value:!1})),a(B)};break}return _}),C=[{id:"url",type:"url",inputRef:b,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(d==null?void 0:d.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0,functions:{onChange:()=>{},onKeyDown:D=>{if(D.key==="Tab"){if(!l)return;D.preventDefault(),D.stopPropagation();const _=w.end(l,[]);ee.select(l,_),re.focus(l)}}}}];h&&C.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",h]})});const k=Gm(r);return c.jsx(br,{parent:k,children:c.jsx(Ln,{ref:f,id:`${n}-link-editor`,className:"link-editor",isOpen:o,styling:{extraPadding:!1,hasForm:!p},functions:{onBlur:()=>{a([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var D;return(D=b.current)==null?void 0:D.focus()})}},children:p?c.jsx(vr,{wrappers:v,buttons:y}):c.jsx(Xt,{element:"fieldset",id:`${n}-link-editor`,className:K({"show-labels":h}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async D=>{setTimeout(async()=>{a([{type:"showLinkEditor",value:!1}]);let _=D.url;if(D.url){const{full:B}=bo(D.url);_=B,d!=null&&d.full?NE(l,_,n,u):ME(l,_,n,u),a({type:"lastAnchor",value:null})}if(D.url&&s&&(!m||i&&(d==null?void 0:d.full)===i.url)){const B=await s(_);B.url&&a([{type:"enrichedUrl",value:B}])}})}},fields:C,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},RE=()=>{const e=zn(),{dispatch:t}=x.useContext(cn),{setFocus:n}=x.useContext(ai),[r,i]=x.useState(!1);return x.useEffect(()=>{i(Ur(e))},[e.selection]),c.jsx(cu,{id:"link",active:r,hasDivider:!0,callback:()=>{t([{type:"showLinkEditor",value:!0}]),n(r?null:"link"),i(!0)},"aria-pressed":null})},$E=e=>[Z.bold,Z.italic,Z.strikethrough].includes(e),th=(e,t)=>{const n=w.marks(e);return n?n[t]===!0:!1},nh=(e,t,n)=>{try{th(e,t)?w.removeMark(e,t):w.addMark(e,t,!0)}catch(r){const i=r.message;n(`Error toggling mark: ${i}`)}},LE=({format:e,hasDivider:t=!1})=>{const{reportError:n}=x.useContext(cn),{setFocus:r}=x.useContext(ai),i=zn(),a=th(i,e);return c.jsx(cu,{id:e,active:a,hasDivider:t,callback:()=>{nh(i,e,n),r(a?null:e)}})},Ti=[Z.bold,Z.italic,Z.strikethrough],zE=[Z.ol,Z.ul,Z.blockquote];const qE=({styling:e={showHeadingOption:!1},...t})=>{const n=ie.useIntl(),{id:r}=x.useContext(cn),i={tabbableOption:Ti[0],openTooltip:null},[a,s]=x.useReducer(pr,i),o=u=>{u&&s([{type:"tabbableOption",value:u||Ti[0]}])};return c.jsxs(ai.Provider,{value:{...a,setFocus:o,dispatch:s},children:[c.jsxs("fieldset",{id:`toolbar-${r}`,className:"toolbar",...t,children:[c.jsx(Oe,{element:"legend",showOnFocus:!1,children:n.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[(e==null?void 0:e.showHeadingOption)&&c.jsx(ad,{format:Z.h3,hasDivider:!0},Z.h3),Ti.map((u,l)=>c.jsx(LE,{format:u,hasDivider:l===Ti.length-1},u)),c.jsx(RE,{}),zE.map((u,l)=>c.jsx(ad,{format:u,hasDivider:l===1},u))]})]}),c.jsx(IE,{})]})},UE=x.memo(qE);function WE(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 fo(e,t){return Array(t+1).join(e)}function VE(e){return e.replace(/^\n*/,"")}function HE(e){for(var t=e.length;t>0&&e[t-1]===`
104
104
  `;)t--;return e.substring(0,t)}var KE=["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 fu(e){return mu(e,KE)}var rh=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function ih(e){return mu(e,rh)}function ZE(e){return sh(e,rh)}var ah=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function YE(e){return mu(e,ah)}function GE(e){return sh(e,ah)}function mu(e,t){return t.indexOf(e.nodeName)>=0}function sh(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var lt={};lt.paragraph={filter:"p",replacement:function(e){return`
105
105
 
106
106
  `+e+`
@@ -148,7 +148,7 @@ ${p}${m?"1.":"-"} ${l}${h?`
148
148
  `)+`
149
149
 
150
150
  `,this.references=[]),t}};lt.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};lt.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};lt.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",r=e.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+t+e+t+n}};lt.image={filter:"img",replacement:function(e,t){var n=oa(t.getAttribute("alt")),r=t.getAttribute("src")||"",i=oa(t.getAttribute("title")),a=i?' "'+i+'"':"";return r?"!["+n+"]("+r+a+")":""}};function oa(e){return e?e.replace(/(\n+\s*)+/g,`
151
- `):""}function oh(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}oh.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=gs(this.array,e,this.options))||(t=gs(this._keep,e,this.options))||(t=gs(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function gs(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(QE(i,t,n))return i}}function QE(e,t,n){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function JE(e){var t=e.element,n=e.isBlock,r=e.isVoid,i=e.isPre||function(m){return m.nodeName==="PRE"};if(!(!t.firstChild||i(t))){for(var a=null,s=!1,o=null,u=sd(o,t,i);u!==t;){if(u.nodeType===3||u.nodeType===4){var l=u.data.replace(/[ \r\n\t]+/g," ");if((!a||/ $/.test(a.data))&&!s&&l[0]===" "&&(l=l.substr(1)),!l){u=vs(u);continue}u.data=l,a=u}else if(u.nodeType===1)n(u)||u.nodeName==="BR"?(a&&(a.data=a.data.replace(/ $/,"")),a=null,s=!1):r(u)||i(u)?(a=null,s=!0):a&&(s=!1);else{u=vs(u);continue}var d=sd(o,u,i);o=u,u=d}a&&(a.data=a.data.replace(/ $/,""),a.data||vs(a))}}function vs(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function sd(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var hu=typeof window<"u"?window:{};function XE(){var e=hu.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function e_(){var e=function(){};return t_()?e.prototype.parseFromString=function(t){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(t),n.close(),n}:e.prototype.parseFromString=function(t){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(t),n.close(),n},e}function t_(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{hu.ActiveXObject&&(e=!0)}return e}var n_=XE()?hu.DOMParser:e_();function r_(e,t){var n;if(typeof e=="string"){var r=i_().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return JE({element:n,isBlock:fu,isVoid:ih,isPre:t.preformattedCode?a_:null}),n}var bs;function i_(){return bs=bs||new n_,bs}function a_(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function s_(e,t){return e.isBlock=fu(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=o_(e),e.flankingWhitespace=u_(e,t),e}function o_(e){return!ih(e)&&!YE(e)&&/^\s*$/i.test(e.textContent)&&!ZE(e)&&!GE(e)}function u_(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=l_(e.textContent);return n.leadingAscii&&od("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&od("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function l_(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function od(e,t,n){var r,i,a;return e==="left"?(r=t.previousSibling,i=/ $/):(r=t.nextSibling,i=/^ /),r&&(r.nodeType===3?a=i.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?a=!1:r.nodeType===1&&!fu(r)&&(a=i.test(r.textContent))),a}var c_=Array.prototype.reduce,d_=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function ni(e){if(!(this instanceof ni))return new ni(e);var t={rules:lt,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
151
+ `):""}function oh(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}oh.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=gs(this.array,e,this.options))||(t=gs(this._keep,e,this.options))||(t=gs(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function gs(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(QE(i,t,n))return i}}function QE(e,t,n){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function JE(e){var t=e.element,n=e.isBlock,r=e.isVoid,i=e.isPre||function(h){return h.nodeName==="PRE"};if(!(!t.firstChild||i(t))){for(var a=null,s=!1,o=null,u=sd(o,t,i);u!==t;){if(u.nodeType===3||u.nodeType===4){var l=u.data.replace(/[ \r\n\t]+/g," ");if((!a||/ $/.test(a.data))&&!s&&l[0]===" "&&(l=l.substr(1)),!l){u=vs(u);continue}u.data=l,a=u}else if(u.nodeType===1)n(u)||u.nodeName==="BR"?(a&&(a.data=a.data.replace(/ $/,"")),a=null,s=!1):r(u)||i(u)?(a=null,s=!0):a&&(s=!1);else{u=vs(u);continue}var d=sd(o,u,i);o=u,u=d}a&&(a.data=a.data.replace(/ $/,""),a.data||vs(a))}}function vs(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function sd(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var hu=typeof window<"u"?window:{};function XE(){var e=hu.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function e_(){var e=function(){};return t_()?e.prototype.parseFromString=function(t){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(t),n.close(),n}:e.prototype.parseFromString=function(t){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(t),n.close(),n},e}function t_(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{hu.ActiveXObject&&(e=!0)}return e}var n_=XE()?hu.DOMParser:e_();function r_(e,t){var n;if(typeof e=="string"){var r=i_().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return JE({element:n,isBlock:fu,isVoid:ih,isPre:t.preformattedCode?a_:null}),n}var bs;function i_(){return bs=bs||new n_,bs}function a_(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function s_(e,t){return e.isBlock=fu(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=o_(e),e.flankingWhitespace=u_(e,t),e}function o_(e){return!ih(e)&&!YE(e)&&/^\s*$/i.test(e.textContent)&&!ZE(e)&&!GE(e)}function u_(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=l_(e.textContent);return n.leadingAscii&&od("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&od("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function l_(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function od(e,t,n){var r,i,a;return e==="left"?(r=t.previousSibling,i=/ $/):(r=t.nextSibling,i=/^ /),r&&(r.nodeType===3?a=i.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?a=!1:r.nodeType===1&&!fu(r)&&(a=i.test(r.textContent))),a}var c_=Array.prototype.reduce,d_=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function ni(e){if(!(this instanceof ni))return new ni(e);var t={rules:lt,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
152
152
 
153
153
  `:""},keepReplacement:function(n,r){return r.isBlock?`
154
154
 
@@ -160,6 +160,6 @@ ${p}${m?"1.":"-"} ${l}${h?`
160
160
 
161
161
  `:n}};this.options=WE({},t,e),this.rules=new oh(this.options)}ni.prototype={turndown:function(e){if(!h_(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=uh.call(this,new r_(e,this.options));return f_.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e=="function")e(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return d_.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function uh(e){var t=this;return c_.call(e.childNodes,function(n,r){r=new s_(r,t.options);var i="";return r.nodeType===3?i=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(i=m_.call(t,r)),lh(n,i)},"")}function f_(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=lh(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function m_(e){var t=this.rules.forNode(e),n=uh.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function lh(e,t){var n=HE(e),r=VE(t),i=Math.max(e.length-n.length,t.length-r.length),a=`
162
162
 
163
- `.substring(0,i);return n+a+r}function h_(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var p_={isHistory(e){return ot(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||vn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||vn.isOperationList(e.undos[0].operations))}},ys=new WeakMap,xs=new WeakMap,nr={isHistoryEditor(e){return p_.isHistory(e.history)&&w.isEditor(e)},isMerging(e){return xs.get(e)},isSaving(e){return ys.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=nr.isMerging(e);xs.set(e,!1),t(),xs.set(e,n)},withoutSaving(e,t){var n=nr.isSaving(e);ys.set(e,!1),t(),ys.set(e,n)}},g_=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:i}=r;if(i.length>0){var a=i[i.length-1];a.selectionBefore&&ee.setSelection(t,a.selectionBefore),nr.withoutSaving(t,()=>{w.withoutNormalizing(t,()=>{for(var s of a.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",a)}},t.undo=()=>{var{history:r}=t,{undos:i}=r;if(i.length>0){var a=i[i.length-1];nr.withoutSaving(t,()=>{w.withoutNormalizing(t,()=>{var s=a.operations.map(vn.inverse).reverse();for(var o of s)t.apply(o);a.selectionBefore&&ee.setSelection(t,a.selectionBefore)})}),t.writeHistory("redos",a),r.undos.pop()}},t.apply=r=>{var{operations:i,history:a}=t,{undos:s}=a,o=s[s.length-1],u=o&&o.operations[o.operations.length-1],l=nr.isSaving(t),d=nr.isMerging(t);if(l==null&&(l=b_(r)),l){if(d==null&&(o==null?d=!1:i.length!==0?d=!0:d=v_(r,u)),o&&d)o.operations.push(r);else{var m={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",m)}for(;s.length>100;)s.shift();a.redos=[]}n(r)},t.writeHistory=(r,i)=>{t.history[r].push(i)},t},v_=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&L.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&L.equals(e.path,t.path)),b_=(e,t)=>e.type!=="set_selection";const y_=(e,t)=>{const{apply:n}=e;try{e.apply=r=>{if(r.type==="remove_node"&&"type"in r.node&&r.node.type===Z.link){const i=r.node;if(i.link){const a=new CustomEvent("linkRemoved",{detail:{url:i.link}});window.dispatchEvent(a)}}n(r)}}catch(r){const i=r.message;t(`Error in withLinkRemovalListener: ${i}`)}return e};var x_=E_,w_=/^(?:\w+:)?\/\/(\S+)$/,C_=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,D_=/^[^\s\.]+\.\S{2,}$/;function E_(e){if(typeof e!="string")return!1;var t=e.match(w_);if(!t)return!1;var n=t[1];return n?!!(C_.test(n)||D_.test(n)):!1}const __=$n(x_),k_=(e,t,n)=>{const{insertText:r,isInline:i}=e;try{e.isInline=a=>{const s=a;return[Z.link].includes(s.type)||i(a)},e.insertText=a=>{a&&__(a)?du(e,a,t):r(a)}}catch(a){const s=a.message;n(`Error in withInlines: ${s}`)}return e},F_=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:i}=e;try{e.isInline=a=>a.type===Z.mention?!0:n(a),e.isVoid=a=>a.type===Z.mention?!0:r(a),e.markableVoid=a=>a.type===Z.mention||i(a)}catch(a){const s=a.message;t(`Error in withMentions: ${s}`)}return e},A_=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,i])=>{if(r.type===Z.link&&le.string(r).trim()===""){ee.removeNodes(e,{at:i});return}n([r,i])}}catch(r){const i=r.message;t(`Error in withoutEmptyLinks: ${i}`)}return e};const pu=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:i,functions:a,autoFocus:s,data:o,styling:u,...l})=>{const d=ie.useIntl(),m=rp();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=i||{},{listMembers:p,clickMentionFallback:g,onChange:f=()=>{},onChangeData:b=()=>{},getLinkPreview:v=()=>Promise.resolve({}),onMention:y=()=>{},reportError:C=R=>{console.error(R)}}=a||{},k=[{type:Z.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const D={editorKey:null,originalValue:t||"",initialValue:t?null:k,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1,enrichedUrl:!1},[_,B]=x.useReducer(pr,D),{editorKey:P,originalValue:N,initialValue:z,stringValue:O,lastAnchor:A,lastKey:F,hasInteracted:S,hasLoaded:I,enrichedUrl:H,mentionPopover:V}=_,ae=async R=>{const M=await v(R);M.url&&B([{type:"enrichedUrl",value:M}])},ne=`rte-${e}`,E=x.useCallback(R=>c.jsx(ub,{...R}),[]),Y=x.useCallback(R=>c.jsx(lb,{...R}),[]),q=x.useMemo(()=>y_(k_(F_(A_(g_(Yw(Jx())),C),C),ne,C),C),[]),T=R=>{if(!q||R!==ne)return;const M=w.end(q,[]);ee.select(q,M),re.focus(q)};x.useEffect(()=>{const R=M=>{var W;const U=M,X=((W=U==null?void 0:U.detail)==null?void 0:W.id)||null;X&&T(X)};return window.addEventListener("focusEditor",R),()=>{window.removeEventListener("focusEditor",R)}},[]),x.useEffect(()=>{if(q.children.length>0&&!I){if(B([{type:"hasLoaded",value:!0}]),!s)return;T(ne)}},[q.children.length,z]),x.useEffect(()=>{N&&(async()=>{let M=Pt(N);if(M.includes("<")){ni.prototype.escape=X=>X;const U=new ni;U.addRule("br",{filter:["br"],replacement:X=>X+`
163
+ `.substring(0,i);return n+a+r}function h_(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var p_={isHistory(e){return ot(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||vn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||vn.isOperationList(e.undos[0].operations))}},ys=new WeakMap,xs=new WeakMap,nr={isHistoryEditor(e){return p_.isHistory(e.history)&&w.isEditor(e)},isMerging(e){return xs.get(e)},isSaving(e){return ys.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=nr.isMerging(e);xs.set(e,!1),t(),xs.set(e,n)},withoutSaving(e,t){var n=nr.isSaving(e);ys.set(e,!1),t(),ys.set(e,n)}},g_=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:i}=r;if(i.length>0){var a=i[i.length-1];a.selectionBefore&&ee.setSelection(t,a.selectionBefore),nr.withoutSaving(t,()=>{w.withoutNormalizing(t,()=>{for(var s of a.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",a)}},t.undo=()=>{var{history:r}=t,{undos:i}=r;if(i.length>0){var a=i[i.length-1];nr.withoutSaving(t,()=>{w.withoutNormalizing(t,()=>{var s=a.operations.map(vn.inverse).reverse();for(var o of s)t.apply(o);a.selectionBefore&&ee.setSelection(t,a.selectionBefore)})}),t.writeHistory("redos",a),r.undos.pop()}},t.apply=r=>{var{operations:i,history:a}=t,{undos:s}=a,o=s[s.length-1],u=o&&o.operations[o.operations.length-1],l=nr.isSaving(t),d=nr.isMerging(t);if(l==null&&(l=b_(r)),l){if(d==null&&(o==null?d=!1:i.length!==0?d=!0:d=v_(r,u)),o&&d)o.operations.push(r);else{var h={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",h)}for(;s.length>100;)s.shift();a.redos=[]}n(r)},t.writeHistory=(r,i)=>{t.history[r].push(i)},t},v_=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&L.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&L.equals(e.path,t.path)),b_=(e,t)=>e.type!=="set_selection";const y_=(e,t)=>{const{apply:n}=e;try{e.apply=r=>{if(r.type==="remove_node"&&"type"in r.node&&r.node.type===Z.link){const i=r.node;if(i.link){const a=new CustomEvent("linkRemoved",{detail:{url:i.link}});window.dispatchEvent(a)}}n(r)}}catch(r){const i=r.message;t(`Error in withLinkRemovalListener: ${i}`)}return e};var x_=E_,w_=/^(?:\w+:)?\/\/(\S+)$/,C_=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,D_=/^[^\s\.]+\.\S{2,}$/;function E_(e){if(typeof e!="string")return!1;var t=e.match(w_);if(!t)return!1;var n=t[1];return n?!!(C_.test(n)||D_.test(n)):!1}const __=$n(x_),k_=(e,t,n)=>{const{insertText:r,isInline:i}=e;try{e.isInline=a=>{const s=a;return[Z.link].includes(s.type)||i(a)},e.insertText=a=>{a&&__(a)?du(e,a,t):r(a)}}catch(a){const s=a.message;n(`Error in withInlines: ${s}`)}return e},F_=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:i}=e;try{e.isInline=a=>a.type===Z.mention?!0:n(a),e.isVoid=a=>a.type===Z.mention?!0:r(a),e.markableVoid=a=>a.type===Z.mention||i(a)}catch(a){const s=a.message;t(`Error in withMentions: ${s}`)}return e},A_=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,i])=>{if(r.type===Z.link&&le.string(r).trim()===""){ee.removeNodes(e,{at:i});return}n([r,i])}}catch(r){const i=r.message;t(`Error in withoutEmptyLinks: ${i}`)}return e};const pu=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:i,functions:a,autoFocus:s,data:o,styling:u,...l})=>{const d=ie.useIntl(),h=rp();typeof s>"u"&&(s=!0);const{isInOverlay:m=!1}=i||{},{listMembers:p,clickMentionFallback:g,onChange:f=()=>{},onChangeData:b=()=>{},getLinkPreview:v=()=>Promise.resolve({}),onMention:y=()=>{},reportError:C=R=>{console.error(R)}}=a||{},k=[{type:Z.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const D={editorKey:null,originalValue:t||"",initialValue:t?null:k,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1,enrichedUrl:!1},[_,B]=x.useReducer(pr,D),{editorKey:M,originalValue:P,initialValue:z,stringValue:O,lastAnchor:A,lastKey:F,hasInteracted:S,hasLoaded:I,enrichedUrl:H,mentionPopover:V}=_,ae=async R=>{const N=await v(R);N.url&&B([{type:"enrichedUrl",value:N}])},ne=`rte-${e}`,E=x.useCallback(R=>c.jsx(ub,{...R}),[]),Y=x.useCallback(R=>c.jsx(lb,{...R}),[]),q=x.useMemo(()=>y_(k_(F_(A_(g_(Yw(Jx())),C),C),ne,C),C),[]),T=R=>{if(!q||R!==ne)return;const N=w.end(q,[]);ee.select(q,N),re.focus(q)};x.useEffect(()=>{const R=N=>{var W;const U=N,X=((W=U==null?void 0:U.detail)==null?void 0:W.id)||null;X&&T(X)};return window.addEventListener("focusEditor",R),()=>{window.removeEventListener("focusEditor",R)}},[]),x.useEffect(()=>{if(q.children.length>0&&!I){if(B([{type:"hasLoaded",value:!0}]),!s)return;T(ne)}},[q.children.length,z]),x.useEffect(()=>{P&&(async()=>{let N=Pt(P);if(N.includes("<")){ni.prototype.escape=X=>X;const U=new ni;U.addRule("br",{filter:["br"],replacement:X=>X+`
164
164
 
165
- `}),M=U.turndown(M)}o&&o.mentions&&(M=await Pd({text:M,template:`[${io}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),_E(M,U=>{const X=[{type:"initialValue",value:U},{type:"editorKey",value:N.toString()}];o!=null&&o.link&&(X.push({type:"enrichedUrl",value:o.link}),o.link.url&&ae(o.link.url)),B(X),setTimeout(()=>{B([{type:"stringValue",value:ed(q)}])},150)})})()},[N]),x.useEffect(()=>{if(H===void 0&&q){const M=AE(q);M&&ae(M)}const R=M=>{var W;const U=M,X=((W=U==null?void 0:U.detail)==null?void 0:W.url)||null;X&&H&&H.url===X&&B([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",R),()=>{window.removeEventListener("linkRemoved",R)}},[H]),x.useEffect(()=>{if(t){Hr.lastIndex=0;const R=t.match(Hr);R&&R.length===1&&R[0].length===t.length&&!S&&B([{type:"originalValue",value:t}])}t!==""||!q||Wi(N,t)&&!S||(w.withoutNormalizing(q,()=>{ee.delete(q,{at:{anchor:w.start(q,[]),focus:w.end(q,[])}}),ee.deselect(q),q.children.length!==0&&ee.unwrapNodes(q,{at:[0]}),ee.insertNodes(q,k,{at:[0]})}),B([{type:"initialValue",value:k},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),x.useEffect(()=>{b({link:H})},[H]),x.useEffect(()=>{O===""&&H&&B([{type:"enrichedUrl",value:void 0}])},[O]);const j=Wr(()=>{BE({editor:q,isShowing:V.show,numberOfUsers:V.numberOfUsers,listMembers:p,dispatch:B})},100);return z?c.jsx("div",{id:ne,className:"rich-text-editor input text-medium",children:c.jsxs(cn.Provider,{value:{..._,id:ne,isInOverlay:h,dispatch:B,onMention:y,reportError:C},children:[c.jsxs(Kw,{editor:q,initialValue:z,onChange:R=>{if(q.operations.some(U=>U.type!=="set_selection")){let U=jE(R);U==="<br>"&&(U=""),f(U,H),B([{type:"stringValue",value:ed(q)}]),S||B([{type:"hasInteracted",value:!0}]),j(),m&&console.log({serialized:U,json:R})}},...l,children:[c.jsx(Rw,{className:"editor",renderElement:E,renderLeaf:Y,placeholder:n||d.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async R=>{const M=H!==!1,U=R.clipboardData.getData("text");if((W=>{try{return new URL(W),!0}catch{return!1}})(U)){let W=U;if(U){const{full:te}=bo(U);W=te}if(U&&v&&!M){const te=await v(W);te.url&&B([{type:"enrichedUrl",value:te}])}}},onKeyDown:R=>{if(R.key==="Enter"){V.show&&(R.preventDefault(),R.stopPropagation(),Ym(q,V,B,ne));const{selection:M}=q;if(M){const U=Q.isCollapsed(M),[X,W]=w.node(q,M,{depth:1});let te=X,de=te.type;const J=te.children[0];if(J&&(J==null?void 0:J[Z.h3])===!0&&(R.stopPropagation(),R.preventDefault(),ee.insertNodes(q,k)),J&&[Z.ol,Z.ul].includes(J.type)&&(te=J,de=J.type),te&&he.isElement(te)&&de!==Z.paragraph){if(de===Z.blockquote&&!R.shiftKey){R.stopPropagation(),R.preventDefault(),ee.insertNodes(q,k);return}if(U){const[ve,me]=w.parent(q,M,{edge:"end"}),_e=ve.type;if([Z.ul,Z.ol].includes(de))if(R.stopPropagation(),R.preventDefault(),_e===Z.li&&F==="Enter"){ve.children.length===1&&"text"in ve.children[0]&&ve.children[0].text===""&&ee.removeNodes(q,{at:me}),ee.insertNodes(q,k,{at:L.next(W)}),ee.select(q,w.end(q,L.next(W)));return}else{const[De,ze]=kE(q,Z.li),We={type:Z.li,children:[{text:""}]};ee.insertNodes(q,We,{at:L.next(ze)}),ee.select(q,w.end(q,L.next(ze)))}}}}}else if(R.key==="Escape"){if(V.show){R.preventDefault(),R.stopPropagation(),B([{type:"mentionPopover",value:{...V,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(R.key)&&V.show){R.preventDefault(),R.stopPropagation();const{selectedUser:M,possibleUsers:U}=V;let X=R.key==="ArrowUp"?M-1:M+1;X<0&&(X=U.length-1),X>=U.length+1&&(X=0),B([{type:"mentionPopover",value:{...V,selectedUser:X}}])}B([{type:"lastKey",value:R.key}]),TE(R,q,B,C)},onBlur:()=>{q.selection&&B([{type:"lastAnchor",value:q.selection.anchor}])},onFocus:()=>{if(A){if(!L.isPath(A.path)||!le.has(q,A.path))return;const R=le.get(q,A.path);let M=0;if(ge.isText(R)?M=R.text.length:R.children&&(M=R.children.length),A.offset>M)return;try{ee.select(q,{anchor:A,focus:A})}catch(U){const X=U.message;C(`Error focusing editor: ${X}`)}}}}),H?c.jsx($o,{data:H,variant:"condensed",onClick:()=>{B([{type:"enrichedUrl",value:!1}]);const R=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(R)},"aria-label":d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:H.title||d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(UE,{styling:u==null?void 0:u.toolbar}),p?c.jsx(PE,{onFallbackClick:g}):c.jsx(c.Fragment,{})]},P),c.jsx(zo,{id:`character-limit-${e}`,limit:r,valueLength:ba(O)})]})}):c.jsx(c.Fragment,{})};const T_=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:i=()=>{}},isDisabled:a=!1,className:s=""})=>{const[o,u]=x.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);x.useEffect(()=>{r&&u(r)},[r]);const l=d=>{a||(u(d),i(d))};return c.jsxs("div",{className:K("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),l(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:K("toggle-options",{disabled:a,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:()=>l(d.value),disabled:a}),c.jsx("label",{htmlFor:m,children:d.label})]},m)})})]})};function ch({className:e="",userId:t,userName:n,src:r,uploadImage:i,button:a,callback:s}){const o=ie.useIntl(),u="profileImageChange_",[l,d]=x.useState(r),[m,h]=x.useState(!1),[p,g]=x.useState(!1),f=x.useRef(null),b=async k=>{h(!0),g(!1);try{const D=k.target.files&&k.target.files[0];if(!D||!t)throw h(!1),new Error("Image file or userID is missing");const _=await i({fileObject:D,userId:t}),B={thumbnail:_.thumbnailURL,full:_.originalURL};d(B),s(B)}catch{g(!0)}finally{h(!1)}h(!1)},{upload:v=o.formatMessage({id:`${u}cta_upload`}),change:y=o.formatMessage({id:`${u}cta_change`}),uploading:C=o.formatMessage({id:`${u}cta_uploading`})}=(a==null?void 0:a.text)||{};return c.jsxs("div",{className:K("profile-image-change-figure",e),children:[c.jsx(un,{className:"profile-image-change-picture",name:n,src:l==null?void 0:l.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),p&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${u}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(we,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${l?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:m,children:m?C:l?y:v})]})}const dh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:i="contact-form-submit-click"}=e||{};return c.jsx(Xt,{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:i},functions:{onSuccess:t,onFailure:n},button:{className:"new"}})};const B_=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=ie.useIntl();return c.jsx(zh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:i=>{t(i),n(!i.length)},autoFocus:!1,getLabel:(i,a,s)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:i}),c.jsx(we,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(a),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},a)})},fh=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:i,labelColor:a,backgroundColor:s,onClose:o,reportError:u,sendInvites:l,initialFormStatus:d="NOT_SUBMITTED",gtm:m={context:"Form",event:"form-submit-click"},secondaryActionButton:h,meta:p})=>{const[g,f]=x.useState([]),[b,v]=x.useState(!0),[y,C]=x.useState(d),{formatMessage:k}=ie.useIntl(),D=async P=>{try{await l(g,P.message),f([]),C("SUCCESS")}catch(N){C("ERROR"),u(N)}},_=P=>{P.preventDefault(),C("NOT_SUBMITTED"),v(!0),f([])},B=P=>{P.preventDefault(),o(),C("CLOSED")};return y==="CLOSED"?null:y==="ERROR"||y==="SUCCESS"&&!(p!=null&&p.shouldHideDoneButtonOnSubmit)?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:y==="SUCCESS"?c.jsx("h2",{className:"success-title",children:k({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",k({id:"inviteForm_error"})]})}),c.jsx(zt,{}),c.jsx("div",{className:"footer",children:y==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(we,{variant:"secondary",onClick:_,children:k({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(we,{onClick:B,children:k({id:"inviteForm_ctaDone"})})]}):c.jsx(we,{onClick:_,children:k({id:"inviteForm_ctaTryAgain"})})})]}):c.jsxs("div",{className:"invite-form-wrapper",style:{backgroundColor:s},children:[c.jsxs("div",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:i},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t})]}),c.jsx(Xt,{id:"invite-form",fields:[{component:B_,props:{emails:g,setEmails:f,setIsDisabled:v},required:!0},{id:"message",type:"textarea",label:k({id:"inviteForm_message_label"}),placeholder:n||k({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:D},button:{text:r,size:"medium",disabled:b},gtm:m,meta:p,secondaryActionButton:h})]})},Ui=e=>e.map(t=>({condition:t})),Bt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},S_=({functions:e,...t})=>{const{formatMessage:n}=ie.useIntl(),[r,i]=x.useState(null),[a,s]=x.useState(!1),[o,u]=x.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),l=p=>p[Bt.NEW_PASSWORD]!==p[Bt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=p=>!Ns(p[Bt.NEW_PASSWORD]).isValid,m=[{"data-testid":Bt.NEW_PASSWORD,id:Bt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Ui(["required",d]),functions:{onChange:p=>u(Ns(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Bt.CONFIRMED_PASSWORD,id:Bt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Ui(["required",l])}];t.isPasswordChange&&m.unshift({"data-testid":Bt.CURRENT_PASSWORD,id:Bt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Ui(["required"])}),a&&m.push({component:Lf,props:{matchingRules:o}});const h={id:Bt.FORM_ID,fields:m,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>i(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(Bt.NEW_PASSWORD)||g.includes(Bt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Xt,{...h}),r&&c.jsx(Qt,{variant:"error",text:r})]})};const mh=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:i,...a})=>{var P;const s=ie.useIntl(),o="profileForm_",u=x.useContext(rt),[l,d]=x.useState(u.image),[m,h]=x.useState(!1),{uploadImage:p=()=>{},onSuccess:g=async N=>{},onCancel:f=()=>{},onFailure:b=()=>{}}=n,{buildLocation:v,isValidPlace:y,predictPlaces:C}=t.useMaps(),{context:k="ProfileForm",event:D="profile-form-submit-click"}=i||{},_=[{id:"jobTitle",type:"text",label:s.formatMessage({id:`${o}jobTitle`}),placeholder:s.formatMessage({id:`${o}jobTitle_placeholder`}),value:u.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:s.formatMessage({id:`${o}organization`}),placeholder:s.formatMessage({id:`${o}organization_placeholder`}),value:u.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:s.formatMessage({id:`${o}location`}),placeholder:s.formatMessage({id:`${o}location_placeholder`}),value:(P=u.location)==null?void 0:P.en,validation:[{condition:"required"},{condition:({location:N})=>N&&!m?!1:!y(N),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{m||h(!0)},onKeyInput:C}}],B=[{component:ch,props:{userName:u.name,userId:u.id,src:l,uploadImage:p,callback:d,button:{text:{upload:s.formatMessage({id:`${o}image`})}}}},{id:"name",type:"text",label:s.formatMessage({id:`${o}name`}),placeholder:s.formatMessage({id:`${o}name_placeholder`}),value:u.name,autoComplete:"name",validation:[{condition:"required"}]},..._,{id:"biography",type:"textarea",label:s.formatMessage({id:`${o}bio`}),placeholder:s.formatMessage({id:`${o}bio_placeholder`}),limit:1e3,value:u.biography},{component:zt}];return c.jsx(Xt,{id:"profile-details-form",fields:e?_:B,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:k,event:D},functions:{onSuccess:async N=>{try{const z={...N,image:l||null,location:m?await v(N==null?void 0:N.location):u.location,...e?{onboardingState:"completed"}:{}};u.updateDetails&&u.updateDetails(O=>({...O,...z})),await g(z)}catch{b()}},onCancel:f,onFailure:b},button:{size:"large",text:{default:s.formatMessage({id:`${o}cta`}),submitting:s.formatMessage({id:`${o}cta_submitting`}),submitted:s.formatMessage({id:`${o}cta_submitted`})}},...a})},j_=()=>{const e=ie.useIntl(),[t,n]=x.useState(0);return x.useEffect(()=>{const r=setInterval(()=>{n(i=>{if(i>=95)return clearInterval(r),95;const a=Math.round(Math.random()*10);return Math.min(i+a,95)})},800);return()=>{clearInterval(r)}},[]),c.jsx(Xd,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};function P_({coverImage:e,setShowImagePicker:t}){return e&&e.url?c.jsx(Qt,{className:"cover-image-preview",text:c.jsx(Cn,{className:"cover-image",image:{description:e.description||"",height:e.height,width:e.width,url:e.url,color:e.color,type:"image/jpeg"}}),button:{component:c.jsx(we,{variant:"tertiary",onClick:()=>t(!0),children:c.jsx(ie.FormattedMessage,{id:"publishArticleForm_replaceImage_button"})})}}):c.jsx(Qt,{button:{component:c.jsx(we,{variant:"secondary",onClick:()=>t(!0),children:c.jsx(ie.FormattedMessage,{id:"publishArticleForm_selectImage_button"})})}})}var hh=(e=>(e.CitiesAndLocalGovernment="topic_CitiesAndLocalGovernment",e.Climate="topic_Climate",e.DigitalAndData="topic_DigitalAndData",e.Education="topic_Education",e.EquityJusticeAndInclusion="topic_EquityJusticeAndInclusion",e.HealthAndSocialCare="topic_HealthAndSocialCare",e.Innovation="topic_Innovation",e.LeadershipAndSkills="topic_LeadershipAndSkills",e.LifeInGovernment="topic_LifeInGovernment",e.Policymaking="topic_Policymaking",e.TransportAndInfrastructure="topic_TransportAndInfrastructure",e.WorkingAndTheEconomy="topic_WorkAndTheEconomy",e))(hh||{});let ws=null;const et="publishArticleForm_",ud={},ld=10,O_=({id:e="publish-article-form",values:t=ud,setShowImagePicker:n,functions:r,meta:i,gtm:a})=>{var N;const s=ie.useIntl(),o=x.useContext(rt),{create:u,onSuccess:l=()=>{},onFailure:d=()=>{}}=r||{},{isInOverlay:m=!1}=i||{},[h,p]=x.useState(!1),[g,f]=x.useState(t.body||""),[b,v]=x.useState(!1),[y,C]=x.useState("");x.useEffect(()=>{Wi(t,ud)||Kr(t.body)&&t.body!==g&&t.body!==void 0&&f(t.body)},[t.body]);const k=()=>{!o||!o.id?v(s.formatMessage({id:`${et}error_loggedOut`})):b&&v(!1)},D=z=>({condition:O=>{const A=O[z];return!A||typeof A!="string"?!0:A.length<ld},error:s.formatMessage({id:`${et}error_underMinLength`},{length:ld})}),_=!!g&&Kr(g),B=()=>c.jsxs(c.Fragment,{children:[c.jsx(zt,{}),c.jsx("p",{className:"text-medium",children:s.formatMessage({id:`${et}disclaimer`})})]}),P=[{id:"title",type:"textarea",value:t.title||"",limit:65,label:s.formatMessage({id:`${et}title_label`}),placeholder:s.formatMessage({id:`${et}title_placeholder`}),styling:{autosizeToFit:!0},functions:{onChange:k},validation:[{condition:"required"},D("title")]},{id:"subtitle",type:"textarea",value:t.subtitle,limit:115,label:s.formatMessage({id:`${et}subtitle_label`}),styling:{autosizeToFit:!0},placeholder:s.formatMessage({id:`${et}subtitle_placeholder`}),functions:{onChange:k},validation:[{condition:"required"},D("subtitle")]},{component:sa,props:{formID:e,label:{visible:s.formatMessage({id:`${et}body_label`})},showLabel:!0}},{component:pu,props:{id:`${e}-input`,value:g,placeholder:s.formatMessage({id:`${et}body_placeholder`}),meta:{isInOverlay:m},autoFocus:!1,functions:{onChange:z=>{f(z),k()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!b,"aria-errormessage":"error-message"}},{id:"tags",label:s.formatMessage({id:`${et}tags_label`}),type:"checkboxes",styling:{displayOptionsAsPills:!0},options:Object.values(hh).map(z=>({id:z,label:s.formatMessage({id:`${et}_tags_${z}`})})),multipleOptions:{limit:3},validation:[{condition:"required",error:s.formatMessage({id:`${et}tags_error_required`})},{condition:z=>{var O;return((O=z==null?void 0:z.tags)==null?void 0:O.length)>3},error:s.formatMessage({id:`${et}tags_error_over_three`})}]},{component:sa,props:{formID:e,label:{visible:s.formatMessage({id:`${et}cover_image_label`})},showLabel:!0}},{component:P_,props:{coverImage:t.coverImage||{},setShowImagePicker:n}}];return h?P.push({component:zt}):P.push({component:B}),c.jsxs("section",{className:"publish-article-form",children:[c.jsx(Xt,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,shouldScrollOnSuccess:!1},functions:{onSuccess:async z=>{if(!o||!o.id||!_)return;ws&&clearTimeout(ws),p(!0);const O={...z,body:g,coverImage:t.coverImage};try{u&&await u(O),ws=setTimeout(()=>{C(s.formatMessage({id:`${et}aria_success`})),l(O)},500)}catch{v(s.formatMessage({id:`${et}error`})),C(""),d()}},onFailure:d},fields:P,intlPath:et,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":a==null?void 0:a.context,"data-gtm-event-type":"publish-article-click",disabled:!o||!o.id||!_||!((N=t==null?void 0:t.coverImage)!=null&&N.url),text:{default:s.formatMessage({id:`${et}cta_submit`}),submitting:s.formatMessage({id:`${et}cta_submitting`}),submitted:s.formatMessage({id:`${et}cta_submitted`})},customOnSubmit:b?c.jsx(c.Fragment,{}):c.jsx(j_,{})},gtm:a}),b&&c.jsx(ur,{id:"error-message",className:"error",children:typeof b=="string"&&b.includes(" ")?b:s.formatMessage({id:`${et}error`})}),y&&c.jsx(Oe,{"aria-live":"polite",showOnFocus:!1,children:y})]})};const ph=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:i="search-bar",gtmEvent:a="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},u=ie.useIntl(),l=x.useRef(null);or(()=>{!n||o||!s||l.current&&l.current.focus()},[s]);const d=m=>{m.preventDefault(),m.stopPropagation(),!(!l.current||!l.current.value||l.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(l.current.value)}`)};return c.jsx("form",{onSubmit:d,className:K("search-form gtm-trackable",t),role:"search","data-gtm-event-context":i,"data-gtm-event-type":a,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Oe,{element:"label",htmlFor:e,children:u.formatMessage({id:"search_label"})}),c.jsx("input",{ref:l,type:"search",id:e,name:e,defaultValue:r,placeholder:u.formatMessage({id:"search_placeholder"}),onKeyDown:m=>{m.key==="Enter"&&d(m)}}),c.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.stopPropagation(),l.current&&l.current.value&&(l.current.value="")},children:c.jsx(Oe,{children:u.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Oe,{children:u.formatMessage({id:"search_cta"})})})]})})})},cd=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 i=e.current.value.toString().toLowerCase().trim(),a={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},a);try{s=await t(i),s===void 0&&(s=a)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:i,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:u=!1,exists:l}=s;let d="";return o?d=u?"gov":"nonGov":l.registration?l.engagement&&!l.user?d=l.auth?"verify":"pending":d="exists":l.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!u},{type:"emailDetails",value:{email:i,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(i)}},{type:"validFields.email",value:!0}])},M_=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"]}},N_=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:i,state:a})=>{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=M_(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...a.values}),i([{type:"showSuccessMessage",value:!0}])},I_=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:i},refs:a,state:s,dispatch:o,dataToSubmit:u,intl:l})=>{const{emailDetails:d}=s,m=(p,g)=>{p.current&&s.validFields[g]!==p.current.validity.valid&&o([{type:`validFields.${g}`,value:p.current.validity.valid}])},h=[{id:"full_name",type:"text",inputRef:a.name,placeholder:l.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>m(a.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:a.email,placeholder:l.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{cd({ref:a.email,validateEmail:r,dispatch:o})},onChange:(p,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:Of,props:{email:d.email,type:d.boxType,resendVerificationCode:i}}];return s.shouldManuallyApprove&&(h.push({id:"job_title",type:"text",inputRef:a.jobTitle,placeholder:l.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>m(a.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:a.organisation,placeholder:l.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{m(a.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&h.push({id:"url",type:"text",label:l.formatMessage({id:"signup_url"},{small:p=>c.jsx("small",{children:p})}),placeholder:l.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&h.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||l.formatMessage({id:"signup_expectation"},{small:p=>c.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||l.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),h.push({id:"terms",className:"text-small",type:"checkbox",inputRef:a.tc,label:l.formatMessage({id:"signup_terms"},{terms:p=>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:p}),privacy:p=>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:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==a[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:a[f].current.validity.valid}),f==="email"&&cd({ref:a.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),h};const R_=({className:e=""})=>c.jsxs("div",{className:K("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ie.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ie.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const $_={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},L_=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:i={},submitButton:a,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const u=ie.useIntl(),l=window.location.pathname.includes("/signup")?"/login":`/login?returnTo=${window.location.pathname}`,{title:d=!0,expectation:m=!1,url:h=!0,logInButton:p=!0,successMessage:g=!0}=i,f={title:d,expectation:m,url:h,logInButton:p,successMessage:g},[b,v]=x.useReducer(pr,$_),{validFields:y,emailDetails:C,shouldManuallyApprove:k,shouldDisableButton:D,showSuccessMessage:_,showError:B}=b,[P,N]=ho.useCookies(["signup-this-session","functional-cookie-consent"]),z={form:x.createRef(),name:x.createRef(),email:x.createRef(),jobTitle:x.createRef(),organisation:x.createRef(),tc:x.createRef(),hiddenValidation:x.createRef()};x.useEffect(()=>{k===!0&&z.jobTitle.current&&z.jobTitle.current.focus()},[k]),x.useEffect(()=>{P["signup-this-session"]&&v([{type:"showSuccessMessage",value:!0}])},[P]),x.useEffect(()=>{_&&P["functional-cookie-consent"]&&N("signup-this-session","true",{path:"/",maxAge:3600})},[_]);const O=x.useMemo(()=>I_({placeholders:n,labels:t,shouldShow:f,functions:r,refs:z,state:b,dispatch:v,dataToSubmit:s,intl:u}),[s,r,u,z,f,b]),A=D?!0:k?!Object.values(y).every(F=>F===!0):!y.name||!y.email||["exists","pending","verify"].includes(C.boxType);return f.successMessage&&_?c.jsx(R_,{className:e}):c.jsxs("fieldset",{className:K("signup-form-fieldset",e),"data-testid":"signup-form",children:[f.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ie.FormattedMessage,{id:"signup_title"})}),B&&c.jsx(Qt,{variant:"error",text:u.formatMessage({id:"signup_error"})}),c.jsx(Xt,{className:"signup-form",formRef:z.form,id:"sign-up-form",fields:O,intlPath:"signup",button:{variant:"primary",size:"medium",text:a||u.formatMessage({id:"signup_button_join"}),disabled:A?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:l,"data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:u.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:f.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await N_({refs:z,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:v,state:b})},onCatch:F=>{r.handleError(F),v([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:z.hiddenValidation})]})};const kn=({children:e,className:t="",styling:n={},...r})=>{const{background:i="default",padding:a="none"}=n;return c.jsx("section",{className:K("full-width-section",t,{[i]:i!=="default",[a]:a!=="none"}),...r,children:e})};const z_=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(i=>{r.push({href:i.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable new","data-gtm-event-type":"download-click","data-gtm-event-context":i.eventContext||"Download",target:"_blank",children:i.text})}),c.jsx(kn,{className:K("download-section",n),styling:{background:"dark"},children:c.jsxs("div",{className:"content-default",children:[x.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(vr,{buttons:r})]})})};const mo="editSection_";function gh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const q_=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:i,setShowModal:a})=>{const{formatMessage:s}=ie.useIntl();return c.jsxs(_t,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${mo}placeholder_description`})}),i&&c.jsx("p",{children:c.jsx(we,{href:r,variant:"secondary",size:"small",onClick:()=>gh({href:r,setShowModal:a}),children:n||s({id:`${mo}placeholder_cta`})})})]})},U_=({children:e,className:t="",formProps:n,formComponent:r,href:i,title:a,showTitle:s=!0,modalTitle:o,placeholder:u,showDivider:l=!0})=>{const{formatMessage:d}=ie.useIntl(),[m,h]=x.useState(!1),p=()=>h(!1),g=!!n||!!r,f=typeof i=="string"||g;let b;return r&&(b=x.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{p()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),p()}}})),c.jsxs("section",{className:K("edit-section",t),children:[g&&c.jsx(ln,{title:o||`Edit ${a}`,isOpen:m,showDivider:!1,showIcon:!1,functions:{onClose:p},className:K("edit-section-modal"),children:b||(n?c.jsx(Xt,{...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 y,C;(y=n==null?void 0:n.functions)!=null&&y.onSuccess&&await((C=n==null?void 0:n.functions)==null?void 0:C.onSuccess(v)),h(!1)},onCancel:p}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:K("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:a}),f&&c.jsx(we,{href:i,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>gh({href:i,setShowModal:h}),children:d({id:`${mo}edit`})})]}),e||c.jsx(q_,{...u,href:i,setShowModal:h,showEditButton:f}),l&&c.jsx(zt,{})]})};const W_=({title:e=!1,text:t,logos:n=[],styling:r={},className:i=""})=>{const a=n.length;if(a===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:u="center",display:l="block"}=r;return c.jsxs("div",{className:K("logos",i,`align-${u}`,{[l]:l!=="block","wrap-logos":o}),children:[e&&x.createElement(s.element,{className:K("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:K({"two-col":a===2||a===4,"three-col":a===5||a<=10&&a%3===0}),children:n.map(({logo:d,nameOfBusiness:m,link:h=!1,description:p=!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:h?c.jsx("a",{href:h,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),p&&c.jsx("small",{children:p})]},window.btoa(`${d.url}_${g}`))})})]})};let Cs;const Ds="contactFooter_",V_=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=x.useRef(null),[r,i]=x.useState(0),[a,s]=x.useState(!1),o=()=>{n.current&&i(n.current.clientHeight)},u=()=>{a||(s(!0),clearTimeout(Cs),Cs=setTimeout(()=>{o(),s(!1)},500))};return x.useEffect(()=>(o(),window.addEventListener("resize",u),()=>{clearTimeout(Cs),window.removeEventListener("resize",u)}),[]),c.jsx(kn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ie.FormattedMessage,{id:`${Ds}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:a?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(ie.FormattedMessage,{id:`${Ds}text`})}),c.jsx(Dn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ie.FormattedMessage,{id:`${Ds}email`})})]}),c.jsx(dh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},H_=({activeLink:e,profile:t,...n})=>c.jsx(kn,{children:c.jsx(jf,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(Sf,{activeLink:e,profile:t}),c.jsx(Yd,{...n})]})})});const Es="cookieBanner_",_s=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],ks=new Date(Date.now()+12*30*24*60*60*1e3),vh=()=>{const e=ie.useIntl(),[t,n,r]=ho.useCookies(_s),[i,a]=x.useState(!t["apol-cookie-banner"]),s=()=>{_s.forEach(d=>{n(d,!0,{path:"/",expires:ks,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),a(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:ks}),_s.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:ks});return}r(d)}),a(!1)};if(!i)return null;const u=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],l=[];return u.forEach(d=>{l.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:`${Es}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${Es}title`})}),c.jsx("p",{children:e.formatMessage({id:`${Es}text`})}),c.jsx(vr,{buttons:l})]})},nn={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:Qn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Qn["data-protection"].eu,gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["london","washington","berlin","registered","support","business"],london:{address:!0},washington:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:Qn.support,gtmType:"concierge-email-click"},business:{email:Qn.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 rr="footer_",ua="SiteFooter",dd=({group:e})=>{const t=nn[e].order||[];let n=!1;return"text"in nn[e]&&(n=nn[e].text),c.jsxs(x.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ie.FormattedMessage,{id:`${rr}${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:i,gtmType:a}=nn[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:i,className:"gtm-trackable","data-gtm-event-context":ua,"data-gtm-event-type":a,...s,children:c.jsx(ie.FormattedMessage,{id:`${rr}${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(x.Fragment,{children:[c.jsx("dt",{children:c.jsx(ie.FormattedMessage,{id:`${rr}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ie.FormattedMessage,{id:`${rr}${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":ua,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},gu=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(fa,{element:"hr"}),c.jsx(Lo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":ua,"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(dd,{group:e}),Object.keys(nn[e]).includes("child")&&c.jsx(dd,{group:nn[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(nn.social.order)&&nn.social.order.map(e=>{const t=nn.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":ua,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ie.FormattedMessage,{id:`${rr}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ie.FormattedMessage,{id:`${rr}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Ue={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=a=>{const s=`logged${e?"In":"Out"}`;return t>=n[a][s]};let i={};return["navigation","search"].forEach(a=>{i[a]=r(a)}),i},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(i=>i===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:i=!1})=>{if(!i&&n[e]===t||!i&&e===Et.ACCOUNT&&t===!1&&n[Et.SITE]===!0)return;const a=Date.now();if(!i&&!t&&Ue.handlerCalled[e]&&a-Ue.handlerCalled[e]<500)return;Ue.handlerCalled[e]=a;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 Et.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case Et.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case Et.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 i=vd(e[r],t);if(!(typeof i>"u")&&(!n||i[t]&&i[t].includes(n)||i.value&&i.value.includes(n)||i.toString().includes(n)))return e[r]}return e[0].children?Ue.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:i})=>{var u;if(!t.current||!t.current.children)return;const a=n?"desktop":"default";if(r[e][a]){(u=document.querySelector(`#header ul a[href="${r[e][a]}"]:last-child`))==null||u.focus();return}let s,o;switch(e){case Et.SITE:if(n){const l=Ue.findFirstChild(t.current.children,"className","has-submenu parent"),d=Ue.findFirstChild(l.children,"id",Et.SITE);s=Ue.findFirstChild(d.children,"href")}else s=Ue.findFirstChild(t.current.children,"href");break;case Et.ACCOUNT:if(o=Ue.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Ue.findFirstChild(o.children,"href");break;default:return}s&&(i([{type:`focusElements.${e}.${a}`,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(Ue.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Ue.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Ue.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Ue.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},ri={order:["home","communities","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},communities:{href:"/communities/",gtmType:"communities-click",onlyShow:"logged-in"},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:"/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},la=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:a=null})=>{const s=ie.useIntl(),o=vd(ri,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const u="doTrack"in o,l=a===null?u?o.doTrack:!0:a,d=e.includes("buttons.");let m=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(m+=`_logged${t?"In":"Out"}`);let h=!1;if(o.href){let C=o.gtmType||`${e}-click`;if(C.includes(".")){const k=C.split("."),D=k[k.length-2];C=`${D==="topics"?`${D}-`:""}${k[k.length-1]}`}h={href:o.withReturnTo?`${o.href}?returnTo=${window.location.pathname}`:o.href},l&&(h={...h,className:"gtm-trackable","data-gtm-event-type":C,"data-gtm-event-context":"HeaderButtons"}),d&&(h={...h,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],g=p&&o[o.order[0]].order,f=h&&window.location.pathname===o.href;let b={},v={},y={};if(f&&(b={...b,"aria-current":"page"}),p){const C=o.menuId||e,k={onClick:D=>Ue.events.onClick(D,{id:C,callback:i,isOpen:r[C]}),onFocus:()=>Ue.events.onFocus({id:C}),onBlur:()=>Ue.events.onBlur({id:C,callback:i}),onMouseLeave:()=>Ue.events.onBlur({id:C,callback:i}),onMouseEnter:()=>Ue.events.onMouseEnter({id:C,callback:i})};v={...k,id:C===Et.SITE?Et.SITE:Et.ACCOUNT},n&&(g&&(y={...k,className:"navigation-button",onKeyPress:D=>{D.key==="Enter"&&Ue.events.onClick(D,{id:C,callback:i,isOpen:r[C]})},"aria-haspopup":!0,"aria-expanded":r[C],"aria-controls":C}),v={...v,hidden:C in r?!r[C]:!0}),g||(v={...v})}return c.jsxs("li",{className:K({[o.className]:o.className,"has-submenu":p,parent:g,active:f}),...b,children:[h?x.createElement(d?we:"a",h,s.formatMessage({id:m})):n&&o.order&&g?c.jsxs("button",{...y,children:[s.formatMessage({id:m}),c.jsx(Oe,{children:s.formatMessage({id:`header_menu_${r[Et.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:m}),o.order&&c.jsx("ul",{...v,children:o.order.map(C=>{if(!o[C])return null;const k={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:u?l:null};return o[C].order?c.jsxs("li",{className:K({[o[C].className]:o[C].className}),children:[s.formatMessage({id:`${m}_${C}`}),c.jsx("ul",{children:o[C].order.map(D=>c.jsx(la,{id:`${e}.${C}.${D}`,...k},D))})]},C):c.jsx(la,{id:`${e}.${C}`,...k},C)})})]},e)};const K_=({headerIsVisible:e})=>{const t=ie.useIntl();return c.jsx("div",{id:"language-unavailable-message",className:K({visible:e}),children:c.jsx("p",{className:"text",children:t.formatMessage({id:"header_language_unavailable"},{link:n=>c.jsx("a",{href:"/home",children:n})})})})};const Fs={height:67,height_desktop:83,additional_message_height:40};var Et=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(Et||{});const vu=({showNavigation:e=!0,showLanguageUnavailableMessage:t=!1,showLanguageSwitcher:n=!1,functions:{onLanguageSwitcherClick:r}={}})=>{const i=ie.useIntl(),a=x.useContext(rt),s=wn(!0,!0),o=a&&typeof a.id=="string",u=x.useMemo(()=>Ue.getIsDesktopVersion(o,s),[o,s]),[l,d]=x.useReducer(pr,{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:m,menus:h,focusElements:p}=l,g=x.useRef(l);x.useEffect(()=>{g.current=l},[l]),Dd({scrollPosition:t?Fs[`height${u.navigation?"_desktop":""}`]+Fs.additional_message_height:Fs[`height${u.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const D=g.current.menus;!u&&D["site-navigation"]||Ue.shouldChangeHeaderIsVisible(!0,D,d)},scrollDown:()=>{const D=g.current.menus;!u&&D["site-navigation"]||Ue.shouldChangeHeaderIsVisible(!1,D,d)}}});const f=(D,_,B=!1)=>{Ue.handleMenus({id:D,value:_,menus:g.current.menus,dispatch:d,forceHandle:B})},b=x.useRef(null),v=D=>{D.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(_=>{g.current.menus[_]&&f(_,!1,!0)})};x.useEffect(()=>{var D;return(D=document.getElementById("header"))==null||D.addEventListener("keydown",v),()=>{var _;(_=document.getElementById("header"))==null||_.removeEventListener("keydown",v)}},[]),or(()=>{h["site-navigation"]&&Ue.autoFocus({menu:"site-navigation",navigationRef:b,isDesktopVersion:u.navigation,focusElements:p,dispatch:d})},[h["site-navigation"]]),or(()=>{h["account-navigation"]&&Ue.autoFocus({menu:"account-navigation",navigationRef:b,isDesktopVersion:u.navigation,focusElements:p,dispatch:d})},[h["account-navigation"]]);const y=c.jsxs(c.Fragment,{children:[!u.search&&c.jsx("button",{className:"search toggle-search-button",onClick:D=>{D.preventDefault(),D.stopPropagation(),f("search",!h.search)},children:c.jsx(Oe,{children:i.formatMessage({id:`header_search_${h.search?"hide":"show"}`})})}),c.jsx(ph,{id:"global-search",handleToggle:{searchIsOpen:h.search,isDesktopVersion:u.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),C=c.jsx("button",{className:"earth icon language-switcher-button",onClick:D=>{D.preventDefault(),D.stopPropagation(),r&&r()},children:c.jsx(Oe,{children:i.formatMessage({id:"header_language_switcher"})})}),k=c.jsxs(c.Fragment,{children:[!u.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:D=>{D.preventDefault(),D.stopPropagation(),f("site-navigation",!h["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":h["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Oe,{children:i.formatMessage({id:`header_menu_${h["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:b,id:"navigation",hidden:u.navigation||h["account-navigation"]?!1:!h["site-navigation"],"data-showing":!u.navigation&&h["account-navigation"]?"account":"default",children:ri.order.map(D=>c.jsx(la,{id:D,isLoggedIn:o,isDesktopVersion:u.navigation,menus:{"site-navigation":h["site-navigation"],"account-navigation":h["account-navigation"]},callback:f},D))})]});return a&&a.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:K({"logged-in":o,"logged-out":!o,visible:m}),children:[c.jsx(Oe,{element:"a",href:"#content-of-page",children:i.formatMessage({id:"header_skip"})}),c.jsx(Lo,{variant:"monochrome"}),e?c.jsxs(c.Fragment,{children:[u.navigation?c.jsxs(c.Fragment,{children:[k,y,n&&C]}):c.jsxs(c.Fragment,{children:[y,n&&C,k]}),o?c.jsxs("button",{className:"account-button",onClick:D=>Ue.events.onClick(D,{id:"account-navigation",callback:f,isOpen:h["account-navigation"]}),onMouseEnter:()=>Ue.events.onMouseEnter({id:"account-navigation",callback:f}),onMouseLeave:()=>Ue.events.onBlur({id:"account-navigation",callback:f}),"aria-haspopup":"true","aria-expanded":h["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Oe,{children:i.formatMessage({id:`header_account_${h["account-navigation"]?"hide":"show"}`})}),c.jsx(un,{name:a&&a.name||"",src:a&&a.image&&a.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:ri.buttons.order.map(D=>c.jsx(la,{id:`buttons.${D}`},D))})]}):n&&C]}),t&&c.jsx(K_,{headerIsVisible:m}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:K("overlay",{open:h["site-navigation"]||h["account-navigation"]||!u.search&&h.search})})]})};const Z_=()=>{const e=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(vu,{}),c.jsx("div",{id:"content",children:c.jsx(Qt,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(gu,{})]})},bh=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:a={},className:s="",locale:o="en"})=>{const u=ie.useIntl(),{navigation:l=!0,footer:d=!0,unavailableLanguageMessage:m=!1,languageSwitcher:h=!1}=i,{background:p="default",variant:g="default",circle:f="default",modal:b="default"}=a,v=wd(),[y,C]=x.useState(""),k=N=>{const{detail:{message:z}}=N;C(z)};x.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",k),()=>{document.removeEventListener("ariaLive",k)}),[v]);const D=Oi(e,{locale:o}),_=Oi(t,{locale:o}),B=Oi(n,{locale:o}),P={};return p!=="default"&&(P[p]=!0),g!=="default"&&(P[g]=!0),f!=="default"&&(P[f]=!0),c.jsx(Lh.ErrorBoundary,{onError:r,fallback:c.jsx(Z_,{}),children:c.jsxs(x.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:K(s,P,{"has-footer":d}),"data-too-small":u.formatMessage({id:"pageLayout_browserTooSmall"}),children:[c.jsx(vu,{showNavigation:l,showLanguageUnavailableMessage:m,showLanguageSwitcher:h}),c.jsxs("main",{id:"content-wrapper",children:[_&&c.jsx("div",{className:K("additional-content prepended",{"large-modal":b==="large"}),children:_}),x.createElement(p==="bold"?ko:"div",{id:"content",children:D,className:K({"large-modal":b==="large"})})]}),B&&c.jsx("div",{className:"additional-content appended",children:B}),d&&c.jsx(gu,{}),c.jsx(vh,{})]}),y&&c.jsx(Oe,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:y})]})})},fd={default:"tags_",headerTopics:"header_topics_topics_"},As={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"},Y_={getTagDetails:e=>{if(e.includes("topic_")){if(e=As.topic[e.replace("topic_","")],e){const t=ri.topics.topics[e].href;return t?{id:e,href:t,text:`${fd.headerTopics}${e}`}:null}return null}return As[e]?(e=As[e],{id:e,text:`${fd.default}${e}`}):null}};const G_=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:a="tag-click",gtmContext:s="tags"})=>{const o=ie.useIntl();if(!e||e.length<1)return null;const u=[];return e.forEach(l=>{if(!l)return;const d=Y_.getTagDetails(l);d&&u.push(d)}),u.length<1?null:c.jsx("ul",{className:K("tags text-small",t,i,{"one-line":n}),children:u.map(l=>{const d=o.formatMessage({id:l.text});return c.jsx("li",{children:l.href&&r?c.jsx("a",{href:l.href,className:"gtm-trackable","data-gtm-event-type":a,"data-gtm-event-context":s,children:d}):d},l.id)})})};const yh=25,Q_=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:i=!1,loadNextPage:a=()=>{},profile:s,gtmContext:o="member",gtmType:u="member-click",showHeader:l=!0,showPlaceholders:d=!1,className:m=""})=>{const h=ie.useIntl(),p="membersList",g=x.useContext(rt),[f,b]=x.useState(!1);return e.length===0&&!d?null:c.jsxs("div",{className:K("members-list",m),children:[l?c.jsxs("h1",{children:[h.formatMessage({id:p}),c.jsx("span",{className:"count",children:t})]}):c.jsx(c.Fragment,{}),c.jsxs("ul",{children:[r?c.jsxs("li",{children:[c.jsx(an,{member:g,gtmContext:o,gtmType:u,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:n||""},{scope:ut.Platform,area:"all"}]}}),c.jsx(Dn,{href:"/profiles/me",className:"text-small",onClick:v=>{v==null||v.preventDefault(),v==null||v.stopPropagation(),b(!0)},children:h.formatMessage({id:`${p}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((v,y)=>g&&v.id===g.id?c.jsx(c.Fragment,{}):c.jsxs("li",{children:[c.jsx(an,{member:v,gtmContext:o,gtmType:u,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:n||""},{scope:ut.Platform,area:"all"}]}}),v.isAdmin&&c.jsx(Yt,{children:h.formatMessage({id:`${p}_admin`})})]},y)),d&&e.length===0&&t>0?[...new Array(Math.min(t,yh))].map((v,y)=>c.jsx("li",{children:c.jsx(ga,{layout:"member"})},y)):c.jsx(c.Fragment,{})]}),i&&c.jsx(ii,{hasNextPage:i,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(Fa,{form:s,showModal:f,content:{title:h.formatMessage({id:`${p}_modal_title`})},functions:{onClose:()=>{b(!1)}}}):c.jsx(c.Fragment,{})]})},xh=Q_,J_=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const i=ie.useIntl();return t?c.jsx("small",{children:Rt(i.formatMessage,`${e}explainer`,n,"action",{a:a=>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:a})})}):c.jsx(c.Fragment,{})},X_=({intlPath:e,type:t,...n})=>{const r=ie.useIntl();return c.jsx(sa,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:Rt(r.formatMessage,`${e}label_action`,t,"action")},...n})},md=5,hd=2,ek=e=>{var r;let t=0;const n=[];return(r=e==null?void 0:e["poll-options"])==null||r.forEach((i,a)=>{i!==""&&(t++,n.push({position:t,description:{en:i}}))}),{title:{en:e.title},options:n,settings:{allow_multiple_votes:e["multiple-answers"]||!1}}};let Gn=null;const Qe="discussion_form_",oi=({id:e,parentId:t,content:n={type:Te.Response,slugs:{}},userHasPermissions:r=!0,meta:i,placeholder:a,maxLength:s=0,buttons:o,forceShow:u={cancel:!1,error:!1},functions:l,data:d={},gtmContext:m="DiscussionForm"})=>{var G,se,be;const h=ie.useIntl(),p=x.useContext(rt),[g,f]=x.useState(n.type),[b,v]=x.useState(""),{isLoading:y=!1,isInWrapper:C=!1,isInOverlay:k=!1,isAutoFocused:D=!1,isEditing:_=!1,hasTitleField:B=!1,canBePrepopulated:P=!1,isPrepopulated:N=!1,showTitle:z=!1,showGuidelines:O=!0,showDivider:A=!1,showSuccessMessage:F=!0,showPostType:S=!1,postCategories:I=[]}=i||{},{onChange:H=()=>{},create:V=()=>{},createPoll:ae=()=>Promise,handleSaveEdit:ne=()=>{},handleCancel:E=()=>{},callback:Y=()=>{},onMention:q=()=>{},listMembers:T=()=>Promise.resolve([]),clickMentionFallback:j=()=>{},getLinkPreview:R=()=>Promise.resolve({}),props:M={create:{projectNames:["questions-answers"]}}}=l,[U,X]=x.useState({body:_&&_.text||N&&N.text||"",data:d!=null&&d.link?{link:d==null?void 0:d.link}:{}}),[W,te]=x.useState(u.error||!1),de={status:!1,title:B&&B.text||"",polls:0},[J,ve]=x.useState(de);x.useEffect(()=>{P&&!_&&N&&N!==U.body&&X(oe=>({...oe,body:N.text||""}))},[N]),x.useEffect(()=>{f(n.type)},[n.type]);const me=Wr((oe,ce)=>{X(Fe=>({...Fe,body:oe,data:{link:ce}})),H({body:oe});let pe;!p||!p.id?pe=Rt(h.formatMessage,`${Qe}error_loggedOut`,g,"action"):r?s>0&&oe.length>=s&&(pe=`${Qe}error_tooLong`):pe=Rt(h.formatMessage,`${Qe}error_noPermission`,g,"action"),pe?te(pe):W&&te(!1)},50);let ye=`${g}-form`;if(g===Te.Response||g===Te.Reply){const oe=((G=n.slugs)==null?void 0:G.reply)||((se=n.slugs)==null?void 0:se.answer)||((be=n.slugs)==null?void 0:be.question)||"";oe&&(ye=`${ye}-${oe.slice(-15)}`)}e&&(ye=`${e}-${ye}`);const _e=async oe=>{if(!p||!p.id||!r||Ke)throw new Error("You do not have permission to post.");Gn&&clearTimeout(Gn),ve(pe=>({...pe,status:"submitting"}));const ce=window.location.pathname;try{let pe;switch(g){case Te.Post:pe=await V({title:oe.title,content:oe.body,categories:oe.postType,data:oe.data});break;case Te.Poll:pe=await ae(ek(oe));break;case Te.Question:pe=await V({title:oe.body,authorId:p&&p.id,data:oe.data,...M==null?void 0:M.create});break;case Te.Response:pe=await V({questionSlug:n.slugs.question},{body:oe.body,authorId:p&&p.id,contentPath:ce,data:oe.data});break;case Te.Reply:pe=await V({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:oe.body,authorId:p&&p.id,contentPath:ce,data:oe.data});break;default:break}return await np(1e3),Y&&await Y(pe),Gn=setTimeout(()=>{X({body:"",data:{}}),f(Te.Post),ve(qe=>({...qe,status:"submitted"})),v(Rt(h.formatMessage,`${Qe}success`,g,"action"));const Fe=new Event(it.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(Fe),De()},850),pe}catch(pe){const Fe=pe;let qe=`${Qe}error`;Fe!=null&&Fe.message.includes("entry already exists")&&(qe=Rt(h.formatMessage,`${Qe}error_alreadyExists`,g,"action")),Fe!=null&&Fe.message.includes("429")?qe=Rt(h.formatMessage,`${Qe}error_tooMany`,g,"action"):Fe!=null&&Fe.message.includes("400")&&(qe=`${Qe}error`),te(qe),De()}},De=()=>{Gn=setTimeout(()=>{te(!1),ve(de),v("")},5e3)},ze=Wr(async oe=>{const ce={...U,...oe};if(_){ve(pe=>({...pe,status:"submitting"})),ne(ce);return}try{if(!await _e(ce))throw Error("No response from handleSubmit")}catch{Gn&&clearTimeout(Gn)}},100);if(y)return c.jsx(Nt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const We=!U.body||!Kr(U.body),He=!J.title||!Kr(J.title);let Ke=!1;g!==Te.Poll&&(Ke=We),B&&(Ke=Ke&&He);const Be=J.status==="submitting",Me=[];g===Te.Poll?Me.push({id:"poll-options",label:h.formatMessage({id:`${Qe}option_label`}),type:"multiple-inputs",element:"textarea",placeholder:h.formatMessage({id:`${Qe}option_placeholder`}),limit:100,multipleInputs:{showCount:!0,defaultInputs:hd,maxInputs:md,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:h.formatMessage({id:`${Qe}option_cta`})}},styling:{autosizeToFit:!0},functions:{onChange:oe=>{var pe;let ce=0;oe&&Array.isArray(oe)&&(ce=((pe=oe==null?void 0:oe.filter(Fe=>Fe!==""))==null?void 0:pe.length)||0),J.polls!==ce&&ve(Fe=>({...Fe,polls:ce})),H({polls:oe})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:h.formatMessage({id:`${Qe}multiplePollAnswers`}),className:"text-medium"}):Me.push({component:X_,props:{formID:ye,intlPath:Qe,showLabel:B!==!1,type:g}},{component:pu,props:{id:`${ye}-input`,value:J.status==="submitting"&&!W?"":U.body,placeholder:a||Rt(h.formatMessage,`${Qe}placeholder`,g,"action"),maxLength:s,meta:{isInOverlay:k},functions:{onChange:me,onChangeData:oe=>{X(ce=>({...ce,data:oe}))},onMention:q,listMembers:T,clickMentionFallback:j,getLinkPreview:R},data:d,autoFocus:_!==!1||D&&!B,"aria-invalid":!!W,"aria-errormessage":"error-message"}},{component:J_,props:{intlPath:Qe,showGuidelines:O,type:g,gtmContext:m}}),A&&Me.push({component:zt}),B&&Me.unshift({id:"title",type:"textarea",value:B.text,limit:250,label:h.formatMessage({id:`${Qe}${g===Te.Poll?"question":"titleField"}_label`}),styling:{autosizeToFit:!0},placeholder:h.formatMessage({id:`${Qe}${g===Te.Poll?"question":"titleField"}_placeholder`}),functions:{onChange:oe=>{ve(ce=>({...ce,title:oe})),H({title:oe})}},validation:g===Te.Poll?[{condition:"required"}]:[]}),S&&Me.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:h.formatMessage({id:`${Qe}postType_label`}),options:I.map(oe=>({id:oe.slug,label:oe.name})),validation:[{condition:"required"}],functions:{onChange:oe=>{H({postType:oe}),oe.includes(Te.Poll)?f(Te.Poll):g!==Te.Post&&f(Te.Post)}}});let Ce=!p||!p.id||!r||Be;if(g===Te.Poll){const oe=J.polls;Ce=Ce||He||oe<hd||oe>md}else Ce=Ce||Ke,_&&(B?Ce=Ce||U.body===_.text&&J.title===B.text:Ce=Ce||U.body===_.text);return c.jsxs(c.Fragment,{children:[c.jsxs(Xt,{id:ye,className:K("discussion-card discussion-form",{"no-styling":C&&_}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:_&&!Be||u.cancel},functions:{onSuccess:async oe=>{await ze(oe)},onCancel:E},fields:Me,intlPath:Qe,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"data-gtm-event-type":`${_?"save":"submit"}-${g}-click`,"data-testid":"save-button",disabled:Ce,text:{default:!_&&(o!=null&&o.submit)?o==null?void 0:o.submit:h.formatMessage({id:`${Qe}${_?"save":"post"}`}),submitting:h.formatMessage({id:`${Qe}${_?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"data-gtm-event-type":`cancel-${g}-click`,disabled:!u.cancel&&(!p||!p.id||!U.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:h.formatMessage({id:`${Qe}cancel`})},gtm:{context:m,event:`${g}-form`},"data-testid":`discussion-${g}-form`,children:[z&&!_&&g===Te.Question&&c.jsx("h2",{children:Rt(h.formatMessage,`${Qe}title`,g,"action")}),c.jsx(an,{member:p?{...p,link:!1}:"community",gtmContext:m,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:t||""},{scope:ut.Platform,area:"all"}]}})]}),J.status==="submitted"&&F&&c.jsx(ur,{className:"success","data-testid":"success",children:Rt(h.formatMessage,`${Qe}success`,g,"action")}),W&&c.jsx(ur,{id:"error-message",className:"error","data-testid":"error",children:u.error?u.error:typeof W=="string"?W.includes(" ")?W:h.formatMessage({id:W},{action:h.formatMessage({id:`discussion_action_${g}`}),maxLength:s}):W}),b&&c.jsx(Oe,{"aria-live":"polite",showOnFocus:!1,children:b})]})},tk=Object.freeze(Object.defineProperty({__proto__:null,default:oi},Symbol.toStringTag,{value:"Module"}));const nk={showForm:!1},ka=x.createContext(nk),wh=({children:e})=>{const[t,n]=x.useState({showForm:!1});return c.jsx(ka.Provider,{value:{...t,updateConversation:n},children:e})};function rk({author:e,originalAuthorId:t,createdAt:n,contentData:r,content:i,gtmContext:a,badges:s}){var m;const o="discussion_",u=ie.useIntl(),l=(m=i==null?void 0:i.componentProps)==null?void 0:m.member.additionalContent,d=l?l.customMessage:void 0;return c.jsxs("div",{className:"author-section",children:[c.jsx(an,{member:e,additionalContent:{createdAt:n,didEdit:r.didEdit,customMessage:d},className:K({highlighted:typeof e!="string"&&e.id===t}),styling:{additionalContentNewLine:!!d},gtmContext:a,gtmType:"profile-click",badges:s}),i.pinned&&c.jsx(Yt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Oe,{children:u.formatMessage({id:`${o}pinned_post`})})})]})}const Ts=({children:e,class:t,...n})=>{const r={...n,class:K("subtle",t)};return c.jsx("blockquote",{...r,children:e})};function ik({content:e}){var t;return!e||!((t=e.categories)!=null&&t.length)?c.jsx(c.Fragment,{}):c.jsx("ul",{className:"categories-list",children:e.categories.map(n=>!n.slug||!n.name?c.jsx(c.Fragment,{}):c.jsx(Yt,{size:"small",element:"li",children:n.name},n.slug))})}var ca=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(ca||{});const ak=(e,t,n)=>n===void 0?0:e.some(i=>i.hasUserVoted)?t?e.findIndex(i=>!i.hasUserVoted):e.findIndex(i=>i.hasUserVoted):0,sk=(e,t,n,r=0)=>{if(!e)return{nextElement:null,nextIndex:0};let i=n==="next"?e.nextElementSibling:e.previousElementSibling,a=r+(n==="next"?1:-1);for(;i;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}const s=e.parentElement;if(s)for(i=n==="next"?s.firstElementChild:s.lastElementChild,a=n==="next"?0:s.childElementCount-1;i&&i!==e;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}return{nextElement:null,nextIndex:0}};const ok=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:i=!1,showResults:a=!1,hasVotedOnPoll:s=!1,isTabbable:o=!1,functions:u})=>{var b;const[l,d]=x.useState(t.hasUserVoted);let m=0,h={};const p=(i||!s)&&!t.hasUserVoted;a&&(m=Math.round(t.numVotes/r*100)||0,h={"--vote-perc":`${m}%`});const g=v=>{v.stopPropagation(),p&&(u==null||u.createVote(t),d(!0))},f={htmlFor:t.id,className:K({"can-vote":p}),tabIndex:o&&p?0:-1,"data-testid":"poll-option-label","data-gtm-event-type":"poll-option-click","data-gtm-event-context":"PollOption","aria-selected":t.hasUserVoted,onClick:g,onKeyDown:v=>{var y;if(v.code!=="Tab")switch(v.code){case"Enter":case"Space":v.preventDefault(),v.stopPropagation(),g(v),d(!0);break;case"ArrowUp":case"ArrowDown":v.stopPropagation(),v.preventDefault();const C=v.code==="ArrowUp"?"prev":"next",{nextElement:k,nextIndex:D}=sk(v.currentTarget.parentElement,"selected",C,n);k&&((y=k.querySelector("label"))==null||y.focus(),u==null||u.setTabbableOption(D));break}}};return c.jsxs("li",{"data-testid":"poll-option",style:h,className:K("poll-option text-small",{selected:t.hasUserVoted}),children:[c.jsx("label",{...f,children:c.jsx("span",{children:t.label})}),a&&c.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&c.jsx(un,{className:"author-profile-picture",name:e.name,src:(b=e==null?void 0:e.image)==null?void 0:b.thumbnail}),c.jsxs("p",{className:"vote-perc text-medium","data-testid":"vote-perc",children:[m,"%"]})]}),c.jsx("input",{type:i?"radio":"checkbox",id:t.id,name:t.id,checked:l,tabIndex:-1})]})};const Ch=({title:e,options:t,settings:n,functions:r})=>{const i="poll_",a=ie.useIntl(),s=x.useContext(rt),{showRemoveVote:o=!1,allowMultipleVotes:u=!1,resultsVisibility:l=ca.AfterVoting}=n||{},[d,m]=x.useState(ak(t,u,s==null?void 0:s.id)),h=t.reduce((v,y)=>v+y.numVotes,0),p=t.filter(v=>v.hasUserVoted).length,g=t.filter(v=>v.hasUserVoted),f=x.useCallback(async v=>{await r.createVote({reactionId:v.id})},[]),b=x.useCallback(async()=>{t.forEach(async v=>{v.hasUserVoted&&v.userVote&&r.removeVote({reactionId:v.userVote.id})})},[t]);return c.jsxs("div",{className:"poll-wrapper",children:[c.jsx("p",{className:"poll-title",children:e}),c.jsxs("aside",{className:"poll-info",children:[c.jsx("p",{className:"poll-instructions","data-testid":"poll-instructions",children:c.jsx("small",{children:a.formatMessage({id:`${i}instructions`},{allowMultipleVotes:u})})}),c.jsx("p",{className:"poll-num-votes",children:c.jsx("small",{"data-testid":"poll-total-votes",children:a.formatMessage({id:`${i}num_votes`},{number:h})})}),o&&c.jsx("p",{className:"poll-remove-vote",children:c.jsx(we,{variant:"tertiary",onClick:b,"data-testid":"remove-votes-button",disabled:p===0,children:c.jsx("small",{children:a.formatMessage({id:`${i}remove_vote_button`},{number:p})})})})]}),t&&c.jsx("form",{children:c.jsx("fieldset",{children:c.jsx("ul",{className:"poll-options",children:t==null?void 0:t.map((v,y)=>c.jsx(ok,{isTabbable:d===y,user:s,option:v,optionIndex:y,totalPollVotes:h,showResults:l==ca.Always||!!p,allowMultipleVotes:u,hasVotedOnPoll:!!p,functions:{createVote:f,setTabbableOption:m}},v.id))})})}),c.jsxs(Oe,{"aria-live":"polite",children:[a.formatMessage({id:`${i}aria_votes`},{number:p}),!!p&&c.jsx("ul",{children:g.map(v=>c.jsx("li",{children:v.label}))})]})]})};function uk({content:e,contentData:t,functions:n}){return c.jsx(Ch,{title:t.title,options:(e==null?void 0:e.pollOptions)||[],settings:(e==null?void 0:e.pollSettings)||{},functions:{createVote:n.createVote,removeVote:n.removeVote}})}function lk({links:e={},contentData:t,postCutOff:n,content:r}){var i;return c.jsxs(c.Fragment,{children:[e.post?c.jsxs("a",{href:e.post,children:[(t==null?void 0:t.title)&&c.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),t.postBody.length>n?c.jsx($d,{text:t.postBody,markdownOptions:{overrides:{a:Rs,blockquote:{component:Ts}}}}):c.jsx(On,{options:{overrides:{a:Rs,blockquote:{component:Ts}}},children:t.postBody})]}):c.jsxs(c.Fragment,{children:[(t==null?void 0:t.title)&&c.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),c.jsx(On,{options:{wrapper:r.type===Te.Question?"h1":x.Fragment,forceWrapper:r.type===Te.Question,forceInline:r.type===Te.Question,forceBlock:r.type!==Te.Question,overrides:{blockquote:{component:Ts}}},children:t.postBody})]}),(i=t.data)!=null&&i.link?c.jsx($o,{data:t.data.link}):c.jsx(c.Fragment,{})]})}const It="discussion_",ck=195;let Bi=null;const ui=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:i=!1,originalAuthorId:a,forceHide:s,functions:o,links:u={},className:l,gtmContext:d="DiscussionAnswer",children:m,isTruncated:h=!1,setFocus:p=!1,isCommunity:g=!1,badges:f,basePath:b,parentId:v,locale:y="en"})=>{var Me,Ce,G,se,be,oe;const C=ie.useIntl(),k=x.useContext(ka),D=x.useContext(rt),{createContent:_=async()=>{},deleteContent:B=async()=>{},updateContent:P=async()=>{}}=o.content||{},{createLike:N=()=>{},deleteLike:z=()=>{},listLikes:O=async()=>({})}=o.likes||{},{openComments:A=()=>{}}=o.comments||{},{listMembers:F=()=>Promise.resolve([]),clickMentionFallback:S=()=>{}}=o.form||{},{createVote:I=()=>{},removeVote:H=()=>{},removePoll:V=()=>{}}=o.polls||{},{author:ae,createdAt:ne,id:E,likes:Y=0,userLiked:q,comments:T=0,data:j}=t,R=yv(t.title,y),M=D&&D.id&&typeof ae!="string"&&ae.id&&ae.id===D.id||!1,U=M&&(!t.createdAt||ep(t.createdAt,10,"seconds")),X=x.useRef(null),[W,te]=x.useState({title:t.body!==R&&R||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[de,J]=x.useState(!1),[ve,me]=x.useState(U?"highlighted":"default"),[ye,_e]=x.useState("");x.useEffect(()=>{const ce=X.current;if(!(!ce||ve==="default"))return document.addEventListener(it.DISCUSSION_FORM_SUBMITTED,De),ce.addEventListener("transitionend",ze),()=>{document.removeEventListener(it.DISCUSSION_FORM_SUBMITTED,De),ce.removeEventListener("transitionend",ze)}},[]),x.useEffect(()=>{te(ce=>({...ce,title:t&&R||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),x.useEffect(()=>{(async()=>{const pe=await Io(W.body,h,j==null?void 0:j.mentions,F);te(Fe=>({...Fe,postBody:pe}))})()},[W.body,j==null?void 0:j.mentions]);const De=()=>{setTimeout(()=>{me("fading")},1e3)},ze=({propertyName:ce})=>{ce==="background-color"&&me(pe=>(pe==="default"&&(document.removeEventListener(it.DISCUSSION_FORM_SUBMITTED,De),X.current&&X.current.removeEventListener("transitionend",ze)),pe==="fading"?"default":pe))};if(i||!t||t.type===Te.Answer&&(!t.slugs||!t.slugs.question)||W.postBody===""&&t.title==="")return c.jsx(Nt,{className:"discussion-card"});const We=async({title:ce,body:pe,data:Fe})=>{ce||(ce=""),pe||(pe=""),_e("");try{if(!Wi(ce,W.title)||!Wi(pe,W.body)){const qe=t.type===Te.Question?{title:pe}:{title:ce,body:pe,data:Fe};await P(Us(t.slugs),qe)}te(qe=>({...qe,title:ce||"",body:pe||"",data:{...qe.data,...Fe},isEditing:!1,didEdit:!0}))}catch{_e(`${It}form_error`)}},He=()=>{if(k&&k.updateConversation){const ce={showForm:!0},pe=t.author;pe&&pe.id&&(g&&(ce.prepopulateForm=`@{{${pe.id}}}`),ce.mentionData={id:pe.id,name:pe.name}),k.updateConversation(ce)}setTimeout(()=>{var At,pt,tt;const pe=`reply-form-${(t.type===Te.Answer?t.slug:((At=t.slugs)==null?void 0:At.reply)||((pt=t.slugs)==null?void 0:pt.answer)||((tt=t.slugs)==null?void 0:tt.question)||"").toLowerCase().slice(-15)}`,Fe=document.getElementById(pe),qe=document.getElementById(`${pe}-input`);qe&&qe.focus(),Fe&&Fe.scrollIntoView({behavior:"smooth"})},0)},Ke=async()=>{J(!1);try{t.type===Te.Poll?(await V(),window.location.href=`${b}/${v}`):await B(Us(t.slugs))}catch{_e("delete-error")}},Be=[];return n&&M&&(t.type!==Te.Poll&&Be.push({text:C.formatMessage({id:`${It}moreMenu_edit`}),onClick:()=>te(ce=>({...ce,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),Be.push({text:C.formatMessage({id:`${It}moreMenu_delete`}),onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),J(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...hf(`delete-${t.slug}-modal`,de)})),r&&o.pins&&Be.push({text:C.formatMessage({id:`${It}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`}),p&&((Me=X==null?void 0:X.current)==null||Me.focus(),(Ce=X==null?void 0:X.current)==null||Ce.scrollIntoView({behavior:"smooth"})),x.createElement(e,{className:K("discussion-post",l,{[ve]:!l||!l.includes("highlighted-text-box"),"has-link":u.post&&!W.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:X,tabIndex:p?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:ce=>{if(!u.post||W.isEditing||t.type===Te.Poll&&bv(ce,["poll-options","poll-info"],"discussion-post"))return;ce.preventDefault(),ce.stopPropagation(),Bi&&clearTimeout(Bi),Bi=setTimeout(()=>{window.location.href=u.post},150);const pe=new CustomEvent(it.DISCUSSION_POST_CLICKED,{detail:{link:u.post,timeout:Bi}});document.dispatchEvent(pe)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:E||t.slug,className:K("discussion-card text-medium",t.type,{editing:W.isEditing,"has-link":u.post&&!W.isEditing}),children:[!W.isEditing&&c.jsx(rk,{author:ae,originalAuthorId:a,createdAt:ne,contentData:{didEdit:W.didEdit},content:t,gtmContext:d,badges:f}),W.isEditing?c.jsx(oi,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:i,isInWrapper:!0,hasTitleField:W.title!==""?{text:W.title}:!1,isEditing:{text:W.body,categories:[]},canBePrepopulated:g,isPrepopulated:!1},maxLength:t.type===Te.Question?250:5e4,forceShow:{error:ye!==""&&ye!=="delete-error"?C.formatMessage({id:ye},{action:C.formatMessage({id:`${It}action_${t.type}`})}):!1},functions:{create:_,handleSaveEdit:We,handleCancel:()=>{_e(""),te(ce=>({...ce,isEditing:!1}))},listMembers:F,clickMentionFallback:S},gtmContext:`${d}Form`,data:j}):c.jsxs(c.Fragment,{children:[t.type===Te.Poll?c.jsx(uk,{content:t,contentData:W,functions:{createVote:I,removeVote:H}}):c.jsx(lk,{links:u,contentData:W,postCutOff:ck,content:t}),c.jsx(ik,{content:t})]}),!W.isEditing&&!(s!=null&&s.actionBar)&&c.jsx(Tf,{className:t.type,gtmContext:d,contentType:t.type,likes:s!=null&&s.likes?!1:{count:Y||0,userLiked:q||!1,canLike:n??!0,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:N,deleteLike:z,listLikes:O},basePath:b,parentId:v},comments:!(s!=null&&s.comments)&&([Te.Question,Te.Post].includes(t.type)||u.comments)?{count:T||0,functions:{onClick:()=>{u!=null&&u.comments&&(window.location.href=u.comments),typeof A=="function"&&A()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{canReply:n??!0,functions:{onClick:He}}:!1,shareLink:{url:`${window.location.origin}${(G=t.slugs)==null?void 0:G.question}/${(se=t.slugs)==null?void 0:se.answer}${(be=t.slugs)!=null&&be.reply?`#${(oe=t.slugs)==null?void 0:oe.reply}`:""}`},moreMenu:{options:Be,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),m,c.jsx(ln,{id:`delete-${t.slug}-modal`,isOpen:de,functions:{onOpen:()=>{},onClose:()=>J(!1)},forceShow:{error:ye==="delete-error"?C.formatMessage({id:"${intlPath}delete_error"},{action:C.formatMessage({id:`${It}action_${t.type}`})}):!1},title:C.formatMessage({id:`${It}delete_title`},{action:C.formatMessage({id:`${It}action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>J(!1),children:C.formatMessage({id:`${It}delete_cancel`})},{variant:"primary",className:"destructive",onClick:Ke,children:C.formatMessage({id:`${It}delete_delete`})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:c.jsx(ie.FormattedMessage,{id:"discussion_delete_text",values:{p:ce=>c.jsx("p",{children:ce}),action:C.formatMessage({id:`${It}action_${t.type}`})}})})]})})};const dk=x.lazy(()=>Promise.resolve().then(()=>_k)),fk=65,Dh=({forceShow:e,form:t,className:n})=>{const r=ie.useIntl(),i="discussionFormCard_",a="DiscardDraftModal",o=x.useContext(rt)||"community",u=va(o);u.name||(u.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const l=wn(!0,!1),d=l?l<768:0,{modal:m=!1}=e||{},[h,p]=x.useState({form:m||Od("showPost")==="true"||!1,warning:!1}),[g,f]=x.useState({showCachedText:!1});x.useEffect(()=>{if(!g.showCachedText)return;(async()=>{const C=await Io(g.title||g.body||"",fk,g.mentions);f(k=>({...k,prettifiedText:C}))})()},[g.showCachedText,g.title,g.body]);const b=y=>{if(!g.showCachedText||typeof h.warning=="string")return;let C;if("detail"in y&&y.detail.link)y.detail.timeout&&clearTimeout(y.detail.timeout),C=y.detail.link;else{const k=y;k.preventDefault(),k.stopPropagation();const _=k.target.closest("a");C=_&&_.getAttribute("href")}p(k=>({...k,warning:C||!1}))};x.useEffect(()=>{if(!g.showCachedText){document.removeEventListener(it.DISCUSSION_POST_CLICKED,b),document.removeEventListener(it.MEMBER_CLICKED,b),document.removeEventListener("click",b);return}return document.addEventListener(it.DISCUSSION_POST_CLICKED,b),document.addEventListener(it.MEMBER_CLICKED,b),document.addEventListener("click",b),()=>{document.removeEventListener(it.DISCUSSION_POST_CLICKED,b),document.removeEventListener(it.MEMBER_CLICKED,b),document.removeEventListener("click",b)}},[g.showCachedText]),x.useEffect(()=>{const y=C=>{if(!(!g.showCachedText||h.warning!==!1))return C.preventDefault(),C.returnValue=""};return window.addEventListener("beforeunload",y,{capture:!0}),()=>{window.removeEventListener("beforeunload",y,{capture:!0})}},[g.showCachedText,h.warning]);let v=r.formatMessage({id:`${i}placeholder${d?"":"_long"}`});return g.showCachedText&&(g.title||g.body)&&(v=g.prettifiedText||v),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:K("discussion-form-card",n),onClick:y=>{y.preventDefault(),y.stopPropagation(),p(C=>({...C,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(un,{name:u.name,src:u.image,alt:""}),c.jsx(On,{className:K("input",{placeholder:!g.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:St,blockquote:St,br:St,em:St,li:St,ol:St,p:St,s:St,span:St,strong:St,ul:St}},children:v})]}),c.jsxs(br,{children:[c.jsx(dk,{showModal:h.form,functions:{cacheText:f,onClose:()=>{p(y=>({...y,form:!1}))}},form:t,cachedText:g,className:"in-portal"}),c.jsx(ln,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:h.warning!==!1,functions:{onClose:()=>{p(y=>({...y,warning:!1}))}},title:r.formatMessage({id:`${i}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${i}overlay_cta_discard`}),onClick:y=>{y.preventDefault(),y.stopPropagation(),typeof h.warning=="string"&&(window.location.href=h.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":a},{variant:"primary",children:r.formatMessage({id:`${i}overlay_cta_continue`}),onClick:()=>{p({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":a}],children:c.jsx("p",{children:r.formatMessage({id:`${i}overlay_text`})})})]})]})},mk=x.lazy(()=>Promise.resolve().then(()=>tk)),bu=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:i,required:a,join:s,leave:o,notMemberStateText:u},locale:l=Bo})=>{if(a&&!i)return c.jsx(Qt,{text:u,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(To,{isShort:!0,functions:{join:s,leave:o}})}});const{content:d,functions:m,meta:h,...p}=t,g={content:{type:(d==null?void 0:d.type)||"reply",slugs:(d==null?void 0:d.slugs)||{}},functions:{...m,create:(m==null?void 0:m.create)||(()=>{})},parentId:n,meta:{...h,isEditing:(h==null?void 0:h.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...p,id:`add-post-${p.id||""}`};return e?c.jsx(Dh,{form:g}):c.jsx(mk,{...g})},yu=({form:e})=>{const t=x.useContext(rt),n=ie.useIntl(),[r,i]=x.useState(!1),a=()=>{lp(t)||i(!0)};x.useEffect(()=>(document.addEventListener(it.DISCUSSION_POST_ADDED,a),()=>{document.removeEventListener(it.DISCUSSION_POST_ADDED,a)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(Fa,{form:e,showModal:r,functions:{onClose:()=>{i(!1)}},content:s})};const Bs="discussion_responses_",Eh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ie.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${Bs}title`},{action:r.formatMessage({id:`${Bs}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:Rt(r.formatMessage,`${Bs}empty`,e,e)})]})};const _h=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:i})=>{const a=ie.useIntl(),s=x.useContext(ka),o=Oi(i,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const u=r.data||{};u.mentions||(u.mentions={});const l=s.mentionData.id||"1";u.mentions[l]={created_at:"",updated_at:"",id:l,data:s.mentionData},r.data=u,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:K("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(ii,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:a.formatMessage({id:"discussion_thread_loadMore"}),error:a.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx(oi,{...r})]})};function hk(e){var n,r;let t=!1;return(r=(n=e.latest_reactions)==null?void 0:n["poll-option"])==null||r.forEach(i=>{var a,s;(s=(a=i.own_children)==null?void 0:a["poll-vote"])!=null&&s.length&&(t=!0)}),t}function pk({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=Re.useMutation({mutationFn:e,onMutate:({reactionId:o})=>t(u=>(gf({activity:u,reactionId:o,user:a}),u)),onError:n,onSuccess:(o,{reactionId:u},l)=>{l&&vf({activity:l,reactionId:u,correctReactionId:o.body.id,user:a}),r.setQueryData(i,l)}});return s}function gk({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Re.useMutation({mutationFn:e,onMutate:({content:i,title:a})=>t(s=>(s&&(i!=null&&(s.content=i),a!=null&&(s.title=a)),s)),onError:n});return r}function vk({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Re.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Qi({activity:o}),o)),onError:n,onSuccess:(s,o,u)=>{u&&Qi({activity:u,reaction:s}),r.setQueryData(i,u)}});return a}function bk({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Re.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ji({activity:o}),o)),onError:n,onSuccess:(s,o,u)=>{u&&Ji({activity:u,reaction:s}),r.setQueryData(i,u)}});return a}function yk({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,isFetching:a}=Re.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:i,isFetching:a}}function xk({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:({reactionId:a})=>t(s=>(bf({activity:s,reactionId:a}),s)),onError:n});return i}function wk({queryFns:{read:e,edit:t,like:n,unlike:r,pin:i,unpin:a,createVote:s,removeVote:o},queryKey:u}){const l=Re.useQueryClient(),d=pa(),m={queryClient:l,queryKey:u},h={mutationHandlers:{error:So(m),mutate:jo(m)},user:d,...m},p=gk({...h,mutationFn:t}),g=vk({...h,mutationFn:n}),f=Ck({...h,mutationFn:r}),b=bk({...h,mutationFn:i}),v=Dk({...h,mutationFn:a}),y=pk({...h,mutationFn:s}),C=xk({...h,mutationFn:o}),{activity:k,...D}=yk({queryKey:u,queryFn:e});return{activity:k,mutations:{edit:p,like:g,unlike:f,pin:b,unpin:v,createVote:y,removeVote:C},user:d,...D}}function Ck({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:a=>t(s=>(s&&yf({activity:s,user:r}),s)),onError:n});return i}function Dk({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:a=>(console.log("unpin"),t(s=>(s&&xf({activity:s,user:r}),s))),onError:n});return i}const Ek=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:i,functions:{activities:{remove:a,...s},likes:o,reactions:u,form:l,join:d,leave:m,polls:h},profile:p,categories:g,locale:f=Bo})=>{var q,T,j,R,M,U,X,W,te,de,J,ve;const b=ie.useIntl(),v={...s,...h},{activity:y,error:C,isLoading:k,mutations:{edit:D,like:_,unlike:B,pin:P,unpin:N,createVote:z,removeVote:O}}=wk({queryFns:v,queryKey:[e,t,n]});if(k)return c.jsx(Nt,{style:{height:"400px"}});if(C||!y)return c.jsx(Qt,{variant:"error",text:b.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:A,verb:F,latest_reactions:S,mentioned_users:I,additional_data:H}=y,V=(((q=S==null?void 0:S.like)==null?void 0:q.length)||0)>0,ae=(((T=A==null?void 0:A.like)==null?void 0:T.length)||0)>0,ne=ae?A==null?void 0:A.like[0].id:"",E=V?(j=S==null?void 0:S.like)==null?void 0:j.map(me=>{var ye,_e,De;return{id:(ye=me==null?void 0:me.user)==null?void 0:ye.id,name:(De=(_e=me==null?void 0:me.user)==null?void 0:_e.data)==null?void 0:De.name}}):!1,Y=y==null?void 0:y.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(ui,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:F,title:y==null?void 0:y.title,body:y==null?void 0:y.content,categories:Ro((y==null?void 0:y.categories)||[],g||[]),createdAt:(y==null?void 0:y.time)||"",slugs:{question:`${e}/${t}`,answer:y==null?void 0:y.id},slug:n,author:xr(Y),userLiked:ae,likes:((R=y==null?void 0:y.reaction_counts)==null?void 0:R.like)||0,comments:(y==null?void 0:y.total_replies)||0,peopleWhoLiked:E,data:{mentions:I,...H||{}},pinned:((M=y==null?void 0:y.reaction_counts)==null?void 0:M.pin)&&((U=y==null?void 0:y.reaction_counts)==null?void 0:U.pin)>0||!1,pollOptions:pf(y,f),pollSettings:{showRemoveVote:(X=y==null?void 0:y.settings)==null?void 0:X.show_remove_vote,allowMultipleVotes:(W=y==null?void 0:y.settings)==null?void 0:W.allow_multiple_votes,deadlineAt:(te=y==null?void 0:y.settings)==null?void 0:te.deadline_at,hideParticipants:(de=y==null?void 0:y.settings)==null?void 0:de.hide_participants,numberOfWinners:(J=y==null?void 0:y.settings)==null?void 0:J.number_of_winners,resultsVisibility:(ve=y==null?void 0:y.settings)==null?void 0:ve.results_visibility}},originalAuthorId:Y==null?void 0:Y.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(me,{title:ye,body:_e})=>D({title:ye,content:_e})},likes:{createLike:()=>_({activityId:n}),deleteLike:()=>B({activityId:n,reactionId:ne}),listLikes:me=>o.list({activityId:n,...me})},comments:{openComments:()=>{}},pins:{createPin:()=>P({activityId:n}),deletePin:()=>{var me;return N({activityId:n,reactionId:(me=S==null?void 0:S.pin)==null?void 0:me[0].id})}},polls:{createVote:({reactionId:me})=>z({reactionId:me}),removeVote:({reactionId:me})=>O({reactionId:me}),removePoll:()=>h.removePoll({activityId:n})},form:l},styling:{showShareLinkButton:!0},userHasPermissions:r,userHasOwnerPermissions:i,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:t||""},{scope:ut.Platform,area:"all"}]},basePath:e,parentId:t},n),c.jsx(_f,{basePath:e,parentId:t,activityId:n,showReplies:F===Te.Poll?hk(y):!0,activityTotalReplies:(y==null?void 0:y.total_replies)||0,isMember:r,functions:{reactions:u,likes:o,form:l,join:d,leave:m},profile:p})]})};const kh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:i})=>{const a=ie.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:u=()=>{}}=t,{data:l,meta:d,functions:m}=n,{title:h="",body:p="",mentions:g}=r||{},f="discussion-form-modal";return c.jsx(ln,{id:f,title:a.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(h!==""||p!=="")&&u(b=>({...b,showCachedText:!0})),o()}},className:K("discussion-form-modal",i),children:c.jsx(oi,{...n,data:{...l,mentions:g||(l==null?void 0:l.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:h},isPrepopulated:{text:p||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0,showPostType:!0},buttons:{submit:a.formatMessage({id:`${s}cta`})},functions:{...m,onChange:b=>{u(v=>({...v,...b}))},onMention:({id:b,name:v}={})=>{if(!b||!v)return;const y=g||{};y[b]={created_at:"",updated_at:"",id:b,data:{name:v}},u(C=>({...C,mentions:y}))},create:async b=>{o(),m.create&&await m.create(b),u({showCachedText:!1})},createPoll:async b=>{const v=()=>{o(),u({showCachedText:!1})};if(m.createPoll)try{const y=await m.createPoll(b);return new Promise(C=>(v(),C(y)))}catch{return new Promise((C,k)=>k())}else return v(),new Promise(y=>y({}))},handleSaveEdit:async b=>{o(),m.handleSaveEdit&&await m.handleSaveEdit(b),u({showCachedText:!1})}}})})},_k=Object.freeze(Object.defineProperty({__proto__:null,default:kh},Symbol.toStringTag,{value:"Module"}));const kk=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:i,formLabel:a,ctaMessage:s,showIcon:o,onClose:u,reportError:l=()=>{},sendInvites:d})=>{const m=ie.useIntl();return i||(i=m.formatMessage({id:"inviteModal_formTitle"})),a||(a=m.formatMessage({id:"inviteModal_formLabel"})),s||(s=m.formatMessage({id:"inviteModal_cta"})),c.jsx(ln,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:o,functions:{onClose:u},className:K("invite-modal",e,{success:!!n}),children:c.jsx(fh,{title:i,label:a,messagePlaceholder:r,ctaMessage:s,onClose:u,sendInvites:d,reportError:l})})};const Fk=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:i,form:a,className:s})=>{const o=ie.useIntl(),[u,l]=x.useState(Od("showProfile")==="true"||e);x.useEffect(()=>{l(e)},[e]);const{onClose:d=()=>{}}=i;return c.jsx(ln,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:u,showDivider:!t,functions:{onClose:d},className:K("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(mh,{...a,meta:{shouldShowCancelButton:!1},functions:{...(a==null?void 0:a.functions)||{},onSuccess:async m=>{var h;try{(h=a==null?void 0:a.functions)!=null&&h.onSuccess&&await a.functions.onSuccess(m)}finally{d()}}}})]})})},Fa=Fk,Ak=Object.freeze(Object.defineProperty({__proto__:null,default:Fa},Symbol.toStringTag,{value:"Module"}));const Tk=({members:e})=>{const[t,n]=x.useState(!1),r=i=>{const{fullName:a,jobTitle:s,organisation:o,photo:u}=i||{};return c.jsxs(c.Fragment,{children:[c.jsx(un,{name:a,src:u}),c.jsx("p",{children:a}),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(i=>c.jsx("li",{children:c.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),n(i)},children:r(i)})},i.fullName))}),c.jsx(ln,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(On,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const Bk=({email:e,settings:t={}})=>{const{formatMessage:n}=ie.useIntl(),r=x.useContext(rt),{myProfile:i,isConnected:a,cannotConnect:s}=t,[o,u]=x.useState(!1),[l,d]=x.useState(!1);return r?e&&i?c.jsx(we,{icon:{icon:"info-inside-circle",position:"right"},size:"small",variant:"secondary",styling:{muted:!0},tooltip:n({id:"member_show_email_tooltip_mine"}),forceTooltip:!0,className:"show-email fake-button",children:e}):s?c.jsx(we,{icon:"email",size:"small",variant:"secondary",styling:{muted:!0},tooltip:n({id:"member_show_email_tooltip_private"}),forceTooltip:!0,className:"show-email fake-button",children:n({id:"member_show_email_private"})}):a?e&&a?c.jsx(c.Fragment,{children:o?c.jsx(we,{icon:{icon:"copy",position:"right"},size:"small",variant:"secondary",styling:{muted:!0},className:"show-email copy-button",tooltip:n({id:`member_show_email_tooltip${l?"_copied":""}`}),forceTooltip:!0,"data-gtm-event-context":"connections-email-address-button","data-gtm-event-type":"copy-email-click",onClick:()=>{navigator.clipboard.writeText(e).then(()=>{d(!0),setTimeout(()=>{d(!1)},2e3)})},children:e}):c.jsx(we,{icon:"email",size:"small","data-gtm-event-context":"connections-email-address-button","data-gtm-event-type":"show-email-click",onClick:()=>u(!0),children:n({id:"member_show_email_show"})})}):c.jsx(c.Fragment,{}):c.jsx(we,{icon:"email",size:"small",variant:"secondary",styling:{muted:!0},className:"show-email fake-button",children:n({id:"member_show_email_hide"})}):c.jsx(c.Fragment,{})};const Sk=({author:e,authorCite:t,content:n,member:r,className:i=""})=>c.jsxs("blockquote",{className:K("testimonial-block",i),children:[c.jsx(Zt,{className:"testimonial",children:n}),r?c.jsx(an,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:K("author",{"text-small":!i.includes("new")}),children:e}),t&&c.jsx("p",{className:K("author-cite",{"text-small":!i.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),jk=x.memo(Sk);const Pk=({items:e=[],selector:t="",className:n=""})=>{const r=ie.useIntl(),[i,a]=x.useState(e);return x.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((l,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const u=Array.from(document.querySelectorAll(s)).filter(l=>l.id).map(l=>({id:l.id,text:l.textContent||""}));a(u)},[]),i&&i.length>0&&c.jsxs(_t,{variant:"subtle",className:K("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:i.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Aa=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:i=""})=>{const a=ie.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const m=d/60,h=Math.floor(m),p=(m-h)*60,g=Math.round(p),f=`${a.formatMessage({id:`${s}hours`},{time:h})}${h>0&&g>0?", ":""}${a.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${h>0?`${a.formatMessage({id:`${s}hours_short`},{time:h})} `:""}${g>0?a.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:u,ariaText:l}=o(e);if(t){const{text:d,ariaText:m}=o(e+t);u=a.formatMessage({id:`${s}range`},{early:u,late:d}),l=a.formatMessage({id:`${s}range_aria`},{early:l,late:m})}return n&&(l=`${n} ${l}`,u=`${n} ${u}`),r&&(l=`${l} ${r}`,u=`${u} ${r}`),c.jsx("span",{className:K("time-to-complete",i),"aria-label":l,children:u})};const Ok=({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(Cn,{...n,className:K("banner",e),image:{...t,aspect:"banner"}})):null;const Mk=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Nk=({className:e="",content:t,image:n,variant:r,spacing:i="normal",styling:a,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:u})=>{var g,f;const l={imageFullWidth:!0,...a};r||(r=l.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],m={eyebrow:"small",title:"h1",text:"p"},h={};d.forEach(b=>{if(!t[b]){h[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){h[b]=t[b];const{text:v,element:y}=t[b];if(y&&Mk.includes(y.toLowerCase()))return;h[b]={text:v,element:m[b]};return}h[b]={text:t[b],element:m[b]}}});const p=o&&o.text&&o.link;return p&&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(kn,{className:K("banner-section",r,i,e,{"has-image":n,"image-full-width":n&&l.imageFullWidth,"image-inline":n&&!l.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&i==="normal"&&h.eyebrow&&h.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(h[b]&&typeof h[b]=="object"){const{text:v,element:y=""}=h[b];return b==="text"?c.jsx(On,{overrideType:"text-only",className:"text",children:v},b):x.createElement(y,{key:b,className:b},v)}return null}),u,p&&c.jsx(we,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:K({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(Cn,{image:{...n,aspect:l.imageFullWidth?"banner":n.aspect||void 0}})]})})},Ik=x.memo(Nk);const Rk=({image:e,variant:t="default",children:n,className:r=""})=>{const i={};return e&&(i["--image"]=`url(${e})`),c.jsx(kn,{className:K("custom-content-banner",t,r,{"has-image":e}),style:i,children:c.jsx("div",{className:"content-slim",children:n})})};const $k=({alignImage:e="left",className:t,content:n,image:r})=>{const i=typeof n=="string"?c.jsx(On,{children:n}):n;return c.jsxs(kn,{className:K("highlight-section",t),children:[r&&c.jsx("div",{className:K("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(Cn,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),c.jsx("div",{className:K("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:K("highlight-content",{"highlight-content-right":e==="left"}),children:r?i:c.jsx("div",{className:"content-default",children:i})})})]})},Lk=x.memo($k);const zk=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:c.jsxs("aside",{className:K("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(we,{variant:t.variant||"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"learn-more-click",children:t.text})]}),qk=({type:e,data:t})=>{const n=ie.useIntl(),{answers:r,createdAt:i,dateHasPassed:a,isOngoingEvent:s,pill:o,readingTime:u,publishedDate:l,startDate:d}=t;if(e==="question"){const m=i&&Ms(i);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&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&&!a||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):vo(d)});if(o)return c.jsx(Yt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(u||l){const m=l&&Ms(l);return c.jsxs("ul",{className:"details",children:[u&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:u})}),l&&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},Uk={title:66,text:3e3,secondaryText:1e3,partner:34},da={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"}},Wk=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const i=ie.useIntl(),[a,s]=x.useState({loading:!1,registered:e.registered||!1});x.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:u,dateHasPassed:l,pill:d,slug:m}=e,h=e.contentType;let p="";if((f=da[h])!=null&&f.gtmEvent&&(p=da[h].gtmEvent),u&&l)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||i.formatMessage({id:"card_watch"})}):null;if(h==="people")return n?c.jsx(we,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||i.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(h)&&d!=="premium"){const v=a.loading||a.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),y=async C=>{var k;if(C.preventDefault(),C.stopPropagation(),window&&((k=window.dataLayer)==null||k.push({event:"gtm.click","gtm.element":n,"gtm.elementClasses":"gtm-trackable","gtm.elementUrl":n,EventType:`${r}-${h}-register-click`,EventContext:`${r}Page-${h}: ${m}`})),!(v||!t||!t.onClick)){s(D=>({...D,loading:!0}));try{const D=await t.onClick(e);s(D==="success"?()=>({registered:!0,loading:!1}):_=>({..._,loading:!1}))}catch{s(_=>({..._,loading:!1}))}}};return c.jsx("p",{className:K("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(we,{onClick:y,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${h}: ${m}`,"data-gtm-event-type":`${r}-${h}-register-click`,"data-testid":"in-card-button",children:o||i.formatMessage({id:`card_cta_${h}${v?`_${a.loading?"loading":"done"}`:""}`})})})}return null};function Vk({buildMemberData:e,communitySlug:t}){const n=ie.useIntl(),r=x.useContext(rt),[i,a]=x.useState({count:"...",isMember:!1,memberType:""});return x.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(s=>{if(!s)return;const{membersCount:o,role:u="",pagination:l}=s;let d=0;o?d=o:l!=null&&l.total&&(d=l==null?void 0:l.total),a({count:d.toString(),isMember:!!u,memberType:u})})},[t,e]),c.jsxs("span",{className:"member-information",children:[i.isMember&&c.jsx(Yt,{size:"small",variant:"registered",icon:(i==null?void 0:i.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${i.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:i.count})})]})}const xu=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:i,cta:a,gtmContext:s="Carousel",handleCardClick:o,meta:u})=>{var F,S;const l=ie.useIntl(),d=x.useContext(rt),m=!!(d!=null&&d.id),{isTabbable:h=!0,setFocus:p=!1}=u||{},g=x.useRef(null),[f,b]=x.useState({data:null,isLoading:!0});x.useEffect(()=>{n(i,m).then(I=>{b({data:I,isLoading:!1})}).catch(()=>b(I=>({...I,isLoading:!1})))},[i,m,n]);const{data:v,isLoading:y}=f;if(y||!v)return c.jsx(Nt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!a&&(a={text:l.formatMessage({id:`card_cta_${i.contentType}`}),onClick:o});const{contentType:C}=v;if(!C||!da[C])return c.jsx(Nt,{element:"li",className:"card-wrapper"});const{basePath:k="",className:D,length:_,gtmEvent:B}=da[C];let P=h&&v.slug?`${k}${v.slug}`:!1;h&&v.slug&&(v.slug.slice(0,4)==="http"||v.slug.slice(0,2)==="//"||v.slug.slice(0,6)==="mailto"||v.slug.slice(0,3)==="tel")&&(P=v.slug);const N=I=>{if(P){I.preventDefault(),I.stopPropagation();const H=I.currentTarget.getAttribute("data-url");window&&window.dataLayer.push({event:"gtm.click","gtm.element":H,"gtm.elementClasses":"gtm-trackable","gtm.elementUrl":H,EventType:`${s}-CarouselCard`,EventContext:`${B}-click`}),window.location.href=H}},z={...Uk,..._};let O={className:"card"},A={};return P&&(A={href:P,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${B}-click`,"data-testid":"link"},v.openInNewTab&&(A.target="_blank"),O={onClick:N,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${B}-click`}),p&&(O={...O,tabIndex:"0"},(F=g==null?void 0:g.current)==null||F.focus(),(S=g==null?void 0:g.current)==null||S.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:K("card-wrapper text-medium",D,t,{"has-link":P,"no-link":!P,"has-image":v.banner}),"data-testid":`${C}-card`,children:c.jsxs("div",{...O,ref:g,"data-url":P,children:[c.jsx(Nd,{className:"card-label",contentType:C,customIcon:v.isPrivate?"lock-locked":v.customIcon,customLabel:v.customLabel}),C==="communityPage"&&(v==null?void 0:v.createdAt)&&tp(v==null?void 0:v.createdAt,60)&&c.jsx(Yt,{size:"small",variant:"information","data-testid":"new-community",children:l.formatMessage({id:"card_new"})}),v.startDate&&!v.isOngoingEvent&&c.jsx(Yt,{size:"small",variant:v.dateHasPassed?"default":"information","data-testid":"date",children:v.dateHasPassed?l.formatMessage({id:"card_ended"}):Sd(v.startDate)}),v.banner?c.jsxs("p",{className:"img",children:[v.registered&&c.jsx(Yt,{size:"small",variant:"registered",children:l.formatMessage({id:"card_registered"})}),c.jsx(Cn,{image:{...v.banner,description:""}})]}):D==="people"?c.jsx(un,{name:v.title||"",src:v.profile,"data-testid":"people-profile-picture"}):null,v.contributors&&c.jsx(_o,{contributors:{data:v.contributors},styling:{size:"small",showGap:D!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(C)?l.formatMessage({id:`card_contributors_${C}`}):void 0,"data-testid":"contributors"}),v.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:v.partner.length>1?l.formatMessage({id:"card_partner"},{partner:v.partner[0],number:v.partner.length-1}):sr(v.partner[0],z.partner)}),["title","text","secondaryText"].map(I=>{const H=v[I];if(!H)return null;const V=kd(I),ae={key:I,className:V,"data-testid":V},ne={wrapper:"p",forceWrapper:!0,forceInline:!0},E=sr(H,z[I]);return["title","text"].includes(I)&&P?(ne.wrapper="a",c.jsx("p",{...ae,children:c.jsx(Zt,{options:ne,...A,children:E})})):c.jsx(Zt,{options:ne,...ae,children:E})}),i.contentType==="communityPage"&&(i.slug||v.slug)&&r&&c.jsx(Vk,{communitySlug:i.slug||v.slug,buildMemberData:r}),c.jsx(qk,{type:D||"",data:v}),c.jsx(Wk,{data:v,cta:a,link:P||"",gtmContext:s})]})})};const Fh=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:K("card-block",n),children:e.map((i,a)=>{const s=i.slug?`${i.slug}-${t[a]}`:`${t[a]}-${a}`;return c.jsx(xu,{id:s,card:{...i,contentType:t[a]},meta:{setFocus:a===(r==null?void 0:r.focusCardIndex)},...r},s)})}),Hk=(e,t,n,r)=>{const i=t*n<=e,a=e<t*(n+1),s=r.includes(Math.floor(e/t));return{inView:i&&a,isLoaded:s}},Kk=({id:e,title:t})=>{const n=ie.useIntl();if(!t||!t.text)return null;const{text:r,element:i="h2",variant:a="default",size:s="medium",link:o}=t;return x.createElement(i,{className:K("title",a,s,{"highlighted-title":a==="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 Ss={fourCards:1024,threeCards:769,twoCards:480};let Si=null,js=null;const Zk=({id:e,cards:t,cardTypes:n,buildCardData:r,title:i,className:a,gtmContext:s,...o})=>{const u=ie.useIntl(),l="carousel_pagination_",[d,m]=x.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:h,isLoading:p}=d,[g,f]=x.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:v}=g,[y,C]=x.useState(""),k=t.length,D=Math.ceil(k/h),_=x.useRef(null),B=wn(!0,!0,_==null?void 0:_.current);x.useEffect(()=>{let F=1;B&&(B>=Ss.fourCards?F=4:B>=Ss.threeCards?F=3:B>=Ss.twoCards&&(F=2),F>k&&(F=k)),m(S=>({...S,cardsPerPage:F,isLoading:!1}))},[B,k]);const P=(F="next")=>{js&&clearTimeout(js);let S=b;if(typeof F=="string")if(F==="next")if(b<D-1)S=b+1;else return;else if(b>0)S=b-1;else return;else S=F;C(""),f(H=>({...H,currentPage:S,loadedPages:[...new Set([...v,S])]}));const I=()=>{const H=S*d.cardsPerPage,V=H+d.cardsPerPage;return t.slice(H,V).length};js=setTimeout(()=>{C(u.formatMessage({id:`${l}ariaLive${typeof F=="string"?"":"_slide"}`},{direction:u.formatMessage({id:`${l}${typeof F=="string"?F:"next"}`}),slide:typeof F=="string"?1:F+1,count:I()}))},500)},N=F=>{Si=F.touches[0].clientX},z=F=>{if(Si===null)return;const S=F.touches[0].clientX,I=Si-S;I>5?P("next"):I<-5&&P("previous"),Si=null},O={"--width":`${B||0}px`,"--total-cards":k,"--cards-per-page":h,"--page":b};if(p)return c.jsx(ga,{layout:`carousel${i?"-with-title":""}`});const A=(F,S)=>{var H;let I=null;return(H=F==null?void 0:F.sys)!=null&&H.id?I=`card-${F.sys.id}`:F!=null&&F.slug?I=`card-${F.slug}`:[n[S],F.contentType].includes("customCard")&&(I=`card-${window.btoa(`${F.title} ${F.createdAt}`)}-${S}`),I};return c.jsxs("section",{ref:_,className:K("carousel-wrapper",a),"data-testid":"carousel",children:[c.jsx(Kk,{id:e,title:i}),c.jsx("ul",{className:"carousel",onTouchStart:N,onTouchMove:z,style:O,"data-testid":"carousel-list",children:t.map((F,S)=>{let I=A(F,S);const{inView:H,isLoaded:V}=Hk(S,h,b,v);return I&&(H||V)?c.jsx(xu,{id:I,card:{...F,contentType:n[S]},buildCardData:r,gtmContext:s,meta:{isTabbable:H},...o},I):(I=I||`${e}-card-${S}`,c.jsx(Nt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},I))})}),D<=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(we,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:F=>{F.preventDefault(),F.stopPropagation(),P("previous")},screenreaderText:u.formatMessage({id:`${l}previousSlide`}),disabled:b<=0})}),[...Array(D)].map((F,S)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:K("page-indicator",{selected:S===b}),onClick:I=>{I.preventDefault(),I.stopPropagation(),P(S)},children:c.jsx(Oe,{showOnFocus:!1,children:u.formatMessage({id:`${l}slide`},{number:S+1,total:D})})})},`page-indicator-${S}`)),c.jsx("li",{className:"arrow next",children:c.jsx(we,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:F=>{F.preventDefault(),F.stopPropagation(),P("next")},screenreaderText:u.formatMessage({id:`${l}nextSlide`}),disabled:b>=D-1})})]}),c.jsx(Oe,{"aria-live":"polite",showOnFocus:!1,children:y})]})]})},Yk=({carousels:e=[],isLoading:t,title:n,className:r="",...i})=>!e||!e.length?null:e.map(({title:a,viewAllUrl:s,cards:o,cardsTypes:u},l)=>{const d=a?window.btoa(a):`carousel-${l}`,m=l===e.length-1;return t?c.jsxs(x.Fragment,{children:[c.jsx(ga,{layout:`carousel${a?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:c.jsx(zt,{})]},`placeholder-${d}`):c.jsxs(x.Fragment,{children:[c.jsx(Zk,{cards:o,cardTypes:u,title:n!=null&&n.hidden?{}:{...n,text:a,link:s},...i}),m?null:c.jsx(zt,{})]},`carousel-${d}`)});const Gk=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:i,title:a,text:s,isPrivate:o,slug:u}=n;let l={};return u&&(l={onClick:m=>{u&&(m.preventDefault(),m.stopPropagation(),window.location.href=u)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),x.createElement(e,{className:K("narrow-card",t,{"has-link":u,"gtm-trackable":u,"no-link":!u}),...l,children:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:K("img",{private:o,"no-image":!i}),children:i&&c.jsx(Cn,{image:i})}),c.jsxs("div",{className:"content",children:[a&&c.jsx("p",{className:"title text-medium",children:a}),s&&c.jsx("p",{className:"text text-medium",children:s})]})]})})};const Qk=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:i=!0},graph:a,styling:s={},className:o=""})=>{const u=ie.useIntl();let l=i?n:r;l>99?l=100:l<1&&(l=0);const{highlightPercentage:d=!1}=s;return x.createElement(e,{className:K("course-progression",o,{"highlight-percentage":d,"has-circle-graph":a==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:u.formatMessage({id:"courseProgression_done"},{percent:m=>c.jsx("strong",{children:m}),number:l})}),l<100&&i&&c.jsx(Aa,{time:t,appendedText:u.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(Eo,{progress:l,styling:{layout:a||"bar",size:a&&a==="circle"?"small":"default"}})]})})};const Ah=({element:e="span",sectionId:t,subsectionId:n,title:r,className:i=""})=>x.createElement(e,{className:K("lesson-name",i),"data-number":`${t}.${n}`,children:r});const Th=({size:e="default",completionTime:t,icon:n,optional:r,type:i,children:a})=>{const s=ie.useIntl(),o=ma(`lessonType_${i}`)?s.formatMessage({id:`lessonType_${i}`}):Ad(i||"");return c.jsxs("small",{className:K("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:K("type",n),children:o})," ",t>0&&!r&&c.jsx(Aa,{time:t})," ",a?c.jsx("span",{className:"additional",children:a}):null]})};const Jk=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:i,sectionId:a,sectionTime:s,slug:o,timeLeft:u,title:l},quizScores:d})=>{const m=ie.useIntl(),h="courseStructure_",p=l.toLowerCase().includes("course conclusion");return c.jsxs(ha,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[m.formatMessage({id:`${h}section${p?"_end":""}`},{number:a})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:i&&u===0?m.formatMessage({id:`${h}time_completed`}):c.jsx(Aa,{time:s,appendedText:i?m.formatMessage({id:`${h}time_left`}):""})})]}),c.jsx("h3",{children:l})]}),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:y,isIntroduction:C,optional:k,slug:D,subsectionId:_,title:B,type:P})=>{const N=i&&t||C,z={};return y&&(z.style={"--image":`url(${y})`}),c.jsx("li",{className:K({article:b===jr.ARTICLE,discussion:b===jr.DISCUSSION,quiz:b===jr.QUIZ,completed:g&&b===jr.ARTICLE,locked:!N}),...z,children:c.jsx(Dn,{href:N?`/microcourses/en/${o}/${D}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Fd(B)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(Ah,{sectionId:a,subsectionId:_,title:B,className:"course-title"})," ",c.jsx(Th,{completionTime:f,icon:v,optional:k,type:P,children:d&&d[D]&&c.jsx("span",{className:"quiz-score",children:`${d[D]}%`})})]})})},D)})})]})};const Xk=({isComplete:e=!1,onClick:t,...n})=>{const r=ie.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(we,{...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:K("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},eF=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),pd=[{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 ji="notFoundError_",tF=()=>{const e=ie.useIntl(),t=[];return pd.forEach((n,r)=>{n.title=e.formatMessage({id:`${ji}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(bh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(kn,{children:[c.jsx(Fh,{cards:pd,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),c.jsx(we,{href:"/solution-articles/",children:e.formatMessage({id:`${ji}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${ji}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ji}text`})})]})};exports.ASSETS_URL=Gt;exports.ActionBar=Tf;exports.ActionButton=Zr;exports.ActivitiesFeed=xv;exports.ActivitySection=Ek;exports.ActivityType=yr;exports.AddPost=bu;exports.Badge=Gd;exports.BadgeScope=ut;exports.Badges=Qd;exports.BadgesContext=yo;exports.BadgesProvider=zd;exports.Banner=Ok;exports.BannerSection=Ik;exports.Breadcrumbs=Lv;exports.Buckets=vp;exports.Button=we;exports.ButtonWrapper=vr;exports.COURSE_CONTENT_TYPES=jr;exports.CacheProvider=qd;exports.Card=xu;exports.CardBlock=Fh;exports.Carousel=Yk;exports.CharacterLimit=zo;exports.Checkbox=qo;exports.CollapsibleSection=ha;exports.Columns=jf;exports.CommunityDetails=Lg;exports.ConnectionCta=Jd;exports.ConnectionDirectionType=Do;exports.ConnectionStatusType=Co;exports.ContactFooter=V_;exports.ContactForm=dh;exports.ContentTypeLabel=Nd;exports.Contributors=_o;exports.ConversationContext=ka;exports.CookieBanner=vh;exports.CourseProgression=Qk;exports.CourseStructure=Jk;exports.CustomContentBanner=Rk;exports.CustomEvents=it;exports.DELETED_USER_ID=Vr;exports.Directory=Tk;exports.DiscussionContentType=Te;exports.DiscussionConversation=wh;exports.DiscussionForm=oi;exports.DiscussionFormCard=Dh;exports.DiscussionFormModal=kh;exports.DiscussionPost=ui;exports.DiscussionThread=_h;exports.Divider=zt;exports.DownloadSection=z_;exports.EMAILS=Qn;exports.EditSection=U_;exports.EmailHelperTextBox=Of;exports.EmptyStateBox=Qt;exports.EnrichedUrl=$o;exports.FeatureFlags=Wd;exports.Filters=Bf;exports.FlagsProvider=Ud;exports.Footer=gu;exports.Form=Xt;exports.Formatting=Z;exports.Fragment=St;exports.FullWidthSection=kn;exports.GET_STREAM_USER_PREFIX=Os;exports.GlobalProviders=Ap;exports.Header=vu;exports.HelperTextBox=Rd;exports.HiddenFromScreenReaders=fa;exports.HideShowTextBox=$d;exports.HighlightSection=Lk;exports.HighlightedTextBox=_t;exports.INVALID_TOKEN=Td;exports.IconBulletedList=xp;exports.ImageContainer=mp;exports.IntlProvider=Vd;exports.InviteForm=fh;exports.InviteModal=kk;exports.JoinButton=To;exports.Label=sa;exports.LanguageContext=xo;exports.LanguageSwitcher=qv;exports.LessonName=Ah;exports.LessonType=Th;exports.LikesButton=Df;exports.LikesFeed=kf;exports.LikesModal=Ff;exports.Link=Dn;exports.LoadMore=ii;exports.LoadingBlock=Xd;exports.LoadingPlaceholder=Nt;exports.LoadingState=ga;exports.Logo=Lo;exports.LogoSection=W_;exports.MEMBERS_PER_PAGE=yh;exports.MENTION_REGEX=Bd;exports.MarkCompleteButton=Xk;exports.MarkdownText=On;exports.MarketingBlock=zk;exports.Marks=Kt;exports.Member=an;exports.MembersList=xh;exports.Modal=ko;exports.MoreMenu=Xi;exports.NUMBER_OF_COUNTRIES=Jh;exports.NUMBER_OF_USERS=Qh;exports.NarrowCard=Gk;exports.NavigationMenu=Sf;exports.NotFoundError=tF;exports.Overlay=ln;exports.OverlayContext=wo;exports.OverlayProvider=Zd;exports.PageHeading=Yd;exports.PageLayout=bh;exports.Password=Mf;exports.PasswordForm=S_;exports.PasswordRules=Lf;exports.Pill=Yt;exports.Poll=Ch;exports.Popover=Md;exports.Portal=br;exports.ProfileForm=mh;exports.ProfileImageChange=ch;exports.ProfileModal=Fa;exports.ProfileModalLauncher=yu;exports.ProfilePicture=un;exports.ProgressBar=Eo;exports.ProgressTracker=pp;exports.PublishArticleForm=O_;exports.Rating=ab;exports.RepliesFeed=_f;exports.ResponsesHeading=Eh;exports.ResponsiveImage=Cn;exports.ResultsVisibility=ca;exports.ReturnToNavButton=gp;exports.RichTextEditor=pu;exports.SearchForm=ph;exports.ShareLink=Af;exports.ShareLinks=Zv;exports.ShowEmail=Bk;exports.SignupForm=L_;exports.Span=Rs;exports.StatusBanner=ur;exports.TableOfContents=Pk;exports.Tabs=Yv;exports.Tags=G_;exports.TestimonialBlock=jk;exports.TimeToComplete=Aa;exports.Toggle=T_;exports.Tooltip=Ln;exports.TopLevelPage=H_;exports.UUID_V4_REGEX=Hr;exports.UserContext=rt;exports.UserProvider=Hd;exports.VisuallyHidden=Oe;exports.addAriaProps=hf;exports.basicReducer=pr;exports.camelCaseToDashCase=kd;exports.checkIntlPathExists=ma;exports.enrichPostCategories=Ro;exports.generateConditions=Ui;exports.generateCssIcon=Xh;exports.getAuthorData=xr;exports.getCharacterLimitProps=Pf;exports.getLongDate=vo;exports.getMember=va;exports.getPostBody=Io;exports.getShortDate=Sd;exports.getValueLength=ba;exports.headerData=ri;exports.likesResponseMock=Rv;exports.mapGetStreamData=eF;exports.pageReady=jd;exports.passwordValidator=Ns;exports.repliesFeedMock=wv;exports.supportedLanguages=Mi;exports.toCamelCase=Fd;exports.toCapitalisedCase=Gh;exports.toSentenceCase=Ad;exports.transformSlugs=Us;exports.useAutoResize=xd;exports.useBadges=Ld;exports.useCurrentPath=wd;exports.useEffectAfterMount=or;exports.useElementWidth=wn;exports.useOverlay=Kd;exports.useScrollListener=Dd;exports.useScrollToHash=po;exports.useTooltips=go;exports.useUser=pa;
165
+ `}),N=U.turndown(N)}o&&o.mentions&&(N=await Pd({text:N,template:`[${io}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),_E(N,U=>{const X=[{type:"initialValue",value:U},{type:"editorKey",value:P.toString()}];o!=null&&o.link&&(X.push({type:"enrichedUrl",value:o.link}),o.link.url&&ae(o.link.url)),B(X),setTimeout(()=>{B([{type:"stringValue",value:ed(q)}])},150)})})()},[P]),x.useEffect(()=>{if(H===void 0&&q){const N=AE(q);N&&ae(N)}const R=N=>{var W;const U=N,X=((W=U==null?void 0:U.detail)==null?void 0:W.url)||null;X&&H&&H.url===X&&B([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",R),()=>{window.removeEventListener("linkRemoved",R)}},[H]),x.useEffect(()=>{if(t){Hr.lastIndex=0;const R=t.match(Hr);R&&R.length===1&&R[0].length===t.length&&!S&&B([{type:"originalValue",value:t}])}t!==""||!q||Wi(P,t)&&!S||(w.withoutNormalizing(q,()=>{ee.delete(q,{at:{anchor:w.start(q,[]),focus:w.end(q,[])}}),ee.deselect(q),q.children.length!==0&&ee.unwrapNodes(q,{at:[0]}),ee.insertNodes(q,k,{at:[0]})}),B([{type:"initialValue",value:k},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),x.useEffect(()=>{b({link:H})},[H]),x.useEffect(()=>{O===""&&H&&B([{type:"enrichedUrl",value:void 0}])},[O]);const j=Wr(()=>{BE({editor:q,isShowing:V.show,numberOfUsers:V.numberOfUsers,listMembers:p,dispatch:B})},100);return z?c.jsx("div",{id:ne,className:"rich-text-editor input text-medium",children:c.jsxs(cn.Provider,{value:{..._,id:ne,isInOverlay:m,dispatch:B,onMention:y,reportError:C},children:[c.jsxs(Kw,{editor:q,initialValue:z,onChange:R=>{if(q.operations.some(U=>U.type!=="set_selection")){let U=jE(R);U==="<br>"&&(U=""),f(U,H),B([{type:"stringValue",value:ed(q)}]),S||B([{type:"hasInteracted",value:!0}]),j(),h&&console.log({serialized:U,json:R})}},...l,children:[c.jsx(Rw,{className:"editor",renderElement:E,renderLeaf:Y,placeholder:n||d.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async R=>{const N=H!==!1,U=R.clipboardData.getData("text");if((W=>{try{return new URL(W),!0}catch{return!1}})(U)){let W=U;if(U){const{full:te}=bo(U);W=te}if(U&&v&&!N){const te=await v(W);te.url&&B([{type:"enrichedUrl",value:te}])}}},onKeyDown:R=>{if(R.key==="Enter"){V.show&&(R.preventDefault(),R.stopPropagation(),Ym(q,V,B,ne));const{selection:N}=q;if(N){const U=Q.isCollapsed(N),[X,W]=w.node(q,N,{depth:1});let te=X,de=te.type;const J=te.children[0];if(J&&(J==null?void 0:J[Z.h3])===!0&&(R.stopPropagation(),R.preventDefault(),ee.insertNodes(q,k)),J&&[Z.ol,Z.ul].includes(J.type)&&(te=J,de=J.type),te&&he.isElement(te)&&de!==Z.paragraph){if(de===Z.blockquote&&!R.shiftKey){R.stopPropagation(),R.preventDefault(),ee.insertNodes(q,k);return}if(U){const[ve,me]=w.parent(q,N,{edge:"end"}),_e=ve.type;if([Z.ul,Z.ol].includes(de))if(R.stopPropagation(),R.preventDefault(),_e===Z.li&&F==="Enter"){ve.children.length===1&&"text"in ve.children[0]&&ve.children[0].text===""&&ee.removeNodes(q,{at:me}),ee.insertNodes(q,k,{at:L.next(W)}),ee.select(q,w.end(q,L.next(W)));return}else{const[De,ze]=kE(q,Z.li),We={type:Z.li,children:[{text:""}]};ee.insertNodes(q,We,{at:L.next(ze)}),ee.select(q,w.end(q,L.next(ze)))}}}}}else if(R.key==="Escape"){if(V.show){R.preventDefault(),R.stopPropagation(),B([{type:"mentionPopover",value:{...V,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(R.key)&&V.show){R.preventDefault(),R.stopPropagation();const{selectedUser:N,possibleUsers:U}=V;let X=R.key==="ArrowUp"?N-1:N+1;X<0&&(X=U.length-1),X>=U.length+1&&(X=0),B([{type:"mentionPopover",value:{...V,selectedUser:X}}])}B([{type:"lastKey",value:R.key}]),TE(R,q,B,C)},onBlur:()=>{q.selection&&B([{type:"lastAnchor",value:q.selection.anchor}])},onFocus:()=>{if(A){if(!L.isPath(A.path)||!le.has(q,A.path))return;const R=le.get(q,A.path);let N=0;if(ge.isText(R)?N=R.text.length:R.children&&(N=R.children.length),A.offset>N)return;try{ee.select(q,{anchor:A,focus:A})}catch(U){const X=U.message;C(`Error focusing editor: ${X}`)}}}}),H?c.jsx($o,{data:H,variant:"condensed",onClick:()=>{B([{type:"enrichedUrl",value:!1}]);const R=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(R)},"aria-label":d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:H.title||d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(UE,{styling:u==null?void 0:u.toolbar}),p?c.jsx(PE,{onFallbackClick:g}):c.jsx(c.Fragment,{})]},M),c.jsx(zo,{id:`character-limit-${e}`,limit:r,valueLength:ba(O)})]})}):c.jsx(c.Fragment,{})};const T_=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:i=()=>{}},isDisabled:a=!1,className:s=""})=>{const[o,u]=x.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);x.useEffect(()=>{r&&u(r)},[r]);const l=d=>{a||(u(d),i(d))};return c.jsxs("div",{className:K("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),l(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:K("toggle-options",{disabled:a,on:o===n[1].value}),children:n.map(d=>{const h=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:h,name:e,value:d.value,checked:o===d.value,onChange:()=>l(d.value),disabled:a}),c.jsx("label",{htmlFor:h,children:d.label})]},h)})})]})};function ch({className:e="",userId:t,userName:n,src:r,uploadImage:i,button:a,callback:s}){const o=ie.useIntl(),u="profileImageChange_",[l,d]=x.useState(r),[h,m]=x.useState(!1),[p,g]=x.useState(!1),f=x.useRef(null),b=async k=>{m(!0),g(!1);try{const D=k.target.files&&k.target.files[0];if(!D||!t)throw m(!1),new Error("Image file or userID is missing");const _=await i({fileObject:D,userId:t}),B={thumbnail:_.thumbnailURL,full:_.originalURL};d(B),s(B)}catch{g(!0)}finally{m(!1)}m(!1)},{upload:v=o.formatMessage({id:`${u}cta_upload`}),change:y=o.formatMessage({id:`${u}cta_change`}),uploading:C=o.formatMessage({id:`${u}cta_uploading`})}=(a==null?void 0:a.text)||{};return c.jsxs("div",{className:K("profile-image-change-figure",e),children:[c.jsx(un,{className:"profile-image-change-picture",name:n,src:l==null?void 0:l.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),p&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${u}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(we,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${l?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:h,children:h?C:l?y:v})]})}const dh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:i="contact-form-submit-click"}=e||{};return c.jsx(Xt,{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:i},functions:{onSuccess:t,onFailure:n},button:{className:"new"}})};const B_=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=ie.useIntl();return c.jsx(zh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:i=>{t(i),n(!i.length)},autoFocus:!1,getLabel:(i,a,s)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:i}),c.jsx(we,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(a),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},a)})},fh=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:i,labelColor:a,backgroundColor:s,onClose:o,reportError:u,sendInvites:l,initialFormStatus:d="NOT_SUBMITTED",gtm:h={context:"Form",event:"form-submit-click"},secondaryActionButton:m,meta:p})=>{const[g,f]=x.useState([]),[b,v]=x.useState(!0),[y,C]=x.useState(d),{formatMessage:k}=ie.useIntl(),D=async M=>{try{await l(g,M.message),f([]),C("SUCCESS")}catch(P){C("ERROR"),u(P)}},_=M=>{M.preventDefault(),C("NOT_SUBMITTED"),v(!0),f([])},B=M=>{M.preventDefault(),o(),C("CLOSED")};return y==="CLOSED"?null:y==="ERROR"||y==="SUCCESS"&&!(p!=null&&p.shouldHideDoneButtonOnSubmit)?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:y==="SUCCESS"?c.jsx("h2",{className:"success-title",children:k({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",k({id:"inviteForm_error"})]})}),c.jsx(zt,{}),c.jsx("div",{className:"footer",children:y==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(we,{variant:"secondary",onClick:_,children:k({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(we,{onClick:B,children:k({id:"inviteForm_ctaDone"})})]}):c.jsx(we,{onClick:_,children:k({id:"inviteForm_ctaTryAgain"})})})]}):c.jsxs("div",{className:"invite-form-wrapper",style:{backgroundColor:s},children:[c.jsxs("div",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:i},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t})]}),c.jsx(Xt,{id:"invite-form",fields:[{component:B_,props:{emails:g,setEmails:f,setIsDisabled:v},required:!0},{id:"message",type:"textarea",label:k({id:"inviteForm_message_label"}),placeholder:n||k({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:D},button:{text:r,size:"medium",disabled:b},gtm:h,meta:p,secondaryActionButton:m})]})},Ui=e=>e.map(t=>({condition:t})),Bt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},S_=({functions:e,...t})=>{const{formatMessage:n}=ie.useIntl(),[r,i]=x.useState(null),[a,s]=x.useState(!1),[o,u]=x.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),l=p=>p[Bt.NEW_PASSWORD]!==p[Bt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=p=>!Ns(p[Bt.NEW_PASSWORD]).isValid,h=[{"data-testid":Bt.NEW_PASSWORD,id:Bt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Ui(["required",d]),functions:{onChange:p=>u(Ns(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Bt.CONFIRMED_PASSWORD,id:Bt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Ui(["required",l])}];t.isPasswordChange&&h.unshift({"data-testid":Bt.CURRENT_PASSWORD,id:Bt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Ui(["required"])}),a&&h.push({component:Lf,props:{matchingRules:o}});const m={id:Bt.FORM_ID,fields:h,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>i(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(Bt.NEW_PASSWORD)||g.includes(Bt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Xt,{...m}),r&&c.jsx(Qt,{variant:"error",text:r})]})};const mh=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:i,...a})=>{var M;const s=ie.useIntl(),o="profileForm_",u=x.useContext(rt),[l,d]=x.useState(u.image),[h,m]=x.useState(!1),{uploadImage:p=()=>{},onSuccess:g=async P=>{},onCancel:f=()=>{},onFailure:b=()=>{}}=n,{buildLocation:v,isValidPlace:y,predictPlaces:C}=t.useMaps(),{context:k="ProfileForm",event:D="profile-form-submit-click"}=i||{},_=[{id:"jobTitle",type:"text",label:s.formatMessage({id:`${o}jobTitle`}),placeholder:s.formatMessage({id:`${o}jobTitle_placeholder`}),value:u.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:s.formatMessage({id:`${o}organization`}),placeholder:s.formatMessage({id:`${o}organization_placeholder`}),value:u.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:s.formatMessage({id:`${o}location`}),placeholder:s.formatMessage({id:`${o}location_placeholder`}),value:(M=u.location)==null?void 0:M.en,validation:[{condition:"required"},{condition:({location:P})=>P&&!h?!1:!y(P),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{h||m(!0)},onKeyInput:C}}],B=[{component:ch,props:{userName:u.name,userId:u.id,src:l,uploadImage:p,callback:d,button:{text:{upload:s.formatMessage({id:`${o}image`})}}}},{id:"name",type:"text",label:s.formatMessage({id:`${o}name`}),placeholder:s.formatMessage({id:`${o}name_placeholder`}),value:u.name,autoComplete:"name",validation:[{condition:"required"}]},..._,{id:"biography",type:"textarea",label:s.formatMessage({id:`${o}bio`}),placeholder:s.formatMessage({id:`${o}bio_placeholder`}),limit:1e3,value:u.biography},{component:zt}];return c.jsx(Xt,{id:"profile-details-form",fields:e?_:B,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:k,event:D},functions:{onSuccess:async P=>{try{const z={...P,image:l||null,location:h?await v(P==null?void 0:P.location):u.location,...e?{onboardingState:"completed"}:{}};u.updateDetails&&u.updateDetails(O=>({...O,...z})),await g(z)}catch{b()}},onCancel:f,onFailure:b},button:{size:"large",text:{default:s.formatMessage({id:`${o}cta`}),submitting:s.formatMessage({id:`${o}cta_submitting`}),submitted:s.formatMessage({id:`${o}cta_submitted`})}},...a})},j_=()=>{const e=ie.useIntl(),[t,n]=x.useState(0);return x.useEffect(()=>{const r=setInterval(()=>{n(i=>{if(i>=95)return clearInterval(r),95;const a=Math.round(Math.random()*10);return Math.min(i+a,95)})},800);return()=>{clearInterval(r)}},[]),c.jsx(Xd,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};function P_({coverImage:e,setShowImagePicker:t}){return e&&e.url?c.jsx(Qt,{className:"cover-image-preview",text:c.jsx(Cn,{className:"cover-image",image:{description:e.description||"",height:e.height,width:e.width,url:e.url,color:e.color,type:"image/jpeg"}}),button:{component:c.jsx(we,{variant:"tertiary",onClick:()=>t(!0),children:c.jsx(ie.FormattedMessage,{id:"publishArticleForm_replaceImage_button"})})}}):c.jsx(Qt,{button:{component:c.jsx(we,{variant:"secondary",onClick:()=>t(!0),children:c.jsx(ie.FormattedMessage,{id:"publishArticleForm_selectImage_button"})})}})}var hh=(e=>(e.CitiesAndLocalGovernment="topic_CitiesAndLocalGovernment",e.Climate="topic_Climate",e.DigitalAndData="topic_DigitalAndData",e.Education="topic_Education",e.EquityJusticeAndInclusion="topic_EquityJusticeAndInclusion",e.HealthAndSocialCare="topic_HealthAndSocialCare",e.Innovation="topic_Innovation",e.LeadershipAndSkills="topic_LeadershipAndSkills",e.LifeInGovernment="topic_LifeInGovernment",e.Policymaking="topic_Policymaking",e.TransportAndInfrastructure="topic_TransportAndInfrastructure",e.WorkingAndTheEconomy="topic_WorkAndTheEconomy",e))(hh||{});let ws=null;const et="publishArticleForm_",ud={},ld=10,O_=({id:e="publish-article-form",values:t=ud,setShowImagePicker:n,functions:r,meta:i,gtm:a})=>{var P;const s=ie.useIntl(),o=x.useContext(rt),{create:u,onSuccess:l=()=>{},onFailure:d=()=>{}}=r||{},{isInOverlay:h=!1}=i||{},[m,p]=x.useState(!1),[g,f]=x.useState(t.body||""),[b,v]=x.useState(!1),[y,C]=x.useState("");x.useEffect(()=>{Wi(t,ud)||Kr(t.body)&&t.body!==g&&t.body!==void 0&&f(t.body)},[t.body]);const k=()=>{!o||!o.id?v(s.formatMessage({id:`${et}error_loggedOut`})):b&&v(!1)},D=z=>({condition:O=>{const A=O[z];return!A||typeof A!="string"?!0:A.length<ld},error:s.formatMessage({id:`${et}error_underMinLength`},{length:ld})}),_=!!g&&Kr(g),B=()=>c.jsxs(c.Fragment,{children:[c.jsx(zt,{}),c.jsx("p",{className:"text-medium",children:s.formatMessage({id:`${et}disclaimer`})})]}),M=[{id:"title",type:"textarea",value:t.title||"",limit:65,label:s.formatMessage({id:`${et}title_label`}),placeholder:s.formatMessage({id:`${et}title_placeholder`}),styling:{autosizeToFit:!0},functions:{onChange:k},validation:[{condition:"required"},D("title")]},{id:"subtitle",type:"textarea",value:t.subtitle,limit:115,label:s.formatMessage({id:`${et}subtitle_label`}),styling:{autosizeToFit:!0},placeholder:s.formatMessage({id:`${et}subtitle_placeholder`}),functions:{onChange:k},validation:[{condition:"required"},D("subtitle")]},{component:sa,props:{formID:e,label:{visible:s.formatMessage({id:`${et}body_label`})},showLabel:!0}},{component:pu,props:{id:`${e}-input`,value:g,placeholder:s.formatMessage({id:`${et}body_placeholder`}),meta:{isInOverlay:h},autoFocus:!1,functions:{onChange:z=>{f(z),k()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!b,"aria-errormessage":"error-message"}},{id:"tags",label:s.formatMessage({id:`${et}tags_label`}),type:"checkboxes",styling:{displayOptionsAsPills:!0},options:Object.values(hh).map(z=>({id:z,label:s.formatMessage({id:`${et}_tags_${z}`})})),multipleOptions:{limit:3},validation:[{condition:"required",error:s.formatMessage({id:`${et}tags_error_required`})},{condition:z=>{var O;return((O=z==null?void 0:z.tags)==null?void 0:O.length)>3},error:s.formatMessage({id:`${et}tags_error_over_three`})}]},{component:sa,props:{formID:e,label:{visible:s.formatMessage({id:`${et}cover_image_label`})},showLabel:!0}},{component:P_,props:{coverImage:t.coverImage||{},setShowImagePicker:n}}];return m?M.push({component:zt}):M.push({component:B}),c.jsxs("section",{className:"publish-article-form",children:[c.jsx(Xt,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,shouldScrollOnSuccess:!1},functions:{onSuccess:async z=>{if(!o||!o.id||!_)return;ws&&clearTimeout(ws),p(!0);const O={...z,body:g,coverImage:t.coverImage};try{u&&await u(O),ws=setTimeout(()=>{C(s.formatMessage({id:`${et}aria_success`})),l(O)},500)}catch{v(s.formatMessage({id:`${et}error`})),C(""),d()}},onFailure:d},fields:M,intlPath:et,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":a==null?void 0:a.context,"data-gtm-event-type":"publish-article-click",disabled:!o||!o.id||!_||!((P=t==null?void 0:t.coverImage)!=null&&P.url),text:{default:s.formatMessage({id:`${et}cta_submit`}),submitting:s.formatMessage({id:`${et}cta_submitting`}),submitted:s.formatMessage({id:`${et}cta_submitted`})},customOnSubmit:b?c.jsx(c.Fragment,{}):c.jsx(j_,{})},gtm:a}),b&&c.jsx(ur,{id:"error-message",className:"error",children:typeof b=="string"&&b.includes(" ")?b:s.formatMessage({id:`${et}error`})}),y&&c.jsx(Oe,{"aria-live":"polite",showOnFocus:!1,children:y})]})};const ph=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:i="search-bar",gtmEvent:a="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},u=ie.useIntl(),l=x.useRef(null);or(()=>{!n||o||!s||l.current&&l.current.focus()},[s]);const d=h=>{h.preventDefault(),h.stopPropagation(),!(!l.current||!l.current.value||l.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(l.current.value)}`)};return c.jsx("form",{onSubmit:d,className:K("search-form gtm-trackable",t),role:"search","data-gtm-event-context":i,"data-gtm-event-type":a,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Oe,{element:"label",htmlFor:e,children:u.formatMessage({id:"search_label"})}),c.jsx("input",{ref:l,type:"search",id:e,name:e,defaultValue:r,placeholder:u.formatMessage({id:"search_placeholder"}),onKeyDown:h=>{h.key==="Enter"&&d(h)}}),c.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.stopPropagation(),l.current&&l.current.value&&(l.current.value="")},children:c.jsx(Oe,{children:u.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Oe,{children:u.formatMessage({id:"search_cta"})})})]})})})},cd=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 i=e.current.value.toString().toLowerCase().trim(),a={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},a);try{s=await t(i),s===void 0&&(s=a)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:i,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:u=!1,exists:l}=s;let d="";return o?d=u?"gov":"nonGov":l.registration?l.engagement&&!l.user?d=l.auth?"verify":"pending":d="exists":l.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!u},{type:"emailDetails",value:{email:i,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(i)}},{type:"validFields.email",value:!0}])},M_=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"]}},N_=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:i,state:a})=>{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=M_(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...a.values}),i([{type:"showSuccessMessage",value:!0}])},I_=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:i},refs:a,state:s,dispatch:o,dataToSubmit:u,intl:l})=>{const{emailDetails:d}=s,h=(p,g)=>{p.current&&s.validFields[g]!==p.current.validity.valid&&o([{type:`validFields.${g}`,value:p.current.validity.valid}])},m=[{id:"full_name",type:"text",inputRef:a.name,placeholder:l.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>h(a.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:a.email,placeholder:l.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{cd({ref:a.email,validateEmail:r,dispatch:o})},onChange:(p,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:Of,props:{email:d.email,type:d.boxType,resendVerificationCode:i}}];return s.shouldManuallyApprove&&(m.push({id:"job_title",type:"text",inputRef:a.jobTitle,placeholder:l.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>h(a.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:a.organisation,placeholder:l.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{h(a.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&m.push({id:"url",type:"text",label:l.formatMessage({id:"signup_url"},{small:p=>c.jsx("small",{children:p})}),placeholder:l.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&m.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||l.formatMessage({id:"signup_expectation"},{small:p=>c.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||l.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),m.push({id:"terms",className:"text-small",type:"checkbox",inputRef:a.tc,label:l.formatMessage({id:"signup_terms"},{terms:p=>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:p}),privacy:p=>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:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==a[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:a[f].current.validity.valid}),f==="email"&&cd({ref:a.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),m};const R_=({className:e=""})=>c.jsxs("div",{className:K("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ie.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ie.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const $_={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},L_=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:i={},submitButton:a,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const u=ie.useIntl(),l=window.location.pathname.includes("/signup")?"/login":`/login?returnTo=${window.location.pathname}`,{title:d=!0,expectation:h=!1,url:m=!0,logInButton:p=!0,successMessage:g=!0}=i,f={title:d,expectation:h,url:m,logInButton:p,successMessage:g},[b,v]=x.useReducer(pr,$_),{validFields:y,emailDetails:C,shouldManuallyApprove:k,shouldDisableButton:D,showSuccessMessage:_,showError:B}=b,[M,P]=ho.useCookies(["signup-this-session","functional-cookie-consent"]),z={form:x.createRef(),name:x.createRef(),email:x.createRef(),jobTitle:x.createRef(),organisation:x.createRef(),tc:x.createRef(),hiddenValidation:x.createRef()};x.useEffect(()=>{k===!0&&z.jobTitle.current&&z.jobTitle.current.focus()},[k]),x.useEffect(()=>{M["signup-this-session"]&&v([{type:"showSuccessMessage",value:!0}])},[M]),x.useEffect(()=>{_&&M["functional-cookie-consent"]&&P("signup-this-session","true",{path:"/",maxAge:3600})},[_]);const O=x.useMemo(()=>I_({placeholders:n,labels:t,shouldShow:f,functions:r,refs:z,state:b,dispatch:v,dataToSubmit:s,intl:u}),[s,r,u,z,f,b]),A=D?!0:k?!Object.values(y).every(F=>F===!0):!y.name||!y.email||["exists","pending","verify"].includes(C.boxType);return f.successMessage&&_?c.jsx(R_,{className:e}):c.jsxs("fieldset",{className:K("signup-form-fieldset",e),"data-testid":"signup-form",children:[f.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ie.FormattedMessage,{id:"signup_title"})}),B&&c.jsx(Qt,{variant:"error",text:u.formatMessage({id:"signup_error"})}),c.jsx(Xt,{className:"signup-form",formRef:z.form,id:"sign-up-form",fields:O,intlPath:"signup",button:{variant:"primary",size:"medium",text:a||u.formatMessage({id:"signup_button_join"}),disabled:A?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:l,"data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:u.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:f.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await N_({refs:z,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:v,state:b})},onCatch:F=>{r.handleError(F),v([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:z.hiddenValidation})]})};const kn=({children:e,className:t="",styling:n={},...r})=>{const{background:i="default",padding:a="none"}=n;return c.jsx("section",{className:K("full-width-section",t,{[i]:i!=="default",[a]:a!=="none"}),...r,children:e})};const z_=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(i=>{r.push({href:i.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable new","data-gtm-event-type":"download-click","data-gtm-event-context":i.eventContext||"Download",target:"_blank",children:i.text})}),c.jsx(kn,{className:K("download-section",n),styling:{background:"dark"},children:c.jsxs("div",{className:"content-default",children:[x.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(vr,{buttons:r})]})})};const mo="editSection_";function gh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const q_=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:i,setShowModal:a})=>{const{formatMessage:s}=ie.useIntl();return c.jsxs(_t,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${mo}placeholder_description`})}),i&&c.jsx("p",{children:c.jsx(we,{href:r,variant:"secondary",size:"small",onClick:()=>gh({href:r,setShowModal:a}),children:n||s({id:`${mo}placeholder_cta`})})})]})},U_=({children:e,className:t="",formProps:n,formComponent:r,href:i,title:a,showTitle:s=!0,modalTitle:o,placeholder:u,showDivider:l=!0})=>{const{formatMessage:d}=ie.useIntl(),[h,m]=x.useState(!1),p=()=>m(!1),g=!!n||!!r,f=typeof i=="string"||g;let b;return r&&(b=x.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{p()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),p()}}})),c.jsxs("section",{className:K("edit-section",t),children:[g&&c.jsx(ln,{title:o||`Edit ${a}`,isOpen:h,showDivider:!1,showIcon:!1,functions:{onClose:p},className:K("edit-section-modal"),children:b||(n?c.jsx(Xt,{...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 y,C;(y=n==null?void 0:n.functions)!=null&&y.onSuccess&&await((C=n==null?void 0:n.functions)==null?void 0:C.onSuccess(v)),m(!1)},onCancel:p}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:K("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:a}),f&&c.jsx(we,{href:i,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>gh({href:i,setShowModal:m}),children:d({id:`${mo}edit`})})]}),e||c.jsx(q_,{...u,href:i,setShowModal:m,showEditButton:f}),l&&c.jsx(zt,{})]})};const W_=({title:e=!1,text:t,logos:n=[],styling:r={},className:i=""})=>{const a=n.length;if(a===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:u="center",display:l="block"}=r;return c.jsxs("div",{className:K("logos",i,`align-${u}`,{[l]:l!=="block","wrap-logos":o}),children:[e&&x.createElement(s.element,{className:K("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:K({"two-col":a===2||a===4,"three-col":a===5||a<=10&&a%3===0}),children:n.map(({logo:d,nameOfBusiness:h,link:m=!1,description:p=!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:h});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:m?c.jsx("a",{href:m,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),p&&c.jsx("small",{children:p})]},window.btoa(`${d.url}_${g}`))})})]})};let Cs;const Ds="contactFooter_",V_=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=x.useRef(null),[r,i]=x.useState(0),[a,s]=x.useState(!1),o=()=>{n.current&&i(n.current.clientHeight)},u=()=>{a||(s(!0),clearTimeout(Cs),Cs=setTimeout(()=>{o(),s(!1)},500))};return x.useEffect(()=>(o(),window.addEventListener("resize",u),()=>{clearTimeout(Cs),window.removeEventListener("resize",u)}),[]),c.jsx(kn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ie.FormattedMessage,{id:`${Ds}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:a?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(ie.FormattedMessage,{id:`${Ds}text`})}),c.jsx(Dn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ie.FormattedMessage,{id:`${Ds}email`})})]}),c.jsx(dh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},H_=({activeLink:e,profile:t,...n})=>c.jsx(kn,{children:c.jsx(jf,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(Sf,{activeLink:e,profile:t}),c.jsx(Yd,{...n})]})})});const Es="cookieBanner_",_s=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],ks=new Date(Date.now()+12*30*24*60*60*1e3),vh=()=>{const e=ie.useIntl(),[t,n,r]=ho.useCookies(_s),[i,a]=x.useState(!t["apol-cookie-banner"]),s=()=>{_s.forEach(d=>{n(d,!0,{path:"/",expires:ks,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),a(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:ks}),_s.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:ks});return}r(d)}),a(!1)};if(!i)return null;const u=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],l=[];return u.forEach(d=>{l.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:`${Es}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${Es}title`})}),c.jsx("p",{children:e.formatMessage({id:`${Es}text`})}),c.jsx(vr,{buttons:l})]})},nn={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:Qn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Qn["data-protection"].eu,gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["london","washington","berlin","registered","support","business"],london:{address:!0},washington:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:Qn.support,gtmType:"concierge-email-click"},business:{email:Qn.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 rr="footer_",ua="SiteFooter",dd=({group:e})=>{const t=nn[e].order||[];let n=!1;return"text"in nn[e]&&(n=nn[e].text),c.jsxs(x.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ie.FormattedMessage,{id:`${rr}${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:i,gtmType:a}=nn[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:i,className:"gtm-trackable","data-gtm-event-context":ua,"data-gtm-event-type":a,...s,children:c.jsx(ie.FormattedMessage,{id:`${rr}${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(x.Fragment,{children:[c.jsx("dt",{children:c.jsx(ie.FormattedMessage,{id:`${rr}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ie.FormattedMessage,{id:`${rr}${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":ua,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},gu=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(fa,{element:"hr"}),c.jsx(Lo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":ua,"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(dd,{group:e}),Object.keys(nn[e]).includes("child")&&c.jsx(dd,{group:nn[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(nn.social.order)&&nn.social.order.map(e=>{const t=nn.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":ua,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ie.FormattedMessage,{id:`${rr}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ie.FormattedMessage,{id:`${rr}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Ue={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=a=>{const s=`logged${e?"In":"Out"}`;return t>=n[a][s]};let i={};return["navigation","search"].forEach(a=>{i[a]=r(a)}),i},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(i=>i===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:i=!1})=>{if(!i&&n[e]===t||!i&&e===Et.ACCOUNT&&t===!1&&n[Et.SITE]===!0)return;const a=Date.now();if(!i&&!t&&Ue.handlerCalled[e]&&a-Ue.handlerCalled[e]<500)return;Ue.handlerCalled[e]=a;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 Et.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case Et.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case Et.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 i=vd(e[r],t);if(!(typeof i>"u")&&(!n||i[t]&&i[t].includes(n)||i.value&&i.value.includes(n)||i.toString().includes(n)))return e[r]}return e[0].children?Ue.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:i})=>{var u;if(!t.current||!t.current.children)return;const a=n?"desktop":"default";if(r[e][a]){(u=document.querySelector(`#header ul a[href="${r[e][a]}"]:last-child`))==null||u.focus();return}let s,o;switch(e){case Et.SITE:if(n){const l=Ue.findFirstChild(t.current.children,"className","has-submenu parent"),d=Ue.findFirstChild(l.children,"id",Et.SITE);s=Ue.findFirstChild(d.children,"href")}else s=Ue.findFirstChild(t.current.children,"href");break;case Et.ACCOUNT:if(o=Ue.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Ue.findFirstChild(o.children,"href");break;default:return}s&&(i([{type:`focusElements.${e}.${a}`,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(Ue.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Ue.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Ue.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Ue.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},ri={order:["home","communities","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},communities:{href:"/communities/",gtmType:"communities-click",onlyShow:"logged-in"},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:"/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},la=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:a=null})=>{const s=ie.useIntl(),o=vd(ri,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const u="doTrack"in o,l=a===null?u?o.doTrack:!0:a,d=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let m=!1;if(o.href){let C=o.gtmType||`${e}-click`;if(C.includes(".")){const k=C.split("."),D=k[k.length-2];C=`${D==="topics"?`${D}-`:""}${k[k.length-1]}`}m={href:o.withReturnTo?`${o.href}?returnTo=${window.location.pathname}`:o.href},l&&(m={...m,className:"gtm-trackable","data-gtm-event-type":C,"data-gtm-event-context":"HeaderButtons"}),d&&(m={...m,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],g=p&&o[o.order[0]].order,f=m&&window.location.pathname===o.href;let b={},v={},y={};if(f&&(b={...b,"aria-current":"page"}),p){const C=o.menuId||e,k={onClick:D=>Ue.events.onClick(D,{id:C,callback:i,isOpen:r[C]}),onFocus:()=>Ue.events.onFocus({id:C}),onBlur:()=>Ue.events.onBlur({id:C,callback:i}),onMouseLeave:()=>Ue.events.onBlur({id:C,callback:i}),onMouseEnter:()=>Ue.events.onMouseEnter({id:C,callback:i})};v={...k,id:C===Et.SITE?Et.SITE:Et.ACCOUNT},n&&(g&&(y={...k,className:"navigation-button",onKeyPress:D=>{D.key==="Enter"&&Ue.events.onClick(D,{id:C,callback:i,isOpen:r[C]})},"aria-haspopup":!0,"aria-expanded":r[C],"aria-controls":C}),v={...v,hidden:C in r?!r[C]:!0}),g||(v={...v})}return c.jsxs("li",{className:K({[o.className]:o.className,"has-submenu":p,parent:g,active:f}),...b,children:[m?x.createElement(d?we:"a",m,s.formatMessage({id:h})):n&&o.order&&g?c.jsxs("button",{...y,children:[s.formatMessage({id:h}),c.jsx(Oe,{children:s.formatMessage({id:`header_menu_${r[Et.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:h}),o.order&&c.jsx("ul",{...v,children:o.order.map(C=>{if(!o[C])return null;const k={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:u?l:null};return o[C].order?c.jsxs("li",{className:K({[o[C].className]:o[C].className}),children:[s.formatMessage({id:`${h}_${C}`}),c.jsx("ul",{children:o[C].order.map(D=>c.jsx(la,{id:`${e}.${C}.${D}`,...k},D))})]},C):c.jsx(la,{id:`${e}.${C}`,...k},C)})})]},e)};const K_=({headerIsVisible:e})=>{const t=ie.useIntl();return c.jsx("div",{id:"language-unavailable-message",className:K({visible:e}),children:c.jsx("p",{className:"text",children:t.formatMessage({id:"header_language_unavailable"},{link:n=>c.jsx("a",{href:"/home",children:n})})})})};const Fs={height:67,height_desktop:83,additional_message_height:40};var Et=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(Et||{});const vu=({showNavigation:e=!0,showLanguageUnavailableMessage:t=!1,showLanguageSwitcher:n=!1,functions:{onLanguageSwitcherClick:r}={}})=>{const i=ie.useIntl(),a=x.useContext(rt),s=wn(!0,!0),o=a&&typeof a.id=="string",u=x.useMemo(()=>Ue.getIsDesktopVersion(o,s),[o,s]),[l,d]=x.useReducer(pr,{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:h,menus:m,focusElements:p}=l,g=x.useRef(l);x.useEffect(()=>{g.current=l},[l]),Dd({scrollPosition:t?Fs[`height${u.navigation?"_desktop":""}`]+Fs.additional_message_height:Fs[`height${u.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const D=g.current.menus;!u&&D["site-navigation"]||Ue.shouldChangeHeaderIsVisible(!0,D,d)},scrollDown:()=>{const D=g.current.menus;!u&&D["site-navigation"]||Ue.shouldChangeHeaderIsVisible(!1,D,d)}}});const f=(D,_,B=!1)=>{Ue.handleMenus({id:D,value:_,menus:g.current.menus,dispatch:d,forceHandle:B})},b=x.useRef(null),v=D=>{D.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(_=>{g.current.menus[_]&&f(_,!1,!0)})};x.useEffect(()=>{var D;return(D=document.getElementById("header"))==null||D.addEventListener("keydown",v),()=>{var _;(_=document.getElementById("header"))==null||_.removeEventListener("keydown",v)}},[]),or(()=>{m["site-navigation"]&&Ue.autoFocus({menu:"site-navigation",navigationRef:b,isDesktopVersion:u.navigation,focusElements:p,dispatch:d})},[m["site-navigation"]]),or(()=>{m["account-navigation"]&&Ue.autoFocus({menu:"account-navigation",navigationRef:b,isDesktopVersion:u.navigation,focusElements:p,dispatch:d})},[m["account-navigation"]]);const y=c.jsxs(c.Fragment,{children:[!u.search&&c.jsx("button",{className:"search toggle-search-button",onClick:D=>{D.preventDefault(),D.stopPropagation(),f("search",!m.search)},children:c.jsx(Oe,{children:i.formatMessage({id:`header_search_${m.search?"hide":"show"}`})})}),c.jsx(ph,{id:"global-search",handleToggle:{searchIsOpen:m.search,isDesktopVersion:u.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),C=c.jsx("button",{className:"earth icon language-switcher-button",onClick:D=>{D.preventDefault(),D.stopPropagation(),r&&r()},children:c.jsx(Oe,{children:i.formatMessage({id:"header_language_switcher"})})}),k=c.jsxs(c.Fragment,{children:[!u.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:D=>{D.preventDefault(),D.stopPropagation(),f("site-navigation",!m["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":m["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Oe,{children:i.formatMessage({id:`header_menu_${m["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:b,id:"navigation",hidden:u.navigation||m["account-navigation"]?!1:!m["site-navigation"],"data-showing":!u.navigation&&m["account-navigation"]?"account":"default",children:ri.order.map(D=>c.jsx(la,{id:D,isLoggedIn:o,isDesktopVersion:u.navigation,menus:{"site-navigation":m["site-navigation"],"account-navigation":m["account-navigation"]},callback:f},D))})]});return a&&a.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:K({"logged-in":o,"logged-out":!o,visible:h}),children:[c.jsx(Oe,{element:"a",href:"#content-of-page",children:i.formatMessage({id:"header_skip"})}),c.jsx(Lo,{variant:"monochrome"}),e?c.jsxs(c.Fragment,{children:[u.navigation?c.jsxs(c.Fragment,{children:[k,y,n&&C]}):c.jsxs(c.Fragment,{children:[y,n&&C,k]}),o?c.jsxs("button",{className:"account-button",onClick:D=>Ue.events.onClick(D,{id:"account-navigation",callback:f,isOpen:m["account-navigation"]}),onMouseEnter:()=>Ue.events.onMouseEnter({id:"account-navigation",callback:f}),onMouseLeave:()=>Ue.events.onBlur({id:"account-navigation",callback:f}),"aria-haspopup":"true","aria-expanded":m["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Oe,{children:i.formatMessage({id:`header_account_${m["account-navigation"]?"hide":"show"}`})}),c.jsx(un,{name:a&&a.name||"",src:a&&a.image&&a.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:ri.buttons.order.map(D=>c.jsx(la,{id:`buttons.${D}`},D))})]}):n&&C]}),t&&c.jsx(K_,{headerIsVisible:h}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:K("overlay",{open:m["site-navigation"]||m["account-navigation"]||!u.search&&m.search})})]})};const Z_=()=>{const e=ie.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(vu,{}),c.jsx("div",{id:"content",children:c.jsx(Qt,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(gu,{})]})},bh=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:a={},className:s="",locale:o="en"})=>{const u=ie.useIntl(),{navigation:l=!0,footer:d=!0,unavailableLanguageMessage:h=!1,languageSwitcher:m=!1}=i,{background:p="default",variant:g="default",circle:f="default",modal:b="default"}=a,v=wd(),[y,C]=x.useState(""),k=P=>{const{detail:{message:z}}=P;C(z)};x.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",k),()=>{document.removeEventListener("ariaLive",k)}),[v]);const D=Oi(e,{locale:o}),_=Oi(t,{locale:o}),B=Oi(n,{locale:o}),M={};return p!=="default"&&(M[p]=!0),g!=="default"&&(M[g]=!0),f!=="default"&&(M[f]=!0),c.jsx(Lh.ErrorBoundary,{onError:r,fallback:c.jsx(Z_,{}),children:c.jsxs(x.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:K(s,M,{"has-footer":d}),"data-too-small":u.formatMessage({id:"pageLayout_browserTooSmall"}),children:[c.jsx(vu,{showNavigation:l,showLanguageUnavailableMessage:h,showLanguageSwitcher:m}),c.jsxs("main",{id:"content-wrapper",children:[_&&c.jsx("div",{className:K("additional-content prepended",{"large-modal":b==="large"}),children:_}),x.createElement(p==="bold"?ko:"div",{id:"content",children:D,className:K({"large-modal":b==="large"})})]}),B&&c.jsx("div",{className:"additional-content appended",children:B}),d&&c.jsx(gu,{}),c.jsx(vh,{})]}),y&&c.jsx(Oe,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:y})]})})},fd={default:"tags_",headerTopics:"header_topics_topics_"},As={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"},Y_={getTagDetails:e=>{if(e.includes("topic_")){if(e=As.topic[e.replace("topic_","")],e){const t=ri.topics.topics[e].href;return t?{id:e,href:t,text:`${fd.headerTopics}${e}`}:null}return null}return As[e]?(e=As[e],{id:e,text:`${fd.default}${e}`}):null}};const G_=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:a="tag-click",gtmContext:s="tags"})=>{const o=ie.useIntl();if(!e||e.length<1)return null;const u=[];return e.forEach(l=>{if(!l)return;const d=Y_.getTagDetails(l);d&&u.push(d)}),u.length<1?null:c.jsx("ul",{className:K("tags text-small",t,i,{"one-line":n}),children:u.map(l=>{const d=o.formatMessage({id:l.text});return c.jsx("li",{children:l.href&&r?c.jsx("a",{href:l.href,className:"gtm-trackable","data-gtm-event-type":a,"data-gtm-event-context":s,children:d}):d},l.id)})})};const yh=25,Q_=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:i=!1,loadNextPage:a=()=>{},profile:s,gtmContext:o="member",gtmType:u="member-click",showHeader:l=!0,showPlaceholders:d=!1,className:h=""})=>{const m=ie.useIntl(),p="membersList",g=x.useContext(rt),[f,b]=x.useState(!1);return e.length===0&&!d?null:c.jsxs("div",{className:K("members-list",h),children:[l?c.jsxs("h1",{children:[m.formatMessage({id:p}),c.jsx("span",{className:"count",children:t})]}):c.jsx(c.Fragment,{}),c.jsxs("ul",{children:[r?c.jsxs("li",{children:[c.jsx(an,{member:g,gtmContext:o,gtmType:u,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:n||""},{scope:ut.Platform,area:"all"}]}}),c.jsx(Dn,{href:"/profiles/me",className:"text-small",onClick:v=>{v==null||v.preventDefault(),v==null||v.stopPropagation(),b(!0)},children:m.formatMessage({id:`${p}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((v,y)=>g&&v.id===g.id?c.jsx(c.Fragment,{}):c.jsxs("li",{children:[c.jsx(an,{member:v,gtmContext:o,gtmType:u,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:n||""},{scope:ut.Platform,area:"all"}]}}),v.isAdmin&&c.jsx(Yt,{children:m.formatMessage({id:`${p}_admin`})})]},y)),d&&e.length===0&&t>0?[...new Array(Math.min(t,yh))].map((v,y)=>c.jsx("li",{children:c.jsx(ga,{layout:"member"})},y)):c.jsx(c.Fragment,{})]}),i&&c.jsx(ii,{hasNextPage:i,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(Fa,{form:s,showModal:f,content:{title:m.formatMessage({id:`${p}_modal_title`})},functions:{onClose:()=>{b(!1)}}}):c.jsx(c.Fragment,{})]})},xh=Q_,J_=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const i=ie.useIntl();return t?c.jsx("small",{children:Rt(i.formatMessage,`${e}explainer`,n,"action",{a:a=>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:a})})}):c.jsx(c.Fragment,{})},X_=({intlPath:e,type:t,...n})=>{const r=ie.useIntl();return c.jsx(sa,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:Rt(r.formatMessage,`${e}label_action`,t,"action")},...n})},md=5,hd=2,ek=e=>{var r;let t=0;const n=[];return(r=e==null?void 0:e["poll-options"])==null||r.forEach((i,a)=>{i!==""&&(t++,n.push({position:t,description:{en:i}}))}),{title:{en:e.title},options:n,settings:{allow_multiple_votes:e["multiple-answers"]||!1}}};let Gn=null;const Qe="discussion_form_",oi=({id:e,parentId:t,content:n={type:Te.Response,slugs:{}},userHasPermissions:r=!0,meta:i,placeholder:a,maxLength:s=0,buttons:o,forceShow:u={cancel:!1,error:!1},functions:l,data:d={},gtmContext:h="DiscussionForm"})=>{var G,se,be;const m=ie.useIntl(),p=x.useContext(rt),[g,f]=x.useState(n.type),[b,v]=x.useState(""),{isLoading:y=!1,isInWrapper:C=!1,isInOverlay:k=!1,isAutoFocused:D=!1,isEditing:_=!1,hasTitleField:B=!1,canBePrepopulated:M=!1,isPrepopulated:P=!1,showTitle:z=!1,showGuidelines:O=!0,showDivider:A=!1,showSuccessMessage:F=!0,showPostType:S=!1,postCategories:I=[]}=i||{},{onChange:H=()=>{},create:V=()=>{},createPoll:ae=()=>Promise,handleSaveEdit:ne=()=>{},handleCancel:E=()=>{},callback:Y=()=>{},onMention:q=()=>{},listMembers:T=()=>Promise.resolve([]),clickMentionFallback:j=()=>{},getLinkPreview:R=()=>Promise.resolve({}),props:N={create:{projectNames:["questions-answers"]}}}=l,[U,X]=x.useState({body:_&&_.text||P&&P.text||"",data:d!=null&&d.link?{link:d==null?void 0:d.link}:{}}),[W,te]=x.useState(u.error||!1),de={status:!1,title:B&&B.text||"",polls:0},[J,ve]=x.useState(de);x.useEffect(()=>{M&&!_&&P&&P!==U.body&&X(oe=>({...oe,body:P.text||""}))},[P]),x.useEffect(()=>{f(n.type)},[n.type]);const me=Wr((oe,ce)=>{X(Fe=>({...Fe,body:oe,data:{link:ce}})),H({body:oe});let pe;!p||!p.id?pe=Rt(m.formatMessage,`${Qe}error_loggedOut`,g,"action"):r?s>0&&oe.length>=s&&(pe=`${Qe}error_tooLong`):pe=Rt(m.formatMessage,`${Qe}error_noPermission`,g,"action"),pe?te(pe):W&&te(!1)},50);let ye=`${g}-form`;if(g===Te.Response||g===Te.Reply){const oe=((G=n.slugs)==null?void 0:G.reply)||((se=n.slugs)==null?void 0:se.answer)||((be=n.slugs)==null?void 0:be.question)||"";oe&&(ye=`${ye}-${oe.slice(-15)}`)}e&&(ye=`${e}-${ye}`);const _e=async oe=>{if(!p||!p.id||!r||Ke)throw new Error("You do not have permission to post.");Gn&&clearTimeout(Gn),ve(pe=>({...pe,status:"submitting"}));const ce=window.location.pathname;try{let pe;switch(g){case Te.Post:pe=await V({title:oe.title,content:oe.body,categories:oe.postType,data:oe.data});break;case Te.Poll:pe=await ae(ek(oe));break;case Te.Question:pe=await V({title:oe.body,authorId:p&&p.id,data:oe.data,...N==null?void 0:N.create});break;case Te.Response:pe=await V({questionSlug:n.slugs.question},{body:oe.body,authorId:p&&p.id,contentPath:ce,data:oe.data});break;case Te.Reply:pe=await V({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:oe.body,authorId:p&&p.id,contentPath:ce,data:oe.data});break;default:break}return await np(1e3),Y&&await Y(pe),Gn=setTimeout(()=>{X({body:"",data:{}}),f(Te.Post),ve(qe=>({...qe,status:"submitted"})),v(Rt(m.formatMessage,`${Qe}success`,g,"action"));const Fe=new Event(it.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(Fe),De()},850),pe}catch(pe){const Fe=pe;let qe=`${Qe}error`;Fe!=null&&Fe.message.includes("entry already exists")&&(qe=Rt(m.formatMessage,`${Qe}error_alreadyExists`,g,"action")),Fe!=null&&Fe.message.includes("429")?qe=Rt(m.formatMessage,`${Qe}error_tooMany`,g,"action"):Fe!=null&&Fe.message.includes("400")&&(qe=`${Qe}error`),te(qe),De()}},De=()=>{Gn=setTimeout(()=>{te(!1),ve(de),v("")},5e3)},ze=Wr(async oe=>{const ce={...U,...oe};if(_){ve(pe=>({...pe,status:"submitting"})),ne(ce);return}try{if(!await _e(ce))throw Error("No response from handleSubmit")}catch{Gn&&clearTimeout(Gn)}},100);if(y)return c.jsx(Nt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const We=!U.body||!Kr(U.body),He=!J.title||!Kr(J.title);let Ke=!1;g!==Te.Poll&&(Ke=We),B&&(Ke=Ke&&He);const Be=J.status==="submitting",Me=[];g===Te.Poll?Me.push({id:"poll-options",label:m.formatMessage({id:`${Qe}option_label`}),type:"multiple-inputs",element:"textarea",placeholder:m.formatMessage({id:`${Qe}option_placeholder`}),limit:100,multipleInputs:{showCount:!0,defaultInputs:hd,maxInputs:md,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:m.formatMessage({id:`${Qe}option_cta`})}},styling:{autosizeToFit:!0},functions:{onChange:oe=>{var pe;let ce=0;oe&&Array.isArray(oe)&&(ce=((pe=oe==null?void 0:oe.filter(Fe=>Fe!==""))==null?void 0:pe.length)||0),J.polls!==ce&&ve(Fe=>({...Fe,polls:ce})),H({polls:oe})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:m.formatMessage({id:`${Qe}multiplePollAnswers`}),className:"text-medium"}):Me.push({component:X_,props:{formID:ye,intlPath:Qe,showLabel:B!==!1,type:g}},{component:pu,props:{id:`${ye}-input`,value:J.status==="submitting"&&!W?"":U.body,placeholder:a||Rt(m.formatMessage,`${Qe}placeholder`,g,"action"),maxLength:s,meta:{isInOverlay:k},functions:{onChange:me,onChangeData:oe=>{X(ce=>({...ce,data:oe}))},onMention:q,listMembers:T,clickMentionFallback:j,getLinkPreview:R},data:d,autoFocus:_!==!1||D&&!B,"aria-invalid":!!W,"aria-errormessage":"error-message"}},{component:J_,props:{intlPath:Qe,showGuidelines:O,type:g,gtmContext:h}}),A&&Me.push({component:zt}),B&&Me.unshift({id:"title",type:"textarea",value:B.text,limit:250,label:m.formatMessage({id:`${Qe}${g===Te.Poll?"question":"titleField"}_label`}),styling:{autosizeToFit:!0},placeholder:m.formatMessage({id:`${Qe}${g===Te.Poll?"question":"titleField"}_placeholder`}),functions:{onChange:oe=>{ve(ce=>({...ce,title:oe})),H({title:oe})}},validation:g===Te.Poll?[{condition:"required"}]:[]}),S&&Me.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:m.formatMessage({id:`${Qe}postType_label`}),options:I.map(oe=>({id:oe.slug,label:oe.name})),validation:[{condition:"required"}],functions:{onChange:oe=>{H({postType:oe}),oe.includes(Te.Poll)?f(Te.Poll):g!==Te.Post&&f(Te.Post)}}});let Ce=!p||!p.id||!r||Be;if(g===Te.Poll){const oe=J.polls;Ce=Ce||He||oe<hd||oe>md}else Ce=Ce||Ke,_&&(B?Ce=Ce||U.body===_.text&&J.title===B.text:Ce=Ce||U.body===_.text);return c.jsxs(c.Fragment,{children:[c.jsxs(Xt,{id:ye,className:K("discussion-card discussion-form",{"no-styling":C&&_}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:_&&!Be||u.cancel},functions:{onSuccess:async oe=>{await ze(oe)},onCancel:E},fields:Me,intlPath:Qe,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":h,"data-gtm-event-type":`${_?"save":"submit"}-${g}-click`,"data-testid":"save-button",disabled:Ce,text:{default:!_&&(o!=null&&o.submit)?o==null?void 0:o.submit:m.formatMessage({id:`${Qe}${_?"save":"post"}`}),submitting:m.formatMessage({id:`${Qe}${_?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":h,"data-gtm-event-type":`cancel-${g}-click`,disabled:!u.cancel&&(!p||!p.id||!U.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:m.formatMessage({id:`${Qe}cancel`})},gtm:{context:h,event:`${g}-form`},"data-testid":`discussion-${g}-form`,children:[z&&!_&&g===Te.Question&&c.jsx("h2",{children:Rt(m.formatMessage,`${Qe}title`,g,"action")}),c.jsx(an,{member:p?{...p,link:!1}:"community",gtmContext:h,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:t||""},{scope:ut.Platform,area:"all"}]}})]}),J.status==="submitted"&&F&&c.jsx(ur,{className:"success","data-testid":"success",children:Rt(m.formatMessage,`${Qe}success`,g,"action")}),W&&c.jsx(ur,{id:"error-message",className:"error","data-testid":"error",children:u.error?u.error:typeof W=="string"?W.includes(" ")?W:m.formatMessage({id:W},{action:m.formatMessage({id:`discussion_action_${g}`}),maxLength:s}):W}),b&&c.jsx(Oe,{"aria-live":"polite",showOnFocus:!1,children:b})]})},tk=Object.freeze(Object.defineProperty({__proto__:null,default:oi},Symbol.toStringTag,{value:"Module"}));const nk={showForm:!1},ka=x.createContext(nk),wh=({children:e})=>{const[t,n]=x.useState({showForm:!1});return c.jsx(ka.Provider,{value:{...t,updateConversation:n},children:e})};function rk({author:e,originalAuthorId:t,createdAt:n,contentData:r,content:i,gtmContext:a,badges:s}){var h;const o="discussion_",u=ie.useIntl(),l=(h=i==null?void 0:i.componentProps)==null?void 0:h.member.additionalContent,d=l?l.customMessage:void 0;return c.jsxs("div",{className:"author-section",children:[c.jsx(an,{member:e,additionalContent:{createdAt:n,didEdit:r.didEdit,customMessage:d},className:K({highlighted:typeof e!="string"&&e.id===t}),styling:{additionalContentNewLine:!!d},gtmContext:a,gtmType:"profile-click",badges:s}),i.pinned&&c.jsx(Yt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Oe,{children:u.formatMessage({id:`${o}pinned_post`})})})]})}const Ts=({children:e,class:t,...n})=>{const r={...n,class:K("subtle",t)};return c.jsx("blockquote",{...r,children:e})};function ik({content:e}){var t;return!e||!((t=e.categories)!=null&&t.length)?c.jsx(c.Fragment,{}):c.jsx("ul",{className:"categories-list",children:e.categories.map(n=>!n.slug||!n.name?c.jsx(c.Fragment,{}):c.jsx(Yt,{size:"small",element:"li",children:n.name},n.slug))})}var ca=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(ca||{});const ak=(e,t,n)=>n===void 0?0:e.some(i=>i.hasUserVoted)?t?e.findIndex(i=>!i.hasUserVoted):e.findIndex(i=>i.hasUserVoted):0,sk=(e,t,n,r=0)=>{if(!e)return{nextElement:null,nextIndex:0};let i=n==="next"?e.nextElementSibling:e.previousElementSibling,a=r+(n==="next"?1:-1);for(;i;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}const s=e.parentElement;if(s)for(i=n==="next"?s.firstElementChild:s.lastElementChild,a=n==="next"?0:s.childElementCount-1;i&&i!==e;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}return{nextElement:null,nextIndex:0}};const ok=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:i=!1,showResults:a=!1,hasVotedOnPoll:s=!1,isTabbable:o=!1,functions:u})=>{var b;const[l,d]=x.useState(t.hasUserVoted);let h=0,m={};const p=(i||!s)&&!t.hasUserVoted;a&&(h=Math.round(t.numVotes/r*100)||0,m={"--vote-perc":`${h}%`});const g=v=>{v.stopPropagation(),p&&(u==null||u.createVote(t),d(!0))},f={htmlFor:t.id,className:K({"can-vote":p}),tabIndex:o&&p?0:-1,"data-testid":"poll-option-label","data-gtm-event-type":"poll-option-click","data-gtm-event-context":"PollOption","aria-selected":t.hasUserVoted,onClick:g,onKeyDown:v=>{var y;if(v.code!=="Tab")switch(v.code){case"Enter":case"Space":v.preventDefault(),v.stopPropagation(),g(v),d(!0);break;case"ArrowUp":case"ArrowDown":v.stopPropagation(),v.preventDefault();const C=v.code==="ArrowUp"?"prev":"next",{nextElement:k,nextIndex:D}=sk(v.currentTarget.parentElement,"selected",C,n);k&&((y=k.querySelector("label"))==null||y.focus(),u==null||u.setTabbableOption(D));break}}};return c.jsxs("li",{"data-testid":"poll-option",style:m,className:K("poll-option text-small",{selected:t.hasUserVoted}),children:[c.jsx("label",{...f,children:c.jsx("span",{children:t.label})}),a&&c.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&c.jsx(un,{className:"author-profile-picture",name:e.name,src:(b=e==null?void 0:e.image)==null?void 0:b.thumbnail}),c.jsxs("p",{className:"vote-perc text-medium","data-testid":"vote-perc",children:[h,"%"]})]}),c.jsx("input",{type:i?"radio":"checkbox",id:t.id,name:t.id,checked:l,tabIndex:-1})]})};const Ch=({title:e,options:t,settings:n,functions:r})=>{const i="poll_",a=ie.useIntl(),s=x.useContext(rt),{showRemoveVote:o=!1,allowMultipleVotes:u=!1,resultsVisibility:l=ca.AfterVoting}=n||{},[d,h]=x.useState(ak(t,u,s==null?void 0:s.id)),m=t.reduce((v,y)=>v+y.numVotes,0),p=t.filter(v=>v.hasUserVoted).length,g=t.filter(v=>v.hasUserVoted),f=x.useCallback(async v=>{await r.createVote({reactionId:v.id})},[]),b=x.useCallback(async()=>{t.forEach(async v=>{v.hasUserVoted&&v.userVote&&r.removeVote({reactionId:v.userVote.id})})},[t]);return c.jsxs("div",{className:"poll-wrapper",children:[c.jsx("p",{className:"poll-title",children:e}),c.jsxs("aside",{className:"poll-info",children:[c.jsx("p",{className:"poll-instructions","data-testid":"poll-instructions",children:c.jsx("small",{children:a.formatMessage({id:`${i}instructions`},{allowMultipleVotes:u})})}),c.jsx("p",{className:"poll-num-votes",children:c.jsx("small",{"data-testid":"poll-total-votes",children:a.formatMessage({id:`${i}num_votes`},{number:m})})}),o&&c.jsx("p",{className:"poll-remove-vote",children:c.jsx(we,{variant:"tertiary",onClick:b,"data-testid":"remove-votes-button",disabled:p===0,children:c.jsx("small",{children:a.formatMessage({id:`${i}remove_vote_button`},{number:p})})})})]}),t&&c.jsx("form",{children:c.jsx("fieldset",{children:c.jsx("ul",{className:"poll-options",children:t==null?void 0:t.map((v,y)=>c.jsx(ok,{isTabbable:d===y,user:s,option:v,optionIndex:y,totalPollVotes:m,showResults:l==ca.Always||!!p,allowMultipleVotes:u,hasVotedOnPoll:!!p,functions:{createVote:f,setTabbableOption:h}},v.id))})})}),c.jsxs(Oe,{"aria-live":"polite",children:[a.formatMessage({id:`${i}aria_votes`},{number:p}),!!p&&c.jsx("ul",{children:g.map(v=>c.jsx("li",{children:v.label}))})]})]})};function uk({content:e,contentData:t,functions:n}){return c.jsx(Ch,{title:t.title,options:(e==null?void 0:e.pollOptions)||[],settings:(e==null?void 0:e.pollSettings)||{},functions:{createVote:n.createVote,removeVote:n.removeVote}})}function lk({links:e={},contentData:t,postCutOff:n,content:r}){var i;return c.jsxs(c.Fragment,{children:[e.post?c.jsxs("a",{href:e.post,children:[(t==null?void 0:t.title)&&c.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),t.postBody.length>n?c.jsx($d,{text:t.postBody,markdownOptions:{overrides:{a:Rs,blockquote:{component:Ts}}}}):c.jsx(On,{options:{overrides:{a:Rs,blockquote:{component:Ts}}},children:t.postBody})]}):c.jsxs(c.Fragment,{children:[(t==null?void 0:t.title)&&c.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),c.jsx(On,{options:{wrapper:r.type===Te.Question?"h1":x.Fragment,forceWrapper:r.type===Te.Question,forceInline:r.type===Te.Question,forceBlock:r.type!==Te.Question,overrides:{blockquote:{component:Ts}}},children:t.postBody})]}),(i=t.data)!=null&&i.link?c.jsx($o,{data:t.data.link}):c.jsx(c.Fragment,{})]})}const It="discussion_",ck=195;let Bi=null;const ui=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:i=!1,originalAuthorId:a,forceHide:s,functions:o,links:u={},className:l,gtmContext:d="DiscussionAnswer",children:h,isTruncated:m=!1,setFocus:p=!1,isCommunity:g=!1,badges:f,basePath:b,parentId:v,locale:y="en"})=>{var Me,Ce,G,se,be,oe;const C=ie.useIntl(),k=x.useContext(ka),D=x.useContext(rt),{createContent:_=async()=>{},deleteContent:B=async()=>{},updateContent:M=async()=>{}}=o.content||{},{createLike:P=()=>{},deleteLike:z=()=>{},listLikes:O=async()=>({})}=o.likes||{},{openComments:A=()=>{}}=o.comments||{},{listMembers:F=()=>Promise.resolve([]),clickMentionFallback:S=()=>{}}=o.form||{},{createVote:I=()=>{},removeVote:H=()=>{},removePoll:V=()=>{}}=o.polls||{},{author:ae,createdAt:ne,id:E,likes:Y=0,userLiked:q,comments:T=0,data:j}=t,R=yv(t.title,y),N=D&&D.id&&typeof ae!="string"&&ae.id&&ae.id===D.id||!1,U=N&&(!t.createdAt||ep(t.createdAt,10,"seconds")),X=x.useRef(null),[W,te]=x.useState({title:t.body!==R&&R||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[de,J]=x.useState(!1),[ve,me]=x.useState(U?"highlighted":"default"),[ye,_e]=x.useState("");x.useEffect(()=>{const ce=X.current;if(!(!ce||ve==="default"))return document.addEventListener(it.DISCUSSION_FORM_SUBMITTED,De),ce.addEventListener("transitionend",ze),()=>{document.removeEventListener(it.DISCUSSION_FORM_SUBMITTED,De),ce.removeEventListener("transitionend",ze)}},[]),x.useEffect(()=>{te(ce=>({...ce,title:t&&R||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),x.useEffect(()=>{(async()=>{const pe=await Io(W.body,m,j==null?void 0:j.mentions,F);te(Fe=>({...Fe,postBody:pe}))})()},[W.body,j==null?void 0:j.mentions]);const De=()=>{setTimeout(()=>{me("fading")},1e3)},ze=({propertyName:ce})=>{ce==="background-color"&&me(pe=>(pe==="default"&&(document.removeEventListener(it.DISCUSSION_FORM_SUBMITTED,De),X.current&&X.current.removeEventListener("transitionend",ze)),pe==="fading"?"default":pe))};if(i||!t||t.type===Te.Answer&&(!t.slugs||!t.slugs.question)||W.postBody===""&&t.title==="")return c.jsx(Nt,{className:"discussion-card"});const We=async({title:ce,body:pe,data:Fe})=>{ce||(ce=""),pe||(pe=""),_e("");try{if(!Wi(ce,W.title)||!Wi(pe,W.body)){const qe=t.type===Te.Question?{title:pe}:{title:ce,body:pe,data:Fe};await M(Us(t.slugs),qe)}te(qe=>({...qe,title:ce||"",body:pe||"",data:{...qe.data,...Fe},isEditing:!1,didEdit:!0}))}catch{_e(`${It}form_error`)}},He=()=>{if(k&&k.updateConversation){const ce={showForm:!0},pe=t.author;pe&&pe.id&&(g&&(ce.prepopulateForm=`@{{${pe.id}}}`),ce.mentionData={id:pe.id,name:pe.name}),k.updateConversation(ce)}setTimeout(()=>{var At,pt,tt;const pe=`reply-form-${(t.type===Te.Answer?t.slug:((At=t.slugs)==null?void 0:At.reply)||((pt=t.slugs)==null?void 0:pt.answer)||((tt=t.slugs)==null?void 0:tt.question)||"").toLowerCase().slice(-15)}`,Fe=document.getElementById(pe),qe=document.getElementById(`${pe}-input`);qe&&qe.focus(),Fe&&Fe.scrollIntoView({behavior:"smooth"})},0)},Ke=async()=>{J(!1);try{t.type===Te.Poll?(await V(),window.location.href=`${b}/${v}`):await B(Us(t.slugs))}catch{_e("delete-error")}},Be=[];return n&&N&&(t.type!==Te.Poll&&Be.push({text:C.formatMessage({id:`${It}moreMenu_edit`}),onClick:()=>te(ce=>({...ce,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),Be.push({text:C.formatMessage({id:`${It}moreMenu_delete`}),onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),J(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...hf(`delete-${t.slug}-modal`,de)})),r&&o.pins&&Be.push({text:C.formatMessage({id:`${It}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`}),p&&((Me=X==null?void 0:X.current)==null||Me.focus(),(Ce=X==null?void 0:X.current)==null||Ce.scrollIntoView({behavior:"smooth"})),x.createElement(e,{className:K("discussion-post",l,{[ve]:!l||!l.includes("highlighted-text-box"),"has-link":u.post&&!W.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:X,tabIndex:p?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:ce=>{if(!u.post||W.isEditing||t.type===Te.Poll&&bv(ce,["poll-options","poll-info"],"discussion-post"))return;ce.preventDefault(),ce.stopPropagation(),Bi&&clearTimeout(Bi),Bi=setTimeout(()=>{window.location.href=u.post},150);const pe=new CustomEvent(it.DISCUSSION_POST_CLICKED,{detail:{link:u.post,timeout:Bi}});document.dispatchEvent(pe)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:E||t.slug,className:K("discussion-card text-medium",t.type,{editing:W.isEditing,"has-link":u.post&&!W.isEditing}),children:[!W.isEditing&&c.jsx(rk,{author:ae,originalAuthorId:a,createdAt:ne,contentData:{didEdit:W.didEdit},content:t,gtmContext:d,badges:f}),W.isEditing?c.jsx(oi,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:i,isInWrapper:!0,hasTitleField:W.title!==""?{text:W.title}:!1,isEditing:{text:W.body,categories:[]},canBePrepopulated:g,isPrepopulated:!1},maxLength:t.type===Te.Question?250:5e4,forceShow:{error:ye!==""&&ye!=="delete-error"?C.formatMessage({id:ye},{action:C.formatMessage({id:`${It}action_${t.type}`})}):!1},functions:{create:_,handleSaveEdit:We,handleCancel:()=>{_e(""),te(ce=>({...ce,isEditing:!1}))},listMembers:F,clickMentionFallback:S},gtmContext:`${d}Form`,data:j}):c.jsxs(c.Fragment,{children:[t.type===Te.Poll?c.jsx(uk,{content:t,contentData:W,functions:{createVote:I,removeVote:H}}):c.jsx(lk,{links:u,contentData:W,postCutOff:ck,content:t}),c.jsx(ik,{content:t})]}),!W.isEditing&&!(s!=null&&s.actionBar)&&c.jsx(Tf,{className:t.type,gtmContext:d,contentType:t.type,likes:s!=null&&s.likes?!1:{count:Y||0,userLiked:q||!1,canLike:n??!0,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:P,deleteLike:z,listLikes:O},basePath:b,parentId:v},comments:!(s!=null&&s.comments)&&([Te.Question,Te.Post].includes(t.type)||u.comments)?{count:T||0,functions:{onClick:()=>{u!=null&&u.comments&&(window.location.href=u.comments),typeof A=="function"&&A()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{canReply:n??!0,functions:{onClick:He}}:!1,shareLink:{url:`${window.location.origin}${(G=t.slugs)==null?void 0:G.question}/${(se=t.slugs)==null?void 0:se.answer}${(be=t.slugs)!=null&&be.reply?`#${(oe=t.slugs)==null?void 0:oe.reply}`:""}`},moreMenu:{options:Be,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),h,c.jsx(ln,{id:`delete-${t.slug}-modal`,isOpen:de,functions:{onOpen:()=>{},onClose:()=>J(!1)},forceShow:{error:ye==="delete-error"?C.formatMessage({id:"${intlPath}delete_error"},{action:C.formatMessage({id:`${It}action_${t.type}`})}):!1},title:C.formatMessage({id:`${It}delete_title`},{action:C.formatMessage({id:`${It}action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>J(!1),children:C.formatMessage({id:`${It}delete_cancel`})},{variant:"primary",className:"destructive",onClick:Ke,children:C.formatMessage({id:`${It}delete_delete`})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:c.jsx(ie.FormattedMessage,{id:"discussion_delete_text",values:{p:ce=>c.jsx("p",{children:ce}),action:C.formatMessage({id:`${It}action_${t.type}`})}})})]})})};const dk=x.lazy(()=>Promise.resolve().then(()=>_k)),fk=65,Dh=({forceShow:e,form:t,className:n})=>{const r=ie.useIntl(),i="discussionFormCard_",a="DiscardDraftModal",o=x.useContext(rt)||"community",u=va(o);u.name||(u.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const l=wn(!0,!1),d=l?l<768:0,{modal:h=!1}=e||{},[m,p]=x.useState({form:h||Od("showPost")==="true"||!1,warning:!1}),[g,f]=x.useState({showCachedText:!1});x.useEffect(()=>{if(!g.showCachedText)return;(async()=>{const C=await Io(g.title||g.body||"",fk,g.mentions);f(k=>({...k,prettifiedText:C}))})()},[g.showCachedText,g.title,g.body]);const b=y=>{if(!g.showCachedText||typeof m.warning=="string")return;let C;if("detail"in y&&y.detail.link)y.detail.timeout&&clearTimeout(y.detail.timeout),C=y.detail.link;else{const k=y;k.preventDefault(),k.stopPropagation();const _=k.target.closest("a");C=_&&_.getAttribute("href")}p(k=>({...k,warning:C||!1}))};x.useEffect(()=>{if(!g.showCachedText){document.removeEventListener(it.DISCUSSION_POST_CLICKED,b),document.removeEventListener(it.MEMBER_CLICKED,b),document.removeEventListener("click",b);return}return document.addEventListener(it.DISCUSSION_POST_CLICKED,b),document.addEventListener(it.MEMBER_CLICKED,b),document.addEventListener("click",b),()=>{document.removeEventListener(it.DISCUSSION_POST_CLICKED,b),document.removeEventListener(it.MEMBER_CLICKED,b),document.removeEventListener("click",b)}},[g.showCachedText]),x.useEffect(()=>{const y=C=>{if(!(!g.showCachedText||m.warning!==!1))return C.preventDefault(),C.returnValue=""};return window.addEventListener("beforeunload",y,{capture:!0}),()=>{window.removeEventListener("beforeunload",y,{capture:!0})}},[g.showCachedText,m.warning]);let v=r.formatMessage({id:`${i}placeholder${d?"":"_long"}`});return g.showCachedText&&(g.title||g.body)&&(v=g.prettifiedText||v),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:K("discussion-form-card",n),onClick:y=>{y.preventDefault(),y.stopPropagation(),p(C=>({...C,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(un,{name:u.name,src:u.image,alt:""}),c.jsx(On,{className:K("input",{placeholder:!g.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:St,blockquote:St,br:St,em:St,li:St,ol:St,p:St,s:St,span:St,strong:St,ul:St}},children:v})]}),c.jsxs(br,{children:[c.jsx(dk,{showModal:m.form,functions:{cacheText:f,onClose:()=>{p(y=>({...y,form:!1}))}},form:t,cachedText:g,className:"in-portal"}),c.jsx(ln,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:m.warning!==!1,functions:{onClose:()=>{p(y=>({...y,warning:!1}))}},title:r.formatMessage({id:`${i}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${i}overlay_cta_discard`}),onClick:y=>{y.preventDefault(),y.stopPropagation(),typeof m.warning=="string"&&(window.location.href=m.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":a},{variant:"primary",children:r.formatMessage({id:`${i}overlay_cta_continue`}),onClick:()=>{p({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":a}],children:c.jsx("p",{children:r.formatMessage({id:`${i}overlay_text`})})})]})]})},mk=x.lazy(()=>Promise.resolve().then(()=>tk)),bu=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:i,required:a,join:s,leave:o,notMemberStateText:u},locale:l=Bo})=>{if(a&&!i)return c.jsx(Qt,{text:u,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(To,{isShort:!0,functions:{join:s,leave:o}})}});const{content:d,functions:h,meta:m,...p}=t,g={content:{type:(d==null?void 0:d.type)||"reply",slugs:(d==null?void 0:d.slugs)||{}},functions:{...h,create:(h==null?void 0:h.create)||(()=>{})},parentId:n,meta:{...m,isEditing:(m==null?void 0:m.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...p,id:`add-post-${p.id||""}`};return e?c.jsx(Dh,{form:g}):c.jsx(mk,{...g})},yu=({form:e})=>{const t=x.useContext(rt),n=ie.useIntl(),[r,i]=x.useState(!1),a=()=>{lp(t)||i(!0)};x.useEffect(()=>(document.addEventListener(it.DISCUSSION_POST_ADDED,a),()=>{document.removeEventListener(it.DISCUSSION_POST_ADDED,a)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(Fa,{form:e,showModal:r,functions:{onClose:()=>{i(!1)}},content:s})};const Bs="discussion_responses_",Eh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ie.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${Bs}title`},{action:r.formatMessage({id:`${Bs}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:Rt(r.formatMessage,`${Bs}empty`,e,e)})]})};const _h=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:i})=>{const a=ie.useIntl(),s=x.useContext(ka),o=Oi(i,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const u=r.data||{};u.mentions||(u.mentions={});const l=s.mentionData.id||"1";u.mentions[l]={created_at:"",updated_at:"",id:l,data:s.mentionData},r.data=u,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:K("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(ii,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:a.formatMessage({id:"discussion_thread_loadMore"}),error:a.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx(oi,{...r})]})};function hk(e){var n,r;let t=!1;return(r=(n=e.latest_reactions)==null?void 0:n["poll-option"])==null||r.forEach(i=>{var a,s;(s=(a=i.own_children)==null?void 0:a["poll-vote"])!=null&&s.length&&(t=!0)}),t}function pk({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=Re.useMutation({mutationFn:e,onMutate:({reactionId:o})=>t(u=>(gf({activity:u,reactionId:o,user:a}),u)),onError:n,onSuccess:(o,{reactionId:u},l)=>{l&&vf({activity:l,reactionId:u,correctReactionId:o.body.id,user:a}),r.setQueryData(i,l)}});return s}function gk({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Re.useMutation({mutationFn:e,onMutate:({content:i,title:a})=>t(s=>(s&&(i!=null&&(s.content=i),a!=null&&(s.title=a)),s)),onError:n});return r}function vk({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Re.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Qi({activity:o}),o)),onError:n,onSuccess:(s,o,u)=>{u&&Qi({activity:u,reaction:s}),r.setQueryData(i,u)}});return a}function bk({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Re.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ji({activity:o}),o)),onError:n,onSuccess:(s,o,u)=>{u&&Ji({activity:u,reaction:s}),r.setQueryData(i,u)}});return a}function yk({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,isFetching:a}=Re.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:i,isFetching:a}}function xk({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:({reactionId:a})=>t(s=>(bf({activity:s,reactionId:a}),s)),onError:n});return i}function wk({queryFns:{read:e,edit:t,like:n,unlike:r,pin:i,unpin:a,createVote:s,removeVote:o},queryKey:u}){const l=Re.useQueryClient(),d=pa(),h={queryClient:l,queryKey:u},m={mutationHandlers:{error:So(h),mutate:jo(h)},user:d,...h},p=gk({...m,mutationFn:t}),g=vk({...m,mutationFn:n}),f=Ck({...m,mutationFn:r}),b=bk({...m,mutationFn:i}),v=Dk({...m,mutationFn:a}),y=pk({...m,mutationFn:s}),C=xk({...m,mutationFn:o}),{activity:k,...D}=yk({queryKey:u,queryFn:e});return{activity:k,mutations:{edit:p,like:g,unlike:f,pin:b,unpin:v,createVote:y,removeVote:C},user:d,...D}}function Ck({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:a=>t(s=>(s&&yf({activity:s,user:r}),s)),onError:n});return i}function Dk({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Re.useMutation({mutationFn:e,onMutate:a=>(console.log("unpin"),t(s=>(s&&xf({activity:s,user:r}),s))),onError:n});return i}const Ek=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:i,functions:{activities:{remove:a,...s},likes:o,reactions:u,form:l,join:d,leave:h,polls:m},profile:p,categories:g,locale:f=Bo})=>{var q,T,j,R,N,U,X,W,te,de,J,ve;const b=ie.useIntl(),v={...s,...m},{activity:y,error:C,isLoading:k,mutations:{edit:D,like:_,unlike:B,pin:M,unpin:P,createVote:z,removeVote:O}}=wk({queryFns:v,queryKey:[e,t,n]});if(k)return c.jsx(Nt,{style:{height:"400px"}});if(C||!y)return c.jsx(Qt,{variant:"error",text:b.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:A,verb:F,latest_reactions:S,mentioned_users:I,additional_data:H}=y,V=(((q=S==null?void 0:S.like)==null?void 0:q.length)||0)>0,ae=(((T=A==null?void 0:A.like)==null?void 0:T.length)||0)>0,ne=ae?A==null?void 0:A.like[0].id:"",E=V?(j=S==null?void 0:S.like)==null?void 0:j.map(me=>{var ye,_e,De;return{id:(ye=me==null?void 0:me.user)==null?void 0:ye.id,name:(De=(_e=me==null?void 0:me.user)==null?void 0:_e.data)==null?void 0:De.name}}):!1,Y=y==null?void 0:y.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(ui,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:F,title:y==null?void 0:y.title,body:y==null?void 0:y.content,categories:Ro((y==null?void 0:y.categories)||[],g||[]),createdAt:(y==null?void 0:y.time)||"",slugs:{question:`${e}/${t}`,answer:y==null?void 0:y.id},slug:n,author:xr(Y),userLiked:ae,likes:((R=y==null?void 0:y.reaction_counts)==null?void 0:R.like)||0,comments:(y==null?void 0:y.total_replies)||0,peopleWhoLiked:E,data:{mentions:I,...H||{}},pinned:((N=y==null?void 0:y.reaction_counts)==null?void 0:N.pin)&&((U=y==null?void 0:y.reaction_counts)==null?void 0:U.pin)>0||!1,pollOptions:pf(y,f),pollSettings:{showRemoveVote:(X=y==null?void 0:y.settings)==null?void 0:X.show_remove_vote,allowMultipleVotes:(W=y==null?void 0:y.settings)==null?void 0:W.allow_multiple_votes,deadlineAt:(te=y==null?void 0:y.settings)==null?void 0:te.deadline_at,hideParticipants:(de=y==null?void 0:y.settings)==null?void 0:de.hide_participants,numberOfWinners:(J=y==null?void 0:y.settings)==null?void 0:J.number_of_winners,resultsVisibility:(ve=y==null?void 0:y.settings)==null?void 0:ve.results_visibility}},originalAuthorId:Y==null?void 0:Y.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(me,{title:ye,body:_e})=>D({title:ye,content:_e})},likes:{createLike:()=>_({activityId:n}),deleteLike:()=>B({activityId:n,reactionId:ne}),listLikes:me=>o.list({activityId:n,...me})},comments:{openComments:()=>{}},pins:{createPin:()=>M({activityId:n}),deletePin:()=>{var me;return P({activityId:n,reactionId:(me=S==null?void 0:S.pin)==null?void 0:me[0].id})}},polls:{createVote:({reactionId:me})=>z({reactionId:me}),removeVote:({reactionId:me})=>O({reactionId:me}),removePoll:()=>m.removePoll({activityId:n})},form:l},styling:{showShareLinkButton:!0},userHasPermissions:r,userHasOwnerPermissions:i,badges:{showBadges:!0,scopes:[{scope:ut.Communities,area:t||""},{scope:ut.Platform,area:"all"}]},basePath:e,parentId:t},n),c.jsx(_f,{basePath:e,parentId:t,activityId:n,showReplies:F===Te.Poll?hk(y):!0,activityTotalReplies:(y==null?void 0:y.total_replies)||0,isMember:r,functions:{reactions:u,likes:o,form:l,join:d,leave:h},profile:p})]})};const kh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:i})=>{const a=ie.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:u=()=>{}}=t,{data:l,meta:d,functions:h}=n,{title:m="",body:p="",mentions:g}=r||{},f="discussion-form-modal";return c.jsx(ln,{id:f,title:a.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(m!==""||p!=="")&&u(b=>({...b,showCachedText:!0})),o()}},className:K("discussion-form-modal",i),children:c.jsx(oi,{...n,data:{...l,mentions:g||(l==null?void 0:l.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:m},isPrepopulated:{text:p||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0,showPostType:!0},buttons:{submit:a.formatMessage({id:`${s}cta`})},functions:{...h,onChange:b=>{u(v=>({...v,...b}))},onMention:({id:b,name:v}={})=>{if(!b||!v)return;const y=g||{};y[b]={created_at:"",updated_at:"",id:b,data:{name:v}},u(C=>({...C,mentions:y}))},create:async b=>{o(),h.create&&await h.create(b),u({showCachedText:!1})},createPoll:async b=>{const v=()=>{o(),u({showCachedText:!1})};if(h.createPoll)try{const y=await h.createPoll(b);return new Promise(C=>(v(),C(y)))}catch{return new Promise((C,k)=>k())}else return v(),new Promise(y=>y({}))},handleSaveEdit:async b=>{o(),h.handleSaveEdit&&await h.handleSaveEdit(b),u({showCachedText:!1})}}})})},_k=Object.freeze(Object.defineProperty({__proto__:null,default:kh},Symbol.toStringTag,{value:"Module"}));const kk=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:i,formLabel:a,ctaMessage:s,showIcon:o,onClose:u,reportError:l=()=>{},sendInvites:d})=>{const h=ie.useIntl();return i||(i=h.formatMessage({id:"inviteModal_formTitle"})),a||(a=h.formatMessage({id:"inviteModal_formLabel"})),s||(s=h.formatMessage({id:"inviteModal_cta"})),c.jsx(ln,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:o,functions:{onClose:u},className:K("invite-modal",e,{success:!!n}),children:c.jsx(fh,{title:i,label:a,messagePlaceholder:r,ctaMessage:s,onClose:u,sendInvites:d,reportError:l})})};const Fk=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:i,form:a,className:s})=>{const o=ie.useIntl(),[u,l]=x.useState(Od("showProfile")==="true"||e);x.useEffect(()=>{l(e)},[e]);const{onClose:d=()=>{}}=i;return c.jsx(ln,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:u,showDivider:!t,functions:{onClose:d},className:K("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(mh,{...a,meta:{shouldShowCancelButton:!1},functions:{...(a==null?void 0:a.functions)||{},onSuccess:async h=>{var m;try{(m=a==null?void 0:a.functions)!=null&&m.onSuccess&&await a.functions.onSuccess(h)}finally{d()}}}})]})})},Fa=Fk,Ak=Object.freeze(Object.defineProperty({__proto__:null,default:Fa},Symbol.toStringTag,{value:"Module"}));const Tk=({members:e})=>{const[t,n]=x.useState(!1),r=i=>{const{fullName:a,jobTitle:s,organisation:o,photo:u}=i||{};return c.jsxs(c.Fragment,{children:[c.jsx(un,{name:a,src:u}),c.jsx("p",{children:a}),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(i=>c.jsx("li",{children:c.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),n(i)},children:r(i)})},i.fullName))}),c.jsx(ln,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(On,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const Bk=({email:e,settings:t={}})=>{const{formatMessage:n}=ie.useIntl(),r=x.useContext(rt),{myProfile:i,isConnected:a,cannotConnect:s}=t,[o,u]=x.useState(!1),[l,d]=x.useState(!1);return r?e&&i?c.jsx(we,{icon:{icon:"info-inside-circle",position:"right"},size:"small",variant:"secondary",styling:{muted:!0},tooltip:n({id:"member_show_email_tooltip_mine"}),forceTooltip:!0,className:"show-email fake-button",children:e}):s?c.jsx(we,{icon:"email",size:"small",variant:"secondary",styling:{muted:!0},tooltip:n({id:"member_show_email_tooltip_private"}),forceTooltip:!0,className:"show-email fake-button",children:n({id:"member_show_email_private"})}):a?e&&a?c.jsx(c.Fragment,{children:o?c.jsx(we,{icon:{icon:"copy",position:"right"},size:"small",variant:"secondary",styling:{muted:!0},className:"show-email copy-button",tooltip:n({id:`member_show_email_tooltip${l?"_copied":""}`}),forceTooltip:!0,"data-gtm-event-context":"connections-email-address-button","data-gtm-event-type":"copy-email-click",onClick:()=>{navigator.clipboard.writeText(e).then(()=>{d(!0),setTimeout(()=>{d(!1)},2e3)})},children:e}):c.jsx(we,{icon:"email",size:"small","data-gtm-event-context":"connections-email-address-button","data-gtm-event-type":"show-email-click",onClick:()=>u(!0),children:n({id:"member_show_email_show"})})}):c.jsx(c.Fragment,{}):c.jsx(we,{icon:"email",size:"small",variant:"secondary",styling:{muted:!0},className:"show-email fake-button",children:n({id:"member_show_email_hide"})}):c.jsx(c.Fragment,{})};const Sk=({author:e,authorCite:t,content:n,member:r,className:i=""})=>c.jsxs("blockquote",{className:K("testimonial-block",i),children:[c.jsx(Zt,{className:"testimonial",children:n}),r?c.jsx(an,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:K("author",{"text-small":!i.includes("new")}),children:e}),t&&c.jsx("p",{className:K("author-cite",{"text-small":!i.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),jk=x.memo(Sk);const Pk=({items:e=[],selector:t="",className:n=""})=>{const r=ie.useIntl(),[i,a]=x.useState(e);return x.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((l,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const u=Array.from(document.querySelectorAll(s)).filter(l=>l.id).map(l=>({id:l.id,text:l.textContent||""}));a(u)},[]),i&&i.length>0&&c.jsxs(_t,{variant:"subtle",className:K("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:i.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Aa=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:i=""})=>{const a=ie.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const h=d/60,m=Math.floor(h),p=(h-m)*60,g=Math.round(p),f=`${a.formatMessage({id:`${s}hours`},{time:m})}${m>0&&g>0?", ":""}${a.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${m>0?`${a.formatMessage({id:`${s}hours_short`},{time:m})} `:""}${g>0?a.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:u,ariaText:l}=o(e);if(t){const{text:d,ariaText:h}=o(e+t);u=a.formatMessage({id:`${s}range`},{early:u,late:d}),l=a.formatMessage({id:`${s}range_aria`},{early:l,late:h})}return n&&(l=`${n} ${l}`,u=`${n} ${u}`),r&&(l=`${l} ${r}`,u=`${u} ${r}`),c.jsx("span",{className:K("time-to-complete",i),"aria-label":l,children:u})};const Ok=({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(Cn,{...n,className:K("banner",e),image:{...t,aspect:"banner"}})):null;const Mk=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Nk=({className:e="",content:t,image:n,variant:r,spacing:i="normal",styling:a,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:u})=>{var g,f;const l={imageFullWidth:!0,...a};r||(r=l.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],h={eyebrow:"small",title:"h1",text:"p"},m={};d.forEach(b=>{if(!t[b]){m[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){m[b]=t[b];const{text:v,element:y}=t[b];if(y&&Mk.includes(y.toLowerCase()))return;m[b]={text:v,element:h[b]};return}m[b]={text:t[b],element:h[b]}}});const p=o&&o.text&&o.link;return p&&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(kn,{className:K("banner-section",r,i,e,{"has-image":n,"image-full-width":n&&l.imageFullWidth,"image-inline":n&&!l.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&i==="normal"&&m.eyebrow&&m.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(m[b]&&typeof m[b]=="object"){const{text:v,element:y=""}=m[b];return b==="text"?c.jsx(On,{overrideType:"text-only",className:"text",children:v},b):x.createElement(y,{key:b,className:b},v)}return null}),u,p&&c.jsx(we,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:K({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(Cn,{image:{...n,aspect:l.imageFullWidth?"banner":n.aspect||void 0}})]})})},Ik=x.memo(Nk);const Rk=({image:e,variant:t="default",children:n,className:r=""})=>{const i={};return e&&(i["--image"]=`url(${e})`),c.jsx(kn,{className:K("custom-content-banner",t,r,{"has-image":e}),style:i,children:c.jsx("div",{className:"content-slim",children:n})})};const $k=({alignImage:e="left",className:t,content:n,image:r})=>{const i=typeof n=="string"?c.jsx(On,{children:n}):n;return c.jsxs(kn,{className:K("highlight-section",t),children:[r&&c.jsx("div",{className:K("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(Cn,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),c.jsx("div",{className:K("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:K("highlight-content",{"highlight-content-right":e==="left"}),children:r?i:c.jsx("div",{className:"content-default",children:i})})})]})},Lk=x.memo($k);const zk=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!n&&!r?null:c.jsxs("aside",{className:K("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(we,{variant:t.variant||"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"learn-more-click",children:t.text})]}),qk=({type:e,data:t})=>{const n=ie.useIntl(),{answers:r,createdAt:i,dateHasPassed:a,isOngoingEvent:s,pill:o,readingTime:u,publishedDate:l,startDate:d}=t;if(e==="question"){const h=i&&Ms(i);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})]})]})}if(d&&!a||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):vo(d)});if(o)return c.jsx(Yt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(u||l){const h=l&&Ms(l);return c.jsxs("ul",{className:"details",children:[u&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:u})}),l&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})})]})}return null},Uk={title:66,text:3e3,secondaryText:1e3,partner:34},da={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"}},Wk=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const i=ie.useIntl(),[a,s]=x.useState({loading:!1,registered:e.registered||!1});x.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:u,dateHasPassed:l,pill:d,slug:h}=e,m=e.contentType;let p="";if((f=da[m])!=null&&f.gtmEvent&&(p=da[m].gtmEvent),u&&l)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||i.formatMessage({id:"card_watch"})}):null;if(m==="people")return n?c.jsx(we,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||i.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(m)&&d!=="premium"){const v=a.loading||a.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),y=async C=>{var k;if(C.preventDefault(),C.stopPropagation(),window&&((k=window.dataLayer)==null||k.push({event:"gtm.click","gtm.element":n,"gtm.elementClasses":"gtm-trackable","gtm.elementUrl":n,EventType:`${r}-${m}-register-click`,EventContext:`${r}Page-${m}: ${h}`})),!(v||!t||!t.onClick)){s(D=>({...D,loading:!0}));try{const D=await t.onClick(e);s(D==="success"?()=>({registered:!0,loading:!1}):_=>({..._,loading:!1}))}catch{s(_=>({..._,loading:!1}))}}};return c.jsx("p",{className:K("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(we,{onClick:y,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${m}: ${h}`,"data-gtm-event-type":`${r}-${m}-register-click`,"data-testid":"in-card-button",children:o||i.formatMessage({id:`card_cta_${m}${v?`_${a.loading?"loading":"done"}`:""}`})})})}return null};function Vk({buildMemberData:e,communitySlug:t}){const n=ie.useIntl(),r=x.useContext(rt),[i,a]=x.useState({count:"...",isMember:!1,memberType:""});return x.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(s=>{if(!s)return;const{membersCount:o,role:u="",pagination:l}=s;let d=0;o?d=o:l!=null&&l.total&&(d=l==null?void 0:l.total),a({count:d.toString(),isMember:!!u,memberType:u})})},[t,e]),c.jsxs("span",{className:"member-information",children:[i.isMember&&c.jsx(Yt,{size:"small",variant:"registered",icon:(i==null?void 0:i.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${i.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:i.count})})]})}const xu=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:i,cta:a,gtmContext:s="Carousel",handleCardClick:o,meta:u})=>{var F,S;const l=ie.useIntl(),d=x.useContext(rt),h=!!(d!=null&&d.id),{isTabbable:m=!0,setFocus:p=!1}=u||{},g=x.useRef(null),[f,b]=x.useState({data:null,isLoading:!0});x.useEffect(()=>{n(i,h).then(I=>{b({data:I,isLoading:!1})}).catch(()=>b(I=>({...I,isLoading:!1})))},[i,h,n]);const{data:v,isLoading:y}=f;if(y||!v)return c.jsx(Nt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!a&&(a={text:l.formatMessage({id:`card_cta_${i.contentType}`}),onClick:o});const{contentType:C}=v;if(!C||!da[C])return c.jsx(Nt,{element:"li",className:"card-wrapper"});const{basePath:k="",className:D,length:_,gtmEvent:B}=da[C];let M=m&&v.slug?`${k}${v.slug}`:!1;m&&v.slug&&(v.slug.slice(0,4)==="http"||v.slug.slice(0,2)==="//"||v.slug.slice(0,6)==="mailto"||v.slug.slice(0,3)==="tel")&&(M=v.slug);const P=I=>{if(M){I.preventDefault(),I.stopPropagation();const H=I.currentTarget.getAttribute("data-url");window&&window.dataLayer.push({event:"gtm.click","gtm.element":H,"gtm.elementClasses":"gtm-trackable","gtm.elementUrl":H,EventType:`${s}-CarouselCard`,EventContext:`${B}-click`}),window.location.href=H}},z={...Uk,..._};let O={className:"card"},A={};return M&&(A={href:M,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${B}-click`,"data-testid":"link"},v.openInNewTab&&(A.target="_blank"),O={onClick:P,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${B}-click`}),p&&(O={...O,tabIndex:"0"},(F=g==null?void 0:g.current)==null||F.focus(),(S=g==null?void 0:g.current)==null||S.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:K("card-wrapper text-medium",D,t,{"has-link":M,"no-link":!M,"has-image":v.banner}),"data-testid":`${C}-card`,children:c.jsxs("div",{...O,ref:g,"data-url":M,children:[c.jsx(Nd,{className:"card-label",contentType:C,customIcon:v.isPrivate?"lock-locked":v.customIcon,customLabel:v.customLabel}),C==="communityPage"&&(v==null?void 0:v.createdAt)&&tp(v==null?void 0:v.createdAt,60)&&c.jsx(Yt,{size:"small",variant:"information","data-testid":"new-community",children:l.formatMessage({id:"card_new"})}),v.startDate&&!v.isOngoingEvent&&c.jsx(Yt,{size:"small",variant:v.dateHasPassed?"default":"information","data-testid":"date",children:v.dateHasPassed?l.formatMessage({id:"card_ended"}):Sd(v.startDate)}),v.banner?c.jsxs("p",{className:"img",children:[v.registered&&c.jsx(Yt,{size:"small",variant:"registered",children:l.formatMessage({id:"card_registered"})}),c.jsx(Cn,{image:{...v.banner,description:""}})]}):D==="people"?c.jsx(un,{name:v.title||"",src:v.profile,"data-testid":"people-profile-picture"}):null,v.contributors&&c.jsx(_o,{contributors:{data:v.contributors},styling:{size:"small",showGap:D!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(C)?l.formatMessage({id:`card_contributors_${C}`}):void 0,"data-testid":"contributors"}),v.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:v.partner.length>1?l.formatMessage({id:"card_partner"},{partner:v.partner[0],number:v.partner.length-1}):sr(v.partner[0],z.partner)}),["title","text","secondaryText"].map(I=>{const H=v[I];if(!H)return null;const V=kd(I),ae={key:I,className:V,"data-testid":V},ne={wrapper:"p",forceWrapper:!0,forceInline:!0},E=sr(H,z[I]);return["title","text"].includes(I)&&M?(ne.wrapper="a",c.jsx("p",{...ae,children:c.jsx(Zt,{options:ne,...A,children:E})})):c.jsx(Zt,{options:ne,...ae,children:E})}),i.contentType==="communityPage"&&(i.slug||v.slug)&&r&&c.jsx(Vk,{communitySlug:i.slug||v.slug,buildMemberData:r}),c.jsx(qk,{type:D||"",data:v}),c.jsx(Wk,{data:v,cta:a,link:M||"",gtmContext:s})]})})};const Fh=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:K("card-block",n),children:e.map((i,a)=>{const s=i.slug?`${i.slug}-${t[a]}`:`${t[a]}-${a}`;return c.jsx(xu,{id:s,card:{...i,contentType:t[a]},meta:{setFocus:a===(r==null?void 0:r.focusCardIndex)},...r},s)})}),Hk=(e,t,n,r)=>{const i=t*n<=e,a=e<t*(n+1),s=r.includes(Math.floor(e/t));return{inView:i&&a,isLoaded:s}},Kk=({id:e,title:t})=>{const n=ie.useIntl();if(!t||!t.text)return null;const{text:r,element:i="h2",variant:a="default",size:s="medium",link:o}=t;return x.createElement(i,{className:K("title",a,s,{"highlighted-title":a==="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 Ss={fourCards:1024,threeCards:769,twoCards:480};let Si=null,js=null;const Zk=({id:e,cards:t,cardTypes:n,buildCardData:r,title:i,className:a,gtmContext:s,...o})=>{const u=ie.useIntl(),l="carousel_pagination_",[d,h]=x.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:m,isLoading:p}=d,[g,f]=x.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:v}=g,[y,C]=x.useState(""),k=t.length,D=Math.ceil(k/m),_=x.useRef(null),B=wn(!0,!0,_==null?void 0:_.current);x.useEffect(()=>{let F=1;B&&(B>=Ss.fourCards?F=4:B>=Ss.threeCards?F=3:B>=Ss.twoCards&&(F=2),F>k&&(F=k)),h(S=>({...S,cardsPerPage:F,isLoading:!1}))},[B,k]);const M=(F="next")=>{js&&clearTimeout(js);let S=b;if(typeof F=="string")if(F==="next")if(b<D-1)S=b+1;else return;else if(b>0)S=b-1;else return;else S=F;C(""),f(H=>({...H,currentPage:S,loadedPages:[...new Set([...v,S])]}));const I=()=>{const H=S*d.cardsPerPage,V=H+d.cardsPerPage;return t.slice(H,V).length};js=setTimeout(()=>{C(u.formatMessage({id:`${l}ariaLive${typeof F=="string"?"":"_slide"}`},{direction:u.formatMessage({id:`${l}${typeof F=="string"?F:"next"}`}),slide:typeof F=="string"?1:F+1,count:I()}))},500)},P=F=>{Si=F.touches[0].clientX},z=F=>{if(Si===null)return;const S=F.touches[0].clientX,I=Si-S;I>5?M("next"):I<-5&&M("previous"),Si=null},O={"--width":`${B||0}px`,"--total-cards":k,"--cards-per-page":m,"--page":b};if(p)return c.jsx(ga,{layout:`carousel${i?"-with-title":""}`});const A=(F,S)=>{var H;let I=null;return(H=F==null?void 0:F.sys)!=null&&H.id?I=`card-${F.sys.id}`:F!=null&&F.slug?I=`card-${F.slug}`:[n[S],F.contentType].includes("customCard")&&(I=`card-${window.btoa(`${F.title} ${F.createdAt}`)}-${S}`),I};return c.jsxs("section",{ref:_,className:K("carousel-wrapper",a),"data-testid":"carousel",children:[c.jsx(Kk,{id:e,title:i}),c.jsx("ul",{className:"carousel",onTouchStart:P,onTouchMove:z,style:O,"data-testid":"carousel-list",children:t.map((F,S)=>{let I=A(F,S);const{inView:H,isLoaded:V}=Hk(S,m,b,v);return I&&(H||V)?c.jsx(xu,{id:I,card:{...F,contentType:n[S]},buildCardData:r,gtmContext:s,meta:{isTabbable:H},...o},I):(I=I||`${e}-card-${S}`,c.jsx(Nt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},I))})}),D<=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(we,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:F=>{F.preventDefault(),F.stopPropagation(),M("previous")},screenreaderText:u.formatMessage({id:`${l}previousSlide`}),disabled:b<=0})}),[...Array(D)].map((F,S)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:K("page-indicator",{selected:S===b}),onClick:I=>{I.preventDefault(),I.stopPropagation(),M(S)},children:c.jsx(Oe,{showOnFocus:!1,children:u.formatMessage({id:`${l}slide`},{number:S+1,total:D})})})},`page-indicator-${S}`)),c.jsx("li",{className:"arrow next",children:c.jsx(we,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:F=>{F.preventDefault(),F.stopPropagation(),M("next")},screenreaderText:u.formatMessage({id:`${l}nextSlide`}),disabled:b>=D-1})})]}),c.jsx(Oe,{"aria-live":"polite",showOnFocus:!1,children:y})]})]})},Yk=({carousels:e=[],isLoading:t,title:n,className:r="",...i})=>!e||!e.length?null:e.map(({title:a,viewAllUrl:s,cards:o,cardsTypes:u},l)=>{const d=a?window.btoa(a):`carousel-${l}`,h=l===e.length-1;return t?c.jsxs(x.Fragment,{children:[c.jsx(ga,{layout:`carousel${a?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:c.jsx(zt,{})]},`placeholder-${d}`):c.jsxs(x.Fragment,{children:[c.jsx(Zk,{cards:o,cardTypes:u,title:n!=null&&n.hidden?{}:{...n,text:a,link:s},...i}),h?null:c.jsx(zt,{})]},`carousel-${d}`)});const Gk=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:i,title:a,text:s,isPrivate:o,slug:u}=n;let l={};return u&&(l={onClick:h=>{u&&(h.preventDefault(),h.stopPropagation(),window.location.href=u)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),x.createElement(e,{className:K("narrow-card",t,{"has-link":u,"gtm-trackable":u,"no-link":!u}),...l,children:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:K("img",{private:o,"no-image":!i}),children:i&&c.jsx(Cn,{image:i})}),c.jsxs("div",{className:"content",children:[a&&c.jsx("p",{className:"title text-medium",children:a}),s&&c.jsx("p",{className:"text text-medium",children:s})]})]})})};const Qk=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:i=!0},graph:a,styling:s={},className:o=""})=>{const u=ie.useIntl();let l=i?n:r;l>99?l=100:l<1&&(l=0);const{highlightPercentage:d=!1}=s;return x.createElement(e,{className:K("course-progression",o,{"highlight-percentage":d,"has-circle-graph":a==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:u.formatMessage({id:"courseProgression_done"},{percent:h=>c.jsx("strong",{children:h}),number:l})}),l<100&&i&&c.jsx(Aa,{time:t,appendedText:u.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(Eo,{progress:l,styling:{layout:a||"bar",size:a&&a==="circle"?"small":"default"}})]})})};const Ah=({element:e="span",sectionId:t,subsectionId:n,title:r,className:i=""})=>x.createElement(e,{className:K("lesson-name",i),"data-number":`${t}.${n}`,children:r});const Th=({size:e="default",completionTime:t,icon:n,optional:r,type:i,children:a})=>{const s=ie.useIntl(),o=ma(`lessonType_${i}`)?s.formatMessage({id:`lessonType_${i}`}):Ad(i||"");return c.jsxs("small",{className:K("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:K("type",n),children:o})," ",t>0&&!r&&c.jsx(Aa,{time:t})," ",a?c.jsx("span",{className:"additional",children:a}):null]})};const Jk=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:i,sectionId:a,sectionTime:s,slug:o,timeLeft:u,title:l},quizScores:d})=>{const h=ie.useIntl(),m="courseStructure_",p=l.toLowerCase().includes("course conclusion");return c.jsxs(ha,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[h.formatMessage({id:`${m}section${p?"_end":""}`},{number:a})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:i&&u===0?h.formatMessage({id:`${m}time_completed`}):c.jsx(Aa,{time:s,appendedText:i?h.formatMessage({id:`${m}time_left`}):""})})]}),c.jsx("h3",{children:l})]}),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:y,isIntroduction:C,optional:k,slug:D,subsectionId:_,title:B,type:M})=>{const P=i&&t||C,z={};return y&&(z.style={"--image":`url(${y})`}),c.jsx("li",{className:K({article:b===jr.ARTICLE,discussion:b===jr.DISCUSSION,quiz:b===jr.QUIZ,completed:g&&b===jr.ARTICLE,locked:!P}),...z,children:c.jsx(Dn,{href:P?`/microcourses/en/${o}/${D}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Fd(B)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(Ah,{sectionId:a,subsectionId:_,title:B,className:"course-title"})," ",c.jsx(Th,{completionTime:f,icon:v,optional:k,type:M,children:d&&d[D]&&c.jsx("span",{className:"quiz-score",children:`${d[D]}%`})})]})})},D)})})]})};const Xk=({isComplete:e=!1,onClick:t,...n})=>{const r=ie.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(we,{...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:K("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},eF=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),pd=[{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 ji="notFoundError_",tF=()=>{const e=ie.useIntl(),t=[];return pd.forEach((n,r)=>{n.title=e.formatMessage({id:`${ji}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(bh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(kn,{children:[c.jsx(Fh,{cards:pd,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),c.jsx(we,{href:"/solution-articles/",children:e.formatMessage({id:`${ji}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${ji}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ji}text`})})]})};exports.ASSETS_URL=Gt;exports.ActionBar=Tf;exports.ActionButton=Zr;exports.ActivitiesFeed=xv;exports.ActivitySection=Ek;exports.ActivityType=yr;exports.AddPost=bu;exports.Badge=Gd;exports.BadgeScope=ut;exports.Badges=Qd;exports.BadgesContext=yo;exports.BadgesProvider=zd;exports.Banner=Ok;exports.BannerSection=Ik;exports.Breadcrumbs=Lv;exports.Buckets=vp;exports.Button=we;exports.ButtonWrapper=vr;exports.COURSE_CONTENT_TYPES=jr;exports.CacheProvider=qd;exports.Card=xu;exports.CardBlock=Fh;exports.Carousel=Yk;exports.CharacterLimit=zo;exports.Checkbox=qo;exports.CollapsibleSection=ha;exports.Columns=jf;exports.CommunityDetails=Lg;exports.ConnectionCta=Jd;exports.ConnectionDirectionType=Do;exports.ConnectionStatusType=Co;exports.ContactFooter=V_;exports.ContactForm=dh;exports.ContentTypeLabel=Nd;exports.Contributors=_o;exports.ConversationContext=ka;exports.CookieBanner=vh;exports.CourseProgression=Qk;exports.CourseStructure=Jk;exports.CustomContentBanner=Rk;exports.CustomEvents=it;exports.DELETED_USER_ID=Vr;exports.Directory=Tk;exports.DiscussionContentType=Te;exports.DiscussionConversation=wh;exports.DiscussionForm=oi;exports.DiscussionFormCard=Dh;exports.DiscussionFormModal=kh;exports.DiscussionPost=ui;exports.DiscussionThread=_h;exports.Divider=zt;exports.DownloadSection=z_;exports.EMAILS=Qn;exports.EditSection=U_;exports.EmailHelperTextBox=Of;exports.EmptyStateBox=Qt;exports.EnrichedUrl=$o;exports.FeatureFlags=Wd;exports.Filters=Bf;exports.FlagsProvider=Ud;exports.Footer=gu;exports.Form=Xt;exports.Formatting=Z;exports.Fragment=St;exports.FullWidthSection=kn;exports.GET_STREAM_USER_PREFIX=Os;exports.GlobalProviders=Ap;exports.Header=vu;exports.HelperTextBox=Rd;exports.HiddenFromScreenReaders=fa;exports.HideShowTextBox=$d;exports.HighlightSection=Lk;exports.HighlightedTextBox=_t;exports.INVALID_TOKEN=Td;exports.IconBulletedList=xp;exports.ImageContainer=mp;exports.IntlProvider=Vd;exports.InviteForm=fh;exports.InviteModal=kk;exports.JoinButton=To;exports.Label=sa;exports.LanguageContext=xo;exports.LanguageSwitcher=qv;exports.LessonName=Ah;exports.LessonType=Th;exports.LikesButton=Df;exports.LikesFeed=kf;exports.LikesModal=Ff;exports.Link=Dn;exports.LoadMore=ii;exports.LoadingBlock=Xd;exports.LoadingPlaceholder=Nt;exports.LoadingState=ga;exports.Logo=Lo;exports.LogoSection=W_;exports.MEMBERS_PER_PAGE=yh;exports.MENTION_REGEX=Bd;exports.MarkCompleteButton=Xk;exports.MarkdownText=On;exports.MarketingBlock=zk;exports.Marks=Kt;exports.Member=an;exports.MembersList=xh;exports.Modal=ko;exports.MoreMenu=Xi;exports.NUMBER_OF_COUNTRIES=Jh;exports.NUMBER_OF_USERS=Qh;exports.NarrowCard=Gk;exports.NavigationMenu=Sf;exports.NotFoundError=tF;exports.Overlay=ln;exports.OverlayContext=wo;exports.OverlayProvider=Zd;exports.PageHeading=Yd;exports.PageLayout=bh;exports.Password=Mf;exports.PasswordForm=S_;exports.PasswordRules=Lf;exports.Pill=Yt;exports.Poll=Ch;exports.Popover=Md;exports.Portal=br;exports.ProfileForm=mh;exports.ProfileImageChange=ch;exports.ProfileModal=Fa;exports.ProfileModalLauncher=yu;exports.ProfilePicture=un;exports.ProgressBar=Eo;exports.ProgressTracker=pp;exports.PublishArticleForm=O_;exports.Rating=ab;exports.RepliesFeed=_f;exports.ResponsesHeading=Eh;exports.ResponsiveImage=Cn;exports.ResultsVisibility=ca;exports.ReturnToNavButton=gp;exports.RichTextEditor=pu;exports.SearchForm=ph;exports.ShareLink=Af;exports.ShareLinks=Zv;exports.ShowEmail=Bk;exports.SignupForm=L_;exports.Span=Rs;exports.StatusBanner=ur;exports.TableOfContents=Pk;exports.Tabs=Yv;exports.Tags=G_;exports.TestimonialBlock=jk;exports.TimeToComplete=Aa;exports.Toggle=T_;exports.Tooltip=Ln;exports.TopLevelPage=H_;exports.UUID_V4_REGEX=Hr;exports.UserContext=rt;exports.UserProvider=Hd;exports.VisuallyHidden=Oe;exports.addAriaProps=hf;exports.basicReducer=pr;exports.camelCaseToDashCase=kd;exports.checkIntlPathExists=ma;exports.enrichPostCategories=Ro;exports.generateConditions=Ui;exports.generateCssIcon=Xh;exports.getAuthorData=xr;exports.getCharacterLimitProps=Pf;exports.getLongDate=vo;exports.getMember=va;exports.getPostBody=Io;exports.getShortDate=Sd;exports.getValueLength=ba;exports.headerData=ri;exports.likesResponseMock=Rv;exports.mapGetStreamData=eF;exports.pageReady=jd;exports.passwordValidator=Ns;exports.repliesFeedMock=wv;exports.supportedLanguages=Mi;exports.toCamelCase=Fd;exports.toCapitalisedCase=Gh;exports.toSentenceCase=Ad;exports.transformSlugs=Us;exports.useAutoResize=xd;exports.useBadges=Ld;exports.useCurrentPath=wd;exports.useEffectAfterMount=or;exports.useElementWidth=wn;exports.useOverlay=Kd;exports.useScrollListener=Dd;exports.useScrollToHash=po;exports.useTooltips=go;exports.useUser=pa;