@apolitical/component-library 6.5.1-beta.0 → 6.5.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/index.js +32 -32
  2. package/index.mjs +1601 -1600
  3. package/package.json +1 -1
  4. package/style.css +1 -1
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),ae=require("react-intl"),Ot=require("lodash.clonedeep"),gh=require("lodash.set"),Gc=require("react-dom"),Zt=require("markdown-to-jsx"),sr=require("truncate"),Ke=require("@tanstack/react-query"),vh=require("@tanstack/react-query-devtools"),Fa=require("posthog-js"),ao=require("react-cookie"),Ra=require("lodash.isequal"),Qc=require("lodash.get"),bh=require("react-error-boundary"),yh=require("react-multi-email");var ra=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Jc(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var Xc={exports:{}};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),ae=require("react-intl"),Ot=require("lodash.clonedeep"),vh=require("lodash.set"),Qc=require("react-dom"),Zt=require("markdown-to-jsx"),sr=require("truncate"),Ke=require("@tanstack/react-query"),bh=require("@tanstack/react-query-devtools"),Fa=require("posthog-js"),ao=require("react-cookie"),Ra=require("lodash.isequal"),Jc=require("lodash.get"),yh=require("react-error-boundary"),xh=require("react-multi-email");var ra=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Xc(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var ed={exports:{}};/*!
2
2
  Copyright (c) 2018 Jed Watson.
3
3
  Licensed under the MIT License (MIT), see
4
4
  http://jedwatson.github.io/classnames
5
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a<arguments.length;a++){var i=arguments[a];if(i){var s=typeof i;if(s==="string"||s==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var o=n.apply(null,i);o&&r.push(o)}}else if(s==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var l in i)t.call(i,l)&&i[l]&&r.push(l)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Xc);var xh=Xc.exports;const V=Rn(xh),Ch=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>y.createElement(e,{...a,className:V("hidden",r,{"show-on-focus":t}),children:n}),Pe=y.memo(Ch),wh=({element:e="span",children:t=null,...n})=>y.createElement(e,{...n,"aria-hidden":!0},t),oi=y.memo(wh);var Es={exports:{}},yr={};/**
5
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a<arguments.length;a++){var i=arguments[a];if(i){var s=typeof i;if(s==="string"||s==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var o=n.apply(null,i);o&&r.push(o)}}else if(s==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var l in i)t.call(i,l)&&i[l]&&r.push(l)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(ed);var Ch=ed.exports;const V=Rn(Ch),wh=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>y.createElement(e,{...a,className:V("hidden",r,{"show-on-focus":t}),children:n}),Pe=y.memo(wh),Dh=({element:e="span",children:t=null,...n})=>y.createElement(e,{...n,"aria-hidden":!0},t),oi=y.memo(Dh);var Es={exports:{}},yr={};/**
6
6
  * @license React
7
7
  * react-jsx-runtime.production.min.js
8
8
  *
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * This source code is licensed under the MIT license found in the
12
12
  * LICENSE file in the root directory of this source tree.
13
- */var mu;function Dh(){if(mu)return yr;mu=1;var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var d,m={},h=null,p=null;u!==void 0&&(h=""+u),l.key!==void 0&&(h=""+l.key),l.ref!==void 0&&(p=l.ref);for(d in l)r.call(l,d)&&!i.hasOwnProperty(d)&&(m[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)m[d]===void 0&&(m[d]=l[d]);return{$$typeof:t,type:o,key:h,ref:p,props:m,_owner:a.current}}return yr.Fragment=n,yr.jsx=s,yr.jsxs=s,yr}var xr={};/**
13
+ */var mu;function Eh(){if(mu)return yr;mu=1;var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var d,m={},h=null,p=null;u!==void 0&&(h=""+u),l.key!==void 0&&(h=""+l.key),l.ref!==void 0&&(p=l.ref);for(d in l)r.call(l,d)&&!i.hasOwnProperty(d)&&(m[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)m[d]===void 0&&(m[d]=l[d]);return{$$typeof:t,type:o,key:h,ref:p,props:m,_owner:a.current}}return yr.Fragment=n,yr.jsx=s,yr.jsxs=s,yr}var xr={};/**
14
14
  * @license React
15
15
  * react-jsx-runtime.development.js
16
16
  *
@@ -18,70 +18,70 @@
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 hu;function Eh(){return hu||(hu=1,process.env.NODE_ENV!=="production"&&function(){var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=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(N){if(N===null||typeof N!="object")return null;var ue=g&&N[g]||N[f];return typeof ue=="function"?ue:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function C(N){{for(var ue=arguments.length,de=new Array(ue>1?ue-1:0),we=1;we<ue;we++)de[we-1]=arguments[we];D("error",N,de)}}function D(N,ue,de){{var we=v.ReactDebugCurrentFrame,Ne=we.getStackAddendum();Ne!==""&&(ue+="%s",de=de.concat([Ne]));var Ve=de.map(function(Se){return String(Se)});Ve.unshift("Warning: "+ue),Function.prototype.apply.call(console[N],console,Ve)}}var A=!1,E=!1,k=!1,T=!1,$=!1,P;P=Symbol.for("react.module.reference");function z(N){return!!(typeof N=="string"||typeof N=="function"||N===r||N===i||$||N===a||N===u||N===d||T||N===p||A||E||k||typeof N=="object"&&N!==null&&(N.$$typeof===h||N.$$typeof===m||N.$$typeof===s||N.$$typeof===o||N.$$typeof===l||N.$$typeof===P||N.getModuleId!==void 0))}function L(N,ue,de){var we=N.displayName;if(we)return we;var Ne=ue.displayName||ue.name||"";return Ne!==""?de+"("+Ne+")":de}function B(N){return N.displayName||"Context"}function F(N){if(N==null)return null;if(typeof N.tag=="number"&&C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof N=="function")return N.displayName||N.name||null;if(typeof N=="string")return N;switch(N){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if(typeof N=="object")switch(N.$$typeof){case o:var ue=N;return B(ue)+".Consumer";case s:var de=N;return B(de._context)+".Provider";case l:return L(N,N.render,"ForwardRef");case m:var we=N.displayName||null;return we!==null?we:F(N.type)||"Memo";case h:{var Ne=N,Ve=Ne._payload,Se=Ne._init;try{return F(Se(Ve))}catch{return null}}}return null}var j=Object.assign,O=0,q,W,ne,J,w,Q,se;function _(){}_.__reactDisabledLog=!0;function M(){{if(O===0){q=console.log,W=console.info,ne=console.warn,J=console.error,w=console.group,Q=console.groupCollapsed,se=console.groupEnd;var N={configurable:!0,enumerable:!0,value:_,writable:!0};Object.defineProperties(console,{info:N,log:N,warn:N,error:N,group:N,groupCollapsed:N,groupEnd:N})}O++}}function U(){{if(O--,O===0){var N={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},N,{value:q}),info:j({},N,{value:W}),warn:j({},N,{value:ne}),error:j({},N,{value:J}),group:j({},N,{value:w}),groupCollapsed:j({},N,{value:Q}),groupEnd:j({},N,{value:se})})}O<0&&C("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var S=v.ReactCurrentDispatcher,R;function K(N,ue,de){{if(R===void 0)try{throw Error()}catch(Ne){var we=Ne.stack.trim().match(/\n( *(at )?)/);R=we&&we[1]||""}return`
21
+ */var hu;function _h(){return hu||(hu=1,process.env.NODE_ENV!=="production"&&function(){var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=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(N){if(N===null||typeof N!="object")return null;var ue=g&&N[g]||N[f];return typeof ue=="function"?ue:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function C(N){{for(var ue=arguments.length,de=new Array(ue>1?ue-1:0),we=1;we<ue;we++)de[we-1]=arguments[we];D("error",N,de)}}function D(N,ue,de){{var we=v.ReactDebugCurrentFrame,Ne=we.getStackAddendum();Ne!==""&&(ue+="%s",de=de.concat([Ne]));var Ve=de.map(function(Se){return String(Se)});Ve.unshift("Warning: "+ue),Function.prototype.apply.call(console[N],console,Ve)}}var A=!1,E=!1,k=!1,T=!1,$=!1,P;P=Symbol.for("react.module.reference");function z(N){return!!(typeof N=="string"||typeof N=="function"||N===r||N===i||$||N===a||N===u||N===d||T||N===p||A||E||k||typeof N=="object"&&N!==null&&(N.$$typeof===h||N.$$typeof===m||N.$$typeof===s||N.$$typeof===o||N.$$typeof===l||N.$$typeof===P||N.getModuleId!==void 0))}function L(N,ue,de){var we=N.displayName;if(we)return we;var Ne=ue.displayName||ue.name||"";return Ne!==""?de+"("+Ne+")":de}function B(N){return N.displayName||"Context"}function F(N){if(N==null)return null;if(typeof N.tag=="number"&&C("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof N=="function")return N.displayName||N.name||null;if(typeof N=="string")return N;switch(N){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if(typeof N=="object")switch(N.$$typeof){case o:var ue=N;return B(ue)+".Consumer";case s:var de=N;return B(de._context)+".Provider";case l:return L(N,N.render,"ForwardRef");case m:var we=N.displayName||null;return we!==null?we:F(N.type)||"Memo";case h:{var Ne=N,Ve=Ne._payload,Se=Ne._init;try{return F(Se(Ve))}catch{return null}}}return null}var j=Object.assign,O=0,q,W,ne,J,w,Q,se;function _(){}_.__reactDisabledLog=!0;function M(){{if(O===0){q=console.log,W=console.info,ne=console.warn,J=console.error,w=console.group,Q=console.groupCollapsed,se=console.groupEnd;var N={configurable:!0,enumerable:!0,value:_,writable:!0};Object.defineProperties(console,{info:N,log:N,warn:N,error:N,group:N,groupCollapsed:N,groupEnd:N})}O++}}function U(){{if(O--,O===0){var N={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},N,{value:q}),info:j({},N,{value:W}),warn:j({},N,{value:ne}),error:j({},N,{value:J}),group:j({},N,{value:w}),groupCollapsed:j({},N,{value:Q}),groupEnd:j({},N,{value:se})})}O<0&&C("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var S=v.ReactCurrentDispatcher,R;function K(N,ue,de){{if(R===void 0)try{throw Error()}catch(Ne){var we=Ne.stack.trim().match(/\n( *(at )?)/);R=we&&we[1]||""}return`
22
22
  `+R+N}}var Z=!1,re;{var ce=typeof WeakMap=="function"?WeakMap:Map;re=new ce}function X(N,ue){if(!N||Z)return"";{var de=re.get(N);if(de!==void 0)return de}var we;Z=!0;var Ne=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ve;Ve=S.current,S.current=null,M();try{if(ue){var Se=function(){throw Error()};if(Object.defineProperty(Se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Se,[])}catch(en){we=en}Reflect.construct(N,[],Se)}else{try{Se.call()}catch(en){we=en}N.call(Se.prototype)}}else{try{throw Error()}catch(en){we=en}N()}}catch(en){if(en&&we&&typeof en.stack=="string"){for(var Te=en.stack.split(`
23
23
  `),ft=we.stack.split(`
24
24
  `),et=Te.length-1,nt=ft.length-1;et>=1&&nt>=0&&Te[et]!==ft[nt];)nt--;for(;et>=1&&nt>=0;et--,nt--)if(Te[et]!==ft[nt]){if(et!==1||nt!==1)do if(et--,nt--,nt<0||Te[et]!==ft[nt]){var Bt=`
25
25
  `+Te[et].replace(" at new "," at ");return N.displayName&&Bt.includes("<anonymous>")&&(Bt=Bt.replace("<anonymous>",N.displayName)),typeof N=="function"&&re.set(N,Bt),Bt}while(et>=1&&nt>=0);break}}}finally{Z=!1,S.current=Ve,U(),Error.prepareStackTrace=Ne}var Wn=N?N.displayName||N.name:"",fu=Wn?K(Wn):"";return typeof N=="function"&&re.set(N,fu),fu}function pe(N,ue,de){return X(N,!1)}function ve(N){var ue=N.prototype;return!!(ue&&ue.isReactComponent)}function ye(N,ue,de){if(N==null)return"";if(typeof N=="function")return X(N,ve(N));if(typeof N=="string")return K(N);switch(N){case u:return K("Suspense");case d:return K("SuspenseList")}if(typeof N=="object")switch(N.$$typeof){case l:return pe(N.render);case m:return ye(N.type,ue,de);case h:{var we=N,Ne=we._payload,Ve=we._init;try{return ye(Ve(Ne),ue,de)}catch{}}}return""}var Me=Object.prototype.hasOwnProperty,je={},Je=v.ReactDebugCurrentFrame;function Ue(N){if(N){var ue=N._owner,de=ye(N.type,N._source,ue?ue.type:null);Je.setExtraStackFrame(de)}else Je.setExtraStackFrame(null)}function Le(N,ue,de,we,Ne){{var Ve=Function.call.bind(Me);for(var Se in N)if(Ve(N,Se)){var Te=void 0;try{if(typeof N[Se]!="function"){var ft=Error((we||"React class")+": "+de+" type `"+Se+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof N[Se]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ft.name="Invariant Violation",ft}Te=N[Se](ue,Se,we,de,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(et){Te=et}Te&&!(Te instanceof Error)&&(Ue(Ne),C("%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).",we||"React class",de,Se,typeof Te),Ue(null)),Te instanceof Error&&!(Te.message in je)&&(je[Te.message]=!0,Ue(Ne),C("Failed %s type: %s",de,Te.message),Ue(null))}}}var Xe=Array.isArray;function _e(N){return Xe(N)}function Oe(N){{var ue=typeof Symbol=="function"&&Symbol.toStringTag,de=ue&&N[Symbol.toStringTag]||N.constructor.name||"Object";return de}}function We(N){try{return Y(N),!1}catch{return!0}}function Y(N){return""+N}function oe(N){if(We(N))return C("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Oe(N)),Y(N)}var ie=v.ReactCurrentOwner,me={key:!0,ref:!0,__self:!0,__source:!0},ge,ke,ze;ze={};function ot(N){if(Me.call(N,"ref")){var ue=Object.getOwnPropertyDescriptor(N,"ref").get;if(ue&&ue.isReactWarning)return!1}return N.ref!==void 0}function At(N){if(Me.call(N,"key")){var ue=Object.getOwnPropertyDescriptor(N,"key").get;if(ue&&ue.isReactWarning)return!1}return N.key!==void 0}function vt(N,ue){if(typeof N.ref=="string"&&ie.current&&ue&&ie.current.stateNode!==ue){var de=F(ie.current.type);ze[de]||(C('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(ie.current.type),N.ref),ze[de]=!0)}}function tt(N,ue){{var de=function(){ge||(ge=!0,C("%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))};de.isReactWarning=!0,Object.defineProperty(N,"key",{get:de,configurable:!0})}}function Ce(N,ue){{var de=function(){ke||(ke=!0,C("%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))};de.isReactWarning=!0,Object.defineProperty(N,"ref",{get:de,configurable:!0})}}var Be=function(N,ue,de,we,Ne,Ve,Se){var Te={$$typeof:t,type:N,key:ue,ref:de,props:Se,_owner:Ve};return Te._store={},Object.defineProperty(Te._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Te,"_self",{configurable:!1,enumerable:!1,writable:!1,value:we}),Object.defineProperty(Te,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ne}),Object.freeze&&(Object.freeze(Te.props),Object.freeze(Te)),Te};function It(N,ue,de,we,Ne){{var Ve,Se={},Te=null,ft=null;de!==void 0&&(oe(de),Te=""+de),At(ue)&&(oe(ue.key),Te=""+ue.key),ot(ue)&&(ft=ue.ref,vt(ue,Ne));for(Ve in ue)Me.call(ue,Ve)&&!me.hasOwnProperty(Ve)&&(Se[Ve]=ue[Ve]);if(N&&N.defaultProps){var et=N.defaultProps;for(Ve in et)Se[Ve]===void 0&&(Se[Ve]=et[Ve])}if(Te||ft){var nt=typeof N=="function"?N.displayName||N.name||"Unknown":N;Te&&tt(Se,nt),ft&&Ce(Se,nt)}return Be(N,Te,ft,Ne,we,ie.current,Se)}}var bt=v.ReactCurrentOwner,_n=v.ReactDebugCurrentFrame;function Xt(N){if(N){var ue=N._owner,de=ye(N.type,N._source,ue?ue.type:null);_n.setExtraStackFrame(de)}else _n.setExtraStackFrame(null)}var Un;Un=!1;function Ei(N){return typeof N=="object"&&N!==null&&N.$$typeof===t}function ou(){{if(bt.current){var N=F(bt.current.type);if(N)return`
26
26
 
27
- Check the render method of \``+N+"`."}return""}}function uh(N){{if(N!==void 0){var ue=N.fileName.replace(/^.*[\\\/]/,""),de=N.lineNumber;return`
27
+ Check the render method of \``+N+"`."}return""}}function lh(N){{if(N!==void 0){var ue=N.fileName.replace(/^.*[\\\/]/,""),de=N.lineNumber;return`
28
28
 
29
- Check your code at `+ue+":"+de+"."}return""}}var uu={};function lh(N){{var ue=ou();if(!ue){var de=typeof N=="string"?N:N.displayName||N.name;de&&(ue=`
29
+ Check your code at `+ue+":"+de+"."}return""}}var uu={};function ch(N){{var ue=ou();if(!ue){var de=typeof N=="string"?N:N.displayName||N.name;de&&(ue=`
30
30
 
31
- Check the top-level render call using <`+de+">.")}return ue}}function lu(N,ue){{if(!N._store||N._store.validated||N.key!=null)return;N._store.validated=!0;var de=lh(ue);if(uu[de])return;uu[de]=!0;var we="";N&&N._owner&&N._owner!==bt.current&&(we=" It was passed a child from "+F(N._owner.type)+"."),Xt(N),C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',de,we),Xt(null)}}function cu(N,ue){{if(typeof N!="object")return;if(_e(N))for(var de=0;de<N.length;de++){var we=N[de];Ei(we)&&lu(we,ue)}else if(Ei(N))N._store&&(N._store.validated=!0);else if(N){var Ne=b(N);if(typeof Ne=="function"&&Ne!==N.entries)for(var Ve=Ne.call(N),Se;!(Se=Ve.next()).done;)Ei(Se.value)&&lu(Se.value,ue)}}}function ch(N){{var ue=N.type;if(ue==null||typeof ue=="string")return;var de;if(typeof ue=="function")de=ue.propTypes;else if(typeof ue=="object"&&(ue.$$typeof===l||ue.$$typeof===m))de=ue.propTypes;else return;if(de){var we=F(ue);Le(de,N.props,"prop",we,N)}else if(ue.PropTypes!==void 0&&!Un){Un=!0;var Ne=F(ue);C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ne||"Unknown")}typeof ue.getDefaultProps=="function"&&!ue.getDefaultProps.isReactClassApproved&&C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function dh(N){{for(var ue=Object.keys(N.props),de=0;de<ue.length;de++){var we=ue[de];if(we!=="children"&&we!=="key"){Xt(N),C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",we),Xt(null);break}}N.ref!==null&&(Xt(N),C("Invalid attribute `ref` supplied to `React.Fragment`."),Xt(null))}}function du(N,ue,de,we,Ne,Ve){{var Se=z(N);if(!Se){var Te="";(N===void 0||typeof N=="object"&&N!==null&&Object.keys(N).length===0)&&(Te+=" 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 ft=uh(Ne);ft?Te+=ft:Te+=ou();var et;N===null?et="null":_e(N)?et="array":N!==void 0&&N.$$typeof===t?(et="<"+(F(N.type)||"Unknown")+" />",Te=" Did you accidentally export a JSX literal instead of a component?"):et=typeof N,C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",et,Te)}var nt=It(N,ue,de,Ne,Ve);if(nt==null)return nt;if(Se){var Bt=ue.children;if(Bt!==void 0)if(we)if(_e(Bt)){for(var Wn=0;Wn<Bt.length;Wn++)cu(Bt[Wn],N);Object.freeze&&Object.freeze(Bt)}else C("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 cu(Bt,N)}return N===r?dh(nt):ch(nt),nt}}function fh(N,ue,de){return du(N,ue,de,!0)}function mh(N,ue,de){return du(N,ue,de,!1)}var hh=mh,ph=fh;xr.Fragment=r,xr.jsx=hh,xr.jsxs=ph}()),xr}process.env.NODE_ENV==="production"?Es.exports=Dh():Es.exports=Eh();var c=Es.exports;const ed=(e,t)=>{if(!e)return!1;const n=y.useRef(null),r=t||n;return y.useEffect(()=>{const a=r.current,i=()=>{a&&(a.style.height="auto",a.style.height=`${a.scrollHeight}px`)};if(a)return i(),a.addEventListener("input",i),()=>a.removeEventListener("input",i)},[]),r},td=()=>{const[e,t]=y.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return y.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},or=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function nd(e,t,n){var r=this,a=y.useRef(null),i=y.useRef(0),s=y.useRef(null),o=y.useRef([]),l=y.useRef(),u=y.useRef(),d=y.useRef(e),m=y.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,C=b?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var D=y.useMemo(function(){var A=function(z){var L=o.current,B=l.current;return o.current=l.current=null,i.current=z,u.current=d.current.apply(B,L)},E=function(z,L){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(z):setTimeout(z,L)},k=function(z){if(!m.current)return!1;var L=z-a.current;return!a.current||L>=t||L<0||b&&z-i.current>=C},T=function(z){return s.current=null,f&&o.current?A(z):(o.current=l.current=null,u.current)},$=function z(){var L=Date.now();if(k(L))return T(L);if(m.current){var B=t-(L-a.current),F=b?Math.min(B,C-(L-i.current)):B;E(z,F)}},P=function(){if(h||v){var z=Date.now(),L=k(z);if(o.current=[].slice.call(arguments),l.current=r,a.current=z,L){if(!s.current&&m.current)return i.current=a.current,E($,t),g?A(a.current):u.current;if(b)return E($,t),A(a.current)}return s.current||E($,t),u.current}};return P.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},P.isPending=function(){return!!s.current},P.flush=function(){return s.current?T(Date.now()):u.current},P},[g,b,t,C,f,p,h,v]);return D}function rd(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return nd(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let _i;const $n=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=y.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];y.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(_i),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:d})=>{const{id:m}=d;n==="window"||!n.closest(`#${m}`)||s()===r||o()},u=rd(()=>{s()!==r&&(t&&(clearTimeout(_i),document.body.classList.add("is-resizing"),_i=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},ad=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=y.useState({current:0,past:0})||[!1,()=>{}],[s,o]=y.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];y.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const d=window.scrollY,m=a.current,h=d-m,p=h>0?"down":"up";if(i({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}))},u=rd(()=>{l()},250);return a},io=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.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)},so=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=y.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 pu={},Ln=y.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},accessibility:l={},...u},d)=>{const m=ae.useIntl(),[h]=y.useState(e||Date.now().toString()),p=y.useRef(null),g=d||p,[f,b]=y.useState(n?"open":"hidden"),{extraPadding:v=!0,hasPointer:C=!1,hasForm:D=!1}=t,{onOpen:A=()=>{},onClose:E=()=>{}}=o,{readToScreenreadersWhenClosed:k=!1,...T}=l,$=pu[h];y.useEffect(()=>{const B=g==null?void 0:g.current;if(B)return B.addEventListener("transitionend",P),()=>{B.removeEventListener("transitionend",P)}},[]),y.useEffect(()=>{if(f!=="open")return;const B=F=>{F.key==="Escape"&&(F.stopPropagation(),F.preventDefault(),b("closed"))};return document.addEventListener("keyup",B),()=>{document.removeEventListener("keyup",B)}},[f]);const P=({propertyName:B})=>{B==="opacity"&&($!==!1&&clearTimeout($),b(F=>(F==="open"?A():F==="closed"&&E(),F==="opening"?"open":F==="closing"?"closed":F==="closed"?"hidden":F)))};or(()=>{$!==!1&&clearTimeout($);let B="open";n?b("opening"):(b("closing"),B="hidden"),pu[h||""]=setTimeout(()=>{b(B)},300)},[n]);const z={"aria-live":"polite",...u,...T};s&&s.onBlur&&(z.onBlur=s.onBlur);const L={className:"content"};return k?L.className=V("content",{hidden:f==="hidden"}):L.hidden=f==="hidden",c.jsx("aside",{ref:g,id:h,className:V("tooltip text-medium",f,i,{loading:r,"extra-padding":v,"has-pointer":C,bottom:C==="bottom","has-form":D}),...z,children:c.jsx("div",{...L,children:r?c.jsx("p",{children:m.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?c.jsx("p",{children:a}):a})})}),Jr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Ot(e);return t.forEach(({type:r,value:a})=>{gh(n,r,a)}),n},id=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},sd=(e,t,n)=>{let r=n.mobile;for(const a in t){const i=parseInt(String(t[a]));if(e>=i)r=n[i];else if(e<i)break}return r},od=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),ud=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),ld=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),_h=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Gt="https://storage.googleapis.com/apolitical-assets/",Qn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Ar={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},_s="SU:",Lr="DELETED",cd="Invalid token error: Logging user out...",kh="200,000+",Fh="160+",zr=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,dd=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function Ah(e){return e?{"--icon":`url(${Gt}icons/${e}.svg)`}:{}}const An={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},fd=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),oo=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),ks=e=>{let t;const n=$a(),r=$a(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/An.milliseconds.inHour,i=Math.floor(t/An.milliseconds.inDay);if(i<1)return a<1?{path:"now"}:{path:"hours",number:Math.floor(a)};if(i<7)return{path:"days",number:i};const s=Math.floor(i/7);return s<=An.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/An.year.days)}},$a=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Bh=(e,t,n)=>{let r;const a=$a(),i=$a(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/An.milliseconds.inSecond<=t;case"minutes":return r/An.milliseconds.inMinute<=t;case"hours":return r/An.milliseconds.inHour<=t}return!1},Th=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},Sh=e=>new Promise(t=>setTimeout(t,e)),jh=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},hr={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_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
31
+ Check the top-level render call using <`+de+">.")}return ue}}function lu(N,ue){{if(!N._store||N._store.validated||N.key!=null)return;N._store.validated=!0;var de=ch(ue);if(uu[de])return;uu[de]=!0;var we="";N&&N._owner&&N._owner!==bt.current&&(we=" It was passed a child from "+F(N._owner.type)+"."),Xt(N),C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',de,we),Xt(null)}}function cu(N,ue){{if(typeof N!="object")return;if(_e(N))for(var de=0;de<N.length;de++){var we=N[de];Ei(we)&&lu(we,ue)}else if(Ei(N))N._store&&(N._store.validated=!0);else if(N){var Ne=b(N);if(typeof Ne=="function"&&Ne!==N.entries)for(var Ve=Ne.call(N),Se;!(Se=Ve.next()).done;)Ei(Se.value)&&lu(Se.value,ue)}}}function dh(N){{var ue=N.type;if(ue==null||typeof ue=="string")return;var de;if(typeof ue=="function")de=ue.propTypes;else if(typeof ue=="object"&&(ue.$$typeof===l||ue.$$typeof===m))de=ue.propTypes;else return;if(de){var we=F(ue);Le(de,N.props,"prop",we,N)}else if(ue.PropTypes!==void 0&&!Un){Un=!0;var Ne=F(ue);C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ne||"Unknown")}typeof ue.getDefaultProps=="function"&&!ue.getDefaultProps.isReactClassApproved&&C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function fh(N){{for(var ue=Object.keys(N.props),de=0;de<ue.length;de++){var we=ue[de];if(we!=="children"&&we!=="key"){Xt(N),C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",we),Xt(null);break}}N.ref!==null&&(Xt(N),C("Invalid attribute `ref` supplied to `React.Fragment`."),Xt(null))}}function du(N,ue,de,we,Ne,Ve){{var Se=z(N);if(!Se){var Te="";(N===void 0||typeof N=="object"&&N!==null&&Object.keys(N).length===0)&&(Te+=" 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 ft=lh(Ne);ft?Te+=ft:Te+=ou();var et;N===null?et="null":_e(N)?et="array":N!==void 0&&N.$$typeof===t?(et="<"+(F(N.type)||"Unknown")+" />",Te=" Did you accidentally export a JSX literal instead of a component?"):et=typeof N,C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",et,Te)}var nt=It(N,ue,de,Ne,Ve);if(nt==null)return nt;if(Se){var Bt=ue.children;if(Bt!==void 0)if(we)if(_e(Bt)){for(var Wn=0;Wn<Bt.length;Wn++)cu(Bt[Wn],N);Object.freeze&&Object.freeze(Bt)}else C("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 cu(Bt,N)}return N===r?fh(nt):dh(nt),nt}}function mh(N,ue,de){return du(N,ue,de,!0)}function hh(N,ue,de){return du(N,ue,de,!1)}var ph=hh,gh=mh;xr.Fragment=r,xr.jsx=ph,xr.jsxs=gh}()),xr}process.env.NODE_ENV==="production"?Es.exports=Eh():Es.exports=_h();var c=Es.exports;const td=(e,t)=>{if(!e)return!1;const n=y.useRef(null),r=t||n;return y.useEffect(()=>{const a=r.current,i=()=>{a&&(a.style.height="auto",a.style.height=`${a.scrollHeight}px`)};if(a)return i(),a.addEventListener("input",i),()=>a.removeEventListener("input",i)},[]),r},nd=()=>{const[e,t]=y.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return y.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},or=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function rd(e,t,n){var r=this,a=y.useRef(null),i=y.useRef(0),s=y.useRef(null),o=y.useRef([]),l=y.useRef(),u=y.useRef(),d=y.useRef(e),m=y.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,C=b?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var D=y.useMemo(function(){var A=function(z){var L=o.current,B=l.current;return o.current=l.current=null,i.current=z,u.current=d.current.apply(B,L)},E=function(z,L){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(z):setTimeout(z,L)},k=function(z){if(!m.current)return!1;var L=z-a.current;return!a.current||L>=t||L<0||b&&z-i.current>=C},T=function(z){return s.current=null,f&&o.current?A(z):(o.current=l.current=null,u.current)},$=function z(){var L=Date.now();if(k(L))return T(L);if(m.current){var B=t-(L-a.current),F=b?Math.min(B,C-(L-i.current)):B;E(z,F)}},P=function(){if(h||v){var z=Date.now(),L=k(z);if(o.current=[].slice.call(arguments),l.current=r,a.current=z,L){if(!s.current&&m.current)return i.current=a.current,E($,t),g?A(a.current):u.current;if(b)return E($,t),A(a.current)}return s.current||E($,t),u.current}};return P.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},P.isPending=function(){return!!s.current},P.flush=function(){return s.current?T(Date.now()):u.current},P},[g,b,t,C,f,p,h,v]);return D}function ad(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return rd(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let _i;const $n=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=y.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];y.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(_i),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:d})=>{const{id:m}=d;n==="window"||!n.closest(`#${m}`)||s()===r||o()},u=ad(()=>{s()!==r&&(t&&(clearTimeout(_i),document.body.classList.add("is-resizing"),_i=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},id=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=y.useState({current:0,past:0})||[!1,()=>{}],[s,o]=y.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];y.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const d=window.scrollY,m=a.current,h=d-m,p=h>0?"down":"up";if(i({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}))},u=ad(()=>{l()},250);return a},io=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.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)},so=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=y.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 pu={},Ln=y.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},accessibility:l={},...u},d)=>{const m=ae.useIntl(),[h]=y.useState(e||Date.now().toString()),p=y.useRef(null),g=d||p,[f,b]=y.useState(n?"open":"hidden"),{extraPadding:v=!0,hasPointer:C=!1,hasForm:D=!1}=t,{onOpen:A=()=>{},onClose:E=()=>{}}=o,{readToScreenreadersWhenClosed:k=!1,...T}=l,$=pu[h];y.useEffect(()=>{const B=g==null?void 0:g.current;if(B)return B.addEventListener("transitionend",P),()=>{B.removeEventListener("transitionend",P)}},[]),y.useEffect(()=>{if(f!=="open")return;const B=F=>{F.key==="Escape"&&(F.stopPropagation(),F.preventDefault(),b("closed"))};return document.addEventListener("keyup",B),()=>{document.removeEventListener("keyup",B)}},[f]);const P=({propertyName:B})=>{B==="opacity"&&($!==!1&&clearTimeout($),b(F=>(F==="open"?A():F==="closed"&&E(),F==="opening"?"open":F==="closing"?"closed":F==="closed"?"hidden":F)))};or(()=>{$!==!1&&clearTimeout($);let B="open";n?b("opening"):(b("closing"),B="hidden"),pu[h||""]=setTimeout(()=>{b(B)},300)},[n]);const z={"aria-live":"polite",...u,...T};s&&s.onBlur&&(z.onBlur=s.onBlur);const L={className:"content"};return k?L.className=V("content",{hidden:f==="hidden"}):L.hidden=f==="hidden",c.jsx("aside",{ref:g,id:h,className:V("tooltip text-medium",f,i,{loading:r,"extra-padding":v,"has-pointer":C,bottom:C==="bottom","has-form":D}),...z,children:c.jsx("div",{...L,children:r?c.jsx("p",{children:m.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?c.jsx("p",{children:a}):a})})}),Jr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Ot(e);return t.forEach(({type:r,value:a})=>{vh(n,r,a)}),n},sd=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},od=(e,t,n)=>{let r=n.mobile;for(const a in t){const i=parseInt(String(t[a]));if(e>=i)r=n[i];else if(e<i)break}return r},ud=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),ld=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),cd=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),kh=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Gt="https://storage.googleapis.com/apolitical-assets/",Qn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Ar={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},_s="SU:",Lr="DELETED",dd="Invalid token error: Logging user out...",Fh="200,000+",Ah="160+",zr=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,fd=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function Bh(e){return e?{"--icon":`url(${Gt}icons/${e}.svg)`}:{}}const An={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},md=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),oo=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),ks=e=>{let t;const n=$a(),r=$a(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/An.milliseconds.inHour,i=Math.floor(t/An.milliseconds.inDay);if(i<1)return a<1?{path:"now"}:{path:"hours",number:Math.floor(a)};if(i<7)return{path:"days",number:i};const s=Math.floor(i/7);return s<=An.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/An.year.days)}},$a=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Th=(e,t,n)=>{let r;const a=$a(),i=$a(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/An.milliseconds.inSecond<=t;case"minutes":return r/An.milliseconds.inMinute<=t;case"hours":return r/An.milliseconds.inHour<=t}return!1},Sh=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},jh=e=>new Promise(t=>setTimeout(t,e)),Oh=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},hr={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_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
32
32
 
33
33
  Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
34
34
 
35
- Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"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_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_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",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_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_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",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:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},Oh={...hr,languageSwitcher_label:"Me gustaría leer este artículo en...",languageSwitcher_translation_original:"idioma original",languageSwitcher_translation_human:"traducido por un humano",languageSwitcher_translation_machine:"traducido por máquina",languageSwitcher_disclaimer:"Este contenido fue traducido automáticamente y ocasionalmente tendrá errores de género u otras traducciones directas. Estamos intentando resolver este problema, pero mientras tanto, si notas algún error grave, escríbenos a <link>{email}</link>"},Ph={...hr,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"},Mh={...hr,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>"},Nh=Object.freeze(Object.defineProperty({__proto__:null,en:hr,es:Oh,fr:Ph,pt:Mh},Symbol.toStringTag,{value:"Module"})),ui=(e,t=hr)=>e in t,Rt=(e,t,n,r,a={})=>{let i="";return ui(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},Ih=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let a=n.length-1;a>=0;a--){const i=Math.pow(10,(a+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&a<n.length-1&&(e=1,a++),r=`${e}${n[a]}`;break}}return r},Aa=(e,t)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),md=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Rh=e=>{var i,s;const n=["name","organization","jobTitle","biography"].every(o=>{const l=e[o];return l!=null&&l!==""}),r=((i=e.image)==null?void 0:i.thumbnail)!==void 0,a=((s=e.location)==null?void 0:s.en)!==void 0;return n&&r&&a},$h=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,Lr).replace(/{{id}}/g,Lr):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),hd=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(zr);if(!a)return e;for(const s of a){const o=s.replace(zr,(d,m)=>m),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=l.error?l.error:((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"",u.error=l.error;else{const d=l;if(d.startsWith(_s))try{const m=d.replace(_s,"");u.id=m,await r({id:m}).then(h=>{const{name:p,error:g}=h;u.name=g||p||"",u.error=g})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?$h(e,u,t):s)}return e},uo=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},pd=e=>new URLSearchParams(window.location.search).get(e),La=(e="")=>e.replace(/\s+/g,"").length>0,Fs=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 Ee=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:d=!1,children:m=!1,...h})=>{const g=$n(typeof t=="object"),{showTooltip:f,tooltipProps:b}=so(!!u);if(typeof t=="object"&&typeof g=="number"){const A=Object.assign({},t),E=id(Object.keys(A));t=sd(g,E,A)}!l&&u&&(u="");const v=[];typeof t=="string"&&v.push(t),r&&(v.push("icon"),typeof r=="object"?(v.push(r.icon),r.position?v.push(r.position):v.push("left"),r.hover&&v.push(`hover_${r.hover}`),r.animate&&(v.push("animate"),typeof r.animate=="string"&&v.push(r.animate))):(v.push(r),!r.includes("right")&&!r.includes("left")&&v.push("left")));const C={...h,className:V(e,o,v,{"no-text":!m,disabled:l,button:a,muted:n.muted,"full-width":n.fullWidth}),onClick:A=>{(!a||a[0]==="#")&&s&&(A.preventDefault(),A.stopPropagation()),s&&s(A)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",C.href=a);const D=y.createElement(i,C,m||(d?c.jsx(Pe,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...b,children:[c.jsx(Ln,{isOpen:f,accessibility:{readToScreenreadersWhenClosed:!0},children:u}),D]}):D},pr=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?c.jsx(Ee,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(Ee,{...s})},o)});return y.createElement(a,{className:V("button-wrapper",n),...r,children:i})};const zt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:V(e,{"has-max-width":t}),style:n})},gu={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"}},Lh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?gu[e]:gu.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},zh=({format:e,height:t,query:n,width:r})=>{let a=`w=${r}&h=${t}`;return a=e?`${a}&fm=${e}`:a,a=n?`${a}&${n}`:a,a},ki=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${zh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const zn=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:m}=e,{range:h,sizes:p}=Lh(e),g=ki({format:"avif",query:s,range:h,url:o}),f=ki({format:"webp",query:s,range:h,url:o}),b=ki({format:"",query:s,range:h,url:o});return i&&i.includes("svg")?c.jsx("picture",{className:t,children:c.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:m||"auto",width:l,height:a,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[i!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:g,sizes:p,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:p,"data-testid":"source"}),c.jsx("img",{srcSet:b,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:m||"auto",width:l,height:a,"data-testid":n||"image"})]})};const qh=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(zn,{image:{...e},className:"image"})}),xn=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),c.jsx("a",{href:e,className:V("gtm-trackable",r),...l,children:t})}return n?y.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const gd=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:V("popover",e),"aria-live":"polite",children:t})}),gr=({parent:e=document.body,children:t})=>typeof document=="object"?Gc.createPortal(t,e):null,Uh=Object.freeze(Object.defineProperty({__proto__:null,default:gr},Symbol.toStringTag,{value:"Module"}));const Wh=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Pe,{children:c.jsx(ae.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 a=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:V("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:V("line",{active:a<e})})]},r)})})})]});const Vh=({elementId:e,offset:t=20})=>{const n=ae.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return c.jsx(Ee,{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 Hh=({items:e,className:t="",...n})=>c.jsx("ul",{className:V("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:i,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:a})]})},o))}),vu=300,bu="ease-in-out";class Kh{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:vu,easing:bu}),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:vu,easing:bu}),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 li=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ae.useIntl(),i=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new Kh(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:V("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},yu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Zh=e=>{let t=e;return Object.keys(yu).includes(e)&&(t=yu[e]),`url(${Gt}icons/${t}.svg)`};const xu={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},vd=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ae.useIntl(),i=t?{"--custom-icon":Zh(t)}:{},s=ui(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:V("content-type-label text-small",e in xu?xu[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const _t=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Gt}icons/${t}.svg)`}:{};return c.jsx("div",{className:V("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const Cn=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let a=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,s=$n(i);if(i&&typeof n=="object"&&typeof s=="number"){const m=Object.assign({},n.breakpoints),h=id(Object.keys(m));a=sd(s,h,m)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(_t,{variant:"subtle",className:V("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(Zt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(Ee,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const As=({children:e,...t})=>c.jsx("p",{...t,children:e}),bd={q:As,blockquote:As};for(let e=1;e<=6;e++)bd[`h${e}`]={component:As,props:{className:"title"}};const yd=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:V("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(Zt,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:bd},children:r}):c.jsx("p",{children:r})]});const xd=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,fadeStyle:s="default",children:o})=>{const l=ae.useIntl(),u=y.useRef(null);e||(e=Date.now().toString());const[d,m]=y.useState(""),[h,p]=y.useState("closed");y.useEffect(()=>{const b=u.current;if(b)return b.addEventListener("transitionend",g),()=>{b.removeEventListener("transitionend",g)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const b=a.split(`
35
+ Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"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_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_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",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_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_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",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:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},Ph={...hr,languageSwitcher_label:"Me gustaría leer este artículo en...",languageSwitcher_translation_original:"idioma original",languageSwitcher_translation_human:"traducido por un humano",languageSwitcher_translation_machine:"traducido por máquina",languageSwitcher_disclaimer:"Este contenido fue traducido automáticamente y ocasionalmente tendrá errores de género u otras traducciones directas. Estamos intentando resolver este problema, pero mientras tanto, si notas algún error grave, escríbenos a <link>{email}</link>"},Mh={...hr,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"},Nh={...hr,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>"},Ih=Object.freeze(Object.defineProperty({__proto__:null,en:hr,es:Ph,fr:Mh,pt:Nh},Symbol.toStringTag,{value:"Module"})),ui=(e,t=hr)=>e in t,Rt=(e,t,n,r,a={})=>{let i="";return ui(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},Rh=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let a=n.length-1;a>=0;a--){const i=Math.pow(10,(a+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&a<n.length-1&&(e=1,a++),r=`${e}${n[a]}`;break}}return r},Aa=(e,t)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),hd=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},$h=e=>{var i,s;const n=["name","organization","jobTitle","biography"].every(o=>{const l=e[o];return l!=null&&l!==""}),r=((i=e.image)==null?void 0:i.thumbnail)!==void 0,a=((s=e.location)==null?void 0:s.en)!==void 0;return n&&r&&a},Lh=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,Lr).replace(/{{id}}/g,Lr):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),pd=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(zr);if(!a)return e;for(const s of a){const o=s.replace(zr,(d,m)=>m),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=l.error?l.error:((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"",u.error=l.error;else{const d=l;if(d.startsWith(_s))try{const m=d.replace(_s,"");u.id=m,await r({id:m}).then(h=>{const{name:p,error:g}=h;u.name=g||p||"",u.error=g})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Lh(e,u,t):s)}return e},uo=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},gd=e=>new URLSearchParams(window.location.search).get(e),La=(e="")=>e.replace(/\s+/g,"").length>0,Fs=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 Ee=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:d=!1,children:m=!1,...h})=>{const g=$n(typeof t=="object"),{showTooltip:f,tooltipProps:b}=so(!!u);if(typeof t=="object"&&typeof g=="number"){const A=Object.assign({},t),E=sd(Object.keys(A));t=od(g,E,A)}!l&&u&&(u="");const v=[];typeof t=="string"&&v.push(t),r&&(v.push("icon"),typeof r=="object"?(v.push(r.icon),r.position?v.push(r.position):v.push("left"),r.hover&&v.push(`hover_${r.hover}`),r.animate&&(v.push("animate"),typeof r.animate=="string"&&v.push(r.animate))):(v.push(r),!r.includes("right")&&!r.includes("left")&&v.push("left")));const C={...h,className:V(e,o,v,{"no-text":!m,disabled:l,button:a,muted:n.muted,"full-width":n.fullWidth}),onClick:A=>{(!a||a[0]==="#")&&s&&(A.preventDefault(),A.stopPropagation()),s&&s(A)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",C.href=a);const D=y.createElement(i,C,m||(d?c.jsx(Pe,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...b,children:[c.jsx(Ln,{isOpen:f,accessibility:{readToScreenreadersWhenClosed:!0},children:u}),D]}):D},pr=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?c.jsx(Ee,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(Ee,{...s})},o)});return y.createElement(a,{className:V("button-wrapper",n),...r,children:i})};const zt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:V(e,{"has-max-width":t}),style:n})},gu={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"}},zh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?gu[e]:gu.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},qh=({format:e,height:t,query:n,width:r})=>{let a=`w=${r}&h=${t}`;return a=e?`${a}&fm=${e}`:a,a=n?`${a}&${n}`:a,a},ki=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${qh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const zn=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:m}=e,{range:h,sizes:p}=zh(e),g=ki({format:"avif",query:s,range:h,url:o}),f=ki({format:"webp",query:s,range:h,url:o}),b=ki({format:"",query:s,range:h,url:o});return i&&i.includes("svg")?c.jsx("picture",{className:t,children:c.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:m||"auto",width:l,height:a,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[i!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:g,sizes:p,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:p,"data-testid":"source"}),c.jsx("img",{srcSet:b,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:m||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Uh=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(zn,{image:{...e},className:"image"})}),xn=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),c.jsx("a",{href:e,className:V("gtm-trackable",r),...l,children:t})}return n?y.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const vd=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:V("popover",e),"aria-live":"polite",children:t})}),gr=({parent:e=document.body,children:t})=>typeof document=="object"?Qc.createPortal(t,e):null,Wh=Object.freeze(Object.defineProperty({__proto__:null,default:gr},Symbol.toStringTag,{value:"Module"}));const Vh=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Pe,{children:c.jsx(ae.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 a=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:V("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:V("line",{active:a<e})})]},r)})})})]});const Hh=({elementId:e,offset:t=20})=>{const n=ae.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return c.jsx(Ee,{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 Kh=({items:e,className:t="",...n})=>c.jsx("ul",{className:V("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:i,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:a})]})},o))}),vu=300,bu="ease-in-out";class Zh{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:vu,easing:bu}),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:vu,easing:bu}),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 li=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ae.useIntl(),i=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new Zh(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:V("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},yu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Yh=e=>{let t=e;return Object.keys(yu).includes(e)&&(t=yu[e]),`url(${Gt}icons/${t}.svg)`};const xu={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},bd=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ae.useIntl(),i=t?{"--custom-icon":Yh(t)}:{},s=ui(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:V("content-type-label text-small",e in xu?xu[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const _t=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Gt}icons/${t}.svg)`}:{};return c.jsx("div",{className:V("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const Cn=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let a=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,s=$n(i);if(i&&typeof n=="object"&&typeof s=="number"){const m=Object.assign({},n.breakpoints),h=sd(Object.keys(m));a=od(s,h,m)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(_t,{variant:"subtle",className:V("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(Zt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(Ee,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const As=({children:e,...t})=>c.jsx("p",{...t,children:e}),yd={q:As,blockquote:As};for(let e=1;e<=6;e++)yd[`h${e}`]={component:As,props:{className:"title"}};const xd=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:V("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(Zt,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:yd},children:r}):c.jsx("p",{children:r})]});const Cd=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,fadeStyle:s="default",children:o})=>{const l=ae.useIntl(),u=y.useRef(null);e||(e=Date.now().toString());const[d,m]=y.useState(""),[h,p]=y.useState("closed");y.useEffect(()=>{const b=u.current;if(b)return b.addEventListener("transitionend",g),()=>{b.removeEventListener("transitionend",g)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const b=a.split(`
36
36
  `);m(b.length<3?`${a.substring(0,400)}...`:b.slice(0,3).join(`
37
- `))},[a]),y.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:V("hide-show-text-box",t),children:[c.jsx("div",{ref:u,id:e,className:V("content",h,s),children:a?c.jsxs(c.Fragment,{children:[c.jsx(Zt,{options:{forceBlock:!0,...i},children:h==="closed"?d:a}),h!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(Ee,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:V({"rotate-180":f}),onClick:()=>{p(f?"ready-to-close":"opening")},"aria-expanded":f,"aria-controls":e,children:f?r||l.formatMessage({id:"hideShowTextBox_hide"}):n||l.formatMessage({id:"hideShowTextBox_show"})})})]})};const Yh=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return y.createElement(e,{className:V("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const d={wrapper:y.Fragment,forceInline:!0},m={"--icon":`url(${Gt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(y.Fragment,{children:[c.jsx("dt",{style:m,children:c.jsx(Zt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(Zt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:m,children:typeof l.text=="string"?c.jsx(Zt,{options:d,children:l.text}):l.text},u)})})},ut=()=>y.Fragment,Gh=({children:e})=>c.jsx(_t,{variant:"secondary",children:e}),Qh=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),Jh=["span","strong","h1","h2","h3","h4","h5","h6","p"],Xh=({children:e})=>{const t=ae.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of y.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(y.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of y.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&y.isValidElement(s)){const o=s.type;if(Jh.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(i);const a=n?n.toString():"";return c.jsx(li,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},ep=({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}),tp=e=>{const t=ae.useIntl(),n=Date.now().toString();let r="default";const a=e.src;a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet");const i=`content-after-iframe-${n}`;return c.jsxs(c.Fragment,{children:[c.jsx(Pe,{element:"a",href:`#${i}`,onClick:s=>{s.preventDefault(),s.stopPropagation();const o=document.getElementById(i);o==null||o.scrollIntoView({behavior:"smooth"}),o==null||o.focus()},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),c.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),c.jsx("span",{id:i,tabIndex:0})]})},Cu=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},np=({children:e,...t})=>{const n=ae.useIntl();let r={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(r.target="_blank");let a=e,i=!1;for(const o of y.Children.toArray(e))if(!(!o||typeof o=="string"||typeof o=="number")&&y.isValidElement(o)){const l=o.type;if(["button","center","span","strong"].includes(l)&&o.props&&o.props.children&&o.props.children[0])for((l==="button"||Cu(o.props.children[0])==="button")&&(i=!0),a=o.props.children[0];a&&typeof a!="string"&&!(typeof a=="boolean"||typeof a=="number"||!y.isValidElement(a));)if(a.props&&a.props.children&&a.props.children[0])a=a.props.children[0],a&&Cu(a)==="button"&&(i=!0);else break}const s=`@${Lr}`;return a===s||Array.isArray(a)&&a[0]===s?(delete r.href,delete r.target,c.jsxs("span",{...r,className:"mention deleted-user",children:["@",n.formatMessage({id:"member_deleted"})]})):i?(r={...r,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(Ee,{variant:"primary",size:"medium",...r,children:a})})):c.jsx("a",{...r,children:a})},Bs=({children:e,...t})=>c.jsx("span",{className:V({url:t==null?void 0:t.href}),children:e});const rp={default:{a:np,CollapsibleSection:li,TextBox:_t,CaseStudy:Gh,style:ut,details:Xh,div:ep,iframe:tp,center:Qh},"text-only":{h1:ut,h2:ut,h3:ut,h4:ut,h5:ut,h6:ut,style:ut,details:ut,div:ut,TextBox:ut,CollapsibleSection:ut,CaseStudy:ut,blockquote:ut,iframe:ut,button:ut}},On=({element:e="div",className:t="",options:n={},children:r,overrideType:a="default",styling:i={}})=>{if(!r)return null;const{highlightTitles:s=!1}=i;r=r.replace(/^<br\/?>/,"");const o={wrapper:y.Fragment,forceBlock:!0};let l=rp[a];return n.overrides&&(l={...l,...n.overrides}),y.createElement(e,{className:V("markdown-text",t,{"highlight-titles":s}),children:c.jsx(Zt,{options:{...o,...n,overrides:l},children:r})})};const Cd=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a="",ctaButton:i})=>{const s=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:V("page-heading",a),children:[c.jsxs("div",{className:V("content",{"has-max-width":e}),style:s,children:[c.jsxs("div",{className:V("content-wrapper",{"has-max-width":e}),children:[t&&t.text&&y.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&y.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),i&&c.jsx(Ee,{...i,className:V("cta-button","gtm-trackable"),"data-gtm-event-context":"CreateNewArticle","data-gtm-event-type":"create-article-click",children:i.text})]}),r]})};const Yt=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,element:s="span",...o})=>{const l={"--icon":`url(${Gt}icons/${r}.svg)`},{showTooltip:u,tooltipProps:d}=so(!!a),m={},h=a?typeof a=="string"?`tooltip-${window.btoa(a)}`:a.id:void 0,p=a?typeof a=="string"?a:a.text:void 0;a&&h&&(m["aria-describedby"]=h);const g=y.createElement(a?"button":s,{className:V("pill",e,t,n,{"has-icon":r}),style:l,children:i,...d,...m,...o});return a?y.createElement(s,{className:"pill-wrapper"},c.jsxs(c.Fragment,{children:[g,c.jsx(Ln,{id:h,isOpen:u,children:p})]})):g};const ur=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:V("status-banner text-small",n),"aria-live":"assertive"},t),lo=y.createContext({badges:[],isLoading:!0});function wd(){return y.useContext(lo)}const Dd=({children:e,badges:t})=>c.jsx(lo.Provider,{value:t,children:e}),Ed=({showDevTools:e=!0,children:t})=>{const n=new Ke.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(Ke.QueryClientProvider,{client:n,children:[t,e&&c.jsx(vh.ReactQueryDevtools,{initialIsOpen:!1})]})};var ap=y.createContext({client:Fa});function ip(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=y.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(Fa.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Fa.init(r,a)),Fa)},[n,r]);return y.createElement(ap.Provider,{value:{client:i}},t)}const _d=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(ip,{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 kd=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(kd||{});const Fd=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Nh[r],...n||{}};return c.jsx(ae.IntlProvider,{locale:r,messages:a,children:e})},co=y.createContext({}),Ba={en:"English",es:"Español",fr:"Français",pt:"Português"},it=y.createContext({isLoading:!0});function ci(){return y.useContext(it)}const Ad=({children:e,user:t,updateDetails:n})=>c.jsx(it.Provider,{value:{...t,updateDetails:n},children:e}),fo=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Bd=()=>y.useContext(fo),Td=({children:e})=>{const[t,n]=y.useState([]);y.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=y.useCallback(i=>{n(s=>[...s,i])},[]),a=y.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return c.jsx(fo.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},sp=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=y.useState({isLoading:!0}),[s,o]=y.useState({badges:[],isLoading:!0}),l=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[u,d]=y.useState(l),m=h=>{localStorage.setItem("language",h),d(h)};return y.useEffect(()=>{e().then(h=>{Array.isArray(h)?(i({...h[0],isLoading:!1}),o({badges:h[1],isLoading:!1})):i({...h,isLoading:!1}),md(5e3)}).catch(h=>{h.message===cd&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(co.Provider,{value:{language:u,updateLanguage:m},children:c.jsx(Fd,{locale:u,messages:n==null?void 0:n.messages,children:c.jsx(ao.CookiesProvider,{children:c.jsx(Ad,{user:a,updateDetails:i,children:c.jsx(Dd,{badges:s,children:c.jsx(Td,{children:c.jsx(Ed,{showDevTools:r,children:c.jsx(_d,{user:a,children:t})})})})})})})})},op={globe:"globe",heart:"heart_empty_thick",pencil:"pencil",star:"star_empty","speech-bubble":"speech-bubble_round"};const Sd=({slug:e})=>{const{badges:t}=wd(),n=t==null?void 0:t.find(o=>o.slug===e);if(!n)return null;const{name:r,icon:a,colour:i,description:s}=n;return c.jsx(Yt,{className:V("user-badge",i==null?void 0:i.toLowerCase()),icon:a&&op[a],element:"li",tooltip:s,children:r})};var ct=(e=>(e.Communities="communities",e.Platform="platform",e))(ct||{});const jd=({element:e="ul",userBadges:t,badgeOptions:n})=>{if(Object.keys(t).length!==0)return y.createElement(e,{className:"badges-list",children:(n==null?void 0:n.scopes)&&(n==null?void 0:n.scopes.map(r=>{var a,i;return(i=(a=t==null?void 0:t[r.scope])==null?void 0:a[r.area])==null?void 0:i.map((s,o)=>c.jsx(Sd,{slug:s},o))}))})};const up=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ae.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,d={"--progress":`${t}%`};return c.jsx("span",{className:V(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:y.createElement(i?"span":Pe,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},mo=y.memo(up);const Fi="loadingBlock_",lp=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ae.useIntl();t||(t={0:{text:r.formatMessage({id:`${Fi}loading`})},75:{text:r.formatMessage({id:`${Fi}almostDone`})},100:{text:r.formatMessage({id:`${Fi}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${Gt}icons/${t[a].icon}.svg)`}:{};return c.jsxs(_t,{className:V("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&c.jsx("span",{className:"step",children:t[a].text}),c.jsx(mo,{progress:e})]})},Od=y.memo(lp);const Nt=({element:e="div",className:t="",...n})=>c.jsx(oi,{element:e,className:V("loading-placeholder",t),...n});const Ts={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"]},Pd=(e,t)=>e in Ts?c.jsx("div",{className:e,children:Ts[e].map((n,r)=>Pd(n,r))},t):c.jsx(Nt,{className:e},t),di=({layout:e="overview-page",...t})=>c.jsx("div",{className:V("loading-state",e),...t,children:Ts[e].map((n,r)=>Pd(n,r))}),Md=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):""},aa=["#5AB6A3","#A2D7AF","#806056","#3962B3"],cp=e=>{const t=Math.ceil(26/aa.length),n=Md(e).toLowerCase();if(n==="")return aa[0];const r=n.charCodeAt(0)-96;for(let a=0;a<aa.length;a++)if(r<=t*(a+1))return aa[a]};const wu=256,un=({className:e="",src:t="",name:n,alt:r,width:a=wu,height:i=wu,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),d=y.useRef(null),m=r??n;y.useEffect(()=>{const p=d.current;if(!p)return;const g=p.getContext("2d");if(!g)return;const f=a,b=i;typeof window<"u"&&window.devicePixelRatio&&(p.width=f*window.devicePixelRatio,p.height=b*window.devicePixelRatio,g.scale(window.devicePixelRatio,window.devicePixelRatio)),g.fillStyle=cp(n),g.fillRect(0,0,f,b),g.font=`${f/3}px Arial`,g.textAlign="center",g.fillStyle="white",g.fillText(Md(n),f/2,b/1.6)},[n]);let h=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(h=!0),c.jsx("figure",{className:V("profile-picture",e,{error:l}),...o,children:h?c.jsx("img",{src:t,alt:m,onError:()=>{u(!0)},width:a,height:i}):s?c.jsx("canvas",{ref:d}):c.jsx("span",{className:"fallback"})})};var rt=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(rt||{});const fi=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},dp=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const a=e!=="",i=t!=="",s=n!=="";if(!a&&!i&&!s)return"";const o=`${e}${a&&i?` — ${t}`:t}`;let l=`${o}${(a||i)&&s?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=sr(l,r)),l};const fp=y.lazy(()=>Promise.resolve().then(()=>Uh)),mp=y.lazy(()=>Promise.resolve().then(()=>$_));let ia=null;const an=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:a={},functions:i={},gtmContext:s="member",gtmType:o="member-click",className:l="",badges:u,...d})=>{var F,j,O,q,W;const m=ae.useIntl(),{profile:h,...p}=i,{size:g="medium",variant:f="inline",isCondensed:b=!0,additionalContentNewLine:v=!1}=a,C=y.useContext(it),D=h&&C&&typeof C.id=="string",[A,E]=y.useState(!1),k=fi(t);k.name||(k.name=m.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:T,image:$}=k;let{url:P}=k;typeof t=="object"&&t.link!==void 0&&(t.link===!1?P=void 0:P=t.link);const z=dp(k),L=r&&r.createdAt?ks(r.createdAt):!1,B=r&&r.createdAt?oo(r.createdAt):"";return y.createElement(e,{...d,className:V("member text-medium",g,f,l,{"has-profile-link":D}),...p,children:c.jsxs(c.Fragment,{children:[c.jsxs(xn,{href:P,gtmType:o,gtmContext:s,onClick:ne=>{if(ne==null||ne.preventDefault(),ne==null||ne.stopPropagation(),!P)return;ia&&clearTimeout(ia),ia=setTimeout(()=>{window.location.href=P},150);const J=new CustomEvent(rt.MEMBER_CLICKED,{detail:{link:P,timeout:ia}});document.dispatchEvent(J)},children:[c.jsx(un,{name:T,src:$,alt:n}),c.jsxs("div",{className:"details",children:[c.jsxs("div",{className:V("name",{"new-line":v}),"data-testid":"member-name",children:[c.jsx("span",{children:T}),(u==null?void 0:u.showBadges)&&(k==null?void 0:k.badges)&&c.jsx(jd,{userBadges:k.badges,badgeOptions:u}),r&&c.jsxs("span",{className:V("additional-content",{"new-line":v}),children:[r.createdAt&&L&&!((F=r==null?void 0:r.customMessage)!=null&&F.text)&&c.jsx("span",{className:"date",title:B,"aria-label":B,"data-testid":"date",children:m.formatMessage({id:`dates_${L.path}`},{number:L.number})}),r.createdAt&&L&&((j=r==null?void 0:r.customMessage)==null?void 0:j.text)&&c.jsx("span",{children:m.formatMessage({id:(O=r.customMessage)==null?void 0:O.text},{time:m.formatMessage({id:`dates_${L.path}`},{number:L.number}),community:(W=(q=r.customMessage)==null?void 0:q.link)==null?void 0:W.text,link:ne=>{var J,w;return c.jsx("a",{href:`${(w=(J=r.customMessage)==null?void 0:J.link)==null?void 0:w.url}`,onClick:Q=>Q.stopPropagation(),children:ne})}})}),r.didEdit&&c.jsx("em",{children:m.formatMessage({id:"discussion_edited"})})]})]}),z&&!v&&c.jsx("small",{className:V({"text-medium":g==="large"}),"data-testid":"member-details",children:b?z:c.jsxs(c.Fragment,{children:[k.role,k.organisation?` — ${k.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:k.country})]})})]})]}),z&&h&&D?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"tertiary",size:"small",onClick:ne=>{ne.preventDefault(),ne.stopPropagation(),E(!0)},"data-testid":"profile-button",children:m.formatMessage({id:"member_profile"})}),c.jsx(fp,{children:c.jsx(mp,{form:h,showModal:A,content:{title:m.formatMessage({id:"member_profile"})},functions:{onClose:()=>{E(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},hp=Object.freeze(Object.defineProperty({__proto__:null,default:an},Symbol.toStringTag,{value:"Module"}));const Du={small:24,medium:48},ho=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...d})=>{const m=ae.useIntl();return!n||n.length===0?null:y.createElement(e,{...d,className:V("contributors",u,a,{"has-gap":i}),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=""}=fi(h);if(s)return c.jsx(Nt,{element:"li",className:"contributor"},p);g=c.jsx(un,{name:b,src:v,width:Du[a||"medium"],height:Du[a||"medium"]})}else if(p===o){const b=(t||n.length)-o;g=c.jsxs("small",{className:V({"large-number":b>99}),children:["+",Ih(b,0)]}),f="number-left"}return g?c.jsx("li",{className:V("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):l||null})]})})};const po=({element:e="section",children:t,className:n,...r})=>y.createElement(e,{className:V("modal",n),children:typeof t=="string"?c.jsx("p",{children:t}):t,...r});var Ss={exports:{}},sa={exports:{}},Re={};/** @license React v16.13.1
37
+ `))},[a]),y.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:V("hide-show-text-box",t),children:[c.jsx("div",{ref:u,id:e,className:V("content",h,s),children:a?c.jsxs(c.Fragment,{children:[c.jsx(Zt,{options:{forceBlock:!0,...i},children:h==="closed"?d:a}),h!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(Ee,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:V({"rotate-180":f}),onClick:()=>{p(f?"ready-to-close":"opening")},"aria-expanded":f,"aria-controls":e,children:f?r||l.formatMessage({id:"hideShowTextBox_hide"}):n||l.formatMessage({id:"hideShowTextBox_show"})})})]})};const Gh=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return y.createElement(e,{className:V("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const d={wrapper:y.Fragment,forceInline:!0},m={"--icon":`url(${Gt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(y.Fragment,{children:[c.jsx("dt",{style:m,children:c.jsx(Zt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(Zt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:m,children:typeof l.text=="string"?c.jsx(Zt,{options:d,children:l.text}):l.text},u)})})},ut=()=>y.Fragment,Qh=({children:e})=>c.jsx(_t,{variant:"secondary",children:e}),Jh=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),Xh=["span","strong","h1","h2","h3","h4","h5","h6","p"],ep=({children:e})=>{const t=ae.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of y.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(y.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of y.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&y.isValidElement(s)){const o=s.type;if(Xh.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(i);const a=n?n.toString():"";return c.jsx(li,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},tp=({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}),np=e=>{const t=ae.useIntl(),n=Date.now().toString();let r="default";const a=e.src;a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet");const i=`content-after-iframe-${n}`;return c.jsxs(c.Fragment,{children:[c.jsx(Pe,{element:"a",href:`#${i}`,onClick:s=>{s.preventDefault(),s.stopPropagation();const o=document.getElementById(i);o==null||o.scrollIntoView({behavior:"smooth"}),o==null||o.focus()},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),c.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),c.jsx("span",{id:i,tabIndex:0})]})},Cu=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},rp=({children:e,...t})=>{const n=ae.useIntl();let r={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(r.target="_blank");let a=e,i=!1;for(const o of y.Children.toArray(e))if(!(!o||typeof o=="string"||typeof o=="number")&&y.isValidElement(o)){const l=o.type;if(["button","center","span","strong"].includes(l)&&o.props&&o.props.children&&o.props.children[0])for((l==="button"||Cu(o.props.children[0])==="button")&&(i=!0),a=o.props.children[0];a&&typeof a!="string"&&!(typeof a=="boolean"||typeof a=="number"||!y.isValidElement(a));)if(a.props&&a.props.children&&a.props.children[0])a=a.props.children[0],a&&Cu(a)==="button"&&(i=!0);else break}const s=`@${Lr}`;return a===s||Array.isArray(a)&&a[0]===s?(delete r.href,delete r.target,c.jsxs("span",{...r,className:"mention deleted-user",children:["@",n.formatMessage({id:"member_deleted"})]})):i?(r={...r,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(Ee,{variant:"primary",size:"medium",...r,children:a})})):c.jsx("a",{...r,children:a})},Bs=({children:e,...t})=>c.jsx("span",{className:V({url:t==null?void 0:t.href}),children:e});const ap={default:{a:rp,CollapsibleSection:li,TextBox:_t,CaseStudy:Qh,style:ut,details:ep,div:tp,iframe:np,center:Jh},"text-only":{h1:ut,h2:ut,h3:ut,h4:ut,h5:ut,h6:ut,style:ut,details:ut,div:ut,TextBox:ut,CollapsibleSection:ut,CaseStudy:ut,blockquote:ut,iframe:ut,button:ut}},On=({element:e="div",className:t="",options:n={},children:r,overrideType:a="default",styling:i={}})=>{if(!r)return null;const{highlightTitles:s=!1}=i;r=r.replace(/^<br\/?>/,"");const o={wrapper:y.Fragment,forceBlock:!0};let l=ap[a];return n.overrides&&(l={...l,...n.overrides}),y.createElement(e,{className:V("markdown-text",t,{"highlight-titles":s}),children:c.jsx(Zt,{options:{...o,...n,overrides:l},children:r})})};const wd=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a="",ctaButton:i})=>{const s=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:V("page-heading",a),children:[c.jsxs("div",{className:V("content",{"has-max-width":e}),style:s,children:[c.jsxs("div",{className:V("content-wrapper",{"has-max-width":e}),children:[t&&t.text&&y.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&y.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),i&&c.jsx(Ee,{...i,className:V("cta-button","gtm-trackable"),"data-gtm-event-context":"CreateNewArticle","data-gtm-event-type":"create-article-click",children:i.text})]}),r]})};const Yt=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,element:s="span",...o})=>{const l={"--icon":`url(${Gt}icons/${r}.svg)`},{showTooltip:u,tooltipProps:d}=so(!!a),m={},h=a?typeof a=="string"?`tooltip-${window.btoa(a)}`:a.id:void 0,p=a?typeof a=="string"?a:a.text:void 0;a&&h&&(m["aria-describedby"]=h);const g=y.createElement(a?"button":s,{className:V("pill",e,t,n,{"has-icon":r}),style:l,children:i,...d,...m,...o});return a?y.createElement(s,{className:"pill-wrapper"},c.jsxs(c.Fragment,{children:[g,c.jsx(Ln,{id:h,isOpen:u,children:p})]})):g};const ur=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:V("status-banner text-small",n),"aria-live":"assertive"},t),lo=y.createContext({badges:[],isLoading:!0});function Dd(){return y.useContext(lo)}const Ed=({children:e,badges:t})=>c.jsx(lo.Provider,{value:t,children:e}),_d=({showDevTools:e=!0,children:t})=>{const n=new Ke.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(Ke.QueryClientProvider,{client:n,children:[t,e&&c.jsx(bh.ReactQueryDevtools,{initialIsOpen:!1})]})};var ip=y.createContext({client:Fa});function sp(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=y.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(Fa.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Fa.init(r,a)),Fa)},[n,r]);return y.createElement(ip.Provider,{value:{client:i}},t)}const kd=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(sp,{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 Fd=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(Fd||{});const Ad=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Ih[r],...n||{}};return c.jsx(ae.IntlProvider,{locale:r,messages:a,children:e})},co=y.createContext({}),Ba={en:"English",es:"Español",fr:"Français",pt:"Português"},it=y.createContext({isLoading:!0});function ci(){return y.useContext(it)}const Bd=({children:e,user:t,updateDetails:n})=>c.jsx(it.Provider,{value:{...t,updateDetails:n},children:e}),fo=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Td=()=>y.useContext(fo),Sd=({children:e})=>{const[t,n]=y.useState([]);y.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=y.useCallback(i=>{n(s=>[...s,i])},[]),a=y.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return c.jsx(fo.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},op=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=y.useState({isLoading:!0}),[s,o]=y.useState({badges:[],isLoading:!0}),l=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[u,d]=y.useState(l),m=h=>{localStorage.setItem("language",h),d(h)};return y.useEffect(()=>{e().then(h=>{Array.isArray(h)?(i({...h[0],isLoading:!1}),o({badges:h[1],isLoading:!1})):i({...h,isLoading:!1}),hd(5e3)}).catch(h=>{h.message===dd&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(co.Provider,{value:{language:u,updateLanguage:m},children:c.jsx(Ad,{locale:u,messages:n==null?void 0:n.messages,children:c.jsx(ao.CookiesProvider,{children:c.jsx(Bd,{user:a,updateDetails:i,children:c.jsx(Ed,{badges:s,children:c.jsx(Sd,{children:c.jsx(_d,{showDevTools:r,children:c.jsx(kd,{user:a,children:t})})})})})})})})},up={globe:"globe",heart:"heart_empty_thick",pencil:"pencil",star:"star_empty","speech-bubble":"speech-bubble_round"};const jd=({slug:e})=>{const{badges:t}=Dd(),n=t==null?void 0:t.find(o=>o.slug===e);if(!n)return null;const{name:r,icon:a,colour:i,description:s}=n;return c.jsx(Yt,{className:V("user-badge",i==null?void 0:i.toLowerCase()),icon:a&&up[a],element:"li",tooltip:s,children:r})};var ct=(e=>(e.Communities="communities",e.Platform="platform",e))(ct||{});const Od=({element:e="ul",userBadges:t,badgeOptions:n})=>{if(Object.keys(t).length!==0)return y.createElement(e,{className:"badges-list",children:(n==null?void 0:n.scopes)&&(n==null?void 0:n.scopes.map(r=>{var a,i;return(i=(a=t==null?void 0:t[r.scope])==null?void 0:a[r.area])==null?void 0:i.map((s,o)=>c.jsx(jd,{slug:s},o))}))})};const lp=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ae.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,d={"--progress":`${t}%`};return c.jsx("span",{className:V(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:y.createElement(i?"span":Pe,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},mo=y.memo(lp);const Fi="loadingBlock_",cp=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ae.useIntl();t||(t={0:{text:r.formatMessage({id:`${Fi}loading`})},75:{text:r.formatMessage({id:`${Fi}almostDone`})},100:{text:r.formatMessage({id:`${Fi}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${Gt}icons/${t[a].icon}.svg)`}:{};return c.jsxs(_t,{className:V("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&c.jsx("span",{className:"step",children:t[a].text}),c.jsx(mo,{progress:e})]})},Pd=y.memo(cp);const Nt=({element:e="div",className:t="",...n})=>c.jsx(oi,{element:e,className:V("loading-placeholder",t),...n});const Ts={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"]},Md=(e,t)=>e in Ts?c.jsx("div",{className:e,children:Ts[e].map((n,r)=>Md(n,r))},t):c.jsx(Nt,{className:e},t),di=({layout:e="overview-page",...t})=>c.jsx("div",{className:V("loading-state",e),...t,children:Ts[e].map((n,r)=>Md(n,r))}),Nd=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):""},aa=["#5AB6A3","#A2D7AF","#806056","#3962B3"],dp=e=>{const t=Math.ceil(26/aa.length),n=Nd(e).toLowerCase();if(n==="")return aa[0];const r=n.charCodeAt(0)-96;for(let a=0;a<aa.length;a++)if(r<=t*(a+1))return aa[a]};const wu=256,un=({className:e="",src:t="",name:n,alt:r,width:a=wu,height:i=wu,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),d=y.useRef(null),m=r??n;y.useEffect(()=>{const p=d.current;if(!p)return;const g=p.getContext("2d");if(!g)return;const f=a,b=i;typeof window<"u"&&window.devicePixelRatio&&(p.width=f*window.devicePixelRatio,p.height=b*window.devicePixelRatio,g.scale(window.devicePixelRatio,window.devicePixelRatio)),g.fillStyle=dp(n),g.fillRect(0,0,f,b),g.font=`${f/3}px Arial`,g.textAlign="center",g.fillStyle="white",g.fillText(Nd(n),f/2,b/1.6)},[n]);let h=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(h=!0),c.jsx("figure",{className:V("profile-picture",e,{error:l}),...o,children:h?c.jsx("img",{src:t,alt:m,onError:()=>{u(!0)},width:a,height:i}):s?c.jsx("canvas",{ref:d}):c.jsx("span",{className:"fallback"})})};var rt=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(rt||{});const fi=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},fp=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const a=e!=="",i=t!=="",s=n!=="";if(!a&&!i&&!s)return"";const o=`${e}${a&&i?` — ${t}`:t}`;let l=`${o}${(a||i)&&s?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=sr(l,r)),l};const mp=y.lazy(()=>Promise.resolve().then(()=>Wh)),hp=y.lazy(()=>Promise.resolve().then(()=>$_));let ia=null;const an=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:a={},functions:i={},gtmContext:s="member",gtmType:o="member-click",className:l="",badges:u,...d})=>{var F,j,O,q,W;const m=ae.useIntl(),{profile:h,...p}=i,{size:g="medium",variant:f="inline",isCondensed:b=!0,additionalContentNewLine:v=!1}=a,C=y.useContext(it),D=h&&C&&typeof C.id=="string",[A,E]=y.useState(!1),k=fi(t);k.name||(k.name=m.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:T,image:$}=k;let{url:P}=k;typeof t=="object"&&t.link!==void 0&&(t.link===!1?P=void 0:P=t.link);const z=fp(k),L=r&&r.createdAt?ks(r.createdAt):!1,B=r&&r.createdAt?oo(r.createdAt):"";return y.createElement(e,{...d,className:V("member text-medium",g,f,l,{"has-profile-link":D}),...p,children:c.jsxs(c.Fragment,{children:[c.jsxs(xn,{href:P,gtmType:o,gtmContext:s,onClick:ne=>{if(ne==null||ne.preventDefault(),ne==null||ne.stopPropagation(),!P)return;ia&&clearTimeout(ia),ia=setTimeout(()=>{window.location.href=P},150);const J=new CustomEvent(rt.MEMBER_CLICKED,{detail:{link:P,timeout:ia}});document.dispatchEvent(J)},children:[c.jsx(un,{name:T,src:$,alt:n}),c.jsxs("div",{className:"details",children:[c.jsxs("div",{className:V("name",{"new-line":v}),"data-testid":"member-name",children:[c.jsx("span",{children:T}),(u==null?void 0:u.showBadges)&&(k==null?void 0:k.badges)&&c.jsx(Od,{userBadges:k.badges,badgeOptions:u}),r&&c.jsxs("span",{className:V("additional-content",{"new-line":v}),children:[r.createdAt&&L&&!((F=r==null?void 0:r.customMessage)!=null&&F.text)&&c.jsx("span",{className:"date",title:B,"aria-label":B,"data-testid":"date",children:m.formatMessage({id:`dates_${L.path}`},{number:L.number})}),r.createdAt&&L&&((j=r==null?void 0:r.customMessage)==null?void 0:j.text)&&c.jsx("span",{children:m.formatMessage({id:(O=r.customMessage)==null?void 0:O.text},{time:m.formatMessage({id:`dates_${L.path}`},{number:L.number}),community:(W=(q=r.customMessage)==null?void 0:q.link)==null?void 0:W.text,link:ne=>{var J,w;return c.jsx("a",{href:`${(w=(J=r.customMessage)==null?void 0:J.link)==null?void 0:w.url}`,onClick:Q=>Q.stopPropagation(),children:ne})}})}),r.didEdit&&c.jsx("em",{children:m.formatMessage({id:"discussion_edited"})})]})]}),z&&!v&&c.jsx("small",{className:V({"text-medium":g==="large"}),"data-testid":"member-details",children:b?z:c.jsxs(c.Fragment,{children:[k.role,k.organisation?` — ${k.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:k.country})]})})]})]}),z&&h&&D?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"tertiary",size:"small",onClick:ne=>{ne.preventDefault(),ne.stopPropagation(),E(!0)},"data-testid":"profile-button",children:m.formatMessage({id:"member_profile"})}),c.jsx(mp,{children:c.jsx(hp,{form:h,showModal:A,content:{title:m.formatMessage({id:"member_profile"})},functions:{onClose:()=>{E(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},pp=Object.freeze(Object.defineProperty({__proto__:null,default:an},Symbol.toStringTag,{value:"Module"}));const Du={small:24,medium:48},ho=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...d})=>{const m=ae.useIntl();return!n||n.length===0?null:y.createElement(e,{...d,className:V("contributors",u,a,{"has-gap":i}),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=""}=fi(h);if(s)return c.jsx(Nt,{element:"li",className:"contributor"},p);g=c.jsx(un,{name:b,src:v,width:Du[a||"medium"],height:Du[a||"medium"]})}else if(p===o){const b=(t||n.length)-o;g=c.jsxs("small",{className:V({"large-number":b>99}),children:["+",Rh(b,0)]}),f="number-left"}return g?c.jsx("li",{className:V("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):l||null})]})})};const po=({element:e="section",children:t,className:n,...r})=>y.createElement(e,{className:V("modal",n),children:typeof t=="string"?c.jsx("p",{children:t}):t,...r});var Ss={exports:{}},sa={exports:{}},Re={};/** @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 Eu;function pp(){if(Eu)return Re;Eu=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,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=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,C=e?Symbol.for("react.scope"):60119;function D(E){if(typeof E=="object"&&E!==null){var k=E.$$typeof;switch(k){case t:switch(E=E.type,E){case l:case u:case r:case i:case a:case m:return E;default:switch(E=E&&E.$$typeof,E){case o:case d:case g:case p:case s:return E;default:return k}}case n:return k}}}function A(E){return D(E)===u}return Re.AsyncMode=l,Re.ConcurrentMode=u,Re.ContextConsumer=o,Re.ContextProvider=s,Re.Element=t,Re.ForwardRef=d,Re.Fragment=r,Re.Lazy=g,Re.Memo=p,Re.Portal=n,Re.Profiler=i,Re.StrictMode=a,Re.Suspense=m,Re.isAsyncMode=function(E){return A(E)||D(E)===l},Re.isConcurrentMode=A,Re.isContextConsumer=function(E){return D(E)===o},Re.isContextProvider=function(E){return D(E)===s},Re.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===t},Re.isForwardRef=function(E){return D(E)===d},Re.isFragment=function(E){return D(E)===r},Re.isLazy=function(E){return D(E)===g},Re.isMemo=function(E){return D(E)===p},Re.isPortal=function(E){return D(E)===n},Re.isProfiler=function(E){return D(E)===i},Re.isStrictMode=function(E){return D(E)===a},Re.isSuspense=function(E){return D(E)===m},Re.isValidElementType=function(E){return typeof E=="string"||typeof E=="function"||E===r||E===u||E===i||E===a||E===m||E===h||typeof E=="object"&&E!==null&&(E.$$typeof===g||E.$$typeof===p||E.$$typeof===s||E.$$typeof===o||E.$$typeof===d||E.$$typeof===b||E.$$typeof===v||E.$$typeof===C||E.$$typeof===f)},Re.typeOf=D,Re}var $e={};/** @license React v16.13.1
44
+ */var Eu;function gp(){if(Eu)return Re;Eu=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,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=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,C=e?Symbol.for("react.scope"):60119;function D(E){if(typeof E=="object"&&E!==null){var k=E.$$typeof;switch(k){case t:switch(E=E.type,E){case l:case u:case r:case i:case a:case m:return E;default:switch(E=E&&E.$$typeof,E){case o:case d:case g:case p:case s:return E;default:return k}}case n:return k}}}function A(E){return D(E)===u}return Re.AsyncMode=l,Re.ConcurrentMode=u,Re.ContextConsumer=o,Re.ContextProvider=s,Re.Element=t,Re.ForwardRef=d,Re.Fragment=r,Re.Lazy=g,Re.Memo=p,Re.Portal=n,Re.Profiler=i,Re.StrictMode=a,Re.Suspense=m,Re.isAsyncMode=function(E){return A(E)||D(E)===l},Re.isConcurrentMode=A,Re.isContextConsumer=function(E){return D(E)===o},Re.isContextProvider=function(E){return D(E)===s},Re.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===t},Re.isForwardRef=function(E){return D(E)===d},Re.isFragment=function(E){return D(E)===r},Re.isLazy=function(E){return D(E)===g},Re.isMemo=function(E){return D(E)===p},Re.isPortal=function(E){return D(E)===n},Re.isProfiler=function(E){return D(E)===i},Re.isStrictMode=function(E){return D(E)===a},Re.isSuspense=function(E){return D(E)===m},Re.isValidElementType=function(E){return typeof E=="string"||typeof E=="function"||E===r||E===u||E===i||E===a||E===m||E===h||typeof E=="object"&&E!==null&&(E.$$typeof===g||E.$$typeof===p||E.$$typeof===s||E.$$typeof===o||E.$$typeof===d||E.$$typeof===b||E.$$typeof===v||E.$$typeof===C||E.$$typeof===f)},Re.typeOf=D,Re}var $e={};/** @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 _u;function gp(){return _u||(_u=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,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=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,C=e?Symbol.for("react.scope"):60119;function D(X){return typeof X=="string"||typeof X=="function"||X===r||X===u||X===i||X===a||X===m||X===h||typeof X=="object"&&X!==null&&(X.$$typeof===g||X.$$typeof===p||X.$$typeof===s||X.$$typeof===o||X.$$typeof===d||X.$$typeof===b||X.$$typeof===v||X.$$typeof===C||X.$$typeof===f)}function A(X){if(typeof X=="object"&&X!==null){var pe=X.$$typeof;switch(pe){case t:var ve=X.type;switch(ve){case l:case u:case r:case i:case a:case m:return ve;default:var ye=ve&&ve.$$typeof;switch(ye){case o:case d:case g:case p:case s:return ye;default:return pe}}case n:return pe}}}var E=l,k=u,T=o,$=s,P=t,z=d,L=r,B=g,F=p,j=n,O=i,q=a,W=m,ne=!1;function J(X){return ne||(ne=!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.")),w(X)||A(X)===l}function w(X){return A(X)===u}function Q(X){return A(X)===o}function se(X){return A(X)===s}function _(X){return typeof X=="object"&&X!==null&&X.$$typeof===t}function M(X){return A(X)===d}function U(X){return A(X)===r}function S(X){return A(X)===g}function R(X){return A(X)===p}function K(X){return A(X)===n}function Z(X){return A(X)===i}function re(X){return A(X)===a}function ce(X){return A(X)===m}$e.AsyncMode=E,$e.ConcurrentMode=k,$e.ContextConsumer=T,$e.ContextProvider=$,$e.Element=P,$e.ForwardRef=z,$e.Fragment=L,$e.Lazy=B,$e.Memo=F,$e.Portal=j,$e.Profiler=O,$e.StrictMode=q,$e.Suspense=W,$e.isAsyncMode=J,$e.isConcurrentMode=w,$e.isContextConsumer=Q,$e.isContextProvider=se,$e.isElement=_,$e.isForwardRef=M,$e.isFragment=U,$e.isLazy=S,$e.isMemo=R,$e.isPortal=K,$e.isProfiler=Z,$e.isStrictMode=re,$e.isSuspense=ce,$e.isValidElementType=D,$e.typeOf=A}()),$e}var ku;function Nd(){return ku||(ku=1,process.env.NODE_ENV==="production"?sa.exports=pp():sa.exports=gp()),sa.exports}/*
51
+ */var _u;function vp(){return _u||(_u=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,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=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,C=e?Symbol.for("react.scope"):60119;function D(X){return typeof X=="string"||typeof X=="function"||X===r||X===u||X===i||X===a||X===m||X===h||typeof X=="object"&&X!==null&&(X.$$typeof===g||X.$$typeof===p||X.$$typeof===s||X.$$typeof===o||X.$$typeof===d||X.$$typeof===b||X.$$typeof===v||X.$$typeof===C||X.$$typeof===f)}function A(X){if(typeof X=="object"&&X!==null){var pe=X.$$typeof;switch(pe){case t:var ve=X.type;switch(ve){case l:case u:case r:case i:case a:case m:return ve;default:var ye=ve&&ve.$$typeof;switch(ye){case o:case d:case g:case p:case s:return ye;default:return pe}}case n:return pe}}}var E=l,k=u,T=o,$=s,P=t,z=d,L=r,B=g,F=p,j=n,O=i,q=a,W=m,ne=!1;function J(X){return ne||(ne=!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.")),w(X)||A(X)===l}function w(X){return A(X)===u}function Q(X){return A(X)===o}function se(X){return A(X)===s}function _(X){return typeof X=="object"&&X!==null&&X.$$typeof===t}function M(X){return A(X)===d}function U(X){return A(X)===r}function S(X){return A(X)===g}function R(X){return A(X)===p}function K(X){return A(X)===n}function Z(X){return A(X)===i}function re(X){return A(X)===a}function ce(X){return A(X)===m}$e.AsyncMode=E,$e.ConcurrentMode=k,$e.ContextConsumer=T,$e.ContextProvider=$,$e.Element=P,$e.ForwardRef=z,$e.Fragment=L,$e.Lazy=B,$e.Memo=F,$e.Portal=j,$e.Profiler=O,$e.StrictMode=q,$e.Suspense=W,$e.isAsyncMode=J,$e.isConcurrentMode=w,$e.isContextConsumer=Q,$e.isContextProvider=se,$e.isElement=_,$e.isForwardRef=M,$e.isFragment=U,$e.isLazy=S,$e.isMemo=R,$e.isPortal=K,$e.isProfiler=Z,$e.isStrictMode=re,$e.isSuspense=ce,$e.isValidElementType=D,$e.typeOf=A}()),$e}var ku;function Id(){return ku||(ku=1,process.env.NODE_ENV==="production"?sa.exports=gp():sa.exports=vp()),sa.exports}/*
52
52
  object-assign
53
53
  (c) Sindre Sorhus
54
54
  @license MIT
55
- */var Ai,Fu;function vp(){if(Fu)return Ai;Fu=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ai=a()?Object.assign:function(i,s){for(var o,l=r(i),u,d=1;d<arguments.length;d++){o=Object(arguments[d]);for(var m in o)t.call(o,m)&&(l[m]=o[m]);if(e){u=e(o);for(var h=0;h<u.length;h++)n.call(o,u[h])&&(l[u[h]]=o[u[h]])}}return l},Ai}var Bi,Au;function go(){if(Au)return Bi;Au=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Bi=e,Bi}var Ti,Bu;function Id(){return Bu||(Bu=1,Ti=Function.call.bind(Object.prototype.hasOwnProperty)),Ti}var Si,Tu;function bp(){if(Tu)return Si;Tu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=go(),n={},r=Id();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var m;try{if(typeof i[d]!="function"){var h=Error((l||"React class")+": "+o+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}m=i[d](s,d,l,o,null,t)}catch(g){m=g}if(m&&!(m instanceof Error)&&e((l||"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=u?u():"";e("Failed "+o+" type: "+m.message+(p??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Si=a,Si}var ji,Su;function yp(){if(Su)return ji;Su=1;var e=Nd(),t=vp(),n=go(),r=Id(),a=bp(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(o){var l="Warning: "+o;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function s(){return null}return ji=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function m(w){var Q=w&&(u&&w[u]||w[d]);if(typeof Q=="function")return Q}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:C(),arrayOf:D,element:A(),elementType:E(),instanceOf:k,node:z(),objectOf:$,oneOf:T,oneOfType:P,shape:B,exact:F};function g(w,Q){return w===Q?w!==0||1/w===1/Q:w!==w&&Q!==Q}function f(w,Q){this.message=w,this.data=Q&&typeof Q=="object"?Q:{},this.stack=""}f.prototype=Error.prototype;function b(w){if(process.env.NODE_ENV!=="production")var Q={},se=0;function _(U,S,R,K,Z,re,ce){if(K=K||h,re=re||R,ce!==n){if(l){var X=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 X.name="Invariant Violation",X}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var pe=K+":"+R;!Q[pe]&&se<3&&(i("You are manually calling a React.PropTypes validation function for the `"+re+"` prop on `"+K+"`. 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."),Q[pe]=!0,se++)}}return S[R]==null?U?S[R]===null?new f("The "+Z+" `"+re+"` is marked as required "+("in `"+K+"`, but its value is `null`.")):new f("The "+Z+" `"+re+"` is marked as required in "+("`"+K+"`, but its value is `undefined`.")):null:w(S,R,K,Z,re)}var M=_.bind(null,!1);return M.isRequired=_.bind(null,!0),M}function v(w){function Q(se,_,M,U,S,R){var K=se[_],Z=q(K);if(Z!==w){var re=W(K);return new f("Invalid "+U+" `"+S+"` of type "+("`"+re+"` supplied to `"+M+"`, expected ")+("`"+w+"`."),{expectedType:w})}return null}return b(Q)}function C(){return b(s)}function D(w){function Q(se,_,M,U,S){if(typeof w!="function")return new f("Property `"+S+"` of component `"+M+"` has invalid PropType notation inside arrayOf.");var R=se[_];if(!Array.isArray(R)){var K=q(R);return new f("Invalid "+U+" `"+S+"` of type "+("`"+K+"` supplied to `"+M+"`, expected an array."))}for(var Z=0;Z<R.length;Z++){var re=w(R,Z,M,U,S+"["+Z+"]",n);if(re instanceof Error)return re}return null}return b(Q)}function A(){function w(Q,se,_,M,U){var S=Q[se];if(!o(S)){var R=q(S);return new f("Invalid "+M+" `"+U+"` of type "+("`"+R+"` supplied to `"+_+"`, expected a single ReactElement."))}return null}return b(w)}function E(){function w(Q,se,_,M,U){var S=Q[se];if(!e.isValidElementType(S)){var R=q(S);return new f("Invalid "+M+" `"+U+"` of type "+("`"+R+"` supplied to `"+_+"`, expected a single ReactElement type."))}return null}return b(w)}function k(w){function Q(se,_,M,U,S){if(!(se[_]instanceof w)){var R=w.name||h,K=J(se[_]);return new f("Invalid "+U+" `"+S+"` of type "+("`"+K+"` supplied to `"+M+"`, expected ")+("instance of `"+R+"`."))}return null}return b(Q)}function T(w){if(!Array.isArray(w))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("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])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function Q(se,_,M,U,S){for(var R=se[_],K=0;K<w.length;K++)if(g(R,w[K]))return null;var Z=JSON.stringify(w,function(ce,X){var pe=W(X);return pe==="symbol"?String(X):X});return new f("Invalid "+U+" `"+S+"` of value `"+String(R)+"` "+("supplied to `"+M+"`, expected one of "+Z+"."))}return b(Q)}function $(w){function Q(se,_,M,U,S){if(typeof w!="function")return new f("Property `"+S+"` of component `"+M+"` has invalid PropType notation inside objectOf.");var R=se[_],K=q(R);if(K!=="object")return new f("Invalid "+U+" `"+S+"` of type "+("`"+K+"` supplied to `"+M+"`, expected an object."));for(var Z in R)if(r(R,Z)){var re=w(R,Z,M,U,S+"."+Z,n);if(re instanceof Error)return re}return null}return b(Q)}function P(w){if(!Array.isArray(w))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var Q=0;Q<w.length;Q++){var se=w[Q];if(typeof se!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ne(se)+" at index "+Q+"."),s}function _(M,U,S,R,K){for(var Z=[],re=0;re<w.length;re++){var ce=w[re],X=ce(M,U,S,R,K,n);if(X==null)return null;X.data&&r(X.data,"expectedType")&&Z.push(X.data.expectedType)}var pe=Z.length>0?", expected one of type ["+Z.join(", ")+"]":"";return new f("Invalid "+R+" `"+K+"` supplied to "+("`"+S+"`"+pe+"."))}return b(_)}function z(){function w(Q,se,_,M,U){return j(Q[se])?null:new f("Invalid "+M+" `"+U+"` supplied to "+("`"+_+"`, expected a ReactNode."))}return b(w)}function L(w,Q,se,_,M){return new f((w||"React class")+": "+Q+" type `"+se+"."+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+M+"`.")}function B(w){function Q(se,_,M,U,S){var R=se[_],K=q(R);if(K!=="object")return new f("Invalid "+U+" `"+S+"` of type `"+K+"` "+("supplied to `"+M+"`, expected `object`."));for(var Z in w){var re=w[Z];if(typeof re!="function")return L(M,U,S,Z,W(re));var ce=re(R,Z,M,U,S+"."+Z,n);if(ce)return ce}return null}return b(Q)}function F(w){function Q(se,_,M,U,S){var R=se[_],K=q(R);if(K!=="object")return new f("Invalid "+U+" `"+S+"` of type `"+K+"` "+("supplied to `"+M+"`, expected `object`."));var Z=t({},se[_],w);for(var re in Z){var ce=w[re];if(r(w,re)&&typeof ce!="function")return L(M,U,S,re,W(ce));if(!ce)return new f("Invalid "+U+" `"+S+"` key `"+re+"` supplied to `"+M+"`.\nBad object: "+JSON.stringify(se[_],null," ")+`
56
- Valid keys: `+JSON.stringify(Object.keys(w),null," "));var X=ce(R,re,M,U,S+"."+re,n);if(X)return X}return null}return b(Q)}function j(w){switch(typeof w){case"number":case"string":case"undefined":return!0;case"boolean":return!w;case"object":if(Array.isArray(w))return w.every(j);if(w===null||o(w))return!0;var Q=m(w);if(Q){var se=Q.call(w),_;if(Q!==w.entries){for(;!(_=se.next()).done;)if(!j(_.value))return!1}else for(;!(_=se.next()).done;){var M=_.value;if(M&&!j(M[1]))return!1}}else return!1;return!0;default:return!1}}function O(w,Q){return w==="symbol"?!0:Q?Q["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&Q instanceof Symbol:!1}function q(w){var Q=typeof w;return Array.isArray(w)?"array":w instanceof RegExp?"object":O(Q,w)?"symbol":Q}function W(w){if(typeof w>"u"||w===null)return""+w;var Q=q(w);if(Q==="object"){if(w instanceof Date)return"date";if(w instanceof RegExp)return"regexp"}return Q}function ne(w){var Q=W(w);switch(Q){case"array":case"object":return"an "+Q;case"boolean":case"date":case"regexp":return"a "+Q;default:return Q}}function J(w){return!w.constructor||!w.constructor.name?h:w.constructor.name}return p.checkPropTypes=a,p.resetWarningCache=a.resetWarningCache,p.PropTypes=p,p},ji}var Oi,ju;function xp(){if(ju)return Oi;ju=1;var e=go();function t(){}function n(){}return n.resetWarningCache=t,Oi=function(){function r(s,o,l,u,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 a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Oi}if(process.env.NODE_ENV!=="production"){var Cp=Nd(),wp=!0;Ss.exports=yp()(Cp.isElement,wp)}else Ss.exports=xp()();var Dp=Ss.exports;/*!
55
+ */var Ai,Fu;function bp(){if(Fu)return Ai;Fu=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ai=a()?Object.assign:function(i,s){for(var o,l=r(i),u,d=1;d<arguments.length;d++){o=Object(arguments[d]);for(var m in o)t.call(o,m)&&(l[m]=o[m]);if(e){u=e(o);for(var h=0;h<u.length;h++)n.call(o,u[h])&&(l[u[h]]=o[u[h]])}}return l},Ai}var Bi,Au;function go(){if(Au)return Bi;Au=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Bi=e,Bi}var Ti,Bu;function Rd(){return Bu||(Bu=1,Ti=Function.call.bind(Object.prototype.hasOwnProperty)),Ti}var Si,Tu;function yp(){if(Tu)return Si;Tu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=go(),n={},r=Rd();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var m;try{if(typeof i[d]!="function"){var h=Error((l||"React class")+": "+o+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}m=i[d](s,d,l,o,null,t)}catch(g){m=g}if(m&&!(m instanceof Error)&&e((l||"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=u?u():"";e("Failed "+o+" type: "+m.message+(p??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Si=a,Si}var ji,Su;function xp(){if(Su)return ji;Su=1;var e=Id(),t=bp(),n=go(),r=Rd(),a=yp(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(o){var l="Warning: "+o;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function s(){return null}return ji=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function m(w){var Q=w&&(u&&w[u]||w[d]);if(typeof Q=="function")return Q}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:C(),arrayOf:D,element:A(),elementType:E(),instanceOf:k,node:z(),objectOf:$,oneOf:T,oneOfType:P,shape:B,exact:F};function g(w,Q){return w===Q?w!==0||1/w===1/Q:w!==w&&Q!==Q}function f(w,Q){this.message=w,this.data=Q&&typeof Q=="object"?Q:{},this.stack=""}f.prototype=Error.prototype;function b(w){if(process.env.NODE_ENV!=="production")var Q={},se=0;function _(U,S,R,K,Z,re,ce){if(K=K||h,re=re||R,ce!==n){if(l){var X=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 X.name="Invariant Violation",X}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var pe=K+":"+R;!Q[pe]&&se<3&&(i("You are manually calling a React.PropTypes validation function for the `"+re+"` prop on `"+K+"`. 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."),Q[pe]=!0,se++)}}return S[R]==null?U?S[R]===null?new f("The "+Z+" `"+re+"` is marked as required "+("in `"+K+"`, but its value is `null`.")):new f("The "+Z+" `"+re+"` is marked as required in "+("`"+K+"`, but its value is `undefined`.")):null:w(S,R,K,Z,re)}var M=_.bind(null,!1);return M.isRequired=_.bind(null,!0),M}function v(w){function Q(se,_,M,U,S,R){var K=se[_],Z=q(K);if(Z!==w){var re=W(K);return new f("Invalid "+U+" `"+S+"` of type "+("`"+re+"` supplied to `"+M+"`, expected ")+("`"+w+"`."),{expectedType:w})}return null}return b(Q)}function C(){return b(s)}function D(w){function Q(se,_,M,U,S){if(typeof w!="function")return new f("Property `"+S+"` of component `"+M+"` has invalid PropType notation inside arrayOf.");var R=se[_];if(!Array.isArray(R)){var K=q(R);return new f("Invalid "+U+" `"+S+"` of type "+("`"+K+"` supplied to `"+M+"`, expected an array."))}for(var Z=0;Z<R.length;Z++){var re=w(R,Z,M,U,S+"["+Z+"]",n);if(re instanceof Error)return re}return null}return b(Q)}function A(){function w(Q,se,_,M,U){var S=Q[se];if(!o(S)){var R=q(S);return new f("Invalid "+M+" `"+U+"` of type "+("`"+R+"` supplied to `"+_+"`, expected a single ReactElement."))}return null}return b(w)}function E(){function w(Q,se,_,M,U){var S=Q[se];if(!e.isValidElementType(S)){var R=q(S);return new f("Invalid "+M+" `"+U+"` of type "+("`"+R+"` supplied to `"+_+"`, expected a single ReactElement type."))}return null}return b(w)}function k(w){function Q(se,_,M,U,S){if(!(se[_]instanceof w)){var R=w.name||h,K=J(se[_]);return new f("Invalid "+U+" `"+S+"` of type "+("`"+K+"` supplied to `"+M+"`, expected ")+("instance of `"+R+"`."))}return null}return b(Q)}function T(w){if(!Array.isArray(w))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("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])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function Q(se,_,M,U,S){for(var R=se[_],K=0;K<w.length;K++)if(g(R,w[K]))return null;var Z=JSON.stringify(w,function(ce,X){var pe=W(X);return pe==="symbol"?String(X):X});return new f("Invalid "+U+" `"+S+"` of value `"+String(R)+"` "+("supplied to `"+M+"`, expected one of "+Z+"."))}return b(Q)}function $(w){function Q(se,_,M,U,S){if(typeof w!="function")return new f("Property `"+S+"` of component `"+M+"` has invalid PropType notation inside objectOf.");var R=se[_],K=q(R);if(K!=="object")return new f("Invalid "+U+" `"+S+"` of type "+("`"+K+"` supplied to `"+M+"`, expected an object."));for(var Z in R)if(r(R,Z)){var re=w(R,Z,M,U,S+"."+Z,n);if(re instanceof Error)return re}return null}return b(Q)}function P(w){if(!Array.isArray(w))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var Q=0;Q<w.length;Q++){var se=w[Q];if(typeof se!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ne(se)+" at index "+Q+"."),s}function _(M,U,S,R,K){for(var Z=[],re=0;re<w.length;re++){var ce=w[re],X=ce(M,U,S,R,K,n);if(X==null)return null;X.data&&r(X.data,"expectedType")&&Z.push(X.data.expectedType)}var pe=Z.length>0?", expected one of type ["+Z.join(", ")+"]":"";return new f("Invalid "+R+" `"+K+"` supplied to "+("`"+S+"`"+pe+"."))}return b(_)}function z(){function w(Q,se,_,M,U){return j(Q[se])?null:new f("Invalid "+M+" `"+U+"` supplied to "+("`"+_+"`, expected a ReactNode."))}return b(w)}function L(w,Q,se,_,M){return new f((w||"React class")+": "+Q+" type `"+se+"."+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+M+"`.")}function B(w){function Q(se,_,M,U,S){var R=se[_],K=q(R);if(K!=="object")return new f("Invalid "+U+" `"+S+"` of type `"+K+"` "+("supplied to `"+M+"`, expected `object`."));for(var Z in w){var re=w[Z];if(typeof re!="function")return L(M,U,S,Z,W(re));var ce=re(R,Z,M,U,S+"."+Z,n);if(ce)return ce}return null}return b(Q)}function F(w){function Q(se,_,M,U,S){var R=se[_],K=q(R);if(K!=="object")return new f("Invalid "+U+" `"+S+"` of type `"+K+"` "+("supplied to `"+M+"`, expected `object`."));var Z=t({},se[_],w);for(var re in Z){var ce=w[re];if(r(w,re)&&typeof ce!="function")return L(M,U,S,re,W(ce));if(!ce)return new f("Invalid "+U+" `"+S+"` key `"+re+"` supplied to `"+M+"`.\nBad object: "+JSON.stringify(se[_],null," ")+`
56
+ Valid keys: `+JSON.stringify(Object.keys(w),null," "));var X=ce(R,re,M,U,S+"."+re,n);if(X)return X}return null}return b(Q)}function j(w){switch(typeof w){case"number":case"string":case"undefined":return!0;case"boolean":return!w;case"object":if(Array.isArray(w))return w.every(j);if(w===null||o(w))return!0;var Q=m(w);if(Q){var se=Q.call(w),_;if(Q!==w.entries){for(;!(_=se.next()).done;)if(!j(_.value))return!1}else for(;!(_=se.next()).done;){var M=_.value;if(M&&!j(M[1]))return!1}}else return!1;return!0;default:return!1}}function O(w,Q){return w==="symbol"?!0:Q?Q["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&Q instanceof Symbol:!1}function q(w){var Q=typeof w;return Array.isArray(w)?"array":w instanceof RegExp?"object":O(Q,w)?"symbol":Q}function W(w){if(typeof w>"u"||w===null)return""+w;var Q=q(w);if(Q==="object"){if(w instanceof Date)return"date";if(w instanceof RegExp)return"regexp"}return Q}function ne(w){var Q=W(w);switch(Q){case"array":case"object":return"an "+Q;case"boolean":case"date":case"regexp":return"a "+Q;default:return Q}}function J(w){return!w.constructor||!w.constructor.name?h:w.constructor.name}return p.checkPropTypes=a,p.resetWarningCache=a.resetWarningCache,p.PropTypes=p,p},ji}var Oi,ju;function Cp(){if(ju)return Oi;ju=1;var e=go();function t(){}function n(){}return n.resetWarningCache=t,Oi=function(){function r(s,o,l,u,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 a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Oi}if(process.env.NODE_ENV!=="production"){var wp=Id(),Dp=!0;Ss.exports=xp()(wp.isElement,Dp)}else Ss.exports=Cp()();var Ep=Ss.exports;/*!
57
57
  * tabbable 6.2.0
58
58
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
59
- */var Rd=["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])"],za=Rd.join(","),$d=typeof Element>"u",Pn=$d?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,qa=!$d&&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},Ua=function e(t,n){var r;n===void 0&&(n=!0);var a=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=a===""||a==="true",s=i||n&&t&&e(t.parentNode);return s},Ep=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Ld=function(t,n,r){if(Ua(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(za));return n&&Pn.call(t,za)&&a.unshift(t),a=a.filter(r),a},zd=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!Ua(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var d=Pn.call(s,za);d&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var m=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),h=!Ua(m,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(m&&h){var p=e(m===!0?s.children:m.children,!0,r);r.flatten?a.push.apply(a,p):a.push({scopeParent:s,candidates:p})}else i.unshift.apply(i,s.children)}}return a},qd=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)||Ep(t))&&!qd(t)?0:t.tabIndex},_p=function(t,n){var r=gn(t);return r<0&&n&&!qd(t)?0:r},kp=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Ud=function(t){return t.tagName==="INPUT"},Fp=function(t){return Ud(t)&&t.type==="hidden"},Ap=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Bp=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Tp=function(t){if(!t.name)return!0;var n=t.form||qa(t),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},a;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")a=r(window.CSS.escape(t.name));else try{a=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 i=Bp(a,t.form);return!i||i===t},Sp=function(t){return Ud(t)&&t.type==="radio"},jp=function(t){return Sp(t)&&!Tp(t)},Op=function(t){var n,r=t&&qa(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,d,m;r=qa(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((d=a)!==null&&d!==void 0&&(m=d.ownerDocument)!==null&&m!==void 0&&m.contains(a))}}return i},Ou=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},Pp=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Pn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Pn.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof a=="function"){for(var o=t;t;){var l=t.parentElement,u=qa(t);if(l&&!l.shadowRoot&&a(l)===!0)return Ou(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(Op(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Ou(t);return!1},Mp=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 a=n.children.item(r);if(a.tagName==="LEGEND")return Pn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},Wa=function(t,n){return!(n.disabled||Ua(n)||Fp(n)||Pp(n,t)||Ap(n)||Mp(n))},js=function(t,n){return!(jp(n)||gn(n)<0||!Wa(t,n))},Np=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Ip=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=_p(o,s),u=s?e(a.candidates):o;l===0?s?n.push.apply(n,u):n.push(o):r.push({documentOrder:i,tabIndex:l,item:a,isScope:s,content:u})}),r.sort(kp).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},Wd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=zd([t],n.includeContainer,{filter:js.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Np}):r=Ld(t,n.includeContainer,js.bind(null,n)),Ip(r)},Vd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=zd([t],n.includeContainer,{filter:Wa.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Ld(t,n.includeContainer,Wa.bind(null,n)),r},kn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Pn.call(t,za)===!1?!1:js(n,t)},Rp=Rd.concat("iframe").join(","),Ta=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Pn.call(t,Rp)===!1?!1:Wa(n,t)};const $p=Object.freeze(Object.defineProperty({__proto__:null,focusable:Vd,getTabIndex:gn,isFocusable:Ta,isTabbable:kn,tabbable:Wd},Symbol.toStringTag,{value:"Module"}));/*!
59
+ */var $d=["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])"],za=$d.join(","),Ld=typeof Element>"u",Pn=Ld?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,qa=!Ld&&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},Ua=function e(t,n){var r;n===void 0&&(n=!0);var a=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=a===""||a==="true",s=i||n&&t&&e(t.parentNode);return s},_p=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},zd=function(t,n,r){if(Ua(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(za));return n&&Pn.call(t,za)&&a.unshift(t),a=a.filter(r),a},qd=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!Ua(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var d=Pn.call(s,za);d&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var m=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),h=!Ua(m,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(m&&h){var p=e(m===!0?s.children:m.children,!0,r);r.flatten?a.push.apply(a,p):a.push({scopeParent:s,candidates:p})}else i.unshift.apply(i,s.children)}}return a},Ud=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)||_p(t))&&!Ud(t)?0:t.tabIndex},kp=function(t,n){var r=gn(t);return r<0&&n&&!Ud(t)?0:r},Fp=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Wd=function(t){return t.tagName==="INPUT"},Ap=function(t){return Wd(t)&&t.type==="hidden"},Bp=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Tp=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Sp=function(t){if(!t.name)return!0;var n=t.form||qa(t),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},a;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")a=r(window.CSS.escape(t.name));else try{a=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 i=Tp(a,t.form);return!i||i===t},jp=function(t){return Wd(t)&&t.type==="radio"},Op=function(t){return jp(t)&&!Sp(t)},Pp=function(t){var n,r=t&&qa(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,d,m;r=qa(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((d=a)!==null&&d!==void 0&&(m=d.ownerDocument)!==null&&m!==void 0&&m.contains(a))}}return i},Ou=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},Mp=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Pn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Pn.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof a=="function"){for(var o=t;t;){var l=t.parentElement,u=qa(t);if(l&&!l.shadowRoot&&a(l)===!0)return Ou(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(Pp(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Ou(t);return!1},Np=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 a=n.children.item(r);if(a.tagName==="LEGEND")return Pn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},Wa=function(t,n){return!(n.disabled||Ua(n)||Ap(n)||Mp(n,t)||Bp(n)||Np(n))},js=function(t,n){return!(Op(n)||gn(n)<0||!Wa(t,n))},Ip=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Rp=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=kp(o,s),u=s?e(a.candidates):o;l===0?s?n.push.apply(n,u):n.push(o):r.push({documentOrder:i,tabIndex:l,item:a,isScope:s,content:u})}),r.sort(Fp).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},Vd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=qd([t],n.includeContainer,{filter:js.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Ip}):r=zd(t,n.includeContainer,js.bind(null,n)),Rp(r)},Hd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=qd([t],n.includeContainer,{filter:Wa.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=zd(t,n.includeContainer,Wa.bind(null,n)),r},kn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Pn.call(t,za)===!1?!1:js(n,t)},$p=$d.concat("iframe").join(","),Ta=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Pn.call(t,$p)===!1?!1:Wa(n,t)};const Lp=Object.freeze(Object.defineProperty({__proto__:null,focusable:Hd,getTabIndex:gn,isFocusable:Ta,isTabbable:kn,tabbable:Vd},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 Pu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Mu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pu(Object(n),!0).forEach(function(r){Lp(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Lp(e,t,n){return t=qp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zp(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 qp(e){var t=zp(e,"string");return typeof t=="symbol"?t:String(t)}var Nu={activateTrap:function(t,n){if(t.length>0){var r=t[t.length-1];r!==n&&r.pause()}var a=t.indexOf(n);a===-1||t.splice(a,1),t.push(n)},deactivateTrap:function(t,n){var r=t.indexOf(n);r!==-1&&t.splice(r,1),t.length>0&&t[t.length-1].unpause()}},Up=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},Wp=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},jr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},Vp=function(t){return jr(t)&&!t.shiftKey},Hp=function(t){return jr(t)&&t.shiftKey},Iu=function(t){return setTimeout(t,0)},Ru=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},Cr=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return typeof t=="function"?t.apply(void 0,r):t},oa=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},Kp=[],Zp=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||Kp,i=Mu({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Vp,isKeyBackward:Hp},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(B,F,j){return B&&B[F]!==void 0?B[F]:i[j||F]},u=function(B,F){var j=typeof(F==null?void 0:F.composedPath)=="function"?F.composedPath():void 0;return s.containerGroups.findIndex(function(O){var q=O.container,W=O.tabbableNodes;return q.contains(B)||(j==null?void 0:j.includes(q))||W.find(function(ne){return ne===B})})},d=function(B){var F=i[B];if(typeof F=="function"){for(var j=arguments.length,O=new Array(j>1?j-1:0),q=1;q<j;q++)O[q-1]=arguments[q];F=F.apply(void 0,O)}if(F===!0&&(F=void 0),!F){if(F===void 0||F===!1)return F;throw new Error("`".concat(B,"` was specified but was not a node, or did not return a node"))}var W=F;if(typeof F=="string"&&(W=r.querySelector(F),!W))throw new Error("`".concat(B,"` as selector refers to no known node"));return W},m=function(){var B=d("initialFocus");if(B===!1)return!1;if(B===void 0||!Ta(B,i.tabbableOptions))if(u(r.activeElement)>=0)B=r.activeElement;else{var F=s.tabbableGroups[0],j=F&&F.firstTabbableNode;B=j||d("fallbackFocus")}if(!B)throw new Error("Your focus-trap needs to have at least one focusable element");return B},h=function(){if(s.containerGroups=s.containers.map(function(B){var F=Wd(B,i.tabbableOptions),j=Vd(B,i.tabbableOptions),O=F.length>0?F[0]:void 0,q=F.length>0?F[F.length-1]:void 0,W=j.find(function(w){return kn(w)}),ne=j.slice().reverse().find(function(w){return kn(w)}),J=!!F.find(function(w){return gn(w)>0});return{container:B,tabbableNodes:F,focusableNodes:j,posTabIndexesFound:J,firstTabbableNode:O,lastTabbableNode:q,firstDomTabbableNode:W,lastDomTabbableNode:ne,nextTabbableNode:function(Q){var se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=F.indexOf(Q);return _<0?se?j.slice(j.indexOf(Q)+1).find(function(M){return kn(M)}):j.slice(0,j.indexOf(Q)).reverse().find(function(M){return kn(M)}):F[_+(se?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(B){return B.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(B){return B.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 L(B){var F=B.activeElement;if(F)return F.shadowRoot&&F.shadowRoot.activeElement!==null?L(F.shadowRoot):F},g=function L(B){if(B!==!1&&B!==p(document)){if(!B||!B.focus){L(m());return}B.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=B,Up(B)&&B.select()}},f=function(B){var F=d("setReturnFocus",B);return F||(F===!1?!1:B)},b=function(B){var F=B.target,j=B.event,O=B.isBackward,q=O===void 0?!1:O;F=F||oa(j),h();var W=null;if(s.tabbableGroups.length>0){var ne=u(F,j),J=ne>=0?s.containerGroups[ne]:void 0;if(ne<0)q?W=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:W=s.tabbableGroups[0].firstTabbableNode;else if(q){var w=Ru(s.tabbableGroups,function(S){var R=S.firstTabbableNode;return F===R});if(w<0&&(J.container===F||Ta(F,i.tabbableOptions)&&!kn(F,i.tabbableOptions)&&!J.nextTabbableNode(F,!1))&&(w=ne),w>=0){var Q=w===0?s.tabbableGroups.length-1:w-1,se=s.tabbableGroups[Q];W=gn(F)>=0?se.lastTabbableNode:se.lastDomTabbableNode}else jr(j)||(W=J.nextTabbableNode(F,!1))}else{var _=Ru(s.tabbableGroups,function(S){var R=S.lastTabbableNode;return F===R});if(_<0&&(J.container===F||Ta(F,i.tabbableOptions)&&!kn(F,i.tabbableOptions)&&!J.nextTabbableNode(F))&&(_=ne),_>=0){var M=_===s.tabbableGroups.length-1?0:_+1,U=s.tabbableGroups[M];W=gn(F)>=0?U.firstTabbableNode:U.firstDomTabbableNode}else jr(j)||(W=J.nextTabbableNode(F))}}else W=d("fallbackFocus");return W},v=function(B){var F=oa(B);if(!(u(F,B)>=0)){if(Cr(i.clickOutsideDeactivates,B)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}Cr(i.allowOutsideClick,B)||B.preventDefault()}},C=function(B){var F=oa(B),j=u(F,B)>=0;if(j||F instanceof Document)j&&(s.mostRecentlyFocusedNode=F);else{B.stopImmediatePropagation();var O,q=!0;if(s.mostRecentlyFocusedNode)if(gn(s.mostRecentlyFocusedNode)>0){var W=u(s.mostRecentlyFocusedNode),ne=s.containerGroups[W].tabbableNodes;if(ne.length>0){var J=ne.findIndex(function(w){return w===s.mostRecentlyFocusedNode});J>=0&&(i.isKeyForward(s.recentNavEvent)?J+1<ne.length&&(O=ne[J+1],q=!1):J-1>=0&&(O=ne[J-1],q=!1))}}else s.containerGroups.some(function(w){return w.tabbableNodes.some(function(Q){return gn(Q)>0})})||(q=!1);else q=!1;q&&(O=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(O||s.mostRecentlyFocusedNode||m())}s.recentNavEvent=void 0},D=function(B){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=B;var j=b({event:B,isBackward:F});j&&(jr(B)&&B.preventDefault(),g(j))},A=function(B){if(Wp(B)&&Cr(i.escapeDeactivates,B)!==!1){B.preventDefault(),o.deactivate();return}(i.isKeyForward(B)||i.isKeyBackward(B))&&D(B,i.isKeyBackward(B))},E=function(B){var F=oa(B);u(F,B)>=0||Cr(i.clickOutsideDeactivates,B)||Cr(i.allowOutsideClick,B)||(B.preventDefault(),B.stopImmediatePropagation())},k=function(){if(s.active)return Nu.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Iu(function(){g(m())}):g(m()),r.addEventListener("focusin",C,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",E,{capture:!0,passive:!1}),r.addEventListener("keydown",A,{capture:!0,passive:!1}),o},T=function(){if(s.active)return r.removeEventListener("focusin",C,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",E,!0),r.removeEventListener("keydown",A,!0),o},$=function(B){var F=B.some(function(j){var O=Array.from(j.removedNodes);return O.some(function(q){return q===s.mostRecentlyFocusedNode})});F&&g(m())},P=typeof window<"u"&&"MutationObserver"in window?new MutationObserver($):void 0,z=function(){P&&(P.disconnect(),s.active&&!s.paused&&s.containers.map(function(B){P.observe(B,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(B){if(s.active)return this;var F=l(B,"onActivate"),j=l(B,"onPostActivate"),O=l(B,"checkCanFocusTrap");O||h(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,F==null||F();var q=function(){O&&h(),k(),z(),j==null||j()};return O?(O(s.containers.concat()).then(q,q),this):(q(),this)},deactivate:function(B){if(!s.active)return this;var F=Mu({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},B);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,T(),s.active=!1,s.paused=!1,z(),Nu.deactivateTrap(a,o);var j=l(F,"onDeactivate"),O=l(F,"onPostDeactivate"),q=l(F,"checkCanReturnFocus"),W=l(F,"returnFocus","returnFocusOnDeactivate");j==null||j();var ne=function(){Iu(function(){W&&g(f(s.nodeFocusedBeforeActivation)),O==null||O()})};return W&&q?(q(f(s.nodeFocusedBeforeActivation)).then(ne,ne),this):(ne(),this)},pause:function(B){if(s.paused||!s.active)return this;var F=l(B,"onPause"),j=l(B,"onPostPause");return s.paused=!0,F==null||F(),T(),z(),j==null||j(),this},unpause:function(B){if(!s.paused||!s.active)return this;var F=l(B,"onUnpause"),j=l(B,"onPostUnpause");return s.paused=!1,F==null||F(),h(),k(),z(),j==null||j(),this},updateContainerElements:function(B){var F=[].concat(B).filter(Boolean);return s.containers=F.map(function(j){return typeof j=="string"?r.querySelector(j):j}),s.active&&h(),z(),this}},o.updateContainerElements(t),o};const Yp=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Zp},Symbol.toStringTag,{value:"Module"})),Gp=Jc(Yp),Qp=Jc($p);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 Jp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $u(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,Hd(r.key),r)}}function Xp(e,t,n){return t&&$u(e.prototype,t),n&&$u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function eg(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&&Os(e,t)}function Os(e,t){return Os=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Os(e,t)}function tg(e){var t=rg();return function(){var r=Va(e),a;if(t){var i=Va(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return ng(this,a)}}function ng(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 Br(e)}function Br(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rg(){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 Va(e){return Va=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Va(e)}function ag(e,t,n){return t=Hd(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hd(e){var t=ig(e,"string");return lr(t)==="symbol"?t:String(t)}function ig(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 ua=y,be=Dp,sg=Gp,og=sg.createFocusTrap,ug=Qp,lg=ug.isFocusable,vo=function(e){eg(n,e);var t=tg(n);function n(r){var a;Jp(this,n),a=t.call(this,r),ag(Br(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var d=arguments.length,m=new Array(d>1?d-1:0),h=1;h<d;h++)m[h-1]=arguments[h];u=u.apply(void 0,m)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var p=u;if(typeof u=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),a.handleDeactivate=a.handleDeactivate.bind(Br(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(Br(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(Br(a)),a.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:a.handleDeactivate,onPostDeactivate:a.handlePostDeactivate,clickOutsideDeactivates:a.handleClickOutsideDeactivates},a.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){a.originalOptions[s]=i[s];continue}a.internalOptions[s]=i[s]}return a.outsideClick=null,a.focusTrapElements=r.containerElements||[],a.updatePreviousElement(),a}return Xp(n,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var a=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return a||(a===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var a=this.getDocument();a&&(this.previouslyFocusedElement=a.activeElement)}},{key:"deactivateTrap",value:function(){!this.focusTrap||!this.focusTrap.active||this.focusTrap.deactivate({returnFocus:!1,checkCanReturnFocus:null,onDeactivate:this.originalOptions.onDeactivate})}},{key:"handleClickOutsideDeactivates",value:function(a){var i=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,a):this.originalOptions.clickOutsideDeactivates;return i&&(this.outsideClick={target:a.target,allowDeactivation:i}),i}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var a=this,i=function(){var o=a.getReturnFocusNode(),l=!!(a.originalOptions.returnFocusOnDeactivate&&o!==null&&o!==void 0&&o.focus&&(!a.outsideClick||a.outsideClick.allowDeactivation&&!lg(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,d=u===void 0?!1:u;l&&o.focus({preventScroll:d}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?ua.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===ua.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var d=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=d||[u]},o=ua.cloneElement(i,{ref:s});return o}return null}}]),n}(ua.Component),wr=typeof Element>"u"?Function:Element;vo.propTypes={active:be.bool,paused:be.bool,focusTrapOptions:be.shape({document:be.object,onActivate:be.func,onPostActivate:be.func,checkCanFocusTrap:be.func,onPause:be.func,onPostPause:be.func,onUnpause:be.func,onPostUnpause:be.func,onDeactivate:be.func,onPostDeactivate:be.func,checkCanReturnFocus:be.func,initialFocus:be.oneOfType([be.instanceOf(wr),be.string,be.bool,be.func]),fallbackFocus:be.oneOfType([be.instanceOf(wr),be.string,be.func]),escapeDeactivates:be.oneOfType([be.bool,be.func]),clickOutsideDeactivates:be.oneOfType([be.bool,be.func]),returnFocusOnDeactivate:be.bool,setReturnFocus:be.oneOfType([be.instanceOf(wr),be.string,be.bool,be.func]),allowOutsideClick:be.oneOfType([be.bool,be.func]),preventScroll:be.bool,tabbableOptions:be.shape({displayCheck:be.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:be.oneOfType([be.bool,be.func])}),trapStack:be.array,isKeyForward:be.func,isKeyBackward:be.func}),containerElements:be.arrayOf(be.instanceOf(wr)),children:be.oneOfType([be.element,be.instanceOf(wr)])};vo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:og};var cg=vo;const dg=Rn(cg);const ln=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:d="",gtmContext:m="Modal"})=>{const h=ae.useIntl(),{registerOverlay:p,unregisterOverlay:g}=Bd(),[f,b]=y.useState(t),[v,C]=y.useState(null),D=y.useRef(null),A=P=>{f&&P.key==="Escape"&&T(!1)},E=P=>{C(P.target)},k=P=>{v===D.current&&P.target===D.current&&T(!1),C(null)};y.useEffect(()=>{if(f)return window.addEventListener("keyup",A),()=>{window.removeEventListener("keyup",A)}},[f]),y.useEffect(()=>{const P=D.current;return P&&(P.addEventListener("mousedown",E),P.addEventListener("mouseup",k)),()=>{P&&(P.removeEventListener("mousedown",E),P.removeEventListener("mouseup",k))}},[v]);const T=P=>{if(b(P),P)a(),p(e);else{if(f===P)return;i(),g(e)}};y.useEffect(()=>(T(t),()=>{f&&g(e)}),[t]);const $=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:D,className:V("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(po,{id:e,className:V("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:$,children:t&&c.jsx(dg,{containerElements:[D.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(Ee,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>T(!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,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(zt,{}),c.jsx(pr,{buttons:u})]}),s&&c.jsx(ur,{className:"error",children:s})]})})})})},Kd=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Dr="joinCommunityButton",bo=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ae.useIntl(),o=y.useContext(it),l=o&&typeof o.id=="string",u=r||!l,[d,m]=y.useState(e),[h,p]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{h==="joining"?p("joined"):h==="leaving"&&p("notJoined")},[d]);const g={},f={};return d&&h!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${Dr}_leave`}),g["aria-label"]=s.formatMessage({id:`${Dr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(Ee,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&h!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${Dr}_closed_tooltip`}):"",onClick:async b=>{if(u)return;b.currentTarget.blur(),p(d?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${Dr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(v);const C=d?i:a;typeof C=="function"&&setTimeout(async()=>{await C()},500),m(!d)},className:V("join-community-button",h,{active:h==="joining"}),disabled:u,"data-testid":"join-button",...g,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${Dr}${["joining","leaving"].includes(h)?`_${h}`:d?"_member":n?"_short":""}`})})})};const Pi="communityDetails_",fg=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=ae.useIntl(),{id:u}=y.useContext(it),d=u,m=5,h=a||i.length,p=i.length?i:Array(m).fill({}),g=`/communities/${r}/members`===window.location.pathname,f=t||n,b=!n&&!t;return c.jsxs("div",{className:V("community-details",e),children:[f?c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[l.formatMessage({id:`${Pi}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:l.formatMessage({id:`${Pi}viewAll`})})})]}),d&&c.jsx(ho,{contributors:{total:a,data:p},styling:{size:"medium",showGap:!0,showPlaceholders:h===0},cutoff:m})]}):c.jsx(c.Fragment,{}),d?c.jsxs(c.Fragment,{children:[c.jsx(bo,{isMember:t,isOpen:n,disabled:b,functions:{...o}}),t&&c.jsx(Ee,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${Pi}invite`})})]}):c.jsx(c.Fragment,{})]})};const qr=({icon:e,className:t="",...n})=>c.jsx(Ee,{className:V("action-button",t),variant:"tertiary",icon:e,...n}),mg="post",hg="reply",Zd="00000000-0000-0000-0000-000000000000";function yo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function xo({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return e.setQueryData(t,r),a}return n}function pg(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function gg(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Yd(e){const{id:t="",name:n="",organization:r="",jobTitle:a="",image:i={}}=e,{thumbnail:s=""}=i;return{id:t,data:{name:n,organization:r,jobTitle:a,thumbnail:s}}}function vg({title:e,content:t,categories:n}){const r=[];return n&&!["no-category",""].includes(n)&&r.push(n),{title:e,content:t,categories:r,id:Zd,time:new Date().toISOString(),verb:mg}}function Lu({activity:e,user:t}){return{...e,actor:Yd(t),...pg()}}function Ha({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((a=e.own_reactions)==null?void 0:a.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function Gd({activity:e,user:t}){var n,r,a;e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like-1:0},t!=null&&t.id&&(e.latest_reactions={...e.latest_reactions||{},like:(((r=e.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((a=e.own_reactions)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function Ka({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},pin:[...((r=e.latest_reactions)==null?void 0:r.pin)||[],t]},e.own_reactions={...e.own_reactions||{},pin:[...((a=e.own_reactions)==null?void 0:a.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function Qd({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 bg({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Zd,kind:hg,parent:t||""}}function zu({reply:e,user:t}){const n=Yd(t);return{...e,user_id:n.id,user:n,...gg()}}function qu({reply:e,reaction:t}){var n,r,a;t?(e.latest_children={...e.latest_children||{},like:[...((r=e.latest_children)==null?void 0:r.like)||[],t]},e.own_children={...e.own_children||{},like:[...((a=e.own_children)==null?void 0:a.like)||[],t]}):e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like+1:1}}function yg({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function xg(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function Cg(e,t,n){const r=t.pages.length-1,a=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[a]=e:t.pages[r].results.push(e),t}function wg(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 Za(e,t,n){return t?n!=null&&n.append?Cg(e,t,n):wg(e,t,n):xg(e)}function qt(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Jd(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function Co(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const Xd=(e,t)=>{const n=new CustomEvent(rt.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let Uu,Mi=0;const ef=()=>{y.useEffect(()=>(document.addEventListener(rt.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(rt.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(Uu);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),Mi=0;return}Mi++,!(Mi>10)&&(Uu=setTimeout(()=>{e(t)},50))}};var Ae=(e=>(e.Answer="answer",e.Poll="poll",e.Post="post",e.Response="response",e.Reply="reply",e.Question="question",e))(Ae||{});const cr=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}),Qt=Object.freeze({id:"some-user-id-2",name:"some user name 2",organization:"some user organization 2",jobTitle:"some user job title 2",image:{thumbnail:"https://some-user-thumbnail.com/avatar2.png"},isLoading:!1}),wo=Object.freeze({actor:`SU:${cr.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"}),Dg=Object.freeze({actor:`SU:${Qt.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"}),Eg=Object.freeze({actor:`SU:${cr.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"}),_g=Object.freeze({actor:`SU:${Qt.id}`,content:"some content 4",duration:"5.53ms",feed_id:"some-feed-id-4",foreign_id:"post:some-foriegn-id-4",id:"some-activity-id-4",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"});Object.freeze({id:"some-reaction-id-1",activity_id:wo.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Qt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Qt.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({id:"some-reaction-id-1",activity_id:wo.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Qt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Qt.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:Qt.id,user:{id:Qt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:wo.id,data:{content:"Some content 1..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-2",user_id:cr.id,user:{id:cr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Dg.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:Qt.id,user:{id:Qt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Eg.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:cr.id,user:{id:cr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:_g.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});const kg=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Fg=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);function Ag(e){return y.useCallback(t=>{var s,o,l,u;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 a=r==null?void 0:r.nextElementSibling;if(n==="up"){const d=r==null?void 0:r.previousElementSibling;d?a=d:(a=(o=r==null?void 0:r.parentElement)==null?void 0:o.lastElementChild,(a==null?void 0:a.getAttribute("data-index"))==="-1"&&(a=a==null?void 0:a.previousElementSibling))}else(!a||(a==null?void 0:a.getAttribute("data-index"))==="-1")&&(a=(l=r==null?void 0:r.parentElement)==null?void 0:l.firstElementChild);if(!a)return;const i=Number((a==null?void 0:a.getAttribute("data-index"))||"0");e([{type:"tabbableLink",value:i}]),(u=a==null?void 0:a.querySelector("a,button"))==null||u.focus()},[e])}const Bg=y.lazy(()=>Promise.resolve().then(()=>av));let Or=!1;const Ni=()=>{Or!==!1&&(clearTimeout(Or),Or=!1)},Tg=5;let Ii=null;const tf=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:Ae.Reply,slugs:{}},canLike:s=!0,activityId:o,basePath:l,parentId:u,functions:{createLike:d=()=>{},deleteLike:m=()=>{},listLikes:h=async()=>({next:"",results:[]})}})=>{const p=ae.useIntl(),g={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0,showLikesModal:!1},[f,b]=y.useReducer(Jr,g),{numberOfLikes:v,userLikedContent:C,ignoreInteractions:D,showLikers:A,tabbableLink:E,showLikesModal:k}=f,T=Ag(b);y.useEffect(()=>{b([{type:"userLikedContent",value:a}])},[a]);const $=y.useMemo(()=>Fg(n,Tg),[n]),P=F=>{if(F.preventDefault(),F.stopPropagation(),b([{type:"showLikers",value:!1}]),Or)return Ni(),!1;if(Ni(),D||!s)return!1;Or=setTimeout(z,350)},z=async()=>{if(Ni(),D||!s)return!1;let F=C?v-1:v+1;F<0&&(F=0),b([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:F},{type:"userLikedContent",value:!C}]);try{if(i&&i.slugs){const j=kg(i.slugs);C?await m(j):await d({...j,payload:{contentPath:window.location.pathname}})}}catch{b([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{b([{type:"ignoreInteractions",value:!1}])}},L=()=>{Ii=setTimeout(()=>{b([{type:"showLikers",value:!1}])},500)},B=()=>{Ii&&clearTimeout(Ii)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:F=>{F.key==="Escape"&&b([{type:"showLikers",value:!1}])},onMouseEnter:()=>{B(),b([{type:"showLikers",value:!0}])},onMouseLeave:()=>{L()}},c.jsxs(c.Fragment,{children:[c.jsx(qr,{className:V("discussion-button text-medium action-button likes-button",{"show-spinner":D,"is-liked":C,disabled:!s}),icon:{icon:C?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:P,screenreaderText:s?p.formatMessage({id:`discussion_likes_${C?"unlike":"like"}`},{action:p.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":C,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(Pe,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{B()},onBlur:()=>L,onClick:F=>{var O;F.preventDefault(),F.stopPropagation(),B(),b([{type:"showLikers",value:!0}]);const j=(O=F.currentTarget.nextSibling)==null?void 0:O.childNodes[0];if(j){const q=j.querySelector("li:first-child a");q&&(b([{type:"tabbableLink",value:0}]),setTimeout(()=>{q.focus()},100))}},onKeyDown:F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),L())},"aria-expanded":A,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Pe,{showOnFocus:!1,children:p.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(Ln,{id:`likes-tooltip-${i.slug}`,isOpen:A,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[$.map((F,j)=>{if(typeof F=="string")return null;const O={};return E!==j&&(O.tabIndex=-1),c.jsx("li",{"data-index":j,children:c.jsx(xn,{href:F.id?`/profiles/${F.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onFocus:()=>B(),onKeyDown:T,...O,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":$.length,className:"show-all",children:c.jsx(Ee,{variant:"tertiary",onClick:()=>{B(),L(),b([{type:"showLikesModal",value:!0}])},onKeyDown:T,children:p.formatMessage({id:"discussion_likes_showAll"})})})]})}),k&&c.jsx(gr,{children:c.jsx(y.Suspense,{children:c.jsx(Bg,{activityId:o,basePath:l,parentId:u,likeCount:t,showModal:k,functions:{onClose:()=>b([{type:"showLikesModal",value:!1}]),likes:{list:h}}})})})]})]}))},Ps=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},vr=e=>{var t,n,r,a,i,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:(a=e==null?void 0:e.data)==null?void 0:a.location,image:{thumbnail:((i=e==null?void 0:e.data)==null?void 0:i.thumbnail)||void 0},badges:(s=e==null?void 0:e.data)==null?void 0:s.badges}:"deleted"};function Sg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Lu({activity:vg(o),user:i});return Za(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=Lu({activity:o,user:i});r.setQueryData(a,Za(d,u,{replace:!0})),setTimeout(()=>{Xd(d.id,"activity")},0)}});return s}function jg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=qt(a,s);return o&&(o.content=i),s}),onError:n});return r}function Og({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i,pin:s,unpin:o},queryKey:l,filterOption:u}){const d=Ke.useQueryClient(),m=ci(),h={queryClient:d,queryKey:l},p={mutationHandlers:{error:yo(h),mutate:xo(h)},user:m,...h},g=Sg({...p,mutationFn:e}),f=jg({...p,mutationFn:t}),b=Pg({...p,mutationFn:n}),v=Ig({...p,mutationFn:a}),C=Rg({...p,mutationFn:i}),D=Ng({...p,mutationFn:s}),A=$g({...p,mutationFn:o}),{activities:E,...k}=Mg({queryKey:l,queryFn:r,filterOption:u});return{activities:E,mutations:{create:g,edit:f,remove:v,like:b,unlike:C,pin:D,unpin:A},user:m,...k}}function Pg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=qt(s,o);return l&&Ha({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=qt(o,l);u&&Ha({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Mg({queryFn:e,queryKey:t,filterOption:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`${n==null?void 0:n.type}=${n==null?void 0:n.id}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&${n==null?void 0:n.type}=${n==null?void 0:n.id}`:null});return{activities:Co(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function Ng({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=qt(s,o);return l&&Ka({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=qt(o,l);u&&Ka({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Ig({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Jd(a,i)),onError:n});return r}function Rg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=qt(i,s);return o&&Gd({activity:o,user:r}),s}),onError:n});return a}function $g({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=qt(i,s);return o&&Qd({activity:o,user:r}),s}),onError:n});return a}const Lg=280,Do=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?sr(e,typeof t=="number"?t:Lg):e;a=a.trim();const i=`<br>
62
+ */function Pu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Mu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pu(Object(n),!0).forEach(function(r){zp(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function zp(e,t,n){return t=Up(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qp(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 Up(e){var t=qp(e,"string");return typeof t=="symbol"?t:String(t)}var Nu={activateTrap:function(t,n){if(t.length>0){var r=t[t.length-1];r!==n&&r.pause()}var a=t.indexOf(n);a===-1||t.splice(a,1),t.push(n)},deactivateTrap:function(t,n){var r=t.indexOf(n);r!==-1&&t.splice(r,1),t.length>0&&t[t.length-1].unpause()}},Wp=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},Vp=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},jr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},Hp=function(t){return jr(t)&&!t.shiftKey},Kp=function(t){return jr(t)&&t.shiftKey},Iu=function(t){return setTimeout(t,0)},Ru=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},Cr=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return typeof t=="function"?t.apply(void 0,r):t},oa=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},Zp=[],Yp=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||Zp,i=Mu({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Hp,isKeyBackward:Kp},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(B,F,j){return B&&B[F]!==void 0?B[F]:i[j||F]},u=function(B,F){var j=typeof(F==null?void 0:F.composedPath)=="function"?F.composedPath():void 0;return s.containerGroups.findIndex(function(O){var q=O.container,W=O.tabbableNodes;return q.contains(B)||(j==null?void 0:j.includes(q))||W.find(function(ne){return ne===B})})},d=function(B){var F=i[B];if(typeof F=="function"){for(var j=arguments.length,O=new Array(j>1?j-1:0),q=1;q<j;q++)O[q-1]=arguments[q];F=F.apply(void 0,O)}if(F===!0&&(F=void 0),!F){if(F===void 0||F===!1)return F;throw new Error("`".concat(B,"` was specified but was not a node, or did not return a node"))}var W=F;if(typeof F=="string"&&(W=r.querySelector(F),!W))throw new Error("`".concat(B,"` as selector refers to no known node"));return W},m=function(){var B=d("initialFocus");if(B===!1)return!1;if(B===void 0||!Ta(B,i.tabbableOptions))if(u(r.activeElement)>=0)B=r.activeElement;else{var F=s.tabbableGroups[0],j=F&&F.firstTabbableNode;B=j||d("fallbackFocus")}if(!B)throw new Error("Your focus-trap needs to have at least one focusable element");return B},h=function(){if(s.containerGroups=s.containers.map(function(B){var F=Vd(B,i.tabbableOptions),j=Hd(B,i.tabbableOptions),O=F.length>0?F[0]:void 0,q=F.length>0?F[F.length-1]:void 0,W=j.find(function(w){return kn(w)}),ne=j.slice().reverse().find(function(w){return kn(w)}),J=!!F.find(function(w){return gn(w)>0});return{container:B,tabbableNodes:F,focusableNodes:j,posTabIndexesFound:J,firstTabbableNode:O,lastTabbableNode:q,firstDomTabbableNode:W,lastDomTabbableNode:ne,nextTabbableNode:function(Q){var se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=F.indexOf(Q);return _<0?se?j.slice(j.indexOf(Q)+1).find(function(M){return kn(M)}):j.slice(0,j.indexOf(Q)).reverse().find(function(M){return kn(M)}):F[_+(se?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(B){return B.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(B){return B.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 L(B){var F=B.activeElement;if(F)return F.shadowRoot&&F.shadowRoot.activeElement!==null?L(F.shadowRoot):F},g=function L(B){if(B!==!1&&B!==p(document)){if(!B||!B.focus){L(m());return}B.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=B,Wp(B)&&B.select()}},f=function(B){var F=d("setReturnFocus",B);return F||(F===!1?!1:B)},b=function(B){var F=B.target,j=B.event,O=B.isBackward,q=O===void 0?!1:O;F=F||oa(j),h();var W=null;if(s.tabbableGroups.length>0){var ne=u(F,j),J=ne>=0?s.containerGroups[ne]:void 0;if(ne<0)q?W=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:W=s.tabbableGroups[0].firstTabbableNode;else if(q){var w=Ru(s.tabbableGroups,function(S){var R=S.firstTabbableNode;return F===R});if(w<0&&(J.container===F||Ta(F,i.tabbableOptions)&&!kn(F,i.tabbableOptions)&&!J.nextTabbableNode(F,!1))&&(w=ne),w>=0){var Q=w===0?s.tabbableGroups.length-1:w-1,se=s.tabbableGroups[Q];W=gn(F)>=0?se.lastTabbableNode:se.lastDomTabbableNode}else jr(j)||(W=J.nextTabbableNode(F,!1))}else{var _=Ru(s.tabbableGroups,function(S){var R=S.lastTabbableNode;return F===R});if(_<0&&(J.container===F||Ta(F,i.tabbableOptions)&&!kn(F,i.tabbableOptions)&&!J.nextTabbableNode(F))&&(_=ne),_>=0){var M=_===s.tabbableGroups.length-1?0:_+1,U=s.tabbableGroups[M];W=gn(F)>=0?U.firstTabbableNode:U.firstDomTabbableNode}else jr(j)||(W=J.nextTabbableNode(F))}}else W=d("fallbackFocus");return W},v=function(B){var F=oa(B);if(!(u(F,B)>=0)){if(Cr(i.clickOutsideDeactivates,B)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}Cr(i.allowOutsideClick,B)||B.preventDefault()}},C=function(B){var F=oa(B),j=u(F,B)>=0;if(j||F instanceof Document)j&&(s.mostRecentlyFocusedNode=F);else{B.stopImmediatePropagation();var O,q=!0;if(s.mostRecentlyFocusedNode)if(gn(s.mostRecentlyFocusedNode)>0){var W=u(s.mostRecentlyFocusedNode),ne=s.containerGroups[W].tabbableNodes;if(ne.length>0){var J=ne.findIndex(function(w){return w===s.mostRecentlyFocusedNode});J>=0&&(i.isKeyForward(s.recentNavEvent)?J+1<ne.length&&(O=ne[J+1],q=!1):J-1>=0&&(O=ne[J-1],q=!1))}}else s.containerGroups.some(function(w){return w.tabbableNodes.some(function(Q){return gn(Q)>0})})||(q=!1);else q=!1;q&&(O=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(O||s.mostRecentlyFocusedNode||m())}s.recentNavEvent=void 0},D=function(B){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=B;var j=b({event:B,isBackward:F});j&&(jr(B)&&B.preventDefault(),g(j))},A=function(B){if(Vp(B)&&Cr(i.escapeDeactivates,B)!==!1){B.preventDefault(),o.deactivate();return}(i.isKeyForward(B)||i.isKeyBackward(B))&&D(B,i.isKeyBackward(B))},E=function(B){var F=oa(B);u(F,B)>=0||Cr(i.clickOutsideDeactivates,B)||Cr(i.allowOutsideClick,B)||(B.preventDefault(),B.stopImmediatePropagation())},k=function(){if(s.active)return Nu.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Iu(function(){g(m())}):g(m()),r.addEventListener("focusin",C,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",E,{capture:!0,passive:!1}),r.addEventListener("keydown",A,{capture:!0,passive:!1}),o},T=function(){if(s.active)return r.removeEventListener("focusin",C,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",E,!0),r.removeEventListener("keydown",A,!0),o},$=function(B){var F=B.some(function(j){var O=Array.from(j.removedNodes);return O.some(function(q){return q===s.mostRecentlyFocusedNode})});F&&g(m())},P=typeof window<"u"&&"MutationObserver"in window?new MutationObserver($):void 0,z=function(){P&&(P.disconnect(),s.active&&!s.paused&&s.containers.map(function(B){P.observe(B,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(B){if(s.active)return this;var F=l(B,"onActivate"),j=l(B,"onPostActivate"),O=l(B,"checkCanFocusTrap");O||h(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,F==null||F();var q=function(){O&&h(),k(),z(),j==null||j()};return O?(O(s.containers.concat()).then(q,q),this):(q(),this)},deactivate:function(B){if(!s.active)return this;var F=Mu({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},B);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,T(),s.active=!1,s.paused=!1,z(),Nu.deactivateTrap(a,o);var j=l(F,"onDeactivate"),O=l(F,"onPostDeactivate"),q=l(F,"checkCanReturnFocus"),W=l(F,"returnFocus","returnFocusOnDeactivate");j==null||j();var ne=function(){Iu(function(){W&&g(f(s.nodeFocusedBeforeActivation)),O==null||O()})};return W&&q?(q(f(s.nodeFocusedBeforeActivation)).then(ne,ne),this):(ne(),this)},pause:function(B){if(s.paused||!s.active)return this;var F=l(B,"onPause"),j=l(B,"onPostPause");return s.paused=!0,F==null||F(),T(),z(),j==null||j(),this},unpause:function(B){if(!s.paused||!s.active)return this;var F=l(B,"onUnpause"),j=l(B,"onPostUnpause");return s.paused=!1,F==null||F(),h(),k(),z(),j==null||j(),this},updateContainerElements:function(B){var F=[].concat(B).filter(Boolean);return s.containers=F.map(function(j){return typeof j=="string"?r.querySelector(j):j}),s.active&&h(),z(),this}},o.updateContainerElements(t),o};const Gp=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Yp},Symbol.toStringTag,{value:"Module"})),Qp=Xc(Gp),Jp=Xc(Lp);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 Xp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $u(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,Kd(r.key),r)}}function eg(e,t,n){return t&&$u(e.prototype,t),n&&$u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function tg(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&&Os(e,t)}function Os(e,t){return Os=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Os(e,t)}function ng(e){var t=ag();return function(){var r=Va(e),a;if(t){var i=Va(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return rg(this,a)}}function rg(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 Br(e)}function Br(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ag(){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 Va(e){return Va=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Va(e)}function ig(e,t,n){return t=Kd(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Kd(e){var t=sg(e,"string");return lr(t)==="symbol"?t:String(t)}function sg(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 ua=y,be=Ep,og=Qp,ug=og.createFocusTrap,lg=Jp,cg=lg.isFocusable,vo=function(e){tg(n,e);var t=ng(n);function n(r){var a;Xp(this,n),a=t.call(this,r),ig(Br(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var d=arguments.length,m=new Array(d>1?d-1:0),h=1;h<d;h++)m[h-1]=arguments[h];u=u.apply(void 0,m)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var p=u;if(typeof u=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),a.handleDeactivate=a.handleDeactivate.bind(Br(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(Br(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(Br(a)),a.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:a.handleDeactivate,onPostDeactivate:a.handlePostDeactivate,clickOutsideDeactivates:a.handleClickOutsideDeactivates},a.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){a.originalOptions[s]=i[s];continue}a.internalOptions[s]=i[s]}return a.outsideClick=null,a.focusTrapElements=r.containerElements||[],a.updatePreviousElement(),a}return eg(n,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var a=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return a||(a===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var a=this.getDocument();a&&(this.previouslyFocusedElement=a.activeElement)}},{key:"deactivateTrap",value:function(){!this.focusTrap||!this.focusTrap.active||this.focusTrap.deactivate({returnFocus:!1,checkCanReturnFocus:null,onDeactivate:this.originalOptions.onDeactivate})}},{key:"handleClickOutsideDeactivates",value:function(a){var i=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,a):this.originalOptions.clickOutsideDeactivates;return i&&(this.outsideClick={target:a.target,allowDeactivation:i}),i}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var a=this,i=function(){var o=a.getReturnFocusNode(),l=!!(a.originalOptions.returnFocusOnDeactivate&&o!==null&&o!==void 0&&o.focus&&(!a.outsideClick||a.outsideClick.allowDeactivation&&!cg(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,d=u===void 0?!1:u;l&&o.focus({preventScroll:d}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?ua.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===ua.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var d=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=d||[u]},o=ua.cloneElement(i,{ref:s});return o}return null}}]),n}(ua.Component),wr=typeof Element>"u"?Function:Element;vo.propTypes={active:be.bool,paused:be.bool,focusTrapOptions:be.shape({document:be.object,onActivate:be.func,onPostActivate:be.func,checkCanFocusTrap:be.func,onPause:be.func,onPostPause:be.func,onUnpause:be.func,onPostUnpause:be.func,onDeactivate:be.func,onPostDeactivate:be.func,checkCanReturnFocus:be.func,initialFocus:be.oneOfType([be.instanceOf(wr),be.string,be.bool,be.func]),fallbackFocus:be.oneOfType([be.instanceOf(wr),be.string,be.func]),escapeDeactivates:be.oneOfType([be.bool,be.func]),clickOutsideDeactivates:be.oneOfType([be.bool,be.func]),returnFocusOnDeactivate:be.bool,setReturnFocus:be.oneOfType([be.instanceOf(wr),be.string,be.bool,be.func]),allowOutsideClick:be.oneOfType([be.bool,be.func]),preventScroll:be.bool,tabbableOptions:be.shape({displayCheck:be.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:be.oneOfType([be.bool,be.func])}),trapStack:be.array,isKeyForward:be.func,isKeyBackward:be.func}),containerElements:be.arrayOf(be.instanceOf(wr)),children:be.oneOfType([be.element,be.instanceOf(wr)])};vo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:ug};var dg=vo;const fg=Rn(dg);const ln=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:d="",gtmContext:m="Modal"})=>{const h=ae.useIntl(),{registerOverlay:p,unregisterOverlay:g}=Td(),[f,b]=y.useState(t),[v,C]=y.useState(null),D=y.useRef(null),A=P=>{f&&P.key==="Escape"&&T(!1)},E=P=>{C(P.target)},k=P=>{v===D.current&&P.target===D.current&&T(!1),C(null)};y.useEffect(()=>{if(f)return window.addEventListener("keyup",A),()=>{window.removeEventListener("keyup",A)}},[f]),y.useEffect(()=>{const P=D.current;return P&&(P.addEventListener("mousedown",E),P.addEventListener("mouseup",k)),()=>{P&&(P.removeEventListener("mousedown",E),P.removeEventListener("mouseup",k))}},[v]);const T=P=>{if(b(P),P)a(),p(e);else{if(f===P)return;i(),g(e)}};y.useEffect(()=>(T(t),()=>{f&&g(e)}),[t]);const $=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:D,className:V("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(po,{id:e,className:V("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:$,children:t&&c.jsx(fg,{containerElements:[D.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(Ee,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>T(!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,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(zt,{}),c.jsx(pr,{buttons:u})]}),s&&c.jsx(ur,{className:"error",children:s})]})})})})},Zd=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Dr="joinCommunityButton",bo=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ae.useIntl(),o=y.useContext(it),l=o&&typeof o.id=="string",u=r||!l,[d,m]=y.useState(e),[h,p]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{h==="joining"?p("joined"):h==="leaving"&&p("notJoined")},[d]);const g={},f={};return d&&h!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${Dr}_leave`}),g["aria-label"]=s.formatMessage({id:`${Dr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(Ee,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&h!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${Dr}_closed_tooltip`}):"",onClick:async b=>{if(u)return;b.currentTarget.blur(),p(d?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${Dr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(v);const C=d?i:a;typeof C=="function"&&setTimeout(async()=>{await C()},500),m(!d)},className:V("join-community-button",h,{active:h==="joining"}),disabled:u,"data-testid":"join-button",...g,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${Dr}${["joining","leaving"].includes(h)?`_${h}`:d?"_member":n?"_short":""}`})})})};const Pi="communityDetails_",mg=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=ae.useIntl(),{id:u}=y.useContext(it),d=u,m=5,h=a||i.length,p=i.length?i:Array(m).fill({}),g=`/communities/${r}/members`===window.location.pathname,f=t||n,b=!n&&!t;return c.jsxs("div",{className:V("community-details",e),children:[f?c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[l.formatMessage({id:`${Pi}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:l.formatMessage({id:`${Pi}viewAll`})})})]}),d&&c.jsx(ho,{contributors:{total:a,data:p},styling:{size:"medium",showGap:!0,showPlaceholders:h===0},cutoff:m})]}):c.jsx(c.Fragment,{}),d?c.jsxs(c.Fragment,{children:[c.jsx(bo,{isMember:t,isOpen:n,disabled:b,functions:{...o}}),t&&c.jsx(Ee,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${Pi}invite`})})]}):c.jsx(c.Fragment,{})]})};const qr=({icon:e,className:t="",...n})=>c.jsx(Ee,{className:V("action-button",t),variant:"tertiary",icon:e,...n}),hg="post",pg="reply",Yd="00000000-0000-0000-0000-000000000000";function yo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function xo({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return e.setQueryData(t,r),a}return n}function gg(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function vg(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Gd(e){const{id:t="",name:n="",organization:r="",jobTitle:a="",image:i={}}=e,{thumbnail:s=""}=i;return{id:t,data:{name:n,organization:r,jobTitle:a,thumbnail:s}}}function bg({title:e,content:t,categories:n}){const r=[];return n&&!["no-category",""].includes(n)&&r.push(n),{title:e,content:t,categories:r,id:Yd,time:new Date().toISOString(),verb:hg}}function Lu({activity:e,user:t}){return{...e,actor:Gd(t),...gg()}}function Ha({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((a=e.own_reactions)==null?void 0:a.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function Qd({activity:e,user:t}){var n,r,a;e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like-1:0},t!=null&&t.id&&(e.latest_reactions={...e.latest_reactions||{},like:(((r=e.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((a=e.own_reactions)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function Ka({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},pin:[...((r=e.latest_reactions)==null?void 0:r.pin)||[],t]},e.own_reactions={...e.own_reactions||{},pin:[...((a=e.own_reactions)==null?void 0:a.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function Jd({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 yg({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Yd,kind:pg,parent:t||""}}function zu({reply:e,user:t}){const n=Gd(t);return{...e,user_id:n.id,user:n,...vg()}}function qu({reply:e,reaction:t}){var n,r,a;t?(e.latest_children={...e.latest_children||{},like:[...((r=e.latest_children)==null?void 0:r.like)||[],t]},e.own_children={...e.own_children||{},like:[...((a=e.own_children)==null?void 0:a.like)||[],t]}):e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like+1:1}}function xg({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function Cg(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function wg(e,t,n){const r=t.pages.length-1,a=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[a]=e:t.pages[r].results.push(e),t}function Dg(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 Za(e,t,n){return t?n!=null&&n.append?wg(e,t,n):Dg(e,t,n):Cg(e)}function qt(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Xd(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function Co(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const ef=(e,t)=>{const n=new CustomEvent(rt.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let Uu,Mi=0;const tf=()=>{y.useEffect(()=>(document.addEventListener(rt.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(rt.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(Uu);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),Mi=0;return}Mi++,!(Mi>10)&&(Uu=setTimeout(()=>{e(t)},50))}};var Ae=(e=>(e.Answer="answer",e.Poll="poll",e.Post="post",e.Response="response",e.Reply="reply",e.Question="question",e))(Ae||{});const cr=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}),Qt=Object.freeze({id:"some-user-id-2",name:"some user name 2",organization:"some user organization 2",jobTitle:"some user job title 2",image:{thumbnail:"https://some-user-thumbnail.com/avatar2.png"},isLoading:!1}),wo=Object.freeze({actor:`SU:${cr.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"}),Eg=Object.freeze({actor:`SU:${Qt.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"}),_g=Object.freeze({actor:`SU:${cr.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"}),kg=Object.freeze({actor:`SU:${Qt.id}`,content:"some content 4",duration:"5.53ms",feed_id:"some-feed-id-4",foreign_id:"post:some-foriegn-id-4",id:"some-activity-id-4",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"});Object.freeze({id:"some-reaction-id-1",activity_id:wo.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Qt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Qt.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({id:"some-reaction-id-1",activity_id:wo.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Qt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Qt.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:Qt.id,user:{id:Qt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:wo.id,data:{content:"Some content 1..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-2",user_id:cr.id,user:{id:cr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Eg.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:Qt.id,user:{id:Qt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:_g.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:cr.id,user:{id:cr.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:kg.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});const Fg=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Ag=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);function Bg(e){return y.useCallback(t=>{var s,o,l,u;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 a=r==null?void 0:r.nextElementSibling;if(n==="up"){const d=r==null?void 0:r.previousElementSibling;d?a=d:(a=(o=r==null?void 0:r.parentElement)==null?void 0:o.lastElementChild,(a==null?void 0:a.getAttribute("data-index"))==="-1"&&(a=a==null?void 0:a.previousElementSibling))}else(!a||(a==null?void 0:a.getAttribute("data-index"))==="-1")&&(a=(l=r==null?void 0:r.parentElement)==null?void 0:l.firstElementChild);if(!a)return;const i=Number((a==null?void 0:a.getAttribute("data-index"))||"0");e([{type:"tabbableLink",value:i}]),(u=a==null?void 0:a.querySelector("a,button"))==null||u.focus()},[e])}const Tg=y.lazy(()=>Promise.resolve().then(()=>iv));let Or=!1;const Ni=()=>{Or!==!1&&(clearTimeout(Or),Or=!1)},Sg=5;let Ii=null;const nf=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:Ae.Reply,slugs:{}},canLike:s=!0,activityId:o,basePath:l,parentId:u,functions:{createLike:d=()=>{},deleteLike:m=()=>{},listLikes:h=async()=>({next:"",results:[]})}})=>{const p=ae.useIntl(),g={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0,showLikesModal:!1},[f,b]=y.useReducer(Jr,g),{numberOfLikes:v,userLikedContent:C,ignoreInteractions:D,showLikers:A,tabbableLink:E,showLikesModal:k}=f,T=Bg(b);y.useEffect(()=>{b([{type:"userLikedContent",value:a}])},[a]);const $=y.useMemo(()=>Ag(n,Sg),[n]),P=F=>{if(F.preventDefault(),F.stopPropagation(),b([{type:"showLikers",value:!1}]),Or)return Ni(),!1;if(Ni(),D||!s)return!1;Or=setTimeout(z,350)},z=async()=>{if(Ni(),D||!s)return!1;let F=C?v-1:v+1;F<0&&(F=0),b([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:F},{type:"userLikedContent",value:!C}]);try{if(i&&i.slugs){const j=Fg(i.slugs);C?await m(j):await d({...j,payload:{contentPath:window.location.pathname}})}}catch{b([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{b([{type:"ignoreInteractions",value:!1}])}},L=()=>{Ii=setTimeout(()=>{b([{type:"showLikers",value:!1}])},500)},B=()=>{Ii&&clearTimeout(Ii)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:F=>{F.key==="Escape"&&b([{type:"showLikers",value:!1}])},onMouseEnter:()=>{B(),b([{type:"showLikers",value:!0}])},onMouseLeave:()=>{L()}},c.jsxs(c.Fragment,{children:[c.jsx(qr,{className:V("discussion-button text-medium action-button likes-button",{"show-spinner":D,"is-liked":C,disabled:!s}),icon:{icon:C?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:P,screenreaderText:s?p.formatMessage({id:`discussion_likes_${C?"unlike":"like"}`},{action:p.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":C,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(Pe,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{B()},onBlur:()=>L,onClick:F=>{var O;F.preventDefault(),F.stopPropagation(),B(),b([{type:"showLikers",value:!0}]);const j=(O=F.currentTarget.nextSibling)==null?void 0:O.childNodes[0];if(j){const q=j.querySelector("li:first-child a");q&&(b([{type:"tabbableLink",value:0}]),setTimeout(()=>{q.focus()},100))}},onKeyDown:F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),L())},"aria-expanded":A,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Pe,{showOnFocus:!1,children:p.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(Ln,{id:`likes-tooltip-${i.slug}`,isOpen:A,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[$.map((F,j)=>{if(typeof F=="string")return null;const O={};return E!==j&&(O.tabIndex=-1),c.jsx("li",{"data-index":j,children:c.jsx(xn,{href:F.id?`/profiles/${F.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onFocus:()=>B(),onKeyDown:T,...O,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":$.length,className:"show-all",children:c.jsx(Ee,{variant:"tertiary",onClick:()=>{B(),L(),b([{type:"showLikesModal",value:!0}])},onKeyDown:T,children:p.formatMessage({id:"discussion_likes_showAll"})})})]})}),k&&c.jsx(gr,{children:c.jsx(y.Suspense,{children:c.jsx(Tg,{activityId:o,basePath:l,parentId:u,likeCount:t,showModal:k,functions:{onClose:()=>b([{type:"showLikesModal",value:!1}]),likes:{list:h}}})})})]})]}))},Ps=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},vr=e=>{var t,n,r,a,i,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:(a=e==null?void 0:e.data)==null?void 0:a.location,image:{thumbnail:((i=e==null?void 0:e.data)==null?void 0:i.thumbnail)||void 0},badges:(s=e==null?void 0:e.data)==null?void 0:s.badges}:"deleted"};function jg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Lu({activity:bg(o),user:i});return Za(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=Lu({activity:o,user:i});r.setQueryData(a,Za(d,u,{replace:!0})),setTimeout(()=>{ef(d.id,"activity")},0)}});return s}function Og({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=qt(a,s);return o&&(o.content=i),s}),onError:n});return r}function Pg({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i,pin:s,unpin:o},queryKey:l,filterOption:u}){const d=Ke.useQueryClient(),m=ci(),h={queryClient:d,queryKey:l},p={mutationHandlers:{error:yo(h),mutate:xo(h)},user:m,...h},g=jg({...p,mutationFn:e}),f=Og({...p,mutationFn:t}),b=Mg({...p,mutationFn:n}),v=Rg({...p,mutationFn:a}),C=$g({...p,mutationFn:i}),D=Ig({...p,mutationFn:s}),A=Lg({...p,mutationFn:o}),{activities:E,...k}=Ng({queryKey:l,queryFn:r,filterOption:u});return{activities:E,mutations:{create:g,edit:f,remove:v,like:b,unlike:C,pin:D,unpin:A},user:m,...k}}function Mg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=qt(s,o);return l&&Ha({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=qt(o,l);u&&Ha({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Ng({queryFn:e,queryKey:t,filterOption:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`${n==null?void 0:n.type}=${n==null?void 0:n.id}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&${n==null?void 0:n.type}=${n==null?void 0:n.id}`:null});return{activities:Co(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function Ig({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=qt(s,o);return l&&Ka({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=qt(o,l);u&&Ka({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Rg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Xd(a,i)),onError:n});return r}function $g({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=qt(i,s);return o&&Qd({activity:o,user:r}),s}),onError:n});return a}function Lg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=qt(i,s);return o&&Jd({activity:o,user:r}),s}),onError:n});return a}const zg=280,Do=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?sr(e,typeof t=="number"?t:zg):e;a=a.trim();const i=`<br>
63
63
 
64
- `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await hd({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a},Eo=(e,t)=>t.length===0||e.length===0?[]:e.map(n=>t.find(r=>r.slug===n)),zg=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:a,functions:{activities:i,form:s,join:o,leave:l,likes:u},profile:d})=>{const m=ae.useIntl(),[h,p]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[g,f]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),{activities:b,error:v,fetchNextPage:C,hasNextPage:D,isLoading:A,mutations:{create:E,edit:k,remove:T,like:$,unlike:P,pin:z,unpin:L}}=Og({queryKey:[e,t,"activities",h],queryFns:i,filterOption:h[0]});y.useEffect(()=>{a&&f(g.concat(a==null?void 0:a.map(({slug:O,name:q})=>({id:O,text:q,type:"category"}))))},[a]);const[B,F]=y.useState(null),j=()=>{F(b.length),C()};return ef(),v?c.jsx(Cn,{variant:"error",text:v.message}):c.jsxs("section",{children:[c.jsx(au,{isCard:!0,parentId:t,categories:a,form:{content:{type:"post",slugs:{}},functions:{create:E,...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:l,notMemberStateText:m.formatMessage({id:"community_joinToPost"})}}),c.jsx(lf,{className:"activities-feed-filtering",options:g.map(({id:O,text:q})=>({id:O,text:m.formatMessage({id:`activitiesFeed_rankingMethod_${q}`,defaultMessage:q})})),defaultOptions:h.map(({id:O,text:q})=>({id:O,text:m.formatMessage({id:`activitiesFeed_rankingMethod_${q}`,defaultMessage:q})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:O,previous:q})=>{if(O[0]===q[0])return;p([g.find(J=>J.id===O[0])]);const W=g.find(J=>J.id===O[0]);if(!W)return;const ne=new CustomEvent("ariaLive",{detail:{message:m.formatMessage({id:"community_sortSuccess"},{order:m.formatMessage({id:`activitiesFeed_rankingMethod_${W.text}`,defaultMessage:W.text})})}});document.dispatchEvent(ne)}}),b==null?void 0:b.map((O,q)=>{var K,Z,re;const{id:W,own_reactions:ne,latest_reactions:J,reaction_counts:w,mentioned_users:Q,total_replies:se,additional_data:_}=O,M=(((K=J==null?void 0:J.like)==null?void 0:K.length)||0)>0,U=(((Z=ne==null?void 0:ne.like)==null?void 0:Z.length)||0)>0,S=U?ne==null?void 0:ne.like[0].id:"",R=M?(re=J==null?void 0:J.like)==null?void 0:re.map(ce=>{var X,pe,ve;return{id:(X=ce==null?void 0:ce.user)==null?void 0:X.id,name:(ve=(pe=ce==null?void 0:ce.user)==null?void 0:pe.data)==null?void 0:ve.name}}):!1;return(O==null?void 0:O.verb)!=="post"?c.jsx(c.Fragment,{children:" "}):c.jsx(y.Fragment,{children:c.jsx(na,{content:{type:"post",title:O==null?void 0:O.title,body:O==null?void 0:O.content,canLike:n,createdAt:(O==null?void 0:O.time)||"",slugs:{question:`${e}/${t}`,answer:W},slug:W,author:vr(O==null?void 0:O.actor),userLiked:U,likes:(w==null?void 0:w.like)||0,comments:se||0,peopleWhoLiked:R,data:{mentions:Q,..._||{}},pinned:(w==null?void 0:w.pin)&&(w==null?void 0:w.pin)>0||!1,categories:Eo((O==null?void 0:O.categories)||[],a||[])},links:{post:`${e}/${t}/${W}`,comments:`${e}/${t}/${W}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>T({activityId:W}),updateContent:(ce,{body:X})=>k({activityId:W,content:X})},likes:{createLike:()=>$({activityId:W}),deleteLike:()=>P({activityId:W,reactionId:S}),listLikes:ce=>u.list({activityId:W,...ce})},comments:{openComments:()=>null},pins:{createPin:()=>z({activityId:W}),deletePin:()=>L({activityId:W,reactionId:J==null?void 0:J.pin[0].id})},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:q===B,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:t||""},{scope:ct.Platform,area:"all"}]},basePath:e,parentId:t})},W)}),!A&&c.jsx(Xr,{hasNextPage:D,loadNextPage:j,icon:{icon:"arrow-down",position:"right"},messages:{button:m.formatMessage({id:"loadMore_button"}),error:m.formatMessage({id:"loadMore_error"})}}),b.length===0&&!A&&c.jsx(_t,{className:"no-activities",variant:"muted",icon:"text--input",children:h[0].type==="category"?c.jsx("p",{children:m.formatMessage({id:"activitiesFeed_noActivities_inCategories"})}):c.jsxs(c.Fragment,{children:[c.jsx("p",{children:m.formatMessage({id:"activitiesFeed_noActivities"})}),c.jsx("p",{children:c.jsx(Ee,{variant:"secondary",size:"small",href:"/communities",children:m.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),c.jsx(iu,{form:d})]})},qg={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 Ug({parentId:e,isMember:t,formFunctions:n,leave:r,join:a}){const i=ae.useIntl();return c.jsx(au,{form:{content:{type:Ae.Reply,slugs:{}},functions:n,meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:i.formatMessage({id:"discussion_responses_placeholder"})},parentId:e,membershipRequiredToPost:{isMember:t,required:!0,join:a,leave:r,notMemberStateText:i.formatMessage({id:"community_joinToPost"})}})}function Wg({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const a=ae.useIntl(),i=()=>{n(r),t()};return c.jsx(Xr,{hasNextPage:e,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},messages:{button:a.formatMessage({id:"loadMore_button"}),error:a.formatMessage({id:"loadMore_error"})}})}function Vg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=zu({reply:bg(o),user:i});return Za(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=zu({reply:o,user:i});r.setQueryData(a,Za(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Xd(d.id,"reply")},0)}});return s}function Hg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=qt(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Kg({replies:e,user:t}){return!e||!(t!=null&&t.id)?[]:e.map(({id:n,own_children:r,latest_children:a,children_counts:i,data:s,created_at:o,parent:l,...u})=>{var f,b,v,C;const d=(((f=r==null?void 0:r.like)==null?void 0:f.length)||0)>0,m=(((b=a==null?void 0:a.like)==null?void 0:b.length)||0)>0,h=d?(v=r==null?void 0:r.like)==null?void 0:v.find(D=>{var A;return((A=D==null?void 0:D.user)==null?void 0:A.id)===(t==null?void 0:t.id)}):!1,p=typeof h=="object"?(h==null?void 0:h.id)??"":"",g=m?(C=a==null?void 0:a.like)==null?void 0:C.map(D=>{var A,E,k;return{id:(A=D==null?void 0:D.user)==null?void 0:A.id,name:(k=(E=D==null?void 0:D.user)==null?void 0:E.data)==null?void 0:k.name}}):!1;return{user:u==null?void 0:u.user,body:Yg(s),createdAt:o,data:Zg(s),likeId:p,liked:m,likes:(i==null?void 0:i.like)||0,peopleWhoLiked:g,replyId:n,parent:l,userLiked:!!h}})}function Zg(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 Yg(e){var t;return e?typeof e.content=="string"?e.content:((t=e==null?void 0:e.content)==null?void 0:t.text)||"":""}function nf({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ke.useQueryClient(),l=ci(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:yo(u),mutate:xo(u)},user:l,...u},m=Vg({...d,mutationFn:e}),h=Hg({...d,mutationFn:t}),p=Gg({...d,mutationFn:n}),g=Jg({...d,mutationFn:a}),f=Xg({...d,mutationFn:i}),{replies:b,...v}=Qg({queryKey:s,queryFn:r});return{replies:Kg({replies:b,user:l}),mutations:{create:m,edit:h,remove:g,like:p,unlike:f},user:l,...v}}function Gg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=qt(s,o);return l&&qu({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=qt(o,l);u&&qu({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function Qg({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:Co(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Jg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Jd(a,i)),onError:n});return r}function Xg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=qt(i,s);return o&&yg({reply:o,user:r}),s}),onError:n});return a}const ev=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:a,functions:{reactions:i,form:s,likes:o}})=>{const l=ae.useIntl(),u=3,{replies:d,fetchNextPage:m,hasNextPage:h,isLoading:p,mutations:{create:g,edit:f,like:b,remove:v,unlike:C}}=nf({queryKey:[t,r,e,a,"replies"],queryFns:{...i,list:E=>i.list({...E,reactionId:a})}});io([p]);const[D,A]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(d==null?void 0:d.length)>=u&&c.jsx(Ee,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${D?"up_left":"down_right"}`,position:"left"},onClick:()=>A(!D),children:l.formatMessage({id:`discussion_thread_${D?"hide":"show"}`},{count:d==null?void 0:d.length})}),D&&c.jsx(rh,{loadMore:{isLoading:p,hasNextPage:h,loadNextPage:()=>m()},form:{parentId:r,content:{type:Ae.Reply,slugs:{question:`${t}/${r}`,answer:e,reply:a}},functions:{create:(E,{body:k})=>g({activityId:e,replyId:a,content:k}),...s},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:d&&d.length>0?d==null?void 0:d.map(({replyId:E,likes:k,data:T,body:$,createdAt:P,userLiked:z,peopleWhoLiked:L,parent:B,user:F,likeId:j})=>c.jsx(na,{isCommunity:!0,content:{id:E,type:Ae.Reply,body:$,canLike:n,createdAt:P,slugs:{question:`${t}/${r}`,answer:e,reply:B},slug:"",author:vr(F),userLiked:z,likes:k,peopleWhoLiked:L,data:T},functions:{content:{createContent:()=>null,deleteContent:()=>v({replyId:E}),updateContent:(O,{body:q})=>f({replyId:E,content:q})},likes:{createLike:()=>b({replyId:E}),deleteLike:()=>C({replyId:E,reactionId:j}),listLikes:O=>o.list({replyId:E,...O})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:r||""},{scope:ct.Platform,area:"all"}]},basePath:t,parentId:r},E)):null})]})};function tv({formFns:e,activityId:t,basePath:n,focus:r,isMember:a,parentId:i,reply:s}){const{body:o,data:l,likeId:u,liked:d,likes:m,peopleWhoLiked:h,replyId:p,createdAt:g,user:f}=s,{edit:b,like:v,remove:C,unlike:D}=e.mutations;return c.jsx(eh,{children:c.jsx(na,{isCommunity:!0,content:{id:p,type:Ae.Reply,body:o,canLike:a,createdAt:g,slugs:{question:`${n}/${i}`,answer:t,reply:p},slug:p,author:vr(f),userLiked:d,likes:m,peopleWhoLiked:h,data:l},functions:{content:{createContent:()=>null,deleteContent:()=>C({replyId:p}),updateContent:(A,{body:E})=>b({replyId:p,content:E})},likes:{createLike:()=>v({replyId:p}),deleteLike:()=>D({replyId:p,reactionId:u}),listLikes:A=>e.likes.list({replyId:p,...A})},comments:{},form:e.form},badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:i||""},{scope:ct.Platform,area:"all"}]},children:c.jsx(ev,{basePath:n,parentId:i,activityId:t,replyId:p,isMember:a,functions:e}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:i},p)},p)}const rf=({activityId:e,basePath:t,parentId:n,activityTotalReplies:r,isMember:a,functions:{form:i,join:s,leave:o,likes:l,reactions:u},profile:d,showReplies:m})=>{const{fetchNextPage:h,hasNextPage:p,isLoading:g,replies:f,mutations:{create:b,remove:v,edit:C,like:D,unlike:A}}=nf({queryKey:[t,n,e,"replies"],queryFns:u}),[E,k]=y.useState(null);io([g]),ef();const T={create:($,P)=>{const{body:z}=P;b({activityId:e,content:z})},...i};return c.jsxs("section",{className:"replies-feed",children:[c.jsx(nh,{type:"comment",responses:r,isLoading:g}),m?c.jsxs(c.Fragment,{children:[c.jsx(Ug,{parentId:n,isMember:a,join:s,leave:o,formFunctions:T}),f==null?void 0:f.map(($,P)=>c.jsx(tv,{activityId:e,basePath:t,focus:E===P,formFns:{form:i,likes:l,reactions:u,mutations:{remove:v,edit:C,like:D,unlike:A}},isMember:a,parentId:n,reply:$},$.replyId)),g?c.jsx(c.Fragment,{children:" "}):c.jsx(Wg,{hasNextPage:p,fetchNextPage:h,setFocusReplyIndex:k,totalReplies:f.length})]}):c.jsx(_t,{children:c.jsx(ae.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),c.jsx(iu,{form:d})]})};function nv({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:d=>(d==null?void 0:d.next)||null}),l=Co(n),u=`${l.length||0}${i?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}}function rv({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=nv({queryKey:t,queryFn:e});return{likes:n,...r}}function af({basePath:e,parentId:t,activityId:n,likeCount:r,functions:a}){const{likes:i,fetchNextPage:s,hasNextPage:o,refetch:l}=rv({queryKey:[e,t,n,"likes"],queryFns:a.likes});y.useEffect(()=>{l()},[l]);const u=i.map(({user:d})=>d).map(d=>d?vr(d):void 0).filter(d=>d&&typeof d!="string");return c.jsx("section",{className:"likes-feed",children:c.jsx(Xm,{members:{data:u,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&u.length<r,loadNextPage:s})})}const sf=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:a,...i})=>{const s=ae.useIntl();return c.jsx(ln,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:V("profile-modal in-portal",a,{open:e}),maxWidth:600,children:c.jsx(af,{...i,likeCount:r??0,functions:{likes:n}})})},av=Object.freeze(Object.defineProperty({__proto__:null,default:sf},Symbol.toStringTag,{value:"Module"})),iv={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 sv=3e3,of=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ae.useIntl(),r="discussion_share_copy_link",[a,i]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(qr,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>i({...a,isOpen:!0}),onFocus:()=>i({...a,isOpen:!0}),onMouseOut:()=>i({isOpen:!1,isCopied:!1}),onBlur:()=>i({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{i({isOpen:!0,isCopied:!0});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{i({isOpen:!1,isCopied:!1})},sv)})},"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:V({copied:a.isCopied}),isOpen:a.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${a.isCopied?"_success":""}`})})]})};const Vn="discussion_",uf=({className:e,gtmContext:t,contentType:n,likes:r,comments:a,replies:i,shareLink:s,moreMenu:o})=>{const l=ae.useIntl(),u=[];return o&&o.reportData&&u.push({text:l.formatMessage({id:`${Vn}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(l.formatMessage({id:`${Vn}report_subject`}))}&body=${encodeURI(l.formatMessage({id:`${Vn}report_body`},{contentType:n||"",contentSlug:o&&o.reportData&&o.contentSlug||"",contentUrl:o&&o.reportData&&o.reportData.contentUrl||""}))}`,icon:"flag"}),c.jsxs("ul",{className:V("actions text-medium",e),"data-testid":`${n}-actions`,children:[r?c.jsx(tf,{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,{}),a?c.jsx("li",{children:c.jsx(qr,{onClick:d=>{d.preventDefault(),d.stopPropagation(),a.functions.onClick()},icon:{icon:"speech-bubble_square"},"data-testid":"comment","data-gtm-event-context":t,"data-gtm-event-type":`answer-${n}-click`,screenreaderText:l.formatMessage({id:`${Vn}comments_screenReader`},{count:a.count}),children:l.formatMessage({id:`${Vn}comments${a.count===null?"_loading":""}`},{count:a.count})})}):c.jsx(c.Fragment,{}),i?c.jsx("li",{children:c.jsx(qr,{styling:{muted:!0},onClick:i.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",children:l.formatMessage({id:`${Vn}reply`})})}):c.jsx(c.Fragment,{}),s?c.jsx(of,{url:s.url,gtm:{context:t||"",event:`copy-link-${n}-click`}}):c.jsx(c.Fragment,{}),o?c.jsx(cf,{element:"li",id:`more-${o.contentSlug}`,options:[...o.options||[],...u]}):c.jsx(c.Fragment,{})]})};const ov=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ae.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Pe,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:V("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),c.jsxs("li",{children:[s&&c.jsx(Pe,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(xn,{href:s?void 0:i,...l,children:sr(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const _o=({variant:e="default",data:{image:t,url:n,title:r,description:a},onClick:i,gtm:s,...o})=>{const l=n.split("//")[1].split("/")[0],{context:u="EnrichedLink",event:d="enriched-link-click"}=s??{};return c.jsxs("aside",{className:V("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:m=>{if(m.preventDefault(),m.stopPropagation(),i){i(m);return}window.open(n,"_blank")},"data-gtm-event-context":u,"data-gtm-event-type":d,children:[c.jsx("small",{children:l}),c.jsx("p",{className:"title text-medium",children:c.jsx("a",{...o,href:n,target:"_blank",rel:"noreferrer",children:r})}),a&&e!=="condensed"?c.jsx("p",{className:"text-small",children:a}):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 lf=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:a=()=>{},preventNoOptionSelected:i=!1,className:s=""})=>{const o=ae.useIntl(),l=n?[{id:"all",text:typeof n!="boolean"&&n.text||o.formatMessage({id:"filters_all"})},...e]:e,[u,d]=y.useState(n?["all"]:t.length?t.map(g=>g.id):[]),[m,h]=y.useState(0),p=(g,f)=>{let b=[];u.includes(g)&&!i?b=u.filter(v=>v!==g):g==="all"?b=["all"]:r?b=[...u.filter(v=>v!=="all"),g]:b=[g],d(v=>(a&&typeof a=="function"&&a({current:b,previous:v}),b)),f&&typeof f=="function"&&f()};return c.jsx("ul",{className:V("filters",s),children:l.map(({id:g,text:f,disabled:b=!1,callback:v=()=>{}},C)=>{let D={tabIndex:m===C?0:-1};return b&&(D={disabled:!0,"aria-label":o.formatMessage({id:"filters_disabled"},{name:f})}),c.jsx("li",{children:c.jsx("button",{className:V(g,{selected:u.includes(g)}),onClick:A=>{A.preventDefault(),A.stopPropagation(),p(g,v)},onKeyDown:A=>{var $,P;let E=C+1,k,T;switch(A.code){case"Enter":case"Space":A.preventDefault(),A.stopPropagation(),p(g,v);break;case"ArrowLeft":case"ArrowRight":A.preventDefault(),A.stopPropagation(),A.code==="ArrowLeft"?(E=C-1,E<0&&(E=l.length-1)):E>=l.length&&(E=0),h(E),k=A.currentTarget.closest("li"),T=($=k==null?void 0:k.parentElement)==null?void 0:$.children[E],(P=T==null?void 0:T.querySelector("button"))==null||P.focus();break}},"aria-selected":u.includes(g),...D,children:f})},g)})})},uv=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let a="",i=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(a+=`/${s}`,i=!0):(a.includes(`/${r}/`)||(a+=`/${r}`),a+=`/${s}`)}),a.includes(`/${r}/`)||(a+=`/${r}`),t&&(a+=`/${t}`),i?{url:a,urlForRouter:`/${a.split("/").slice(2).join("/")}`}:a};const la="languageSwitcher_",lv=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ae.useIntl(),{updateLanguage:d=()=>{}}=y.useContext(co),[m,h]=y.useState(e);if(y.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:V("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${la}label`})}),c.jsx("ul",{children:g.map(b=>{var D;if(!Ba[b])return null;const v=(D=r[b])==null?void 0:D.post_name;let C={className:b};if(m===b)C["aria-label"]=u.formatMessage({id:`${la}selected`},{language:Ba[b]});else{const A=uv(b,v,i);C={...C,href:typeof A=="string"?A:A.url,onClick:E=>{h(b),d(b),typeof a<"u"&&(E.preventDefault(),E.stopPropagation(),a(b,typeof A=="string"?A:A.urlForRouter))}}}return c.jsx("li",{children:c.jsx(xn,{...C,fallbackElement:"span",children:Ba[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${la}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${la}disclaimer`},{email:Qn.support,link:b=>{const v=`mailto:${b}`;return c.jsx("a",{href:v,children:b})}})})]})};const Ri=ae.createIntl({locale:"en",messages:hr}),Xr=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:a="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:Ri.formatMessage({id:"loadMore_button"}),endOfFeed:Ri.formatMessage({id:"loadMore_endOfFeed"}),error:Ri.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,m]=y.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:V("load-more",l),children:!d&&e?c.jsx(Ee,{variant:r,size:a,styling:i,icon:s,onClick:h,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const ko=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:V("logo",e,t,n),...r,children:c.jsx(Pe,{children:c.jsx(ae.FormattedMessage,{id:"apolitical"})})})});let ca=!1;const cf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ae.useIntl(),i=y.useRef(null),[s,o]=y.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:i,className:V("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"tertiary",size:"medium","data-testid":"more-menu",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:d,text:m,icon:h,...p},g)=>{const f={...p,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{ca&&(clearTimeout(ca),ca=!1)},onBlur:()=>{ca=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(Ee,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...f,children:m})},`${window.btoa(m)}_${g}`)})})]})})},cv=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const dv=y.lazy(()=>Promise.resolve().then(()=>hp)),fv=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],df=({activeLink:e,profile:t})=>{const n=ae.useIntl(),r=y.useContext(it),a=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[fv.map(({key:i,href:s})=>{const o=cv(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:V(i,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${i}`})})},i)}),a&&t&&c.jsx(dv,{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"})]})},Er=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,mv=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${Er(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(`${Er(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(`${Er(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
64
+ `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await pd({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a},Eo=(e,t)=>t.length===0||e.length===0?[]:e.map(n=>t.find(r=>r.slug===n)),qg=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:a,functions:{activities:i,form:s,join:o,leave:l,likes:u},profile:d})=>{const m=ae.useIntl(),[h,p]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[g,f]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),{activities:b,error:v,fetchNextPage:C,hasNextPage:D,isLoading:A,mutations:{create:E,edit:k,remove:T,like:$,unlike:P,pin:z,unpin:L}}=Pg({queryKey:[e,t,"activities",h],queryFns:i,filterOption:h[0]});y.useEffect(()=>{a&&f(g.concat(a==null?void 0:a.map(({slug:O,name:q})=>({id:O,text:q,type:"category"}))))},[a]);const[B,F]=y.useState(null),j=()=>{F(b.length),C()};return tf(),v?c.jsx(Cn,{variant:"error",text:v.message}):c.jsxs("section",{children:[c.jsx(au,{isCard:!0,parentId:t,categories:a,form:{content:{type:"post",slugs:{}},functions:{create:E,...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:l,notMemberStateText:m.formatMessage({id:"community_joinToPost"})}}),c.jsx(cf,{className:"activities-feed-filtering",options:g.map(({id:O,text:q})=>({id:O,text:m.formatMessage({id:`activitiesFeed_rankingMethod_${q}`,defaultMessage:q})})),defaultOptions:h.map(({id:O,text:q})=>({id:O,text:m.formatMessage({id:`activitiesFeed_rankingMethod_${q}`,defaultMessage:q})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:O,previous:q})=>{if(O[0]===q[0])return;p([g.find(J=>J.id===O[0])]);const W=g.find(J=>J.id===O[0]);if(!W)return;const ne=new CustomEvent("ariaLive",{detail:{message:m.formatMessage({id:"community_sortSuccess"},{order:m.formatMessage({id:`activitiesFeed_rankingMethod_${W.text}`,defaultMessage:W.text})})}});document.dispatchEvent(ne)}}),b==null?void 0:b.map((O,q)=>{var K,Z,re;const{id:W,own_reactions:ne,latest_reactions:J,reaction_counts:w,mentioned_users:Q,total_replies:se,additional_data:_}=O,M=(((K=J==null?void 0:J.like)==null?void 0:K.length)||0)>0,U=(((Z=ne==null?void 0:ne.like)==null?void 0:Z.length)||0)>0,S=U?ne==null?void 0:ne.like[0].id:"",R=M?(re=J==null?void 0:J.like)==null?void 0:re.map(ce=>{var X,pe,ve;return{id:(X=ce==null?void 0:ce.user)==null?void 0:X.id,name:(ve=(pe=ce==null?void 0:ce.user)==null?void 0:pe.data)==null?void 0:ve.name}}):!1;return(O==null?void 0:O.verb)!=="post"?c.jsx(c.Fragment,{children:" "}):c.jsx(y.Fragment,{children:c.jsx(na,{content:{type:"post",title:O==null?void 0:O.title,body:O==null?void 0:O.content,canLike:n,createdAt:(O==null?void 0:O.time)||"",slugs:{question:`${e}/${t}`,answer:W},slug:W,author:vr(O==null?void 0:O.actor),userLiked:U,likes:(w==null?void 0:w.like)||0,comments:se||0,peopleWhoLiked:R,data:{mentions:Q,..._||{}},pinned:(w==null?void 0:w.pin)&&(w==null?void 0:w.pin)>0||!1,categories:Eo((O==null?void 0:O.categories)||[],a||[])},links:{post:`${e}/${t}/${W}`,comments:`${e}/${t}/${W}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>T({activityId:W}),updateContent:(ce,{body:X})=>k({activityId:W,content:X})},likes:{createLike:()=>$({activityId:W}),deleteLike:()=>P({activityId:W,reactionId:S}),listLikes:ce=>u.list({activityId:W,...ce})},comments:{openComments:()=>null},pins:{createPin:()=>z({activityId:W}),deletePin:()=>L({activityId:W,reactionId:J==null?void 0:J.pin[0].id})},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:q===B,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:t||""},{scope:ct.Platform,area:"all"}]},basePath:e,parentId:t})},W)}),!A&&c.jsx(Xr,{hasNextPage:D,loadNextPage:j,icon:{icon:"arrow-down",position:"right"},messages:{button:m.formatMessage({id:"loadMore_button"}),error:m.formatMessage({id:"loadMore_error"})}}),b.length===0&&!A&&c.jsx(_t,{className:"no-activities",variant:"muted",icon:"text--input",children:h[0].type==="category"?c.jsx("p",{children:m.formatMessage({id:"activitiesFeed_noActivities_inCategories"})}):c.jsxs(c.Fragment,{children:[c.jsx("p",{children:m.formatMessage({id:"activitiesFeed_noActivities"})}),c.jsx("p",{children:c.jsx(Ee,{variant:"secondary",size:"small",href:"/communities",children:m.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),c.jsx(iu,{form:d})]})},Ug={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 Wg({parentId:e,isMember:t,formFunctions:n,leave:r,join:a}){const i=ae.useIntl();return c.jsx(au,{form:{content:{type:Ae.Reply,slugs:{}},functions:n,meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:i.formatMessage({id:"discussion_responses_placeholder"})},parentId:e,membershipRequiredToPost:{isMember:t,required:!0,join:a,leave:r,notMemberStateText:i.formatMessage({id:"community_joinToPost"})}})}function Vg({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const a=ae.useIntl(),i=()=>{n(r),t()};return c.jsx(Xr,{hasNextPage:e,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},messages:{button:a.formatMessage({id:"loadMore_button"}),error:a.formatMessage({id:"loadMore_error"})}})}function Hg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=zu({reply:yg(o),user:i});return Za(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=zu({reply:o,user:i});r.setQueryData(a,Za(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{ef(d.id,"reply")},0)}});return s}function Kg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=qt(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Zg({replies:e,user:t}){return!e||!(t!=null&&t.id)?[]:e.map(({id:n,own_children:r,latest_children:a,children_counts:i,data:s,created_at:o,parent:l,...u})=>{var f,b,v,C;const d=(((f=r==null?void 0:r.like)==null?void 0:f.length)||0)>0,m=(((b=a==null?void 0:a.like)==null?void 0:b.length)||0)>0,h=d?(v=r==null?void 0:r.like)==null?void 0:v.find(D=>{var A;return((A=D==null?void 0:D.user)==null?void 0:A.id)===(t==null?void 0:t.id)}):!1,p=typeof h=="object"?(h==null?void 0:h.id)??"":"",g=m?(C=a==null?void 0:a.like)==null?void 0:C.map(D=>{var A,E,k;return{id:(A=D==null?void 0:D.user)==null?void 0:A.id,name:(k=(E=D==null?void 0:D.user)==null?void 0:E.data)==null?void 0:k.name}}):!1;return{user:u==null?void 0:u.user,body:Gg(s),createdAt:o,data:Yg(s),likeId:p,liked:m,likes:(i==null?void 0:i.like)||0,peopleWhoLiked:g,replyId:n,parent:l,userLiked:!!h}})}function Yg(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 Gg(e){var t;return e?typeof e.content=="string"?e.content:((t=e==null?void 0:e.content)==null?void 0:t.text)||"":""}function rf({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ke.useQueryClient(),l=ci(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:yo(u),mutate:xo(u)},user:l,...u},m=Hg({...d,mutationFn:e}),h=Kg({...d,mutationFn:t}),p=Qg({...d,mutationFn:n}),g=Xg({...d,mutationFn:a}),f=ev({...d,mutationFn:i}),{replies:b,...v}=Jg({queryKey:s,queryFn:r});return{replies:Zg({replies:b,user:l}),mutations:{create:m,edit:h,remove:g,like:p,unlike:f},user:l,...v}}function Qg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=qt(s,o);return l&&qu({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=qt(o,l);u&&qu({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function Jg({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:Co(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Xg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Xd(a,i)),onError:n});return r}function ev({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=qt(i,s);return o&&xg({reply:o,user:r}),s}),onError:n});return a}const tv=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:a,functions:{reactions:i,form:s,likes:o}})=>{const l=ae.useIntl(),u=3,{replies:d,fetchNextPage:m,hasNextPage:h,isLoading:p,mutations:{create:g,edit:f,like:b,remove:v,unlike:C}}=rf({queryKey:[t,r,e,a,"replies"],queryFns:{...i,list:E=>i.list({...E,reactionId:a})}});io([p]);const[D,A]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(d==null?void 0:d.length)>=u&&c.jsx(Ee,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${D?"up_left":"down_right"}`,position:"left"},onClick:()=>A(!D),children:l.formatMessage({id:`discussion_thread_${D?"hide":"show"}`},{count:d==null?void 0:d.length})}),D&&c.jsx(ah,{loadMore:{isLoading:p,hasNextPage:h,loadNextPage:()=>m()},form:{parentId:r,content:{type:Ae.Reply,slugs:{question:`${t}/${r}`,answer:e,reply:a}},functions:{create:(E,{body:k})=>g({activityId:e,replyId:a,content:k}),...s},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:d&&d.length>0?d==null?void 0:d.map(({replyId:E,likes:k,data:T,body:$,createdAt:P,userLiked:z,peopleWhoLiked:L,parent:B,user:F,likeId:j})=>c.jsx(na,{isCommunity:!0,content:{id:E,type:Ae.Reply,body:$,canLike:n,createdAt:P,slugs:{question:`${t}/${r}`,answer:e,reply:B},slug:"",author:vr(F),userLiked:z,likes:k,peopleWhoLiked:L,data:T},functions:{content:{createContent:()=>null,deleteContent:()=>v({replyId:E}),updateContent:(O,{body:q})=>f({replyId:E,content:q})},likes:{createLike:()=>b({replyId:E}),deleteLike:()=>C({replyId:E,reactionId:j}),listLikes:O=>o.list({replyId:E,...O})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:r||""},{scope:ct.Platform,area:"all"}]},basePath:t,parentId:r},E)):null})]})};function nv({formFns:e,activityId:t,basePath:n,focus:r,isMember:a,parentId:i,reply:s}){const{body:o,data:l,likeId:u,liked:d,likes:m,peopleWhoLiked:h,replyId:p,createdAt:g,user:f}=s,{edit:b,like:v,remove:C,unlike:D}=e.mutations;return c.jsx(th,{children:c.jsx(na,{isCommunity:!0,content:{id:p,type:Ae.Reply,body:o,canLike:a,createdAt:g,slugs:{question:`${n}/${i}`,answer:t,reply:p},slug:p,author:vr(f),userLiked:d,likes:m,peopleWhoLiked:h,data:l},functions:{content:{createContent:()=>null,deleteContent:()=>C({replyId:p}),updateContent:(A,{body:E})=>b({replyId:p,content:E})},likes:{createLike:()=>v({replyId:p}),deleteLike:()=>D({replyId:p,reactionId:u}),listLikes:A=>e.likes.list({replyId:p,...A})},comments:{},form:e.form},badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:i||""},{scope:ct.Platform,area:"all"}]},children:c.jsx(tv,{basePath:n,parentId:i,activityId:t,replyId:p,isMember:a,functions:e}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:i},p)},p)}const af=({activityId:e,basePath:t,parentId:n,activityTotalReplies:r,isMember:a,functions:{form:i,join:s,leave:o,likes:l,reactions:u},profile:d,showReplies:m})=>{const{fetchNextPage:h,hasNextPage:p,isLoading:g,replies:f,mutations:{create:b,remove:v,edit:C,like:D,unlike:A}}=rf({queryKey:[t,n,e,"replies"],queryFns:u}),[E,k]=y.useState(null);io([g]),tf();const T={create:($,P)=>{const{body:z}=P;b({activityId:e,content:z})},...i};return c.jsxs("section",{className:"replies-feed",children:[c.jsx(rh,{type:"comment",responses:r,isLoading:g}),m?c.jsxs(c.Fragment,{children:[c.jsx(Wg,{parentId:n,isMember:a,join:s,leave:o,formFunctions:T}),f==null?void 0:f.map(($,P)=>c.jsx(nv,{activityId:e,basePath:t,focus:E===P,formFns:{form:i,likes:l,reactions:u,mutations:{remove:v,edit:C,like:D,unlike:A}},isMember:a,parentId:n,reply:$},$.replyId)),g?c.jsx(c.Fragment,{children:" "}):c.jsx(Vg,{hasNextPage:p,fetchNextPage:h,setFocusReplyIndex:k,totalReplies:f.length})]}):c.jsx(_t,{children:c.jsx(ae.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),c.jsx(iu,{form:d})]})};function rv({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:d=>(d==null?void 0:d.next)||null}),l=Co(n),u=`${l.length||0}${i?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s,refetch:o}}function av({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=rv({queryKey:t,queryFn:e});return{likes:n,...r}}function sf({basePath:e,parentId:t,activityId:n,likeCount:r,functions:a}){const{likes:i,fetchNextPage:s,hasNextPage:o,refetch:l}=av({queryKey:[e,t,n,"likes"],queryFns:a.likes});y.useEffect(()=>{l()},[l]);const u=i.map(({user:d})=>d).map(d=>d?vr(d):void 0).filter(d=>d&&typeof d!="string");return c.jsx("section",{className:"likes-feed",children:c.jsx(eh,{members:{data:u,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&u.length<r,loadNextPage:s})})}const of=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:a,...i})=>{const s=ae.useIntl();return c.jsx(ln,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:V("profile-modal in-portal",a,{open:e}),maxWidth:600,children:c.jsx(sf,{...i,likeCount:r??0,functions:{likes:n}})})},iv=Object.freeze(Object.defineProperty({__proto__:null,default:of},Symbol.toStringTag,{value:"Module"})),sv={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 ov=3e3,uf=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ae.useIntl(),r="discussion_share_copy_link",[a,i]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(qr,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>i({...a,isOpen:!0}),onFocus:()=>i({...a,isOpen:!0}),onMouseOut:()=>i({isOpen:!1,isCopied:!1}),onBlur:()=>i({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{i({isOpen:!0,isCopied:!0});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{i({isOpen:!1,isCopied:!1})},ov)})},"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:V({copied:a.isCopied}),isOpen:a.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${a.isCopied?"_success":""}`})})]})};const Vn="discussion_",lf=({className:e,gtmContext:t,contentType:n,likes:r,comments:a,replies:i,shareLink:s,moreMenu:o})=>{const l=ae.useIntl(),u=[];return o&&o.reportData&&u.push({text:l.formatMessage({id:`${Vn}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(l.formatMessage({id:`${Vn}report_subject`}))}&body=${encodeURI(l.formatMessage({id:`${Vn}report_body`},{contentType:n||"",contentSlug:o&&o.reportData&&o.contentSlug||"",contentUrl:o&&o.reportData&&o.reportData.contentUrl||""}))}`,icon:"flag"}),c.jsxs("ul",{className:V("actions text-medium",e),"data-testid":`${n}-actions`,children:[r?c.jsx(nf,{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,{}),a?c.jsx("li",{children:c.jsx(qr,{onClick:d=>{d.preventDefault(),d.stopPropagation(),a.functions.onClick()},icon:{icon:"speech-bubble_square"},"data-testid":"comment","data-gtm-event-context":t,"data-gtm-event-type":`answer-${n}-click`,screenreaderText:l.formatMessage({id:`${Vn}comments_screenReader`},{count:a.count}),children:l.formatMessage({id:`${Vn}comments${a.count===null?"_loading":""}`},{count:a.count})})}):c.jsx(c.Fragment,{}),i?c.jsx("li",{children:c.jsx(qr,{styling:{muted:!0},onClick:i.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",children:l.formatMessage({id:`${Vn}reply`})})}):c.jsx(c.Fragment,{}),s?c.jsx(uf,{url:s.url,gtm:{context:t||"",event:`copy-link-${n}-click`}}):c.jsx(c.Fragment,{}),o?c.jsx(df,{element:"li",id:`more-${o.contentSlug}`,options:[...o.options||[],...u]}):c.jsx(c.Fragment,{})]})};const uv=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ae.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Pe,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:V("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),c.jsxs("li",{children:[s&&c.jsx(Pe,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(xn,{href:s?void 0:i,...l,children:sr(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const _o=({variant:e="default",data:{image:t,url:n,title:r,description:a},onClick:i,gtm:s,...o})=>{const l=n.split("//")[1].split("/")[0],{context:u="EnrichedLink",event:d="enriched-link-click"}=s??{};return c.jsxs("aside",{className:V("enriched-url gtm-trackable",{"has-image":t,[e]:e!=="default"}),onClick:m=>{if(m.preventDefault(),m.stopPropagation(),i){i(m);return}window.open(n,"_blank")},"data-gtm-event-context":u,"data-gtm-event-type":d,children:[c.jsx("small",{children:l}),c.jsx("p",{className:"title text-medium",children:c.jsx("a",{...o,href:n,target:"_blank",rel:"noreferrer",children:r})}),a&&e!=="condensed"?c.jsx("p",{className:"text-small",children:a}):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 cf=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:a=()=>{},preventNoOptionSelected:i=!1,className:s=""})=>{const o=ae.useIntl(),l=n?[{id:"all",text:typeof n!="boolean"&&n.text||o.formatMessage({id:"filters_all"})},...e]:e,[u,d]=y.useState(n?["all"]:t.length?t.map(g=>g.id):[]),[m,h]=y.useState(0),p=(g,f)=>{let b=[];u.includes(g)&&!i?b=u.filter(v=>v!==g):g==="all"?b=["all"]:r?b=[...u.filter(v=>v!=="all"),g]:b=[g],d(v=>(a&&typeof a=="function"&&a({current:b,previous:v}),b)),f&&typeof f=="function"&&f()};return c.jsx("ul",{className:V("filters",s),children:l.map(({id:g,text:f,disabled:b=!1,callback:v=()=>{}},C)=>{let D={tabIndex:m===C?0:-1};return b&&(D={disabled:!0,"aria-label":o.formatMessage({id:"filters_disabled"},{name:f})}),c.jsx("li",{children:c.jsx("button",{className:V(g,{selected:u.includes(g)}),onClick:A=>{A.preventDefault(),A.stopPropagation(),p(g,v)},onKeyDown:A=>{var $,P;let E=C+1,k,T;switch(A.code){case"Enter":case"Space":A.preventDefault(),A.stopPropagation(),p(g,v);break;case"ArrowLeft":case"ArrowRight":A.preventDefault(),A.stopPropagation(),A.code==="ArrowLeft"?(E=C-1,E<0&&(E=l.length-1)):E>=l.length&&(E=0),h(E),k=A.currentTarget.closest("li"),T=($=k==null?void 0:k.parentElement)==null?void 0:$.children[E],(P=T==null?void 0:T.querySelector("button"))==null||P.focus();break}},"aria-selected":u.includes(g),...D,children:f})},g)})})},lv=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let a="",i=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(a+=`/${s}`,i=!0):(a.includes(`/${r}/`)||(a+=`/${r}`),a+=`/${s}`)}),a.includes(`/${r}/`)||(a+=`/${r}`),t&&(a+=`/${t}`),i?{url:a,urlForRouter:`/${a.split("/").slice(2).join("/")}`}:a};const la="languageSwitcher_",cv=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ae.useIntl(),{updateLanguage:d=()=>{}}=y.useContext(co),[m,h]=y.useState(e);if(y.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:V("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${la}label`})}),c.jsx("ul",{children:g.map(b=>{var D;if(!Ba[b])return null;const v=(D=r[b])==null?void 0:D.post_name;let C={className:b};if(m===b)C["aria-label"]=u.formatMessage({id:`${la}selected`},{language:Ba[b]});else{const A=lv(b,v,i);C={...C,href:typeof A=="string"?A:A.url,onClick:E=>{h(b),d(b),typeof a<"u"&&(E.preventDefault(),E.stopPropagation(),a(b,typeof A=="string"?A:A.urlForRouter))}}}return c.jsx("li",{children:c.jsx(xn,{...C,fallbackElement:"span",children:Ba[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${la}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${la}disclaimer`},{email:Qn.support,link:b=>{const v=`mailto:${b}`;return c.jsx("a",{href:v,children:b})}})})]})};const Ri=ae.createIntl({locale:"en",messages:hr}),Xr=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:a="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:Ri.formatMessage({id:"loadMore_button"}),endOfFeed:Ri.formatMessage({id:"loadMore_endOfFeed"}),error:Ri.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,m]=y.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:V("load-more",l),children:!d&&e?c.jsx(Ee,{variant:r,size:a,styling:i,icon:s,onClick:h,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const ko=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:V("logo",e,t,n),...r,children:c.jsx(Pe,{children:c.jsx(ae.FormattedMessage,{id:"apolitical"})})})});let ca=!1;const df=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ae.useIntl(),i=y.useRef(null),[s,o]=y.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:i,className:V("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"tertiary",size:"medium","data-testid":"more-menu",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:d,text:m,icon:h,...p},g)=>{const f={...p,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{ca&&(clearTimeout(ca),ca=!1)},onBlur:()=>{ca=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(Ee,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...f,children:m})},`${window.btoa(m)}_${g}`)})})]})})},dv=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const fv=y.lazy(()=>Promise.resolve().then(()=>pp)),mv=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],ff=({activeLink:e,profile:t})=>{const n=ae.useIntl(),r=y.useContext(it),a=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[mv.map(({key:i,href:s})=>{const o=dv(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:V(i,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${i}`})})},i)}),a&&t&&c.jsx(fv,{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"})]})},Er=(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(`${Er(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(`${Er(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(`${Er(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
65
65
 
66
- ${Er(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Er(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const hv="shareLinks_",pv=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ae.useIntl(),l=mv({title:e,link:t,referrer:n});return c.jsxs("aside",{className:V("share-links",a,i,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:l.map(({key:u,icon:d,url:m,shouldRender: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(Ee,{size:a,variant:"tertiary",icon:{icon:d||u},href:m,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${hv}link_${u}`}),...g})},u)})})]})};const gv=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(f,b,v)=>(f||(f=`panel-${window.btoa(b)}-${v}`),f),a=$n(!0)||0;let i=e.findIndex(f=>f.current===!0);if(i<0&&(i=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(v=>v.id===f)){for(let v=0;v<e.length;v++)if(r(e[v].id,e[v].text,v)===f){i=v;break}}}const[s,o]=y.useState((g=e[i])!=null&&g.id?e[i].id:r(e[i].id,e[i].text,i)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let v=b;f.key==="ArrowLeft"?b>0?v=b-1:v=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?v=b+1:v=0);const C=r(e[v].id,e[v].text,v),D=document.getElementById(`tab-${C}`);D==null||D.focus(),u(C);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},m=f=>{let b=!1;return f.target==="min-width"&&a>=f.value&&(b=!0),f.target==="max-width"&&a<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const h=[],p=[];return e.forEach(({id:f,text:b,content:v,href:C,hasCarousel:D,breakpoint:A},E)=>{if(A&&!m(A))return;f=r(f,b,E);const k=s===f,T={};C||(T["aria-controls"]=f,T.onClick=$=>{$.preventDefault(),$.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},p.push(c.jsx("section",{id:f,hidden:!k,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":k?"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:C||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:V({selected:k}),role:"tab",tabIndex:k?0:-1,"aria-selected":k,onKeyDown:$=>d($,E),...T,children:b})},`tab-${f}`))}),c.jsxs("div",{className:V("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:h}),c.jsx("div",{className:"tab-content",children:p})]})};const vv={"2-1":901,"1-3":769,"1-1":769},ff=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=$n(!0);let s=a;return y.Children.count(a)===1&&(s=y.Children.toArray(a)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:V("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<vv[e]?null:o)})};const Fo=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=ae.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:V("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":d?"":a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:a.formatMessage({id:i})}),n," / ",t]})}),c.jsx(Pe,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},mi=e=>(e==null?void 0:e.toString().length)||0,mf=(e,t)=>{const n={};return e===0||(n["data-character-limit"]=e,n.functions={...t,onChange:r=>{mi(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t.onChange(r)}}),n};const da="emailHelperTextBox_",hf=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=ae.useIntl(),[s,o]=y.useState({path:`${da}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=b=>{o({path:`${da}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>d(v),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof a!="function"){f(i.formatMessage({id:`${da}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let g=da,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:C=>d(C),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",b={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:g,type:f,link:b,mail:v})},[t]);const m={};return["link","mail"].forEach(g=>{m[g]=Object.keys(s[g]).length?f=>c.jsx("a",{...s[g],children:f}):f=>f}),c.jsx(yd,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),"aria-live":"assertive",children:l?c.jsxs(c.Fragment,{children:[c.jsx(Nt,{element:"span"}),c.jsx(Nt,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...m,strong:g=>c.jsx("strong",{children:g}),em:g=>c.jsx("em",{children:g}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Jn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,autoFocus:u,label:d,styling:m={},...h})=>{const p=y.useRef(),g=r||p,{autosizeToFit:f=!1}=m;return ed(f&&t==="textarea",g),y.useEffect(()=>{var b;u&&((b=g.current)==null||b.focus())},[]),!(h!=null&&h.autoComplete)&&["email"].includes(o)&&(h.autoComplete="email"),y.createElement(t,{ref:g,...h,id:n,name:i,className:V(e,t,{autoresize:f}),value:l,placeholder:s,autoFocus:u,...a,onChange:b=>{const v=b.target;a.onChange(v.value)}})};const Hn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},bv=500,yv=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:d},m]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:h,activePredictionIndex:p,isPredictionSelected:g},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=ae.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const A=setTimeout(()=>{g||m(E=>({...E,debouncedInput:l}))},bv);return()=>{clearTimeout(A)}},[l,g]),y.useEffect(()=>{d&&!g?(async()=>{try{const E=await o(d)||[];f(k=>({...k,predictions:E}))}catch(E){console.error("Error fetching predictions:",E),f(k=>({...k,predictions:[]}))}})():f(A=>({...A,predictions:[]}))},[d,g]),y.useEffect(()=>{p>=0&&h[p]&&m(A=>({...A,displayInput:h[p].description}))},[p,h]);const v=A=>{[Hn.DOWN,Hn.UP,Hn.ENTER].includes(A.key)&&(A.preventDefault(),A.key===Hn.DOWN&&p<h.length-1?f(E=>({...E,activePredictionIndex:p+1})):A.key===Hn.UP&&p>0?f(E=>({...E,activePredictionIndex:p-1})):A.key===Hn.ENTER&&p>-1&&(s(h[p].description),m(E=>({...E,input:h[p].description})),f(E=>({...E,predictions:[],isPredictionSelected:!0}))))},C=A=>{s(A.target.value),m(E=>({...E,input:A.target.value,displayInput:A.target.value})),f(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},D=A=>{s(A.description),m(E=>({...E,input:A.description,displayInput:A.description})),f(E=>({...E,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:C,onKeyDown:v,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:h.map((A,E)=>c.jsx("li",{onClick:()=>D(A),onMouseEnter:()=>f(k=>({...k,activePredictionIndex:E})),className:V("predictions-list-item",{active:E===p}),children:A.description},E))})]})};const pf=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:d,accessibilityOptions:{checkboxes:{navigateWithArrowKeys:m=!1}={}}={},...h})=>{const p=ae.useIntl(),{onChange:g,...f}=r,b=()=>{t||g(d?null:l)},v=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:d,readOnly:!0,disabled:t,tabIndex:-1}),c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:a,onKeyDown:C=>{(C.key==="Enter"||C.code==="Space")&&(C.preventDefault(),C.stopPropagation(),b())},tabIndex:d||!m?0:-1,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return y.createElement(n,{onClick:C=>{const D=C.target;D.nodeName.toLowerCase()==="a"||D.parentNode&&D.parentNode.nodeName.toLowerCase()==="a"||(C.preventDefault(),C.stopPropagation(),b())},onKeyDown:m?C=>{var D,A,E;if(C.key!=="Tab")switch(C.code){case"Enter":case"Space":C.stopPropagation(),C.preventDefault(),b();break;case"ArrowLeft":case"ArrowRight":C.stopPropagation(),C.preventDefault();const k=C.currentTarget;let T=k==null?void 0:k.nextElementSibling;if(C.key==="ArrowLeft"){const $=k==null?void 0:k.previousElementSibling;$?T=$:T=(D=k==null?void 0:k.parentElement)==null?void 0:D.lastElementChild}else T||(T=(A=k==null?void 0:k.parentElement)==null?void 0:A.firstElementChild);T&&((E=T==null?void 0:T.querySelector("label"))==null||E.focus());break}}:void 0,className:V(a,"checkbox-wrapper",e,{"is-checked":d}),...h,...f},v)};const xv=y.memo(function({direction:t="down"}){return c.jsx(oi,{className:V("rotating-chevron",`direction-${t}`)})});const Cv=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const d=ae.useIntl(),[m,h]=y.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[f,b]=y.useState(g);let v;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?v=t&&f?t.find(T=>T.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?v=f[0]:v={id:"",label:""},y.useEffect(()=>{b(g)},[r,n]);const{onChange:C,onMultiSelectSubmit:D,...A}=a,E=T=>{if(o){let $=[];f!=null&&f.includes(T.id)?$=f.filter(P=>P!==T.id):$=[...f,T.id],b([...$]),C&&C([...$])}else b([T]),C&&C(T.id),h(!1)},k=T=>{if(T==="all"){const $=(t==null?void 0:t.map(P=>P.id))||[];b($),C&&C($)}else b([]),C&&C([])};return c.jsxs("div",{className:V("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":m,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:T=>{T.preventDefault(),T.stopPropagation(),h(!m)},"data-testid":"dropdown-selector",...A,children:[o?`${s} · ${f.length}`:v.label,c.jsx(xv,{direction:m?"up":"down"})]}),c.jsx("select",{defaultValue:v.id,onChange:T=>{T.preventDefault(),T.stopPropagation();const $=t&&t.find(P=>P.id===T.target.value);E($)},hidden:!m,...A,children:t==null?void 0:t.map(T=>c.jsx("option",{value:T.id,className:"gtm-trackable","data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":i,children:T.label},T.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!m,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${f==null?void 0:f.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>k("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>k("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(T=>{const $=T.id===v.id||(f==null?void 0:f.includes(T))||(f==null?void 0:f.includes(T.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:V("gtm-trackable",{selected:$,"selected-single":$&&!o}),"data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":i,onClick:P=>{P.preventDefault(),P.stopPropagation(),E(T)},role:"menuitem","aria-current":$,"data-testid":$?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:V({"menu-option-label":o}),children:T.label})]})},T.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(Ee,{variant:"secondary",onClick:()=>{D&&D(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),h(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})},Tr=(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 $i=null;const wv=({id:e,label:t,limit:n,value:r,placeholder:a,functions:i,error:s,multipleInputs:o,validation:l,fieldData:u,type:d,...m})=>{const h=ae.useIntl(),{showCount:p=!1,label:g,defaultInputs:f=1,maxInputs:b=100,hasButton:v=!1}=o||{},[C,D]=y.useState(r?Array.isArray(r)?r:[r]:Array(f).fill("")),A=C.filter(P=>P!==""),E=()=>{if(!u)return;const P=Ot(u.fields).filter(({id:B,name:F})=>(B||(B=F||""),B!==e&&!B.includes(`${e}-`))),z=[];C.map((B,F)=>{if(b&&F>=b)return;const j=Ot(l);j&&e&&(j.forEach(O=>{const{condition:q,error:W}=O;if(typeof q=="function")O.condition=ne=>{var Q;let J=(Q=ne==null?void 0:ne[e])==null?void 0:Q[F];J||(ne[e]&&!Array.isArray(ne[e])?J=ne[e]:J="");const w=Ot(ne);return w[e]=J,typeof q=="function"&&q(w)?W:!1};else{const ne=q;O.condition=J=>{var Q;let w=(Q=J==null?void 0:J[e])==null?void 0:Q[F];switch(w||(J[e]&&!Array.isArray(J[e])?w=J[e]:w=""),ne){case"required":W||(O.error=h==null?void 0:h.formatMessage({id:"form_error_required"}));break;case"no-numbers":W||(O.error=h==null?void 0:h.formatMessage({id:"form_error_numbers"}));break;case"valid-email":W||(O.error=W||(h==null?void 0:h.formatMessage({id:"form_error_email"})));break;case"valid-url":W||(O.error=h==null?void 0:h.formatMessage({id:"form_error_url"}));break;default:console.warn("WARNING! No field validation condition has been set")}return Tr(ne,w)?O.error:!1}}}),z.push({id:`${e}-${F}`,validation:j,value:B}))});const L={fieldsToValidate:P.concat(z)};u.multipleInputs.includes(e)&&(L.multipleInputs=u.multipleInputs.filter(B=>B!==e)),u.setFields(B=>({...B,...L}))};y.useEffect(()=>{E()},[C.length]),y.useEffect(()=>{!u||!u.multipleInputs||u.multipleInputs.includes(e)&&E()},[u==null?void 0:u.multipleInputs]);const k=()=>{(!b||C.length<b)&&D([...C,""])},T=P=>{const z=document.getElementById(`${e}-${P+1}`);z==null||z.focus()},$=(P,z)=>P.replace("{number}",z+1);return c.jsxs("fieldset",{className:V("multiple-inputs field-wrapper",{"has-button":v,"has-legend":t}),children:[t?c.jsxs("legend",{className:"legend-as-label",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:A.length,total:b}),children:h.formatMessage({id:"form_multipleInputs_filledInCount"},{number:A.length,total:b})})]}):""]}):c.jsx(c.Fragment,{}),C.map((P,z)=>{if(b&&z>=b)return c.jsx(c.Fragment,{});let L=!1;t?L=c.jsx(Pe,{showOnFocus:!1,children:h.formatMessage({id:"form_multipleInputs_label"},{number:z+1})}):g&&(L=$(g,z));const B=`${e}-${z}`;return c.jsx(gf,{id:B,type:"text",label:L,value:P,placeholder:a?$(a,z):void 0,limit:n,error:s&&typeof s!="string"?s==null?void 0:s[B]:void 0,functions:{...i,onFocus:()=>{v||z!==C.length-1||k()},onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),F.stopPropagation(),$i&&clearTimeout($i),z!==C.length-1?T(z):(k(),$i=setTimeout(()=>T(z),100)))},onChange:F=>{const j=Ot(C);j[z]=F,D(j),u==null||u.dispatch({type:"removeError",payload:{key:B}}),i==null||i.onChange(j)}},siblings:z+1<=f?void 0:c.jsx(Ee,{variant:"tertiary",size:"small",icon:"close",screenreaderText:h.formatMessage({id:"form_multipleInputs_remove"}),onClick:()=>{const F=Ot(C);F.splice(z,1),D(F),u==null||u.dispatch({type:"removeError",payload:{key:B}}),i==null||i.onChange(F)}}),...m},B)}),v?c.jsx(Ee,{...v,onClick:k,disabled:!!(b&&b<=C.length)}):c.jsx(c.Fragment,{})]})};const Wu=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:d,accessibilityOptions:m,styling:{displayOptionsAsPills:h=!1}={},...p})=>{const g=ae.useIntl(),f=i?d:[],b=d;return c.jsx("ul",{...p,className:V("options-wrapper",e,{"with-pills filters":h}),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:v,label:C=!1,value:D=v,disabled:A=!1})=>{const E=`${r}_${v}`,k=()=>{if(A)return;let T;if(i){const $=f==null?void 0:f.indexOf(D);Array.isArray(f)&&$>=0?(T=f,T.splice($,1)):(!f||f.length===0?T=[]:T=f,T.push(D))}else T=b===D?void 0:D;t.onChange(T)};return c.jsx(pf,{element:"li",id:E,type:u==="checkboxes"?"checkbox":"radio",shownValue:D,value:i?f==null?void 0:f.includes(D):b===D,functions:{...t,onChange:k},intlPath:n,label:C||g.formatMessage({id:n?`${n}_${v}`:v}),disabled:A,accessibilityOptions:m},E)})})};const Dv=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=ae.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,m]=y.useState(t),h=()=>{var p;u(!l),m(l?"password":"text"),(p=o.current)==null||p.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:V("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:h,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Jn,{inputRef:o,type:d,autoComplete:r,...a})]})};const Kn={text:{component:Jn},email:{component:Jn},url:{component:Jn},textarea:{component:Jn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:pf},checkboxes:{component:Wu,props:{multiSelect:!0}},radio:{component:Wu,props:{multiSelect:!1}},select:{component:Cv},password:{component:Dv},autocomplete:{component:yv},"multiple-inputs":{component:c.jsx(c.Fragment,{})}},gf=e=>{const t=ae.useIntl(),{id:n,intlPath:r=!1,className:a="",error:i,functions:s={onChange:()=>{}},limit:o=0,showRequiredLabels:l=!0,type:u,validation:d,value:m,submitOnEnter:h,fieldData:p,siblings:g,...f}=e;if(u&&u==="multiple-inputs")return c.jsx(wv,{...e});const b=d&&d.some(({condition:j})=>j==="required"),v=mi(m),C=u&&Kn[u]&&Kn[u].component?Kn[u].component:Jn,D=u&&["checkboxes","radio"].includes(u),A=u&&["autocomplete"].includes(u),E=i&&`error-${n}`,k=`character-limit-${n}`,T={};D?T.element="legend":T.htmlFor=n;let $={...f,id:n,name:n,className:i?"error":"",type:u,required:b,"aria-required":b,functions:Ot(s),value:m};const P=j=>{$["aria-describedby"]?$["aria-describedby"]+=` ${j}`:$["aria-describedby"]=j};if(o>0){const j=mf(o,s);P(`${k}-info`),$={...$,...j},j.functions&&typeof j.functions=="object"&&($.functions={...$.functions,...j.functions})}u&&Kn[u]&&Kn[u].props&&($={...$,...Kn[u].props}),D&&($.intlPath=`${r}_${n}`),i&&($["aria-invalid"]=!0,$["aria-errormessage"]=E,P(E));const z=f.label||t.formatMessage({id:r?`${r}_${n}`:n}),L=({...j})=>i?y.createElement(j.as||"p",{id:E,className:"error text-small",...j},i):null;if(u&&["checkbox"].includes(u))return c.jsxs(c.Fragment,{children:[c.jsx(C,{...$,label:z,className:V("field-wrapper",a)}),c.jsx(L,{as:"p"})]});const B={};D?T.className="legend-as-label text-small":B.className="field-label";const F=({element:j,...O})=>y.createElement(j||"label",{...O,"data-testid":`label-${n}`});return c.jsx(c.Fragment,{children:y.createElement(D?"fieldset":"div",{className:V("field-wrapper text-medium",a,`${u}-wrapper`,{"multiple-options-wrapper":D})},c.jsxs(c.Fragment,{children:[f.label===!1?c.jsx(c.Fragment,{}):y.createElement(D?y.Fragment:"p",B,c.jsxs(F,{...T,children:[z,b&&l&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",t.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(D||A?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(C,{...$}),c.jsx(Fo,{id:k,limit:o,valueLength:v}),g]})),c.jsx(L,{})]}))})},Ev=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?Ot(e.errors):{},i=e.values?Ot(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:d}=r,m=Ot(Object.keys(a));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(i);v&&(b=f||v)}else{const v=i[h.id],C=g;switch(C){case"required":Tr(C,v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{Tr(C,v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{Tr(C,v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{Tr(C,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?l(i):u(i,m),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Li=null;const Jt=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:m,...h})=>{const p=(t||[]).filter(R=>R.type==="multiple-inputs").map(R=>R.id),[g,f]=y.useState({fieldsToValidate:t,multipleInputs:p});y.useEffect(()=>{g.multipleInputs.length||f(R=>({...R,fieldsToValidate:t,multipleInputs:p}))},[t.length]);const{customOnSubmit:b,hideButton:v,...C}=s,D=40,{shouldShowCancelButton:A=!1,shouldReset:E=!0,shouldHide:k=!0,showRequiredLabels:T=!0,showSuccessMessage:$=!1}=l||{},{onSuccess:P=async()=>{},onCancel:z=()=>{},onCatch:L=()=>{},onFailure:B=()=>{}}=m||{},F=ae.useIntl(),j={};t.length&&t.forEach(R=>{const K=R.id||R.name;K&&(j[K]=R.value||"")});const[O,q]=y.useReducer(Ev,{isSubmitting:!1,formSubmitted:!1,errors:{},values:j}),{errors:W,isSubmitting:ne,formSubmitted:J,values:w}=O;y.useEffect(()=>{E&&J&&(Li=setTimeout(()=>{q({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[J]),y.useEffect(()=>()=>{Li&&clearTimeout(Li)},[]),y.useEffect(()=>{const R=K=>{q({type:"updateValue",payload:{key:K.detail.id,value:K.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",R),()=>{document.removeEventListener("dropdownMultiSelectSubmit",R)}},[]);const Q=y.useRef(null),se=a||Q;if(!t.length)return null;const _={};s.children&&(_.default=s.children),C.text&&typeof C.text=="string"&&(_.default=C.text),["default","submitting","submitted"].forEach(R=>{C.text&&typeof C.text!="string"&&R in C.text?_[R]=C.text[R]:_[R]||(_[R]=F.formatMessage({id:`form_${R==="default"?"submit":R}`}))}),delete C.text;const M=()=>{if(!ne){if(q({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&q({type:"submitForm",payload:{fields:g.fieldsToValidate,dispatch:q,intl:F}});return}q({type:"submitForm",payload:{fields:g.fieldsToValidate,dispatch:q,onSuccess:async R=>{try{await P(R),q({type:E?"formSubmittedAndReset":"formSubmitted"})}catch(K){L(K),q({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(R,K)=>{B(R,K),q({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:F}})}},U=R=>{var re;if(R.preventDefault(),R.stopPropagation(),ne)return;let K=0;if((re=se==null?void 0:se.current)!=null&&re.id){const ce=document.getElementById(se.current.id);ce&&(K=ce.getBoundingClientRect().top+window.scrollY)}const Z=document.getElementById("header");Z&&(K=K-Z.offsetHeight-D),K<0&&(K=0),window.scrollTo({top:K,behavior:"smooth"}),M()},S=[{...C,icon:J?{icon:"tick",position:"left"}:!1,className:V("gtm-trackable",C.className),onClick:U,disabled:ne||J||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:_[ne?"submitting":J?"submitted":"default"]}];return A&&S.unshift({...o,className:V("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:ne||J,onClick:z,children:o.text||F.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...h,id:r,className:V("form",n),ref:se},c.jsxs(c.Fragment,{children:[W!=null&&W.general?c.jsx(Cn,{variant:"error",text:F.formatMessage({id:"form_error_generalError"})}):null,u,(!k||!ne&&!J||b)&&t.map((R,K)=>{const{id:Z=R.name||K,component:re,functions:ce={onChange:()=>{}},submitOnEnter:X=!1}=R;if(re)return c.jsx(re,{...R.props||{}},`component-${Z}-${K}`);const pe=(w==null?void 0:w[Z])||"",ve={...ce,onChange:ye=>{q({type:"updateValue",payload:{key:Z,value:ye}}),ce.onChange(ye,q)}};return X&&(ve.onKeyDown=ye=>{ye.key==="Enter"&&(ye.stopPropagation(),ye.preventDefault(),M()),ce.onKeyDown&&ce.onKeyDown(ye)}),c.jsx(gf,{intlPath:i,...R,showRequiredLabels:T,value:pe,error:R.type==="multiple-inputs"?W:W==null?void 0:W[Z],functions:ve,fieldData:{fields:g.fieldsToValidate,multipleInputs:g.multipleInputs,setFields:f,dispatch:q}},Z)}),v?null:(ne||J)&&b?b:c.jsx(pr,{className:V("cta",{center:ne||J,submitted:J}),buttons:S})]})),$&&J&&c.jsx(ur,{className:"success",children:typeof $=="string"?$:F.formatMessage({id:"form_success"})})]})};const fa="passwordRules_",vf="isMoreThanEightCharacters",bf="includesNumberAndSymbol",yf="includesLowerAndUppercase",_v={[vf]:"8Characters",[bf]:"numberSymbol",[yf]:"lowercaseUppercase"},kv=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ae.useIntl();return c.jsxs("aside",{className:V("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${fa}intro`})}),c.jsx("ul",{children:[vf,bf,yf].map(r=>c.jsxs("li",{className:V({matches:e[r]}),children:[c.jsxs(Pe,{children:[n.formatMessage({id:`${fa}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${fa}rule_${_v[r]}`})}),!e[r]&&c.jsxs(Pe,{element:"strong",children:[" ",n.formatMessage({id:`${fa}notMet`})]})]},`rule-${r}`))})]})},xf=y.memo(kv);const Fv=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ae.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const v=await n();u(C=>({...C,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(C=>({...C,setUp:!0,disabled:!0})),a(v)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Nt,{className:"rating-placeholder"});const{id:m,rating:h,disabled:p}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},b=async v=>{if(!(!m||p))try{u(C=>({...C,rating:v,disabled:!0})),await r({id:m,value:v})}catch(C){u(D=>({...D,rating:null})),a(C)}finally{u(C=>({...C,disabled:!1}))}};return c.jsxs("div",{className:V("rating",i),children:[c.jsx("span",{className:"label",children:f[h?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const C=v+1;return c.jsx("li",{className:V({selected:h&&C<=h}),children:c.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:`star${!h||C>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:C,total:t})}${C===1||C===t?` - ${f[C===1?"low":"high"]}`:""}`,onClick:D=>{D.preventDefault(),D.stopPropagation(),b(C)},disabled:p})},`rating-${C}`)})})]})},Av={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,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=y.createContext(Av);var H=(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))(H||{}),Kt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Kt||{});const Bv=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case H.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case H.link:return c.jsx("a",{...e,children:t});case H.li:return c.jsx("li",{...e,children:t});case H.mention:const a=r;return a!=null&&a.name&&a.name===Lr?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(ae.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case H.ol:return c.jsx("ol",{...e,children:t});case H.ul:return c.jsx("ul",{...e,children:t});case H.span:return c.jsx("span",{...e,children:t});case H.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},Tv=({attributes:e,children:t,leaf:n})=>{const r=n;return r[H.bold]&&(t=c.jsx("strong",{children:t})),r[H.italic]&&(t=c.jsx("em",{children:t})),r[H.strikethrough]&&(t=c.jsx("s",{children:t})),r[H.h3]&&(t=c.jsx("h3",{children:t})),c.jsx("span",{...e,children:t})};var Sv=Pv,Cf="֑-߿יִ-﷽ﹰ-ﻼ",wf="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",jv=new RegExp("^[^"+wf+"]*["+Cf+"]"),Ov=new RegExp("^[^"+Cf+"]*["+wf+"]");function Pv(e){return e=String(e||""),jv.test(e)?"rtl":Ov.test(e)?"ltr":"neutral"}const Df=Rn(Sv);function Mv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ao=Mv,Nv=typeof ra=="object"&&ra&&ra.Object===Object&&ra,Iv=Nv,Rv=Iv,$v=typeof self=="object"&&self&&self.Object===Object&&self,Lv=Rv||$v||Function("return this")(),Ef=Lv,zv=Ef,qv=function(){return zv.Date.now()},Uv=qv,Wv=/\s/;function Vv(e){for(var t=e.length;t--&&Wv.test(e.charAt(t)););return t}var Hv=Vv,Kv=Hv,Zv=/^\s+/;function Yv(e){return e&&e.slice(0,Kv(e)+1).replace(Zv,"")}var Gv=Yv,Qv=Ef,Jv=Qv.Symbol,_f=Jv,Vu=_f,kf=Object.prototype,Xv=kf.hasOwnProperty,eb=kf.toString,_r=Vu?Vu.toStringTag:void 0;function tb(e){var t=Xv.call(e,_r),n=e[_r];try{e[_r]=void 0;var r=!0}catch{}var a=eb.call(e);return r&&(t?e[_r]=n:delete e[_r]),a}var nb=tb,rb=Object.prototype,ab=rb.toString;function ib(e){return ab.call(e)}var sb=ib,Hu=_f,ob=nb,ub=sb,lb="[object Null]",cb="[object Undefined]",Ku=Hu?Hu.toStringTag:void 0;function db(e){return e==null?e===void 0?cb:lb:Ku&&Ku in Object(e)?ob(e):ub(e)}var fb=db;function mb(e){return e!=null&&typeof e=="object"}var hb=mb,pb=fb,gb=hb,vb="[object Symbol]";function bb(e){return typeof e=="symbol"||gb(e)&&pb(e)==vb}var yb=bb,xb=Gv,Zu=Ao,Cb=yb,Yu=0/0,wb=/^[-+]0x[0-9a-f]+$/i,Db=/^0b[01]+$/i,Eb=/^0o[0-7]+$/i,_b=parseInt;function kb(e){if(typeof e=="number")return e;if(Cb(e))return Yu;if(Zu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Zu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=xb(e);var n=Db.test(e);return n||Eb.test(e)?_b(e.slice(2),n?2:8):wb.test(e)?Yu:+e}var Fb=kb,Ab=Ao,zi=Uv,Gu=Fb,Bb="Expected a function",Tb=Math.max,Sb=Math.min;function jb(e,t,n){var r,a,i,s,o,l,u=0,d=!1,m=!1,h=!0;if(typeof e!="function")throw new TypeError(Bb);t=Gu(t)||0,Ab(n)&&(d=!!n.leading,m="maxWait"in n,i=m?Tb(Gu(n.maxWait)||0,t):i,h="trailing"in n?!!n.trailing:h);function p(k){var T=r,$=a;return r=a=void 0,u=k,s=e.apply($,T),s}function g(k){return u=k,o=setTimeout(v,t),d?p(k):s}function f(k){var T=k-l,$=k-u,P=t-T;return m?Sb(P,i-$):P}function b(k){var T=k-l,$=k-u;return l===void 0||T>=t||T<0||m&&$>=i}function v(){var k=zi();if(b(k))return C(k);o=setTimeout(v,f(k))}function C(k){return o=void 0,h&&r?p(k):(r=a=void 0,s)}function D(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function A(){return o===void 0?s:C(zi())}function E(){var k=zi(),T=b(k);if(r=arguments,a=this,l=k,T){if(o===void 0)return g(l);if(m)return clearTimeout(o),o=setTimeout(v,t),p(l)}return o===void 0&&(o=setTimeout(v,t)),s}return E.cancel=D,E.flush=A,E}var Ff=jb;const Ob=Rn(Ff);var Pb=Ff,Mb=Ao,Nb="Expected a function";function Ib(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(Nb);return Mb(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),Pb(e,t,{leading:r,maxWait:t,trailing:a})}var Rb=Ib;const $b=Rn(Rb),Qu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Ju=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",qi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Ju(n.overflowY,t)||Ju(n.overflowX,t)||(r=>{const a=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!a&&(a.clientHeight<r.scrollHeight||a.clientWidth<r.scrollWidth)})(e)}return!1},ma=(e,t,n,r,a,i,s,o)=>i<e&&s>t||i>e&&s<t?0:i<=e&&o<=n||s>=t&&o>=n?i-e-r:s>t&&o<n||i<e&&o>n?s-t+a:0,Lb=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Xu=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,m=typeof u=="function"?u:q=>q!==u;if(!Qu(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let g=e;for(;Qu(g)&&m(g);){if(g=Lb(g),g===h){p.push(g);break}g!=null&&g===document.body&&qi(g)&&!qi(document.documentElement)||g!=null&&qi(g,d)&&p.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:v,scrollY:C}=window,{height:D,width:A,top:E,right:k,bottom:T,left:$}=e.getBoundingClientRect(),{top:P,right:z,bottom:L,left:B}=(q=>{const W=window.getComputedStyle(q);return{top:parseFloat(W.scrollMarginTop)||0,right:parseFloat(W.scrollMarginRight)||0,bottom:parseFloat(W.scrollMarginBottom)||0,left:parseFloat(W.scrollMarginLeft)||0}})(e);let F=o==="start"||o==="nearest"?E-P:o==="end"?T+L:E+D/2-P+L,j=l==="center"?$+A/2-B+z:l==="end"?k+z:$-B;const O=[];for(let q=0;q<p.length;q++){const W=p[q],{height:ne,width:J,top:w,right:Q,bottom:se,left:_}=W.getBoundingClientRect();if(s==="if-needed"&&E>=0&&$>=0&&T<=b&&k<=f&&E>=w&&T<=se&&$>=_&&k<=Q)return O;const M=getComputedStyle(W),U=parseInt(M.borderLeftWidth,10),S=parseInt(M.borderTopWidth,10),R=parseInt(M.borderRightWidth,10),K=parseInt(M.borderBottomWidth,10);let Z=0,re=0;const ce="offsetWidth"in W?W.offsetWidth-W.clientWidth-U-R:0,X="offsetHeight"in W?W.offsetHeight-W.clientHeight-S-K:0,pe="offsetWidth"in W?W.offsetWidth===0?0:J/W.offsetWidth:0,ve="offsetHeight"in W?W.offsetHeight===0?0:ne/W.offsetHeight:0;if(h===W)Z=o==="start"?F:o==="end"?F-b:o==="nearest"?ma(C,C+b,b,S,K,C+F,C+F+D,D):F-b/2,re=l==="start"?j:l==="center"?j-f/2:l==="end"?j-f:ma(v,v+f,f,U,R,v+j,v+j+A,A),Z=Math.max(0,Z+C),re=Math.max(0,re+v);else{Z=o==="start"?F-w-S:o==="end"?F-se+K+X:o==="nearest"?ma(w,se,ne,S,K+X,F,F+D,D):F-(w+ne/2)+X/2,re=l==="start"?j-_-U:l==="center"?j-(_+J/2)+ce/2:l==="end"?j-Q+R+ce:ma(_,Q,J,U,R+ce,j,j+A,A);const{scrollLeft:ye,scrollTop:Me}=W;Z=ve===0?0:Math.max(0,Math.min(Me+Z/ve,W.scrollHeight-ne/ve+X)),re=pe===0?0:Math.max(0,Math.min(ye+re/pe,W.scrollWidth-J/pe+ce)),F+=Me-Z,j+=ye-re}O.push({el:W,top:Z,left:re})}return O},zb=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function qb(e,t){if(!e.isConnected||!(a=>{let i=a;for(;i&&i.parentNode;){if(i.parentNode===document)return!0;i=i.parentNode instanceof ShadowRoot?i.parentNode.host:i.parentNode}return!1})(e))return;const n=(a=>{const i=window.getComputedStyle(a);return{top:parseFloat(i.scrollMarginTop)||0,right:parseFloat(i.scrollMarginRight)||0,bottom:parseFloat(i.scrollMarginBottom)||0,left:parseFloat(i.scrollMarginLeft)||0}})(e);if((a=>typeof a=="object"&&typeof a.behavior=="function")(t))return t.behavior(Xu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Xu(e,zb(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}/*!
66
+ ${Er(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Er(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const pv="shareLinks_",gv=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ae.useIntl(),l=hv({title:e,link:t,referrer:n});return c.jsxs("aside",{className:V("share-links",a,i,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:l.map(({key:u,icon:d,url:m,shouldRender: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(Ee,{size:a,variant:"tertiary",icon:{icon:d||u},href:m,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${pv}link_${u}`}),...g})},u)})})]})};const vv=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(f,b,v)=>(f||(f=`panel-${window.btoa(b)}-${v}`),f),a=$n(!0)||0;let i=e.findIndex(f=>f.current===!0);if(i<0&&(i=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(v=>v.id===f)){for(let v=0;v<e.length;v++)if(r(e[v].id,e[v].text,v)===f){i=v;break}}}const[s,o]=y.useState((g=e[i])!=null&&g.id?e[i].id:r(e[i].id,e[i].text,i)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let v=b;f.key==="ArrowLeft"?b>0?v=b-1:v=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?v=b+1:v=0);const C=r(e[v].id,e[v].text,v),D=document.getElementById(`tab-${C}`);D==null||D.focus(),u(C);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},m=f=>{let b=!1;return f.target==="min-width"&&a>=f.value&&(b=!0),f.target==="max-width"&&a<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const h=[],p=[];return e.forEach(({id:f,text:b,content:v,href:C,hasCarousel:D,breakpoint:A},E)=>{if(A&&!m(A))return;f=r(f,b,E);const k=s===f,T={};C||(T["aria-controls"]=f,T.onClick=$=>{$.preventDefault(),$.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},p.push(c.jsx("section",{id:f,hidden:!k,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":k?"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:C||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:V({selected:k}),role:"tab",tabIndex:k?0:-1,"aria-selected":k,onKeyDown:$=>d($,E),...T,children:b})},`tab-${f}`))}),c.jsxs("div",{className:V("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:h}),c.jsx("div",{className:"tab-content",children:p})]})};const bv={"2-1":901,"1-3":769,"1-1":769},mf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=$n(!0);let s=a;return y.Children.count(a)===1&&(s=y.Children.toArray(a)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:V("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<bv[e]?null:o)})};const Fo=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=ae.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:V("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":d?"":a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:a.formatMessage({id:i})}),n," / ",t]})}),c.jsx(Pe,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},mi=e=>(e==null?void 0:e.toString().length)||0,hf=(e,t)=>{const n={};return e===0||(n["data-character-limit"]=e,n.functions={...t,onChange:r=>{mi(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t.onChange(r)}}),n};const da="emailHelperTextBox_",pf=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=ae.useIntl(),[s,o]=y.useState({path:`${da}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=b=>{o({path:`${da}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>d(v),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof a!="function"){f(i.formatMessage({id:`${da}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let g=da,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:C=>d(C),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",b={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:g,type:f,link:b,mail:v})},[t]);const m={};return["link","mail"].forEach(g=>{m[g]=Object.keys(s[g]).length?f=>c.jsx("a",{...s[g],children:f}):f=>f}),c.jsx(xd,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),"aria-live":"assertive",children:l?c.jsxs(c.Fragment,{children:[c.jsx(Nt,{element:"span"}),c.jsx(Nt,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...m,strong:g=>c.jsx("strong",{children:g}),em:g=>c.jsx("em",{children:g}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Jn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,autoFocus:u,label:d,styling:m={},...h})=>{const p=y.useRef(),g=r||p,{autosizeToFit:f=!1}=m;return td(f&&t==="textarea",g),y.useEffect(()=>{var b;u&&((b=g.current)==null||b.focus())},[]),!(h!=null&&h.autoComplete)&&["email"].includes(o)&&(h.autoComplete="email"),y.createElement(t,{ref:g,...h,id:n,name:i,className:V(e,t,{autoresize:f}),value:l,placeholder:s,autoFocus:u,...a,onChange:b=>{const v=b.target;a.onChange(v.value)}})};const Hn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},yv=500,xv=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:d},m]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:h,activePredictionIndex:p,isPredictionSelected:g},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=ae.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const A=setTimeout(()=>{g||m(E=>({...E,debouncedInput:l}))},yv);return()=>{clearTimeout(A)}},[l,g]),y.useEffect(()=>{d&&!g?(async()=>{try{const E=await o(d)||[];f(k=>({...k,predictions:E}))}catch(E){console.error("Error fetching predictions:",E),f(k=>({...k,predictions:[]}))}})():f(A=>({...A,predictions:[]}))},[d,g]),y.useEffect(()=>{p>=0&&h[p]&&m(A=>({...A,displayInput:h[p].description}))},[p,h]);const v=A=>{[Hn.DOWN,Hn.UP,Hn.ENTER].includes(A.key)&&(A.preventDefault(),A.key===Hn.DOWN&&p<h.length-1?f(E=>({...E,activePredictionIndex:p+1})):A.key===Hn.UP&&p>0?f(E=>({...E,activePredictionIndex:p-1})):A.key===Hn.ENTER&&p>-1&&(s(h[p].description),m(E=>({...E,input:h[p].description})),f(E=>({...E,predictions:[],isPredictionSelected:!0}))))},C=A=>{s(A.target.value),m(E=>({...E,input:A.target.value,displayInput:A.target.value})),f(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},D=A=>{s(A.description),m(E=>({...E,input:A.description,displayInput:A.description})),f(E=>({...E,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:C,onKeyDown:v,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:h.map((A,E)=>c.jsx("li",{onClick:()=>D(A),onMouseEnter:()=>f(k=>({...k,activePredictionIndex:E})),className:V("predictions-list-item",{active:E===p}),children:A.description},E))})]})};const gf=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:d,accessibilityOptions:{checkboxes:{navigateWithArrowKeys:m=!1}={}}={},...h})=>{const p=ae.useIntl(),{onChange:g,...f}=r,b=()=>{t||g(d?null:l)},v=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:d,readOnly:!0,disabled:t,tabIndex:-1}),c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:a,onKeyDown:C=>{(C.key==="Enter"||C.code==="Space")&&(C.preventDefault(),C.stopPropagation(),b())},tabIndex:d||!m?0:-1,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return y.createElement(n,{onClick:C=>{const D=C.target;D.nodeName.toLowerCase()==="a"||D.parentNode&&D.parentNode.nodeName.toLowerCase()==="a"||(C.preventDefault(),C.stopPropagation(),b())},onKeyDown:m?C=>{var D,A,E;if(C.key!=="Tab")switch(C.code){case"Enter":case"Space":C.stopPropagation(),C.preventDefault(),b();break;case"ArrowLeft":case"ArrowRight":C.stopPropagation(),C.preventDefault();const k=C.currentTarget;let T=k==null?void 0:k.nextElementSibling;if(C.key==="ArrowLeft"){const $=k==null?void 0:k.previousElementSibling;$?T=$:T=(D=k==null?void 0:k.parentElement)==null?void 0:D.lastElementChild}else T||(T=(A=k==null?void 0:k.parentElement)==null?void 0:A.firstElementChild);T&&((E=T==null?void 0:T.querySelector("label"))==null||E.focus());break}}:void 0,className:V(a,"checkbox-wrapper",e,{"is-checked":d}),...h,...f},v)};const Cv=y.memo(function({direction:t="down"}){return c.jsx(oi,{className:V("rotating-chevron",`direction-${t}`)})});const wv=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const d=ae.useIntl(),[m,h]=y.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[f,b]=y.useState(g);let v;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?v=t&&f?t.find(T=>T.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?v=f[0]:v={id:"",label:""},y.useEffect(()=>{b(g)},[r,n]);const{onChange:C,onMultiSelectSubmit:D,...A}=a,E=T=>{if(o){let $=[];f!=null&&f.includes(T.id)?$=f.filter(P=>P!==T.id):$=[...f,T.id],b([...$]),C&&C([...$])}else b([T]),C&&C(T.id),h(!1)},k=T=>{if(T==="all"){const $=(t==null?void 0:t.map(P=>P.id))||[];b($),C&&C($)}else b([]),C&&C([])};return c.jsxs("div",{className:V("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":m,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:T=>{T.preventDefault(),T.stopPropagation(),h(!m)},"data-testid":"dropdown-selector",...A,children:[o?`${s} · ${f.length}`:v.label,c.jsx(Cv,{direction:m?"up":"down"})]}),c.jsx("select",{defaultValue:v.id,onChange:T=>{T.preventDefault(),T.stopPropagation();const $=t&&t.find(P=>P.id===T.target.value);E($)},hidden:!m,...A,children:t==null?void 0:t.map(T=>c.jsx("option",{value:T.id,className:"gtm-trackable","data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":i,children:T.label},T.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!m,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${f==null?void 0:f.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>k("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>k("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(T=>{const $=T.id===v.id||(f==null?void 0:f.includes(T))||(f==null?void 0:f.includes(T.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:V("gtm-trackable",{selected:$,"selected-single":$&&!o}),"data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":i,onClick:P=>{P.preventDefault(),P.stopPropagation(),E(T)},role:"menuitem","aria-current":$,"data-testid":$?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:V({"menu-option-label":o}),children:T.label})]})},T.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(Ee,{variant:"secondary",onClick:()=>{D&&D(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),h(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})},Tr=(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 $i=null;const Dv=({id:e,label:t,limit:n,value:r,placeholder:a,functions:i,error:s,multipleInputs:o,validation:l,fieldData:u,type:d,...m})=>{const h=ae.useIntl(),{showCount:p=!1,label:g,defaultInputs:f=1,maxInputs:b=100,hasButton:v=!1}=o||{},[C,D]=y.useState(r?Array.isArray(r)?r:[r]:Array(f).fill("")),A=C.filter(P=>P!==""),E=()=>{if(!u)return;const P=Ot(u.fields).filter(({id:B,name:F})=>(B||(B=F||""),B!==e&&!B.includes(`${e}-`))),z=[];C.map((B,F)=>{if(b&&F>=b)return;const j=Ot(l);j&&e&&(j.forEach(O=>{const{condition:q,error:W}=O;if(typeof q=="function")O.condition=ne=>{var Q;let J=(Q=ne==null?void 0:ne[e])==null?void 0:Q[F];J||(ne[e]&&!Array.isArray(ne[e])?J=ne[e]:J="");const w=Ot(ne);return w[e]=J,typeof q=="function"&&q(w)?W:!1};else{const ne=q;O.condition=J=>{var Q;let w=(Q=J==null?void 0:J[e])==null?void 0:Q[F];switch(w||(J[e]&&!Array.isArray(J[e])?w=J[e]:w=""),ne){case"required":W||(O.error=h==null?void 0:h.formatMessage({id:"form_error_required"}));break;case"no-numbers":W||(O.error=h==null?void 0:h.formatMessage({id:"form_error_numbers"}));break;case"valid-email":W||(O.error=W||(h==null?void 0:h.formatMessage({id:"form_error_email"})));break;case"valid-url":W||(O.error=h==null?void 0:h.formatMessage({id:"form_error_url"}));break;default:console.warn("WARNING! No field validation condition has been set")}return Tr(ne,w)?O.error:!1}}}),z.push({id:`${e}-${F}`,validation:j,value:B}))});const L={fieldsToValidate:P.concat(z)};u.multipleInputs.includes(e)&&(L.multipleInputs=u.multipleInputs.filter(B=>B!==e)),u.setFields(B=>({...B,...L}))};y.useEffect(()=>{E()},[C.length]),y.useEffect(()=>{!u||!u.multipleInputs||u.multipleInputs.includes(e)&&E()},[u==null?void 0:u.multipleInputs]);const k=()=>{(!b||C.length<b)&&D([...C,""])},T=P=>{const z=document.getElementById(`${e}-${P+1}`);z==null||z.focus()},$=(P,z)=>P.replace("{number}",z+1);return c.jsxs("fieldset",{className:V("multiple-inputs field-wrapper",{"has-button":v,"has-legend":t}),children:[t?c.jsxs("legend",{className:"legend-as-label",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:A.length,total:b}),children:h.formatMessage({id:"form_multipleInputs_filledInCount"},{number:A.length,total:b})})]}):""]}):c.jsx(c.Fragment,{}),C.map((P,z)=>{if(b&&z>=b)return c.jsx(c.Fragment,{});let L=!1;t?L=c.jsx(Pe,{showOnFocus:!1,children:h.formatMessage({id:"form_multipleInputs_label"},{number:z+1})}):g&&(L=$(g,z));const B=`${e}-${z}`;return c.jsx(vf,{id:B,type:"text",label:L,value:P,placeholder:a?$(a,z):void 0,limit:n,error:s&&typeof s!="string"?s==null?void 0:s[B]:void 0,functions:{...i,onFocus:()=>{v||z!==C.length-1||k()},onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),F.stopPropagation(),$i&&clearTimeout($i),z!==C.length-1?T(z):(k(),$i=setTimeout(()=>T(z),100)))},onChange:F=>{const j=Ot(C);j[z]=F,D(j),u==null||u.dispatch({type:"removeError",payload:{key:B}}),i==null||i.onChange(j)}},siblings:z+1<=f?void 0:c.jsx(Ee,{variant:"tertiary",size:"small",icon:"close",screenreaderText:h.formatMessage({id:"form_multipleInputs_remove"}),onClick:()=>{const F=Ot(C);F.splice(z,1),D(F),u==null||u.dispatch({type:"removeError",payload:{key:B}}),i==null||i.onChange(F)}}),...m},B)}),v?c.jsx(Ee,{...v,onClick:k,disabled:!!(b&&b<=C.length)}):c.jsx(c.Fragment,{})]})};const Wu=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:d,accessibilityOptions:m,styling:{displayOptionsAsPills:h=!1}={},...p})=>{const g=ae.useIntl(),f=i?d:[],b=d;return c.jsx("ul",{...p,className:V("options-wrapper",e,{"with-pills filters":h}),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:v,label:C=!1,value:D=v,disabled:A=!1})=>{const E=`${r}_${v}`,k=()=>{if(A)return;let T;if(i){const $=f==null?void 0:f.indexOf(D);Array.isArray(f)&&$>=0?(T=f,T.splice($,1)):(!f||f.length===0?T=[]:T=f,T.push(D))}else T=b===D?void 0:D;t.onChange(T)};return c.jsx(gf,{element:"li",id:E,type:u==="checkboxes"?"checkbox":"radio",shownValue:D,value:i?f==null?void 0:f.includes(D):b===D,functions:{...t,onChange:k},intlPath:n,label:C||g.formatMessage({id:n?`${n}_${v}`:v}),disabled:A,accessibilityOptions:m},E)})})};const Ev=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=ae.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,m]=y.useState(t),h=()=>{var p;u(!l),m(l?"password":"text"),(p=o.current)==null||p.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:V("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:h,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Jn,{inputRef:o,type:d,autoComplete:r,...a})]})};const Kn={text:{component:Jn},email:{component:Jn},url:{component:Jn},textarea:{component:Jn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:gf},checkboxes:{component:Wu,props:{multiSelect:!0}},radio:{component:Wu,props:{multiSelect:!1}},select:{component:wv},password:{component:Ev},autocomplete:{component:xv},"multiple-inputs":{component:c.jsx(c.Fragment,{})}},vf=e=>{const t=ae.useIntl(),{id:n,intlPath:r=!1,className:a="",error:i,functions:s={onChange:()=>{}},limit:o=0,showRequiredLabels:l=!0,type:u,validation:d,value:m,submitOnEnter:h,fieldData:p,siblings:g,...f}=e;if(u&&u==="multiple-inputs")return c.jsx(Dv,{...e});const b=d&&d.some(({condition:j})=>j==="required"),v=mi(m),C=u&&Kn[u]&&Kn[u].component?Kn[u].component:Jn,D=u&&["checkboxes","radio"].includes(u),A=u&&["autocomplete"].includes(u),E=i&&`error-${n}`,k=`character-limit-${n}`,T={};D?T.element="legend":T.htmlFor=n;let $={...f,id:n,name:n,className:i?"error":"",type:u,required:b,"aria-required":b,functions:Ot(s),value:m};const P=j=>{$["aria-describedby"]?$["aria-describedby"]+=` ${j}`:$["aria-describedby"]=j};if(o>0){const j=hf(o,s);P(`${k}-info`),$={...$,...j},j.functions&&typeof j.functions=="object"&&($.functions={...$.functions,...j.functions})}u&&Kn[u]&&Kn[u].props&&($={...$,...Kn[u].props}),D&&($.intlPath=`${r}_${n}`),i&&($["aria-invalid"]=!0,$["aria-errormessage"]=E,P(E));const z=f.label||t.formatMessage({id:r?`${r}_${n}`:n}),L=({...j})=>i?y.createElement(j.as||"p",{id:E,className:"error text-small",...j},i):null;if(u&&["checkbox"].includes(u))return c.jsxs(c.Fragment,{children:[c.jsx(C,{...$,label:z,className:V("field-wrapper",a)}),c.jsx(L,{as:"p"})]});const B={};D?T.className="legend-as-label text-small":B.className="field-label";const F=({element:j,...O})=>y.createElement(j||"label",{...O,"data-testid":`label-${n}`});return c.jsx(c.Fragment,{children:y.createElement(D?"fieldset":"div",{className:V("field-wrapper text-medium",a,`${u}-wrapper`,{"multiple-options-wrapper":D})},c.jsxs(c.Fragment,{children:[f.label===!1?c.jsx(c.Fragment,{}):y.createElement(D?y.Fragment:"p",B,c.jsxs(F,{...T,children:[z,b&&l&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",t.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(D||A?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(C,{...$}),c.jsx(Fo,{id:k,limit:o,valueLength:v}),g]})),c.jsx(L,{})]}))})},_v=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?Ot(e.errors):{},i=e.values?Ot(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:d}=r,m=Ot(Object.keys(a));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(i);v&&(b=f||v)}else{const v=i[h.id],C=g;switch(C){case"required":Tr(C,v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{Tr(C,v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{Tr(C,v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{Tr(C,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?l(i):u(i,m),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Li=null;const Jt=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:m,...h})=>{const p=(t||[]).filter(R=>R.type==="multiple-inputs").map(R=>R.id),[g,f]=y.useState({fieldsToValidate:t,multipleInputs:p});y.useEffect(()=>{g.multipleInputs.length||f(R=>({...R,fieldsToValidate:t,multipleInputs:p}))},[t.length]);const{customOnSubmit:b,hideButton:v,...C}=s,D=40,{shouldShowCancelButton:A=!1,shouldReset:E=!0,shouldHide:k=!0,showRequiredLabels:T=!0,showSuccessMessage:$=!1}=l||{},{onSuccess:P=async()=>{},onCancel:z=()=>{},onCatch:L=()=>{},onFailure:B=()=>{}}=m||{},F=ae.useIntl(),j={};t.length&&t.forEach(R=>{const K=R.id||R.name;K&&(j[K]=R.value||"")});const[O,q]=y.useReducer(_v,{isSubmitting:!1,formSubmitted:!1,errors:{},values:j}),{errors:W,isSubmitting:ne,formSubmitted:J,values:w}=O;y.useEffect(()=>{E&&J&&(Li=setTimeout(()=>{q({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[J]),y.useEffect(()=>()=>{Li&&clearTimeout(Li)},[]),y.useEffect(()=>{const R=K=>{q({type:"updateValue",payload:{key:K.detail.id,value:K.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",R),()=>{document.removeEventListener("dropdownMultiSelectSubmit",R)}},[]);const Q=y.useRef(null),se=a||Q;if(!t.length)return null;const _={};s.children&&(_.default=s.children),C.text&&typeof C.text=="string"&&(_.default=C.text),["default","submitting","submitted"].forEach(R=>{C.text&&typeof C.text!="string"&&R in C.text?_[R]=C.text[R]:_[R]||(_[R]=F.formatMessage({id:`form_${R==="default"?"submit":R}`}))}),delete C.text;const M=()=>{if(!ne){if(q({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&q({type:"submitForm",payload:{fields:g.fieldsToValidate,dispatch:q,intl:F}});return}q({type:"submitForm",payload:{fields:g.fieldsToValidate,dispatch:q,onSuccess:async R=>{try{await P(R),q({type:E?"formSubmittedAndReset":"formSubmitted"})}catch(K){L(K),q({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(R,K)=>{B(R,K),q({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:F}})}},U=R=>{var re;if(R.preventDefault(),R.stopPropagation(),ne)return;let K=0;if((re=se==null?void 0:se.current)!=null&&re.id){const ce=document.getElementById(se.current.id);ce&&(K=ce.getBoundingClientRect().top+window.scrollY)}const Z=document.getElementById("header");Z&&(K=K-Z.offsetHeight-D),K<0&&(K=0),window.scrollTo({top:K,behavior:"smooth"}),M()},S=[{...C,icon:J?{icon:"tick",position:"left"}:!1,className:V("gtm-trackable",C.className),onClick:U,disabled:ne||J||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:_[ne?"submitting":J?"submitted":"default"]}];return A&&S.unshift({...o,className:V("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:ne||J,onClick:z,children:o.text||F.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...h,id:r,className:V("form",n),ref:se},c.jsxs(c.Fragment,{children:[W!=null&&W.general?c.jsx(Cn,{variant:"error",text:F.formatMessage({id:"form_error_generalError"})}):null,u,(!k||!ne&&!J||b)&&t.map((R,K)=>{const{id:Z=R.name||K,component:re,functions:ce={onChange:()=>{}},submitOnEnter:X=!1}=R;if(re)return c.jsx(re,{...R.props||{}},`component-${Z}-${K}`);const pe=(w==null?void 0:w[Z])||"",ve={...ce,onChange:ye=>{q({type:"updateValue",payload:{key:Z,value:ye}}),ce.onChange(ye,q)}};return X&&(ve.onKeyDown=ye=>{ye.key==="Enter"&&(ye.stopPropagation(),ye.preventDefault(),M()),ce.onKeyDown&&ce.onKeyDown(ye)}),c.jsx(vf,{intlPath:i,...R,showRequiredLabels:T,value:pe,error:R.type==="multiple-inputs"?W:W==null?void 0:W[Z],functions:ve,fieldData:{fields:g.fieldsToValidate,multipleInputs:g.multipleInputs,setFields:f,dispatch:q}},Z)}),v?null:(ne||J)&&b?b:c.jsx(pr,{className:V("cta",{center:ne||J,submitted:J}),buttons:S})]})),$&&J&&c.jsx(ur,{className:"success",children:typeof $=="string"?$:F.formatMessage({id:"form_success"})})]})};const fa="passwordRules_",bf="isMoreThanEightCharacters",yf="includesNumberAndSymbol",xf="includesLowerAndUppercase",kv={[bf]:"8Characters",[yf]:"numberSymbol",[xf]:"lowercaseUppercase"},Fv=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ae.useIntl();return c.jsxs("aside",{className:V("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${fa}intro`})}),c.jsx("ul",{children:[bf,yf,xf].map(r=>c.jsxs("li",{className:V({matches:e[r]}),children:[c.jsxs(Pe,{children:[n.formatMessage({id:`${fa}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${fa}rule_${kv[r]}`})}),!e[r]&&c.jsxs(Pe,{element:"strong",children:[" ",n.formatMessage({id:`${fa}notMet`})]})]},`rule-${r}`))})]})},Cf=y.memo(Fv);const Av=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ae.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const v=await n();u(C=>({...C,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(C=>({...C,setUp:!0,disabled:!0})),a(v)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Nt,{className:"rating-placeholder"});const{id:m,rating:h,disabled:p}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},b=async v=>{if(!(!m||p))try{u(C=>({...C,rating:v,disabled:!0})),await r({id:m,value:v})}catch(C){u(D=>({...D,rating:null})),a(C)}finally{u(C=>({...C,disabled:!1}))}};return c.jsxs("div",{className:V("rating",i),children:[c.jsx("span",{className:"label",children:f[h?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const C=v+1;return c.jsx("li",{className:V({selected:h&&C<=h}),children:c.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:`star${!h||C>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:C,total:t})}${C===1||C===t?` - ${f[C===1?"low":"high"]}`:""}`,onClick:D=>{D.preventDefault(),D.stopPropagation(),b(C)},disabled:p})},`rating-${C}`)})})]})},Bv={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,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=y.createContext(Bv);var H=(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))(H||{}),Kt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Kt||{});const Tv=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case H.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case H.link:return c.jsx("a",{...e,children:t});case H.li:return c.jsx("li",{...e,children:t});case H.mention:const a=r;return a!=null&&a.name&&a.name===Lr?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(ae.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case H.ol:return c.jsx("ol",{...e,children:t});case H.ul:return c.jsx("ul",{...e,children:t});case H.span:return c.jsx("span",{...e,children:t});case H.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},Sv=({attributes:e,children:t,leaf:n})=>{const r=n;return r[H.bold]&&(t=c.jsx("strong",{children:t})),r[H.italic]&&(t=c.jsx("em",{children:t})),r[H.strikethrough]&&(t=c.jsx("s",{children:t})),r[H.h3]&&(t=c.jsx("h3",{children:t})),c.jsx("span",{...e,children:t})};var jv=Mv,wf="֑-߿יִ-﷽ﹰ-ﻼ",Df="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Ov=new RegExp("^[^"+Df+"]*["+wf+"]"),Pv=new RegExp("^[^"+wf+"]*["+Df+"]");function Mv(e){return e=String(e||""),Ov.test(e)?"rtl":Pv.test(e)?"ltr":"neutral"}const Ef=Rn(jv);function Nv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ao=Nv,Iv=typeof ra=="object"&&ra&&ra.Object===Object&&ra,Rv=Iv,$v=Rv,Lv=typeof self=="object"&&self&&self.Object===Object&&self,zv=$v||Lv||Function("return this")(),_f=zv,qv=_f,Uv=function(){return qv.Date.now()},Wv=Uv,Vv=/\s/;function Hv(e){for(var t=e.length;t--&&Vv.test(e.charAt(t)););return t}var Kv=Hv,Zv=Kv,Yv=/^\s+/;function Gv(e){return e&&e.slice(0,Zv(e)+1).replace(Yv,"")}var Qv=Gv,Jv=_f,Xv=Jv.Symbol,kf=Xv,Vu=kf,Ff=Object.prototype,eb=Ff.hasOwnProperty,tb=Ff.toString,_r=Vu?Vu.toStringTag:void 0;function nb(e){var t=eb.call(e,_r),n=e[_r];try{e[_r]=void 0;var r=!0}catch{}var a=tb.call(e);return r&&(t?e[_r]=n:delete e[_r]),a}var rb=nb,ab=Object.prototype,ib=ab.toString;function sb(e){return ib.call(e)}var ob=sb,Hu=kf,ub=rb,lb=ob,cb="[object Null]",db="[object Undefined]",Ku=Hu?Hu.toStringTag:void 0;function fb(e){return e==null?e===void 0?db:cb:Ku&&Ku in Object(e)?ub(e):lb(e)}var mb=fb;function hb(e){return e!=null&&typeof e=="object"}var pb=hb,gb=mb,vb=pb,bb="[object Symbol]";function yb(e){return typeof e=="symbol"||vb(e)&&gb(e)==bb}var xb=yb,Cb=Qv,Zu=Ao,wb=xb,Yu=0/0,Db=/^[-+]0x[0-9a-f]+$/i,Eb=/^0b[01]+$/i,_b=/^0o[0-7]+$/i,kb=parseInt;function Fb(e){if(typeof e=="number")return e;if(wb(e))return Yu;if(Zu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Zu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Cb(e);var n=Eb.test(e);return n||_b.test(e)?kb(e.slice(2),n?2:8):Db.test(e)?Yu:+e}var Ab=Fb,Bb=Ao,zi=Wv,Gu=Ab,Tb="Expected a function",Sb=Math.max,jb=Math.min;function Ob(e,t,n){var r,a,i,s,o,l,u=0,d=!1,m=!1,h=!0;if(typeof e!="function")throw new TypeError(Tb);t=Gu(t)||0,Bb(n)&&(d=!!n.leading,m="maxWait"in n,i=m?Sb(Gu(n.maxWait)||0,t):i,h="trailing"in n?!!n.trailing:h);function p(k){var T=r,$=a;return r=a=void 0,u=k,s=e.apply($,T),s}function g(k){return u=k,o=setTimeout(v,t),d?p(k):s}function f(k){var T=k-l,$=k-u,P=t-T;return m?jb(P,i-$):P}function b(k){var T=k-l,$=k-u;return l===void 0||T>=t||T<0||m&&$>=i}function v(){var k=zi();if(b(k))return C(k);o=setTimeout(v,f(k))}function C(k){return o=void 0,h&&r?p(k):(r=a=void 0,s)}function D(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function A(){return o===void 0?s:C(zi())}function E(){var k=zi(),T=b(k);if(r=arguments,a=this,l=k,T){if(o===void 0)return g(l);if(m)return clearTimeout(o),o=setTimeout(v,t),p(l)}return o===void 0&&(o=setTimeout(v,t)),s}return E.cancel=D,E.flush=A,E}var Af=Ob;const Pb=Rn(Af);var Mb=Af,Nb=Ao,Ib="Expected a function";function Rb(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(Ib);return Nb(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),Mb(e,t,{leading:r,maxWait:t,trailing:a})}var $b=Rb;const Lb=Rn($b),Qu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Ju=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",qi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Ju(n.overflowY,t)||Ju(n.overflowX,t)||(r=>{const a=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!a&&(a.clientHeight<r.scrollHeight||a.clientWidth<r.scrollWidth)})(e)}return!1},ma=(e,t,n,r,a,i,s,o)=>i<e&&s>t||i>e&&s<t?0:i<=e&&o<=n||s>=t&&o>=n?i-e-r:s>t&&o<n||i<e&&o>n?s-t+a:0,zb=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Xu=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,m=typeof u=="function"?u:q=>q!==u;if(!Qu(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let g=e;for(;Qu(g)&&m(g);){if(g=zb(g),g===h){p.push(g);break}g!=null&&g===document.body&&qi(g)&&!qi(document.documentElement)||g!=null&&qi(g,d)&&p.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:v,scrollY:C}=window,{height:D,width:A,top:E,right:k,bottom:T,left:$}=e.getBoundingClientRect(),{top:P,right:z,bottom:L,left:B}=(q=>{const W=window.getComputedStyle(q);return{top:parseFloat(W.scrollMarginTop)||0,right:parseFloat(W.scrollMarginRight)||0,bottom:parseFloat(W.scrollMarginBottom)||0,left:parseFloat(W.scrollMarginLeft)||0}})(e);let F=o==="start"||o==="nearest"?E-P:o==="end"?T+L:E+D/2-P+L,j=l==="center"?$+A/2-B+z:l==="end"?k+z:$-B;const O=[];for(let q=0;q<p.length;q++){const W=p[q],{height:ne,width:J,top:w,right:Q,bottom:se,left:_}=W.getBoundingClientRect();if(s==="if-needed"&&E>=0&&$>=0&&T<=b&&k<=f&&E>=w&&T<=se&&$>=_&&k<=Q)return O;const M=getComputedStyle(W),U=parseInt(M.borderLeftWidth,10),S=parseInt(M.borderTopWidth,10),R=parseInt(M.borderRightWidth,10),K=parseInt(M.borderBottomWidth,10);let Z=0,re=0;const ce="offsetWidth"in W?W.offsetWidth-W.clientWidth-U-R:0,X="offsetHeight"in W?W.offsetHeight-W.clientHeight-S-K:0,pe="offsetWidth"in W?W.offsetWidth===0?0:J/W.offsetWidth:0,ve="offsetHeight"in W?W.offsetHeight===0?0:ne/W.offsetHeight:0;if(h===W)Z=o==="start"?F:o==="end"?F-b:o==="nearest"?ma(C,C+b,b,S,K,C+F,C+F+D,D):F-b/2,re=l==="start"?j:l==="center"?j-f/2:l==="end"?j-f:ma(v,v+f,f,U,R,v+j,v+j+A,A),Z=Math.max(0,Z+C),re=Math.max(0,re+v);else{Z=o==="start"?F-w-S:o==="end"?F-se+K+X:o==="nearest"?ma(w,se,ne,S,K+X,F,F+D,D):F-(w+ne/2)+X/2,re=l==="start"?j-_-U:l==="center"?j-(_+J/2)+ce/2:l==="end"?j-Q+R+ce:ma(_,Q,J,U,R+ce,j,j+A,A);const{scrollLeft:ye,scrollTop:Me}=W;Z=ve===0?0:Math.max(0,Math.min(Me+Z/ve,W.scrollHeight-ne/ve+X)),re=pe===0?0:Math.max(0,Math.min(ye+re/pe,W.scrollWidth-J/pe+ce)),F+=Me-Z,j+=ye-re}O.push({el:W,top:Z,left:re})}return O},qb=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function Ub(e,t){if(!e.isConnected||!(a=>{let i=a;for(;i&&i.parentNode;){if(i.parentNode===document)return!0;i=i.parentNode instanceof ShadowRoot?i.parentNode.host:i.parentNode}return!1})(e))return;const n=(a=>{const i=window.getComputedStyle(a);return{top:parseFloat(i.scrollMarginTop)||0,right:parseFloat(i.scrollMarginRight)||0,bottom:parseFloat(i.scrollMarginBottom)||0,left:parseFloat(i.scrollMarginLeft)||0}})(e);if((a=>typeof a=="object"&&typeof a.behavior=="function")(t))return t.behavior(Xu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Xu(e,qb(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,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 el(e){return Object.prototype.toString.call(e)==="[object Object]"}function st(e){var t,n;return el(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(el(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Af=Symbol.for("immer-nothing"),tl=Symbol.for("immer-draftable"),kt=Symbol.for("immer-state"),Ub=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 Ct(e,...t){if(process.env.NODE_ENV!=="production"){const n=Ub[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 dr=Object.getPrototypeOf;function Mn(e){return!!e&&!!e[kt]}function Nn(e){var t;return e?Bf(e)||Array.isArray(e)||!!e[tl]||!!((t=e.constructor)!=null&&t[tl])||pi(e)||gi(e):!1}var Wb=Object.prototype.constructor.toString();function Bf(e){if(!e||typeof e!="object")return!1;const t=dr(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)===Wb}function Ya(e,t){hi(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function hi(e){const t=e[kt];return t?t.type_:Array.isArray(e)?1:pi(e)?2:gi(e)?3:0}function Ms(e,t){return hi(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Tf(e,t,n){const r=hi(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Vb(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function pi(e){return e instanceof Map}function gi(e){return e instanceof Set}function Fn(e){return e.copy_||e.base_}function Ns(e,t){if(pi(e))return new Map(e);if(gi(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Bf(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[kt];let a=Reflect.ownKeys(r);for(let i=0;i<a.length;i++){const s=a[i],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(dr(e),r)}else{const r=dr(e);if(r!==null&&n)return{...e};const a=Object.create(r);return Object.assign(a,e)}}function Bo(e,t=!1){return vi(e)||Mn(e)||!Nn(e)||(hi(e)>1&&(e.set=e.add=e.clear=e.delete=Hb),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Bo(r,!0))),e}function Hb(){Ct(2)}function vi(e){return Object.isFrozen(e)}var Kb={};function In(e){const t=Kb[e];return t||Ct(0,e),t}var Ur;function Sf(){return Ur}function Zb(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function nl(e,t){t&&(In("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Is(e){Rs(e),e.drafts_.forEach(Yb),e.drafts_=null}function Rs(e){e===Ur&&(Ur=e.parent_)}function rl(e){return Ur=Zb(Ur,e)}function Yb(e){const t=e[kt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function al(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[kt].modified_&&(Is(t),Ct(4)),Nn(e)&&(e=Ga(t,e),t.parent_||Qa(t,e)),t.patches_&&In("Patches").generateReplacementPatches_(n[kt].base_,e,t.patches_,t.inversePatches_)):e=Ga(t,n,[]),Is(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Af?e:void 0}function Ga(e,t,n){if(vi(t))return t;const r=t[kt];if(!r)return Ya(t,(a,i)=>il(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Qa(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const a=r.copy_;let i=a,s=!1;r.type_===3&&(i=new Set(a),a.clear(),s=!0),Ya(i,(o,l)=>il(e,r,a,o,l,n,s)),Qa(e,a,!1),n&&e.patches_&&In("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function il(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&Ct(5),Mn(a)){const o=i&&t&&t.type_!==3&&!Ms(t.assigned_,r)?i.concat(r):void 0,l=Ga(e,a,o);if(Tf(n,r,l),Mn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Nn(a)&&!vi(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ga(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Qa(e,a)}}function Qa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Bo(t,n)}function Gb(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Sf(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=To;n&&(a=[r],i=Wr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var To={get(e,t){if(t===kt)return e;const n=Fn(e);if(!Ms(n,t))return Qb(e,n,t);const r=n[t];return e.finalized_||!Nn(r)?r:r===Ui(e.base_,t)?(Wi(e),e.copy_[t]=Ls(r,e)):r},has(e,t){return t in Fn(e)},ownKeys(e){return Reflect.ownKeys(Fn(e))},set(e,t,n){const r=jf(Fn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=Ui(Fn(e),t),i=a==null?void 0:a[kt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Vb(n,a)&&(n!==void 0||Ms(e.base_,t)))return!0;Wi(e),$s(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 Ui(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Wi(e),$s(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Fn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Ct(11)},getPrototypeOf(e){return dr(e.base_)},setPrototypeOf(){Ct(12)}},Wr={};Ya(To,(e,t)=>{Wr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Wr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Ct(13),Wr.set.call(this,e,t,void 0)};Wr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Ct(14),To.set.call(this,e[0],t,n,e[0])};function Ui(e,t){const n=e[kt];return(n?Fn(n):e)[t]}function Qb(e,t,n){var a;const r=jf(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function jf(e,t){if(!(t in e))return;let n=dr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=dr(n)}}function $s(e){e.modified_||(e.modified_=!0,e.parent_&&$s(e.parent_))}function Wi(e){e.copy_||(e.copy_=Ns(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Jb=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,d=>n.call(this,d,...u))}}typeof n!="function"&&Ct(6),r!==void 0&&typeof r!="function"&&Ct(7);let a;if(Nn(t)){const i=rl(this),s=Ls(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?Is(i):Rs(i)}return nl(i,r),al(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===Af&&(a=void 0),this.autoFreeze_&&Bo(a,!0),r){const i=[],s=[];In("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else Ct(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,l=>t(l,...o));let r,a;return[this.produce(t,n,(s,o)=>{r=s,a=o}),r,a]},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){Nn(e)||Ct(8),Mn(e)&&(e=Xb(e));const t=rl(this),n=Ls(e,void 0);return n[kt].isManual_=!0,Rs(t),n}finishDraft(e,t){const n=e&&e[kt];(!n||!n.isManual_)&&Ct(9);const{scope_:r}=n;return nl(r,t),al(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 a=t[n];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}n>-1&&(t=t.slice(n+1));const r=In("Patches").applyPatches_;return Mn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function Ls(e,t){const n=pi(e)?In("MapSet").proxyMap_(e,t):gi(e)?In("MapSet").proxySet_(e,t):Gb(e,t);return(t?t.scope_:Sf()).drafts_.push(n),n}function Xb(e){return Mn(e)||Ct(10,e),Of(e)}function Of(e){if(!Nn(e)||vi(e))return e;const t=e[kt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ns(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ns(e,!0);return Ya(n,(r,a)=>{Tf(n,r,Of(a))}),t&&(t.finalized_=!1),n}var Ft=new Jb,So=Ft.produce;Ft.produceWithPatches.bind(Ft);Ft.setAutoFreeze.bind(Ft);Ft.setUseStrictShallowCopy.bind(Ft);Ft.applyPatches.bind(Ft);var sl=Ft.createDraft.bind(Ft),ol=Ft.finishDraft.bind(Ft),e0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=I.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},t0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Fe.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},n0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=G.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Ja=new WeakMap,Xa=new WeakMap,Pr=new WeakMap,Pf=new WeakMap,ul=new WeakMap,ll=new WeakMap,cl=new WeakMap,I={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=I.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 a=e[r],i=t[r];if(a!==i)break;n.push(a)}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),a=t.slice(0,n),i=e[n],s=t[n];return I.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return I.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return I.equals(r,a)&&i<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 I.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&I.compare(e,t)===0},isBefore(e,t){return I.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&I.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&I.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&I.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&I.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),a=e[e.length-1],i=t[t.length-1];return a!==i&&I.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));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(!I.isAncestor(t,e)&&!I.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:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(I.equals(i,r)||I.endsBefore(i,r)||I.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(I.equals(s,r)||I.isAncestor(s,r))return null;I.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;I.equals(o,r)||I.endsBefore(o,r)?r[o.length-1]-=1:I.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:d}=t;if(I.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else I.endsBefore(u,r)?r[u.length-1]+=1:I.isAncestor(u,r)&&e[u.length]>=d&&(r[u.length-1]+=1,r[u.length]-=d);break}case"move_node":{var{path:m,newPath:h}=t;if(I.equals(m,h))return r;if(I.isAncestor(m,r)||I.equals(m,r)){var p=h.slice();return I.endsBefore(m,h)&&m.length<h.length&&(p[m.length-1]-=1),p.concat(r.slice(m.length))}else I.isSibling(m,h)&&(I.isAncestor(h,r)||I.equals(h,r))?I.endsBefore(m,r)?r[m.length-1]-=1:r[m.length-1]+=1:I.endsBefore(h,r)||I.equals(h,r)||I.isAncestor(h,r)?(I.endsBefore(m,r)&&(r[m.length-1]-=1),r[h.length-1]+=1):I.endsBefore(m,r)&&(I.equals(h,r)&&(r[h.length-1]+=1),r[m.length-1]-=1);break}}return r}};function Vr(e){"@babel/helpers - typeof";return Vr=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},Vr(e)}function r0(e,t){if(Vr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Vr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function a0(e){var t=r0(e,"string");return Vr(t)==="symbol"?t:String(t)}function gt(e,t,n){return t=a0(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function kr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var i0=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=le.parent(e,r),s=r[r.length-1];if(s>i.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(i.children.splice(s,0,a),t)for(var[o,l]of G.points(t))t[l]=Fe.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:m}=n;if(m.length===0)break;var h=le.leaf(e,u),p=h.text.slice(0,d),g=h.text.slice(d);if(h.text=p+m+g,t)for(var[f,b]of G.points(t))t[b]=Fe.transform(f,n);break}case"merge_node":{var{path:v}=n,C=le.get(e,v),D=I.previous(v),A=le.get(e,D),E=le.parent(e,v),k=v[v.length-1];if(he.isText(C)&&he.isText(A))A.text+=C.text;else if(!he.isText(C)&&!he.isText(A))A.children.push(...C.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(at.stringify(C)," ").concat(at.stringify(A)));if(E.children.splice(k,1),t)for(var[T,$]of G.points(t))t[$]=Fe.transform(T,n);break}case"move_node":{var{path:P,newPath:z}=n;if(I.isAncestor(P,z))throw new Error("Cannot move a path [".concat(P,"] to new path [").concat(z,"] because the destination is inside itself."));var L=le.get(e,P),B=le.parent(e,P),F=P[P.length-1];B.children.splice(F,1);var j=I.transform(P,n),O=le.get(e,I.parent(j)),q=j[j.length-1];if(O.children.splice(q,0,L),t)for(var[W,ne]of G.points(t))t[ne]=Fe.transform(W,n);break}case"remove_node":{var{path:J}=n,w=J[J.length-1],Q=le.parent(e,J);if(Q.children.splice(w,1),t)for(var[se,_]of G.points(t)){var M=Fe.transform(se,n);if(t!=null&&M!=null)t[_]=M;else{var U=void 0,S=void 0;for(var[R,K]of le.texts(e))if(I.compare(K,J)===-1)U=[R,K];else{S=[R,K];break}var Z=!1;U&&S&&(I.equals(S[1],J)?Z=!I.hasPrevious(S[1]):Z=I.common(U[1],J).length<I.common(S[1],J).length),U&&!Z?(se.path=U[1],se.offset=U[0].text.length):S?(se.path=S[1],se.offset=0):t=null}}break}case"remove_text":{var{path:re,offset:ce,text:X}=n;if(X.length===0)break;var pe=le.leaf(e,re),ve=pe.text.slice(0,ce),ye=pe.text.slice(ce+X.length);if(pe.text=ve+ye,t)for(var[Me,je]of G.points(t))t[je]=Fe.transform(Me,n);break}case"set_node":{var{path:Je,properties:Ue,newProperties:Le}=n;if(Je.length===0)throw new Error("Cannot set properties on the root node!");var Xe=le.get(e,Je);for(var _e in Le){if(_e==="children"||_e==="text")throw new Error('Cannot set the "'.concat(_e,'" property of nodes!'));var Oe=Le[_e];Oe==null?delete Xe[_e]:Xe[_e]=Oe}for(var We in Ue)Le.hasOwnProperty(We)||delete Xe[We];break}case"set_selection":{var{newProperties:Y}=n;if(Y==null)t=Y;else{if(t==null){if(!G.isRange(Y))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(at.stringify(Y)," when there is no current selection."));t=kr({},Y)}for(var oe in Y){var ie=Y[oe];if(ie==null){if(oe==="anchor"||oe==="focus")throw new Error('Cannot remove the "'.concat(oe,'" selection property'));delete t[oe]}else t[oe]=ie}}break}case"split_node":{var{path:me,position:ge,properties:ke}=n;if(me.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(me,"] because the root node cannot be split."));var ze=le.get(e,me),ot=le.parent(e,me),At=me[me.length-1],vt;if(he.isText(ze)){var tt=ze.text.slice(0,ge),Ce=ze.text.slice(ge);ze.text=tt,vt=kr(kr({},ke),{},{text:Ce})}else{var Be=ze.children.slice(0,ge),It=ze.children.slice(ge);ze.children=Be,vt=kr(kr({},ke),{},{children:It})}if(ot.children.splice(At+1,0,vt),t)for(var[bt,_n]of G.points(t))t[_n]=Fe.transform(bt,n);break}}return t},s0={transform(e,t){e.children=sl(e.children);var n=e.selection&&sl(e.selection);try{n=i0(e,n,t)}finally{e.children=ol(e.children),n?e.selection=Mn(n)?ol(n):n:e.selection=null}}},o0={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)}},u0={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)}},Mf=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(st(r)&&st(a)){if(!Mf(r,a))return!1}else if(Array.isArray(r)&&Array.isArray(a)){if(r.length!==a.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==a[i])return!1}else if(r!==a)return!1}for(var s in t)if(e[s]===void 0&&t[s]!==void 0)return!1;return!0};function l0(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function sn(e,t){if(e==null)return{};var n=l0(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var c0=["anchor","focus"];function fl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function d0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var G={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return G.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=G.edges(e);return t},equals(e,t){return Fe.equals(e.anchor,t.anchor)&&Fe.equals(e.focus,t.focus)},includes(e,t){if(G.isRange(t)){if(G.includes(e,t.anchor)||G.includes(e,t.focus))return!0;var[n,r]=G.edges(e),[a,i]=G.edges(t);return Fe.isBefore(n,a)&&Fe.isAfter(r,i)}var[s,o]=G.edges(e),l=!1,u=!1;return Fe.isPoint(t)?(l=Fe.compare(t,s)>=0,u=Fe.compare(t,o)<=0):(l=I.compare(t,s.path)>=0,u=I.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=sn(e,c0),[r,a]=G.edges(e),[i,s]=G.edges(t),o=Fe.isBefore(r,i)?i:r,l=Fe.isBefore(a,s)?a:s;return Fe.isBefore(l,o)?null:d0({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return Fe.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Fe.equals(t,n)},isExpanded(e){return!G.isCollapsed(e)},isForward(e){return!G.isBackward(e)},isRange(e){return st(e)&&Fe.isPoint(e.anchor)&&Fe.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=G.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return So(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=G.isCollapsed(r);G.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?G.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=Fe.transform(r.anchor,t,{affinity:i}),u=Fe.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},ml=e=>st(e)&&le.isNodeList(e.children)&&!x.isEditor(e),fe={isAncestor(e){return st(e)&&le.isNodeList(e.children)},isElement:ml,isElementList(e){return Array.isArray(e)&&e.every(t=>fe.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 ml(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},f0=["children"],m0=["text"],hl=new WeakMap,le={ancestor(e,t){var n=le.get(e,t);if(he.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 I.ancestors(t,n)){var a=le.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(he.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,a=le.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=le.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=I.common(t,n),a=le.get(e,r);return[a,r]},descendant(e,t){var n=le.get(e,t);if(x.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))fe.isElement(n)&&(yield[n,r])}()},extractProps(e){if(fe.isAncestor(e)){var t=sn(e,f0);return t}else{var t=sn(e,m0);return t}},first(e,t){for(var n=t.slice(),r=le.get(e,n);r&&!(he.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(he.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(at.stringify(e)));var n=So({children:e.children},r=>{var[a,i]=G.edges(t),s=le.nodes(r,{reverse:!0,pass:h=>{var[,p]=h;return!G.includes(t,p)}});for(var[,o]of s){if(!G.includes(t,o)){var l=le.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(I.equals(o,i.path)){var d=le.leaf(r,o);d.text=d.text.slice(0,i.offset)}if(I.equals(o,a.path)){var m=le.leaf(r,o);m.text=m.text.slice(a.offset)}}x.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(he.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(at.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(he.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return he.isText(e)||fe.isElement(e)||x.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=hl.get(e);if(t!==void 0)return t;var n=e.every(r=>le.isNode(r));return hl.set(e,n),n},last(e,t){for(var n=t.slice(),r=le.get(e,n);r&&!(he.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=le.get(e,t);if(!he.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 I.levels(t,n)){var a=le.get(e,r);yield[a,r]}}()},matches(e,t){return fe.isElement(e)&&fe.isElementProps(t)&&fe.matches(e,t)||he.isText(e)&&he.isTextProps(t)&&he.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:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?I.isBefore(o,i):I.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!he.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;I.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=le.get(e,o);continue}if(o.length===0)break;if(!r){var d=I.next(o);if(le.has(e,d)){o=d,l=le.get(e,o);continue}}if(r&&o[o.length-1]!==0){var m=I.previous(o);o=m,l=le.get(e,o);continue}o=I.parent(o),l=le.get(e,o),s.add(l)}}()},parent(e,t){var n=I.parent(t),r=le.get(e,n);if(he.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 he.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))he.isText(n)&&(yield[n,r])}()}};function pl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ze(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pl(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(!st(e))return!1;switch(e.type){case"insert_node":return I.isPath(e.path)&&le.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&I.isPath(e.path);case"merge_node":return typeof e.position=="number"&&I.isPath(e.path)&&st(e.properties);case"move_node":return I.isPath(e.path)&&I.isPath(e.newPath);case"remove_node":return I.isPath(e.path)&&le.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&I.isPath(e.path);case"set_node":return I.isPath(e.path)&&st(e.properties)&&st(e.newProperties);case"set_selection":return e.properties===null&&G.isRange(e.newProperties)||e.newProperties===null&&G.isRange(e.properties)||st(e.properties)&&st(e.newProperties);case"split_node":return I.isPath(e.path)&&typeof e.position=="number"&&st(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 Ze(Ze({},e),{},{type:"remove_node"});case"insert_text":return Ze(Ze({},e),{},{type:"remove_text"});case"merge_node":return Ze(Ze({},e),{},{type:"split_node",path:I.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(I.equals(t,n))return e;if(I.isSibling(n,t))return Ze(Ze({},e),{},{path:t,newPath:n});var r=I.transform(n,e),a=I.transform(I.next(n),e);return Ze(Ze({},e),{},{path:r,newPath:a})}case"remove_node":return Ze(Ze({},e),{},{type:"insert_node"});case"remove_text":return Ze(Ze({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Ze(Ze({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Ze(Ze({},e),{},{properties:l,newProperties:null}):l==null?Ze(Ze({},e),{},{properties:null,newProperties:o}):Ze(Ze({},e),{},{properties:l,newProperties:o})}case"split_node":return Ze(Ze({},e),{},{type:"merge_node",path:I.next(e.path)})}}},gl=new WeakMap,h0=e=>{var t=gl.get(e);if(t!==void 0)return t;if(!st(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||st(e.marks))&&(e.selection===null||G.isRange(e.selection))&&le.isNodeList(e.children)&&vn.isOperationList(e.operations);return gl.set(e,n),n},x={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 h0(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)}},p0={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(I.isPath)}};function vl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function bl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Fe={compare(e,t){var n=I.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return Fe.compare(e,t)===1},isBefore(e,t){return Fe.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&I.equals(e.path,t.path)},isPoint(e){return st(e)&&typeof e.offset=="number"&&I.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return So(e,r=>{if(r===null)return null;var{affinity:a="forward"}=n,{path:i,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=I.transform(i,t,n);break}case"insert_text":{I.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{I.equals(t.path,i)&&(r.offset+=t.position),r.path=I.transform(i,t,n);break}case"remove_text":{I.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(I.equals(t.path,i)||I.isAncestor(t.path,i))return null;r.path=I.transform(i,t,n);break}case"split_node":{if(I.equals(t.path,i)){if(t.position===s&&a==null)return null;(t.position<s||t.position===s&&a==="forward")&&(r.offset-=t.position,r.path=I.transform(i,t,bl(bl({},n),{},{affinity:"forward"})))}else r.path=I.transform(i,t,n);break}}})}},yl=void 0,at={setScrubber(e){yl=e},stringify(e){return JSON.stringify(e,yl)}},g0=["text"],v0=["anchor","focus"];function xl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function tn(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){gt(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 he={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=sn(i,g0);return s}return Mf(r?a(e):e,r?a(t):t)},isText(e){return st(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>he.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 a=sn(r,v0),[i,s]=G.edges(r),o=[],l=0,u=i.offset,d=s.offset;for(var m of n){var{length:h}=m.text,p=l;if(l+=h,u<=p&&l<=d){Object.assign(m,a),o.push(m);continue}if(u!==d&&(u===l||d===p)||u>l||d<p||d===p&&p!==0){o.push(m);continue}var g=m,f=void 0,b=void 0;if(d<l){var v=d-p;b=tn(tn({},g),{},{text:g.text.slice(v)}),g=tn(tn({},g),{},{text:g.text.slice(0,v)})}if(u>p){var C=u-p;f=tn(tn({},g),{},{text:g.text.slice(0,C)}),g=tn(tn({},g),{},{text:g.text.slice(C)})}Object.assign(g,a),f&&o.push(f),o.push(g),b&&o.push(b)}n=o}return n}},jo=e=>e.selection?e.selection:e.children.length>0?x.end(e,[]):[0],br=(e,t)=>{var[n]=x.node(e,t);return r=>r===n},Oo=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?D0(t):t,i=De.None,s=De.None,o=0,l=null,u=null;for(var d of a){var m=d.codePointAt(0);if(!m)break;var h=M0(d,m);if([i,s]=r?[s,h]:[h,i],Xn(i,De.ZWJ)&&Xn(s,De.ExtPict)&&(r?l=Cl(t.substring(0,o)):l=Cl(t.substring(0,t.length-o)),!l)||Xn(i,De.RI)&&Xn(s,De.RI)&&(u!==null?u=!u:r?u=!0:u=L0(t.substring(0,t.length-o)),!u)||i!==De.None&&s!==De.None&&I0(i,s))break;o+=d.length}return o||1},b0=/\s/,y0=/[\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]/,C0=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=Oo(t,n),[s,o]=Po(t,i,n);if(w0(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Po=(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)]},w0=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(b0.test(t))return!1;if(x0.test(t)){var a=Oo(n,r),[i,s]=Po(n,a,r);if(e(i,s,r))return!0}return!y0.test(t)},D0=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(_0(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(E0(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},E0=e=>e>=55296&&e<=56319,_0=e=>e>=56320&&e<=57343,De;(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"})(De||(De={}));var k0=/^(?:[\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])$/,F0=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,A0=/^(?:[\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])$/,B0=/^[\u1100-\u115F\uA960-\uA97C]$/,T0=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,S0=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,j0=/^[\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]$/,O0=/^[\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]$/,P0=/^(?:[\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])$/,M0=(e,t)=>{var n=De.Any;return e.search(k0)!==-1&&(n|=De.Extend),t===8205&&(n|=De.ZWJ),t>=127462&&t<=127487&&(n|=De.RI),e.search(F0)!==-1&&(n|=De.Prepend),e.search(A0)!==-1&&(n|=De.SpacingMark),e.search(B0)!==-1&&(n|=De.L),e.search(T0)!==-1&&(n|=De.V),e.search(S0)!==-1&&(n|=De.T),e.search(j0)!==-1&&(n|=De.LV),e.search(O0)!==-1&&(n|=De.LVT),e.search(P0)!==-1&&(n|=De.ExtPict),n};function Xn(e,t){return(e&t)!==0}var N0=[[De.L,De.L|De.V|De.LV|De.LVT],[De.LV|De.V,De.V|De.T],[De.LVT|De.T,De.T],[De.Any,De.Extend|De.ZWJ],[De.Any,De.SpacingMark],[De.Prepend,De.Any],[De.ZWJ,De.ExtPict],[De.RI,De.RI]];function I0(e,t){return N0.findIndex(n=>Xn(e,n[0])&&Xn(t,n[1]))===-1}var R0=/(?:[\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$/,Cl=e=>e.search(R0)!==-1,$0=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,L0=e=>{var t=e.match($0);if(t===null)return!1;var n=t[0].length/2;return n%2===1},z0={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]:{};x.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=jo(e)}=n;if(I.isPath(a)&&(a=x.range(e,a)),G.isRange(a))if(G.isCollapsed(a))a=a.anchor;else{var i=G.end(a);if(!r&&x.void(e,{at:i}))return;var s=G.start(a),o=x.pointRef(e,s),l=x.pointRef(e,i);ee.delete(e,{at:a,voids:r});var u=o.unref(),d=l.unref();a=u||d,ee.setSelection(e,{anchor:a,focus:a})}if(!(!r&&x.void(e,{at:a})||x.elementReadOnly(e,{at:a}))){var{path:m,offset:h}=a;t.length>0&&e.apply({type:"insert_text",path:m,offset:h,text:t})}})}};function wl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ha(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){gt(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 ee=ha(ha(ha(ha({},s0),o0),u0),z0),Sa=new WeakMap,q0=e=>Sa.get(e)||!1,U0=(e,t,n)=>{var r=Sa.get(e)||!1;Sa.set(e,!0);try{t(),n()}finally{Sa.set(e,r)}};function Nf(e,t,n){var r=Ja.get(e)||[],a=Xa.get(e)||new Set,i,s,o=m=>{if(m){var h=m.join(",");s.has(h)||(s.add(h),i.push(m))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var d of t)o(d);Ja.set(e,i),Xa.set(e,s)}var W0=(e,t)=>{for(var n of x.pathRefs(e))e0.transform(n,t);for(var r of x.pointRefs(e))t0.transform(r,t);for(var a of x.rangeRefs(e))n0.transform(a,t);if(!q0(e)){var i=I.operationCanTransformPath(t)?s=>I.transform(s,t):void 0;Nf(e,e.getDirtyPaths(t),i)}ee.transform(e,t),e.operations.push(t),x.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),Pr.get(e)||(Pr.set(e,!0),Promise.resolve().then(()=>{Pr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},V0=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return I.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=I.levels(a),s=he.isText(r)?[]:Array.from(le.nodes(r),z=>{var[,L]=z;return a.concat(L)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=I.ancestors(o),u=I.previous(o);return[...l,u]}case"move_node":{var{path:d,newPath:m}=t;if(I.equals(d,m))return[];var h=[],p=[];for(var g of I.ancestors(d)){var f=I.transform(g,t);h.push(f)}for(var b of I.ancestors(m)){var v=I.transform(b,t);p.push(v)}var C=p[p.length-1],D=m[m.length-1],A=C.concat(D);return[...h,...p,A]}case"remove_node":{var{path:E}=t,k=I.ancestors(E);return[...k]}case"split_node":{var{path:T}=t,$=I.levels(T),P=I.next(T);return[...$,P]}default:return[]}},H0=e=>{var{selection:t}=e;return t?le.fragment(e,t):[]},K0=(e,t)=>{var[n,r]=t;if(!he.isText(n)){if(fe.isElement(n)&&n.children.length===0){var a={text:""};ee.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=x.isEditor(n)?!1:fe.isElement(n)&&(e.isInline(n)||n.children.length===0||he.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=le.get(e,r);if(!he.isText(l)){var u=l.children[s],d=l.children[s-1],m=o===n.children.length-1,h=he.isText(u)||fe.isElement(u)&&e.isInline(u);if(h!==i)ee.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(fe.isElement(u)){if(e.isInline(u)){if(d==null||!he.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&&he.isText(d)&&(he.equals(u,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--):u.text===""&&(ee.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Z0=(e,t)=>{var{iteration:n,initialDirtyPathsLength:r}=t,a=r*42;if(n>a)throw new Error("Could not completely normalize the editor after ".concat(a," iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state."));return!0},Y0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:s}=n;if(i){var o=x.path(t,i),l=a==="lowest";for(var[u,d]of x.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!he.isText(u)){if(G.isRange(i)){if(I.isAncestor(d,i.anchor.path)&&I.isAncestor(d,i.focus.path))return[u,d]}else if(!I.equals(o,d))return[u,d]}}};function Dl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function El(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Dl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var G0=(e,t,n)=>{var{selection:r}=e;if(r){var a=(m,h)=>{if(!he.isText(m))return!1;var[p,g]=x.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},i=G.isExpanded(r),s=!1;if(!i){var[o,l]=x.node(e,r);if(o&&a(o,l)){var[u]=x.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)ee.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var d=El(El({},x.marks(e)||{}),{},{[t]:n});e.marks=d,Pr.get(e)||e.onChange()}}};function _l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function kl(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){gt(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 Q0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.point(t,n,{edge:"end"}),i=x.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,kl(kl({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};function Fl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Al(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Fl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var J0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.start(t,[]),i=x.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,Al(Al({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},X0=(e,t)=>{var{selection:n}=e;n&&G.isCollapsed(n)&&ee.delete(e,{unit:t,reverse:!0})},ey=(e,t)=>{var{selection:n}=e;n&&G.isCollapsed(n)&&ee.delete(e,{unit:t})},ty=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&G.isExpanded(r)&&ee.delete(t,{reverse:n==="backward"})},ny=(e,t)=>[x.start(e,t),x.end(e,t)];function Bl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Tl(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){gt(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 ry=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,Tl(Tl({},n),{},{match:r=>fe.isElement(r)&&x.isElementReadOnly(t,r)}))},ay=(e,t)=>x.point(e,t,{edge:"end"}),iy=(e,t)=>{var n=x.path(e,t,{edge:"start"});return x.node(e,n)},sy=(e,t)=>{var n=x.range(e,t);return le.fragment(e,n)};function Sl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function jl(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){gt(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 oy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,jl(jl({},n),{},{match:r=>fe.isElement(r)&&x.isVoid(t,r)}))},uy=(e,t)=>t.children.some(n=>fe.isElement(n)&&x.isBlock(e,n)),ly=(e,t)=>t.children.some(n=>he.isText(n)||x.isInline(e,n)),cy=(e,t)=>le.has(e,t),dy=(e,t)=>t.children.every(n=>he.isText(n)),fy=e=>{ee.splitNodes(e,{always:!0})},my=(e,t,n)=>{ee.insertNodes(e,t,n)},hy=e=>{ee.splitNodes(e,{always:!0})};function Ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function py(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){gt(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 gy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a,marks:i}=t;if(a){if(i){var s=py({text:n},i);ee.insertNodes(t,s,{at:r.at,voids:r.voids})}else ee.insertText(t,n,r);t.marks=null}},vy=(e,t)=>!e.isInline(t),by=(e,t,n)=>x.isStart(e,t,n)||x.isEnd(e,t,n),yy=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&he.isText(r)&&r.text===""&&!e.isVoid(t)},xy=(e,t,n)=>{var r=x.end(e,n);return Fe.equals(t,r)},Cy=e=>{var t=Pf.get(e);return t===void 0?!0:t},wy=(e,t,n)=>{if(t.offset!==0)return!1;var r=x.start(e,n);return Fe.equals(t,r)},Dy=(e,t)=>{var n=x.path(e,t,{edge:"end"});return x.node(e,n)},Ey=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=le.leaf(t,a);return[i,a]};function _y(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var s=[],o=x.path(e,n);for(var[l,u]of le.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&fe.isElement(l)&&x.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var ky=["text"],Fy=["text"],Ay=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(G.isExpanded(r)){var s=x.isEnd(t,a,a.path);if(s){var o=x.after(t,a);o&&(a=o)}var[l]=x.nodes(t,{match:he.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,d=sn(u,ky);return d}else return{}}var{path:m}=a,[h]=x.leaf(t,m);if(a.offset===0){var p=x.previous(t,{at:m,match:he.isText}),g=x.above(t,{match:A=>fe.isElement(A)&&x.isVoid(t,A)&&t.markableVoid(A)});if(!g){var f=x.above(t,{match:A=>fe.isElement(A)&&x.isBlock(t,A)});if(p&&f){var[b,v]=p,[,C]=f;I.isAncestor(C,v)&&(h=b)}}}var D=sn(h,Fy);return D},By=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=x.after(t,s,{voids:a});if(o){var[,l]=x.last(t,[]),u=[o.path,l];if(I.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(I.isPath(s)){var[d]=x.parent(t,s);i=h=>d.children.includes(h)}else i=()=>!0;var[m]=x.nodes(t,{at:u,match:i,mode:r,voids:a});return m}}},Ty=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=le.get(t,a);return[i,a]};function Sy(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,d;if(p0.isSpan(n))u=n[0],d=n[1];else{var m=x.path(e,n,{edge:"start"}),h=x.path(e,n,{edge:"end"});u=i?h:m,d=i?m:h}var p=le.nodes(e,{reverse:i,from:u,to:d,pass:A=>{var[E]=A;return fe.isElement(E)?!!(!s&&(x.isVoid(e,E)||x.isElementReadOnly(e,E))||o&&!x.isSelectable(e,E)):!1}}),g=[],f;for(var[b,v]of p)if(!(o&&fe.isElement(b)&&!x.isSelectable(e,b))){var C=f&&I.compare(v,f[1])===0;if(!(r==="highest"&&C)){if(!l(b,v)){if(a&&!C&&he.isText(b))return;continue}if(r==="lowest"&&C){f=[b,v];continue}var D=r==="lowest"?f:[b,v];D&&(a?g.push(D):yield D),f=[b,v]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var jy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=d=>Ja.get(d)||[],s=d=>Xa.get(d)||new Set,o=d=>{var m=i(d).pop(),h=m.join(",");return s(d).delete(h),m};if(x.isNormalizing(t)){if(r){var l=Array.from(le.nodes(t),d=>{var[,m]=d;return m}),u=new Set(l.map(d=>d.join(",")));Ja.set(t,l),Xa.set(t,u)}i(t).length!==0&&x.withoutNormalizing(t,()=>{for(var d of i(t))if(le.has(t,d)){var m=x.node(t,d),[h,p]=m;fe.isElement(h)&&h.children.length===0&&t.normalizeNode(m,{operation:a})}for(var g=i(t),f=g.length,b=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:b,initialDirtyPathsLength:f,operation:a}))return;var v=o(t);if(le.has(t,v)){var C=x.node(t,v);t.normalizeNode(C,{operation:a})}b++,g=i(t)}})}},Oy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=I.parent(a),s=x.node(t,i);return s},Py=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.pathRefs(t);return l.delete(i),i.current=null,o}},s=x.pathRefs(t);return s.add(i),i},My=e=>{var t=ul.get(e);return t||(t=new Set,ul.set(e,t)),t},Ny=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(I.isPath(n)){if(i==="start"){var[,s]=le.first(t,n);n=s}else if(i==="end"){var[,o]=le.last(t,n);n=o}}return G.isRange(n)&&(i==="start"?n=G.start(n):i==="end"?n=G.end(n):n=I.common(n.anchor.path,n.focus.path)),Fe.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},Iy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.pointRefs(t);return l.delete(i),i.current=null,o}},s=x.pointRefs(t);return s.add(i),i},Ry=e=>{var t=ll.get(e);return t||(t=new Set,ll.set(e,t)),t},$y=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(I.isPath(n)){var i;if(a==="end"){var[,s]=le.last(t,n);i=s}else{var[,o]=le.first(t,n);i=o}var l=le.get(t,i);if(!he.isText(l))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?l.text.length:0}}if(G.isRange(n)){var[u,d]=G.edges(n);return a==="start"?u:d}return n};function Ly(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:a=!1,voids:i=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=x.range(e,n),[l,u]=G.edges(o),d=a?u:l,m=!1,h="",p=0,g=0,f=0;for(var[b,v]of x.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(fe.isElement(b)){if(!i&&(e.isVoid(b)||e.isElementReadOnly(b))){yield x.start(e,v);continue}if(e.isInline(b))continue;if(x.hasInlines(e,b)){var C=I.isAncestor(v,u.path)?u:x.end(e,v),D=I.isAncestor(v,l.path)?l:x.start(e,v);h=x.string(e,{anchor:D,focus:C},{voids:i}),m=!0}}if(he.isText(b)){var A=I.equals(v,d.path);for(A?(g=a?d.offset:b.text.length-d.offset,f=d.offset):(g=b.text.length,f=a?g:0),(A||m||r==="offset")&&(yield{path:v,offset:f},m=!1);;){if(p===0){if(h==="")break;p=E(h,r,a),h=Po(h,p,a)[1]}if(f=a?f-p:f+p,g=g-p,g<0){p=-g;break}p=0,yield{path:v,offset:f}}}}function E(k,T,$){return T==="character"?Oo(k,$):T==="word"?C0(k,$):T==="line"||T==="block"?k.length:1}}()}var zy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=x.before(t,s,{voids:a});if(o){var[,l]=x.first(t,[]),u=[o.path,l];if(I.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(I.isPath(s)){var[d]=x.parent(t,s);i=h=>d.children.includes(h)}else i=()=>!0;var[m]=x.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return m}}},qy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.rangeRefs(t);return l.delete(i),i.current=null,o}},s=x.rangeRefs(t);return s.add(i),i},Uy=e=>{var t=cl.get(e);return t||(t=new Set,cl.set(e,t)),t},Wy=(e,t,n)=>{if(G.isRange(t)&&!n)return t;var r=x.start(e,t),a=x.end(e,n||t);return{anchor:r,focus:a}};function Pl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Vy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Hy=(e,t)=>{var{selection:n}=e;if(n){var r=(d,m)=>{if(!he.isText(d))return!1;var[h,p]=x.parent(e,m);return!e.isVoid(h)||e.markableVoid(h)},a=G.isExpanded(n),i=!1;if(!a){var[s,o]=x.node(e,n);if(s&&r(s,o)){var[l]=x.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)ee.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Vy({},x.marks(e)||{});delete u[t],e.marks=u,Pr.get(e)||e.onChange()}}},Ky=(e,t)=>{Pf.set(e,t)},Zy=(e,t)=>x.point(e,t,{edge:"start"}),Yy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=x.range(t,n),[s,o]=G.edges(i),l="";for(var[u,d]of x.nodes(t,{at:i,match:he.isText,voids:a})){var m=u.text;I.equals(d,o.path)&&(m=m.slice(0,o.offset)),I.equals(d,s.path)&&(m=m.slice(s.offset)),l+=m}return l},Gy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=G.edges(n);if(i.offset!==0||s.offset!==0||G.isCollapsed(n)||I.hasPrevious(s.path))return n;var o=x.above(t,{at:s,match:g=>fe.isElement(g)&&x.isBlock(t,g),voids:a}),l=o?o[1]:[],u=x.start(t,i),d={anchor:u,focus:s},m=!0;for(var[h,p]of x.nodes(t,{at:d,match:he.isText,reverse:!0,voids:a})){if(m){m=!1;continue}if(h.text!==""||I.isBefore(p,l)){s={path:p,offset:h.text.length};break}}return{anchor:i,focus:s}},Qy=(e,t)=>{var n=x.isNormalizing(e);x.setNormalizing(e,!1);try{t()}finally{x.setNormalizing(e,n)}x.normalize(e)},Jy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:d=!1}=n;if(u){var m=!1;if(G.isRange(u)&&G.isCollapsed(u)&&(m=!0,u=u.anchor),Fe.isPoint(u)){var h=x.void(t,{at:u,mode:"highest"});if(!l&&h){var[,p]=h;u=p}else{var g={unit:s,distance:o},f=i?x.before(t,u,g)||x.start(t,[]):x.after(t,u,g)||x.end(t,[]);u={anchor:u,focus:f},d=!0}}if(I.isPath(u)){ee.removeNodes(t,{at:u,voids:l});return}if(!G.isCollapsed(u)){if(!d){var[,b]=G.edges(u),v=x.end(t,[]);Fe.equals(b,v)||(u=x.unhangRange(t,u,{voids:l}))}var[C,D]=G.edges(u),A=x.above(t,{match:ve=>fe.isElement(ve)&&x.isBlock(t,ve),at:C,voids:l}),E=x.above(t,{match:ve=>fe.isElement(ve)&&x.isBlock(t,ve),at:D,voids:l}),k=A&&E&&!I.equals(A[1],E[1]),T=I.equals(C.path,D.path),$=l?null:(r=x.void(t,{at:C,mode:"highest"}))!==null&&r!==void 0?r:x.elementReadOnly(t,{at:C,mode:"highest"}),P=l?null:(a=x.void(t,{at:D,mode:"highest"}))!==null&&a!==void 0?a:x.elementReadOnly(t,{at:D,mode:"highest"});if($){var z=x.before(t,C);z&&A&&I.isAncestor(A[1],z.path)&&(C=z)}if(P){var L=x.after(t,D);L&&E&&I.isAncestor(E[1],L.path)&&(D=L)}var B=[],F;for(var j of x.nodes(t,{at:u,voids:l})){var[O,q]=j;F&&I.compare(q,F)===0||(!l&&fe.isElement(O)&&(x.isVoid(t,O)||x.isElementReadOnly(t,O))||!I.isCommon(q,C.path)&&!I.isCommon(q,D.path))&&(B.push(j),F=q)}var W=Array.from(B,ve=>{var[,ye]=ve;return x.pathRef(t,ye)}),ne=x.pointRef(t,C),J=x.pointRef(t,D),w="";if(!T&&!$){var Q=ne.current,[se]=x.leaf(t,Q),{path:_}=Q,{offset:M}=C,U=se.text.slice(M);U.length>0&&(t.apply({type:"remove_text",path:_,offset:M,text:U}),w=U)}if(W.reverse().map(ve=>ve.unref()).filter(ve=>ve!==null).forEach(ve=>ee.removeNodes(t,{at:ve,voids:l})),!P){var S=J.current,[R]=x.leaf(t,S),{path:K}=S,Z=T?C.offset:0,re=R.text.slice(Z,D.offset);re.length>0&&(t.apply({type:"remove_text",path:K,offset:Z,text:re}),w=re)}!T&&k&&J.current&&ne.current&&ee.mergeNodes(t,{at:J.current,hanging:!0,voids:l}),m&&i&&s==="character"&&w.length>1&&w.match(/[\u0E00-\u0E7F]+/)&&ee.insertText(t,w.slice(0,w.length-o));var ce=ne.unref(),X=J.unref(),pe=i?ce||X:X||ce;n.at==null&&pe&&ee.select(t,pe)}}})},Xy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=jo(t),batchDirty:o=!0}=r;if(n.length){if(G.isRange(s))if(a||(s=x.unhangRange(t,s,{voids:i})),G.isCollapsed(s))s=s.anchor;else{var[,l]=G.edges(s);if(!i&&x.void(t,{at:l}))return;var u=x.pointRef(t,l);ee.delete(t,{at:s}),s=u.unref()}else I.isPath(s)&&(s=x.start(t,s));if(!(!i&&x.void(t,{at:s}))){var d=x.above(t,{at:s,match:U=>fe.isElement(U)&&x.isInline(t,U),mode:"highest",voids:i});if(d){var[,m]=d;if(x.isEnd(t,s,m)){var h=x.after(t,m);s=h}else if(x.isStart(t,s,m)){var p=x.before(t,m);s=p}}var g=x.above(t,{match:U=>fe.isElement(U)&&x.isBlock(t,U),at:s,voids:i}),[,f]=g,b=x.isStart(t,s,f),v=x.isEnd(t,s,f),C=b&&v,D=!b||b&&v,A=!v,[,E]=le.first({children:n},[]),[,k]=le.last({children:n},[]),T=[],$=U=>{var[S,R]=U,K=R.length===0;return K?!1:C?!0:!(D&&I.isAncestor(R,E)&&fe.isElement(S)&&!t.isVoid(S)&&!t.isInline(S)||A&&I.isAncestor(R,k)&&fe.isElement(S)&&!t.isVoid(S)&&!t.isInline(S))};for(var P of le.nodes({children:n},{pass:$}))$(P)&&T.push(P);var z=[],L=[],B=[],F=!0,j=!1;for(var[O]of T)fe.isElement(O)&&!t.isInline(O)?(F=!1,j=!0,L.push(O)):F?z.push(O):B.push(O);var[q]=x.nodes(t,{at:s,match:U=>he.isText(U)||x.isInline(t,U),mode:"highest",voids:i}),[,W]=q,ne=x.isStart(t,s,W),J=x.isEnd(t,s,W),w=x.pathRef(t,v&&!B.length?I.next(f):f),Q=x.pathRef(t,J?I.next(W):W);ee.splitNodes(t,{at:s,match:U=>j?fe.isElement(U)&&x.isBlock(t,U):he.isText(U)||x.isInline(t,U),mode:j?"lowest":"highest",always:j&&(!b||z.length>0)&&(!v||B.length>0),voids:i});var se=x.pathRef(t,!ne||ne&&J?I.next(W):W);if(ee.insertNodes(t,z,{at:se.current,match:U=>he.isText(U)||x.isInline(t,U),mode:"highest",voids:i,batchDirty:o}),C&&!z.length&&L.length&&!B.length&&ee.delete(t,{at:f,voids:i}),ee.insertNodes(t,L,{at:w.current,match:U=>fe.isElement(U)&&x.isBlock(t,U),mode:"lowest",voids:i,batchDirty:o}),ee.insertNodes(t,B,{at:Q.current,match:U=>he.isText(U)||x.isInline(t,U),mode:"highest",voids:i,batchDirty:o}),!r.at){var _;if(B.length>0&&Q.current?_=I.previous(Q.current):L.length>0&&w.current?_=I.previous(w.current):se.current&&(_=I.previous(se.current)),_){var M=x.end(t,_);ee.select(t,M)}}se.unref(),w.unref(),Q.unref()}}})},ex=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")ee.select(t,a.anchor);else if(r==="focus")ee.select(t,a.focus);else if(r==="start"){var[i]=G.edges(a);ee.select(t,i)}else if(r==="end"){var[,s]=G.edges(a);ee.select(t,s)}}else return},tx=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},nx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:a=1,unit:i="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=G.isBackward(r)?"focus":"anchor"),o==="end"&&(o=G.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:a,unit:i,ignoreNonSelectable:!0},m={};if(o==null||o==="anchor"){var h=s?x.before(t,l,d):x.after(t,l,d);h&&(m.anchor=h)}if(o==null||o==="focus"){var p=s?x.before(t,u,d):x.after(t,u,d);p&&(m.focus=p)}ee.setSelection(t,m)}},rx=(e,t)=>{var{selection:n}=e;if(t=x.range(e,t),n){ee.setSelection(e,t);return}if(!G.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 Ml(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Nl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ml(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ml(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ax=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a}=t,{edge:i="both"}=r;if(a){i==="start"&&(i=G.isBackward(a)?"focus":"anchor"),i==="end"&&(i=G.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;ee.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Nl(Nl({},l),n)})}},ix=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!Fe.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!Fe.equals(t.focus,n.focus)||i!=="anchor"&&i!=="focus"&&t[i]!==n[i])&&(r[i]=n[i],a[i]=t[i]);Object.keys(r).length>0&&e.apply({type:"set_selection",properties:r,newProperties:a})}},sx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:d}=r;if(le.isNode(n)&&(n=[n]),n.length!==0){var[m]=n;if(l||(l=jo(t),d!==!1&&(d=!0)),d==null&&(d=!1),G.isRange(l))if(a||(l=x.unhangRange(t,l,{voids:i})),G.isCollapsed(l))l=l.anchor;else{var[,h]=G.edges(l),p=x.pointRef(t,h);ee.delete(t,{at:l}),l=p.unref()}if(Fe.isPoint(l)){u==null&&(he.isText(m)?u=z=>he.isText(z):t.isInline(m)?u=z=>he.isText(z)||x.isInline(t,z):u=z=>fe.isElement(z)&&x.isBlock(t,z));var[g]=x.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,b=x.pathRef(t,f),v=x.isEnd(t,l,f);ee.splitNodes(t,{at:l,match:u,mode:s,voids:i});var C=b.unref();l=v?I.next(C):C}else return}var D=I.parent(l),A=l[l.length-1];if(!(!i&&x.void(t,{at:D}))){if(o){var E=[],k=I.levels(D);U0(t,()=>{var z=function(){var F=D.concat(A);A++;var j={type:"insert_node",path:F,node:L};t.apply(j),l=I.next(l),E.push(j),he.isText?k.push(...Array.from(le.nodes(L),O=>{var[,q]=O;return F.concat(q)})):k.push(F)};for(var L of n)z()},()=>{Nf(t,k,z=>{var L=z;for(var B of E)if(I.operationCanTransformPath(B)&&(L=I.transform(L,B),!L))return null;return L})})}else for(var T of n){var $=D.concat(A);A++,t.apply({type:"insert_node",path:$,node:T}),l=I.next(l)}if(l=I.previous(l),d){var P=x.end(t,l);P&&ee.select(t,P)}}}})},ox=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=I.isPath(r)?br(t,r):A=>fe.isElement(A)&&x.isBlock(t,A)),!!r){var o=x.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,A=>{var[,E]=A;return x.pathRef(t,E)});for(var u of l){var d=u.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=x.node(t,I.parent(d)),[h,p]=m,g=d[d.length-1],{length:f}=h.children;if(f===1){var b=I.next(p);ee.moveNodes(t,{at:d,to:b,voids:i}),ee.removeNodes(t,{at:p,voids:i})}else if(g===0)ee.moveNodes(t,{at:d,to:p,voids:i});else if(g===f-1){var v=I.next(p);ee.moveNodes(t,{at:d,to:v,voids:i})}else{var C=I.next(d),D=I.next(p);ee.splitNodes(t,{at:C,voids:i}),ee.moveNodes(t,{at:d,to:D,voids:i})}}}})},ux=["text"],lx=["children"],If=(e,t)=>{if(fe.isElement(t)){var n=t;return x.isVoid(e,t)?!0:n.children.length===1?If(e,n.children[0]):!1}else return!x.isEditor(t)},cx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(I.isPath(a)){var[l]=x.parent(t,a);r=z=>l.children.includes(z)}else r=z=>fe.isElement(z)&&x.isBlock(t,z);if(!i&&G.isRange(a)&&(a=x.unhangRange(t,a,{voids:s})),G.isRange(a))if(G.isCollapsed(a))a=a.anchor;else{var[,u]=G.edges(a),d=x.pointRef(t,u);ee.delete(t,{at:a}),a=d.unref(),n.at==null&&ee.select(t,a)}var[m]=x.nodes(t,{at:a,match:r,voids:s,mode:o}),h=x.previous(t,{at:a,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=I.next(b),C=I.common(g,b),D=I.isSibling(g,b),A=Array.from(x.levels(t,{at:g}),z=>{var[L]=z;return L}).slice(C.length).slice(0,-1),E=x.above(t,{at:g,mode:"highest",match:z=>A.includes(z)&&If(t,z)}),k=E&&x.pathRef(t,E[1]),T,$;if(he.isText(p)&&he.isText(f)){var P=sn(p,ux);$=f.text.length,T=P}else if(fe.isElement(p)&&fe.isElement(f)){var P=sn(p,lx);$=f.children.length,T=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)));D||ee.moveNodes(t,{at:g,to:v,voids:s}),k&&ee.removeNodes(t,{at:k.current,voids:s}),fe.isElement(f)&&x.isEmpty(t,f)||he.isText(f)&&f.text===""&&b[b.length-1]!==0?ee.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:v,position:$,properties:T}),k&&k.unref()}}}})},dx=(e,t)=>{x.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=I.isPath(r)?br(e,r):p=>fe.isElement(p)&&x.isBlock(e,p));var o=x.pathRef(e,n),l=x.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,p=>{var[,g]=p;return x.pathRef(e,g)});for(var d of u){var m=d.unref(),h=o.current;m.length!==0&&e.apply({type:"move_node",path:m,newPath:h}),o.current&&I.isSibling(h,m)&&I.isAfter(h,m)&&(o.current=I.next(o.current))}o.unref()}})},fx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=I.isPath(s)?br(t,s):p=>fe.isElement(p)&&x.isBlock(t,p)),!r&&G.isRange(s)&&(s=x.unhangRange(t,s,{voids:a}));var l=x.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,p=>{var[,g]=p;return x.pathRef(t,g)});for(var d of u){var m=d.unref();if(m){var[h]=x.node(t,m);t.apply({type:"remove_node",path:m,node:h})}}}})},mx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:d=!1,voids:m=!1}=r;if(i){if(a==null&&(a=I.isPath(i)?br(t,i):$=>fe.isElement($)&&x.isBlock(t,$)),!l&&G.isRange(i)&&(i=x.unhangRange(t,i,{voids:m})),d&&G.isRange(i)){if(G.isCollapsed(i)&&x.leaf(t,i.anchor)[0].text.length>0)return;var h=x.rangeRef(t,i,{affinity:"inward"}),[p,g]=G.edges(i),f=u==="lowest"?"lowest":"highest",b=x.isEnd(t,g,g.path);ee.splitNodes(t,{at:g,match:a,mode:f,voids:m,always:!b});var v=x.isStart(t,p,p.path);ee.splitNodes(t,{at:p,match:a,mode:f,voids:m,always:!v}),i=h.unref(),r.at==null&&ee.select(t,i)}s||(s=($,P)=>$!==P);for(var[C,D]of x.nodes(t,{at:i,match:a,mode:u,voids:m})){var A={},E={};if(D.length!==0){var k=!1;for(var T in n)T==="children"||T==="text"||s(n[T],C[T])&&(k=!0,C.hasOwnProperty(T)&&(A[T]=C[T]),o?n[T]!=null&&(E[T]=o(C[T],n[T])):n[T]!=null&&(E[T]=n[T]));k&&t.apply({type:"set_node",path:D,properties:A,newProperties:E})}}}})},hx=(e,t)=>{if(G.isCollapsed(t))return t.anchor;var[,n]=G.edges(t),r=x.pointRef(e,n);return ee.delete(e,{at:t}),r.unref()},px=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=J=>fe.isElement(J)&&x.isBlock(t,J)),G.isRange(s)&&(s=hx(t,s)),I.isPath(s)){var u=s,d=x.point(t,u),[m]=x.parent(t,u);i=J=>J===m,o=d.path.length-u.length+1,s=d,l=!0}if(s){var h=x.pointRef(t,s,{affinity:"backward"}),p;try{var[g]=x.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=x.void(t,{at:s,mode:"highest"}),b=0;if(!a&&f){var[v,C]=f;if(fe.isElement(v)&&t.isInline(v)){var D=x.after(t,C);if(!D){var A={text:""},E=I.next(C);ee.insertNodes(t,A,{at:E,voids:a}),D=x.point(t,E)}s=D,l=!0}var k=s.path.length-C.length;o=k+1,l=!0}p=x.pointRef(t,s);var T=s.path.length-o,[,$]=g,P=s.path.slice(0,T),z=o===0?s.offset:s.path[T]+b;for(var[L,B]of x.levels(t,{at:P,reverse:!0,voids:a})){var F=!1;if(B.length<$.length||B.length===0||!a&&fe.isElement(L)&&x.isVoid(t,L))break;var j=h.current,O=x.isEnd(t,j,B);if(l||!h||!x.isEdge(t,j,B)){F=!0;var q=le.extractProps(L);t.apply({type:"split_node",path:B,position:z,properties:q})}z=B[B.length-1]+(F||O?1:0)}if(n.at==null){var W=p.current||x.end(t,[]);ee.select(t,W)}}finally{var ne;h.unref(),(ne=p)===null||ne===void 0||ne.unref()}}})},gx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var a={};for(var i of n)a[i]=null;ee.setNodes(t,a,r)},vx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=I.isPath(s)?br(t,s):p=>fe.isElement(p)&&x.isBlock(t,p)),I.isPath(s)&&(s=x.range(t,s));var l=G.isRange(s)?x.rangeRef(t,s):null,u=x.nodes(t,{at:s,match:o,mode:r,voids:i}),d=Array.from(u,p=>{var[,g]=p;return x.pathRef(t,g)}).reverse(),m=function(){var g=h.unref(),[f]=x.node(t,g),b=x.range(t,g);a&&l&&(b=G.intersection(l.current,b)),ee.liftNodes(t,{at:b,match:v=>fe.isAncestor(f)&&f.children.includes(v),voids:i})};for(var h of d)m();l&&l.unref()}})};function Il(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Rl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Il(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Il(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var bx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(I.isPath(l)?o=br(t,l):t.isInline(n)?o=b=>fe.isElement(b)&&x.isInline(t,b)||he.isText(b):o=b=>fe.isElement(b)&&x.isBlock(t,b)),i&&G.isRange(l)){var[u,d]=G.edges(l),m=x.rangeRef(t,l,{affinity:"inward"});ee.splitNodes(t,{at:d,match:o,voids:s}),ee.splitNodes(t,{at:u,match:o,voids:s}),l=m.unref(),r.at==null&&ee.select(t,l)}var h=Array.from(x.nodes(t,{at:l,match:t.isInline(n)?b=>fe.isElement(b)&&x.isBlock(t,b):b=>x.isEditor(b),mode:"lowest",voids:s})),p=function(){var v=G.isRange(l)?G.intersection(l,x.range(t,f)):l;if(!v)return 0;var C=Array.from(x.nodes(t,{at:v,match:o,mode:a,voids:s}));if(C.length>0){var[D]=C,A=C[C.length-1],[,E]=D,[,k]=A;if(E.length===0&&k.length===0)return 0;var T=I.equals(E,k)?I.parent(E):I.common(E,k),$=x.range(t,E,k),P=x.node(t,T),[z]=P,L=T.length+1,B=I.next(k.slice(0,L)),F=Rl(Rl({},n),{},{children:[]});ee.insertNodes(t,F,{at:B,voids:s}),ee.moveNodes(t,{at:$,match:j=>fe.isAncestor(z)&&z.children.includes(j),to:B.concat(0),voids:s})}},g;for(var[,f]of h)g=p()}})},yx=()=>{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),a=0;a<n;a++)r[a]=arguments[a];return W0(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return G0(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return X0(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ey(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ty(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return H0(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fy(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hy(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xy(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return my(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gy(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return K0(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hy(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return V0(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Z0(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Y0(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Q0(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return J0(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ex(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jy(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tx(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ny(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ry(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ay(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iy(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sy(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ay(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uy(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ly(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cy(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dy(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sx(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vy(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return by(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yy(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xy(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cy(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wy(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dy(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ey(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _y(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ox(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cx(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nx(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dx(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return By(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ty(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sy(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jy(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Oy(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ny(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Py(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return My(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $y(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Iy(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ry(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ly(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zy(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wy(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qy(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Uy(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fx(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rx(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mx(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ky(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ax(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ix(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return px(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zy(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yy(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gy(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gx(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vx(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return oy(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qy(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bx(e,...r)}};return e},Tn=[],xx=function(){return Tn.some(function(e){return e.activeTargets.length>0})},Cx=function(){return Tn.some(function(e){return e.skippedTargets.length>0})},$l="ResizeObserver loop completed with undelivered notifications.",wx=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:$l}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=$l),window.dispatchEvent(e)},Hr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Hr||(Hr={}));var Sn=function(e){return Object.freeze(e)},Dx=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,Sn(this)}return e}(),Rf=function(){function e(t,n,r,a){return this.x=t,this.y=n,this.width=r,this.height=a,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Sn(this)}return e.prototype.toJSON=function(){var t=this,n=t.x,r=t.y,a=t.top,i=t.right,s=t.bottom,o=t.left,l=t.width,u=t.height;return{x:n,y:r,top:a,right:i,bottom:s,left:o,width:l,height:u}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),Mo=function(e){return e instanceof SVGElement&&"getBBox"in e},$f=function(e){if(Mo(e)){var t=e.getBBox(),n=t.width,r=t.height;return!n&&!r}var a=e,i=a.offsetWidth,s=a.offsetHeight;return!(i||s||e.getClientRects().length)},Ll=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)},Ex=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},Mr=typeof window<"u"?window:{},pa=new WeakMap,zl=/auto|scroll/,_x=/^tb|vertical/,kx=/msie|trident/i.test(Mr.navigator&&Mr.navigator.userAgent),Ut=function(e){return parseFloat(e||"0")},ar=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new Dx((n?t:e)||0,(n?e:t)||0)},ql=Sn({devicePixelContentBoxSize:ar(),borderBoxSize:ar(),contentBoxSize:ar(),contentRect:new Rf(0,0,0,0)}),Lf=function(e,t){if(t===void 0&&(t=!1),pa.has(e)&&!t)return pa.get(e);if($f(e))return pa.set(e,ql),ql;var n=getComputedStyle(e),r=Mo(e)&&e.ownerSVGElement&&e.getBBox(),a=!kx&&n.boxSizing==="border-box",i=_x.test(n.writingMode||""),s=!r&&zl.test(n.overflowY||""),o=!r&&zl.test(n.overflowX||""),l=r?0:Ut(n.paddingTop),u=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+u,v=l+d,C=f+p,D=h+g,A=o?e.offsetHeight-D-e.clientHeight:0,E=s?e.offsetWidth-C-e.clientWidth:0,k=a?b+C:0,T=a?v+D:0,$=r?r.width:Ut(n.width)-k-E,P=r?r.height:Ut(n.height)-T-A,z=$+b+E+C,L=P+v+A+D,B=Sn({devicePixelContentBoxSize:ar(Math.round($*devicePixelRatio),Math.round(P*devicePixelRatio),i),borderBoxSize:ar(z,L,i),contentBoxSize:ar($,P,i),contentRect:new Rf(m,l,$,P)});return pa.set(e,B),B},zf=function(e,t,n){var r=Lf(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Hr.DEVICE_PIXEL_CONTENT_BOX:return s;case Hr.BORDER_BOX:return a;default:return i}},Fx=function(){function e(t){var n=Lf(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=Sn([n.borderBoxSize]),this.contentBoxSize=Sn([n.contentBoxSize]),this.devicePixelContentBoxSize=Sn([n.devicePixelContentBoxSize])}return e}(),qf=function(e){if($f(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},Ax=function(){var e=1/0,t=[];Tn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new Fx(u.target),m=qf(u.target);o.push(d),u.lastReportedSize=zf(u.target,u.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 a=r[n];a()}return e},Ul=function(e){Tn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(qf(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},Bx=function(){var e=0;for(Ul(e);xx();)e=Ax(),Ul(e);return Cx()&&wx(),e>0},Vi,Uf=[],Tx=function(){return Uf.splice(0).forEach(function(e){return e()})},Sx=function(e){if(!Vi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Tx()}).observe(n,r),Vi=function(){n.textContent="".concat(t?t--:t++)}}Uf.push(e),Vi()},jx=function(e){Sx(function(){requestAnimationFrame(e)})},ja=0,Ox=function(){return!!ja},Px=250,Mx={attributes:!0,characterData:!0,childList:!0,subtree:!0},Wl=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Vl=function(e){return e===void 0&&(e=0),Date.now()+e},Hi=!1,Nx=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=Px),!Hi){Hi=!0;var r=Vl(t);jx(function(){var a=!1;try{a=Bx()}finally{if(Hi=!1,t=r-Vl(),!Ox())return;a?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,Mx)};document.body?n():Mr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Wl.forEach(function(n){return Mr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Wl.forEach(function(n){return Mr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),zs=new Nx,Hl=function(e){!ja&&e>0&&zs.start(),ja+=e,!ja&&zs.stop()},Ix=function(e){return!Mo(e)&&!Ex(e)&&getComputedStyle(e).display==="inline"},Rx=function(){function e(t,n){this.target=t,this.observedBox=n||Hr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=zf(this.target,this.observedBox,!0);return Ix(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),$x=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),ga=new WeakMap,Kl=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},va=function(){function e(){}return e.connect=function(t,n){var r=new $x(t,n);ga.set(t,r)},e.observe=function(t,n,r){var a=ga.get(t),i=a.observationTargets.length===0;Kl(a.observationTargets,n)<0&&(i&&Tn.push(a),a.observationTargets.push(new Rx(n,r&&r.box)),Hl(1),zs.schedule())},e.unobserve=function(t,n){var r=ga.get(t),a=Kl(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&Tn.splice(Tn.indexOf(r),1),r.observationTargets.splice(a,1),Hl(-1))},e.disconnect=function(t){var n=this,r=ga.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Lx=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.");va.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(!Ll(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");va.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(!Ll(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");va.unobserve(this,t)},e.prototype.disconnect=function(){va.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),dn={};Object.defineProperty(dn,"__esModule",{value:!0});var zx=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Ki={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Wf={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:zx?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},No={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 ba=1;ba<20;ba++)No["f"+ba]=111+ba;function bi(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Vf(s,t)}),a=function(o){return r.some(function(l){return Hf(l,o)})},i=n==null?a:a(n);return i}function qx(e,t){return bi(e,t)}function Ux(e,t){return bi(e,{byKey:!0},t)}function Vf(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in Ki)r[Ki[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var d=a[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=Io(h),f=Ki[g];if(h.length>1&&!f&&!Wf[h]&&!No[g])throw new TypeError('Unknown modifier: "'+h+'"');(i===1||!f)&&(n?r.key=g:r.which=Kf(h)),f&&(r[f]=p?null:!0)}}catch(b){l=!0,u=b}finally{try{!o&&d.return&&d.return()}finally{if(l)throw u}}return r}function Hf(e,t){for(var n in e){var r=e[n],a=void 0;if(r!=null&&(n==="key"&&t.key!=null?a=t.key.toLowerCase():n==="which"?a=r===91&&t.which===93?91:t.which:a=t[n],!(a==null&&r===!1)&&a!==r))return!1}return!0}function Kf(e){e=Io(e);var t=No[e]||e.toUpperCase().charCodeAt(0);return t}function Io(e){return e=e.toLowerCase(),e=Wf[e]||e,e}var Wx=dn.default=bi,Zi=dn.isHotkey=bi;dn.isCodeHotkey=qx;dn.isKeyHotkey=Ux;dn.parseHotkey=Vf;dn.compareHotkey=Hf;dn.toKeyCode=Kf;dn.toKeyName=Io;function Vx(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function fr(e,t){if(e==null)return{};var n=Vx(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Kr(e){"@babel/helpers - typeof";return Kr=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},Kr(e)}function Hx(e,t){if(Kr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Kr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Kx(e){var t=Hx(e,"string");return Kr(t)==="symbol"?t:String(t)}function Mt(e,t,n){return t=Kx(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ro=y.createContext(null),wn=()=>{var e=y.useContext(Ro);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Zf=parseInt(y.version.split(".")[0],10),Zx=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Zl=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),pt=typeof navigator<"u"&&/Android/.test(navigator.userAgent),er=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Sr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),Yx=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Yf=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Gx=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Qx=pt&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),Jx=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),Xx=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),e1=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),Oa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",fn=(!Gx||!Qx)&&!Yx&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",$o=new WeakMap,Lo=new WeakMap,Gf=new WeakMap,Pa=new WeakMap,qs=new WeakMap,Zr=new WeakMap,jn=new WeakMap,ei=new WeakMap,yi=new WeakMap,Us=new WeakMap,bn=new WeakMap,Bn=new WeakMap,Nr=new WeakMap,Ws=new WeakMap,zo=new WeakMap,$t=new WeakMap,rn=new WeakMap,xt=new WeakMap,hn=new WeakMap,pn=new WeakMap,Qf=new WeakMap,mr=Symbol("placeholder"),Jf=Symbol("mark-placeholder"),t1=globalThis.Text,qo=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,n1=e=>yn(e)&&e.nodeType===8,Pt=e=>yn(e)&&e.nodeType===1,yn=e=>{var t=qo(e);return!!t&&e instanceof t.Node},Vs=e=>{var t=e&&e.anchorNode&&qo(e.anchorNode);return!!t&&e instanceof t.Selection},Xf=e=>yn(e)&&e.nodeType===3,r1=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,a1=e=>{var[t,n]=e;if(Pt(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=em(t,a,r?"backward":"forward"),r=a<n;Pt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=s1(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},i1=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},em=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(n1(a)||Pt(a)&&a.childNodes.length===0||Pt(a)&&a.getAttribute("contenteditable")==="false")&&!(s&&o);){if(i>=r.length){s=!0,i=t-1,n="backward";continue}if(i<0){o=!0,i=t+1,n="forward";continue}a=r[i],t=i,i+=n==="forward"?1:-1}return[a,t]},s1=(e,t,n)=>{var[r]=em(e,t,n);return r},tm=e=>{var t="";if(Xf(e)&&e.nodeValue)return e.nodeValue;if(Pt(e)){for(var n of Array.from(e.childNodes))t+=tm(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
72
- `)}return t},o1=/data-slate-fragment="(.+?)"/m,u1=e=>{var t=e.getData("text/html"),[,n]=t.match(o1)||[];return n},Uo=(e,t,n)=>{var{target:r}=t;if(Pt(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=te.getWindow(e);if(a.contains(r))return te.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var d of l)if(d===r||d.contains(r))return!0});return!i||i===t?!1:Uo(e,i,n)},l1=0;class c1{constructor(){Mt(this,"id",void 0),this.id="".concat(l1++)}}var te={androidPendingDiffs:e=>xt.get(e),androidScheduleFlush:e=>{var t;(t=zo.get(e))===null||t===void 0||t()},blur:e=>{var t=te.toDOMNode(e,e),n=te.findDocumentOrShadowRoot(e);bn.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=te.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&ee.deselect(e)},findDocumentOrShadowRoot:e=>{var t=te.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:a}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i=te.toSlateNode(e,t.target),s=te.findPath(e,i);if(fe.isElement(i)&&x.isVoid(e,i)){var o=a.getBoundingClientRect(),l=e.isInline(i)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,u=x.point(e,s,{edge:l?"start":"end"}),d=l?x.before(e,u):x.after(e,u);if(d){var m=x.range(e,d);return m}}var h,{document:p}=te.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=te.toSlateRange(e,h,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=ei.get(t);return n||(n=new c1,ei.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=Lo.get(r);if(a==null){if(x.isEditor(r))return n;break}var i=$o.get(r);if(i==null)break;n.unshift(i),r=a}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(()=>{te.focus(t,{retries:n.retries-1})},10);return}var r=te.toDOMNode(t,t),a=te.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=te.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(ee.select(t,x.start(t,[])),t.onChange()),bn.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=Gf.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:a=!1}=r,i=te.toDOMNode(t,t),s;try{s=Pt(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]")===i&&(!a||s.isContentEditable?!0:typeof s.isContentEditable=="boolean"&&s.closest('[contenteditable="false"]')===i||!!s.getAttribute("data-slate-zero-width")):!1},hasEditableTarget:(e,t)=>yn(t)&&te.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return x.hasPath(e,n.path)&&x.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>te.hasEditableTarget(e,t)||te.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>yn(t)&&te.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=>!!Us.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Us.get(e))return!1;var n=te.hasTarget(e,t)&&te.toSlateNode(e,t);return fe.isElement(n)&&x.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=yi.get(e),r=x.isEditor(t)?Pa.get(e):n==null?void 0:n.get(te.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]=x.node(e,t.path),r=te.toDOMNode(e,n),a;x.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],d=u.childNodes[0];if(!(d==null||d.textContent==null)){var{length:m}=d.textContent,h=u.getAttribute("data-slate-length"),p=h==null?m:parseInt(h,10),g=o+p,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var b,v=f.childNodes[0];a=[v instanceof t1?v:f,(b=f.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var C=Math.min(m,Math.max(0,t.offset-o));a=[d,C];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(at.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=G.isBackward(t),i=te.toDOMPoint(e,n),s=G.isCollapsed(t)?i:te.toDOMPoint(e,r),o=te.getWindow(e),l=o.document.createRange(),[u,d]=a?s:i,[m,h]=a?i:s,p=Pt(u)?u:u.parentElement,g=!!p.getAttribute("data-slate-zero-width"),f=Pt(m)?m:m.parentElement,b=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:d),l.setEnd(m,b?1:h),l},toSlateNode:(e,t)=>{var n=Pt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Zr.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:a}=n,[i,s]=r?t:a1(t),o=i.parentNode,l=null,u=0;if(o){var d,m,h=te.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(l=f.closest('[data-slate-node="text"]'),l){var v=te.getWindow(e),C=v.document.createRange();C.setStart(l,0),C.setEnd(i,s);var D=C.cloneContents(),A=[...Array.prototype.slice.call(D.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(D.querySelectorAll("[contenteditable=false]"))];A.forEach(j=>{if(pt&&!r&&j.hasAttribute("data-slate-zero-width")&&j.textContent.length>0&&j.textContext!=="\uFEFF"){j.textContent.startsWith("\uFEFF")&&(j.textContent=j.textContent.slice(1));return}j.parentNode.removeChild(j)}),u=D.textContent.length,b=l}}else if(g){for(var E=g.querySelectorAll("[data-slate-leaf]"),k=0;k<E.length;k++){var T=E[k];if(te.hasDOMNode(e,T)){f=T;break}}f?(l=f.closest('[data-slate-node="text"]'),b=f,u=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(j=>{u-=j.textContent.length})):u=1}b&&u===b.textContent.length&&pt&&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 el(e){return Object.prototype.toString.call(e)==="[object Object]"}function st(e){var t,n;return el(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(el(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Bf=Symbol.for("immer-nothing"),tl=Symbol.for("immer-draftable"),kt=Symbol.for("immer-state"),Wb=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 Ct(e,...t){if(process.env.NODE_ENV!=="production"){const n=Wb[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 dr=Object.getPrototypeOf;function Mn(e){return!!e&&!!e[kt]}function Nn(e){var t;return e?Tf(e)||Array.isArray(e)||!!e[tl]||!!((t=e.constructor)!=null&&t[tl])||pi(e)||gi(e):!1}var Vb=Object.prototype.constructor.toString();function Tf(e){if(!e||typeof e!="object")return!1;const t=dr(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)===Vb}function Ya(e,t){hi(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function hi(e){const t=e[kt];return t?t.type_:Array.isArray(e)?1:pi(e)?2:gi(e)?3:0}function Ms(e,t){return hi(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Sf(e,t,n){const r=hi(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Hb(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function pi(e){return e instanceof Map}function gi(e){return e instanceof Set}function Fn(e){return e.copy_||e.base_}function Ns(e,t){if(pi(e))return new Map(e);if(gi(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Tf(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[kt];let a=Reflect.ownKeys(r);for(let i=0;i<a.length;i++){const s=a[i],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(dr(e),r)}else{const r=dr(e);if(r!==null&&n)return{...e};const a=Object.create(r);return Object.assign(a,e)}}function Bo(e,t=!1){return vi(e)||Mn(e)||!Nn(e)||(hi(e)>1&&(e.set=e.add=e.clear=e.delete=Kb),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Bo(r,!0))),e}function Kb(){Ct(2)}function vi(e){return Object.isFrozen(e)}var Zb={};function In(e){const t=Zb[e];return t||Ct(0,e),t}var Ur;function jf(){return Ur}function Yb(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function nl(e,t){t&&(In("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Is(e){Rs(e),e.drafts_.forEach(Gb),e.drafts_=null}function Rs(e){e===Ur&&(Ur=e.parent_)}function rl(e){return Ur=Yb(Ur,e)}function Gb(e){const t=e[kt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function al(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[kt].modified_&&(Is(t),Ct(4)),Nn(e)&&(e=Ga(t,e),t.parent_||Qa(t,e)),t.patches_&&In("Patches").generateReplacementPatches_(n[kt].base_,e,t.patches_,t.inversePatches_)):e=Ga(t,n,[]),Is(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Bf?e:void 0}function Ga(e,t,n){if(vi(t))return t;const r=t[kt];if(!r)return Ya(t,(a,i)=>il(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Qa(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const a=r.copy_;let i=a,s=!1;r.type_===3&&(i=new Set(a),a.clear(),s=!0),Ya(i,(o,l)=>il(e,r,a,o,l,n,s)),Qa(e,a,!1),n&&e.patches_&&In("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function il(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&Ct(5),Mn(a)){const o=i&&t&&t.type_!==3&&!Ms(t.assigned_,r)?i.concat(r):void 0,l=Ga(e,a,o);if(Sf(n,r,l),Mn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Nn(a)&&!vi(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ga(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Qa(e,a)}}function Qa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Bo(t,n)}function Qb(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:jf(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=To;n&&(a=[r],i=Wr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var To={get(e,t){if(t===kt)return e;const n=Fn(e);if(!Ms(n,t))return Jb(e,n,t);const r=n[t];return e.finalized_||!Nn(r)?r:r===Ui(e.base_,t)?(Wi(e),e.copy_[t]=Ls(r,e)):r},has(e,t){return t in Fn(e)},ownKeys(e){return Reflect.ownKeys(Fn(e))},set(e,t,n){const r=Of(Fn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=Ui(Fn(e),t),i=a==null?void 0:a[kt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Hb(n,a)&&(n!==void 0||Ms(e.base_,t)))return!0;Wi(e),$s(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 Ui(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Wi(e),$s(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Fn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){Ct(11)},getPrototypeOf(e){return dr(e.base_)},setPrototypeOf(){Ct(12)}},Wr={};Ya(To,(e,t)=>{Wr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Wr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Ct(13),Wr.set.call(this,e,t,void 0)};Wr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Ct(14),To.set.call(this,e[0],t,n,e[0])};function Ui(e,t){const n=e[kt];return(n?Fn(n):e)[t]}function Jb(e,t,n){var a;const r=Of(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Of(e,t){if(!(t in e))return;let n=dr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=dr(n)}}function $s(e){e.modified_||(e.modified_=!0,e.parent_&&$s(e.parent_))}function Wi(e){e.copy_||(e.copy_=Ns(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Xb=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,d=>n.call(this,d,...u))}}typeof n!="function"&&Ct(6),r!==void 0&&typeof r!="function"&&Ct(7);let a;if(Nn(t)){const i=rl(this),s=Ls(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?Is(i):Rs(i)}return nl(i,r),al(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===Bf&&(a=void 0),this.autoFreeze_&&Bo(a,!0),r){const i=[],s=[];In("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else Ct(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,l=>t(l,...o));let r,a;return[this.produce(t,n,(s,o)=>{r=s,a=o}),r,a]},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){Nn(e)||Ct(8),Mn(e)&&(e=e0(e));const t=rl(this),n=Ls(e,void 0);return n[kt].isManual_=!0,Rs(t),n}finishDraft(e,t){const n=e&&e[kt];(!n||!n.isManual_)&&Ct(9);const{scope_:r}=n;return nl(r,t),al(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 a=t[n];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}n>-1&&(t=t.slice(n+1));const r=In("Patches").applyPatches_;return Mn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function Ls(e,t){const n=pi(e)?In("MapSet").proxyMap_(e,t):gi(e)?In("MapSet").proxySet_(e,t):Qb(e,t);return(t?t.scope_:jf()).drafts_.push(n),n}function e0(e){return Mn(e)||Ct(10,e),Pf(e)}function Pf(e){if(!Nn(e)||vi(e))return e;const t=e[kt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ns(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ns(e,!0);return Ya(n,(r,a)=>{Sf(n,r,Pf(a))}),t&&(t.finalized_=!1),n}var Ft=new Xb,So=Ft.produce;Ft.produceWithPatches.bind(Ft);Ft.setAutoFreeze.bind(Ft);Ft.setUseStrictShallowCopy.bind(Ft);Ft.applyPatches.bind(Ft);var sl=Ft.createDraft.bind(Ft),ol=Ft.finishDraft.bind(Ft),t0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=I.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},n0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Fe.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},r0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=G.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Ja=new WeakMap,Xa=new WeakMap,Pr=new WeakMap,Mf=new WeakMap,ul=new WeakMap,ll=new WeakMap,cl=new WeakMap,I={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=I.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 a=e[r],i=t[r];if(a!==i)break;n.push(a)}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),a=t.slice(0,n),i=e[n],s=t[n];return I.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return I.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return I.equals(r,a)&&i<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 I.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&I.compare(e,t)===0},isBefore(e,t){return I.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&I.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&I.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&I.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&I.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),a=e[e.length-1],i=t[t.length-1];return a!==i&&I.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));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(!I.isAncestor(t,e)&&!I.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:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(I.equals(i,r)||I.endsBefore(i,r)||I.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(I.equals(s,r)||I.isAncestor(s,r))return null;I.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;I.equals(o,r)||I.endsBefore(o,r)?r[o.length-1]-=1:I.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:d}=t;if(I.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else I.endsBefore(u,r)?r[u.length-1]+=1:I.isAncestor(u,r)&&e[u.length]>=d&&(r[u.length-1]+=1,r[u.length]-=d);break}case"move_node":{var{path:m,newPath:h}=t;if(I.equals(m,h))return r;if(I.isAncestor(m,r)||I.equals(m,r)){var p=h.slice();return I.endsBefore(m,h)&&m.length<h.length&&(p[m.length-1]-=1),p.concat(r.slice(m.length))}else I.isSibling(m,h)&&(I.isAncestor(h,r)||I.equals(h,r))?I.endsBefore(m,r)?r[m.length-1]-=1:r[m.length-1]+=1:I.endsBefore(h,r)||I.equals(h,r)||I.isAncestor(h,r)?(I.endsBefore(m,r)&&(r[m.length-1]-=1),r[h.length-1]+=1):I.endsBefore(m,r)&&(I.equals(h,r)&&(r[h.length-1]+=1),r[m.length-1]-=1);break}}return r}};function Vr(e){"@babel/helpers - typeof";return Vr=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},Vr(e)}function a0(e,t){if(Vr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Vr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function i0(e){var t=a0(e,"string");return Vr(t)==="symbol"?t:String(t)}function gt(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 dl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function kr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var s0=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=le.parent(e,r),s=r[r.length-1];if(s>i.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(i.children.splice(s,0,a),t)for(var[o,l]of G.points(t))t[l]=Fe.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:m}=n;if(m.length===0)break;var h=le.leaf(e,u),p=h.text.slice(0,d),g=h.text.slice(d);if(h.text=p+m+g,t)for(var[f,b]of G.points(t))t[b]=Fe.transform(f,n);break}case"merge_node":{var{path:v}=n,C=le.get(e,v),D=I.previous(v),A=le.get(e,D),E=le.parent(e,v),k=v[v.length-1];if(he.isText(C)&&he.isText(A))A.text+=C.text;else if(!he.isText(C)&&!he.isText(A))A.children.push(...C.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(at.stringify(C)," ").concat(at.stringify(A)));if(E.children.splice(k,1),t)for(var[T,$]of G.points(t))t[$]=Fe.transform(T,n);break}case"move_node":{var{path:P,newPath:z}=n;if(I.isAncestor(P,z))throw new Error("Cannot move a path [".concat(P,"] to new path [").concat(z,"] because the destination is inside itself."));var L=le.get(e,P),B=le.parent(e,P),F=P[P.length-1];B.children.splice(F,1);var j=I.transform(P,n),O=le.get(e,I.parent(j)),q=j[j.length-1];if(O.children.splice(q,0,L),t)for(var[W,ne]of G.points(t))t[ne]=Fe.transform(W,n);break}case"remove_node":{var{path:J}=n,w=J[J.length-1],Q=le.parent(e,J);if(Q.children.splice(w,1),t)for(var[se,_]of G.points(t)){var M=Fe.transform(se,n);if(t!=null&&M!=null)t[_]=M;else{var U=void 0,S=void 0;for(var[R,K]of le.texts(e))if(I.compare(K,J)===-1)U=[R,K];else{S=[R,K];break}var Z=!1;U&&S&&(I.equals(S[1],J)?Z=!I.hasPrevious(S[1]):Z=I.common(U[1],J).length<I.common(S[1],J).length),U&&!Z?(se.path=U[1],se.offset=U[0].text.length):S?(se.path=S[1],se.offset=0):t=null}}break}case"remove_text":{var{path:re,offset:ce,text:X}=n;if(X.length===0)break;var pe=le.leaf(e,re),ve=pe.text.slice(0,ce),ye=pe.text.slice(ce+X.length);if(pe.text=ve+ye,t)for(var[Me,je]of G.points(t))t[je]=Fe.transform(Me,n);break}case"set_node":{var{path:Je,properties:Ue,newProperties:Le}=n;if(Je.length===0)throw new Error("Cannot set properties on the root node!");var Xe=le.get(e,Je);for(var _e in Le){if(_e==="children"||_e==="text")throw new Error('Cannot set the "'.concat(_e,'" property of nodes!'));var Oe=Le[_e];Oe==null?delete Xe[_e]:Xe[_e]=Oe}for(var We in Ue)Le.hasOwnProperty(We)||delete Xe[We];break}case"set_selection":{var{newProperties:Y}=n;if(Y==null)t=Y;else{if(t==null){if(!G.isRange(Y))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(at.stringify(Y)," when there is no current selection."));t=kr({},Y)}for(var oe in Y){var ie=Y[oe];if(ie==null){if(oe==="anchor"||oe==="focus")throw new Error('Cannot remove the "'.concat(oe,'" selection property'));delete t[oe]}else t[oe]=ie}}break}case"split_node":{var{path:me,position:ge,properties:ke}=n;if(me.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(me,"] because the root node cannot be split."));var ze=le.get(e,me),ot=le.parent(e,me),At=me[me.length-1],vt;if(he.isText(ze)){var tt=ze.text.slice(0,ge),Ce=ze.text.slice(ge);ze.text=tt,vt=kr(kr({},ke),{},{text:Ce})}else{var Be=ze.children.slice(0,ge),It=ze.children.slice(ge);ze.children=Be,vt=kr(kr({},ke),{},{children:It})}if(ot.children.splice(At+1,0,vt),t)for(var[bt,_n]of G.points(t))t[_n]=Fe.transform(bt,n);break}}return t},o0={transform(e,t){e.children=sl(e.children);var n=e.selection&&sl(e.selection);try{n=s0(e,n,t)}finally{e.children=ol(e.children),n?e.selection=Mn(n)?ol(n):n:e.selection=null}}},u0={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)}},l0={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)}},Nf=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(st(r)&&st(a)){if(!Nf(r,a))return!1}else if(Array.isArray(r)&&Array.isArray(a)){if(r.length!==a.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==a[i])return!1}else if(r!==a)return!1}for(var s in t)if(e[s]===void 0&&t[s]!==void 0)return!1;return!0};function c0(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function sn(e,t){if(e==null)return{};var n=c0(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var d0=["anchor","focus"];function fl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function f0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var G={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return G.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=G.edges(e);return t},equals(e,t){return Fe.equals(e.anchor,t.anchor)&&Fe.equals(e.focus,t.focus)},includes(e,t){if(G.isRange(t)){if(G.includes(e,t.anchor)||G.includes(e,t.focus))return!0;var[n,r]=G.edges(e),[a,i]=G.edges(t);return Fe.isBefore(n,a)&&Fe.isAfter(r,i)}var[s,o]=G.edges(e),l=!1,u=!1;return Fe.isPoint(t)?(l=Fe.compare(t,s)>=0,u=Fe.compare(t,o)<=0):(l=I.compare(t,s.path)>=0,u=I.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=sn(e,d0),[r,a]=G.edges(e),[i,s]=G.edges(t),o=Fe.isBefore(r,i)?i:r,l=Fe.isBefore(a,s)?a:s;return Fe.isBefore(l,o)?null:f0({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return Fe.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Fe.equals(t,n)},isExpanded(e){return!G.isCollapsed(e)},isForward(e){return!G.isBackward(e)},isRange(e){return st(e)&&Fe.isPoint(e.anchor)&&Fe.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=G.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return So(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=G.isCollapsed(r);G.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?G.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=Fe.transform(r.anchor,t,{affinity:i}),u=Fe.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},ml=e=>st(e)&&le.isNodeList(e.children)&&!x.isEditor(e),fe={isAncestor(e){return st(e)&&le.isNodeList(e.children)},isElement:ml,isElementList(e){return Array.isArray(e)&&e.every(t=>fe.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 ml(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},m0=["children"],h0=["text"],hl=new WeakMap,le={ancestor(e,t){var n=le.get(e,t);if(he.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 I.ancestors(t,n)){var a=le.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(he.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,a=le.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=le.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=I.common(t,n),a=le.get(e,r);return[a,r]},descendant(e,t){var n=le.get(e,t);if(x.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))fe.isElement(n)&&(yield[n,r])}()},extractProps(e){if(fe.isAncestor(e)){var t=sn(e,m0);return t}else{var t=sn(e,h0);return t}},first(e,t){for(var n=t.slice(),r=le.get(e,n);r&&!(he.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(he.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(at.stringify(e)));var n=So({children:e.children},r=>{var[a,i]=G.edges(t),s=le.nodes(r,{reverse:!0,pass:h=>{var[,p]=h;return!G.includes(t,p)}});for(var[,o]of s){if(!G.includes(t,o)){var l=le.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(I.equals(o,i.path)){var d=le.leaf(r,o);d.text=d.text.slice(0,i.offset)}if(I.equals(o,a.path)){var m=le.leaf(r,o);m.text=m.text.slice(a.offset)}}x.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(he.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(at.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(he.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return he.isText(e)||fe.isElement(e)||x.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=hl.get(e);if(t!==void 0)return t;var n=e.every(r=>le.isNode(r));return hl.set(e,n),n},last(e,t){for(var n=t.slice(),r=le.get(e,n);r&&!(he.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=le.get(e,t);if(!he.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 I.levels(t,n)){var a=le.get(e,r);yield[a,r]}}()},matches(e,t){return fe.isElement(e)&&fe.isElementProps(t)&&fe.matches(e,t)||he.isText(e)&&he.isTextProps(t)&&he.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:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?I.isBefore(o,i):I.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!he.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;I.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=le.get(e,o);continue}if(o.length===0)break;if(!r){var d=I.next(o);if(le.has(e,d)){o=d,l=le.get(e,o);continue}}if(r&&o[o.length-1]!==0){var m=I.previous(o);o=m,l=le.get(e,o);continue}o=I.parent(o),l=le.get(e,o),s.add(l)}}()},parent(e,t){var n=I.parent(t),r=le.get(e,n);if(he.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 he.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))he.isText(n)&&(yield[n,r])}()}};function pl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ze(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pl(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(!st(e))return!1;switch(e.type){case"insert_node":return I.isPath(e.path)&&le.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&I.isPath(e.path);case"merge_node":return typeof e.position=="number"&&I.isPath(e.path)&&st(e.properties);case"move_node":return I.isPath(e.path)&&I.isPath(e.newPath);case"remove_node":return I.isPath(e.path)&&le.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&I.isPath(e.path);case"set_node":return I.isPath(e.path)&&st(e.properties)&&st(e.newProperties);case"set_selection":return e.properties===null&&G.isRange(e.newProperties)||e.newProperties===null&&G.isRange(e.properties)||st(e.properties)&&st(e.newProperties);case"split_node":return I.isPath(e.path)&&typeof e.position=="number"&&st(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 Ze(Ze({},e),{},{type:"remove_node"});case"insert_text":return Ze(Ze({},e),{},{type:"remove_text"});case"merge_node":return Ze(Ze({},e),{},{type:"split_node",path:I.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(I.equals(t,n))return e;if(I.isSibling(n,t))return Ze(Ze({},e),{},{path:t,newPath:n});var r=I.transform(n,e),a=I.transform(I.next(n),e);return Ze(Ze({},e),{},{path:r,newPath:a})}case"remove_node":return Ze(Ze({},e),{},{type:"insert_node"});case"remove_text":return Ze(Ze({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Ze(Ze({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Ze(Ze({},e),{},{properties:l,newProperties:null}):l==null?Ze(Ze({},e),{},{properties:null,newProperties:o}):Ze(Ze({},e),{},{properties:l,newProperties:o})}case"split_node":return Ze(Ze({},e),{},{type:"merge_node",path:I.next(e.path)})}}},gl=new WeakMap,p0=e=>{var t=gl.get(e);if(t!==void 0)return t;if(!st(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||st(e.marks))&&(e.selection===null||G.isRange(e.selection))&&le.isNodeList(e.children)&&vn.isOperationList(e.operations);return gl.set(e,n),n},x={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 p0(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)}},g0={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(I.isPath)}};function vl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function bl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Fe={compare(e,t){var n=I.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return Fe.compare(e,t)===1},isBefore(e,t){return Fe.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&I.equals(e.path,t.path)},isPoint(e){return st(e)&&typeof e.offset=="number"&&I.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return So(e,r=>{if(r===null)return null;var{affinity:a="forward"}=n,{path:i,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=I.transform(i,t,n);break}case"insert_text":{I.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{I.equals(t.path,i)&&(r.offset+=t.position),r.path=I.transform(i,t,n);break}case"remove_text":{I.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(I.equals(t.path,i)||I.isAncestor(t.path,i))return null;r.path=I.transform(i,t,n);break}case"split_node":{if(I.equals(t.path,i)){if(t.position===s&&a==null)return null;(t.position<s||t.position===s&&a==="forward")&&(r.offset-=t.position,r.path=I.transform(i,t,bl(bl({},n),{},{affinity:"forward"})))}else r.path=I.transform(i,t,n);break}}})}},yl=void 0,at={setScrubber(e){yl=e},stringify(e){return JSON.stringify(e,yl)}},v0=["text"],b0=["anchor","focus"];function xl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function tn(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){gt(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 he={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=sn(i,v0);return s}return Nf(r?a(e):e,r?a(t):t)},isText(e){return st(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>he.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 a=sn(r,b0),[i,s]=G.edges(r),o=[],l=0,u=i.offset,d=s.offset;for(var m of n){var{length:h}=m.text,p=l;if(l+=h,u<=p&&l<=d){Object.assign(m,a),o.push(m);continue}if(u!==d&&(u===l||d===p)||u>l||d<p||d===p&&p!==0){o.push(m);continue}var g=m,f=void 0,b=void 0;if(d<l){var v=d-p;b=tn(tn({},g),{},{text:g.text.slice(v)}),g=tn(tn({},g),{},{text:g.text.slice(0,v)})}if(u>p){var C=u-p;f=tn(tn({},g),{},{text:g.text.slice(0,C)}),g=tn(tn({},g),{},{text:g.text.slice(C)})}Object.assign(g,a),f&&o.push(f),o.push(g),b&&o.push(b)}n=o}return n}},jo=e=>e.selection?e.selection:e.children.length>0?x.end(e,[]):[0],br=(e,t)=>{var[n]=x.node(e,t);return r=>r===n},Oo=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?E0(t):t,i=De.None,s=De.None,o=0,l=null,u=null;for(var d of a){var m=d.codePointAt(0);if(!m)break;var h=N0(d,m);if([i,s]=r?[s,h]:[h,i],Xn(i,De.ZWJ)&&Xn(s,De.ExtPict)&&(r?l=Cl(t.substring(0,o)):l=Cl(t.substring(0,t.length-o)),!l)||Xn(i,De.RI)&&Xn(s,De.RI)&&(u!==null?u=!u:r?u=!0:u=z0(t.substring(0,t.length-o)),!u)||i!==De.None&&s!==De.None&&R0(i,s))break;o+=d.length}return o||1},y0=/\s/,x0=/[\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]/,C0=/['\u2018\u2019]/,w0=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=Oo(t,n),[s,o]=Po(t,i,n);if(D0(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Po=(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)]},D0=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(y0.test(t))return!1;if(C0.test(t)){var a=Oo(n,r),[i,s]=Po(n,a,r);if(e(i,s,r))return!0}return!x0.test(t)},E0=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(k0(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(_0(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},_0=e=>e>=55296&&e<=56319,k0=e=>e>=56320&&e<=57343,De;(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"})(De||(De={}));var F0=/^(?:[\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])$/,A0=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,B0=/^(?:[\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])$/,T0=/^[\u1100-\u115F\uA960-\uA97C]$/,S0=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,j0=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,O0=/^[\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]$/,P0=/^[\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]$/,M0=/^(?:[\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])$/,N0=(e,t)=>{var n=De.Any;return e.search(F0)!==-1&&(n|=De.Extend),t===8205&&(n|=De.ZWJ),t>=127462&&t<=127487&&(n|=De.RI),e.search(A0)!==-1&&(n|=De.Prepend),e.search(B0)!==-1&&(n|=De.SpacingMark),e.search(T0)!==-1&&(n|=De.L),e.search(S0)!==-1&&(n|=De.V),e.search(j0)!==-1&&(n|=De.T),e.search(O0)!==-1&&(n|=De.LV),e.search(P0)!==-1&&(n|=De.LVT),e.search(M0)!==-1&&(n|=De.ExtPict),n};function Xn(e,t){return(e&t)!==0}var I0=[[De.L,De.L|De.V|De.LV|De.LVT],[De.LV|De.V,De.V|De.T],[De.LVT|De.T,De.T],[De.Any,De.Extend|De.ZWJ],[De.Any,De.SpacingMark],[De.Prepend,De.Any],[De.ZWJ,De.ExtPict],[De.RI,De.RI]];function R0(e,t){return I0.findIndex(n=>Xn(e,n[0])&&Xn(t,n[1]))===-1}var $0=/(?:[\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$/,Cl=e=>e.search($0)!==-1,L0=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,z0=e=>{var t=e.match(L0);if(t===null)return!1;var n=t[0].length/2;return n%2===1},q0={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]:{};x.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=jo(e)}=n;if(I.isPath(a)&&(a=x.range(e,a)),G.isRange(a))if(G.isCollapsed(a))a=a.anchor;else{var i=G.end(a);if(!r&&x.void(e,{at:i}))return;var s=G.start(a),o=x.pointRef(e,s),l=x.pointRef(e,i);ee.delete(e,{at:a,voids:r});var u=o.unref(),d=l.unref();a=u||d,ee.setSelection(e,{anchor:a,focus:a})}if(!(!r&&x.void(e,{at:a})||x.elementReadOnly(e,{at:a}))){var{path:m,offset:h}=a;t.length>0&&e.apply({type:"insert_text",path:m,offset:h,text:t})}})}};function wl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ha(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){gt(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 ee=ha(ha(ha(ha({},o0),u0),l0),q0),Sa=new WeakMap,U0=e=>Sa.get(e)||!1,W0=(e,t,n)=>{var r=Sa.get(e)||!1;Sa.set(e,!0);try{t(),n()}finally{Sa.set(e,r)}};function If(e,t,n){var r=Ja.get(e)||[],a=Xa.get(e)||new Set,i,s,o=m=>{if(m){var h=m.join(",");s.has(h)||(s.add(h),i.push(m))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var d of t)o(d);Ja.set(e,i),Xa.set(e,s)}var V0=(e,t)=>{for(var n of x.pathRefs(e))t0.transform(n,t);for(var r of x.pointRefs(e))n0.transform(r,t);for(var a of x.rangeRefs(e))r0.transform(a,t);if(!U0(e)){var i=I.operationCanTransformPath(t)?s=>I.transform(s,t):void 0;If(e,e.getDirtyPaths(t),i)}ee.transform(e,t),e.operations.push(t),x.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),Pr.get(e)||(Pr.set(e,!0),Promise.resolve().then(()=>{Pr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},H0=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return I.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=I.levels(a),s=he.isText(r)?[]:Array.from(le.nodes(r),z=>{var[,L]=z;return a.concat(L)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=I.ancestors(o),u=I.previous(o);return[...l,u]}case"move_node":{var{path:d,newPath:m}=t;if(I.equals(d,m))return[];var h=[],p=[];for(var g of I.ancestors(d)){var f=I.transform(g,t);h.push(f)}for(var b of I.ancestors(m)){var v=I.transform(b,t);p.push(v)}var C=p[p.length-1],D=m[m.length-1],A=C.concat(D);return[...h,...p,A]}case"remove_node":{var{path:E}=t,k=I.ancestors(E);return[...k]}case"split_node":{var{path:T}=t,$=I.levels(T),P=I.next(T);return[...$,P]}default:return[]}},K0=e=>{var{selection:t}=e;return t?le.fragment(e,t):[]},Z0=(e,t)=>{var[n,r]=t;if(!he.isText(n)){if(fe.isElement(n)&&n.children.length===0){var a={text:""};ee.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=x.isEditor(n)?!1:fe.isElement(n)&&(e.isInline(n)||n.children.length===0||he.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=le.get(e,r);if(!he.isText(l)){var u=l.children[s],d=l.children[s-1],m=o===n.children.length-1,h=he.isText(u)||fe.isElement(u)&&e.isInline(u);if(h!==i)ee.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(fe.isElement(u)){if(e.isInline(u)){if(d==null||!he.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&&he.isText(d)&&(he.equals(u,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--):u.text===""&&(ee.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Y0=(e,t)=>{var{iteration:n,initialDirtyPathsLength:r}=t,a=r*42;if(n>a)throw new Error("Could not completely normalize the editor after ".concat(a," iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state."));return!0},G0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:s}=n;if(i){var o=x.path(t,i),l=a==="lowest";for(var[u,d]of x.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!he.isText(u)){if(G.isRange(i)){if(I.isAncestor(d,i.anchor.path)&&I.isAncestor(d,i.focus.path))return[u,d]}else if(!I.equals(o,d))return[u,d]}}};function Dl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function El(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Dl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Q0=(e,t,n)=>{var{selection:r}=e;if(r){var a=(m,h)=>{if(!he.isText(m))return!1;var[p,g]=x.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},i=G.isExpanded(r),s=!1;if(!i){var[o,l]=x.node(e,r);if(o&&a(o,l)){var[u]=x.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)ee.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var d=El(El({},x.marks(e)||{}),{},{[t]:n});e.marks=d,Pr.get(e)||e.onChange()}}};function _l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function kl(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){gt(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 J0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.point(t,n,{edge:"end"}),i=x.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,kl(kl({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};function Fl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Al(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Fl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var X0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.start(t,[]),i=x.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,Al(Al({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},ey=(e,t)=>{var{selection:n}=e;n&&G.isCollapsed(n)&&ee.delete(e,{unit:t,reverse:!0})},ty=(e,t)=>{var{selection:n}=e;n&&G.isCollapsed(n)&&ee.delete(e,{unit:t})},ny=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&G.isExpanded(r)&&ee.delete(t,{reverse:n==="backward"})},ry=(e,t)=>[x.start(e,t),x.end(e,t)];function Bl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Tl(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){gt(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 ay=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,Tl(Tl({},n),{},{match:r=>fe.isElement(r)&&x.isElementReadOnly(t,r)}))},iy=(e,t)=>x.point(e,t,{edge:"end"}),sy=(e,t)=>{var n=x.path(e,t,{edge:"start"});return x.node(e,n)},oy=(e,t)=>{var n=x.range(e,t);return le.fragment(e,n)};function Sl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function jl(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){gt(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 uy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,jl(jl({},n),{},{match:r=>fe.isElement(r)&&x.isVoid(t,r)}))},ly=(e,t)=>t.children.some(n=>fe.isElement(n)&&x.isBlock(e,n)),cy=(e,t)=>t.children.some(n=>he.isText(n)||x.isInline(e,n)),dy=(e,t)=>le.has(e,t),fy=(e,t)=>t.children.every(n=>he.isText(n)),my=e=>{ee.splitNodes(e,{always:!0})},hy=(e,t,n)=>{ee.insertNodes(e,t,n)},py=e=>{ee.splitNodes(e,{always:!0})};function Ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function gy(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){gt(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 vy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a,marks:i}=t;if(a){if(i){var s=gy({text:n},i);ee.insertNodes(t,s,{at:r.at,voids:r.voids})}else ee.insertText(t,n,r);t.marks=null}},by=(e,t)=>!e.isInline(t),yy=(e,t,n)=>x.isStart(e,t,n)||x.isEnd(e,t,n),xy=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&he.isText(r)&&r.text===""&&!e.isVoid(t)},Cy=(e,t,n)=>{var r=x.end(e,n);return Fe.equals(t,r)},wy=e=>{var t=Mf.get(e);return t===void 0?!0:t},Dy=(e,t,n)=>{if(t.offset!==0)return!1;var r=x.start(e,n);return Fe.equals(t,r)},Ey=(e,t)=>{var n=x.path(e,t,{edge:"end"});return x.node(e,n)},_y=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=le.leaf(t,a);return[i,a]};function ky(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var s=[],o=x.path(e,n);for(var[l,u]of le.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&fe.isElement(l)&&x.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var Fy=["text"],Ay=["text"],By=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(G.isExpanded(r)){var s=x.isEnd(t,a,a.path);if(s){var o=x.after(t,a);o&&(a=o)}var[l]=x.nodes(t,{match:he.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,d=sn(u,Fy);return d}else return{}}var{path:m}=a,[h]=x.leaf(t,m);if(a.offset===0){var p=x.previous(t,{at:m,match:he.isText}),g=x.above(t,{match:A=>fe.isElement(A)&&x.isVoid(t,A)&&t.markableVoid(A)});if(!g){var f=x.above(t,{match:A=>fe.isElement(A)&&x.isBlock(t,A)});if(p&&f){var[b,v]=p,[,C]=f;I.isAncestor(C,v)&&(h=b)}}}var D=sn(h,Ay);return D},Ty=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=x.after(t,s,{voids:a});if(o){var[,l]=x.last(t,[]),u=[o.path,l];if(I.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(I.isPath(s)){var[d]=x.parent(t,s);i=h=>d.children.includes(h)}else i=()=>!0;var[m]=x.nodes(t,{at:u,match:i,mode:r,voids:a});return m}}},Sy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=le.get(t,a);return[i,a]};function jy(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,d;if(g0.isSpan(n))u=n[0],d=n[1];else{var m=x.path(e,n,{edge:"start"}),h=x.path(e,n,{edge:"end"});u=i?h:m,d=i?m:h}var p=le.nodes(e,{reverse:i,from:u,to:d,pass:A=>{var[E]=A;return fe.isElement(E)?!!(!s&&(x.isVoid(e,E)||x.isElementReadOnly(e,E))||o&&!x.isSelectable(e,E)):!1}}),g=[],f;for(var[b,v]of p)if(!(o&&fe.isElement(b)&&!x.isSelectable(e,b))){var C=f&&I.compare(v,f[1])===0;if(!(r==="highest"&&C)){if(!l(b,v)){if(a&&!C&&he.isText(b))return;continue}if(r==="lowest"&&C){f=[b,v];continue}var D=r==="lowest"?f:[b,v];D&&(a?g.push(D):yield D),f=[b,v]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var Oy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=d=>Ja.get(d)||[],s=d=>Xa.get(d)||new Set,o=d=>{var m=i(d).pop(),h=m.join(",");return s(d).delete(h),m};if(x.isNormalizing(t)){if(r){var l=Array.from(le.nodes(t),d=>{var[,m]=d;return m}),u=new Set(l.map(d=>d.join(",")));Ja.set(t,l),Xa.set(t,u)}i(t).length!==0&&x.withoutNormalizing(t,()=>{for(var d of i(t))if(le.has(t,d)){var m=x.node(t,d),[h,p]=m;fe.isElement(h)&&h.children.length===0&&t.normalizeNode(m,{operation:a})}for(var g=i(t),f=g.length,b=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:b,initialDirtyPathsLength:f,operation:a}))return;var v=o(t);if(le.has(t,v)){var C=x.node(t,v);t.normalizeNode(C,{operation:a})}b++,g=i(t)}})}},Py=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=x.path(t,n,r),i=I.parent(a),s=x.node(t,i);return s},My=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.pathRefs(t);return l.delete(i),i.current=null,o}},s=x.pathRefs(t);return s.add(i),i},Ny=e=>{var t=ul.get(e);return t||(t=new Set,ul.set(e,t)),t},Iy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(I.isPath(n)){if(i==="start"){var[,s]=le.first(t,n);n=s}else if(i==="end"){var[,o]=le.last(t,n);n=o}}return G.isRange(n)&&(i==="start"?n=G.start(n):i==="end"?n=G.end(n):n=I.common(n.anchor.path,n.focus.path)),Fe.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},Ry=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.pointRefs(t);return l.delete(i),i.current=null,o}},s=x.pointRefs(t);return s.add(i),i},$y=e=>{var t=ll.get(e);return t||(t=new Set,ll.set(e,t)),t},Ly=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(I.isPath(n)){var i;if(a==="end"){var[,s]=le.last(t,n);i=s}else{var[,o]=le.first(t,n);i=o}var l=le.get(t,i);if(!he.isText(l))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?l.text.length:0}}if(G.isRange(n)){var[u,d]=G.edges(n);return a==="start"?u:d}return n};function zy(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:a=!1,voids:i=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=x.range(e,n),[l,u]=G.edges(o),d=a?u:l,m=!1,h="",p=0,g=0,f=0;for(var[b,v]of x.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(fe.isElement(b)){if(!i&&(e.isVoid(b)||e.isElementReadOnly(b))){yield x.start(e,v);continue}if(e.isInline(b))continue;if(x.hasInlines(e,b)){var C=I.isAncestor(v,u.path)?u:x.end(e,v),D=I.isAncestor(v,l.path)?l:x.start(e,v);h=x.string(e,{anchor:D,focus:C},{voids:i}),m=!0}}if(he.isText(b)){var A=I.equals(v,d.path);for(A?(g=a?d.offset:b.text.length-d.offset,f=d.offset):(g=b.text.length,f=a?g:0),(A||m||r==="offset")&&(yield{path:v,offset:f},m=!1);;){if(p===0){if(h==="")break;p=E(h,r,a),h=Po(h,p,a)[1]}if(f=a?f-p:f+p,g=g-p,g<0){p=-g;break}p=0,yield{path:v,offset:f}}}}function E(k,T,$){return T==="character"?Oo(k,$):T==="word"?w0(k,$):T==="line"||T==="block"?k.length:1}}()}var qy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=x.before(t,s,{voids:a});if(o){var[,l]=x.first(t,[]),u=[o.path,l];if(I.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(I.isPath(s)){var[d]=x.parent(t,s);i=h=>d.children.includes(h)}else i=()=>!0;var[m]=x.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return m}}},Uy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=x.rangeRefs(t);return l.delete(i),i.current=null,o}},s=x.rangeRefs(t);return s.add(i),i},Wy=e=>{var t=cl.get(e);return t||(t=new Set,cl.set(e,t)),t},Vy=(e,t,n)=>{if(G.isRange(t)&&!n)return t;var r=x.start(e,t),a=x.end(e,n||t);return{anchor:r,focus:a}};function Pl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Hy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pl(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ky=(e,t)=>{var{selection:n}=e;if(n){var r=(d,m)=>{if(!he.isText(d))return!1;var[h,p]=x.parent(e,m);return!e.isVoid(h)||e.markableVoid(h)},a=G.isExpanded(n),i=!1;if(!a){var[s,o]=x.node(e,n);if(s&&r(s,o)){var[l]=x.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)ee.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Hy({},x.marks(e)||{});delete u[t],e.marks=u,Pr.get(e)||e.onChange()}}},Zy=(e,t)=>{Mf.set(e,t)},Yy=(e,t)=>x.point(e,t,{edge:"start"}),Gy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=x.range(t,n),[s,o]=G.edges(i),l="";for(var[u,d]of x.nodes(t,{at:i,match:he.isText,voids:a})){var m=u.text;I.equals(d,o.path)&&(m=m.slice(0,o.offset)),I.equals(d,s.path)&&(m=m.slice(s.offset)),l+=m}return l},Qy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=G.edges(n);if(i.offset!==0||s.offset!==0||G.isCollapsed(n)||I.hasPrevious(s.path))return n;var o=x.above(t,{at:s,match:g=>fe.isElement(g)&&x.isBlock(t,g),voids:a}),l=o?o[1]:[],u=x.start(t,i),d={anchor:u,focus:s},m=!0;for(var[h,p]of x.nodes(t,{at:d,match:he.isText,reverse:!0,voids:a})){if(m){m=!1;continue}if(h.text!==""||I.isBefore(p,l)){s={path:p,offset:h.text.length};break}}return{anchor:i,focus:s}},Jy=(e,t)=>{var n=x.isNormalizing(e);x.setNormalizing(e,!1);try{t()}finally{x.setNormalizing(e,n)}x.normalize(e)},Xy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:d=!1}=n;if(u){var m=!1;if(G.isRange(u)&&G.isCollapsed(u)&&(m=!0,u=u.anchor),Fe.isPoint(u)){var h=x.void(t,{at:u,mode:"highest"});if(!l&&h){var[,p]=h;u=p}else{var g={unit:s,distance:o},f=i?x.before(t,u,g)||x.start(t,[]):x.after(t,u,g)||x.end(t,[]);u={anchor:u,focus:f},d=!0}}if(I.isPath(u)){ee.removeNodes(t,{at:u,voids:l});return}if(!G.isCollapsed(u)){if(!d){var[,b]=G.edges(u),v=x.end(t,[]);Fe.equals(b,v)||(u=x.unhangRange(t,u,{voids:l}))}var[C,D]=G.edges(u),A=x.above(t,{match:ve=>fe.isElement(ve)&&x.isBlock(t,ve),at:C,voids:l}),E=x.above(t,{match:ve=>fe.isElement(ve)&&x.isBlock(t,ve),at:D,voids:l}),k=A&&E&&!I.equals(A[1],E[1]),T=I.equals(C.path,D.path),$=l?null:(r=x.void(t,{at:C,mode:"highest"}))!==null&&r!==void 0?r:x.elementReadOnly(t,{at:C,mode:"highest"}),P=l?null:(a=x.void(t,{at:D,mode:"highest"}))!==null&&a!==void 0?a:x.elementReadOnly(t,{at:D,mode:"highest"});if($){var z=x.before(t,C);z&&A&&I.isAncestor(A[1],z.path)&&(C=z)}if(P){var L=x.after(t,D);L&&E&&I.isAncestor(E[1],L.path)&&(D=L)}var B=[],F;for(var j of x.nodes(t,{at:u,voids:l})){var[O,q]=j;F&&I.compare(q,F)===0||(!l&&fe.isElement(O)&&(x.isVoid(t,O)||x.isElementReadOnly(t,O))||!I.isCommon(q,C.path)&&!I.isCommon(q,D.path))&&(B.push(j),F=q)}var W=Array.from(B,ve=>{var[,ye]=ve;return x.pathRef(t,ye)}),ne=x.pointRef(t,C),J=x.pointRef(t,D),w="";if(!T&&!$){var Q=ne.current,[se]=x.leaf(t,Q),{path:_}=Q,{offset:M}=C,U=se.text.slice(M);U.length>0&&(t.apply({type:"remove_text",path:_,offset:M,text:U}),w=U)}if(W.reverse().map(ve=>ve.unref()).filter(ve=>ve!==null).forEach(ve=>ee.removeNodes(t,{at:ve,voids:l})),!P){var S=J.current,[R]=x.leaf(t,S),{path:K}=S,Z=T?C.offset:0,re=R.text.slice(Z,D.offset);re.length>0&&(t.apply({type:"remove_text",path:K,offset:Z,text:re}),w=re)}!T&&k&&J.current&&ne.current&&ee.mergeNodes(t,{at:J.current,hanging:!0,voids:l}),m&&i&&s==="character"&&w.length>1&&w.match(/[\u0E00-\u0E7F]+/)&&ee.insertText(t,w.slice(0,w.length-o));var ce=ne.unref(),X=J.unref(),pe=i?ce||X:X||ce;n.at==null&&pe&&ee.select(t,pe)}}})},ex=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=jo(t),batchDirty:o=!0}=r;if(n.length){if(G.isRange(s))if(a||(s=x.unhangRange(t,s,{voids:i})),G.isCollapsed(s))s=s.anchor;else{var[,l]=G.edges(s);if(!i&&x.void(t,{at:l}))return;var u=x.pointRef(t,l);ee.delete(t,{at:s}),s=u.unref()}else I.isPath(s)&&(s=x.start(t,s));if(!(!i&&x.void(t,{at:s}))){var d=x.above(t,{at:s,match:U=>fe.isElement(U)&&x.isInline(t,U),mode:"highest",voids:i});if(d){var[,m]=d;if(x.isEnd(t,s,m)){var h=x.after(t,m);s=h}else if(x.isStart(t,s,m)){var p=x.before(t,m);s=p}}var g=x.above(t,{match:U=>fe.isElement(U)&&x.isBlock(t,U),at:s,voids:i}),[,f]=g,b=x.isStart(t,s,f),v=x.isEnd(t,s,f),C=b&&v,D=!b||b&&v,A=!v,[,E]=le.first({children:n},[]),[,k]=le.last({children:n},[]),T=[],$=U=>{var[S,R]=U,K=R.length===0;return K?!1:C?!0:!(D&&I.isAncestor(R,E)&&fe.isElement(S)&&!t.isVoid(S)&&!t.isInline(S)||A&&I.isAncestor(R,k)&&fe.isElement(S)&&!t.isVoid(S)&&!t.isInline(S))};for(var P of le.nodes({children:n},{pass:$}))$(P)&&T.push(P);var z=[],L=[],B=[],F=!0,j=!1;for(var[O]of T)fe.isElement(O)&&!t.isInline(O)?(F=!1,j=!0,L.push(O)):F?z.push(O):B.push(O);var[q]=x.nodes(t,{at:s,match:U=>he.isText(U)||x.isInline(t,U),mode:"highest",voids:i}),[,W]=q,ne=x.isStart(t,s,W),J=x.isEnd(t,s,W),w=x.pathRef(t,v&&!B.length?I.next(f):f),Q=x.pathRef(t,J?I.next(W):W);ee.splitNodes(t,{at:s,match:U=>j?fe.isElement(U)&&x.isBlock(t,U):he.isText(U)||x.isInline(t,U),mode:j?"lowest":"highest",always:j&&(!b||z.length>0)&&(!v||B.length>0),voids:i});var se=x.pathRef(t,!ne||ne&&J?I.next(W):W);if(ee.insertNodes(t,z,{at:se.current,match:U=>he.isText(U)||x.isInline(t,U),mode:"highest",voids:i,batchDirty:o}),C&&!z.length&&L.length&&!B.length&&ee.delete(t,{at:f,voids:i}),ee.insertNodes(t,L,{at:w.current,match:U=>fe.isElement(U)&&x.isBlock(t,U),mode:"lowest",voids:i,batchDirty:o}),ee.insertNodes(t,B,{at:Q.current,match:U=>he.isText(U)||x.isInline(t,U),mode:"highest",voids:i,batchDirty:o}),!r.at){var _;if(B.length>0&&Q.current?_=I.previous(Q.current):L.length>0&&w.current?_=I.previous(w.current):se.current&&(_=I.previous(se.current)),_){var M=x.end(t,_);ee.select(t,M)}}se.unref(),w.unref(),Q.unref()}}})},tx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")ee.select(t,a.anchor);else if(r==="focus")ee.select(t,a.focus);else if(r==="start"){var[i]=G.edges(a);ee.select(t,i)}else if(r==="end"){var[,s]=G.edges(a);ee.select(t,s)}}else return},nx=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},rx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:a=1,unit:i="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=G.isBackward(r)?"focus":"anchor"),o==="end"&&(o=G.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:a,unit:i,ignoreNonSelectable:!0},m={};if(o==null||o==="anchor"){var h=s?x.before(t,l,d):x.after(t,l,d);h&&(m.anchor=h)}if(o==null||o==="focus"){var p=s?x.before(t,u,d):x.after(t,u,d);p&&(m.focus=p)}ee.setSelection(t,m)}},ax=(e,t)=>{var{selection:n}=e;if(t=x.range(e,t),n){ee.setSelection(e,t);return}if(!G.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 Ml(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Nl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ml(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ml(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:a}=t,{edge:i="both"}=r;if(a){i==="start"&&(i=G.isBackward(a)?"focus":"anchor"),i==="end"&&(i=G.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;ee.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Nl(Nl({},l),n)})}},sx=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!Fe.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!Fe.equals(t.focus,n.focus)||i!=="anchor"&&i!=="focus"&&t[i]!==n[i])&&(r[i]=n[i],a[i]=t[i]);Object.keys(r).length>0&&e.apply({type:"set_selection",properties:r,newProperties:a})}},ox=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:d}=r;if(le.isNode(n)&&(n=[n]),n.length!==0){var[m]=n;if(l||(l=jo(t),d!==!1&&(d=!0)),d==null&&(d=!1),G.isRange(l))if(a||(l=x.unhangRange(t,l,{voids:i})),G.isCollapsed(l))l=l.anchor;else{var[,h]=G.edges(l),p=x.pointRef(t,h);ee.delete(t,{at:l}),l=p.unref()}if(Fe.isPoint(l)){u==null&&(he.isText(m)?u=z=>he.isText(z):t.isInline(m)?u=z=>he.isText(z)||x.isInline(t,z):u=z=>fe.isElement(z)&&x.isBlock(t,z));var[g]=x.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,b=x.pathRef(t,f),v=x.isEnd(t,l,f);ee.splitNodes(t,{at:l,match:u,mode:s,voids:i});var C=b.unref();l=v?I.next(C):C}else return}var D=I.parent(l),A=l[l.length-1];if(!(!i&&x.void(t,{at:D}))){if(o){var E=[],k=I.levels(D);W0(t,()=>{var z=function(){var F=D.concat(A);A++;var j={type:"insert_node",path:F,node:L};t.apply(j),l=I.next(l),E.push(j),he.isText?k.push(...Array.from(le.nodes(L),O=>{var[,q]=O;return F.concat(q)})):k.push(F)};for(var L of n)z()},()=>{If(t,k,z=>{var L=z;for(var B of E)if(I.operationCanTransformPath(B)&&(L=I.transform(L,B),!L))return null;return L})})}else for(var T of n){var $=D.concat(A);A++,t.apply({type:"insert_node",path:$,node:T}),l=I.next(l)}if(l=I.previous(l),d){var P=x.end(t,l);P&&ee.select(t,P)}}}})},ux=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=I.isPath(r)?br(t,r):A=>fe.isElement(A)&&x.isBlock(t,A)),!!r){var o=x.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,A=>{var[,E]=A;return x.pathRef(t,E)});for(var u of l){var d=u.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=x.node(t,I.parent(d)),[h,p]=m,g=d[d.length-1],{length:f}=h.children;if(f===1){var b=I.next(p);ee.moveNodes(t,{at:d,to:b,voids:i}),ee.removeNodes(t,{at:p,voids:i})}else if(g===0)ee.moveNodes(t,{at:d,to:p,voids:i});else if(g===f-1){var v=I.next(p);ee.moveNodes(t,{at:d,to:v,voids:i})}else{var C=I.next(d),D=I.next(p);ee.splitNodes(t,{at:C,voids:i}),ee.moveNodes(t,{at:d,to:D,voids:i})}}}})},lx=["text"],cx=["children"],Rf=(e,t)=>{if(fe.isElement(t)){var n=t;return x.isVoid(e,t)?!0:n.children.length===1?Rf(e,n.children[0]):!1}else return!x.isEditor(t)},dx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(I.isPath(a)){var[l]=x.parent(t,a);r=z=>l.children.includes(z)}else r=z=>fe.isElement(z)&&x.isBlock(t,z);if(!i&&G.isRange(a)&&(a=x.unhangRange(t,a,{voids:s})),G.isRange(a))if(G.isCollapsed(a))a=a.anchor;else{var[,u]=G.edges(a),d=x.pointRef(t,u);ee.delete(t,{at:a}),a=d.unref(),n.at==null&&ee.select(t,a)}var[m]=x.nodes(t,{at:a,match:r,voids:s,mode:o}),h=x.previous(t,{at:a,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=I.next(b),C=I.common(g,b),D=I.isSibling(g,b),A=Array.from(x.levels(t,{at:g}),z=>{var[L]=z;return L}).slice(C.length).slice(0,-1),E=x.above(t,{at:g,mode:"highest",match:z=>A.includes(z)&&Rf(t,z)}),k=E&&x.pathRef(t,E[1]),T,$;if(he.isText(p)&&he.isText(f)){var P=sn(p,lx);$=f.text.length,T=P}else if(fe.isElement(p)&&fe.isElement(f)){var P=sn(p,cx);$=f.children.length,T=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)));D||ee.moveNodes(t,{at:g,to:v,voids:s}),k&&ee.removeNodes(t,{at:k.current,voids:s}),fe.isElement(f)&&x.isEmpty(t,f)||he.isText(f)&&f.text===""&&b[b.length-1]!==0?ee.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:v,position:$,properties:T}),k&&k.unref()}}}})},fx=(e,t)=>{x.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=I.isPath(r)?br(e,r):p=>fe.isElement(p)&&x.isBlock(e,p));var o=x.pathRef(e,n),l=x.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,p=>{var[,g]=p;return x.pathRef(e,g)});for(var d of u){var m=d.unref(),h=o.current;m.length!==0&&e.apply({type:"move_node",path:m,newPath:h}),o.current&&I.isSibling(h,m)&&I.isAfter(h,m)&&(o.current=I.next(o.current))}o.unref()}})},mx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=I.isPath(s)?br(t,s):p=>fe.isElement(p)&&x.isBlock(t,p)),!r&&G.isRange(s)&&(s=x.unhangRange(t,s,{voids:a}));var l=x.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,p=>{var[,g]=p;return x.pathRef(t,g)});for(var d of u){var m=d.unref();if(m){var[h]=x.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]:{};x.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:d=!1,voids:m=!1}=r;if(i){if(a==null&&(a=I.isPath(i)?br(t,i):$=>fe.isElement($)&&x.isBlock(t,$)),!l&&G.isRange(i)&&(i=x.unhangRange(t,i,{voids:m})),d&&G.isRange(i)){if(G.isCollapsed(i)&&x.leaf(t,i.anchor)[0].text.length>0)return;var h=x.rangeRef(t,i,{affinity:"inward"}),[p,g]=G.edges(i),f=u==="lowest"?"lowest":"highest",b=x.isEnd(t,g,g.path);ee.splitNodes(t,{at:g,match:a,mode:f,voids:m,always:!b});var v=x.isStart(t,p,p.path);ee.splitNodes(t,{at:p,match:a,mode:f,voids:m,always:!v}),i=h.unref(),r.at==null&&ee.select(t,i)}s||(s=($,P)=>$!==P);for(var[C,D]of x.nodes(t,{at:i,match:a,mode:u,voids:m})){var A={},E={};if(D.length!==0){var k=!1;for(var T in n)T==="children"||T==="text"||s(n[T],C[T])&&(k=!0,C.hasOwnProperty(T)&&(A[T]=C[T]),o?n[T]!=null&&(E[T]=o(C[T],n[T])):n[T]!=null&&(E[T]=n[T]));k&&t.apply({type:"set_node",path:D,properties:A,newProperties:E})}}}})},px=(e,t)=>{if(G.isCollapsed(t))return t.anchor;var[,n]=G.edges(t),r=x.pointRef(e,n);return ee.delete(e,{at:t}),r.unref()},gx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=J=>fe.isElement(J)&&x.isBlock(t,J)),G.isRange(s)&&(s=px(t,s)),I.isPath(s)){var u=s,d=x.point(t,u),[m]=x.parent(t,u);i=J=>J===m,o=d.path.length-u.length+1,s=d,l=!0}if(s){var h=x.pointRef(t,s,{affinity:"backward"}),p;try{var[g]=x.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=x.void(t,{at:s,mode:"highest"}),b=0;if(!a&&f){var[v,C]=f;if(fe.isElement(v)&&t.isInline(v)){var D=x.after(t,C);if(!D){var A={text:""},E=I.next(C);ee.insertNodes(t,A,{at:E,voids:a}),D=x.point(t,E)}s=D,l=!0}var k=s.path.length-C.length;o=k+1,l=!0}p=x.pointRef(t,s);var T=s.path.length-o,[,$]=g,P=s.path.slice(0,T),z=o===0?s.offset:s.path[T]+b;for(var[L,B]of x.levels(t,{at:P,reverse:!0,voids:a})){var F=!1;if(B.length<$.length||B.length===0||!a&&fe.isElement(L)&&x.isVoid(t,L))break;var j=h.current,O=x.isEnd(t,j,B);if(l||!h||!x.isEdge(t,j,B)){F=!0;var q=le.extractProps(L);t.apply({type:"split_node",path:B,position:z,properties:q})}z=B[B.length-1]+(F||O?1:0)}if(n.at==null){var W=p.current||x.end(t,[]);ee.select(t,W)}}finally{var ne;h.unref(),(ne=p)===null||ne===void 0||ne.unref()}}})},vx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var a={};for(var i of n)a[i]=null;ee.setNodes(t,a,r)},bx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=I.isPath(s)?br(t,s):p=>fe.isElement(p)&&x.isBlock(t,p)),I.isPath(s)&&(s=x.range(t,s));var l=G.isRange(s)?x.rangeRef(t,s):null,u=x.nodes(t,{at:s,match:o,mode:r,voids:i}),d=Array.from(u,p=>{var[,g]=p;return x.pathRef(t,g)}).reverse(),m=function(){var g=h.unref(),[f]=x.node(t,g),b=x.range(t,g);a&&l&&(b=G.intersection(l.current,b)),ee.liftNodes(t,{at:b,match:v=>fe.isAncestor(f)&&f.children.includes(v),voids:i})};for(var h of d)m();l&&l.unref()}})};function Il(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Rl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Il(Object(n),!0).forEach(function(r){gt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Il(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var yx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(I.isPath(l)?o=br(t,l):t.isInline(n)?o=b=>fe.isElement(b)&&x.isInline(t,b)||he.isText(b):o=b=>fe.isElement(b)&&x.isBlock(t,b)),i&&G.isRange(l)){var[u,d]=G.edges(l),m=x.rangeRef(t,l,{affinity:"inward"});ee.splitNodes(t,{at:d,match:o,voids:s}),ee.splitNodes(t,{at:u,match:o,voids:s}),l=m.unref(),r.at==null&&ee.select(t,l)}var h=Array.from(x.nodes(t,{at:l,match:t.isInline(n)?b=>fe.isElement(b)&&x.isBlock(t,b):b=>x.isEditor(b),mode:"lowest",voids:s})),p=function(){var v=G.isRange(l)?G.intersection(l,x.range(t,f)):l;if(!v)return 0;var C=Array.from(x.nodes(t,{at:v,match:o,mode:a,voids:s}));if(C.length>0){var[D]=C,A=C[C.length-1],[,E]=D,[,k]=A;if(E.length===0&&k.length===0)return 0;var T=I.equals(E,k)?I.parent(E):I.common(E,k),$=x.range(t,E,k),P=x.node(t,T),[z]=P,L=T.length+1,B=I.next(k.slice(0,L)),F=Rl(Rl({},n),{},{children:[]});ee.insertNodes(t,F,{at:B,voids:s}),ee.moveNodes(t,{at:$,match:j=>fe.isAncestor(z)&&z.children.includes(j),to:B.concat(0),voids:s})}},g;for(var[,f]of h)g=p()}})},xx=()=>{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),a=0;a<n;a++)r[a]=arguments[a];return V0(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Q0(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ey(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ty(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ny(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return K0(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return my(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return py(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ex(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hy(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vy(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Z0(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ky(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return H0(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Y0(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return G0(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return J0(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return X0(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tx(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xy(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nx(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ry(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ay(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iy(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sy(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return oy(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return By(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ly(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cy(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dy(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fy(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ox(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return by(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yy(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xy(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cy(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wy(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dy(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ey(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _y(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ky(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ux(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dx(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rx(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fx(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ty(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sy(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jy(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Oy(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Py(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Iy(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return My(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ny(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ly(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ry(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $y(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zy(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qy(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vy(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Uy(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wy(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mx(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ax(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hx(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zy(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ix(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sx(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gx(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yy(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gy(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qy(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vx(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bx(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uy(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jy(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yx(e,...r)}};return e},Tn=[],Cx=function(){return Tn.some(function(e){return e.activeTargets.length>0})},wx=function(){return Tn.some(function(e){return e.skippedTargets.length>0})},$l="ResizeObserver loop completed with undelivered notifications.",Dx=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:$l}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=$l),window.dispatchEvent(e)},Hr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Hr||(Hr={}));var Sn=function(e){return Object.freeze(e)},Ex=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,Sn(this)}return e}(),$f=function(){function e(t,n,r,a){return this.x=t,this.y=n,this.width=r,this.height=a,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Sn(this)}return e.prototype.toJSON=function(){var t=this,n=t.x,r=t.y,a=t.top,i=t.right,s=t.bottom,o=t.left,l=t.width,u=t.height;return{x:n,y:r,top:a,right:i,bottom:s,left:o,width:l,height:u}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),Mo=function(e){return e instanceof SVGElement&&"getBBox"in e},Lf=function(e){if(Mo(e)){var t=e.getBBox(),n=t.width,r=t.height;return!n&&!r}var a=e,i=a.offsetWidth,s=a.offsetHeight;return!(i||s||e.getClientRects().length)},Ll=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)},_x=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},Mr=typeof window<"u"?window:{},pa=new WeakMap,zl=/auto|scroll/,kx=/^tb|vertical/,Fx=/msie|trident/i.test(Mr.navigator&&Mr.navigator.userAgent),Ut=function(e){return parseFloat(e||"0")},ar=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new Ex((n?t:e)||0,(n?e:t)||0)},ql=Sn({devicePixelContentBoxSize:ar(),borderBoxSize:ar(),contentBoxSize:ar(),contentRect:new $f(0,0,0,0)}),zf=function(e,t){if(t===void 0&&(t=!1),pa.has(e)&&!t)return pa.get(e);if(Lf(e))return pa.set(e,ql),ql;var n=getComputedStyle(e),r=Mo(e)&&e.ownerSVGElement&&e.getBBox(),a=!Fx&&n.boxSizing==="border-box",i=kx.test(n.writingMode||""),s=!r&&zl.test(n.overflowY||""),o=!r&&zl.test(n.overflowX||""),l=r?0:Ut(n.paddingTop),u=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+u,v=l+d,C=f+p,D=h+g,A=o?e.offsetHeight-D-e.clientHeight:0,E=s?e.offsetWidth-C-e.clientWidth:0,k=a?b+C:0,T=a?v+D:0,$=r?r.width:Ut(n.width)-k-E,P=r?r.height:Ut(n.height)-T-A,z=$+b+E+C,L=P+v+A+D,B=Sn({devicePixelContentBoxSize:ar(Math.round($*devicePixelRatio),Math.round(P*devicePixelRatio),i),borderBoxSize:ar(z,L,i),contentBoxSize:ar($,P,i),contentRect:new $f(m,l,$,P)});return pa.set(e,B),B},qf=function(e,t,n){var r=zf(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Hr.DEVICE_PIXEL_CONTENT_BOX:return s;case Hr.BORDER_BOX:return a;default:return i}},Ax=function(){function e(t){var n=zf(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=Sn([n.borderBoxSize]),this.contentBoxSize=Sn([n.contentBoxSize]),this.devicePixelContentBoxSize=Sn([n.devicePixelContentBoxSize])}return e}(),Uf=function(e){if(Lf(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},Bx=function(){var e=1/0,t=[];Tn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new Ax(u.target),m=Uf(u.target);o.push(d),u.lastReportedSize=qf(u.target,u.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 a=r[n];a()}return e},Ul=function(e){Tn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(Uf(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},Tx=function(){var e=0;for(Ul(e);Cx();)e=Bx(),Ul(e);return wx()&&Dx(),e>0},Vi,Wf=[],Sx=function(){return Wf.splice(0).forEach(function(e){return e()})},jx=function(e){if(!Vi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Sx()}).observe(n,r),Vi=function(){n.textContent="".concat(t?t--:t++)}}Wf.push(e),Vi()},Ox=function(e){jx(function(){requestAnimationFrame(e)})},ja=0,Px=function(){return!!ja},Mx=250,Nx={attributes:!0,characterData:!0,childList:!0,subtree:!0},Wl=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Vl=function(e){return e===void 0&&(e=0),Date.now()+e},Hi=!1,Ix=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=Mx),!Hi){Hi=!0;var r=Vl(t);Ox(function(){var a=!1;try{a=Tx()}finally{if(Hi=!1,t=r-Vl(),!Px())return;a?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,Nx)};document.body?n():Mr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Wl.forEach(function(n){return Mr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Wl.forEach(function(n){return Mr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),zs=new Ix,Hl=function(e){!ja&&e>0&&zs.start(),ja+=e,!ja&&zs.stop()},Rx=function(e){return!Mo(e)&&!_x(e)&&getComputedStyle(e).display==="inline"},$x=function(){function e(t,n){this.target=t,this.observedBox=n||Hr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=qf(this.target,this.observedBox,!0);return Rx(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Lx=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),ga=new WeakMap,Kl=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},va=function(){function e(){}return e.connect=function(t,n){var r=new Lx(t,n);ga.set(t,r)},e.observe=function(t,n,r){var a=ga.get(t),i=a.observationTargets.length===0;Kl(a.observationTargets,n)<0&&(i&&Tn.push(a),a.observationTargets.push(new $x(n,r&&r.box)),Hl(1),zs.schedule())},e.unobserve=function(t,n){var r=ga.get(t),a=Kl(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&Tn.splice(Tn.indexOf(r),1),r.observationTargets.splice(a,1),Hl(-1))},e.disconnect=function(t){var n=this,r=ga.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),zx=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.");va.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(!Ll(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");va.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(!Ll(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");va.unobserve(this,t)},e.prototype.disconnect=function(){va.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),dn={};Object.defineProperty(dn,"__esModule",{value:!0});var qx=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Ki={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Vf={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:qx?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},No={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 ba=1;ba<20;ba++)No["f"+ba]=111+ba;function bi(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Hf(s,t)}),a=function(o){return r.some(function(l){return Kf(l,o)})},i=n==null?a:a(n);return i}function Ux(e,t){return bi(e,t)}function Wx(e,t){return bi(e,{byKey:!0},t)}function Hf(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in Ki)r[Ki[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var d=a[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=Io(h),f=Ki[g];if(h.length>1&&!f&&!Vf[h]&&!No[g])throw new TypeError('Unknown modifier: "'+h+'"');(i===1||!f)&&(n?r.key=g:r.which=Zf(h)),f&&(r[f]=p?null:!0)}}catch(b){l=!0,u=b}finally{try{!o&&d.return&&d.return()}finally{if(l)throw u}}return r}function Kf(e,t){for(var n in e){var r=e[n],a=void 0;if(r!=null&&(n==="key"&&t.key!=null?a=t.key.toLowerCase():n==="which"?a=r===91&&t.which===93?91:t.which:a=t[n],!(a==null&&r===!1)&&a!==r))return!1}return!0}function Zf(e){e=Io(e);var t=No[e]||e.toUpperCase().charCodeAt(0);return t}function Io(e){return e=e.toLowerCase(),e=Vf[e]||e,e}var Vx=dn.default=bi,Zi=dn.isHotkey=bi;dn.isCodeHotkey=Ux;dn.isKeyHotkey=Wx;dn.parseHotkey=Hf;dn.compareHotkey=Kf;dn.toKeyCode=Zf;dn.toKeyName=Io;function Hx(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function fr(e,t){if(e==null)return{};var n=Hx(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Kr(e){"@babel/helpers - typeof";return Kr=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},Kr(e)}function Kx(e,t){if(Kr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Kr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zx(e){var t=Kx(e,"string");return Kr(t)==="symbol"?t:String(t)}function Mt(e,t,n){return t=Zx(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ro=y.createContext(null),wn=()=>{var e=y.useContext(Ro);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Yf=parseInt(y.version.split(".")[0],10),Yx=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Zl=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),pt=typeof navigator<"u"&&/Android/.test(navigator.userAgent),er=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Sr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),Gx=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Gf=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Qx=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Jx=pt&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),Xx=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),e1=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),t1=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),Oa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",fn=(!Qx||!Jx)&&!Gx&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",$o=new WeakMap,Lo=new WeakMap,Qf=new WeakMap,Pa=new WeakMap,qs=new WeakMap,Zr=new WeakMap,jn=new WeakMap,ei=new WeakMap,yi=new WeakMap,Us=new WeakMap,bn=new WeakMap,Bn=new WeakMap,Nr=new WeakMap,Ws=new WeakMap,zo=new WeakMap,$t=new WeakMap,rn=new WeakMap,xt=new WeakMap,hn=new WeakMap,pn=new WeakMap,Jf=new WeakMap,mr=Symbol("placeholder"),Xf=Symbol("mark-placeholder"),n1=globalThis.Text,qo=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,r1=e=>yn(e)&&e.nodeType===8,Pt=e=>yn(e)&&e.nodeType===1,yn=e=>{var t=qo(e);return!!t&&e instanceof t.Node},Vs=e=>{var t=e&&e.anchorNode&&qo(e.anchorNode);return!!t&&e instanceof t.Selection},em=e=>yn(e)&&e.nodeType===3,a1=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,i1=e=>{var[t,n]=e;if(Pt(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=tm(t,a,r?"backward":"forward"),r=a<n;Pt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=o1(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},s1=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},tm=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(r1(a)||Pt(a)&&a.childNodes.length===0||Pt(a)&&a.getAttribute("contenteditable")==="false")&&!(s&&o);){if(i>=r.length){s=!0,i=t-1,n="backward";continue}if(i<0){o=!0,i=t+1,n="forward";continue}a=r[i],t=i,i+=n==="forward"?1:-1}return[a,t]},o1=(e,t,n)=>{var[r]=tm(e,t,n);return r},nm=e=>{var t="";if(em(e)&&e.nodeValue)return e.nodeValue;if(Pt(e)){for(var n of Array.from(e.childNodes))t+=nm(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
72
+ `)}return t},u1=/data-slate-fragment="(.+?)"/m,l1=e=>{var t=e.getData("text/html"),[,n]=t.match(u1)||[];return n},Uo=(e,t,n)=>{var{target:r}=t;if(Pt(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=te.getWindow(e);if(a.contains(r))return te.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var d of l)if(d===r||d.contains(r))return!0});return!i||i===t?!1:Uo(e,i,n)},c1=0;class d1{constructor(){Mt(this,"id",void 0),this.id="".concat(c1++)}}var te={androidPendingDiffs:e=>xt.get(e),androidScheduleFlush:e=>{var t;(t=zo.get(e))===null||t===void 0||t()},blur:e=>{var t=te.toDOMNode(e,e),n=te.findDocumentOrShadowRoot(e);bn.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=te.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&ee.deselect(e)},findDocumentOrShadowRoot:e=>{var t=te.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:a}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i=te.toSlateNode(e,t.target),s=te.findPath(e,i);if(fe.isElement(i)&&x.isVoid(e,i)){var o=a.getBoundingClientRect(),l=e.isInline(i)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,u=x.point(e,s,{edge:l?"start":"end"}),d=l?x.before(e,u):x.after(e,u);if(d){var m=x.range(e,d);return m}}var h,{document:p}=te.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=te.toSlateRange(e,h,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=ei.get(t);return n||(n=new d1,ei.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=Lo.get(r);if(a==null){if(x.isEditor(r))return n;break}var i=$o.get(r);if(i==null)break;n.unshift(i),r=a}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(()=>{te.focus(t,{retries:n.retries-1})},10);return}var r=te.toDOMNode(t,t),a=te.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=te.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(ee.select(t,x.start(t,[])),t.onChange()),bn.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=Qf.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:a=!1}=r,i=te.toDOMNode(t,t),s;try{s=Pt(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]")===i&&(!a||s.isContentEditable?!0:typeof s.isContentEditable=="boolean"&&s.closest('[contenteditable="false"]')===i||!!s.getAttribute("data-slate-zero-width")):!1},hasEditableTarget:(e,t)=>yn(t)&&te.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return x.hasPath(e,n.path)&&x.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>te.hasEditableTarget(e,t)||te.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>yn(t)&&te.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=>!!Us.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Us.get(e))return!1;var n=te.hasTarget(e,t)&&te.toSlateNode(e,t);return fe.isElement(n)&&x.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=yi.get(e),r=x.isEditor(t)?Pa.get(e):n==null?void 0:n.get(te.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]=x.node(e,t.path),r=te.toDOMNode(e,n),a;x.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],d=u.childNodes[0];if(!(d==null||d.textContent==null)){var{length:m}=d.textContent,h=u.getAttribute("data-slate-length"),p=h==null?m:parseInt(h,10),g=o+p,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var b,v=f.childNodes[0];a=[v instanceof n1?v:f,(b=f.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var C=Math.min(m,Math.max(0,t.offset-o));a=[d,C];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(at.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=G.isBackward(t),i=te.toDOMPoint(e,n),s=G.isCollapsed(t)?i:te.toDOMPoint(e,r),o=te.getWindow(e),l=o.document.createRange(),[u,d]=a?s:i,[m,h]=a?i:s,p=Pt(u)?u:u.parentElement,g=!!p.getAttribute("data-slate-zero-width"),f=Pt(m)?m:m.parentElement,b=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:d),l.setEnd(m,b?1:h),l},toSlateNode:(e,t)=>{var n=Pt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Zr.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:a}=n,[i,s]=r?t:i1(t),o=i.parentNode,l=null,u=0;if(o){var d,m,h=te.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(l=f.closest('[data-slate-node="text"]'),l){var v=te.getWindow(e),C=v.document.createRange();C.setStart(l,0),C.setEnd(i,s);var D=C.cloneContents(),A=[...Array.prototype.slice.call(D.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(D.querySelectorAll("[contenteditable=false]"))];A.forEach(j=>{if(pt&&!r&&j.hasAttribute("data-slate-zero-width")&&j.textContent.length>0&&j.textContext!=="\uFEFF"){j.textContent.startsWith("\uFEFF")&&(j.textContent=j.textContent.slice(1));return}j.parentNode.removeChild(j)}),u=D.textContent.length,b=l}}else if(g){for(var E=g.querySelectorAll("[data-slate-leaf]"),k=0;k<E.length;k++){var T=E[k];if(te.hasDOMNode(e,T)){f=T;break}}f?(l=f.closest('[data-slate-node="text"]'),b=f,u=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(j=>{u-=j.textContent.length})):u=1}b&&u===b.textContent.length&&pt&&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(`
73
73
 
74
- `))&&u--}if(pt&&!l&&!r){var $=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if($&&te.hasDOMNode(e,$,{editable:!0})){var P=te.toSlateNode(e,$),{path:z,offset:L}=x.start(e,te.findPath(e,P));return $.querySelector("[data-slate-leaf]")||(L=s),{path:z,offset:L}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var B=te.toSlateNode(e,l),F=te.findPath(e,B);return{path:F,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=Vs(t)?t.anchorNode:t.startContainer,o,l,u,d,m;if(s)if(Vs(t)){if(er&&t.rangeCount>1){u=t.focusNode;var h=t.getRangeAt(0),p=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&h.startContainer instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement){let k=function(T){return T.childElementCount>0?k(T.children[0]):T};var g=h.startContainer,f=p.startContainer,b=k(g.children[h.startOffset]),v=k(f.children[p.startOffset]);d=0,v.childNodes.length>0?o=v.childNodes[0]:o=v,b.childNodes.length>0?u=b.childNodes[0]:u=b,v instanceof HTMLElement?l=v.innerHTML.length:l=0}else h.startContainer===u?(o=p.endContainer,l=p.endOffset,d=h.startOffset):(o=h.startContainer,l=h.endOffset,d=p.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,d=t.focusOffset;Yf&&i1(o)||er?m=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:m=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,d=t.endOffset,m=t.collapsed;if(o==null||u==null||l==null||d==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(er&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
74
+ `))&&u--}if(pt&&!l&&!r){var $=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if($&&te.hasDOMNode(e,$,{editable:!0})){var P=te.toSlateNode(e,$),{path:z,offset:L}=x.start(e,te.findPath(e,P));return $.querySelector("[data-slate-leaf]")||(L=s),{path:z,offset:L}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var B=te.toSlateNode(e,l),F=te.findPath(e,B);return{path:F,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=Vs(t)?t.anchorNode:t.startContainer,o,l,u,d,m;if(s)if(Vs(t)){if(er&&t.rangeCount>1){u=t.focusNode;var h=t.getRangeAt(0),p=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&h.startContainer instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement){let k=function(T){return T.childElementCount>0?k(T.children[0]):T};var g=h.startContainer,f=p.startContainer,b=k(g.children[h.startOffset]),v=k(f.children[p.startOffset]);d=0,v.childNodes.length>0?o=v.childNodes[0]:o=v,b.childNodes.length>0?u=b.childNodes[0]:u=b,v instanceof HTMLElement?l=v.innerHTML.length:l=0}else h.startContainer===u?(o=p.endContainer,l=p.endOffset,d=h.startOffset):(o=h.startContainer,l=h.endOffset,d=p.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,d=t.focusOffset;Gf&&s1(o)||er?m=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:m=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,d=t.endOffset,m=t.collapsed;if(o==null||u==null||l==null||d==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(er&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
75
75
 
76
- `)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var C;u=o,d=((C=o.textContent)===null||C===void 0?void 0:C.length)||0}var D=te.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!D)return null;var A=m?D:te.toSlatePoint(e,[u,d],{exactMatch:a,suppressThrow:i});if(!A)return null;var E={anchor:D,focus:A};return G.isExpanded(E)&&G.isForward(E)&&Pt(u)&&x.void(e,{at:E.focus,mode:"highest"})&&(E=x.unhangRange(e,E,{voids:!0})),E}};function d1(e,t){var{path:n,diff:r}=t;if(!x.hasPath(e,n))return!1;var a=le.get(e,n);if(!he.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=I.next(n);if(!x.hasPath(e,i))return!1;var s=le.get(e,i);return he.isText(s)&&s.text.startsWith(r.text)}function nm(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((a,i)=>a.slice(0,i.start)+i.text+a.slice(i.end),e)}function f1(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 m1(e,t,n){for(var r=Math.min(e.length,t.length,n),a=0;a<r;a++)if(e.charAt(e.length-a-1)!==t.charAt(t.length-a-1))return a;return r}function rm(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=f1(i,a),o=Math.min(i.length-s,a.length-s),l=m1(i,a,o),u={start:n+s,end:r-l,text:a.slice(s,a.length-l)};return u.start===u.end&&u.text.length===0?null:u}function h1(e,t,n){var r=Math.min(t.start,n.start),a=Math.max(0,Math.min(t.start+t.text.length,n.end)-n.start),i=nm(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)-a),o=i.slice(r,s),l=Math.max(t.end,n.end-t.text.length+(t.end-t.start));return rm(e,{start:r,end:l,text:o})}function p1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Hs(e,t){var{path:n,offset:r}=t;if(!x.hasPath(e,n))return null;var a=le.get(e,n);if(!he.isText(a))return null;var i=x.above(e,{match:o=>fe.isElement(o)&&x.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=x.next(e,{at:n,match:he.isText});if(!s||!I.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Yl(e,t){var n=Hs(e,t.anchor);if(!n)return null;if(G.isCollapsed(t))return{anchor:n,focus:n};var r=Hs(e,t.focus);return r?{anchor:n,focus:r}:null}function Ks(e,t,n){var r=xt.get(e),a=r==null?void 0:r.find(d=>{var{path:m}=d;return I.equals(m,t.path)});if(!a||t.offset<=a.diff.start)return Fe.transform(t,n,{affinity:"backward"});var{diff:i}=a;if(t.offset<=i.start+i.text.length){var s={path:t.path,offset:i.start},o=Fe.transform(s,n,{affinity:"backward"});return o?{path:o.path,offset:o.offset+t.offset-i.start}:null}var l={path:t.path,offset:t.offset-i.text.length+i.end-i.start},u=Fe.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&I.equals(n.path,t.path)&&l.offset<n.position&&i.start<n.position?u:{path:u.path,offset:u.offset+i.text.length-i.end+i.start}:null}function Gl(e,t,n){var r=Ks(e,t.anchor,n);if(!r)return null;if(G.isCollapsed(t))return{anchor:r,focus:r};var a=Ks(e,t.focus,n);return a?{anchor:r,focus:a}:null}function g1(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!I.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:a,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:a,path:n};case"remove_text":return!I.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:a,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:a,path:n};case"split_node":return!I.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:I.transform(n,t,{affinity:"backward"})}:t.position>r.start?{diff:{start:r.start,end:Math.min(t.position,r.end),text:r.text},id:a,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:a,path:I.transform(n,t,{affinity:"forward"})};case"merge_node":return I.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:I.transform(n,t)}:{diff:r,id:a,path:I.transform(n,t)}}var i=I.transform(n,t);return i?{diff:r,path:i,id:a}:null}function Ql(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ya(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){Mt(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 v1=25,b1=200,y1=function(){},x1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function C1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,d=()=>{var B=pn.get(t);if(pn.delete(t),B){var{selection:F}=t,j=Yl(t,B);j&&(!F||!G.equals(j,F))&&ee.select(t,j)}},m=()=>{var B=hn.get(t);if(hn.delete(t),!!B){if(B.at){var F=Fe.isPoint(B.at)?Hs(t,B.at):Yl(t,B.at);if(!F)return;var j=x.range(t,F);(!t.selection||!G.equals(t.selection,j))&&ee.select(t,F)}B.run()}},h=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!A()&&!D()){d();return}a||(a=!0,setTimeout(()=>a=!1)),D()&&(a="action");var B=t.selection&&x.rangeRef(t,t.selection,{affinity:"forward"});rn.set(t,t.marks),y1("flush",hn.get(t),xt.get(t));for(var F=A(),j;j=(O=xt.get(t))===null||O===void 0?void 0:O[0];){var O,q,W=$t.get(t);W!==void 0&&($t.delete(t),t.marks=W),W&&u===!1&&(u=null);var ne=p1(j);(!t.selection||!G.equals(t.selection,ne))&&ee.select(t,ne),j.diff.text?x.insertText(t,j.diff.text):x.deleteFragment(t),xt.set(t,(q=xt.get(t))===null||q===void 0?void 0:q.filter(Q=>{var{id:se}=Q;return se!==j.id})),d1(t,j)||(F=!1,hn.delete(t),rn.delete(t),a="action",pn.delete(t),n.cancel(),r.cancel(),B==null||B.unref())}var J=B==null?void 0:B.unref();if(J&&!pn.get(t)&&(!t.selection||!G.equals(J,t.selection))&&ee.select(t,J),D()){m();return}F&&n(),n.flush(),r.flush(),d();var w=rn.get(t);rn.delete(t),w!==void 0&&(t.marks=w,t.onChange())},p=B=>{i&&clearTimeout(i),i=setTimeout(()=>{Bn.set(t,!1),h()},v1)},g=B=>{Bn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=qs.get(t);if(j){if(A()||F){j.style.display="none";return}j.style.removeProperty("display")}},b=(B,F)=>{var j,O=(j=xt.get(t))!==null&&j!==void 0?j:[];xt.set(t,O);var q=le.leaf(t,B),W=O.findIndex(w=>I.equals(w.path,B));if(W<0){var ne=rm(q.text,F);ne&&O.push({path:B,diff:F,id:l++}),f();return}var J=h1(q.text,O[W].diff,F);if(!J){O.splice(W,1),f();return}O[W]=ya(ya({},O[W]),{},{diff:J})},v=function(F){var{at:j}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,pn.delete(t),n.cancel(),r.cancel(),D()&&h(),hn.set(t,{at:j,run:F}),o=setTimeout(h)},C=B=>{var F;s&&(clearTimeout(s),s=null);var{inputType:j}=B,O=null,q=B.dataTransfer||B.data||void 0;u!==!1&&j!=="insertText"&&j!=="insertCompositionText"&&(u=!1);var[W]=B.getTargetRanges();W&&(O=te.toSlateRange(t,W,{exactMatch:!1,suppressThrow:!0}));var ne=te.getWindow(t),J=ne.getSelection();if(!O&&J&&(W=J,O=te.toSlateRange(t,J,{exactMatch:!1,suppressThrow:!0})),O=(F=O)!==null&&F!==void 0?F:t.selection,!!O){var w=!0;if(j.startsWith("delete")){if(G.isExpanded(O)){var[Q,se]=G.edges(O),_=le.leaf(t,Q.path);if(_.text.length===Q.offset&&se.offset===0){var M=x.next(t,{at:Q.path,match:he.isText});M&&I.equals(M[1],se.path)&&(O={anchor:se,focus:se})}}var U=j.endsWith("Backward")?"backward":"forward",[S,R]=G.edges(O),[K,Z]=x.leaf(t,S.path),re={text:"",start:S.offset,end:R.offset},ce=xt.get(t),X=ce==null?void 0:ce.find(me=>I.equals(me.path,Z)),pe=X?[X.diff,re]:[re],ve=nm(K.text,...pe);if(ve.length===0&&(w=!1),G.isExpanded(O)){if(w&&I.equals(O.anchor.path,O.focus.path)){var ye={path:O.anchor.path,offset:S.offset},Me=x.range(t,ye,ye);return T(Me),b(O.anchor.path,{text:"",end:R.offset,start:S.offset})}return v(()=>x.deleteFragment(t,{direction:U}),{at:O})}}switch(j){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>x.deleteFragment(t),{at:O});case"deleteContent":case"deleteContentForward":{var{anchor:je}=O;if(w&&G.isCollapsed(O)){var Je=le.leaf(t,je.path);if(je.offset<Je.text.length)return b(je.path,{text:"",start:je.offset,end:je.offset+1})}return v(()=>x.deleteForward(t),{at:O})}case"deleteContentBackward":{var Ue,{anchor:Le}=O,Xe=Vs(W)?W.isCollapsed:!!((Ue=W)!==null&&Ue!==void 0&&Ue.collapsed);return w&&Xe&&G.isCollapsed(O)&&Le.offset>0?b(Le.path,{text:"",start:Le.offset-1,end:Le.offset}):v(()=>x.deleteBackward(t),{at:O})}case"deleteEntireSoftLine":return v(()=>{x.deleteBackward(t,{unit:"line"}),x.deleteForward(t,{unit:"line"})},{at:O});case"deleteHardLineBackward":return v(()=>x.deleteBackward(t,{unit:"block"}),{at:O});case"deleteSoftLineBackward":return v(()=>x.deleteBackward(t,{unit:"line"}),{at:O});case"deleteHardLineForward":return v(()=>x.deleteForward(t,{unit:"block"}),{at:O});case"deleteSoftLineForward":return v(()=>x.deleteForward(t,{unit:"line"}),{at:O});case"deleteWordBackward":return v(()=>x.deleteBackward(t,{unit:"word"}),{at:O});case"deleteWordForward":return v(()=>x.deleteForward(t,{unit:"word"}),{at:O});case"insertLineBreak":return v(()=>x.insertSoftBreak(t),{at:O});case"insertParagraph":return v(()=>x.insertBreak(t),{at:O});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(x1(q))return v(()=>te.insertData(t,q),{at:O});var _e=q??"";if($t.get(t)&&(_e=_e.replace("\uFEFF","")),j==="insertText"&&/.*\n.*\n$/.test(_e)&&(_e=_e.slice(0,-1)),_e.includes(`
76
+ `)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var C;u=o,d=((C=o.textContent)===null||C===void 0?void 0:C.length)||0}var D=te.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!D)return null;var A=m?D:te.toSlatePoint(e,[u,d],{exactMatch:a,suppressThrow:i});if(!A)return null;var E={anchor:D,focus:A};return G.isExpanded(E)&&G.isForward(E)&&Pt(u)&&x.void(e,{at:E.focus,mode:"highest"})&&(E=x.unhangRange(e,E,{voids:!0})),E}};function f1(e,t){var{path:n,diff:r}=t;if(!x.hasPath(e,n))return!1;var a=le.get(e,n);if(!he.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=I.next(n);if(!x.hasPath(e,i))return!1;var s=le.get(e,i);return he.isText(s)&&s.text.startsWith(r.text)}function rm(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((a,i)=>a.slice(0,i.start)+i.text+a.slice(i.end),e)}function m1(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),a=0;a<r;a++)if(e.charAt(e.length-a-1)!==t.charAt(t.length-a-1))return a;return r}function am(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=m1(i,a),o=Math.min(i.length-s,a.length-s),l=h1(i,a,o),u={start:n+s,end:r-l,text:a.slice(s,a.length-l)};return u.start===u.end&&u.text.length===0?null:u}function p1(e,t,n){var r=Math.min(t.start,n.start),a=Math.max(0,Math.min(t.start+t.text.length,n.end)-n.start),i=rm(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)-a),o=i.slice(r,s),l=Math.max(t.end,n.end-t.text.length+(t.end-t.start));return am(e,{start:r,end:l,text:o})}function g1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Hs(e,t){var{path:n,offset:r}=t;if(!x.hasPath(e,n))return null;var a=le.get(e,n);if(!he.isText(a))return null;var i=x.above(e,{match:o=>fe.isElement(o)&&x.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=x.next(e,{at:n,match:he.isText});if(!s||!I.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Yl(e,t){var n=Hs(e,t.anchor);if(!n)return null;if(G.isCollapsed(t))return{anchor:n,focus:n};var r=Hs(e,t.focus);return r?{anchor:n,focus:r}:null}function Ks(e,t,n){var r=xt.get(e),a=r==null?void 0:r.find(d=>{var{path:m}=d;return I.equals(m,t.path)});if(!a||t.offset<=a.diff.start)return Fe.transform(t,n,{affinity:"backward"});var{diff:i}=a;if(t.offset<=i.start+i.text.length){var s={path:t.path,offset:i.start},o=Fe.transform(s,n,{affinity:"backward"});return o?{path:o.path,offset:o.offset+t.offset-i.start}:null}var l={path:t.path,offset:t.offset-i.text.length+i.end-i.start},u=Fe.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&I.equals(n.path,t.path)&&l.offset<n.position&&i.start<n.position?u:{path:u.path,offset:u.offset+i.text.length-i.end+i.start}:null}function Gl(e,t,n){var r=Ks(e,t.anchor,n);if(!r)return null;if(G.isCollapsed(t))return{anchor:r,focus:r};var a=Ks(e,t.focus,n);return a?{anchor:r,focus:a}:null}function v1(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!I.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:a,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:a,path:n};case"remove_text":return!I.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:a,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:a,path:n};case"split_node":return!I.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:I.transform(n,t,{affinity:"backward"})}:t.position>r.start?{diff:{start:r.start,end:Math.min(t.position,r.end),text:r.text},id:a,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:a,path:I.transform(n,t,{affinity:"forward"})};case"merge_node":return I.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:I.transform(n,t)}:{diff:r,id:a,path:I.transform(n,t)}}var i=I.transform(n,t);return i?{diff:r,path:i,id:a}:null}function Ql(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ya(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){Mt(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 b1=25,y1=200,x1=function(){},C1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function w1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,d=()=>{var B=pn.get(t);if(pn.delete(t),B){var{selection:F}=t,j=Yl(t,B);j&&(!F||!G.equals(j,F))&&ee.select(t,j)}},m=()=>{var B=hn.get(t);if(hn.delete(t),!!B){if(B.at){var F=Fe.isPoint(B.at)?Hs(t,B.at):Yl(t,B.at);if(!F)return;var j=x.range(t,F);(!t.selection||!G.equals(t.selection,j))&&ee.select(t,F)}B.run()}},h=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!A()&&!D()){d();return}a||(a=!0,setTimeout(()=>a=!1)),D()&&(a="action");var B=t.selection&&x.rangeRef(t,t.selection,{affinity:"forward"});rn.set(t,t.marks),x1("flush",hn.get(t),xt.get(t));for(var F=A(),j;j=(O=xt.get(t))===null||O===void 0?void 0:O[0];){var O,q,W=$t.get(t);W!==void 0&&($t.delete(t),t.marks=W),W&&u===!1&&(u=null);var ne=g1(j);(!t.selection||!G.equals(t.selection,ne))&&ee.select(t,ne),j.diff.text?x.insertText(t,j.diff.text):x.deleteFragment(t),xt.set(t,(q=xt.get(t))===null||q===void 0?void 0:q.filter(Q=>{var{id:se}=Q;return se!==j.id})),f1(t,j)||(F=!1,hn.delete(t),rn.delete(t),a="action",pn.delete(t),n.cancel(),r.cancel(),B==null||B.unref())}var J=B==null?void 0:B.unref();if(J&&!pn.get(t)&&(!t.selection||!G.equals(J,t.selection))&&ee.select(t,J),D()){m();return}F&&n(),n.flush(),r.flush(),d();var w=rn.get(t);rn.delete(t),w!==void 0&&(t.marks=w,t.onChange())},p=B=>{i&&clearTimeout(i),i=setTimeout(()=>{Bn.set(t,!1),h()},b1)},g=B=>{Bn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=qs.get(t);if(j){if(A()||F){j.style.display="none";return}j.style.removeProperty("display")}},b=(B,F)=>{var j,O=(j=xt.get(t))!==null&&j!==void 0?j:[];xt.set(t,O);var q=le.leaf(t,B),W=O.findIndex(w=>I.equals(w.path,B));if(W<0){var ne=am(q.text,F);ne&&O.push({path:B,diff:F,id:l++}),f();return}var J=p1(q.text,O[W].diff,F);if(!J){O.splice(W,1),f();return}O[W]=ya(ya({},O[W]),{},{diff:J})},v=function(F){var{at:j}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,pn.delete(t),n.cancel(),r.cancel(),D()&&h(),hn.set(t,{at:j,run:F}),o=setTimeout(h)},C=B=>{var F;s&&(clearTimeout(s),s=null);var{inputType:j}=B,O=null,q=B.dataTransfer||B.data||void 0;u!==!1&&j!=="insertText"&&j!=="insertCompositionText"&&(u=!1);var[W]=B.getTargetRanges();W&&(O=te.toSlateRange(t,W,{exactMatch:!1,suppressThrow:!0}));var ne=te.getWindow(t),J=ne.getSelection();if(!O&&J&&(W=J,O=te.toSlateRange(t,J,{exactMatch:!1,suppressThrow:!0})),O=(F=O)!==null&&F!==void 0?F:t.selection,!!O){var w=!0;if(j.startsWith("delete")){if(G.isExpanded(O)){var[Q,se]=G.edges(O),_=le.leaf(t,Q.path);if(_.text.length===Q.offset&&se.offset===0){var M=x.next(t,{at:Q.path,match:he.isText});M&&I.equals(M[1],se.path)&&(O={anchor:se,focus:se})}}var U=j.endsWith("Backward")?"backward":"forward",[S,R]=G.edges(O),[K,Z]=x.leaf(t,S.path),re={text:"",start:S.offset,end:R.offset},ce=xt.get(t),X=ce==null?void 0:ce.find(me=>I.equals(me.path,Z)),pe=X?[X.diff,re]:[re],ve=rm(K.text,...pe);if(ve.length===0&&(w=!1),G.isExpanded(O)){if(w&&I.equals(O.anchor.path,O.focus.path)){var ye={path:O.anchor.path,offset:S.offset},Me=x.range(t,ye,ye);return T(Me),b(O.anchor.path,{text:"",end:R.offset,start:S.offset})}return v(()=>x.deleteFragment(t,{direction:U}),{at:O})}}switch(j){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>x.deleteFragment(t),{at:O});case"deleteContent":case"deleteContentForward":{var{anchor:je}=O;if(w&&G.isCollapsed(O)){var Je=le.leaf(t,je.path);if(je.offset<Je.text.length)return b(je.path,{text:"",start:je.offset,end:je.offset+1})}return v(()=>x.deleteForward(t),{at:O})}case"deleteContentBackward":{var Ue,{anchor:Le}=O,Xe=Vs(W)?W.isCollapsed:!!((Ue=W)!==null&&Ue!==void 0&&Ue.collapsed);return w&&Xe&&G.isCollapsed(O)&&Le.offset>0?b(Le.path,{text:"",start:Le.offset-1,end:Le.offset}):v(()=>x.deleteBackward(t),{at:O})}case"deleteEntireSoftLine":return v(()=>{x.deleteBackward(t,{unit:"line"}),x.deleteForward(t,{unit:"line"})},{at:O});case"deleteHardLineBackward":return v(()=>x.deleteBackward(t,{unit:"block"}),{at:O});case"deleteSoftLineBackward":return v(()=>x.deleteBackward(t,{unit:"line"}),{at:O});case"deleteHardLineForward":return v(()=>x.deleteForward(t,{unit:"block"}),{at:O});case"deleteSoftLineForward":return v(()=>x.deleteForward(t,{unit:"line"}),{at:O});case"deleteWordBackward":return v(()=>x.deleteBackward(t,{unit:"word"}),{at:O});case"deleteWordForward":return v(()=>x.deleteForward(t,{unit:"word"}),{at:O});case"insertLineBreak":return v(()=>x.insertSoftBreak(t),{at:O});case"insertParagraph":return v(()=>x.insertBreak(t),{at:O});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(C1(q))return v(()=>te.insertData(t,q),{at:O});var _e=q??"";if($t.get(t)&&(_e=_e.replace("\uFEFF","")),j==="insertText"&&/.*\n.*\n$/.test(_e)&&(_e=_e.slice(0,-1)),_e.includes(`
77
77
  `))return v(()=>{var me=_e.split(`
78
- `);me.forEach((ge,ke)=>{ge&&x.insertText(t,ge),ke!==me.length-1&&x.insertSoftBreak(t)})},{at:O});if(I.equals(O.anchor.path,O.focus.path)){var[Oe,We]=G.edges(O),Y={start:Oe.offset,end:We.offset,text:_e};if(_e&&u&&j==="insertCompositionText"){var oe=u.start+u.text.search(/\S|$/),ie=Y.start+Y.text.search(/\S|$/);ie===oe+1&&Y.end===u.start+u.text.length?(Y.start-=1,u=null,z()):u=!1}else j==="insertText"?u===null?u=Y:u&&G.isCollapsed(O)&&u.end+u.text.length===Oe.offset?u=ya(ya({},u),{},{text:u.text+_e}):u=!1:u=!1;if(w){b(Oe.path,Y);return}}return v(()=>x.insertText(t,_e),{at:O})}}}},D=()=>!!hn.get(t),A=()=>{var B;return!!((B=xt.get(t))!==null&&B!==void 0&&B.length)},E=()=>D()||A(),k=()=>a,T=B=>{pn.set(t,B),s&&(clearTimeout(s),s=null);var{selection:F}=t;if(B){var j=!F||!I.equals(F.anchor.path,B.anchor.path),O=!F||!I.equals(F.anchor.path.slice(0,-1),B.anchor.path.slice(0,-1));(j&&u||O)&&(u=!1),(j||A())&&(s=setTimeout(h,b1))}},$=()=>{(D()||!A())&&h()},P=B=>{A()||(f(!0),setTimeout(f))},z=()=>{D()||(o=setTimeout(h))},L=B=>{if(!(A()||D())&&B.some(j=>Uo(t,j,B))){var F;(F=Qf.get(t))===null||F===void 0||F()}};return{flush:h,scheduleFlush:z,hasPendingDiffs:A,hasPendingAction:D,hasPendingChanges:E,isFlushing:k,handleUserSelect:T,handleCompositionEnd:p,handleCompositionStart:g,handleDOMBeforeInput:C,handleKeyDown:P,handleDomMutations:L,handleInput:$}}function w1(){var e=y.useRef(!1);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Yr=Oa?y.useLayoutEffect:y.useEffect;function D1(e,t,n){var[r]=y.useState(()=>new MutationObserver(t));Yr(()=>{r.takeRecords()}),y.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 E1=["node"];function Jl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function _1(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){Mt(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 k1={subtree:!0,childList:!0,characterData:!0},F1=pt?e=>{var{node:t}=e,n=fr(e,E1);if(!pt)return null;var r=wn(),a=w1(),[i]=y.useState(()=>C1(_1({editor:r},n)));return D1(t,i.handleDomMutations,k1),zo.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,A1=["anchor","focus"],B1=["anchor","focus"],T1=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),am=(e,t)=>{var n=fr(e,A1),r=fr(t,B1);return e[mr]===t[mr]&&T1(n,r)},S1=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(!G.equals(r,a)||!am(r,a))return!1}return!0},j1=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(r.anchor.offset!==a.anchor.offset||r.focus.offset!==a.focus.offset||!am(r,a))return!1}return!0};function Xl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function O1(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){Mt(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 P1=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=wn(),s=te.findPath(i,a),o=I.parent(s),l=!!n[Jf];return i.isVoid(r)?y.createElement(Yi,{length:le.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&x.string(i,o)===""?y.createElement(Yi,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?y.createElement(Yi,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
78
+ `);me.forEach((ge,ke)=>{ge&&x.insertText(t,ge),ke!==me.length-1&&x.insertSoftBreak(t)})},{at:O});if(I.equals(O.anchor.path,O.focus.path)){var[Oe,We]=G.edges(O),Y={start:Oe.offset,end:We.offset,text:_e};if(_e&&u&&j==="insertCompositionText"){var oe=u.start+u.text.search(/\S|$/),ie=Y.start+Y.text.search(/\S|$/);ie===oe+1&&Y.end===u.start+u.text.length?(Y.start-=1,u=null,z()):u=!1}else j==="insertText"?u===null?u=Y:u&&G.isCollapsed(O)&&u.end+u.text.length===Oe.offset?u=ya(ya({},u),{},{text:u.text+_e}):u=!1:u=!1;if(w){b(Oe.path,Y);return}}return v(()=>x.insertText(t,_e),{at:O})}}}},D=()=>!!hn.get(t),A=()=>{var B;return!!((B=xt.get(t))!==null&&B!==void 0&&B.length)},E=()=>D()||A(),k=()=>a,T=B=>{pn.set(t,B),s&&(clearTimeout(s),s=null);var{selection:F}=t;if(B){var j=!F||!I.equals(F.anchor.path,B.anchor.path),O=!F||!I.equals(F.anchor.path.slice(0,-1),B.anchor.path.slice(0,-1));(j&&u||O)&&(u=!1),(j||A())&&(s=setTimeout(h,y1))}},$=()=>{(D()||!A())&&h()},P=B=>{A()||(f(!0),setTimeout(f))},z=()=>{D()||(o=setTimeout(h))},L=B=>{if(!(A()||D())&&B.some(j=>Uo(t,j,B))){var F;(F=Jf.get(t))===null||F===void 0||F()}};return{flush:h,scheduleFlush:z,hasPendingDiffs:A,hasPendingAction:D,hasPendingChanges:E,isFlushing:k,handleUserSelect:T,handleCompositionEnd:p,handleCompositionStart:g,handleDOMBeforeInput:C,handleKeyDown:P,handleDomMutations:L,handleInput:$}}function D1(){var e=y.useRef(!1);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Yr=Oa?y.useLayoutEffect:y.useEffect;function E1(e,t,n){var[r]=y.useState(()=>new MutationObserver(t));Yr(()=>{r.takeRecords()}),y.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 _1=["node"];function Jl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function k1(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){Mt(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 F1={subtree:!0,childList:!0,characterData:!0},A1=pt?e=>{var{node:t}=e,n=fr(e,_1);if(!pt)return null;var r=wn(),a=D1(),[i]=y.useState(()=>w1(k1({editor:r},n)));return E1(t,i.handleDomMutations,F1),zo.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,B1=["anchor","focus"],T1=["anchor","focus"],S1=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),im=(e,t)=>{var n=fr(e,B1),r=fr(t,T1);return e[mr]===t[mr]&&S1(n,r)},j1=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(!G.equals(r,a)||!im(r,a))return!1}return!0},O1=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(r.anchor.offset!==a.anchor.offset||r.focus.offset!==a.focus.offset||!im(r,a))return!1}return!0};function Xl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function P1(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){Mt(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 M1=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=wn(),s=te.findPath(i,a),o=I.parent(s),l=!!n[Xf];return i.isVoid(r)?y.createElement(Yi,{length:le.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&x.string(i,o)===""?y.createElement(Yi,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?y.createElement(Yi,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
79
79
  `?y.createElement(ec,{isTrailing:!0,text:n.text}):y.createElement(ec,{text:n.text})},ec=e=>{var{text:t,isTrailing:n=!1}=e,r=y.useRef(null),a=()=>"".concat(t??"").concat(n?`
80
- `:""),[i]=y.useState(a);return Yr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(M1,{ref:r},i)},M1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Yi=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),y.createElement("span",O1({},a),!pt||!n?"\uFEFF":null,n?y.createElement("br",null):null)};function tc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function im(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var N1=pt?300:0;function I1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function nc(e){e.current&&(clearTimeout(e.current),e.current=null)}var R1=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=C=>y.createElement(L1,im({},C))}=e,o=wn(),l=y.useRef(null),u=y.useRef(null),[d,m]=y.useState(!1),h=y.useRef(null),p=y.useCallback(C=>{if(I1(l,C==null),C==null){var D;qs.delete(o),(D=t.onPlaceholderResize)===null||D===void 0||D.call(t,null)}else{if(qs.set(o,C),!l.current){var A=window.ResizeObserver||Lx;l.current=new A(()=>{var E;(E=t.onPlaceholderResize)===null||E===void 0||E.call(t,C)})}l.current.observe(C),u.current=C}},[u,t,o]),g=y.createElement(P1,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[mr];if(y.useEffect(()=>(f?h.current||(h.current=setTimeout(()=>{m(!0),h.current=null},N1)):(nc(h),m(!1)),()=>nc(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:Sr?"inherit":void 0},contentEditable:!1,ref:p}};g=y.createElement(y.Fragment,null,i(b),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},$1=y.memo(R1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&he.equals(t.leaf,e.leaf)&&t.leaf[mr]===e.leaf[mr]),L1=e=>{var{attributes:t,children:n}=e;return y.createElement("span",im({},t),n)},z1=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=wn(),l=y.useRef(null),u=he.decorations(s,t),d=te.findKey(o,s),m=[],h=0;h<u.length;h++){var p=u[h];m.push(y.createElement($1,{isLast:n&&h===u.length-1,key:"".concat(d.id,"-").concat(h),renderPlaceholder:a,leaf:p,text:s,parent:r,renderLeaf:i}))}var g=y.useCallback(f=>{var b=yi.get(o);f?(b==null||b.set(d,f),jn.set(s,f),Zr.set(f,s)):(b==null||b.delete(d),jn.delete(s),l.current&&Zr.delete(l.current)),l.current=f},[l,o,d,s]);return y.createElement("span",{"data-slate-node":"text",ref:g},m)},sm=y.memo(z1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&j1(t.decorations,e.decorations));function rc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Zs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var q1=e=>{var{decorations:t,element:n,renderElement:r=C=>y.createElement(W1,Zs({},C)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=wn(),l=K1(),u=o.isInline(n),d=te.findKey(o,n),m=y.useCallback(C=>{var D=yi.get(o);C?(D==null||D.set(d,C),jn.set(n,C),Zr.set(C,n)):(D==null||D.delete(d),jn.delete(n))},[o,d,n]),h=um({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),p={"data-slate-node":"element",ref:m};if(u&&(p["data-slate-inline"]=!0),!u&&x.hasInlines(o,n)){var g=le.string(n),f=Df(g);f==="rtl"&&(p.dir=f)}if(x.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var b=u?"span":"div",[[v]]=le.texts(n);h=y.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(sm,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),$o.set(v,0),Lo.set(v,n)}return r({attributes:p,children:h,element:n})},U1=y.memo(q1,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&S1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&G.equals(e.selection,t.selection))),W1=e=>{var{attributes:t,children:n,element:r}=e,a=wn(),i=a.isInline(r)?"span":"div";return y.createElement(i,Zs(Zs({},t),{},{style:{position:"relative"}}),n)},om=y.createContext(()=>[]),V1=()=>y.useContext(om),H1=y.createContext(!1),um=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=V1(),l=wn(),u=te.findPath(l,n),d=[],m=fe.isElement(n)&&!l.isInline(n)&&x.hasInlines(l,n),h=0;h<n.children.length;h++){var p=u.concat(h),g=n.children[h],f=te.findKey(l,g),b=x.range(l,p),v=s&&G.intersection(b,s),C=o([g,p]);for(var D of t){var A=G.intersection(D,b);A&&C.push(A)}fe.isElement(g)?d.push(y.createElement(H1.Provider,{key:"provider-".concat(f.id),value:!!v},y.createElement(U1,{decorations:C,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):d.push(y.createElement(sm,{decorations:C,key:f.id,isLast:m&&h===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),$o.set(g,h),Lo.set(g,n)}return d},lm=y.createContext(!1),K1=()=>y.useContext(lm),cm=y.createContext(null),qn=()=>{var e=y.useContext(cm);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function Z1(){var e=wn(),t=y.useRef(!1),n=y.useRef(0),r=y.useCallback(()=>{if(!t.current){t.current=!0;var a=te.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return y.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var Y1=3,G1={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"},Q1={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"},J1={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ye=e=>{var t=G1[e],n=Q1[e],r=J1[e],a=t&&Zi(t),i=n&&Zi(n),s=r&&Zi(r);return o=>!!(a&&a(o)||Zl&&i&&i(o)||!Zl&&s&&s(o))},Qe={isBold:Ye("bold"),isCompose:Ye("compose"),isMoveBackward:Ye("moveBackward"),isMoveForward:Ye("moveForward"),isDeleteBackward:Ye("deleteBackward"),isDeleteForward:Ye("deleteForward"),isDeleteLineBackward:Ye("deleteLineBackward"),isDeleteLineForward:Ye("deleteLineForward"),isDeleteWordBackward:Ye("deleteWordBackward"),isDeleteWordForward:Ye("deleteWordForward"),isExtendBackward:Ye("extendBackward"),isExtendForward:Ye("extendForward"),isExtendLineBackward:Ye("extendLineBackward"),isExtendLineForward:Ye("extendLineForward"),isItalic:Ye("italic"),isMoveLineBackward:Ye("moveLineBackward"),isMoveLineForward:Ye("moveLineForward"),isMoveWordBackward:Ye("moveWordBackward"),isMoveWordForward:Ye("moveWordForward"),isRedo:Ye("redo"),isSoftBreak:Ye("insertSoftBreak"),isSplitBlock:Ye("splitBlock"),isTransposeCharacter:Ye("transposeCharacter"),isUndo:Ye("undo")},X1=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>Uo(e,l,s));n.push(...o)}};function i(){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:a,restoreDOM:i,clear:r}},eC={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class dm extends y.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,eC)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=X1(n,t),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var t,n,r,a=(t=this.mutationObserver)===null||t===void 0?void 0:t.takeRecords();if(a!=null&&a.length){var i;(i=this.manager)===null||i===void 0||i.registerMutations(a)}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(dm,"contextType",Ro);var tC=pt?dm:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},nC=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],rC=["text"];function ac(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Wt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ac(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ac(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var aC=e=>y.createElement(y.Fragment,null,um(e)),iC=e=>{var t=y.useCallback(M=>y.createElement(sC,Wt({},M)),[]),{autoFocus:n,decorate:r=oC,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=uC,style:m={},as:h="div",disableDefaultStyles:p=!1}=e,g=fr(e,nC),f=qn(),[b,v]=y.useState(!1),C=y.useRef(null),D=y.useRef([]),[A,E]=y.useState(),{onUserInput:k,receivedUserInput:T}=Z1(),[,$]=y.useReducer(M=>M+1,0);Qf.set(f,$),Us.set(f,s);var P=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{C.current&&n&&C.current.focus()},[n]);var z=y.useRef(),L=y.useMemo(()=>$b(()=>{var M=z.current;if((pt||!te.isComposing(f))&&(!P.isUpdatingSelection||M!=null&&M.isFlushing())&&!P.isDraggingInternally){var U=te.findDocumentOrShadowRoot(f),{activeElement:S}=U,R=te.toDOMNode(f,f),K=U.getSelection();if(S===R?(P.latestElement=S,bn.set(f,!0)):bn.delete(f),!K)return ee.deselect(f);var{anchorNode:Z,focusNode:re}=K,ce=te.hasEditableTarget(f,Z)||te.isTargetInsideNonReadonlyVoid(f,Z),X=te.hasEditableTarget(f,re)||te.isTargetInsideNonReadonlyVoid(f,re);if(ce&&X){var pe=te.toSlateRange(f,K,{exactMatch:!1,suppressThrow:!0});pe&&(!te.isComposing(f)&&!(M!=null&&M.hasPendingChanges())&&!(M!=null&&M.isFlushing())?ee.select(f,pe):M==null||M.handleUserSelect(pe))}s&&(!ce||!X)&&ee.deselect(f)}},100),[f,s,P]),B=y.useMemo(()=>Ob(L,0),[L]);z.current=F1({node:C,onDOMSelectionChange:L,scheduleOnDOMSelectionChange:B}),Yr(()=>{var M,U,S;C.current&&(S=qo(C.current))?(Gf.set(f,S),Pa.set(f,C.current),jn.set(f,C.current),Zr.set(C.current,f)):jn.delete(f);var{selection:R}=f,K=te.findDocumentOrShadowRoot(f),Z=K.getSelection();if(!(!Z||!te.isFocused(f)||(M=z.current)!==null&&M!==void 0&&M.hasPendingAction())){var re=ve=>{var ye=Z.type!=="None";if(!(!R&&!ye)){var Me=Z.focusNode,je;if(er&&Z.rangeCount>1){var Je=Z.getRangeAt(0),Ue=Z.getRangeAt(Z.rangeCount-1);Je.startContainer===Me?je=Ue.endContainer:je=Je.startContainer}else je=Z.anchorNode;var Le=Pa.get(f),Xe=!1;if(Le.contains(je)&&Le.contains(Me)&&(Xe=!0),ye&&Xe&&R&&!ve){var _e=te.toSlateRange(f,Z,{exactMatch:!0,suppressThrow:!0});if(_e&&G.equals(_e,R)){var Oe;if(!P.hasMarkPlaceholder||(Oe=je)!==null&&Oe!==void 0&&(Oe=Oe.parentElement)!==null&&Oe!==void 0&&Oe.hasAttribute("data-slate-mark-placeholder"))return}}if(R&&!te.hasRange(f,R)){f.selection=te.toSlateRange(f,Z,{exactMatch:!1,suppressThrow:!0});return}P.isUpdatingSelection=!0;var We=R&&te.toDOMRange(f,R);return We?(te.isComposing(f)&&!pt?Z.collapseToEnd():G.isBackward(R)?Z.setBaseAndExtent(We.endContainer,We.endOffset,We.startContainer,We.startOffset):Z.setBaseAndExtent(We.startContainer,We.startOffset,We.endContainer,We.endOffset),d(f,We)):Z.removeAllRanges(),We}};Z.rangeCount<=1&&re();var ce=((U=z.current)===null||U===void 0?void 0:U.isFlushing())==="action";if(!pt||!ce){setTimeout(()=>{P.isUpdatingSelection=!1});return}var X=null,pe=requestAnimationFrame(()=>{if(ce){var ve=ye=>{try{var Me=te.toDOMNode(f,f);Me.focus(),re(ye)}catch{}};ve(),X=setTimeout(()=>{ve(!0),P.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(pe),X&&clearTimeout(X)}}});var F=y.useCallback(M=>{if(k(),!s&&te.hasEditableTarget(f,M.target)&&!lC(M,a)){var U;if(z.current)return z.current.handleDOMBeforeInput(M);B.flush(),L.flush();var{selection:S}=f,{inputType:R}=M,K=M.dataTransfer||M.data||void 0,Z=R==="insertCompositionText"||R==="deleteCompositionText";if(Z&&te.isComposing(f))return;var re=!1;if(R==="insertText"&&S&&G.isCollapsed(S)&&M.data&&M.data.length===1&&/[a-z ]/i.test(M.data)&&S.anchor.offset!==0){var ce,X;re=!0,f.marks&&(re=!1);var{anchor:pe}=S,[ve,ye]=te.toDOMPoint(f,pe),Me=(ce=ve.parentElement)===null||ce===void 0?void 0:ce.closest("a"),je=te.getWindow(f);if(re&&Me&&te.hasDOMNode(f,Me)){var Je,Ue=je==null?void 0:je.document.createTreeWalker(Me,NodeFilter.SHOW_TEXT).lastChild();Ue===ve&&((Je=Ue.textContent)===null||Je===void 0?void 0:Je.length)===ye&&(re=!1)}if(re&&ve.parentElement&&(je==null||(X=je.getComputedStyle(ve.parentElement))===null||X===void 0?void 0:X.whiteSpace)==="pre"){var Le=x.above(f,{at:pe.path,match:oe=>fe.isElement(oe)&&x.isBlock(f,oe)});Le&&le.string(Le[0]).includes(" ")&&(re=!1)}}if(!R.startsWith("delete")||R.startsWith("deleteBy")){var[Xe]=M.getTargetRanges();if(Xe){var _e=te.toSlateRange(f,Xe,{exactMatch:!1,suppressThrow:!1});if(!S||!G.equals(S,_e)){re=!1;var Oe=!Z&&f.selection&&x.rangeRef(f,f.selection);ee.select(f,_e),Oe&&Nr.set(f,Oe)}}}if(Z)return;if(re||M.preventDefault(),S&&G.isExpanded(S)&&R.startsWith("delete")){var We=R.endsWith("Backward")?"backward":"forward";x.deleteFragment(f,{direction:We});return}switch(R){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{x.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{x.deleteForward(f);break}case"deleteContentBackward":{x.deleteBackward(f);break}case"deleteEntireSoftLine":{x.deleteBackward(f,{unit:"line"}),x.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{x.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{x.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{x.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{x.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{x.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{x.deleteForward(f,{unit:"word"});break}case"insertLineBreak":x.insertSoftBreak(f);break;case"insertParagraph":{x.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{R==="insertFromComposition"&&te.isComposing(f)&&(v(!1),Bn.set(f,!1)),(K==null?void 0:K.constructor.name)==="DataTransfer"?te.insertData(f,K):typeof K=="string"&&(re?D.current.push(()=>x.insertText(f,K)):x.insertText(f,K));break}}var Y=(U=Nr.get(f))===null||U===void 0?void 0:U.unref();Nr.delete(f),Y&&(!f.selection||!G.equals(f.selection,Y))&&ee.select(f,Y)}},[f,L,k,a,s,B]),j=y.useCallback(M=>{M==null?(L.cancel(),B.cancel(),Pa.delete(f),jn.delete(f),C.current&&fn&&C.current.removeEventListener("beforeinput",F)):fn&&M.addEventListener("beforeinput",F),C.current=M},[L,B,f,F]);Yr(()=>{var M=te.getWindow(f);return M.document.addEventListener("selectionchange",B),()=>{M.document.removeEventListener("selectionchange",B)}},[B]);var O=r([f,[]]),q=i&&f.children.length===1&&Array.from(le.texts(f)).length===1&&le.string(f)===""&&!b,W=y.useCallback(M=>{if(M&&q){var U;E((U=M.getBoundingClientRect())===null||U===void 0?void 0:U.height)}else E(void 0)},[q]);if(q){var ne=x.start(f,[]);O.push({[mr]:!0,placeholder:i,onPlaceholderResize:W,anchor:ne,focus:ne})}var{marks:J}=f;if(P.hasMarkPlaceholder=!1,f.selection&&G.isCollapsed(f.selection)&&J){var{anchor:w}=f.selection,Q=le.leaf(f,w.path),se=fr(Q,rC);if(!he.equals(Q,J,{loose:!0})){P.hasMarkPlaceholder=!0;var _=Object.fromEntries(Object.keys(se).map(M=>[M,null]));O.push(Wt(Wt(Wt({[Jf]:!0},_),J),{},{anchor:w,focus:w}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:M}=f;if(M){var{anchor:U}=M,S=le.leaf(f,U.path);if(J&&!he.equals(S,J,{loose:!0})){$t.set(f,J);return}}$t.delete(f)})}),y.createElement(lm.Provider,{value:s},y.createElement(om.Provider,{value:r},y.createElement(tC,{node:C,receivedUserInput:T},y.createElement(h,Wt(Wt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:fn||!Oa?g.spellCheck:!1,autoCorrect:fn||!Oa?g.autoCorrect:"false",autoCapitalize:fn||!Oa?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:j,style:Wt(Wt({},p?{}:Wt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},A?{minHeight:A}:{})),m),onBeforeInput:y.useCallback(M=>{if(!fn&&!s&&!mt(M,g.onBeforeInput)&&te.hasSelectableTarget(f,M.target)&&(M.preventDefault(),!te.isComposing(f))){var U=M.data;x.insertText(f,U)}},[g.onBeforeInput,f,s]),onInput:y.useCallback(M=>{if(!mt(M,g.onInput)){if(z.current){z.current.handleInput();return}for(var U of D.current)U();D.current=[]}},[g.onInput]),onBlur:y.useCallback(M=>{if(!(s||P.isUpdatingSelection||!te.hasSelectableTarget(f,M.target)||mt(M,g.onBlur))){var U=te.findDocumentOrShadowRoot(f);if(P.latestElement!==U.activeElement){var{relatedTarget:S}=M,R=te.toDOMNode(f,f);if(S!==R&&!(Pt(S)&&S.hasAttribute("data-slate-spacer"))){if(S!=null&&yn(S)&&te.hasDOMNode(f,S)){var K=te.toSlateNode(f,S);if(fe.isElement(K)&&!f.isVoid(K))return}if(Sr){var Z=U.getSelection();Z==null||Z.removeAllRanges()}bn.delete(f)}}}},[s,P.isUpdatingSelection,P.latestElement,f,g.onBlur]),onClick:y.useCallback(M=>{if(te.hasTarget(f,M.target)&&!mt(M,g.onClick)&&yn(M.target)){var U=te.toSlateNode(f,M.target),S=te.findPath(f,U);if(!x.hasPath(f,S)||le.get(f,S)!==U)return;if(M.detail===Y1&&S.length>=1){var R=S;if(!(fe.isElement(U)&&x.isBlock(f,U))){var K,Z=x.above(f,{match:Me=>fe.isElement(Me)&&x.isBlock(f,Me),at:S});R=(K=Z==null?void 0:Z[1])!==null&&K!==void 0?K:S.slice(0,1)}var re=x.range(f,R);ee.select(f,re);return}if(s)return;var ce=x.start(f,S),X=x.end(f,S),pe=x.void(f,{at:ce}),ve=x.void(f,{at:X});if(pe&&ve&&I.equals(pe[1],ve[1])){var ye=x.range(f,ce);ee.select(f,ye)}}},[f,g.onClick,s]),onCompositionEnd:y.useCallback(M=>{if(te.hasSelectableTarget(f,M.target)){var U;if(te.isComposing(f)&&Promise.resolve().then(()=>{v(!1),Bn.set(f,!1)}),(U=z.current)===null||U===void 0||U.handleCompositionEnd(M),mt(M,g.onCompositionEnd)||pt)return;if(!Sr&&!Jx&&!Zx&&!e1&&!Xx&&M.data){var S=$t.get(f);$t.delete(f),S!==void 0&&(rn.set(f,f.marks),f.marks=S),x.insertText(f,M.data);var R=rn.get(f);rn.delete(f),R!==void 0&&(f.marks=R)}}},[g.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(M=>{te.hasSelectableTarget(f,M.target)&&!mt(M,g.onCompositionUpdate)&&(te.isComposing(f)||(v(!0),Bn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:y.useCallback(M=>{if(te.hasSelectableTarget(f,M.target)){var U;if((U=z.current)===null||U===void 0||U.handleCompositionStart(M),mt(M,g.onCompositionStart)||pt)return;v(!0);var{selection:S}=f;if(S&&G.isExpanded(S)){x.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:y.useCallback(M=>{te.hasSelectableTarget(f,M.target)&&!mt(M,g.onCopy)&&!ic(M)&&(M.preventDefault(),te.setFragmentData(f,M.clipboardData,"copy"))},[g.onCopy,f]),onCut:y.useCallback(M=>{if(!s&&te.hasSelectableTarget(f,M.target)&&!mt(M,g.onCut)&&!ic(M)){M.preventDefault(),te.setFragmentData(f,M.clipboardData,"cut");var{selection:U}=f;if(U)if(G.isExpanded(U))x.deleteFragment(f);else{var S=le.parent(f,U.anchor.path);x.isVoid(f,S)&&ee.delete(f)}}},[s,f,g.onCut]),onDragOver:y.useCallback(M=>{if(te.hasTarget(f,M.target)&&!mt(M,g.onDragOver)){var U=te.toSlateNode(f,M.target);fe.isElement(U)&&x.isVoid(f,U)&&M.preventDefault()}},[g.onDragOver,f]),onDragStart:y.useCallback(M=>{if(!s&&te.hasTarget(f,M.target)&&!mt(M,g.onDragStart)){var U=te.toSlateNode(f,M.target),S=te.findPath(f,U),R=fe.isElement(U)&&x.isVoid(f,U)||x.void(f,{at:S,voids:!0});if(R){var K=x.range(f,S);ee.select(f,K)}P.isDraggingInternally=!0,te.setFragmentData(f,M.dataTransfer,"drag")}},[s,f,g.onDragStart,P]),onDrop:y.useCallback(M=>{if(!s&&te.hasTarget(f,M.target)&&!mt(M,g.onDrop)){M.preventDefault();var U=f.selection,S=te.findEventRange(f,M),R=M.dataTransfer;ee.select(f,S),P.isDraggingInternally&&U&&!G.equals(U,S)&&!x.void(f,{at:S,voids:!0})&&ee.delete(f,{at:U}),te.insertData(f,R),te.isFocused(f)||te.focus(f)}P.isDraggingInternally=!1},[s,f,g.onDrop,P]),onDragEnd:y.useCallback(M=>{!s&&P.isDraggingInternally&&g.onDragEnd&&te.hasTarget(f,M.target)&&g.onDragEnd(M),P.isDraggingInternally=!1},[s,P,g,f]),onFocus:y.useCallback(M=>{if(!s&&!P.isUpdatingSelection&&te.hasEditableTarget(f,M.target)&&!mt(M,g.onFocus)){var U=te.toDOMNode(f,f),S=te.findDocumentOrShadowRoot(f);if(P.latestElement=S.activeElement,er&&M.target!==U){U.focus();return}bn.set(f,!0)}},[s,P,f,g.onFocus]),onKeyDown:y.useCallback(M=>{if(!s&&te.hasEditableTarget(f,M.target)){var U;(U=z.current)===null||U===void 0||U.handleKeyDown(M);var{nativeEvent:S}=M;if(te.isComposing(f)&&S.isComposing===!1&&(Bn.set(f,!1),v(!1)),mt(M,g.onKeyDown)||te.isComposing(f))return;var{selection:R}=f,K=f.children[R!==null?R.focus.path[0]:0],Z=Df(le.string(K))==="rtl";if(Qe.isRedo(S)){M.preventDefault();var re=f;typeof re.redo=="function"&&re.redo();return}if(Qe.isUndo(S)){M.preventDefault();var ce=f;typeof ce.undo=="function"&&ce.undo();return}if(Qe.isMoveLineBackward(S)){M.preventDefault(),ee.move(f,{unit:"line",reverse:!0});return}if(Qe.isMoveLineForward(S)){M.preventDefault(),ee.move(f,{unit:"line"});return}if(Qe.isExtendLineBackward(S)){M.preventDefault(),ee.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Qe.isExtendLineForward(S)){M.preventDefault(),ee.move(f,{unit:"line",edge:"focus"});return}if(Qe.isMoveBackward(S)){M.preventDefault(),R&&G.isCollapsed(R)?ee.move(f,{reverse:!Z}):ee.collapse(f,{edge:Z?"end":"start"});return}if(Qe.isMoveForward(S)){M.preventDefault(),R&&G.isCollapsed(R)?ee.move(f,{reverse:Z}):ee.collapse(f,{edge:Z?"start":"end"});return}if(Qe.isMoveWordBackward(S)){M.preventDefault(),R&&G.isExpanded(R)&&ee.collapse(f,{edge:"focus"}),ee.move(f,{unit:"word",reverse:!Z});return}if(Qe.isMoveWordForward(S)){M.preventDefault(),R&&G.isExpanded(R)&&ee.collapse(f,{edge:"focus"}),ee.move(f,{unit:"word",reverse:Z});return}if(fn){if((Yf||Sr)&&R&&(Qe.isDeleteBackward(S)||Qe.isDeleteForward(S))&&G.isCollapsed(R)){var X=le.parent(f,R.anchor.path);if(fe.isElement(X)&&x.isVoid(f,X)&&(x.isInline(f,X)||x.isBlock(f,X))){M.preventDefault(),x.deleteBackward(f,{unit:"block"});return}}}else{if(Qe.isBold(S)||Qe.isItalic(S)||Qe.isTransposeCharacter(S)){M.preventDefault();return}if(Qe.isSoftBreak(S)){M.preventDefault(),x.insertSoftBreak(f);return}if(Qe.isSplitBlock(S)){M.preventDefault(),x.insertBreak(f);return}if(Qe.isDeleteBackward(S)){M.preventDefault(),R&&G.isExpanded(R)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f);return}if(Qe.isDeleteForward(S)){M.preventDefault(),R&&G.isExpanded(R)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f);return}if(Qe.isDeleteLineBackward(S)){M.preventDefault(),R&&G.isExpanded(R)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"line"});return}if(Qe.isDeleteLineForward(S)){M.preventDefault(),R&&G.isExpanded(R)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"line"});return}if(Qe.isDeleteWordBackward(S)){M.preventDefault(),R&&G.isExpanded(R)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"word"});return}if(Qe.isDeleteWordForward(S)){M.preventDefault(),R&&G.isExpanded(R)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:y.useCallback(M=>{!s&&te.hasEditableTarget(f,M.target)&&!mt(M,g.onPaste)&&(!fn||r1(M.nativeEvent)||Sr)&&(M.preventDefault(),te.insertData(f,M.clipboardData))},[s,f,g.onPaste])}),y.createElement(aC,{decorations:O,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},sC=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Wt({},t),n,pt&&y.createElement("br",null))},oC=()=>[],uC=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&G.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),qb(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},mt=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},ic=e=>yn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),lC=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},cC=y.createContext(!1),dC=y.createContext({});function fC(e){var t=y.useRef([]).current,n=y.useRef({editor:e}).current,r=y.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=y.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var mC=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],hC=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=fr(e,mC),[l,u]=y.useState(()=>{if(!le.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(at.stringify(s)));if(!x.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}=fC(t),h=y.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":a==null||a(t.selection);break;default:i==null||i(t.children)}u(v=>({v:v.v+1,editor:t})),m(t)},[t,m,r,a,i]);y.useEffect(()=>(Ws.set(t,h),()=>{Ws.set(t,()=>{})}),[t,h]);var[p,g]=y.useState(te.isFocused(t));return y.useEffect(()=>{g(te.isFocused(t))},[t]),Yr(()=>{var f=()=>g(te.isFocused(t));return Zf>=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)})},[]),y.createElement(dC.Provider,{value:d},y.createElement(cm.Provider,{value:l},y.createElement(Ro.Provider,{value:l.editor},y.createElement(cC.Provider,{value:p},n))))},sc=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},oc=(e,t,n)=>{var r=te.toDOMRange(e,t).getBoundingClientRect(),a=te.toDOMRange(e,n).getBoundingClientRect();return sc(r,a)&&sc(a,r)},pC=(e,t)=>{var n=x.range(e,G.end(t)),r=Array.from(x.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(oc(e,x.range(e,r[a]),n))return x.range(e,r[a],n);if(r.length<2)return x.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)oc(e,x.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return x.range(e,r[i],n)};function uc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function lc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?uc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var gC=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",r=t,{apply:a,onChange:i,deleteBackward:s,addMark:o,removeMark:l}=r;return yi.set(r,new WeakMap),r.addMark=(u,d)=>{var m,h;(m=zo.get(r))===null||m===void 0||m(),!$t.get(r)&&(h=xt.get(r))!==null&&h!==void 0&&h.length&&$t.set(r,null),rn.delete(r),o(u,d)},r.removeMark=u=>{var d;!$t.get(r)&&(d=xt.get(r))!==null&&d!==void 0&&d.length&&$t.set(r,null),rn.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&G.isCollapsed(r.selection)){var d=x.above(r,{match:g=>fe.isElement(g)&&x.isBlock(r,g),at:r.selection});if(d){var[,m]=d,h=x.range(r,m,r.selection.anchor),p=pC(r,h);G.isCollapsed(p)||ee.delete(r,{at:p})}}},r.apply=u=>{var d=[],m=[],h=xt.get(r);if(h!=null&&h.length){var p=h.map(j=>g1(j,u)).filter(Boolean);xt.set(r,p)}var g=pn.get(r);g&&pn.set(r,Gl(r,g,u));var f=hn.get(r);if(f!=null&&f.at){var b=Fe.isPoint(f==null?void 0:f.at)?Ks(r,f.at,u):Gl(r,f.at,u);hn.set(r,b?lc(lc({},f),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Zn(r,u.path));break}case"set_selection":{var v;(v=Nr.get(r))===null||v===void 0||v.unref(),Nr.delete(r);break}case"insert_node":case"remove_node":{d.push(...Zn(r,I.parent(u.path)));break}case"merge_node":{var C=I.previous(u.path);d.push(...Zn(r,C));break}case"move_node":{var D=I.common(I.parent(u.path),I.parent(u.newPath));d.push(...Zn(r,D));var A;I.isBefore(u.path,u.newPath)?(d.push(...Zn(r,I.parent(u.path))),A=u.newPath):(d.push(...Zn(r,I.parent(u.newPath))),A=u.path);var E=le.get(t,I.parent(A)),k=te.findKey(r,E),T=x.pathRef(r,I.parent(A));m.push([T,k]);break}}a(u);for(var[$,P]of d){var[z]=x.node(r,$);ei.set(z,P)}for(var[L,B]of m)if(L.current){var[F]=x.node(r,L.current);ei.set(F,B)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[m,h]=G.edges(d),p=x.void(r,{at:m.path}),g=x.void(r,{at:h.path});if(!(G.isCollapsed(d)&&!p)){var f=te.toDOMRange(r,d),b=f.cloneContents(),v=b.childNodes[0];if(b.childNodes.forEach(z=>{z.textContent&&z.textContent.trim()!==""&&(v=z)}),g){var[C]=g,D=f.cloneRange(),A=te.toDOMNode(r,C);D.setEndAfter(A),b=D.cloneContents()}if(p&&(v=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(z=>{var L=z.getAttribute("data-slate-zero-width")==="n";z.textContent=L?`
81
- `:""}),Xf(v)){var E=v.ownerDocument.createElement("span");E.style.whiteSpace="pre",E.appendChild(v),b.appendChild(E),v=E}var k=r.getFragment(),T=JSON.stringify(k),$=window.btoa(encodeURIComponent(T));v.setAttribute("data-slate-fragment",$),u.setData("application/".concat(n),$);var P=b.ownerDocument.createElement("div");return P.appendChild(b),P.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(P),u.setData("text/html",P.innerHTML),u.setData("text/plain",tm(P)),b.ownerDocument.body.removeChild(P),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||u1(u);if(d){var m=decodeURIComponent(window.atob(d)),h=JSON.parse(m);return r.insertFragment(h),!0}return!1},r.insertTextData=u=>{var d=u.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=u=>{var d=Zf<18?Gc.unstable_batchedUpdates:m=>m();d(()=>{var m=Ws.get(r);m&&m(u),i(u)})},r},Zn=(e,t)=>{var n=[];for(var[r,a]of x.levels(e,{at:t})){var i=te.findKey(e,r);n.push([a,i])}return n};const Ys="MENTION: ",fm={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},cc={"mention-popover":35,default:-52},Gi=16,mm=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:a,mentionPopover:i}=y.useContext(cn),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var p,g;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,d=0;if(t==="mention-popover"){const{position:f}=i,b=D=>{if(!x.hasPath(e,D.path))return!1;const A=le.get(e,D.path);return x.isEditor(A)||fe.isElement(A)?D.offset<=A.children.length:he.isText(A)?D.offset<=A.text.length:!1};if(f&&(!b(f==null?void 0:f.anchor)||!b(f==null?void 0:f.focus)))return;u=te.toDOMRange(e,f||fm).getBoundingClientRect();const C=(p=document.getElementById(n))==null?void 0:p.getBoundingClientRect();l.style.setProperty("--width",`${((C==null?void 0:C.width)||0)/Gi}rem`),d=(C==null?void 0:C.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(u=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}u||(u=(g=document.getElementById(n))==null?void 0:g.getBoundingClientRect());const m=cc[t]||cc.default,h=((u==null?void 0:u.top)||0)+window.scrollY+m;d===0&&(d=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${h/Gi}rem`,l.style.left=`${d/Gi}rem`},o),r},vC=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=x.nodes(e,{at:r,match:i=>i.type===H.link});if(a){const i=a[0],s=uo(i.link),o=i.children[0],l=(o==null?void 0:o.text)||"";n({...s,text:l})}else n(null)},[e,e.selection]),t};var ht=(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))(ht||{});const tr={[H.paragraph]:H.paragraph,[H.blockquote]:H.blockquote,[H.codeblock]:H.codeblock,[H.link]:H.link,[H.ul]:H.ul,[H.ol]:H.ol,[H.li]:H.li,[H.mention]:H.mention,[H.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Kt.emphasis]:H.italic,[Kt.strong]:H.bold,[Kt.delete]:H.strikethrough,[Kt.code]:H.code,[H.hr]:H.hr,[H.image]:H.image,[H.h3]:H.h3};function dc(e){if(e)throw e}var Ma=Object.prototype.hasOwnProperty,hm=Object.prototype.toString,fc=Object.defineProperty,mc=Object.getOwnPropertyDescriptor,hc=function(t){return typeof Array.isArray=="function"?Array.isArray(t):hm.call(t)==="[object Array]"},pc=function(t){if(!t||hm.call(t)!=="[object Object]")return!1;var n=Ma.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Ma.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||Ma.call(t,a)},gc=function(t,n){fc&&n.name==="__proto__"?fc(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},vc=function(t,n){if(n==="__proto__")if(Ma.call(t,n)){if(mc)return mc(t,n).value}else return;return t[n]},bC=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=vc(o,n),a=vc(t,n),o!==a&&(d&&a&&(pc(a)||(i=hc(a)))?(i?(i=!1,s=r&&hc(r)?r:[]):s=r&&pc(r)?r:{},gc(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&gc(o,{name:n,newValue:a}));return o};const Qi=Rn(bC);function Gs(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 yC(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const d=e[++i];let m=-1;if(l){s(l);return}for(;++m<a.length;)(u[m]===null||u[m]===void 0)&&(u[m]=a[m]);a=u,d?xC(d,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function xC(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const d=u;if(o&&n)throw d;return a(d)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function Ir(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?bc(e.position):"start"in e||"end"in e?bc(e):"line"in e||"column"in e?Qs(e):""}function Qs(e){return yc(e&&e.line)+":"+yc(e&&e.column)}function bc(e){return Qs(e&&e.start)+"-"+Qs(e&&e.end)}function yc(e){return e&&typeof e=="number"?e:1}class Dt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=o?o.line:void 0,this.name=Ir(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}Dt.prototype.file="";Dt.prototype.name="";Dt.prototype.reason="";Dt.prototype.message="";Dt.prototype.stack="";Dt.prototype.column=void 0;Dt.prototype.line=void 0;Dt.prototype.ancestors=void 0;Dt.prototype.cause=void 0;Dt.prototype.fatal=void 0;Dt.prototype.place=void 0;Dt.prototype.ruleId=void 0;Dt.prototype.source=void 0;const Vt={basename:CC,dirname:wC,extname:DC,join:EC,sep:"/"};function CC(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ea(e);let n=0,r=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else r<0&&(i=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function wC(e){if(ea(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 DC(e){ea(e);let t=e.length,n=-1,r=0,a=-1,i=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?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function EC(...e){let t=-1,n;for(;++t<e.length;)ea(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":_C(n)}function _C(e){ea(e);const t=e.codePointAt(0)===47;let n=kC(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function kC(e,t){let n="",r=0,a=-1,i=0,s=-1,o,l;for(;++s<=e.length;){if(s<e.length)o=e.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(a===s-1||i===1))if(a!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),a=s,i=0;continue}}else if(n.length>0){n="",r=0,a=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,s):n=e.slice(a+1,s),r=s-a-1;a=s,i=0}else o===46&&i>-1?i++:i=-1}return n}function ea(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const FC={cwd:AC};function AC(){return"/"}function Js(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function BC(e){if(typeof e=="string")e=new URL(e);else if(!Js(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 TC(e)}function TC(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 a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Ji=["history","path","basename","stem","extname","dirname"];class SC{constructor(t){let n;t?Js(t)?n={path:t}:typeof t=="string"||jC(t)?n={value:t}:n=t:n={},this.cwd=FC.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ji.length;){const i=Ji[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)Ji.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Vt.basename(this.path):void 0}set basename(t){es(t,"basename"),Xi(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){xc(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(Xi(t,"extname"),xc(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){Js(t)&&(t=BC(t)),es(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){es(t,"stem"),Xi(t,"stem"),this.path=Vt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new Dt(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Xi(e,t){if(e&&e.includes(Vt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Vt.sep+"`")}function es(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function xc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function jC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const OC=function(e){const r=this.constructor.prototype,a=r[e],i=function(){return a.apply(i,arguments)};Object.setPrototypeOf(i,r);const s=Object.getOwnPropertyNames(a);for(const o of s){const l=Object.getOwnPropertyDescriptor(a,o);l&&Object.defineProperty(i,o,l)}return i},PC={}.hasOwnProperty;class Wo extends OC{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=yC()}copy(){const t=new Wo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Qi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(rs("data",this.frozen),this.namespace[t]=n,this):PC.call(this.namespace,t)&&this.namespace[t]||void 0:t?(rs("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 a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=xa(t),r=this.parser||this.Parser;return ts("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ts("process",this.parser||this.Parser),ns("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=xa(t),l=r.parse(o);r.run(l,o,function(d,m,h){if(d||!m||!h)return u(d);const p=m,g=r.stringify(p,h);IC(g)?h.value=g:h.result=g,u(d,h)});function u(d,m){d||!m?s(d):i?i(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),ts("processSync",this.parser||this.Parser),ns("processSync",this.compiler||this.Compiler),this.process(t,a),wc("processSync","process",n),r;function a(i,s){n=!0,dc(i),r=s}}run(t,n,r){Cc(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,o){const l=xa(n);a.run(t,l,u);function u(d,m,h){const p=m||t;d?o(d):s?s(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),wc("runSync","run",r),a;function i(s,o){dc(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=xa(n),a=this.compiler||this.Compiler;return ns("stringify",a),Cc(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(rs("use",this.frozen),t!=null)if(typeof t=="function")l(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 i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...m]=u;l(d,m)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))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(u.plugins),u.settings&&(a.settings=Qi(!0,a.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const m=u[d];i(m)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let m=-1,h=-1;for(;++m<r.length;)if(r[m][0]===u){h=m;break}if(h===-1)r.push([u,...d]);else if(d.length>0){let[p,...g]=d;const f=r[h][1];Gs(f)&&Gs(p)&&(p=Qi(!0,f,p)),r[h]=[u,p,...g]}}}}const MC=new Wo().freeze();function ts(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ns(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function rs(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 Cc(e){if(!Gs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function wc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function xa(e){return NC(e)?e:new SC(e)}function NC(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function IC(e){return typeof e=="string"||RC(e)}function RC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const $C={};function LC(e,t){const n=t||$C,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return pm(e,r,a)}function pm(e,t,n){if(zC(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 Dc(e.children,t,n)}return Array.isArray(e)?Dc(e,t,n):""}function Dc(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=pm(e[a],t,n);return r.join("")}function zC(e){return!!(e&&typeof e=="object")}const Ec=document.createElement("i");function Vo(e){const t="&"+e+";";Ec.innerHTML=t;const n=Ec.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function on(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a: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);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function jt(e,t){return e.length>0?(on(e,e.length,0,t),e):t}const _c={}.hasOwnProperty;function qC(e){const t={};let n=-1;for(;++n<e.length;)UC(t,e[n]);return t}function UC(e,t){let n;for(n in t){const a=(_c.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){_c.call(a,s)||(a[s]=[]);const o=i[s];WC(a[s],Array.isArray(o)?o:o?[o]:[])}}}function WC(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 gm(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 ir(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ht=Dn(/[A-Za-z]/),Lt=Dn(/[\dA-Za-z]/),VC=Dn(/[#-'*+\--9=?A-Z^-~]/);function Xs(e){return e!==null&&(e<32||e===127)}const eo=Dn(/\d/),HC=Dn(/[\dA-Fa-f]/),KC=Dn(/[!-/:-@[-`{-~]/);function xe(e){return e!==null&&e<-2}function wt(e){return e!==null&&(e<0||e===32)}function Ie(e){return e===-2||e===-1||e===32}const ZC=Dn(/\p{P}|\p{S}/u),YC=Dn(/\s/);function Dn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function He(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Ie(l)?(e.enter(n),o(l)):t(l)}function o(l){return Ie(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const GC={tokenize:QC};function QC(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),He(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return xe(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const JC={tokenize:XC},kc={tokenize:ew};function XC(e){const t=this,n=[];let r=0,a,i,s;return o;function o(D){if(r<n.length){const A=n[r];return t.containerState=A[1],e.attempt(A[0].continuation,l,u)(D)}return u(D)}function l(D){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&C();const A=t.events.length;let E=A,k;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){k=t.events[E][1].end;break}v(r);let T=A;for(;T<t.events.length;)t.events[T][1].end=Object.assign({},k),T++;return on(t.events,E+1,0,t.events.slice(A)),t.events.length=T,u(D)}return o(D)}function u(D){if(r===n.length){if(!a)return h(D);if(a.currentConstruct&&a.currentConstruct.concrete)return g(D);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(kc,d,m)(D)}function d(D){return a&&C(),v(r),h(D)}function m(D){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(D)}function h(D){return t.containerState={},e.attempt(kc,p,g)(D)}function p(D){return r++,n.push([t.currentConstruct,t.containerState]),h(D)}function g(D){if(D===null){a&&C(),v(0),e.consume(D);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(D)}function f(D){if(D===null){b(e.exit("chunkFlow"),!0),v(0),e.consume(D);return}return xe(D)?(e.consume(D),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(D),f)}function b(D,A){const E=t.sliceStream(D);if(A&&E.push(null),D.previous=i,i&&(i.next=D),i=D,a.defineSkip(D.start),a.write(E),t.parser.lazy[D.start.line]){let k=a.events.length;for(;k--;)if(a.events[k][1].start.offset<s&&(!a.events[k][1].end||a.events[k][1].end.offset>s))return;const T=t.events.length;let $=T,P,z;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(P){z=t.events[$][1].end;break}P=!0}for(v(r),k=T;k<t.events.length;)t.events[k][1].end=Object.assign({},z),k++;on(t.events,$+1,0,t.events.slice(T)),t.events.length=k}}function v(D){let A=n.length;for(;A-- >D;){const E=n[A];t.containerState=E[1],E[0].exit.call(t,e)}n.length=D}function C(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function ew(e,t,n){return He(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Fc(e){if(e===null||wt(e)||YC(e))return 1;if(ZC(e))return 2}function Ho(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const to={name:"attention",tokenize:nw,resolveAll:tw};function tw(e,t){let n=-1,r,a,i,s,o,l,u,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;l=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);Ac(m,-l),Ac(h,l),s={type:l>1?"strongSequence":"emphasisSequence",start:m,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:h},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>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),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=jt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=jt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=jt(u,Ho(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=jt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=jt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,on(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function nw(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Fc(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),d=Fc(l),m=!d||d===2&&a||n.includes(l),h=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?m:m&&(a||!h)),u._close=!!(i===42?h:h&&(d||!m)),t(l)}}function Ac(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const rw={name:"autolink",tokenize:aw};function aw(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return Ht(p)?(e.consume(p),s):p===64?n(p):u(p)}function s(p){return p===43||p===45||p===46||Lt(p)?(r=1,o(p)):u(p)}function o(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||Lt(p))&&r++<32?(e.consume(p),o):(r=0,u(p))}function l(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||Xs(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),d):VC(p)?(e.consume(p),u):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 xi={tokenize:iw,partial:!0};function iw(e,t,n){return r;function r(i){return Ie(i)?He(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||xe(i)?t(i):n(i)}}const vm={name:"blockQuote",tokenize:sw,continuation:{tokenize:ow},exit:uw};function sw(e,t,n){const r=this;return a;function a(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"),i}return n(s)}function i(s){return Ie(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function ow(e,t,n){const r=this;return a;function a(s){return Ie(s)?He(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(vm,t,n)(s)}}function uw(e){e.exit("blockQuote")}const bm={name:"characterEscape",tokenize:lw};function lw(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return KC(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const ym={name:"characterReference",tokenize:cw};function cw(e,t,n){const r=this;let a=0,i,s;return o;function o(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),l}function l(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=Lt,d(m))}function u(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=HC,d):(e.enter("characterReferenceValue"),i=7,s=eo,d(m))}function d(m){if(m===59&&a){const h=e.exit("characterReferenceValue");return s===Lt&&!Vo(r.sliceSerialize(h))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(m)&&a++<i?(e.consume(m),d):n(m)}}const Bc={tokenize:fw,partial:!0},Tc={name:"codeFenced",tokenize:dw,concrete:!0};function dw(e,t,n){const r=this,a={tokenize:E,partial:!0};let i=0,s=0,o;return l;function l(k){return u(k)}function u(k){const T=r.events[r.events.length-1];return i=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,o=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(k)}function d(k){return k===o?(s++,e.consume(k),d):s<3?n(k):(e.exit("codeFencedFenceSequence"),Ie(k)?He(e,m,"whitespace")(k):m(k))}function m(k){return k===null||xe(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(Bc,f,A)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(k))}function h(k){return k===null||xe(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(k)):Ie(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),He(e,p,"whitespace")(k)):k===96&&k===o?n(k):(e.consume(k),h)}function p(k){return k===null||xe(k)?m(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===null||xe(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(k)):k===96&&k===o?n(k):(e.consume(k),g)}function f(k){return e.attempt(a,A,b)(k)}function b(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),v}function v(k){return i>0&&Ie(k)?He(e,C,"linePrefix",i+1)(k):C(k)}function C(k){return k===null||xe(k)?e.check(Bc,f,A)(k):(e.enter("codeFlowValue"),D(k))}function D(k){return k===null||xe(k)?(e.exit("codeFlowValue"),C(k)):(e.consume(k),D)}function A(k){return e.exit("codeFenced"),t(k)}function E(k,T,$){let P=0;return z;function z(O){return k.enter("lineEnding"),k.consume(O),k.exit("lineEnding"),L}function L(O){return k.enter("codeFencedFence"),Ie(O)?He(k,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):B(O)}function B(O){return O===o?(k.enter("codeFencedFenceSequence"),F(O)):$(O)}function F(O){return O===o?(P++,k.consume(O),F):P>=s?(k.exit("codeFencedFenceSequence"),Ie(O)?He(k,j,"whitespace")(O):j(O)):$(O)}function j(O){return O===null||xe(O)?(k.exit("codeFencedFence"),T(O)):$(O)}}}function fw(e,t,n){const r=this;return a;function a(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const as={name:"codeIndented",tokenize:hw},mw={tokenize:pw,partial:!0};function hw(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),He(e,i,"linePrefix",4+1)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):xe(u)?e.attempt(mw,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||xe(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function pw(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):xe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):He(e,i,"linePrefix",4+1)(s)}function i(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):xe(s)?a(s):n(s)}}const gw={name:"codeText",tokenize:yw,resolve:vw,previous:bw};function vw(e){let t=e.length-4,n=3,r,a;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;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function bw(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function yw(e,t,n){let r=0,a,i;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"),l(m))}function l(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),l):m===96?(i=e.enter("codeTextSequence"),a=0,d(m)):xe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||xe(m)?(e.exit("codeTextData"),l(m)):(e.consume(m),u)}function d(m){return m===96?(e.consume(m),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(i.type="codeTextData",u(m))}}class xw{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 a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Fr(this.left,r),i.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),Fr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Fr(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);Fr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Fr(this.left,n.reverse())}}}function Fr(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 xm(e){const t={};let n=-1,r,a,i,s,o,l,u;const d=new xw(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"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Cw(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=d.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},d.get(a)[1].start),o=d.slice(a,n),o.unshift(r),d.splice(a,n-a+1,o))}}return on(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function Cw(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let d,m,h=-1,p=n,g=0,f=0;const b=[f];for(;p;){for(;e.get(++a)[1]!==p;);i.push(a),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]),C=i.pop();l.push([C,C+v.length-1]),e.splice(C,2,v)}for(l.reverse(),h=-1;++h<l.length;)u[g+l[h][0]]=g+l[h][1],g+=l[h][1]-l[h][0]-1;return u}const ww={tokenize:_w,resolve:Ew},Dw={tokenize:kw,partial:!0};function Ew(e){return xm(e),e}function _w(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):xe(o)?e.check(Dw,s,i)(o):(e.consume(o),a)}function i(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,a}}function kw(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),He(e,i,"linePrefix")}function i(s){if(s===null||xe(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 Cm(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return m;function m(v){return v===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(v),e.exit(i),h):v===null||v===32||v===41||Xs(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(i),e.consume(v),e.exit(i),e.exit(a),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||xe(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||wt(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):d<u&&v===40?(e.consume(v),d++,f):v===41?(e.consume(v),d--,f):v===null||v===32||v===40||Xs(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 wm(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),d}function d(p){return o>999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):xe(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||xe(p)||o++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!Ie(p)),p===92?h:m)}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,m):m(p)}}function Dm(e,t,n,r,a,i){let s;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(a),e.consume(h),e.exit(a),s=h===40?41:h,l):n(h)}function l(h){return h===s?(e.enter(a),e.consume(h),e.exit(a),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===s?(e.exit(i),l(s)):h===null?n(h):xe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),He(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===s||h===null||xe(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?m:d)}function m(h){return h===s||h===92?(e.consume(h),d):d(h)}}function Rr(e,t){let n;return r;function r(a){return xe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Ie(a)?He(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const Fw={name:"definition",tokenize:Bw},Aw={tokenize:Tw,partial:!0};function Bw(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return wm.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return a=ir(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return wt(p)?Rr(e,u)(p):u(p)}function u(p){return Cm(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(Aw,m,m)(p)}function m(p){return Ie(p)?He(e,h,"whitespace")(p):h(p)}function h(p){return p===null||xe(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function Tw(e,t,n){return r;function r(o){return wt(o)?Rr(e,a)(o):n(o)}function a(o){return Dm(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Ie(o)?He(e,s,"whitespace")(o):s(o)}function s(o){return o===null||xe(o)?t(o):n(o)}}const Sw={name:"hardBreakEscape",tokenize:jw};function jw(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return xe(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const Ow={name:"headingAtx",tokenize:Mw,resolve:Pw};function Pw(e,t){let n=e.length-2,r=3,a,i;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&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},on(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function Mw(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||wt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||xe(d)?(e.exit("atxHeading"),t(d)):Ie(d)?He(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||wt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const Nw=["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"],Sc=["pre","script","style","textarea"],Iw={name:"htmlFlow",tokenize:zw,resolveTo:Lw,concrete:!0},Rw={tokenize:Uw,partial:!0},$w={tokenize:qw,partial:!0};function Lw(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 zw(e,t,n){const r=this;let a,i,s,o,l;return u;function u(_){return d(_)}function d(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),m}function m(_){return _===33?(e.consume(_),h):_===47?(e.consume(_),i=!0,f):_===63?(e.consume(_),a=3,r.interrupt?t:w):Ht(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function h(_){return _===45?(e.consume(_),a=2,p):_===91?(e.consume(_),a=5,o=0,g):Ht(_)?(e.consume(_),a=4,r.interrupt?t:w):n(_)}function p(_){return _===45?(e.consume(_),r.interrupt?t:w):n(_)}function g(_){const M="CDATA[";return _===M.charCodeAt(o++)?(e.consume(_),o===M.length?r.interrupt?t:B:g):n(_)}function f(_){return Ht(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function b(_){if(_===null||_===47||_===62||wt(_)){const M=_===47,U=s.toLowerCase();return!M&&!i&&Sc.includes(U)?(a=1,r.interrupt?t(_):B(_)):Nw.includes(s.toLowerCase())?(a=6,M?(e.consume(_),v):r.interrupt?t(_):B(_)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?C(_):D(_))}return _===45||Lt(_)?(e.consume(_),s+=String.fromCharCode(_),b):n(_)}function v(_){return _===62?(e.consume(_),r.interrupt?t:B):n(_)}function C(_){return Ie(_)?(e.consume(_),C):z(_)}function D(_){return _===47?(e.consume(_),z):_===58||_===95||Ht(_)?(e.consume(_),A):Ie(_)?(e.consume(_),D):z(_)}function A(_){return _===45||_===46||_===58||_===95||Lt(_)?(e.consume(_),A):E(_)}function E(_){return _===61?(e.consume(_),k):Ie(_)?(e.consume(_),E):D(_)}function k(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,T):Ie(_)?(e.consume(_),k):$(_)}function T(_){return _===l?(e.consume(_),l=null,P):_===null||xe(_)?n(_):(e.consume(_),T)}function $(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||wt(_)?E(_):(e.consume(_),$)}function P(_){return _===47||_===62||Ie(_)?D(_):n(_)}function z(_){return _===62?(e.consume(_),L):n(_)}function L(_){return _===null||xe(_)?B(_):Ie(_)?(e.consume(_),L):n(_)}function B(_){return _===45&&a===2?(e.consume(_),q):_===60&&a===1?(e.consume(_),W):_===62&&a===4?(e.consume(_),Q):_===63&&a===3?(e.consume(_),w):_===93&&a===5?(e.consume(_),J):xe(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(Rw,se,F)(_)):_===null||xe(_)?(e.exit("htmlFlowData"),F(_)):(e.consume(_),B)}function F(_){return e.check($w,j,se)(_)}function j(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),O}function O(_){return _===null||xe(_)?F(_):(e.enter("htmlFlowData"),B(_))}function q(_){return _===45?(e.consume(_),w):B(_)}function W(_){return _===47?(e.consume(_),s="",ne):B(_)}function ne(_){if(_===62){const M=s.toLowerCase();return Sc.includes(M)?(e.consume(_),Q):B(_)}return Ht(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),ne):B(_)}function J(_){return _===93?(e.consume(_),w):B(_)}function w(_){return _===62?(e.consume(_),Q):_===45&&a===2?(e.consume(_),w):B(_)}function Q(_){return _===null||xe(_)?(e.exit("htmlFlowData"),se(_)):(e.consume(_),Q)}function se(_){return e.exit("htmlFlow"),t(_)}}function qw(e,t,n){const r=this;return a;function a(s){return xe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function Uw(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(xi,t,n)}}const Ww={name:"htmlText",tokenize:Vw};function Vw(e,t,n){const r=this;let a,i,s;return o;function o(w){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(w),l}function l(w){return w===33?(e.consume(w),u):w===47?(e.consume(w),E):w===63?(e.consume(w),D):Ht(w)?(e.consume(w),$):n(w)}function u(w){return w===45?(e.consume(w),d):w===91?(e.consume(w),i=0,g):Ht(w)?(e.consume(w),C):n(w)}function d(w){return w===45?(e.consume(w),p):n(w)}function m(w){return w===null?n(w):w===45?(e.consume(w),h):xe(w)?(s=m,W(w)):(e.consume(w),m)}function h(w){return w===45?(e.consume(w),p):m(w)}function p(w){return w===62?q(w):w===45?h(w):m(w)}function g(w){const Q="CDATA[";return w===Q.charCodeAt(i++)?(e.consume(w),i===Q.length?f:g):n(w)}function f(w){return w===null?n(w):w===93?(e.consume(w),b):xe(w)?(s=f,W(w)):(e.consume(w),f)}function b(w){return w===93?(e.consume(w),v):f(w)}function v(w){return w===62?q(w):w===93?(e.consume(w),v):f(w)}function C(w){return w===null||w===62?q(w):xe(w)?(s=C,W(w)):(e.consume(w),C)}function D(w){return w===null?n(w):w===63?(e.consume(w),A):xe(w)?(s=D,W(w)):(e.consume(w),D)}function A(w){return w===62?q(w):D(w)}function E(w){return Ht(w)?(e.consume(w),k):n(w)}function k(w){return w===45||Lt(w)?(e.consume(w),k):T(w)}function T(w){return xe(w)?(s=T,W(w)):Ie(w)?(e.consume(w),T):q(w)}function $(w){return w===45||Lt(w)?(e.consume(w),$):w===47||w===62||wt(w)?P(w):n(w)}function P(w){return w===47?(e.consume(w),q):w===58||w===95||Ht(w)?(e.consume(w),z):xe(w)?(s=P,W(w)):Ie(w)?(e.consume(w),P):q(w)}function z(w){return w===45||w===46||w===58||w===95||Lt(w)?(e.consume(w),z):L(w)}function L(w){return w===61?(e.consume(w),B):xe(w)?(s=L,W(w)):Ie(w)?(e.consume(w),L):P(w)}function B(w){return w===null||w===60||w===61||w===62||w===96?n(w):w===34||w===39?(e.consume(w),a=w,F):xe(w)?(s=B,W(w)):Ie(w)?(e.consume(w),B):(e.consume(w),j)}function F(w){return w===a?(e.consume(w),a=void 0,O):w===null?n(w):xe(w)?(s=F,W(w)):(e.consume(w),F)}function j(w){return w===null||w===34||w===39||w===60||w===61||w===96?n(w):w===47||w===62||wt(w)?P(w):(e.consume(w),j)}function O(w){return w===47||w===62||wt(w)?P(w):n(w)}function q(w){return w===62?(e.consume(w),e.exit("htmlTextData"),e.exit("htmlText"),t):n(w)}function W(w){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),ne}function ne(w){return Ie(w)?He(e,J,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):J(w)}function J(w){return e.enter("htmlTextData"),s(w)}}const Ko={name:"labelEnd",tokenize:Qw,resolveTo:Gw,resolveAll:Yw},Hw={tokenize:Jw},Kw={tokenize:Xw},Zw={tokenize:eD};function Yw(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 Gw(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},d={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=jt(o,e.slice(i+1,i+r+3)),o=jt(o,[["enter",d,t]]),o=jt(o,Ho(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=jt(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=jt(o,e.slice(s+1)),o=jt(o,[["exit",l,t]]),on(e,i,e.length,o),e}function Qw(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(h){return i?i._inactive?m(h):(s=r.parser.defined.includes(ir(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(Hw,d,s?d:m)(h):h===91?e.attempt(Kw,d,s?u:m)(h):s?d(h):m(h)}function u(h){return e.attempt(Zw,d,m)(h)}function d(h){return t(h)}function m(h){return i._balanced=!0,n(h)}}function Jw(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return wt(m)?Rr(e,i)(m):i(m)}function i(m){return m===41?d(m):Cm(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function s(m){return wt(m)?Rr(e,l)(m):d(m)}function o(m){return n(m)}function l(m){return m===34||m===39||m===40?Dm(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):d(m)}function u(m){return wt(m)?Rr(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 Xw(e,t,n){const r=this;return a;function a(o){return wm.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(ir(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function eD(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const tD={name:"labelStartImage",tokenize:nD,resolveAll:Ko.resolveAll};function nD(e,t,n){const r=this;return a;function a(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(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 rD={name:"labelStartLink",tokenize:aD,resolveAll:Ko.resolveAll};function aD(e,t,n){const r=this;return a;function a(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const is={name:"lineEnding",tokenize:iD};function iD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),He(e,t,"linePrefix")}}const Na={name:"thematicBreak",tokenize:sD};function sD(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||xe(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Ie(u)?He(e,o,"whitespace")(u):o(u))}}const yt={name:"list",tokenize:lD,continuation:{tokenize:cD},exit:fD},oD={tokenize:mD,partial:!0},uD={tokenize:dD,partial:!0};function lD(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[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:eo(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(Na,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return eo(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(xi,r.interrupt?n:d,e.attempt(oD,h,m))}function d(p){return r.containerState.initialBlankLine=!0,i++,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=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function cD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(xi,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,He(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(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(uD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,He(e,e.attempt(yt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function dD(e,t,n){const r=this;return He(e,a,"listItemIndent",r.containerState.size+1);function a(i){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(i):n(i)}}function fD(e){e.exit(this.containerState.type)}function mD(e,t,n){const r=this;return He(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function a(i){const s=r.events[r.events.length-1];return!Ie(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const jc={name:"setextUnderline",tokenize:pD,resolveTo:hD};function hD(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:Object.assign({},e[a][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[i][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}function pD(e,t,n){const r=this;let a;return i;function i(u){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"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Ie(u)?He(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||xe(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const gD={tokenize:vD};function vD(e){const t=this,n=e.attempt(xi,r,e.attempt(this.parser.constructs.flowInitial,a,He(e,e.attempt(this.parser.constructs.flow,a,e.attempt(ww,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const bD={resolveAll:_m()},yD=Em("string"),xD=Em("text");function Em(e){return{tokenize:t,resolveAll:_m(e==="text"?CD:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const m=a[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 _m(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function CD(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],a=t.sliceStream(r);let i=a.length,s=-1,o=0,l;for(;i--;){const u=a[i];if(typeof u=="string"){for(s=u.length;u.charCodeAt(s-1)===32;)o++,s--;if(s)break;s=-1}else if(u===-2)l=!0,o++;else if(u!==-1){i++;break}}if(o){const u={type:n===e.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-o,offset:r.end.offset-o,_index:r.start._index+i,_bufferIndex:i?s:r.start._bufferIndex+s},end:Object.assign({},r.end)};r.end=Object.assign({},u.start),r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}function wD(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:C,enter:D,exit:A,attempt:T(E),check:T(k),interrupt:T(k,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:h,now:g,defineSkip:f,write:m};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function m(L){return s=jt(s,L),b(),s[s.length-1]!==null?[]:($(t,0),u.events=Ho(i,u.events,u),u.events)}function h(L,B){return ED(p(L),B)}function p(L){return DD(s,L)}function g(){const{line:L,column:B,offset:F,_index:j,_bufferIndex:O}=r;return{line:L,column:B,offset:F,_index:j,_bufferIndex:O}}function f(L){a[L.line]=L.column,z()}function b(){let L;for(;r._index<s.length;){const B=s[r._index];if(typeof B=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<B.length;)v(B.charCodeAt(r._bufferIndex));else v(B)}}function v(L){d=d(L)}function C(L){xe(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,z()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=L}function D(L,B){const F=B||{};return F.type=L,F.start=g(),u.events.push(["enter",F,u]),o.push(F),F}function A(L){const B=o.pop();return B.end=g(),u.events.push(["exit",B,u]),B}function E(L,B){$(L,B.from)}function k(L,B){B.restore()}function T(L,B){return F;function F(j,O,q){let W,ne,J,w;return Array.isArray(j)?se(j):"tokenize"in j?se([j]):Q(j);function Q(S){return R;function R(K){const Z=K!==null&&S[K],re=K!==null&&S.null,ce=[...Array.isArray(Z)?Z:Z?[Z]:[],...Array.isArray(re)?re:re?[re]:[]];return se(ce)(K)}}function se(S){return W=S,ne=0,S.length===0?q:_(S[ne])}function _(S){return R;function R(K){return w=P(),J=S,S.partial||(u.currentConstruct=S),S.name&&u.parser.constructs.disable.null.includes(S.name)?U():S.tokenize.call(B?Object.assign(Object.create(u),B):u,l,M,U)(K)}}function M(S){return L(J,w),O}function U(S){return w.restore(),++ne<W.length?_(W[ne]):q}}}function $(L,B){L.resolveAll&&!i.includes(L)&&i.push(L),L.resolve&&on(u.events,B,u.events.length-B,L.resolve(u.events.slice(B),u)),L.resolveTo&&(u.events=L.resolveTo(u.events,u))}function P(){const L=g(),B=u.previous,F=u.currentConstruct,j=u.events.length,O=Array.from(o);return{restore:q,from:j};function q(){r=L,u.previous=B,u.currentConstruct=F,u.events.length=j,o=O,z()}}function z(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function DD(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let s;if(n===a)s=[e[n].slice(r,i)];else{if(s=e.slice(n,a),r>-1){const o=s[0];typeof o=="string"?s[0]=o.slice(r):s.shift()}i>0&&s.push(e[a].slice(0,i))}return s}function ED(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
80
+ `:""),[i]=y.useState(a);return Yr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(N1,{ref:r},i)},N1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Yi=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),y.createElement("span",P1({},a),!pt||!n?"\uFEFF":null,n?y.createElement("br",null):null)};function tc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function sm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var I1=pt?300:0;function R1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function nc(e){e.current&&(clearTimeout(e.current),e.current=null)}var $1=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=C=>y.createElement(z1,sm({},C))}=e,o=wn(),l=y.useRef(null),u=y.useRef(null),[d,m]=y.useState(!1),h=y.useRef(null),p=y.useCallback(C=>{if(R1(l,C==null),C==null){var D;qs.delete(o),(D=t.onPlaceholderResize)===null||D===void 0||D.call(t,null)}else{if(qs.set(o,C),!l.current){var A=window.ResizeObserver||zx;l.current=new A(()=>{var E;(E=t.onPlaceholderResize)===null||E===void 0||E.call(t,C)})}l.current.observe(C),u.current=C}},[u,t,o]),g=y.createElement(M1,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[mr];if(y.useEffect(()=>(f?h.current||(h.current=setTimeout(()=>{m(!0),h.current=null},I1)):(nc(h),m(!1)),()=>nc(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:Sr?"inherit":void 0},contentEditable:!1,ref:p}};g=y.createElement(y.Fragment,null,i(b),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},L1=y.memo($1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&he.equals(t.leaf,e.leaf)&&t.leaf[mr]===e.leaf[mr]),z1=e=>{var{attributes:t,children:n}=e;return y.createElement("span",sm({},t),n)},q1=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=wn(),l=y.useRef(null),u=he.decorations(s,t),d=te.findKey(o,s),m=[],h=0;h<u.length;h++){var p=u[h];m.push(y.createElement(L1,{isLast:n&&h===u.length-1,key:"".concat(d.id,"-").concat(h),renderPlaceholder:a,leaf:p,text:s,parent:r,renderLeaf:i}))}var g=y.useCallback(f=>{var b=yi.get(o);f?(b==null||b.set(d,f),jn.set(s,f),Zr.set(f,s)):(b==null||b.delete(d),jn.delete(s),l.current&&Zr.delete(l.current)),l.current=f},[l,o,d,s]);return y.createElement("span",{"data-slate-node":"text",ref:g},m)},om=y.memo(q1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&O1(t.decorations,e.decorations));function rc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Zs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var U1=e=>{var{decorations:t,element:n,renderElement:r=C=>y.createElement(V1,Zs({},C)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=wn(),l=Z1(),u=o.isInline(n),d=te.findKey(o,n),m=y.useCallback(C=>{var D=yi.get(o);C?(D==null||D.set(d,C),jn.set(n,C),Zr.set(C,n)):(D==null||D.delete(d),jn.delete(n))},[o,d,n]),h=lm({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),p={"data-slate-node":"element",ref:m};if(u&&(p["data-slate-inline"]=!0),!u&&x.hasInlines(o,n)){var g=le.string(n),f=Ef(g);f==="rtl"&&(p.dir=f)}if(x.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var b=u?"span":"div",[[v]]=le.texts(n);h=y.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(om,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),$o.set(v,0),Lo.set(v,n)}return r({attributes:p,children:h,element:n})},W1=y.memo(U1,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&j1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&G.equals(e.selection,t.selection))),V1=e=>{var{attributes:t,children:n,element:r}=e,a=wn(),i=a.isInline(r)?"span":"div";return y.createElement(i,Zs(Zs({},t),{},{style:{position:"relative"}}),n)},um=y.createContext(()=>[]),H1=()=>y.useContext(um),K1=y.createContext(!1),lm=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=H1(),l=wn(),u=te.findPath(l,n),d=[],m=fe.isElement(n)&&!l.isInline(n)&&x.hasInlines(l,n),h=0;h<n.children.length;h++){var p=u.concat(h),g=n.children[h],f=te.findKey(l,g),b=x.range(l,p),v=s&&G.intersection(b,s),C=o([g,p]);for(var D of t){var A=G.intersection(D,b);A&&C.push(A)}fe.isElement(g)?d.push(y.createElement(K1.Provider,{key:"provider-".concat(f.id),value:!!v},y.createElement(W1,{decorations:C,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):d.push(y.createElement(om,{decorations:C,key:f.id,isLast:m&&h===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),$o.set(g,h),Lo.set(g,n)}return d},cm=y.createContext(!1),Z1=()=>y.useContext(cm),dm=y.createContext(null),qn=()=>{var e=y.useContext(dm);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function Y1(){var e=wn(),t=y.useRef(!1),n=y.useRef(0),r=y.useCallback(()=>{if(!t.current){t.current=!0;var a=te.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return y.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var G1=3,Q1={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"},J1={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"},X1={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ye=e=>{var t=Q1[e],n=J1[e],r=X1[e],a=t&&Zi(t),i=n&&Zi(n),s=r&&Zi(r);return o=>!!(a&&a(o)||Zl&&i&&i(o)||!Zl&&s&&s(o))},Qe={isBold:Ye("bold"),isCompose:Ye("compose"),isMoveBackward:Ye("moveBackward"),isMoveForward:Ye("moveForward"),isDeleteBackward:Ye("deleteBackward"),isDeleteForward:Ye("deleteForward"),isDeleteLineBackward:Ye("deleteLineBackward"),isDeleteLineForward:Ye("deleteLineForward"),isDeleteWordBackward:Ye("deleteWordBackward"),isDeleteWordForward:Ye("deleteWordForward"),isExtendBackward:Ye("extendBackward"),isExtendForward:Ye("extendForward"),isExtendLineBackward:Ye("extendLineBackward"),isExtendLineForward:Ye("extendLineForward"),isItalic:Ye("italic"),isMoveLineBackward:Ye("moveLineBackward"),isMoveLineForward:Ye("moveLineForward"),isMoveWordBackward:Ye("moveWordBackward"),isMoveWordForward:Ye("moveWordForward"),isRedo:Ye("redo"),isSoftBreak:Ye("insertSoftBreak"),isSplitBlock:Ye("splitBlock"),isTransposeCharacter:Ye("transposeCharacter"),isUndo:Ye("undo")},eC=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>Uo(e,l,s));n.push(...o)}};function i(){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:a,restoreDOM:i,clear:r}},tC={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class fm extends y.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,tC)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=eC(n,t),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var t,n,r,a=(t=this.mutationObserver)===null||t===void 0?void 0:t.takeRecords();if(a!=null&&a.length){var i;(i=this.manager)===null||i===void 0||i.registerMutations(a)}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(fm,"contextType",Ro);var nC=pt?fm:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},rC=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],aC=["text"];function ac(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Wt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ac(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ac(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var iC=e=>y.createElement(y.Fragment,null,lm(e)),sC=e=>{var t=y.useCallback(M=>y.createElement(oC,Wt({},M)),[]),{autoFocus:n,decorate:r=uC,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=lC,style:m={},as:h="div",disableDefaultStyles:p=!1}=e,g=fr(e,rC),f=qn(),[b,v]=y.useState(!1),C=y.useRef(null),D=y.useRef([]),[A,E]=y.useState(),{onUserInput:k,receivedUserInput:T}=Y1(),[,$]=y.useReducer(M=>M+1,0);Jf.set(f,$),Us.set(f,s);var P=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{C.current&&n&&C.current.focus()},[n]);var z=y.useRef(),L=y.useMemo(()=>Lb(()=>{var M=z.current;if((pt||!te.isComposing(f))&&(!P.isUpdatingSelection||M!=null&&M.isFlushing())&&!P.isDraggingInternally){var U=te.findDocumentOrShadowRoot(f),{activeElement:S}=U,R=te.toDOMNode(f,f),K=U.getSelection();if(S===R?(P.latestElement=S,bn.set(f,!0)):bn.delete(f),!K)return ee.deselect(f);var{anchorNode:Z,focusNode:re}=K,ce=te.hasEditableTarget(f,Z)||te.isTargetInsideNonReadonlyVoid(f,Z),X=te.hasEditableTarget(f,re)||te.isTargetInsideNonReadonlyVoid(f,re);if(ce&&X){var pe=te.toSlateRange(f,K,{exactMatch:!1,suppressThrow:!0});pe&&(!te.isComposing(f)&&!(M!=null&&M.hasPendingChanges())&&!(M!=null&&M.isFlushing())?ee.select(f,pe):M==null||M.handleUserSelect(pe))}s&&(!ce||!X)&&ee.deselect(f)}},100),[f,s,P]),B=y.useMemo(()=>Pb(L,0),[L]);z.current=A1({node:C,onDOMSelectionChange:L,scheduleOnDOMSelectionChange:B}),Yr(()=>{var M,U,S;C.current&&(S=qo(C.current))?(Qf.set(f,S),Pa.set(f,C.current),jn.set(f,C.current),Zr.set(C.current,f)):jn.delete(f);var{selection:R}=f,K=te.findDocumentOrShadowRoot(f),Z=K.getSelection();if(!(!Z||!te.isFocused(f)||(M=z.current)!==null&&M!==void 0&&M.hasPendingAction())){var re=ve=>{var ye=Z.type!=="None";if(!(!R&&!ye)){var Me=Z.focusNode,je;if(er&&Z.rangeCount>1){var Je=Z.getRangeAt(0),Ue=Z.getRangeAt(Z.rangeCount-1);Je.startContainer===Me?je=Ue.endContainer:je=Je.startContainer}else je=Z.anchorNode;var Le=Pa.get(f),Xe=!1;if(Le.contains(je)&&Le.contains(Me)&&(Xe=!0),ye&&Xe&&R&&!ve){var _e=te.toSlateRange(f,Z,{exactMatch:!0,suppressThrow:!0});if(_e&&G.equals(_e,R)){var Oe;if(!P.hasMarkPlaceholder||(Oe=je)!==null&&Oe!==void 0&&(Oe=Oe.parentElement)!==null&&Oe!==void 0&&Oe.hasAttribute("data-slate-mark-placeholder"))return}}if(R&&!te.hasRange(f,R)){f.selection=te.toSlateRange(f,Z,{exactMatch:!1,suppressThrow:!0});return}P.isUpdatingSelection=!0;var We=R&&te.toDOMRange(f,R);return We?(te.isComposing(f)&&!pt?Z.collapseToEnd():G.isBackward(R)?Z.setBaseAndExtent(We.endContainer,We.endOffset,We.startContainer,We.startOffset):Z.setBaseAndExtent(We.startContainer,We.startOffset,We.endContainer,We.endOffset),d(f,We)):Z.removeAllRanges(),We}};Z.rangeCount<=1&&re();var ce=((U=z.current)===null||U===void 0?void 0:U.isFlushing())==="action";if(!pt||!ce){setTimeout(()=>{P.isUpdatingSelection=!1});return}var X=null,pe=requestAnimationFrame(()=>{if(ce){var ve=ye=>{try{var Me=te.toDOMNode(f,f);Me.focus(),re(ye)}catch{}};ve(),X=setTimeout(()=>{ve(!0),P.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(pe),X&&clearTimeout(X)}}});var F=y.useCallback(M=>{if(k(),!s&&te.hasEditableTarget(f,M.target)&&!cC(M,a)){var U;if(z.current)return z.current.handleDOMBeforeInput(M);B.flush(),L.flush();var{selection:S}=f,{inputType:R}=M,K=M.dataTransfer||M.data||void 0,Z=R==="insertCompositionText"||R==="deleteCompositionText";if(Z&&te.isComposing(f))return;var re=!1;if(R==="insertText"&&S&&G.isCollapsed(S)&&M.data&&M.data.length===1&&/[a-z ]/i.test(M.data)&&S.anchor.offset!==0){var ce,X;re=!0,f.marks&&(re=!1);var{anchor:pe}=S,[ve,ye]=te.toDOMPoint(f,pe),Me=(ce=ve.parentElement)===null||ce===void 0?void 0:ce.closest("a"),je=te.getWindow(f);if(re&&Me&&te.hasDOMNode(f,Me)){var Je,Ue=je==null?void 0:je.document.createTreeWalker(Me,NodeFilter.SHOW_TEXT).lastChild();Ue===ve&&((Je=Ue.textContent)===null||Je===void 0?void 0:Je.length)===ye&&(re=!1)}if(re&&ve.parentElement&&(je==null||(X=je.getComputedStyle(ve.parentElement))===null||X===void 0?void 0:X.whiteSpace)==="pre"){var Le=x.above(f,{at:pe.path,match:oe=>fe.isElement(oe)&&x.isBlock(f,oe)});Le&&le.string(Le[0]).includes(" ")&&(re=!1)}}if(!R.startsWith("delete")||R.startsWith("deleteBy")){var[Xe]=M.getTargetRanges();if(Xe){var _e=te.toSlateRange(f,Xe,{exactMatch:!1,suppressThrow:!1});if(!S||!G.equals(S,_e)){re=!1;var Oe=!Z&&f.selection&&x.rangeRef(f,f.selection);ee.select(f,_e),Oe&&Nr.set(f,Oe)}}}if(Z)return;if(re||M.preventDefault(),S&&G.isExpanded(S)&&R.startsWith("delete")){var We=R.endsWith("Backward")?"backward":"forward";x.deleteFragment(f,{direction:We});return}switch(R){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{x.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{x.deleteForward(f);break}case"deleteContentBackward":{x.deleteBackward(f);break}case"deleteEntireSoftLine":{x.deleteBackward(f,{unit:"line"}),x.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{x.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{x.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{x.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{x.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{x.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{x.deleteForward(f,{unit:"word"});break}case"insertLineBreak":x.insertSoftBreak(f);break;case"insertParagraph":{x.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{R==="insertFromComposition"&&te.isComposing(f)&&(v(!1),Bn.set(f,!1)),(K==null?void 0:K.constructor.name)==="DataTransfer"?te.insertData(f,K):typeof K=="string"&&(re?D.current.push(()=>x.insertText(f,K)):x.insertText(f,K));break}}var Y=(U=Nr.get(f))===null||U===void 0?void 0:U.unref();Nr.delete(f),Y&&(!f.selection||!G.equals(f.selection,Y))&&ee.select(f,Y)}},[f,L,k,a,s,B]),j=y.useCallback(M=>{M==null?(L.cancel(),B.cancel(),Pa.delete(f),jn.delete(f),C.current&&fn&&C.current.removeEventListener("beforeinput",F)):fn&&M.addEventListener("beforeinput",F),C.current=M},[L,B,f,F]);Yr(()=>{var M=te.getWindow(f);return M.document.addEventListener("selectionchange",B),()=>{M.document.removeEventListener("selectionchange",B)}},[B]);var O=r([f,[]]),q=i&&f.children.length===1&&Array.from(le.texts(f)).length===1&&le.string(f)===""&&!b,W=y.useCallback(M=>{if(M&&q){var U;E((U=M.getBoundingClientRect())===null||U===void 0?void 0:U.height)}else E(void 0)},[q]);if(q){var ne=x.start(f,[]);O.push({[mr]:!0,placeholder:i,onPlaceholderResize:W,anchor:ne,focus:ne})}var{marks:J}=f;if(P.hasMarkPlaceholder=!1,f.selection&&G.isCollapsed(f.selection)&&J){var{anchor:w}=f.selection,Q=le.leaf(f,w.path),se=fr(Q,aC);if(!he.equals(Q,J,{loose:!0})){P.hasMarkPlaceholder=!0;var _=Object.fromEntries(Object.keys(se).map(M=>[M,null]));O.push(Wt(Wt(Wt({[Xf]:!0},_),J),{},{anchor:w,focus:w}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:M}=f;if(M){var{anchor:U}=M,S=le.leaf(f,U.path);if(J&&!he.equals(S,J,{loose:!0})){$t.set(f,J);return}}$t.delete(f)})}),y.createElement(cm.Provider,{value:s},y.createElement(um.Provider,{value:r},y.createElement(nC,{node:C,receivedUserInput:T},y.createElement(h,Wt(Wt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:fn||!Oa?g.spellCheck:!1,autoCorrect:fn||!Oa?g.autoCorrect:"false",autoCapitalize:fn||!Oa?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:j,style:Wt(Wt({},p?{}:Wt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},A?{minHeight:A}:{})),m),onBeforeInput:y.useCallback(M=>{if(!fn&&!s&&!mt(M,g.onBeforeInput)&&te.hasSelectableTarget(f,M.target)&&(M.preventDefault(),!te.isComposing(f))){var U=M.data;x.insertText(f,U)}},[g.onBeforeInput,f,s]),onInput:y.useCallback(M=>{if(!mt(M,g.onInput)){if(z.current){z.current.handleInput();return}for(var U of D.current)U();D.current=[]}},[g.onInput]),onBlur:y.useCallback(M=>{if(!(s||P.isUpdatingSelection||!te.hasSelectableTarget(f,M.target)||mt(M,g.onBlur))){var U=te.findDocumentOrShadowRoot(f);if(P.latestElement!==U.activeElement){var{relatedTarget:S}=M,R=te.toDOMNode(f,f);if(S!==R&&!(Pt(S)&&S.hasAttribute("data-slate-spacer"))){if(S!=null&&yn(S)&&te.hasDOMNode(f,S)){var K=te.toSlateNode(f,S);if(fe.isElement(K)&&!f.isVoid(K))return}if(Sr){var Z=U.getSelection();Z==null||Z.removeAllRanges()}bn.delete(f)}}}},[s,P.isUpdatingSelection,P.latestElement,f,g.onBlur]),onClick:y.useCallback(M=>{if(te.hasTarget(f,M.target)&&!mt(M,g.onClick)&&yn(M.target)){var U=te.toSlateNode(f,M.target),S=te.findPath(f,U);if(!x.hasPath(f,S)||le.get(f,S)!==U)return;if(M.detail===G1&&S.length>=1){var R=S;if(!(fe.isElement(U)&&x.isBlock(f,U))){var K,Z=x.above(f,{match:Me=>fe.isElement(Me)&&x.isBlock(f,Me),at:S});R=(K=Z==null?void 0:Z[1])!==null&&K!==void 0?K:S.slice(0,1)}var re=x.range(f,R);ee.select(f,re);return}if(s)return;var ce=x.start(f,S),X=x.end(f,S),pe=x.void(f,{at:ce}),ve=x.void(f,{at:X});if(pe&&ve&&I.equals(pe[1],ve[1])){var ye=x.range(f,ce);ee.select(f,ye)}}},[f,g.onClick,s]),onCompositionEnd:y.useCallback(M=>{if(te.hasSelectableTarget(f,M.target)){var U;if(te.isComposing(f)&&Promise.resolve().then(()=>{v(!1),Bn.set(f,!1)}),(U=z.current)===null||U===void 0||U.handleCompositionEnd(M),mt(M,g.onCompositionEnd)||pt)return;if(!Sr&&!Xx&&!Yx&&!t1&&!e1&&M.data){var S=$t.get(f);$t.delete(f),S!==void 0&&(rn.set(f,f.marks),f.marks=S),x.insertText(f,M.data);var R=rn.get(f);rn.delete(f),R!==void 0&&(f.marks=R)}}},[g.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(M=>{te.hasSelectableTarget(f,M.target)&&!mt(M,g.onCompositionUpdate)&&(te.isComposing(f)||(v(!0),Bn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:y.useCallback(M=>{if(te.hasSelectableTarget(f,M.target)){var U;if((U=z.current)===null||U===void 0||U.handleCompositionStart(M),mt(M,g.onCompositionStart)||pt)return;v(!0);var{selection:S}=f;if(S&&G.isExpanded(S)){x.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:y.useCallback(M=>{te.hasSelectableTarget(f,M.target)&&!mt(M,g.onCopy)&&!ic(M)&&(M.preventDefault(),te.setFragmentData(f,M.clipboardData,"copy"))},[g.onCopy,f]),onCut:y.useCallback(M=>{if(!s&&te.hasSelectableTarget(f,M.target)&&!mt(M,g.onCut)&&!ic(M)){M.preventDefault(),te.setFragmentData(f,M.clipboardData,"cut");var{selection:U}=f;if(U)if(G.isExpanded(U))x.deleteFragment(f);else{var S=le.parent(f,U.anchor.path);x.isVoid(f,S)&&ee.delete(f)}}},[s,f,g.onCut]),onDragOver:y.useCallback(M=>{if(te.hasTarget(f,M.target)&&!mt(M,g.onDragOver)){var U=te.toSlateNode(f,M.target);fe.isElement(U)&&x.isVoid(f,U)&&M.preventDefault()}},[g.onDragOver,f]),onDragStart:y.useCallback(M=>{if(!s&&te.hasTarget(f,M.target)&&!mt(M,g.onDragStart)){var U=te.toSlateNode(f,M.target),S=te.findPath(f,U),R=fe.isElement(U)&&x.isVoid(f,U)||x.void(f,{at:S,voids:!0});if(R){var K=x.range(f,S);ee.select(f,K)}P.isDraggingInternally=!0,te.setFragmentData(f,M.dataTransfer,"drag")}},[s,f,g.onDragStart,P]),onDrop:y.useCallback(M=>{if(!s&&te.hasTarget(f,M.target)&&!mt(M,g.onDrop)){M.preventDefault();var U=f.selection,S=te.findEventRange(f,M),R=M.dataTransfer;ee.select(f,S),P.isDraggingInternally&&U&&!G.equals(U,S)&&!x.void(f,{at:S,voids:!0})&&ee.delete(f,{at:U}),te.insertData(f,R),te.isFocused(f)||te.focus(f)}P.isDraggingInternally=!1},[s,f,g.onDrop,P]),onDragEnd:y.useCallback(M=>{!s&&P.isDraggingInternally&&g.onDragEnd&&te.hasTarget(f,M.target)&&g.onDragEnd(M),P.isDraggingInternally=!1},[s,P,g,f]),onFocus:y.useCallback(M=>{if(!s&&!P.isUpdatingSelection&&te.hasEditableTarget(f,M.target)&&!mt(M,g.onFocus)){var U=te.toDOMNode(f,f),S=te.findDocumentOrShadowRoot(f);if(P.latestElement=S.activeElement,er&&M.target!==U){U.focus();return}bn.set(f,!0)}},[s,P,f,g.onFocus]),onKeyDown:y.useCallback(M=>{if(!s&&te.hasEditableTarget(f,M.target)){var U;(U=z.current)===null||U===void 0||U.handleKeyDown(M);var{nativeEvent:S}=M;if(te.isComposing(f)&&S.isComposing===!1&&(Bn.set(f,!1),v(!1)),mt(M,g.onKeyDown)||te.isComposing(f))return;var{selection:R}=f,K=f.children[R!==null?R.focus.path[0]:0],Z=Ef(le.string(K))==="rtl";if(Qe.isRedo(S)){M.preventDefault();var re=f;typeof re.redo=="function"&&re.redo();return}if(Qe.isUndo(S)){M.preventDefault();var ce=f;typeof ce.undo=="function"&&ce.undo();return}if(Qe.isMoveLineBackward(S)){M.preventDefault(),ee.move(f,{unit:"line",reverse:!0});return}if(Qe.isMoveLineForward(S)){M.preventDefault(),ee.move(f,{unit:"line"});return}if(Qe.isExtendLineBackward(S)){M.preventDefault(),ee.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Qe.isExtendLineForward(S)){M.preventDefault(),ee.move(f,{unit:"line",edge:"focus"});return}if(Qe.isMoveBackward(S)){M.preventDefault(),R&&G.isCollapsed(R)?ee.move(f,{reverse:!Z}):ee.collapse(f,{edge:Z?"end":"start"});return}if(Qe.isMoveForward(S)){M.preventDefault(),R&&G.isCollapsed(R)?ee.move(f,{reverse:Z}):ee.collapse(f,{edge:Z?"start":"end"});return}if(Qe.isMoveWordBackward(S)){M.preventDefault(),R&&G.isExpanded(R)&&ee.collapse(f,{edge:"focus"}),ee.move(f,{unit:"word",reverse:!Z});return}if(Qe.isMoveWordForward(S)){M.preventDefault(),R&&G.isExpanded(R)&&ee.collapse(f,{edge:"focus"}),ee.move(f,{unit:"word",reverse:Z});return}if(fn){if((Gf||Sr)&&R&&(Qe.isDeleteBackward(S)||Qe.isDeleteForward(S))&&G.isCollapsed(R)){var X=le.parent(f,R.anchor.path);if(fe.isElement(X)&&x.isVoid(f,X)&&(x.isInline(f,X)||x.isBlock(f,X))){M.preventDefault(),x.deleteBackward(f,{unit:"block"});return}}}else{if(Qe.isBold(S)||Qe.isItalic(S)||Qe.isTransposeCharacter(S)){M.preventDefault();return}if(Qe.isSoftBreak(S)){M.preventDefault(),x.insertSoftBreak(f);return}if(Qe.isSplitBlock(S)){M.preventDefault(),x.insertBreak(f);return}if(Qe.isDeleteBackward(S)){M.preventDefault(),R&&G.isExpanded(R)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f);return}if(Qe.isDeleteForward(S)){M.preventDefault(),R&&G.isExpanded(R)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f);return}if(Qe.isDeleteLineBackward(S)){M.preventDefault(),R&&G.isExpanded(R)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"line"});return}if(Qe.isDeleteLineForward(S)){M.preventDefault(),R&&G.isExpanded(R)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"line"});return}if(Qe.isDeleteWordBackward(S)){M.preventDefault(),R&&G.isExpanded(R)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"word"});return}if(Qe.isDeleteWordForward(S)){M.preventDefault(),R&&G.isExpanded(R)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:y.useCallback(M=>{!s&&te.hasEditableTarget(f,M.target)&&!mt(M,g.onPaste)&&(!fn||a1(M.nativeEvent)||Sr)&&(M.preventDefault(),te.insertData(f,M.clipboardData))},[s,f,g.onPaste])}),y.createElement(iC,{decorations:O,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},oC=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Wt({},t),n,pt&&y.createElement("br",null))},uC=()=>[],lC=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&G.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),Ub(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},mt=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},ic=e=>yn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),cC=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},dC=y.createContext(!1),fC=y.createContext({});function mC(e){var t=y.useRef([]).current,n=y.useRef({editor:e}).current,r=y.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=y.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var hC=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],pC=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=fr(e,hC),[l,u]=y.useState(()=>{if(!le.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(at.stringify(s)));if(!x.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}=mC(t),h=y.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":a==null||a(t.selection);break;default:i==null||i(t.children)}u(v=>({v:v.v+1,editor:t})),m(t)},[t,m,r,a,i]);y.useEffect(()=>(Ws.set(t,h),()=>{Ws.set(t,()=>{})}),[t,h]);var[p,g]=y.useState(te.isFocused(t));return y.useEffect(()=>{g(te.isFocused(t))},[t]),Yr(()=>{var f=()=>g(te.isFocused(t));return Yf>=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)})},[]),y.createElement(fC.Provider,{value:d},y.createElement(dm.Provider,{value:l},y.createElement(Ro.Provider,{value:l.editor},y.createElement(dC.Provider,{value:p},n))))},sc=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},oc=(e,t,n)=>{var r=te.toDOMRange(e,t).getBoundingClientRect(),a=te.toDOMRange(e,n).getBoundingClientRect();return sc(r,a)&&sc(a,r)},gC=(e,t)=>{var n=x.range(e,G.end(t)),r=Array.from(x.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(oc(e,x.range(e,r[a]),n))return x.range(e,r[a],n);if(r.length<2)return x.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)oc(e,x.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return x.range(e,r[i],n)};function uc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function lc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?uc(Object(n),!0).forEach(function(r){Mt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):uc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var vC=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",r=t,{apply:a,onChange:i,deleteBackward:s,addMark:o,removeMark:l}=r;return yi.set(r,new WeakMap),r.addMark=(u,d)=>{var m,h;(m=zo.get(r))===null||m===void 0||m(),!$t.get(r)&&(h=xt.get(r))!==null&&h!==void 0&&h.length&&$t.set(r,null),rn.delete(r),o(u,d)},r.removeMark=u=>{var d;!$t.get(r)&&(d=xt.get(r))!==null&&d!==void 0&&d.length&&$t.set(r,null),rn.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&G.isCollapsed(r.selection)){var d=x.above(r,{match:g=>fe.isElement(g)&&x.isBlock(r,g),at:r.selection});if(d){var[,m]=d,h=x.range(r,m,r.selection.anchor),p=gC(r,h);G.isCollapsed(p)||ee.delete(r,{at:p})}}},r.apply=u=>{var d=[],m=[],h=xt.get(r);if(h!=null&&h.length){var p=h.map(j=>v1(j,u)).filter(Boolean);xt.set(r,p)}var g=pn.get(r);g&&pn.set(r,Gl(r,g,u));var f=hn.get(r);if(f!=null&&f.at){var b=Fe.isPoint(f==null?void 0:f.at)?Ks(r,f.at,u):Gl(r,f.at,u);hn.set(r,b?lc(lc({},f),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Zn(r,u.path));break}case"set_selection":{var v;(v=Nr.get(r))===null||v===void 0||v.unref(),Nr.delete(r);break}case"insert_node":case"remove_node":{d.push(...Zn(r,I.parent(u.path)));break}case"merge_node":{var C=I.previous(u.path);d.push(...Zn(r,C));break}case"move_node":{var D=I.common(I.parent(u.path),I.parent(u.newPath));d.push(...Zn(r,D));var A;I.isBefore(u.path,u.newPath)?(d.push(...Zn(r,I.parent(u.path))),A=u.newPath):(d.push(...Zn(r,I.parent(u.newPath))),A=u.path);var E=le.get(t,I.parent(A)),k=te.findKey(r,E),T=x.pathRef(r,I.parent(A));m.push([T,k]);break}}a(u);for(var[$,P]of d){var[z]=x.node(r,$);ei.set(z,P)}for(var[L,B]of m)if(L.current){var[F]=x.node(r,L.current);ei.set(F,B)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[m,h]=G.edges(d),p=x.void(r,{at:m.path}),g=x.void(r,{at:h.path});if(!(G.isCollapsed(d)&&!p)){var f=te.toDOMRange(r,d),b=f.cloneContents(),v=b.childNodes[0];if(b.childNodes.forEach(z=>{z.textContent&&z.textContent.trim()!==""&&(v=z)}),g){var[C]=g,D=f.cloneRange(),A=te.toDOMNode(r,C);D.setEndAfter(A),b=D.cloneContents()}if(p&&(v=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(z=>{var L=z.getAttribute("data-slate-zero-width")==="n";z.textContent=L?`
81
+ `:""}),em(v)){var E=v.ownerDocument.createElement("span");E.style.whiteSpace="pre",E.appendChild(v),b.appendChild(E),v=E}var k=r.getFragment(),T=JSON.stringify(k),$=window.btoa(encodeURIComponent(T));v.setAttribute("data-slate-fragment",$),u.setData("application/".concat(n),$);var P=b.ownerDocument.createElement("div");return P.appendChild(b),P.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(P),u.setData("text/html",P.innerHTML),u.setData("text/plain",nm(P)),b.ownerDocument.body.removeChild(P),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||l1(u);if(d){var m=decodeURIComponent(window.atob(d)),h=JSON.parse(m);return r.insertFragment(h),!0}return!1},r.insertTextData=u=>{var d=u.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=u=>{var d=Yf<18?Qc.unstable_batchedUpdates:m=>m();d(()=>{var m=Ws.get(r);m&&m(u),i(u)})},r},Zn=(e,t)=>{var n=[];for(var[r,a]of x.levels(e,{at:t})){var i=te.findKey(e,r);n.push([a,i])}return n};const Ys="MENTION: ",mm={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},cc={"mention-popover":35,default:-52},Gi=16,hm=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:a,mentionPopover:i}=y.useContext(cn),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var p,g;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,d=0;if(t==="mention-popover"){const{position:f}=i,b=D=>{if(!x.hasPath(e,D.path))return!1;const A=le.get(e,D.path);return x.isEditor(A)||fe.isElement(A)?D.offset<=A.children.length:he.isText(A)?D.offset<=A.text.length:!1};if(f&&(!b(f==null?void 0:f.anchor)||!b(f==null?void 0:f.focus)))return;u=te.toDOMRange(e,f||mm).getBoundingClientRect();const C=(p=document.getElementById(n))==null?void 0:p.getBoundingClientRect();l.style.setProperty("--width",`${((C==null?void 0:C.width)||0)/Gi}rem`),d=(C==null?void 0:C.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(u=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}u||(u=(g=document.getElementById(n))==null?void 0:g.getBoundingClientRect());const m=cc[t]||cc.default,h=((u==null?void 0:u.top)||0)+window.scrollY+m;d===0&&(d=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${h/Gi}rem`,l.style.left=`${d/Gi}rem`},o),r},bC=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=x.nodes(e,{at:r,match:i=>i.type===H.link});if(a){const i=a[0],s=uo(i.link),o=i.children[0],l=(o==null?void 0:o.text)||"";n({...s,text:l})}else n(null)},[e,e.selection]),t};var ht=(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))(ht||{});const tr={[H.paragraph]:H.paragraph,[H.blockquote]:H.blockquote,[H.codeblock]:H.codeblock,[H.link]:H.link,[H.ul]:H.ul,[H.ol]:H.ol,[H.li]:H.li,[H.mention]:H.mention,[H.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Kt.emphasis]:H.italic,[Kt.strong]:H.bold,[Kt.delete]:H.strikethrough,[Kt.code]:H.code,[H.hr]:H.hr,[H.image]:H.image,[H.h3]:H.h3};function dc(e){if(e)throw e}var Ma=Object.prototype.hasOwnProperty,pm=Object.prototype.toString,fc=Object.defineProperty,mc=Object.getOwnPropertyDescriptor,hc=function(t){return typeof Array.isArray=="function"?Array.isArray(t):pm.call(t)==="[object Array]"},pc=function(t){if(!t||pm.call(t)!=="[object Object]")return!1;var n=Ma.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Ma.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||Ma.call(t,a)},gc=function(t,n){fc&&n.name==="__proto__"?fc(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},vc=function(t,n){if(n==="__proto__")if(Ma.call(t,n)){if(mc)return mc(t,n).value}else return;return t[n]},yC=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=vc(o,n),a=vc(t,n),o!==a&&(d&&a&&(pc(a)||(i=hc(a)))?(i?(i=!1,s=r&&hc(r)?r:[]):s=r&&pc(r)?r:{},gc(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&gc(o,{name:n,newValue:a}));return o};const Qi=Rn(yC);function Gs(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 xC(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const d=e[++i];let m=-1;if(l){s(l);return}for(;++m<a.length;)(u[m]===null||u[m]===void 0)&&(u[m]=a[m]);a=u,d?CC(d,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function CC(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const d=u;if(o&&n)throw d;return a(d)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function Ir(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?bc(e.position):"start"in e||"end"in e?bc(e):"line"in e||"column"in e?Qs(e):""}function Qs(e){return yc(e&&e.line)+":"+yc(e&&e.column)}function bc(e){return Qs(e&&e.start)+"-"+Qs(e&&e.end)}function yc(e){return e&&typeof e=="number"?e:1}class Dt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=o?o.line:void 0,this.name=Ir(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}Dt.prototype.file="";Dt.prototype.name="";Dt.prototype.reason="";Dt.prototype.message="";Dt.prototype.stack="";Dt.prototype.column=void 0;Dt.prototype.line=void 0;Dt.prototype.ancestors=void 0;Dt.prototype.cause=void 0;Dt.prototype.fatal=void 0;Dt.prototype.place=void 0;Dt.prototype.ruleId=void 0;Dt.prototype.source=void 0;const Vt={basename:wC,dirname:DC,extname:EC,join:_C,sep:"/"};function wC(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ea(e);let n=0,r=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else r<0&&(i=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function DC(e){if(ea(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 EC(e){ea(e);let t=e.length,n=-1,r=0,a=-1,i=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?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function _C(...e){let t=-1,n;for(;++t<e.length;)ea(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":kC(n)}function kC(e){ea(e);const t=e.codePointAt(0)===47;let n=FC(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function FC(e,t){let n="",r=0,a=-1,i=0,s=-1,o,l;for(;++s<=e.length;){if(s<e.length)o=e.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(a===s-1||i===1))if(a!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),a=s,i=0;continue}}else if(n.length>0){n="",r=0,a=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,s):n=e.slice(a+1,s),r=s-a-1;a=s,i=0}else o===46&&i>-1?i++:i=-1}return n}function ea(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const AC={cwd:BC};function BC(){return"/"}function Js(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function TC(e){if(typeof e=="string")e=new URL(e);else if(!Js(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 SC(e)}function SC(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 a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Ji=["history","path","basename","stem","extname","dirname"];class jC{constructor(t){let n;t?Js(t)?n={path:t}:typeof t=="string"||OC(t)?n={value:t}:n=t:n={},this.cwd=AC.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ji.length;){const i=Ji[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)Ji.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Vt.basename(this.path):void 0}set basename(t){es(t,"basename"),Xi(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){xc(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(Xi(t,"extname"),xc(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){Js(t)&&(t=TC(t)),es(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){es(t,"stem"),Xi(t,"stem"),this.path=Vt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new Dt(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Xi(e,t){if(e&&e.includes(Vt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Vt.sep+"`")}function es(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function xc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function OC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const PC=function(e){const r=this.constructor.prototype,a=r[e],i=function(){return a.apply(i,arguments)};Object.setPrototypeOf(i,r);const s=Object.getOwnPropertyNames(a);for(const o of s){const l=Object.getOwnPropertyDescriptor(a,o);l&&Object.defineProperty(i,o,l)}return i},MC={}.hasOwnProperty;class Wo extends PC{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=xC()}copy(){const t=new Wo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Qi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(rs("data",this.frozen),this.namespace[t]=n,this):MC.call(this.namespace,t)&&this.namespace[t]||void 0:t?(rs("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 a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=xa(t),r=this.parser||this.Parser;return ts("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ts("process",this.parser||this.Parser),ns("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=xa(t),l=r.parse(o);r.run(l,o,function(d,m,h){if(d||!m||!h)return u(d);const p=m,g=r.stringify(p,h);RC(g)?h.value=g:h.result=g,u(d,h)});function u(d,m){d||!m?s(d):i?i(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),ts("processSync",this.parser||this.Parser),ns("processSync",this.compiler||this.Compiler),this.process(t,a),wc("processSync","process",n),r;function a(i,s){n=!0,dc(i),r=s}}run(t,n,r){Cc(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,o){const l=xa(n);a.run(t,l,u);function u(d,m,h){const p=m||t;d?o(d):s?s(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),wc("runSync","run",r),a;function i(s,o){dc(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=xa(n),a=this.compiler||this.Compiler;return ns("stringify",a),Cc(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(rs("use",this.frozen),t!=null)if(typeof t=="function")l(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 i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...m]=u;l(d,m)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))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(u.plugins),u.settings&&(a.settings=Qi(!0,a.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const m=u[d];i(m)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let m=-1,h=-1;for(;++m<r.length;)if(r[m][0]===u){h=m;break}if(h===-1)r.push([u,...d]);else if(d.length>0){let[p,...g]=d;const f=r[h][1];Gs(f)&&Gs(p)&&(p=Qi(!0,f,p)),r[h]=[u,p,...g]}}}}const NC=new Wo().freeze();function ts(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ns(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function rs(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 Cc(e){if(!Gs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function wc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function xa(e){return IC(e)?e:new jC(e)}function IC(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function RC(e){return typeof e=="string"||$C(e)}function $C(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const LC={};function zC(e,t){const n=t||LC,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return gm(e,r,a)}function gm(e,t,n){if(qC(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 Dc(e.children,t,n)}return Array.isArray(e)?Dc(e,t,n):""}function Dc(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=gm(e[a],t,n);return r.join("")}function qC(e){return!!(e&&typeof e=="object")}const Ec=document.createElement("i");function Vo(e){const t="&"+e+";";Ec.innerHTML=t;const n=Ec.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function on(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a: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);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function jt(e,t){return e.length>0?(on(e,e.length,0,t),e):t}const _c={}.hasOwnProperty;function UC(e){const t={};let n=-1;for(;++n<e.length;)WC(t,e[n]);return t}function WC(e,t){let n;for(n in t){const a=(_c.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){_c.call(a,s)||(a[s]=[]);const o=i[s];VC(a[s],Array.isArray(o)?o:o?[o]:[])}}}function VC(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 vm(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 ir(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ht=Dn(/[A-Za-z]/),Lt=Dn(/[\dA-Za-z]/),HC=Dn(/[#-'*+\--9=?A-Z^-~]/);function Xs(e){return e!==null&&(e<32||e===127)}const eo=Dn(/\d/),KC=Dn(/[\dA-Fa-f]/),ZC=Dn(/[!-/:-@[-`{-~]/);function xe(e){return e!==null&&e<-2}function wt(e){return e!==null&&(e<0||e===32)}function Ie(e){return e===-2||e===-1||e===32}const YC=Dn(/\p{P}|\p{S}/u),GC=Dn(/\s/);function Dn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function He(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Ie(l)?(e.enter(n),o(l)):t(l)}function o(l){return Ie(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const QC={tokenize:JC};function JC(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),He(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return xe(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const XC={tokenize:ew},kc={tokenize:tw};function ew(e){const t=this,n=[];let r=0,a,i,s;return o;function o(D){if(r<n.length){const A=n[r];return t.containerState=A[1],e.attempt(A[0].continuation,l,u)(D)}return u(D)}function l(D){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&C();const A=t.events.length;let E=A,k;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){k=t.events[E][1].end;break}v(r);let T=A;for(;T<t.events.length;)t.events[T][1].end=Object.assign({},k),T++;return on(t.events,E+1,0,t.events.slice(A)),t.events.length=T,u(D)}return o(D)}function u(D){if(r===n.length){if(!a)return h(D);if(a.currentConstruct&&a.currentConstruct.concrete)return g(D);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(kc,d,m)(D)}function d(D){return a&&C(),v(r),h(D)}function m(D){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(D)}function h(D){return t.containerState={},e.attempt(kc,p,g)(D)}function p(D){return r++,n.push([t.currentConstruct,t.containerState]),h(D)}function g(D){if(D===null){a&&C(),v(0),e.consume(D);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(D)}function f(D){if(D===null){b(e.exit("chunkFlow"),!0),v(0),e.consume(D);return}return xe(D)?(e.consume(D),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(D),f)}function b(D,A){const E=t.sliceStream(D);if(A&&E.push(null),D.previous=i,i&&(i.next=D),i=D,a.defineSkip(D.start),a.write(E),t.parser.lazy[D.start.line]){let k=a.events.length;for(;k--;)if(a.events[k][1].start.offset<s&&(!a.events[k][1].end||a.events[k][1].end.offset>s))return;const T=t.events.length;let $=T,P,z;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(P){z=t.events[$][1].end;break}P=!0}for(v(r),k=T;k<t.events.length;)t.events[k][1].end=Object.assign({},z),k++;on(t.events,$+1,0,t.events.slice(T)),t.events.length=k}}function v(D){let A=n.length;for(;A-- >D;){const E=n[A];t.containerState=E[1],E[0].exit.call(t,e)}n.length=D}function C(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function tw(e,t,n){return He(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Fc(e){if(e===null||wt(e)||GC(e))return 1;if(YC(e))return 2}function Ho(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const to={name:"attention",tokenize:rw,resolveAll:nw};function nw(e,t){let n=-1,r,a,i,s,o,l,u,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;l=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);Ac(m,-l),Ac(h,l),s={type:l>1?"strongSequence":"emphasisSequence",start:m,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:h},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>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),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=jt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=jt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=jt(u,Ho(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=jt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=jt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,on(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function rw(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Fc(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),d=Fc(l),m=!d||d===2&&a||n.includes(l),h=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?m:m&&(a||!h)),u._close=!!(i===42?h:h&&(d||!m)),t(l)}}function Ac(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const aw={name:"autolink",tokenize:iw};function iw(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return Ht(p)?(e.consume(p),s):p===64?n(p):u(p)}function s(p){return p===43||p===45||p===46||Lt(p)?(r=1,o(p)):u(p)}function o(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||Lt(p))&&r++<32?(e.consume(p),o):(r=0,u(p))}function l(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||Xs(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),d):HC(p)?(e.consume(p),u):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 xi={tokenize:sw,partial:!0};function sw(e,t,n){return r;function r(i){return Ie(i)?He(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||xe(i)?t(i):n(i)}}const bm={name:"blockQuote",tokenize:ow,continuation:{tokenize:uw},exit:lw};function ow(e,t,n){const r=this;return a;function a(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"),i}return n(s)}function i(s){return Ie(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function uw(e,t,n){const r=this;return a;function a(s){return Ie(s)?He(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(bm,t,n)(s)}}function lw(e){e.exit("blockQuote")}const ym={name:"characterEscape",tokenize:cw};function cw(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return ZC(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const xm={name:"characterReference",tokenize:dw};function dw(e,t,n){const r=this;let a=0,i,s;return o;function o(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),l}function l(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=Lt,d(m))}function u(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=KC,d):(e.enter("characterReferenceValue"),i=7,s=eo,d(m))}function d(m){if(m===59&&a){const h=e.exit("characterReferenceValue");return s===Lt&&!Vo(r.sliceSerialize(h))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(m)&&a++<i?(e.consume(m),d):n(m)}}const Bc={tokenize:mw,partial:!0},Tc={name:"codeFenced",tokenize:fw,concrete:!0};function fw(e,t,n){const r=this,a={tokenize:E,partial:!0};let i=0,s=0,o;return l;function l(k){return u(k)}function u(k){const T=r.events[r.events.length-1];return i=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,o=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(k)}function d(k){return k===o?(s++,e.consume(k),d):s<3?n(k):(e.exit("codeFencedFenceSequence"),Ie(k)?He(e,m,"whitespace")(k):m(k))}function m(k){return k===null||xe(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(Bc,f,A)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(k))}function h(k){return k===null||xe(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(k)):Ie(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),He(e,p,"whitespace")(k)):k===96&&k===o?n(k):(e.consume(k),h)}function p(k){return k===null||xe(k)?m(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===null||xe(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(k)):k===96&&k===o?n(k):(e.consume(k),g)}function f(k){return e.attempt(a,A,b)(k)}function b(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),v}function v(k){return i>0&&Ie(k)?He(e,C,"linePrefix",i+1)(k):C(k)}function C(k){return k===null||xe(k)?e.check(Bc,f,A)(k):(e.enter("codeFlowValue"),D(k))}function D(k){return k===null||xe(k)?(e.exit("codeFlowValue"),C(k)):(e.consume(k),D)}function A(k){return e.exit("codeFenced"),t(k)}function E(k,T,$){let P=0;return z;function z(O){return k.enter("lineEnding"),k.consume(O),k.exit("lineEnding"),L}function L(O){return k.enter("codeFencedFence"),Ie(O)?He(k,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):B(O)}function B(O){return O===o?(k.enter("codeFencedFenceSequence"),F(O)):$(O)}function F(O){return O===o?(P++,k.consume(O),F):P>=s?(k.exit("codeFencedFenceSequence"),Ie(O)?He(k,j,"whitespace")(O):j(O)):$(O)}function j(O){return O===null||xe(O)?(k.exit("codeFencedFence"),T(O)):$(O)}}}function mw(e,t,n){const r=this;return a;function a(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const as={name:"codeIndented",tokenize:pw},hw={tokenize:gw,partial:!0};function pw(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),He(e,i,"linePrefix",4+1)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):xe(u)?e.attempt(hw,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||xe(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function gw(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):xe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):He(e,i,"linePrefix",4+1)(s)}function i(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):xe(s)?a(s):n(s)}}const vw={name:"codeText",tokenize:xw,resolve:bw,previous:yw};function bw(e){let t=e.length-4,n=3,r,a;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;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function yw(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function xw(e,t,n){let r=0,a,i;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"),l(m))}function l(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),l):m===96?(i=e.enter("codeTextSequence"),a=0,d(m)):xe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||xe(m)?(e.exit("codeTextData"),l(m)):(e.consume(m),u)}function d(m){return m===96?(e.consume(m),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(i.type="codeTextData",u(m))}}class Cw{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 a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Fr(this.left,r),i.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),Fr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Fr(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);Fr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Fr(this.left,n.reverse())}}}function Fr(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 Cm(e){const t={};let n=-1,r,a,i,s,o,l,u;const d=new Cw(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"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,ww(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=d.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},d.get(a)[1].start),o=d.slice(a,n),o.unshift(r),d.splice(a,n-a+1,o))}}return on(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function ww(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let d,m,h=-1,p=n,g=0,f=0;const b=[f];for(;p;){for(;e.get(++a)[1]!==p;);i.push(a),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]),C=i.pop();l.push([C,C+v.length-1]),e.splice(C,2,v)}for(l.reverse(),h=-1;++h<l.length;)u[g+l[h][0]]=g+l[h][1],g+=l[h][1]-l[h][0]-1;return u}const Dw={tokenize:kw,resolve:_w},Ew={tokenize:Fw,partial:!0};function _w(e){return Cm(e),e}function kw(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):xe(o)?e.check(Ew,s,i)(o):(e.consume(o),a)}function i(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,a}}function Fw(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),He(e,i,"linePrefix")}function i(s){if(s===null||xe(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 wm(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return m;function m(v){return v===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(v),e.exit(i),h):v===null||v===32||v===41||Xs(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(i),e.consume(v),e.exit(i),e.exit(a),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||xe(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||wt(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):d<u&&v===40?(e.consume(v),d++,f):v===41?(e.consume(v),d--,f):v===null||v===32||v===40||Xs(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 Dm(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),d}function d(p){return o>999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):xe(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||xe(p)||o++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!Ie(p)),p===92?h:m)}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,m):m(p)}}function Em(e,t,n,r,a,i){let s;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(a),e.consume(h),e.exit(a),s=h===40?41:h,l):n(h)}function l(h){return h===s?(e.enter(a),e.consume(h),e.exit(a),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===s?(e.exit(i),l(s)):h===null?n(h):xe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),He(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===s||h===null||xe(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?m:d)}function m(h){return h===s||h===92?(e.consume(h),d):d(h)}}function Rr(e,t){let n;return r;function r(a){return xe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Ie(a)?He(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const Aw={name:"definition",tokenize:Tw},Bw={tokenize:Sw,partial:!0};function Tw(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return Dm.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return a=ir(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return wt(p)?Rr(e,u)(p):u(p)}function u(p){return wm(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(Bw,m,m)(p)}function m(p){return Ie(p)?He(e,h,"whitespace")(p):h(p)}function h(p){return p===null||xe(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function Sw(e,t,n){return r;function r(o){return wt(o)?Rr(e,a)(o):n(o)}function a(o){return Em(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Ie(o)?He(e,s,"whitespace")(o):s(o)}function s(o){return o===null||xe(o)?t(o):n(o)}}const jw={name:"hardBreakEscape",tokenize:Ow};function Ow(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return xe(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const Pw={name:"headingAtx",tokenize:Nw,resolve:Mw};function Mw(e,t){let n=e.length-2,r=3,a,i;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&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},on(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function Nw(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||wt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||xe(d)?(e.exit("atxHeading"),t(d)):Ie(d)?He(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||wt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const Iw=["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"],Sc=["pre","script","style","textarea"],Rw={name:"htmlFlow",tokenize:qw,resolveTo:zw,concrete:!0},$w={tokenize:Ww,partial:!0},Lw={tokenize:Uw,partial:!0};function zw(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 qw(e,t,n){const r=this;let a,i,s,o,l;return u;function u(_){return d(_)}function d(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),m}function m(_){return _===33?(e.consume(_),h):_===47?(e.consume(_),i=!0,f):_===63?(e.consume(_),a=3,r.interrupt?t:w):Ht(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function h(_){return _===45?(e.consume(_),a=2,p):_===91?(e.consume(_),a=5,o=0,g):Ht(_)?(e.consume(_),a=4,r.interrupt?t:w):n(_)}function p(_){return _===45?(e.consume(_),r.interrupt?t:w):n(_)}function g(_){const M="CDATA[";return _===M.charCodeAt(o++)?(e.consume(_),o===M.length?r.interrupt?t:B:g):n(_)}function f(_){return Ht(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function b(_){if(_===null||_===47||_===62||wt(_)){const M=_===47,U=s.toLowerCase();return!M&&!i&&Sc.includes(U)?(a=1,r.interrupt?t(_):B(_)):Iw.includes(s.toLowerCase())?(a=6,M?(e.consume(_),v):r.interrupt?t(_):B(_)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?C(_):D(_))}return _===45||Lt(_)?(e.consume(_),s+=String.fromCharCode(_),b):n(_)}function v(_){return _===62?(e.consume(_),r.interrupt?t:B):n(_)}function C(_){return Ie(_)?(e.consume(_),C):z(_)}function D(_){return _===47?(e.consume(_),z):_===58||_===95||Ht(_)?(e.consume(_),A):Ie(_)?(e.consume(_),D):z(_)}function A(_){return _===45||_===46||_===58||_===95||Lt(_)?(e.consume(_),A):E(_)}function E(_){return _===61?(e.consume(_),k):Ie(_)?(e.consume(_),E):D(_)}function k(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,T):Ie(_)?(e.consume(_),k):$(_)}function T(_){return _===l?(e.consume(_),l=null,P):_===null||xe(_)?n(_):(e.consume(_),T)}function $(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||wt(_)?E(_):(e.consume(_),$)}function P(_){return _===47||_===62||Ie(_)?D(_):n(_)}function z(_){return _===62?(e.consume(_),L):n(_)}function L(_){return _===null||xe(_)?B(_):Ie(_)?(e.consume(_),L):n(_)}function B(_){return _===45&&a===2?(e.consume(_),q):_===60&&a===1?(e.consume(_),W):_===62&&a===4?(e.consume(_),Q):_===63&&a===3?(e.consume(_),w):_===93&&a===5?(e.consume(_),J):xe(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check($w,se,F)(_)):_===null||xe(_)?(e.exit("htmlFlowData"),F(_)):(e.consume(_),B)}function F(_){return e.check(Lw,j,se)(_)}function j(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),O}function O(_){return _===null||xe(_)?F(_):(e.enter("htmlFlowData"),B(_))}function q(_){return _===45?(e.consume(_),w):B(_)}function W(_){return _===47?(e.consume(_),s="",ne):B(_)}function ne(_){if(_===62){const M=s.toLowerCase();return Sc.includes(M)?(e.consume(_),Q):B(_)}return Ht(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),ne):B(_)}function J(_){return _===93?(e.consume(_),w):B(_)}function w(_){return _===62?(e.consume(_),Q):_===45&&a===2?(e.consume(_),w):B(_)}function Q(_){return _===null||xe(_)?(e.exit("htmlFlowData"),se(_)):(e.consume(_),Q)}function se(_){return e.exit("htmlFlow"),t(_)}}function Uw(e,t,n){const r=this;return a;function a(s){return xe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function Ww(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(xi,t,n)}}const Vw={name:"htmlText",tokenize:Hw};function Hw(e,t,n){const r=this;let a,i,s;return o;function o(w){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(w),l}function l(w){return w===33?(e.consume(w),u):w===47?(e.consume(w),E):w===63?(e.consume(w),D):Ht(w)?(e.consume(w),$):n(w)}function u(w){return w===45?(e.consume(w),d):w===91?(e.consume(w),i=0,g):Ht(w)?(e.consume(w),C):n(w)}function d(w){return w===45?(e.consume(w),p):n(w)}function m(w){return w===null?n(w):w===45?(e.consume(w),h):xe(w)?(s=m,W(w)):(e.consume(w),m)}function h(w){return w===45?(e.consume(w),p):m(w)}function p(w){return w===62?q(w):w===45?h(w):m(w)}function g(w){const Q="CDATA[";return w===Q.charCodeAt(i++)?(e.consume(w),i===Q.length?f:g):n(w)}function f(w){return w===null?n(w):w===93?(e.consume(w),b):xe(w)?(s=f,W(w)):(e.consume(w),f)}function b(w){return w===93?(e.consume(w),v):f(w)}function v(w){return w===62?q(w):w===93?(e.consume(w),v):f(w)}function C(w){return w===null||w===62?q(w):xe(w)?(s=C,W(w)):(e.consume(w),C)}function D(w){return w===null?n(w):w===63?(e.consume(w),A):xe(w)?(s=D,W(w)):(e.consume(w),D)}function A(w){return w===62?q(w):D(w)}function E(w){return Ht(w)?(e.consume(w),k):n(w)}function k(w){return w===45||Lt(w)?(e.consume(w),k):T(w)}function T(w){return xe(w)?(s=T,W(w)):Ie(w)?(e.consume(w),T):q(w)}function $(w){return w===45||Lt(w)?(e.consume(w),$):w===47||w===62||wt(w)?P(w):n(w)}function P(w){return w===47?(e.consume(w),q):w===58||w===95||Ht(w)?(e.consume(w),z):xe(w)?(s=P,W(w)):Ie(w)?(e.consume(w),P):q(w)}function z(w){return w===45||w===46||w===58||w===95||Lt(w)?(e.consume(w),z):L(w)}function L(w){return w===61?(e.consume(w),B):xe(w)?(s=L,W(w)):Ie(w)?(e.consume(w),L):P(w)}function B(w){return w===null||w===60||w===61||w===62||w===96?n(w):w===34||w===39?(e.consume(w),a=w,F):xe(w)?(s=B,W(w)):Ie(w)?(e.consume(w),B):(e.consume(w),j)}function F(w){return w===a?(e.consume(w),a=void 0,O):w===null?n(w):xe(w)?(s=F,W(w)):(e.consume(w),F)}function j(w){return w===null||w===34||w===39||w===60||w===61||w===96?n(w):w===47||w===62||wt(w)?P(w):(e.consume(w),j)}function O(w){return w===47||w===62||wt(w)?P(w):n(w)}function q(w){return w===62?(e.consume(w),e.exit("htmlTextData"),e.exit("htmlText"),t):n(w)}function W(w){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),ne}function ne(w){return Ie(w)?He(e,J,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(w):J(w)}function J(w){return e.enter("htmlTextData"),s(w)}}const Ko={name:"labelEnd",tokenize:Jw,resolveTo:Qw,resolveAll:Gw},Kw={tokenize:Xw},Zw={tokenize:eD},Yw={tokenize:tD};function Gw(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 Qw(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},d={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=jt(o,e.slice(i+1,i+r+3)),o=jt(o,[["enter",d,t]]),o=jt(o,Ho(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=jt(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=jt(o,e.slice(s+1)),o=jt(o,[["exit",l,t]]),on(e,i,e.length,o),e}function Jw(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(h){return i?i._inactive?m(h):(s=r.parser.defined.includes(ir(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(Kw,d,s?d:m)(h):h===91?e.attempt(Zw,d,s?u:m)(h):s?d(h):m(h)}function u(h){return e.attempt(Yw,d,m)(h)}function d(h){return t(h)}function m(h){return i._balanced=!0,n(h)}}function Xw(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return wt(m)?Rr(e,i)(m):i(m)}function i(m){return m===41?d(m):wm(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function s(m){return wt(m)?Rr(e,l)(m):d(m)}function o(m){return n(m)}function l(m){return m===34||m===39||m===40?Em(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):d(m)}function u(m){return wt(m)?Rr(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 eD(e,t,n){const r=this;return a;function a(o){return Dm.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(ir(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function tD(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const nD={name:"labelStartImage",tokenize:rD,resolveAll:Ko.resolveAll};function rD(e,t,n){const r=this;return a;function a(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(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 aD={name:"labelStartLink",tokenize:iD,resolveAll:Ko.resolveAll};function iD(e,t,n){const r=this;return a;function a(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const is={name:"lineEnding",tokenize:sD};function sD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),He(e,t,"linePrefix")}}const Na={name:"thematicBreak",tokenize:oD};function oD(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||xe(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Ie(u)?He(e,o,"whitespace")(u):o(u))}}const yt={name:"list",tokenize:cD,continuation:{tokenize:dD},exit:mD},uD={tokenize:hD,partial:!0},lD={tokenize:fD,partial:!0};function cD(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[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:eo(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(Na,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return eo(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(xi,r.interrupt?n:d,e.attempt(uD,h,m))}function d(p){return r.containerState.initialBlankLine=!0,i++,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=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function dD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(xi,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,He(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(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(lD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,He(e,e.attempt(yt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function fD(e,t,n){const r=this;return He(e,a,"listItemIndent",r.containerState.size+1);function a(i){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(i):n(i)}}function mD(e){e.exit(this.containerState.type)}function hD(e,t,n){const r=this;return He(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function a(i){const s=r.events[r.events.length-1];return!Ie(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const jc={name:"setextUnderline",tokenize:gD,resolveTo:pD};function pD(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:Object.assign({},e[a][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[i][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}function gD(e,t,n){const r=this;let a;return i;function i(u){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"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Ie(u)?He(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||xe(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const vD={tokenize:bD};function bD(e){const t=this,n=e.attempt(xi,r,e.attempt(this.parser.constructs.flowInitial,a,He(e,e.attempt(this.parser.constructs.flow,a,e.attempt(Dw,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const yD={resolveAll:km()},xD=_m("string"),CD=_m("text");function _m(e){return{tokenize:t,resolveAll:km(e==="text"?wD:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const m=a[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 km(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function wD(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],a=t.sliceStream(r);let i=a.length,s=-1,o=0,l;for(;i--;){const u=a[i];if(typeof u=="string"){for(s=u.length;u.charCodeAt(s-1)===32;)o++,s--;if(s)break;s=-1}else if(u===-2)l=!0,o++;else if(u!==-1){i++;break}}if(o){const u={type:n===e.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-o,offset:r.end.offset-o,_index:r.start._index+i,_bufferIndex:i?s:r.start._bufferIndex+s},end:Object.assign({},r.end)};r.end=Object.assign({},u.start),r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}function DD(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:C,enter:D,exit:A,attempt:T(E),check:T(k),interrupt:T(k,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:h,now:g,defineSkip:f,write:m};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function m(L){return s=jt(s,L),b(),s[s.length-1]!==null?[]:($(t,0),u.events=Ho(i,u.events,u),u.events)}function h(L,B){return _D(p(L),B)}function p(L){return ED(s,L)}function g(){const{line:L,column:B,offset:F,_index:j,_bufferIndex:O}=r;return{line:L,column:B,offset:F,_index:j,_bufferIndex:O}}function f(L){a[L.line]=L.column,z()}function b(){let L;for(;r._index<s.length;){const B=s[r._index];if(typeof B=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<B.length;)v(B.charCodeAt(r._bufferIndex));else v(B)}}function v(L){d=d(L)}function C(L){xe(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,z()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=L}function D(L,B){const F=B||{};return F.type=L,F.start=g(),u.events.push(["enter",F,u]),o.push(F),F}function A(L){const B=o.pop();return B.end=g(),u.events.push(["exit",B,u]),B}function E(L,B){$(L,B.from)}function k(L,B){B.restore()}function T(L,B){return F;function F(j,O,q){let W,ne,J,w;return Array.isArray(j)?se(j):"tokenize"in j?se([j]):Q(j);function Q(S){return R;function R(K){const Z=K!==null&&S[K],re=K!==null&&S.null,ce=[...Array.isArray(Z)?Z:Z?[Z]:[],...Array.isArray(re)?re:re?[re]:[]];return se(ce)(K)}}function se(S){return W=S,ne=0,S.length===0?q:_(S[ne])}function _(S){return R;function R(K){return w=P(),J=S,S.partial||(u.currentConstruct=S),S.name&&u.parser.constructs.disable.null.includes(S.name)?U():S.tokenize.call(B?Object.assign(Object.create(u),B):u,l,M,U)(K)}}function M(S){return L(J,w),O}function U(S){return w.restore(),++ne<W.length?_(W[ne]):q}}}function $(L,B){L.resolveAll&&!i.includes(L)&&i.push(L),L.resolve&&on(u.events,B,u.events.length-B,L.resolve(u.events.slice(B),u)),L.resolveTo&&(u.events=L.resolveTo(u.events,u))}function P(){const L=g(),B=u.previous,F=u.currentConstruct,j=u.events.length,O=Array.from(o);return{restore:q,from:j};function q(){r=L,u.previous=B,u.currentConstruct=F,u.events.length=j,o=O,z()}}function z(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function ED(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let s;if(n===a)s=[e[n].slice(r,i)];else{if(s=e.slice(n,a),r>-1){const o=s[0];typeof o=="string"?s[0]=o.slice(r):s.shift()}i>0&&s.push(e[a].slice(0,i))}return s}function _D(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){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&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const _D={42:yt,43:yt,45:yt,48:yt,49:yt,50:yt,51:yt,52:yt,53:yt,54:yt,55:yt,56:yt,57:yt,62:vm},kD={91:Fw},FD={[-2]:as,[-1]:as,32:as},AD={35:Ow,42:Na,45:[jc,Na],60:Iw,61:jc,95:Na,96:Tc,126:Tc},BD={38:ym,92:bm},TD={[-5]:is,[-4]:is,[-3]:is,33:tD,38:ym,42:to,60:[rw,Ww],91:rD,92:[Sw,bm],93:Ko,95:to,96:gw},SD={null:[to,bD]},jD={null:[42,95]},OD={null:[]},PD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:jD,contentInitial:kD,disable:OD,document:_D,flow:AD,flowInitial:FD,insideSpan:SD,string:BD,text:TD},Symbol.toStringTag,{value:"Module"}));function MD(e){const n=qC([PD,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(GC),document:a(JC),flow:a(gD),string:a(yD),text:a(xD)};return r;function a(i){return s;function s(o){return wD(r,i,o)}}}function ND(e){for(;!xm(e););return e}const Oc=/[\0\t\n\r]/g;function ID(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,m,h,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),m=0,t="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(Oc.lastIndex=m,u=Oc.exec(i),h=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(h),!u){t=i.slice(m);break}if(p===10&&m===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),m<h&&(l.push(i.slice(m,h)),e+=h-m),p){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}m=h+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const RD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function $D(e){return e.replace(RD,LD)}function LD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return gm(n.slice(i?2:1),i?16:10)}return Vo(n)||e}const km={}.hasOwnProperty;function zD(e,t,n){return typeof t!="string"&&(n=t,t=void 0),qD(n)(ND(MD(n).document().write(ID()(e,t,!0))))}function qD(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Je),autolinkProtocol:P,autolinkEmail:P,atxHeading:i(ve),blockQuote:i(Z),characterEscape:P,characterReference:P,codeFenced:i(re),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(re,s),codeText:i(ce,s),codeTextData:P,data:P,codeFlowValue:P,definition:i(X),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(pe),hardBreakEscape:i(ye),hardBreakTrailing:i(ye),htmlFlow:i(Me,s),htmlFlowData:P,htmlText:i(Me,s),htmlTextData:P,image:i(je),label:s,link:i(Je),listItem:i(Le),listItemValue:h,listOrdered:i(Ue,m),listUnordered:i(Ue),paragraph:i(Xe),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(ve),strong:i(_e),thematicBreak:i(We)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:K,autolinkProtocol:R,blockQuote:l(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,characterReferenceValue:S,codeFenced:l(b),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:z,codeIndented:l(v),codeText:l(O),codeTextData:z,data:z,definition:l(),definitionDestinationString:A,definitionLabelString:C,definitionTitleString:D,emphasis:l(),hardBreakEscape:l(B),hardBreakTrailing:l(B),htmlFlow:l(F),htmlFlowData:z,htmlText:l(j),htmlTextData:z,image:l(W),label:J,labelText:ne,lineEnding:L,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:M,resourceDestinationString:w,resourceTitleString:Q,resource:se,setextHeading:l($),setextHeadingLineSequence:T,setextHeadingText:k,strong:l(),thematicBreak:l()}};Fm(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Y){let oe={type:"root",children:[]};const ie={stack:[oe],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},me=[];let ge=-1;for(;++ge<Y.length;)if(Y[ge][1].type==="listOrdered"||Y[ge][1].type==="listUnordered")if(Y[ge][0]==="enter")me.push(ge);else{const ke=me.pop();ge=a(Y,ke,ge)}for(ge=-1;++ge<Y.length;){const ke=t[Y[ge][0]];km.call(ke,Y[ge][1].type)&&ke[Y[ge][1].type].call(Object.assign({sliceSerialize:Y[ge][2].sliceSerialize},ie),Y[ge][1])}if(ie.tokenStack.length>0){const ke=ie.tokenStack[ie.tokenStack.length-1];(ke[1]||Pc).call(ie,void 0,ke[0])}for(oe.position={start:mn(Y.length>0?Y[0][1].start:{line:1,column:1,offset:0}),end:mn(Y.length>0?Y[Y.length-2][1].end:{line:1,column:1,offset:0})},ge=-1;++ge<t.transforms.length;)oe=t.transforms[ge](oe)||oe;return oe}function a(Y,oe,ie){let me=oe-1,ge=-1,ke=!1,ze,ot,At,vt;for(;++me<=ie;){const tt=Y[me];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?ge++:ge--,vt=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(ze&&!vt&&!ge&&!At&&(At=me),vt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:vt=void 0}if(!ge&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||ge===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(ze){let Ce=me;for(ot=void 0;Ce--;){const Be=Y[Ce];if(Be[1].type==="lineEnding"||Be[1].type==="lineEndingBlank"){if(Be[0]==="exit")continue;ot&&(Y[ot][1].type="lineEndingBlank",ke=!0),Be[1].type="lineEnding",ot=Ce}else if(!(Be[1].type==="linePrefix"||Be[1].type==="blockQuotePrefix"||Be[1].type==="blockQuotePrefixWhitespace"||Be[1].type==="blockQuoteMarker"||Be[1].type==="listItemIndent"))break}At&&(!ot||At<ot)&&(ze._spread=!0),ze.end=Object.assign({},ot?Y[ot][1].start:tt[1].end),Y.splice(ot||me,0,["exit",ze,tt[2]]),me++,ie++}if(tt[1].type==="listItemPrefix"){const Ce={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};ze=Ce,Y.splice(me,0,["enter",Ce,tt[2]]),me++,ie++,At=void 0,vt=!0}}}return Y[oe][1]._spread=ke,ie}function i(Y,oe){return ie;function ie(me){o.call(this,Y(me),me),oe&&oe.call(this,me)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(Y,oe,ie){this.stack[this.stack.length-1].children.push(Y),this.stack.push(Y),this.tokenStack.push([oe,ie]),Y.position={start:mn(oe.start),end:void 0}}function l(Y){return oe;function oe(ie){Y&&Y.call(this,ie),u.call(this,ie)}}function u(Y,oe){const ie=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==Y.type&&(oe?oe.call(this,Y,me[0]):(me[1]||Pc).call(this,Y,me[0]));else throw new Error("Cannot close `"+Y.type+"` ("+Ir({start:Y.start,end:Y.end})+"): it’s not open");ie.position.end=mn(Y.end)}function d(){return LC(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function h(Y){if(this.data.expectingFirstListItemValue){const oe=this.stack[this.stack.length-2];oe.start=Number.parseInt(this.sliceSerialize(Y),10),this.data.expectingFirstListItemValue=void 0}}function p(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.lang=Y}function g(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.meta=Y}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y.replace(/(\r?\n|\r)$/g,"")}function C(Y){const oe=this.resume(),ie=this.stack[this.stack.length-1];ie.label=oe,ie.identifier=ir(this.sliceSerialize(Y)).toLowerCase()}function D(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Y}function A(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Y}function E(Y){const oe=this.stack[this.stack.length-1];if(!oe.depth){const ie=this.sliceSerialize(Y).length;oe.depth=ie}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function T(Y){const oe=this.stack[this.stack.length-1];oe.depth=this.sliceSerialize(Y).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function P(Y){const ie=this.stack[this.stack.length-1].children;let me=ie[ie.length-1];(!me||me.type!=="text")&&(me=Oe(),me.position={start:mn(Y.start),end:void 0},ie.push(me)),this.stack.push(me)}function z(Y){const oe=this.stack.pop();oe.value+=this.sliceSerialize(Y),oe.position.end=mn(Y.end)}function L(Y){const oe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ie=oe.children[oe.children.length-1];ie.position.end=mn(Y.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(oe.type)&&(P.call(this,Y),z.call(this,Y))}function B(){this.data.atHardBreak=!0}function F(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y}function j(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y}function O(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y}function q(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=oe,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function W(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=oe,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function ne(Y){const oe=this.sliceSerialize(Y),ie=this.stack[this.stack.length-2];ie.label=$D(oe),ie.identifier=ir(oe).toLowerCase()}function J(){const Y=this.stack[this.stack.length-1],oe=this.resume(),ie=this.stack[this.stack.length-1];if(this.data.inReference=!0,ie.type==="link"){const me=Y.children;ie.children=me}else ie.alt=oe}function w(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Y}function Q(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Y}function se(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function M(Y){const oe=this.resume(),ie=this.stack[this.stack.length-1];ie.label=oe,ie.identifier=ir(this.sliceSerialize(Y)).toLowerCase(),this.data.referenceType="full"}function U(Y){this.data.characterReferenceType=Y.type}function S(Y){const oe=this.sliceSerialize(Y),ie=this.data.characterReferenceType;let me;ie?(me=gm(oe,ie==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Vo(oe);const ge=this.stack.pop();ge.value+=me,ge.position.end=mn(Y.end)}function R(Y){z.call(this,Y);const oe=this.stack[this.stack.length-1];oe.url=this.sliceSerialize(Y)}function K(Y){z.call(this,Y);const oe=this.stack[this.stack.length-1];oe.url="mailto:"+this.sliceSerialize(Y)}function Z(){return{type:"blockquote",children:[]}}function re(){return{type:"code",lang:null,meta:null,value:""}}function ce(){return{type:"inlineCode",value:""}}function X(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function ve(){return{type:"heading",depth:0,children:[]}}function ye(){return{type:"break"}}function Me(){return{type:"html",value:""}}function je(){return{type:"image",title:null,url:"",alt:null}}function Je(){return{type:"link",title:null,url:"",children:[]}}function Ue(Y){return{type:"list",ordered:Y.type==="listOrdered",start:null,spread:Y._spread,children:[]}}function Le(Y){return{type:"listItem",spread:Y._spread,checked:null,children:[]}}function Xe(){return{type:"paragraph",children:[]}}function _e(){return{type:"strong",children:[]}}function Oe(){return{type:"text",value:""}}function We(){return{type:"thematicBreak"}}}function mn(e){return{line:e.line,column:e.column,offset:e.offset}}function Fm(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Fm(e,r):UD(e,r)}}function UD(e,t){let n;for(n in t)if(km.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 Pc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ir({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ir({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ir({start:t.start,end:t.end})+") is still open")}function WD(e){const t=this;t.parser=n;function n(r){return zD(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Am(e,t){var l,u,d;const n={...tr,...t==null?void 0:t.nodeTypes,[H.heading]:{...tr[H.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[H.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(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=>Am({...m,ordered:e.ordered||!1},t))),e.type){case ht.heading:return{type:n[H.heading][e.depth||1],children:s.map(m=>({...m,[n[H.heading][e.depth||1]]:!0}))};case ht.list:return{type:e.ordered?n[H.ol]:n[H.ul],children:s};case ht.listItem:return{type:n[H.li],children:s};case ht.paragraph:return{type:n[H.paragraph],children:s};case ht.link:return{type:n[H.link],[r]:e.url,children:s};case ht.image:return{type:n[H.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case ht.blockquote:return{type:n[H.blockquote],children:s};case ht.code:return{type:n[H.codeblock],language:e.lang,children:[{text:e.value}]};case ht.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[H.paragraph],children:[{text:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:H.paragraph,children:[{text:e.value||""}]};case ht.emphasis:return{[n[Kt.emphasis]]:!0,...ss(s),...Ca(s)};case ht.strong:return{[n[Kt.strong]]:!0,...ss(s),...Ca(s)};case ht.delete:return{[n[Kt.delete]]:!0,...ss(s),...Ca(s)};case ht.inlineCode:return{[n[Kt.code]]:!0,text:e.value,...Ca(s)};case ht.thematicBreak:return{type:n[H.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const ss=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Ca(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const VD=function(t){const n=r=>r.children.map(a=>Am(a,t));this.Compiler=n},HD=(e,t=n=>{})=>{MC().use(WD).use(VD).process(e).then(n=>{const r=Ot(n.result),a=s=>{const o=s;[H.li,H.blockquote].includes(o.type)&&o.children.map((l,u)=>{const d=l;d.type===H.paragraph&&o.children.splice(u,1,...d.children)}),"children"in s&&s.children&&s.children.forEach(l=>a(l))};r.forEach(a);const i=s=>{for(let o=0;o<s.length;o++){const l=s[o],u=l;if(u.type===H.link){const d=u.children&&u.children[0];if(d&&"text"in d&&d.text.includes(Ys)){const m=u,h=d.text.replace(Ys,""),p="link"in m&&m.link?m.link:"";m.type=H.mention,m.id=p,m.name=h,m.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in l&&l.children&&i(l.children)}};i(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,l)=>{if("text"in o&&o.text){const u=o.text.match(/~~(.*?)~~/g);u&&u.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,[H.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},Zo=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},KD=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=x.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=I.parent(a),r=le.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},ZD=e=>{const{selection:t}=e;return t?x.string(e,t):null},Mc=e=>{let t="";for(const n of le.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},YD=e=>{for(const[t]of le.descendants(e)){const n=t;if(n.type===H.link)return n.link}return null},Nc={"mod+b":H.bold,"mod+i":H.italic,"mod+shift+x":H.strikethrough,"mod+k":H.link,"mod+shift+7":H.ol,"mod+shift+8":H.ul,"mod+shift+9":H.blockquote},GD=(e,t,n,r)=>{for(const a in Nc)if(Wx(a,e)){e.stopPropagation(),e.preventDefault();const i=Nc[a];if(i===H.link){n([{type:"showLinkEditor",value:!0}]);return}if(sE(i)){Nm(t,i,r);return}Om(t,i,r)}},Bm=(e,t,n,r)=>{var d;const{selectedUser:a,possibleUsers:i}=t,s=i[a];if(!s)return;const o=s.userId||"",l=(d=s.user)==null?void 0:d.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const u={type:H.mention,id:o,name:l,children:[{text:""}]};ee.select(e,(t==null?void 0:t.position)||fm),ee.insertNodes(e,[u,{text:" "}]),ee.move(e,{distance:1,unit:"offset"}),Zo(r)},QD=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&G.isCollapsed(i)){const[s]=G.edges(i),o=x.start(e,s.path),l=x.range(e,o,s),d=x.string(e,l).match(dd);if(d){const m=d.index||0,h={path:s.path,offset:m},p={path:s.path,offset:m+d[0].length},g=x.range(e,h,p),f=x.after(e,s),b=x.range(e,s,f);if(x.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const D=d[1];let A=[];r&&(A=await r({name:D})),a([{type:"mentionPopover",value:{show:A.length>0?!0:n!==null,selectedUser:0,possibleUsers:A,position:A.length>0?g:null,numberOfUsers:A.length>0?A.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},Tm=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},Yn=e=>typeof e.text=="string",JD=[H.hr,H.image,H.mention],Ic="<br>";function Sm(e,t={nodeTypes:tr}){const{nodeTypes:n=tr,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...tr,...n,heading:{...tr[H.heading],...n[H.heading]}},l=[o[H.ul],o[H.ol]];let u=i;if(!Yn(e)&&s!==H.mention&&(u=e.children.map(d=>{const m=Yn(d)?!1:l.includes(d.type||""),h=l.includes(e.type||"");let p=!1;return!Yn(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!Yn(g)&&g.type===o.link)),Sm({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||m||h||p)&&!d.break,listDepth:l.includes(d.type||"")?a+1:a,inBlockquote:s===o[H.blockquote]||e.parentType===o[H.blockquote]})}).join("")),!r&&(i===""||i===`
84
- `)&&e.parentType===o[H.paragraph]&&s!==o[H.mention]&&(s=o[H.paragraph],u=Ic),!(u===""&&!JD.find(d=>o[d]===s)))switch(u!==Ic&&Yn(e)&&(e[H.strikethrough]&&e[H.bold]&&e[H.italic]?u=Gn(u,"~~***"):e[H.bold]&&e[H.italic]?u=Gn(u,"***"):(e[H.bold]&&(u=Gn(u,"**")),e[H.italic]&&(u=Gn(u,"_")),e[H.strikethrough]&&(u=Gn(u,"~~")),e[H.code]&&(u=Gn(u,"`")))),s){case o[H.heading][1]:return`# ${u}
83
+ `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const kD={42:yt,43:yt,45:yt,48:yt,49:yt,50:yt,51:yt,52:yt,53:yt,54:yt,55:yt,56:yt,57:yt,62:bm},FD={91:Aw},AD={[-2]:as,[-1]:as,32:as},BD={35:Pw,42:Na,45:[jc,Na],60:Rw,61:jc,95:Na,96:Tc,126:Tc},TD={38:xm,92:ym},SD={[-5]:is,[-4]:is,[-3]:is,33:nD,38:xm,42:to,60:[aw,Vw],91:aD,92:[jw,ym],93:Ko,95:to,96:vw},jD={null:[to,yD]},OD={null:[42,95]},PD={null:[]},MD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:OD,contentInitial:FD,disable:PD,document:kD,flow:BD,flowInitial:AD,insideSpan:jD,string:TD,text:SD},Symbol.toStringTag,{value:"Module"}));function ND(e){const n=UC([MD,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(QC),document:a(XC),flow:a(vD),string:a(xD),text:a(CD)};return r;function a(i){return s;function s(o){return DD(r,i,o)}}}function ID(e){for(;!Cm(e););return e}const Oc=/[\0\t\n\r]/g;function RD(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,m,h,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),m=0,t="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(Oc.lastIndex=m,u=Oc.exec(i),h=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(h),!u){t=i.slice(m);break}if(p===10&&m===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),m<h&&(l.push(i.slice(m,h)),e+=h-m),p){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}m=h+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const $D=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function LD(e){return e.replace($D,zD)}function zD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return vm(n.slice(i?2:1),i?16:10)}return Vo(n)||e}const Fm={}.hasOwnProperty;function qD(e,t,n){return typeof t!="string"&&(n=t,t=void 0),UD(n)(ID(ND(n).document().write(RD()(e,t,!0))))}function UD(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Je),autolinkProtocol:P,autolinkEmail:P,atxHeading:i(ve),blockQuote:i(Z),characterEscape:P,characterReference:P,codeFenced:i(re),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(re,s),codeText:i(ce,s),codeTextData:P,data:P,codeFlowValue:P,definition:i(X),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(pe),hardBreakEscape:i(ye),hardBreakTrailing:i(ye),htmlFlow:i(Me,s),htmlFlowData:P,htmlText:i(Me,s),htmlTextData:P,image:i(je),label:s,link:i(Je),listItem:i(Le),listItemValue:h,listOrdered:i(Ue,m),listUnordered:i(Ue),paragraph:i(Xe),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(ve),strong:i(_e),thematicBreak:i(We)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:K,autolinkProtocol:R,blockQuote:l(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,characterReferenceValue:S,codeFenced:l(b),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:z,codeIndented:l(v),codeText:l(O),codeTextData:z,data:z,definition:l(),definitionDestinationString:A,definitionLabelString:C,definitionTitleString:D,emphasis:l(),hardBreakEscape:l(B),hardBreakTrailing:l(B),htmlFlow:l(F),htmlFlowData:z,htmlText:l(j),htmlTextData:z,image:l(W),label:J,labelText:ne,lineEnding:L,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:M,resourceDestinationString:w,resourceTitleString:Q,resource:se,setextHeading:l($),setextHeadingLineSequence:T,setextHeadingText:k,strong:l(),thematicBreak:l()}};Am(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Y){let oe={type:"root",children:[]};const ie={stack:[oe],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},me=[];let ge=-1;for(;++ge<Y.length;)if(Y[ge][1].type==="listOrdered"||Y[ge][1].type==="listUnordered")if(Y[ge][0]==="enter")me.push(ge);else{const ke=me.pop();ge=a(Y,ke,ge)}for(ge=-1;++ge<Y.length;){const ke=t[Y[ge][0]];Fm.call(ke,Y[ge][1].type)&&ke[Y[ge][1].type].call(Object.assign({sliceSerialize:Y[ge][2].sliceSerialize},ie),Y[ge][1])}if(ie.tokenStack.length>0){const ke=ie.tokenStack[ie.tokenStack.length-1];(ke[1]||Pc).call(ie,void 0,ke[0])}for(oe.position={start:mn(Y.length>0?Y[0][1].start:{line:1,column:1,offset:0}),end:mn(Y.length>0?Y[Y.length-2][1].end:{line:1,column:1,offset:0})},ge=-1;++ge<t.transforms.length;)oe=t.transforms[ge](oe)||oe;return oe}function a(Y,oe,ie){let me=oe-1,ge=-1,ke=!1,ze,ot,At,vt;for(;++me<=ie;){const tt=Y[me];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?ge++:ge--,vt=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(ze&&!vt&&!ge&&!At&&(At=me),vt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:vt=void 0}if(!ge&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||ge===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(ze){let Ce=me;for(ot=void 0;Ce--;){const Be=Y[Ce];if(Be[1].type==="lineEnding"||Be[1].type==="lineEndingBlank"){if(Be[0]==="exit")continue;ot&&(Y[ot][1].type="lineEndingBlank",ke=!0),Be[1].type="lineEnding",ot=Ce}else if(!(Be[1].type==="linePrefix"||Be[1].type==="blockQuotePrefix"||Be[1].type==="blockQuotePrefixWhitespace"||Be[1].type==="blockQuoteMarker"||Be[1].type==="listItemIndent"))break}At&&(!ot||At<ot)&&(ze._spread=!0),ze.end=Object.assign({},ot?Y[ot][1].start:tt[1].end),Y.splice(ot||me,0,["exit",ze,tt[2]]),me++,ie++}if(tt[1].type==="listItemPrefix"){const Ce={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};ze=Ce,Y.splice(me,0,["enter",Ce,tt[2]]),me++,ie++,At=void 0,vt=!0}}}return Y[oe][1]._spread=ke,ie}function i(Y,oe){return ie;function ie(me){o.call(this,Y(me),me),oe&&oe.call(this,me)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(Y,oe,ie){this.stack[this.stack.length-1].children.push(Y),this.stack.push(Y),this.tokenStack.push([oe,ie]),Y.position={start:mn(oe.start),end:void 0}}function l(Y){return oe;function oe(ie){Y&&Y.call(this,ie),u.call(this,ie)}}function u(Y,oe){const ie=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==Y.type&&(oe?oe.call(this,Y,me[0]):(me[1]||Pc).call(this,Y,me[0]));else throw new Error("Cannot close `"+Y.type+"` ("+Ir({start:Y.start,end:Y.end})+"): it’s not open");ie.position.end=mn(Y.end)}function d(){return zC(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function h(Y){if(this.data.expectingFirstListItemValue){const oe=this.stack[this.stack.length-2];oe.start=Number.parseInt(this.sliceSerialize(Y),10),this.data.expectingFirstListItemValue=void 0}}function p(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.lang=Y}function g(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.meta=Y}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y.replace(/(\r?\n|\r)$/g,"")}function C(Y){const oe=this.resume(),ie=this.stack[this.stack.length-1];ie.label=oe,ie.identifier=ir(this.sliceSerialize(Y)).toLowerCase()}function D(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Y}function A(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Y}function E(Y){const oe=this.stack[this.stack.length-1];if(!oe.depth){const ie=this.sliceSerialize(Y).length;oe.depth=ie}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function T(Y){const oe=this.stack[this.stack.length-1];oe.depth=this.sliceSerialize(Y).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function P(Y){const ie=this.stack[this.stack.length-1].children;let me=ie[ie.length-1];(!me||me.type!=="text")&&(me=Oe(),me.position={start:mn(Y.start),end:void 0},ie.push(me)),this.stack.push(me)}function z(Y){const oe=this.stack.pop();oe.value+=this.sliceSerialize(Y),oe.position.end=mn(Y.end)}function L(Y){const oe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ie=oe.children[oe.children.length-1];ie.position.end=mn(Y.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(oe.type)&&(P.call(this,Y),z.call(this,Y))}function B(){this.data.atHardBreak=!0}function F(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y}function j(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y}function O(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Y}function q(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=oe,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function W(){const Y=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Y.type+="Reference",Y.referenceType=oe,delete Y.url,delete Y.title}else delete Y.identifier,delete Y.label;this.data.referenceType=void 0}function ne(Y){const oe=this.sliceSerialize(Y),ie=this.stack[this.stack.length-2];ie.label=LD(oe),ie.identifier=ir(oe).toLowerCase()}function J(){const Y=this.stack[this.stack.length-1],oe=this.resume(),ie=this.stack[this.stack.length-1];if(this.data.inReference=!0,ie.type==="link"){const me=Y.children;ie.children=me}else ie.alt=oe}function w(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Y}function Q(){const Y=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Y}function se(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function M(Y){const oe=this.resume(),ie=this.stack[this.stack.length-1];ie.label=oe,ie.identifier=ir(this.sliceSerialize(Y)).toLowerCase(),this.data.referenceType="full"}function U(Y){this.data.characterReferenceType=Y.type}function S(Y){const oe=this.sliceSerialize(Y),ie=this.data.characterReferenceType;let me;ie?(me=vm(oe,ie==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Vo(oe);const ge=this.stack.pop();ge.value+=me,ge.position.end=mn(Y.end)}function R(Y){z.call(this,Y);const oe=this.stack[this.stack.length-1];oe.url=this.sliceSerialize(Y)}function K(Y){z.call(this,Y);const oe=this.stack[this.stack.length-1];oe.url="mailto:"+this.sliceSerialize(Y)}function Z(){return{type:"blockquote",children:[]}}function re(){return{type:"code",lang:null,meta:null,value:""}}function ce(){return{type:"inlineCode",value:""}}function X(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function ve(){return{type:"heading",depth:0,children:[]}}function ye(){return{type:"break"}}function Me(){return{type:"html",value:""}}function je(){return{type:"image",title:null,url:"",alt:null}}function Je(){return{type:"link",title:null,url:"",children:[]}}function Ue(Y){return{type:"list",ordered:Y.type==="listOrdered",start:null,spread:Y._spread,children:[]}}function Le(Y){return{type:"listItem",spread:Y._spread,checked:null,children:[]}}function Xe(){return{type:"paragraph",children:[]}}function _e(){return{type:"strong",children:[]}}function Oe(){return{type:"text",value:""}}function We(){return{type:"thematicBreak"}}}function mn(e){return{line:e.line,column:e.column,offset:e.offset}}function Am(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Am(e,r):WD(e,r)}}function WD(e,t){let n;for(n in t)if(Fm.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 Pc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ir({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ir({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ir({start:t.start,end:t.end})+") is still open")}function VD(e){const t=this;t.parser=n;function n(r){return qD(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Bm(e,t){var l,u,d;const n={...tr,...t==null?void 0:t.nodeTypes,[H.heading]:{...tr[H.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[H.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(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=>Bm({...m,ordered:e.ordered||!1},t))),e.type){case ht.heading:return{type:n[H.heading][e.depth||1],children:s.map(m=>({...m,[n[H.heading][e.depth||1]]:!0}))};case ht.list:return{type:e.ordered?n[H.ol]:n[H.ul],children:s};case ht.listItem:return{type:n[H.li],children:s};case ht.paragraph:return{type:n[H.paragraph],children:s};case ht.link:return{type:n[H.link],[r]:e.url,children:s};case ht.image:return{type:n[H.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case ht.blockquote:return{type:n[H.blockquote],children:s};case ht.code:return{type:n[H.codeblock],language:e.lang,children:[{text:e.value}]};case ht.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[H.paragraph],children:[{text:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:H.paragraph,children:[{text:e.value||""}]};case ht.emphasis:return{[n[Kt.emphasis]]:!0,...ss(s),...Ca(s)};case ht.strong:return{[n[Kt.strong]]:!0,...ss(s),...Ca(s)};case ht.delete:return{[n[Kt.delete]]:!0,...ss(s),...Ca(s)};case ht.inlineCode:return{[n[Kt.code]]:!0,text:e.value,...Ca(s)};case ht.thematicBreak:return{type:n[H.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const ss=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Ca(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const HD=function(t){const n=r=>r.children.map(a=>Bm(a,t));this.Compiler=n},KD=(e,t=n=>{})=>{NC().use(VD).use(HD).process(e).then(n=>{const r=Ot(n.result),a=s=>{const o=s;[H.li,H.blockquote].includes(o.type)&&o.children.map((l,u)=>{const d=l;d.type===H.paragraph&&o.children.splice(u,1,...d.children)}),"children"in s&&s.children&&s.children.forEach(l=>a(l))};r.forEach(a);const i=s=>{for(let o=0;o<s.length;o++){const l=s[o],u=l;if(u.type===H.link){const d=u.children&&u.children[0];if(d&&"text"in d&&d.text.includes(Ys)){const m=u,h=d.text.replace(Ys,""),p="link"in m&&m.link?m.link:"";m.type=H.mention,m.id=p,m.name=h,m.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in l&&l.children&&i(l.children)}};i(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,l)=>{if("text"in o&&o.text){const u=o.text.match(/~~(.*?)~~/g);u&&u.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,[H.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},Zo=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},ZD=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=x.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=I.parent(a),r=le.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},YD=e=>{const{selection:t}=e;return t?x.string(e,t):null},Mc=e=>{let t="";for(const n of le.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},GD=e=>{for(const[t]of le.descendants(e)){const n=t;if(n.type===H.link)return n.link}return null},Nc={"mod+b":H.bold,"mod+i":H.italic,"mod+shift+x":H.strikethrough,"mod+k":H.link,"mod+shift+7":H.ol,"mod+shift+8":H.ul,"mod+shift+9":H.blockquote},QD=(e,t,n,r)=>{for(const a in Nc)if(Vx(a,e)){e.stopPropagation(),e.preventDefault();const i=Nc[a];if(i===H.link){n([{type:"showLinkEditor",value:!0}]);return}if(oE(i)){Im(t,i,r);return}Pm(t,i,r)}},Tm=(e,t,n,r)=>{var d;const{selectedUser:a,possibleUsers:i}=t,s=i[a];if(!s)return;const o=s.userId||"",l=(d=s.user)==null?void 0:d.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const u={type:H.mention,id:o,name:l,children:[{text:""}]};ee.select(e,(t==null?void 0:t.position)||mm),ee.insertNodes(e,[u,{text:" "}]),ee.move(e,{distance:1,unit:"offset"}),Zo(r)},JD=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&G.isCollapsed(i)){const[s]=G.edges(i),o=x.start(e,s.path),l=x.range(e,o,s),d=x.string(e,l).match(fd);if(d){const m=d.index||0,h={path:s.path,offset:m},p={path:s.path,offset:m+d[0].length},g=x.range(e,h,p),f=x.after(e,s),b=x.range(e,s,f);if(x.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const D=d[1];let A=[];r&&(A=await r({name:D})),a([{type:"mentionPopover",value:{show:A.length>0?!0:n!==null,selectedUser:0,possibleUsers:A,position:A.length>0?g:null,numberOfUsers:A.length>0?A.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},Sm=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},Yn=e=>typeof e.text=="string",XD=[H.hr,H.image,H.mention],Ic="<br>";function jm(e,t={nodeTypes:tr}){const{nodeTypes:n=tr,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...tr,...n,heading:{...tr[H.heading],...n[H.heading]}},l=[o[H.ul],o[H.ol]];let u=i;if(!Yn(e)&&s!==H.mention&&(u=e.children.map(d=>{const m=Yn(d)?!1:l.includes(d.type||""),h=l.includes(e.type||"");let p=!1;return!Yn(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!Yn(g)&&g.type===o.link)),jm({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||m||h||p)&&!d.break,listDepth:l.includes(d.type||"")?a+1:a,inBlockquote:s===o[H.blockquote]||e.parentType===o[H.blockquote]})}).join("")),!r&&(i===""||i===`
84
+ `)&&e.parentType===o[H.paragraph]&&s!==o[H.mention]&&(s=o[H.paragraph],u=Ic),!(u===""&&!XD.find(d=>o[d]===s)))switch(u!==Ic&&Yn(e)&&(e[H.strikethrough]&&e[H.bold]&&e[H.italic]?u=Gn(u,"~~***"):e[H.bold]&&e[H.italic]?u=Gn(u,"***"):(e[H.bold]&&(u=Gn(u,"**")),e[H.italic]&&(u=Gn(u,"_")),e[H.strikethrough]&&(u=Gn(u,"~~")),e[H.code]&&(u=Gn(u,"`")))),s){case o[H.heading][1]:return`# ${u}
85
85
  `;case o[H.heading][2]:return`## ${u}
86
86
  `;case o[H.heading][3]:return`### ${u}
87
87
  `;case o[H.heading][4]:return`#### ${u}
@@ -100,8 +100,8 @@ ${p}${m?"1.":"-"} ${u}${h?`
100
100
  `:""}`;case o[H.paragraph]:return`${u}
101
101
 
102
102
  `;case o[H.hr]:return`---
103
- `;default:return u}}function Gn(e,t){const n=e.trim(),r=n,a=`${t}${r}${Rc(t)}`;if(r.length===e.length)return a;const i=t+r+Rc(t);return e.replace(n,i)}const Rc=e=>e.split("").reverse().join(""),XD=e=>e.map(t=>Sm(t)).join("").trim();const eE=({onFallbackClick:e=()=>{}})=>{const t=ae.useIntl(),n=qn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(cn),{show:l,selectedUser:u,possibleUsers:d}=i,m=mm(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const h=Tm(a);return c.jsx(gr,{parent:h,children:c.jsx(gd,{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:V({selected:f===u}),member:{id:p,...g,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const v={...i,selectedUser:f};r([{type:"mentionPopover",value:v}]),Bm(n,v,r,s),o&&o({id:p||"",name:g.name||""})}}},p)),c.jsx(an,{element:"li",className:V("fallback",{selected:d.length===u}),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 Yo=({formID:e,label:t,showLabel:n})=>{const{visible:r="",screenreader:a=""}=t||{};return n?c.jsx("label",{htmlFor:`${e}-input`,className:"rte-label text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:r}):c.jsx(Pe,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:a})},Go=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,"aria-pressed":s,...o})=>{const l=ae.useIntl(),u=qn(),{id:d,tabbableOption:m,setFocus:h,openTooltip:p,dispatch:g}=y.useContext(cn),f={};return e!==m&&(f.tabIndex=-1),s!==null&&(f["aria-pressed"]=typeof s=="boolean"?s:t),c.jsxs("li",{id:`${d}-${e}`,className:V(e,{"has-divider":n}),onMouseEnter:()=>{g([{type:"openTooltip",value:e}])},onMouseLeave:()=>{g([{type:"openTooltip",value:null}])},onFocus:()=>{g([{type:"openTooltip",value:e}])},onBlur:b=>{b.stopPropagation();const v=[{type:"openTooltip",value:null}];u.selection&&v.push({type:"lastAnchor",value:u.selection.anchor}),g(v)},contentEditable:!1,children:[c.jsxs("button",{...o,...f,className:V(e,a,{active:t}),onClick:b=>{b.stopPropagation(),b.preventDefault()},onMouseDown:b=>{b.stopPropagation(),b.preventDefault(),r()},onKeyDown:b=>{var v,C,D,A;if(b.key!=="Tab")switch(b.key){case"Enter":b.stopPropagation(),b.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":b.stopPropagation(),b.preventDefault();const E=b.currentTarget.closest("li");let k=E==null?void 0:E.nextElementSibling;if(b.key==="ArrowLeft"){const P=E==null?void 0:E.previousElementSibling;P?k=P:k=(v=E==null?void 0:E.parentElement)==null?void 0:v.lastElementChild}else k||(k=(C=E==null?void 0:E.parentElement)==null?void 0:C.firstElementChild);const T=k==null?void 0:k.className.split(" ")[0];T&&(h(T),(D=k==null?void 0:k.querySelector("button"))==null||D.focus());break;default:const $=b.currentTarget.closest("fieldset");if($){(A=$==null?void 0:$.previousElementSibling)==null||A.focus();break}}},children:[c.jsx(Pe,{showOnFocus:!1,children:l.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(Ln,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,accessibility:{"aria-hidden":!0},children:l.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},$c=[H.ol,H.ul],jm=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(x.nodes(e,{at:x.unhangRange(e,n),match:a=>{const i=a;return!x.isEditor(a)&&fe.isElement(a)&&i.type===t}}));return!!r},tE=e=>{const[t]=x.nodes(e,{match:n=>n.type===H.blockquote});return!!t},Om=(e,t,n)=>{try{const r=tE(e),a=jm(e,t),i=$c.includes(t);ee.unwrapNodes(e,{match:l=>{const u=l;return!x.isEditor(u)&&fe.isElement(u)&&$c.includes(u.type)},split:!0});const o={type:a?H.paragraph:i?H.li:t};if(ee.setNodes(e,o),t===H.h3){const l={type:t};a?x.removeMark(e,t):x.addMark(e,t,!0),ee.setNodes(e,l)}if(i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=x.parent(e,l,{edge:"end"});Array.from(x.nodes(e,{at:d,match:h=>{const p=h;return!x.isEditor(h)&&fe.isElement(h)&&p.type===H.li}})).forEach(([h,p])=>{le.string(h).trim()===""&&ee.removeNodes(e,{at:p})})}else{if(r){const u={type:H.blockquote,children:[]};ee.wrapNodes(e,u)}const l={type:t,children:[]};ee.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},Lc=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(cn),a=qn(),i=jm(a,e);return c.jsx(Go,{id:e,active:i,hasDivider:t,callback:()=>{Om(a,e,r),n(i?null:e)}})},$r=e=>{const[t]=x.nodes(e,{match:n=>{const r=n;return!x.isEditor(n)&&fe.isElement(n)&&r.type===H.link}});return!!t},nE=(e,t,n,r)=>{e.selection&&Qo(e,t,n,r)},rE=(e,t,n,r)=>{const{selection:a}=e;if(a&&G.isCollapsed(a)){const[s]=x.nodes(e,{match:o=>{const l=o;return!x.isEditor(o)&&fe.isElement(o)&&l.type===H.link}});if(s){const[o,l]=s,u={link:t};ee.setNodes(e,u,{at:l}),Zo(n)}}else Qo(e,t,n,r)},Qo=(e,t,n,r=a=>{console.error(a)})=>{try{$r(e)&&Pm(e);const{selection:a}=e,i=a&&G.isCollapsed(a),s={type:H.link,link:t,children:i?[{text:t}]:[]};i?(ee.insertNodes(e,s),ee.move(e,{distance:1,unit:"offset"})):(ee.wrapNodes(e,s,{split:!0}),ee.collapse(e,{edge:"end"}),ee.insertNodes(e,{text:""}),ee.move(e,{distance:1,unit:"offset"})),Zo(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},Pm=e=>{ee.unwrapNodes(e,{match:t=>{const n=t;return!x.isEditor(t)&&fe.isElement(t)&&n.type===H.link}})};let os=null;const aE=()=>{const e=ae.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,enrichedUrl:i,dispatch:s,getLinkPreview:o,reportError:l}=y.useContext(cn),u=qn(),d=vC(u),m=(d==null?void 0:d.text)||ZD(u),h=i!==!1,[p,g]=y.useState($r(u)),f=mm(u,"link-editor",`${n}-link`),b=y.useRef(null);y.useEffect(()=>{var E;!p&&r&&((E=b.current)==null||E.focus())},[p]),y.useEffect(()=>{os&&clearTimeout(os),os=setTimeout(()=>{g($r(u))},500)},[u.selection]);const v=[],C=["open","edit","remove"].map(E=>{const k={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${E}`},{link:d==null?void 0:d.pretty})};switch(v.push({className:E}),E){case"open":k.href=(d==null?void 0:d.full)||"",k.onClick=T=>{T.preventDefault(),T.stopPropagation(),window.open((d==null?void 0:d.full)||"","_blank"),s([{type:"showLinkEditor",value:!1}])},k.children=c.jsxs(c.Fragment,{children:[k.children,c.jsx(Pe,{children:e.formatMessage({id:`${t}${E}_text`})})]});break;case"edit":k.onClick=()=>{g(!1)};break;case"remove":k.onClick=()=>{const T=[{type:"showLinkEditor",value:!1}];$r(u)&&(Pm(u),T.push({type:"lastAnchor",value:null}),i&&(d==null?void 0:d.full)===(i==null?void 0:i.url)&&T.push({type:"enrichedUrl",value:!1})),s(T)};break}return k}),D=[{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:E=>{if(E.key==="Tab"){if(!u)return;E.preventDefault(),E.stopPropagation();const k=x.end(u,[]);ee.select(u,k),te.focus(u)}}}}];m&&D.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 A=Tm(a);return c.jsx(gr,{parent:A,children:c.jsx(Ln,{ref:f,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!p},functions:{onBlur:()=>{s([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var E;return(E=b.current)==null?void 0:E.focus()})}},children:p?c.jsx(pr,{wrappers:v,buttons:C}):c.jsx(Jt,{element:"fieldset",id:`${n}-link-editor`,className:V({"show-labels":m}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async E=>{setTimeout(async()=>{const k=[{type:"showLinkEditor",value:!1}];let T=E.url;if(E.url){const{full:$}=uo(E.url);T=$,d!=null&&d.full?rE(u,T,n,l):nE(u,T,n,l),k.push({type:"lastAnchor",value:null})}if(s(k),E.url&&o&&(!h||i&&(d==null?void 0:d.full)===i.url)){const $=await o(T);$.url&&s([{type:"enrichedUrl",value:$}])}})}},fields:D,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},iE=()=>{const e=qn(),{setFocus:t,dispatch:n}=y.useContext(cn),[r,a]=y.useState(!1);return y.useEffect(()=>{a($r(e))},[e.selection]),c.jsx(Go,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)},"aria-pressed":null})},sE=e=>[H.bold,H.italic,H.strikethrough].includes(e),Mm=(e,t)=>{const n=x.marks(e);return n?n[t]===!0:!1},Nm=(e,t,n)=>{try{Mm(e,t)?x.removeMark(e,t):x.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},oE=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(cn),a=qn(),i=Mm(a,e);return c.jsx(Go,{id:e,active:i,hasDivider:t,callback:()=>{Nm(a,e,r),n(i?null:e)}})},ti=[H.bold,H.italic,H.strikethrough],uE=[H.ol,H.ul,H.blockquote];const lE=({styling:e={showHeadingOption:!1},...t})=>{const n=ae.useIntl(),{id:r}=y.useContext(cn);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${r}`,className:"toolbar",...t,children:[c.jsx(Pe,{element:"legend",showOnFocus:!1,children:n.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[(e==null?void 0:e.showHeadingOption)&&c.jsx(Lc,{format:H.h3,hasDivider:!0},H.h3),ti.map((a,i)=>c.jsx(oE,{format:a,hasDivider:i===ti.length-1},a)),c.jsx(iE,{}),uE.map((a,i)=>c.jsx(Lc,{format:a,hasDivider:i===1},a))]})]}),c.jsx(aE,{})]})};function cE(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 no(e,t){return Array(t+1).join(e)}function dE(e){return e.replace(/^\n*/,"")}function fE(e){for(var t=e.length;t>0&&e[t-1]===`
104
- `;)t--;return e.substring(0,t)}var mE=["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 Jo(e){return Xo(e,mE)}var Im=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Rm(e){return Xo(e,Im)}function hE(e){return Lm(e,Im)}var $m=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function pE(e){return Xo(e,$m)}function gE(e){return Lm(e,$m)}function Xo(e,t){return t.indexOf(e.nodeName)>=0}function Lm(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var dt={};dt.paragraph={filter:"p",replacement:function(e){return`
103
+ `;default:return u}}function Gn(e,t){const n=e.trim(),r=n,a=`${t}${r}${Rc(t)}`;if(r.length===e.length)return a;const i=t+r+Rc(t);return e.replace(n,i)}const Rc=e=>e.split("").reverse().join(""),eE=e=>e.map(t=>jm(t)).join("").trim();const tE=({onFallbackClick:e=()=>{}})=>{const t=ae.useIntl(),n=qn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(cn),{show:l,selectedUser:u,possibleUsers:d}=i,m=hm(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const h=Sm(a);return c.jsx(gr,{parent:h,children:c.jsx(vd,{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:V({selected:f===u}),member:{id:p,...g,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const v={...i,selectedUser:f};r([{type:"mentionPopover",value:v}]),Tm(n,v,r,s),o&&o({id:p||"",name:g.name||""})}}},p)),c.jsx(an,{element:"li",className:V("fallback",{selected:d.length===u}),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 Yo=({formID:e,label:t,showLabel:n})=>{const{visible:r="",screenreader:a=""}=t||{};return n?c.jsx("label",{htmlFor:`${e}-input`,className:"rte-label text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:r}):c.jsx(Pe,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:a})},Go=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,"aria-pressed":s,...o})=>{const l=ae.useIntl(),u=qn(),{id:d,tabbableOption:m,setFocus:h,openTooltip:p,dispatch:g}=y.useContext(cn),f={};return e!==m&&(f.tabIndex=-1),s!==null&&(f["aria-pressed"]=typeof s=="boolean"?s:t),c.jsxs("li",{id:`${d}-${e}`,className:V(e,{"has-divider":n}),onMouseEnter:()=>{g([{type:"openTooltip",value:e}])},onMouseLeave:()=>{g([{type:"openTooltip",value:null}])},onFocus:()=>{g([{type:"openTooltip",value:e}])},onBlur:b=>{b.stopPropagation();const v=[{type:"openTooltip",value:null}];u.selection&&v.push({type:"lastAnchor",value:u.selection.anchor}),g(v)},contentEditable:!1,children:[c.jsxs("button",{...o,...f,className:V(e,a,{active:t}),onClick:b=>{b.stopPropagation(),b.preventDefault()},onMouseDown:b=>{b.stopPropagation(),b.preventDefault(),r()},onKeyDown:b=>{var v,C,D,A;if(b.key!=="Tab")switch(b.key){case"Enter":b.stopPropagation(),b.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":b.stopPropagation(),b.preventDefault();const E=b.currentTarget.closest("li");let k=E==null?void 0:E.nextElementSibling;if(b.key==="ArrowLeft"){const P=E==null?void 0:E.previousElementSibling;P?k=P:k=(v=E==null?void 0:E.parentElement)==null?void 0:v.lastElementChild}else k||(k=(C=E==null?void 0:E.parentElement)==null?void 0:C.firstElementChild);const T=k==null?void 0:k.className.split(" ")[0];T&&(h(T),(D=k==null?void 0:k.querySelector("button"))==null||D.focus());break;default:const $=b.currentTarget.closest("fieldset");if($){(A=$==null?void 0:$.previousElementSibling)==null||A.focus();break}}},children:[c.jsx(Pe,{showOnFocus:!1,children:l.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(Ln,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,accessibility:{"aria-hidden":!0},children:l.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},$c=[H.ol,H.ul],Om=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(x.nodes(e,{at:x.unhangRange(e,n),match:a=>{const i=a;return!x.isEditor(a)&&fe.isElement(a)&&i.type===t}}));return!!r},nE=e=>{const[t]=x.nodes(e,{match:n=>n.type===H.blockquote});return!!t},Pm=(e,t,n)=>{try{const r=nE(e),a=Om(e,t),i=$c.includes(t);ee.unwrapNodes(e,{match:l=>{const u=l;return!x.isEditor(u)&&fe.isElement(u)&&$c.includes(u.type)},split:!0});const o={type:a?H.paragraph:i?H.li:t};if(ee.setNodes(e,o),t===H.h3){const l={type:t};a?x.removeMark(e,t):x.addMark(e,t,!0),ee.setNodes(e,l)}if(i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=x.parent(e,l,{edge:"end"});Array.from(x.nodes(e,{at:d,match:h=>{const p=h;return!x.isEditor(h)&&fe.isElement(h)&&p.type===H.li}})).forEach(([h,p])=>{le.string(h).trim()===""&&ee.removeNodes(e,{at:p})})}else{if(r){const u={type:H.blockquote,children:[]};ee.wrapNodes(e,u)}const l={type:t,children:[]};ee.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},Lc=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(cn),a=qn(),i=Om(a,e);return c.jsx(Go,{id:e,active:i,hasDivider:t,callback:()=>{Pm(a,e,r),n(i?null:e)}})},$r=e=>{const[t]=x.nodes(e,{match:n=>{const r=n;return!x.isEditor(n)&&fe.isElement(n)&&r.type===H.link}});return!!t},rE=(e,t,n,r)=>{e.selection&&Qo(e,t,n,r)},aE=(e,t,n,r)=>{const{selection:a}=e;if(a&&G.isCollapsed(a)){const[s]=x.nodes(e,{match:o=>{const l=o;return!x.isEditor(o)&&fe.isElement(o)&&l.type===H.link}});if(s){const[o,l]=s,u={link:t};ee.setNodes(e,u,{at:l}),Zo(n)}}else Qo(e,t,n,r)},Qo=(e,t,n,r=a=>{console.error(a)})=>{try{$r(e)&&Mm(e);const{selection:a}=e,i=a&&G.isCollapsed(a),s={type:H.link,link:t,children:i?[{text:t}]:[]};i?(ee.insertNodes(e,s),ee.move(e,{distance:1,unit:"offset"})):(ee.wrapNodes(e,s,{split:!0}),ee.collapse(e,{edge:"end"}),ee.insertNodes(e,{text:""}),ee.move(e,{distance:1,unit:"offset"})),Zo(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},Mm=e=>{ee.unwrapNodes(e,{match:t=>{const n=t;return!x.isEditor(t)&&fe.isElement(t)&&n.type===H.link}})};let os=null;const iE=()=>{const e=ae.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,enrichedUrl:i,dispatch:s,getLinkPreview:o,reportError:l}=y.useContext(cn),u=qn(),d=bC(u),m=(d==null?void 0:d.text)||YD(u),h=i!==!1,[p,g]=y.useState($r(u)),f=hm(u,"link-editor",`${n}-link`),b=y.useRef(null);y.useEffect(()=>{var E;!p&&r&&((E=b.current)==null||E.focus())},[p]),y.useEffect(()=>{os&&clearTimeout(os),os=setTimeout(()=>{g($r(u))},500)},[u.selection]);const v=[],C=["open","edit","remove"].map(E=>{const k={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${E}`},{link:d==null?void 0:d.pretty})};switch(v.push({className:E}),E){case"open":k.href=(d==null?void 0:d.full)||"",k.onClick=T=>{T.preventDefault(),T.stopPropagation(),window.open((d==null?void 0:d.full)||"","_blank"),s([{type:"showLinkEditor",value:!1}])},k.children=c.jsxs(c.Fragment,{children:[k.children,c.jsx(Pe,{children:e.formatMessage({id:`${t}${E}_text`})})]});break;case"edit":k.onClick=()=>{g(!1)};break;case"remove":k.onClick=()=>{const T=[{type:"showLinkEditor",value:!1}];$r(u)&&(Mm(u),T.push({type:"lastAnchor",value:null}),i&&(d==null?void 0:d.full)===(i==null?void 0:i.url)&&T.push({type:"enrichedUrl",value:!1})),s(T)};break}return k}),D=[{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:E=>{if(E.key==="Tab"){if(!u)return;E.preventDefault(),E.stopPropagation();const k=x.end(u,[]);ee.select(u,k),te.focus(u)}}}}];m&&D.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 A=Sm(a);return c.jsx(gr,{parent:A,children:c.jsx(Ln,{ref:f,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!p},functions:{onBlur:()=>{s([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var E;return(E=b.current)==null?void 0:E.focus()})}},children:p?c.jsx(pr,{wrappers:v,buttons:C}):c.jsx(Jt,{element:"fieldset",id:`${n}-link-editor`,className:V({"show-labels":m}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async E=>{setTimeout(async()=>{const k=[{type:"showLinkEditor",value:!1}];let T=E.url;if(E.url){const{full:$}=uo(E.url);T=$,d!=null&&d.full?aE(u,T,n,l):rE(u,T,n,l),k.push({type:"lastAnchor",value:null})}if(s(k),E.url&&o&&(!h||i&&(d==null?void 0:d.full)===i.url)){const $=await o(T);$.url&&s([{type:"enrichedUrl",value:$}])}})}},fields:D,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},sE=()=>{const e=qn(),{setFocus:t,dispatch:n}=y.useContext(cn),[r,a]=y.useState(!1);return y.useEffect(()=>{a($r(e))},[e.selection]),c.jsx(Go,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)},"aria-pressed":null})},oE=e=>[H.bold,H.italic,H.strikethrough].includes(e),Nm=(e,t)=>{const n=x.marks(e);return n?n[t]===!0:!1},Im=(e,t,n)=>{try{Nm(e,t)?x.removeMark(e,t):x.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},uE=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(cn),a=qn(),i=Nm(a,e);return c.jsx(Go,{id:e,active:i,hasDivider:t,callback:()=>{Im(a,e,r),n(i?null:e)}})},ti=[H.bold,H.italic,H.strikethrough],lE=[H.ol,H.ul,H.blockquote];const cE=({styling:e={showHeadingOption:!1},...t})=>{const n=ae.useIntl(),{id:r}=y.useContext(cn);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${r}`,className:"toolbar",...t,children:[c.jsx(Pe,{element:"legend",showOnFocus:!1,children:n.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[(e==null?void 0:e.showHeadingOption)&&c.jsx(Lc,{format:H.h3,hasDivider:!0},H.h3),ti.map((a,i)=>c.jsx(uE,{format:a,hasDivider:i===ti.length-1},a)),c.jsx(sE,{}),lE.map((a,i)=>c.jsx(Lc,{format:a,hasDivider:i===1},a))]})]}),c.jsx(iE,{})]})};function dE(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 no(e,t){return Array(t+1).join(e)}function fE(e){return e.replace(/^\n*/,"")}function mE(e){for(var t=e.length;t>0&&e[t-1]===`
104
+ `;)t--;return e.substring(0,t)}var hE=["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 Jo(e){return Xo(e,hE)}var Rm=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function $m(e){return Xo(e,Rm)}function pE(e){return zm(e,Rm)}var Lm=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function gE(e){return Xo(e,Lm)}function vE(e){return zm(e,Lm)}function Xo(e,t){return t.indexOf(e.nodeName)>=0}function zm(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var dt={};dt.paragraph={filter:"p",replacement:function(e){return`
105
105
 
106
106
  `+e+`
107
107
 
@@ -148,7 +148,7 @@ ${p}${m?"1.":"-"} ${u}${h?`
148
148
  `)+`
149
149
 
150
150
  `,this.references=[]),t}};dt.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};dt.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};dt.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}};dt.image={filter:"img",replacement:function(e,t){var n=ni(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=ni(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"!["+n+"]("+r+i+")":""}};function ni(e){return e?e.replace(/(\n+\s*)+/g,`
151
- `):""}function zm(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])}zm.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=us(this.array,e,this.options))||(t=us(this._keep,e,this.options))||(t=us(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 us(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(vE(a,t,n))return a}}function vE(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 bE(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(m){return m.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=zc(o,t,a);l!==t;){if(l.nodeType===3||l.nodeType===4){var u=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!s&&u[0]===" "&&(u=u.substr(1)),!u){l=ls(l);continue}l.data=u,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,s=!1):r(l)||a(l)?(i=null,s=!0):i&&(s=!1);else{l=ls(l);continue}var d=zc(o,l,a);o=l,l=d}i&&(i.data=i.data.replace(/ $/,""),i.data||ls(i))}}function ls(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function zc(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var eu=typeof window<"u"?window:{};function yE(){var e=eu.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function xE(){var e=function(){};return CE()?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 CE(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{eu.ActiveXObject&&(e=!0)}return e}var wE=yE()?eu.DOMParser:xE();function DE(e,t){var n;if(typeof e=="string"){var r=EE().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return bE({element:n,isBlock:Jo,isVoid:Rm,isPre:t.preformattedCode?_E:null}),n}var cs;function EE(){return cs=cs||new wE,cs}function _E(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function kE(e,t){return e.isBlock=Jo(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=FE(e),e.flankingWhitespace=AE(e,t),e}function FE(e){return!Rm(e)&&!pE(e)&&/^\s*$/i.test(e.textContent)&&!hE(e)&&!gE(e)}function AE(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=BE(e.textContent);return n.leadingAscii&&qc("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&qc("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function BE(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 qc(e,t,n){var r,a,i;return e==="left"?(r=t.previousSibling,a=/ $/):(r=t.nextSibling,a=/^ /),r&&(r.nodeType===3?i=a.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!Jo(r)&&(i=a.test(r.textContent))),i}var TE=Array.prototype.reduce,SE=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Gr(e){if(!(this instanceof Gr))return new Gr(e);var t={rules:dt,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 qm(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])}qm.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=us(this.array,e,this.options))||(t=us(this._keep,e,this.options))||(t=us(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 us(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(bE(a,t,n))return a}}function bE(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 yE(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(m){return m.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=zc(o,t,a);l!==t;){if(l.nodeType===3||l.nodeType===4){var u=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!s&&u[0]===" "&&(u=u.substr(1)),!u){l=ls(l);continue}l.data=u,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,s=!1):r(l)||a(l)?(i=null,s=!0):i&&(s=!1);else{l=ls(l);continue}var d=zc(o,l,a);o=l,l=d}i&&(i.data=i.data.replace(/ $/,""),i.data||ls(i))}}function ls(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function zc(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var eu=typeof window<"u"?window:{};function xE(){var e=eu.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function CE(){var e=function(){};return wE()?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 wE(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{eu.ActiveXObject&&(e=!0)}return e}var DE=xE()?eu.DOMParser:CE();function EE(e,t){var n;if(typeof e=="string"){var r=_E().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return yE({element:n,isBlock:Jo,isVoid:$m,isPre:t.preformattedCode?kE:null}),n}var cs;function _E(){return cs=cs||new DE,cs}function kE(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function FE(e,t){return e.isBlock=Jo(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=AE(e),e.flankingWhitespace=BE(e,t),e}function AE(e){return!$m(e)&&!gE(e)&&/^\s*$/i.test(e.textContent)&&!pE(e)&&!vE(e)}function BE(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=TE(e.textContent);return n.leadingAscii&&qc("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&qc("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function TE(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 qc(e,t,n){var r,a,i;return e==="left"?(r=t.previousSibling,a=/ $/):(r=t.nextSibling,a=/^ /),r&&(r.nodeType===3?i=a.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!Jo(r)&&(i=a.test(r.textContent))),i}var SE=Array.prototype.reduce,jE=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Gr(e){if(!(this instanceof Gr))return new Gr(e);var t={rules:dt,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
 
@@ -158,8 +158,8 @@ ${p}${m?"1.":"-"} ${u}${h?`
158
158
 
159
159
  `+n+`
160
160
 
161
- `:n}};this.options=cE({},t,e),this.rules=new zm(this.options)}Gr.prototype={turndown:function(e){if(!PE(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=qm.call(this,new DE(e,this.options));return jE.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 SE.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function qm(e){var t=this;return TE.call(e.childNodes,function(n,r){r=new kE(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=OE.call(t,r)),Um(n,a)},"")}function jE(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=Um(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function OE(e){var t=this.rules.forNode(e),n=qm.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 Um(e,t){var n=fE(e),r=dE(t),a=Math.max(e.length-n.length,t.length-r.length),i=`
161
+ `:n}};this.options=dE({},t,e),this.rules=new qm(this.options)}Gr.prototype={turndown:function(e){if(!ME(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=Um.call(this,new EE(e,this.options));return OE.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 jE.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function Um(e){var t=this;return SE.call(e.childNodes,function(n,r){r=new FE(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=PE.call(t,r)),Wm(n,a)},"")}function OE(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=Wm(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function PE(e){var t=this.rules.forNode(e),n=Um.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 Wm(e,t){var n=mE(e),r=fE(t),a=Math.max(e.length-n.length,t.length-r.length),i=`
162
162
 
163
- `.substring(0,a);return n+i+r}function PE(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var ME={isHistory(e){return st(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))}},ds=new WeakMap,fs=new WeakMap,nr={isHistoryEditor(e){return ME.isHistory(e.history)&&x.isEditor(e)},isMerging(e){return fs.get(e)},isSaving(e){return ds.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=nr.isMerging(e);fs.set(e,!1),t(),fs.set(e,n)},withoutSaving(e,t){var n=nr.isSaving(e);ds.set(e,!1),t(),ds.set(e,n)}},NE=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&ee.setSelection(t,i.selectionBefore),nr.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{for(var s of i.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:r}=t,{undos:a}=r;if(a.length>0){var i=a[a.length-1];nr.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{var s=i.operations.map(vn.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&ee.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=nr.isSaving(t),d=nr.isMerging(t);if(u==null&&(u=RE(r)),u){if(d==null&&(o==null?d=!1:a.length!==0?d=!0:d=IE(r,l)),o&&d)o.operations.push(r);else{var m={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",m)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},IE=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&I.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&I.equals(e.path,t.path)),RE=(e,t)=>e.type!=="set_selection";const $E=(e,t)=>{const{apply:n}=e;try{e.apply=r=>{if(r.type==="remove_node"&&"type"in r.node&&r.node.type===H.link){const a=r.node;if(a.link){const i=new CustomEvent("linkRemoved",{detail:{url:a.link}});window.dispatchEvent(i)}}n(r)}}catch(r){const a=r.message;t(`Error in withLinkRemovalListener: ${a}`)}return e};var LE=WE,zE=/^(?:\w+:)?\/\/(\S+)$/,qE=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,UE=/^[^\s\.]+\.\S{2,}$/;function WE(e){if(typeof e!="string")return!1;var t=e.match(zE);if(!t)return!1;var n=t[1];return n?!!(qE.test(n)||UE.test(n)):!1}const VE=Rn(LE),HE=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[H.link].includes(s.type)||a(i)},e.insertText=i=>{i&&VE(i)?Qo(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},KE=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===H.mention?!0:n(i),e.isVoid=i=>i.type===H.mention?!0:r(i),e.markableVoid=i=>i.type===H.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},ZE=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===H.link&&le.string(r).trim()===""){ee.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const tu=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,styling:l,...u})=>{const d=ae.useIntl(),m=jh();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=a||{},{listMembers:p,clickMentionFallback:g,onChange:f=()=>{},onChangeData:b=()=>{},getLinkPreview:v=()=>Promise.resolve({}),onMention:C=()=>{},reportError:D=S=>{console.error(S)}}=i||{},A=[{type:H.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const E={editorKey:null,originalValue:t||"",initialValue:t?null:A,tabbableOption:ti[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1,enrichedUrl:!1},[k,T]=y.useReducer(Jr,E),{editorKey:$,originalValue:P,initialValue:z,stringValue:L,lastAnchor:B,lastKey:F,hasInteracted:j,hasLoaded:O,enrichedUrl:q,mentionPopover:W}=k,ne=S=>{S&&T([{type:"tabbableOption",value:S||ti[0]}])},J=async S=>{const R=await v(S);R.url&&T([{type:"enrichedUrl",value:R}])},w=`rte-${e}`,Q=y.useCallback(S=>c.jsx(Bv,{...S}),[]),se=y.useCallback(S=>c.jsx(Tv,{...S}),[]),_=y.useMemo(()=>$E(HE(KE(ZE(NE(gC(yx())),D),D),w,D),D),[]),M=S=>{if(!_||S!==w)return;const R=x.end(_,[]);ee.select(_,R),te.focus(_)};y.useEffect(()=>{const S=R=>{var re;const K=R,Z=((re=K==null?void 0:K.detail)==null?void 0:re.id)||null;Z&&M(Z)};return window.addEventListener("focusEditor",S),()=>{window.removeEventListener("focusEditor",S)}},[]),y.useEffect(()=>{if(_.children.length>0&&!O){if(T([{type:"hasLoaded",value:!0}]),!s)return;M(w)}},[_.children.length,z]),y.useEffect(()=>{P&&(async()=>{let R=Ot(P);if(R.includes("<")){Gr.prototype.escape=Z=>Z;const K=new Gr;K.addRule("br",{filter:["br"],replacement:Z=>Z+`
163
+ `.substring(0,a);return n+i+r}function ME(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var NE={isHistory(e){return st(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))}},ds=new WeakMap,fs=new WeakMap,nr={isHistoryEditor(e){return NE.isHistory(e.history)&&x.isEditor(e)},isMerging(e){return fs.get(e)},isSaving(e){return ds.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=nr.isMerging(e);fs.set(e,!1),t(),fs.set(e,n)},withoutSaving(e,t){var n=nr.isSaving(e);ds.set(e,!1),t(),ds.set(e,n)}},IE=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&ee.setSelection(t,i.selectionBefore),nr.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{for(var s of i.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:r}=t,{undos:a}=r;if(a.length>0){var i=a[a.length-1];nr.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{var s=i.operations.map(vn.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&ee.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=nr.isSaving(t),d=nr.isMerging(t);if(u==null&&(u=$E(r)),u){if(d==null&&(o==null?d=!1:a.length!==0?d=!0:d=RE(r,l)),o&&d)o.operations.push(r);else{var m={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",m)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},RE=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&I.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&I.equals(e.path,t.path)),$E=(e,t)=>e.type!=="set_selection";const LE=(e,t)=>{const{apply:n}=e;try{e.apply=r=>{if(r.type==="remove_node"&&"type"in r.node&&r.node.type===H.link){const a=r.node;if(a.link){const i=new CustomEvent("linkRemoved",{detail:{url:a.link}});window.dispatchEvent(i)}}n(r)}}catch(r){const a=r.message;t(`Error in withLinkRemovalListener: ${a}`)}return e};var zE=VE,qE=/^(?:\w+:)?\/\/(\S+)$/,UE=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,WE=/^[^\s\.]+\.\S{2,}$/;function VE(e){if(typeof e!="string")return!1;var t=e.match(qE);if(!t)return!1;var n=t[1];return n?!!(UE.test(n)||WE.test(n)):!1}const HE=Rn(zE),KE=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[H.link].includes(s.type)||a(i)},e.insertText=i=>{i&&HE(i)?Qo(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},ZE=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===H.mention?!0:n(i),e.isVoid=i=>i.type===H.mention?!0:r(i),e.markableVoid=i=>i.type===H.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},YE=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===H.link&&le.string(r).trim()===""){ee.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const tu=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,styling:l,...u})=>{const d=ae.useIntl(),m=Oh();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=a||{},{listMembers:p,clickMentionFallback:g,onChange:f=()=>{},onChangeData:b=()=>{},getLinkPreview:v=()=>Promise.resolve({}),onMention:C=()=>{},reportError:D=S=>{console.error(S)}}=i||{},A=[{type:H.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const E={editorKey:null,originalValue:t||"",initialValue:t?null:A,tabbableOption:ti[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1,enrichedUrl:!1},[k,T]=y.useReducer(Jr,E),{editorKey:$,originalValue:P,initialValue:z,stringValue:L,lastAnchor:B,lastKey:F,hasInteracted:j,hasLoaded:O,enrichedUrl:q,mentionPopover:W}=k,ne=S=>{S&&T([{type:"tabbableOption",value:S||ti[0]}])},J=async S=>{const R=await v(S);R.url&&T([{type:"enrichedUrl",value:R}])},w=`rte-${e}`,Q=y.useCallback(S=>c.jsx(Tv,{...S}),[]),se=y.useCallback(S=>c.jsx(Sv,{...S}),[]),_=y.useMemo(()=>LE(KE(ZE(YE(IE(vC(xx())),D),D),w,D),D),[]),M=S=>{if(!_||S!==w)return;const R=x.end(_,[]);ee.select(_,R),te.focus(_)};y.useEffect(()=>{const S=R=>{var re;const K=R,Z=((re=K==null?void 0:K.detail)==null?void 0:re.id)||null;Z&&M(Z)};return window.addEventListener("focusEditor",S),()=>{window.removeEventListener("focusEditor",S)}},[]),y.useEffect(()=>{if(_.children.length>0&&!O){if(T([{type:"hasLoaded",value:!0}]),!s)return;M(w)}},[_.children.length,z]),y.useEffect(()=>{P&&(async()=>{let R=Ot(P);if(R.includes("<")){Gr.prototype.escape=Z=>Z;const K=new Gr;K.addRule("br",{filter:["br"],replacement:Z=>Z+`
164
164
 
165
- `}),R=K.turndown(R)}o&&o.mentions&&(R=await hd({text:R,template:`[${Ys}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),HD(R,K=>{const Z=[{type:"initialValue",value:K},{type:"editorKey",value:P.toString()}];o!=null&&o.link&&(Z.push({type:"enrichedUrl",value:o.link}),o.link.url&&J(o.link.url)),T(Z),setTimeout(()=>{T([{type:"stringValue",value:Mc(_)}])},150)})})()},[P]),y.useEffect(()=>{if(q===void 0&&_){const R=YD(_);R&&J(R)}const S=R=>{var re;const K=R,Z=((re=K==null?void 0:K.detail)==null?void 0:re.url)||null;Z&&q&&q.url===Z&&T([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",S),()=>{window.removeEventListener("linkRemoved",S)}},[q]),y.useEffect(()=>{if(t){zr.lastIndex=0;const S=t.match(zr);S&&S.length===1&&S[0].length===t.length&&!j&&T([{type:"originalValue",value:t}])}t!==""||!_||Ra(P,t)&&!j||(x.withoutNormalizing(_,()=>{ee.delete(_,{at:{anchor:x.start(_,[]),focus:x.end(_,[])}}),ee.deselect(_),_.children.length!==0&&ee.unwrapNodes(_,{at:[0]}),ee.insertNodes(_,A,{at:[0]})}),T([{type:"initialValue",value:A},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),y.useEffect(()=>{b({link:q})},[q]),y.useEffect(()=>{L===""&&q&&T([{type:"enrichedUrl",value:void 0}])},[L]);const U=nd(()=>{QD({editor:_,isShowing:W.show,numberOfUsers:W.numberOfUsers,listMembers:p,dispatch:T})},100);return z?c.jsx("div",{id:w,className:"rich-text-editor",children:c.jsxs(cn.Provider,{value:{...k,id:w,isInOverlay:h,setFocus:ne,dispatch:T,getLinkPreview:v,onMention:C,reportError:D},children:[c.jsxs(hC,{editor:_,initialValue:z,onChange:S=>{if(_.operations.some(K=>K.type!=="set_selection")){let K=XD(S);K==="<br>"&&(K=""),f(K,q),T([{type:"stringValue",value:Mc(_)}]),j||T([{type:"hasInteracted",value:!0}]),U(),m&&console.log({serialized:K,json:S})}},...u,children:[c.jsx(iC,{className:"input",renderElement:Q,renderLeaf:se,placeholder:n||d.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async S=>{const R=q!==!1,K=S.clipboardData.getData("text");if((re=>{try{return new URL(re),!0}catch{return!1}})(K)){let re=K;if(K){const{full:ce}=uo(K);re=ce}if(K&&v&&!R){const ce=await v(re);ce.url&&T([{type:"enrichedUrl",value:ce}])}}},onKeyDown:S=>{if(S.key==="Enter"){W.show&&(S.preventDefault(),S.stopPropagation(),Bm(_,W,T,w));const{selection:R}=_;if(R){const K=G.isCollapsed(R),[Z,re]=x.node(_,R,{depth:1});let ce=Z,X=ce.type;const pe=ce.children[0];if(pe&&(pe==null?void 0:pe[H.h3])===!0&&(S.stopPropagation(),S.preventDefault(),ee.insertNodes(_,A)),pe&&[H.ol,H.ul].includes(pe.type)&&(ce=pe,X=pe.type),ce&&fe.isElement(ce)&&X!==H.paragraph){if(X===H.blockquote&&!S.shiftKey){S.stopPropagation(),S.preventDefault(),ee.insertNodes(_,A);return}if(K){const[ve,ye]=x.parent(_,R,{edge:"end"}),je=ve.type;if([H.ul,H.ol].includes(X))if(S.stopPropagation(),S.preventDefault(),je===H.li&&F==="Enter"){ve.children.length===1&&"text"in ve.children[0]&&ve.children[0].text===""&&ee.removeNodes(_,{at:ye}),ee.insertNodes(_,A,{at:I.next(re)}),ee.select(_,x.end(_,I.next(re)));return}else{const[Je,Ue]=KD(_,H.li),Le={type:H.li,children:[{text:""}]};ee.insertNodes(_,Le,{at:I.next(Ue)}),ee.select(_,x.end(_,I.next(Ue)))}}}}}else if(S.key==="Escape"){if(W.show){S.preventDefault(),S.stopPropagation(),T([{type:"mentionPopover",value:{...W,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(S.key)&&W.show){S.preventDefault(),S.stopPropagation();const{selectedUser:R,possibleUsers:K}=W;let Z=S.key==="ArrowUp"?R-1:R+1;Z<0&&(Z=K.length-1),Z>=K.length+1&&(Z=0),T([{type:"mentionPopover",value:{...W,selectedUser:Z}}])}T([{type:"lastKey",value:S.key}]),GD(S,_,T,D)},onBlur:()=>{_.selection&&T([{type:"lastAnchor",value:_.selection.anchor}])},onFocus:()=>{if(B){if(!I.isPath(B.path)||!le.has(_,B.path))return;const S=le.get(_,B.path);let R=0;if(he.isText(S)?R=S.text.length:S.children&&(R=S.children.length),B.offset>R)return;try{ee.select(_,{anchor:B,focus:B})}catch(K){const Z=K.message;D(`Error focusing editor: ${Z}`)}}}}),q?c.jsx(_o,{data:q,variant:"condensed",onClick:()=>{T([{type:"enrichedUrl",value:!1}]);const S=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(S)},"aria-label":d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:q.title||d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(lE,{styling:l==null?void 0:l.toolbar}),p?c.jsx(eE,{onFallbackClick:g}):c.jsx(c.Fragment,{})]},$),c.jsx(Fo,{id:`character-limit-${e}`,limit:r,valueLength:mi(L)})]})}):c.jsx(c.Fragment,{})};const YE=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:V("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:V("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const m=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:m,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:m,children:d.label})]},m)})})]})};function Wm({className:e="",userId:t,userName:n,src:r,uploadImage:a,button:i,callback:s}){const o=ae.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[m,h]=y.useState(!1),[p,g]=y.useState(!1),f=y.useRef(null),b=async A=>{h(!0),g(!1);try{const E=A.target.files&&A.target.files[0];if(!E||!t)throw h(!1),new Error("Image file or userID is missing");const k=await a({fileObject:E,userId:t}),T={thumbnail:k.thumbnailURL,full:k.originalURL};d(T),s(T)}catch{g(!0)}finally{h(!1)}h(!1)},{upload:v=o.formatMessage({id:`${l}cta_upload`}),change:C=o.formatMessage({id:`${l}cta_change`}),uploading:D=o.formatMessage({id:`${l}cta_uploading`})}=(i==null?void 0:i.text)||{};return c.jsxs("div",{className:V("profile-image-change-figure",e),children:[c.jsx(un,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),p&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(Ee,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:m,children:m?D:u?C:v})]})}const Vm=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(Jt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n},button:{className:"new"}})};const GE=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=ae.useIntl();return c.jsx(yh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:a=>{t(a),n(!a.length)},autoFocus:!1,getLabel:(a,i,s)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:a}),c.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(i),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},i)})},Hm=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:a,labelColor:i,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:d="NOT_SUBMITTED"})=>{const[m,h]=y.useState([]),[p,g]=y.useState(!0),[f,b]=y.useState(d),{formatMessage:v}=ae.useIntl(),C=async E=>{try{await u(m,E.message),h([]),b("SUCCESS")}catch(k){b("ERROR"),l(k)}},D=E=>{E.preventDefault(),b("NOT_SUBMITTED"),g(!0),h([])},A=E=>{E.preventDefault(),o(),b("CLOSED")};return f==="CLOSED"?null:f==="ERROR"||f==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:f==="SUCCESS"?c.jsx("h2",{className:"success-title",children:v({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",v({id:"inviteForm_error"})]})}),c.jsx(zt,{}),c.jsx("div",{className:"footer",children:f==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"secondary",onClick:D,children:v({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Ee,{onClick:A,children:v({id:"inviteForm_ctaDone"})})]}):c.jsx(Ee,{onClick:D,children:v({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:a},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:i},children:t})]}),c.jsx(Jt,{id:"invite-form",fields:[{component:GE,props:{emails:m,setEmails:h,setIsDisabled:g},required:!0},{id:"message",type:"textarea",label:v({id:"inviteForm_message_label"}),placeholder:n||v({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:C},button:{text:r,size:"medium",disabled:p}})]})},Ia=e=>e.map(t=>({condition:t})),Tt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},QE=({functions:e,...t})=>{const{formatMessage:n}=ae.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[Tt.NEW_PASSWORD]!==p[Tt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=p=>!Fs(p[Tt.NEW_PASSWORD]).isValid,m=[{"data-testid":Tt.NEW_PASSWORD,id:Tt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Ia(["required",d]),functions:{onChange:p=>l(Fs(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Tt.CONFIRMED_PASSWORD,id:Tt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Ia(["required",u])}];t.isPasswordChange&&m.unshift({"data-testid":Tt.CURRENT_PASSWORD,id:Tt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Ia(["required"])}),i&&m.push({component:xf,props:{matchingRules:o}});const h={id:Tt.FORM_ID,fields:m,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>a(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(Tt.NEW_PASSWORD)||g.includes(Tt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Jt,{...h}),r&&c.jsx(Cn,{variant:"error",text:r})]})};const Km=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:a,...i})=>{var $;const s=ae.useIntl(),o="profileForm_",l=y.useContext(it),[u,d]=y.useState(l.image),[m,h]=y.useState(!1),{uploadImage:p=()=>{},onSuccess:g=async P=>{},onCancel:f=()=>{},onFailure:b=()=>{}}=n,{buildLocation:v,isValidPlace:C,predictPlaces:D}=t.useMaps(),{context:A="ProfileForm",event:E="profile-form-submit-click"}=a||{},k=[{id:"jobTitle",type:"text",label:s.formatMessage({id:`${o}jobTitle`}),placeholder:s.formatMessage({id:`${o}jobTitle_placeholder`}),value:l.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:s.formatMessage({id:`${o}organization`}),placeholder:s.formatMessage({id:`${o}organization_placeholder`}),value:l.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:s.formatMessage({id:`${o}location`}),placeholder:s.formatMessage({id:`${o}location_placeholder`}),value:($=l.location)==null?void 0:$.en,validation:[{condition:"required"},{condition:({location:P})=>P&&!m?!1:!C(P),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{m||h(!0)},onKeyInput:D}}],T=[{component:Wm,props:{userName:l.name,userId:l.id,src:u,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:l.name,autoComplete:"name",validation:[{condition:"required"}]},...k,{id:"biography",type:"textarea",label:s.formatMessage({id:`${o}bio`}),placeholder:s.formatMessage({id:`${o}bio_placeholder`}),limit:1e3,value:l.biography},{component:zt}];return c.jsx(Jt,{id:"profile-details-form",fields:e?k:T,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:A,event:E},functions:{onSuccess:async P=>{try{const z={...P,image:u||null,location:m?await v(P==null?void 0:P.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails(L=>({...L,...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`})}},...i})},JE=()=>{const e=ae.useIntl(),[t,n]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>{n(a=>{if(a>=95)return clearInterval(r),95;const i=Math.round(Math.random()*10);return Math.min(a+i,95)})},800);return()=>{clearInterval(r)}},[]),c.jsx(Od,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};let ms=null;const lt="publishArticleForm_",Uc={},Wc=10,XE=({id:e="publish-article-form",values:t=Uc,functions:n,meta:r,gtm:a})=>{const i=ae.useIntl(),s=y.useContext(it),{create:o,onSuccess:l=()=>{},onFailure:u=()=>{}}=n||{},{isInOverlay:d=!1}=r||{},[m,h]=y.useState(!1),[p,g]=y.useState(t.body||""),[f,b]=y.useState(!1),[v,C]=y.useState("");y.useEffect(()=>{Ra(t,Uc)||La(t.body)&&t.body!==p&&t.body!==void 0&&g(t.body)},[t.body]);const D=()=>{!s||!s.id?b(i.formatMessage({id:`${lt}error_loggedOut`})):f&&b(!1)},A=$=>({condition:P=>{const z=P[$];return!z||typeof z!="string"?!0:z.length<Wc},error:i.formatMessage({id:`${lt}error_underMinLength`},{length:Wc})}),E=!!p&&La(p),k=()=>c.jsxs(c.Fragment,{children:[c.jsx(zt,{}),c.jsx("p",{className:"text-medium",children:i.formatMessage({id:`${lt}disclaimer`})})]}),T=[{id:"title",type:"text",value:t.title||"",limit:65,label:i.formatMessage({id:`${lt}title_label`}),placeholder:i.formatMessage({id:`${lt}title_placeholder`}),functions:{onChange:D},validation:[{condition:"required"},A("title")]},{id:"subtitle",type:"text",value:t.subtitle,limit:115,label:i.formatMessage({id:`${lt}subtitle_label`}),placeholder:i.formatMessage({id:`${lt}subtitle_placeholder`}),functions:{onChange:D},validation:[{condition:"required"},A("subtitle")]},{component:Yo,props:{formID:e,label:{visible:i.formatMessage({id:`${lt}body_label`})},showLabel:!0}},{component:tu,props:{id:`${e}-input`,value:p,placeholder:i.formatMessage({id:`${lt}body_placeholder`}),meta:{isInOverlay:d},autoFocus:!1,functions:{onChange:$=>{g($),D()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!f,"aria-errormessage":"error-message"}}];return m?T.push({component:zt}):T.push({component:k}),c.jsxs("section",{className:"publish-article-form",children:[c.jsx(Jt,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1},functions:{onSuccess:async $=>{if(!s||!s.id||!E)return;ms&&clearTimeout(ms),h(!0);const P={...$,body:p};try{o&&await o(P),ms=setTimeout(()=>{C(i.formatMessage({id:`${lt}aria_success`})),l(P)},500)}catch{b(i.formatMessage({id:`${lt}error`})),C(""),u()}},onFailure:u},fields:T,intlPath:lt,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:!s||!s.id||!E,text:{default:i.formatMessage({id:`${lt}cta_submit`}),submitting:i.formatMessage({id:`${lt}cta_submitting`}),submitted:i.formatMessage({id:`${lt}cta_submitted`})},customOnSubmit:f?c.jsx(c.Fragment,{}):c.jsx(JE,{})},gtm:a}),f&&c.jsx(ur,{id:"error-message",className:"error",children:typeof f=="string"&&f.includes(" ")?f:i.formatMessage({id:`${lt}error`})}),v&&c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,children:v})]})};const Zm=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=ae.useIntl(),u=y.useRef(null);or(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=m=>{m.preventDefault(),m.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:V("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Pe,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:m=>{m.key==="Enter"&&d(m)}}),c.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Pe,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Pe,{children:l.formatMessage({id:"search_cta"})})})]})})})},Vc=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},e_=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"]}},t_=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:a,state:i})=>{if(!e.form||!e.form.current)throw new Error("No refs.form");if(!e.form.current.checkValidity()){e.hiddenValidation&&e.hiddenValidation.current&&e.hiddenValidation.current.click();return}const s=e_(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...i.values}),a([{type:"showSuccessMessage",value:!0}])},n_=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,m=(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:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>m(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Vc({ref:i.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:hf,props:{email:d.email,type:d.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(h.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>m(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{m(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&h.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>c.jsx("small",{children:p})}),placeholder:u.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)||u.formatMessage({id:"signup_expectation"},{small:p=>c.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),h.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.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]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Vc({ref:i.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:V("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ae.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ae.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const a_={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},i_=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ae.useIntl(),{title:u=!0,expectation:d=!1,url:m=!0,logInButton:h=!0,successMessage:p=!0}=a,g={title:u,expectation:d,url:m,logInButton:h,successMessage:p},[f,b]=y.useReducer(Jr,a_),{validFields:v,emailDetails:C,shouldManuallyApprove:D,shouldDisableButton:A,showSuccessMessage:E,showError:k}=f,[T,$]=ao.useCookies(["signup-this-session","functional-cookie-consent"]),P={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{D===!0&&P.jobTitle.current&&P.jobTitle.current.focus()},[D]),y.useEffect(()=>{T["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[T]),y.useEffect(()=>{E&&T["functional-cookie-consent"]&&$("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const z=y.useMemo(()=>n_({placeholders:n,labels:t,shouldShow:g,functions:r,refs:P,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,P,g,f]),L=A?!0:D?!Object.values(v).every(B=>B===!0):!v.name||!v.email||["exists","pending","verify"].includes(C.boxType);return g.successMessage&&E?c.jsx(r_,{className:e}):c.jsxs("fieldset",{className:V("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ae.FormattedMessage,{id:"signup_title"})}),k&&c.jsx(Cn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Jt,{className:"signup-form",formRef:P.form,id:"sign-up-form",fields:z,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:L?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:`/api/next-ui/login?returnTo=${window.location.pathname}`,"data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await t_({refs:P,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:B=>{r.handleError(B),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:P.hiddenValidation})]})};const En=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default",padding:i="none"}=n;return c.jsx("section",{className:V("full-width-section",t,{[a]:a!=="default",[i]:i!=="none"}),...r,children:e})};const s_=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable new","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),c.jsx(En,{className:V("download-section",n),styling:{background:"dark"},children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(pr,{buttons:r})]})})};const ro="editSection_";function Ym({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const o_=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ae.useIntl();return c.jsxs(_t,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${ro}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(Ee,{href:r,variant:"secondary",size:"small",onClick:()=>Ym({href:r,setShowModal:i}),children:n||s({id:`${ro}placeholder_cta`})})})]})},u_=({children:e,className:t="",formProps:n,formComponent:r,href:a,title:i,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=ae.useIntl(),[m,h]=y.useState(!1),p=()=>h(!1),g=!!n||!!r,f=typeof a=="string"||g;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{p()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),p()}}})),c.jsxs("section",{className:V("edit-section",t),children:[g&&c.jsx(ln,{title:o||`Edit ${i}`,isOpen:m,showDivider:!1,showIcon:!1,functions:{onClose:p},className:V("edit-section-modal"),children:b||(n?c.jsx(Jt,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async v=>{var C,D;(C=n==null?void 0:n.functions)!=null&&C.onSuccess&&await((D=n==null?void 0:n.functions)==null?void 0:D.onSuccess(v)),h(!1)},onCancel:p}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:V("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:i}),f&&c.jsx(Ee,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Ym({href:a,setShowModal:h}),children:d({id:`${ro}edit`})})]}),e||c.jsx(o_,{...l,href:a,setShowModal:h,showEditButton:f}),u&&c.jsx(zt,{})]})};const l_=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:V("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:V("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:V({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%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 hs;const ps="contactFooter_",c_=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,a]=y.useState(0),[i,s]=y.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(hs),hs=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(hs),window.removeEventListener("resize",l)}),[]),c.jsx(En,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ae.FormattedMessage,{id:`${ps}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(ae.FormattedMessage,{id:`${ps}text`})}),c.jsx(xn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ae.FormattedMessage,{id:`${ps}email`})})]}),c.jsx(Vm,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},d_=({activeLink:e,profile:t,...n})=>c.jsx(En,{children:c.jsx(ff,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(df,{activeLink:e,profile:t}),c.jsx(Cd,{...n})]})})});const gs="cookieBanner_",vs=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],bs=new Date(Date.now()+12*30*24*60*60*1e3),Gm=()=>{const e=ae.useIntl(),[t,n,r]=ao.useCookies(vs),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{vs.forEach(d=>{n(d,!0,{path:"/",expires:bs,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:bs}),vs.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:bs});return}r(d)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${gs}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${gs}title`})}),c.jsx("p",{children:e.formatMessage({id:`${gs}text`})}),c.jsx(pr,{buttons:u})]})},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:["correspondence","registered","berlin","support","business"],correspondence:{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_",ri="SiteFooter",Hc=({group:e})=>{const t=nn[e].order||[];let n=!1;return"text"in nn[e]&&(n=nn[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ae.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:a,gtmType:i}=nn[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":ri,"data-gtm-event-type":i,...s,children:c.jsx(ae.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(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(ae.FormattedMessage,{id:`${rr}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ae.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":ri,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},nu=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(oi,{element:"hr"}),c.jsx(ko,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":ri,"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(Hc,{group:e}),Object.keys(nn[e]).includes("child")&&c.jsx(Hc,{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":ri,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ae.FormattedMessage,{id:`${rr}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ae.FormattedMessage,{id:`${rr}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),qe={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e===Et.ACCOUNT&&t===!1&&n[Et.SITE]===!0)return;const i=Date.now();if(!a&&!t&&qe.handlerCalled[e]&&i-qe.handlerCalled[e]<500)return;qe.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case 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 a=Qc(e[r],t);if(!(typeof a>"u")&&(!n||a[t]&&a[t].includes(n)||a.value&&a.value.includes(n)||a.toString().includes(n)))return e[r]}return e[0].children?qe.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case Et.SITE:if(n){const u=qe.findFirstChild(t.current.children,"className","has-submenu parent"),d=qe.findFirstChild(u.children,"id",Et.SITE);s=qe.findFirstChild(d.children,"href")}else s=qe.findFirstChild(t.current.children,"href");break;case Et.ACCOUNT:if(o=qe.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=qe.findFirstChild(o.children,"href");break;default:return}s&&(a([{type:`focusElements.${e}.${i}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(qe.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(qe.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(qe.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{qe.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Qr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/api/next-ui/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},ai=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ae.useIntl(),o=Qc(Qr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,d=e.includes("buttons.");let m=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(m+=`_logged${t?"In":"Out"}`);let h=!1;if(o.href){let D=o.gtmType||`${e}-click`;if(D.includes(".")){const A=D.split("."),E=A[A.length-2];D=`${E==="topics"?`${E}-`:""}${A[A.length-1]}`}h={href:o.withReturnTo?`${o.href}?returnTo=${window.location.pathname}`:o.href},u&&(h={...h,className:"gtm-trackable","data-gtm-event-type":D,"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={},C={};if(f&&(b={...b,"aria-current":"page"}),p){const D=o.menuId||e,A={onClick:E=>qe.events.onClick(E,{id:D,callback:a,isOpen:r[D]}),onFocus:()=>qe.events.onFocus({id:D}),onBlur:()=>qe.events.onBlur({id:D,callback:a}),onMouseLeave:()=>qe.events.onBlur({id:D,callback:a}),onMouseEnter:()=>qe.events.onMouseEnter({id:D,callback:a})};v={...A,id:D===Et.SITE?Et.SITE:Et.ACCOUNT},n&&(g&&(C={...A,className:"navigation-button",onKeyPress:E=>{E.key==="Enter"&&qe.events.onClick(E,{id:D,callback:a,isOpen:r[D]})},"aria-haspopup":!0,"aria-expanded":r[D],"aria-controls":D}),v={...v,hidden:D in r?!r[D]:!0}),g||(v={...v})}return c.jsxs("li",{className:V({[o.className]:o.className,"has-submenu":p,parent:g,active:f}),...b,children:[h?y.createElement(d?Ee:"a",h,s.formatMessage({id:m})):n&&o.order&&g?c.jsxs("button",{...C,children:[s.formatMessage({id:m}),c.jsx(Pe,{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(D=>{if(!o[D])return null;const A={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[D].order?c.jsxs("li",{className:V({[o[D].className]:o[D].className}),children:[s.formatMessage({id:`${m}_${D}`}),c.jsx("ul",{children:o[D].order.map(E=>c.jsx(ai,{id:`${e}.${D}.${E}`,...A},E))})]},D):c.jsx(ai,{id:`${e}.${D}`,...A},D)})})]},e)};const f_={height:67,height_desktop:83};var Et=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(Et||{});const ru=({showNavigation:e=!0})=>{const t=ae.useIntl(),n=y.useContext(it),r=$n(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>qe.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(Jr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,m=y.useRef(s);y.useEffect(()=>{m.current=s},[s]),ad({scrollPosition:f_[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const v=m.current.menus;!i&&v["site-navigation"]||qe.shouldChangeHeaderIsVisible(!0,v,o)},scrollDown:()=>{const v=m.current.menus;!i&&v["site-navigation"]||qe.shouldChangeHeaderIsVisible(!1,v,o)}}});const h=(v,C,D=!1)=>{qe.handleMenus({id:v,value:C,menus:m.current.menus,dispatch:o,forceHandle:D})},p=y.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(C=>{m.current.menus[C]&&h(C,!1,!0)})};y.useEffect(()=>{var v;return(v=document.getElementById("header"))==null||v.addEventListener("keydown",g),()=>{var C;(C=document.getElementById("header"))==null||C.removeEventListener("keydown",g)}},[]),or(()=>{u["site-navigation"]&&qe.autoFocus({menu:"site-navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),or(()=>{u["account-navigation"]&&qe.autoFocus({menu:"account-navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),h("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Pe,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(Zm,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:v=>{v.preventDefault(),v.stopPropagation(),h("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Pe,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Qr.order.map(v=>c.jsx(ai,{id:v,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:h},v))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:V({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(Pe,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(ko,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),a?c.jsxs("button",{className:"account-button",onClick:v=>qe.events.onClick(v,{id:"account-navigation",callback:h,isOpen:u["account-navigation"]}),onMouseEnter:()=>qe.events.onMouseEnter({id:"account-navigation",callback:h}),onMouseLeave:()=>qe.events.onBlur({id:"account-navigation",callback:h}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Pe,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(un,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:Qr.buttons.order.map(v=>c.jsx(ai,{id:`buttons.${v}`},v))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:V("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const m_=()=>{const e=ae.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(ru,{}),c.jsx("div",{id:"content",children:c.jsx(Cn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(nu,{})]})},Qm=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:d="default",variant:m="default",circle:h="default",modal:p="default"}=i,g=td(),[f,b]=y.useState(""),v=k=>{const{detail:{message:T}}=k;b(T)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const C=Aa(e,{locale:o}),D=Aa(t,{locale:o}),A=Aa(n,{locale:o}),E={};return d!=="default"&&(E[d]=!0),m!=="default"&&(E[m]=!0),h!=="default"&&(E[h]=!0),c.jsx(bh.ErrorBoundary,{onError:r,fallback:c.jsx(m_,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:V(s,E,{"has-footer":u}),children:[c.jsx(ru,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[D&&c.jsx("div",{className:V("additional-content prepended",{"large-modal":p==="large"}),children:D}),y.createElement(d==="bold"?po:"div",{id:"content",children:C,className:V({"large-modal":p==="large"})})]}),A&&c.jsx("div",{className:"additional-content appended",children:A}),u&&c.jsx(nu,{}),c.jsx(Gm,{})]}),f&&c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Kc={default:"tags_",headerTopics:"header_topics_topics_"},ys={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"},h_={getTagDetails:e=>{if(e.includes("topic_")){if(e=ys.topic[e.replace("topic_","")],e){const t=Qr.topics.topics[e].href;return t?{id:e,href:t,text:`${Kc.headerTopics}${e}`}:null}return null}return ys[e]?(e=ys[e],{id:e,text:`${Kc.default}${e}`}):null}};const p_=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ae.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=h_.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:V("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:d}):d},u.id)})})};const Jm=25,g_=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:a=!1,loadNextPage:i=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:d=!1,className:m=""})=>{const h=ae.useIntl(),p="membersList",g=y.useContext(it),[f,b]=y.useState(!1);return e.length===0&&!d?null:c.jsxs("div",{className:V("members-list",m),children:[u?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:l,badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:n||""},{scope:ct.Platform,area:"all"}]}}),c.jsx(xn,{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,C)=>c.jsxs("li",{children:[c.jsx(an,{member:v,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:n||""},{scope:ct.Platform,area:"all"}]}}),v.isAdmin&&c.jsx(Yt,{children:h.formatMessage({id:`${p}_admin`})})]},C)),d&&e.length===0&&t>0?[...new Array(Math.min(t,Jm))].map((v,C)=>c.jsx("li",{children:c.jsx(di,{layout:"member"})},C)):c.jsx(c.Fragment,{})]}),a&&c.jsx(Xr,{hasNextPage:a,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(wi,{form:s,showModal:f,content:{title:h.formatMessage({id:`${p}_modal_title`})},functions:{onClose:()=>{b(!1)}}}):c.jsx(c.Fragment,{})]})},Xm=g_,v_=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ae.useIntl();return t?c.jsx("small",{children:Rt(a.formatMessage,`${e}explainer`,n,"action",{a:i=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):c.jsx(c.Fragment,{})},b_=({intlPath:e,type:t,...n})=>{const r=ae.useIntl();return c.jsx(Yo,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:Rt(r.formatMessage,`${e}label_action`,t,"action")},...n})},Zc=5,y_=2,x_=e=>{var r;let t=0;const n=[];return(r=e==null?void 0:e["poll-options"])==null||r.forEach((a,i)=>{a!==""&&(t++,n.push({position:t,description:{en:a}}))}),{title:{en:e.title},options:n,settings:{allow_multiple_votes:e["multiple-answers"]||!1}}};let wa=null;const Ge="discussion_form_",ta=({id:e,parentId:t,content:n={type:Ae.Response,slugs:{}},userHasPermissions:r=!0,meta:a,placeholder:i,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},functions:u,data:d={},gtmContext:m="DiscussionForm"})=>{var We,Y,oe;const h=ae.useIntl(),p=y.useContext(it),[g,f]=y.useState(n.type),[b,v]=y.useState(""),{isLoading:C=!1,isInWrapper:D=!1,isInOverlay:A=!1,isAutoFocused:E=!1,isEditing:k=!1,hasTitleField:T=!1,canBePrepopulated:$=!1,isPrepopulated:P=!1,showTitle:z=!1,showGuidelines:L=!0,showDivider:B=!1,showSuccessMessage:F=!0,showPostType:j=!1,postCategories:O=[]}=a||{},{onChange:q=()=>{},create:W=()=>{},createPoll:ne=()=>{},handleSaveEdit:J=()=>{},handleCancel:w=()=>{},callback:Q=()=>{},onMention:se=()=>{},listMembers:_=()=>Promise.resolve([]),clickMentionFallback:M=()=>{},getLinkPreview:U=()=>Promise.resolve({}),props:S={create:{projectNames:["questions-answers"]}}}=u,[R,K]=y.useState({body:k&&k.text||P&&P.text||"",data:d!=null&&d.link?{link:d==null?void 0:d.link}:{}}),[Z,re]=y.useState(l.error||!1),ce={status:!1,title:T&&T.text||"",polls:0},[X,pe]=y.useState(ce);if(y.useEffect(()=>{$&&!k&&P&&P!==R.body&&K(ie=>({...ie,body:P.text||""}))},[P]),y.useEffect(()=>{f(n.type)},[n.type]),C)return c.jsx(Nt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const ve=(ie,me)=>{K(ke=>({...ke,body:ie,data:{link:me}})),q({body:ie});let ge;!p||!p.id?ge=Rt(h.formatMessage,`${Ge}error_loggedOut`,g,"action"):r?s>0&&ie.length>=s&&(ge=`${Ge}error_tooLong`):ge=Rt(h.formatMessage,`${Ge}error_noPermission`,g,"action"),ge?re(ge):Z&&re(!1)};let ye=`${g}-form`;if(g===Ae.Response||g===Ae.Reply){const ie=((We=n.slugs)==null?void 0:We.reply)||((Y=n.slugs)==null?void 0:Y.answer)||((oe=n.slugs)==null?void 0:oe.question)||"";ie&&(ye=`${ye}-${ie.slice(-15)}`)}e&&(ye=`${e}-${ye}`);const Me=async ie=>{if(!p||!p.id||!r||Le)return;wa&&clearTimeout(wa),pe(ge=>({...ge,status:"submitting"}));const me=window.location.pathname;try{let ge;switch(g){case Ae.Post:ge=await W({title:ie.title,content:ie.body,categories:ie.categories,data:ie.data});break;case Ae.Poll:ge=await ne(x_(ie));break;case Ae.Question:ge=await W({title:ie.body,authorId:p&&p.id,data:ie.data,...S==null?void 0:S.create});break;case Ae.Response:ge=await W({questionSlug:n.slugs.question},{body:ie.body,authorId:p&&p.id,contentPath:me,data:ie.data});break;case Ae.Reply:ge=await W({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:ie.body,authorId:p&&p.id,contentPath:me,data:ie.data});break;default:break}await Sh(1e3),Q&&await Q(ge),wa=setTimeout(()=>{K({body:"",data:{}}),f(Ae.Post),pe(ze=>({...ze,status:"submitted"})),v(Rt(h.formatMessage,`${Ge}success`,g,"action"));const ke=new Event(rt.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(ke),je()},500)}catch(ge){const ke=ge;let ze=`${Ge}error`;ke!=null&&ke.message.includes("entry already exists")&&(ze=Rt(h.formatMessage,`${Ge}error_alreadyExists`,g,"action")),ke!=null&&ke.message.includes("429")?ze=Rt(h.formatMessage,`${Ge}error_tooMany`,g,"action"):ke!=null&&ke.message.includes("400")&&(ze=`${Ge}error`),re(ze),je()}},je=()=>{wa=setTimeout(()=>{re(!1),pe(ce),v("")},5e3)},Je=!R.body||!La(R.body),Ue=!X.title||!La(X.title);let Le=!1;g!==Ae.Poll&&(Le=Je),T&&(Le=Le&&Ue);const Xe=X.status==="submitting",_e=[];g===Ae.Poll?_e.push({id:"poll-options",label:h.formatMessage({id:`${Ge}option_label`}),type:"multiple-inputs",element:"textarea",placeholder:h.formatMessage({id:`${Ge}option_placeholder`}),limit:250,multipleInputs:{showCount:!0,maxInputs:Zc,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:h.formatMessage({id:`${Ge}option_cta`})}},styling:{autosizeToFit:!0},functions:{onChange:ie=>{var ge;let me=0;ie&&Array.isArray(ie)&&(me=((ge=ie==null?void 0:ie.filter(ke=>ke!==""))==null?void 0:ge.length)||0),X.polls!==me&&pe(ke=>({...ke,polls:me})),q({polls:ie})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:h.formatMessage({id:`${Ge}multiplePollAnswers`}),className:"text-medium"}):_e.push({component:b_,props:{formID:ye,intlPath:Ge,showLabel:T!==!1,type:g}},{component:tu,props:{id:`${ye}-input`,value:X.status==="submitting"&&!Z?"":R.body,placeholder:i||Rt(h.formatMessage,`${Ge}placeholder`,g,"action"),maxLength:s,meta:{isInOverlay:A},functions:{onChange:ve,onChangeData:ie=>{K(me=>({...me,data:ie}))},onMention:se,listMembers:_,clickMentionFallback:M,getLinkPreview:U},data:d,autoFocus:k!==!1||E&&!T,"aria-invalid":!!Z,"aria-errormessage":"error-message"}},{component:v_,props:{intlPath:Ge,showGuidelines:L,type:g,gtmContext:m}}),B&&_e.push({component:zt}),T&&_e.unshift({id:"title",type:"text",value:T.text,limit:g===Ae.Poll?0:250,label:h.formatMessage({id:`${Ge}${g===Ae.Poll?"question":"titleField"}_label`}),placeholder:h.formatMessage({id:`${Ge}${g===Ae.Poll?"question":"titleField"}_placeholder`}),functions:{onChange:ie=>{pe(me=>({...me,title:ie})),q({title:ie})}},validation:g===Ae.Poll?[{condition:"required"}]:[]}),j&&_e.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:h.formatMessage({id:`${Ge}postType_label`}),options:O.map(ie=>({id:ie.slug,label:ie.name})),validation:[{condition:"required"}],functions:{onChange:ie=>{q({postType:ie}),ie.includes(Ae.Poll)?f(Ae.Poll):g!==Ae.Post&&f(Ae.Post)}}});let Oe=!p||!p.id||!r||Xe;if(g===Ae.Poll){const ie=X.polls;Oe=Oe||Ue||ie<y_||ie>Zc}else Oe=Oe||Le,k&&(T?Oe=Oe||R.body===k.text&&X.title===T.text:Oe=Oe||R.body===k.text);return c.jsxs(c.Fragment,{children:[c.jsxs(Jt,{id:ye,className:V("discussion-card discussion-form",{"no-styling":D&&k}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:k&&!Xe||l.cancel},functions:{onSuccess:async ie=>{const me={...R,...ie};if(k){pe(ge=>({...ge,status:"submitting"})),J(me);return}await Me(me)},onCancel:w},fields:_e,intlPath:Ge,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"data-gtm-event-type":`${k?"save":"submit"}-${g}-click`,"data-testid":"save-button",disabled:Oe,text:{default:!k&&(o!=null&&o.submit)?o==null?void 0:o.submit:h.formatMessage({id:`${Ge}${k?"save":"post"}`}),submitting:h.formatMessage({id:`${Ge}${k?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"data-gtm-event-type":`cancel-${g}-click`,disabled:!l.cancel&&(!p||!p.id||!R.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:h.formatMessage({id:`${Ge}cancel`})},gtm:{context:m,event:`${g}-form`},"data-testid":`discussion-${g}-form`,children:[z&&!k&&g===Ae.Question&&c.jsx("h2",{children:Rt(h.formatMessage,`${Ge}title`,g,"action")}),c.jsx(an,{member:p?{...p,link:!1}:"community",gtmContext:m,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:t||""},{scope:ct.Platform,area:"all"}]}})]}),X.status==="submitted"&&F&&c.jsx(ur,{className:"success","data-testid":"success",children:Rt(h.formatMessage,`${Ge}success`,g,"action")}),Z&&c.jsx(ur,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof Z=="string"?Z.includes(" ")?Z:h.formatMessage({id:Z},{action:h.formatMessage({id:`discussion_action_${g}`}),maxLength:s}):Z}),b&&c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,children:b})]})},C_=Object.freeze(Object.defineProperty({__proto__:null,default:ta},Symbol.toStringTag,{value:"Module"})),xs=({children:e,class:t,...n})=>{const r={...n,class:V("subtle",t)};return c.jsx("blockquote",{...r,children:e})};const w_={showForm:!1},Ci=y.createContext(w_),eh=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(Ci.Provider,{value:{...t,updateConversation:n},children:e})},Da="discussion_",D_=195;let Ea=null;const na=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:a=!1,originalAuthorId:i,forceHide:s,functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:m,isTruncated:h=!1,setFocus:p=!1,isCommunity:g=!1,badges:f,basePath:b,parentId:v})=>{var Le,Xe,_e,Oe,We,Y,oe,ie,me,ge,ke,ze,ot,At,vt,tt;const C=ae.useIntl(),D=y.useContext(Ci),A=y.useContext(it),{createContent:E=async()=>{},deleteContent:k=async()=>{},updateContent:T=async()=>{}}=o.content||{},{createLike:$=()=>{},deleteLike:P=()=>{},listLikes:z=async()=>({})}=o.likes||{},{openComments:L=()=>{}}=o.comments||{},{listMembers:B=()=>Promise.resolve([]),clickMentionFallback:F=()=>{}}=o.form||{},{author:j,canLike:O,createdAt:q,id:W,likes:ne=0,userLiked:J,comments:w=0,data:Q}=t,se=A&&A.id&&typeof j!="string"&&j.id&&j.id===A.id||!1,_=typeof O=="boolean"?O:!0,M=se&&(!t.createdAt||Bh(t.createdAt,10,"seconds")),U=y.useRef(null),[S,R]=y.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[K,Z]=y.useState(!1),[re,ce]=y.useState(M?"highlighted":"default"),[X,pe]=y.useState("");y.useEffect(()=>{const Ce=U.current;if(!(!Ce||re==="default"))return document.addEventListener(rt.DISCUSSION_FORM_SUBMITTED,ve),Ce.addEventListener("transitionend",ye),()=>{document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,ve),Ce.removeEventListener("transitionend",ye)}},[]),y.useEffect(()=>{R(Ce=>({...Ce,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),y.useEffect(()=>{(async()=>{const Be=await Do(S.body,h,Q==null?void 0:Q.mentions,B);R(It=>({...It,postBody:Be}))})()},[S.body,Q==null?void 0:Q.mentions]);const ve=()=>{setTimeout(()=>{ce("fading")},1e3)},ye=({propertyName:Ce})=>{Ce==="background-color"&&ce(Be=>(Be==="default"&&(document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,ve),U.current&&U.current.removeEventListener("transitionend",ye)),Be==="fading"?"default":Be))};if(a||!t||t.type===Ae.Answer&&(!t.slugs||!t.slugs.question)||S.postBody===""&&t.title==="")return c.jsx(Nt,{className:"discussion-card"});const Me=async({title:Ce,body:Be,data:It})=>{Ce||(Ce=""),Be||(Be=""),pe("");try{if(!Ra(Ce,S.title)||!Ra(Be,S.body)){const bt=t.type===Ae.Question?{title:Be}:{title:Ce,body:Be,data:It};await T(Ps(t.slugs),bt)}R(bt=>({...bt,title:Ce||"",body:Be||"",data:{...bt.data,...It},isEditing:!1,didEdit:!0}))}catch{pe(`${Da}form_error`)}},je=()=>{if(D&&D.updateConversation){const Ce={showForm:!0},Be=t.author;Be&&Be.id&&(g&&(Ce.prepopulateForm=`@{{${Be.id}}}`),Ce.mentionData={id:Be.id,name:Be.name}),D.updateConversation(Ce)}setTimeout(()=>{var _n,Xt,Un;const Be=`reply-form-${(t.type===Ae.Answer?t.slug:((_n=t.slugs)==null?void 0:_n.reply)||((Xt=t.slugs)==null?void 0:Xt.answer)||((Un=t.slugs)==null?void 0:Un.question)||"").toLowerCase().slice(-15)}`,It=document.getElementById(Be),bt=document.getElementById(`${Be}-input`);bt&&bt.focus(),It&&It.scrollIntoView({behavior:"smooth"})},0)},Je=async()=>{Z(!1);try{await k(Ps(t.slugs))}catch{pe("delete-error")}},Ue=[];return n&&se&&Ue.push({text:C.formatMessage({id:`${Da}moreMenu_edit`}),onClick:()=>R(Ce=>({...Ce,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`},{text:C.formatMessage({id:`${Da}moreMenu_delete`}),onClick:Ce=>{Ce.preventDefault(),Ce.stopPropagation(),Z(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...Kd(`delete-${t.slug}-modal`,K)}),r&&o.pins&&Ue.push({text:C.formatMessage({id:`${Da}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&&((Le=U==null?void 0:U.current)==null||Le.focus(),(Xe=U==null?void 0:U.current)==null||Xe.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:V("discussion-post",u,{[re]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!S.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:U,tabIndex:p?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:Ce=>{if(!l.post||S.isEditing)return;Ce.preventDefault(),Ce.stopPropagation(),Ea&&clearTimeout(Ea),Ea=setTimeout(()=>{window.location.href=l.post},150);const Be=new CustomEvent(rt.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:Ea}});document.dispatchEvent(Be)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:W||t.slug,className:V("discussion-card",t.type,{editing:S.isEditing,"has-link":l.post&&!S.isEditing}),children:[!S.isEditing&&c.jsxs("div",{className:"author-section",children:[c.jsx(an,{member:j,additionalContent:{createdAt:q,didEdit:S.didEdit,customMessage:(_e=t.componentProps)!=null&&_e.member.additionalContent?(Y=(We=(Oe=t.componentProps)==null?void 0:Oe.member)==null?void 0:We.additionalContent)==null?void 0:Y.customMessage:{}},className:typeof j!="string"&&j.id===i?"highlighted":"",styling:{additionalContentNewLine:!!((oe=t.componentProps)!=null&&oe.member.additionalContent&&((ge=(me=(ie=t.componentProps)==null?void 0:ie.member)==null?void 0:me.additionalContent)!=null&&ge.customMessage))},gtmContext:d,gtmType:"profile-click",badges:f}),t.pinned&&c.jsx(Yt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Pe,{children:"Pinned Post"})})]}),S.isEditing?c.jsx(ta,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:S.title!==""?{text:S.title}:!1,isEditing:{text:S.body,categories:[]},canBePrepopulated:g,isPrepopulated:!1},maxLength:t.type===Ae.Question?250:5e4,forceShow:{error:X!==""&&X!=="delete-error"?C.formatMessage({id:X},{action:C.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:E,handleSaveEdit:Me,handleCancel:()=>{pe(""),R(Ce=>({...Ce,isEditing:!1}))},listMembers:B,clickMentionFallback:F},gtmContext:`${d}Form`,data:Q}):c.jsxs(c.Fragment,{children:[l.post?c.jsxs("a",{href:l.post,children:[(S==null?void 0:S.title)&&c.jsx("p",{className:"content-title",children:S==null?void 0:S.title}),S.postBody.length>D_?c.jsx(xd,{text:S.postBody,markdownOptions:{overrides:{a:Bs,blockquote:{component:xs}}}}):c.jsx(On,{options:{overrides:{a:Bs,blockquote:{component:xs}}},children:S.postBody})]}):c.jsxs(c.Fragment,{children:[(S==null?void 0:S.title)&&c.jsx("p",{className:"content-title",children:S==null?void 0:S.title}),c.jsx(On,{options:{wrapper:t.type===Ae.Question?"h1":y.Fragment,forceWrapper:t.type===Ae.Question,forceInline:t.type===Ae.Question,forceBlock:t.type!==Ae.Question,overrides:{blockquote:{component:xs}}},children:S.postBody})]}),(ke=S.data)!=null&&ke.link?c.jsx(_o,{data:S.data.link}):c.jsx(c.Fragment,{}),(ze=t.categories)!=null&&ze.length?c.jsx("ul",{className:"categories-list",children:t.categories.map(Ce=>c.jsx(Yt,{size:"small",element:"li",children:Ce.name},Ce.slug))}):c.jsx(c.Fragment,{})]}),!S.isEditing&&!(s!=null&&s.actionBar)&&c.jsx(uf,{className:t.type,gtmContext:d,contentType:t.type,likes:s!=null&&s.likes?!1:{count:ne||0,userLiked:J||!1,canLike:_,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:$,deleteLike:P,listLikes:z},basePath:b,parentId:v},comments:!(s!=null&&s.comments)&&([Ae.Question,Ae.Post].includes(t.type)||l.comments)?{count:w||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof L=="function"&&L()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{functions:{onClick:je}}:!1,shareLink:{url:`${window.location.origin}${(ot=t.slugs)==null?void 0:ot.question}/${(At=t.slugs)==null?void 0:At.answer}${(vt=t.slugs)!=null&&vt.reply?`#${(tt=t.slugs)==null?void 0:tt.reply}`:""}`},moreMenu:{options:Ue,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:K,functions:{onOpen:()=>{},onClose:()=>Z(!1)},forceShow:{error:X==="delete-error"?C.formatMessage({id:"discussion_delete_error"},{action:C.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:C.formatMessage({id:"discussion_delete_title"},{action:C.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>Z(!1),children:C.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:Je,children:C.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:c.jsx(ae.FormattedMessage,{id:"discussion_delete_text",values:{p:Ce=>c.jsx("p",{children:Ce}),action:C.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const E_=y.lazy(()=>Promise.resolve().then(()=>N_)),__=65,th=({forceShow:e,form:t,className:n})=>{const r=ae.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(it)||"community",l=fi(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,m]=y.useState({form:u||pd("showPost")==="true"||!1,warning:!1}),[h,p]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!h.showCachedText)return;(async()=>{const v=await Do(h.title||h.body||"",__,h.mentions);p(C=>({...C,prettifiedText:v}))})()},[h.showCachedText,h.title,h.body]);const g=b=>{if(!h.showCachedText||typeof d.warning=="string")return;let v;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),v=b.detail.link;else{const C=b;C.preventDefault(),C.stopPropagation();const A=C.target.closest("a");v=A&&A.getAttribute("href")}m(C=>({...C,warning:v||!1}))};y.useEffect(()=>{if(!h.showCachedText){document.removeEventListener(rt.DISCUSSION_POST_CLICKED,g),document.removeEventListener(rt.MEMBER_CLICKED,g),document.removeEventListener("click",g);return}return document.addEventListener(rt.DISCUSSION_POST_CLICKED,g),document.addEventListener(rt.MEMBER_CLICKED,g),document.addEventListener("click",g),()=>{document.removeEventListener(rt.DISCUSSION_POST_CLICKED,g),document.removeEventListener(rt.MEMBER_CLICKED,g),document.removeEventListener("click",g)}},[h.showCachedText]),y.useEffect(()=>{const b=v=>{if(!(!h.showCachedText||d.warning!==!1))return v.preventDefault(),v.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[h.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return h.showCachedText&&(h.title||h.body)&&(f=h.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:V("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),m(v=>({...v,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(un,{name:l.name,src:l.image,alt:""}),c.jsx(On,{className:V("input",{placeholder:!h.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:f})]}),c.jsxs(gr,{children:[c.jsx(E_,{showModal:d.form,functions:{cacheText:p,onClose:()=>{m(b=>({...b,form:!1}))}},form:t,cachedText:h,className:"in-portal"}),c.jsx(ln,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{m(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{m({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":i}],children:c.jsx("p",{children:r.formatMessage({id:`${a}overlay_text`})})})]})]})},k_=y.lazy(()=>Promise.resolve().then(()=>C_)),au=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:a,required:i,join:s,leave:o,notMemberStateText:l}})=>{if(i&&!a)return c.jsx(Cn,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(bo,{isShort:!0,functions:{join:s,leave:o}})}});const{content:u,functions:d,meta:m,...h}=t,p={content:{type:(u==null?void 0:u.type)||"reply",slugs:(u==null?void 0:u.slugs)||{}},functions:{...d,create:(d==null?void 0:d.create)||(()=>{})},parentId:n,meta:{...m,isEditing:(m==null?void 0:m.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...h,id:`add-post-${h.id||""}`};return e?c.jsx(th,{form:p}):c.jsx(k_,{...p})},iu=({form:e})=>{const t=y.useContext(it),n=ae.useIntl(),[r,a]=y.useState(!1),i=()=>{Rh(t)||a(!0)};y.useEffect(()=>(document.addEventListener(rt.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(rt.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(wi,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const Cs="discussion_responses_",nh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ae.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${Cs}title`},{action:r.formatMessage({id:`${Cs}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:Rt(r.formatMessage,`${Cs}empty`,e,e)})]})};const rh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ae.useIntl(),s=y.useContext(Ci),o=Aa(a,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:V("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(Xr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx(ta,{...r})]})};function F_(e,t){var n;if(e==="poll")if(t&&((n=t["poll-option"])==null?void 0:n.length)>0)t["poll-option"].some(r=>r.own_children&&r.own_children["poll-vote"]&&r.own_children["poll-vote"].length>0);else return!1;return!0}function A_({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({content:a,title:i})=>t(s=>(s&&(a!=null&&(s.content=a),i!=null&&(s.title=i)),s)),onError:n});return r}function B_({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=Ke.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function T_({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=Ke.useQueryClient(),l=ci(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:yo(u),mutate:xo(u)},user:l,...u},m=A_({...d,mutationFn:t}),h=S_({...d,mutationFn:n}),p=j_({...d,mutationFn:r}),g=O_({...d,mutationFn:a}),f=P_({...d,mutationFn:i}),{activity:b,...v}=B_({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:m,like:h,unlike:p,pin:g,unpin:f},user:l,...v}}function S_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ha({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ha({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function j_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Gd({activity:s,user:r}),s)),onError:n});return a}function O_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ka({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ka({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function P_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&Qd({activity:s,user:r}),s))),onError:n});return a}const M_=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},likes:o,reactions:l,form:u,join:d,leave:m},profile:h,categories:p})=>{var W,ne,J,w,Q,se;const g=ae.useIntl(),{activity:f,error:b,isLoading:v,mutations:{edit:C,like:D,unlike:A,pin:E,unpin:k}}=T_({queryFns:s,queryKey:[e,t,n]});if(v)return c.jsx(Nt,{style:{height:"400px"}});if(b||!f)return c.jsx(Cn,{variant:"error",text:g.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:T,verb:$,latest_reactions:P,mentioned_users:z,additional_data:L}=f,B=(((W=P==null?void 0:P.like)==null?void 0:W.length)||0)>0,F=(((ne=T==null?void 0:T.like)==null?void 0:ne.length)||0)>0,j=F?T==null?void 0:T.like[0].id:"",O=B?(J=P==null?void 0:P.like)==null?void 0:J.map(_=>{var M,U,S;return{id:(M=_==null?void 0:_.user)==null?void 0:M.id,name:(S=(U=_==null?void 0:_.user)==null?void 0:U.data)==null?void 0:S.name}}):!1,q=f==null?void 0:f.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(na,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:Ae.Post,title:f==null?void 0:f.title,body:f==null?void 0:f.content,categories:Eo((f==null?void 0:f.categories)||[],p||[]),canLike:r,createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:vr(q),userLiked:F,likes:((w=f==null?void 0:f.reaction_counts)==null?void 0:w.like)||0,comments:(f==null?void 0:f.total_replies)||0,peopleWhoLiked:O,data:{mentions:z,...L||{}},pinned:((Q=f==null?void 0:f.reaction_counts)==null?void 0:Q.pin)&&((se=f==null?void 0:f.reaction_counts)==null?void 0:se.pin)>0||!1},originalAuthorId:q==null?void 0:q.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(_,{title:M,body:U})=>C({title:M,content:U})},likes:{createLike:()=>D({activityId:n}),deleteLike:()=>A({activityId:n,reactionId:j}),listLikes:_=>o.list({activityId:n,..._})},comments:{openComments:()=>{}},pins:{createPin:()=>E({activityId:n}),deletePin:()=>{var _;return k({activityId:n,reactionId:(_=P==null?void 0:P.pin)==null?void 0:_[0].id})}},form:u},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a,badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:t||""},{scope:ct.Platform,area:"all"}]},basePath:e,parentId:t},n),c.jsx(rf,{basePath:e,parentId:t,activityId:n,showReplies:F_($,P),activityTotalReplies:(f==null?void 0:f.total_replies)||0,isMember:r,functions:{reactions:l,likes:o,form:u,join:d,leave:m},profile:h})]})};const ah=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=ae.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:m}=n,{title:h="",body:p="",mentions:g}=r||{},f="discussion-form-modal";return c.jsx(ln,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(h!==""||p!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:V("discussion-form-modal",a),children:c.jsx(ta,{...n,data:{...u,mentions:g||(u==null?void 0:u.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:i.formatMessage({id:`${s}cta`})},functions:{...m,onChange:b=>{l(v=>({...v,...b}))},onMention:({id:b,name:v}={})=>{if(!b||!v)return;const C=g||{};C[b]={created_at:"",updated_at:"",id:b,data:{name:v}},l(D=>({...D,mentions:C}))},create:async b=>{o(),m.create&&await m.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),m.handleSaveEdit&&await m.handleSaveEdit(b),l({showCachedText:!1})}}})})},N_=Object.freeze(Object.defineProperty({__proto__:null,default:ah},Symbol.toStringTag,{value:"Module"}));const I_=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:a,formLabel:i,ctaMessage:s,showIcon:o,onClose:l,reportError:u=()=>{},sendInvites:d})=>{const m=ae.useIntl();return a||(a=m.formatMessage({id:"inviteModal_formTitle"})),i||(i=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:l},className:V("invite-modal",e,{success:!!n}),children:c.jsx(Hm,{title:a,label:i,messagePlaceholder:r,ctaMessage:s,onClose:l,sendInvites:d,reportError:u})})};const R_=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=ae.useIntl(),[l,u]=y.useState(pd("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(ln,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:V("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(Km,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async m=>{var h;try{(h=i==null?void 0:i.functions)!=null&&h.onSuccess&&await i.functions.onSuccess(m)}finally{d()}}}})]})})},wi=R_,$_=Object.freeze(Object.defineProperty({__proto__:null,default:wi},Symbol.toStringTag,{value:"Module"}));const L_=({members:e})=>{const[t,n]=y.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return c.jsxs(c.Fragment,{children:[c.jsx(un,{name:i,src:l}),c.jsx("p",{children:i}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(a=>c.jsx("li",{children:c.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),c.jsx(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 z_=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:V("testimonial-block",a),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:V("author",{"text-small":!a.includes("new")}),children:e}),t&&c.jsx("p",{className:V("author-cite",{"text-small":!a.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),q_=y.memo(z_);const U_=({items:e=[],selector:t="",className:n=""})=>{const r=ae.useIntl(),[a,i]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&c.jsxs(_t,{variant:"subtle",className:V("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:a.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Di=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ae.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=`${i.formatMessage({id:`${s}hours`},{time:h})}${h>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${h>0?`${i.formatMessage({id:`${s}hours_short`},{time:h})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:m}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:m})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:V("time-to-complete",a),"aria-label":u,children:l})};const W_=({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(zn,{...n,className:V("banner",e),image:{...t,aspect:"banner"}})):null;const V_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],H_=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],m={eyebrow:"small",title:"h1",text:"p"},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:C}=t[b];if(C&&V_.includes(C.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(En,{className:V("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&a==="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:C=""}=h[b];return b==="text"?c.jsx(On,{overrideType:"text-only",className:"text",children:v},b):y.createElement(C,{key:b,className:b},v)}return null}),l,p&&c.jsx(Ee,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:V({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(zn,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},K_=y.memo(H_);const Z_=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(En,{className:V("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const Y_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(On,{children:n}):n;return c.jsxs(En,{className:V("highlight-section",t),children:[r&&c.jsx("div",{className:V("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(zn,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),c.jsx("div",{className:V("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:V("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:c.jsx("div",{className:"content-default",children:a})})})]})},G_=y.memo(Y_);const Q_=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:c.jsxs("aside",{className:V("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(Ee,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),J_=({type:e,data:t})=>{const n=ae.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const m=a&&ks(a);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):oo(d)});if(o)return c.jsx(Yt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const m=u&&ks(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})})]})}return null},X_={title:66,text:3e3,secondaryText:1e3,partner:34},ii={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"}},ek=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const a=ae.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:m}=e,h=e.contentType;let p="";if((f=ii[h])!=null&&f.gtmEvent&&(p=ii[h].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(h==="people")return n?c.jsx(Ee,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(h)&&d!=="premium"){const v=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),C=async D=>{if(D.preventDefault(),D.stopPropagation(),!(v||!t||!t.onClick)){s(A=>({...A,loading:!0}));try{const A=await t.onClick(e);s(A==="success"?()=>({registered:!0,loading:!1}):E=>({...E,loading:!1}))}catch{s(E=>({...E,loading:!1}))}}};return c.jsx("p",{className:V("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Ee,{onClick:C,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||a.formatMessage({id:`card_cta_${h}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};function tk({buildMemberData:e,communitySlug:t}){const n=ae.useIntl(),r=y.useContext(it),[a,i]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(s=>{if(!s)return;const{membersCount:o,role:l="",pagination:u}=s;let d=0;o?d=o:u!=null&&u.total&&(d=u==null?void 0:u.total),i({count:d.toString(),isMember:!!l,memberType:l})})},[t,e]),c.jsxs("span",{className:"member-information",children:[a.isMember&&c.jsx(Yt,{size:"small",variant:"registered",icon:(a==null?void 0:a.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${a.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:a.count})})]})}const su=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,meta:l})=>{var F,j;const u=ae.useIntl(),d=y.useContext(it),m=!!(d!=null&&d.id),{isTabbable:h=!0,setFocus:p=!1}=l||{},g=y.useRef(null),[f,b]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,m).then(O=>{b({data:O,isLoading:!1})}).catch(()=>b(O=>({...O,isLoading:!1})))},[a,m,n]);const{data:v,isLoading:C}=f;if(C||!v)return c.jsx(Nt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:D}=v;if(!D||!ii[D])return c.jsx(Nt,{element:"li",className:"card-wrapper"});const{basePath:A="",className:E,length:k,gtmEvent:T}=ii[D];let $=h&&v.slug?`${A}${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")&&($=v.slug);const P=O=>{$&&(O.preventDefault(),O.stopPropagation(),window.location.href=$)},z={...X_,...k};let L={className:"card"},B={};return $&&(B={href:$,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`,"data-testid":"link"},v.openInNewTab&&(B.target="_blank"),L={onClick:P,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`}),p&&(L={...L,tabIndex:"0"},(F=g==null?void 0:g.current)==null||F.focus(),(j=g==null?void 0:g.current)==null||j.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:V("card-wrapper text-medium",E,t,{"has-link":$,"no-link":!$,"has-image":v.banner}),"data-testid":`${D}-card`,children:c.jsxs("div",{...L,ref:g,children:[c.jsx(vd,{className:"card-label",contentType:D,customIcon:v.isPrivate?"lock-locked":v.customIcon,customLabel:v.customLabel}),D==="communityPage"&&(v==null?void 0:v.createdAt)&&Th(v==null?void 0:v.createdAt,60)&&c.jsx(Yt,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),v.startDate&&!v.isOngoingEvent&&c.jsx(Yt,{size:"small",variant:v.dateHasPassed?"default":"information","data-testid":"date",children:v.dateHasPassed?u.formatMessage({id:"card_ended"}):fd(v.startDate)}),v.banner?c.jsxs("p",{className:"img",children:[v.registered&&c.jsx(Yt,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(zn,{image:{...v.banner,description:""}})]}):E==="people"?c.jsx(un,{name:v.title||"",src:v.profile,"data-testid":"people-profile-picture"}):null,v.contributors&&c.jsx(ho,{contributors:{data:v.contributors},styling:{size:"small",showGap:E!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(D)?u.formatMessage({id:`card_contributors_${D}`}):void 0,"data-testid":"contributors"}),v.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:v.partner.length>1?u.formatMessage({id:"card_partner"},{partner:v.partner[0],number:v.partner.length-1}):sr(v.partner[0],z.partner)}),["title","text","secondaryText"].map(O=>{const q=v[O];if(!q)return null;const W=od(O),ne={key:O,className:W,"data-testid":W},J={wrapper:"p",forceWrapper:!0,forceInline:!0},w=sr(q,z[O]);return["title","text"].includes(O)&&$?(J.wrapper="a",c.jsx("p",{...ne,children:c.jsx(Zt,{options:J,...B,children:w})})):c.jsx(Zt,{options:J,...ne,children:w})}),a.contentType==="communityPage"&&(a.slug||v.slug)&&r&&c.jsx(tk,{communitySlug:a.slug||v.slug,buildMemberData:r}),c.jsx(J_,{type:E||"",data:v}),c.jsx(ek,{data:v,cta:i,link:$||"",gtmContext:s})]})})};const ih=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:V("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return c.jsx(su,{id:s,card:{...a,contentType:t[i]},meta:{setFocus:i===(r==null?void 0:r.focusCardIndex)},...r},s)})}),nk=(e,t,n,r)=>{const a=t*n<=e,i=e<t*(n+1),s=r.includes(Math.floor(e/t));return{inView:a&&i,isLoaded:s}},rk=({id:e,title:t})=>{const n=ae.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return y.createElement(a,{className:V("title",i,s,{"highlighted-title":i==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const ws={fourCards:1024,threeCards:769,twoCards:480};let _a=null,Ds=null;const ak=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ae.useIntl(),u="carousel_pagination_",[d,m]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:h,isLoading:p}=d,[g,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:v}=g,[C,D]=y.useState(""),A=t.length,E=Math.ceil(A/h),k=y.useRef(null),T=$n(!0,!0,k==null?void 0:k.current);y.useEffect(()=>{let F=1;T&&(T>=ws.fourCards?F=4:T>=ws.threeCards?F=3:T>=ws.twoCards&&(F=2),F>A&&(F=A)),m(j=>({...j,cardsPerPage:F,isLoading:!1}))},[T,A]);const $=(F="next")=>{Ds&&clearTimeout(Ds);let j=b;if(typeof F=="string")if(F==="next")if(b<E-1)j=b+1;else return;else if(b>0)j=b-1;else return;else j=F;D(""),f(q=>({...q,currentPage:j,loadedPages:[...new Set([...v,j])]}));const O=()=>{const q=j*d.cardsPerPage,W=q+d.cardsPerPage;return t.slice(q,W).length};Ds=setTimeout(()=>{D(l.formatMessage({id:`${u}ariaLive${typeof F=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof F=="string"?F:"next"}`}),slide:typeof F=="string"?1:F+1,count:O()}))},500)},P=F=>{_a=F.touches[0].clientX},z=F=>{if(_a===null)return;const j=F.touches[0].clientX,O=_a-j;O>5?$("next"):O<-5&&$("previous"),_a=null},L={"--width":`${T||0}px`,"--total-cards":A,"--cards-per-page":h,"--page":b};if(p)return c.jsx(di,{layout:`carousel${a?"-with-title":""}`});const B=(F,j)=>{var q;let O=null;return(q=F==null?void 0:F.sys)!=null&&q.id?O=`card-${F.sys.id}`:F!=null&&F.slug?O=`card-${F.slug}`:[n[j],F.contentType].includes("customCard")&&(O=`card-${window.btoa(`${F.title} ${F.createdAt}`)}-${j}`),O};return c.jsxs("section",{ref:k,className:V("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(rk,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:P,onTouchMove:z,style:L,"data-testid":"carousel-list",children:t.map((F,j)=>{let O=B(F,j);const{inView:q,isLoaded:W}=nk(j,h,b,v);return O&&(q||W)?c.jsx(su,{id:O,card:{...F,contentType:n[j]},buildCardData:r,gtmContext:s,meta:{isTabbable:q},...o},O):(O=O||`${e}-card-${j}`,c.jsx(Nt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},O))})}),E<=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(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:F=>{F.preventDefault(),F.stopPropagation(),$("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:b<=0})}),[...Array(E)].map((F,j)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:V("page-indicator",{selected:j===b}),onClick:O=>{O.preventDefault(),O.stopPropagation(),$(j)},children:c.jsx(Pe,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:j+1,total:E})})})},`page-indicator-${j}`)),c.jsx("li",{className:"arrow next",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:F=>{F.preventDefault(),F.stopPropagation(),$("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:b>=E-1})})]}),c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,children:C})]})]})},ik=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=i?window.btoa(i):`carousel-${u}`,m=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(di,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:c.jsx(zt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(ak,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),m?null:c.jsx(zt,{})]},`carousel-${d}`)});const sk=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:a,title:i,text:s,isPrivate:o,slug:l}=n;let u={};return l&&(u={onClick:m=>{l&&(m.preventDefault(),m.stopPropagation(),window.location.href=l)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),y.createElement(e,{className:V("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:V("img",{private:o,"no-image":!a}),children:a&&c.jsx(zn,{image:a})}),c.jsxs("div",{className:"content",children:[i&&c.jsx("p",{className:"title text-medium",children:i}),s&&c.jsx("p",{className:"text text-medium",children:s})]})]})})};const ok=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ae.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return y.createElement(e,{className:V("course-progression",o,{"highlight-percentage":d,"has-circle-graph":i==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:m=>c.jsx("strong",{children:m}),number:u})}),u<100&&a&&c.jsx(Di,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(mo,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const sh=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>y.createElement(e,{className:V("lesson-name",a),"data-number":`${t}.${n}`,children:r});const oh=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ae.useIntl(),o=ui(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):ld(a||"");return c.jsxs("small",{className:V("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:V("type",n),children:o})," ",t>0&&!r&&c.jsx(Di,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const uk=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const m=ae.useIntl(),h="courseStructure_",p=u.toLowerCase().includes("course conclusion");return c.jsxs(li,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[m.formatMessage({id:`${h}section${p?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?m.formatMessage({id:`${h}time_completed`}):c.jsx(Di,{time:s,appendedText:a?m.formatMessage({id:`${h}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:f,contentType:b,icon:v,image:C,isIntroduction:D,optional:A,slug:E,subsectionId:k,title:T,type:$})=>{const P=a&&t||D,z={};return C&&(z.style={"--image":`url(${C})`}),c.jsx("li",{className:V({article:b===Ar.ARTICLE,discussion:b===Ar.DISCUSSION,quiz:b===Ar.QUIZ,completed:g&&b===Ar.ARTICLE,locked:!P}),...z,children:c.jsx(xn,{href:P?`/microcourses/en/${o}/${E}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${ud(T)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(sh,{sectionId:i,subsectionId:k,title:T,className:"course-title"})," ",c.jsx(oh,{completionTime:f,icon:v,optional:A,type:$,children:d&&d[E]&&c.jsx("span",{className:"quiz-score",children:`${d[E]}%`})})]})})},E)})})]})};const lk=({isComplete:e=!1,onClick:t,...n})=>{const r=ae.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Ee,{...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:V("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},ck=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Yc=[{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 ka="notFoundError_",dk=()=>{const e=ae.useIntl(),t=[];return Yc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ka}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(Qm,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(En,{children:[c.jsx(ih,{cards:Yc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(Ee,{href:"/solution-articles/",children:e.formatMessage({id:`${ka}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${ka}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ka}text`})})]})};var si=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(si||{});const fk=(e,t,n)=>n===void 0?0:e.some(a=>a.hasUserVoted)?t?e.findIndex(a=>!a.hasUserVoted):e.findIndex(a=>a.hasUserVoted):0,mk=(e,t,n,r=0)=>{if(!e)return{nextElement:null,nextIndex:0};let a=n==="next"?e.nextElementSibling:e.previousElementSibling,i=r+(n==="next"?1:-1);for(;a;){if(!a.classList.contains(t))return{nextElement:a,nextIndex:i};a=n==="next"?a.nextElementSibling:a.previousElementSibling,i=i+(n==="next"?1:-1)}const s=e.parentElement;if(s)for(a=n==="next"?s.firstElementChild:s.lastElementChild,i=n==="next"?0:s.childElementCount-1;a&&a!==e;){if(!a.classList.contains(t))return{nextElement:a,nextIndex:i};a=n==="next"?a.nextElementSibling:a.previousElementSibling,i=i+(n==="next"?1:-1)}return{nextElement:null,nextIndex:0}};const hk=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:a=!1,showResults:i=!1,hasVotedOnPoll:s=!1,isTabbable:o=!1,functions:l})=>{var b;const[u,d]=y.useState(t.hasUserVoted);let m=0,h={};const p=(a||!s)&&!t.hasUserVoted;i&&(m=Math.round(t.numVotes/r*100)||0,h={"--vote-perc":`${m}%`});const g=v=>{v.stopPropagation(),p&&(l==null||l.createVote(t),d(!0))},f={htmlFor:t.id,className:V({"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 C;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 D=v.code==="ArrowUp"?"prev":"next",{nextElement:A,nextIndex:E}=mk(v.currentTarget.parentElement,"selected",D,n);A&&((C=A.querySelector("label"))==null||C.focus(),l==null||l.setTabbableOption(E));break}}};return c.jsxs("li",{"data-testid":"poll-option",style:h,className:V("poll-option text-small",{selected:t.hasUserVoted}),children:[c.jsx("label",{...f,children:c.jsx("span",{children:t.label})}),i&&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:a?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const pk=({title:e,options:t,settings:n,functions:r})=>{const a="poll_",i=ae.useIntl(),s=y.useContext(it),{showRemoveVote:o=!0,allowMultipleVotes:l=!1,resultsVisibility:u=si.AfterVoting}=n||{},[d,m]=y.useState(fk(t,l,s==null?void 0:s.id)),{createVote:h=async()=>{},removeVote:p=()=>{}}=r||{},g=t.reduce((D,A)=>D+A.numVotes,0),f=t.filter(D=>D.hasUserVoted).length,b=t.filter(D=>D.hasUserVoted),v=y.useCallback(async D=>{await h(D.id)},[]),C=y.useCallback(async()=>{t.forEach(async D=>{D.hasUserVoted&&D.userVote&&await p(D.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:i.formatMessage({id:`${a}instructions`},{allowMultipleVotes:l})})}),c.jsx("p",{className:"poll-num-votes",children:c.jsx("small",{"data-testid":"poll-total-votes",children:i.formatMessage({id:`${a}num_votes`},{number:g})})}),o&&c.jsx("p",{className:"poll-remove-vote",children:c.jsx(Ee,{variant:"tertiary",onClick:C,"data-testid":"remove-votes-button",disabled:f===0,children:c.jsx("small",{children:i.formatMessage({id:`${a}remove_vote_button`},{number:f})})})})]}),t&&c.jsx("form",{children:c.jsx("fieldset",{children:c.jsx("ul",{className:"poll",children:t==null?void 0:t.map((D,A)=>c.jsx(hk,{isTabbable:d===A,user:s,option:D,optionIndex:A,totalPollVotes:g,showResults:u==si.Always||!!f,allowMultipleVotes:l,hasVotedOnPoll:!!f,functions:{createVote:v,setTabbableOption:m}},D.id))})})}),c.jsxs(Pe,{"aria-live":"polite",children:[i.formatMessage({id:`${a}aria_votes`},{number:f}),!!f&&c.jsx("ul",{children:b.map(D=>c.jsx("li",{children:D.label}))})]})]})};exports.ASSETS_BUCKET=Gt;exports.ActionBar=uf;exports.ActionButton=qr;exports.ActivitiesFeed=zg;exports.ActivitySection=M_;exports.AddPost=au;exports.Badge=Sd;exports.BadgeScope=ct;exports.Badges=jd;exports.BadgesContext=lo;exports.BadgesProvider=Dd;exports.Banner=W_;exports.BannerSection=K_;exports.Breadcrumbs=ov;exports.Buckets=Hh;exports.Button=Ee;exports.ButtonWrapper=pr;exports.COURSE_CONTENT_TYPES=Ar;exports.CacheProvider=Ed;exports.Card=su;exports.CardBlock=ih;exports.Carousel=ik;exports.CharacterLimit=Fo;exports.CollapsibleSection=li;exports.Columns=ff;exports.CommunityDetails=fg;exports.ContactFooter=c_;exports.ContactForm=Vm;exports.ContentTypeLabel=vd;exports.Contributors=ho;exports.ConversationContext=Ci;exports.CookieBanner=Gm;exports.CourseProgression=ok;exports.CourseStructure=uk;exports.CustomContentBanner=Z_;exports.CustomEvents=rt;exports.DELETED_USER_ID=Lr;exports.Directory=L_;exports.DiscussionConversation=eh;exports.DiscussionForm=ta;exports.DiscussionFormCard=th;exports.DiscussionFormModal=ah;exports.DiscussionPost=na;exports.DiscussionThread=rh;exports.Divider=zt;exports.DownloadSection=s_;exports.EMAILS=Qn;exports.EditSection=u_;exports.EmailHelperTextBox=hf;exports.EmptyStateBox=Cn;exports.EnrichedUrl=_o;exports.FeatureFlags=kd;exports.Filters=lf;exports.FlagsProvider=_d;exports.Footer=nu;exports.Form=Jt;exports.Formatting=H;exports.Fragment=St;exports.FullWidthSection=En;exports.GET_STREAM_USER_PREFIX=_s;exports.GlobalProviders=sp;exports.Header=ru;exports.HelperTextBox=yd;exports.HiddenFromScreenReaders=oi;exports.HideShowTextBox=xd;exports.HighlightSection=G_;exports.HighlightedTextBox=_t;exports.INVALID_TOKEN=cd;exports.IconBulletedList=Yh;exports.ImageContainer=qh;exports.IntlProvider=Fd;exports.InviteForm=Hm;exports.InviteModal=I_;exports.JoinButton=bo;exports.Label=Yo;exports.LanguageContext=co;exports.LanguageSwitcher=lv;exports.LessonName=sh;exports.LessonType=oh;exports.LikesButton=tf;exports.LikesFeed=af;exports.LikesModal=sf;exports.Link=xn;exports.LoadMore=Xr;exports.LoadingBlock=Od;exports.LoadingPlaceholder=Nt;exports.LoadingState=di;exports.Logo=ko;exports.LogoSection=l_;exports.MEMBERS_PER_PAGE=Jm;exports.MENTION_REGEX=dd;exports.MarkCompleteButton=lk;exports.MarkdownText=On;exports.MarketingBlock=Q_;exports.Marks=Kt;exports.Member=an;exports.MembersList=Xm;exports.Modal=po;exports.MoreMenu=cf;exports.NUMBER_OF_COUNTRIES=Fh;exports.NUMBER_OF_USERS=kh;exports.NarrowCard=sk;exports.NavigationMenu=df;exports.NotFoundError=dk;exports.Overlay=ln;exports.OverlayContext=fo;exports.OverlayProvider=Td;exports.PageHeading=Cd;exports.PageLayout=Qm;exports.PasswordForm=QE;exports.PasswordRules=xf;exports.Pill=Yt;exports.Poll=pk;exports.Popover=gd;exports.Portal=gr;exports.ProfileForm=Km;exports.ProfileImageChange=Wm;exports.ProfileModal=wi;exports.ProfileModalLauncher=iu;exports.ProfilePicture=un;exports.ProgressBar=mo;exports.ProgressTracker=Wh;exports.PublishArticleForm=XE;exports.Rating=Fv;exports.RepliesFeed=rf;exports.ResponsesHeading=nh;exports.ResponsiveImage=zn;exports.ResultsVisibility=si;exports.ReturnToNavButton=Vh;exports.RichTextEditor=tu;exports.SearchForm=Zm;exports.ShareLink=of;exports.ShareLinks=pv;exports.SignupForm=i_;exports.Span=Bs;exports.StatusBanner=ur;exports.TableOfContents=U_;exports.Tabs=gv;exports.Tags=p_;exports.TestimonialBlock=q_;exports.TimeToComplete=Di;exports.Toggle=YE;exports.Tooltip=Ln;exports.TopLevelPage=d_;exports.UUID_V4_REGEX=zr;exports.UserContext=it;exports.UserProvider=Ad;exports.VisuallyHidden=Pe;exports.addAriaProps=Kd;exports.basicReducer=Jr;exports.camelCaseToDashCase=od;exports.checkIntlPathExists=ui;exports.enrichPostCategories=Eo;exports.generateConditions=Ia;exports.generateCssIcon=Ah;exports.getAuthorData=vr;exports.getCharacterLimitProps=mf;exports.getLongDate=oo;exports.getMember=fi;exports.getPostBody=Do;exports.getShortDate=fd;exports.getValueLength=mi;exports.headerData=Qr;exports.likesResponseMock=iv;exports.mapGetStreamData=ck;exports.pageReady=md;exports.passwordValidator=Fs;exports.repliesFeedMock=qg;exports.supportedLanguages=Ba;exports.toCamelCase=ud;exports.toCapitalisedCase=_h;exports.toSentenceCase=ld;exports.transformSlugs=Ps;exports.useAutoResize=ed;exports.useBadges=wd;exports.useCurrentPath=td;exports.useEffectAfterMount=or;exports.useElementWidth=$n;exports.useOverlay=Bd;exports.useScrollListener=ad;exports.useScrollToHash=io;exports.useTooltips=so;exports.useUser=ci;
165
+ `}),R=K.turndown(R)}o&&o.mentions&&(R=await pd({text:R,template:`[${Ys}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),KD(R,K=>{const Z=[{type:"initialValue",value:K},{type:"editorKey",value:P.toString()}];o!=null&&o.link&&(Z.push({type:"enrichedUrl",value:o.link}),o.link.url&&J(o.link.url)),T(Z),setTimeout(()=>{T([{type:"stringValue",value:Mc(_)}])},150)})})()},[P]),y.useEffect(()=>{if(q===void 0&&_){const R=GD(_);R&&J(R)}const S=R=>{var re;const K=R,Z=((re=K==null?void 0:K.detail)==null?void 0:re.url)||null;Z&&q&&q.url===Z&&T([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",S),()=>{window.removeEventListener("linkRemoved",S)}},[q]),y.useEffect(()=>{if(t){zr.lastIndex=0;const S=t.match(zr);S&&S.length===1&&S[0].length===t.length&&!j&&T([{type:"originalValue",value:t}])}t!==""||!_||Ra(P,t)&&!j||(x.withoutNormalizing(_,()=>{ee.delete(_,{at:{anchor:x.start(_,[]),focus:x.end(_,[])}}),ee.deselect(_),_.children.length!==0&&ee.unwrapNodes(_,{at:[0]}),ee.insertNodes(_,A,{at:[0]})}),T([{type:"initialValue",value:A},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),y.useEffect(()=>{b({link:q})},[q]),y.useEffect(()=>{L===""&&q&&T([{type:"enrichedUrl",value:void 0}])},[L]);const U=rd(()=>{JD({editor:_,isShowing:W.show,numberOfUsers:W.numberOfUsers,listMembers:p,dispatch:T})},100);return z?c.jsx("div",{id:w,className:"rich-text-editor",children:c.jsxs(cn.Provider,{value:{...k,id:w,isInOverlay:h,setFocus:ne,dispatch:T,getLinkPreview:v,onMention:C,reportError:D},children:[c.jsxs(pC,{editor:_,initialValue:z,onChange:S=>{if(_.operations.some(K=>K.type!=="set_selection")){let K=eE(S);K==="<br>"&&(K=""),f(K,q),T([{type:"stringValue",value:Mc(_)}]),j||T([{type:"hasInteracted",value:!0}]),U(),m&&console.log({serialized:K,json:S})}},...u,children:[c.jsx(sC,{className:"input",renderElement:Q,renderLeaf:se,placeholder:n||d.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async S=>{const R=q!==!1,K=S.clipboardData.getData("text");if((re=>{try{return new URL(re),!0}catch{return!1}})(K)){let re=K;if(K){const{full:ce}=uo(K);re=ce}if(K&&v&&!R){const ce=await v(re);ce.url&&T([{type:"enrichedUrl",value:ce}])}}},onKeyDown:S=>{if(S.key==="Enter"){W.show&&(S.preventDefault(),S.stopPropagation(),Tm(_,W,T,w));const{selection:R}=_;if(R){const K=G.isCollapsed(R),[Z,re]=x.node(_,R,{depth:1});let ce=Z,X=ce.type;const pe=ce.children[0];if(pe&&(pe==null?void 0:pe[H.h3])===!0&&(S.stopPropagation(),S.preventDefault(),ee.insertNodes(_,A)),pe&&[H.ol,H.ul].includes(pe.type)&&(ce=pe,X=pe.type),ce&&fe.isElement(ce)&&X!==H.paragraph){if(X===H.blockquote&&!S.shiftKey){S.stopPropagation(),S.preventDefault(),ee.insertNodes(_,A);return}if(K){const[ve,ye]=x.parent(_,R,{edge:"end"}),je=ve.type;if([H.ul,H.ol].includes(X))if(S.stopPropagation(),S.preventDefault(),je===H.li&&F==="Enter"){ve.children.length===1&&"text"in ve.children[0]&&ve.children[0].text===""&&ee.removeNodes(_,{at:ye}),ee.insertNodes(_,A,{at:I.next(re)}),ee.select(_,x.end(_,I.next(re)));return}else{const[Je,Ue]=ZD(_,H.li),Le={type:H.li,children:[{text:""}]};ee.insertNodes(_,Le,{at:I.next(Ue)}),ee.select(_,x.end(_,I.next(Ue)))}}}}}else if(S.key==="Escape"){if(W.show){S.preventDefault(),S.stopPropagation(),T([{type:"mentionPopover",value:{...W,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(S.key)&&W.show){S.preventDefault(),S.stopPropagation();const{selectedUser:R,possibleUsers:K}=W;let Z=S.key==="ArrowUp"?R-1:R+1;Z<0&&(Z=K.length-1),Z>=K.length+1&&(Z=0),T([{type:"mentionPopover",value:{...W,selectedUser:Z}}])}T([{type:"lastKey",value:S.key}]),QD(S,_,T,D)},onBlur:()=>{_.selection&&T([{type:"lastAnchor",value:_.selection.anchor}])},onFocus:()=>{if(B){if(!I.isPath(B.path)||!le.has(_,B.path))return;const S=le.get(_,B.path);let R=0;if(he.isText(S)?R=S.text.length:S.children&&(R=S.children.length),B.offset>R)return;try{ee.select(_,{anchor:B,focus:B})}catch(K){const Z=K.message;D(`Error focusing editor: ${Z}`)}}}}),q?c.jsx(_o,{data:q,variant:"condensed",onClick:()=>{T([{type:"enrichedUrl",value:!1}]);const S=new CustomEvent("ariaLive",{detail:{message:d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_live"})}});document.dispatchEvent(S)},"aria-label":d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria"},{title:q.title||d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(cE,{styling:l==null?void 0:l.toolbar}),p?c.jsx(tE,{onFallbackClick:g}):c.jsx(c.Fragment,{})]},$),c.jsx(Fo,{id:`character-limit-${e}`,limit:r,valueLength:mi(L)})]})}):c.jsx(c.Fragment,{})};const GE=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:V("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:V("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const m=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:m,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:m,children:d.label})]},m)})})]})};function Vm({className:e="",userId:t,userName:n,src:r,uploadImage:a,button:i,callback:s}){const o=ae.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[m,h]=y.useState(!1),[p,g]=y.useState(!1),f=y.useRef(null),b=async A=>{h(!0),g(!1);try{const E=A.target.files&&A.target.files[0];if(!E||!t)throw h(!1),new Error("Image file or userID is missing");const k=await a({fileObject:E,userId:t}),T={thumbnail:k.thumbnailURL,full:k.originalURL};d(T),s(T)}catch{g(!0)}finally{h(!1)}h(!1)},{upload:v=o.formatMessage({id:`${l}cta_upload`}),change:C=o.formatMessage({id:`${l}cta_change`}),uploading:D=o.formatMessage({id:`${l}cta_uploading`})}=(i==null?void 0:i.text)||{};return c.jsxs("div",{className:V("profile-image-change-figure",e),children:[c.jsx(un,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),p&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(Ee,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:m,children:m?D:u?C:v})]})}const Hm=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(Jt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n},button:{className:"new"}})};const QE=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=ae.useIntl();return c.jsx(xh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:a=>{t(a),n(!a.length)},autoFocus:!1,getLabel:(a,i,s)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:a}),c.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(i),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},i)})},Km=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:a,labelColor:i,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:d="NOT_SUBMITTED"})=>{const[m,h]=y.useState([]),[p,g]=y.useState(!0),[f,b]=y.useState(d),{formatMessage:v}=ae.useIntl(),C=async E=>{try{await u(m,E.message),h([]),b("SUCCESS")}catch(k){b("ERROR"),l(k)}},D=E=>{E.preventDefault(),b("NOT_SUBMITTED"),g(!0),h([])},A=E=>{E.preventDefault(),o(),b("CLOSED")};return f==="CLOSED"?null:f==="ERROR"||f==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:f==="SUCCESS"?c.jsx("h2",{className:"success-title",children:v({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",v({id:"inviteForm_error"})]})}),c.jsx(zt,{}),c.jsx("div",{className:"footer",children:f==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"secondary",onClick:D,children:v({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Ee,{onClick:A,children:v({id:"inviteForm_ctaDone"})})]}):c.jsx(Ee,{onClick:D,children:v({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:a},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:i},children:t})]}),c.jsx(Jt,{id:"invite-form",fields:[{component:QE,props:{emails:m,setEmails:h,setIsDisabled:g},required:!0},{id:"message",type:"textarea",label:v({id:"inviteForm_message_label"}),placeholder:n||v({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:C},button:{text:r,size:"medium",disabled:p}})]})},Ia=e=>e.map(t=>({condition:t})),Tt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},JE=({functions:e,...t})=>{const{formatMessage:n}=ae.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[Tt.NEW_PASSWORD]!==p[Tt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=p=>!Fs(p[Tt.NEW_PASSWORD]).isValid,m=[{"data-testid":Tt.NEW_PASSWORD,id:Tt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Ia(["required",d]),functions:{onChange:p=>l(Fs(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Tt.CONFIRMED_PASSWORD,id:Tt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Ia(["required",u])}];t.isPasswordChange&&m.unshift({"data-testid":Tt.CURRENT_PASSWORD,id:Tt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Ia(["required"])}),i&&m.push({component:Cf,props:{matchingRules:o}});const h={id:Tt.FORM_ID,fields:m,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>a(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(Tt.NEW_PASSWORD)||g.includes(Tt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Jt,{...h}),r&&c.jsx(Cn,{variant:"error",text:r})]})};const Zm=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:a,...i})=>{var $;const s=ae.useIntl(),o="profileForm_",l=y.useContext(it),[u,d]=y.useState(l.image),[m,h]=y.useState(!1),{uploadImage:p=()=>{},onSuccess:g=async P=>{},onCancel:f=()=>{},onFailure:b=()=>{}}=n,{buildLocation:v,isValidPlace:C,predictPlaces:D}=t.useMaps(),{context:A="ProfileForm",event:E="profile-form-submit-click"}=a||{},k=[{id:"jobTitle",type:"text",label:s.formatMessage({id:`${o}jobTitle`}),placeholder:s.formatMessage({id:`${o}jobTitle_placeholder`}),value:l.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:s.formatMessage({id:`${o}organization`}),placeholder:s.formatMessage({id:`${o}organization_placeholder`}),value:l.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:s.formatMessage({id:`${o}location`}),placeholder:s.formatMessage({id:`${o}location_placeholder`}),value:($=l.location)==null?void 0:$.en,validation:[{condition:"required"},{condition:({location:P})=>P&&!m?!1:!C(P),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{m||h(!0)},onKeyInput:D}}],T=[{component:Vm,props:{userName:l.name,userId:l.id,src:u,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:l.name,autoComplete:"name",validation:[{condition:"required"}]},...k,{id:"biography",type:"textarea",label:s.formatMessage({id:`${o}bio`}),placeholder:s.formatMessage({id:`${o}bio_placeholder`}),limit:1e3,value:l.biography},{component:zt}];return c.jsx(Jt,{id:"profile-details-form",fields:e?k:T,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:A,event:E},functions:{onSuccess:async P=>{try{const z={...P,image:u||null,location:m?await v(P==null?void 0:P.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails(L=>({...L,...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`})}},...i})},XE=()=>{const e=ae.useIntl(),[t,n]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>{n(a=>{if(a>=95)return clearInterval(r),95;const i=Math.round(Math.random()*10);return Math.min(a+i,95)})},800);return()=>{clearInterval(r)}},[]),c.jsx(Pd,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};let ms=null;const lt="publishArticleForm_",Uc={},Wc=10,e_=({id:e="publish-article-form",values:t=Uc,functions:n,meta:r,gtm:a})=>{const i=ae.useIntl(),s=y.useContext(it),{create:o,onSuccess:l=()=>{},onFailure:u=()=>{}}=n||{},{isInOverlay:d=!1}=r||{},[m,h]=y.useState(!1),[p,g]=y.useState(t.body||""),[f,b]=y.useState(!1),[v,C]=y.useState("");y.useEffect(()=>{Ra(t,Uc)||La(t.body)&&t.body!==p&&t.body!==void 0&&g(t.body)},[t.body]);const D=()=>{!s||!s.id?b(i.formatMessage({id:`${lt}error_loggedOut`})):f&&b(!1)},A=$=>({condition:P=>{const z=P[$];return!z||typeof z!="string"?!0:z.length<Wc},error:i.formatMessage({id:`${lt}error_underMinLength`},{length:Wc})}),E=!!p&&La(p),k=()=>c.jsxs(c.Fragment,{children:[c.jsx(zt,{}),c.jsx("p",{className:"text-medium",children:i.formatMessage({id:`${lt}disclaimer`})})]}),T=[{id:"title",type:"text",value:t.title||"",limit:65,label:i.formatMessage({id:`${lt}title_label`}),placeholder:i.formatMessage({id:`${lt}title_placeholder`}),functions:{onChange:D},validation:[{condition:"required"},A("title")]},{id:"subtitle",type:"text",value:t.subtitle,limit:115,label:i.formatMessage({id:`${lt}subtitle_label`}),placeholder:i.formatMessage({id:`${lt}subtitle_placeholder`}),functions:{onChange:D},validation:[{condition:"required"},A("subtitle")]},{component:Yo,props:{formID:e,label:{visible:i.formatMessage({id:`${lt}body_label`})},showLabel:!0}},{component:tu,props:{id:`${e}-input`,value:p,placeholder:i.formatMessage({id:`${lt}body_placeholder`}),meta:{isInOverlay:d},autoFocus:!1,functions:{onChange:$=>{g($),D()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!f,"aria-errormessage":"error-message"}}];return m?T.push({component:zt}):T.push({component:k}),c.jsxs("section",{className:"publish-article-form",children:[c.jsx(Jt,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1},functions:{onSuccess:async $=>{if(!s||!s.id||!E)return;ms&&clearTimeout(ms),h(!0);const P={...$,body:p};try{o&&await o(P),ms=setTimeout(()=>{C(i.formatMessage({id:`${lt}aria_success`})),l(P)},500)}catch{b(i.formatMessage({id:`${lt}error`})),C(""),u()}},onFailure:u},fields:T,intlPath:lt,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:!s||!s.id||!E,text:{default:i.formatMessage({id:`${lt}cta_submit`}),submitting:i.formatMessage({id:`${lt}cta_submitting`}),submitted:i.formatMessage({id:`${lt}cta_submitted`})},customOnSubmit:f?c.jsx(c.Fragment,{}):c.jsx(XE,{})},gtm:a}),f&&c.jsx(ur,{id:"error-message",className:"error",children:typeof f=="string"&&f.includes(" ")?f:i.formatMessage({id:`${lt}error`})}),v&&c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,children:v})]})};const Ym=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=ae.useIntl(),u=y.useRef(null);or(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=m=>{m.preventDefault(),m.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:V("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Pe,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:m=>{m.key==="Enter"&&d(m)}}),c.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Pe,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Pe,{children:l.formatMessage({id:"search_cta"})})})]})})})},Vc=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},t_=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:a,state:i})=>{if(!e.form||!e.form.current)throw new Error("No refs.form");if(!e.form.current.checkValidity()){e.hiddenValidation&&e.hiddenValidation.current&&e.hiddenValidation.current.click();return}const s=t_(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...i.values}),a([{type:"showSuccessMessage",value:!0}])},r_=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,m=(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:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>m(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Vc({ref:i.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:pf,props:{email:d.email,type:d.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(h.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>m(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{m(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&h.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>c.jsx("small",{children:p})}),placeholder:u.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)||u.formatMessage({id:"signup_expectation"},{small:p=>c.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),h.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.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]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Vc({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),h};const a_=({className:e=""})=>c.jsxs("div",{className:V("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ae.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ae.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const i_={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},s_=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ae.useIntl(),{title:u=!0,expectation:d=!1,url:m=!0,logInButton:h=!0,successMessage:p=!0}=a,g={title:u,expectation:d,url:m,logInButton:h,successMessage:p},[f,b]=y.useReducer(Jr,i_),{validFields:v,emailDetails:C,shouldManuallyApprove:D,shouldDisableButton:A,showSuccessMessage:E,showError:k}=f,[T,$]=ao.useCookies(["signup-this-session","functional-cookie-consent"]),P={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{D===!0&&P.jobTitle.current&&P.jobTitle.current.focus()},[D]),y.useEffect(()=>{T["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[T]),y.useEffect(()=>{E&&T["functional-cookie-consent"]&&$("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const z=y.useMemo(()=>r_({placeholders:n,labels:t,shouldShow:g,functions:r,refs:P,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,P,g,f]),L=A?!0:D?!Object.values(v).every(B=>B===!0):!v.name||!v.email||["exists","pending","verify"].includes(C.boxType);return g.successMessage&&E?c.jsx(a_,{className:e}):c.jsxs("fieldset",{className:V("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ae.FormattedMessage,{id:"signup_title"})}),k&&c.jsx(Cn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Jt,{className:"signup-form",formRef:P.form,id:"sign-up-form",fields:z,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:L?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:`/api/next-ui/login?returnTo=${window.location.pathname}`,"data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await n_({refs:P,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:B=>{r.handleError(B),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:P.hiddenValidation})]})};const En=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default",padding:i="none"}=n;return c.jsx("section",{className:V("full-width-section",t,{[a]:a!=="default",[i]:i!=="none"}),...r,children:e})};const o_=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable new","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),c.jsx(En,{className:V("download-section",n),styling:{background:"dark"},children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(pr,{buttons:r})]})})};const ro="editSection_";function Gm({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const u_=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ae.useIntl();return c.jsxs(_t,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${ro}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(Ee,{href:r,variant:"secondary",size:"small",onClick:()=>Gm({href:r,setShowModal:i}),children:n||s({id:`${ro}placeholder_cta`})})})]})},l_=({children:e,className:t="",formProps:n,formComponent:r,href:a,title:i,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=ae.useIntl(),[m,h]=y.useState(!1),p=()=>h(!1),g=!!n||!!r,f=typeof a=="string"||g;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{p()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),p()}}})),c.jsxs("section",{className:V("edit-section",t),children:[g&&c.jsx(ln,{title:o||`Edit ${i}`,isOpen:m,showDivider:!1,showIcon:!1,functions:{onClose:p},className:V("edit-section-modal"),children:b||(n?c.jsx(Jt,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async v=>{var C,D;(C=n==null?void 0:n.functions)!=null&&C.onSuccess&&await((D=n==null?void 0:n.functions)==null?void 0:D.onSuccess(v)),h(!1)},onCancel:p}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:V("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:i}),f&&c.jsx(Ee,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Gm({href:a,setShowModal:h}),children:d({id:`${ro}edit`})})]}),e||c.jsx(u_,{...l,href:a,setShowModal:h,showEditButton:f}),u&&c.jsx(zt,{})]})};const c_=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:V("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:V("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:V({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%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 hs;const ps="contactFooter_",d_=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,a]=y.useState(0),[i,s]=y.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(hs),hs=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(hs),window.removeEventListener("resize",l)}),[]),c.jsx(En,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ae.FormattedMessage,{id:`${ps}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(ae.FormattedMessage,{id:`${ps}text`})}),c.jsx(xn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ae.FormattedMessage,{id:`${ps}email`})})]}),c.jsx(Hm,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},f_=({activeLink:e,profile:t,...n})=>c.jsx(En,{children:c.jsx(mf,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(ff,{activeLink:e,profile:t}),c.jsx(wd,{...n})]})})});const gs="cookieBanner_",vs=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],bs=new Date(Date.now()+12*30*24*60*60*1e3),Qm=()=>{const e=ae.useIntl(),[t,n,r]=ao.useCookies(vs),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{vs.forEach(d=>{n(d,!0,{path:"/",expires:bs,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:bs}),vs.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:bs});return}r(d)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${gs}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${gs}title`})}),c.jsx("p",{children:e.formatMessage({id:`${gs}text`})}),c.jsx(pr,{buttons:u})]})},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:["correspondence","registered","berlin","support","business"],correspondence:{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_",ri="SiteFooter",Hc=({group:e})=>{const t=nn[e].order||[];let n=!1;return"text"in nn[e]&&(n=nn[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ae.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:a,gtmType:i}=nn[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":ri,"data-gtm-event-type":i,...s,children:c.jsx(ae.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(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(ae.FormattedMessage,{id:`${rr}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ae.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":ri,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},nu=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(oi,{element:"hr"}),c.jsx(ko,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":ri,"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(Hc,{group:e}),Object.keys(nn[e]).includes("child")&&c.jsx(Hc,{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":ri,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ae.FormattedMessage,{id:`${rr}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ae.FormattedMessage,{id:`${rr}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),qe={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e===Et.ACCOUNT&&t===!1&&n[Et.SITE]===!0)return;const i=Date.now();if(!a&&!t&&qe.handlerCalled[e]&&i-qe.handlerCalled[e]<500)return;qe.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case 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 a=Jc(e[r],t);if(!(typeof a>"u")&&(!n||a[t]&&a[t].includes(n)||a.value&&a.value.includes(n)||a.toString().includes(n)))return e[r]}return e[0].children?qe.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case Et.SITE:if(n){const u=qe.findFirstChild(t.current.children,"className","has-submenu parent"),d=qe.findFirstChild(u.children,"id",Et.SITE);s=qe.findFirstChild(d.children,"href")}else s=qe.findFirstChild(t.current.children,"href");break;case Et.ACCOUNT:if(o=qe.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=qe.findFirstChild(o.children,"href");break;default:return}s&&(a([{type:`focusElements.${e}.${i}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(qe.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(qe.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(qe.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{qe.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Qr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/api/next-ui/login",withReturnTo:!0},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},ai=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ae.useIntl(),o=Jc(Qr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,d=e.includes("buttons.");let m=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(m+=`_logged${t?"In":"Out"}`);let h=!1;if(o.href){let D=o.gtmType||`${e}-click`;if(D.includes(".")){const A=D.split("."),E=A[A.length-2];D=`${E==="topics"?`${E}-`:""}${A[A.length-1]}`}h={href:o.withReturnTo?`${o.href}?returnTo=${window.location.pathname}`:o.href},u&&(h={...h,className:"gtm-trackable","data-gtm-event-type":D,"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={},C={};if(f&&(b={...b,"aria-current":"page"}),p){const D=o.menuId||e,A={onClick:E=>qe.events.onClick(E,{id:D,callback:a,isOpen:r[D]}),onFocus:()=>qe.events.onFocus({id:D}),onBlur:()=>qe.events.onBlur({id:D,callback:a}),onMouseLeave:()=>qe.events.onBlur({id:D,callback:a}),onMouseEnter:()=>qe.events.onMouseEnter({id:D,callback:a})};v={...A,id:D===Et.SITE?Et.SITE:Et.ACCOUNT},n&&(g&&(C={...A,className:"navigation-button",onKeyPress:E=>{E.key==="Enter"&&qe.events.onClick(E,{id:D,callback:a,isOpen:r[D]})},"aria-haspopup":!0,"aria-expanded":r[D],"aria-controls":D}),v={...v,hidden:D in r?!r[D]:!0}),g||(v={...v})}return c.jsxs("li",{className:V({[o.className]:o.className,"has-submenu":p,parent:g,active:f}),...b,children:[h?y.createElement(d?Ee:"a",h,s.formatMessage({id:m})):n&&o.order&&g?c.jsxs("button",{...C,children:[s.formatMessage({id:m}),c.jsx(Pe,{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(D=>{if(!o[D])return null;const A={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[D].order?c.jsxs("li",{className:V({[o[D].className]:o[D].className}),children:[s.formatMessage({id:`${m}_${D}`}),c.jsx("ul",{children:o[D].order.map(E=>c.jsx(ai,{id:`${e}.${D}.${E}`,...A},E))})]},D):c.jsx(ai,{id:`${e}.${D}`,...A},D)})})]},e)};const m_={height:67,height_desktop:83};var Et=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(Et||{});const ru=({showNavigation:e=!0})=>{const t=ae.useIntl(),n=y.useContext(it),r=$n(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>qe.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(Jr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,m=y.useRef(s);y.useEffect(()=>{m.current=s},[s]),id({scrollPosition:m_[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const v=m.current.menus;!i&&v["site-navigation"]||qe.shouldChangeHeaderIsVisible(!0,v,o)},scrollDown:()=>{const v=m.current.menus;!i&&v["site-navigation"]||qe.shouldChangeHeaderIsVisible(!1,v,o)}}});const h=(v,C,D=!1)=>{qe.handleMenus({id:v,value:C,menus:m.current.menus,dispatch:o,forceHandle:D})},p=y.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(C=>{m.current.menus[C]&&h(C,!1,!0)})};y.useEffect(()=>{var v;return(v=document.getElementById("header"))==null||v.addEventListener("keydown",g),()=>{var C;(C=document.getElementById("header"))==null||C.removeEventListener("keydown",g)}},[]),or(()=>{u["site-navigation"]&&qe.autoFocus({menu:"site-navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),or(()=>{u["account-navigation"]&&qe.autoFocus({menu:"account-navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),h("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Pe,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(Ym,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:v=>{v.preventDefault(),v.stopPropagation(),h("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Pe,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Qr.order.map(v=>c.jsx(ai,{id:v,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:h},v))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:V({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(Pe,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(ko,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),a?c.jsxs("button",{className:"account-button",onClick:v=>qe.events.onClick(v,{id:"account-navigation",callback:h,isOpen:u["account-navigation"]}),onMouseEnter:()=>qe.events.onMouseEnter({id:"account-navigation",callback:h}),onMouseLeave:()=>qe.events.onBlur({id:"account-navigation",callback:h}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Pe,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(un,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:Qr.buttons.order.map(v=>c.jsx(ai,{id:`buttons.${v}`},v))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:V("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const h_=()=>{const e=ae.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(ru,{}),c.jsx("div",{id:"content",children:c.jsx(Cn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(nu,{})]})},Jm=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:d="default",variant:m="default",circle:h="default",modal:p="default"}=i,g=nd(),[f,b]=y.useState(""),v=k=>{const{detail:{message:T}}=k;b(T)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const C=Aa(e,{locale:o}),D=Aa(t,{locale:o}),A=Aa(n,{locale:o}),E={};return d!=="default"&&(E[d]=!0),m!=="default"&&(E[m]=!0),h!=="default"&&(E[h]=!0),c.jsx(yh.ErrorBoundary,{onError:r,fallback:c.jsx(h_,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:V(s,E,{"has-footer":u}),children:[c.jsx(ru,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[D&&c.jsx("div",{className:V("additional-content prepended",{"large-modal":p==="large"}),children:D}),y.createElement(d==="bold"?po:"div",{id:"content",children:C,className:V({"large-modal":p==="large"})})]}),A&&c.jsx("div",{className:"additional-content appended",children:A}),u&&c.jsx(nu,{}),c.jsx(Qm,{})]}),f&&c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Kc={default:"tags_",headerTopics:"header_topics_topics_"},ys={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"},p_={getTagDetails:e=>{if(e.includes("topic_")){if(e=ys.topic[e.replace("topic_","")],e){const t=Qr.topics.topics[e].href;return t?{id:e,href:t,text:`${Kc.headerTopics}${e}`}:null}return null}return ys[e]?(e=ys[e],{id:e,text:`${Kc.default}${e}`}):null}};const g_=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ae.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=p_.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:V("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:d}):d},u.id)})})};const Xm=25,v_=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:a=!1,loadNextPage:i=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:d=!1,className:m=""})=>{const h=ae.useIntl(),p="membersList",g=y.useContext(it),[f,b]=y.useState(!1);return e.length===0&&!d?null:c.jsxs("div",{className:V("members-list",m),children:[u?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:l,badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:n||""},{scope:ct.Platform,area:"all"}]}}),c.jsx(xn,{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,C)=>c.jsxs("li",{children:[c.jsx(an,{member:v,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:n||""},{scope:ct.Platform,area:"all"}]}}),v.isAdmin&&c.jsx(Yt,{children:h.formatMessage({id:`${p}_admin`})})]},C)),d&&e.length===0&&t>0?[...new Array(Math.min(t,Xm))].map((v,C)=>c.jsx("li",{children:c.jsx(di,{layout:"member"})},C)):c.jsx(c.Fragment,{})]}),a&&c.jsx(Xr,{hasNextPage:a,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(wi,{form:s,showModal:f,content:{title:h.formatMessage({id:`${p}_modal_title`})},functions:{onClose:()=>{b(!1)}}}):c.jsx(c.Fragment,{})]})},eh=v_,b_=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ae.useIntl();return t?c.jsx("small",{children:Rt(a.formatMessage,`${e}explainer`,n,"action",{a:i=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):c.jsx(c.Fragment,{})},y_=({intlPath:e,type:t,...n})=>{const r=ae.useIntl();return c.jsx(Yo,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:Rt(r.formatMessage,`${e}label_action`,t,"action")},...n})},Zc=5,Yc=2,x_=e=>{var r;let t=0;const n=[];return(r=e==null?void 0:e["poll-options"])==null||r.forEach((a,i)=>{a!==""&&(t++,n.push({position:t,description:{en:a}}))}),{title:{en:e.title},options:n,settings:{allow_multiple_votes:e["multiple-answers"]||!1}}};let wa=null;const Ge="discussion_form_",ta=({id:e,parentId:t,content:n={type:Ae.Response,slugs:{}},userHasPermissions:r=!0,meta:a,placeholder:i,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},functions:u,data:d={},gtmContext:m="DiscussionForm"})=>{var We,Y,oe;const h=ae.useIntl(),p=y.useContext(it),[g,f]=y.useState(n.type),[b,v]=y.useState(""),{isLoading:C=!1,isInWrapper:D=!1,isInOverlay:A=!1,isAutoFocused:E=!1,isEditing:k=!1,hasTitleField:T=!1,canBePrepopulated:$=!1,isPrepopulated:P=!1,showTitle:z=!1,showGuidelines:L=!0,showDivider:B=!1,showSuccessMessage:F=!0,showPostType:j=!1,postCategories:O=[]}=a||{},{onChange:q=()=>{},create:W=()=>{},createPoll:ne=()=>{},handleSaveEdit:J=()=>{},handleCancel:w=()=>{},callback:Q=()=>{},onMention:se=()=>{},listMembers:_=()=>Promise.resolve([]),clickMentionFallback:M=()=>{},getLinkPreview:U=()=>Promise.resolve({}),props:S={create:{projectNames:["questions-answers"]}}}=u,[R,K]=y.useState({body:k&&k.text||P&&P.text||"",data:d!=null&&d.link?{link:d==null?void 0:d.link}:{}}),[Z,re]=y.useState(l.error||!1),ce={status:!1,title:T&&T.text||"",polls:0},[X,pe]=y.useState(ce);if(y.useEffect(()=>{$&&!k&&P&&P!==R.body&&K(ie=>({...ie,body:P.text||""}))},[P]),y.useEffect(()=>{f(n.type)},[n.type]),C)return c.jsx(Nt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const ve=(ie,me)=>{K(ke=>({...ke,body:ie,data:{link:me}})),q({body:ie});let ge;!p||!p.id?ge=Rt(h.formatMessage,`${Ge}error_loggedOut`,g,"action"):r?s>0&&ie.length>=s&&(ge=`${Ge}error_tooLong`):ge=Rt(h.formatMessage,`${Ge}error_noPermission`,g,"action"),ge?re(ge):Z&&re(!1)};let ye=`${g}-form`;if(g===Ae.Response||g===Ae.Reply){const ie=((We=n.slugs)==null?void 0:We.reply)||((Y=n.slugs)==null?void 0:Y.answer)||((oe=n.slugs)==null?void 0:oe.question)||"";ie&&(ye=`${ye}-${ie.slice(-15)}`)}e&&(ye=`${e}-${ye}`);const Me=async ie=>{if(!p||!p.id||!r||Le)return;wa&&clearTimeout(wa),pe(ge=>({...ge,status:"submitting"}));const me=window.location.pathname;try{let ge;switch(g){case Ae.Post:ge=await W({title:ie.title,content:ie.body,categories:ie.categories,data:ie.data});break;case Ae.Poll:ge=await ne(x_(ie));break;case Ae.Question:ge=await W({title:ie.body,authorId:p&&p.id,data:ie.data,...S==null?void 0:S.create});break;case Ae.Response:ge=await W({questionSlug:n.slugs.question},{body:ie.body,authorId:p&&p.id,contentPath:me,data:ie.data});break;case Ae.Reply:ge=await W({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:ie.body,authorId:p&&p.id,contentPath:me,data:ie.data});break;default:break}await jh(1e3),Q&&await Q(ge),wa=setTimeout(()=>{K({body:"",data:{}}),f(Ae.Post),pe(ze=>({...ze,status:"submitted"})),v(Rt(h.formatMessage,`${Ge}success`,g,"action"));const ke=new Event(rt.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(ke),je()},500)}catch(ge){const ke=ge;let ze=`${Ge}error`;ke!=null&&ke.message.includes("entry already exists")&&(ze=Rt(h.formatMessage,`${Ge}error_alreadyExists`,g,"action")),ke!=null&&ke.message.includes("429")?ze=Rt(h.formatMessage,`${Ge}error_tooMany`,g,"action"):ke!=null&&ke.message.includes("400")&&(ze=`${Ge}error`),re(ze),je()}},je=()=>{wa=setTimeout(()=>{re(!1),pe(ce),v("")},5e3)},Je=!R.body||!La(R.body),Ue=!X.title||!La(X.title);let Le=!1;g!==Ae.Poll&&(Le=Je),T&&(Le=Le&&Ue);const Xe=X.status==="submitting",_e=[];g===Ae.Poll?_e.push({id:"poll-options",label:h.formatMessage({id:`${Ge}option_label`}),type:"multiple-inputs",element:"textarea",placeholder:h.formatMessage({id:`${Ge}option_placeholder`}),limit:250,multipleInputs:{showCount:!0,defaultInputs:Yc,maxInputs:Zc,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:h.formatMessage({id:`${Ge}option_cta`})}},styling:{autosizeToFit:!0},functions:{onChange:ie=>{var ge;let me=0;ie&&Array.isArray(ie)&&(me=((ge=ie==null?void 0:ie.filter(ke=>ke!==""))==null?void 0:ge.length)||0),X.polls!==me&&pe(ke=>({...ke,polls:me})),q({polls:ie})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:h.formatMessage({id:`${Ge}multiplePollAnswers`}),className:"text-medium"}):_e.push({component:y_,props:{formID:ye,intlPath:Ge,showLabel:T!==!1,type:g}},{component:tu,props:{id:`${ye}-input`,value:X.status==="submitting"&&!Z?"":R.body,placeholder:i||Rt(h.formatMessage,`${Ge}placeholder`,g,"action"),maxLength:s,meta:{isInOverlay:A},functions:{onChange:ve,onChangeData:ie=>{K(me=>({...me,data:ie}))},onMention:se,listMembers:_,clickMentionFallback:M,getLinkPreview:U},data:d,autoFocus:k!==!1||E&&!T,"aria-invalid":!!Z,"aria-errormessage":"error-message"}},{component:b_,props:{intlPath:Ge,showGuidelines:L,type:g,gtmContext:m}}),B&&_e.push({component:zt}),T&&_e.unshift({id:"title",type:"text",value:T.text,limit:g===Ae.Poll?0:250,label:h.formatMessage({id:`${Ge}${g===Ae.Poll?"question":"titleField"}_label`}),placeholder:h.formatMessage({id:`${Ge}${g===Ae.Poll?"question":"titleField"}_placeholder`}),functions:{onChange:ie=>{pe(me=>({...me,title:ie})),q({title:ie})}},validation:g===Ae.Poll?[{condition:"required"}]:[]}),j&&_e.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:h.formatMessage({id:`${Ge}postType_label`}),options:O.map(ie=>({id:ie.slug,label:ie.name})),validation:[{condition:"required"}],functions:{onChange:ie=>{q({postType:ie}),ie.includes(Ae.Poll)?f(Ae.Poll):g!==Ae.Post&&f(Ae.Post)}}});let Oe=!p||!p.id||!r||Xe;if(g===Ae.Poll){const ie=X.polls;Oe=Oe||Ue||ie<Yc||ie>Zc}else Oe=Oe||Le,k&&(T?Oe=Oe||R.body===k.text&&X.title===T.text:Oe=Oe||R.body===k.text);return c.jsxs(c.Fragment,{children:[c.jsxs(Jt,{id:ye,className:V("discussion-card discussion-form",{"no-styling":D&&k}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:k&&!Xe||l.cancel},functions:{onSuccess:async ie=>{const me={...R,...ie};if(k){pe(ge=>({...ge,status:"submitting"})),J(me);return}await Me(me)},onCancel:w},fields:_e,intlPath:Ge,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"data-gtm-event-type":`${k?"save":"submit"}-${g}-click`,"data-testid":"save-button",disabled:Oe,text:{default:!k&&(o!=null&&o.submit)?o==null?void 0:o.submit:h.formatMessage({id:`${Ge}${k?"save":"post"}`}),submitting:h.formatMessage({id:`${Ge}${k?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"data-gtm-event-type":`cancel-${g}-click`,disabled:!l.cancel&&(!p||!p.id||!R.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:h.formatMessage({id:`${Ge}cancel`})},gtm:{context:m,event:`${g}-form`},"data-testid":`discussion-${g}-form`,children:[z&&!k&&g===Ae.Question&&c.jsx("h2",{children:Rt(h.formatMessage,`${Ge}title`,g,"action")}),c.jsx(an,{member:p?{...p,link:!1}:"community",gtmContext:m,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:t||""},{scope:ct.Platform,area:"all"}]}})]}),X.status==="submitted"&&F&&c.jsx(ur,{className:"success","data-testid":"success",children:Rt(h.formatMessage,`${Ge}success`,g,"action")}),Z&&c.jsx(ur,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof Z=="string"?Z.includes(" ")?Z:h.formatMessage({id:Z},{action:h.formatMessage({id:`discussion_action_${g}`}),maxLength:s}):Z}),b&&c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,children:b})]})},C_=Object.freeze(Object.defineProperty({__proto__:null,default:ta},Symbol.toStringTag,{value:"Module"})),xs=({children:e,class:t,...n})=>{const r={...n,class:V("subtle",t)};return c.jsx("blockquote",{...r,children:e})};const w_={showForm:!1},Ci=y.createContext(w_),th=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(Ci.Provider,{value:{...t,updateConversation:n},children:e})},Da="discussion_",D_=195;let Ea=null;const na=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:a=!1,originalAuthorId:i,forceHide:s,functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:m,isTruncated:h=!1,setFocus:p=!1,isCommunity:g=!1,badges:f,basePath:b,parentId:v})=>{var Le,Xe,_e,Oe,We,Y,oe,ie,me,ge,ke,ze,ot,At,vt,tt;const C=ae.useIntl(),D=y.useContext(Ci),A=y.useContext(it),{createContent:E=async()=>{},deleteContent:k=async()=>{},updateContent:T=async()=>{}}=o.content||{},{createLike:$=()=>{},deleteLike:P=()=>{},listLikes:z=async()=>({})}=o.likes||{},{openComments:L=()=>{}}=o.comments||{},{listMembers:B=()=>Promise.resolve([]),clickMentionFallback:F=()=>{}}=o.form||{},{author:j,canLike:O,createdAt:q,id:W,likes:ne=0,userLiked:J,comments:w=0,data:Q}=t,se=A&&A.id&&typeof j!="string"&&j.id&&j.id===A.id||!1,_=typeof O=="boolean"?O:!0,M=se&&(!t.createdAt||Th(t.createdAt,10,"seconds")),U=y.useRef(null),[S,R]=y.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[K,Z]=y.useState(!1),[re,ce]=y.useState(M?"highlighted":"default"),[X,pe]=y.useState("");y.useEffect(()=>{const Ce=U.current;if(!(!Ce||re==="default"))return document.addEventListener(rt.DISCUSSION_FORM_SUBMITTED,ve),Ce.addEventListener("transitionend",ye),()=>{document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,ve),Ce.removeEventListener("transitionend",ye)}},[]),y.useEffect(()=>{R(Ce=>({...Ce,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),y.useEffect(()=>{(async()=>{const Be=await Do(S.body,h,Q==null?void 0:Q.mentions,B);R(It=>({...It,postBody:Be}))})()},[S.body,Q==null?void 0:Q.mentions]);const ve=()=>{setTimeout(()=>{ce("fading")},1e3)},ye=({propertyName:Ce})=>{Ce==="background-color"&&ce(Be=>(Be==="default"&&(document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,ve),U.current&&U.current.removeEventListener("transitionend",ye)),Be==="fading"?"default":Be))};if(a||!t||t.type===Ae.Answer&&(!t.slugs||!t.slugs.question)||S.postBody===""&&t.title==="")return c.jsx(Nt,{className:"discussion-card"});const Me=async({title:Ce,body:Be,data:It})=>{Ce||(Ce=""),Be||(Be=""),pe("");try{if(!Ra(Ce,S.title)||!Ra(Be,S.body)){const bt=t.type===Ae.Question?{title:Be}:{title:Ce,body:Be,data:It};await T(Ps(t.slugs),bt)}R(bt=>({...bt,title:Ce||"",body:Be||"",data:{...bt.data,...It},isEditing:!1,didEdit:!0}))}catch{pe(`${Da}form_error`)}},je=()=>{if(D&&D.updateConversation){const Ce={showForm:!0},Be=t.author;Be&&Be.id&&(g&&(Ce.prepopulateForm=`@{{${Be.id}}}`),Ce.mentionData={id:Be.id,name:Be.name}),D.updateConversation(Ce)}setTimeout(()=>{var _n,Xt,Un;const Be=`reply-form-${(t.type===Ae.Answer?t.slug:((_n=t.slugs)==null?void 0:_n.reply)||((Xt=t.slugs)==null?void 0:Xt.answer)||((Un=t.slugs)==null?void 0:Un.question)||"").toLowerCase().slice(-15)}`,It=document.getElementById(Be),bt=document.getElementById(`${Be}-input`);bt&&bt.focus(),It&&It.scrollIntoView({behavior:"smooth"})},0)},Je=async()=>{Z(!1);try{await k(Ps(t.slugs))}catch{pe("delete-error")}},Ue=[];return n&&se&&Ue.push({text:C.formatMessage({id:`${Da}moreMenu_edit`}),onClick:()=>R(Ce=>({...Ce,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`},{text:C.formatMessage({id:`${Da}moreMenu_delete`}),onClick:Ce=>{Ce.preventDefault(),Ce.stopPropagation(),Z(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...Zd(`delete-${t.slug}-modal`,K)}),r&&o.pins&&Ue.push({text:C.formatMessage({id:`${Da}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&&((Le=U==null?void 0:U.current)==null||Le.focus(),(Xe=U==null?void 0:U.current)==null||Xe.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:V("discussion-post",u,{[re]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!S.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:U,tabIndex:p?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:Ce=>{if(!l.post||S.isEditing)return;Ce.preventDefault(),Ce.stopPropagation(),Ea&&clearTimeout(Ea),Ea=setTimeout(()=>{window.location.href=l.post},150);const Be=new CustomEvent(rt.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:Ea}});document.dispatchEvent(Be)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:W||t.slug,className:V("discussion-card",t.type,{editing:S.isEditing,"has-link":l.post&&!S.isEditing}),children:[!S.isEditing&&c.jsxs("div",{className:"author-section",children:[c.jsx(an,{member:j,additionalContent:{createdAt:q,didEdit:S.didEdit,customMessage:(_e=t.componentProps)!=null&&_e.member.additionalContent?(Y=(We=(Oe=t.componentProps)==null?void 0:Oe.member)==null?void 0:We.additionalContent)==null?void 0:Y.customMessage:{}},className:typeof j!="string"&&j.id===i?"highlighted":"",styling:{additionalContentNewLine:!!((oe=t.componentProps)!=null&&oe.member.additionalContent&&((ge=(me=(ie=t.componentProps)==null?void 0:ie.member)==null?void 0:me.additionalContent)!=null&&ge.customMessage))},gtmContext:d,gtmType:"profile-click",badges:f}),t.pinned&&c.jsx(Yt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Pe,{children:"Pinned Post"})})]}),S.isEditing?c.jsx(ta,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:S.title!==""?{text:S.title}:!1,isEditing:{text:S.body,categories:[]},canBePrepopulated:g,isPrepopulated:!1},maxLength:t.type===Ae.Question?250:5e4,forceShow:{error:X!==""&&X!=="delete-error"?C.formatMessage({id:X},{action:C.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:E,handleSaveEdit:Me,handleCancel:()=>{pe(""),R(Ce=>({...Ce,isEditing:!1}))},listMembers:B,clickMentionFallback:F},gtmContext:`${d}Form`,data:Q}):c.jsxs(c.Fragment,{children:[l.post?c.jsxs("a",{href:l.post,children:[(S==null?void 0:S.title)&&c.jsx("p",{className:"content-title",children:S==null?void 0:S.title}),S.postBody.length>D_?c.jsx(Cd,{text:S.postBody,markdownOptions:{overrides:{a:Bs,blockquote:{component:xs}}}}):c.jsx(On,{options:{overrides:{a:Bs,blockquote:{component:xs}}},children:S.postBody})]}):c.jsxs(c.Fragment,{children:[(S==null?void 0:S.title)&&c.jsx("p",{className:"content-title",children:S==null?void 0:S.title}),c.jsx(On,{options:{wrapper:t.type===Ae.Question?"h1":y.Fragment,forceWrapper:t.type===Ae.Question,forceInline:t.type===Ae.Question,forceBlock:t.type!==Ae.Question,overrides:{blockquote:{component:xs}}},children:S.postBody})]}),(ke=S.data)!=null&&ke.link?c.jsx(_o,{data:S.data.link}):c.jsx(c.Fragment,{}),(ze=t.categories)!=null&&ze.length?c.jsx("ul",{className:"categories-list",children:t.categories.map(Ce=>c.jsx(Yt,{size:"small",element:"li",children:Ce.name},Ce.slug))}):c.jsx(c.Fragment,{})]}),!S.isEditing&&!(s!=null&&s.actionBar)&&c.jsx(lf,{className:t.type,gtmContext:d,contentType:t.type,likes:s!=null&&s.likes?!1:{count:ne||0,userLiked:J||!1,canLike:_,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:$,deleteLike:P,listLikes:z},basePath:b,parentId:v},comments:!(s!=null&&s.comments)&&([Ae.Question,Ae.Post].includes(t.type)||l.comments)?{count:w||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof L=="function"&&L()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{functions:{onClick:je}}:!1,shareLink:{url:`${window.location.origin}${(ot=t.slugs)==null?void 0:ot.question}/${(At=t.slugs)==null?void 0:At.answer}${(vt=t.slugs)!=null&&vt.reply?`#${(tt=t.slugs)==null?void 0:tt.reply}`:""}`},moreMenu:{options:Ue,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:K,functions:{onOpen:()=>{},onClose:()=>Z(!1)},forceShow:{error:X==="delete-error"?C.formatMessage({id:"discussion_delete_error"},{action:C.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:C.formatMessage({id:"discussion_delete_title"},{action:C.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>Z(!1),children:C.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:Je,children:C.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:c.jsx(ae.FormattedMessage,{id:"discussion_delete_text",values:{p:Ce=>c.jsx("p",{children:Ce}),action:C.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const E_=y.lazy(()=>Promise.resolve().then(()=>N_)),__=65,nh=({forceShow:e,form:t,className:n})=>{const r=ae.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(it)||"community",l=fi(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,m]=y.useState({form:u||gd("showPost")==="true"||!1,warning:!1}),[h,p]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!h.showCachedText)return;(async()=>{const v=await Do(h.title||h.body||"",__,h.mentions);p(C=>({...C,prettifiedText:v}))})()},[h.showCachedText,h.title,h.body]);const g=b=>{if(!h.showCachedText||typeof d.warning=="string")return;let v;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),v=b.detail.link;else{const C=b;C.preventDefault(),C.stopPropagation();const A=C.target.closest("a");v=A&&A.getAttribute("href")}m(C=>({...C,warning:v||!1}))};y.useEffect(()=>{if(!h.showCachedText){document.removeEventListener(rt.DISCUSSION_POST_CLICKED,g),document.removeEventListener(rt.MEMBER_CLICKED,g),document.removeEventListener("click",g);return}return document.addEventListener(rt.DISCUSSION_POST_CLICKED,g),document.addEventListener(rt.MEMBER_CLICKED,g),document.addEventListener("click",g),()=>{document.removeEventListener(rt.DISCUSSION_POST_CLICKED,g),document.removeEventListener(rt.MEMBER_CLICKED,g),document.removeEventListener("click",g)}},[h.showCachedText]),y.useEffect(()=>{const b=v=>{if(!(!h.showCachedText||d.warning!==!1))return v.preventDefault(),v.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[h.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return h.showCachedText&&(h.title||h.body)&&(f=h.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:V("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),m(v=>({...v,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(un,{name:l.name,src:l.image,alt:""}),c.jsx(On,{className:V("input",{placeholder:!h.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:f})]}),c.jsxs(gr,{children:[c.jsx(E_,{showModal:d.form,functions:{cacheText:p,onClose:()=>{m(b=>({...b,form:!1}))}},form:t,cachedText:h,className:"in-portal"}),c.jsx(ln,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{m(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{m({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":i}],children:c.jsx("p",{children:r.formatMessage({id:`${a}overlay_text`})})})]})]})},k_=y.lazy(()=>Promise.resolve().then(()=>C_)),au=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:a,required:i,join:s,leave:o,notMemberStateText:l}})=>{if(i&&!a)return c.jsx(Cn,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(bo,{isShort:!0,functions:{join:s,leave:o}})}});const{content:u,functions:d,meta:m,...h}=t,p={content:{type:(u==null?void 0:u.type)||"reply",slugs:(u==null?void 0:u.slugs)||{}},functions:{...d,create:(d==null?void 0:d.create)||(()=>{})},parentId:n,meta:{...m,isEditing:(m==null?void 0:m.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...h,id:`add-post-${h.id||""}`};return e?c.jsx(nh,{form:p}):c.jsx(k_,{...p})},iu=({form:e})=>{const t=y.useContext(it),n=ae.useIntl(),[r,a]=y.useState(!1),i=()=>{$h(t)||a(!0)};y.useEffect(()=>(document.addEventListener(rt.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(rt.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(wi,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const Cs="discussion_responses_",rh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ae.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${Cs}title`},{action:r.formatMessage({id:`${Cs}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:Rt(r.formatMessage,`${Cs}empty`,e,e)})]})};const ah=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ae.useIntl(),s=y.useContext(Ci),o=Aa(a,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:V("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(Xr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx(ta,{...r})]})};function F_(e,t){var n;if(e==="poll")if(t&&((n=t["poll-option"])==null?void 0:n.length)>0)t["poll-option"].some(r=>r.own_children&&r.own_children["poll-vote"]&&r.own_children["poll-vote"].length>0);else return!1;return!0}function A_({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({content:a,title:i})=>t(s=>(s&&(a!=null&&(s.content=a),i!=null&&(s.title=i)),s)),onError:n});return r}function B_({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=Ke.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function T_({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=Ke.useQueryClient(),l=ci(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:yo(u),mutate:xo(u)},user:l,...u},m=A_({...d,mutationFn:t}),h=S_({...d,mutationFn:n}),p=j_({...d,mutationFn:r}),g=O_({...d,mutationFn:a}),f=P_({...d,mutationFn:i}),{activity:b,...v}=B_({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:m,like:h,unlike:p,pin:g,unpin:f},user:l,...v}}function S_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ha({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ha({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function j_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Qd({activity:s,user:r}),s)),onError:n});return a}function O_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ka({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ka({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function P_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&Jd({activity:s,user:r}),s))),onError:n});return a}const M_=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},likes:o,reactions:l,form:u,join:d,leave:m},profile:h,categories:p})=>{var W,ne,J,w,Q,se;const g=ae.useIntl(),{activity:f,error:b,isLoading:v,mutations:{edit:C,like:D,unlike:A,pin:E,unpin:k}}=T_({queryFns:s,queryKey:[e,t,n]});if(v)return c.jsx(Nt,{style:{height:"400px"}});if(b||!f)return c.jsx(Cn,{variant:"error",text:g.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:T,verb:$,latest_reactions:P,mentioned_users:z,additional_data:L}=f,B=(((W=P==null?void 0:P.like)==null?void 0:W.length)||0)>0,F=(((ne=T==null?void 0:T.like)==null?void 0:ne.length)||0)>0,j=F?T==null?void 0:T.like[0].id:"",O=B?(J=P==null?void 0:P.like)==null?void 0:J.map(_=>{var M,U,S;return{id:(M=_==null?void 0:_.user)==null?void 0:M.id,name:(S=(U=_==null?void 0:_.user)==null?void 0:U.data)==null?void 0:S.name}}):!1,q=f==null?void 0:f.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(na,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:Ae.Post,title:f==null?void 0:f.title,body:f==null?void 0:f.content,categories:Eo((f==null?void 0:f.categories)||[],p||[]),canLike:r,createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:vr(q),userLiked:F,likes:((w=f==null?void 0:f.reaction_counts)==null?void 0:w.like)||0,comments:(f==null?void 0:f.total_replies)||0,peopleWhoLiked:O,data:{mentions:z,...L||{}},pinned:((Q=f==null?void 0:f.reaction_counts)==null?void 0:Q.pin)&&((se=f==null?void 0:f.reaction_counts)==null?void 0:se.pin)>0||!1},originalAuthorId:q==null?void 0:q.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(_,{title:M,body:U})=>C({title:M,content:U})},likes:{createLike:()=>D({activityId:n}),deleteLike:()=>A({activityId:n,reactionId:j}),listLikes:_=>o.list({activityId:n,..._})},comments:{openComments:()=>{}},pins:{createPin:()=>E({activityId:n}),deletePin:()=>{var _;return k({activityId:n,reactionId:(_=P==null?void 0:P.pin)==null?void 0:_[0].id})}},form:u},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a,badges:{showBadges:!0,scopes:[{scope:ct.Communities,area:t||""},{scope:ct.Platform,area:"all"}]},basePath:e,parentId:t},n),c.jsx(af,{basePath:e,parentId:t,activityId:n,showReplies:F_($,P),activityTotalReplies:(f==null?void 0:f.total_replies)||0,isMember:r,functions:{reactions:l,likes:o,form:u,join:d,leave:m},profile:h})]})};const ih=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=ae.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:m}=n,{title:h="",body:p="",mentions:g}=r||{},f="discussion-form-modal";return c.jsx(ln,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(h!==""||p!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:V("discussion-form-modal",a),children:c.jsx(ta,{...n,data:{...u,mentions:g||(u==null?void 0:u.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:i.formatMessage({id:`${s}cta`})},functions:{...m,onChange:b=>{l(v=>({...v,...b}))},onMention:({id:b,name:v}={})=>{if(!b||!v)return;const C=g||{};C[b]={created_at:"",updated_at:"",id:b,data:{name:v}},l(D=>({...D,mentions:C}))},create:async b=>{o(),m.create&&await m.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),m.handleSaveEdit&&await m.handleSaveEdit(b),l({showCachedText:!1})}}})})},N_=Object.freeze(Object.defineProperty({__proto__:null,default:ih},Symbol.toStringTag,{value:"Module"}));const I_=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:a,formLabel:i,ctaMessage:s,showIcon:o,onClose:l,reportError:u=()=>{},sendInvites:d})=>{const m=ae.useIntl();return a||(a=m.formatMessage({id:"inviteModal_formTitle"})),i||(i=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:l},className:V("invite-modal",e,{success:!!n}),children:c.jsx(Km,{title:a,label:i,messagePlaceholder:r,ctaMessage:s,onClose:l,sendInvites:d,reportError:u})})};const R_=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=ae.useIntl(),[l,u]=y.useState(gd("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(ln,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:V("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(Zm,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async m=>{var h;try{(h=i==null?void 0:i.functions)!=null&&h.onSuccess&&await i.functions.onSuccess(m)}finally{d()}}}})]})})},wi=R_,$_=Object.freeze(Object.defineProperty({__proto__:null,default:wi},Symbol.toStringTag,{value:"Module"}));const L_=({members:e})=>{const[t,n]=y.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return c.jsxs(c.Fragment,{children:[c.jsx(un,{name:i,src:l}),c.jsx("p",{children:i}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(a=>c.jsx("li",{children:c.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),c.jsx(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 z_=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:V("testimonial-block",a),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:V("author",{"text-small":!a.includes("new")}),children:e}),t&&c.jsx("p",{className:V("author-cite",{"text-small":!a.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),q_=y.memo(z_);const U_=({items:e=[],selector:t="",className:n=""})=>{const r=ae.useIntl(),[a,i]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&c.jsxs(_t,{variant:"subtle",className:V("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:a.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Di=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ae.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=`${i.formatMessage({id:`${s}hours`},{time:h})}${h>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${h>0?`${i.formatMessage({id:`${s}hours_short`},{time:h})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:m}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:m})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:V("time-to-complete",a),"aria-label":u,children:l})};const W_=({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(zn,{...n,className:V("banner",e),image:{...t,aspect:"banner"}})):null;const V_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],H_=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],m={eyebrow:"small",title:"h1",text:"p"},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:C}=t[b];if(C&&V_.includes(C.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(En,{className:V("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&a==="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:C=""}=h[b];return b==="text"?c.jsx(On,{overrideType:"text-only",className:"text",children:v},b):y.createElement(C,{key:b,className:b},v)}return null}),l,p&&c.jsx(Ee,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:V({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(zn,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},K_=y.memo(H_);const Z_=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(En,{className:V("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const Y_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(On,{children:n}):n;return c.jsxs(En,{className:V("highlight-section",t),children:[r&&c.jsx("div",{className:V("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(zn,{image:{...r,description:"",query:"q=85",aspect:"highlightSection"}})}),c.jsx("div",{className:V("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:V("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:c.jsx("div",{className:"content-default",children:a})})})]})},G_=y.memo(Y_);const Q_=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:c.jsxs("aside",{className:V("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(Ee,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),J_=({type:e,data:t})=>{const n=ae.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const m=a&&ks(a);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):oo(d)});if(o)return c.jsx(Yt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const m=u&&ks(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})})]})}return null},X_={title:66,text:3e3,secondaryText:1e3,partner:34},ii={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"}},ek=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const a=ae.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:m}=e,h=e.contentType;let p="";if((f=ii[h])!=null&&f.gtmEvent&&(p=ii[h].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(h==="people")return n?c.jsx(Ee,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(h)&&d!=="premium"){const v=i.loading||i.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),C=async D=>{if(D.preventDefault(),D.stopPropagation(),!(v||!t||!t.onClick)){s(A=>({...A,loading:!0}));try{const A=await t.onClick(e);s(A==="success"?()=>({registered:!0,loading:!1}):E=>({...E,loading:!1}))}catch{s(E=>({...E,loading:!1}))}}};return c.jsx("p",{className:V("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Ee,{onClick:C,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||a.formatMessage({id:`card_cta_${h}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};function tk({buildMemberData:e,communitySlug:t}){const n=ae.useIntl(),r=y.useContext(it),[a,i]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t,typeof(r==null?void 0:r.id)<"u").then(s=>{if(!s)return;const{membersCount:o,role:l="",pagination:u}=s;let d=0;o?d=o:u!=null&&u.total&&(d=u==null?void 0:u.total),i({count:d.toString(),isMember:!!l,memberType:l})})},[t,e]),c.jsxs("span",{className:"member-information",children:[a.isMember&&c.jsx(Yt,{size:"small",variant:"registered",icon:(a==null?void 0:a.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${a.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:a.count})})]})}const su=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,meta:l})=>{var F,j;const u=ae.useIntl(),d=y.useContext(it),m=!!(d!=null&&d.id),{isTabbable:h=!0,setFocus:p=!1}=l||{},g=y.useRef(null),[f,b]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,m).then(O=>{b({data:O,isLoading:!1})}).catch(()=>b(O=>({...O,isLoading:!1})))},[a,m,n]);const{data:v,isLoading:C}=f;if(C||!v)return c.jsx(Nt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:D}=v;if(!D||!ii[D])return c.jsx(Nt,{element:"li",className:"card-wrapper"});const{basePath:A="",className:E,length:k,gtmEvent:T}=ii[D];let $=h&&v.slug?`${A}${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")&&($=v.slug);const P=O=>{$&&(O.preventDefault(),O.stopPropagation(),window.location.href=$)},z={...X_,...k};let L={className:"card"},B={};return $&&(B={href:$,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`,"data-testid":"link"},v.openInNewTab&&(B.target="_blank"),L={onClick:P,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`}),p&&(L={...L,tabIndex:"0"},(F=g==null?void 0:g.current)==null||F.focus(),(j=g==null?void 0:g.current)==null||j.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:V("card-wrapper text-medium",E,t,{"has-link":$,"no-link":!$,"has-image":v.banner}),"data-testid":`${D}-card`,children:c.jsxs("div",{...L,ref:g,children:[c.jsx(bd,{className:"card-label",contentType:D,customIcon:v.isPrivate?"lock-locked":v.customIcon,customLabel:v.customLabel}),D==="communityPage"&&(v==null?void 0:v.createdAt)&&Sh(v==null?void 0:v.createdAt,60)&&c.jsx(Yt,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),v.startDate&&!v.isOngoingEvent&&c.jsx(Yt,{size:"small",variant:v.dateHasPassed?"default":"information","data-testid":"date",children:v.dateHasPassed?u.formatMessage({id:"card_ended"}):md(v.startDate)}),v.banner?c.jsxs("p",{className:"img",children:[v.registered&&c.jsx(Yt,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(zn,{image:{...v.banner,description:""}})]}):E==="people"?c.jsx(un,{name:v.title||"",src:v.profile,"data-testid":"people-profile-picture"}):null,v.contributors&&c.jsx(ho,{contributors:{data:v.contributors},styling:{size:"small",showGap:E!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(D)?u.formatMessage({id:`card_contributors_${D}`}):void 0,"data-testid":"contributors"}),v.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:v.partner.length>1?u.formatMessage({id:"card_partner"},{partner:v.partner[0],number:v.partner.length-1}):sr(v.partner[0],z.partner)}),["title","text","secondaryText"].map(O=>{const q=v[O];if(!q)return null;const W=ud(O),ne={key:O,className:W,"data-testid":W},J={wrapper:"p",forceWrapper:!0,forceInline:!0},w=sr(q,z[O]);return["title","text"].includes(O)&&$?(J.wrapper="a",c.jsx("p",{...ne,children:c.jsx(Zt,{options:J,...B,children:w})})):c.jsx(Zt,{options:J,...ne,children:w})}),a.contentType==="communityPage"&&(a.slug||v.slug)&&r&&c.jsx(tk,{communitySlug:a.slug||v.slug,buildMemberData:r}),c.jsx(J_,{type:E||"",data:v}),c.jsx(ek,{data:v,cta:i,link:$||"",gtmContext:s})]})})};const sh=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:V("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return c.jsx(su,{id:s,card:{...a,contentType:t[i]},meta:{setFocus:i===(r==null?void 0:r.focusCardIndex)},...r},s)})}),nk=(e,t,n,r)=>{const a=t*n<=e,i=e<t*(n+1),s=r.includes(Math.floor(e/t));return{inView:a&&i,isLoaded:s}},rk=({id:e,title:t})=>{const n=ae.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return y.createElement(a,{className:V("title",i,s,{"highlighted-title":i==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const ws={fourCards:1024,threeCards:769,twoCards:480};let _a=null,Ds=null;const ak=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ae.useIntl(),u="carousel_pagination_",[d,m]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:h,isLoading:p}=d,[g,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:v}=g,[C,D]=y.useState(""),A=t.length,E=Math.ceil(A/h),k=y.useRef(null),T=$n(!0,!0,k==null?void 0:k.current);y.useEffect(()=>{let F=1;T&&(T>=ws.fourCards?F=4:T>=ws.threeCards?F=3:T>=ws.twoCards&&(F=2),F>A&&(F=A)),m(j=>({...j,cardsPerPage:F,isLoading:!1}))},[T,A]);const $=(F="next")=>{Ds&&clearTimeout(Ds);let j=b;if(typeof F=="string")if(F==="next")if(b<E-1)j=b+1;else return;else if(b>0)j=b-1;else return;else j=F;D(""),f(q=>({...q,currentPage:j,loadedPages:[...new Set([...v,j])]}));const O=()=>{const q=j*d.cardsPerPage,W=q+d.cardsPerPage;return t.slice(q,W).length};Ds=setTimeout(()=>{D(l.formatMessage({id:`${u}ariaLive${typeof F=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof F=="string"?F:"next"}`}),slide:typeof F=="string"?1:F+1,count:O()}))},500)},P=F=>{_a=F.touches[0].clientX},z=F=>{if(_a===null)return;const j=F.touches[0].clientX,O=_a-j;O>5?$("next"):O<-5&&$("previous"),_a=null},L={"--width":`${T||0}px`,"--total-cards":A,"--cards-per-page":h,"--page":b};if(p)return c.jsx(di,{layout:`carousel${a?"-with-title":""}`});const B=(F,j)=>{var q;let O=null;return(q=F==null?void 0:F.sys)!=null&&q.id?O=`card-${F.sys.id}`:F!=null&&F.slug?O=`card-${F.slug}`:[n[j],F.contentType].includes("customCard")&&(O=`card-${window.btoa(`${F.title} ${F.createdAt}`)}-${j}`),O};return c.jsxs("section",{ref:k,className:V("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(rk,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:P,onTouchMove:z,style:L,"data-testid":"carousel-list",children:t.map((F,j)=>{let O=B(F,j);const{inView:q,isLoaded:W}=nk(j,h,b,v);return O&&(q||W)?c.jsx(su,{id:O,card:{...F,contentType:n[j]},buildCardData:r,gtmContext:s,meta:{isTabbable:q},...o},O):(O=O||`${e}-card-${j}`,c.jsx(Nt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},O))})}),E<=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(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:F=>{F.preventDefault(),F.stopPropagation(),$("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:b<=0})}),[...Array(E)].map((F,j)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:V("page-indicator",{selected:j===b}),onClick:O=>{O.preventDefault(),O.stopPropagation(),$(j)},children:c.jsx(Pe,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:j+1,total:E})})})},`page-indicator-${j}`)),c.jsx("li",{className:"arrow next",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:F=>{F.preventDefault(),F.stopPropagation(),$("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:b>=E-1})})]}),c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,children:C})]})]})},ik=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=i?window.btoa(i):`carousel-${u}`,m=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(di,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:c.jsx(zt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(ak,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),m?null:c.jsx(zt,{})]},`carousel-${d}`)});const sk=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:a,title:i,text:s,isPrivate:o,slug:l}=n;let u={};return l&&(u={onClick:m=>{l&&(m.preventDefault(),m.stopPropagation(),window.location.href=l)},tabIndex:"0","data-gtm-event-context":`${r}-NarrowCard`,"data-gtm-event-type":`${r}-click`}),y.createElement(e,{className:V("narrow-card",t,{"has-link":l,"gtm-trackable":l,"no-link":!l}),...u,children:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:V("img",{private:o,"no-image":!a}),children:a&&c.jsx(zn,{image:a})}),c.jsxs("div",{className:"content",children:[i&&c.jsx("p",{className:"title text-medium",children:i}),s&&c.jsx("p",{className:"text text-medium",children:s})]})]})})};const ok=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ae.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return y.createElement(e,{className:V("course-progression",o,{"highlight-percentage":d,"has-circle-graph":i==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:m=>c.jsx("strong",{children:m}),number:u})}),u<100&&a&&c.jsx(Di,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(mo,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const oh=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>y.createElement(e,{className:V("lesson-name",a),"data-number":`${t}.${n}`,children:r});const uh=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ae.useIntl(),o=ui(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):cd(a||"");return c.jsxs("small",{className:V("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:V("type",n),children:o})," ",t>0&&!r&&c.jsx(Di,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const uk=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const m=ae.useIntl(),h="courseStructure_",p=u.toLowerCase().includes("course conclusion");return c.jsxs(li,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[m.formatMessage({id:`${h}section${p?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?m.formatMessage({id:`${h}time_completed`}):c.jsx(Di,{time:s,appendedText:a?m.formatMessage({id:`${h}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:f,contentType:b,icon:v,image:C,isIntroduction:D,optional:A,slug:E,subsectionId:k,title:T,type:$})=>{const P=a&&t||D,z={};return C&&(z.style={"--image":`url(${C})`}),c.jsx("li",{className:V({article:b===Ar.ARTICLE,discussion:b===Ar.DISCUSSION,quiz:b===Ar.QUIZ,completed:g&&b===Ar.ARTICLE,locked:!P}),...z,children:c.jsx(xn,{href:P?`/microcourses/en/${o}/${E}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${ld(T)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(oh,{sectionId:i,subsectionId:k,title:T,className:"course-title"})," ",c.jsx(uh,{completionTime:f,icon:v,optional:A,type:$,children:d&&d[E]&&c.jsx("span",{className:"quiz-score",children:`${d[E]}%`})})]})})},E)})})]})};const lk=({isComplete:e=!1,onClick:t,...n})=>{const r=ae.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Ee,{...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:V("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},ck=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Gc=[{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 ka="notFoundError_",dk=()=>{const e=ae.useIntl(),t=[];return Gc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ka}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(Jm,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(En,{children:[c.jsx(sh,{cards:Gc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(Ee,{href:"/solution-articles/",children:e.formatMessage({id:`${ka}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${ka}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ka}text`})})]})};var si=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(si||{});const fk=(e,t,n)=>n===void 0?0:e.some(a=>a.hasUserVoted)?t?e.findIndex(a=>!a.hasUserVoted):e.findIndex(a=>a.hasUserVoted):0,mk=(e,t,n,r=0)=>{if(!e)return{nextElement:null,nextIndex:0};let a=n==="next"?e.nextElementSibling:e.previousElementSibling,i=r+(n==="next"?1:-1);for(;a;){if(!a.classList.contains(t))return{nextElement:a,nextIndex:i};a=n==="next"?a.nextElementSibling:a.previousElementSibling,i=i+(n==="next"?1:-1)}const s=e.parentElement;if(s)for(a=n==="next"?s.firstElementChild:s.lastElementChild,i=n==="next"?0:s.childElementCount-1;a&&a!==e;){if(!a.classList.contains(t))return{nextElement:a,nextIndex:i};a=n==="next"?a.nextElementSibling:a.previousElementSibling,i=i+(n==="next"?1:-1)}return{nextElement:null,nextIndex:0}};const hk=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:a=!1,showResults:i=!1,hasVotedOnPoll:s=!1,isTabbable:o=!1,functions:l})=>{var b;const[u,d]=y.useState(t.hasUserVoted);let m=0,h={};const p=(a||!s)&&!t.hasUserVoted;i&&(m=Math.round(t.numVotes/r*100)||0,h={"--vote-perc":`${m}%`});const g=v=>{v.stopPropagation(),p&&(l==null||l.createVote(t),d(!0))},f={htmlFor:t.id,className:V({"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 C;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 D=v.code==="ArrowUp"?"prev":"next",{nextElement:A,nextIndex:E}=mk(v.currentTarget.parentElement,"selected",D,n);A&&((C=A.querySelector("label"))==null||C.focus(),l==null||l.setTabbableOption(E));break}}};return c.jsxs("li",{"data-testid":"poll-option",style:h,className:V("poll-option text-small",{selected:t.hasUserVoted}),children:[c.jsx("label",{...f,children:c.jsx("span",{children:t.label})}),i&&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:a?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const pk=({title:e,options:t,settings:n,functions:r})=>{const a="poll_",i=ae.useIntl(),s=y.useContext(it),{showRemoveVote:o=!0,allowMultipleVotes:l=!1,resultsVisibility:u=si.AfterVoting}=n||{},[d,m]=y.useState(fk(t,l,s==null?void 0:s.id)),{createVote:h=async()=>{},removeVote:p=()=>{}}=r||{},g=t.reduce((D,A)=>D+A.numVotes,0),f=t.filter(D=>D.hasUserVoted).length,b=t.filter(D=>D.hasUserVoted),v=y.useCallback(async D=>{await h(D.id)},[]),C=y.useCallback(async()=>{t.forEach(async D=>{D.hasUserVoted&&D.userVote&&await p(D.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:i.formatMessage({id:`${a}instructions`},{allowMultipleVotes:l})})}),c.jsx("p",{className:"poll-num-votes",children:c.jsx("small",{"data-testid":"poll-total-votes",children:i.formatMessage({id:`${a}num_votes`},{number:g})})}),o&&c.jsx("p",{className:"poll-remove-vote",children:c.jsx(Ee,{variant:"tertiary",onClick:C,"data-testid":"remove-votes-button",disabled:f===0,children:c.jsx("small",{children:i.formatMessage({id:`${a}remove_vote_button`},{number:f})})})})]}),t&&c.jsx("form",{children:c.jsx("fieldset",{children:c.jsx("ul",{className:"poll",children:t==null?void 0:t.map((D,A)=>c.jsx(hk,{isTabbable:d===A,user:s,option:D,optionIndex:A,totalPollVotes:g,showResults:u==si.Always||!!f,allowMultipleVotes:l,hasVotedOnPoll:!!f,functions:{createVote:v,setTabbableOption:m}},D.id))})})}),c.jsxs(Pe,{"aria-live":"polite",children:[i.formatMessage({id:`${a}aria_votes`},{number:f}),!!f&&c.jsx("ul",{children:b.map(D=>c.jsx("li",{children:D.label}))})]})]})};exports.ASSETS_BUCKET=Gt;exports.ActionBar=lf;exports.ActionButton=qr;exports.ActivitiesFeed=qg;exports.ActivitySection=M_;exports.AddPost=au;exports.Badge=jd;exports.BadgeScope=ct;exports.Badges=Od;exports.BadgesContext=lo;exports.BadgesProvider=Ed;exports.Banner=W_;exports.BannerSection=K_;exports.Breadcrumbs=uv;exports.Buckets=Kh;exports.Button=Ee;exports.ButtonWrapper=pr;exports.COURSE_CONTENT_TYPES=Ar;exports.CacheProvider=_d;exports.Card=su;exports.CardBlock=sh;exports.Carousel=ik;exports.CharacterLimit=Fo;exports.CollapsibleSection=li;exports.Columns=mf;exports.CommunityDetails=mg;exports.ContactFooter=d_;exports.ContactForm=Hm;exports.ContentTypeLabel=bd;exports.Contributors=ho;exports.ConversationContext=Ci;exports.CookieBanner=Qm;exports.CourseProgression=ok;exports.CourseStructure=uk;exports.CustomContentBanner=Z_;exports.CustomEvents=rt;exports.DELETED_USER_ID=Lr;exports.Directory=L_;exports.DiscussionConversation=th;exports.DiscussionForm=ta;exports.DiscussionFormCard=nh;exports.DiscussionFormModal=ih;exports.DiscussionPost=na;exports.DiscussionThread=ah;exports.Divider=zt;exports.DownloadSection=o_;exports.EMAILS=Qn;exports.EditSection=l_;exports.EmailHelperTextBox=pf;exports.EmptyStateBox=Cn;exports.EnrichedUrl=_o;exports.FeatureFlags=Fd;exports.Filters=cf;exports.FlagsProvider=kd;exports.Footer=nu;exports.Form=Jt;exports.Formatting=H;exports.Fragment=St;exports.FullWidthSection=En;exports.GET_STREAM_USER_PREFIX=_s;exports.GlobalProviders=op;exports.Header=ru;exports.HelperTextBox=xd;exports.HiddenFromScreenReaders=oi;exports.HideShowTextBox=Cd;exports.HighlightSection=G_;exports.HighlightedTextBox=_t;exports.INVALID_TOKEN=dd;exports.IconBulletedList=Gh;exports.ImageContainer=Uh;exports.IntlProvider=Ad;exports.InviteForm=Km;exports.InviteModal=I_;exports.JoinButton=bo;exports.Label=Yo;exports.LanguageContext=co;exports.LanguageSwitcher=cv;exports.LessonName=oh;exports.LessonType=uh;exports.LikesButton=nf;exports.LikesFeed=sf;exports.LikesModal=of;exports.Link=xn;exports.LoadMore=Xr;exports.LoadingBlock=Pd;exports.LoadingPlaceholder=Nt;exports.LoadingState=di;exports.Logo=ko;exports.LogoSection=c_;exports.MEMBERS_PER_PAGE=Xm;exports.MENTION_REGEX=fd;exports.MarkCompleteButton=lk;exports.MarkdownText=On;exports.MarketingBlock=Q_;exports.Marks=Kt;exports.Member=an;exports.MembersList=eh;exports.Modal=po;exports.MoreMenu=df;exports.NUMBER_OF_COUNTRIES=Ah;exports.NUMBER_OF_USERS=Fh;exports.NarrowCard=sk;exports.NavigationMenu=ff;exports.NotFoundError=dk;exports.Overlay=ln;exports.OverlayContext=fo;exports.OverlayProvider=Sd;exports.PageHeading=wd;exports.PageLayout=Jm;exports.PasswordForm=JE;exports.PasswordRules=Cf;exports.Pill=Yt;exports.Poll=pk;exports.Popover=vd;exports.Portal=gr;exports.ProfileForm=Zm;exports.ProfileImageChange=Vm;exports.ProfileModal=wi;exports.ProfileModalLauncher=iu;exports.ProfilePicture=un;exports.ProgressBar=mo;exports.ProgressTracker=Vh;exports.PublishArticleForm=e_;exports.Rating=Av;exports.RepliesFeed=af;exports.ResponsesHeading=rh;exports.ResponsiveImage=zn;exports.ResultsVisibility=si;exports.ReturnToNavButton=Hh;exports.RichTextEditor=tu;exports.SearchForm=Ym;exports.ShareLink=uf;exports.ShareLinks=gv;exports.SignupForm=s_;exports.Span=Bs;exports.StatusBanner=ur;exports.TableOfContents=U_;exports.Tabs=vv;exports.Tags=g_;exports.TestimonialBlock=q_;exports.TimeToComplete=Di;exports.Toggle=GE;exports.Tooltip=Ln;exports.TopLevelPage=f_;exports.UUID_V4_REGEX=zr;exports.UserContext=it;exports.UserProvider=Bd;exports.VisuallyHidden=Pe;exports.addAriaProps=Zd;exports.basicReducer=Jr;exports.camelCaseToDashCase=ud;exports.checkIntlPathExists=ui;exports.enrichPostCategories=Eo;exports.generateConditions=Ia;exports.generateCssIcon=Bh;exports.getAuthorData=vr;exports.getCharacterLimitProps=hf;exports.getLongDate=oo;exports.getMember=fi;exports.getPostBody=Do;exports.getShortDate=md;exports.getValueLength=mi;exports.headerData=Qr;exports.likesResponseMock=sv;exports.mapGetStreamData=ck;exports.pageReady=hd;exports.passwordValidator=Fs;exports.repliesFeedMock=Ug;exports.supportedLanguages=Ba;exports.toCamelCase=ld;exports.toCapitalisedCase=kh;exports.toSentenceCase=cd;exports.transformSlugs=Ps;exports.useAutoResize=td;exports.useBadges=Dd;exports.useCurrentPath=nd;exports.useEffectAfterMount=or;exports.useElementWidth=$n;exports.useOverlay=Td;exports.useScrollListener=id;exports.useScrollToHash=io;exports.useTooltips=so;exports.useUser=ci;