@apolitical/component-library 6.6.0-SW.0 → 6.6.0-SW.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),re=require("react-intl"),Pt=require("lodash.clonedeep"),vm=require("lodash.set"),Jc=require("react-dom"),Zt=require("markdown-to-jsx"),ir=require("truncate"),Ue=require("@tanstack/react-query"),bm=require("@tanstack/react-query-devtools"),Fi=require("posthog-js"),so=require("react-cookie"),Ri=require("lodash.isequal"),Xc=require("lodash.get"),ym=require("react-error-boundary"),xm=require("react-multi-email");var ii=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Nn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ed(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 i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var td={exports:{}};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),re=require("react-intl"),Ot=require("lodash.clonedeep"),_h=require("lodash.set"),id=require("react-dom"),Zt=require("markdown-to-jsx"),ar=require("truncate"),ze=require("@tanstack/react-query"),kh=require("@tanstack/react-query-devtools"),Bi=require("posthog-js"),so=require("react-cookie"),Li=require("lodash.isequal"),ad=require("lodash.get"),Fh=require("react-error-boundary"),Ah=require("react-multi-email");var si=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function In(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function sd(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 i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var od={exports:{}};/*!
2
2
  Copyright (c) 2018 Jed Watson.
3
3
  Licensed under the MIT License (MIT), see
4
4
  http://jedwatson.github.io/classnames
5
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],i=0;i<arguments.length;i++){var a=arguments[i];if(a){var s=typeof a;if(s==="string"||s==="number")r.push(a);else if(Array.isArray(a)){if(a.length){var o=n.apply(null,a);o&&r.push(o)}}else if(s==="object"){if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]")){r.push(a.toString());continue}for(var l in a)t.call(a,l)&&a[l]&&r.push(l)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(td);var Cm=td.exports;const V=Nn(Cm),wm=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...i})=>y.createElement(e,{...i,className:V("hidden",r,{"show-on-focus":t}),children:n}),Pe=y.memo(wm),Dm=({element:e="span",children:t=null,...n})=>y.createElement(e,{...n,"aria-hidden":!0},t),oa=y.memo(Dm);var ks={exports:{}},br={};/**
5
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],i=0;i<arguments.length;i++){var a=arguments[i];if(a){var s=typeof a;if(s==="string"||s==="number")r.push(a);else if(Array.isArray(a)){if(a.length){var o=n.apply(null,a);o&&r.push(o)}}else if(s==="object"){if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]")){r.push(a.toString());continue}for(var l in a)t.call(a,l)&&a[l]&&r.push(l)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(od);var Bh=od.exports;const V=In(Bh),Th=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...i})=>y.createElement(e,{...i,className:V("hidden",r,{"show-on-focus":t}),children:n}),Ie=y.memo(Th),Sh=({element:e="span",children:t=null,...n})=>y.createElement(e,{...n,"aria-hidden":!0},t),ua=y.memo(Sh);var ks={exports:{}},wr={};/**
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 pu;function Em(){if(pu)return br;pu=1;var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var d,h={},p=null,m=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(m=l.ref);for(d in l)r.call(l,d)&&!a.hasOwnProperty(d)&&(h[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)h[d]===void 0&&(h[d]=l[d]);return{$$typeof:t,type:o,key:p,ref:m,props:h,_owner:i.current}}return br.Fragment=n,br.jsx=s,br.jsxs=s,br}var yr={};/**
13
+ */var bu;function jh(){if(bu)return wr;bu=1;var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function s(o,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)&&!a.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:i.current}}return wr.Fragment=n,wr.jsx=s,wr.jsxs=s,wr}var Cr={};/**
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 gu;function _m(){return gu||(gu=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"),i=Symbol.for("react.strict_mode"),a=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"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),v=Symbol.iterator,f="@@iterator";function b(N){if(N===null||typeof N!="object")return null;var ue=v&&N[v]||N[f];return typeof ue=="function"?ue:null}var g=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function D(N){{for(var ue=arguments.length,de=new Array(ue>1?ue-1:0),De=1;De<ue;De++)de[De-1]=arguments[De];w("error",N,de)}}function w(N,ue,de){{var De=g.ReactDebugCurrentFrame,Ne=De.getStackAddendum();Ne!==""&&(ue+="%s",de=de.concat([Ne]));var Ve=de.map(function(Oe){return String(Oe)});Ve.unshift("Warning: "+ue),Function.prototype.apply.call(console[N],console,Ve)}}var F=!1,E=!1,k=!1,T=!1,R=!1,P;P=Symbol.for("react.module.reference");function z(N){return!!(typeof N=="string"||typeof N=="function"||N===r||N===a||R||N===i||N===u||N===d||T||N===m||F||E||k||typeof N=="object"&&N!==null&&(N.$$typeof===p||N.$$typeof===h||N.$$typeof===s||N.$$typeof===o||N.$$typeof===l||N.$$typeof===P||N.getModuleId!==void 0))}function $(N,ue,de){var De=N.displayName;if(De)return De;var Ne=ue.displayName||ue.name||"";return Ne!==""?de+"("+Ne+")":de}function B(N){return N.displayName||"Context"}function A(N){if(N==null)return null;if(typeof N.tag=="number"&&D("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 a:return"Profiler";case i: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 $(N,N.render,"ForwardRef");case h:var De=N.displayName||null;return De!==null?De:A(N.type)||"Memo";case p:{var Ne=N,Ve=Ne._payload,Oe=Ne._init;try{return A(Oe(Ve))}catch{return null}}}return null}var j=Object.assign,M=0,U,W,ie,ae,C,G,ne;function _(){}_.__reactDisabledLog=!0;function O(){{if(M===0){U=console.log,W=console.info,ie=console.warn,ae=console.error,C=console.group,G=console.groupCollapsed,ne=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})}M++}}function q(){{if(M--,M===0){var N={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},N,{value:U}),info:j({},N,{value:W}),warn:j({},N,{value:ie}),error:j({},N,{value:ae}),group:j({},N,{value:C}),groupCollapsed:j({},N,{value:G}),groupEnd:j({},N,{value:ne})})}M<0&&D("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var S=g.ReactCurrentDispatcher,L;function Q(N,ue,de){{if(L===void 0)try{throw Error()}catch(Ne){var De=Ne.stack.trim().match(/\n( *(at )?)/);L=De&&De[1]||""}return`
22
- `+L+N}}var K=!1,J;{var ce=typeof WeakMap=="function"?WeakMap:Map;J=new ce}function ee(N,ue){if(!N||K)return"";{var de=J.get(N);if(de!==void 0)return de}var De;K=!0;var Ne=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Ve;Ve=S.current,S.current=null,O();try{if(ue){var Oe=function(){throw Error()};if(Object.defineProperty(Oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Oe,[])}catch(Xt){De=Xt}Reflect.construct(N,[],Oe)}else{try{Oe.call()}catch(Xt){De=Xt}N.call(Oe.prototype)}}else{try{throw Error()}catch(Xt){De=Xt}N()}}catch(Xt){if(Xt&&De&&typeof Xt.stack=="string"){for(var Se=Xt.stack.split(`
23
- `),dt=De.stack.split(`
24
- `),Je=Se.length-1,tt=dt.length-1;Je>=1&&tt>=0&&Se[Je]!==dt[tt];)tt--;for(;Je>=1&&tt>=0;Je--,tt--)if(Se[Je]!==dt[tt]){if(Je!==1||tt!==1)do if(Je--,tt--,tt<0||Se[Je]!==dt[tt]){var Tt=`
25
- `+Se[Je].replace(" at new "," at ");return N.displayName&&Tt.includes("<anonymous>")&&(Tt=Tt.replace("<anonymous>",N.displayName)),typeof N=="function"&&J.set(N,Tt),Tt}while(Je>=1&&tt>=0);break}}}finally{K=!1,S.current=Ve,q(),Error.prepareStackTrace=Ne}var qn=N?N.displayName||N.name:"",mu=qn?Q(qn):"";return typeof N=="function"&&J.set(N,mu),mu}function pe(N,ue,de){return ee(N,!1)}function ve(N){var ue=N.prototype;return!!(ue&&ue.isReactComponent)}function Ee(N,ue,de){if(N==null)return"";if(typeof N=="function")return ee(N,ve(N));if(typeof N=="string")return Q(N);switch(N){case u:return Q("Suspense");case d:return Q("SuspenseList")}if(typeof N=="object")switch(N.$$typeof){case l:return pe(N.render);case h:return Ee(N.type,ue,de);case p:{var De=N,Ne=De._payload,Ve=De._init;try{return Ee(Ve(Ne),ue,de)}catch{}}}return""}var Ce=Object.prototype.hasOwnProperty,Fe={},We=g.ReactDebugCurrentFrame;function Me(N){if(N){var ue=N._owner,de=Ee(N.type,N._source,ue?ue.type:null);We.setExtraStackFrame(de)}else We.setExtraStackFrame(null)}function ze(N,ue,de,De,Ne){{var Ve=Function.call.bind(Ce);for(var Oe in N)if(Ve(N,Oe)){var Se=void 0;try{if(typeof N[Oe]!="function"){var dt=Error((De||"React class")+": "+de+" type `"+Oe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof N[Oe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw dt.name="Invariant Violation",dt}Se=N[Oe](ue,Oe,De,de,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Je){Se=Je}Se&&!(Se instanceof Error)&&(Me(Ne),D("%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).",De||"React class",de,Oe,typeof Se),Me(null)),Se instanceof Error&&!(Se.message in Fe)&&(Fe[Se.message]=!0,Me(Ne),D("Failed %s type: %s",de,Se.message),Me(null))}}}var Xe=Array.isArray;function Ae(N){return Xe(N)}function je(N){{var ue=typeof Symbol=="function"&&Symbol.toStringTag,de=ue&&N[Symbol.toStringTag]||N.constructor.name||"Object";return de}}function qe(N){try{return Z(N),!1}catch{return!0}}function Z(N){return""+N}function oe(N){if(qe(N))return D("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",je(N)),Z(N)}var se=g.ReactCurrentOwner,me={key:!0,ref:!0,__self:!0,__source:!0},be,he,xe;xe={};function Qe(N){if(Ce.call(N,"ref")){var ue=Object.getOwnPropertyDescriptor(N,"ref").get;if(ue&&ue.isReactWarning)return!1}return N.ref!==void 0}function rt(N){if(Ce.call(N,"key")){var ue=Object.getOwnPropertyDescriptor(N,"key").get;if(ue&&ue.isReactWarning)return!1}return N.key!==void 0}function gt(N,ue){if(typeof N.ref=="string"&&se.current&&ue&&se.current.stateNode!==ue){var de=A(se.current.type);xe[de]||(D('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',A(se.current.type),N.ref),xe[de]=!0)}}function et(N,ue){{var de=function(){be||(be=!0,D("%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 Dt(N,ue){{var de=function(){he||(he=!0,D("%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 Et=function(N,ue,de,De,Ne,Ve,Oe){var Se={$$typeof:t,type:N,key:ue,ref:de,props:Oe,_owner:Ve};return Se._store={},Object.defineProperty(Se._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Se,"_self",{configurable:!1,enumerable:!1,writable:!1,value:De}),Object.defineProperty(Se,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Ne}),Object.freeze&&(Object.freeze(Se.props),Object.freeze(Se)),Se};function _a(N,ue,de,De,Ne){{var Ve,Oe={},Se=null,dt=null;de!==void 0&&(oe(de),Se=""+de),rt(ue)&&(oe(ue.key),Se=""+ue.key),Qe(ue)&&(dt=ue.ref,gt(ue,Ne));for(Ve in ue)Ce.call(ue,Ve)&&!me.hasOwnProperty(Ve)&&(Oe[Ve]=ue[Ve]);if(N&&N.defaultProps){var Je=N.defaultProps;for(Ve in Je)Oe[Ve]===void 0&&(Oe[Ve]=Je[Ve])}if(Se||dt){var tt=typeof N=="function"?N.displayName||N.name||"Unknown":N;Se&&et(Oe,tt),dt&&Dt(Oe,tt)}return Et(N,Se,dt,Ne,De,se.current,Oe)}}var vr=g.ReactCurrentOwner,ri=g.ReactDebugCurrentFrame;function zn(N){if(N){var ue=N._owner,de=Ee(N.type,N._source,ue?ue.type:null);ri.setExtraStackFrame(de)}else ri.setExtraStackFrame(null)}var ka;ka=!1;function Fa(N){return typeof N=="object"&&N!==null&&N.$$typeof===t}function lu(){{if(vr.current){var N=A(vr.current.type);if(N)return`
21
+ */var yu;function Ph(){return yu||(yu=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"),i=Symbol.for("react.strict_mode"),a=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"),v=Symbol.iterator,f="@@iterator";function b(N){if(N===null||typeof N!="object")return null;var ue=v&&N[v]||N[f];return typeof ue=="function"?ue:null}var g=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(N){{for(var ue=arguments.length,fe=new Array(ue>1?ue-1:0),Ce=1;Ce<ue;Ce++)fe[Ce-1]=arguments[Ce];C("error",N,fe)}}function C(N,ue,fe){{var Ce=g.ReactDebugCurrentFrame,$e=Ce.getStackAddendum();$e!==""&&(ue+="%s",fe=fe.concat([$e]));var He=fe.map(function(Me){return String(Me)});He.unshift("Warning: "+ue),Function.prototype.apply.call(console[N],console,He)}}var F=!1,D=!1,_=!1,T=!1,R=!1,O;O=Symbol.for("react.module.reference");function z(N){return!!(typeof N=="string"||typeof N=="function"||N===r||N===a||R||N===i||N===u||N===d||T||N===p||F||D||_||typeof N=="object"&&N!==null&&(N.$$typeof===h||N.$$typeof===m||N.$$typeof===s||N.$$typeof===o||N.$$typeof===l||N.$$typeof===O||N.getModuleId!==void 0))}function $(N,ue,fe){var Ce=N.displayName;if(Ce)return Ce;var $e=ue.displayName||ue.name||"";return $e!==""?fe+"("+$e+")":fe}function A(N){return N.displayName||"Context"}function B(N){if(N==null)return null;if(typeof N.tag=="number"&&x("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 a:return"Profiler";case i:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if(typeof N=="object")switch(N.$$typeof){case o:var ue=N;return A(ue)+".Consumer";case s:var fe=N;return A(fe._context)+".Provider";case l:return $(N,N.render,"ForwardRef");case m:var Ce=N.displayName||null;return Ce!==null?Ce:B(N.type)||"Memo";case h:{var $e=N,He=$e._payload,Me=$e._init;try{return B(Me(He))}catch{return null}}}return null}var j=Object.assign,M=0,U,W,ie,se,E,ee,Z;function k(){}k.__reactDisabledLog=!0;function P(){{if(M===0){U=console.log,W=console.info,ie=console.warn,se=console.error,E=console.group,ee=console.groupCollapsed,Z=console.groupEnd;var N={configurable:!0,enumerable:!0,value:k,writable:!0};Object.defineProperties(console,{info:N,log:N,warn:N,error:N,group:N,groupCollapsed:N,groupEnd:N})}M++}}function q(){{if(M--,M===0){var N={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},N,{value:U}),info:j({},N,{value:W}),warn:j({},N,{value:ie}),error:j({},N,{value:se}),group:j({},N,{value:E}),groupCollapsed:j({},N,{value:ee}),groupEnd:j({},N,{value:Z})})}M<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var S=g.ReactCurrentDispatcher,L;function Q(N,ue,fe){{if(L===void 0)try{throw Error()}catch($e){var Ce=$e.stack.trim().match(/\n( *(at )?)/);L=Ce&&Ce[1]||""}return`
22
+ `+L+N}}var Y=!1,te;{var ce=typeof WeakMap=="function"?WeakMap:Map;te=new ce}function J(N,ue){if(!N||Y)return"";{var fe=te.get(N);if(fe!==void 0)return fe}var Ce;Y=!0;var $e=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var He;He=S.current,S.current=null,P();try{if(ue){var Me=function(){throw Error()};if(Object.defineProperty(Me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Me,[])}catch(Xt){Ce=Xt}Reflect.construct(N,[],Me)}else{try{Me.call()}catch(Xt){Ce=Xt}N.call(Me.prototype)}}else{try{throw Error()}catch(Xt){Ce=Xt}N()}}catch(Xt){if(Xt&&Ce&&typeof Xt.stack=="string"){for(var Pe=Xt.stack.split(`
23
+ `),mt=Ce.stack.split(`
24
+ `),Xe=Pe.length-1,nt=mt.length-1;Xe>=1&&nt>=0&&Pe[Xe]!==mt[nt];)nt--;for(;Xe>=1&&nt>=0;Xe--,nt--)if(Pe[Xe]!==mt[nt]){if(Xe!==1||nt!==1)do if(Xe--,nt--,nt<0||Pe[Xe]!==mt[nt]){var Tt=`
25
+ `+Pe[Xe].replace(" at new "," at ");return N.displayName&&Tt.includes("<anonymous>")&&(Tt=Tt.replace("<anonymous>",N.displayName)),typeof N=="function"&&te.set(N,Tt),Tt}while(Xe>=1&&nt>=0);break}}}finally{Y=!1,S.current=He,q(),Error.prepareStackTrace=$e}var Un=N?N.displayName||N.name:"",vu=Un?Q(Un):"";return typeof N=="function"&&te.set(N,vu),vu}function pe(N,ue,fe){return J(N,!1)}function de(N){var ue=N.prototype;return!!(ue&&ue.isReactComponent)}function xe(N,ue,fe){if(N==null)return"";if(typeof N=="function")return J(N,de(N));if(typeof N=="string")return Q(N);switch(N){case u:return Q("Suspense");case d:return Q("SuspenseList")}if(typeof N=="object")switch(N.$$typeof){case l:return pe(N.render);case m:return xe(N.type,ue,fe);case h:{var Ce=N,$e=Ce._payload,He=Ce._init;try{return xe(He($e),ue,fe)}catch{}}}return""}var Be=Object.prototype.hasOwnProperty,Fe={},Ve=g.ReactDebugCurrentFrame;function Re(N){if(N){var ue=N._owner,fe=xe(N.type,N._source,ue?ue.type:null);Ve.setExtraStackFrame(fe)}else Ve.setExtraStackFrame(null)}function Ne(N,ue,fe,Ce,$e){{var He=Function.call.bind(Be);for(var Me in N)if(He(N,Me)){var Pe=void 0;try{if(typeof N[Me]!="function"){var mt=Error((Ce||"React class")+": "+fe+" type `"+Me+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof N[Me]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw mt.name="Invariant Violation",mt}Pe=N[Me](ue,Me,Ce,fe,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Xe){Pe=Xe}Pe&&!(Pe instanceof Error)&&(Re($e),x("%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).",Ce||"React class",fe,Me,typeof Pe),Re(null)),Pe instanceof Error&&!(Pe.message in Fe)&&(Fe[Pe.message]=!0,Re($e),x("Failed %s type: %s",fe,Pe.message),Re(null))}}}var Qe=Array.isArray;function Ae(N){return Qe(N)}function Oe(N){{var ue=typeof Symbol=="function"&&Symbol.toStringTag,fe=ue&&N[Symbol.toStringTag]||N.constructor.name||"Object";return fe}}function Ee(N){try{return K(N),!1}catch{return!0}}function K(N){return""+N}function oe(N){if(Ee(N))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Oe(N)),K(N)}var ae=g.ReactCurrentOwner,he={key:!0,ref:!0,__self:!0,__source:!0},ve,Te,be;be={};function je(N){if(Be.call(N,"ref")){var ue=Object.getOwnPropertyDescriptor(N,"ref").get;if(ue&&ue.isReactWarning)return!1}return N.ref!==void 0}function st(N){if(Be.call(N,"key")){var ue=Object.getOwnPropertyDescriptor(N,"key").get;if(ue&&ue.isReactWarning)return!1}return N.key!==void 0}function et(N,ue){if(typeof N.ref=="string"&&ae.current&&ue&&ae.current.stateNode!==ue){var fe=B(ae.current.type);be[fe]||(x('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',B(ae.current.type),N.ref),be[fe]=!0)}}function tt(N,ue){{var fe=function(){ve||(ve=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ue))};fe.isReactWarning=!0,Object.defineProperty(N,"key",{get:fe,configurable:!0})}}function _t(N,ue){{var fe=function(){Te||(Te=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ue))};fe.isReactWarning=!0,Object.defineProperty(N,"ref",{get:fe,configurable:!0})}}var ut=function(N,ue,fe,Ce,$e,He,Me){var Pe={$$typeof:t,type:N,key:ue,ref:fe,props:Me,_owner:He};return Pe._store={},Object.defineProperty(Pe._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Pe,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Ce}),Object.defineProperty(Pe,"_source",{configurable:!1,enumerable:!1,writable:!1,value:$e}),Object.freeze&&(Object.freeze(Pe.props),Object.freeze(Pe)),Pe};function _a(N,ue,fe,Ce,$e){{var He,Me={},Pe=null,mt=null;fe!==void 0&&(oe(fe),Pe=""+fe),st(ue)&&(oe(ue.key),Pe=""+ue.key),je(ue)&&(mt=ue.ref,et(ue,$e));for(He in ue)Be.call(ue,He)&&!he.hasOwnProperty(He)&&(Me[He]=ue[He]);if(N&&N.defaultProps){var Xe=N.defaultProps;for(He in Xe)Me[He]===void 0&&(Me[He]=Xe[He])}if(Pe||mt){var nt=typeof N=="function"?N.displayName||N.name||"Unknown":N;Pe&&tt(Me,nt),mt&&_t(Me,nt)}return ut(N,Pe,mt,$e,Ce,ae.current,Me)}}var xr=g.ReactCurrentOwner,ai=g.ReactDebugCurrentFrame;function qn(N){if(N){var ue=N._owner,fe=xe(N.type,N._source,ue?ue.type:null);ai.setExtraStackFrame(fe)}else ai.setExtraStackFrame(null)}var ka;ka=!1;function Fa(N){return typeof N=="object"&&N!==null&&N.$$typeof===t}function fu(){{if(xr.current){var N=B(xr.current.type);if(N)return`
26
26
 
27
- Check the render method of \``+N+"`."}return""}}function lm(N){{if(N!==void 0){var ue=N.fileName.replace(/^.*[\\\/]/,""),de=N.lineNumber;return`
27
+ Check the render method of \``+N+"`."}return""}}function vh(N){{if(N!==void 0){var ue=N.fileName.replace(/^.*[\\\/]/,""),fe=N.lineNumber;return`
28
28
 
29
- Check your code at `+ue+":"+de+"."}return""}}var cu={};function cm(N){{var ue=lu();if(!ue){var de=typeof N=="string"?N:N.displayName||N.name;de&&(ue=`
29
+ Check your code at `+ue+":"+fe+"."}return""}}var mu={};function bh(N){{var ue=fu();if(!ue){var fe=typeof N=="string"?N:N.displayName||N.name;fe&&(ue=`
30
30
 
31
- Check the top-level render call using <`+de+">.")}return ue}}function du(N,ue){{if(!N._store||N._store.validated||N.key!=null)return;N._store.validated=!0;var de=cm(ue);if(cu[de])return;cu[de]=!0;var De="";N&&N._owner&&N._owner!==vr.current&&(De=" It was passed a child from "+A(N._owner.type)+"."),zn(N),D('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',de,De),zn(null)}}function fu(N,ue){{if(typeof N!="object")return;if(Ae(N))for(var de=0;de<N.length;de++){var De=N[de];Fa(De)&&du(De,ue)}else if(Fa(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),Oe;!(Oe=Ve.next()).done;)Fa(Oe.value)&&du(Oe.value,ue)}}}function dm(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===h))de=ue.propTypes;else return;if(de){var De=A(ue);ze(de,N.props,"prop",De,N)}else if(ue.PropTypes!==void 0&&!ka){ka=!0;var Ne=A(ue);D("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Ne||"Unknown")}typeof ue.getDefaultProps=="function"&&!ue.getDefaultProps.isReactClassApproved&&D("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function fm(N){{for(var ue=Object.keys(N.props),de=0;de<ue.length;de++){var De=ue[de];if(De!=="children"&&De!=="key"){zn(N),D("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",De),zn(null);break}}N.ref!==null&&(zn(N),D("Invalid attribute `ref` supplied to `React.Fragment`."),zn(null))}}function hu(N,ue,de,De,Ne,Ve){{var Oe=z(N);if(!Oe){var Se="";(N===void 0||typeof N=="object"&&N!==null&&Object.keys(N).length===0)&&(Se+=" 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 dt=lm(Ne);dt?Se+=dt:Se+=lu();var Je;N===null?Je="null":Ae(N)?Je="array":N!==void 0&&N.$$typeof===t?(Je="<"+(A(N.type)||"Unknown")+" />",Se=" Did you accidentally export a JSX literal instead of a component?"):Je=typeof N,D("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Je,Se)}var tt=_a(N,ue,de,Ne,Ve);if(tt==null)return tt;if(Oe){var Tt=ue.children;if(Tt!==void 0)if(De)if(Ae(Tt)){for(var qn=0;qn<Tt.length;qn++)fu(Tt[qn],N);Object.freeze&&Object.freeze(Tt)}else D("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 fu(Tt,N)}return N===r?fm(tt):dm(tt),tt}}function hm(N,ue,de){return hu(N,ue,de,!0)}function mm(N,ue,de){return hu(N,ue,de,!1)}var pm=mm,gm=hm;yr.Fragment=r,yr.jsx=pm,yr.jsxs=gm}()),yr}process.env.NODE_ENV==="production"?ks.exports=Em():ks.exports=_m();var c=ks.exports;const 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},ar=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function rd(e,t,n){var r=this,i=y.useRef(null),a=y.useRef(0),s=y.useRef(null),o=y.useRef([]),l=y.useRef(),u=y.useRef(),d=y.useRef(e),h=y.useRef(!0);d.current=e;var p=typeof window<"u",m=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var v=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,b="maxWait"in n,g="debounceOnServer"in n&&!!n.debounceOnServer,D=b?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var w=y.useMemo(function(){var F=function(z){var $=o.current,B=l.current;return o.current=l.current=null,a.current=z,u.current=d.current.apply(B,$)},E=function(z,$){m&&cancelAnimationFrame(s.current),s.current=m?requestAnimationFrame(z):setTimeout(z,$)},k=function(z){if(!h.current)return!1;var $=z-i.current;return!i.current||$>=t||$<0||b&&z-a.current>=D},T=function(z){return s.current=null,f&&o.current?F(z):(o.current=l.current=null,u.current)},R=function z(){var $=Date.now();if(k($))return T($);if(h.current){var B=t-($-i.current),A=b?Math.min(B,D-($-a.current)):B;E(z,A)}},P=function(){if(p||g){var z=Date.now(),$=k(z);if(o.current=[].slice.call(arguments),l.current=r,i.current=z,$){if(!s.current&&h.current)return a.current=i.current,E(R,t),v?F(i.current):u.current;if(b)return E(R,t),F(i.current)}return s.current||E(R,t),u.current}};return P.cancel=function(){s.current&&(m?cancelAnimationFrame(s.current):clearTimeout(s.current)),a.current=0,o.current=i.current=l.current=s.current=null},P.isPending=function(){return!!s.current},P.flush=function(){return s.current?T(Date.now()):u.current},P},[v,b,t,D,f,m,p,g]);return w}function id(e,t,n){var r=n===void 0?{}:n,i=r.leading,a=r.trailing;return rd(e,t,{maxWait:t,leading:i===void 0||i,trailing:a===void 0||a})}let Aa;const In=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,i]=y.useState(0)||[!1,()=>{}],a=n==="window"?[]:[n];y.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(Aa),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),a);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{i(s())},l=({detail:d})=>{const{id:h}=d;n==="window"||!n.closest(`#${h}`)||s()===r||o()},u=id(()=>{s()!==r&&(t&&(clearTimeout(Aa),document.body.classList.add("is-resizing"),Aa=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[i,a]=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,h=i.current,p=d-h,m=p>0?"down":"up";if(a({current:d,past:h}),m==="down"){d>=e+t.down&&!s.scrollDown&&(!s.scrollUp||p>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=id(()=>{l()},250);return i},oo=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.useRef(!1);ar(()=>{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)},uo=(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 vu={},Rn=y.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:i,className:a="",functions:s={},callbacks:o={},accessibility:l={},...u},d)=>{const h=re.useIntl(),[p]=y.useState(e||Date.now().toString()),m=y.useRef(null),v=d||m,[f,b]=y.useState(n?"open":"hidden"),{extraPadding:g=!0,hasPointer:D=!1,hasForm:w=!1}=t,{onOpen:F=()=>{},onClose:E=()=>{}}=o,{readToScreenreadersWhenClosed:k=!1,...T}=l,R=vu[p];y.useEffect(()=>{const B=v==null?void 0:v.current;if(B)return B.addEventListener("transitionend",P),()=>{B.removeEventListener("transitionend",P)}},[]),y.useEffect(()=>{if(f!=="open")return;const B=A=>{A.key==="Escape"&&(A.stopPropagation(),A.preventDefault(),b("closed"))};return document.addEventListener("keyup",B),()=>{document.removeEventListener("keyup",B)}},[f]);const P=({propertyName:B})=>{B==="opacity"&&(R!==!1&&clearTimeout(R),b(A=>(A==="open"?F():A==="closed"&&E(),A==="opening"?"open":A==="closing"?"closed":A==="closed"?"hidden":A)))};ar(()=>{R!==!1&&clearTimeout(R);let B="open";n?b("opening"):(b("closing"),B="hidden"),vu[p||""]=setTimeout(()=>{b(B)},300)},[n]);const z={"aria-live":"polite",...u,...T};s&&s.onBlur&&(z.onBlur=s.onBlur);const $={className:"content"};return k?$.className=V("content",{hidden:f==="hidden"}):$.hidden=f==="hidden",c.jsx("aside",{ref:v,id:p,className:V("tooltip text-medium",f,a,{loading:r,"extra-padding":g,"has-pointer":D,bottom:D==="bottom","has-form":w}),...z,children:c.jsx("div",{...$,children:r?c.jsx("p",{children:h.formatMessage({id:"tooltip_loading"})}):typeof i=="string"?c.jsx("p",{children:i}):i})})}),Jr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Pt(e);return t.forEach(({type:r,value:i})=>{vm(n,r,i)}),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 i in t){const a=parseInt(String(t[i]));if(e>=a)r=n[a];else if(e<a)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),km=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Gt="https://storage.googleapis.com/apolitical-assets/",Yn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Fr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},Fs="SU:",$r="DELETED",dd="Invalid token error: Logging user out...",Fm="200,000+",Am="160+",Lr=/@{{([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 Bm(e){return e?{"--icon":`url(${Gt}icons/${e}.svg)`}:{}}const kn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},hd=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),lo=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),As=e=>{let t;const n=$i(),r=$i(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const i=t/kn.milliseconds.inHour,a=Math.floor(t/kn.milliseconds.inDay);if(a<1)return i<1?{path:"now"}:{path:"hours",number:Math.floor(i)};if(a<7)return{path:"days",number:a};const s=Math.floor(a/7);return s<=kn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(a/kn.year.days)}},$i=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Tm=(e,t,n)=>{let r;const i=$i(),a=$i(new Date(e));try{r=i.getTime()-a.getTime()}catch{return!1}switch(n){case"seconds":return r/kn.milliseconds.inSecond<=t;case"minutes":return r/kn.milliseconds.inMinute<=t;case"hours":return r/kn.milliseconds.inHour<=t}return!1},Sm=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},jm=e=>new Promise(t=>setTimeout(t,e)),Om=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},fr={apolitical:"Apolitical",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",card_carousel_viewAll:"View all",card_label_communityPage:"Community",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_new:"New",card_registered:"Registered",card_partner:"{partner} and {number} more",card_contributors_event:"Multiple speakers",card_contributors_solutionArticle:"Multiple authors",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_member_type_owner:"Admin",card_member_type_member:"Member",card_member_count:"{count} members",card_cta_people:"View profile",card_cta_communityPage:"Join now",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_communityPage_loading:"Joining...",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_communityPage_done:"Joined",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"previous",carousel_pagination_previousSlide:"Previous slide",carousel_pagination_next:"next",carousel_pagination_nextSlide:"Next slide",carousel_pagination_slide:"Slide {number} of {total}",carousel_pagination_ariaLive:"On {direction} slide: {count, plural, one {1 card} other {# cards}} available",carousel_pagination_ariaLive_slide:"On slide {slide}: {count, plural, one {1 card} other {# cards}} available",activitySection_notFoundError:"Post not found",activitiesFeed_sorting_label:"Choose feed sorting method",activitiesFeed_rankingMethod_recent:"Recent",activitiesFeed_rankingMethod_popular:"Popular",activitiesFeed_rankingMethod_internalTesting:"Testing",activitiesFeed_noActivities_inCategories:"There are no posts of this type yet.",activitiesFeed_noActivities:"Activities will appear here.",activitiesFeed_noActivities_button:"Explore Communities",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",community_sortSuccess:"Feed ordered by {order}",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",joinCommunityButton_closed_tooltip:"Please contact the admin of this closed community if you would like to join it.",joinCommunityButton_aria_live:"You are {action} this community",member_apolitical:"Apolitical",member_community:"Community post",member_deleted:"Deleted user",member_profile:"Update profile",member_createdAt_community:"{time} ago in <link>{community}</link>",membersList:"Members",membersList_admin:"Admin",membersList_profile:"Update profile",membersList_modal_title:"Update profile",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_poll:"poll",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_pinned_post:"Pinned Post",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
31
+ Check the top-level render call using <`+fe+">.")}return ue}}function hu(N,ue){{if(!N._store||N._store.validated||N.key!=null)return;N._store.validated=!0;var fe=bh(ue);if(mu[fe])return;mu[fe]=!0;var Ce="";N&&N._owner&&N._owner!==xr.current&&(Ce=" It was passed a child from "+B(N._owner.type)+"."),qn(N),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',fe,Ce),qn(null)}}function pu(N,ue){{if(typeof N!="object")return;if(Ae(N))for(var fe=0;fe<N.length;fe++){var Ce=N[fe];Fa(Ce)&&hu(Ce,ue)}else if(Fa(N))N._store&&(N._store.validated=!0);else if(N){var $e=b(N);if(typeof $e=="function"&&$e!==N.entries)for(var He=$e.call(N),Me;!(Me=He.next()).done;)Fa(Me.value)&&hu(Me.value,ue)}}}function yh(N){{var ue=N.type;if(ue==null||typeof ue=="string")return;var fe;if(typeof ue=="function")fe=ue.propTypes;else if(typeof ue=="object"&&(ue.$$typeof===l||ue.$$typeof===m))fe=ue.propTypes;else return;if(fe){var Ce=B(ue);Ne(fe,N.props,"prop",Ce,N)}else if(ue.PropTypes!==void 0&&!ka){ka=!0;var $e=B(ue);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",$e||"Unknown")}typeof ue.getDefaultProps=="function"&&!ue.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function xh(N){{for(var ue=Object.keys(N.props),fe=0;fe<ue.length;fe++){var Ce=ue[fe];if(Ce!=="children"&&Ce!=="key"){qn(N),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Ce),qn(null);break}}N.ref!==null&&(qn(N),x("Invalid attribute `ref` supplied to `React.Fragment`."),qn(null))}}function gu(N,ue,fe,Ce,$e,He){{var Me=z(N);if(!Me){var Pe="";(N===void 0||typeof N=="object"&&N!==null&&Object.keys(N).length===0)&&(Pe+=" 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 mt=vh($e);mt?Pe+=mt:Pe+=fu();var Xe;N===null?Xe="null":Ae(N)?Xe="array":N!==void 0&&N.$$typeof===t?(Xe="<"+(B(N.type)||"Unknown")+" />",Pe=" Did you accidentally export a JSX literal instead of a component?"):Xe=typeof N,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Xe,Pe)}var nt=_a(N,ue,fe,$e,He);if(nt==null)return nt;if(Me){var Tt=ue.children;if(Tt!==void 0)if(Ce)if(Ae(Tt)){for(var Un=0;Un<Tt.length;Un++)pu(Tt[Un],N);Object.freeze&&Object.freeze(Tt)}else x("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 pu(Tt,N)}return N===r?xh(nt):yh(nt),nt}}function wh(N,ue,fe){return gu(N,ue,fe,!0)}function Ch(N,ue,fe){return gu(N,ue,fe,!1)}var Dh=Ch,Eh=wh;Cr.Fragment=r,Cr.jsx=Dh,Cr.jsxs=Eh}()),Cr}process.env.NODE_ENV==="production"?ks.exports=jh():ks.exports=Ph();var c=ks.exports;const ud=()=>{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},sr=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function ld(e,t,n){var r=this,i=y.useRef(null),a=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 v=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,b="maxWait"in n,g="debounceOnServer"in n&&!!n.debounceOnServer,x=b?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var C=y.useMemo(function(){var F=function(z){var $=o.current,A=l.current;return o.current=l.current=null,a.current=z,u.current=d.current.apply(A,$)},D=function(z,$){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(z):setTimeout(z,$)},_=function(z){if(!m.current)return!1;var $=z-i.current;return!i.current||$>=t||$<0||b&&z-a.current>=x},T=function(z){return s.current=null,f&&o.current?F(z):(o.current=l.current=null,u.current)},R=function z(){var $=Date.now();if(_($))return T($);if(m.current){var A=t-($-i.current),B=b?Math.min(A,x-($-a.current)):A;D(z,B)}},O=function(){if(h||g){var z=Date.now(),$=_(z);if(o.current=[].slice.call(arguments),l.current=r,i.current=z,$){if(!s.current&&m.current)return a.current=i.current,D(R,t),v?F(i.current):u.current;if(b)return D(R,t),F(i.current)}return s.current||D(R,t),u.current}};return O.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),a.current=0,o.current=i.current=l.current=s.current=null},O.isPending=function(){return!!s.current},O.flush=function(){return s.current?T(Date.now()):u.current},O},[v,b,t,x,f,p,h,g]);return C}function cd(e,t,n){var r=n===void 0?{}:n,i=r.leading,a=r.trailing;return ld(e,t,{maxWait:t,leading:i===void 0||i,trailing:a===void 0||a})}let Aa;const Rn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,i]=y.useState(0)||[!1,()=>{}],a=n==="window"?[]:[n];y.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(Aa),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),a);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{i(s())},l=({detail:d})=>{const{id:m}=d;n==="window"||!n.closest(`#${m}`)||s()===r||o()},u=cd(()=>{s()!==r&&(t&&(clearTimeout(Aa),document.body.classList.add("is-resizing"),Aa=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},dd=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[i,a]=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=i.current,h=d-m,p=h>0?"down":"up";if(a({current:d,past:m}),p==="down"){d>=e+t.down&&!s.scrollDown&&(!s.scrollUp||h>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(h)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=cd(()=>{l()},250);return i},oo=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.useRef(!1);sr(()=>{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)},uo=(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 xu={},$n=y.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:i,className:a="",functions:s={},callbacks:o={},accessibility:l={},...u},d)=>{const m=re.useIntl(),[h]=y.useState(e||Date.now().toString()),p=y.useRef(null),v=d||p,[f,b]=y.useState(n?"open":"hidden"),{extraPadding:g=!0,hasPointer:x=!1,hasForm:C=!1}=t,{onOpen:F=()=>{},onClose:D=()=>{}}=o,{readToScreenreadersWhenClosed:_=!1,...T}=l,R=xu[h];y.useEffect(()=>{const A=v==null?void 0:v.current;if(A)return A.addEventListener("transitionend",O),()=>{A.removeEventListener("transitionend",O)}},[]),y.useEffect(()=>{if(f!=="open")return;const A=B=>{B.key==="Escape"&&(B.stopPropagation(),B.preventDefault(),b("closed"))};return document.addEventListener("keyup",A),()=>{document.removeEventListener("keyup",A)}},[f]);const O=({propertyName:A})=>{A==="opacity"&&(R!==!1&&clearTimeout(R),b(B=>(B==="open"?F():B==="closed"&&D(),B==="opening"?"open":B==="closing"?"closed":B==="closed"?"hidden":B)))};sr(()=>{R!==!1&&clearTimeout(R);let A="open";n?b("opening"):(b("closing"),A="hidden"),xu[h||""]=setTimeout(()=>{b(A)},300)},[n]);const z={"aria-live":"polite",...u,...T};s&&s.onBlur&&(z.onBlur=s.onBlur);const $={className:"content"};return _?$.className=V("content",{hidden:f==="hidden"}):$.hidden=f==="hidden",c.jsx("aside",{ref:v,id:h,className:V("tooltip text-medium",f,a,{loading:r,"extra-padding":g,"has-pointer":x,bottom:x==="bottom","has-form":C}),...z,children:c.jsx("div",{...$,children:r?c.jsx("p",{children:m.formatMessage({id:"tooltip_loading"})}):typeof i=="string"?c.jsx("p",{children:i}):i})})}),ei=(e,t)=>{Array.isArray(t)||(t=[t]);const n=Ot(e);return t.forEach(({type:r,value:i})=>{_h(n,r,i)}),n},fd=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},md=(e,t,n)=>{let r=n.mobile;for(const i in t){const a=parseInt(String(t[i]));if(e>=a)r=n[a];else if(e<a)break}return r},hd=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),pd=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),gd=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Oh=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Gt="https://storage.googleapis.com/apolitical-assets/",Gn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Tr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},Fs="SU:",qr="DELETED",vd="Invalid token error: Logging user out...",Mh="200,000+",Nh="160+",Ur=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,bd=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function Ih(e){return e?{"--icon":`url(${Gt}icons/${e}.svg)`}:{}}const kn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},yd=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),lo=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),As=e=>{let t;const n=zi(),r=zi(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const i=t/kn.milliseconds.inHour,a=Math.floor(t/kn.milliseconds.inDay);if(a<1)return i<1?{path:"now"}:{path:"hours",number:Math.floor(i)};if(a<7)return{path:"days",number:a};const s=Math.floor(a/7);return s<=kn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(a/kn.year.days)}},zi=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Rh=(e,t,n)=>{let r;const i=zi(),a=zi(new Date(e));try{r=i.getTime()-a.getTime()}catch{return!1}switch(n){case"seconds":return r/kn.milliseconds.inSecond<=t;case"minutes":return r/kn.milliseconds.inMinute<=t;case"hours":return r/kn.milliseconds.inHour<=t}return!1},$h=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},Lh=e=>new Promise(t=>setTimeout(t,e)),zh=()=>{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_poll:"poll",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_pinned_post:"Pinned Post",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
32
32
 
33
33
  Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
34
34
 
35
- Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"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{allow_multiple_votes, 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"},Pm={...fr,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>"},Mm={...fr,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"},Nm={...fr,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>"},Im=Object.freeze(Object.defineProperty({__proto__:null,en:fr,es:Pm,fr:Mm,pt:Nm},Symbol.toStringTag,{value:"Module"})),ua=(e,t=fr)=>e in t,$t=(e,t,n,r,i={})=>{let a="";return ua(`${t}_${n}`)?a=e({id:`${t}_${n}`},i):a=e({id:t},{[r]:n,...i}),a},Rm=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let i=n.length-1;i>=0;i--){const a=Math.pow(10,(i+1)*3);if(a<=e){e=Math.round(e*t/a)/t,e===1e3&&i<n.length-1&&(e=1,i++),r=`${e}${n[i]}`;break}}return r},Ai=(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)},$m=e=>{var a,s;const n=["name","organization","jobTitle","biography"].every(o=>{const l=e[o];return l!=null&&l!==""}),r=((a=e.image)==null?void 0:a.thumbnail)!==void 0,i=((s=e.location)==null?void 0:s.en)!==void 0;return n&&r&&i},Lm=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,$r).replace(/{{id}}/g,$r):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),pd=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var a;if(!n)return e;const i=e.match(Lr);if(!i)return e;for(const s of i){const o=s.replace(Lr,(d,h)=>h),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=l.error?l.error:((a=l==null?void 0:l.data)==null?void 0:a.name)||"",u.id=l.id||"",u.error=l.error;else{const d=l;if(d.startsWith(Fs))try{const h=d.replace(Fs,"");u.id=h,await r({id:h}).then(p=>{const{name:m,error:v}=p;u.name=v||m||"",u.error=v})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Lm(e,u,t):s)}return e},co=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),Li=(e="")=>e.replace(/\s+/g,"").length>0,Bs=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 ke=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:i=!1,element:a="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:d=!1,children:h=!1,...p})=>{const v=In(typeof t=="object"),{showTooltip:f,tooltipProps:b}=uo(!!u);if(typeof t=="object"&&typeof v=="number"){const F=Object.assign({},t),E=sd(Object.keys(F));t=od(v,E,F)}!l&&u&&(u="");const g=[];typeof t=="string"&&g.push(t),r&&(g.push("icon"),typeof r=="object"?(g.push(r.icon),r.position?g.push(r.position):g.push("left"),r.hover&&g.push(`hover_${r.hover}`),r.animate&&(g.push("animate"),typeof r.animate=="string"&&g.push(r.animate))):(g.push(r),!r.includes("right")&&!r.includes("left")&&g.push("left")));const D={...p,className:V(e,o,g,{"no-text":!h,disabled:l,button:i,muted:n.muted,"full-width":n.fullWidth}),onClick:F=>{(!i||i[0]==="#")&&s&&(F.preventDefault(),F.stopPropagation()),s&&s(F)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};i&&(a="a",D.href=i);const w=y.createElement(a,D,h||(d?c.jsx(Pe,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...b,children:[c.jsx(Rn,{isOpen:f,accessibility:{readToScreenreadersWhenClosed:!0},children:u}),w]}):w},hr=({buttons:e,wrappers:t=[],className:n="",...r})=>{const i=e.length>1?"ul":"p",a=e.map((s,o)=>{var l;return i==="p"?c.jsx(ke,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(ke,{...s})},o)});return y.createElement(i,{className:V("button-wrapper",n),...r,children:a})};const qt=({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})},bu={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},highlightSection:{range:[{height:200,width:674},{height:400,width:1348},{height:1e3,width:1e3},{height:2e3,width:2e3}],sizes:"(max-width: 500px) 674px, (max-width: 1024px) 1348px, (max-width: 1200px) 1000px, 2000px"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"}},zm=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:i}=e?bu[e]:bu.fallback;return{range:t&&t.length>0?t:r,sizes:n||i}},qm=({format:e,height:t,query:n,width:r})=>{let i=`w=${r}&h=${t}`;return i=e?`${i}&fm=${e}`:i,i=n?`${i}&${n}`:i,i},Ba=({format:e,range:t,url:n,query:r})=>t.map(({height:i,width:a})=>`${n}?${qm({format:e,height:i,query:r,width:a})} ${a}w`).join(", ");const $n=({image:e,className:t,testId:n})=>{const{description:r,height:i,type:a,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:h}=e,{range:p,sizes:m}=zm(e),v=Ba({format:"avif",query:s,range:p,url:o}),f=Ba({format:"webp",query:s,range:p,url:o}),b=Ba({format:"",query:s,range:p,url:o});return a&&a.includes("svg")?c.jsx("picture",{className:t,children:c.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:i,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[a!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:v,sizes:m,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:m,"data-testid":"source"}),c.jsx("img",{srcSet:b,sizes:m,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:i,"data-testid":n||"image"})]})};const Um=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx($n,{image:{...e},className:"image"})}),yn=({href:e,children:t,fallbackElement:n,className:r="",onClick:i,gtmContext:a,gtmType:s,...o})=>{if(e){const l={...o};return i&&(l.onClick=i),a&&(l["data-gtm-event-context"]=a),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),i=n||r;return c.jsx("aside",{ref:i,className:V("popover",e),"aria-live":"polite",children:t})}),mr=({parent:e=document.body,children:t})=>typeof document=="object"?Jc.createPortal(t,e):null,Wm=Object.freeze(Object.defineProperty({__proto__:null,default:mr},Symbol.toStringTag,{value:"Module"}));const Vm=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Pe,{children:c.jsx(re.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),c.jsx("div",{className:"progress-tracker",children:c.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const i=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:V("dot",{active:i===e,completed:i<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:V("line",{active:i<e})})]},r)})})})]});const Hm=({elementId:e,offset:t=20})=>{const n=re.useIntl(),r=()=>{const i=document.getElementById(e);if(!i)return;const a=document.getElementById("header");a&&window.scrollTo({top:i.offsetTop-a.clientHeight-t})};return c.jsx(ke,{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 Km=({items:e,className:t="",...n})=>c.jsx("ul",{className:V("buckets",t),...n,children:e.map(({title:r,text:i,link:a,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:a,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:i})]})},o))}),yu=300,xu="ease-in-out";class Zm{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:yu,easing:xu}),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:yu,easing:xu}),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 la=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const i=re.useIntl(),a=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new Zm(a.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:a,className:V("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||i.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},Cu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Ym=e=>{let t=e;return Object.keys(Cu).includes(e)&&(t=Cu[e]),`url(${Gt}icons/${t}.svg)`};const wu={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 i=re.useIntl(),a=t?{"--custom-icon":Ym(t)}:{},s=ua(`contentTypeLabel_${e}`)?i.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:V("content-type-label text-small",e in wu?wu[e]:e,r,{"has-custom-icon":t}),style:a,"data-testid":"content-type-label",children:n||s})};const kt=({variant:e="primary",icon:t,styling:n={},className:r="",children:i,...a})=>{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,...a,children:i})};const xn=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let i=n&&!!Object.keys(n).length;const a=typeof n=="object"&&"breakpoints"in n,s=In(a);if(a&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),p=sd(Object.keys(h));i=od(s,p,h)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(kt,{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,i&&typeof n=="object"&&(u||c.jsx(ke,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Ts=({children:e,...t})=>c.jsx("p",{...t,children:e}),yd={q:Ts,blockquote:Ts};for(let e=1;e<=6;e++)yd[`h${e}`]={component:Ts,props:{className:"title"}};const xd=({type:e="default",className:t="",heading:n=!1,children:r,...i})=>c.jsxs("div",{...i,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:i,markdownOptions:a,fadeStyle:s="default",children:o})=>{const l=re.useIntl(),u=y.useRef(null);e||(e=Date.now().toString());const[d,h]=y.useState(""),[p,m]=y.useState("closed");y.useEffect(()=>{const b=u.current;if(b)return b.addEventListener("transitionend",v),()=>{b.removeEventListener("transitionend",v)}},[]),y.useEffect(()=>{if(!i||typeof i!="string")return;const b=i.split(`
36
- `);h(b.length<3?`${i.substring(0,400)}...`:b.slice(0,3).join(`
37
- `))},[i]),y.useEffect(()=>{p==="ready-to-close"&&m("closing")},[p]);const v=({propertyName:b})=>{b==="max-height"&&m(g=>g==="opening"?"open":g==="closing"?"closed":g)},f=["opening","open"].includes(p);return c.jsxs(kt,{variant:"subtle",className:V("hide-show-text-box",t),children:[c.jsx("div",{ref:u,id:e,className:V("content",p,s),children:i?c.jsxs(c.Fragment,{children:[c.jsx(Zt,{options:{forceBlock:!0,...a},children:p==="closed"?d:i}),p!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(ke,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:V({"rotate-180":f}),onClick:()=>{m(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 Gm=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:i={},className:a=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=i;return y.createElement(e,{className:V("icon-bulleted-list text-medium",n,a,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const d={wrapper:y.Fragment,forceInline:!0},h={"--icon":`url(${Gt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(y.Fragment,{children:[c.jsx("dt",{style:h,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:h,children:typeof l.text=="string"?c.jsx(Zt,{options:d,children:l.text}):l.text},u)})})},ot=()=>y.Fragment,Qm=({children:e})=>c.jsx(kt,{variant:"secondary",children:e}),Jm=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),Xm=["span","strong","h1","h2","h3","h4","h5","h6","p"],ep=({children:e})=>{const t=re.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const a of y.Children.toArray(e))if(!(!a||typeof a=="string"||typeof a=="number"))if(y.isValidElement(a)&&a.type==="summary"){if(a.props&&a.props.children){for(const s of y.Children.toArray(a.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&y.isValidElement(s)){const o=s.type;if(Xm.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(a);const i=n?n.toString():"";return c.jsx(la,{label:i,className:["Sources","Resources"].includes(i)?"discrete-links":"",children:r.map(a=>a)})},tp=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(kt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(kt,{variant:"primary",children:e});case"pink-textbox":return c.jsx(kt,{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})},jt=({children:e})=>c.jsx(c.Fragment,{children:e}),np=e=>{const t=re.useIntl(),n=Date.now().toString();let r="default";const i=e.src;i.includes("youtube")||i.includes("vimeo")?r="video":i.includes("riddle")||i.includes("sli.do")?r="poll":i.includes("padlet")&&(r="padlet");const a=`content-after-iframe-${n}`;return c.jsxs(c.Fragment,{children:[c.jsx(Pe,{element:"a",href:`#${a}`,onClick:s=>{s.preventDefault(),s.stopPropagation();const o=document.getElementById(a);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:a,tabIndex:0})]})},Du=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=re.useIntl();let r={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(r.target="_blank");let i=e,a=!1;for(const o of 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"||Du(o.props.children[0])==="button")&&(a=!0),i=o.props.children[0];i&&typeof i!="string"&&!(typeof i=="boolean"||typeof i=="number"||!y.isValidElement(i));)if(i.props&&i.props.children&&i.props.children[0])i=i.props.children[0],i&&Du(i)==="button"&&(a=!0);else break}const s=`@${$r}`;return i===s||Array.isArray(i)&&i[0]===s?(delete r.href,delete r.target,c.jsxs("span",{...r,className:"mention deleted-user",children:["@",n.formatMessage({id:"member_deleted"})]})):a?(r={...r,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(ke,{variant:"primary",size:"medium",...r,children:i})})):c.jsx("a",{...r,children:i})},Ss=({children:e,...t})=>c.jsx("span",{className:V({url:t==null?void 0:t.href}),children:e});const ip={default:{a:rp,CollapsibleSection:la,TextBox:kt,CaseStudy:Qm,style:ot,details:ep,div:tp,iframe:np,center:Jm},"text-only":{h1:ot,h2:ot,h3:ot,h4:ot,h5:ot,h6:ot,style:ot,details:ot,div:ot,TextBox:ot,CollapsibleSection:ot,CaseStudy:ot,blockquote:ot,iframe:ot,button:ot}},Sn=({element:e="div",className:t="",options:n={},children:r,overrideType:i="default",styling:a={}})=>{if(!r)return null;const{highlightTitles:s=!1}=a;r=r.replace(/^<br\/?>/,"");const o={wrapper:y.Fragment,forceBlock:!0};let l=ip[i];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:i="",ctaButton:a})=>{const s=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:V("page-heading",i),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)]}),a&&c.jsx(ke,{...a,className:V("cta-button","gtm-trackable"),"data-gtm-event-context":"CreateNewArticle","data-gtm-event-type":"create-article-click",children:a.text})]}),r]})};const Yt=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:i="",children:a,element:s="span",...o})=>{const l={"--icon":`url(${Gt}icons/${r}.svg)`},{showTooltip:u,tooltipProps:d}=uo(!!i),h={},p=i?typeof i=="string"?`tooltip-${window.btoa(i)}`:i.id:void 0,m=i?typeof i=="string"?i:i.text:void 0;i&&p&&(h["aria-describedby"]=p);const v=y.createElement(i?"button":s,{className:V("pill",e,t,n,{"has-icon":r}),style:l,children:a,...d,...h,...o});return i?y.createElement(s,{className:"pill-wrapper"},c.jsxs(c.Fragment,{children:[v,c.jsx(Rn,{id:p,isOpen:u,children:m})]})):v};const sr=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:V("status-banner text-small",n),"aria-live":"assertive"},t),fo=y.createContext({badges:[],isLoading:!0});function Dd(){return y.useContext(fo)}const Ed=({children:e,badges:t})=>c.jsx(fo.Provider,{value:t,children:e}),_d=({showDevTools:e=!0,children:t})=>{const n=new Ue.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(Ue.QueryClientProvider,{client:n,children:[t,e&&c.jsx(bm.ReactQueryDevtools,{initialIsOpen:!1})]})};var ap=y.createContext({client:Fi});function sp(e){var t=e.children,n=e.client,r=e.apiKey,i=e.options,a=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&&i&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(Fi.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Fi.init(r,i)),Fi)},[n,r]);return y.createElement(ap.Provider,{value:{client:a}},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",i={...Im[r],...n||{}};return c.jsx(re.IntlProvider,{locale:r,messages:i,children:e})},ho=y.createContext({}),Bi={en:"English",es:"Español",fr:"Français",pt:"Português"},at=y.createContext({isLoading:!0});function ca(){return y.useContext(at)}const Bd=({children:e,user:t,updateDetails:n})=>c.jsx(at.Provider,{value:{...t,updateDetails:n},children:e}),mo=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Td=()=>y.useContext(mo),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(a=>{n(s=>[...s,a])},[]),i=y.useCallback(a=>{n(s=>s.filter(o=>o!==a))},[]);return c.jsx(mo.Provider,{value:{registerOverlay:r,unregisterOverlay:i},children:e})},op=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[i,a]=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),h=p=>{localStorage.setItem("language",p),d(p)};return y.useEffect(()=>{e().then(p=>{Array.isArray(p)?(a({...p[0],isLoading:!1}),o({badges:p[1],isLoading:!1})):a({...p,isLoading:!1}),md(5e3)}).catch(p=>{p.message===dd&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),a({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(ho.Provider,{value:{language:u,updateLanguage:h},children:c.jsx(Ad,{locale:u,messages:n==null?void 0:n.messages,children:c.jsx(so.CookiesProvider,{children:c.jsx(Bd,{user:i,updateDetails:a,children:c.jsx(Ed,{badges:s,children:c.jsx(Sd,{children:c.jsx(_d,{showDevTools:r,children:c.jsx(kd,{user:i,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:i,colour:a,description:s}=n;return c.jsx(Yt,{className:V("user-badge",a==null?void 0:a.toLowerCase()),icon:i&&up[i],element:"li",tooltip:s,children:r})};var lt=(e=>(e.Communities="communities",e.Platform="platform",e))(lt||{});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 i,a;return(a=(i=t==null?void 0:t[r.scope])==null?void 0:i[r.area])==null?void 0:a.map((s,o)=>c.jsx(jd,{slug:s},o))}))})};const lp=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const i=re.useIntl(),{showText:a=!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(a?"span":Pe,{className:a?"text":"",children:n||i.formatMessage({id:"progressBar"},{number:t})})})},po=y.memo(lp);const Ta="loadingBlock_",cp=({progress:e=0,steps:t=!1,className:n=""})=>{const r=re.useIntl();t||(t={0:{text:r.formatMessage({id:`${Ta}loading`})},75:{text:r.formatMessage({id:`${Ta}almostDone`})},100:{text:r.formatMessage({id:`${Ta}complete`})}});let i=null;const a=Object.keys(t);for(let o=0;o<a.length&&!(e<parseInt(a[o]));o++)i=a[o];const s=i&&t[i].icon?{"--icon":`url(${Gt}icons/${t[i].icon}.svg)`}:{};return c.jsxs(kt,{className:V("loading-block",n,{"has-icon":i&&t[i].icon}),variant:"subtle",style:s,children:[i&&c.jsx("span",{className:"step",children:t[i].text}),c.jsx(po,{progress:e})]})},Pd=y.memo(cp);const It=({element:e="div",className:t="",...n})=>c.jsx(oa,{element:e,className:V("loading-placeholder",t),...n});const js={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 js?c.jsx("div",{className:e,children:js[e].map((n,r)=>Md(n,r))},t):c.jsx(It,{className:e},t),da=({layout:e="overview-page",...t})=>c.jsx("div",{className:V("loading-state",e),...t,children:js[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):""},ai=["#5AB6A3","#A2D7AF","#806056","#3962B3"],dp=e=>{const t=Math.ceil(26/ai.length),n=Nd(e).toLowerCase();if(n==="")return ai[0];const r=n.charCodeAt(0)-96;for(let i=0;i<ai.length;i++)if(r<=t*(i+1))return ai[i]};const Eu=256,on=({className:e="",src:t="",name:n,alt:r,width:i=Eu,height:a=Eu,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),d=y.useRef(null),h=r??n;y.useEffect(()=>{const m=d.current;if(!m)return;const v=m.getContext("2d");if(!v)return;const f=i,b=a;typeof window<"u"&&window.devicePixelRatio&&(m.width=f*window.devicePixelRatio,m.height=b*window.devicePixelRatio,v.scale(window.devicePixelRatio,window.devicePixelRatio)),v.fillStyle=dp(n),v.fillRect(0,0,f,b),v.font=`${f/3}px Arial`,v.textAlign="center",v.fillStyle="white",v.fillText(Nd(n),f/2,b/1.6)},[n]);let p=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(p=!0),c.jsx("figure",{className:V("profile-picture",e,{error:l}),...o,children:p?c.jsx("img",{src:t,alt:h,onError:()=>{u(!0)},width:i,height:a}):s?c.jsx("canvas",{ref:d}):c.jsx("span",{className:"fallback"})})};var nt=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(nt||{});const fa=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 i=e!=="",a=t!=="",s=n!=="";if(!i&&!a&&!s)return"";const o=`${e}${i&&a?` — ${t}`:t}`;let l=`${o}${(i||a)&&s?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=ir(l,r)),l};const hp=y.lazy(()=>Promise.resolve().then(()=>Wm)),mp=y.lazy(()=>Promise.resolve().then(()=>nk));let si=null;const rn=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:i={},functions:a={},gtmContext:s="member",gtmType:o="member-click",className:l="",badges:u,...d})=>{var A,j,M,U,W;const h=re.useIntl(),{profile:p,...m}=a,{size:v="medium",variant:f="inline",isCondensed:b=!0,additionalContentNewLine:g=!1}=i,D=y.useContext(at),w=p&&D&&typeof D.id=="string",[F,E]=y.useState(!1),k=fa(t);k.name||(k.name=h.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:T,image:R}=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),$=r&&r.createdAt?As(r.createdAt):!1,B=r&&r.createdAt?lo(r.createdAt):"";return y.createElement(e,{...d,className:V("member text-medium",v,f,l,{"has-profile-link":w}),...m,children:c.jsxs(c.Fragment,{children:[c.jsxs(yn,{href:P,gtmType:o,gtmContext:s,onClick:ie=>{if(ie==null||ie.preventDefault(),ie==null||ie.stopPropagation(),!P)return;si&&clearTimeout(si),si=setTimeout(()=>{window.location.href=P},150);const ae=new CustomEvent(nt.MEMBER_CLICKED,{detail:{link:P,timeout:si}});document.dispatchEvent(ae)},children:[c.jsx(on,{name:T,src:R,alt:n}),c.jsxs("div",{className:"details",children:[c.jsxs("div",{className:V("name",{"new-line":g}),"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":g}),children:[r.createdAt&&$&&!((A=r==null?void 0:r.customMessage)!=null&&A.text)&&c.jsx("span",{className:"date",title:B,"aria-label":B,"data-testid":"date",children:h.formatMessage({id:`dates_${$.path}`},{number:$.number})}),r.createdAt&&$&&((j=r==null?void 0:r.customMessage)==null?void 0:j.text)&&c.jsx("span",{children:h.formatMessage({id:(M=r.customMessage)==null?void 0:M.text},{time:h.formatMessage({id:`dates_${$.path}`},{number:$.number}),community:(W=(U=r.customMessage)==null?void 0:U.link)==null?void 0:W.text,link:ie=>{var ae,C;return c.jsx("a",{href:`${(C=(ae=r.customMessage)==null?void 0:ae.link)==null?void 0:C.url}`,onClick:G=>G.stopPropagation(),children:ie})}})}),r.didEdit&&c.jsx("em",{children:h.formatMessage({id:"discussion_edited"})})]})]}),z&&!g&&c.jsx("small",{className:V({"text-medium":v==="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&&p&&w?c.jsxs(c.Fragment,{children:[c.jsx(ke,{variant:"tertiary",size:"small",onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),E(!0)},"data-testid":"profile-button",children:h.formatMessage({id:"member_profile"})}),c.jsx(hp,{children:c.jsx(mp,{form:p,showModal:F,content:{title:h.formatMessage({id:"member_profile"})},functions:{onClose:()=>{E(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},pp=Object.freeze(Object.defineProperty({__proto__:null,default:rn},Symbol.toStringTag,{value:"Module"}));const _u={small:24,medium:48},go=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:i,showGap:a,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...d})=>{const h=re.useIntl();return!n||n.length===0?null:y.createElement(e,{...d,className:V("contributors",u,i,{"has-gap":a}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((p,m)=>{let v,f="";if(m<o){const{name:b="",image:g=""}=fa(p);if(s)return c.jsx(It,{element:"li",className:"contributor"},m);v=c.jsx(on,{name:b,src:g,width:_u[i||"medium"],height:_u[i||"medium"]})}else if(m===o){const b=(t||n.length)-o;v=c.jsxs("small",{className:V({"large-number":b>99}),children:["+",Rm(b,0)]}),f="number-left"}return v?c.jsx("li",{className:V("contributor",f),children:v},m):null})}),r&&c.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?h.formatMessage({id:`member_${n[0]}`}):ir(n[0].name||"",20):l||null})]})})};const vo=({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 Os={exports:{}},oi={exports:{}},Re={};/** @license React v16.13.1
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"},qh={...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>"},Uh={...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"},Wh={...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>"},Vh=Object.freeze(Object.defineProperty({__proto__:null,en:hr,es:qh,fr:Uh,pt:Wh},Symbol.toStringTag,{value:"Module"})),la=(e,t=hr)=>e in t,$t=(e,t,n,r,i={})=>{let a="";return la(`${t}_${n}`)?a=e({id:`${t}_${n}`},i):a=e({id:t},{[r]:n,...i}),a},Hh=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let i=n.length-1;i>=0;i--){const a=Math.pow(10,(i+1)*3);if(a<=e){e=Math.round(e*t/a)/t,e===1e3&&i<n.length-1&&(e=1,i++),r=`${e}${n[i]}`;break}}return r},Ti=(e,t)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),xd=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Kh=e=>{var a,s;const n=["name","organization","jobTitle","biography"].every(o=>{const l=e[o];return l!=null&&l!==""}),r=((a=e.image)==null?void 0:a.thumbnail)!==void 0,i=((s=e.location)==null?void 0:s.en)!==void 0;return n&&r&&i},Zh=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,qr).replace(/{{id}}/g,qr):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),wd=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var a;if(!n)return e;const i=e.match(Ur);if(!i)return e;for(const s of i){const o=s.replace(Ur,(d,m)=>m),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=l.error?l.error:((a=l==null?void 0:l.data)==null?void 0:a.name)||"",u.id=l.id||"",u.error=l.error;else{const d=l;if(d.startsWith(Fs))try{const m=d.replace(Fs,"");u.id=m,await r({id:m}).then(h=>{const{name:p,error:v}=h;u.name=v||p||"",u.error=v})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Zh(e,u,t):s)}return e},co=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Cd=e=>new URLSearchParams(window.location.search).get(e),qi=(e="")=>e.replace(/\s+/g,"").length>0,Bs=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 ke=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:i=!1,element:a="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:d=!1,children:m=!1,...h})=>{const v=Rn(typeof t=="object"),{showTooltip:f,tooltipProps:b}=uo(!!u);if(typeof t=="object"&&typeof v=="number"){const F=Object.assign({},t),D=fd(Object.keys(F));t=md(v,D,F)}!l&&u&&(u="");const g=[];typeof t=="string"&&g.push(t),r&&(g.push("icon"),typeof r=="object"?(g.push(r.icon),r.position?g.push(r.position):g.push("left"),r.hover&&g.push(`hover_${r.hover}`),r.animate&&(g.push("animate"),typeof r.animate=="string"&&g.push(r.animate))):(g.push(r),!r.includes("right")&&!r.includes("left")&&g.push("left")));const x={...h,className:V(e,o,g,{"no-text":!m,disabled:l,button:i,muted:n.muted,"full-width":n.fullWidth}),onClick:F=>{(!i||i[0]==="#")&&s&&(F.preventDefault(),F.stopPropagation()),s&&s(F)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};i&&(a="a",x.href=i);const C=y.createElement(a,x,m||(d?c.jsx(Ie,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...b,children:[c.jsx($n,{isOpen:f,accessibility:{readToScreenreadersWhenClosed:!0},children:u}),C]}):C},pr=({buttons:e,wrappers:t=[],className:n="",...r})=>{const i=e.length>1?"ul":"p",a=e.map((s,o)=>{var l;return i==="p"?c.jsx(ke,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(ke,{...s})},o)});return y.createElement(i,{className:V("button-wrapper",n),...r,children:a})};const qt=({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})},wu={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"}},Yh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:i}=e?wu[e]:wu.fallback;return{range:t&&t.length>0?t:r,sizes:n||i}},Gh=({format:e,height:t,query:n,width:r})=>{let i=`w=${r}&h=${t}`;return i=e?`${i}&fm=${e}`:i,i=n?`${i}&${n}`:i,i},Ba=({format:e,range:t,url:n,query:r})=>t.map(({height:i,width:a})=>`${n}?${Gh({format:e,height:i,query:r,width:a})} ${a}w`).join(", ");const Ln=({image:e,className:t,testId:n})=>{const{description:r,height:i,type:a,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:m}=e,{range:h,sizes:p}=Yh(e),v=Ba({format:"avif",query:s,range:h,url:o}),f=Ba({format:"webp",query:s,range:h,url:o}),b=Ba({format:"",query:s,range:h,url:o});return a&&a.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:i,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[a!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:v,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:i,"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(Ln,{image:{...e},className:"image"})}),yn=({href:e,children:t,fallbackElement:n,className:r="",onClick:i,gtmContext:a,gtmType:s,...o})=>{if(e){const l={...o};return i&&(l.onClick=i),a&&(l["data-gtm-event-context"]=a),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 Dd=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),i=n||r;return c.jsx("aside",{ref:i,className:V("popover",e),"aria-live":"polite",children:t})}),gr=({parent:e=document.body,children:t})=>typeof document=="object"?id.createPortal(t,e):null,Jh=Object.freeze(Object.defineProperty({__proto__:null,default:gr},Symbol.toStringTag,{value:"Module"}));const Xh=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Ie,{children:c.jsx(re.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),c.jsx("div",{className:"progress-tracker",children:c.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const i=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:V("dot",{active:i===e,completed:i<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:V("line",{active:i<e})})]},r)})})})]});const ep=({elementId:e,offset:t=20})=>{const n=re.useIntl(),r=()=>{const i=document.getElementById(e);if(!i)return;const a=document.getElementById("header");a&&window.scrollTo({top:i.offsetTop-a.clientHeight-t})};return c.jsx(ke,{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 tp=({items:e,className:t="",...n})=>c.jsx("ul",{className:V("buckets",t),...n,children:e.map(({title:r,text:i,link:a,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:a,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:i})]})},o))}),Cu=300,Du="ease-in-out";class np{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:Cu,easing:Du}),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:Cu,easing:Du}),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 ca=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const i=re.useIntl(),a=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new np(a.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:a,className:V("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||i.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},Eu={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},rp=e=>{let t=e;return Object.keys(Eu).includes(e)&&(t=Eu[e]),`url(${Gt}icons/${t}.svg)`};const _u={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Ed=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const i=re.useIntl(),a=t?{"--custom-icon":rp(t)}:{},s=la(`contentTypeLabel_${e}`)?i.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:V("content-type-label text-small",e in _u?_u[e]:e,r,{"has-custom-icon":t}),style:a,"data-testid":"content-type-label",children:n||s})};const Ft=({variant:e="primary",icon:t,styling:n={},className:r="",children:i,...a})=>{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,...a,children:i})};const xn=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let i=n&&!!Object.keys(n).length;const a=typeof n=="object"&&"breakpoints"in n,s=Rn(a);if(a&&typeof n=="object"&&typeof s=="number"){const m=Object.assign({},n.breakpoints),h=fd(Object.keys(m));i=md(s,h,m)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(Ft,{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,i&&typeof n=="object"&&(u||c.jsx(ke,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Ts=({children:e,...t})=>c.jsx("p",{...t,children:e}),_d={q:Ts,blockquote:Ts};for(let e=1;e<=6;e++)_d[`h${e}`]={component:Ts,props:{className:"title"}};const kd=({type:e="default",className:t="",heading:n=!1,children:r,...i})=>c.jsxs("div",{...i,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:_d},children:r}):c.jsx("p",{children:r})]});const Fd=({id:e,className:t="",show:n=!1,hide:r=!1,text:i,markdownOptions:a,fadeStyle:s="default",children:o})=>{const l=re.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",v),()=>{b.removeEventListener("transitionend",v)}},[]),y.useEffect(()=>{if(!i||typeof i!="string")return;const b=i.split(`
36
+ `);m(b.length<3?`${i.substring(0,400)}...`:b.slice(0,3).join(`
37
+ `))},[i]),y.useEffect(()=>{h==="ready-to-close"&&p("closing")},[h]);const v=({propertyName:b})=>{b==="max-height"&&p(g=>g==="opening"?"open":g==="closing"?"closed":g)},f=["opening","open"].includes(h);return c.jsxs(Ft,{variant:"subtle",className:V("hide-show-text-box",t),children:[c.jsx("div",{ref:u,id:e,className:V("content",h,s),children:i?c.jsxs(c.Fragment,{children:[c.jsx(Zt,{options:{forceBlock:!0,...a},children:h==="closed"?d:i}),h!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(ke,{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 ip=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:i={},className:a=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=i;return y.createElement(e,{className:V("icon-bulleted-list text-medium",n,a,{"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)})})},lt=()=>y.Fragment,ap=({children:e})=>c.jsx(Ft,{variant:"secondary",children:e}),sp=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),op=["span","strong","h1","h2","h3","h4","h5","h6","p"],up=({children:e})=>{const t=re.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const a of y.Children.toArray(e))if(!(!a||typeof a=="string"||typeof a=="number"))if(y.isValidElement(a)&&a.type==="summary"){if(a.props&&a.props.children){for(const s of y.Children.toArray(a.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&y.isValidElement(s)){const o=s.type;if(op.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(a);const i=n?n.toString():"";return c.jsx(ca,{label:i,className:["Sources","Resources"].includes(i)?"discrete-links":"",children:r.map(a=>a)})},lp=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(Ft,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(Ft,{variant:"primary",children:e});case"pink-textbox":return c.jsx(Ft,{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})},jt=({children:e})=>c.jsx(c.Fragment,{children:e}),cp=e=>{const t=re.useIntl(),n=Date.now().toString();let r="default";const i=e.src;i.includes("youtube")||i.includes("vimeo")?r="video":i.includes("riddle")||i.includes("sli.do")?r="poll":i.includes("padlet")&&(r="padlet");const a=`content-after-iframe-${n}`;return c.jsxs(c.Fragment,{children:[c.jsx(Ie,{element:"a",href:`#${a}`,onClick:s=>{s.preventDefault(),s.stopPropagation();const o=document.getElementById(a);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:a,tabIndex:0})]})},ku=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},dp=({children:e,...t})=>{const n=re.useIntl();let r={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(r.target="_blank");let i=e,a=!1;for(const o of 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"||ku(o.props.children[0])==="button")&&(a=!0),i=o.props.children[0];i&&typeof i!="string"&&!(typeof i=="boolean"||typeof i=="number"||!y.isValidElement(i));)if(i.props&&i.props.children&&i.props.children[0])i=i.props.children[0],i&&ku(i)==="button"&&(a=!0);else break}const s=`@${qr}`;return i===s||Array.isArray(i)&&i[0]===s?(delete r.href,delete r.target,c.jsxs("span",{...r,className:"mention deleted-user",children:["@",n.formatMessage({id:"member_deleted"})]})):a?(r={...r,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(ke,{variant:"primary",size:"medium",...r,children:i})})):c.jsx("a",{...r,children:i})},Ss=({children:e,...t})=>c.jsx("span",{className:V({url:t==null?void 0:t.href}),children:e});const fp={default:{a:dp,CollapsibleSection:ca,TextBox:Ft,CaseStudy:ap,style:lt,details:up,div:lp,iframe:cp,center:sp},"text-only":{h1:lt,h2:lt,h3:lt,h4:lt,h5:lt,h6:lt,style:lt,details:lt,div:lt,TextBox:lt,CollapsibleSection:lt,CaseStudy:lt,blockquote:lt,iframe:lt,button:lt}},Sn=({element:e="div",className:t="",options:n={},children:r,overrideType:i="default",styling:a={}})=>{if(!r)return null;const{highlightTitles:s=!1}=a;r=r.replace(/^<br\/?>/,"");const o={wrapper:y.Fragment,forceBlock:!0};let l=fp[i];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 Ad=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:i="",ctaButton:a})=>{const s=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:V("page-heading",i),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)]}),a&&c.jsx(ke,{...a,className:V("cta-button","gtm-trackable"),"data-gtm-event-context":"CreateNewArticle","data-gtm-event-type":"create-article-click",children:a.text})]}),r]})};const Yt=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:i="",children:a,element:s="span",...o})=>{const l={"--icon":`url(${Gt}icons/${r}.svg)`},{showTooltip:u,tooltipProps:d}=uo(!!i),m={},h=i?typeof i=="string"?`tooltip-${window.btoa(i)}`:i.id:void 0,p=i?typeof i=="string"?i:i.text:void 0;i&&h&&(m["aria-describedby"]=h);const v=y.createElement(i?"button":s,{className:V("pill",e,t,n,{"has-icon":r}),style:l,children:a,...d,...m,...o});return i?y.createElement(s,{className:"pill-wrapper"},c.jsxs(c.Fragment,{children:[v,c.jsx($n,{id:h,isOpen:u,children:p})]})):v};const or=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:V("status-banner text-small",n),"aria-live":"assertive"},t),fo=y.createContext({badges:[],isLoading:!0});function Bd(){return y.useContext(fo)}const Td=({children:e,badges:t})=>c.jsx(fo.Provider,{value:t,children:e}),Sd=({showDevTools:e=!0,children:t})=>{const n=new ze.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(ze.QueryClientProvider,{client:n,children:[t,e&&c.jsx(kh.ReactQueryDevtools,{initialIsOpen:!1})]})};var mp=y.createContext({client:Bi});function hp(e){var t=e.children,n=e.client,r=e.apiKey,i=e.options,a=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&&i&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(Bi.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Bi.init(r,i)),Bi)},[n,r]);return y.createElement(mp.Provider,{value:{client:a}},t)}const jd=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(hp,{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 Pd=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(Pd||{});const Od=({children:e,locale:t,messages:n})=>{const r=t||"en",i={...Vh[r],...n||{}};return c.jsx(re.IntlProvider,{locale:r,messages:i,children:e})},mo=y.createContext({}),Si={en:"English",es:"Español",fr:"Français",pt:"Português"},at=y.createContext({isLoading:!0});function da(){return y.useContext(at)}const Md=({children:e,user:t,updateDetails:n})=>c.jsx(at.Provider,{value:{...t,updateDetails:n},children:e}),ho=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Nd=()=>y.useContext(ho),Id=({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(a=>{n(s=>[...s,a])},[]),i=y.useCallback(a=>{n(s=>s.filter(o=>o!==a))},[]);return c.jsx(ho.Provider,{value:{registerOverlay:r,unregisterOverlay:i},children:e})},pp=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[i,a]=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)?(a({...h[0],isLoading:!1}),o({badges:h[1],isLoading:!1})):a({...h,isLoading:!1}),xd(5e3)}).catch(h=>{h.message===vd&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),a({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(mo.Provider,{value:{language:u,updateLanguage:m},children:c.jsx(Od,{locale:u,messages:n==null?void 0:n.messages,children:c.jsx(so.CookiesProvider,{children:c.jsx(Md,{user:i,updateDetails:a,children:c.jsx(Td,{badges:s,children:c.jsx(Id,{children:c.jsx(Sd,{showDevTools:r,children:c.jsx(jd,{user:i,children:t})})})})})})})})},gp={globe:"globe",heart:"heart_empty_thick",pencil:"pencil",star:"star_empty","speech-bubble":"speech-bubble_round"};const Rd=({slug:e})=>{const{badges:t}=Bd(),n=t==null?void 0:t.find(o=>o.slug===e);if(!n)return null;const{name:r,icon:i,colour:a,description:s}=n;return c.jsx(Yt,{className:V("user-badge",a==null?void 0:a.toLowerCase()),icon:i&&gp[i],element:"li",tooltip:s,children:r})};var dt=(e=>(e.Communities="communities",e.Platform="platform",e))(dt||{});const $d=({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 i,a;return(a=(i=t==null?void 0:t[r.scope])==null?void 0:i[r.area])==null?void 0:a.map((s,o)=>c.jsx(Rd,{slug:s},o))}))})};const vp=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const i=re.useIntl(),{showText:a=!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(a?"span":Ie,{className:a?"text":"",children:n||i.formatMessage({id:"progressBar"},{number:t})})})},po=y.memo(vp);const Ta="loadingBlock_",bp=({progress:e=0,steps:t=!1,className:n=""})=>{const r=re.useIntl();t||(t={0:{text:r.formatMessage({id:`${Ta}loading`})},75:{text:r.formatMessage({id:`${Ta}almostDone`})},100:{text:r.formatMessage({id:`${Ta}complete`})}});let i=null;const a=Object.keys(t);for(let o=0;o<a.length&&!(e<parseInt(a[o]));o++)i=a[o];const s=i&&t[i].icon?{"--icon":`url(${Gt}icons/${t[i].icon}.svg)`}:{};return c.jsxs(Ft,{className:V("loading-block",n,{"has-icon":i&&t[i].icon}),variant:"subtle",style:s,children:[i&&c.jsx("span",{className:"step",children:t[i].text}),c.jsx(po,{progress:e})]})},Ld=y.memo(bp);const It=({element:e="div",className:t="",...n})=>c.jsx(ua,{element:e,className:V("loading-placeholder",t),...n});const js={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"]},zd=(e,t)=>e in js?c.jsx("div",{className:e,children:js[e].map((n,r)=>zd(n,r))},t):c.jsx(It,{className:e},t),fa=({layout:e="overview-page",...t})=>c.jsx("div",{className:V("loading-state",e),...t,children:js[e].map((n,r)=>zd(n,r))}),qd=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):""},oi=["#5AB6A3","#A2D7AF","#806056","#3962B3"],yp=e=>{const t=Math.ceil(26/oi.length),n=qd(e).toLowerCase();if(n==="")return oi[0];const r=n.charCodeAt(0)-96;for(let i=0;i<oi.length;i++)if(r<=t*(i+1))return oi[i]};const Fu=256,on=({className:e="",src:t="",name:n,alt:r,width:i=Fu,height:a=Fu,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 v=p.getContext("2d");if(!v)return;const f=i,b=a;typeof window<"u"&&window.devicePixelRatio&&(p.width=f*window.devicePixelRatio,p.height=b*window.devicePixelRatio,v.scale(window.devicePixelRatio,window.devicePixelRatio)),v.fillStyle=yp(n),v.fillRect(0,0,f,b),v.font=`${f/3}px Arial`,v.textAlign="center",v.fillStyle="white",v.fillText(qd(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:i,height:a}):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 ma=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},xp=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const i=e!=="",a=t!=="",s=n!=="";if(!i&&!a&&!s)return"";const o=`${e}${i&&a?` — ${t}`:t}`;let l=`${o}${(i||a)&&s?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=ar(l,r)),l};const wp=y.lazy(()=>Promise.resolve().then(()=>Jh)),Cp=y.lazy(()=>Promise.resolve().then(()=>uk));let ui=null;const rn=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:i={},functions:a={},gtmContext:s="member",gtmType:o="member-click",className:l="",badges:u,...d})=>{var B,j,M,U,W;const m=re.useIntl(),{profile:h,...p}=a,{size:v="medium",variant:f="inline",isCondensed:b=!0,additionalContentNewLine:g=!1}=i,x=y.useContext(at),C=h&&x&&typeof x.id=="string",[F,D]=y.useState(!1),_=ma(t);_.name||(_.name=m.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:T,image:R}=_;let{url:O}=_;typeof t=="object"&&t.link!==void 0&&(t.link===!1?O=void 0:O=t.link);const z=xp(_),$=r&&r.createdAt?As(r.createdAt):!1,A=r&&r.createdAt?lo(r.createdAt):"";return y.createElement(e,{...d,className:V("member text-medium",v,f,l,{"has-profile-link":C}),...p,children:c.jsxs(c.Fragment,{children:[c.jsxs(yn,{href:O,gtmType:o,gtmContext:s,onClick:ie=>{if(ie==null||ie.preventDefault(),ie==null||ie.stopPropagation(),!O)return;ui&&clearTimeout(ui),ui=setTimeout(()=>{window.location.href=O},150);const se=new CustomEvent(rt.MEMBER_CLICKED,{detail:{link:O,timeout:ui}});document.dispatchEvent(se)},children:[c.jsx(on,{name:T,src:R,alt:n}),c.jsxs("div",{className:"details",children:[c.jsxs("div",{className:V("name",{"new-line":g}),"data-testid":"member-name",children:[c.jsx("span",{children:T}),(u==null?void 0:u.showBadges)&&(_==null?void 0:_.badges)&&c.jsx($d,{userBadges:_.badges,badgeOptions:u}),r&&c.jsxs("span",{className:V("additional-content",{"new-line":g}),children:[r.createdAt&&$&&!((B=r==null?void 0:r.customMessage)!=null&&B.text)&&c.jsx("span",{className:"date",title:A,"aria-label":A,"data-testid":"date",children:m.formatMessage({id:`dates_${$.path}`},{number:$.number})}),r.createdAt&&$&&((j=r==null?void 0:r.customMessage)==null?void 0:j.text)&&c.jsx("span",{children:m.formatMessage({id:(M=r.customMessage)==null?void 0:M.text},{time:m.formatMessage({id:`dates_${$.path}`},{number:$.number}),community:(W=(U=r.customMessage)==null?void 0:U.link)==null?void 0:W.text,link:ie=>{var se,E;return c.jsx("a",{href:`${(E=(se=r.customMessage)==null?void 0:se.link)==null?void 0:E.url}`,onClick:ee=>ee.stopPropagation(),children:ie})}})}),r.didEdit&&c.jsx("em",{children:m.formatMessage({id:"discussion_edited"})})]})]}),z&&!g&&c.jsx("small",{className:V({"text-medium":v==="large"}),"data-testid":"member-details",children:b?z:c.jsxs(c.Fragment,{children:[_.role,_.organisation?` — ${_.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:_.country})]})})]})]}),z&&h&&C?c.jsxs(c.Fragment,{children:[c.jsx(ke,{variant:"tertiary",size:"small",onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),D(!0)},"data-testid":"profile-button",children:m.formatMessage({id:"member_profile"})}),c.jsx(wp,{children:c.jsx(Cp,{form:h,showModal:F,content:{title:m.formatMessage({id:"member_profile"})},functions:{onClose:()=>{D(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},Dp=Object.freeze(Object.defineProperty({__proto__:null,default:rn},Symbol.toStringTag,{value:"Module"}));const Au={small:24,medium:48},go=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:i,showGap:a,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...d})=>{const m=re.useIntl();return!n||n.length===0?null:y.createElement(e,{...d,className:V("contributors",u,i,{"has-gap":a}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((h,p)=>{let v,f="";if(p<o){const{name:b="",image:g=""}=ma(h);if(s)return c.jsx(It,{element:"li",className:"contributor"},p);v=c.jsx(on,{name:b,src:g,width:Au[i||"medium"],height:Au[i||"medium"]})}else if(p===o){const b=(t||n.length)-o;v=c.jsxs("small",{className:V({"large-number":b>99}),children:["+",Hh(b,0)]}),f="number-left"}return v?c.jsx("li",{className:V("contributor",f),children:v},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]}`}):ar(n[0].name||"",20):l||null})]})})};const vo=({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 Ps={exports:{}},li={exports:{}},qe={};/** @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 ku;function gp(){if(ku)return Re;ku=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,D=e?Symbol.for("react.scope"):60119;function w(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 a:case i:case h:return E;default:switch(E=E&&E.$$typeof,E){case o:case d:case v:case m:case s:return E;default:return k}}case n:return k}}}function F(E){return w(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=v,Re.Memo=m,Re.Portal=n,Re.Profiler=a,Re.StrictMode=i,Re.Suspense=h,Re.isAsyncMode=function(E){return F(E)||w(E)===l},Re.isConcurrentMode=F,Re.isContextConsumer=function(E){return w(E)===o},Re.isContextProvider=function(E){return w(E)===s},Re.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===t},Re.isForwardRef=function(E){return w(E)===d},Re.isFragment=function(E){return w(E)===r},Re.isLazy=function(E){return w(E)===v},Re.isMemo=function(E){return w(E)===m},Re.isPortal=function(E){return w(E)===n},Re.isProfiler=function(E){return w(E)===a},Re.isStrictMode=function(E){return w(E)===i},Re.isSuspense=function(E){return w(E)===h},Re.isValidElementType=function(E){return typeof E=="string"||typeof E=="function"||E===r||E===u||E===a||E===i||E===h||E===p||typeof E=="object"&&E!==null&&(E.$$typeof===v||E.$$typeof===m||E.$$typeof===s||E.$$typeof===o||E.$$typeof===d||E.$$typeof===b||E.$$typeof===g||E.$$typeof===D||E.$$typeof===f)},Re.typeOf=w,Re}var $e={};/** @license React v16.13.1
44
+ */var Bu;function Ep(){if(Bu)return qe;Bu=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,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,v=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function C(D){if(typeof D=="object"&&D!==null){var _=D.$$typeof;switch(_){case t:switch(D=D.type,D){case l:case u:case r:case a:case i:case m:return D;default:switch(D=D&&D.$$typeof,D){case o:case d:case v:case p:case s:return D;default:return _}}case n:return _}}}function F(D){return C(D)===u}return qe.AsyncMode=l,qe.ConcurrentMode=u,qe.ContextConsumer=o,qe.ContextProvider=s,qe.Element=t,qe.ForwardRef=d,qe.Fragment=r,qe.Lazy=v,qe.Memo=p,qe.Portal=n,qe.Profiler=a,qe.StrictMode=i,qe.Suspense=m,qe.isAsyncMode=function(D){return F(D)||C(D)===l},qe.isConcurrentMode=F,qe.isContextConsumer=function(D){return C(D)===o},qe.isContextProvider=function(D){return C(D)===s},qe.isElement=function(D){return typeof D=="object"&&D!==null&&D.$$typeof===t},qe.isForwardRef=function(D){return C(D)===d},qe.isFragment=function(D){return C(D)===r},qe.isLazy=function(D){return C(D)===v},qe.isMemo=function(D){return C(D)===p},qe.isPortal=function(D){return C(D)===n},qe.isProfiler=function(D){return C(D)===a},qe.isStrictMode=function(D){return C(D)===i},qe.isSuspense=function(D){return C(D)===m},qe.isValidElementType=function(D){return typeof D=="string"||typeof D=="function"||D===r||D===u||D===a||D===i||D===m||D===h||typeof D=="object"&&D!==null&&(D.$$typeof===v||D.$$typeof===p||D.$$typeof===s||D.$$typeof===o||D.$$typeof===d||D.$$typeof===b||D.$$typeof===g||D.$$typeof===x||D.$$typeof===f)},qe.typeOf=C,qe}var Ue={};/** @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 Fu;function vp(){return Fu||(Fu=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,D=e?Symbol.for("react.scope"):60119;function w(ee){return typeof ee=="string"||typeof ee=="function"||ee===r||ee===u||ee===a||ee===i||ee===h||ee===p||typeof ee=="object"&&ee!==null&&(ee.$$typeof===v||ee.$$typeof===m||ee.$$typeof===s||ee.$$typeof===o||ee.$$typeof===d||ee.$$typeof===b||ee.$$typeof===g||ee.$$typeof===D||ee.$$typeof===f)}function F(ee){if(typeof ee=="object"&&ee!==null){var pe=ee.$$typeof;switch(pe){case t:var ve=ee.type;switch(ve){case l:case u:case r:case a:case i:case h:return ve;default:var Ee=ve&&ve.$$typeof;switch(Ee){case o:case d:case v:case m:case s:return Ee;default:return pe}}case n:return pe}}}var E=l,k=u,T=o,R=s,P=t,z=d,$=r,B=v,A=m,j=n,M=a,U=i,W=h,ie=!1;function ae(ee){return ie||(ie=!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.")),C(ee)||F(ee)===l}function C(ee){return F(ee)===u}function G(ee){return F(ee)===o}function ne(ee){return F(ee)===s}function _(ee){return typeof ee=="object"&&ee!==null&&ee.$$typeof===t}function O(ee){return F(ee)===d}function q(ee){return F(ee)===r}function S(ee){return F(ee)===v}function L(ee){return F(ee)===m}function Q(ee){return F(ee)===n}function K(ee){return F(ee)===a}function J(ee){return F(ee)===i}function ce(ee){return F(ee)===h}$e.AsyncMode=E,$e.ConcurrentMode=k,$e.ContextConsumer=T,$e.ContextProvider=R,$e.Element=P,$e.ForwardRef=z,$e.Fragment=$,$e.Lazy=B,$e.Memo=A,$e.Portal=j,$e.Profiler=M,$e.StrictMode=U,$e.Suspense=W,$e.isAsyncMode=ae,$e.isConcurrentMode=C,$e.isContextConsumer=G,$e.isContextProvider=ne,$e.isElement=_,$e.isForwardRef=O,$e.isFragment=q,$e.isLazy=S,$e.isMemo=L,$e.isPortal=Q,$e.isProfiler=K,$e.isStrictMode=J,$e.isSuspense=ce,$e.isValidElementType=w,$e.typeOf=F}()),$e}var Au;function Id(){return Au||(Au=1,process.env.NODE_ENV==="production"?oi.exports=gp():oi.exports=vp()),oi.exports}/*
51
+ */var Tu;function _p(){return Tu||(Tu=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,a=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,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,v=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function C(J){return typeof J=="string"||typeof J=="function"||J===r||J===u||J===a||J===i||J===m||J===h||typeof J=="object"&&J!==null&&(J.$$typeof===v||J.$$typeof===p||J.$$typeof===s||J.$$typeof===o||J.$$typeof===d||J.$$typeof===b||J.$$typeof===g||J.$$typeof===x||J.$$typeof===f)}function F(J){if(typeof J=="object"&&J!==null){var pe=J.$$typeof;switch(pe){case t:var de=J.type;switch(de){case l:case u:case r:case a:case i:case m:return de;default:var xe=de&&de.$$typeof;switch(xe){case o:case d:case v:case p:case s:return xe;default:return pe}}case n:return pe}}}var D=l,_=u,T=o,R=s,O=t,z=d,$=r,A=v,B=p,j=n,M=a,U=i,W=m,ie=!1;function se(J){return ie||(ie=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),E(J)||F(J)===l}function E(J){return F(J)===u}function ee(J){return F(J)===o}function Z(J){return F(J)===s}function k(J){return typeof J=="object"&&J!==null&&J.$$typeof===t}function P(J){return F(J)===d}function q(J){return F(J)===r}function S(J){return F(J)===v}function L(J){return F(J)===p}function Q(J){return F(J)===n}function Y(J){return F(J)===a}function te(J){return F(J)===i}function ce(J){return F(J)===m}Ue.AsyncMode=D,Ue.ConcurrentMode=_,Ue.ContextConsumer=T,Ue.ContextProvider=R,Ue.Element=O,Ue.ForwardRef=z,Ue.Fragment=$,Ue.Lazy=A,Ue.Memo=B,Ue.Portal=j,Ue.Profiler=M,Ue.StrictMode=U,Ue.Suspense=W,Ue.isAsyncMode=se,Ue.isConcurrentMode=E,Ue.isContextConsumer=ee,Ue.isContextProvider=Z,Ue.isElement=k,Ue.isForwardRef=P,Ue.isFragment=q,Ue.isLazy=S,Ue.isMemo=L,Ue.isPortal=Q,Ue.isProfiler=Y,Ue.isStrictMode=te,Ue.isSuspense=ce,Ue.isValidElementType=C,Ue.typeOf=F}()),Ue}var Su;function Ud(){return Su||(Su=1,process.env.NODE_ENV==="production"?li.exports=Ep():li.exports=_p()),li.exports}/*
52
52
  object-assign
53
53
  (c) Sindre Sorhus
54
54
  @license MIT
55
- */var Sa,Bu;function bp(){if(Bu)return Sa;Bu=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(a){if(a==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(a)}function i(){try{if(!Object.assign)return!1;var a=new String("abc");if(a[5]="de",Object.getOwnPropertyNames(a)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var 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 Sa=i()?Object.assign:function(a,s){for(var o,l=r(a),u,d=1;d<arguments.length;d++){o=Object(arguments[d]);for(var h in o)t.call(o,h)&&(l[h]=o[h]);if(e){u=e(o);for(var p=0;p<u.length;p++)n.call(o,u[p])&&(l[u[p]]=o[u[p]])}}return l},Sa}var ja,Tu;function bo(){if(Tu)return ja;Tu=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ja=e,ja}var Oa,Su;function Rd(){return Su||(Su=1,Oa=Function.call.bind(Object.prototype.hasOwnProperty)),Oa}var Pa,ju;function yp(){if(ju)return Pa;ju=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=bo(),n={},r=Rd();e=function(a){var s="Warning: "+a;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(a,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var d in a)if(r(a,d)){var h;try{if(typeof a[d]!="function"){var p=Error((l||"React class")+": "+o+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}h=a[d](s,d,l,o,null,t)}catch(v){h=v}if(h&&!(h 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 h+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),h instanceof Error&&!(h.message in n)){n[h.message]=!0;var m=u?u():"";e("Failed "+o+" type: "+h.message+(m??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Pa=i,Pa}var Ma,Ou;function xp(){if(Ou)return Ma;Ou=1;var e=Id(),t=bp(),n=bo(),r=Rd(),i=yp(),a=function(){};process.env.NODE_ENV!=="production"&&(a=function(o){var l="Warning: "+o;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function s(){return null}return Ma=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function h(C){var G=C&&(u&&C[u]||C[d]);if(typeof G=="function")return G}var p="<<anonymous>>",m={array:g("array"),bigint:g("bigint"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:D(),arrayOf:w,element:F(),elementType:E(),instanceOf:k,node:z(),objectOf:R,oneOf:T,oneOfType:P,shape:B,exact:A};function v(C,G){return C===G?C!==0||1/C===1/G:C!==C&&G!==G}function f(C,G){this.message=C,this.data=G&&typeof G=="object"?G:{},this.stack=""}f.prototype=Error.prototype;function b(C){if(process.env.NODE_ENV!=="production")var G={},ne=0;function _(q,S,L,Q,K,J,ce){if(Q=Q||p,J=J||L,ce!==n){if(l){var ee=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 ee.name="Invariant Violation",ee}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var pe=Q+":"+L;!G[pe]&&ne<3&&(a("You are manually calling a React.PropTypes validation function for the `"+J+"` prop on `"+Q+"`. 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."),G[pe]=!0,ne++)}}return S[L]==null?q?S[L]===null?new f("The "+K+" `"+J+"` is marked as required "+("in `"+Q+"`, but its value is `null`.")):new f("The "+K+" `"+J+"` is marked as required in "+("`"+Q+"`, but its value is `undefined`.")):null:C(S,L,Q,K,J)}var O=_.bind(null,!1);return O.isRequired=_.bind(null,!0),O}function g(C){function G(ne,_,O,q,S,L){var Q=ne[_],K=U(Q);if(K!==C){var J=W(Q);return new f("Invalid "+q+" `"+S+"` of type "+("`"+J+"` supplied to `"+O+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return b(G)}function D(){return b(s)}function w(C){function G(ne,_,O,q,S){if(typeof C!="function")return new f("Property `"+S+"` of component `"+O+"` has invalid PropType notation inside arrayOf.");var L=ne[_];if(!Array.isArray(L)){var Q=U(L);return new f("Invalid "+q+" `"+S+"` of type "+("`"+Q+"` supplied to `"+O+"`, expected an array."))}for(var K=0;K<L.length;K++){var J=C(L,K,O,q,S+"["+K+"]",n);if(J instanceof Error)return J}return null}return b(G)}function F(){function C(G,ne,_,O,q){var S=G[ne];if(!o(S)){var L=U(S);return new f("Invalid "+O+" `"+q+"` of type "+("`"+L+"` supplied to `"+_+"`, expected a single ReactElement."))}return null}return b(C)}function E(){function C(G,ne,_,O,q){var S=G[ne];if(!e.isValidElementType(S)){var L=U(S);return new f("Invalid "+O+" `"+q+"` of type "+("`"+L+"` supplied to `"+_+"`, expected a single ReactElement type."))}return null}return b(C)}function k(C){function G(ne,_,O,q,S){if(!(ne[_]instanceof C)){var L=C.name||p,Q=ae(ne[_]);return new f("Invalid "+q+" `"+S+"` of type "+("`"+Q+"` supplied to `"+O+"`, expected ")+("instance of `"+L+"`."))}return null}return b(G)}function T(C){if(!Array.isArray(C))return process.env.NODE_ENV!=="production"&&(arguments.length>1?a("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):a("Invalid argument supplied to oneOf, expected an array.")),s;function G(ne,_,O,q,S){for(var L=ne[_],Q=0;Q<C.length;Q++)if(v(L,C[Q]))return null;var K=JSON.stringify(C,function(ce,ee){var pe=W(ee);return pe==="symbol"?String(ee):ee});return new f("Invalid "+q+" `"+S+"` of value `"+String(L)+"` "+("supplied to `"+O+"`, expected one of "+K+"."))}return b(G)}function R(C){function G(ne,_,O,q,S){if(typeof C!="function")return new f("Property `"+S+"` of component `"+O+"` has invalid PropType notation inside objectOf.");var L=ne[_],Q=U(L);if(Q!=="object")return new f("Invalid "+q+" `"+S+"` of type "+("`"+Q+"` supplied to `"+O+"`, expected an object."));for(var K in L)if(r(L,K)){var J=C(L,K,O,q,S+"."+K,n);if(J instanceof Error)return J}return null}return b(G)}function P(C){if(!Array.isArray(C))return process.env.NODE_ENV!=="production"&&a("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var G=0;G<C.length;G++){var ne=C[G];if(typeof ne!="function")return a("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ie(ne)+" at index "+G+"."),s}function _(O,q,S,L,Q){for(var K=[],J=0;J<C.length;J++){var ce=C[J],ee=ce(O,q,S,L,Q,n);if(ee==null)return null;ee.data&&r(ee.data,"expectedType")&&K.push(ee.data.expectedType)}var pe=K.length>0?", expected one of type ["+K.join(", ")+"]":"";return new f("Invalid "+L+" `"+Q+"` supplied to "+("`"+S+"`"+pe+"."))}return b(_)}function z(){function C(G,ne,_,O,q){return j(G[ne])?null:new f("Invalid "+O+" `"+q+"` supplied to "+("`"+_+"`, expected a ReactNode."))}return b(C)}function $(C,G,ne,_,O){return new f((C||"React class")+": "+G+" type `"+ne+"."+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+O+"`.")}function B(C){function G(ne,_,O,q,S){var L=ne[_],Q=U(L);if(Q!=="object")return new f("Invalid "+q+" `"+S+"` of type `"+Q+"` "+("supplied to `"+O+"`, expected `object`."));for(var K in C){var J=C[K];if(typeof J!="function")return $(O,q,S,K,W(J));var ce=J(L,K,O,q,S+"."+K,n);if(ce)return ce}return null}return b(G)}function A(C){function G(ne,_,O,q,S){var L=ne[_],Q=U(L);if(Q!=="object")return new f("Invalid "+q+" `"+S+"` of type `"+Q+"` "+("supplied to `"+O+"`, expected `object`."));var K=t({},ne[_],C);for(var J in K){var ce=C[J];if(r(C,J)&&typeof ce!="function")return $(O,q,S,J,W(ce));if(!ce)return new f("Invalid "+q+" `"+S+"` key `"+J+"` supplied to `"+O+"`.\nBad object: "+JSON.stringify(ne[_],null," ")+`
56
- Valid keys: `+JSON.stringify(Object.keys(C),null," "));var ee=ce(L,J,O,q,S+"."+J,n);if(ee)return ee}return null}return b(G)}function j(C){switch(typeof C){case"number":case"string":case"undefined":return!0;case"boolean":return!C;case"object":if(Array.isArray(C))return C.every(j);if(C===null||o(C))return!0;var G=h(C);if(G){var ne=G.call(C),_;if(G!==C.entries){for(;!(_=ne.next()).done;)if(!j(_.value))return!1}else for(;!(_=ne.next()).done;){var O=_.value;if(O&&!j(O[1]))return!1}}else return!1;return!0;default:return!1}}function M(C,G){return C==="symbol"?!0:G?G["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&G instanceof Symbol:!1}function U(C){var G=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":M(G,C)?"symbol":G}function W(C){if(typeof C>"u"||C===null)return""+C;var G=U(C);if(G==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return G}function ie(C){var G=W(C);switch(G){case"array":case"object":return"an "+G;case"boolean":case"date":case"regexp":return"a "+G;default:return G}}function ae(C){return!C.constructor||!C.constructor.name?p:C.constructor.name}return m.checkPropTypes=i,m.resetWarningCache=i.resetWarningCache,m.PropTypes=m,m},Ma}var Na,Pu;function Cp(){if(Pu)return Na;Pu=1;var e=bo();function t(){}function n(){}return n.resetWarningCache=t,Na=function(){function r(s,o,l,u,d,h){if(h!==e){var p=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 p.name="Invariant Violation",p}}r.isRequired=r;function i(){return r}var a={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return a.PropTypes=a,a},Na}if(process.env.NODE_ENV!=="production"){var wp=Id(),Dp=!0;Os.exports=xp()(wp.isElement,Dp)}else Os.exports=Cp()();var Ep=Os.exports;/*!
55
+ */var Sa,ju;function kp(){if(ju)return Sa;ju=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(a){if(a==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(a)}function i(){try{if(!Object.assign)return!1;var a=new String("abc");if(a[5]="de",Object.getOwnPropertyNames(a)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var 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 Sa=i()?Object.assign:function(a,s){for(var o,l=r(a),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},Sa}var ja,Pu;function bo(){if(Pu)return ja;Pu=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ja=e,ja}var Pa,Ou;function Wd(){return Ou||(Ou=1,Pa=Function.call.bind(Object.prototype.hasOwnProperty)),Pa}var Oa,Mu;function Fp(){if(Mu)return Oa;Mu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=bo(),n={},r=Wd();e=function(a){var s="Warning: "+a;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(a,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var d in a)if(r(a,d)){var m;try{if(typeof a[d]!="function"){var h=Error((l||"React class")+": "+o+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}m=a[d](s,d,l,o,null,t)}catch(v){m=v}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 i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Oa=i,Oa}var Ma,Nu;function Ap(){if(Nu)return Ma;Nu=1;var e=Ud(),t=kp(),n=bo(),r=Wd(),i=Fp(),a=function(){};process.env.NODE_ENV!=="production"&&(a=function(o){var l="Warning: "+o;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function s(){return null}return Ma=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function m(E){var ee=E&&(u&&E[u]||E[d]);if(typeof ee=="function")return ee}var h="<<anonymous>>",p={array:g("array"),bigint:g("bigint"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:x(),arrayOf:C,element:F(),elementType:D(),instanceOf:_,node:z(),objectOf:R,oneOf:T,oneOfType:O,shape:A,exact:B};function v(E,ee){return E===ee?E!==0||1/E===1/ee:E!==E&&ee!==ee}function f(E,ee){this.message=E,this.data=ee&&typeof ee=="object"?ee:{},this.stack=""}f.prototype=Error.prototype;function b(E){if(process.env.NODE_ENV!=="production")var ee={},Z=0;function k(q,S,L,Q,Y,te,ce){if(Q=Q||h,te=te||L,ce!==n){if(l){var J=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw J.name="Invariant Violation",J}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var pe=Q+":"+L;!ee[pe]&&Z<3&&(a("You are manually calling a React.PropTypes validation function for the `"+te+"` prop on `"+Q+"`. 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."),ee[pe]=!0,Z++)}}return S[L]==null?q?S[L]===null?new f("The "+Y+" `"+te+"` is marked as required "+("in `"+Q+"`, but its value is `null`.")):new f("The "+Y+" `"+te+"` is marked as required in "+("`"+Q+"`, but its value is `undefined`.")):null:E(S,L,Q,Y,te)}var P=k.bind(null,!1);return P.isRequired=k.bind(null,!0),P}function g(E){function ee(Z,k,P,q,S,L){var Q=Z[k],Y=U(Q);if(Y!==E){var te=W(Q);return new f("Invalid "+q+" `"+S+"` of type "+("`"+te+"` supplied to `"+P+"`, expected ")+("`"+E+"`."),{expectedType:E})}return null}return b(ee)}function x(){return b(s)}function C(E){function ee(Z,k,P,q,S){if(typeof E!="function")return new f("Property `"+S+"` of component `"+P+"` has invalid PropType notation inside arrayOf.");var L=Z[k];if(!Array.isArray(L)){var Q=U(L);return new f("Invalid "+q+" `"+S+"` of type "+("`"+Q+"` supplied to `"+P+"`, expected an array."))}for(var Y=0;Y<L.length;Y++){var te=E(L,Y,P,q,S+"["+Y+"]",n);if(te instanceof Error)return te}return null}return b(ee)}function F(){function E(ee,Z,k,P,q){var S=ee[Z];if(!o(S)){var L=U(S);return new f("Invalid "+P+" `"+q+"` of type "+("`"+L+"` supplied to `"+k+"`, expected a single ReactElement."))}return null}return b(E)}function D(){function E(ee,Z,k,P,q){var S=ee[Z];if(!e.isValidElementType(S)){var L=U(S);return new f("Invalid "+P+" `"+q+"` of type "+("`"+L+"` supplied to `"+k+"`, expected a single ReactElement type."))}return null}return b(E)}function _(E){function ee(Z,k,P,q,S){if(!(Z[k]instanceof E)){var L=E.name||h,Q=se(Z[k]);return new f("Invalid "+q+" `"+S+"` of type "+("`"+Q+"` supplied to `"+P+"`, expected ")+("instance of `"+L+"`."))}return null}return b(ee)}function T(E){if(!Array.isArray(E))return process.env.NODE_ENV!=="production"&&(arguments.length>1?a("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):a("Invalid argument supplied to oneOf, expected an array.")),s;function ee(Z,k,P,q,S){for(var L=Z[k],Q=0;Q<E.length;Q++)if(v(L,E[Q]))return null;var Y=JSON.stringify(E,function(ce,J){var pe=W(J);return pe==="symbol"?String(J):J});return new f("Invalid "+q+" `"+S+"` of value `"+String(L)+"` "+("supplied to `"+P+"`, expected one of "+Y+"."))}return b(ee)}function R(E){function ee(Z,k,P,q,S){if(typeof E!="function")return new f("Property `"+S+"` of component `"+P+"` has invalid PropType notation inside objectOf.");var L=Z[k],Q=U(L);if(Q!=="object")return new f("Invalid "+q+" `"+S+"` of type "+("`"+Q+"` supplied to `"+P+"`, expected an object."));for(var Y in L)if(r(L,Y)){var te=E(L,Y,P,q,S+"."+Y,n);if(te instanceof Error)return te}return null}return b(ee)}function O(E){if(!Array.isArray(E))return process.env.NODE_ENV!=="production"&&a("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var ee=0;ee<E.length;ee++){var Z=E[ee];if(typeof Z!="function")return a("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+ie(Z)+" at index "+ee+"."),s}function k(P,q,S,L,Q){for(var Y=[],te=0;te<E.length;te++){var ce=E[te],J=ce(P,q,S,L,Q,n);if(J==null)return null;J.data&&r(J.data,"expectedType")&&Y.push(J.data.expectedType)}var pe=Y.length>0?", expected one of type ["+Y.join(", ")+"]":"";return new f("Invalid "+L+" `"+Q+"` supplied to "+("`"+S+"`"+pe+"."))}return b(k)}function z(){function E(ee,Z,k,P,q){return j(ee[Z])?null:new f("Invalid "+P+" `"+q+"` supplied to "+("`"+k+"`, expected a ReactNode."))}return b(E)}function $(E,ee,Z,k,P){return new f((E||"React class")+": "+ee+" type `"+Z+"."+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+P+"`.")}function A(E){function ee(Z,k,P,q,S){var L=Z[k],Q=U(L);if(Q!=="object")return new f("Invalid "+q+" `"+S+"` of type `"+Q+"` "+("supplied to `"+P+"`, expected `object`."));for(var Y in E){var te=E[Y];if(typeof te!="function")return $(P,q,S,Y,W(te));var ce=te(L,Y,P,q,S+"."+Y,n);if(ce)return ce}return null}return b(ee)}function B(E){function ee(Z,k,P,q,S){var L=Z[k],Q=U(L);if(Q!=="object")return new f("Invalid "+q+" `"+S+"` of type `"+Q+"` "+("supplied to `"+P+"`, expected `object`."));var Y=t({},Z[k],E);for(var te in Y){var ce=E[te];if(r(E,te)&&typeof ce!="function")return $(P,q,S,te,W(ce));if(!ce)return new f("Invalid "+q+" `"+S+"` key `"+te+"` supplied to `"+P+"`.\nBad object: "+JSON.stringify(Z[k],null," ")+`
56
+ Valid keys: `+JSON.stringify(Object.keys(E),null," "));var J=ce(L,te,P,q,S+"."+te,n);if(J)return J}return null}return b(ee)}function j(E){switch(typeof E){case"number":case"string":case"undefined":return!0;case"boolean":return!E;case"object":if(Array.isArray(E))return E.every(j);if(E===null||o(E))return!0;var ee=m(E);if(ee){var Z=ee.call(E),k;if(ee!==E.entries){for(;!(k=Z.next()).done;)if(!j(k.value))return!1}else for(;!(k=Z.next()).done;){var P=k.value;if(P&&!j(P[1]))return!1}}else return!1;return!0;default:return!1}}function M(E,ee){return E==="symbol"?!0:ee?ee["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&ee instanceof Symbol:!1}function U(E){var ee=typeof E;return Array.isArray(E)?"array":E instanceof RegExp?"object":M(ee,E)?"symbol":ee}function W(E){if(typeof E>"u"||E===null)return""+E;var ee=U(E);if(ee==="object"){if(E instanceof Date)return"date";if(E instanceof RegExp)return"regexp"}return ee}function ie(E){var ee=W(E);switch(ee){case"array":case"object":return"an "+ee;case"boolean":case"date":case"regexp":return"a "+ee;default:return ee}}function se(E){return!E.constructor||!E.constructor.name?h:E.constructor.name}return p.checkPropTypes=i,p.resetWarningCache=i.resetWarningCache,p.PropTypes=p,p},Ma}var Na,Iu;function Bp(){if(Iu)return Na;Iu=1;var e=bo();function t(){}function n(){}return n.resetWarningCache=t,Na=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 i(){return r}var a={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return a.PropTypes=a,a},Na}if(process.env.NODE_ENV!=="production"){var Tp=Ud(),Sp=!0;Ps.exports=Ap()(Tp.isElement,Sp)}else Ps.exports=Bp()();var jp=Ps.exports;/*!
57
57
  * tabbable 6.2.0
58
58
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
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])"],zi=$d.join(","),Ld=typeof Element>"u",jn=Ld?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,qi=!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},Ui=function e(t,n){var r;n===void 0&&(n=!0);var i=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),a=i===""||i==="true",s=a||n&&t&&e(t.parentNode);return s},_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(Ui(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(zi));return n&&jn.call(t,zi)&&i.unshift(t),i=i.filter(r),i},qd=function e(t,n,r){for(var i=[],a=Array.from(t);a.length;){var s=a.shift();if(!Ui(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?i.push.apply(i,u):i.push({scopeParent:s,candidates:u})}else{var d=jn.call(s,zi);d&&r.filter(s)&&(n||!t.includes(s))&&i.push(s);var h=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!Ui(h,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(h&&p){var m=e(h===!0?s.children:h.children,!0,r);r.flatten?i.push.apply(i,m):i.push({scopeParent:s,candidates:m})}else a.unshift.apply(a,s.children)}}return i},Ud=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},pn=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=pn(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||qi(t),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(t.name));else try{i=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var a=Tp(i,t.form);return!a||a===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&&qi(t),i=(n=r)===null||n===void 0?void 0:n.host,a=!1;if(r&&r!==t){var s,o,l;for(a=!!((s=i)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(i)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!a&&i;){var u,d,h;r=qi(i),i=(u=r)===null||u===void 0?void 0:u.host,a=!!((d=i)!==null&&d!==void 0&&(h=d.ownerDocument)!==null&&h!==void 0&&h.contains(i))}}return a},Mu=function(t){var n=t.getBoundingClientRect(),r=n.width,i=n.height;return r===0&&i===0},Mp=function(t,n){var r=n.displayCheck,i=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var a=jn.call(t,"details>summary:first-of-type"),s=a?t.parentElement:t;if(jn.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof i=="function"){for(var o=t;t;){var l=t.parentElement,u=qi(t);if(l&&!l.shadowRoot&&i(l)===!0)return Mu(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 Mu(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 i=n.children.item(r);if(i.tagName==="LEGEND")return jn.call(n,"fieldset[disabled] *")?!0:!i.contains(t)}return!0}n=n.parentElement}return!1},Wi=function(t,n){return!(n.disabled||Ui(n)||Ap(n)||Mp(n,t)||Bp(n)||Np(n))},Ps=function(t,n){return!(Op(n)||pn(n)<0||!Wi(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(i,a){var s=!!i.scopeParent,o=s?i.scopeParent:i,l=kp(o,s),u=s?e(i.candidates):o;l===0?s?n.push.apply(n,u):n.push(o):r.push({documentOrder:a,tabIndex:l,item:i,isScope:s,content:u})}),r.sort(Fp).reduce(function(i,a){return a.isScope?i.push.apply(i,a.content):i.push(a.content),i},[]).concat(n)},Vd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=qd([t],n.includeContainer,{filter:Ps.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Ip}):r=zd(t,n.includeContainer,Ps.bind(null,n)),Rp(r)},Hd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=qd([t],n.includeContainer,{filter:Wi.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=zd(t,n.includeContainer,Wi.bind(null,n)),r},En=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return jn.call(t,zi)===!1?!1:Ps(n,t)},$p=$d.concat("iframe").join(","),Ti=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return jn.call(t,$p)===!1?!1:Wi(n,t)};const Lp=Object.freeze(Object.defineProperty({__proto__:null,focusable:Hd,getTabIndex:pn,isFocusable:Ti,isTabbable:En,tabbable:Vd},Symbol.toStringTag,{value:"Module"}));/*!
59
+ */var Vd=["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])"],Ui=Vd.join(","),Hd=typeof Element>"u",jn=Hd?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Wi=!Hd&&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},Vi=function e(t,n){var r;n===void 0&&(n=!0);var i=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),a=i===""||i==="true",s=a||n&&t&&e(t.parentNode);return s},Pp=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Kd=function(t,n,r){if(Vi(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(Ui));return n&&jn.call(t,Ui)&&i.unshift(t),i=i.filter(r),i},Zd=function e(t,n,r){for(var i=[],a=Array.from(t);a.length;){var s=a.shift();if(!Vi(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?i.push.apply(i,u):i.push({scopeParent:s,candidates:u})}else{var d=jn.call(s,Ui);d&&r.filter(s)&&(n||!t.includes(s))&&i.push(s);var m=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),h=!Vi(m,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(m&&h){var p=e(m===!0?s.children:m.children,!0,r);r.flatten?i.push.apply(i,p):i.push({scopeParent:s,candidates:p})}else a.unshift.apply(a,s.children)}}return i},Yd=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},pn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Pp(t))&&!Yd(t)?0:t.tabIndex},Op=function(t,n){var r=pn(t);return r<0&&n&&!Yd(t)?0:r},Mp=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Gd=function(t){return t.tagName==="INPUT"},Np=function(t){return Gd(t)&&t.type==="hidden"},Ip=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Rp=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},$p=function(t){if(!t.name)return!0;var n=t.form||Wi(t),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(t.name));else try{i=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var a=Rp(i,t.form);return!a||a===t},Lp=function(t){return Gd(t)&&t.type==="radio"},zp=function(t){return Lp(t)&&!$p(t)},qp=function(t){var n,r=t&&Wi(t),i=(n=r)===null||n===void 0?void 0:n.host,a=!1;if(r&&r!==t){var s,o,l;for(a=!!((s=i)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(i)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!a&&i;){var u,d,m;r=Wi(i),i=(u=r)===null||u===void 0?void 0:u.host,a=!!((d=i)!==null&&d!==void 0&&(m=d.ownerDocument)!==null&&m!==void 0&&m.contains(i))}}return a},Ru=function(t){var n=t.getBoundingClientRect(),r=n.width,i=n.height;return r===0&&i===0},Up=function(t,n){var r=n.displayCheck,i=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var a=jn.call(t,"details>summary:first-of-type"),s=a?t.parentElement:t;if(jn.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof i=="function"){for(var o=t;t;){var l=t.parentElement,u=Wi(t);if(l&&!l.shadowRoot&&i(l)===!0)return Ru(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(qp(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Ru(t);return!1},Wp=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var i=n.children.item(r);if(i.tagName==="LEGEND")return jn.call(n,"fieldset[disabled] *")?!0:!i.contains(t)}return!0}n=n.parentElement}return!1},Hi=function(t,n){return!(n.disabled||Vi(n)||Np(n)||Up(n,t)||Ip(n)||Wp(n))},Os=function(t,n){return!(zp(n)||pn(n)<0||!Hi(t,n))},Vp=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Hp=function e(t){var n=[],r=[];return t.forEach(function(i,a){var s=!!i.scopeParent,o=s?i.scopeParent:i,l=Op(o,s),u=s?e(i.candidates):o;l===0?s?n.push.apply(n,u):n.push(o):r.push({documentOrder:a,tabIndex:l,item:i,isScope:s,content:u})}),r.sort(Mp).reduce(function(i,a){return a.isScope?i.push.apply(i,a.content):i.push(a.content),i},[]).concat(n)},Qd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Zd([t],n.includeContainer,{filter:Os.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Vp}):r=Kd(t,n.includeContainer,Os.bind(null,n)),Hp(r)},Jd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Zd([t],n.includeContainer,{filter:Hi.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Kd(t,n.includeContainer,Hi.bind(null,n)),r},En=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return jn.call(t,Ui)===!1?!1:Os(n,t)},Kp=Vd.concat("iframe").join(","),ji=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return jn.call(t,Kp)===!1?!1:Hi(n,t)};const Zp=Object.freeze(Object.defineProperty({__proto__:null,focusable:Jd,getTabIndex:pn,isFocusable:ji,isTabbable:En,tabbable:Qd},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 Nu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Iu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nu(Object(n),!0).forEach(function(r){zp(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nu(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 Ru={activateTrap:function(t,n){if(t.length>0){var r=t[t.length-1];r!==n&&r.pause()}var i=t.indexOf(n);i===-1||t.splice(i,1),t.push(n)},deactivateTrap:function(t,n){var r=t.indexOf(n);r!==-1&&t.splice(r,1),t.length>0&&t[t.length-1].unpause()}},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},Sr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},Hp=function(t){return Sr(t)&&!t.shiftKey},Kp=function(t){return Sr(t)&&t.shiftKey},$u=function(t){return setTimeout(t,0)},Lu=function(t,n){var r=-1;return t.every(function(i,a){return n(i)?(r=a,!1):!0}),r},xr=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return typeof t=="function"?t.apply(void 0,r):t},ui=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,i=(n==null?void 0:n.trapStack)||Zp,a=Iu({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,A,j){return B&&B[A]!==void 0?B[A]:a[j||A]},u=function(B,A){var j=typeof(A==null?void 0:A.composedPath)=="function"?A.composedPath():void 0;return s.containerGroups.findIndex(function(M){var U=M.container,W=M.tabbableNodes;return U.contains(B)||(j==null?void 0:j.includes(U))||W.find(function(ie){return ie===B})})},d=function(B){var A=a[B];if(typeof A=="function"){for(var j=arguments.length,M=new Array(j>1?j-1:0),U=1;U<j;U++)M[U-1]=arguments[U];A=A.apply(void 0,M)}if(A===!0&&(A=void 0),!A){if(A===void 0||A===!1)return A;throw new Error("`".concat(B,"` was specified but was not a node, or did not return a node"))}var W=A;if(typeof A=="string"&&(W=r.querySelector(A),!W))throw new Error("`".concat(B,"` as selector refers to no known node"));return W},h=function(){var B=d("initialFocus");if(B===!1)return!1;if(B===void 0||!Ti(B,a.tabbableOptions))if(u(r.activeElement)>=0)B=r.activeElement;else{var A=s.tabbableGroups[0],j=A&&A.firstTabbableNode;B=j||d("fallbackFocus")}if(!B)throw new Error("Your focus-trap needs to have at least one focusable element");return B},p=function(){if(s.containerGroups=s.containers.map(function(B){var A=Vd(B,a.tabbableOptions),j=Hd(B,a.tabbableOptions),M=A.length>0?A[0]:void 0,U=A.length>0?A[A.length-1]:void 0,W=j.find(function(C){return En(C)}),ie=j.slice().reverse().find(function(C){return En(C)}),ae=!!A.find(function(C){return pn(C)>0});return{container:B,tabbableNodes:A,focusableNodes:j,posTabIndexesFound:ae,firstTabbableNode:M,lastTabbableNode:U,firstDomTabbableNode:W,lastDomTabbableNode:ie,nextTabbableNode:function(G){var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=A.indexOf(G);return _<0?ne?j.slice(j.indexOf(G)+1).find(function(O){return En(O)}):j.slice(0,j.indexOf(G)).reverse().find(function(O){return En(O)}):A[_+(ne?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.")},m=function $(B){var A=B.activeElement;if(A)return A.shadowRoot&&A.shadowRoot.activeElement!==null?$(A.shadowRoot):A},v=function $(B){if(B!==!1&&B!==m(document)){if(!B||!B.focus){$(h());return}B.focus({preventScroll:!!a.preventScroll}),s.mostRecentlyFocusedNode=B,Wp(B)&&B.select()}},f=function(B){var A=d("setReturnFocus",B);return A||(A===!1?!1:B)},b=function(B){var A=B.target,j=B.event,M=B.isBackward,U=M===void 0?!1:M;A=A||ui(j),p();var W=null;if(s.tabbableGroups.length>0){var ie=u(A,j),ae=ie>=0?s.containerGroups[ie]:void 0;if(ie<0)U?W=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:W=s.tabbableGroups[0].firstTabbableNode;else if(U){var C=Lu(s.tabbableGroups,function(S){var L=S.firstTabbableNode;return A===L});if(C<0&&(ae.container===A||Ti(A,a.tabbableOptions)&&!En(A,a.tabbableOptions)&&!ae.nextTabbableNode(A,!1))&&(C=ie),C>=0){var G=C===0?s.tabbableGroups.length-1:C-1,ne=s.tabbableGroups[G];W=pn(A)>=0?ne.lastTabbableNode:ne.lastDomTabbableNode}else Sr(j)||(W=ae.nextTabbableNode(A,!1))}else{var _=Lu(s.tabbableGroups,function(S){var L=S.lastTabbableNode;return A===L});if(_<0&&(ae.container===A||Ti(A,a.tabbableOptions)&&!En(A,a.tabbableOptions)&&!ae.nextTabbableNode(A))&&(_=ie),_>=0){var O=_===s.tabbableGroups.length-1?0:_+1,q=s.tabbableGroups[O];W=pn(A)>=0?q.firstTabbableNode:q.firstDomTabbableNode}else Sr(j)||(W=ae.nextTabbableNode(A))}}else W=d("fallbackFocus");return W},g=function(B){var A=ui(B);if(!(u(A,B)>=0)){if(xr(a.clickOutsideDeactivates,B)){o.deactivate({returnFocus:a.returnFocusOnDeactivate});return}xr(a.allowOutsideClick,B)||B.preventDefault()}},D=function(B){var A=ui(B),j=u(A,B)>=0;if(j||A instanceof Document)j&&(s.mostRecentlyFocusedNode=A);else{B.stopImmediatePropagation();var M,U=!0;if(s.mostRecentlyFocusedNode)if(pn(s.mostRecentlyFocusedNode)>0){var W=u(s.mostRecentlyFocusedNode),ie=s.containerGroups[W].tabbableNodes;if(ie.length>0){var ae=ie.findIndex(function(C){return C===s.mostRecentlyFocusedNode});ae>=0&&(a.isKeyForward(s.recentNavEvent)?ae+1<ie.length&&(M=ie[ae+1],U=!1):ae-1>=0&&(M=ie[ae-1],U=!1))}}else s.containerGroups.some(function(C){return C.tabbableNodes.some(function(G){return pn(G)>0})})||(U=!1);else U=!1;U&&(M=b({target:s.mostRecentlyFocusedNode,isBackward:a.isKeyBackward(s.recentNavEvent)})),v(M||s.mostRecentlyFocusedNode||h())}s.recentNavEvent=void 0},w=function(B){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=B;var j=b({event:B,isBackward:A});j&&(Sr(B)&&B.preventDefault(),v(j))},F=function(B){if(Vp(B)&&xr(a.escapeDeactivates,B)!==!1){B.preventDefault(),o.deactivate();return}(a.isKeyForward(B)||a.isKeyBackward(B))&&w(B,a.isKeyBackward(B))},E=function(B){var A=ui(B);u(A,B)>=0||xr(a.clickOutsideDeactivates,B)||xr(a.allowOutsideClick,B)||(B.preventDefault(),B.stopImmediatePropagation())},k=function(){if(s.active)return Ru.activateTrap(i,o),s.delayInitialFocusTimer=a.delayInitialFocus?$u(function(){v(h())}):v(h()),r.addEventListener("focusin",D,!0),r.addEventListener("mousedown",g,{capture:!0,passive:!1}),r.addEventListener("touchstart",g,{capture:!0,passive:!1}),r.addEventListener("click",E,{capture:!0,passive:!1}),r.addEventListener("keydown",F,{capture:!0,passive:!1}),o},T=function(){if(s.active)return r.removeEventListener("focusin",D,!0),r.removeEventListener("mousedown",g,!0),r.removeEventListener("touchstart",g,!0),r.removeEventListener("click",E,!0),r.removeEventListener("keydown",F,!0),o},R=function(B){var A=B.some(function(j){var M=Array.from(j.removedNodes);return M.some(function(U){return U===s.mostRecentlyFocusedNode})});A&&v(h())},P=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(R):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 A=l(B,"onActivate"),j=l(B,"onPostActivate"),M=l(B,"checkCanFocusTrap");M||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,A==null||A();var U=function(){M&&p(),k(),z(),j==null||j()};return M?(M(s.containers.concat()).then(U,U),this):(U(),this)},deactivate:function(B){if(!s.active)return this;var A=Iu({onDeactivate:a.onDeactivate,onPostDeactivate:a.onPostDeactivate,checkCanReturnFocus:a.checkCanReturnFocus},B);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,T(),s.active=!1,s.paused=!1,z(),Ru.deactivateTrap(i,o);var j=l(A,"onDeactivate"),M=l(A,"onPostDeactivate"),U=l(A,"checkCanReturnFocus"),W=l(A,"returnFocus","returnFocusOnDeactivate");j==null||j();var ie=function(){$u(function(){W&&v(f(s.nodeFocusedBeforeActivation)),M==null||M()})};return W&&U?(U(f(s.nodeFocusedBeforeActivation)).then(ie,ie),this):(ie(),this)},pause:function(B){if(s.paused||!s.active)return this;var A=l(B,"onPause"),j=l(B,"onPostPause");return s.paused=!0,A==null||A(),T(),z(),j==null||j(),this},unpause:function(B){if(!s.paused||!s.active)return this;var A=l(B,"onUnpause"),j=l(B,"onPostUnpause");return s.paused=!1,A==null||A(),p(),k(),z(),j==null||j(),this},updateContainerElements:function(B){var A=[].concat(B).filter(Boolean);return s.containers=A.map(function(j){return typeof j=="string"?r.querySelector(j):j}),s.active&&p(),z(),this}},o.updateContainerElements(t),o};const Gp=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Yp},Symbol.toStringTag,{value:"Module"})),Qp=ed(Gp),Jp=ed(Lp);function or(e){"@babel/helpers - typeof";return or=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},or(e)}function Xp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zu(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&&zu(e.prototype,t),n&&zu(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&&Ms(e,t)}function Ms(e,t){return Ms=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Ms(e,t)}function ng(e){var t=ig();return function(){var r=Vi(e),i;if(t){var a=Vi(this).constructor;i=Reflect.construct(r,arguments,a)}else i=r.apply(this,arguments);return rg(this,i)}}function rg(e,t){if(t&&(or(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ar(e)}function Ar(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ig(){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 Vi(e){return Vi=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Vi(e)}function ag(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 or(t)==="symbol"?t:String(t)}function sg(e,t){if(or(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(or(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var li=y,ye=Ep,og=Qp,ug=og.createFocusTrap,lg=Jp,cg=lg.isFocusable,yo=function(e){tg(n,e);var t=ng(n);function n(r){var i;Xp(this,n),i=t.call(this,r),ag(Ar(i),"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,h=new Array(d>1?d-1:0),p=1;p<d;p++)h[p-1]=arguments[p];u=u.apply(void 0,h)}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 m=u;if(typeof u=="string"){var v;if(m=(v=this.getDocument())===null||v===void 0?void 0:v.querySelector(u),!m)throw new Error("`".concat(o,"` as selector refers to no known node"))}return m}),i.handleDeactivate=i.handleDeactivate.bind(Ar(i)),i.handlePostDeactivate=i.handlePostDeactivate.bind(Ar(i)),i.handleClickOutsideDeactivates=i.handleClickOutsideDeactivates.bind(Ar(i)),i.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:i.handleDeactivate,onPostDeactivate:i.handlePostDeactivate,clickOutsideDeactivates:i.handleClickOutsideDeactivates},i.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var a=r.focusTrapOptions;for(var s in a)if(Object.prototype.hasOwnProperty.call(a,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){i.originalOptions[s]=a[s];continue}i.internalOptions[s]=a[s]}return i.outsideClick=null,i.focusTrapElements=r.containerElements||[],i.updatePreviousElement(),i}return eg(n,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var i=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return i||(i===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var i=this.getDocument();i&&(this.previouslyFocusedElement=i.activeElement)}},{key:"deactivateTrap",value:function(){!this.focusTrap||!this.focusTrap.active||this.focusTrap.deactivate({returnFocus:!1,checkCanReturnFocus:null,onDeactivate:this.originalOptions.onDeactivate})}},{key:"handleClickOutsideDeactivates",value:function(i){var a=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,i):this.originalOptions.clickOutsideDeactivates;return a&&(this.outsideClick={target:i.target,allowDeactivation:a}),a}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var i=this,a=function(){var o=i.getReturnFocusNode(),l=!!(i.originalOptions.returnFocusOnDeactivate&&o!==null&&o!==void 0&&o.focus&&(!i.outsideClick||i.outsideClick.allowDeactivation&&!cg(i.outsideClick.target,i.internalOptions.tabbableOptions))),u=i.internalOptions.preventScroll,d=u===void 0?!1:u;l&&o.focus({preventScroll:d}),i.originalOptions.onPostDeactivate&&i.originalOptions.onPostDeactivate.call(null),i.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(a,a):a()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var i=this.focusTrapElements.some(Boolean);i&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(i){if(this.focusTrap){i.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var a=!i.active&&this.props.active,s=i.active&&!this.props.active,o=!i.paused&&this.props.paused,l=i.paused&&!this.props.paused;if(a&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else i.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var i=this,a=this.props.children?li.Children.only(this.props.children):void 0;if(a){if(a.type&&a.type===li.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=i.props.containerElements;a&&(typeof a.ref=="function"?a.ref(u):a.ref&&(a.ref.current=u)),i.focusTrapElements=d||[u]},o=li.cloneElement(a,{ref:s});return o}return null}}]),n}(li.Component),Cr=typeof Element>"u"?Function:Element;yo.propTypes={active:ye.bool,paused:ye.bool,focusTrapOptions:ye.shape({document:ye.object,onActivate:ye.func,onPostActivate:ye.func,checkCanFocusTrap:ye.func,onPause:ye.func,onPostPause:ye.func,onUnpause:ye.func,onPostUnpause:ye.func,onDeactivate:ye.func,onPostDeactivate:ye.func,checkCanReturnFocus:ye.func,initialFocus:ye.oneOfType([ye.instanceOf(Cr),ye.string,ye.bool,ye.func]),fallbackFocus:ye.oneOfType([ye.instanceOf(Cr),ye.string,ye.func]),escapeDeactivates:ye.oneOfType([ye.bool,ye.func]),clickOutsideDeactivates:ye.oneOfType([ye.bool,ye.func]),returnFocusOnDeactivate:ye.bool,setReturnFocus:ye.oneOfType([ye.instanceOf(Cr),ye.string,ye.bool,ye.func]),allowOutsideClick:ye.oneOfType([ye.bool,ye.func]),preventScroll:ye.bool,tabbableOptions:ye.shape({displayCheck:ye.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:ye.oneOfType([ye.bool,ye.func])}),trapStack:ye.array,isKeyForward:ye.func,isKeyBackward:ye.func}),containerElements:ye.arrayOf(ye.instanceOf(Cr)),children:ye.oneOfType([ye.element,ye.instanceOf(Cr)])};yo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:ug};var dg=yo;const fg=Nn(dg);const un=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:i=()=>{},onClose:a=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:d="",gtmContext:h="Modal"})=>{const p=re.useIntl(),{registerOverlay:m,unregisterOverlay:v}=Td(),[f,b]=y.useState(t),[g,D]=y.useState(null),w=y.useRef(null),F=P=>{f&&P.key==="Escape"&&T(!1)},E=P=>{D(P.target)},k=P=>{g===w.current&&P.target===w.current&&T(!1),D(null)};y.useEffect(()=>{if(f)return window.addEventListener("keyup",F),()=>{window.removeEventListener("keyup",F)}},[f]),y.useEffect(()=>{const P=w.current;return P&&(P.addEventListener("mousedown",E),P.addEventListener("mouseup",k)),()=>{P&&(P.removeEventListener("mousedown",E),P.removeEventListener("mouseup",k))}},[g]);const T=P=>{if(b(P),P)i(),m(e);else{if(f===P)return;a(),v(e)}};y.useEffect(()=>(T(t),()=>{f&&v(e)}),[t]);const R=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:w,className:V("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(vo,{id:e,className:V("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:R,children:t&&c.jsx(fg,{containerElements:[w.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(ke,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>T(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":h,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(qt,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(qt,{}),c.jsx(hr,{buttons:u})]}),s&&c.jsx(sr,{className:"error",children:s})]})})})})},Zd=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const wr="joinCommunityButton",xo=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:i,leave:a}={join:()=>{},leave:()=>{}}})=>{const s=re.useIntl(),o=y.useContext(at),l=o&&typeof o.id=="string",u=r||!l,[d,h]=y.useState(e),[p,m]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{p==="joining"?m("joined"):p==="leaving"&&m("notJoined")},[d]);const v={},f={};return d&&p!=="leaving"&&(v["data-hover-text"]=s.formatMessage({id:`${wr}_leave`}),v["aria-label"]=s.formatMessage({id:`${wr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(ke,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&p!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${wr}_closed_tooltip`}):"",onClick:async b=>{if(u)return;b.currentTarget.blur(),m(d?"leaving":"joining");const g=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${wr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(g);const D=d?a:i;typeof D=="function"&&setTimeout(async()=>{await D()},500),h(!d)},className:V("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...v,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${wr}${["joining","leaving"].includes(p)?`_${p}`:d?"_member":n?"_short":""}`})})})};const Ia="communityDetails_",hg=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:i=0,data:a=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=re.useIntl(),{id:u}=y.useContext(at),d=u,h=5,p=i||a.length,m=a.length?a:Array(h).fill({}),v=`/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:`${Ia}members`}),c.jsx("span",{className:"count",children:p})]}),v?c.jsx(c.Fragment,{}):c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${Ia}viewAll`})})})]}),d&&c.jsx(go,{contributors:{total:i,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:p===0},cutoff:h})]}):c.jsx(c.Fragment,{}),d?c.jsxs(c.Fragment,{children:[c.jsx(xo,{isMember:t,isOpen:n,disabled:b,functions:{...o}}),t&&c.jsx(ke,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${Ia}invite`})})]}):c.jsx(c.Fragment,{})]})};const zr=({icon:e,className:t="",...n})=>c.jsx(ke,{className:V("action-button",t),variant:"tertiary",icon:e,...n}),mg="post",pg="reply",qr="00000000-0000-0000-0000-000000000000",gg="en";function Co({queryClient:e,queryKey:t}){function n(r,i,a){e.setQueryData(t,a)}return n}function wo({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const i=e.getQueryData(t);return e.setQueryData(t,r),i}return n}function vg(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function bg(){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:i="",image:a={}}=e,{thumbnail:s=""}=a;return{id:t,data:{name:n,organization:r,jobTitle:i,thumbnail:s}}}function yg({title:e,content:t,categories:n}){const r=[];return n&&!["no-category",""].includes(n)&&r.push(n),{title:e,content:t,categories:r,id:qr,time:new Date().toISOString(),verb:mg}}function qu({activity:e,user:t}){return{...e,actor:Yd(t),...vg()}}function Hi({activity:e,reaction:t}){var n,r,i;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((i=e.own_reactions)==null?void 0:i.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function Gd({activity:e,user:t}){var n,r,i;e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like-1:0},t!=null&&t.id&&(e.latest_reactions={...e.latest_reactions||{},like:(((r=e.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:a})=>a!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((i=e.own_reactions)==null?void 0:i.like)||[]).filter(({user_id:a})=>a!==t.id)})}function Ki({activity:e,reaction:t}){var n,r,i;t?(e.latest_reactions={...e.latest_reactions||{},pin:[...((r=e.latest_reactions)==null?void 0:r.pin)||[],t]},e.own_reactions={...e.own_reactions||{},pin:[...((i=e.own_reactions)==null?void 0:i.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function 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 xg(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function Cg(e,t,n){const r=t.pages.length-1,i=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[i]=e:t.pages[r].results.push(e),t}function 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 Zi(e,t,n){return t?n!=null&&n.append?Cg(e,t,n):wg(e,t,n):xg(e)}function Ft(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:i})=>i===e);if(r)return r}}function Jd(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:i})=>i===e);if(r!==-1){n.splice(r,1);break}}return t}function Do(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],[]))||[]}var ha=(e=>(e.Post="post",e.Poll="poll",e))(ha||{});const bt="poll-vote",Dg=(e,t="en")=>{var r;return e.verb!==ha.Poll?[]:(((r=e==null?void 0:e.latest_reactions)==null?void 0:r["poll-option"])||[]).map(i=>{var o,l,u,d,h;const a=((o=i==null?void 0:i.own_children)==null?void 0:o["poll-vote"])||[],s=(l=i.data)==null?void 0:l.description;return{id:i.id,label:s[t],numVotes:((u=i==null?void 0:i.children_counts)==null?void 0:u["poll-vote"])||0,hasUserVoted:a.length>0,userVote:{id:(d=a[0])==null?void 0:d.id},position:((h=i.data)==null?void 0:h.position)||0}}).sort((i,a)=>i.position-a.position)};function Eg({activity:e,reactionId:t,user:n}){var a;const r=n==null?void 0:n.id;if(!r)return;const i=(a=e.latest_reactions)==null?void 0:a["poll-option"];if(i){for(const s of i)if(s.id===t){const o={id:qr,activity_id:e.id,kind:bt,data:{},created_at:new Date().toISOString(),updated_at:new Date().toISOString(),user_id:r,parent:s.id,latest_children:{},own_children:{},children_counts:{}};s.latest_children=s.latest_children||{},s.latest_children[bt]=s.latest_children[bt]||[],s.latest_children[bt].push(o),s.own_children=s.own_children||{},s.own_children[bt]=s.own_children[bt]||[],s.own_children[bt].push(o),s.children_counts=s.children_counts||{},s.children_counts[bt]=(s.children_counts[bt]||0)+1;break}}}function _g({activity:e,reactionId:t,correctReactionId:n,user:r}){var i;(i=e.latest_reactions)==null||i["poll-option"].forEach(a=>{var s;a.id===t&&(a.latest_children[bt].forEach(o=>{o.id===qr&&o.user_id===(r==null?void 0:r.id)&&(o.id=n)}),(s=a.own_children)==null||s[bt].forEach(o=>{o.id===qr&&o.user_id===(r==null?void 0:r.id)&&(o.id=n)}))})}function kg({cache:e,activityId:t,reactionId:n}){var r,i,a;for(const{results:s}of e.pages)for(const o of s)if(o.id===t){const l=(r=o.latest_reactions)==null?void 0:r["poll-option"];if(l)for(const u of l){const d=(i=u.own_children)==null?void 0:i[bt],h=(a=u.latest_children)==null?void 0:a[bt];if(h){const p=h.findIndex(m=>m.id===n);p!==-1&&(h.splice(p,1),u.children_counts[bt]--)}if(d){const p=d.findIndex(m=>m.id===n);p!==-1&&d.splice(p,1)}}return e}return e}function Fg({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:qr,kind:pg,parent:t||""}}function Uu({reply:e,user:t}){const n=Yd(t);return{...e,user_id:n.id,user:n,...bg()}}function Wu({reply:e,reaction:t}){var n,r,i;t?(e.latest_children={...e.latest_children||{},like:[...((r=e.latest_children)==null?void 0:r.like)||[],t]},e.own_children={...e.own_children||{},like:[...((i=e.own_children)==null?void 0:i.like)||[],t]}):e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like+1:1}}function Ag({reply:e,user:t}){var n,r,i;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:a})=>a!==t.id)},e.own_children={...e.own_children||{},like:(((i=e.own_children)==null?void 0:i.like)||[]).filter(({user_id:a})=>a!==t.id)})}const Xd=(e,t)=>{const n=new CustomEvent(nt.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let Vu,Ra=0;const ef=()=>{y.useEffect(()=>(document.addEventListener(nt.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(nt.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(Vu);const i=document.getElementById(n);if(i){i.scrollIntoView({behavior:"smooth",block:"start"}),Ra=0;return}Ra++,!(Ra>10)&&(Vu=setTimeout(()=>{e(t)},50))}};var Be=(e=>(e.Answer="answer",e.Poll="poll",e.Post="post",e.Response="response",e.Reply="reply",e.Question="question",e))(Be||{});const ur=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}),Eo=Object.freeze({actor:`SU:${ur.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"}),Bg=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"}),Tg=Object.freeze({actor:`SU:${ur.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"}),Sg=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:Eo.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:Eo.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:Eo.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:ur.id,user:{id:ur.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Bg.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:Tg.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:ur.id,user:{id:ur.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Sg.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});const jg=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Og=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);function Pg(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 i=r==null?void 0:r.nextElementSibling;if(n==="up"){const d=r==null?void 0:r.previousElementSibling;d?i=d:(i=(o=r==null?void 0:r.parentElement)==null?void 0:o.lastElementChild,(i==null?void 0:i.getAttribute("data-index"))==="-1"&&(i=i==null?void 0:i.previousElementSibling))}else(!i||(i==null?void 0:i.getAttribute("data-index"))==="-1")&&(i=(l=r==null?void 0:r.parentElement)==null?void 0:l.firstElementChild);if(!i)return;const a=Number((i==null?void 0:i.getAttribute("data-index"))||"0");e([{type:"tabbableLink",value:a}]),(u=i==null?void 0:i.querySelector("a,button"))==null||u.focus()},[e])}const Mg=y.lazy(()=>Promise.resolve().then(()=>mv));let jr=!1;const $a=()=>{jr!==!1&&(clearTimeout(jr),jr=!1)},Ng=5;let La=null;const tf=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:i=!1,content:a={type:Be.Reply,slugs:{}},canLike:s=!0,activityId:o,basePath:l,parentId:u,functions:{createLike:d=()=>{},deleteLike:h=()=>{},listLikes:p=async()=>({next:"",results:[]})}})=>{const m=re.useIntl(),v={numberOfLikes:t,userLikedContent:i,ignoreInteractions:!1,showLikers:!1,tabbableLink:0,showLikesModal:!1},[f,b]=y.useReducer(Jr,v),{numberOfLikes:g,userLikedContent:D,ignoreInteractions:w,showLikers:F,tabbableLink:E,showLikesModal:k}=f,T=Pg(b);y.useEffect(()=>{b([{type:"userLikedContent",value:i}])},[i]);const R=y.useMemo(()=>Og(n,Ng),[n]),P=A=>{if(A.preventDefault(),A.stopPropagation(),b([{type:"showLikers",value:!1}]),jr)return $a(),!1;if($a(),w||!s)return!1;jr=setTimeout(z,350)},z=async()=>{if($a(),w||!s)return!1;let A=D?g-1:g+1;A<0&&(A=0),b([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:A},{type:"userLikedContent",value:!D}]);try{if(a&&a.slugs){const j=jg(a.slugs);D?await h(j):await d({...j,payload:{contentPath:window.location.pathname}})}}catch{b([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:i}])}finally{b([{type:"ignoreInteractions",value:!1}])}},$=()=>{La=setTimeout(()=>{b([{type:"showLikers",value:!1}])},500)},B=()=>{La&&clearTimeout(La)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:A=>{A.key==="Escape"&&b([{type:"showLikers",value:!1}])},onMouseEnter:()=>{B(),b([{type:"showLikers",value:!0}])},onMouseLeave:()=>{$()}},c.jsxs(c.Fragment,{children:[c.jsx(zr,{className:V("discussion-button text-medium action-button likes-button",{"show-spinner":w,"is-liked":D,disabled:!s}),icon:{icon:D?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${a.type}-click`,onClick:P,screenreaderText:s?m.formatMessage({id:`discussion_likes_${D?"unlike":"like"}`},{action:m.formatMessage({id:`discussion_action_${a.type}`})}):!1,"aria-pressed":D,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:m.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:g})})}),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:()=>$,onClick:A=>{var M;A.preventDefault(),A.stopPropagation(),B(),b([{type:"showLikers",value:!0}]);const j=(M=A.currentTarget.nextSibling)==null?void 0:M.childNodes[0];if(j){const U=j.querySelector("li:first-child a");U&&(b([{type:"tabbableLink",value:0}]),setTimeout(()=>{U.focus()},100))}},onKeyDown:A=>{A.key==="Escape"&&(A.preventDefault(),A.stopPropagation(),$())},"aria-expanded":F,"aria-controls":`likes-tooltip-${a.slug}`,children:c.jsx(Pe,{showOnFocus:!1,children:m.formatMessage({id:"discussion_likes_show"},{action:a.type})})}),c.jsx(Rn,{id:`likes-tooltip-${a.slug}`,isOpen:F,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[R.map((A,j)=>{if(typeof A=="string")return null;const M={};return E!==j&&(M.tabIndex=-1),c.jsx("li",{"data-index":j,children:c.jsx(yn,{href:A.id?`/profiles/${A.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onFocus:()=>B(),onKeyDown:T,...M,children:A.name?A.name:c.jsx("span",{className:"deleted-user",children:m.formatMessage({id:"member_deleted"})})})},A.id||window.btoa(A.name||""))}),c.jsx("li",{"data-index":R.length,className:"show-all",children:c.jsx(ke,{variant:"tertiary",onClick:()=>{B(),$(),b([{type:"showLikesModal",value:!0}])},onKeyDown:T,children:m.formatMessage({id:"discussion_likes_showAll"})})})]})}),k&&c.jsx(mr,{children:c.jsx(y.Suspense,{children:c.jsx(Mg,{activityId:o,basePath:l,parentId:u,likeCount:t,showModal:k,functions:{onClose:()=>b([{type:"showLikesModal",value:!1}]),likes:{list:p}}})})})]})]}))},Ns=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},pr=e=>{var t,n,r,i,a,s;return e&&!e.error?{id:e==null?void 0:e.id,name:(t=e==null?void 0:e.data)==null?void 0:t.name,organization:(n=e==null?void 0:e.data)==null?void 0:n.organization,jobTitle:(r=e==null?void 0:e.data)==null?void 0:r.jobTitle,location:(i=e==null?void 0:e.data)==null?void 0:i.location,image:{thumbnail:((a=e==null?void 0:e.data)==null?void 0:a.thumbnail)||void 0},badges:(s=e==null?void 0:e.data)==null?void 0:s.badges}:"deleted"};function Ig({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=Ue.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=qu({activity:yg(o),user:a});return Zi(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=qu({activity:o,user:a});r.setQueryData(i,Zi(d,u,{replace:!0})),setTimeout(()=>{Xd(d.id,"activity")},0)}});return s}function Rg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=Ue.useMutation({mutationFn:e,onMutate:({activityId:o,reactionId:l})=>t(u=>{const d=Ft(o,u);return d&&Eg({activity:d,reactionId:l,user:a}),u}),onError:n,onSuccess:(o,{activityId:l,reactionId:u},d)=>{const h=Ft(l,d);h&&_g({activity:h,reactionId:u,correctReactionId:o.body.id,user:a}),r.setQueryData(i,d)}});return s}function $g({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ue.useMutation({mutationFn:e,onMutate:({activityId:i,content:a})=>t(s=>{const o=Ft(i,s);return o&&(o.content=a),s}),onError:n});return r}function Lg({queryFns:{create:e,edit:t,like:n,list:r,remove:i,unlike:a,pin:s,unpin:o,createVote:l,removeVote:u,removePoll:d},queryKey:h,filterOption:p}){const m=Ue.useQueryClient(),v=ca(),f={queryClient:m,queryKey:h},b={mutationHandlers:{error:Co(f),mutate:wo(f)},user:v,...f},g=Ig({...b,mutationFn:e}),D=$g({...b,mutationFn:t}),w=zg({...b,mutationFn:n}),F=Wg({...b,mutationFn:i}),E=Hg({...b,mutationFn:a}),k=Ug({...b,mutationFn:s}),T=Kg({...b,mutationFn:o}),R=Rg({...b,mutationFn:l}),P=Vg({...b,mutationFn:u}),{activities:z,...$}=qg({queryKey:h,queryFn:r,filterOption:p});return{activities:z,mutations:{create:g,edit:D,remove:F,like:w,unlike:E,pin:k,unpin:T,createVote:R,removeVote:P},user:v,...$}}function zg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Ue.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Ft(s,o);return l&&Hi({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Ft(o,l);u&&Hi({activity:u,reaction:s}),r.setQueryData(i,l)}});return a}function qg({queryFn:e,queryKey:t,filterOption:n}){const{data:r,error:i,isLoading:a,hasNextPage:s,fetchNextPage:o}=Ue.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:Do(r),error:i,isLoading:a,hasNextPage:s,fetchNextPage:o}}function Ug({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Ue.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Ft(s,o);return l&&Ki({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Ft(o,l);u&&Ki({activity:u,reaction:s}),r.setQueryData(i,l)}});return a}function Wg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ue.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(a=>Jd(i,a)),onError:n});return r}function Vg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Ue.useMutation({mutationFn:e,onMutate:({activityId:a,reactionId:s})=>t(o=>kg({cache:o,activityId:a,reactionId:s})),onError:n});return i}function Hg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Ue.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(s=>{const o=Ft(a,s);return o&&Gd({activity:o,user:r}),s}),onError:n});return i}function Kg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Ue.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(s=>{const o=Ft(a,s);return o&&Qd({activity:o,user:r}),s}),onError:n});return i}const Zg=280,_o=async(e,t,n,r=()=>Promise.resolve([]))=>{let i=t?ir(e,typeof t=="number"?t:Zg):e;i=i.trim();const a=`<br>
62
+ */function $u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Lu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$u(Object(n),!0).forEach(function(r){Yp(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$u(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Yp(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 Gp(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=Gp(e,"string");return typeof t=="symbol"?t:String(t)}var zu={activateTrap:function(t,n){if(t.length>0){var r=t[t.length-1];r!==n&&r.pause()}var i=t.indexOf(n);i===-1||t.splice(i,1),t.push(n)},deactivateTrap:function(t,n){var r=t.indexOf(n);r!==-1&&t.splice(r,1),t.length>0&&t[t.length-1].unpause()}},Jp=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},Xp=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},Or=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},eg=function(t){return Or(t)&&!t.shiftKey},tg=function(t){return Or(t)&&t.shiftKey},qu=function(t){return setTimeout(t,0)},Uu=function(t,n){var r=-1;return t.every(function(i,a){return n(i)?(r=a,!1):!0}),r},Dr=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return typeof t=="function"?t.apply(void 0,r):t},ci=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},ng=[],rg=function(t,n){var r=(n==null?void 0:n.document)||document,i=(n==null?void 0:n.trapStack)||ng,a=Lu({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:eg,isKeyBackward:tg},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(A,B,j){return A&&A[B]!==void 0?A[B]:a[j||B]},u=function(A,B){var j=typeof(B==null?void 0:B.composedPath)=="function"?B.composedPath():void 0;return s.containerGroups.findIndex(function(M){var U=M.container,W=M.tabbableNodes;return U.contains(A)||(j==null?void 0:j.includes(U))||W.find(function(ie){return ie===A})})},d=function(A){var B=a[A];if(typeof B=="function"){for(var j=arguments.length,M=new Array(j>1?j-1:0),U=1;U<j;U++)M[U-1]=arguments[U];B=B.apply(void 0,M)}if(B===!0&&(B=void 0),!B){if(B===void 0||B===!1)return B;throw new Error("`".concat(A,"` was specified but was not a node, or did not return a node"))}var W=B;if(typeof B=="string"&&(W=r.querySelector(B),!W))throw new Error("`".concat(A,"` as selector refers to no known node"));return W},m=function(){var A=d("initialFocus");if(A===!1)return!1;if(A===void 0||!ji(A,a.tabbableOptions))if(u(r.activeElement)>=0)A=r.activeElement;else{var B=s.tabbableGroups[0],j=B&&B.firstTabbableNode;A=j||d("fallbackFocus")}if(!A)throw new Error("Your focus-trap needs to have at least one focusable element");return A},h=function(){if(s.containerGroups=s.containers.map(function(A){var B=Qd(A,a.tabbableOptions),j=Jd(A,a.tabbableOptions),M=B.length>0?B[0]:void 0,U=B.length>0?B[B.length-1]:void 0,W=j.find(function(E){return En(E)}),ie=j.slice().reverse().find(function(E){return En(E)}),se=!!B.find(function(E){return pn(E)>0});return{container:A,tabbableNodes:B,focusableNodes:j,posTabIndexesFound:se,firstTabbableNode:M,lastTabbableNode:U,firstDomTabbableNode:W,lastDomTabbableNode:ie,nextTabbableNode:function(ee){var Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,k=B.indexOf(ee);return k<0?Z?j.slice(j.indexOf(ee)+1).find(function(P){return En(P)}):j.slice(0,j.indexOf(ee)).reverse().find(function(P){return En(P)}):B[k+(Z?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(A){return A.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(A){return A.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function $(A){var B=A.activeElement;if(B)return B.shadowRoot&&B.shadowRoot.activeElement!==null?$(B.shadowRoot):B},v=function $(A){if(A!==!1&&A!==p(document)){if(!A||!A.focus){$(m());return}A.focus({preventScroll:!!a.preventScroll}),s.mostRecentlyFocusedNode=A,Jp(A)&&A.select()}},f=function(A){var B=d("setReturnFocus",A);return B||(B===!1?!1:A)},b=function(A){var B=A.target,j=A.event,M=A.isBackward,U=M===void 0?!1:M;B=B||ci(j),h();var W=null;if(s.tabbableGroups.length>0){var ie=u(B,j),se=ie>=0?s.containerGroups[ie]:void 0;if(ie<0)U?W=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:W=s.tabbableGroups[0].firstTabbableNode;else if(U){var E=Uu(s.tabbableGroups,function(S){var L=S.firstTabbableNode;return B===L});if(E<0&&(se.container===B||ji(B,a.tabbableOptions)&&!En(B,a.tabbableOptions)&&!se.nextTabbableNode(B,!1))&&(E=ie),E>=0){var ee=E===0?s.tabbableGroups.length-1:E-1,Z=s.tabbableGroups[ee];W=pn(B)>=0?Z.lastTabbableNode:Z.lastDomTabbableNode}else Or(j)||(W=se.nextTabbableNode(B,!1))}else{var k=Uu(s.tabbableGroups,function(S){var L=S.lastTabbableNode;return B===L});if(k<0&&(se.container===B||ji(B,a.tabbableOptions)&&!En(B,a.tabbableOptions)&&!se.nextTabbableNode(B))&&(k=ie),k>=0){var P=k===s.tabbableGroups.length-1?0:k+1,q=s.tabbableGroups[P];W=pn(B)>=0?q.firstTabbableNode:q.firstDomTabbableNode}else Or(j)||(W=se.nextTabbableNode(B))}}else W=d("fallbackFocus");return W},g=function(A){var B=ci(A);if(!(u(B,A)>=0)){if(Dr(a.clickOutsideDeactivates,A)){o.deactivate({returnFocus:a.returnFocusOnDeactivate});return}Dr(a.allowOutsideClick,A)||A.preventDefault()}},x=function(A){var B=ci(A),j=u(B,A)>=0;if(j||B instanceof Document)j&&(s.mostRecentlyFocusedNode=B);else{A.stopImmediatePropagation();var M,U=!0;if(s.mostRecentlyFocusedNode)if(pn(s.mostRecentlyFocusedNode)>0){var W=u(s.mostRecentlyFocusedNode),ie=s.containerGroups[W].tabbableNodes;if(ie.length>0){var se=ie.findIndex(function(E){return E===s.mostRecentlyFocusedNode});se>=0&&(a.isKeyForward(s.recentNavEvent)?se+1<ie.length&&(M=ie[se+1],U=!1):se-1>=0&&(M=ie[se-1],U=!1))}}else s.containerGroups.some(function(E){return E.tabbableNodes.some(function(ee){return pn(ee)>0})})||(U=!1);else U=!1;U&&(M=b({target:s.mostRecentlyFocusedNode,isBackward:a.isKeyBackward(s.recentNavEvent)})),v(M||s.mostRecentlyFocusedNode||m())}s.recentNavEvent=void 0},C=function(A){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=A;var j=b({event:A,isBackward:B});j&&(Or(A)&&A.preventDefault(),v(j))},F=function(A){if(Xp(A)&&Dr(a.escapeDeactivates,A)!==!1){A.preventDefault(),o.deactivate();return}(a.isKeyForward(A)||a.isKeyBackward(A))&&C(A,a.isKeyBackward(A))},D=function(A){var B=ci(A);u(B,A)>=0||Dr(a.clickOutsideDeactivates,A)||Dr(a.allowOutsideClick,A)||(A.preventDefault(),A.stopImmediatePropagation())},_=function(){if(s.active)return zu.activateTrap(i,o),s.delayInitialFocusTimer=a.delayInitialFocus?qu(function(){v(m())}):v(m()),r.addEventListener("focusin",x,!0),r.addEventListener("mousedown",g,{capture:!0,passive:!1}),r.addEventListener("touchstart",g,{capture:!0,passive:!1}),r.addEventListener("click",D,{capture:!0,passive:!1}),r.addEventListener("keydown",F,{capture:!0,passive:!1}),o},T=function(){if(s.active)return r.removeEventListener("focusin",x,!0),r.removeEventListener("mousedown",g,!0),r.removeEventListener("touchstart",g,!0),r.removeEventListener("click",D,!0),r.removeEventListener("keydown",F,!0),o},R=function(A){var B=A.some(function(j){var M=Array.from(j.removedNodes);return M.some(function(U){return U===s.mostRecentlyFocusedNode})});B&&v(m())},O=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(R):void 0,z=function(){O&&(O.disconnect(),s.active&&!s.paused&&s.containers.map(function(A){O.observe(A,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(A){if(s.active)return this;var B=l(A,"onActivate"),j=l(A,"onPostActivate"),M=l(A,"checkCanFocusTrap");M||h(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,B==null||B();var U=function(){M&&h(),_(),z(),j==null||j()};return M?(M(s.containers.concat()).then(U,U),this):(U(),this)},deactivate:function(A){if(!s.active)return this;var B=Lu({onDeactivate:a.onDeactivate,onPostDeactivate:a.onPostDeactivate,checkCanReturnFocus:a.checkCanReturnFocus},A);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,T(),s.active=!1,s.paused=!1,z(),zu.deactivateTrap(i,o);var j=l(B,"onDeactivate"),M=l(B,"onPostDeactivate"),U=l(B,"checkCanReturnFocus"),W=l(B,"returnFocus","returnFocusOnDeactivate");j==null||j();var ie=function(){qu(function(){W&&v(f(s.nodeFocusedBeforeActivation)),M==null||M()})};return W&&U?(U(f(s.nodeFocusedBeforeActivation)).then(ie,ie),this):(ie(),this)},pause:function(A){if(s.paused||!s.active)return this;var B=l(A,"onPause"),j=l(A,"onPostPause");return s.paused=!0,B==null||B(),T(),z(),j==null||j(),this},unpause:function(A){if(!s.paused||!s.active)return this;var B=l(A,"onUnpause"),j=l(A,"onPostUnpause");return s.paused=!1,B==null||B(),h(),_(),z(),j==null||j(),this},updateContainerElements:function(A){var B=[].concat(A).filter(Boolean);return s.containers=B.map(function(j){return typeof j=="string"?r.querySelector(j):j}),s.active&&h(),z(),this}},o.updateContainerElements(t),o};const ig=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:rg},Symbol.toStringTag,{value:"Module"})),ag=sd(ig),sg=sd(Zp);function ur(e){"@babel/helpers - typeof";return ur=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},ur(e)}function og(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wu(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,Xd(r.key),r)}}function ug(e,t,n){return t&&Wu(e.prototype,t),n&&Wu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function lg(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&&Ms(e,t)}function Ms(e,t){return Ms=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},Ms(e,t)}function cg(e){var t=fg();return function(){var r=Ki(e),i;if(t){var a=Ki(this).constructor;i=Reflect.construct(r,arguments,a)}else i=r.apply(this,arguments);return dg(this,i)}}function dg(e,t){if(t&&(ur(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Sr(e)}function Sr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function fg(){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 Ki(e){return Ki=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ki(e)}function mg(e,t,n){return t=Xd(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xd(e){var t=hg(e,"string");return ur(t)==="symbol"?t:String(t)}function hg(e,t){if(ur(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(ur(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var di=y,ye=jp,pg=ag,gg=pg.createFocusTrap,vg=sg,bg=vg.isFocusable,yo=function(e){lg(n,e);var t=cg(n);function n(r){var i;og(this,n),i=t.call(this,r),mg(Sr(i),"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 v;if(p=(v=this.getDocument())===null||v===void 0?void 0:v.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),i.handleDeactivate=i.handleDeactivate.bind(Sr(i)),i.handlePostDeactivate=i.handlePostDeactivate.bind(Sr(i)),i.handleClickOutsideDeactivates=i.handleClickOutsideDeactivates.bind(Sr(i)),i.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:i.handleDeactivate,onPostDeactivate:i.handlePostDeactivate,clickOutsideDeactivates:i.handleClickOutsideDeactivates},i.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var a=r.focusTrapOptions;for(var s in a)if(Object.prototype.hasOwnProperty.call(a,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){i.originalOptions[s]=a[s];continue}i.internalOptions[s]=a[s]}return i.outsideClick=null,i.focusTrapElements=r.containerElements||[],i.updatePreviousElement(),i}return ug(n,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var i=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return i||(i===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var i=this.getDocument();i&&(this.previouslyFocusedElement=i.activeElement)}},{key:"deactivateTrap",value:function(){!this.focusTrap||!this.focusTrap.active||this.focusTrap.deactivate({returnFocus:!1,checkCanReturnFocus:null,onDeactivate:this.originalOptions.onDeactivate})}},{key:"handleClickOutsideDeactivates",value:function(i){var a=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,i):this.originalOptions.clickOutsideDeactivates;return a&&(this.outsideClick={target:i.target,allowDeactivation:a}),a}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var i=this,a=function(){var o=i.getReturnFocusNode(),l=!!(i.originalOptions.returnFocusOnDeactivate&&o!==null&&o!==void 0&&o.focus&&(!i.outsideClick||i.outsideClick.allowDeactivation&&!bg(i.outsideClick.target,i.internalOptions.tabbableOptions))),u=i.internalOptions.preventScroll,d=u===void 0?!1:u;l&&o.focus({preventScroll:d}),i.originalOptions.onPostDeactivate&&i.originalOptions.onPostDeactivate.call(null),i.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(a,a):a()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var i=this.focusTrapElements.some(Boolean);i&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(i){if(this.focusTrap){i.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var a=!i.active&&this.props.active,s=i.active&&!this.props.active,o=!i.paused&&this.props.paused,l=i.paused&&!this.props.paused;if(a&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else i.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var i=this,a=this.props.children?di.Children.only(this.props.children):void 0;if(a){if(a.type&&a.type===di.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=i.props.containerElements;a&&(typeof a.ref=="function"?a.ref(u):a.ref&&(a.ref.current=u)),i.focusTrapElements=d||[u]},o=di.cloneElement(a,{ref:s});return o}return null}}]),n}(di.Component),Er=typeof Element>"u"?Function:Element;yo.propTypes={active:ye.bool,paused:ye.bool,focusTrapOptions:ye.shape({document:ye.object,onActivate:ye.func,onPostActivate:ye.func,checkCanFocusTrap:ye.func,onPause:ye.func,onPostPause:ye.func,onUnpause:ye.func,onPostUnpause:ye.func,onDeactivate:ye.func,onPostDeactivate:ye.func,checkCanReturnFocus:ye.func,initialFocus:ye.oneOfType([ye.instanceOf(Er),ye.string,ye.bool,ye.func]),fallbackFocus:ye.oneOfType([ye.instanceOf(Er),ye.string,ye.func]),escapeDeactivates:ye.oneOfType([ye.bool,ye.func]),clickOutsideDeactivates:ye.oneOfType([ye.bool,ye.func]),returnFocusOnDeactivate:ye.bool,setReturnFocus:ye.oneOfType([ye.instanceOf(Er),ye.string,ye.bool,ye.func]),allowOutsideClick:ye.oneOfType([ye.bool,ye.func]),preventScroll:ye.bool,tabbableOptions:ye.shape({displayCheck:ye.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:ye.oneOfType([ye.bool,ye.func])}),trapStack:ye.array,isKeyForward:ye.func,isKeyBackward:ye.func}),containerElements:ye.arrayOf(ye.instanceOf(Er)),children:ye.oneOfType([ye.element,ye.instanceOf(Er)])};yo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:gg};var yg=yo;const xg=In(yg);const un=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:i=()=>{},onClose:a=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:d="",gtmContext:m="Modal"})=>{const h=re.useIntl(),{registerOverlay:p,unregisterOverlay:v}=Nd(),[f,b]=y.useState(t),[g,x]=y.useState(null),C=y.useRef(null),F=O=>{f&&O.key==="Escape"&&T(!1)},D=O=>{x(O.target)},_=O=>{g===C.current&&O.target===C.current&&T(!1),x(null)};y.useEffect(()=>{if(f)return window.addEventListener("keyup",F),()=>{window.removeEventListener("keyup",F)}},[f]),y.useEffect(()=>{const O=C.current;return O&&(O.addEventListener("mousedown",D),O.addEventListener("mouseup",_)),()=>{O&&(O.removeEventListener("mousedown",D),O.removeEventListener("mouseup",_))}},[g]);const T=O=>{if(b(O),O)i(),p(e);else{if(f===O)return;a(),v(e)}};y.useEffect(()=>(T(t),()=>{f&&v(e)}),[t]);const R=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:C,className:V("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(vo,{id:e,className:V("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:R,children:t&&c.jsx(xg,{containerElements:[C.current],children:c.jsxs("div",{className:"overlay-content",children:[c.jsxs("div",{className:"top",children:[o&&c.jsx("h2",{className:"modal-title",children:o}),c.jsx(ke,{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(qt,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(qt,{}),c.jsx(pr,{buttons:u})]}),s&&c.jsx(or,{className:"error",children:s})]})})})})},ef=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const _r="joinCommunityButton",xo=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:i,leave:a}={join:()=>{},leave:()=>{}}})=>{const s=re.useIntl(),o=y.useContext(at),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 v={},f={};return d&&h!=="leaving"&&(v["data-hover-text"]=s.formatMessage({id:`${_r}_leave`}),v["aria-label"]=s.formatMessage({id:`${_r}_member_aria`}),f["aria-hidden"]="true"),c.jsx(ke,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&h!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${_r}_closed_tooltip`}):"",onClick:async b=>{if(u)return;b.currentTarget.blur(),p(d?"leaving":"joining");const g=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${_r}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(g);const x=d?a:i;typeof x=="function"&&setTimeout(async()=>{await x()},500),m(!d)},className:V("join-community-button",h,{active:h==="joining"}),disabled:u,"data-testid":"join-button",...v,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${_r}${["joining","leaving"].includes(h)?`_${h}`:d?"_member":n?"_short":""}`})})})};const Ia="communityDetails_",wg=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:i=0,data:a=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=re.useIntl(),{id:u}=y.useContext(at),d=u,m=5,h=i||a.length,p=a.length?a:Array(m).fill({}),v=`/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:`${Ia}members`}),c.jsx("span",{className:"count",children:h})]}),v?c.jsx(c.Fragment,{}):c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${Ia}viewAll`})})})]}),d&&c.jsx(go,{contributors:{total:i,data:p},styling:{size:"medium",showGap:!0,showPlaceholders:h===0},cutoff:m})]}):c.jsx(c.Fragment,{}),d?c.jsxs(c.Fragment,{children:[c.jsx(xo,{isMember:t,isOpen:n,disabled:b,functions:{...o}}),t&&c.jsx(ke,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${Ia}invite`})})]}):c.jsx(c.Fragment,{})]})};const Wr=({icon:e,className:t="",...n})=>c.jsx(ke,{className:V("action-button",t),variant:"tertiary",icon:e,...n}),Cg="reply",Pn="00000000-0000-0000-0000-000000000000",wo="en";function Co({queryClient:e,queryKey:t}){function n(r,i,a){e.setQueryData(t,a)}return n}function Do({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const i=e.getQueryData(t);return e.setQueryData(t,r),i}return n}var vr=(e=>(e.Post="post",e.Poll="poll",e))(vr||{});const yt="poll-vote",tf=(e,t="en")=>{var r;return e.verb!==vr.Poll?[]:(((r=e==null?void 0:e.latest_reactions)==null?void 0:r["poll-option"])||[]).map(i=>{var o,l,u,d,m;const a=((o=i==null?void 0:i.own_children)==null?void 0:o["poll-vote"])||[],s=((l=i.data)==null?void 0:l.description)||{[t]:""};return{id:i.id,label:s[t],numVotes:((u=i==null?void 0:i.children_counts)==null?void 0:u["poll-vote"])||0,hasUserVoted:a.length>0,userVote:{id:(d=a[0])==null?void 0:d.id},position:((m=i.data)==null?void 0:m.position)||0}}).sort((i,a)=>i.position-a.position)};function nf({activity:e,reactionId:t,user:n}){var a;const r=n==null?void 0:n.id;if(!r)return;const i=(a=e.latest_reactions)==null?void 0:a["poll-option"];if(i){for(const s of i)if(s.id===t){const o={id:Pn,activity_id:e.id,kind:yt,data:{},created_at:new Date().toISOString(),updated_at:new Date().toISOString(),user_id:r,parent:s.id,latest_children:{},own_children:{},children_counts:{}};s.latest_children=s.latest_children||{},s.latest_children[yt]=s.latest_children[yt]||[],s.latest_children[yt].push(o),s.own_children=s.own_children||{},s.own_children[yt]=s.own_children[yt]||[],s.own_children[yt].push(o),s.children_counts=s.children_counts||{},s.children_counts[yt]=(s.children_counts[yt]||0)+1;break}}}function rf({activity:e,reactionId:t,correctReactionId:n,user:r}){var i;(i=e.latest_reactions)==null||i["poll-option"].forEach(a=>{var s;a.id===t&&(a.latest_children[yt].forEach(o=>{o.id===Pn&&o.user_id===(r==null?void 0:r.id)&&(o.id=n)}),(s=a.own_children)==null||s[yt].forEach(o=>{o.id===Pn&&o.user_id===(r==null?void 0:r.id)&&(o.id=n)}))})}function af({activity:e,reactionId:t}){var r,i,a;const n=(r=e.latest_reactions)==null?void 0:r["poll-option"];if(n)for(const s of n){const o=(i=s.own_children)==null?void 0:i[yt],l=(a=s.latest_children)==null?void 0:a[yt];if(l){const u=l.findIndex(d=>d.id===t);u!==-1&&(l.splice(u,1),s.children_counts[yt]--)}if(o){const u=o.findIndex(d=>d.id===t);u!==-1&&o.splice(u,1)}}}function Dg({position:e,description:t},n){if(n!=null&&n.id)return{created_at:new Date().toISOString(),updated_at:new Date().toISOString(),id:Pn,kind:"poll-option",data:{description:t,position:e},parent:""}}function Eg(){return{latest_reactions:{like:[],reply:[],"poll-option":[]},reaction_counts:{like:0,reply:0,"poll-option":0},own_reactions:{like:[],reply:[],"poll-option":[]}}}function _g(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function kg(e,t){const n=e.map(r=>Dg(r,t));return{latest_reactions:{like:[],reply:[],"poll-option":n},reaction_counts:{like:0,reply:0,"poll-option":0},own_reactions:{like:[],reply:[],"poll-option":[]}}}function Eo(e){const{id:t="",name:n="",organization:r="",jobTitle:i="",image:a={}}=e,{thumbnail:s=""}=a;return{id:t,data:{name:n,organization:r,jobTitle:i,thumbnail:s}}}function Fg({title:e,content:t,categories:n}){const r=[];return n&&!["no-category",""].includes(n)&&r.push(n),{title:e,content:t,categories:r,id:Pn,time:new Date().toISOString(),verb:vr.Post}}function Vu({title:e,options:t,settings:n,user:r,correctActivityId:i}){return{title:e,content:"",id:i||Pn,time:new Date().toISOString(),verb:vr.Poll}}function Hu({activity:e,user:t}){return{...e,actor:Eo(t),...Eg()}}function Ku({activity:e,options:t,user:n}){return{...e,actor:Eo(n),...kg(t,n)}}function Zi({activity:e,reaction:t}){var n,r,i;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((i=e.own_reactions)==null?void 0:i.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function sf({activity:e,user:t}){var n,r,i;e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like-1:0},t!=null&&t.id&&(e.latest_reactions={...e.latest_reactions||{},like:(((r=e.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:a})=>a!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((i=e.own_reactions)==null?void 0:i.like)||[]).filter(({user_id:a})=>a!==t.id)})}function Yi({activity:e,reaction:t}){var n,r,i;t?(e.latest_reactions={...e.latest_reactions||{},pin:[...((r=e.latest_reactions)==null?void 0:r.pin)||[],t]},e.own_reactions={...e.own_reactions||{},pin:[...((i=e.own_reactions)==null?void 0:i.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function of({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 Ag(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function Bg(e,t,n){const r=t.pages.length-1,i=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[i]=e:t.pages[r].results.push(e),t}function Tg(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 lr(e,t,n){return t?n!=null&&n.append?Bg(e,t,n):Tg(e,t,n):Ag(e)}function Dt(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:i})=>i===e);if(r)return r}}function uf(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:i})=>i===e);if(r!==-1){n.splice(r,1);break}}return t}function _o(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}function Sg({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Pn,kind:Cg,parent:t||""}}function Zu({reply:e,user:t}){const n=Eo(t);return{...e,user_id:n.id,user:n,..._g()}}function Yu({reply:e,reaction:t}){var n,r,i;t?(e.latest_children={...e.latest_children||{},like:[...((r=e.latest_children)==null?void 0:r.like)||[],t]},e.own_children={...e.own_children||{},like:[...((i=e.own_children)==null?void 0:i.like)||[],t]}):e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like+1:1}}function jg({reply:e,user:t}){var n,r,i;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:a})=>a!==t.id)},e.own_children={...e.own_children||{},like:(((i=e.own_children)==null?void 0:i.like)||[]).filter(({user_id:a})=>a!==t.id)})}const ko=(e,t)=>{const n=new CustomEvent(rt.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let Gu,Ra=0;const lf=()=>{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(Gu);const i=document.getElementById(n);if(i){i.scrollIntoView({behavior:"smooth",block:"start"}),Ra=0;return}Ra++,!(Ra>10)&&(Gu=setTimeout(()=>{e(t)},50))}};var _e=(e=>(e.Answer="answer",e.Poll="poll",e.Post="post",e.Response="response",e.Reply="reply",e.Question="question",e))(_e||{});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}),Fo=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"}),Pg=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"}),Og=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"}),Mg=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:Fo.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:Fo.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:Fo.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:Pg.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:Og.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:Mg.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});const Ng=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Ig=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);function Rg(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 i=r==null?void 0:r.nextElementSibling;if(n==="up"){const d=r==null?void 0:r.previousElementSibling;d?i=d:(i=(o=r==null?void 0:r.parentElement)==null?void 0:o.lastElementChild,(i==null?void 0:i.getAttribute("data-index"))==="-1"&&(i=i==null?void 0:i.previousElementSibling))}else(!i||(i==null?void 0:i.getAttribute("data-index"))==="-1")&&(i=(l=r==null?void 0:r.parentElement)==null?void 0:l.firstElementChild);if(!i)return;const a=Number((i==null?void 0:i.getAttribute("data-index"))||"0");e([{type:"tabbableLink",value:a}]),(u=i==null?void 0:i.querySelector("a,button"))==null||u.focus()},[e])}const $g=y.lazy(()=>Promise.resolve().then(()=>bv));let Mr=!1;const $a=()=>{Mr!==!1&&(clearTimeout(Mr),Mr=!1)},Lg=5;let La=null;const cf=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:i=!1,content:a={type:_e.Reply,slugs:{}},canLike:s=!0,activityId:o,basePath:l,parentId:u,functions:{createLike:d=()=>{},deleteLike:m=()=>{},listLikes:h=async()=>({next:"",results:[]})}})=>{const p=re.useIntl(),v={numberOfLikes:t,userLikedContent:i,ignoreInteractions:!1,showLikers:!1,tabbableLink:0,showLikesModal:!1},[f,b]=y.useReducer(ei,v),{numberOfLikes:g,userLikedContent:x,ignoreInteractions:C,showLikers:F,tabbableLink:D,showLikesModal:_}=f,T=Rg(b);y.useEffect(()=>{b([{type:"userLikedContent",value:i}])},[i]);const R=y.useMemo(()=>Ig(n,Lg),[n]),O=B=>{if(B.preventDefault(),B.stopPropagation(),b([{type:"showLikers",value:!1}]),Mr)return $a(),!1;if($a(),C||!s)return!1;Mr=setTimeout(z,350)},z=async()=>{if($a(),C||!s)return!1;let B=x?g-1:g+1;B<0&&(B=0),b([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:B},{type:"userLikedContent",value:!x}]);try{if(a&&a.slugs){const j=Ng(a.slugs);x?await m(j):await d({...j,payload:{contentPath:window.location.pathname}})}}catch{b([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:i}])}finally{b([{type:"ignoreInteractions",value:!1}])}},$=()=>{La=setTimeout(()=>{b([{type:"showLikers",value:!1}])},500)},A=()=>{La&&clearTimeout(La)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:B=>{B.key==="Escape"&&b([{type:"showLikers",value:!1}])},onMouseEnter:()=>{A(),b([{type:"showLikers",value:!0}])},onMouseLeave:()=>{$()}},c.jsxs(c.Fragment,{children:[c.jsx(Wr,{className:V("discussion-button text-medium action-button likes-button",{"show-spinner":C,"is-liked":x,disabled:!s}),icon:{icon:x?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${a.type}-click`,onClick:O,screenreaderText:s?p.formatMessage({id:`discussion_likes_${x?"unlike":"like"}`},{action:p.formatMessage({id:`discussion_action_${a.type}`})}):!1,"aria-pressed":x,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:p.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:g})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Ie,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{A()},onBlur:()=>$,onClick:B=>{var M;B.preventDefault(),B.stopPropagation(),A(),b([{type:"showLikers",value:!0}]);const j=(M=B.currentTarget.nextSibling)==null?void 0:M.childNodes[0];if(j){const U=j.querySelector("li:first-child a");U&&(b([{type:"tabbableLink",value:0}]),setTimeout(()=>{U.focus()},100))}},onKeyDown:B=>{B.key==="Escape"&&(B.preventDefault(),B.stopPropagation(),$())},"aria-expanded":F,"aria-controls":`likes-tooltip-${a.slug}`,children:c.jsx(Ie,{showOnFocus:!1,children:p.formatMessage({id:"discussion_likes_show"},{action:a.type})})}),c.jsx($n,{id:`likes-tooltip-${a.slug}`,isOpen:F,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[R.map((B,j)=>{if(typeof B=="string")return null;const M={};return D!==j&&(M.tabIndex=-1),c.jsx("li",{"data-index":j,children:c.jsx(yn,{href:B.id?`/profiles/${B.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onFocus:()=>A(),onKeyDown:T,...M,children:B.name?B.name:c.jsx("span",{className:"deleted-user",children:p.formatMessage({id:"member_deleted"})})})},B.id||window.btoa(B.name||""))}),c.jsx("li",{"data-index":R.length,className:"show-all",children:c.jsx(ke,{variant:"tertiary",onClick:()=>{A(),$(),b([{type:"showLikesModal",value:!0}])},onKeyDown:T,children:p.formatMessage({id:"discussion_likes_showAll"})})})]})}),_&&c.jsx(gr,{children:c.jsx(y.Suspense,{children:c.jsx($g,{activityId:o,basePath:l,parentId:u,likeCount:t,showModal:_,functions:{onClose:()=>b([{type:"showLikesModal",value:!1}]),likes:{list:h}}})})})]})]}))},Ns=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},br=e=>{var t,n,r,i,a,s;return e&&!e.error?{id:e==null?void 0:e.id,name:(t=e==null?void 0:e.data)==null?void 0:t.name,organization:(n=e==null?void 0:e.data)==null?void 0:n.organization,jobTitle:(r=e==null?void 0:e.data)==null?void 0:r.jobTitle,location:(i=e==null?void 0:e.data)==null?void 0:i.location,image:{thumbnail:((a=e==null?void 0:e.data)==null?void 0:a.thumbnail)||void 0},badges:(s=e==null?void 0:e.data)==null?void 0:s.badges}:"deleted"};function zg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=ze.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Hu({activity:Fg(o),user:a});return lr(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=Hu({activity:o,user:a});r.setQueryData(i,lr(d,u,{replace:!0})),setTimeout(()=>{ko(d.id,"activity")},0)}});return s}function qg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=ze.useMutation({mutationFn:e,onMutate:({options:o,title:l,settings:u})=>t(d=>{const m=Ku({activity:Vu({title:l,options:o,settings:u,user:a}),options:o,user:a});return lr(m,d)}),onError:n,onSuccess:(o,{options:l,title:u,settings:d},m)=>{const h=o.body.id,p=Ku({activity:Vu({title:u,options:l,settings:d,user:a,correctActivityId:h}),options:l,user:a});r.setQueryData(i,lr(p,m,{replace:!0})),setTimeout(()=>{ko(h,"activity")},0)}});return s}function Ug({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=ze.useMutation({mutationFn:e,onMutate:({activityId:o,reactionId:l})=>t(u=>{const d=Dt(o,u);return d&&nf({activity:d,reactionId:l,user:a}),u}),onError:n,onSuccess:(o,{activityId:l,reactionId:u},d)=>{const m=Dt(l,d);m&&rf({activity:m,reactionId:u,correctReactionId:o.body.id,user:a}),r.setQueryData(i,d)}});return s}function Wg({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=ze.useMutation({mutationFn:e,onMutate:({activityId:i,content:a})=>t(s=>{const o=Dt(i,s);return o&&(o.content=a),s}),onError:n});return r}function Vg({queryFns:{create:e,edit:t,like:n,list:r,remove:i,unlike:a,pin:s,unpin:o,createVote:l,createPoll:u,removeVote:d,removePoll:m},queryKey:h,filterOption:p}){const v=ze.useQueryClient(),f=da(),b={queryClient:v,queryKey:h},g={mutationHandlers:{error:Co(b),mutate:Do(b)},user:f,...b},x=zg({...g,mutationFn:e}),C=Wg({...g,mutationFn:t}),F=Hg({...g,mutationFn:n}),D=Qu({...g,mutationFn:i}),_=Gg({...g,mutationFn:a}),T=Zg({...g,mutationFn:s}),R=Qg({...g,mutationFn:o}),O=Ug({...g,mutationFn:l}),z=qg({...g,mutationFn:u}),$=Yg({...g,mutationFn:d}),A=Qu({...g,mutationFn:m}),{activities:B,...j}=Kg({queryKey:h,queryFn:r,filterOption:p});return{activities:B,mutations:{create:x,edit:C,remove:D,like:F,unlike:_,pin:T,unpin:R,createVote:O,createPoll:z,removeVote:$,removePoll:A},user:f,...j}}function Hg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=ze.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Dt(s,o);return l&&Zi({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Dt(o,l);u&&Zi({activity:u,reaction:s}),r.setQueryData(i,l)}});return a}function Kg({queryFn:e,queryKey:t,filterOption:n}){const{data:r,error:i,isLoading:a,hasNextPage:s,fetchNextPage:o}=ze.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:_o(r),error:i,isLoading:a,hasNextPage:s,fetchNextPage:o}}function Zg({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=ze.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Dt(s,o);return l&&Yi({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Dt(o,l);u&&Yi({activity:u,reaction:s}),r.setQueryData(i,l)}});return a}function Qu({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=ze.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(a=>uf(i,a)),onError:n});return r}function Yg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=ze.useMutation({mutationFn:e,onMutate:({activityId:a,reactionId:s})=>t(o=>{const l=Dt(a,o);return l&&af({activity:l,reactionId:s}),o}),onError:n});return i}function Gg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=ze.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(s=>{const o=Dt(a,s);return o&&sf({activity:o,user:r}),s}),onError:n});return i}function Qg({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=ze.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(s=>{const o=Dt(a,s);return o&&of({activity:o,user:r}),s}),onError:n});return i}const Jg=280,Ao=async(e,t,n,r=()=>Promise.resolve([]))=>{let i=t?ar(e,typeof t=="number"?t:Jg):e;i=i.trim();const a=`<br>
63
63
 
64
- `;return i.slice(0,a.length)===a&&(i=i.slice(a.length)),n?await pd({text:i,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):i},ko=(e,t)=>t.length===0||e.length===0?[]:e.map(n=>t.find(r=>r.slug===n)),Yg=(e,t,n)=>{let r=!1;function i(a){let s=30;for(;a||s<=0;){if(t.some(o=>Array.from(a==null?void 0:a.classList).includes(o))){r=!0;break}if(Array.from(a==null?void 0:a.classList).includes(n))break;a=a.parentElement,s--}}return i(e.target),r},Gg=(e,t)=>e?typeof e=="string"?e:e[t]:"",Qg=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:i,functions:{activities:a,form:s,join:o,leave:l,likes:u,polls:d},profile:h,locale:p=gg})=>{const m=re.useIntl(),[v,f]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[b,g]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),D={...a,...d},{activities:w,error:F,fetchNextPage:E,hasNextPage:k,isLoading:T,mutations:{create:R,edit:P,remove:z,like:$,unlike:B,pin:A,unpin:j,createVote:M,removeVote:U}}=Lg({queryKey:[e,t,"activities",v],queryFns:D,filterOption:v[0]});y.useEffect(()=>{i&&g(b.concat(i==null?void 0:i.map(({slug:C,name:G})=>({id:C,text:G,type:"category"}))))},[i]);const[W,ie]=y.useState(null),ae=()=>{ie(w.length),E()};return ef(),F?c.jsx(xn,{variant:"error",text:F.message}):c.jsxs("section",{children:[c.jsx(su,{isCard:!0,parentId:t,categories:i,form:{content:{type:ha.Post,slugs:{}},functions:{create:R,...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:b.map(({id:C,text:G})=>({id:C,text:m.formatMessage({id:`activitiesFeed_rankingMethod_${G}`,defaultMessage:G})})),defaultOptions:v.map(({id:C,text:G})=>({id:C,text:m.formatMessage({id:`activitiesFeed_rankingMethod_${G}`,defaultMessage:G})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:C,previous:G})=>{if(C[0]===G[0])return;f([b.find(O=>O.id===C[0])]);const ne=b.find(O=>O.id===C[0]);if(!ne)return;const _=new CustomEvent("ariaLive",{detail:{message:m.formatMessage({id:"community_sortSuccess"},{order:m.formatMessage({id:`activitiesFeed_rankingMethod_${ne.text}`,defaultMessage:ne.text})})}});document.dispatchEvent(_)}}),w==null?void 0:w.map((C,G)=>{var pe,ve,Ee;const{id:ne,own_reactions:_,latest_reactions:O,reaction_counts:q,mentioned_users:S,total_replies:L,additional_data:Q}=C,K=(((pe=O==null?void 0:O.like)==null?void 0:pe.length)||0)>0,J=(((ve=_==null?void 0:_.like)==null?void 0:ve.length)||0)>0,ce=J?_==null?void 0:_.like[0].id:"",ee=K?(Ee=O==null?void 0:O.like)==null?void 0:Ee.map(Ce=>{var Fe,We,Me;return{id:(Fe=Ce==null?void 0:Ce.user)==null?void 0:Fe.id,name:(Me=(We=Ce==null?void 0:Ce.user)==null?void 0:We.data)==null?void 0:Me.name}}):!1;return c.jsx(y.Fragment,{children:c.jsx(ni,{content:{type:C.verb,title:C==null?void 0:C.title,body:C==null?void 0:C.content,canLike:n,createdAt:(C==null?void 0:C.time)||"",slugs:{question:`${e}/${t}`,answer:ne},slug:ne,author:pr(C==null?void 0:C.actor),userLiked:J,likes:(q==null?void 0:q.like)||0,comments:L||0,peopleWhoLiked:ee,data:{mentions:S,...Q||{}},pinned:(q==null?void 0:q.pin)&&(q==null?void 0:q.pin)>0||!1,categories:ko((C==null?void 0:C.categories)||[],i||[]),pollOptions:Dg(C,p),pollSettings:C==null?void 0:C.settings},links:{post:`${e}/${t}/${ne}`,comments:`${e}/${t}/${ne}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>z({activityId:ne}),updateContent:(Ce,{body:Fe})=>P({activityId:ne,content:Fe})},likes:{createLike:()=>$({activityId:ne}),deleteLike:()=>B({activityId:ne,reactionId:ce}),listLikes:Ce=>u.list({activityId:ne,...Ce})},comments:{openComments:()=>null},pins:{createPin:()=>A({activityId:ne}),deletePin:()=>j({activityId:ne,reactionId:O==null?void 0:O.pin[0].id})},polls:{createVote:({reactionId:Ce})=>M({activityId:ne,reactionId:Ce}),removeVote:({reactionId:Ce})=>U({activityId:ne,reactionId:Ce}),removePoll:()=>null},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:G===W,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:t||""},{scope:lt.Platform,area:"all"}]},basePath:e,parentId:t})},ne)}),!T&&c.jsx(Xr,{hasNextPage:k,loadNextPage:ae,icon:{icon:"arrow-down",position:"right"},messages:{button:m.formatMessage({id:"loadMore_button"}),error:m.formatMessage({id:"loadMore_error"})}}),w.length===0&&!T&&c.jsx(kt,{className:"no-activities",variant:"muted",icon:"text--input",children:v[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(ke,{variant:"secondary",size:"small",href:"/communities",children:m.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),c.jsx(ou,{form:h})]})},Jg={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 Xg({parentId:e,isMember:t,formFunctions:n,leave:r,join:i}){const a=re.useIntl();return c.jsx(su,{form:{content:{type:Be.Reply,slugs:{}},functions:n,meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:a.formatMessage({id:"discussion_responses_placeholder"})},parentId:e,membershipRequiredToPost:{isMember:t,required:!0,join:i,leave:r,notMemberStateText:a.formatMessage({id:"community_joinToPost"})}})}function ev({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const i=re.useIntl(),a=()=>{n(r),t()};return c.jsx(Xr,{hasNextPage:e,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},messages:{button:i.formatMessage({id:"loadMore_button"}),error:i.formatMessage({id:"loadMore_error"})}})}function tv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=Ue.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Uu({reply:Fg(o),user:a});return Zi(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=Uu({reply:o,user:a});r.setQueryData(i,Zi(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Xd(d.id,"reply")},0)}});return s}function nv({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ue.useMutation({mutationFn:e,onMutate:({replyId:i,content:a})=>t(s=>{const o=Ft(i,s);return o&&(o.data.content=a),s}),onError:n});return r}function rv({replies:e,user:t}){return!e||!(t!=null&&t.id)?[]:e.map(({id:n,own_children:r,latest_children:i,children_counts:a,data:s,created_at:o,parent:l,...u})=>{var f,b,g,D;const d=(((f=r==null?void 0:r.like)==null?void 0:f.length)||0)>0,h=(((b=i==null?void 0:i.like)==null?void 0:b.length)||0)>0,p=d?(g=r==null?void 0:r.like)==null?void 0:g.find(w=>{var F;return((F=w==null?void 0:w.user)==null?void 0:F.id)===(t==null?void 0:t.id)}):!1,m=typeof p=="object"?(p==null?void 0:p.id)??"":"",v=h?(D=i==null?void 0:i.like)==null?void 0:D.map(w=>{var F,E,k;return{id:(F=w==null?void 0:w.user)==null?void 0:F.id,name:(k=(E=w==null?void 0:w.user)==null?void 0:E.data)==null?void 0:k.name}}):!1;return{user:u==null?void 0:u.user,body:av(s),createdAt:o,data:iv(s),likeId:m,liked:h,likes:(a==null?void 0:a.like)||0,peopleWhoLiked:v,replyId:n,parent:l,userLiked:!!p}})}function iv(e){if(!e||!e.mentioned_users)return{};const t=e==null?void 0:e.mentioned_users,n=(e==null?void 0:e.additional_data)||{};return{mentions:t,...n}}function av(e){var t;return e?typeof e.content=="string"?e.content:((t=e==null?void 0:e.content)==null?void 0:t.text)||"":""}function nf({queryFns:{create:e,edit:t,like:n,list:r,remove:i,unlike:a},queryKey:s}){const o=Ue.useQueryClient(),l=ca(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Co(u),mutate:wo(u)},user:l,...u},h=tv({...d,mutationFn:e}),p=nv({...d,mutationFn:t}),m=sv({...d,mutationFn:n}),v=uv({...d,mutationFn:i}),f=lv({...d,mutationFn:a}),{replies:b,...g}=ov({queryKey:s,queryFn:r});return{replies:rv({replies:b,user:l}),mutations:{create:h,edit:p,remove:v,like:m,unlike:f},user:l,...g}}function sv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Ue.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Ft(s,o);return l&&Wu({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ft(o,l);u&&Wu({reply:u,reaction:s}),r.setQueryData(i,l)}});return a}function ov({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}=Ue.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:Do(n),error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}}function uv({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ue.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(a=>Jd(i,a)),onError:n});return r}function lv({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Ue.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(s=>{const o=Ft(a,s);return o&&Ag({reply:o,user:r}),s}),onError:n});return i}const cv=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:i,functions:{reactions:a,form:s,likes:o}})=>{const l=re.useIntl(),u=3,{replies:d,fetchNextPage:h,hasNextPage:p,isLoading:m,mutations:{create:v,edit:f,like:b,remove:g,unlike:D}}=nf({queryKey:[t,r,e,i,"replies"],queryFns:{...a,list:E=>a.list({...E,reactionId:i})}});oo([m]);const[w,F]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(d==null?void 0:d.length)>=u&&c.jsx(ke,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${w?"up_left":"down_right"}`,position:"left"},onClick:()=>F(!w),children:l.formatMessage({id:`discussion_thread_${w?"hide":"show"}`},{count:d==null?void 0:d.length})}),w&&c.jsx(im,{loadMore:{isLoading:m,hasNextPage:p,loadNextPage:()=>h()},form:{parentId:r,content:{type:Be.Reply,slugs:{question:`${t}/${r}`,answer:e,reply:i}},functions:{create:(E,{body:k})=>v({activityId:e,replyId:i,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:R,createdAt:P,userLiked:z,peopleWhoLiked:$,parent:B,user:A,likeId:j})=>c.jsx(ni,{isCommunity:!0,content:{id:E,type:Be.Reply,body:R,canLike:n,createdAt:P,slugs:{question:`${t}/${r}`,answer:e,reply:B},slug:"",author:pr(A),userLiked:z,likes:k,peopleWhoLiked:$,data:T},functions:{content:{createContent:()=>null,deleteContent:()=>g({replyId:E}),updateContent:(M,{body:U})=>f({replyId:E,content:U})},likes:{createLike:()=>b({replyId:E}),deleteLike:()=>D({replyId:E,reactionId:j}),listLikes:M=>o.list({replyId:E,...M})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:r||""},{scope:lt.Platform,area:"all"}]},basePath:t,parentId:r},E)):null})]})};function dv({formFns:e,activityId:t,basePath:n,focus:r,isMember:i,parentId:a,reply:s}){const{body:o,data:l,likeId:u,liked:d,likes:h,peopleWhoLiked:p,replyId:m,createdAt:v,user:f}=s,{edit:b,like:g,remove:D,unlike:w}=e.mutations;return c.jsx(em,{children:c.jsx(ni,{isCommunity:!0,content:{id:m,type:Be.Reply,body:o,canLike:i,createdAt:v,slugs:{question:`${n}/${a}`,answer:t,reply:m},slug:m,author:pr(f),userLiked:d,likes:h,peopleWhoLiked:p,data:l},functions:{content:{createContent:()=>null,deleteContent:()=>D({replyId:m}),updateContent:(F,{body:E})=>b({replyId:m,content:E})},likes:{createLike:()=>g({replyId:m}),deleteLike:()=>w({replyId:m,reactionId:u}),listLikes:F=>e.likes.list({replyId:m,...F})},comments:{},form:e.form},badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:a||""},{scope:lt.Platform,area:"all"}]},children:c.jsx(cv,{basePath:n,parentId:a,activityId:t,replyId:m,isMember:i,functions:e}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:a},m)},m)}const rf=({activityId:e,basePath:t,parentId:n,activityTotalReplies:r,isMember:i,functions:{form:a,join:s,leave:o,likes:l,reactions:u},profile:d,showReplies:h})=>{const{fetchNextPage:p,hasNextPage:m,isLoading:v,replies:f,mutations:{create:b,remove:g,edit:D,like:w,unlike:F}}=nf({queryKey:[t,n,e,"replies"],queryFns:u}),[E,k]=y.useState(null);oo([v]),ef();const T={create:(R,P)=>{const{body:z}=P;b({activityId:e,content:z})},...a};return c.jsxs("section",{className:"replies-feed",children:[c.jsx(rm,{type:"comment",responses:r,isLoading:v}),h?c.jsxs(c.Fragment,{children:[c.jsx(Xg,{parentId:n,isMember:i,join:s,leave:o,formFunctions:T}),f==null?void 0:f.map((R,P)=>c.jsx(dv,{activityId:e,basePath:t,focus:E===P,formFns:{form:a,likes:l,reactions:u,mutations:{remove:g,edit:D,like:w,unlike:F}},isMember:i,parentId:n,reply:R},R.replyId)),v?c.jsx(c.Fragment,{children:" "}):c.jsx(ev,{hasNextPage:m,fetchNextPage:p,setFocusReplyIndex:k,totalReplies:f.length})]}):c.jsx(kt,{children:c.jsx(re.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),c.jsx(ou,{form:d})]})};function fv({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}=Ue.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:d=>(d==null?void 0:d.next)||null}),l=Do(n),u=`${l.length||0}${a?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}}function hv({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=fv({queryKey:t,queryFn:e});return{likes:n,...r}}function af({basePath:e,parentId:t,activityId:n,likeCount:r,functions:i}){const{likes:a,fetchNextPage:s,hasNextPage:o,refetch:l}=hv({queryKey:[e,t,n,"likes"],queryFns:i.likes});y.useEffect(()=>{l()},[l]);const u=a.map(({user:d})=>d).map(d=>d?pr(d):void 0).filter(d=>d&&typeof d!="string");return c.jsx("section",{className:"likes-feed",children:c.jsx(Xh,{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:i,...a})=>{const s=re.useIntl();return c.jsx(un,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:V("profile-modal in-portal",i,{open:e}),maxWidth:600,children:c.jsx(af,{...a,likeCount:r??0,functions:{likes:n}})})},mv=Object.freeze(Object.defineProperty({__proto__:null,default:sf},Symbol.toStringTag,{value:"Module"})),pv={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 gv=3e3,of=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=re.useIntl(),r="discussion_share_copy_link",[i,a]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(zr,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>a({...i,isOpen:!0}),onFocus:()=>a({...i,isOpen:!0}),onMouseOut:()=>a({isOpen:!1,isCopied:!1}),onBlur:()=>a({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{a({isOpen:!0,isCopied:!0});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{a({isOpen:!1,isCopied:!1})},gv)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,"data-testid":"share-link",screenreaderText:n.formatMessage({id:r})}),c.jsx(Rn,{className:V({copied:i.isCopied}),isOpen:i.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${i.isCopied?"_success":""}`})})]})};const Un="discussion_",uf=({className:e,gtmContext:t,contentType:n,likes:r,comments:i,replies:a,shareLink:s,moreMenu:o})=>{const l=re.useIntl(),u=[];return o&&o.reportData&&u.push({text:l.formatMessage({id:`${Un}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(l.formatMessage({id:`${Un}report_subject`}))}&body=${encodeURI(l.formatMessage({id:`${Un}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,{}),i?c.jsx("li",{children:c.jsx(zr,{onClick:d=>{d.preventDefault(),d.stopPropagation(),i.functions.onClick()},icon:{icon:"speech-bubble_square"},"data-testid":"comment","data-gtm-event-context":t,"data-gtm-event-type":`answer-${n}-click`,screenreaderText:l.formatMessage({id:`${Un}comments_screenReader`},{count:i.count}),children:l.formatMessage({id:`${Un}comments${i.count===null?"_loading":""}`},{count:i.count})})}):c.jsx(c.Fragment,{}),a?c.jsx("li",{children:c.jsx(zr,{styling:{muted:!0},onClick:a.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",children:l.formatMessage({id:`${Un}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 vv=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=re.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:i,href:a,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(yn,{href:s?void 0:a,...l,children:ir(i,t)})]},`${window.btoa(i)}_${o}`)})})]})};const Fo=({variant:e="default",data:{image:t,url:n,title:r,description:i},onClick:a,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:h=>{if(h.preventDefault(),h.stopPropagation(),a){a(h);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})}),i&&e!=="condensed"?c.jsx("p",{className:"text-small",children:i}):c.jsx(c.Fragment,{}),t&&t.src?c.jsx("p",{className:"img",children:c.jsx("img",{src:t.src,alt:t.alt||"",loading:"lazy",fetchpriority:"low",width:t.width||"auto",height:t.height||"100%"})}):c.jsx(c.Fragment,{})]})};const lf=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:i=()=>{},preventNoOptionSelected:a=!1,className:s=""})=>{const o=re.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(v=>v.id):[]),[h,p]=y.useState(0),m=(v,f)=>{let b=[];u.includes(v)&&!a?b=u.filter(g=>g!==v):v==="all"?b=["all"]:r?b=[...u.filter(g=>g!=="all"),v]:b=[v],d(g=>(i&&typeof i=="function"&&i({current:b,previous:g}),b)),f&&typeof f=="function"&&f()};return c.jsx("ul",{className:V("filters",s),children:l.map(({id:v,text:f,disabled:b=!1,callback:g=()=>{}},D)=>{let w={tabIndex:h===D?0:-1};return b&&(w={disabled:!0,"aria-label":o.formatMessage({id:"filters_disabled"},{name:f})}),c.jsx("li",{children:c.jsx("button",{className:V(v,{selected:u.includes(v)}),onClick:F=>{F.preventDefault(),F.stopPropagation(),m(v,g)},onKeyDown:F=>{var R,P;let E=D+1,k,T;switch(F.code){case"Enter":case"Space":F.preventDefault(),F.stopPropagation(),m(v,g);break;case"ArrowLeft":case"ArrowRight":F.preventDefault(),F.stopPropagation(),F.code==="ArrowLeft"?(E=D-1,E<0&&(E=l.length-1)):E>=l.length&&(E=0),p(E),k=F.currentTarget.closest("li"),T=(R=k==null?void 0:k.parentElement)==null?void 0:R.children[E],(P=T==null?void 0:T.querySelector("button"))==null||P.focus();break}},"aria-selected":u.includes(v),...w,children:f})},v)})})},bv=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let i="",a=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(i+=`/${s}`,a=!0):(i.includes(`/${r}/`)||(i+=`/${r}`),i+=`/${s}`)}),i.includes(`/${r}/`)||(i+=`/${r}`),t&&(i+=`/${t}`),a?{url:i,urlForRouter:`/${i.split("/").slice(2).join("/")}`}:i};const ci="languageSwitcher_",yv=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:i,urlParts:a,variant:s="default",label:o,className:l=""})=>{const u=re.useIntl(),{updateLanguage:d=()=>{}}=y.useContext(ho),[h,p]=y.useState(e);if(y.useEffect(()=>{e!==h&&p(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const v=Object.keys(r),f=h!==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:`${ci}label`})}),c.jsx("ul",{children:v.map(b=>{var w;if(!Bi[b])return null;const g=(w=r[b])==null?void 0:w.post_name;let D={className:b};if(h===b)D["aria-label"]=u.formatMessage({id:`${ci}selected`},{language:Bi[b]});else{const F=bv(b,g,a);D={...D,href:typeof F=="string"?F:F.url,onClick:E=>{p(b),d(b),typeof i<"u"&&(E.preventDefault(),E.stopPropagation(),i(b,typeof F=="string"?F:F.urlForRouter))}}}return c.jsx("li",{children:c.jsx(yn,{...D,fallbackElement:"span",children:Bi[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${ci}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${ci}disclaimer`},{email:Yn.support,link:b=>{const g=`mailto:${b}`;return c.jsx("a",{href:g,children:b})}})})]})};const za=re.createIntl({locale:"en",messages:fr}),Xr=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:i="medium",styling:a={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:za.formatMessage({id:"loadMore_button"}),endOfFeed:za.formatMessage({id:"loadMore_endOfFeed"}),error:za.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,h]=y.useState(""),p=async m=>{if(!n)try{await t(m)}catch(v){v instanceof Error?h(v.message):h("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:V("load-more",l),children:!d&&e?c.jsx(ke,{variant:r,size:i,styling:a,icon:s,onClick:p,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const Ao=({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(re.FormattedMessage,{id:"apolitical"})})})});let di=!1;const cf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const i=re.useIntl(),a=y.useRef(null),[s,o]=y.useState(!1),l=u=>{a.current&&u.target instanceof HTMLElement&&!a.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:a,className:V("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(ke,{variant:"tertiary",size:"medium","data-testid":"more-menu",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:i.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:d,text:h,icon:p,...m},v)=>{const f={...m,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{di&&(clearTimeout(di),di=!1)},onBlur:()=>{di=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(ke,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${v}`)})})]})})},xv=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Cv=y.lazy(()=>Promise.resolve().then(()=>pp)),wv=[{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=re.useIntl(),r=y.useContext(at),i=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[wv.map(({key:a,href:s})=>{const o=xv(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:V(a,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),i&&t&&c.jsx(Cv,{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"})]})},Dr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Dv=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${Dr(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(`${Dr(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(`${Dr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
64
+ `;return i.slice(0,a.length)===a&&(i=i.slice(a.length)),n?await wd({text:i,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):i},Bo=(e,t)=>t.length===0||e.length===0?[]:e.map(n=>t.find(r=>r.slug===n)),Xg=(e,t,n)=>{let r=!1;function i(a){let s=30;for(;a||s<=0;){if(t.some(o=>Array.from(a==null?void 0:a.classList).includes(o))){r=!0;break}if(Array.from(a==null?void 0:a.classList).includes(n))break;a=a.parentElement,s--}}return i(e.target),r},ev=(e,t)=>e?typeof e=="string"?e:e[t]:"",tv=({basePath:e,parentId:t,isMember:n,isOwner:r,categories:i,functions:{activities:a,form:s,join:o,leave:l,likes:u,polls:d},profile:m,locale:h=wo})=>{const p=re.useIntl(),[v,f]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"}]),[b,g]=y.useState([{id:"recent_with_pin",text:"recent",type:"ranking"},{id:"community_feed_live",text:"popular",type:"ranking"}]),x={...a,...d},{activities:C,error:F,fetchNextPage:D,hasNextPage:_,isLoading:T,mutations:{create:R,edit:O,remove:z,like:$,unlike:A,pin:B,unpin:j,createPoll:M,createVote:U,removeVote:W,removePoll:ie}}=Vg({queryKey:[e,t,"activities",v],queryFns:x,filterOption:v[0]});y.useEffect(()=>{i&&g(b.concat(i==null?void 0:i.map(({slug:Z,name:k})=>({id:Z,text:k,type:"category"}))))},[i]);const[se,E]=y.useState(null),ee=()=>{E(C.length),D()};return lf(),F?c.jsx(xn,{variant:"error",text:F.message}):c.jsxs("section",{children:[c.jsx(lu,{isCard:!0,parentId:t,categories:i,form:{content:{type:vr.Post,slugs:{}},functions:{create:R,createPoll:M,...s},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:o,leave:l,notMemberStateText:p.formatMessage({id:"community_joinToPost"})}}),c.jsx(vf,{className:"activities-feed-filtering",options:b.map(({id:Z,text:k})=>({id:Z,text:p.formatMessage({id:`activitiesFeed_rankingMethod_${k}`,defaultMessage:k})})),defaultOptions:v.map(({id:Z,text:k})=>({id:Z,text:p.formatMessage({id:`activitiesFeed_rankingMethod_${k}`,defaultMessage:k})})),preventNoOptionSelected:!0,allowMultiple:!1,onChange:({current:Z,previous:k})=>{if(Z[0]===k[0])return;f([b.find(S=>S.id===Z[0])]);const P=b.find(S=>S.id===Z[0]);if(!P)return;const q=new CustomEvent("ariaLive",{detail:{message:p.formatMessage({id:"community_sortSuccess"},{order:p.formatMessage({id:`activitiesFeed_rankingMethod_${P.text}`,defaultMessage:P.text})})}});document.dispatchEvent(q)}}),C==null?void 0:C.map((Z,k)=>{var xe,Be,Fe,Ve,Re,Ne,Qe,Ae,Oe;const{id:P,own_reactions:q,latest_reactions:S,reaction_counts:L,mentioned_users:Q,total_replies:Y,additional_data:te}=Z,ce=(((xe=S==null?void 0:S.like)==null?void 0:xe.length)||0)>0,J=(((Be=q==null?void 0:q.like)==null?void 0:Be.length)||0)>0,pe=J?q==null?void 0:q.like[0].id:"",de=ce?(Fe=S==null?void 0:S.like)==null?void 0:Fe.map(Ee=>{var K,oe,ae;return{id:(K=Ee==null?void 0:Ee.user)==null?void 0:K.id,name:(ae=(oe=Ee==null?void 0:Ee.user)==null?void 0:oe.data)==null?void 0:ae.name}}):!1;return c.jsx(y.Fragment,{children:c.jsx(ii,{content:{type:Z.verb,title:Z==null?void 0:Z.title,body:Z==null?void 0:Z.content,canLike:n,createdAt:(Z==null?void 0:Z.time)||"",slugs:{question:`${e}/${t}`,answer:P},slug:P,author:br(Z==null?void 0:Z.actor),userLiked:J,likes:(L==null?void 0:L.like)||0,comments:Y||0,peopleWhoLiked:de,data:{mentions:Q,...te||{}},pinned:(L==null?void 0:L.pin)&&(L==null?void 0:L.pin)>0||!1,categories:Bo((Z==null?void 0:Z.categories)||[],i||[]),pollOptions:tf(Z,h),pollSettings:{showRemoveVote:(Ve=Z==null?void 0:Z.settings)==null?void 0:Ve.show_remove_vote,allowMultipleVotes:(Re=Z==null?void 0:Z.settings)==null?void 0:Re.allow_multiple_votes,deadlineAt:(Ne=Z==null?void 0:Z.settings)==null?void 0:Ne.deadline_at,hideParticipants:(Qe=Z==null?void 0:Z.settings)==null?void 0:Qe.hide_participants,numberOfWinners:(Ae=Z==null?void 0:Z.settings)==null?void 0:Ae.number_of_winners,resultsVisibility:(Oe=Z==null?void 0:Z.settings)==null?void 0:Oe.results_visibility}},links:{post:`${e}/${t}/${P}`,comments:`${e}/${t}/${P}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>z({activityId:P}),updateContent:(Ee,{body:K})=>O({activityId:P,content:K})},likes:{createLike:()=>$({activityId:P}),deleteLike:()=>A({activityId:P,reactionId:pe}),listLikes:Ee=>u.list({activityId:P,...Ee})},comments:{openComments:()=>null},pins:{createPin:()=>B({activityId:P}),deletePin:()=>j({activityId:P,reactionId:S==null?void 0:S.pin[0].id})},polls:{createVote:({reactionId:Ee})=>U({activityId:P,reactionId:Ee}),removeVote:({reactionId:Ee})=>W({activityId:P,reactionId:Ee}),removePoll:()=>ie({activityId:P})},form:s},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:k===se,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:t||""},{scope:dt.Platform,area:"all"}]},basePath:e,parentId:t})},P)}),!T&&c.jsx(ti,{hasNextPage:_,loadNextPage:ee,icon:{icon:"arrow-down",position:"right"},messages:{button:p.formatMessage({id:"loadMore_button"}),error:p.formatMessage({id:"loadMore_error"})}}),C.length===0&&!T&&c.jsx(Ft,{className:"no-activities",variant:"muted",icon:"text--input",children:v[0].type==="category"?c.jsx("p",{children:p.formatMessage({id:"activitiesFeed_noActivities_inCategories"})}):c.jsxs(c.Fragment,{children:[c.jsx("p",{children:p.formatMessage({id:"activitiesFeed_noActivities"})}),c.jsx("p",{children:c.jsx(ke,{variant:"secondary",size:"small",href:"/communities",children:p.formatMessage({id:"activitiesFeed_noActivities_button"})})})]})}),c.jsx(cu,{form:m})]})},nv={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 rv({parentId:e,isMember:t,formFunctions:n,leave:r,join:i}){const a=re.useIntl();return c.jsx(lu,{form:{content:{type:_e.Reply,slugs:{}},functions:n,meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:a.formatMessage({id:"discussion_responses_placeholder"})},parentId:e,membershipRequiredToPost:{isMember:t,required:!0,join:i,leave:r,notMemberStateText:a.formatMessage({id:"community_joinToPost"})}})}function iv({hasNextPage:e,fetchNextPage:t,setFocusReplyIndex:n,totalReplies:r}){const i=re.useIntl(),a=()=>{n(r),t()};return c.jsx(ti,{hasNextPage:e,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},messages:{button:i.formatMessage({id:"loadMore_button"}),error:i.formatMessage({id:"loadMore_error"})}})}function av({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=ze.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Zu({reply:Sg(o),user:a});return lr(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:a});r.setQueryData(i,lr(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{ko(d.id,"reply")},0)}});return s}function sv({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=ze.useMutation({mutationFn:e,onMutate:({replyId:i,content:a})=>t(s=>{const o=Dt(i,s);return o&&(o.data.content=a),s}),onError:n});return r}function ov({replies:e,user:t}){return!e||!(t!=null&&t.id)?[]:e.map(({id:n,own_children:r,latest_children:i,children_counts:a,data:s,created_at:o,parent:l,...u})=>{var f,b,g,x;const d=(((f=r==null?void 0:r.like)==null?void 0:f.length)||0)>0,m=(((b=i==null?void 0:i.like)==null?void 0:b.length)||0)>0,h=d?(g=r==null?void 0:r.like)==null?void 0:g.find(C=>{var F;return((F=C==null?void 0:C.user)==null?void 0:F.id)===(t==null?void 0:t.id)}):!1,p=typeof h=="object"?(h==null?void 0:h.id)??"":"",v=m?(x=i==null?void 0:i.like)==null?void 0:x.map(C=>{var F,D,_;return{id:(F=C==null?void 0:C.user)==null?void 0:F.id,name:(_=(D=C==null?void 0:C.user)==null?void 0:D.data)==null?void 0:_.name}}):!1;return{user:u==null?void 0:u.user,body:lv(s),createdAt:o,data:uv(s),likeId:p,liked:m,likes:(a==null?void 0:a.like)||0,peopleWhoLiked:v,replyId:n,parent:l,userLiked:!!h}})}function uv(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 lv(e){var t;return e?typeof e.content=="string"?e.content:((t=e==null?void 0:e.content)==null?void 0:t.text)||"":""}function df({queryFns:{create:e,edit:t,like:n,list:r,remove:i,unlike:a},queryKey:s}){const o=ze.useQueryClient(),l=da(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Co(u),mutate:Do(u)},user:l,...u},m=av({...d,mutationFn:e}),h=sv({...d,mutationFn:t}),p=cv({...d,mutationFn:n}),v=fv({...d,mutationFn:i}),f=mv({...d,mutationFn:a}),{replies:b,...g}=dv({queryKey:s,queryFn:r});return{replies:ov({replies:b,user:l}),mutations:{create:m,edit:h,remove:v,like:p,unlike:f},user:l,...g}}function cv({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=ze.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Dt(s,o);return l&&Yu({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Dt(o,l);u&&Yu({reply:u,reaction:s}),r.setQueryData(i,l)}});return a}function dv({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}=ze.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{replies:_o(n),error:r,isLoading:i,hasNextPage:a,fetchNextPage:s}}function fv({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=ze.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(a=>uf(i,a)),onError:n});return r}function mv({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=ze.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(s=>{const o=Dt(a,s);return o&&jg({reply:o,user:r}),s}),onError:n});return i}const hv=({activityId:e,basePath:t,isMember:n,parentId:r,replyId:i,functions:{reactions:a,form:s,likes:o}})=>{const l=re.useIntl(),u=3,{replies:d,fetchNextPage:m,hasNextPage:h,isLoading:p,mutations:{create:v,edit:f,like:b,remove:g,unlike:x}}=df({queryKey:[t,r,e,i,"replies"],queryFns:{...a,list:D=>a.list({...D,reactionId:i})}});oo([p]);const[C,F]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(d==null?void 0:d.length)>=u&&c.jsx(ke,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${C?"up_left":"down_right"}`,position:"left"},onClick:()=>F(!C),children:l.formatMessage({id:`discussion_thread_${C?"hide":"show"}`},{count:d==null?void 0:d.length})}),C&&c.jsx(fh,{loadMore:{isLoading:p,hasNextPage:h,loadNextPage:()=>m()},form:{parentId:r,content:{type:_e.Reply,slugs:{question:`${t}/${r}`,answer:e,reply:i}},functions:{create:(D,{body:_})=>v({activityId:e,replyId:i,content:_}),...s},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:d&&d.length>0?d==null?void 0:d.map(({replyId:D,likes:_,data:T,body:R,createdAt:O,userLiked:z,peopleWhoLiked:$,parent:A,user:B,likeId:j})=>c.jsx(ii,{isCommunity:!0,content:{id:D,type:_e.Reply,body:R,canLike:n,createdAt:O,slugs:{question:`${t}/${r}`,answer:e,reply:A},slug:"",author:br(B),userLiked:z,likes:_,peopleWhoLiked:$,data:T},functions:{content:{createContent:()=>null,deleteContent:()=>g({replyId:D}),updateContent:(M,{body:U})=>f({replyId:D,content:U})},likes:{createLike:()=>b({replyId:D}),deleteLike:()=>x({replyId:D,reactionId:j}),listLikes:M=>o.list({replyId:D,...M})},comments:{},form:s},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:r||""},{scope:dt.Platform,area:"all"}]},basePath:t,parentId:r},D)):null})]})};function pv({formFns:e,activityId:t,basePath:n,focus:r,isMember:i,parentId:a,reply:s}){const{body:o,data:l,likeId:u,liked:d,likes:m,peopleWhoLiked:h,replyId:p,createdAt:v,user:f}=s,{edit:b,like:g,remove:x,unlike:C}=e.mutations;return c.jsx(uh,{children:c.jsx(ii,{isCommunity:!0,content:{id:p,type:_e.Reply,body:o,canLike:i,createdAt:v,slugs:{question:`${n}/${a}`,answer:t,reply:p},slug:p,author:br(f),userLiked:d,likes:m,peopleWhoLiked:h,data:l},functions:{content:{createContent:()=>null,deleteContent:()=>x({replyId:p}),updateContent:(F,{body:D})=>b({replyId:p,content:D})},likes:{createLike:()=>g({replyId:p}),deleteLike:()=>C({replyId:p,reactionId:u}),listLikes:F=>e.likes.list({replyId:p,...F})},comments:{},form:e.form},badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:a||""},{scope:dt.Platform,area:"all"}]},children:c.jsx(hv,{basePath:n,parentId:a,activityId:t,replyId:p,isMember:i,functions:e}),styling:{showShareLinkButton:!0},setFocus:r,basePath:n,parentId:a},p)},p)}const ff=({activityId:e,basePath:t,parentId:n,activityTotalReplies:r,isMember:i,functions:{form:a,join:s,leave:o,likes:l,reactions:u},profile:d,showReplies:m})=>{const{fetchNextPage:h,hasNextPage:p,isLoading:v,replies:f,mutations:{create:b,remove:g,edit:x,like:C,unlike:F}}=df({queryKey:[t,n,e,"replies"],queryFns:u}),[D,_]=y.useState(null);oo([v]),lf();const T={create:(R,O)=>{const{body:z}=O;b({activityId:e,content:z})},...a};return c.jsxs("section",{className:"replies-feed",children:[c.jsx(dh,{type:"comment",responses:r,isLoading:v}),m?c.jsxs(c.Fragment,{children:[c.jsx(rv,{parentId:n,isMember:i,join:s,leave:o,formFunctions:T}),f==null?void 0:f.map((R,O)=>c.jsx(pv,{activityId:e,basePath:t,focus:D===O,formFns:{form:a,likes:l,reactions:u,mutations:{remove:g,edit:x,like:C,unlike:F}},isMember:i,parentId:n,reply:R},R.replyId)),v?c.jsx(c.Fragment,{children:" "}):c.jsx(iv,{hasNextPage:p,fetchNextPage:h,setFocusReplyIndex:_,totalReplies:f.length})]}):c.jsx(Ft,{children:c.jsx(re.FormattedMessage,{id:"replies_feed_missing_polls_vote_message"})}),c.jsx(cu,{form:d})]})};function gv({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}=ze.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:d=>(d==null?void 0:d.next)||null}),l=_o(n),u=`${l.length||0}${a?"+":""}`;return{likes:l,likesCount:u,error:r,isLoading:i,hasNextPage:a,fetchNextPage:s,refetch:o}}function vv({queryFns:{list:e},queryKey:t}){const{likes:n,...r}=gv({queryKey:t,queryFn:e});return{likes:n,...r}}function mf({basePath:e,parentId:t,activityId:n,likeCount:r,functions:i}){const{likes:a,fetchNextPage:s,hasNextPage:o,refetch:l}=vv({queryKey:[e,t,n,"likes"],queryFns:i.likes});y.useEffect(()=>{l()},[l]);const u=a.map(({user:d})=>d).map(d=>d?br(d):void 0).filter(d=>d&&typeof d!="string");return c.jsx("section",{className:"likes-feed",children:c.jsx(oh,{members:{data:u,total:r},showHeader:!1,showPlaceholders:!0,communitySlug:t,hasNextPage:o&&u.length<r,loadNextPage:s})})}const hf=({showModal:e=!0,functions:{onClose:t,likes:n},likeCount:r,className:i,...a})=>{const s=re.useIntl();return c.jsx(un,{id:"likes-modal",title:s.formatMessage({id:"discussion_likes"},{number:r}),isOpen:e,functions:{onClose:t},className:V("profile-modal in-portal",i,{open:e}),maxWidth:600,children:c.jsx(mf,{...a,likeCount:r??0,functions:{likes:n}})})},bv=Object.freeze(Object.defineProperty({__proto__:null,default:hf},Symbol.toStringTag,{value:"Module"})),yv={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 xv=3e3,pf=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=re.useIntl(),r="discussion_share_copy_link",[i,a]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{className:"share-link-wrapper",children:[c.jsx(Wr,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>a({...i,isOpen:!0}),onFocus:()=>a({...i,isOpen:!0}),onMouseOut:()=>a({isOpen:!1,isCopied:!1}),onBlur:()=>a({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{a({isOpen:!0,isCopied:!0});const s=new CustomEvent("ariaLive",{detail:{message:n.formatMessage({id:`${r}_success`})}});document.dispatchEvent(s),setTimeout(()=>{a({isOpen:!1,isCopied:!1})},xv)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event,"data-testid":"share-link",screenreaderText:n.formatMessage({id:r})}),c.jsx($n,{className:V({copied:i.isCopied}),isOpen:i.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.formatMessage({id:`${r}${i.isCopied?"_success":""}`})})]})};const Wn="discussion_",gf=({className:e,gtmContext:t,contentType:n,likes:r,comments:i,replies:a,shareLink:s,moreMenu:o})=>{const l=re.useIntl(),u=[];return o&&o.reportData&&u.push({text:l.formatMessage({id:`${Wn}moreMenu_report`}),onClick:d=>{d.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(l.formatMessage({id:`${Wn}report_subject`}))}&body=${encodeURI(l.formatMessage({id:`${Wn}report_body`},{contentType:n||"",contentSlug:o&&o.reportData&&o.contentSlug||"",contentUrl:o&&o.reportData&&o.reportData.contentUrl||""}))}`,icon:"flag"}),c.jsxs("ul",{className:V("actions text-medium",e),"data-testid":`${n}-actions`,children:[r?c.jsx(cf,{element:"li",likes:r.count,isShort:!1,userLiked:r.userLiked,content:{type:n,slugs:r.content.slugs,slug:r.content.slug},canLike:r.canLike,peopleWhoLiked:r.peopleWhoLiked,activityId:r.activityId,functions:r.functions,basePath:r.basePath||"",parentId:r.parentId||""}):c.jsx(c.Fragment,{}),i?c.jsx("li",{children:c.jsx(Wr,{onClick:d=>{d.preventDefault(),d.stopPropagation(),i.functions.onClick()},icon:{icon:"speech-bubble_square"},"data-testid":"comment","data-gtm-event-context":t,"data-gtm-event-type":`answer-${n}-click`,screenreaderText:l.formatMessage({id:`${Wn}comments_screenReader`},{count:i.count}),children:l.formatMessage({id:`${Wn}comments${i.count===null?"_loading":""}`},{count:i.count})})}):c.jsx(c.Fragment,{}),a?c.jsx("li",{children:c.jsx(Wr,{styling:{muted:!0},onClick:a.functions.onClick,icon:{icon:"speech-bubble_square"},"data-testid":"reply",children:l.formatMessage({id:`${Wn}reply`})})}):c.jsx(c.Fragment,{}),s?c.jsx(pf,{url:s.url,gtm:{context:t||"",event:`copy-link-${n}-click`}}):c.jsx(c.Fragment,{}),o?c.jsx(bf,{element:"li",id:`more-${o.contentSlug}`,options:[...o.options||[],...u]}):c.jsx(c.Fragment,{})]})};const wv=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=re.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Ie,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:V("breadcrumbs text-small",n),children:e.map(({text:i,href:a,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),c.jsxs("li",{children:[s&&c.jsx(Ie,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(yn,{href:s?void 0:a,...l,children:ar(i,t)})]},`${window.btoa(i)}_${o}`)})})]})};const To=({variant:e="default",data:{image:t,url:n,title:r,description:i},onClick:a,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(),a){a(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})}),i&&e!=="condensed"?c.jsx("p",{className:"text-small",children:i}):c.jsx(c.Fragment,{}),t&&t.src?c.jsx("p",{className:"img",children:c.jsx("img",{src:t.src,alt:t.alt||"",loading:"lazy",fetchpriority:"low",width:t.width||"auto",height:t.height||"100%"})}):c.jsx(c.Fragment,{})]})};const vf=({options:e,defaultOptions:t=[],allOption:n=!1,allowMultiple:r=!0,onChange:i=()=>{},preventNoOptionSelected:a=!1,className:s=""})=>{const o=re.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(v=>v.id):[]),[m,h]=y.useState(0),p=(v,f)=>{let b=[];u.includes(v)&&!a?b=u.filter(g=>g!==v):v==="all"?b=["all"]:r?b=[...u.filter(g=>g!=="all"),v]:b=[v],d(g=>(i&&typeof i=="function"&&i({current:b,previous:g}),b)),f&&typeof f=="function"&&f()};return c.jsx("ul",{className:V("filters",s),children:l.map(({id:v,text:f,disabled:b=!1,callback:g=()=>{}},x)=>{let C={tabIndex:m===x?0:-1};return b&&(C={disabled:!0,"aria-label":o.formatMessage({id:"filters_disabled"},{name:f})}),c.jsx("li",{children:c.jsx("button",{className:V(v,{selected:u.includes(v)}),onClick:F=>{F.preventDefault(),F.stopPropagation(),p(v,g)},onKeyDown:F=>{var R,O;let D=x+1,_,T;switch(F.code){case"Enter":case"Space":F.preventDefault(),F.stopPropagation(),p(v,g);break;case"ArrowLeft":case"ArrowRight":F.preventDefault(),F.stopPropagation(),F.code==="ArrowLeft"?(D=x-1,D<0&&(D=l.length-1)):D>=l.length&&(D=0),h(D),_=F.currentTarget.closest("li"),T=(R=_==null?void 0:_.parentElement)==null?void 0:R.children[D],(O=T==null?void 0:T.querySelector("button"))==null||O.focus();break}},"aria-selected":u.includes(v),...C,children:f})},v)})})},Cv=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let i="",a=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(i+=`/${s}`,a=!0):(i.includes(`/${r}/`)||(i+=`/${r}`),i+=`/${s}`)}),i.includes(`/${r}/`)||(i+=`/${r}`),t&&(i+=`/${t}`),a?{url:i,urlForRouter:`/${i.split("/").slice(2).join("/")}`}:i};const fi="languageSwitcher_",Dv=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:i,urlParts:a,variant:s="default",label:o,className:l=""})=>{const u=re.useIntl(),{updateLanguage:d=()=>{}}=y.useContext(mo),[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 v=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:`${fi}label`})}),c.jsx("ul",{children:v.map(b=>{var C;if(!Si[b])return null;const g=(C=r[b])==null?void 0:C.post_name;let x={className:b};if(m===b)x["aria-label"]=u.formatMessage({id:`${fi}selected`},{language:Si[b]});else{const F=Cv(b,g,a);x={...x,href:typeof F=="string"?F:F.url,onClick:D=>{h(b),d(b),typeof i<"u"&&(D.preventDefault(),D.stopPropagation(),i(b,typeof F=="string"?F:F.urlForRouter))}}}return c.jsx("li",{children:c.jsx(yn,{...x,fallbackElement:"span",children:Si[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${fi}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${fi}disclaimer`},{email:Gn.support,link:b=>{const g=`mailto:${b}`;return c.jsx("a",{href:g,children:b})}})})]})};const za=re.createIntl({locale:"en",messages:hr}),ti=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:i="medium",styling:a={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:za.formatMessage({id:"loadMore_button"}),endOfFeed:za.formatMessage({id:"loadMore_endOfFeed"}),error:za.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,m]=y.useState(""),h=async p=>{if(!n)try{await t(p)}catch(v){v instanceof Error?m(v.message):m("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:V("load-more",l),children:!d&&e?c.jsx(ke,{variant:r,size:i,styling:a,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 So=({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(Ie,{children:c.jsx(re.FormattedMessage,{id:"apolitical"})})})});let mi=!1;const bf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const i=re.useIntl(),a=y.useRef(null),[s,o]=y.useState(!1),l=u=>{a.current&&u.target instanceof HTMLElement&&!a.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:a,className:V("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(ke,{variant:"tertiary",size:"medium","data-testid":"more-menu",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:i.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:d,text:m,icon:h,...p},v)=>{const f={...p,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{mi&&(clearTimeout(mi),mi=!1)},onBlur:()=>{mi=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(ke,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...f,children:m})},`${window.btoa(m)}_${v}`)})})]})})},Ev=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const _v=y.lazy(()=>Promise.resolve().then(()=>Dp)),kv=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],yf=({activeLink:e,profile:t})=>{const n=re.useIntl(),r=y.useContext(at),i=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[kv.map(({key:a,href:s})=>{const o=Ev(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:V(a,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),i&&t&&c.jsx(_v,{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"})]})},kr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Fv=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${kr(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(`${kr(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(`${kr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
65
65
 
66
- ${Dr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:Dr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,i)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(i))}];const Ev="shareLinks_",_v=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:i="large",variant:a="default",className:s=""})=>{const o=re.useIntl(),l=Dv({title:e,link:t,referrer:n});return c.jsxs("aside",{className:V("share-links",i,a,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:h,shouldRender:p=!0,onClick:m})=>{if(typeof p=="function"&&!p())return null;const v={};return m&&(v.onClick=f=>m(f,h)),c.jsx("li",{children:c.jsx(ke,{size:i,variant:"tertiary",icon:{icon:d||u},href:h,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:`${Ev}link_${u}`}),...v})},u)})})]})};const kv=({tabs:e,className:t="",preventLocationChange:n})=>{var v;const r=(f,b,g)=>(f||(f=`panel-${window.btoa(b)}-${g}`),f),i=In(!0)||0;let a=e.findIndex(f=>f.current===!0);if(a<0&&(a=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(g=>g.id===f)){for(let g=0;g<e.length;g++)if(r(e[g].id,e[g].text,g)===f){a=g;break}}}const[s,o]=y.useState((v=e[a])!=null&&v.id?e[a].id:r(e[a].id,e[a].text,a)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let g=b;f.key==="ArrowLeft"?b>0?g=b-1:g=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?g=b+1:g=0);const D=r(e[g].id,e[g].text,g),w=document.getElementById(`tab-${D}`);w==null||w.focus(),u(D);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},h=f=>{let b=!1;return f.target==="min-width"&&i>=f.value&&(b=!0),f.target==="max-width"&&i<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[a].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const p=[],m=[];return e.forEach(({id:f,text:b,content:g,href:D,hasCarousel:w,breakpoint:F},E)=>{if(F&&!h(F))return;f=r(f,b,E);const k=s===f,T={};D||(T["aria-controls"]=f,T.onClick=R=>{R.preventDefault(),R.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},m.push(c.jsx("section",{id:f,hidden:!k,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":k?"assertive":"off",children:typeof g=="string"?c.jsx("p",{children:g}):g},`section-${f}`))),p.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:D||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:V({selected:k}),role:"tab",tabIndex:k?0:-1,"aria-selected":k,onKeyDown:R=>d(R,E),...T,children:b})},`tab-${f}`))}),c.jsxs("div",{className:V("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:p}),c.jsx("div",{className:"tab-content",children:m})]})};const Fv={"2-1":901,"1-3":769,"1-1":769},ff=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:i})=>{const a=In(!0);let s=i;return y.Children.count(i)===1&&(s=y.Children.toArray(i)[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&&a&&a<Fv[e]?null:o)})};const Bo=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const i=re.useIntl(),a="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?"":i.formatMessage({id:`${a}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?i.formatMessage({id:`${a}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:i.formatMessage({id:a})}),n," / ",t]})}),c.jsx(Pe,{showOnFocus:!1,id:`${e}-info`,children:i.formatMessage({id:`${a}_info`},{limit:t})})]})},ma=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=>{ma(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t.onChange(r)}}),n};const fi="emailHelperTextBox_",mf=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:i})=>{const a=re.useIntl(),[s,o]=y.useState({path:`${fi}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(v=>{v.preventDefault(),v.stopPropagation();const f=b=>{o({path:`${fi}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:g=>d(g),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof i!="function"){f(a.formatMessage({id:`${fi}error_noFunction`}));return}u(!0),i(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,i]);y.useEffect(()=>{let v=fi,f="default",b={},g={};switch(t){case"gov":v+="autoApproved",f="success";break;case"nonGov":v+="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":v+="pendingApproval",f="error",g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":v+="emailUnverified",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:D=>d(D),"data-testid":"send-verify-email-click"};break;case"exists":v+="emailAlreadyExists",f="error",b={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:v+="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:v,type:f,link:b,mail:g})},[t]);const h={};return["link","mail"].forEach(v=>{h[v]=Object.keys(s[v]).length?f=>c.jsx("a",{...s[v],children:f}):f=>f}),c.jsx(xd,{id:e,type:s.type,heading:l?!1:a.formatMessage({id:`${s.path}_title`}),"aria-live":"assertive",children:l?c.jsxs(c.Fragment,{children:[c.jsx(It,{element:"span"}),c.jsx(It,{element:"span"})]}):a.formatMessage({id:`${s.path}_text`},{...h,strong:v=>c.jsx("strong",{children:v}),em:v=>c.jsx("em",{children:v}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Gn=({className:e="",element:t="input",id:n,inputRef:r,functions:i={onChange:()=>{}},name:a=n,placeholder:s,type:o="text",value:l,autoFocus:u,label:d,...h})=>{const p=y.useRef(),m=r||p;return y.useEffect(()=>{var v;u&&((v=m.current)==null||v.focus())},[]),!(h!=null&&h.autoComplete)&&["email"].includes(o)&&(h.autoComplete="email"),y.createElement(t,{ref:m,...h,type:o,id:n,name:a,className:V(e,t,{"has-scrollbar":o==="textarea"&&m.current&&m.current.clientHeight<m.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...i,onChange:v=>{const f=v.target;i.onChange(f.value)}})};const Wn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Av=500,Bv=({id:e,name:t=e,value:n,placeholder:r,functions:i={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...a})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=i,[{input:l,displayInput:u,debouncedInput:d},h]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:m,isPredictionSelected:v},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=re.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const F=setTimeout(()=>{v||h(E=>({...E,debouncedInput:l}))},Av);return()=>{clearTimeout(F)}},[l,v]),y.useEffect(()=>{d&&!v?(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(F=>({...F,predictions:[]}))},[d,v]),y.useEffect(()=>{m>=0&&p[m]&&h(F=>({...F,displayInput:p[m].description}))},[m,p]);const g=F=>{[Wn.DOWN,Wn.UP,Wn.ENTER].includes(F.key)&&(F.preventDefault(),F.key===Wn.DOWN&&m<p.length-1?f(E=>({...E,activePredictionIndex:m+1})):F.key===Wn.UP&&m>0?f(E=>({...E,activePredictionIndex:m-1})):F.key===Wn.ENTER&&m>-1&&(s(p[m].description),h(E=>({...E,input:p[m].description})),f(E=>({...E,predictions:[],isPredictionSelected:!0}))))},D=F=>{s(F.target.value),h(E=>({...E,input:F.target.value,displayInput:F.target.value})),f(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},w=F=>{s(F.description),h(E=>({...E,input:F.description,displayInput:F.description})),f(E=>({...E,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:D,onKeyDown:g,placeholder:r,name:t,id:e,...a}),c.jsx("ul",{className:"predictions-list",children:p.map((F,E)=>c.jsx("li",{onClick:()=>w(F),onMouseEnter:()=>f(k=>({...k,activePredictionIndex:E})),className:V("predictions-list-item",{active:E===m}),children:F.description},E))})]})};const pf=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:i,inputRef:a,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:d,accessibilityOptions:{checkboxes:{navigateWithArrowKeys:h=!1}={}}={},...p})=>{const m=re.useIntl(),{onChange:v,...f}=r,b=()=>{t||v(d?null:l)},g=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:a,id:i,name:i,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:i,onKeyDown:D=>{(D.key==="Enter"||D.code==="Space")&&(D.preventDefault(),D.stopPropagation(),b())},tabIndex:d||!h?0:-1,children:o||m.formatMessage({id:s?`${s}_${i}`:i})})]});return y.createElement(n,{onClick:D=>{const w=D.target;w.nodeName.toLowerCase()==="a"||w.parentNode&&w.parentNode.nodeName.toLowerCase()==="a"||(D.preventDefault(),D.stopPropagation(),b())},onKeyDown:h?D=>{var w,F,E;if(D.key!=="Tab")switch(D.code){case"Enter":case"Space":D.stopPropagation(),D.preventDefault(),b();break;case"ArrowLeft":case"ArrowRight":D.stopPropagation(),D.preventDefault();const k=D.currentTarget;let T=k==null?void 0:k.nextElementSibling;if(D.key==="ArrowLeft"){const R=k==null?void 0:k.previousElementSibling;R?T=R:T=(w=k==null?void 0:k.parentElement)==null?void 0:w.lastElementChild}else T||(T=(F=k==null?void 0:k.parentElement)==null?void 0:F.firstElementChild);T&&((E=T==null?void 0:T.querySelector("label"))==null||E.focus());break}}:void 0,className:V(i,"checkbox-wrapper",e,{"is-checked":d}),...p,...f},g)};const Tv=y.memo(function({direction:t="down"}){return c.jsx(oa,{className:V("rotating-chevron",`direction-${t}`)})});const Sv=({className:e,options:t,initialValue:n,value:r,functions:i={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:a}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const d=re.useIntl(),[h,p]=y.useState(!1),m=r||n,v=Array.isArray(m)?[...m]:m?[m]:[],[f,b]=y.useState(v);let g;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?g=t&&f?t.find(T=>T.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?g=f[0]:g={id:"",label:""},y.useEffect(()=>{b(v)},[r,n]);const{onChange:D,onMultiSelectSubmit:w,...F}=i,E=T=>{if(o){let R=[];f!=null&&f.includes(T.id)?R=f.filter(P=>P!==T.id):R=[...f,T.id],b([...R]),D&&D([...R])}else b([T]),D&&D(T.id),p(!1)},k=T=>{if(T==="all"){const R=(t==null?void 0:t.map(P=>P.id))||[];b(R),D&&D(R)}else b([]),D&&D([])};return c.jsxs("div",{className:V("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":h,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:T=>{T.preventDefault(),T.stopPropagation(),p(!h)},"data-testid":"dropdown-selector",...F,children:[o?`${s} · ${f.length}`:g.label,c.jsx(Tv,{direction:h?"up":"down"})]}),c.jsx("select",{defaultValue:g.id,onChange:T=>{T.preventDefault(),T.stopPropagation();const R=t&&t.find(P=>P.id===T.target.value);E(R)},hidden:!h,...F,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":a,children:T.label},T.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!h,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(ke,{variant:"tertiary",size:"small",onClick:()=>k("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":a,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(ke,{variant:"tertiary",size:"small",onClick:()=>k("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":a,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(T=>{const R=T.id===g.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:R,"selected-single":R&&!o}),"data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":a,onClick:P=>{P.preventDefault(),P.stopPropagation(),E(T)},role:"menuitem","aria-current":R,"data-testid":R?"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(ke,{variant:"secondary",onClick:()=>{w&&w(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),p(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})},Br=(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};const jv=({id:e,label:t,limit:n,value:r,placeholder:i,functions:a,error:s,multipleInputs:o,validation:l,fieldData:u,type:d,...h})=>{const p=re.useIntl(),[m,v]=y.useState(r?Array.isArray(r)?r:[r]:[""]),f=m.filter(k=>k!=="");y.useEffect(()=>{if(!u)return;const k=Pt(u.fields).filter(({id:R,name:P})=>(R||(R=P||""),R!==e&&!R.includes(`${e}-`))),T=[];m.map((R,P)=>{if(D&&P>=D)return;const z=Pt(l);z&&e&&(z.forEach($=>{const{condition:B,error:A}=$;if(typeof B=="function")$.condition=j=>{var W;let M=(W=j==null?void 0:j[e])==null?void 0:W[P];M||(j[e]&&!Array.isArray(j[e])?M=j[e]:M="");const U=Pt(j);return U[e]=M,typeof B=="function"&&B(U)?A:!1};else{const j=B;$.condition=M=>{var W;let U=(W=M==null?void 0:M[e])==null?void 0:W[P];switch(U||(M[e]&&!Array.isArray(M[e])?U=M[e]:U=""),j){case"required":A||($.error=p==null?void 0:p.formatMessage({id:"form_error_required"}));break;case"no-numbers":A||($.error=p==null?void 0:p.formatMessage({id:"form_error_numbers"}));break;case"valid-email":A||($.error=A||(p==null?void 0:p.formatMessage({id:"form_error_email"})));break;case"valid-url":A||($.error=p==null?void 0:p.formatMessage({id:"form_error_url"}));break;default:console.warn("WARNING! No field validation condition has been set")}return Br(j,U)?$.error:!1}}}),T.push({id:`${e}-${P}`,validation:z,value:R}))}),u.setFields(k.concat(T))},[m.length]);const{showCount:b=!1,label:g,maxInputs:D=100,hasButton:w=!1}=o||{},F=()=>{(!D||m.length<D)&&v([...m,""])},E=(k,T)=>k.replace("{number}",T+1);return c.jsxs("fieldset",{className:V("multiple-inputs field-wrapper",{"has-button":w,"has-legend":t}),children:[t?c.jsxs("legend",{className:"legend-as-label",children:[t,b?c.jsxs(c.Fragment,{children:[" ",c.jsx("small",{className:"filled-in-count","aria-label":p.formatMessage({id:"form_multipleInputs_filledInCount_aria"},{number:f.length,total:D}),children:p.formatMessage({id:"form_multipleInputs_filledInCount"},{number:f.length,total:D})})]}):""]}):c.jsx(c.Fragment,{}),m.map((k,T)=>{if(D&&T>=D)return c.jsx(c.Fragment,{});let R=!1;t?R=c.jsx(Pe,{showOnFocus:!1,children:p.formatMessage({id:"form_multipleInputs_label"},{number:T+1})}):g&&(R=E(g,T));const P=`${e}-${T}`;return c.jsx(gf,{id:P,type:"text",label:R,value:k,placeholder:i?E(i,T):void 0,limit:n,error:s&&typeof s!="string"?s==null?void 0:s[P]:void 0,functions:{...a,onFocus:()=>{w||T!==m.length-1||F()},onChange:z=>{const $=Pt(m);$[T]=z,v($),u==null||u.dispatch({type:"removeError",payload:{key:P}}),a==null||a.onChange($)}},siblings:T===0?void 0:c.jsx(ke,{variant:"tertiary",size:"small",icon:"close",screenreaderText:p.formatMessage({id:"form_multipleInputs_remove"}),onClick:()=>{const z=Pt(m);z.splice(T,1),v(z),u==null||u.dispatch({type:"removeError",payload:{key:P}}),a==null||a.onChange(z)}}),...h},P)}),w?c.jsx(ke,{...w,onClick:F,disabled:!!(D&&D<=m.length)}):c.jsx(c.Fragment,{})]})};const Hu=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:i,multiSelect:a=!1,name:s,options:o,required:l,type:u="checkboxes",value:d,accessibilityOptions:h,styling:{displayOptionsAsPills:p=!1}={},...m})=>{const v=re.useIntl(),f=a?d:[],b=d;return c.jsx("ul",{...m,className:V("options-wrapper",e,{"with-pills filters":p}),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:g,label:D=!1,value:w=g,disabled:F=!1})=>{const E=`${r}_${g}`,k=()=>{if(F)return;let T;if(a){const R=f==null?void 0:f.indexOf(w);Array.isArray(f)&&R>=0?(T=f,T.splice(R,1)):(!f||f.length===0?T=[]:T=f,T.push(w))}else T=b===w?void 0:w;t.onChange(T)};return c.jsx(pf,{element:"li",id:E,type:u==="checkboxes"?"checkbox":"radio",shownValue:w,value:a?f==null?void 0:f.includes(w):b===w,functions:{...t,onChange:k},intlPath:n,label:D||v.formatMessage({id:n?`${n}_${g}`:g}),disabled:F,accessibilityOptions:h},E)})})};const Ov=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...i})=>{const a=re.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,h]=y.useState(t),p=()=>{var m;u(!l),h(l?"password":"text"),(m=o.current)==null||m.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:p,"aria-label":a.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Gn,{inputRef:o,type:d,autoComplete:r,...i})]})};const Vn={text:{component:Gn},email:{component:Gn},url:{component:Gn},textarea:{component:Gn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:pf},checkboxes:{component:Hu,props:{multiSelect:!0}},radio:{component:Hu,props:{multiSelect:!1}},select:{component:Sv},password:{component:Ov},autocomplete:{component:Bv},"multiple-inputs":{component:c.jsx(c.Fragment,{})}},gf=e=>{const t=re.useIntl(),{id:n,intlPath:r=!1,className:i="",error:a,functions:s={onChange:()=>{}},limit:o=0,showRequiredLabels:l=!0,type:u,validation:d,value:h,submitOnEnter:p,fieldData:m,siblings:v,...f}=e;if(u&&u==="multiple-inputs")return c.jsx(jv,{...e});const b=d&&d.some(({condition:j})=>j==="required"),g=ma(h),D=u&&Vn[u]&&Vn[u].component?Vn[u].component:Gn,w=u&&["checkboxes","radio"].includes(u),F=u&&["autocomplete"].includes(u),E=a&&`error-${n}`,k=`character-limit-${n}`,T={};w?T.element="legend":T.htmlFor=n;let R={...f,id:n,name:n,className:a?"error":"",type:u,required:b,"aria-required":b,functions:Pt(s),value:h};const P=j=>{R["aria-describedby"]?R["aria-describedby"]+=` ${j}`:R["aria-describedby"]=j};if(o>0){const j=hf(o,s);P(`${k}-info`),R={...R,...j},j.functions&&typeof j.functions=="object"&&(R.functions={...R.functions,...j.functions})}u&&Vn[u]&&Vn[u].props&&(R={...R,...Vn[u].props}),w&&(R.intlPath=`${r}_${n}`),a&&(R["aria-invalid"]=!0,R["aria-errormessage"]=E,P(E));const z=f.label||t.formatMessage({id:r?`${r}_${n}`:n}),$=({...j})=>a?y.createElement(j.as||"p",{id:E,className:"error text-small",...j},a):null;if(u&&["checkbox"].includes(u))return c.jsxs(c.Fragment,{children:[c.jsx(D,{...R,label:z,className:V("field-wrapper",i)}),c.jsx($,{as:"p"})]});const B={};w?T.className="legend-as-label text-small":B.className="field-label";const A=({element:j,...M})=>y.createElement(j||"label",{...M,"data-testid":`label-${n}`});return c.jsx(c.Fragment,{children:y.createElement(w?"fieldset":"div",{className:V("field-wrapper text-medium",i,`${u}-wrapper`,{"multiple-options-wrapper":w})},c.jsxs(c.Fragment,{children:[f.label===!1?c.jsx(c.Fragment,{}):y.createElement(w?y.Fragment:"p",B,c.jsxs(A,{...T,children:[z,b&&l&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",t.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(w||F?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(D,{...R}),c.jsx(Bo,{id:k,limit:o,valueLength:g}),v]})),c.jsx($,{})]}))})},Pv=(e,t)=>{const{type:n,payload:r}=t,i=e.errors?Pt(e.errors):{},a=e.values?Pt(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:i,[r==null?void 0:r.key]:r==null?void 0:r.value};a[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:i,values:a};case"addError":return r!=null&&r.key&&!i[r==null?void 0:r.key]&&(i[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:i};case"removeError":return r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],{...e,errors:i};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:d}=r,h=Pt(Object.keys(i));for(const p of s)if(p.validation)for(let m=0;m<p.validation.length;m++){const{condition:v="required",error:f=!1}=p.validation[m];let b=!1;if(typeof v=="function"){const g=v(a);g&&(b=f||g)}else{const g=a[p.id],D=v;switch(D){case"required":Br(D,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{Br(D,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{Br(D,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{Br(D,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:p.id,value:b}}),h.push(p.id);break}}return h.length===0?l(a):u(a,h),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let qa=null;const Jt=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:i,intlPath:a=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:h,...p})=>{const[m,v]=y.useState(t);y.useEffect(()=>{v(t)},[t.length]);const{customOnSubmit:f,hideButton:b,...g}=s,D=40,{shouldShowCancelButton:w=!1,shouldReset:F=!0,shouldHide:E=!0,showRequiredLabels:k=!0,showSuccessMessage:T=!1}=l||{},{onSuccess:R=async()=>{},onCancel:P=()=>{},onCatch:z=()=>{},onFailure:$=()=>{}}=h||{},B=re.useIntl(),A={};t.length&&t.forEach(S=>{const L=S.id||S.name;L&&(A[L]=S.value||"")});const[j,M]=y.useReducer(Pv,{isSubmitting:!1,formSubmitted:!1,errors:{},values:A}),{errors:U,isSubmitting:W,formSubmitted:ie,values:ae}=j;y.useEffect(()=>{F&&ie&&(qa=setTimeout(()=>{M({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[ie]),y.useEffect(()=>()=>{qa&&clearTimeout(qa)},[]),y.useEffect(()=>{const S=L=>{M({type:"updateValue",payload:{key:L.detail.id,value:L.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",S),()=>{document.removeEventListener("dropdownMultiSelectSubmit",S)}},[]);const C=y.useRef(null),G=i||C;if(!t.length)return null;const ne={};s.children&&(ne.default=s.children),g.text&&typeof g.text=="string"&&(ne.default=g.text),["default","submitting","submitted"].forEach(S=>{g.text&&typeof g.text!="string"&&S in g.text?ne[S]=g.text[S]:ne[S]||(ne[S]=B.formatMessage({id:`form_${S==="default"?"submit":S}`}))}),delete g.text;const _=()=>{if(!W){if(M({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&M({type:"submitForm",payload:{fields:m,dispatch:M,intl:B}});return}M({type:"submitForm",payload:{fields:m,dispatch:M,onSuccess:async S=>{try{await R(S),M({type:F?"formSubmittedAndReset":"formSubmitted"})}catch(L){z(L),M({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(S,L)=>{$(S,L),M({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:B}})}},O=S=>{var K;if(S.preventDefault(),S.stopPropagation(),W)return;let L=0;if((K=G==null?void 0:G.current)!=null&&K.id){const J=document.getElementById(G.current.id);J&&(L=J.getBoundingClientRect().top+window.scrollY)}const Q=document.getElementById("header");Q&&(L=L-Q.offsetHeight-D),L<0&&(L=0),window.scrollTo({top:L,behavior:"smooth"}),_()},q=[{...g,icon:ie?{icon:"tick",position:"left"}:!1,className:V("gtm-trackable",g.className),onClick:O,disabled:W||ie||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:ne[W?"submitting":ie?"submitted":"default"]}];return w&&q.unshift({...o,className:V("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:W||ie,onClick:P,children:o.text||B.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...p,id:r,className:V("form",n),ref:G},c.jsxs(c.Fragment,{children:[U!=null&&U.general?c.jsx(xn,{variant:"error",text:B.formatMessage({id:"form_error_generalError"})}):null,u,(!E||!W&&!ie||f)&&t.map((S,L)=>{const{id:Q=S.name||L,component:K,functions:J={onChange:()=>{}},submitOnEnter:ce=!1}=S;if(K)return c.jsx(K,{...S.props||{}},`component-${Q}-${L}`);const ee=(ae==null?void 0:ae[Q])||"",pe={...J,onChange:ve=>{M({type:"updateValue",payload:{key:Q,value:ve}}),J.onChange(ve,M)}};return ce&&(pe.onKeyDown=ve=>{ve.key==="Enter"&&(ve.stopPropagation(),ve.preventDefault(),_()),J.onKeyDown&&J.onKeyDown(ve)}),c.jsx(gf,{intlPath:a,...S,showRequiredLabels:k,value:ee,error:S.type==="multiple-inputs"?U:U==null?void 0:U[Q],functions:pe,fieldData:{fields:m,setFields:v,dispatch:M}},Q)}),b?null:(W||ie)&&f?f:c.jsx(hr,{className:V("cta",{center:W||ie,submitted:ie}),buttons:q})]})),T&&ie&&c.jsx(sr,{className:"success",children:typeof T=="string"?T:B.formatMessage({id:"form_success"})})]})};const hi="passwordRules_",vf="isMoreThanEightCharacters",bf="includesNumberAndSymbol",yf="includesLowerAndUppercase",Mv={[vf]:"8Characters",[bf]:"numberSymbol",[yf]:"lowercaseUppercase"},Nv=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=re.useIntl();return c.jsxs("aside",{className:V("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${hi}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:`${hi}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${hi}rule_${Mv[r]}`})}),!e[r]&&c.jsxs(Pe,{element:"strong",children:[" ",n.formatMessage({id:`${hi}notMet`})]})]},`rule-${r}`))})]})},xf=y.memo(Nv);const Iv=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:i=()=>{}},className:a="",hasLoaded:s=!1})=>{const o=re.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const g=await n();u(D=>({...D,setUp:!0,id:g&&g.id,disabled:!1}))}catch(g){u(D=>({...D,setUp:!0,disabled:!0})),i(g)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(It,{className:"rating-placeholder"});const{id:h,rating:p,disabled:m}=l,v="ratings_",f={text:o.formatMessage({id:`${v}text`}),low:o.formatMessage({id:`${v}low`}),high:o.formatMessage({id:`${v}high`}),success:o.formatMessage({id:`${v}success`}),...e},b=async g=>{if(!(!h||m))try{u(D=>({...D,rating:g,disabled:!0})),await r({id:h,value:g})}catch(D){u(w=>({...w,rating:null})),i(D)}finally{u(D=>({...D,disabled:!1}))}};return c.jsxs("div",{className:V("rating",a),children:[c.jsx("span",{className:"label",children:f[p?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(g=>{const D=g+1;return c.jsx("li",{className:V({selected:p&&D<=p}),children:c.jsx(ke,{variant:"tertiary",size:"small",icon:{icon:`star${!p||D>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${v}stars`},{number:D,total:t})}${D===1||D===t?` - ${f[D===1?"low":"high"]}`:""}`,onClick:w=>{w.preventDefault(),w.stopPropagation(),b(D)},disabled:m})},`rating-${D}`)})})]})},Rv={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)}},ln=y.createContext(Rv);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 $v=({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 i=r;return i!=null&&i.name&&i.name===$r?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(re.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(i==null?void 0:i.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})}},Lv=({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 zv=Wv,Cf="֑-߿יִ-﷽ﹰ-ﻼ",wf="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",qv=new RegExp("^[^"+wf+"]*["+Cf+"]"),Uv=new RegExp("^[^"+Cf+"]*["+wf+"]");function Wv(e){return e=String(e||""),qv.test(e)?"rtl":Uv.test(e)?"ltr":"neutral"}const Df=Nn(zv);function Vv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var To=Vv,Hv=typeof ii=="object"&&ii&&ii.Object===Object&&ii,Kv=Hv,Zv=Kv,Yv=typeof self=="object"&&self&&self.Object===Object&&self,Gv=Zv||Yv||Function("return this")(),Ef=Gv,Qv=Ef,Jv=function(){return Qv.Date.now()},Xv=Jv,eb=/\s/;function tb(e){for(var t=e.length;t--&&eb.test(e.charAt(t)););return t}var nb=tb,rb=nb,ib=/^\s+/;function ab(e){return e&&e.slice(0,rb(e)+1).replace(ib,"")}var sb=ab,ob=Ef,ub=ob.Symbol,_f=ub,Ku=_f,kf=Object.prototype,lb=kf.hasOwnProperty,cb=kf.toString,Er=Ku?Ku.toStringTag:void 0;function db(e){var t=lb.call(e,Er),n=e[Er];try{e[Er]=void 0;var r=!0}catch{}var i=cb.call(e);return r&&(t?e[Er]=n:delete e[Er]),i}var fb=db,hb=Object.prototype,mb=hb.toString;function pb(e){return mb.call(e)}var gb=pb,Zu=_f,vb=fb,bb=gb,yb="[object Null]",xb="[object Undefined]",Yu=Zu?Zu.toStringTag:void 0;function Cb(e){return e==null?e===void 0?xb:yb:Yu&&Yu in Object(e)?vb(e):bb(e)}var wb=Cb;function Db(e){return e!=null&&typeof e=="object"}var Eb=Db,_b=wb,kb=Eb,Fb="[object Symbol]";function Ab(e){return typeof e=="symbol"||kb(e)&&_b(e)==Fb}var Bb=Ab,Tb=sb,Gu=To,Sb=Bb,Qu=0/0,jb=/^[-+]0x[0-9a-f]+$/i,Ob=/^0b[01]+$/i,Pb=/^0o[0-7]+$/i,Mb=parseInt;function Nb(e){if(typeof e=="number")return e;if(Sb(e))return Qu;if(Gu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Gu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Tb(e);var n=Ob.test(e);return n||Pb.test(e)?Mb(e.slice(2),n?2:8):jb.test(e)?Qu:+e}var Ib=Nb,Rb=To,Ua=Xv,Ju=Ib,$b="Expected a function",Lb=Math.max,zb=Math.min;function qb(e,t,n){var r,i,a,s,o,l,u=0,d=!1,h=!1,p=!0;if(typeof e!="function")throw new TypeError($b);t=Ju(t)||0,Rb(n)&&(d=!!n.leading,h="maxWait"in n,a=h?Lb(Ju(n.maxWait)||0,t):a,p="trailing"in n?!!n.trailing:p);function m(k){var T=r,R=i;return r=i=void 0,u=k,s=e.apply(R,T),s}function v(k){return u=k,o=setTimeout(g,t),d?m(k):s}function f(k){var T=k-l,R=k-u,P=t-T;return h?zb(P,a-R):P}function b(k){var T=k-l,R=k-u;return l===void 0||T>=t||T<0||h&&R>=a}function g(){var k=Ua();if(b(k))return D(k);o=setTimeout(g,f(k))}function D(k){return o=void 0,p&&r?m(k):(r=i=void 0,s)}function w(){o!==void 0&&clearTimeout(o),u=0,r=l=i=o=void 0}function F(){return o===void 0?s:D(Ua())}function E(){var k=Ua(),T=b(k);if(r=arguments,i=this,l=k,T){if(o===void 0)return v(l);if(h)return clearTimeout(o),o=setTimeout(g,t),m(l)}return o===void 0&&(o=setTimeout(g,t)),s}return E.cancel=w,E.flush=F,E}var Ff=qb;const Ub=Nn(Ff);var Wb=Ff,Vb=To,Hb="Expected a function";function Kb(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(Hb);return Vb(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Wb(e,t,{leading:r,maxWait:t,trailing:i})}var Zb=Kb;const Yb=Nn(Zb),Xu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,el=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Wa=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return el(n.overflowY,t)||el(n.overflowX,t)||(r=>{const i=(a=>{if(!a.ownerDocument||!a.ownerDocument.defaultView)return null;try{return a.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!i&&(i.clientHeight<r.scrollHeight||i.clientWidth<r.scrollWidth)})(e)}return!1},mi=(e,t,n,r,i,a,s,o)=>a<e&&s>t||a>e&&s<t?0:a<=e&&o<=n||s>=t&&o>=n?a-e-r:s>t&&o<n||a<e&&o>n?s-t+i:0,Gb=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},tl=(e,t)=>{var n,r,i,a;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,h=typeof u=="function"?u:U=>U!==u;if(!Xu(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,m=[];let v=e;for(;Xu(v)&&h(v);){if(v=Gb(v),v===p){m.push(v);break}v!=null&&v===document.body&&Wa(v)&&!Wa(document.documentElement)||v!=null&&Wa(v,d)&&m.push(v)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(a=(i=window.visualViewport)==null?void 0:i.height)!=null?a:innerHeight,{scrollX:g,scrollY:D}=window,{height:w,width:F,top:E,right:k,bottom:T,left:R}=e.getBoundingClientRect(),{top:P,right:z,bottom:$,left:B}=(U=>{const W=window.getComputedStyle(U);return{top:parseFloat(W.scrollMarginTop)||0,right:parseFloat(W.scrollMarginRight)||0,bottom:parseFloat(W.scrollMarginBottom)||0,left:parseFloat(W.scrollMarginLeft)||0}})(e);let A=o==="start"||o==="nearest"?E-P:o==="end"?T+$:E+w/2-P+$,j=l==="center"?R+F/2-B+z:l==="end"?k+z:R-B;const M=[];for(let U=0;U<m.length;U++){const W=m[U],{height:ie,width:ae,top:C,right:G,bottom:ne,left:_}=W.getBoundingClientRect();if(s==="if-needed"&&E>=0&&R>=0&&T<=b&&k<=f&&E>=C&&T<=ne&&R>=_&&k<=G)return M;const O=getComputedStyle(W),q=parseInt(O.borderLeftWidth,10),S=parseInt(O.borderTopWidth,10),L=parseInt(O.borderRightWidth,10),Q=parseInt(O.borderBottomWidth,10);let K=0,J=0;const ce="offsetWidth"in W?W.offsetWidth-W.clientWidth-q-L:0,ee="offsetHeight"in W?W.offsetHeight-W.clientHeight-S-Q:0,pe="offsetWidth"in W?W.offsetWidth===0?0:ae/W.offsetWidth:0,ve="offsetHeight"in W?W.offsetHeight===0?0:ie/W.offsetHeight:0;if(p===W)K=o==="start"?A:o==="end"?A-b:o==="nearest"?mi(D,D+b,b,S,Q,D+A,D+A+w,w):A-b/2,J=l==="start"?j:l==="center"?j-f/2:l==="end"?j-f:mi(g,g+f,f,q,L,g+j,g+j+F,F),K=Math.max(0,K+D),J=Math.max(0,J+g);else{K=o==="start"?A-C-S:o==="end"?A-ne+Q+ee:o==="nearest"?mi(C,ne,ie,S,Q+ee,A,A+w,w):A-(C+ie/2)+ee/2,J=l==="start"?j-_-q:l==="center"?j-(_+ae/2)+ce/2:l==="end"?j-G+L+ce:mi(_,G,ae,q,L+ce,j,j+F,F);const{scrollLeft:Ee,scrollTop:Ce}=W;K=ve===0?0:Math.max(0,Math.min(Ce+K/ve,W.scrollHeight-ie/ve+ee)),J=pe===0?0:Math.max(0,Math.min(Ee+J/pe,W.scrollWidth-ae/pe+ce)),A+=Ce-K,j+=Ee-J}M.push({el:W,top:K,left:J})}return M},Qb=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function Jb(e,t){if(!e.isConnected||!(i=>{let a=i;for(;a&&a.parentNode;){if(a.parentNode===document)return!0;a=a.parentNode instanceof ShadowRoot?a.parentNode.host:a.parentNode}return!1})(e))return;const n=(i=>{const a=window.getComputedStyle(i);return{top:parseFloat(a.scrollMarginTop)||0,right:parseFloat(a.scrollMarginRight)||0,bottom:parseFloat(a.scrollMarginBottom)||0,left:parseFloat(a.scrollMarginLeft)||0}})(e);if((i=>typeof i=="object"&&typeof i.behavior=="function")(t))return t.behavior(tl(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:i,top:a,left:s}of tl(e,Qb(t))){const o=a-n.top+n.bottom,l=s-n.left+n.right;i.scroll({top:o,left:l,behavior:r})}}/*!
66
+ ${kr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:kr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,i)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(i))}];const Av="shareLinks_",Bv=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:i="large",variant:a="default",className:s=""})=>{const o=re.useIntl(),l=Fv({title:e,link:t,referrer:n});return c.jsxs("aside",{className:V("share-links",i,a,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 v={};return p&&(v.onClick=f=>p(f,m)),c.jsx("li",{children:c.jsx(ke,{size:i,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:`${Av}link_${u}`}),...v})},u)})})]})};const Tv=({tabs:e,className:t="",preventLocationChange:n})=>{var v;const r=(f,b,g)=>(f||(f=`panel-${window.btoa(b)}-${g}`),f),i=Rn(!0)||0;let a=e.findIndex(f=>f.current===!0);if(a<0&&(a=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(g=>g.id===f)){for(let g=0;g<e.length;g++)if(r(e[g].id,e[g].text,g)===f){a=g;break}}}const[s,o]=y.useState((v=e[a])!=null&&v.id?e[a].id:r(e[a].id,e[a].text,a)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let g=b;f.key==="ArrowLeft"?b>0?g=b-1:g=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?g=b+1:g=0);const x=r(e[g].id,e[g].text,g),C=document.getElementById(`tab-${x}`);C==null||C.focus(),u(x);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},m=f=>{let b=!1;return f.target==="min-width"&&i>=f.value&&(b=!0),f.target==="max-width"&&i<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[a].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const h=[],p=[];return e.forEach(({id:f,text:b,content:g,href:x,hasCarousel:C,breakpoint:F},D)=>{if(F&&!m(F))return;f=r(f,b,D);const _=s===f,T={};x||(T["aria-controls"]=f,T.onClick=R=>{R.preventDefault(),R.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},p.push(c.jsx("section",{id:f,hidden:!_,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":_?"assertive":"off",children:typeof g=="string"?c.jsx("p",{children:g}):g},`section-${f}`))),h.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:x||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:V({selected:_}),role:"tab",tabIndex:_?0:-1,"aria-selected":_,onKeyDown:R=>d(R,D),...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 Sv={"2-1":901,"1-3":769,"1-1":769},xf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:i})=>{const a=Rn(!0);let s=i;return y.Children.count(i)===1&&(s=y.Children.toArray(i)[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&&a&&a<Sv[e]?null:o)})};const jo=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const i=re.useIntl(),a="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?"":i.formatMessage({id:`${a}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?i.formatMessage({id:`${a}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:i.formatMessage({id:a})}),n," / ",t]})}),c.jsx(Ie,{showOnFocus:!1,id:`${e}-info`,children:i.formatMessage({id:`${a}_info`},{limit:t})})]})},ha=e=>(e==null?void 0:e.toString().length)||0,wf=(e,t)=>{const n={};return e===0||(n["data-character-limit"]=e,n.functions={...t,onChange:r=>{ha(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t.onChange(r)}}),n};const hi="emailHelperTextBox_",Cf=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:i})=>{const a=re.useIntl(),[s,o]=y.useState({path:`${hi}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(v=>{v.preventDefault(),v.stopPropagation();const f=b=>{o({path:`${hi}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:g=>d(g),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof i!="function"){f(a.formatMessage({id:`${hi}error_noFunction`}));return}u(!0),i(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,i]);y.useEffect(()=>{let v=hi,f="default",b={},g={};switch(t){case"gov":v+="autoApproved",f="success";break;case"nonGov":v+="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":v+="pendingApproval",f="error",g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":v+="emailUnverified",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:x=>d(x),"data-testid":"send-verify-email-click"};break;case"exists":v+="emailAlreadyExists",f="error",b={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},g={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:v+="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:v,type:f,link:b,mail:g})},[t]);const m={};return["link","mail"].forEach(v=>{m[v]=Object.keys(s[v]).length?f=>c.jsx("a",{...s[v],children:f}):f=>f}),c.jsx(kd,{id:e,type:s.type,heading:l?!1:a.formatMessage({id:`${s.path}_title`}),"aria-live":"assertive",children:l?c.jsxs(c.Fragment,{children:[c.jsx(It,{element:"span"}),c.jsx(It,{element:"span"})]}):a.formatMessage({id:`${s.path}_text`},{...m,strong:v=>c.jsx("strong",{children:v}),em:v=>c.jsx("em",{children:v}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Qn=({className:e="",element:t="input",id:n,inputRef:r,functions:i={onChange:()=>{}},name:a=n,placeholder:s,type:o="text",value:l,autoFocus:u,label:d,...m})=>{const h=y.useRef(),p=r||h;return y.useEffect(()=>{var v;u&&((v=p.current)==null||v.focus())},[]),!(m!=null&&m.autoComplete)&&["email"].includes(o)&&(m.autoComplete="email"),y.createElement(t,{ref:p,...m,type:o,id:n,name:a,className:V(e,t,{"has-scrollbar":o==="textarea"&&p.current&&p.current.clientHeight<p.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...i,onChange:v=>{const f=v.target;i.onChange(f.value)}})};const Vn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},jv=500,Pv=({id:e,name:t=e,value:n,placeholder:r,functions:i={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...a})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=i,[{input:l,displayInput:u,debouncedInput:d},m]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:h,activePredictionIndex:p,isPredictionSelected:v},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=re.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const F=setTimeout(()=>{v||m(D=>({...D,debouncedInput:l}))},jv);return()=>{clearTimeout(F)}},[l,v]),y.useEffect(()=>{d&&!v?(async()=>{try{const D=await o(d)||[];f(_=>({..._,predictions:D}))}catch(D){console.error("Error fetching predictions:",D),f(_=>({..._,predictions:[]}))}})():f(F=>({...F,predictions:[]}))},[d,v]),y.useEffect(()=>{p>=0&&h[p]&&m(F=>({...F,displayInput:h[p].description}))},[p,h]);const g=F=>{[Vn.DOWN,Vn.UP,Vn.ENTER].includes(F.key)&&(F.preventDefault(),F.key===Vn.DOWN&&p<h.length-1?f(D=>({...D,activePredictionIndex:p+1})):F.key===Vn.UP&&p>0?f(D=>({...D,activePredictionIndex:p-1})):F.key===Vn.ENTER&&p>-1&&(s(h[p].description),m(D=>({...D,input:h[p].description})),f(D=>({...D,predictions:[],isPredictionSelected:!0}))))},x=F=>{s(F.target.value),m(D=>({...D,input:F.target.value,displayInput:F.target.value})),f(D=>({...D,activePredictionIndex:-1,isPredictionSelected:!1}))},C=F=>{s(F.description),m(D=>({...D,input:F.description,displayInput:F.description})),f(D=>({...D,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:x,onKeyDown:g,placeholder:r,name:t,id:e,...a}),c.jsx("ul",{className:"predictions-list",children:h.map((F,D)=>c.jsx("li",{onClick:()=>C(F),onMouseEnter:()=>f(_=>({..._,activePredictionIndex:D})),className:V("predictions-list-item",{active:D===p}),children:F.description},D))})]})};const Df=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:i,inputRef:a,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:d,accessibilityOptions:{checkboxes:{navigateWithArrowKeys:m=!1}={}}={},...h})=>{const p=re.useIntl(),{onChange:v,...f}=r,b=()=>{t||v(d?null:l)},g=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:a,id:i,name:i,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:i,onKeyDown:x=>{(x.key==="Enter"||x.code==="Space")&&(x.preventDefault(),x.stopPropagation(),b())},tabIndex:d||!m?0:-1,children:o||p.formatMessage({id:s?`${s}_${i}`:i})})]});return y.createElement(n,{onClick:x=>{const C=x.target;C.nodeName.toLowerCase()==="a"||C.parentNode&&C.parentNode.nodeName.toLowerCase()==="a"||(x.preventDefault(),x.stopPropagation(),b())},onKeyDown:m?x=>{var C,F,D;if(x.key!=="Tab")switch(x.code){case"Enter":case"Space":x.stopPropagation(),x.preventDefault(),b();break;case"ArrowLeft":case"ArrowRight":x.stopPropagation(),x.preventDefault();const _=x.currentTarget;let T=_==null?void 0:_.nextElementSibling;if(x.key==="ArrowLeft"){const R=_==null?void 0:_.previousElementSibling;R?T=R:T=(C=_==null?void 0:_.parentElement)==null?void 0:C.lastElementChild}else T||(T=(F=_==null?void 0:_.parentElement)==null?void 0:F.firstElementChild);T&&((D=T==null?void 0:T.querySelector("label"))==null||D.focus());break}}:void 0,className:V(i,"checkbox-wrapper",e,{"is-checked":d}),...h,...f},g)};const Ov=y.memo(function({direction:t="down"}){return c.jsx(ua,{className:V("rotating-chevron",`direction-${t}`)})});const Mv=({className:e,options:t,initialValue:n,value:r,functions:i={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:a}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const d=re.useIntl(),[m,h]=y.useState(!1),p=r||n,v=Array.isArray(p)?[...p]:p?[p]:[],[f,b]=y.useState(v);let g;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?g=t&&f?t.find(T=>T.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?g=f[0]:g={id:"",label:""},y.useEffect(()=>{b(v)},[r,n]);const{onChange:x,onMultiSelectSubmit:C,...F}=i,D=T=>{if(o){let R=[];f!=null&&f.includes(T.id)?R=f.filter(O=>O!==T.id):R=[...f,T.id],b([...R]),x&&x([...R])}else b([T]),x&&x(T.id),h(!1)},_=T=>{if(T==="all"){const R=(t==null?void 0:t.map(O=>O.id))||[];b(R),x&&x(R)}else b([]),x&&x([])};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",...F,children:[o?`${s} · ${f.length}`:g.label,c.jsx(Ov,{direction:m?"up":"down"})]}),c.jsx("select",{defaultValue:g.id,onChange:T=>{T.preventDefault(),T.stopPropagation();const R=t&&t.find(O=>O.id===T.target.value);D(R)},hidden:!m,...F,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":a,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(ke,{variant:"tertiary",size:"small",onClick:()=>_("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":a,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(ke,{variant:"tertiary",size:"small",onClick:()=>_("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":a,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(T=>{const R=T.id===g.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:R,"selected-single":R&&!o}),"data-gtm-event-type":`${T.id}-click`,"data-gtm-event-context":a,onClick:O=>{O.preventDefault(),O.stopPropagation(),D(T)},role:"menuitem","aria-current":R,"data-testid":R?"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(ke,{variant:"secondary",onClick:()=>{C&&C(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),h(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})},jr=(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};const Nv=({id:e,label:t,limit:n,value:r,placeholder:i,functions:a,error:s,multipleInputs:o,validation:l,fieldData:u,type:d,...m})=>{const h=re.useIntl(),[p,v]=y.useState(r?Array.isArray(r)?r:[r]:[""]),f=p.filter(_=>_!=="");y.useEffect(()=>{if(!u)return;const _=Ot(u.fields).filter(({id:R,name:O})=>(R||(R=O||""),R!==e&&!R.includes(`${e}-`))),T=[];p.map((R,O)=>{if(x&&O>=x)return;const z=Ot(l);z&&e&&(z.forEach($=>{const{condition:A,error:B}=$;if(typeof A=="function")$.condition=j=>{var W;let M=(W=j==null?void 0:j[e])==null?void 0:W[O];M||(j[e]&&!Array.isArray(j[e])?M=j[e]:M="");const U=Ot(j);return U[e]=M,typeof A=="function"&&A(U)?B:!1};else{const j=A;$.condition=M=>{var W;let U=(W=M==null?void 0:M[e])==null?void 0:W[O];switch(U||(M[e]&&!Array.isArray(M[e])?U=M[e]:U=""),j){case"required":B||($.error=h==null?void 0:h.formatMessage({id:"form_error_required"}));break;case"no-numbers":B||($.error=h==null?void 0:h.formatMessage({id:"form_error_numbers"}));break;case"valid-email":B||($.error=B||(h==null?void 0:h.formatMessage({id:"form_error_email"})));break;case"valid-url":B||($.error=h==null?void 0:h.formatMessage({id:"form_error_url"}));break;default:console.warn("WARNING! No field validation condition has been set")}return jr(j,U)?$.error:!1}}}),T.push({id:`${e}-${O}`,validation:z,value:R}))}),u.setFields(_.concat(T))},[p.length]);const{showCount:b=!1,label:g,maxInputs:x=100,hasButton:C=!1}=o||{},F=()=>{(!x||p.length<x)&&v([...p,""])},D=(_,T)=>_.replace("{number}",T+1);return c.jsxs("fieldset",{className:V("multiple-inputs field-wrapper",{"has-button":C,"has-legend":t}),children:[t?c.jsxs("legend",{className:"legend-as-label",children:[t,b?c.jsxs(c.Fragment,{children:[" ",c.jsx("small",{className:"filled-in-count","aria-label":h.formatMessage({id:"form_multipleInputs_filledInCount_aria"},{number:f.length,total:x}),children:h.formatMessage({id:"form_multipleInputs_filledInCount"},{number:f.length,total:x})})]}):""]}):c.jsx(c.Fragment,{}),p.map((_,T)=>{if(x&&T>=x)return c.jsx(c.Fragment,{});let R=!1;t?R=c.jsx(Ie,{showOnFocus:!1,children:h.formatMessage({id:"form_multipleInputs_label"},{number:T+1})}):g&&(R=D(g,T));const O=`${e}-${T}`;return c.jsx(Ef,{id:O,type:"text",label:R,value:_,placeholder:i?D(i,T):void 0,limit:n,error:s&&typeof s!="string"?s==null?void 0:s[O]:void 0,functions:{...a,onFocus:()=>{C||T!==p.length-1||F()},onChange:z=>{const $=Ot(p);$[T]=z,v($),u==null||u.dispatch({type:"removeError",payload:{key:O}}),a==null||a.onChange($)}},siblings:T===0?void 0:c.jsx(ke,{variant:"tertiary",size:"small",icon:"close",screenreaderText:h.formatMessage({id:"form_multipleInputs_remove"}),onClick:()=>{const z=Ot(p);z.splice(T,1),v(z),u==null||u.dispatch({type:"removeError",payload:{key:O}}),a==null||a.onChange(z)}}),...m},O)}),C?c.jsx(ke,{...C,onClick:F,disabled:!!(x&&x<=p.length)}):c.jsx(c.Fragment,{})]})};const Ju=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:i,multiSelect:a=!1,name:s,options:o,required:l,type:u="checkboxes",value:d,accessibilityOptions:m,styling:{displayOptionsAsPills:h=!1}={},...p})=>{const v=re.useIntl(),f=a?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:g,label:x=!1,value:C=g,disabled:F=!1})=>{const D=`${r}_${g}`,_=()=>{if(F)return;let T;if(a){const R=f==null?void 0:f.indexOf(C);Array.isArray(f)&&R>=0?(T=f,T.splice(R,1)):(!f||f.length===0?T=[]:T=f,T.push(C))}else T=b===C?void 0:C;t.onChange(T)};return c.jsx(Df,{element:"li",id:D,type:u==="checkboxes"?"checkbox":"radio",shownValue:C,value:a?f==null?void 0:f.includes(C):b===C,functions:{...t,onChange:_},intlPath:n,label:x||v.formatMessage({id:n?`${n}_${g}`:g}),disabled:F,accessibilityOptions:m},D)})})};const Iv=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...i})=>{const a=re.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":a.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(Qn,{inputRef:o,type:d,autoComplete:r,...i})]})};const Hn={text:{component:Qn},email:{component:Qn},url:{component:Qn},textarea:{component:Qn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Df},checkboxes:{component:Ju,props:{multiSelect:!0}},radio:{component:Ju,props:{multiSelect:!1}},select:{component:Mv},password:{component:Iv},autocomplete:{component:Pv},"multiple-inputs":{component:c.jsx(c.Fragment,{})}},Ef=e=>{const t=re.useIntl(),{id:n,intlPath:r=!1,className:i="",error:a,functions:s={onChange:()=>{}},limit:o=0,showRequiredLabels:l=!0,type:u,validation:d,value:m,submitOnEnter:h,fieldData:p,siblings:v,...f}=e;if(u&&u==="multiple-inputs")return c.jsx(Nv,{...e});const b=d&&d.some(({condition:j})=>j==="required"),g=ha(m),x=u&&Hn[u]&&Hn[u].component?Hn[u].component:Qn,C=u&&["checkboxes","radio"].includes(u),F=u&&["autocomplete"].includes(u),D=a&&`error-${n}`,_=`character-limit-${n}`,T={};C?T.element="legend":T.htmlFor=n;let R={...f,id:n,name:n,className:a?"error":"",type:u,required:b,"aria-required":b,functions:Ot(s),value:m};const O=j=>{R["aria-describedby"]?R["aria-describedby"]+=` ${j}`:R["aria-describedby"]=j};if(o>0){const j=wf(o,s);O(`${_}-info`),R={...R,...j},j.functions&&typeof j.functions=="object"&&(R.functions={...R.functions,...j.functions})}u&&Hn[u]&&Hn[u].props&&(R={...R,...Hn[u].props}),C&&(R.intlPath=`${r}_${n}`),a&&(R["aria-invalid"]=!0,R["aria-errormessage"]=D,O(D));const z=f.label||t.formatMessage({id:r?`${r}_${n}`:n}),$=({...j})=>a?y.createElement(j.as||"p",{id:D,className:"error text-small",...j},a):null;if(u&&["checkbox"].includes(u))return c.jsxs(c.Fragment,{children:[c.jsx(x,{...R,label:z,className:V("field-wrapper",i)}),c.jsx($,{as:"p"})]});const A={};C?T.className="legend-as-label text-small":A.className="field-label";const B=({element:j,...M})=>y.createElement(j||"label",{...M,"data-testid":`label-${n}`});return c.jsx(c.Fragment,{children:y.createElement(C?"fieldset":"div",{className:V("field-wrapper text-medium",i,`${u}-wrapper`,{"multiple-options-wrapper":C})},c.jsxs(c.Fragment,{children:[f.label===!1?c.jsx(c.Fragment,{}):y.createElement(C?y.Fragment:"p",A,c.jsxs(B,{...T,children:[z,b&&l&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",t.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(C||F?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(x,{...R}),c.jsx(jo,{id:_,limit:o,valueLength:g}),v]})),c.jsx($,{})]}))})},Rv=(e,t)=>{const{type:n,payload:r}=t,i=e.errors?Ot(e.errors):{},a=e.values?Ot(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:i,[r==null?void 0:r.key]:r==null?void 0:r.value};a[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:i,values:a};case"addError":return r!=null&&r.key&&!i[r==null?void 0:r.key]&&(i[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:i};case"removeError":return r!=null&&r.key&&i[r==null?void 0:r.key]&&delete i[r==null?void 0:r.key],{...e,errors:i};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:d}=r,m=Ot(Object.keys(i));for(const h of s)if(h.validation)for(let p=0;p<h.validation.length;p++){const{condition:v="required",error:f=!1}=h.validation[p];let b=!1;if(typeof v=="function"){const g=v(a);g&&(b=f||g)}else{const g=a[h.id],x=v;switch(x){case"required":jr(x,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{jr(x,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{jr(x,g)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{jr(x,g)&&(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(a):u(a,m),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let qa=null;const Jt=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:i,intlPath:a=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:m,...h})=>{const[p,v]=y.useState(t);y.useEffect(()=>{v(t)},[t.length]);const{customOnSubmit:f,hideButton:b,...g}=s,x=40,{shouldShowCancelButton:C=!1,shouldReset:F=!0,shouldHide:D=!0,showRequiredLabels:_=!0,showSuccessMessage:T=!1}=l||{},{onSuccess:R=async()=>{},onCancel:O=()=>{},onCatch:z=()=>{},onFailure:$=()=>{}}=m||{},A=re.useIntl(),B={};t.length&&t.forEach(S=>{const L=S.id||S.name;L&&(B[L]=S.value||"")});const[j,M]=y.useReducer(Rv,{isSubmitting:!1,formSubmitted:!1,errors:{},values:B}),{errors:U,isSubmitting:W,formSubmitted:ie,values:se}=j;y.useEffect(()=>{F&&ie&&(qa=setTimeout(()=>{M({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[ie]),y.useEffect(()=>()=>{qa&&clearTimeout(qa)},[]),y.useEffect(()=>{const S=L=>{M({type:"updateValue",payload:{key:L.detail.id,value:L.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",S),()=>{document.removeEventListener("dropdownMultiSelectSubmit",S)}},[]);const E=y.useRef(null),ee=i||E;if(!t.length)return null;const Z={};s.children&&(Z.default=s.children),g.text&&typeof g.text=="string"&&(Z.default=g.text),["default","submitting","submitted"].forEach(S=>{g.text&&typeof g.text!="string"&&S in g.text?Z[S]=g.text[S]:Z[S]||(Z[S]=A.formatMessage({id:`form_${S==="default"?"submit":S}`}))}),delete g.text;const k=()=>{if(!W){if(M({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&M({type:"submitForm",payload:{fields:p,dispatch:M,intl:A}});return}M({type:"submitForm",payload:{fields:p,dispatch:M,onSuccess:async S=>{try{await R(S),M({type:F?"formSubmittedAndReset":"formSubmitted"})}catch(L){z(L),M({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(S,L)=>{$(S,L),M({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:A}})}},P=S=>{var Y;if(S.preventDefault(),S.stopPropagation(),W)return;let L=0;if((Y=ee==null?void 0:ee.current)!=null&&Y.id){const te=document.getElementById(ee.current.id);te&&(L=te.getBoundingClientRect().top+window.scrollY)}const Q=document.getElementById("header");Q&&(L=L-Q.offsetHeight-x),L<0&&(L=0),window.scrollTo({top:L,behavior:"smooth"}),k()},q=[{...g,icon:ie?{icon:"tick",position:"left"}:!1,className:V("gtm-trackable",g.className),onClick:P,disabled:W||ie||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:Z[W?"submitting":ie?"submitted":"default"]}];return C&&q.unshift({...o,className:V("gtm-trackable",o.className),"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:W||ie,onClick:O,children:o.text||A.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...h,id:r,className:V("form",n),ref:ee},c.jsxs(c.Fragment,{children:[U!=null&&U.general?c.jsx(xn,{variant:"error",text:A.formatMessage({id:"form_error_generalError"})}):null,u,(!D||!W&&!ie||f)&&t.map((S,L)=>{const{id:Q=S.name||L,component:Y,functions:te={onChange:()=>{}},submitOnEnter:ce=!1}=S;if(Y)return c.jsx(Y,{...S.props||{}},`component-${Q}-${L}`);const J=(se==null?void 0:se[Q])||"",pe={...te,onChange:de=>{M({type:"updateValue",payload:{key:Q,value:de}}),te.onChange(de,M)}};return ce&&(pe.onKeyDown=de=>{de.key==="Enter"&&(de.stopPropagation(),de.preventDefault(),k()),te.onKeyDown&&te.onKeyDown(de)}),c.jsx(Ef,{intlPath:a,...S,showRequiredLabels:_,value:J,error:S.type==="multiple-inputs"?U:U==null?void 0:U[Q],functions:pe,fieldData:{fields:p,setFields:v,dispatch:M}},Q)}),b?null:(W||ie)&&f?f:c.jsx(pr,{className:V("cta",{center:W||ie,submitted:ie}),buttons:q})]})),T&&ie&&c.jsx(or,{className:"success",children:typeof T=="string"?T:A.formatMessage({id:"form_success"})})]})};const pi="passwordRules_",_f="isMoreThanEightCharacters",kf="includesNumberAndSymbol",Ff="includesLowerAndUppercase",$v={[_f]:"8Characters",[kf]:"numberSymbol",[Ff]:"lowercaseUppercase"},Lv=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=re.useIntl();return c.jsxs("aside",{className:V("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${pi}intro`})}),c.jsx("ul",{children:[_f,kf,Ff].map(r=>c.jsxs("li",{className:V({matches:e[r]}),children:[c.jsxs(Ie,{children:[n.formatMessage({id:`${pi}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${pi}rule_${$v[r]}`})}),!e[r]&&c.jsxs(Ie,{element:"strong",children:[" ",n.formatMessage({id:`${pi}notMet`})]})]},`rule-${r}`))})]})},Af=y.memo(Lv);const zv=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:i=()=>{}},className:a="",hasLoaded:s=!1})=>{const o=re.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const g=await n();u(x=>({...x,setUp:!0,id:g&&g.id,disabled:!1}))}catch(g){u(x=>({...x,setUp:!0,disabled:!0})),i(g)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(It,{className:"rating-placeholder"});const{id:m,rating:h,disabled:p}=l,v="ratings_",f={text:o.formatMessage({id:`${v}text`}),low:o.formatMessage({id:`${v}low`}),high:o.formatMessage({id:`${v}high`}),success:o.formatMessage({id:`${v}success`}),...e},b=async g=>{if(!(!m||p))try{u(x=>({...x,rating:g,disabled:!0})),await r({id:m,value:g})}catch(x){u(C=>({...C,rating:null})),i(x)}finally{u(x=>({...x,disabled:!1}))}};return c.jsxs("div",{className:V("rating",a),children:[c.jsx("span",{className:"label",children:f[h?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(g=>{const x=g+1;return c.jsx("li",{className:V({selected:h&&x<=h}),children:c.jsx(ke,{variant:"tertiary",size:"small",icon:{icon:`star${!h||x>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${v}stars`},{number:x,total:t})}${x===1||x===t?` - ${f[x===1?"low":"high"]}`:""}`,onClick:C=>{C.preventDefault(),C.stopPropagation(),b(x)},disabled:p})},`rating-${x}`)})})]})},qv={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)}},ln=y.createContext(qv);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 Uv=({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 i=r;return i!=null&&i.name&&i.name===qr?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(re.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(i==null?void 0:i.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})}},Wv=({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 Vv=Zv,Bf="֑-߿יִ-﷽ﹰ-ﻼ",Tf="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Hv=new RegExp("^[^"+Tf+"]*["+Bf+"]"),Kv=new RegExp("^[^"+Bf+"]*["+Tf+"]");function Zv(e){return e=String(e||""),Hv.test(e)?"rtl":Kv.test(e)?"ltr":"neutral"}const Sf=In(Vv);function Yv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Po=Yv,Gv=typeof si=="object"&&si&&si.Object===Object&&si,Qv=Gv,Jv=Qv,Xv=typeof self=="object"&&self&&self.Object===Object&&self,eb=Jv||Xv||Function("return this")(),jf=eb,tb=jf,nb=function(){return tb.Date.now()},rb=nb,ib=/\s/;function ab(e){for(var t=e.length;t--&&ib.test(e.charAt(t)););return t}var sb=ab,ob=sb,ub=/^\s+/;function lb(e){return e&&e.slice(0,ob(e)+1).replace(ub,"")}var cb=lb,db=jf,fb=db.Symbol,Pf=fb,Xu=Pf,Of=Object.prototype,mb=Of.hasOwnProperty,hb=Of.toString,Fr=Xu?Xu.toStringTag:void 0;function pb(e){var t=mb.call(e,Fr),n=e[Fr];try{e[Fr]=void 0;var r=!0}catch{}var i=hb.call(e);return r&&(t?e[Fr]=n:delete e[Fr]),i}var gb=pb,vb=Object.prototype,bb=vb.toString;function yb(e){return bb.call(e)}var xb=yb,el=Pf,wb=gb,Cb=xb,Db="[object Null]",Eb="[object Undefined]",tl=el?el.toStringTag:void 0;function _b(e){return e==null?e===void 0?Eb:Db:tl&&tl in Object(e)?wb(e):Cb(e)}var kb=_b;function Fb(e){return e!=null&&typeof e=="object"}var Ab=Fb,Bb=kb,Tb=Ab,Sb="[object Symbol]";function jb(e){return typeof e=="symbol"||Tb(e)&&Bb(e)==Sb}var Pb=jb,Ob=cb,nl=Po,Mb=Pb,rl=0/0,Nb=/^[-+]0x[0-9a-f]+$/i,Ib=/^0b[01]+$/i,Rb=/^0o[0-7]+$/i,$b=parseInt;function Lb(e){if(typeof e=="number")return e;if(Mb(e))return rl;if(nl(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=nl(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Ob(e);var n=Ib.test(e);return n||Rb.test(e)?$b(e.slice(2),n?2:8):Nb.test(e)?rl:+e}var zb=Lb,qb=Po,Ua=rb,il=zb,Ub="Expected a function",Wb=Math.max,Vb=Math.min;function Hb(e,t,n){var r,i,a,s,o,l,u=0,d=!1,m=!1,h=!0;if(typeof e!="function")throw new TypeError(Ub);t=il(t)||0,qb(n)&&(d=!!n.leading,m="maxWait"in n,a=m?Wb(il(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h);function p(_){var T=r,R=i;return r=i=void 0,u=_,s=e.apply(R,T),s}function v(_){return u=_,o=setTimeout(g,t),d?p(_):s}function f(_){var T=_-l,R=_-u,O=t-T;return m?Vb(O,a-R):O}function b(_){var T=_-l,R=_-u;return l===void 0||T>=t||T<0||m&&R>=a}function g(){var _=Ua();if(b(_))return x(_);o=setTimeout(g,f(_))}function x(_){return o=void 0,h&&r?p(_):(r=i=void 0,s)}function C(){o!==void 0&&clearTimeout(o),u=0,r=l=i=o=void 0}function F(){return o===void 0?s:x(Ua())}function D(){var _=Ua(),T=b(_);if(r=arguments,i=this,l=_,T){if(o===void 0)return v(l);if(m)return clearTimeout(o),o=setTimeout(g,t),p(l)}return o===void 0&&(o=setTimeout(g,t)),s}return D.cancel=C,D.flush=F,D}var Mf=Hb;const Kb=In(Mf);var Zb=Mf,Yb=Po,Gb="Expected a function";function Qb(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(Gb);return Yb(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Zb(e,t,{leading:r,maxWait:t,trailing:i})}var Jb=Qb;const Xb=In(Jb),al=e=>typeof e=="object"&&e!=null&&e.nodeType===1,sl=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Wa=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return sl(n.overflowY,t)||sl(n.overflowX,t)||(r=>{const i=(a=>{if(!a.ownerDocument||!a.ownerDocument.defaultView)return null;try{return a.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!i&&(i.clientHeight<r.scrollHeight||i.clientWidth<r.scrollWidth)})(e)}return!1},gi=(e,t,n,r,i,a,s,o)=>a<e&&s>t||a>e&&s<t?0:a<=e&&o<=n||s>=t&&o>=n?a-e-r:s>t&&o<n||a<e&&o>n?s-t+i:0,e0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},ol=(e,t)=>{var n,r,i,a;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,m=typeof u=="function"?u:U=>U!==u;if(!al(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let v=e;for(;al(v)&&m(v);){if(v=e0(v),v===h){p.push(v);break}v!=null&&v===document.body&&Wa(v)&&!Wa(document.documentElement)||v!=null&&Wa(v,d)&&p.push(v)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(a=(i=window.visualViewport)==null?void 0:i.height)!=null?a:innerHeight,{scrollX:g,scrollY:x}=window,{height:C,width:F,top:D,right:_,bottom:T,left:R}=e.getBoundingClientRect(),{top:O,right:z,bottom:$,left:A}=(U=>{const W=window.getComputedStyle(U);return{top:parseFloat(W.scrollMarginTop)||0,right:parseFloat(W.scrollMarginRight)||0,bottom:parseFloat(W.scrollMarginBottom)||0,left:parseFloat(W.scrollMarginLeft)||0}})(e);let B=o==="start"||o==="nearest"?D-O:o==="end"?T+$:D+C/2-O+$,j=l==="center"?R+F/2-A+z:l==="end"?_+z:R-A;const M=[];for(let U=0;U<p.length;U++){const W=p[U],{height:ie,width:se,top:E,right:ee,bottom:Z,left:k}=W.getBoundingClientRect();if(s==="if-needed"&&D>=0&&R>=0&&T<=b&&_<=f&&D>=E&&T<=Z&&R>=k&&_<=ee)return M;const P=getComputedStyle(W),q=parseInt(P.borderLeftWidth,10),S=parseInt(P.borderTopWidth,10),L=parseInt(P.borderRightWidth,10),Q=parseInt(P.borderBottomWidth,10);let Y=0,te=0;const ce="offsetWidth"in W?W.offsetWidth-W.clientWidth-q-L:0,J="offsetHeight"in W?W.offsetHeight-W.clientHeight-S-Q:0,pe="offsetWidth"in W?W.offsetWidth===0?0:se/W.offsetWidth:0,de="offsetHeight"in W?W.offsetHeight===0?0:ie/W.offsetHeight:0;if(h===W)Y=o==="start"?B:o==="end"?B-b:o==="nearest"?gi(x,x+b,b,S,Q,x+B,x+B+C,C):B-b/2,te=l==="start"?j:l==="center"?j-f/2:l==="end"?j-f:gi(g,g+f,f,q,L,g+j,g+j+F,F),Y=Math.max(0,Y+x),te=Math.max(0,te+g);else{Y=o==="start"?B-E-S:o==="end"?B-Z+Q+J:o==="nearest"?gi(E,Z,ie,S,Q+J,B,B+C,C):B-(E+ie/2)+J/2,te=l==="start"?j-k-q:l==="center"?j-(k+se/2)+ce/2:l==="end"?j-ee+L+ce:gi(k,ee,se,q,L+ce,j,j+F,F);const{scrollLeft:xe,scrollTop:Be}=W;Y=de===0?0:Math.max(0,Math.min(Be+Y/de,W.scrollHeight-ie/de+J)),te=pe===0?0:Math.max(0,Math.min(xe+te/pe,W.scrollWidth-se/pe+ce)),B+=Be-Y,j+=xe-te}M.push({el:W,top:Y,left:te})}return M},t0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function n0(e,t){if(!e.isConnected||!(i=>{let a=i;for(;a&&a.parentNode;){if(a.parentNode===document)return!0;a=a.parentNode instanceof ShadowRoot?a.parentNode.host:a.parentNode}return!1})(e))return;const n=(i=>{const a=window.getComputedStyle(i);return{top:parseFloat(a.scrollMarginTop)||0,right:parseFloat(a.scrollMarginRight)||0,bottom:parseFloat(a.scrollMarginBottom)||0,left:parseFloat(a.scrollMarginLeft)||0}})(e);if((i=>typeof i=="object"&&typeof i.behavior=="function")(t))return t.behavior(ol(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:i,top:a,left:s}of ol(e,t0(t))){const o=a-n.top+n.bottom,l=s-n.left+n.right;i.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 nl(e){return Object.prototype.toString.call(e)==="[object Object]"}function st(e){var t,n;return nl(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(nl(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Af=Symbol.for("immer-nothing"),rl=Symbol.for("immer-draftable"),At=Symbol.for("immer-state"),Xb=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 xt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Xb[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 lr=Object.getPrototypeOf;function On(e){return!!e&&!!e[At]}function Pn(e){var t;return e?Bf(e)||Array.isArray(e)||!!e[rl]||!!((t=e.constructor)!=null&&t[rl])||ga(e)||va(e):!1}var e0=Object.prototype.constructor.toString();function Bf(e){if(!e||typeof e!="object")return!1;const t=lr(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)===e0}function Yi(e,t){pa(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function pa(e){const t=e[At];return t?t.type_:Array.isArray(e)?1:ga(e)?2:va(e)?3:0}function Is(e,t){return pa(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Tf(e,t,n){const r=pa(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function t0(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ga(e){return e instanceof Map}function va(e){return e instanceof Set}function _n(e){return e.copy_||e.base_}function Rs(e,t){if(ga(e))return new Map(e);if(va(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[At];let i=Reflect.ownKeys(r);for(let a=0;a<i.length;a++){const s=i[a],o=r[s];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[s]})}return Object.create(lr(e),r)}else{const r=lr(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function So(e,t=!1){return ba(e)||On(e)||!Pn(e)||(pa(e)>1&&(e.set=e.add=e.clear=e.delete=n0),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>So(r,!0))),e}function n0(){xt(2)}function ba(e){return Object.isFrozen(e)}var r0={};function Mn(e){const t=r0[e];return t||xt(0,e),t}var Ur;function Sf(){return Ur}function i0(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function il(e,t){t&&(Mn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function $s(e){Ls(e),e.drafts_.forEach(a0),e.drafts_=null}function Ls(e){e===Ur&&(Ur=e.parent_)}function al(e){return Ur=i0(Ur,e)}function a0(e){const t=e[At];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function sl(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[At].modified_&&($s(t),xt(4)),Pn(e)&&(e=Gi(t,e),t.parent_||Qi(t,e)),t.patches_&&Mn("Patches").generateReplacementPatches_(n[At].base_,e,t.patches_,t.inversePatches_)):e=Gi(t,n,[]),$s(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Af?e:void 0}function Gi(e,t,n){if(ba(t))return t;const r=t[At];if(!r)return Yi(t,(i,a)=>ol(e,r,t,i,a,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Qi(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let a=i,s=!1;r.type_===3&&(a=new Set(i),i.clear(),s=!0),Yi(a,(o,l)=>ol(e,r,i,o,l,n,s)),Qi(e,i,!1),n&&e.patches_&&Mn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function ol(e,t,n,r,i,a,s){if(process.env.NODE_ENV!=="production"&&i===n&&xt(5),On(i)){const o=a&&t&&t.type_!==3&&!Is(t.assigned_,r)?a.concat(r):void 0,l=Gi(e,i,o);if(Tf(n,r,l),On(l))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(Pn(i)&&!ba(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Gi(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Qi(e,i)}}function Qi(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&So(t,n)}function s0(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 i=r,a=jo;n&&(i=[r],a=Wr);const{revoke:s,proxy:o}=Proxy.revocable(i,a);return r.draft_=o,r.revoke_=s,o}var jo={get(e,t){if(t===At)return e;const n=_n(e);if(!Is(n,t))return o0(e,n,t);const r=n[t];return e.finalized_||!Pn(r)?r:r===Va(e.base_,t)?(Ha(e),e.copy_[t]=qs(r,e)):r},has(e,t){return t in _n(e)},ownKeys(e){return Reflect.ownKeys(_n(e))},set(e,t,n){const r=jf(_n(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Va(_n(e),t),a=i==null?void 0:i[At];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(t0(n,i)&&(n!==void 0||Is(e.base_,t)))return!0;Ha(e),zs(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Va(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ha(e),zs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=_n(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){xt(11)},getPrototypeOf(e){return lr(e.base_)},setPrototypeOf(){xt(12)}},Wr={};Yi(jo,(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))&&xt(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))&&xt(14),jo.set.call(this,e[0],t,n,e[0])};function Va(e,t){const n=e[At];return(n?_n(n):e)[t]}function o0(e,t,n){var i;const r=jf(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function jf(e,t){if(!(t in e))return;let n=lr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=lr(n)}}function zs(e){e.modified_||(e.modified_=!0,e.parent_&&zs(e.parent_))}function Ha(e){e.copy_||(e.copy_=Rs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var u0=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const a=n;n=t;const s=this;return function(l=a,...u){return s.produce(l,d=>n.call(this,d,...u))}}typeof n!="function"&&xt(6),r!==void 0&&typeof r!="function"&&xt(7);let i;if(Pn(t)){const a=al(this),s=qs(t,void 0);let o=!0;try{i=n(s),o=!1}finally{o?$s(a):Ls(a)}return il(a,r),sl(i,a)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Af&&(i=void 0),this.autoFreeze_&&So(i,!0),r){const a=[],s=[];Mn("Patches").generateReplacementPatches_(t,i,a,s),r(a,s)}return i}else xt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,l=>t(l,...o));let r,i;return[this.produce(t,n,(s,o)=>{r=s,i=o}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Pn(e)||xt(8),On(e)&&(e=l0(e));const t=al(this),n=qs(e,void 0);return n[At].isManual_=!0,Ls(t),n}finishDraft(e,t){const n=e&&e[At];(!n||!n.isManual_)&&xt(9);const{scope_:r}=n;return il(r,t),sl(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=Mn("Patches").applyPatches_;return On(e)?r(e,t):this.produce(e,i=>r(i,t))}};function qs(e,t){const n=ga(e)?Mn("MapSet").proxyMap_(e,t):va(e)?Mn("MapSet").proxySet_(e,t):s0(e,t);return(t?t.scope_:Sf()).drafts_.push(n),n}function l0(e){return On(e)||xt(10,e),Of(e)}function Of(e){if(!Pn(e)||ba(e))return e;const t=e[At];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Rs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Rs(e,!0);return Yi(n,(r,i)=>{Tf(n,r,Of(i))}),t&&(t.finalized_=!1),n}var Bt=new u0,Oo=Bt.produce;Bt.produceWithPatches.bind(Bt);Bt.setAutoFreeze.bind(Bt);Bt.setUseStrictShallowCopy.bind(Bt);Bt.applyPatches.bind(Bt);var ul=Bt.createDraft.bind(Bt),ll=Bt.finishDraft.bind(Bt),c0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var i=I.transform(n,t,{affinity:r});e.current=i,i==null&&e.unref()}}},d0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var i=Te.transform(n,t,{affinity:r});e.current=i,i==null&&e.unref()}}},f0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var i=Y.transform(n,t,{affinity:r});e.current=i,i==null&&e.unref()}}},Ji=new WeakMap,Xi=new WeakMap,Or=new WeakMap,Pf=new WeakMap,cl=new WeakMap,dl=new WeakMap,fl=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 i=e[r],a=t[r];if(i!==a)break;n.push(i)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),i=t.slice(0,n),a=e[n],s=t[n];return I.equals(r,i)&&a>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),i=t.slice(0,n);return I.equals(r,i)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),i=t.slice(0,n),a=e[n],s=t[n];return I.equals(r,i)&&a<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return 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),i=e[e.length-1],a=t[t.length-1];return i!==a&&I.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],i=0;i<=e.length;i++)r.push(e.slice(0,i));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!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:i="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:a}=t;(I.equals(a,r)||I.endsBefore(a,r)||I.isAncestor(a,r))&&(r[a.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(i==="forward")r[r.length-1]+=1;else if(i!=="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:h,newPath:p}=t;if(I.equals(h,p))return r;if(I.isAncestor(h,r)||I.equals(h,r)){var m=p.slice();return I.endsBefore(h,p)&&h.length<p.length&&(m[h.length-1]-=1),m.concat(r.slice(h.length))}else I.isSibling(h,p)&&(I.isAncestor(p,r)||I.equals(p,r))?I.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:I.endsBefore(p,r)||I.equals(p,r)||I.isAncestor(p,r)?(I.endsBefore(h,r)&&(r[h.length-1]-=1),r[p.length-1]+=1):I.endsBefore(h,r)&&(I.equals(p,r)&&(r[p.length-1]+=1),r[h.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 h0(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 m0(e){var t=h0(e,"string");return Vr(t)==="symbol"?t:String(t)}function pt(e,t,n){return t=m0(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var p0=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:i}=n,a=le.parent(e,r),s=r[r.length-1];if(s>a.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(a.children.splice(s,0,i),t)for(var[o,l]of Y.points(t))t[l]=Te.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:h}=n;if(h.length===0)break;var p=le.leaf(e,u),m=p.text.slice(0,d),v=p.text.slice(d);if(p.text=m+h+v,t)for(var[f,b]of Y.points(t))t[b]=Te.transform(f,n);break}case"merge_node":{var{path:g}=n,D=le.get(e,g),w=I.previous(g),F=le.get(e,w),E=le.parent(e,g),k=g[g.length-1];if(ge.isText(D)&&ge.isText(F))F.text+=D.text;else if(!ge.isText(D)&&!ge.isText(F))F.children.push(...D.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(g,"] to nodes of different interfaces: ").concat(it.stringify(D)," ").concat(it.stringify(F)));if(E.children.splice(k,1),t)for(var[T,R]of Y.points(t))t[R]=Te.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 $=le.get(e,P),B=le.parent(e,P),A=P[P.length-1];B.children.splice(A,1);var j=I.transform(P,n),M=le.get(e,I.parent(j)),U=j[j.length-1];if(M.children.splice(U,0,$),t)for(var[W,ie]of Y.points(t))t[ie]=Te.transform(W,n);break}case"remove_node":{var{path:ae}=n,C=ae[ae.length-1],G=le.parent(e,ae);if(G.children.splice(C,1),t)for(var[ne,_]of Y.points(t)){var O=Te.transform(ne,n);if(t!=null&&O!=null)t[_]=O;else{var q=void 0,S=void 0;for(var[L,Q]of le.texts(e))if(I.compare(Q,ae)===-1)q=[L,Q];else{S=[L,Q];break}var K=!1;q&&S&&(I.equals(S[1],ae)?K=!I.hasPrevious(S[1]):K=I.common(q[1],ae).length<I.common(S[1],ae).length),q&&!K?(ne.path=q[1],ne.offset=q[0].text.length):S?(ne.path=S[1],ne.offset=0):t=null}}break}case"remove_text":{var{path:J,offset:ce,text:ee}=n;if(ee.length===0)break;var pe=le.leaf(e,J),ve=pe.text.slice(0,ce),Ee=pe.text.slice(ce+ee.length);if(pe.text=ve+Ee,t)for(var[Ce,Fe]of Y.points(t))t[Fe]=Te.transform(Ce,n);break}case"set_node":{var{path:We,properties:Me,newProperties:ze}=n;if(We.length===0)throw new Error("Cannot set properties on the root node!");var Xe=le.get(e,We);for(var Ae in ze){if(Ae==="children"||Ae==="text")throw new Error('Cannot set the "'.concat(Ae,'" property of nodes!'));var je=ze[Ae];je==null?delete Xe[Ae]:Xe[Ae]=je}for(var qe in Me)ze.hasOwnProperty(qe)||delete Xe[qe];break}case"set_selection":{var{newProperties:Z}=n;if(Z==null)t=Z;else{if(t==null){if(!Y.isRange(Z))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(it.stringify(Z)," when there is no current selection."));t=_r({},Z)}for(var oe in Z){var se=Z[oe];if(se==null){if(oe==="anchor"||oe==="focus")throw new Error('Cannot remove the "'.concat(oe,'" selection property'));delete t[oe]}else t[oe]=se}}break}case"split_node":{var{path:me,position:be,properties:he}=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 xe=le.get(e,me),Qe=le.parent(e,me),rt=me[me.length-1],gt;if(ge.isText(xe)){var et=xe.text.slice(0,be),Dt=xe.text.slice(be);xe.text=et,gt=_r(_r({},he),{},{text:Dt})}else{var Et=xe.children.slice(0,be),_a=xe.children.slice(be);xe.children=Et,gt=_r(_r({},he),{},{children:_a})}if(Qe.children.splice(rt+1,0,gt),t)for(var[vr,ri]of Y.points(t))t[ri]=Te.transform(vr,n);break}}return t},g0={transform(e,t){e.children=ul(e.children);var n=e.selection&&ul(e.selection);try{n=p0(e,n,t)}finally{e.children=ll(e.children),n?e.selection=On(n)?ll(n):n:e.selection=null}}},v0={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)}},b0={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],i=t[n];if(st(r)&&st(i)){if(!Mf(r,i))return!1}else if(Array.isArray(r)&&Array.isArray(i)){if(r.length!==i.length)return!1;for(var a=0;a<r.length;a++)if(r[a]!==i[a])return!1}else if(r!==i)return!1}for(var s in t)if(e[s]===void 0&&t[s]!==void 0)return!1;return!0};function y0(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function an(e,t){if(e==null)return{};var n=y0(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var x0=["anchor","focus"];function ml(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function C0(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){pt(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 Y={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:i}=e;return Y.isBackward(e)===n?[r,i]:[i,r]},end(e){var[,t]=Y.edges(e);return t},equals(e,t){return Te.equals(e.anchor,t.anchor)&&Te.equals(e.focus,t.focus)},includes(e,t){if(Y.isRange(t)){if(Y.includes(e,t.anchor)||Y.includes(e,t.focus))return!0;var[n,r]=Y.edges(e),[i,a]=Y.edges(t);return Te.isBefore(n,i)&&Te.isAfter(r,a)}var[s,o]=Y.edges(e),l=!1,u=!1;return Te.isPoint(t)?(l=Te.compare(t,s)>=0,u=Te.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=an(e,x0),[r,i]=Y.edges(e),[a,s]=Y.edges(t),o=Te.isBefore(r,a)?a:r,l=Te.isBefore(i,s)?i:s;return Te.isBefore(l,o)?null:C0({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return Te.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Te.equals(t,n)},isExpanded(e){return!Y.isCollapsed(e)},isForward(e){return!Y.isBackward(e)},isRange(e){return st(e)&&Te.isPoint(e.anchor)&&Te.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Y.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Oo(e,r=>{if(r===null)return null;var{affinity:i="inward"}=n,a,s;if(i==="inward"){var o=Y.isCollapsed(r);Y.isForward(r)?(a="forward",s=o?a:"backward"):(a="backward",s=o?a:"forward")}else i==="outward"?Y.isForward(r)?(a="backward",s="forward"):(a="forward",s="backward"):(a=i,s=i);var l=Te.transform(r.anchor,t,{affinity:a}),u=Te.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},pl=e=>st(e)&&le.isNodeList(e.children)&&!x.isEditor(e),fe={isAncestor(e){return st(e)&&le.isNodeList(e.children)},isElement:pl,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 pl(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},w0=["children"],D0=["text"],gl=new WeakMap,le={ancestor(e,t){var n=le.get(e,t);if(ge.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(it.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 i=le.ancestor(e,r),a=[i,r];yield a}}()},child(e,t){if(ge.isText(e))throw new Error("Cannot get the child of a text node: ".concat(it.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(it.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,i=le.ancestor(e,t),{children:a}=i,s=r?a.length-1:0;r?s>=0:s<a.length;){var o=le.child(i,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=I.common(t,n),i=le.get(e,r);return[i,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(it.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=an(e,w0);return t}else{var t=an(e,D0);return t}},first(e,t){for(var n=t.slice(),r=le.get(e,n);r&&!(ge.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(ge.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(it.stringify(e)));var n=Oo({children:e.children},r=>{var[i,a]=Y.edges(t),s=le.nodes(r,{reverse:!0,pass:p=>{var[,m]=p;return!Y.includes(t,m)}});for(var[,o]of s){if(!Y.includes(t,o)){var l=le.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(I.equals(o,a.path)){var d=le.leaf(r,o);d.text=d.text.slice(0,a.offset)}if(I.equals(o,i.path)){var h=le.leaf(r,o);h.text=h.text.slice(i.offset)}}x.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var i=t[r];if(ge.isText(n)||!n.children[i])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(it.stringify(e)));n=n.children[i]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var i=t[r];if(ge.isText(n)||!n.children[i])return!1;n=n.children[i]}return!0},isNode(e){return ge.isText(e)||fe.isElement(e)||x.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=gl.get(e);if(t!==void 0)return t;var n=e.every(r=>le.isNode(r));return gl.set(e,n),n},last(e,t){for(var n=t.slice(),r=le.get(e,n);r&&!(ge.isText(r)||r.children.length===0);){var i=r.children.length-1;r=r.children[i],n.push(i)}return[r,n]},leaf(e,t){var n=le.get(e,t);if(!ge.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(it.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 i=le.get(e,r);yield[i,r]}}()},matches(e,t){return fe.isElement(e)&&fe.isElementProps(t)&&fe.matches(e,t)||ge.isText(e)&&ge.isTextProps(t)&&ge.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:i=[],to:a}=t,s=new Set,o=[],l=e;!(a&&(r?I.isBefore(o,a):I.isAfter(o,a)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!ge.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,i)&&(u=i[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 h=I.previous(o);o=h,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(ge.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string(e){return ge.isText(e)?e.text:e.children.map(le.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of le.nodes(e,t))ge.isText(n)&&(yield[n,r])}()}};function vl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ke(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){pt(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 gn={isNodeOperation(e){return gn.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&&Y.isRange(e.newProperties)||e.newProperties===null&&Y.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=>gn.isOperation(t))},isSelectionOperation(e){return gn.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return gn.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Ke(Ke({},e),{},{type:"remove_node"});case"insert_text":return Ke(Ke({},e),{},{type:"remove_text"});case"merge_node":return Ke(Ke({},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 Ke(Ke({},e),{},{path:t,newPath:n});var r=I.transform(n,e),i=I.transform(I.next(n),e);return Ke(Ke({},e),{},{path:r,newPath:i})}case"remove_node":return Ke(Ke({},e),{},{type:"insert_node"});case"remove_text":return Ke(Ke({},e),{},{type:"insert_text"});case"set_node":{var{properties:a,newProperties:s}=e;return Ke(Ke({},e),{},{properties:s,newProperties:a})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Ke(Ke({},e),{},{properties:l,newProperties:null}):l==null?Ke(Ke({},e),{},{properties:null,newProperties:o}):Ke(Ke({},e),{},{properties:l,newProperties:o})}case"split_node":return Ke(Ke({},e),{},{type:"merge_node",path:I.next(e.path)})}}},bl=new WeakMap,E0=e=>{var t=bl.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||Y.isRange(e.selection))&&le.isNodeList(e.children)&&gn.isOperationList(e.operations);return bl.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 E0(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)}},_0={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(I.isPath)}};function yl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function xl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Te={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 Te.compare(e,t)===1},isBefore(e,t){return Te.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 Oo(e,r=>{if(r===null)return null;var{affinity:i="forward"}=n,{path:a,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=I.transform(a,t,n);break}case"insert_text":{I.equals(t.path,a)&&(t.offset<s||t.offset===s&&i==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{I.equals(t.path,a)&&(r.offset+=t.position),r.path=I.transform(a,t,n);break}case"remove_text":{I.equals(t.path,a)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(I.equals(t.path,a)||I.isAncestor(t.path,a))return null;r.path=I.transform(a,t,n);break}case"split_node":{if(I.equals(t.path,a)){if(t.position===s&&i==null)return null;(t.position<s||t.position===s&&i==="forward")&&(r.offset-=t.position,r.path=I.transform(a,t,xl(xl({},n),{},{affinity:"forward"})))}else r.path=I.transform(a,t,n);break}}})}},Cl=void 0,it={setScrubber(e){Cl=e},stringify(e){return JSON.stringify(e,Cl)}},k0=["text"],F0=["anchor","focus"];function wl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function en(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){pt(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 ge={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function i(a){var s=an(a,k0);return s}return Mf(r?i(e):e,r?i(t):t)},isText(e){return st(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>ge.isText(t))},isTextProps(e){return e.text!==void 0},matches(e,t){for(var n in t)if(n!=="text"&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[en({},e)];for(var r of t){var i=an(r,F0),[a,s]=Y.edges(r),o=[],l=0,u=a.offset,d=s.offset;for(var h of n){var{length:p}=h.text,m=l;if(l+=p,u<=m&&l<=d){Object.assign(h,i),o.push(h);continue}if(u!==d&&(u===l||d===m)||u>l||d<m||d===m&&m!==0){o.push(h);continue}var v=h,f=void 0,b=void 0;if(d<l){var g=d-m;b=en(en({},v),{},{text:v.text.slice(g)}),v=en(en({},v),{},{text:v.text.slice(0,g)})}if(u>m){var D=u-m;f=en(en({},v),{},{text:v.text.slice(0,D)}),v=en(en({},v),{},{text:v.text.slice(D)})}Object.assign(v,i),f&&o.push(f),o.push(v),b&&o.push(b)}n=o}return n}},Po=e=>e.selection?e.selection:e.children.length>0?x.end(e,[]):[0],gr=(e,t)=>{var[n]=x.node(e,t);return r=>r===n},Mo=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,i=n?O0(t):t,a=_e.None,s=_e.None,o=0,l=null,u=null;for(var d of i){var h=d.codePointAt(0);if(!h)break;var p=V0(d,h);if([a,s]=r?[s,p]:[p,a],Qn(a,_e.ZWJ)&&Qn(s,_e.ExtPict)&&(r?l=Dl(t.substring(0,o)):l=Dl(t.substring(0,t.length-o)),!l)||Qn(a,_e.RI)&&Qn(s,_e.RI)&&(u!==null?u=!u:r?u=!0:u=G0(t.substring(0,t.length-o)),!u)||a!==_e.None&&s!==_e.None&&K0(a,s))break;o+=d.length}return o||1},A0=/\s/,B0=/[\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]/,T0=/['\u2018\u2019]/,S0=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,i=!1;t.length>0;){var a=Mo(t,n),[s,o]=No(t,a,n);if(j0(s,o,n))i=!0,r+=a;else if(!i)r+=a;else break;t=o}return r},No=(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)]},j0=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(A0.test(t))return!1;if(T0.test(t)){var i=Mo(n,r),[a,s]=No(n,i,r);if(e(a,s,r))return!0}return!B0.test(t)},O0=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var i=t.charAt(n-r);if(M0(i.charCodeAt(0))){var a=t.charAt(n-r-1);if(P0(a.charCodeAt(0))){yield a+i,r++;continue}}yield i}},P0=e=>e>=55296&&e<=56319,M0=e=>e>=56320&&e<=57343,_e;(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"})(_e||(_e={}));var N0=/^(?:[\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])$/,I0=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,R0=/^(?:[\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])$/,$0=/^[\u1100-\u115F\uA960-\uA97C]$/,L0=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,z0=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,q0=/^[\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]$/,U0=/^[\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]$/,W0=/^(?:[\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])$/,V0=(e,t)=>{var n=_e.Any;return e.search(N0)!==-1&&(n|=_e.Extend),t===8205&&(n|=_e.ZWJ),t>=127462&&t<=127487&&(n|=_e.RI),e.search(I0)!==-1&&(n|=_e.Prepend),e.search(R0)!==-1&&(n|=_e.SpacingMark),e.search($0)!==-1&&(n|=_e.L),e.search(L0)!==-1&&(n|=_e.V),e.search(z0)!==-1&&(n|=_e.T),e.search(q0)!==-1&&(n|=_e.LV),e.search(U0)!==-1&&(n|=_e.LVT),e.search(W0)!==-1&&(n|=_e.ExtPict),n};function Qn(e,t){return(e&t)!==0}var H0=[[_e.L,_e.L|_e.V|_e.LV|_e.LVT],[_e.LV|_e.V,_e.V|_e.T],[_e.LVT|_e.T,_e.T],[_e.Any,_e.Extend|_e.ZWJ],[_e.Any,_e.SpacingMark],[_e.Prepend,_e.Any],[_e.ZWJ,_e.ExtPict],[_e.RI,_e.RI]];function K0(e,t){return H0.findIndex(n=>Qn(e,n[0])&&Qn(t,n[1]))===-1}var Z0=/(?:[\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$/,Dl=e=>e.search(Z0)!==-1,Y0=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,G0=e=>{var t=e.match(Y0);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:i=Po(e)}=n;if(I.isPath(i)&&(i=x.range(e,i)),Y.isRange(i))if(Y.isCollapsed(i))i=i.anchor;else{var a=Y.end(i);if(!r&&x.void(e,{at:a}))return;var s=Y.start(i),o=x.pointRef(e,s),l=x.pointRef(e,a);X.delete(e,{at:i,voids:r});var u=o.unref(),d=l.unref();i=u||d,X.setSelection(e,{anchor:i,focus:i})}if(!(!r&&x.void(e,{at:i})||x.elementReadOnly(e,{at:i}))){var{path:h,offset:p}=i;t.length>0&&e.apply({type:"insert_text",path:h,offset:p,text:t})}})}};function El(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function pi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?El(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):El(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var X=pi(pi(pi(pi({},g0),v0),b0),Q0),Si=new WeakMap,J0=e=>Si.get(e)||!1,X0=(e,t,n)=>{var r=Si.get(e)||!1;Si.set(e,!0);try{t(),n()}finally{Si.set(e,r)}};function Nf(e,t,n){var r=Ji.get(e)||[],i=Xi.get(e)||new Set,a,s,o=h=>{if(h){var p=h.join(",");s.has(p)||(s.add(p),a.push(h))}};if(n){a=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else a=r,s=i;for(var d of t)o(d);Ji.set(e,a),Xi.set(e,s)}var ey=(e,t)=>{for(var n of x.pathRefs(e))c0.transform(n,t);for(var r of x.pointRefs(e))d0.transform(r,t);for(var i of x.rangeRefs(e))f0.transform(i,t);if(!J0(e)){var a=I.operationCanTransformPath(t)?s=>I.transform(s,t):void 0;Nf(e,e.getDirtyPaths(t),a)}X.transform(e,t),e.operations.push(t),x.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),Or.get(e)||(Or.set(e,!0),Promise.resolve().then(()=>{Or.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},ty=(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:i}=t,a=I.levels(i),s=ge.isText(r)?[]:Array.from(le.nodes(r),z=>{var[,$]=z;return i.concat($)});return[...a,...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:h}=t;if(I.equals(d,h))return[];var p=[],m=[];for(var v of I.ancestors(d)){var f=I.transform(v,t);p.push(f)}for(var b of I.ancestors(h)){var g=I.transform(b,t);m.push(g)}var D=m[m.length-1],w=h[h.length-1],F=D.concat(w);return[...p,...m,F]}case"remove_node":{var{path:E}=t,k=I.ancestors(E);return[...k]}case"split_node":{var{path:T}=t,R=I.levels(T),P=I.next(T);return[...R,P]}default:return[]}},ny=e=>{var{selection:t}=e;return t?le.fragment(e,t):[]},ry=(e,t)=>{var[n,r]=t;if(!ge.isText(n)){if(fe.isElement(n)&&n.children.length===0){var i={text:""};X.insertNodes(e,i,{at:r.concat(0),voids:!0});return}for(var a=x.isEditor(n)?!1:fe.isElement(n)&&(e.isInline(n)||n.children.length===0||ge.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=le.get(e,r);if(!ge.isText(l)){var u=l.children[s],d=l.children[s-1],h=o===n.children.length-1,p=ge.isText(u)||fe.isElement(u)&&e.isInline(u);if(p!==a)X.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(fe.isElement(u)){if(e.isInline(u)){if(d==null||!ge.isText(d)){var m={text:""};X.insertNodes(e,m,{at:r.concat(s),voids:!0}),s++}else if(h){var v={text:""};X.insertNodes(e,v,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&ge.isText(d)&&(ge.equals(u,d,{loose:!0})?(X.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(X.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(X.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},iy=(e,t)=>{var{iteration:n,initialDirtyPathsLength:r}=t,i=r*42;if(n>i)throw new Error("Could not completely normalize the editor after ".concat(i," iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state."));return!0},ay=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:i="lowest",at:a=t.selection,match:s}=n;if(a){var o=x.path(t,a),l=i==="lowest";for(var[u,d]of x.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!ge.isText(u)){if(Y.isRange(a)){if(I.isAncestor(d,a.anchor.path)&&I.isAncestor(d,a.focus.path))return[u,d]}else if(!I.equals(o,d))return[u,d]}}};function _l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function 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){pt(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 sy=(e,t,n)=>{var{selection:r}=e;if(r){var i=(h,p)=>{if(!ge.isText(h))return!1;var[m,v]=x.parent(e,p);return!e.isVoid(m)||e.markableVoid(m)},a=Y.isExpanded(r),s=!1;if(!a){var[o,l]=x.node(e,r);if(o&&i(o,l)){var[u]=x.parent(e,l);s=u&&e.markableVoid(u)}}if(a||s)X.setNodes(e,{[t]:n},{match:i,split:!0,voids:!0});else{var d=kl(kl({},x.marks(e)||{}),{},{[t]:n});e.marks=d,Or.get(e)||e.onChange()}}};function Fl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function 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){pt(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 oy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=x.point(t,n,{edge:"end"}),a=x.end(t,[]),s={anchor:i,focus:a},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,Al(Al({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};function Bl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function 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){pt(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 uy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=x.start(t,[]),a=x.point(t,n,{edge:"start"}),s={anchor:i,focus:a},{distance:o=1}=r,l=0,u;for(var d of x.positions(t,Tl(Tl({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},ly=(e,t)=>{var{selection:n}=e;n&&Y.isCollapsed(n)&&X.delete(e,{unit:t,reverse:!0})},cy=(e,t)=>{var{selection:n}=e;n&&Y.isCollapsed(n)&&X.delete(e,{unit:t})},dy=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&Y.isExpanded(r)&&X.delete(t,{reverse:n==="backward"})},fy=(e,t)=>[x.start(e,t),x.end(e,t)];function Sl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function 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){pt(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 hy=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.isElementReadOnly(t,r)}))},my=(e,t)=>x.point(e,t,{edge:"end"}),py=(e,t)=>{var n=x.path(e,t,{edge:"start"});return x.node(e,n)},gy=(e,t)=>{var n=x.range(e,t);return le.fragment(e,n)};function Ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Pl(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){pt(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){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return x.above(t,Pl(Pl({},n),{},{match:r=>fe.isElement(r)&&x.isVoid(t,r)}))},by=(e,t)=>t.children.some(n=>fe.isElement(n)&&x.isBlock(e,n)),yy=(e,t)=>t.children.some(n=>ge.isText(n)||x.isInline(e,n)),xy=(e,t)=>le.has(e,t),Cy=(e,t)=>t.children.every(n=>ge.isText(n)),wy=e=>{X.splitNodes(e,{always:!0})},Dy=(e,t,n)=>{X.insertNodes(e,t,n)},Ey=e=>{X.splitNodes(e,{always:!0})};function Ml(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _y(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){pt(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 ky=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:i,marks:a}=t;if(i){if(a){var s=_y({text:n},a);X.insertNodes(t,s,{at:r.at,voids:r.voids})}else X.insertText(t,n,r);t.marks=null}},Fy=(e,t)=>!e.isInline(t),Ay=(e,t,n)=>x.isStart(e,t,n)||x.isEnd(e,t,n),By=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&ge.isText(r)&&r.text===""&&!e.isVoid(t)},Ty=(e,t,n)=>{var r=x.end(e,n);return Te.equals(t,r)},Sy=e=>{var t=Pf.get(e);return t===void 0?!0:t},jy=(e,t,n)=>{if(t.offset!==0)return!1;var r=x.start(e,n);return Te.equals(t,r)},Oy=(e,t)=>{var n=x.path(e,t,{edge:"end"});return x.node(e,n)},Py=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=x.path(t,n,r),a=le.leaf(t,i);return[a,i]};function My(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:i=!1}=t,{match:a}=t;if(a==null&&(a=()=>!0),!!n){var s=[],o=x.path(e,n);for(var[l,u]of le.levels(e,o))if(a(l,u)&&(s.push([l,u]),!i&&fe.isElement(l)&&x.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var Ny=["text"],Iy=["text"],Ry=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:i,focus:a}=r;if(n)return n;if(Y.isExpanded(r)){var s=x.isEnd(t,i,i.path);if(s){var o=x.after(t,i);o&&(i=o)}var[l]=x.nodes(t,{match:ge.isText,at:{anchor:i,focus:a}});if(l){var[u]=l,d=an(u,Ny);return d}else return{}}var{path:h}=i,[p]=x.leaf(t,h);if(i.offset===0){var m=x.previous(t,{at:h,match:ge.isText}),v=x.above(t,{match:F=>fe.isElement(F)&&x.isVoid(t,F)&&t.markableVoid(F)});if(!v){var f=x.above(t,{match:F=>fe.isElement(F)&&x.isBlock(t,F)});if(m&&f){var[b,g]=m,[,D]=f;I.isAncestor(D,g)&&(p=b)}}}var w=an(p,Iy);return w},$y=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:i=!1}=n,{match:a,at:s=t.selection}=n;if(s){var o=x.after(t,s,{voids:i});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(a==null)if(I.isPath(s)){var[d]=x.parent(t,s);a=p=>d.children.includes(p)}else a=()=>!0;var[h]=x.nodes(t,{at:u,match:a,mode:r,voids:i});return h}}},Ly=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=x.path(t,n,r),a=le.get(t,i);return[a,i]};function zy(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:i=!1,reverse:a=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,d;if(_0.isSpan(n))u=n[0],d=n[1];else{var h=x.path(e,n,{edge:"start"}),p=x.path(e,n,{edge:"end"});u=a?p:h,d=a?h:p}var m=le.nodes(e,{reverse:a,from:u,to:d,pass:F=>{var[E]=F;return fe.isElement(E)?!!(!s&&(x.isVoid(e,E)||x.isElementReadOnly(e,E))||o&&!x.isSelectable(e,E)):!1}}),v=[],f;for(var[b,g]of m)if(!(o&&fe.isElement(b)&&!x.isSelectable(e,b))){var D=f&&I.compare(g,f[1])===0;if(!(r==="highest"&&D)){if(!l(b,g)){if(i&&!D&&ge.isText(b))return;continue}if(r==="lowest"&&D){f=[b,g];continue}var w=r==="lowest"?f:[b,g];w&&(i?v.push(w):yield w),f=[b,g]}}r==="lowest"&&f&&(i?v.push(f):yield f),i&&(yield*v)}}()}var qy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:i}=n,a=d=>Ji.get(d)||[],s=d=>Xi.get(d)||new Set,o=d=>{var h=a(d).pop(),p=h.join(",");return s(d).delete(p),h};if(x.isNormalizing(t)){if(r){var l=Array.from(le.nodes(t),d=>{var[,h]=d;return h}),u=new Set(l.map(d=>d.join(",")));Ji.set(t,l),Xi.set(t,u)}a(t).length!==0&&x.withoutNormalizing(t,()=>{for(var d of a(t))if(le.has(t,d)){var h=x.node(t,d),[p,m]=h;fe.isElement(p)&&p.children.length===0&&t.normalizeNode(h,{operation:i})}for(var v=a(t),f=v.length,b=0;v.length!==0;){if(!t.shouldNormalize({dirtyPaths:v,iteration:b,initialDirtyPathsLength:f,operation:i}))return;var g=o(t);if(le.has(t,g)){var D=x.node(t,g);t.normalizeNode(D,{operation:i})}b++,v=a(t)}})}},Uy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=x.path(t,n,r),a=I.parent(i),s=x.node(t,a);return s},Wy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:i="forward"}=r,a={current:n,affinity:i,unref(){var{current:o}=a,l=x.pathRefs(t);return l.delete(a),a.current=null,o}},s=x.pathRefs(t);return s.add(a),a},Vy=e=>{var t=cl.get(e);return t||(t=new Set,cl.set(e,t)),t},Hy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:i,edge:a}=r;if(I.isPath(n)){if(a==="start"){var[,s]=le.first(t,n);n=s}else if(a==="end"){var[,o]=le.last(t,n);n=o}}return Y.isRange(n)&&(a==="start"?n=Y.start(n):a==="end"?n=Y.end(n):n=I.common(n.anchor.path,n.focus.path)),Te.isPoint(n)&&(n=n.path),i!=null&&(n=n.slice(0,i)),n},Ky=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:i="forward"}=r,a={current:n,affinity:i,unref(){var{current:o}=a,l=x.pointRefs(t);return l.delete(a),a.current=null,o}},s=x.pointRefs(t);return s.add(a),a},Zy=e=>{var t=dl.get(e);return t||(t=new Set,dl.set(e,t)),t},Yy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:i="start"}=r;if(I.isPath(n)){var a;if(i==="end"){var[,s]=le.last(t,n);a=s}else{var[,o]=le.first(t,n);a=o}var l=le.get(t,a);if(!ge.isText(l))throw new Error("Cannot get the ".concat(i," point in the node at path [").concat(n,"] because it has no ").concat(i," text node."));return{path:a,offset:i==="end"?l.text.length:0}}if(Y.isRange(n)){var[u,d]=Y.edges(n);return i==="start"?u:d}return n};function Gy(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:i=!1,voids:a=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=x.range(e,n),[l,u]=Y.edges(o),d=i?u:l,h=!1,p="",m=0,v=0,f=0;for(var[b,g]of x.nodes(e,{at:n,reverse:i,voids:a,ignoreNonSelectable:s})){if(fe.isElement(b)){if(!a&&(e.isVoid(b)||e.isElementReadOnly(b))){yield x.start(e,g);continue}if(e.isInline(b))continue;if(x.hasInlines(e,b)){var D=I.isAncestor(g,u.path)?u:x.end(e,g),w=I.isAncestor(g,l.path)?l:x.start(e,g);p=x.string(e,{anchor:w,focus:D},{voids:a}),h=!0}}if(ge.isText(b)){var F=I.equals(g,d.path);for(F?(v=i?d.offset:b.text.length-d.offset,f=d.offset):(v=b.text.length,f=i?v:0),(F||h||r==="offset")&&(yield{path:g,offset:f},h=!1);;){if(m===0){if(p==="")break;m=E(p,r,i),p=No(p,m,i)[1]}if(f=i?f-m:f+m,v=v-m,v<0){m=-v;break}m=0,yield{path:g,offset:f}}}}function E(k,T,R){return T==="character"?Mo(k,R):T==="word"?S0(k,R):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:i=!1}=n,{match:a,at:s=t.selection}=n;if(s){var o=x.before(t,s,{voids:i});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(a==null)if(I.isPath(s)){var[d]=x.parent(t,s);a=p=>d.children.includes(p)}else a=()=>!0;var[h]=x.nodes(t,{reverse:!0,at:u,match:a,mode:r,voids:i});return h}}},Jy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:i="forward"}=r,a={current:n,affinity:i,unref(){var{current:o}=a,l=x.rangeRefs(t);return l.delete(a),a.current=null,o}},s=x.rangeRefs(t);return s.add(a),a},Xy=e=>{var t=fl.get(e);return t||(t=new Set,fl.set(e,t)),t},ex=(e,t,n)=>{if(Y.isRange(t)&&!n)return t;var r=x.start(e,t),i=x.end(e,n||t);return{anchor:r,focus:i}};function Nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tx(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nl(Object(n),!0).forEach(function(r){pt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var nx=(e,t)=>{var{selection:n}=e;if(n){var r=(d,h)=>{if(!ge.isText(d))return!1;var[p,m]=x.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},i=Y.isExpanded(n),a=!1;if(!i){var[s,o]=x.node(e,n);if(s&&r(s,o)){var[l]=x.parent(e,o);a=l&&e.markableVoid(l)}}if(i||a)X.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=tx({},x.marks(e)||{});delete u[t],e.marks=u,Or.get(e)||e.onChange()}}},rx=(e,t)=>{Pf.set(e,t)},ix=(e,t)=>x.point(e,t,{edge:"start"}),ax=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:i=!1}=r,a=x.range(t,n),[s,o]=Y.edges(a),l="";for(var[u,d]of x.nodes(t,{at:a,match:ge.isText,voids:i})){var h=u.text;I.equals(d,o.path)&&(h=h.slice(0,o.offset)),I.equals(d,s.path)&&(h=h.slice(s.offset)),l+=h}return l},sx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:i=!1}=r,[a,s]=Y.edges(n);if(a.offset!==0||s.offset!==0||Y.isCollapsed(n)||I.hasPrevious(s.path))return n;var o=x.above(t,{at:s,match:v=>fe.isElement(v)&&x.isBlock(t,v),voids:i}),l=o?o[1]:[],u=x.start(t,a),d={anchor:u,focus:s},h=!0;for(var[p,m]of x.nodes(t,{at:d,match:ge.isText,reverse:!0,voids:i})){if(h){h=!1;continue}if(p.text!==""||I.isBefore(m,l)){s={path:m,offset:p.text.length};break}}return{anchor:a,focus:s}},ox=(e,t)=>{var n=x.isNormalizing(e);x.setNormalizing(e,!1);try{t()}finally{x.setNormalizing(e,n)}x.normalize(e)},ux=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var r,i,{reverse:a=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:d=!1}=n;if(u){var h=!1;if(Y.isRange(u)&&Y.isCollapsed(u)&&(h=!0,u=u.anchor),Te.isPoint(u)){var p=x.void(t,{at:u,mode:"highest"});if(!l&&p){var[,m]=p;u=m}else{var v={unit:s,distance:o},f=a?x.before(t,u,v)||x.start(t,[]):x.after(t,u,v)||x.end(t,[]);u={anchor:u,focus:f},d=!0}}if(I.isPath(u)){X.removeNodes(t,{at:u,voids:l});return}if(!Y.isCollapsed(u)){if(!d){var[,b]=Y.edges(u),g=x.end(t,[]);Te.equals(b,g)||(u=x.unhangRange(t,u,{voids:l}))}var[D,w]=Y.edges(u),F=x.above(t,{match:ve=>fe.isElement(ve)&&x.isBlock(t,ve),at:D,voids:l}),E=x.above(t,{match:ve=>fe.isElement(ve)&&x.isBlock(t,ve),at:w,voids:l}),k=F&&E&&!I.equals(F[1],E[1]),T=I.equals(D.path,w.path),R=l?null:(r=x.void(t,{at:D,mode:"highest"}))!==null&&r!==void 0?r:x.elementReadOnly(t,{at:D,mode:"highest"}),P=l?null:(i=x.void(t,{at:w,mode:"highest"}))!==null&&i!==void 0?i:x.elementReadOnly(t,{at:w,mode:"highest"});if(R){var z=x.before(t,D);z&&F&&I.isAncestor(F[1],z.path)&&(D=z)}if(P){var $=x.after(t,w);$&&E&&I.isAncestor(E[1],$.path)&&(w=$)}var B=[],A;for(var j of x.nodes(t,{at:u,voids:l})){var[M,U]=j;A&&I.compare(U,A)===0||(!l&&fe.isElement(M)&&(x.isVoid(t,M)||x.isElementReadOnly(t,M))||!I.isCommon(U,D.path)&&!I.isCommon(U,w.path))&&(B.push(j),A=U)}var W=Array.from(B,ve=>{var[,Ee]=ve;return x.pathRef(t,Ee)}),ie=x.pointRef(t,D),ae=x.pointRef(t,w),C="";if(!T&&!R){var G=ie.current,[ne]=x.leaf(t,G),{path:_}=G,{offset:O}=D,q=ne.text.slice(O);q.length>0&&(t.apply({type:"remove_text",path:_,offset:O,text:q}),C=q)}if(W.reverse().map(ve=>ve.unref()).filter(ve=>ve!==null).forEach(ve=>X.removeNodes(t,{at:ve,voids:l})),!P){var S=ae.current,[L]=x.leaf(t,S),{path:Q}=S,K=T?D.offset:0,J=L.text.slice(K,w.offset);J.length>0&&(t.apply({type:"remove_text",path:Q,offset:K,text:J}),C=J)}!T&&k&&ae.current&&ie.current&&X.mergeNodes(t,{at:ae.current,hanging:!0,voids:l}),h&&a&&s==="character"&&C.length>1&&C.match(/[\u0E00-\u0E7F]+/)&&X.insertText(t,C.slice(0,C.length-o));var ce=ie.unref(),ee=ae.unref(),pe=a?ce||ee:ee||ce;n.at==null&&pe&&X.select(t,pe)}}})},lx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:i=!1,voids:a=!1}=r,{at:s=Po(t),batchDirty:o=!0}=r;if(n.length){if(Y.isRange(s))if(i||(s=x.unhangRange(t,s,{voids:a})),Y.isCollapsed(s))s=s.anchor;else{var[,l]=Y.edges(s);if(!a&&x.void(t,{at:l}))return;var u=x.pointRef(t,l);X.delete(t,{at:s}),s=u.unref()}else I.isPath(s)&&(s=x.start(t,s));if(!(!a&&x.void(t,{at:s}))){var d=x.above(t,{at:s,match:q=>fe.isElement(q)&&x.isInline(t,q),mode:"highest",voids:a});if(d){var[,h]=d;if(x.isEnd(t,s,h)){var p=x.after(t,h);s=p}else if(x.isStart(t,s,h)){var m=x.before(t,h);s=m}}var v=x.above(t,{match:q=>fe.isElement(q)&&x.isBlock(t,q),at:s,voids:a}),[,f]=v,b=x.isStart(t,s,f),g=x.isEnd(t,s,f),D=b&&g,w=!b||b&&g,F=!g,[,E]=le.first({children:n},[]),[,k]=le.last({children:n},[]),T=[],R=q=>{var[S,L]=q,Q=L.length===0;return Q?!1:D?!0:!(w&&I.isAncestor(L,E)&&fe.isElement(S)&&!t.isVoid(S)&&!t.isInline(S)||F&&I.isAncestor(L,k)&&fe.isElement(S)&&!t.isVoid(S)&&!t.isInline(S))};for(var P of le.nodes({children:n},{pass:R}))R(P)&&T.push(P);var z=[],$=[],B=[],A=!0,j=!1;for(var[M]of T)fe.isElement(M)&&!t.isInline(M)?(A=!1,j=!0,$.push(M)):A?z.push(M):B.push(M);var[U]=x.nodes(t,{at:s,match:q=>ge.isText(q)||x.isInline(t,q),mode:"highest",voids:a}),[,W]=U,ie=x.isStart(t,s,W),ae=x.isEnd(t,s,W),C=x.pathRef(t,g&&!B.length?I.next(f):f),G=x.pathRef(t,ae?I.next(W):W);X.splitNodes(t,{at:s,match:q=>j?fe.isElement(q)&&x.isBlock(t,q):ge.isText(q)||x.isInline(t,q),mode:j?"lowest":"highest",always:j&&(!b||z.length>0)&&(!g||B.length>0),voids:a});var ne=x.pathRef(t,!ie||ie&&ae?I.next(W):W);if(X.insertNodes(t,z,{at:ne.current,match:q=>ge.isText(q)||x.isInline(t,q),mode:"highest",voids:a,batchDirty:o}),D&&!z.length&&$.length&&!B.length&&X.delete(t,{at:f,voids:a}),X.insertNodes(t,$,{at:C.current,match:q=>fe.isElement(q)&&x.isBlock(t,q),mode:"lowest",voids:a,batchDirty:o}),X.insertNodes(t,B,{at:G.current,match:q=>ge.isText(q)||x.isInline(t,q),mode:"highest",voids:a,batchDirty:o}),!r.at){var _;if(B.length>0&&G.current?_=I.previous(G.current):$.length>0&&C.current?_=I.previous(C.current):ne.current&&(_=I.previous(ne.current)),_){var O=x.end(t,_);X.select(t,O)}}ne.unref(),C.unref(),G.unref()}}})},cx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:i}=t;if(i){if(r==="anchor")X.select(t,i.anchor);else if(r==="focus")X.select(t,i.focus);else if(r==="start"){var[a]=Y.edges(i);X.select(t,a)}else if(r==="end"){var[,s]=Y.edges(i);X.select(t,s)}}else return},dx=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},fx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:i=1,unit:a="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=Y.isBackward(r)?"focus":"anchor"),o==="end"&&(o=Y.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:i,unit:a,ignoreNonSelectable:!0},h={};if(o==null||o==="anchor"){var p=s?x.before(t,l,d):x.after(t,l,d);p&&(h.anchor=p)}if(o==null||o==="focus"){var m=s?x.before(t,u,d):x.after(t,u,d);m&&(h.focus=m)}X.setSelection(t,h)}},hx=(e,t)=>{var{selection:n}=e;if(t=x.range(e,t),n){X.setSelection(e,t);return}if(!Y.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(it.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function Il(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function 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){pt(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 mx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:i}=t,{edge:a="both"}=r;if(i){a==="start"&&(a=Y.isBackward(i)?"focus":"anchor"),a==="end"&&(a=Y.isBackward(i)?"anchor":"focus");var{anchor:s,focus:o}=i,l=a==="anchor"?s:o;X.setSelection(t,{[a==="anchor"?"anchor":"focus"]:Rl(Rl({},l),n)})}},px=(e,t)=>{var{selection:n}=e,r={},i={};if(n){for(var a in t)(a==="anchor"&&t.anchor!=null&&!Te.equals(t.anchor,n.anchor)||a==="focus"&&t.focus!=null&&!Te.equals(t.focus,n.focus)||a!=="anchor"&&a!=="focus"&&t[a]!==n[a])&&(r[a]=n[a],i[a]=t[a]);Object.keys(r).length>0&&e.apply({type:"set_selection",properties:r,newProperties:i})}},gx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{hanging:i=!1,voids:a=!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[h]=n;if(l||(l=Po(t),d!==!1&&(d=!0)),d==null&&(d=!1),Y.isRange(l))if(i||(l=x.unhangRange(t,l,{voids:a})),Y.isCollapsed(l))l=l.anchor;else{var[,p]=Y.edges(l),m=x.pointRef(t,p);X.delete(t,{at:l}),l=m.unref()}if(Te.isPoint(l)){u==null&&(ge.isText(h)?u=z=>ge.isText(z):t.isInline(h)?u=z=>ge.isText(z)||x.isInline(t,z):u=z=>fe.isElement(z)&&x.isBlock(t,z));var[v]=x.nodes(t,{at:l.path,match:u,mode:s,voids:a});if(v){var[,f]=v,b=x.pathRef(t,f),g=x.isEnd(t,l,f);X.splitNodes(t,{at:l,match:u,mode:s,voids:a});var D=b.unref();l=g?I.next(D):D}else return}var w=I.parent(l),F=l[l.length-1];if(!(!a&&x.void(t,{at:w}))){if(o){var E=[],k=I.levels(w);X0(t,()=>{var z=function(){var A=w.concat(F);F++;var j={type:"insert_node",path:A,node:$};t.apply(j),l=I.next(l),E.push(j),ge.isText?k.push(...Array.from(le.nodes($),M=>{var[,U]=M;return A.concat(U)})):k.push(A)};for(var $ of n)z()},()=>{Nf(t,k,z=>{var $=z;for(var B of E)if(I.operationCanTransformPath(B)&&($=I.transform($,B),!$))return null;return $})})}else for(var T of n){var R=w.concat(F);F++,t.apply({type:"insert_node",path:R,node:T}),l=I.next(l)}if(l=I.previous(l),d){var P=x.end(t,l);P&&X.select(t,P)}}}})},vx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:i="lowest",voids:a=!1}=n,{match:s}=n;if(s==null&&(s=I.isPath(r)?gr(t,r):F=>fe.isElement(F)&&x.isBlock(t,F)),!!r){var o=x.nodes(t,{at:r,match:s,mode:i,voids:a}),l=Array.from(o,F=>{var[,E]=F;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 h=x.node(t,I.parent(d)),[p,m]=h,v=d[d.length-1],{length:f}=p.children;if(f===1){var b=I.next(m);X.moveNodes(t,{at:d,to:b,voids:a}),X.removeNodes(t,{at:m,voids:a})}else if(v===0)X.moveNodes(t,{at:d,to:m,voids:a});else if(v===f-1){var g=I.next(m);X.moveNodes(t,{at:d,to:g,voids:a})}else{var D=I.next(d),w=I.next(m);X.splitNodes(t,{at:D,voids:a}),X.moveNodes(t,{at:d,to:w,voids:a})}}}})},bx=["text"],yx=["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)},xx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{match:r,at:i=t.selection}=n,{hanging:a=!1,voids:s=!1,mode:o="lowest"}=n;if(i){if(r==null)if(I.isPath(i)){var[l]=x.parent(t,i);r=z=>l.children.includes(z)}else r=z=>fe.isElement(z)&&x.isBlock(t,z);if(!a&&Y.isRange(i)&&(i=x.unhangRange(t,i,{voids:s})),Y.isRange(i))if(Y.isCollapsed(i))i=i.anchor;else{var[,u]=Y.edges(i),d=x.pointRef(t,u);X.delete(t,{at:i}),i=d.unref(),n.at==null&&X.select(t,i)}var[h]=x.nodes(t,{at:i,match:r,voids:s,mode:o}),p=x.previous(t,{at:i,match:r,voids:s,mode:o});if(!(!h||!p)){var[m,v]=h,[f,b]=p;if(!(v.length===0||b.length===0)){var g=I.next(b),D=I.common(v,b),w=I.isSibling(v,b),F=Array.from(x.levels(t,{at:v}),z=>{var[$]=z;return $}).slice(D.length).slice(0,-1),E=x.above(t,{at:v,mode:"highest",match:z=>F.includes(z)&&If(t,z)}),k=E&&x.pathRef(t,E[1]),T,R;if(ge.isText(m)&&ge.isText(f)){var P=an(m,bx);R=f.text.length,T=P}else if(fe.isElement(m)&&fe.isElement(f)){var P=an(m,yx);R=f.children.length,T=P}else throw new Error("Cannot merge the node at path [".concat(v,"] with the previous sibling because it is not the same kind: ").concat(it.stringify(m)," ").concat(it.stringify(f)));w||X.moveNodes(t,{at:v,to:g,voids:s}),k&&X.removeNodes(t,{at:k.current,voids:s}),fe.isElement(f)&&x.isEmpty(t,f)||ge.isText(f)&&f.text===""&&b[b.length-1]!==0?X.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:g,position:R,properties:T}),k&&k.unref()}}}})},Cx=(e,t)=>{x.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:i="lowest",voids:a=!1}=t,{match:s}=t;if(r){s==null&&(s=I.isPath(r)?gr(e,r):m=>fe.isElement(m)&&x.isBlock(e,m));var o=x.pathRef(e,n),l=x.nodes(e,{at:r,match:s,mode:i,voids:a}),u=Array.from(l,m=>{var[,v]=m;return x.pathRef(e,v)});for(var d of u){var h=d.unref(),p=o.current;h.length!==0&&e.apply({type:"move_node",path:h,newPath:p}),o.current&&I.isSibling(p,h)&&I.isAfter(p,h)&&(o.current=I.next(o.current))}o.unref()}})},wx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:i=!1,mode:a="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=I.isPath(s)?gr(t,s):m=>fe.isElement(m)&&x.isBlock(t,m)),!r&&Y.isRange(s)&&(s=x.unhangRange(t,s,{voids:i}));var l=x.nodes(t,{at:s,match:o,mode:a,voids:i}),u=Array.from(l,m=>{var[,v]=m;return x.pathRef(t,v)});for(var d of u){var h=d.unref();if(h){var[p]=x.node(t,h);t.apply({type:"remove_node",path:h,node:p})}}}})},Dx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{match:i,at:a=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:d=!1,voids:h=!1}=r;if(a){if(i==null&&(i=I.isPath(a)?gr(t,a):R=>fe.isElement(R)&&x.isBlock(t,R)),!l&&Y.isRange(a)&&(a=x.unhangRange(t,a,{voids:h})),d&&Y.isRange(a)){if(Y.isCollapsed(a)&&x.leaf(t,a.anchor)[0].text.length>0)return;var p=x.rangeRef(t,a,{affinity:"inward"}),[m,v]=Y.edges(a),f=u==="lowest"?"lowest":"highest",b=x.isEnd(t,v,v.path);X.splitNodes(t,{at:v,match:i,mode:f,voids:h,always:!b});var g=x.isStart(t,m,m.path);X.splitNodes(t,{at:m,match:i,mode:f,voids:h,always:!g}),a=p.unref(),r.at==null&&X.select(t,a)}s||(s=(R,P)=>R!==P);for(var[D,w]of x.nodes(t,{at:a,match:i,mode:u,voids:h})){var F={},E={};if(w.length!==0){var k=!1;for(var T in n)T==="children"||T==="text"||s(n[T],D[T])&&(k=!0,D.hasOwnProperty(T)&&(F[T]=D[T]),o?n[T]!=null&&(E[T]=o(D[T],n[T])):n[T]!=null&&(E[T]=n[T]));k&&t.apply({type:"set_node",path:w,properties:F,newProperties:E})}}}})},Ex=(e,t)=>{if(Y.isCollapsed(t))return t.anchor;var[,n]=Y.edges(t),r=x.pointRef(e,n);return X.delete(e,{at:t}),r.unref()},_x=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:i=!1}=n,{match:a,at:s=t.selection,height:o=0,always:l=!1}=n;if(a==null&&(a=ae=>fe.isElement(ae)&&x.isBlock(t,ae)),Y.isRange(s)&&(s=Ex(t,s)),I.isPath(s)){var u=s,d=x.point(t,u),[h]=x.parent(t,u);a=ae=>ae===h,o=d.path.length-u.length+1,s=d,l=!0}if(s){var p=x.pointRef(t,s,{affinity:"backward"}),m;try{var[v]=x.nodes(t,{at:s,match:a,mode:r,voids:i});if(!v)return;var f=x.void(t,{at:s,mode:"highest"}),b=0;if(!i&&f){var[g,D]=f;if(fe.isElement(g)&&t.isInline(g)){var w=x.after(t,D);if(!w){var F={text:""},E=I.next(D);X.insertNodes(t,F,{at:E,voids:i}),w=x.point(t,E)}s=w,l=!0}var k=s.path.length-D.length;o=k+1,l=!0}m=x.pointRef(t,s);var T=s.path.length-o,[,R]=v,P=s.path.slice(0,T),z=o===0?s.offset:s.path[T]+b;for(var[$,B]of x.levels(t,{at:P,reverse:!0,voids:i})){var A=!1;if(B.length<R.length||B.length===0||!i&&fe.isElement($)&&x.isVoid(t,$))break;var j=p.current,M=x.isEnd(t,j,B);if(l||!p||!x.isEdge(t,j,B)){A=!0;var U=le.extractProps($);t.apply({type:"split_node",path:B,position:z,properties:U})}z=B[B.length-1]+(A||M?1:0)}if(n.at==null){var W=m.current||x.end(t,[]);X.select(t,W)}}finally{var ie;p.unref(),(ie=m)===null||ie===void 0||ie.unref()}}})},kx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var i={};for(var a of n)i[a]=null;X.setNodes(t,i,r)},Fx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};x.withoutNormalizing(t,()=>{var{mode:r="lowest",split:i=!1,voids:a=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=I.isPath(s)?gr(t,s):m=>fe.isElement(m)&&x.isBlock(t,m)),I.isPath(s)&&(s=x.range(t,s));var l=Y.isRange(s)?x.rangeRef(t,s):null,u=x.nodes(t,{at:s,match:o,mode:r,voids:a}),d=Array.from(u,m=>{var[,v]=m;return x.pathRef(t,v)}).reverse(),h=function(){var v=p.unref(),[f]=x.node(t,v),b=x.range(t,v);i&&l&&(b=Y.intersection(l.current,b)),X.liftNodes(t,{at:b,match:g=>fe.isAncestor(f)&&f.children.includes(g),voids:a})};for(var p of d)h();l&&l.unref()}})};function $l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ll(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){pt(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 Ax=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};x.withoutNormalizing(t,()=>{var{mode:i="lowest",split:a=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(I.isPath(l)?o=gr(t,l):t.isInline(n)?o=b=>fe.isElement(b)&&x.isInline(t,b)||ge.isText(b):o=b=>fe.isElement(b)&&x.isBlock(t,b)),a&&Y.isRange(l)){var[u,d]=Y.edges(l),h=x.rangeRef(t,l,{affinity:"inward"});X.splitNodes(t,{at:d,match:o,voids:s}),X.splitNodes(t,{at:u,match:o,voids:s}),l=h.unref(),r.at==null&&X.select(t,l)}var p=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})),m=function(){var g=Y.isRange(l)?Y.intersection(l,x.range(t,f)):l;if(!g)return 0;var D=Array.from(x.nodes(t,{at:g,match:o,mode:i,voids:s}));if(D.length>0){var[w]=D,F=D[D.length-1],[,E]=w,[,k]=F;if(E.length===0&&k.length===0)return 0;var T=I.equals(E,k)?I.parent(E):I.common(E,k),R=x.range(t,E,k),P=x.node(t,T),[z]=P,$=T.length+1,B=I.next(k.slice(0,$)),A=Ll(Ll({},n),{},{children:[]});X.insertNodes(t,A,{at:B,voids:s}),X.moveNodes(t,{at:R,match:j=>fe.isAncestor(z)&&z.children.includes(j),to:B.concat(0),voids:s})}},v;for(var[,f]of p)v=m()}})},Bx=()=>{var e={children:[],operations:[],selection:null,marks:null,isElementReadOnly:()=>!1,isInline:()=>!1,isSelectable:()=>!0,isVoid:()=>!1,markableVoid:()=>!1,onChange:()=>{},apply:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ey(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return sy(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ly(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return cy(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return dy(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ny(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return wy(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ey(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return lx(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Dy(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ky(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ry(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return nx(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ty(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return iy(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ay(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return oy(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return uy(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return cx(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ux(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return dx(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return fy(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return hy(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return my(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return py(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return gy(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ry(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return by(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return yy(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return xy(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Cy(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return gx(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Fy(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ay(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return By(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ty(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Sy(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return jy(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Oy(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Py(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return My(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return vx(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return xx(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return fx(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Cx(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return $y(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ly(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return zy(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return qy(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Uy(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Hy(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Wy(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Vy(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Yy(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ky(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Zy(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Gy(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Qy(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ex(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Jy(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Xy(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return wx(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return hx(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Dx(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return rx(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return mx(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return px(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return _x(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ix(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ax(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return sx(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return kx(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Fx(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return vy(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ox(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ax(e,...r)}};return e},An=[],Tx=function(){return An.some(function(e){return e.activeTargets.length>0})},Sx=function(){return An.some(function(e){return e.skippedTargets.length>0})},zl="ResizeObserver loop completed with undelivered notifications.",jx=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:zl}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=zl),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 Bn=function(e){return Object.freeze(e)},Ox=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,Bn(this)}return e}(),Rf=function(){function e(t,n,r,i){return this.x=t,this.y=n,this.width=r,this.height=i,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Bn(this)}return e.prototype.toJSON=function(){var t=this,n=t.x,r=t.y,i=t.top,a=t.right,s=t.bottom,o=t.left,l=t.width,u=t.height;return{x:n,y:r,top:i,right:a,bottom:s,left:o,width:l,height:u}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),Io=function(e){return e instanceof SVGElement&&"getBBox"in e},$f=function(e){if(Io(e)){var t=e.getBBox(),n=t.width,r=t.height;return!n&&!r}var i=e,a=i.offsetWidth,s=i.offsetHeight;return!(a||s||e.getClientRects().length)},ql=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)},Px=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},Pr=typeof window<"u"?window:{},gi=new WeakMap,Ul=/auto|scroll/,Mx=/^tb|vertical/,Nx=/msie|trident/i.test(Pr.navigator&&Pr.navigator.userAgent),Ut=function(e){return parseFloat(e||"0")},nr=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new Ox((n?t:e)||0,(n?e:t)||0)},Wl=Bn({devicePixelContentBoxSize:nr(),borderBoxSize:nr(),contentBoxSize:nr(),contentRect:new Rf(0,0,0,0)}),Lf=function(e,t){if(t===void 0&&(t=!1),gi.has(e)&&!t)return gi.get(e);if($f(e))return gi.set(e,Wl),Wl;var n=getComputedStyle(e),r=Io(e)&&e.ownerSVGElement&&e.getBBox(),i=!Nx&&n.boxSizing==="border-box",a=Mx.test(n.writingMode||""),s=!r&&Ul.test(n.overflowY||""),o=!r&&Ul.test(n.overflowX||""),l=r?0:Ut(n.paddingTop),u=r?0:Ut(n.paddingRight),d=r?0:Ut(n.paddingBottom),h=r?0:Ut(n.paddingLeft),p=r?0:Ut(n.borderTopWidth),m=r?0:Ut(n.borderRightWidth),v=r?0:Ut(n.borderBottomWidth),f=r?0:Ut(n.borderLeftWidth),b=h+u,g=l+d,D=f+m,w=p+v,F=o?e.offsetHeight-w-e.clientHeight:0,E=s?e.offsetWidth-D-e.clientWidth:0,k=i?b+D:0,T=i?g+w:0,R=r?r.width:Ut(n.width)-k-E,P=r?r.height:Ut(n.height)-T-F,z=R+b+E+D,$=P+g+F+w,B=Bn({devicePixelContentBoxSize:nr(Math.round(R*devicePixelRatio),Math.round(P*devicePixelRatio),a),borderBoxSize:nr(z,$,a),contentBoxSize:nr(R,P,a),contentRect:new Rf(h,l,R,P)});return gi.set(e,B),B},zf=function(e,t,n){var r=Lf(e,n),i=r.borderBoxSize,a=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Hr.DEVICE_PIXEL_CONTENT_BOX:return s;case Hr.BORDER_BOX:return i;default:return a}},Ix=function(){function e(t){var n=Lf(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=Bn([n.borderBoxSize]),this.contentBoxSize=Bn([n.contentBoxSize]),this.devicePixelContentBoxSize=Bn([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},Rx=function(){var e=1/0,t=[];An.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new Ix(u.target),h=qf(u.target);o.push(d),u.lastReportedSize=zf(u.target,u.observedBox),h<e&&(e=h)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var i=r[n];i()}return e},Vl=function(e){An.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(i){i.isActive()&&(qf(i.target)>e?n.activeTargets.push(i):n.skippedTargets.push(i))})})},$x=function(){var e=0;for(Vl(e);Tx();)e=Rx(),Vl(e);return Sx()&&jx(),e>0},Ka,Uf=[],Lx=function(){return Uf.splice(0).forEach(function(e){return e()})},zx=function(e){if(!Ka){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Lx()}).observe(n,r),Ka=function(){n.textContent="".concat(t?t--:t++)}}Uf.push(e),Ka()},qx=function(e){zx(function(){requestAnimationFrame(e)})},ji=0,Ux=function(){return!!ji},Wx=250,Vx={attributes:!0,characterData:!0,childList:!0,subtree:!0},Hl=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Kl=function(e){return e===void 0&&(e=0),Date.now()+e},Za=!1,Hx=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=Wx),!Za){Za=!0;var r=Kl(t);qx(function(){var i=!1;try{i=$x()}finally{if(Za=!1,t=r-Kl(),!Ux())return;i?n.run(1e3):t>0?n.run(t):n.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var t=this,n=function(){return t.observer&&t.observer.observe(document.body,Vx)};document.body?n():Pr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Hl.forEach(function(n){return Pr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Hl.forEach(function(n){return Pr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),Us=new Hx,Zl=function(e){!ji&&e>0&&Us.start(),ji+=e,!ji&&Us.stop()},Kx=function(e){return!Io(e)&&!Px(e)&&getComputedStyle(e).display==="inline"},Zx=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 Kx(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Yx=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),vi=new WeakMap,Yl=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},bi=function(){function e(){}return e.connect=function(t,n){var r=new Yx(t,n);vi.set(t,r)},e.observe=function(t,n,r){var i=vi.get(t),a=i.observationTargets.length===0;Yl(i.observationTargets,n)<0&&(a&&An.push(i),i.observationTargets.push(new Zx(n,r&&r.box)),Zl(1),Us.schedule())},e.unobserve=function(t,n){var r=vi.get(t),i=Yl(r.observationTargets,n),a=r.observationTargets.length===1;i>=0&&(a&&An.splice(An.indexOf(r),1),r.observationTargets.splice(i,1),Zl(-1))},e.disconnect=function(t){var n=this,r=vi.get(t);r.observationTargets.slice().forEach(function(i){return n.unobserve(t,i.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Gx=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.");bi.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(!ql(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");bi.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(!ql(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");bi.unobserve(this,t)},e.prototype.disconnect=function(){bi.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),cn={};Object.defineProperty(cn,"__esModule",{value:!0});var Qx=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Ya={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:Qx?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Ro={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 yi=1;yi<20;yi++)Ro["f"+yi]=111+yi;function ya(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)}),i=function(o){return r.some(function(l){return Hf(l,o)})},a=n==null?i:i(n);return a}function Jx(e,t){return ya(e,t)}function Xx(e,t){return ya(e,{byKey:!0},t)}function Vf(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var i=e.split("+"),a=i.length;for(var s in Ya)r[Ya[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var d=i[Symbol.iterator](),h;!(o=(h=d.next()).done);o=!0){var p=h.value,m=p.endsWith("?")&&p.length>1;m&&(p=p.slice(0,-1));var v=$o(p),f=Ya[v];if(p.length>1&&!f&&!Wf[p]&&!Ro[v])throw new TypeError('Unknown modifier: "'+p+'"');(a===1||!f)&&(n?r.key=v:r.which=Kf(p)),f&&(r[f]=m?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],i=void 0;if(r!=null&&(n==="key"&&t.key!=null?i=t.key.toLowerCase():n==="which"?i=r===91&&t.which===93?91:t.which:i=t[n],!(i==null&&r===!1)&&i!==r))return!1}return!0}function Kf(e){e=$o(e);var t=Ro[e]||e.toUpperCase().charCodeAt(0);return t}function $o(e){return e=e.toLowerCase(),e=Wf[e]||e,e}var e1=cn.default=ya,Ga=cn.isHotkey=ya;cn.isCodeHotkey=Jx;cn.isKeyHotkey=Xx;cn.parseHotkey=Vf;cn.compareHotkey=Hf;cn.toKeyCode=Kf;cn.toKeyName=$o;function t1(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function cr(e,t){if(e==null)return{};var n=t1(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function 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 n1(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 r1(e){var t=n1(e,"string");return Kr(t)==="symbol"?t:String(t)}function Nt(e,t,n){return t=r1(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Lo=y.createContext(null),Cn=()=>{var e=y.useContext(Lo);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),i1=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Gl=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),mt=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Jn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Tr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),a1=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Yf=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),s1=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),o1=mt&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),u1=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),l1=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),c1=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),Oi=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",dn=(!s1||!o1)&&!a1&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",zo=new WeakMap,qo=new WeakMap,Gf=new WeakMap,Pi=new WeakMap,Ws=new WeakMap,Zr=new WeakMap,Tn=new WeakMap,ea=new WeakMap,xa=new WeakMap,Vs=new WeakMap,vn=new WeakMap,Fn=new WeakMap,Mr=new WeakMap,Hs=new WeakMap,Uo=new WeakMap,Lt=new WeakMap,nn=new WeakMap,yt=new WeakMap,hn=new WeakMap,mn=new WeakMap,Qf=new WeakMap,dr=Symbol("placeholder"),Jf=Symbol("mark-placeholder"),d1=globalThis.Text,Wo=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,f1=e=>bn(e)&&e.nodeType===8,Mt=e=>bn(e)&&e.nodeType===1,bn=e=>{var t=Wo(e);return!!t&&e instanceof t.Node},Ks=e=>{var t=e&&e.anchorNode&&Wo(e.anchorNode);return!!t&&e instanceof t.Selection},Xf=e=>bn(e)&&e.nodeType===3,h1=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,m1=e=>{var[t,n]=e;if(Mt(t)&&t.childNodes.length){var r=n===t.childNodes.length,i=r?n-1:n;for([t,i]=eh(t,i,r?"backward":"forward"),r=i<n;Mt(t)&&t.childNodes.length;){var a=r?t.childNodes.length-1:0;t=g1(t,a,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},p1=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},eh=(e,t,n)=>{for(var{childNodes:r}=e,i=r[t],a=t,s=!1,o=!1;(f1(i)||Mt(i)&&i.childNodes.length===0||Mt(i)&&i.getAttribute("contenteditable")==="false")&&!(s&&o);){if(a>=r.length){s=!0,a=t-1,n="backward";continue}if(a<0){o=!0,a=t+1,n="forward";continue}i=r[a],t=a,a+=n==="forward"?1:-1}return[i,t]},g1=(e,t,n)=>{var[r]=eh(e,t,n);return r},th=e=>{var t="";if(Xf(e)&&e.nodeValue)return e.nodeValue;if(Mt(e)){for(var n of Array.from(e.childNodes))t+=th(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
72
- `)}return t},v1=/data-slate-fragment="(.+?)"/m,b1=e=>{var t=e.getData("text/html"),[,n]=t.match(v1)||[];return n},Vo=(e,t,n)=>{var{target:r}=t;if(Mt(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:i}=te.getWindow(e);if(i.contains(r))return te.hasDOMNode(e,r,{editable:!0});var a=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!a||a===t?!1:Vo(e,a,n)},y1=0;class x1{constructor(){Nt(this,"id",void 0),this.id="".concat(y1++)}}var te={androidPendingDiffs:e=>yt.get(e),androidScheduleFlush:e=>{var t;(t=Uo.get(e))===null||t===void 0||t()},blur:e=>{var t=te.toDOMNode(e,e),n=te.findDocumentOrShadowRoot(e);vn.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&&X.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:i}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var a=te.toSlateNode(e,t.target),s=te.findPath(e,a);if(fe.isElement(a)&&x.isVoid(e,a)){var o=i.getBoundingClientRect(),l=e.isInline(a)?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 h=x.range(e,d);return h}}var p,{document:m}=te.getWindow(e);if(m.caretRangeFromPoint)p=m.caretRangeFromPoint(n,r);else{var v=m.caretPositionFromPoint(n,r);v&&(p=m.createRange(),p.setStart(v.offsetNode,v.offset),p.setEnd(v.offsetNode,v.offset))}if(!p)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=te.toSlateRange(e,p,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=ea.get(t);return n||(n=new x1,ea.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var i=qo.get(r);if(i==null){if(x.isEditor(r))return n;break}var a=zo.get(r);if(a==null)break;n.unshift(a),r=i}throw new Error("Unable to find the path for Slate node: ".concat(it.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!vn.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),i=te.findDocumentOrShadowRoot(t);if(i.activeElement!==r){if(t.selection&&i instanceof Document){var a=i.getSelection(),s=te.toDOMRange(t,t.selection);a==null||a.removeAllRanges(),a==null||a.addRange(s)}t.selection||(X.select(t,x.start(t,[])),t.onChange()),vn.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:i=!1}=r,a=te.toDOMNode(t,t),s;try{s=Mt(n)?n:n.parentElement}catch(o){if(o instanceof Error&&!o.message.includes('Permission denied to access property "nodeType"'))throw o}return s?s.closest("[data-slate-editor]")===a&&(!i||s.isContentEditable?!0:typeof s.isContentEditable=="boolean"&&s.closest('[contenteditable="false"]')===a||!!s.getAttribute("data-slate-zero-width")):!1},hasEditableTarget:(e,t)=>bn(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)=>bn(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=>!!Fn.get(e),isFocused:e=>!!vn.get(e),isReadOnly:e=>!!Vs.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Vs.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=xa.get(e),r=x.isEditor(t)?Pi.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(it.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=x.node(e,t.path),r=te.toDOMNode(e,n),i;x.void(e,{at:t})&&(t={path:t.path,offset:0});for(var a="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(a)),o=0,l=0;l<s.length;l++){var u=s[l],d=u.childNodes[0];if(!(d==null||d.textContent==null)){var{length:h}=d.textContent,p=u.getAttribute("data-slate-length"),m=p==null?h:parseInt(p,10),v=o+m,f=s[l+1];if(t.offset===v&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var b,g=f.childNodes[0];i=[g instanceof d1?g:f,(b=f.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=v){var D=Math.min(h,Math.max(0,t.offset-o));i=[d,D];break}o=v}}if(!i)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(it.stringify(t)));return i},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,i=Y.isBackward(t),a=te.toDOMPoint(e,n),s=Y.isCollapsed(t)?a:te.toDOMPoint(e,r),o=te.getWindow(e),l=o.document.createRange(),[u,d]=i?s:a,[h,p]=i?a:s,m=Mt(u)?u:u.parentElement,v=!!m.getAttribute("data-slate-zero-width"),f=Mt(h)?h:h.parentElement,b=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,v?1:d),l.setEnd(h,b?1:p),l},toSlateNode:(e,t)=>{var n=Mt(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:i}=n,[a,s]=r?t:m1(t),o=a.parentNode,l=null,u=0;if(o){var d,h,p=te.toDOMNode(e,e),m=o.closest('[data-slate-void="true"]'),v=m&&p.contains(m)?m:null,f=o.closest("[data-slate-leaf]"),b=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var g=te.getWindow(e),D=g.document.createRange();D.setStart(l,0),D.setEnd(a,s);var w=D.cloneContents(),F=[...Array.prototype.slice.call(w.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(w.querySelectorAll("[contenteditable=false]"))];F.forEach(j=>{if(mt&&!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=w.textContent.length,b=l}}else if(v){for(var E=v.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&&mt&&b.getAttribute("data-slate-zero-width")==="z"&&(d=b.textContent)!==null&&d!==void 0&&d.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Jn&&(h=b.textContent)!==null&&h!==void 0&&h.endsWith(`
71
+ */function ul(e){return Object.prototype.toString.call(e)==="[object Object]"}function ot(e){var t,n;return ul(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(ul(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Nf=Symbol.for("immer-nothing"),ll=Symbol.for("immer-draftable"),At=Symbol.for("immer-state"),r0=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 wt(e,...t){if(process.env.NODE_ENV!=="production"){const n=r0[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 On(e){return!!e&&!!e[At]}function Mn(e){var t;return e?If(e)||Array.isArray(e)||!!e[ll]||!!((t=e.constructor)!=null&&t[ll])||ga(e)||va(e):!1}var i0=Object.prototype.constructor.toString();function If(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)===i0}function Gi(e,t){pa(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function pa(e){const t=e[At];return t?t.type_:Array.isArray(e)?1:ga(e)?2:va(e)?3:0}function Is(e,t){return pa(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Rf(e,t,n){const r=pa(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function a0(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ga(e){return e instanceof Map}function va(e){return e instanceof Set}function _n(e){return e.copy_||e.base_}function Rs(e,t){if(ga(e))return new Map(e);if(va(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=If(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[At];let i=Reflect.ownKeys(r);for(let a=0;a<i.length;a++){const s=i[a],o=r[s];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[s]})}return Object.create(dr(e),r)}else{const r=dr(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function Oo(e,t=!1){return ba(e)||On(e)||!Mn(e)||(pa(e)>1&&(e.set=e.add=e.clear=e.delete=s0),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Oo(r,!0))),e}function s0(){wt(2)}function ba(e){return Object.isFrozen(e)}var o0={};function Nn(e){const t=o0[e];return t||wt(0,e),t}var Vr;function $f(){return Vr}function u0(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function cl(e,t){t&&(Nn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function $s(e){Ls(e),e.drafts_.forEach(l0),e.drafts_=null}function Ls(e){e===Vr&&(Vr=e.parent_)}function dl(e){return Vr=u0(Vr,e)}function l0(e){const t=e[At];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function fl(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[At].modified_&&($s(t),wt(4)),Mn(e)&&(e=Qi(t,e),t.parent_||Ji(t,e)),t.patches_&&Nn("Patches").generateReplacementPatches_(n[At].base_,e,t.patches_,t.inversePatches_)):e=Qi(t,n,[]),$s(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Nf?e:void 0}function Qi(e,t,n){if(ba(t))return t;const r=t[At];if(!r)return Gi(t,(i,a)=>ml(e,r,t,i,a,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Ji(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let a=i,s=!1;r.type_===3&&(a=new Set(i),i.clear(),s=!0),Gi(a,(o,l)=>ml(e,r,i,o,l,n,s)),Ji(e,i,!1),n&&e.patches_&&Nn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function ml(e,t,n,r,i,a,s){if(process.env.NODE_ENV!=="production"&&i===n&&wt(5),On(i)){const o=a&&t&&t.type_!==3&&!Is(t.assigned_,r)?a.concat(r):void 0,l=Qi(e,i,o);if(Rf(n,r,l),On(l))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(Mn(i)&&!ba(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Qi(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Ji(e,i)}}function Ji(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Oo(t,n)}function c0(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:$f(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,a=Mo;n&&(i=[r],a=Hr);const{revoke:s,proxy:o}=Proxy.revocable(i,a);return r.draft_=o,r.revoke_=s,o}var Mo={get(e,t){if(t===At)return e;const n=_n(e);if(!Is(n,t))return d0(e,n,t);const r=n[t];return e.finalized_||!Mn(r)?r:r===Va(e.base_,t)?(Ha(e),e.copy_[t]=qs(r,e)):r},has(e,t){return t in _n(e)},ownKeys(e){return Reflect.ownKeys(_n(e))},set(e,t,n){const r=Lf(_n(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=Va(_n(e),t),a=i==null?void 0:i[At];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(a0(n,i)&&(n!==void 0||Is(e.base_,t)))return!0;Ha(e),zs(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Va(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ha(e),zs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=_n(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){wt(11)},getPrototypeOf(e){return dr(e.base_)},setPrototypeOf(){wt(12)}},Hr={};Gi(Mo,(e,t)=>{Hr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Hr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&wt(13),Hr.set.call(this,e,t,void 0)};Hr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&wt(14),Mo.set.call(this,e[0],t,n,e[0])};function Va(e,t){const n=e[At];return(n?_n(n):e)[t]}function d0(e,t,n){var i;const r=Lf(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Lf(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 zs(e){e.modified_||(e.modified_=!0,e.parent_&&zs(e.parent_))}function Ha(e){e.copy_||(e.copy_=Rs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var f0=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const a=n;n=t;const s=this;return function(l=a,...u){return s.produce(l,d=>n.call(this,d,...u))}}typeof n!="function"&&wt(6),r!==void 0&&typeof r!="function"&&wt(7);let i;if(Mn(t)){const a=dl(this),s=qs(t,void 0);let o=!0;try{i=n(s),o=!1}finally{o?$s(a):Ls(a)}return cl(a,r),fl(i,a)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Nf&&(i=void 0),this.autoFreeze_&&Oo(i,!0),r){const a=[],s=[];Nn("Patches").generateReplacementPatches_(t,i,a,s),r(a,s)}return i}else wt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,l=>t(l,...o));let r,i;return[this.produce(t,n,(s,o)=>{r=s,i=o}),r,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Mn(e)||wt(8),On(e)&&(e=m0(e));const t=dl(this),n=qs(e,void 0);return n[At].isManual_=!0,Ls(t),n}finishDraft(e,t){const n=e&&e[At];(!n||!n.isManual_)&&wt(9);const{scope_:r}=n;return cl(r,t),fl(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const r=Nn("Patches").applyPatches_;return On(e)?r(e,t):this.produce(e,i=>r(i,t))}};function qs(e,t){const n=ga(e)?Nn("MapSet").proxyMap_(e,t):va(e)?Nn("MapSet").proxySet_(e,t):c0(e,t);return(t?t.scope_:$f()).drafts_.push(n),n}function m0(e){return On(e)||wt(10,e),zf(e)}function zf(e){if(!Mn(e)||ba(e))return e;const t=e[At];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Rs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Rs(e,!0);return Gi(n,(r,i)=>{Rf(n,r,zf(i))}),t&&(t.finalized_=!1),n}var Bt=new f0,No=Bt.produce;Bt.produceWithPatches.bind(Bt);Bt.setAutoFreeze.bind(Bt);Bt.setUseStrictShallowCopy.bind(Bt);Bt.applyPatches.bind(Bt);var hl=Bt.createDraft.bind(Bt),pl=Bt.finishDraft.bind(Bt),h0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var i=I.transform(n,t,{affinity:r});e.current=i,i==null&&e.unref()}}},p0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var i=Se.transform(n,t,{affinity:r});e.current=i,i==null&&e.unref()}}},g0={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var i=G.transform(n,t,{affinity:r});e.current=i,i==null&&e.unref()}}},Xi=new WeakMap,ea=new WeakMap,Nr=new WeakMap,qf=new WeakMap,gl=new WeakMap,vl=new WeakMap,bl=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 i=e[r],a=t[r];if(i!==a)break;n.push(i)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),i=t.slice(0,n),a=e[n],s=t[n];return I.equals(r,i)&&a>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),i=t.slice(0,n);return I.equals(r,i)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),i=t.slice(0,n),a=e[n],s=t[n];return I.equals(r,i)&&a<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return 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),i=e[e.length-1],a=t[t.length-1];return i!==a&&I.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],i=0;i<=e.length;i++)r.push(e.slice(0,i));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!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:i="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:a}=t;(I.equals(a,r)||I.endsBefore(a,r)||I.isAncestor(a,r))&&(r[a.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(i==="forward")r[r.length-1]+=1;else if(i!=="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 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 v0(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 b0(e){var t=v0(e,"string");return Kr(t)==="symbol"?t:String(t)}function vt(e,t,n){return t=b0(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ar(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yl(Object(n),!0).forEach(function(r){vt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var y0=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:i}=n,a=le.parent(e,r),s=r[r.length-1];if(s>a.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(a.children.splice(s,0,i),t)for(var[o,l]of G.points(t))t[l]=Se.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),v=h.text.slice(d);if(h.text=p+m+v,t)for(var[f,b]of G.points(t))t[b]=Se.transform(f,n);break}case"merge_node":{var{path:g}=n,x=le.get(e,g),C=I.previous(g),F=le.get(e,C),D=le.parent(e,g),_=g[g.length-1];if(ge.isText(x)&&ge.isText(F))F.text+=x.text;else if(!ge.isText(x)&&!ge.isText(F))F.children.push(...x.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(g,"] to nodes of different interfaces: ").concat(it.stringify(x)," ").concat(it.stringify(F)));if(D.children.splice(_,1),t)for(var[T,R]of G.points(t))t[R]=Se.transform(T,n);break}case"move_node":{var{path:O,newPath:z}=n;if(I.isAncestor(O,z))throw new Error("Cannot move a path [".concat(O,"] to new path [").concat(z,"] because the destination is inside itself."));var $=le.get(e,O),A=le.parent(e,O),B=O[O.length-1];A.children.splice(B,1);var j=I.transform(O,n),M=le.get(e,I.parent(j)),U=j[j.length-1];if(M.children.splice(U,0,$),t)for(var[W,ie]of G.points(t))t[ie]=Se.transform(W,n);break}case"remove_node":{var{path:se}=n,E=se[se.length-1],ee=le.parent(e,se);if(ee.children.splice(E,1),t)for(var[Z,k]of G.points(t)){var P=Se.transform(Z,n);if(t!=null&&P!=null)t[k]=P;else{var q=void 0,S=void 0;for(var[L,Q]of le.texts(e))if(I.compare(Q,se)===-1)q=[L,Q];else{S=[L,Q];break}var Y=!1;q&&S&&(I.equals(S[1],se)?Y=!I.hasPrevious(S[1]):Y=I.common(q[1],se).length<I.common(S[1],se).length),q&&!Y?(Z.path=q[1],Z.offset=q[0].text.length):S?(Z.path=S[1],Z.offset=0):t=null}}break}case"remove_text":{var{path:te,offset:ce,text:J}=n;if(J.length===0)break;var pe=le.leaf(e,te),de=pe.text.slice(0,ce),xe=pe.text.slice(ce+J.length);if(pe.text=de+xe,t)for(var[Be,Fe]of G.points(t))t[Fe]=Se.transform(Be,n);break}case"set_node":{var{path:Ve,properties:Re,newProperties:Ne}=n;if(Ve.length===0)throw new Error("Cannot set properties on the root node!");var Qe=le.get(e,Ve);for(var Ae in Ne){if(Ae==="children"||Ae==="text")throw new Error('Cannot set the "'.concat(Ae,'" property of nodes!'));var Oe=Ne[Ae];Oe==null?delete Qe[Ae]:Qe[Ae]=Oe}for(var Ee in Re)Ne.hasOwnProperty(Ee)||delete Qe[Ee];break}case"set_selection":{var{newProperties:K}=n;if(K==null)t=K;else{if(t==null){if(!G.isRange(K))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(it.stringify(K)," when there is no current selection."));t=Ar({},K)}for(var oe in K){var ae=K[oe];if(ae==null){if(oe==="anchor"||oe==="focus")throw new Error('Cannot remove the "'.concat(oe,'" selection property'));delete t[oe]}else t[oe]=ae}}break}case"split_node":{var{path:he,position:ve,properties:Te}=n;if(he.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(he,"] because the root node cannot be split."));var be=le.get(e,he),je=le.parent(e,he),st=he[he.length-1],et;if(ge.isText(be)){var tt=be.text.slice(0,ve),_t=be.text.slice(ve);be.text=tt,et=Ar(Ar({},Te),{},{text:_t})}else{var ut=be.children.slice(0,ve),_a=be.children.slice(ve);be.children=ut,et=Ar(Ar({},Te),{},{children:_a})}if(je.children.splice(st+1,0,et),t)for(var[xr,ai]of G.points(t))t[ai]=Se.transform(xr,n);break}}return t},x0={transform(e,t){e.children=hl(e.children);var n=e.selection&&hl(e.selection);try{n=y0(e,n,t)}finally{e.children=pl(e.children),n?e.selection=On(n)?pl(n):n:e.selection=null}}},w0={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)}},C0={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)}},Uf=(e,t)=>{for(var n in e){var r=e[n],i=t[n];if(ot(r)&&ot(i)){if(!Uf(r,i))return!1}else if(Array.isArray(r)&&Array.isArray(i)){if(r.length!==i.length)return!1;for(var a=0;a<r.length;a++)if(r[a]!==i[a])return!1}else if(r!==i)return!1}for(var s in t)if(e[s]===void 0&&t[s]!==void 0)return!1;return!0};function D0(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function an(e,t){if(e==null)return{};var n=D0(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var E0=["anchor","focus"];function xl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _0(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){vt(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 G={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:i}=e;return G.isBackward(e)===n?[r,i]:[i,r]},end(e){var[,t]=G.edges(e);return t},equals(e,t){return Se.equals(e.anchor,t.anchor)&&Se.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),[i,a]=G.edges(t);return Se.isBefore(n,i)&&Se.isAfter(r,a)}var[s,o]=G.edges(e),l=!1,u=!1;return Se.isPoint(t)?(l=Se.compare(t,s)>=0,u=Se.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=an(e,E0),[r,i]=G.edges(e),[a,s]=G.edges(t),o=Se.isBefore(r,a)?a:r,l=Se.isBefore(i,s)?i:s;return Se.isBefore(l,o)?null:_0({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return Se.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Se.equals(t,n)},isExpanded(e){return!G.isCollapsed(e)},isForward(e){return!G.isBackward(e)},isRange(e){return ot(e)&&Se.isPoint(e.anchor)&&Se.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=G.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return No(e,r=>{if(r===null)return null;var{affinity:i="inward"}=n,a,s;if(i==="inward"){var o=G.isCollapsed(r);G.isForward(r)?(a="forward",s=o?a:"backward"):(a="backward",s=o?a:"forward")}else i==="outward"?G.isForward(r)?(a="backward",s="forward"):(a="forward",s="backward"):(a=i,s=i);var l=Se.transform(r.anchor,t,{affinity:a}),u=Se.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},wl=e=>ot(e)&&le.isNodeList(e.children)&&!w.isEditor(e),me={isAncestor(e){return ot(e)&&le.isNodeList(e.children)},isElement:wl,isElementList(e){return Array.isArray(e)&&e.every(t=>me.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 wl(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},k0=["children"],F0=["text"],Cl=new WeakMap,le={ancestor(e,t){var n=le.get(e,t);if(ge.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(it.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 i=le.ancestor(e,r),a=[i,r];yield a}}()},child(e,t){if(ge.isText(e))throw new Error("Cannot get the child of a text node: ".concat(it.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(it.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,i=le.ancestor(e,t),{children:a}=i,s=r?a.length-1:0;r?s>=0:s<a.length;){var o=le.child(i,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=I.common(t,n),i=le.get(e,r);return[i,r]},descendant(e,t){var n=le.get(e,t);if(w.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(it.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))me.isElement(n)&&(yield[n,r])}()},extractProps(e){if(me.isAncestor(e)){var t=an(e,k0);return t}else{var t=an(e,F0);return t}},first(e,t){for(var n=t.slice(),r=le.get(e,n);r&&!(ge.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(ge.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(it.stringify(e)));var n=No({children:e.children},r=>{var[i,a]=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,a.path)){var d=le.leaf(r,o);d.text=d.text.slice(0,a.offset)}if(I.equals(o,i.path)){var m=le.leaf(r,o);m.text=m.text.slice(i.offset)}}w.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var i=t[r];if(ge.isText(n)||!n.children[i])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(it.stringify(e)));n=n.children[i]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var i=t[r];if(ge.isText(n)||!n.children[i])return!1;n=n.children[i]}return!0},isNode(e){return ge.isText(e)||me.isElement(e)||w.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=Cl.get(e);if(t!==void 0)return t;var n=e.every(r=>le.isNode(r));return Cl.set(e,n),n},last(e,t){for(var n=t.slice(),r=le.get(e,n);r&&!(ge.isText(r)||r.children.length===0);){var i=r.children.length-1;r=r.children[i],n.push(i)}return[r,n]},leaf(e,t){var n=le.get(e,t);if(!ge.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(it.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 i=le.get(e,r);yield[i,r]}}()},matches(e,t){return me.isElement(e)&&me.isElementProps(t)&&me.matches(e,t)||ge.isText(e)&&ge.isTextProps(t)&&ge.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:i=[],to:a}=t,s=new Set,o=[],l=e;!(a&&(r?I.isBefore(o,a):I.isAfter(o,a)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!ge.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,i)&&(u=i[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(ge.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string(e){return ge.isText(e)?e.text:e.children.map(le.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of le.nodes(e,t))ge.isText(n)&&(yield[n,r])}()}};function Dl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ze(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){vt(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 gn={isNodeOperation(e){return gn.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!ot(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)&&ot(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)&&ot(e.properties)&&ot(e.newProperties);case"set_selection":return e.properties===null&&G.isRange(e.newProperties)||e.newProperties===null&&G.isRange(e.properties)||ot(e.properties)&&ot(e.newProperties);case"split_node":return I.isPath(e.path)&&typeof e.position=="number"&&ot(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>gn.isOperation(t))},isSelectionOperation(e){return gn.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return gn.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),i=I.transform(I.next(n),e);return Ze(Ze({},e),{},{path:r,newPath:i})}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:a,newProperties:s}=e;return Ze(Ze({},e),{},{properties:s,newProperties:a})}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)})}}},El=new WeakMap,A0=e=>{var t=El.get(e);if(t!==void 0)return t;if(!ot(e))return!1;var n=typeof e.addMark=="function"&&typeof e.apply=="function"&&typeof e.deleteFragment=="function"&&typeof e.insertBreak=="function"&&typeof e.insertSoftBreak=="function"&&typeof e.insertFragment=="function"&&typeof e.insertNode=="function"&&typeof e.insertText=="function"&&typeof e.isElementReadOnly=="function"&&typeof e.isInline=="function"&&typeof e.isSelectable=="function"&&typeof e.isVoid=="function"&&typeof e.normalizeNode=="function"&&typeof e.onChange=="function"&&typeof e.removeMark=="function"&&typeof e.getDirtyPaths=="function"&&(e.marks===null||ot(e.marks))&&(e.selection===null||G.isRange(e.selection))&&le.isNodeList(e.children)&&gn.isOperationList(e.operations);return El.set(e,n),n},w={above(e,t){return e.above(t)},addMark(e,t,n){e.addMark(t,n)},after(e,t,n){return e.after(t,n)},before(e,t,n){return e.before(t,n)},deleteBackward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges(e,t){return e.edges(t)},elementReadOnly(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.elementReadOnly(t)},end(e,t){return e.end(t)},first(e,t){return e.first(t)},fragment(e,t){return e.fragment(t)},hasBlocks(e,t){return e.hasBlocks(t)},hasInlines(e,t){return e.hasInlines(t)},hasPath(e,t){return e.hasPath(t)},hasTexts(e,t){return e.hasTexts(t)},insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock(e,t){return e.isBlock(t)},isEdge(e,t,n){return e.isEdge(t,n)},isEditor(e){return A0(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)}},B0={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(I.isPath)}};function _l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function 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){vt(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 Se={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 Se.compare(e,t)===1},isBefore(e,t){return Se.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&I.equals(e.path,t.path)},isPoint(e){return ot(e)&&typeof e.offset=="number"&&I.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return No(e,r=>{if(r===null)return null;var{affinity:i="forward"}=n,{path:a,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=I.transform(a,t,n);break}case"insert_text":{I.equals(t.path,a)&&(t.offset<s||t.offset===s&&i==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{I.equals(t.path,a)&&(r.offset+=t.position),r.path=I.transform(a,t,n);break}case"remove_text":{I.equals(t.path,a)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(I.equals(t.path,a)||I.isAncestor(t.path,a))return null;r.path=I.transform(a,t,n);break}case"split_node":{if(I.equals(t.path,a)){if(t.position===s&&i==null)return null;(t.position<s||t.position===s&&i==="forward")&&(r.offset-=t.position,r.path=I.transform(a,t,kl(kl({},n),{},{affinity:"forward"})))}else r.path=I.transform(a,t,n);break}}})}},Fl=void 0,it={setScrubber(e){Fl=e},stringify(e){return JSON.stringify(e,Fl)}},T0=["text"],S0=["anchor","focus"];function Al(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function en(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Al(Object(n),!0).forEach(function(r){vt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Al(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ge={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function i(a){var s=an(a,T0);return s}return Uf(r?i(e):e,r?i(t):t)},isText(e){return ot(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>ge.isText(t))},isTextProps(e){return e.text!==void 0},matches(e,t){for(var n in t)if(n!=="text"&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[en({},e)];for(var r of t){var i=an(r,S0),[a,s]=G.edges(r),o=[],l=0,u=a.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,i),o.push(m);continue}if(u!==d&&(u===l||d===p)||u>l||d<p||d===p&&p!==0){o.push(m);continue}var v=m,f=void 0,b=void 0;if(d<l){var g=d-p;b=en(en({},v),{},{text:v.text.slice(g)}),v=en(en({},v),{},{text:v.text.slice(0,g)})}if(u>p){var x=u-p;f=en(en({},v),{},{text:v.text.slice(0,x)}),v=en(en({},v),{},{text:v.text.slice(x)})}Object.assign(v,i),f&&o.push(f),o.push(v),b&&o.push(b)}n=o}return n}},Io=e=>e.selection?e.selection:e.children.length>0?w.end(e,[]):[0],yr=(e,t)=>{var[n]=w.node(e,t);return r=>r===n},Ro=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,i=n?I0(t):t,a=De.None,s=De.None,o=0,l=null,u=null;for(var d of i){var m=d.codePointAt(0);if(!m)break;var h=Y0(d,m);if([a,s]=r?[s,h]:[h,a],Jn(a,De.ZWJ)&&Jn(s,De.ExtPict)&&(r?l=Bl(t.substring(0,o)):l=Bl(t.substring(0,t.length-o)),!l)||Jn(a,De.RI)&&Jn(s,De.RI)&&(u!==null?u=!u:r?u=!0:u=ey(t.substring(0,t.length-o)),!u)||a!==De.None&&s!==De.None&&Q0(a,s))break;o+=d.length}return o||1},j0=/\s/,P0=/[\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]/,O0=/['\u2018\u2019]/,M0=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,i=!1;t.length>0;){var a=Ro(t,n),[s,o]=$o(t,a,n);if(N0(s,o,n))i=!0,r+=a;else if(!i)r+=a;else break;t=o}return r},$o=(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)]},N0=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(j0.test(t))return!1;if(O0.test(t)){var i=Ro(n,r),[a,s]=$o(n,i,r);if(e(a,s,r))return!0}return!P0.test(t)},I0=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var i=t.charAt(n-r);if($0(i.charCodeAt(0))){var a=t.charAt(n-r-1);if(R0(a.charCodeAt(0))){yield a+i,r++;continue}}yield i}},R0=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 L0=/^(?:[\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])$/,z0=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,q0=/^(?:[\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])$/,U0=/^[\u1100-\u115F\uA960-\uA97C]$/,W0=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,V0=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,H0=/^[\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]$/,K0=/^[\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]$/,Z0=/^(?:[\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])$/,Y0=(e,t)=>{var n=De.Any;return e.search(L0)!==-1&&(n|=De.Extend),t===8205&&(n|=De.ZWJ),t>=127462&&t<=127487&&(n|=De.RI),e.search(z0)!==-1&&(n|=De.Prepend),e.search(q0)!==-1&&(n|=De.SpacingMark),e.search(U0)!==-1&&(n|=De.L),e.search(W0)!==-1&&(n|=De.V),e.search(V0)!==-1&&(n|=De.T),e.search(H0)!==-1&&(n|=De.LV),e.search(K0)!==-1&&(n|=De.LVT),e.search(Z0)!==-1&&(n|=De.ExtPict),n};function Jn(e,t){return(e&t)!==0}var G0=[[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 Q0(e,t){return G0.findIndex(n=>Jn(e,n[0])&&Jn(t,n[1]))===-1}var J0=/(?:[\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$/,Bl=e=>e.search(J0)!==-1,X0=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,ey=e=>{var t=e.match(X0);if(t===null)return!1;var n=t[0].length/2;return n%2===1},ty={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};w.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:i=Io(e)}=n;if(I.isPath(i)&&(i=w.range(e,i)),G.isRange(i))if(G.isCollapsed(i))i=i.anchor;else{var a=G.end(i);if(!r&&w.void(e,{at:a}))return;var s=G.start(i),o=w.pointRef(e,s),l=w.pointRef(e,a);X.delete(e,{at:i,voids:r});var u=o.unref(),d=l.unref();i=u||d,X.setSelection(e,{anchor:i,focus:i})}if(!(!r&&w.void(e,{at:i})||w.elementReadOnly(e,{at:i}))){var{path:m,offset:h}=i;t.length>0&&e.apply({type:"insert_text",path:m,offset:h,text:t})}})}};function Tl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function vi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Tl(Object(n),!0).forEach(function(r){vt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var X=vi(vi(vi(vi({},x0),w0),C0),ty),Pi=new WeakMap,ny=e=>Pi.get(e)||!1,ry=(e,t,n)=>{var r=Pi.get(e)||!1;Pi.set(e,!0);try{t(),n()}finally{Pi.set(e,r)}};function Wf(e,t,n){var r=Xi.get(e)||[],i=ea.get(e)||new Set,a,s,o=m=>{if(m){var h=m.join(",");s.has(h)||(s.add(h),a.push(m))}};if(n){a=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else a=r,s=i;for(var d of t)o(d);Xi.set(e,a),ea.set(e,s)}var iy=(e,t)=>{for(var n of w.pathRefs(e))h0.transform(n,t);for(var r of w.pointRefs(e))p0.transform(r,t);for(var i of w.rangeRefs(e))g0.transform(i,t);if(!ny(e)){var a=I.operationCanTransformPath(t)?s=>I.transform(s,t):void 0;Wf(e,e.getDirtyPaths(t),a)}X.transform(e,t),e.operations.push(t),w.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),Nr.get(e)||(Nr.set(e,!0),Promise.resolve().then(()=>{Nr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},ay=(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:i}=t,a=I.levels(i),s=ge.isText(r)?[]:Array.from(le.nodes(r),z=>{var[,$]=z;return i.concat($)});return[...a,...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 v of I.ancestors(d)){var f=I.transform(v,t);h.push(f)}for(var b of I.ancestors(m)){var g=I.transform(b,t);p.push(g)}var x=p[p.length-1],C=m[m.length-1],F=x.concat(C);return[...h,...p,F]}case"remove_node":{var{path:D}=t,_=I.ancestors(D);return[..._]}case"split_node":{var{path:T}=t,R=I.levels(T),O=I.next(T);return[...R,O]}default:return[]}},sy=e=>{var{selection:t}=e;return t?le.fragment(e,t):[]},oy=(e,t)=>{var[n,r]=t;if(!ge.isText(n)){if(me.isElement(n)&&n.children.length===0){var i={text:""};X.insertNodes(e,i,{at:r.concat(0),voids:!0});return}for(var a=w.isEditor(n)?!1:me.isElement(n)&&(e.isInline(n)||n.children.length===0||ge.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=le.get(e,r);if(!ge.isText(l)){var u=l.children[s],d=l.children[s-1],m=o===n.children.length-1,h=ge.isText(u)||me.isElement(u)&&e.isInline(u);if(h!==a)X.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(me.isElement(u)){if(e.isInline(u)){if(d==null||!ge.isText(d)){var p={text:""};X.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(m){var v={text:""};X.insertNodes(e,v,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&ge.isText(d)&&(ge.equals(u,d,{loose:!0})?(X.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(X.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(X.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},uy=(e,t)=>{var{iteration:n,initialDirtyPathsLength:r}=t,i=r*42;if(n>i)throw new Error("Could not completely normalize the editor after ".concat(i," iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state."));return!0},ly=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:i="lowest",at:a=t.selection,match:s}=n;if(a){var o=w.path(t,a),l=i==="lowest";for(var[u,d]of w.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!ge.isText(u)){if(G.isRange(a)){if(I.isAncestor(d,a.anchor.path)&&I.isAncestor(d,a.focus.path))return[u,d]}else if(!I.equals(o,d))return[u,d]}}};function Sl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function 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){vt(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 cy=(e,t,n)=>{var{selection:r}=e;if(r){var i=(m,h)=>{if(!ge.isText(m))return!1;var[p,v]=w.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},a=G.isExpanded(r),s=!1;if(!a){var[o,l]=w.node(e,r);if(o&&i(o,l)){var[u]=w.parent(e,l);s=u&&e.markableVoid(u)}}if(a||s)X.setNodes(e,{[t]:n},{match:i,split:!0,voids:!0});else{var d=jl(jl({},w.marks(e)||{}),{},{[t]:n});e.marks=d,Nr.get(e)||e.onChange()}}};function Pl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ol(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){vt(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 dy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=w.point(t,n,{edge:"end"}),a=w.end(t,[]),s={anchor:i,focus:a},{distance:o=1}=r,l=0,u;for(var d of w.positions(t,Ol(Ol({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};function Ml(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function 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){vt(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 fy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=w.start(t,[]),a=w.point(t,n,{edge:"start"}),s={anchor:i,focus:a},{distance:o=1}=r,l=0,u;for(var d of w.positions(t,Nl(Nl({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},my=(e,t)=>{var{selection:n}=e;n&&G.isCollapsed(n)&&X.delete(e,{unit:t,reverse:!0})},hy=(e,t)=>{var{selection:n}=e;n&&G.isCollapsed(n)&&X.delete(e,{unit:t})},py=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&G.isExpanded(r)&&X.delete(t,{reverse:n==="backward"})},gy=(e,t)=>[w.start(e,t),w.end(e,t)];function Il(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function 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){vt(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 vy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return w.above(t,Rl(Rl({},n),{},{match:r=>me.isElement(r)&&w.isElementReadOnly(t,r)}))},by=(e,t)=>w.point(e,t,{edge:"end"}),yy=(e,t)=>{var n=w.path(e,t,{edge:"start"});return w.node(e,n)},xy=(e,t)=>{var n=w.range(e,t);return le.fragment(e,n)};function $l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ll(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){vt(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 wy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return w.above(t,Ll(Ll({},n),{},{match:r=>me.isElement(r)&&w.isVoid(t,r)}))},Cy=(e,t)=>t.children.some(n=>me.isElement(n)&&w.isBlock(e,n)),Dy=(e,t)=>t.children.some(n=>ge.isText(n)||w.isInline(e,n)),Ey=(e,t)=>le.has(e,t),_y=(e,t)=>t.children.every(n=>ge.isText(n)),ky=e=>{X.splitNodes(e,{always:!0})},Fy=(e,t,n)=>{X.insertNodes(e,t,n)},Ay=e=>{X.splitNodes(e,{always:!0})};function zl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function By(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zl(Object(n),!0).forEach(function(r){vt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ty=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:i,marks:a}=t;if(i){if(a){var s=By({text:n},a);X.insertNodes(t,s,{at:r.at,voids:r.voids})}else X.insertText(t,n,r);t.marks=null}},Sy=(e,t)=>!e.isInline(t),jy=(e,t,n)=>w.isStart(e,t,n)||w.isEnd(e,t,n),Py=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&ge.isText(r)&&r.text===""&&!e.isVoid(t)},Oy=(e,t,n)=>{var r=w.end(e,n);return Se.equals(t,r)},My=e=>{var t=qf.get(e);return t===void 0?!0:t},Ny=(e,t,n)=>{if(t.offset!==0)return!1;var r=w.start(e,n);return Se.equals(t,r)},Iy=(e,t)=>{var n=w.path(e,t,{edge:"end"});return w.node(e,n)},Ry=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=w.path(t,n,r),a=le.leaf(t,i);return[a,i]};function $y(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:i=!1}=t,{match:a}=t;if(a==null&&(a=()=>!0),!!n){var s=[],o=w.path(e,n);for(var[l,u]of le.levels(e,o))if(a(l,u)&&(s.push([l,u]),!i&&me.isElement(l)&&w.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var Ly=["text"],zy=["text"],qy=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:i,focus:a}=r;if(n)return n;if(G.isExpanded(r)){var s=w.isEnd(t,i,i.path);if(s){var o=w.after(t,i);o&&(i=o)}var[l]=w.nodes(t,{match:ge.isText,at:{anchor:i,focus:a}});if(l){var[u]=l,d=an(u,Ly);return d}else return{}}var{path:m}=i,[h]=w.leaf(t,m);if(i.offset===0){var p=w.previous(t,{at:m,match:ge.isText}),v=w.above(t,{match:F=>me.isElement(F)&&w.isVoid(t,F)&&t.markableVoid(F)});if(!v){var f=w.above(t,{match:F=>me.isElement(F)&&w.isBlock(t,F)});if(p&&f){var[b,g]=p,[,x]=f;I.isAncestor(x,g)&&(h=b)}}}var C=an(h,zy);return C},Uy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:i=!1}=n,{match:a,at:s=t.selection}=n;if(s){var o=w.after(t,s,{voids:i});if(o){var[,l]=w.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(a==null)if(I.isPath(s)){var[d]=w.parent(t,s);a=h=>d.children.includes(h)}else a=()=>!0;var[m]=w.nodes(t,{at:u,match:a,mode:r,voids:i});return m}}},Wy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=w.path(t,n,r),a=le.get(t,i);return[a,i]};function Vy(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:i=!1,reverse:a=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,d;if(B0.isSpan(n))u=n[0],d=n[1];else{var m=w.path(e,n,{edge:"start"}),h=w.path(e,n,{edge:"end"});u=a?h:m,d=a?m:h}var p=le.nodes(e,{reverse:a,from:u,to:d,pass:F=>{var[D]=F;return me.isElement(D)?!!(!s&&(w.isVoid(e,D)||w.isElementReadOnly(e,D))||o&&!w.isSelectable(e,D)):!1}}),v=[],f;for(var[b,g]of p)if(!(o&&me.isElement(b)&&!w.isSelectable(e,b))){var x=f&&I.compare(g,f[1])===0;if(!(r==="highest"&&x)){if(!l(b,g)){if(i&&!x&&ge.isText(b))return;continue}if(r==="lowest"&&x){f=[b,g];continue}var C=r==="lowest"?f:[b,g];C&&(i?v.push(C):yield C),f=[b,g]}}r==="lowest"&&f&&(i?v.push(f):yield f),i&&(yield*v)}}()}var Hy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:i}=n,a=d=>Xi.get(d)||[],s=d=>ea.get(d)||new Set,o=d=>{var m=a(d).pop(),h=m.join(",");return s(d).delete(h),m};if(w.isNormalizing(t)){if(r){var l=Array.from(le.nodes(t),d=>{var[,m]=d;return m}),u=new Set(l.map(d=>d.join(",")));Xi.set(t,l),ea.set(t,u)}a(t).length!==0&&w.withoutNormalizing(t,()=>{for(var d of a(t))if(le.has(t,d)){var m=w.node(t,d),[h,p]=m;me.isElement(h)&&h.children.length===0&&t.normalizeNode(m,{operation:i})}for(var v=a(t),f=v.length,b=0;v.length!==0;){if(!t.shouldNormalize({dirtyPaths:v,iteration:b,initialDirtyPathsLength:f,operation:i}))return;var g=o(t);if(le.has(t,g)){var x=w.node(t,g);t.normalizeNode(x,{operation:i})}b++,v=a(t)}})}},Ky=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=w.path(t,n,r),a=I.parent(i),s=w.node(t,a);return s},Zy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:i="forward"}=r,a={current:n,affinity:i,unref(){var{current:o}=a,l=w.pathRefs(t);return l.delete(a),a.current=null,o}},s=w.pathRefs(t);return s.add(a),a},Yy=e=>{var t=gl.get(e);return t||(t=new Set,gl.set(e,t)),t},Gy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:i,edge:a}=r;if(I.isPath(n)){if(a==="start"){var[,s]=le.first(t,n);n=s}else if(a==="end"){var[,o]=le.last(t,n);n=o}}return G.isRange(n)&&(a==="start"?n=G.start(n):a==="end"?n=G.end(n):n=I.common(n.anchor.path,n.focus.path)),Se.isPoint(n)&&(n=n.path),i!=null&&(n=n.slice(0,i)),n},Qy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:i="forward"}=r,a={current:n,affinity:i,unref(){var{current:o}=a,l=w.pointRefs(t);return l.delete(a),a.current=null,o}},s=w.pointRefs(t);return s.add(a),a},Jy=e=>{var t=vl.get(e);return t||(t=new Set,vl.set(e,t)),t},Xy=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:i="start"}=r;if(I.isPath(n)){var a;if(i==="end"){var[,s]=le.last(t,n);a=s}else{var[,o]=le.first(t,n);a=o}var l=le.get(t,a);if(!ge.isText(l))throw new Error("Cannot get the ".concat(i," point in the node at path [").concat(n,"] because it has no ").concat(i," text node."));return{path:a,offset:i==="end"?l.text.length:0}}if(G.isRange(n)){var[u,d]=G.edges(n);return i==="start"?u:d}return n};function ex(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:i=!1,voids:a=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=w.range(e,n),[l,u]=G.edges(o),d=i?u:l,m=!1,h="",p=0,v=0,f=0;for(var[b,g]of w.nodes(e,{at:n,reverse:i,voids:a,ignoreNonSelectable:s})){if(me.isElement(b)){if(!a&&(e.isVoid(b)||e.isElementReadOnly(b))){yield w.start(e,g);continue}if(e.isInline(b))continue;if(w.hasInlines(e,b)){var x=I.isAncestor(g,u.path)?u:w.end(e,g),C=I.isAncestor(g,l.path)?l:w.start(e,g);h=w.string(e,{anchor:C,focus:x},{voids:a}),m=!0}}if(ge.isText(b)){var F=I.equals(g,d.path);for(F?(v=i?d.offset:b.text.length-d.offset,f=d.offset):(v=b.text.length,f=i?v:0),(F||m||r==="offset")&&(yield{path:g,offset:f},m=!1);;){if(p===0){if(h==="")break;p=D(h,r,i),h=$o(h,p,i)[1]}if(f=i?f-p:f+p,v=v-p,v<0){p=-v;break}p=0,yield{path:g,offset:f}}}}function D(_,T,R){return T==="character"?Ro(_,R):T==="word"?M0(_,R):T==="line"||T==="block"?_.length:1}}()}var tx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:i=!1}=n,{match:a,at:s=t.selection}=n;if(s){var o=w.before(t,s,{voids:i});if(o){var[,l]=w.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(a==null)if(I.isPath(s)){var[d]=w.parent(t,s);a=h=>d.children.includes(h)}else a=()=>!0;var[m]=w.nodes(t,{reverse:!0,at:u,match:a,mode:r,voids:i});return m}}},nx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:i="forward"}=r,a={current:n,affinity:i,unref(){var{current:o}=a,l=w.rangeRefs(t);return l.delete(a),a.current=null,o}},s=w.rangeRefs(t);return s.add(a),a},rx=e=>{var t=bl.get(e);return t||(t=new Set,bl.set(e,t)),t},ix=(e,t,n)=>{if(G.isRange(t)&&!n)return t;var r=w.start(e,t),i=w.end(e,n||t);return{anchor:r,focus:i}};function ql(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ax(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){vt(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 sx=(e,t)=>{var{selection:n}=e;if(n){var r=(d,m)=>{if(!ge.isText(d))return!1;var[h,p]=w.parent(e,m);return!e.isVoid(h)||e.markableVoid(h)},i=G.isExpanded(n),a=!1;if(!i){var[s,o]=w.node(e,n);if(s&&r(s,o)){var[l]=w.parent(e,o);a=l&&e.markableVoid(l)}}if(i||a)X.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=ax({},w.marks(e)||{});delete u[t],e.marks=u,Nr.get(e)||e.onChange()}}},ox=(e,t)=>{qf.set(e,t)},ux=(e,t)=>w.point(e,t,{edge:"start"}),lx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:i=!1}=r,a=w.range(t,n),[s,o]=G.edges(a),l="";for(var[u,d]of w.nodes(t,{at:a,match:ge.isText,voids:i})){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},cx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:i=!1}=r,[a,s]=G.edges(n);if(a.offset!==0||s.offset!==0||G.isCollapsed(n)||I.hasPrevious(s.path))return n;var o=w.above(t,{at:s,match:v=>me.isElement(v)&&w.isBlock(t,v),voids:i}),l=o?o[1]:[],u=w.start(t,a),d={anchor:u,focus:s},m=!0;for(var[h,p]of w.nodes(t,{at:d,match:ge.isText,reverse:!0,voids:i})){if(m){m=!1;continue}if(h.text!==""||I.isBefore(p,l)){s={path:p,offset:h.text.length};break}}return{anchor:a,focus:s}},dx=(e,t)=>{var n=w.isNormalizing(e);w.setNormalizing(e,!1);try{t()}finally{w.setNormalizing(e,n)}w.normalize(e)},fx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var r,i,{reverse:a=!1,unit:s="character",distance:o=1,voids: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),Se.isPoint(u)){var h=w.void(t,{at:u,mode:"highest"});if(!l&&h){var[,p]=h;u=p}else{var v={unit:s,distance:o},f=a?w.before(t,u,v)||w.start(t,[]):w.after(t,u,v)||w.end(t,[]);u={anchor:u,focus:f},d=!0}}if(I.isPath(u)){X.removeNodes(t,{at:u,voids:l});return}if(!G.isCollapsed(u)){if(!d){var[,b]=G.edges(u),g=w.end(t,[]);Se.equals(b,g)||(u=w.unhangRange(t,u,{voids:l}))}var[x,C]=G.edges(u),F=w.above(t,{match:de=>me.isElement(de)&&w.isBlock(t,de),at:x,voids:l}),D=w.above(t,{match:de=>me.isElement(de)&&w.isBlock(t,de),at:C,voids:l}),_=F&&D&&!I.equals(F[1],D[1]),T=I.equals(x.path,C.path),R=l?null:(r=w.void(t,{at:x,mode:"highest"}))!==null&&r!==void 0?r:w.elementReadOnly(t,{at:x,mode:"highest"}),O=l?null:(i=w.void(t,{at:C,mode:"highest"}))!==null&&i!==void 0?i:w.elementReadOnly(t,{at:C,mode:"highest"});if(R){var z=w.before(t,x);z&&F&&I.isAncestor(F[1],z.path)&&(x=z)}if(O){var $=w.after(t,C);$&&D&&I.isAncestor(D[1],$.path)&&(C=$)}var A=[],B;for(var j of w.nodes(t,{at:u,voids:l})){var[M,U]=j;B&&I.compare(U,B)===0||(!l&&me.isElement(M)&&(w.isVoid(t,M)||w.isElementReadOnly(t,M))||!I.isCommon(U,x.path)&&!I.isCommon(U,C.path))&&(A.push(j),B=U)}var W=Array.from(A,de=>{var[,xe]=de;return w.pathRef(t,xe)}),ie=w.pointRef(t,x),se=w.pointRef(t,C),E="";if(!T&&!R){var ee=ie.current,[Z]=w.leaf(t,ee),{path:k}=ee,{offset:P}=x,q=Z.text.slice(P);q.length>0&&(t.apply({type:"remove_text",path:k,offset:P,text:q}),E=q)}if(W.reverse().map(de=>de.unref()).filter(de=>de!==null).forEach(de=>X.removeNodes(t,{at:de,voids:l})),!O){var S=se.current,[L]=w.leaf(t,S),{path:Q}=S,Y=T?x.offset:0,te=L.text.slice(Y,C.offset);te.length>0&&(t.apply({type:"remove_text",path:Q,offset:Y,text:te}),E=te)}!T&&_&&se.current&&ie.current&&X.mergeNodes(t,{at:se.current,hanging:!0,voids:l}),m&&a&&s==="character"&&E.length>1&&E.match(/[\u0E00-\u0E7F]+/)&&X.insertText(t,E.slice(0,E.length-o));var ce=ie.unref(),J=se.unref(),pe=a?ce||J:J||ce;n.at==null&&pe&&X.select(t,pe)}}})},mx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};w.withoutNormalizing(t,()=>{var{hanging:i=!1,voids:a=!1}=r,{at:s=Io(t),batchDirty:o=!0}=r;if(n.length){if(G.isRange(s))if(i||(s=w.unhangRange(t,s,{voids:a})),G.isCollapsed(s))s=s.anchor;else{var[,l]=G.edges(s);if(!a&&w.void(t,{at:l}))return;var u=w.pointRef(t,l);X.delete(t,{at:s}),s=u.unref()}else I.isPath(s)&&(s=w.start(t,s));if(!(!a&&w.void(t,{at:s}))){var d=w.above(t,{at:s,match:q=>me.isElement(q)&&w.isInline(t,q),mode:"highest",voids:a});if(d){var[,m]=d;if(w.isEnd(t,s,m)){var h=w.after(t,m);s=h}else if(w.isStart(t,s,m)){var p=w.before(t,m);s=p}}var v=w.above(t,{match:q=>me.isElement(q)&&w.isBlock(t,q),at:s,voids:a}),[,f]=v,b=w.isStart(t,s,f),g=w.isEnd(t,s,f),x=b&&g,C=!b||b&&g,F=!g,[,D]=le.first({children:n},[]),[,_]=le.last({children:n},[]),T=[],R=q=>{var[S,L]=q,Q=L.length===0;return Q?!1:x?!0:!(C&&I.isAncestor(L,D)&&me.isElement(S)&&!t.isVoid(S)&&!t.isInline(S)||F&&I.isAncestor(L,_)&&me.isElement(S)&&!t.isVoid(S)&&!t.isInline(S))};for(var O of le.nodes({children:n},{pass:R}))R(O)&&T.push(O);var z=[],$=[],A=[],B=!0,j=!1;for(var[M]of T)me.isElement(M)&&!t.isInline(M)?(B=!1,j=!0,$.push(M)):B?z.push(M):A.push(M);var[U]=w.nodes(t,{at:s,match:q=>ge.isText(q)||w.isInline(t,q),mode:"highest",voids:a}),[,W]=U,ie=w.isStart(t,s,W),se=w.isEnd(t,s,W),E=w.pathRef(t,g&&!A.length?I.next(f):f),ee=w.pathRef(t,se?I.next(W):W);X.splitNodes(t,{at:s,match:q=>j?me.isElement(q)&&w.isBlock(t,q):ge.isText(q)||w.isInline(t,q),mode:j?"lowest":"highest",always:j&&(!b||z.length>0)&&(!g||A.length>0),voids:a});var Z=w.pathRef(t,!ie||ie&&se?I.next(W):W);if(X.insertNodes(t,z,{at:Z.current,match:q=>ge.isText(q)||w.isInline(t,q),mode:"highest",voids:a,batchDirty:o}),x&&!z.length&&$.length&&!A.length&&X.delete(t,{at:f,voids:a}),X.insertNodes(t,$,{at:E.current,match:q=>me.isElement(q)&&w.isBlock(t,q),mode:"lowest",voids:a,batchDirty:o}),X.insertNodes(t,A,{at:ee.current,match:q=>ge.isText(q)||w.isInline(t,q),mode:"highest",voids:a,batchDirty:o}),!r.at){var k;if(A.length>0&&ee.current?k=I.previous(ee.current):$.length>0&&E.current?k=I.previous(E.current):Z.current&&(k=I.previous(Z.current)),k){var P=w.end(t,k);X.select(t,P)}}Z.unref(),E.unref(),ee.unref()}}})},hx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:i}=t;if(i){if(r==="anchor")X.select(t,i.anchor);else if(r==="focus")X.select(t,i.focus);else if(r==="start"){var[a]=G.edges(i);X.select(t,a)}else if(r==="end"){var[,s]=G.edges(i);X.select(t,s)}}else return},px=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},gx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:i=1,unit:a="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=G.isBackward(r)?"focus":"anchor"),o==="end"&&(o=G.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:i,unit:a,ignoreNonSelectable:!0},m={};if(o==null||o==="anchor"){var h=s?w.before(t,l,d):w.after(t,l,d);h&&(m.anchor=h)}if(o==null||o==="focus"){var p=s?w.before(t,u,d):w.after(t,u,d);p&&(m.focus=p)}X.setSelection(t,m)}},vx=(e,t)=>{var{selection:n}=e;if(t=w.range(e,t),n){X.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(it.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function Ul(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Wl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ul(Object(n),!0).forEach(function(r){vt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ul(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]:{},{selection:i}=t,{edge:a="both"}=r;if(i){a==="start"&&(a=G.isBackward(i)?"focus":"anchor"),a==="end"&&(a=G.isBackward(i)?"anchor":"focus");var{anchor:s,focus:o}=i,l=a==="anchor"?s:o;X.setSelection(t,{[a==="anchor"?"anchor":"focus"]:Wl(Wl({},l),n)})}},yx=(e,t)=>{var{selection:n}=e,r={},i={};if(n){for(var a in t)(a==="anchor"&&t.anchor!=null&&!Se.equals(t.anchor,n.anchor)||a==="focus"&&t.focus!=null&&!Se.equals(t.focus,n.focus)||a!=="anchor"&&a!=="focus"&&t[a]!==n[a])&&(r[a]=n[a],i[a]=t[a]);Object.keys(r).length>0&&e.apply({type:"set_selection",properties:r,newProperties:i})}},xx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};w.withoutNormalizing(t,()=>{var{hanging:i=!1,voids:a=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:d}=r;if(le.isNode(n)&&(n=[n]),n.length!==0){var[m]=n;if(l||(l=Io(t),d!==!1&&(d=!0)),d==null&&(d=!1),G.isRange(l))if(i||(l=w.unhangRange(t,l,{voids:a})),G.isCollapsed(l))l=l.anchor;else{var[,h]=G.edges(l),p=w.pointRef(t,h);X.delete(t,{at:l}),l=p.unref()}if(Se.isPoint(l)){u==null&&(ge.isText(m)?u=z=>ge.isText(z):t.isInline(m)?u=z=>ge.isText(z)||w.isInline(t,z):u=z=>me.isElement(z)&&w.isBlock(t,z));var[v]=w.nodes(t,{at:l.path,match:u,mode:s,voids:a});if(v){var[,f]=v,b=w.pathRef(t,f),g=w.isEnd(t,l,f);X.splitNodes(t,{at:l,match:u,mode:s,voids:a});var x=b.unref();l=g?I.next(x):x}else return}var C=I.parent(l),F=l[l.length-1];if(!(!a&&w.void(t,{at:C}))){if(o){var D=[],_=I.levels(C);ry(t,()=>{var z=function(){var B=C.concat(F);F++;var j={type:"insert_node",path:B,node:$};t.apply(j),l=I.next(l),D.push(j),ge.isText?_.push(...Array.from(le.nodes($),M=>{var[,U]=M;return B.concat(U)})):_.push(B)};for(var $ of n)z()},()=>{Wf(t,_,z=>{var $=z;for(var A of D)if(I.operationCanTransformPath(A)&&($=I.transform($,A),!$))return null;return $})})}else for(var T of n){var R=C.concat(F);F++,t.apply({type:"insert_node",path:R,node:T}),l=I.next(l)}if(l=I.previous(l),d){var O=w.end(t,l);O&&X.select(t,O)}}}})},wx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:i="lowest",voids:a=!1}=n,{match:s}=n;if(s==null&&(s=I.isPath(r)?yr(t,r):F=>me.isElement(F)&&w.isBlock(t,F)),!!r){var o=w.nodes(t,{at:r,match:s,mode:i,voids:a}),l=Array.from(o,F=>{var[,D]=F;return w.pathRef(t,D)});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=w.node(t,I.parent(d)),[h,p]=m,v=d[d.length-1],{length:f}=h.children;if(f===1){var b=I.next(p);X.moveNodes(t,{at:d,to:b,voids:a}),X.removeNodes(t,{at:p,voids:a})}else if(v===0)X.moveNodes(t,{at:d,to:p,voids:a});else if(v===f-1){var g=I.next(p);X.moveNodes(t,{at:d,to:g,voids:a})}else{var x=I.next(d),C=I.next(p);X.splitNodes(t,{at:x,voids:a}),X.moveNodes(t,{at:d,to:C,voids:a})}}}})},Cx=["text"],Dx=["children"],Vf=(e,t)=>{if(me.isElement(t)){var n=t;return w.isVoid(e,t)?!0:n.children.length===1?Vf(e,n.children[0]):!1}else return!w.isEditor(t)},Ex=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var{match:r,at:i=t.selection}=n,{hanging:a=!1,voids:s=!1,mode:o="lowest"}=n;if(i){if(r==null)if(I.isPath(i)){var[l]=w.parent(t,i);r=z=>l.children.includes(z)}else r=z=>me.isElement(z)&&w.isBlock(t,z);if(!a&&G.isRange(i)&&(i=w.unhangRange(t,i,{voids:s})),G.isRange(i))if(G.isCollapsed(i))i=i.anchor;else{var[,u]=G.edges(i),d=w.pointRef(t,u);X.delete(t,{at:i}),i=d.unref(),n.at==null&&X.select(t,i)}var[m]=w.nodes(t,{at:i,match:r,voids:s,mode:o}),h=w.previous(t,{at:i,match:r,voids:s,mode:o});if(!(!m||!h)){var[p,v]=m,[f,b]=h;if(!(v.length===0||b.length===0)){var g=I.next(b),x=I.common(v,b),C=I.isSibling(v,b),F=Array.from(w.levels(t,{at:v}),z=>{var[$]=z;return $}).slice(x.length).slice(0,-1),D=w.above(t,{at:v,mode:"highest",match:z=>F.includes(z)&&Vf(t,z)}),_=D&&w.pathRef(t,D[1]),T,R;if(ge.isText(p)&&ge.isText(f)){var O=an(p,Cx);R=f.text.length,T=O}else if(me.isElement(p)&&me.isElement(f)){var O=an(p,Dx);R=f.children.length,T=O}else throw new Error("Cannot merge the node at path [".concat(v,"] with the previous sibling because it is not the same kind: ").concat(it.stringify(p)," ").concat(it.stringify(f)));C||X.moveNodes(t,{at:v,to:g,voids:s}),_&&X.removeNodes(t,{at:_.current,voids:s}),me.isElement(f)&&w.isEmpty(t,f)||ge.isText(f)&&f.text===""&&b[b.length-1]!==0?X.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:g,position:R,properties:T}),_&&_.unref()}}}})},_x=(e,t)=>{w.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:i="lowest",voids:a=!1}=t,{match:s}=t;if(r){s==null&&(s=I.isPath(r)?yr(e,r):p=>me.isElement(p)&&w.isBlock(e,p));var o=w.pathRef(e,n),l=w.nodes(e,{at:r,match:s,mode:i,voids:a}),u=Array.from(l,p=>{var[,v]=p;return w.pathRef(e,v)});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()}})},kx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:i=!1,mode:a="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=I.isPath(s)?yr(t,s):p=>me.isElement(p)&&w.isBlock(t,p)),!r&&G.isRange(s)&&(s=w.unhangRange(t,s,{voids:i}));var l=w.nodes(t,{at:s,match:o,mode:a,voids:i}),u=Array.from(l,p=>{var[,v]=p;return w.pathRef(t,v)});for(var d of u){var m=d.unref();if(m){var[h]=w.node(t,m);t.apply({type:"remove_node",path:m,node:h})}}}})},Fx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};w.withoutNormalizing(t,()=>{var{match:i,at:a=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:d=!1,voids:m=!1}=r;if(a){if(i==null&&(i=I.isPath(a)?yr(t,a):R=>me.isElement(R)&&w.isBlock(t,R)),!l&&G.isRange(a)&&(a=w.unhangRange(t,a,{voids:m})),d&&G.isRange(a)){if(G.isCollapsed(a)&&w.leaf(t,a.anchor)[0].text.length>0)return;var h=w.rangeRef(t,a,{affinity:"inward"}),[p,v]=G.edges(a),f=u==="lowest"?"lowest":"highest",b=w.isEnd(t,v,v.path);X.splitNodes(t,{at:v,match:i,mode:f,voids:m,always:!b});var g=w.isStart(t,p,p.path);X.splitNodes(t,{at:p,match:i,mode:f,voids:m,always:!g}),a=h.unref(),r.at==null&&X.select(t,a)}s||(s=(R,O)=>R!==O);for(var[x,C]of w.nodes(t,{at:a,match:i,mode:u,voids:m})){var F={},D={};if(C.length!==0){var _=!1;for(var T in n)T==="children"||T==="text"||s(n[T],x[T])&&(_=!0,x.hasOwnProperty(T)&&(F[T]=x[T]),o?n[T]!=null&&(D[T]=o(x[T],n[T])):n[T]!=null&&(D[T]=n[T]));_&&t.apply({type:"set_node",path:C,properties:F,newProperties:D})}}}})},Ax=(e,t)=>{if(G.isCollapsed(t))return t.anchor;var[,n]=G.edges(t),r=w.pointRef(e,n);return X.delete(e,{at:t}),r.unref()},Bx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:i=!1}=n,{match:a,at:s=t.selection,height:o=0,always:l=!1}=n;if(a==null&&(a=se=>me.isElement(se)&&w.isBlock(t,se)),G.isRange(s)&&(s=Ax(t,s)),I.isPath(s)){var u=s,d=w.point(t,u),[m]=w.parent(t,u);a=se=>se===m,o=d.path.length-u.length+1,s=d,l=!0}if(s){var h=w.pointRef(t,s,{affinity:"backward"}),p;try{var[v]=w.nodes(t,{at:s,match:a,mode:r,voids:i});if(!v)return;var f=w.void(t,{at:s,mode:"highest"}),b=0;if(!i&&f){var[g,x]=f;if(me.isElement(g)&&t.isInline(g)){var C=w.after(t,x);if(!C){var F={text:""},D=I.next(x);X.insertNodes(t,F,{at:D,voids:i}),C=w.point(t,D)}s=C,l=!0}var _=s.path.length-x.length;o=_+1,l=!0}p=w.pointRef(t,s);var T=s.path.length-o,[,R]=v,O=s.path.slice(0,T),z=o===0?s.offset:s.path[T]+b;for(var[$,A]of w.levels(t,{at:O,reverse:!0,voids:i})){var B=!1;if(A.length<R.length||A.length===0||!i&&me.isElement($)&&w.isVoid(t,$))break;var j=h.current,M=w.isEnd(t,j,A);if(l||!h||!w.isEdge(t,j,A)){B=!0;var U=le.extractProps($);t.apply({type:"split_node",path:A,position:z,properties:U})}z=A[A.length-1]+(B||M?1:0)}if(n.at==null){var W=p.current||w.end(t,[]);X.select(t,W)}}finally{var ie;h.unref(),(ie=p)===null||ie===void 0||ie.unref()}}})},Tx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var i={};for(var a of n)i[a]=null;X.setNodes(t,i,r)},Sx=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};w.withoutNormalizing(t,()=>{var{mode:r="lowest",split:i=!1,voids:a=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=I.isPath(s)?yr(t,s):p=>me.isElement(p)&&w.isBlock(t,p)),I.isPath(s)&&(s=w.range(t,s));var l=G.isRange(s)?w.rangeRef(t,s):null,u=w.nodes(t,{at:s,match:o,mode:r,voids:a}),d=Array.from(u,p=>{var[,v]=p;return w.pathRef(t,v)}).reverse(),m=function(){var v=h.unref(),[f]=w.node(t,v),b=w.range(t,v);i&&l&&(b=G.intersection(l.current,b)),X.liftNodes(t,{at:b,match:g=>me.isAncestor(f)&&f.children.includes(g),voids:a})};for(var h of d)m();l&&l.unref()}})};function Vl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Hl(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){vt(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 jx=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};w.withoutNormalizing(t,()=>{var{mode:i="lowest",split:a=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(I.isPath(l)?o=yr(t,l):t.isInline(n)?o=b=>me.isElement(b)&&w.isInline(t,b)||ge.isText(b):o=b=>me.isElement(b)&&w.isBlock(t,b)),a&&G.isRange(l)){var[u,d]=G.edges(l),m=w.rangeRef(t,l,{affinity:"inward"});X.splitNodes(t,{at:d,match:o,voids:s}),X.splitNodes(t,{at:u,match:o,voids:s}),l=m.unref(),r.at==null&&X.select(t,l)}var h=Array.from(w.nodes(t,{at:l,match:t.isInline(n)?b=>me.isElement(b)&&w.isBlock(t,b):b=>w.isEditor(b),mode:"lowest",voids:s})),p=function(){var g=G.isRange(l)?G.intersection(l,w.range(t,f)):l;if(!g)return 0;var x=Array.from(w.nodes(t,{at:g,match:o,mode:i,voids:s}));if(x.length>0){var[C]=x,F=x[x.length-1],[,D]=C,[,_]=F;if(D.length===0&&_.length===0)return 0;var T=I.equals(D,_)?I.parent(D):I.common(D,_),R=w.range(t,D,_),O=w.node(t,T),[z]=O,$=T.length+1,A=I.next(_.slice(0,$)),B=Hl(Hl({},n),{},{children:[]});X.insertNodes(t,B,{at:A,voids:s}),X.moveNodes(t,{at:R,match:j=>me.isAncestor(z)&&z.children.includes(j),to:A.concat(0),voids:s})}},v;for(var[,f]of h)v=p()}})},Px=()=>{var e={children:[],operations:[],selection:null,marks:null,isElementReadOnly:()=>!1,isInline:()=>!1,isSelectable:()=>!0,isVoid:()=>!1,markableVoid:()=>!1,onChange:()=>{},apply:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return iy(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return cy(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return my(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return hy(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return py(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return sy(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ky(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ay(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return mx(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Fy(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ty(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return oy(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return sx(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ay(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return uy(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ly(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return dy(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return fy(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return hx(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return fx(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return px(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return gy(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return vy(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return by(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return yy(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return xy(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return qy(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Cy(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Dy(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ey(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return _y(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return xx(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Sy(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return jy(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Py(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Oy(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return My(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ny(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Iy(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ry(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return $y(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return wx(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ex(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return gx(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return _x(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Uy(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Wy(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Vy(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Hy(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Ky(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Gy(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Zy(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Yy(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Xy(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Qy(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Jy(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ex(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return tx(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ix(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return nx(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return rx(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return kx(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return vx(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Fx(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ox(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return bx(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return yx(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Bx(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return ux(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return lx(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return cx(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Tx(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Sx(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return wy(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return dx(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return jx(e,...r)}};return e},An=[],Ox=function(){return An.some(function(e){return e.activeTargets.length>0})},Mx=function(){return An.some(function(e){return e.skippedTargets.length>0})},Kl="ResizeObserver loop completed with undelivered notifications.",Nx=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Kl}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Kl),window.dispatchEvent(e)},Zr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Zr||(Zr={}));var Bn=function(e){return Object.freeze(e)},Ix=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,Bn(this)}return e}(),Hf=function(){function e(t,n,r,i){return this.x=t,this.y=n,this.width=r,this.height=i,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Bn(this)}return e.prototype.toJSON=function(){var t=this,n=t.x,r=t.y,i=t.top,a=t.right,s=t.bottom,o=t.left,l=t.width,u=t.height;return{x:n,y:r,top:i,right:a,bottom:s,left:o,width:l,height:u}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),Lo=function(e){return e instanceof SVGElement&&"getBBox"in e},Kf=function(e){if(Lo(e)){var t=e.getBBox(),n=t.width,r=t.height;return!n&&!r}var i=e,a=i.offsetWidth,s=i.offsetHeight;return!(a||s||e.getClientRects().length)},Zl=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)},Rx=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},Ir=typeof window<"u"?window:{},bi=new WeakMap,Yl=/auto|scroll/,$x=/^tb|vertical/,Lx=/msie|trident/i.test(Ir.navigator&&Ir.navigator.userAgent),Ut=function(e){return parseFloat(e||"0")},rr=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new Ix((n?t:e)||0,(n?e:t)||0)},Gl=Bn({devicePixelContentBoxSize:rr(),borderBoxSize:rr(),contentBoxSize:rr(),contentRect:new Hf(0,0,0,0)}),Zf=function(e,t){if(t===void 0&&(t=!1),bi.has(e)&&!t)return bi.get(e);if(Kf(e))return bi.set(e,Gl),Gl;var n=getComputedStyle(e),r=Lo(e)&&e.ownerSVGElement&&e.getBBox(),i=!Lx&&n.boxSizing==="border-box",a=$x.test(n.writingMode||""),s=!r&&Yl.test(n.overflowY||""),o=!r&&Yl.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),v=r?0:Ut(n.borderBottomWidth),f=r?0:Ut(n.borderLeftWidth),b=m+u,g=l+d,x=f+p,C=h+v,F=o?e.offsetHeight-C-e.clientHeight:0,D=s?e.offsetWidth-x-e.clientWidth:0,_=i?b+x:0,T=i?g+C:0,R=r?r.width:Ut(n.width)-_-D,O=r?r.height:Ut(n.height)-T-F,z=R+b+D+x,$=O+g+F+C,A=Bn({devicePixelContentBoxSize:rr(Math.round(R*devicePixelRatio),Math.round(O*devicePixelRatio),a),borderBoxSize:rr(z,$,a),contentBoxSize:rr(R,O,a),contentRect:new Hf(m,l,R,O)});return bi.set(e,A),A},Yf=function(e,t,n){var r=Zf(e,n),i=r.borderBoxSize,a=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Zr.DEVICE_PIXEL_CONTENT_BOX:return s;case Zr.BORDER_BOX:return i;default:return a}},zx=function(){function e(t){var n=Zf(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=Bn([n.borderBoxSize]),this.contentBoxSize=Bn([n.contentBoxSize]),this.devicePixelContentBoxSize=Bn([n.devicePixelContentBoxSize])}return e}(),Gf=function(e){if(Kf(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},qx=function(){var e=1/0,t=[];An.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new zx(u.target),m=Gf(u.target);o.push(d),u.lastReportedSize=Yf(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 i=r[n];i()}return e},Ql=function(e){An.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(i){i.isActive()&&(Gf(i.target)>e?n.activeTargets.push(i):n.skippedTargets.push(i))})})},Ux=function(){var e=0;for(Ql(e);Ox();)e=qx(),Ql(e);return Mx()&&Nx(),e>0},Ka,Qf=[],Wx=function(){return Qf.splice(0).forEach(function(e){return e()})},Vx=function(e){if(!Ka){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Wx()}).observe(n,r),Ka=function(){n.textContent="".concat(t?t--:t++)}}Qf.push(e),Ka()},Hx=function(e){Vx(function(){requestAnimationFrame(e)})},Oi=0,Kx=function(){return!!Oi},Zx=250,Yx={attributes:!0,characterData:!0,childList:!0,subtree:!0},Jl=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Xl=function(e){return e===void 0&&(e=0),Date.now()+e},Za=!1,Gx=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=Zx),!Za){Za=!0;var r=Xl(t);Hx(function(){var i=!1;try{i=Ux()}finally{if(Za=!1,t=r-Xl(),!Kx())return;i?n.run(1e3):t>0?n.run(t):n.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var t=this,n=function(){return t.observer&&t.observer.observe(document.body,Yx)};document.body?n():Ir.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Jl.forEach(function(n){return Ir.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Jl.forEach(function(n){return Ir.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),Us=new Gx,ec=function(e){!Oi&&e>0&&Us.start(),Oi+=e,!Oi&&Us.stop()},Qx=function(e){return!Lo(e)&&!Rx(e)&&getComputedStyle(e).display==="inline"},Jx=function(){function e(t,n){this.target=t,this.observedBox=n||Zr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=Yf(this.target,this.observedBox,!0);return Qx(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Xx=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),yi=new WeakMap,tc=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},xi=function(){function e(){}return e.connect=function(t,n){var r=new Xx(t,n);yi.set(t,r)},e.observe=function(t,n,r){var i=yi.get(t),a=i.observationTargets.length===0;tc(i.observationTargets,n)<0&&(a&&An.push(i),i.observationTargets.push(new Jx(n,r&&r.box)),ec(1),Us.schedule())},e.unobserve=function(t,n){var r=yi.get(t),i=tc(r.observationTargets,n),a=r.observationTargets.length===1;i>=0&&(a&&An.splice(An.indexOf(r),1),r.observationTargets.splice(i,1),ec(-1))},e.disconnect=function(t){var n=this,r=yi.get(t);r.observationTargets.slice().forEach(function(i){return n.unobserve(t,i.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),e1=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.");xi.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(!Zl(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");xi.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(!Zl(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");xi.unobserve(this,t)},e.prototype.disconnect=function(){xi.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),cn={};Object.defineProperty(cn,"__esModule",{value:!0});var t1=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Ya={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Jf={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:t1?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},zo={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 wi=1;wi<20;wi++)zo["f"+wi]=111+wi;function ya(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Xf(s,t)}),i=function(o){return r.some(function(l){return em(l,o)})},a=n==null?i:i(n);return a}function n1(e,t){return ya(e,t)}function r1(e,t){return ya(e,{byKey:!0},t)}function Xf(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var i=e.split("+"),a=i.length;for(var s in Ya)r[Ya[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var d=i[Symbol.iterator](),m;!(o=(m=d.next()).done);o=!0){var h=m.value,p=h.endsWith("?")&&h.length>1;p&&(h=h.slice(0,-1));var v=qo(h),f=Ya[v];if(h.length>1&&!f&&!Jf[h]&&!zo[v])throw new TypeError('Unknown modifier: "'+h+'"');(a===1||!f)&&(n?r.key=v:r.which=tm(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 em(e,t){for(var n in e){var r=e[n],i=void 0;if(r!=null&&(n==="key"&&t.key!=null?i=t.key.toLowerCase():n==="which"?i=r===91&&t.which===93?91:t.which:i=t[n],!(i==null&&r===!1)&&i!==r))return!1}return!0}function tm(e){e=qo(e);var t=zo[e]||e.toUpperCase().charCodeAt(0);return t}function qo(e){return e=e.toLowerCase(),e=Jf[e]||e,e}var i1=cn.default=ya,Ga=cn.isHotkey=ya;cn.isCodeHotkey=n1;cn.isKeyHotkey=r1;cn.parseHotkey=Xf;cn.compareHotkey=em;cn.toKeyCode=tm;cn.toKeyName=qo;function a1(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function fr(e,t){if(e==null)return{};var n=a1(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Yr(e){"@babel/helpers - typeof";return Yr=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},Yr(e)}function s1(e,t){if(Yr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Yr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function o1(e){var t=s1(e,"string");return Yr(t)==="symbol"?t:String(t)}function Nt(e,t,n){return t=o1(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Uo=y.createContext(null),wn=()=>{var e=y.useContext(Uo);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},nm=parseInt(y.version.split(".")[0],10),u1=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,nc=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),gt=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Xn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Pr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),l1=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),rm=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),c1=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),d1=gt&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),f1=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),m1=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),h1=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),Mi=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",dn=(!c1||!d1)&&!l1&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Wo=new WeakMap,Vo=new WeakMap,im=new WeakMap,Ni=new WeakMap,Ws=new WeakMap,Gr=new WeakMap,Tn=new WeakMap,ta=new WeakMap,xa=new WeakMap,Vs=new WeakMap,vn=new WeakMap,Fn=new WeakMap,Rr=new WeakMap,Hs=new WeakMap,Ho=new WeakMap,Lt=new WeakMap,nn=new WeakMap,xt=new WeakMap,mn=new WeakMap,hn=new WeakMap,am=new WeakMap,mr=Symbol("placeholder"),sm=Symbol("mark-placeholder"),p1=globalThis.Text,Ko=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,g1=e=>bn(e)&&e.nodeType===8,Mt=e=>bn(e)&&e.nodeType===1,bn=e=>{var t=Ko(e);return!!t&&e instanceof t.Node},Ks=e=>{var t=e&&e.anchorNode&&Ko(e.anchorNode);return!!t&&e instanceof t.Selection},om=e=>bn(e)&&e.nodeType===3,v1=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,b1=e=>{var[t,n]=e;if(Mt(t)&&t.childNodes.length){var r=n===t.childNodes.length,i=r?n-1:n;for([t,i]=um(t,i,r?"backward":"forward"),r=i<n;Mt(t)&&t.childNodes.length;){var a=r?t.childNodes.length-1:0;t=x1(t,a,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},y1=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},um=(e,t,n)=>{for(var{childNodes:r}=e,i=r[t],a=t,s=!1,o=!1;(g1(i)||Mt(i)&&i.childNodes.length===0||Mt(i)&&i.getAttribute("contenteditable")==="false")&&!(s&&o);){if(a>=r.length){s=!0,a=t-1,n="backward";continue}if(a<0){o=!0,a=t+1,n="forward";continue}i=r[a],t=a,a+=n==="forward"?1:-1}return[i,t]},x1=(e,t,n)=>{var[r]=um(e,t,n);return r},lm=e=>{var t="";if(om(e)&&e.nodeValue)return e.nodeValue;if(Mt(e)){for(var n of Array.from(e.childNodes))t+=lm(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
72
+ `)}return t},w1=/data-slate-fragment="(.+?)"/m,C1=e=>{var t=e.getData("text/html"),[,n]=t.match(w1)||[];return n},Zo=(e,t,n)=>{var{target:r}=t;if(Mt(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:i}=ne.getWindow(e);if(i.contains(r))return ne.hasDOMNode(e,r,{editable:!0});var a=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!a||a===t?!1:Zo(e,a,n)},D1=0;class E1{constructor(){Nt(this,"id",void 0),this.id="".concat(D1++)}}var ne={androidPendingDiffs:e=>xt.get(e),androidScheduleFlush:e=>{var t;(t=Ho.get(e))===null||t===void 0||t()},blur:e=>{var t=ne.toDOMNode(e,e),n=ne.findDocumentOrShadowRoot(e);vn.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=ne.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&X.deselect(e)},findDocumentOrShadowRoot:e=>{var t=ne.toDOMNode(e,e),n=t.getRootNode();return(n instanceof Document||n instanceof ShadowRoot)&&n.getSelection!=null?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:i}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var a=ne.toSlateNode(e,t.target),s=ne.findPath(e,a);if(me.isElement(a)&&w.isVoid(e,a)){var o=i.getBoundingClientRect(),l=e.isInline(a)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,u=w.point(e,s,{edge:l?"start":"end"}),d=l?w.before(e,u):w.after(e,u);if(d){var m=w.range(e,d);return m}}var h,{document:p}=ne.getWindow(e);if(p.caretRangeFromPoint)h=p.caretRangeFromPoint(n,r);else{var v=p.caretPositionFromPoint(n,r);v&&(h=p.createRange(),h.setStart(v.offsetNode,v.offset),h.setEnd(v.offsetNode,v.offset))}if(!h)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=ne.toSlateRange(e,h,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=ta.get(t);return n||(n=new E1,ta.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var i=Vo.get(r);if(i==null){if(w.isEditor(r))return n;break}var a=Wo.get(r);if(a==null)break;n.unshift(a),r=i}throw new Error("Unable to find the path for Slate node: ".concat(it.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!vn.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(()=>{ne.focus(t,{retries:n.retries-1})},10);return}var r=ne.toDOMNode(t,t),i=ne.findDocumentOrShadowRoot(t);if(i.activeElement!==r){if(t.selection&&i instanceof Document){var a=i.getSelection(),s=ne.toDOMRange(t,t.selection);a==null||a.removeAllRanges(),a==null||a.addRange(s)}t.selection||(X.select(t,w.start(t,[])),t.onChange()),vn.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=im.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{editable:i=!1}=r,a=ne.toDOMNode(t,t),s;try{s=Mt(n)?n:n.parentElement}catch(o){if(o instanceof Error&&!o.message.includes('Permission denied to access property "nodeType"'))throw o}return s?s.closest("[data-slate-editor]")===a&&(!i||s.isContentEditable?!0:typeof s.isContentEditable=="boolean"&&s.closest('[contenteditable="false"]')===a||!!s.getAttribute("data-slate-zero-width")):!1},hasEditableTarget:(e,t)=>bn(t)&&ne.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return w.hasPath(e,n.path)&&w.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>ne.hasEditableTarget(e,t)||ne.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>bn(t)&&ne.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!Fn.get(e),isFocused:e=>!!vn.get(e),isReadOnly:e=>!!Vs.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Vs.get(e))return!1;var n=ne.hasTarget(e,t)&&ne.toSlateNode(e,t);return me.isElement(n)&&w.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=xa.get(e),r=w.isEditor(t)?Ni.get(e):n==null?void 0:n.get(ne.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(it.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=w.node(e,t.path),r=ne.toDOMNode(e,n),i;w.void(e,{at:t})&&(t={path:t.path,offset:0});for(var a="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(a)),o=0,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),v=o+p,f=s[l+1];if(t.offset===v&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var b,g=f.childNodes[0];i=[g instanceof p1?g:f,(b=f.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=v){var x=Math.min(m,Math.max(0,t.offset-o));i=[d,x];break}o=v}}if(!i)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(it.stringify(t)));return i},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,i=G.isBackward(t),a=ne.toDOMPoint(e,n),s=G.isCollapsed(t)?a:ne.toDOMPoint(e,r),o=ne.getWindow(e),l=o.document.createRange(),[u,d]=i?s:a,[m,h]=i?a:s,p=Mt(u)?u:u.parentElement,v=!!p.getAttribute("data-slate-zero-width"),f=Mt(m)?m:m.parentElement,b=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,v?1:d),l.setEnd(m,b?1:h),l},toSlateNode:(e,t)=>{var n=Mt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Gr.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},toSlatePoint:(e,t,n)=>{var{exactMatch:r,suppressThrow:i}=n,[a,s]=r?t:b1(t),o=a.parentNode,l=null,u=0;if(o){var d,m,h=ne.toDOMNode(e,e),p=o.closest('[data-slate-void="true"]'),v=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 g=ne.getWindow(e),x=g.document.createRange();x.setStart(l,0),x.setEnd(a,s);var C=x.cloneContents(),F=[...Array.prototype.slice.call(C.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(C.querySelectorAll("[contenteditable=false]"))];F.forEach(j=>{if(gt&&!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=C.textContent.length,b=l}}else if(v){for(var D=v.querySelectorAll("[data-slate-leaf]"),_=0;_<D.length;_++){var T=D[_];if(ne.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&&gt&&b.getAttribute("data-slate-zero-width")==="z"&&(d=b.textContent)!==null&&d!==void 0&&d.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Xn&&(m=b.textContent)!==null&&m!==void 0&&m.endsWith(`
73
73
 
74
- `))&&u--}if(mt&&!l&&!r){var R=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(R&&te.hasDOMNode(e,R,{editable:!0})){var P=te.toSlateNode(e,R),{path:z,offset:$}=x.start(e,te.findPath(e,P));return R.querySelector("[data-slate-leaf]")||($=s),{path:z,offset:$}}}if(!l){if(i)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var B=te.toSlateNode(e,l),A=te.findPath(e,B);return{path:A,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:i,suppressThrow:a}=n,s=Ks(t)?t.anchorNode:t.startContainer,o,l,u,d,h;if(s)if(Ks(t)){if(Jn&&t.rangeCount>1){u=t.focusNode;var p=t.getRangeAt(0),m=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement&&m.startContainer instanceof HTMLTableRowElement){let k=function(T){return T.childElementCount>0?k(T.children[0]):T};var v=p.startContainer,f=m.startContainer,b=k(v.children[p.startOffset]),g=k(f.children[m.startOffset]);d=0,g.childNodes.length>0?o=g.childNodes[0]:o=g,b.childNodes.length>0?u=b.childNodes[0]:u=b,g instanceof HTMLElement?l=g.innerHTML.length:l=0}else p.startContainer===u?(o=m.endContainer,l=m.endOffset,d=p.startOffset):(o=p.startContainer,l=p.endOffset,d=m.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,d=t.focusOffset;Yf&&p1(o)||Jn?h=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:h=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,d=t.endOffset,h=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(Jn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
74
+ `))&&u--}if(gt&&!l&&!r){var R=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(R&&ne.hasDOMNode(e,R,{editable:!0})){var O=ne.toSlateNode(e,R),{path:z,offset:$}=w.start(e,ne.findPath(e,O));return R.querySelector("[data-slate-leaf]")||($=s),{path:z,offset:$}}}if(!l){if(i)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var A=ne.toSlateNode(e,l),B=ne.findPath(e,A);return{path:B,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:i,suppressThrow:a}=n,s=Ks(t)?t.anchorNode:t.startContainer,o,l,u,d,m;if(s)if(Ks(t)){if(Xn&&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 _=function(T){return T.childElementCount>0?_(T.children[0]):T};var v=h.startContainer,f=p.startContainer,b=_(v.children[h.startOffset]),g=_(f.children[p.startOffset]);d=0,g.childNodes.length>0?o=g.childNodes[0]:o=g,b.childNodes.length>0?u=b.childNodes[0]:u=b,g instanceof HTMLElement?l=g.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;rm&&y1(o)||Xn?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(Xn&&(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 D;u=o,d=((D=o.textContent)===null||D===void 0?void 0:D.length)||0}var w=te.toSlatePoint(e,[o,l],{exactMatch:i,suppressThrow:a});if(!w)return null;var F=h?w:te.toSlatePoint(e,[u,d],{exactMatch:i,suppressThrow:a});if(!F)return null;var E={anchor:w,focus:F};return Y.isExpanded(E)&&Y.isForward(E)&&Mt(u)&&x.void(e,{at:E.focus,mode:"highest"})&&(E=x.unhangRange(e,E,{voids:!0})),E}};function C1(e,t){var{path:n,diff:r}=t;if(!x.hasPath(e,n))return!1;var i=le.get(e,n);if(!ge.isText(i))return!1;if(r.start!==i.text.length||r.text.length===0)return i.text.slice(r.start,r.start+r.text.length)===r.text;var a=I.next(n);if(!x.hasPath(e,a))return!1;var s=le.get(e,a);return ge.isText(s)&&s.text.startsWith(r.text)}function nh(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.reduce((i,a)=>i.slice(0,a.start)+a.text+i.slice(a.end),e)}function w1(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 D1(e,t,n){for(var r=Math.min(e.length,t.length,n),i=0;i<r;i++)if(e.charAt(e.length-i-1)!==t.charAt(t.length-i-1))return i;return r}function rh(e,t){var{start:n,end:r,text:i}=t,a=e.slice(n,r),s=w1(a,i),o=Math.min(a.length-s,i.length-s),l=D1(a,i,o),u={start:n+s,end:r-l,text:i.slice(s,i.length-l)};return u.start===u.end&&u.text.length===0?null:u}function E1(e,t,n){var r=Math.min(t.start,n.start),i=Math.max(0,Math.min(t.start+t.text.length,n.end)-n.start),a=nh(e,t,n),s=Math.max(n.start+n.text.length,t.start+t.text.length+(t.start+t.text.length>n.start?n.text.length:0)-i),o=a.slice(r,s),l=Math.max(t.end,n.end-t.text.length+(t.end-t.start));return rh(e,{start:r,end:l,text:o})}function _1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Zs(e,t){var{path:n,offset:r}=t;if(!x.hasPath(e,n))return null;var i=le.get(e,n);if(!ge.isText(i))return null;var a=x.above(e,{match:o=>fe.isElement(o)&&x.isBlock(e,o),at:n});if(!a)return null;for(;r>i.text.length;){var s=x.next(e,{at:n,match:ge.isText});if(!s||!I.isDescendant(s[1],a[1]))return null;r-=i.text.length,i=s[0],n=s[1]}return{path:n,offset:r}}function Ql(e,t){var n=Zs(e,t.anchor);if(!n)return null;if(Y.isCollapsed(t))return{anchor:n,focus:n};var r=Zs(e,t.focus);return r?{anchor:n,focus:r}:null}function Ys(e,t,n){var r=yt.get(e),i=r==null?void 0:r.find(d=>{var{path:h}=d;return I.equals(h,t.path)});if(!i||t.offset<=i.diff.start)return Te.transform(t,n,{affinity:"backward"});var{diff:a}=i;if(t.offset<=a.start+a.text.length){var s={path:t.path,offset:a.start},o=Te.transform(s,n,{affinity:"backward"});return o?{path:o.path,offset:o.offset+t.offset-a.start}:null}var l={path:t.path,offset:t.offset-a.text.length+a.end-a.start},u=Te.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&I.equals(n.path,t.path)&&l.offset<n.position&&a.start<n.position?u:{path:u.path,offset:u.offset+a.text.length-a.end+a.start}:null}function Jl(e,t,n){var r=Ys(e,t.anchor,n);if(!r)return null;if(Y.isCollapsed(t))return{anchor:r,focus:r};var i=Ys(e,t.focus,n);return i?{anchor:r,focus:i}:null}function k1(e,t){var{path:n,diff:r,id:i}=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:i,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:i,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:i,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:i,path:n};case"split_node":return!I.equals(t.path,n)||t.position>=r.end?{diff:r,id:i,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:i,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:i,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:i,path:I.transform(n,t)}:{diff:r,id:i,path:I.transform(n,t)}}var a=I.transform(n,t);return a?{diff:r,path:a,id:i}:null}function Xl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function xi(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){Nt(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 F1=25,A1=200,B1=function(){},T1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function S1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,i=!1,a=null,s=null,o=null,l=0,u=!1,d=()=>{var B=mn.get(t);if(mn.delete(t),B){var{selection:A}=t,j=Ql(t,B);j&&(!A||!Y.equals(j,A))&&X.select(t,j)}},h=()=>{var B=hn.get(t);if(hn.delete(t),!!B){if(B.at){var A=Te.isPoint(B.at)?Zs(t,B.at):Ql(t,B.at);if(!A)return;var j=x.range(t,A);(!t.selection||!Y.equals(t.selection,j))&&X.select(t,A)}B.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!F()&&!w()){d();return}i||(i=!0,setTimeout(()=>i=!1)),w()&&(i="action");var B=t.selection&&x.rangeRef(t,t.selection,{affinity:"forward"});nn.set(t,t.marks),B1("flush",hn.get(t),yt.get(t));for(var A=F(),j;j=(M=yt.get(t))===null||M===void 0?void 0:M[0];){var M,U,W=Lt.get(t);W!==void 0&&(Lt.delete(t),t.marks=W),W&&u===!1&&(u=null);var ie=_1(j);(!t.selection||!Y.equals(t.selection,ie))&&X.select(t,ie),j.diff.text?x.insertText(t,j.diff.text):x.deleteFragment(t),yt.set(t,(U=yt.get(t))===null||U===void 0?void 0:U.filter(G=>{var{id:ne}=G;return ne!==j.id})),C1(t,j)||(A=!1,hn.delete(t),nn.delete(t),i="action",mn.delete(t),n.cancel(),r.cancel(),B==null||B.unref())}var ae=B==null?void 0:B.unref();if(ae&&!mn.get(t)&&(!t.selection||!Y.equals(ae,t.selection))&&X.select(t,ae),w()){h();return}A&&n(),n.flush(),r.flush(),d();var C=nn.get(t);nn.delete(t),C!==void 0&&(t.marks=C,t.onChange())},m=B=>{a&&clearTimeout(a),a=setTimeout(()=>{Fn.set(t,!1),p()},F1)},v=B=>{Fn.set(t,!0),a&&(clearTimeout(a),a=null)},f=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=Ws.get(t);if(j){if(F()||A){j.style.display="none";return}j.style.removeProperty("display")}},b=(B,A)=>{var j,M=(j=yt.get(t))!==null&&j!==void 0?j:[];yt.set(t,M);var U=le.leaf(t,B),W=M.findIndex(C=>I.equals(C.path,B));if(W<0){var ie=rh(U.text,A);ie&&M.push({path:B,diff:A,id:l++}),f();return}var ae=E1(U.text,M[W].diff,A);if(!ae){M.splice(W,1),f();return}M[W]=xi(xi({},M[W]),{},{diff:ae})},g=function(A){var{at:j}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,mn.delete(t),n.cancel(),r.cancel(),w()&&p(),hn.set(t,{at:j,run:A}),o=setTimeout(p)},D=B=>{var A;s&&(clearTimeout(s),s=null);var{inputType:j}=B,M=null,U=B.dataTransfer||B.data||void 0;u!==!1&&j!=="insertText"&&j!=="insertCompositionText"&&(u=!1);var[W]=B.getTargetRanges();W&&(M=te.toSlateRange(t,W,{exactMatch:!1,suppressThrow:!0}));var ie=te.getWindow(t),ae=ie.getSelection();if(!M&&ae&&(W=ae,M=te.toSlateRange(t,ae,{exactMatch:!1,suppressThrow:!0})),M=(A=M)!==null&&A!==void 0?A:t.selection,!!M){var C=!0;if(j.startsWith("delete")){if(Y.isExpanded(M)){var[G,ne]=Y.edges(M),_=le.leaf(t,G.path);if(_.text.length===G.offset&&ne.offset===0){var O=x.next(t,{at:G.path,match:ge.isText});O&&I.equals(O[1],ne.path)&&(M={anchor:ne,focus:ne})}}var q=j.endsWith("Backward")?"backward":"forward",[S,L]=Y.edges(M),[Q,K]=x.leaf(t,S.path),J={text:"",start:S.offset,end:L.offset},ce=yt.get(t),ee=ce==null?void 0:ce.find(me=>I.equals(me.path,K)),pe=ee?[ee.diff,J]:[J],ve=nh(Q.text,...pe);if(ve.length===0&&(C=!1),Y.isExpanded(M)){if(C&&I.equals(M.anchor.path,M.focus.path)){var Ee={path:M.anchor.path,offset:S.offset},Ce=x.range(t,Ee,Ee);return T(Ce),b(M.anchor.path,{text:"",end:L.offset,start:S.offset})}return g(()=>x.deleteFragment(t,{direction:q}),{at:M})}}switch(j){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return g(()=>x.deleteFragment(t),{at:M});case"deleteContent":case"deleteContentForward":{var{anchor:Fe}=M;if(C&&Y.isCollapsed(M)){var We=le.leaf(t,Fe.path);if(Fe.offset<We.text.length)return b(Fe.path,{text:"",start:Fe.offset,end:Fe.offset+1})}return g(()=>x.deleteForward(t),{at:M})}case"deleteContentBackward":{var Me,{anchor:ze}=M,Xe=Ks(W)?W.isCollapsed:!!((Me=W)!==null&&Me!==void 0&&Me.collapsed);return C&&Xe&&Y.isCollapsed(M)&&ze.offset>0?b(ze.path,{text:"",start:ze.offset-1,end:ze.offset}):g(()=>x.deleteBackward(t),{at:M})}case"deleteEntireSoftLine":return g(()=>{x.deleteBackward(t,{unit:"line"}),x.deleteForward(t,{unit:"line"})},{at:M});case"deleteHardLineBackward":return g(()=>x.deleteBackward(t,{unit:"block"}),{at:M});case"deleteSoftLineBackward":return g(()=>x.deleteBackward(t,{unit:"line"}),{at:M});case"deleteHardLineForward":return g(()=>x.deleteForward(t,{unit:"block"}),{at:M});case"deleteSoftLineForward":return g(()=>x.deleteForward(t,{unit:"line"}),{at:M});case"deleteWordBackward":return g(()=>x.deleteBackward(t,{unit:"word"}),{at:M});case"deleteWordForward":return g(()=>x.deleteForward(t,{unit:"word"}),{at:M});case"insertLineBreak":return g(()=>x.insertSoftBreak(t),{at:M});case"insertParagraph":return g(()=>x.insertBreak(t),{at:M});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(T1(U))return g(()=>te.insertData(t,U),{at:M});var Ae=U??"";if(Lt.get(t)&&(Ae=Ae.replace("\uFEFF","")),j==="insertText"&&/.*\n.*\n$/.test(Ae)&&(Ae=Ae.slice(0,-1)),Ae.includes(`
77
- `))return g(()=>{var me=Ae.split(`
78
- `);me.forEach((be,he)=>{be&&x.insertText(t,be),he!==me.length-1&&x.insertSoftBreak(t)})},{at:M});if(I.equals(M.anchor.path,M.focus.path)){var[je,qe]=Y.edges(M),Z={start:je.offset,end:qe.offset,text:Ae};if(Ae&&u&&j==="insertCompositionText"){var oe=u.start+u.text.search(/\S|$/),se=Z.start+Z.text.search(/\S|$/);se===oe+1&&Z.end===u.start+u.text.length?(Z.start-=1,u=null,z()):u=!1}else j==="insertText"?u===null?u=Z:u&&Y.isCollapsed(M)&&u.end+u.text.length===je.offset?u=xi(xi({},u),{},{text:u.text+Ae}):u=!1:u=!1;if(C){b(je.path,Z);return}}return g(()=>x.insertText(t,Ae),{at:M})}}}},w=()=>!!hn.get(t),F=()=>{var B;return!!((B=yt.get(t))!==null&&B!==void 0&&B.length)},E=()=>w()||F(),k=()=>i,T=B=>{mn.set(t,B),s&&(clearTimeout(s),s=null);var{selection:A}=t;if(B){var j=!A||!I.equals(A.anchor.path,B.anchor.path),M=!A||!I.equals(A.anchor.path.slice(0,-1),B.anchor.path.slice(0,-1));(j&&u||M)&&(u=!1),(j||F())&&(s=setTimeout(p,A1))}},R=()=>{(w()||!F())&&p()},P=B=>{F()||(f(!0),setTimeout(f))},z=()=>{w()||(o=setTimeout(p))},$=B=>{if(!(F()||w())&&B.some(j=>Vo(t,j,B))){var A;(A=Qf.get(t))===null||A===void 0||A()}};return{flush:p,scheduleFlush:z,hasPendingDiffs:F,hasPendingAction:w,hasPendingChanges:E,isFlushing:k,handleUserSelect:T,handleCompositionEnd:m,handleCompositionStart:v,handleDOMBeforeInput:D,handleKeyDown:P,handleDomMutations:$,handleInput:R}}function j1(){var e=y.useRef(!1);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Yr=Oi?y.useLayoutEffect:y.useEffect;function O1(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 P1=["node"];function ec(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function M1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ec(Object(n),!0).forEach(function(r){Nt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ec(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var N1={subtree:!0,childList:!0,characterData:!0},I1=mt?e=>{var{node:t}=e,n=cr(e,P1);if(!mt)return null;var r=Cn(),i=j1(),[a]=y.useState(()=>S1(M1({editor:r},n)));return O1(t,a.handleDomMutations,N1),Uo.set(r,a.scheduleFlush),i&&a.flush(),a}:()=>null,R1=["anchor","focus"],$1=["anchor","focus"],L1=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),ih=(e,t)=>{var n=cr(e,R1),r=cr(t,$1);return e[dr]===t[dr]&&L1(n,r)},z1=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],i=t[n];if(!Y.equals(r,i)||!ih(r,i))return!1}return!0},q1=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],i=t[n];if(r.anchor.offset!==i.anchor.offset||r.focus.offset!==i.focus.offset||!ih(r,i))return!1}return!0};function tc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function U1(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){Nt(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 W1=e=>{var{isLast:t,leaf:n,parent:r,text:i}=e,a=Cn(),s=te.findPath(a,i),o=I.parent(s),l=!!n[Jf];return a.isVoid(r)?y.createElement(Qa,{length:le.string(r).length}):n.text===""&&r.children[r.children.length-1]===i&&!a.isInline(r)&&x.string(a,o)===""?y.createElement(Qa,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?y.createElement(Qa,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
79
- `?y.createElement(nc,{isTrailing:!0,text:n.text}):y.createElement(nc,{text:n.text})},nc=e=>{var{text:t,isTrailing:n=!1}=e,r=y.useRef(null),i=()=>"".concat(t??"").concat(n?`
80
- `:""),[a]=y.useState(i);return Yr(()=>{var s=i();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(V1,{ref:r},a)},V1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Qa=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,i={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(i["data-slate-mark-placeholder"]=!0),y.createElement("span",U1({},i),!mt||!n?"\uFEFF":null,n?y.createElement("br",null):null)};function rc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ah(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){Nt(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 H1=mt?300:0;function K1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function ic(e){e.current&&(clearTimeout(e.current),e.current=null)}var Z1=e=>{var{leaf:t,isLast:n,text:r,parent:i,renderPlaceholder:a,renderLeaf:s=D=>y.createElement(G1,ah({},D))}=e,o=Cn(),l=y.useRef(null),u=y.useRef(null),[d,h]=y.useState(!1),p=y.useRef(null),m=y.useCallback(D=>{if(K1(l,D==null),D==null){var w;Ws.delete(o),(w=t.onPlaceholderResize)===null||w===void 0||w.call(t,null)}else{if(Ws.set(o,D),!l.current){var F=window.ResizeObserver||Gx;l.current=new F(()=>{var E;(E=t.onPlaceholderResize)===null||E===void 0||E.call(t,D)})}l.current.observe(D),u.current=D}},[u,t,o]),v=y.createElement(W1,{isLast:n,leaf:t,parent:i,text:r}),f=!!t[dr];if(y.useEffect(()=>(f?p.current||(p.current=setTimeout(()=>{h(!0),p.current=null},H1)):(ic(p),h(!1)),()=>ic(p)),[f,h]),f&&d){var b={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:Tr?"inherit":void 0},contentEditable:!1,ref:m}};v=y.createElement(y.Fragment,null,a(b),v)}var g={"data-slate-leaf":!0};return s({attributes:g,children:v,leaf:t,text:r})},Y1=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&&ge.equals(t.leaf,e.leaf)&&t.leaf[dr]===e.leaf[dr]),G1=e=>{var{attributes:t,children:n}=e;return y.createElement("span",ah({},t),n)},Q1=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:i,renderLeaf:a,text:s}=e,o=Cn(),l=y.useRef(null),u=ge.decorations(s,t),d=te.findKey(o,s),h=[],p=0;p<u.length;p++){var m=u[p];h.push(y.createElement(Y1,{isLast:n&&p===u.length-1,key:"".concat(d.id,"-").concat(p),renderPlaceholder:i,leaf:m,text:s,parent:r,renderLeaf:a}))}var v=y.useCallback(f=>{var b=xa.get(o);f?(b==null||b.set(d,f),Tn.set(s,f),Zr.set(f,s)):(b==null||b.delete(d),Tn.delete(s),l.current&&Zr.delete(l.current)),l.current=f},[l,o,d,s]);return y.createElement("span",{"data-slate-node":"text",ref:v},h)},sh=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&&q1(t.decorations,e.decorations));function ac(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gs(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){Nt(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 J1=e=>{var{decorations:t,element:n,renderElement:r=D=>y.createElement(eC,Gs({},D)),renderPlaceholder:i,renderLeaf:a,selection:s}=e,o=Cn(),l=rC(),u=o.isInline(n),d=te.findKey(o,n),h=y.useCallback(D=>{var w=xa.get(o);D?(w==null||w.set(d,D),Tn.set(n,D),Zr.set(D,n)):(w==null||w.delete(d),Tn.delete(n))},[o,d,n]),p=uh({decorations:t,node:n,renderElement:r,renderPlaceholder:i,renderLeaf:a,selection:s}),m={"data-slate-node":"element",ref:h};if(u&&(m["data-slate-inline"]=!0),!u&&x.hasInlines(o,n)){var v=le.string(n),f=Df(v);f==="rtl"&&(m.dir=f)}if(x.isVoid(o,n)){m["data-slate-void"]=!0,!l&&u&&(m.contentEditable=!1);var b=u?"span":"div",[[g]]=le.texts(n);p=y.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(sh,{renderPlaceholder:i,decorations:[],isLast:!1,parent:n,text:g})),zo.set(g,0),qo.set(g,n)}return r({attributes:m,children:p,element:n})},X1=y.memo(J1,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&z1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&Y.equals(e.selection,t.selection))),eC=e=>{var{attributes:t,children:n,element:r}=e,i=Cn(),a=i.isInline(r)?"span":"div";return y.createElement(a,Gs(Gs({},t),{},{style:{position:"relative"}}),n)},oh=y.createContext(()=>[]),tC=()=>y.useContext(oh),nC=y.createContext(!1),uh=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:i,renderLeaf:a,selection:s}=e,o=tC(),l=Cn(),u=te.findPath(l,n),d=[],h=fe.isElement(n)&&!l.isInline(n)&&x.hasInlines(l,n),p=0;p<n.children.length;p++){var m=u.concat(p),v=n.children[p],f=te.findKey(l,v),b=x.range(l,m),g=s&&Y.intersection(b,s),D=o([v,m]);for(var w of t){var F=Y.intersection(w,b);F&&D.push(F)}fe.isElement(v)?d.push(y.createElement(nC.Provider,{key:"provider-".concat(f.id),value:!!g},y.createElement(X1,{decorations:D,element:v,key:f.id,renderElement:r,renderPlaceholder:i,renderLeaf:a,selection:g}))):d.push(y.createElement(sh,{decorations:D,key:f.id,isLast:h&&p===n.children.length-1,parent:n,renderPlaceholder:i,renderLeaf:a,text:v})),zo.set(v,p),qo.set(v,n)}return d},lh=y.createContext(!1),rC=()=>y.useContext(lh),ch=y.createContext(null),Ln=()=>{var e=y.useContext(ch);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function iC(){var e=Cn(),t=y.useRef(!1),n=y.useRef(0),r=y.useCallback(()=>{if(!t.current){t.current=!0;var i=te.getWindow(e);i.cancelAnimationFrame(n.current),n.current=i.requestAnimationFrame(()=>{t.current=!1})}},[e]);return y.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var aC=3,sC={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"},oC={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"},uC={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ze=e=>{var t=sC[e],n=oC[e],r=uC[e],i=t&&Ga(t),a=n&&Ga(n),s=r&&Ga(r);return o=>!!(i&&i(o)||Gl&&a&&a(o)||!Gl&&s&&s(o))},Ge={isBold:Ze("bold"),isCompose:Ze("compose"),isMoveBackward:Ze("moveBackward"),isMoveForward:Ze("moveForward"),isDeleteBackward:Ze("deleteBackward"),isDeleteForward:Ze("deleteForward"),isDeleteLineBackward:Ze("deleteLineBackward"),isDeleteLineForward:Ze("deleteLineForward"),isDeleteWordBackward:Ze("deleteWordBackward"),isDeleteWordForward:Ze("deleteWordForward"),isExtendBackward:Ze("extendBackward"),isExtendForward:Ze("extendForward"),isExtendLineBackward:Ze("extendLineBackward"),isExtendLineForward:Ze("extendLineForward"),isItalic:Ze("italic"),isMoveLineBackward:Ze("moveLineBackward"),isMoveLineForward:Ze("moveLineForward"),isMoveWordBackward:Ze("moveWordBackward"),isMoveWordForward:Ze("moveWordForward"),isRedo:Ze("redo"),isSoftBreak:Ze("insertSoftBreak"),isSplitBlock:Ze("splitBlock"),isTransposeCharacter:Ze("transposeCharacter"),isUndo:Ze("undo")},lC=(e,t)=>{var n=[],r=()=>{n=[]},i=s=>{if(t.current){var o=s.filter(l=>Vo(e,l,s));n.push(...o)}};function a(){n.length>0&&(n.reverse().forEach(s=>{s.type!=="characterData"&&(s.removedNodes.forEach(o=>{s.target.insertBefore(o,s.nextSibling)}),s.addedNodes.forEach(o=>{s.target.removeChild(o)}))}),r())}return{registerMutations:i,restoreDOM:a,clear:r}},cC={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class dh extends y.Component{constructor(){super(...arguments),Nt(this,"context",null),Nt(this,"manager",null),Nt(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,cC)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=lC(n,t),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var t,n,r,i=(t=this.mutationObserver)===null||t===void 0?void 0:t.takeRecords();if(i!=null&&i.length){var a;(a=this.manager)===null||a===void 0||a.registerMutations(i)}return(n=this.mutationObserver)===null||n===void 0||n.disconnect(),(r=this.manager)===null||r===void 0||r.restoreDOM(),null}componentDidUpdate(){var t;(t=this.manager)===null||t===void 0||t.clear(),this.observe()}componentWillUnmount(){var t;(t=this.mutationObserver)===null||t===void 0||t.disconnect()}render(){return this.props.children}}Nt(dh,"contextType",Lo);var dC=mt?dh:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},fC=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],hC=["text"];function sc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Wt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sc(Object(n),!0).forEach(function(r){Nt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var mC=e=>y.createElement(y.Fragment,null,uh(e)),pC=e=>{var t=y.useCallback(O=>y.createElement(gC,Wt({},O)),[]),{autoFocus:n,decorate:r=vC,onDOMBeforeInput:i,placeholder:a,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=bC,style:h={},as:p="div",disableDefaultStyles:m=!1}=e,v=cr(e,fC),f=Ln(),[b,g]=y.useState(!1),D=y.useRef(null),w=y.useRef([]),[F,E]=y.useState(),{onUserInput:k,receivedUserInput:T}=iC(),[,R]=y.useReducer(O=>O+1,0);Qf.set(f,R),Vs.set(f,s);var P=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{D.current&&n&&D.current.focus()},[n]);var z=y.useRef(),$=y.useMemo(()=>Yb(()=>{var O=z.current;if((mt||!te.isComposing(f))&&(!P.isUpdatingSelection||O!=null&&O.isFlushing())&&!P.isDraggingInternally){var q=te.findDocumentOrShadowRoot(f),{activeElement:S}=q,L=te.toDOMNode(f,f),Q=q.getSelection();if(S===L?(P.latestElement=S,vn.set(f,!0)):vn.delete(f),!Q)return X.deselect(f);var{anchorNode:K,focusNode:J}=Q,ce=te.hasEditableTarget(f,K)||te.isTargetInsideNonReadonlyVoid(f,K),ee=te.hasEditableTarget(f,J)||te.isTargetInsideNonReadonlyVoid(f,J);if(ce&&ee){var pe=te.toSlateRange(f,Q,{exactMatch:!1,suppressThrow:!0});pe&&(!te.isComposing(f)&&!(O!=null&&O.hasPendingChanges())&&!(O!=null&&O.isFlushing())?X.select(f,pe):O==null||O.handleUserSelect(pe))}s&&(!ce||!ee)&&X.deselect(f)}},100),[f,s,P]),B=y.useMemo(()=>Ub($,0),[$]);z.current=I1({node:D,onDOMSelectionChange:$,scheduleOnDOMSelectionChange:B}),Yr(()=>{var O,q,S;D.current&&(S=Wo(D.current))?(Gf.set(f,S),Pi.set(f,D.current),Tn.set(f,D.current),Zr.set(D.current,f)):Tn.delete(f);var{selection:L}=f,Q=te.findDocumentOrShadowRoot(f),K=Q.getSelection();if(!(!K||!te.isFocused(f)||(O=z.current)!==null&&O!==void 0&&O.hasPendingAction())){var J=ve=>{var Ee=K.type!=="None";if(!(!L&&!Ee)){var Ce=K.focusNode,Fe;if(Jn&&K.rangeCount>1){var We=K.getRangeAt(0),Me=K.getRangeAt(K.rangeCount-1);We.startContainer===Ce?Fe=Me.endContainer:Fe=We.startContainer}else Fe=K.anchorNode;var ze=Pi.get(f),Xe=!1;if(ze.contains(Fe)&&ze.contains(Ce)&&(Xe=!0),Ee&&Xe&&L&&!ve){var Ae=te.toSlateRange(f,K,{exactMatch:!0,suppressThrow:!0});if(Ae&&Y.equals(Ae,L)){var je;if(!P.hasMarkPlaceholder||(je=Fe)!==null&&je!==void 0&&(je=je.parentElement)!==null&&je!==void 0&&je.hasAttribute("data-slate-mark-placeholder"))return}}if(L&&!te.hasRange(f,L)){f.selection=te.toSlateRange(f,K,{exactMatch:!1,suppressThrow:!0});return}P.isUpdatingSelection=!0;var qe=L&&te.toDOMRange(f,L);return qe?(te.isComposing(f)&&!mt?K.collapseToEnd():Y.isBackward(L)?K.setBaseAndExtent(qe.endContainer,qe.endOffset,qe.startContainer,qe.startOffset):K.setBaseAndExtent(qe.startContainer,qe.startOffset,qe.endContainer,qe.endOffset),d(f,qe)):K.removeAllRanges(),qe}};K.rangeCount<=1&&J();var ce=((q=z.current)===null||q===void 0?void 0:q.isFlushing())==="action";if(!mt||!ce){setTimeout(()=>{P.isUpdatingSelection=!1});return}var ee=null,pe=requestAnimationFrame(()=>{if(ce){var ve=Ee=>{try{var Ce=te.toDOMNode(f,f);Ce.focus(),J(Ee)}catch{}};ve(),ee=setTimeout(()=>{ve(!0),P.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(pe),ee&&clearTimeout(ee)}}});var A=y.useCallback(O=>{if(k(),!s&&te.hasEditableTarget(f,O.target)&&!yC(O,i)){var q;if(z.current)return z.current.handleDOMBeforeInput(O);B.flush(),$.flush();var{selection:S}=f,{inputType:L}=O,Q=O.dataTransfer||O.data||void 0,K=L==="insertCompositionText"||L==="deleteCompositionText";if(K&&te.isComposing(f))return;var J=!1;if(L==="insertText"&&S&&Y.isCollapsed(S)&&O.data&&O.data.length===1&&/[a-z ]/i.test(O.data)&&S.anchor.offset!==0){var ce,ee;J=!0,f.marks&&(J=!1);var{anchor:pe}=S,[ve,Ee]=te.toDOMPoint(f,pe),Ce=(ce=ve.parentElement)===null||ce===void 0?void 0:ce.closest("a"),Fe=te.getWindow(f);if(J&&Ce&&te.hasDOMNode(f,Ce)){var We,Me=Fe==null?void 0:Fe.document.createTreeWalker(Ce,NodeFilter.SHOW_TEXT).lastChild();Me===ve&&((We=Me.textContent)===null||We===void 0?void 0:We.length)===Ee&&(J=!1)}if(J&&ve.parentElement&&(Fe==null||(ee=Fe.getComputedStyle(ve.parentElement))===null||ee===void 0?void 0:ee.whiteSpace)==="pre"){var ze=x.above(f,{at:pe.path,match:oe=>fe.isElement(oe)&&x.isBlock(f,oe)});ze&&le.string(ze[0]).includes(" ")&&(J=!1)}}if(!L.startsWith("delete")||L.startsWith("deleteBy")){var[Xe]=O.getTargetRanges();if(Xe){var Ae=te.toSlateRange(f,Xe,{exactMatch:!1,suppressThrow:!1});if(!S||!Y.equals(S,Ae)){J=!1;var je=!K&&f.selection&&x.rangeRef(f,f.selection);X.select(f,Ae),je&&Mr.set(f,je)}}}if(K)return;if(J||O.preventDefault(),S&&Y.isExpanded(S)&&L.startsWith("delete")){var qe=L.endsWith("Backward")?"backward":"forward";x.deleteFragment(f,{direction:qe});return}switch(L){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":{L==="insertFromComposition"&&te.isComposing(f)&&(g(!1),Fn.set(f,!1)),(Q==null?void 0:Q.constructor.name)==="DataTransfer"?te.insertData(f,Q):typeof Q=="string"&&(J?w.current.push(()=>x.insertText(f,Q)):x.insertText(f,Q));break}}var Z=(q=Mr.get(f))===null||q===void 0?void 0:q.unref();Mr.delete(f),Z&&(!f.selection||!Y.equals(f.selection,Z))&&X.select(f,Z)}},[f,$,k,i,s,B]),j=y.useCallback(O=>{O==null?($.cancel(),B.cancel(),Pi.delete(f),Tn.delete(f),D.current&&dn&&D.current.removeEventListener("beforeinput",A)):dn&&O.addEventListener("beforeinput",A),D.current=O},[$,B,f,A]);Yr(()=>{var O=te.getWindow(f);return O.document.addEventListener("selectionchange",B),()=>{O.document.removeEventListener("selectionchange",B)}},[B]);var M=r([f,[]]),U=a&&f.children.length===1&&Array.from(le.texts(f)).length===1&&le.string(f)===""&&!b,W=y.useCallback(O=>{if(O&&U){var q;E((q=O.getBoundingClientRect())===null||q===void 0?void 0:q.height)}else E(void 0)},[U]);if(U){var ie=x.start(f,[]);M.push({[dr]:!0,placeholder:a,onPlaceholderResize:W,anchor:ie,focus:ie})}var{marks:ae}=f;if(P.hasMarkPlaceholder=!1,f.selection&&Y.isCollapsed(f.selection)&&ae){var{anchor:C}=f.selection,G=le.leaf(f,C.path),ne=cr(G,hC);if(!ge.equals(G,ae,{loose:!0})){P.hasMarkPlaceholder=!0;var _=Object.fromEntries(Object.keys(ne).map(O=>[O,null]));M.push(Wt(Wt(Wt({[Jf]:!0},_),ae),{},{anchor:C,focus:C}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:O}=f;if(O){var{anchor:q}=O,S=le.leaf(f,q.path);if(ae&&!ge.equals(S,ae,{loose:!0})){Lt.set(f,ae);return}}Lt.delete(f)})}),y.createElement(lh.Provider,{value:s},y.createElement(oh.Provider,{value:r},y.createElement(dC,{node:D,receivedUserInput:T},y.createElement(p,Wt(Wt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},v),{},{spellCheck:dn||!Oi?v.spellCheck:!1,autoCorrect:dn||!Oi?v.autoCorrect:"false",autoCapitalize:dn||!Oi?v.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:j,style:Wt(Wt({},m?{}:Wt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},F?{minHeight:F}:{})),h),onBeforeInput:y.useCallback(O=>{if(!dn&&!s&&!ft(O,v.onBeforeInput)&&te.hasSelectableTarget(f,O.target)&&(O.preventDefault(),!te.isComposing(f))){var q=O.data;x.insertText(f,q)}},[v.onBeforeInput,f,s]),onInput:y.useCallback(O=>{if(!ft(O,v.onInput)){if(z.current){z.current.handleInput();return}for(var q of w.current)q();w.current=[]}},[v.onInput]),onBlur:y.useCallback(O=>{if(!(s||P.isUpdatingSelection||!te.hasSelectableTarget(f,O.target)||ft(O,v.onBlur))){var q=te.findDocumentOrShadowRoot(f);if(P.latestElement!==q.activeElement){var{relatedTarget:S}=O,L=te.toDOMNode(f,f);if(S!==L&&!(Mt(S)&&S.hasAttribute("data-slate-spacer"))){if(S!=null&&bn(S)&&te.hasDOMNode(f,S)){var Q=te.toSlateNode(f,S);if(fe.isElement(Q)&&!f.isVoid(Q))return}if(Tr){var K=q.getSelection();K==null||K.removeAllRanges()}vn.delete(f)}}}},[s,P.isUpdatingSelection,P.latestElement,f,v.onBlur]),onClick:y.useCallback(O=>{if(te.hasTarget(f,O.target)&&!ft(O,v.onClick)&&bn(O.target)){var q=te.toSlateNode(f,O.target),S=te.findPath(f,q);if(!x.hasPath(f,S)||le.get(f,S)!==q)return;if(O.detail===aC&&S.length>=1){var L=S;if(!(fe.isElement(q)&&x.isBlock(f,q))){var Q,K=x.above(f,{match:Ce=>fe.isElement(Ce)&&x.isBlock(f,Ce),at:S});L=(Q=K==null?void 0:K[1])!==null&&Q!==void 0?Q:S.slice(0,1)}var J=x.range(f,L);X.select(f,J);return}if(s)return;var ce=x.start(f,S),ee=x.end(f,S),pe=x.void(f,{at:ce}),ve=x.void(f,{at:ee});if(pe&&ve&&I.equals(pe[1],ve[1])){var Ee=x.range(f,ce);X.select(f,Ee)}}},[f,v.onClick,s]),onCompositionEnd:y.useCallback(O=>{if(te.hasSelectableTarget(f,O.target)){var q;if(te.isComposing(f)&&Promise.resolve().then(()=>{g(!1),Fn.set(f,!1)}),(q=z.current)===null||q===void 0||q.handleCompositionEnd(O),ft(O,v.onCompositionEnd)||mt)return;if(!Tr&&!u1&&!i1&&!c1&&!l1&&O.data){var S=Lt.get(f);Lt.delete(f),S!==void 0&&(nn.set(f,f.marks),f.marks=S),x.insertText(f,O.data);var L=nn.get(f);nn.delete(f),L!==void 0&&(f.marks=L)}}},[v.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(O=>{te.hasSelectableTarget(f,O.target)&&!ft(O,v.onCompositionUpdate)&&(te.isComposing(f)||(g(!0),Fn.set(f,!0)))},[v.onCompositionUpdate,f]),onCompositionStart:y.useCallback(O=>{if(te.hasSelectableTarget(f,O.target)){var q;if((q=z.current)===null||q===void 0||q.handleCompositionStart(O),ft(O,v.onCompositionStart)||mt)return;g(!0);var{selection:S}=f;if(S&&Y.isExpanded(S)){x.deleteFragment(f);return}}},[v.onCompositionStart,f]),onCopy:y.useCallback(O=>{te.hasSelectableTarget(f,O.target)&&!ft(O,v.onCopy)&&!oc(O)&&(O.preventDefault(),te.setFragmentData(f,O.clipboardData,"copy"))},[v.onCopy,f]),onCut:y.useCallback(O=>{if(!s&&te.hasSelectableTarget(f,O.target)&&!ft(O,v.onCut)&&!oc(O)){O.preventDefault(),te.setFragmentData(f,O.clipboardData,"cut");var{selection:q}=f;if(q)if(Y.isExpanded(q))x.deleteFragment(f);else{var S=le.parent(f,q.anchor.path);x.isVoid(f,S)&&X.delete(f)}}},[s,f,v.onCut]),onDragOver:y.useCallback(O=>{if(te.hasTarget(f,O.target)&&!ft(O,v.onDragOver)){var q=te.toSlateNode(f,O.target);fe.isElement(q)&&x.isVoid(f,q)&&O.preventDefault()}},[v.onDragOver,f]),onDragStart:y.useCallback(O=>{if(!s&&te.hasTarget(f,O.target)&&!ft(O,v.onDragStart)){var q=te.toSlateNode(f,O.target),S=te.findPath(f,q),L=fe.isElement(q)&&x.isVoid(f,q)||x.void(f,{at:S,voids:!0});if(L){var Q=x.range(f,S);X.select(f,Q)}P.isDraggingInternally=!0,te.setFragmentData(f,O.dataTransfer,"drag")}},[s,f,v.onDragStart,P]),onDrop:y.useCallback(O=>{if(!s&&te.hasTarget(f,O.target)&&!ft(O,v.onDrop)){O.preventDefault();var q=f.selection,S=te.findEventRange(f,O),L=O.dataTransfer;X.select(f,S),P.isDraggingInternally&&q&&!Y.equals(q,S)&&!x.void(f,{at:S,voids:!0})&&X.delete(f,{at:q}),te.insertData(f,L),te.isFocused(f)||te.focus(f)}P.isDraggingInternally=!1},[s,f,v.onDrop,P]),onDragEnd:y.useCallback(O=>{!s&&P.isDraggingInternally&&v.onDragEnd&&te.hasTarget(f,O.target)&&v.onDragEnd(O),P.isDraggingInternally=!1},[s,P,v,f]),onFocus:y.useCallback(O=>{if(!s&&!P.isUpdatingSelection&&te.hasEditableTarget(f,O.target)&&!ft(O,v.onFocus)){var q=te.toDOMNode(f,f),S=te.findDocumentOrShadowRoot(f);if(P.latestElement=S.activeElement,Jn&&O.target!==q){q.focus();return}vn.set(f,!0)}},[s,P,f,v.onFocus]),onKeyDown:y.useCallback(O=>{if(!s&&te.hasEditableTarget(f,O.target)){var q;(q=z.current)===null||q===void 0||q.handleKeyDown(O);var{nativeEvent:S}=O;if(te.isComposing(f)&&S.isComposing===!1&&(Fn.set(f,!1),g(!1)),ft(O,v.onKeyDown)||te.isComposing(f))return;var{selection:L}=f,Q=f.children[L!==null?L.focus.path[0]:0],K=Df(le.string(Q))==="rtl";if(Ge.isRedo(S)){O.preventDefault();var J=f;typeof J.redo=="function"&&J.redo();return}if(Ge.isUndo(S)){O.preventDefault();var ce=f;typeof ce.undo=="function"&&ce.undo();return}if(Ge.isMoveLineBackward(S)){O.preventDefault(),X.move(f,{unit:"line",reverse:!0});return}if(Ge.isMoveLineForward(S)){O.preventDefault(),X.move(f,{unit:"line"});return}if(Ge.isExtendLineBackward(S)){O.preventDefault(),X.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Ge.isExtendLineForward(S)){O.preventDefault(),X.move(f,{unit:"line",edge:"focus"});return}if(Ge.isMoveBackward(S)){O.preventDefault(),L&&Y.isCollapsed(L)?X.move(f,{reverse:!K}):X.collapse(f,{edge:K?"end":"start"});return}if(Ge.isMoveForward(S)){O.preventDefault(),L&&Y.isCollapsed(L)?X.move(f,{reverse:K}):X.collapse(f,{edge:K?"start":"end"});return}if(Ge.isMoveWordBackward(S)){O.preventDefault(),L&&Y.isExpanded(L)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:!K});return}if(Ge.isMoveWordForward(S)){O.preventDefault(),L&&Y.isExpanded(L)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:K});return}if(dn){if((Yf||Tr)&&L&&(Ge.isDeleteBackward(S)||Ge.isDeleteForward(S))&&Y.isCollapsed(L)){var ee=le.parent(f,L.anchor.path);if(fe.isElement(ee)&&x.isVoid(f,ee)&&(x.isInline(f,ee)||x.isBlock(f,ee))){O.preventDefault(),x.deleteBackward(f,{unit:"block"});return}}}else{if(Ge.isBold(S)||Ge.isItalic(S)||Ge.isTransposeCharacter(S)){O.preventDefault();return}if(Ge.isSoftBreak(S)){O.preventDefault(),x.insertSoftBreak(f);return}if(Ge.isSplitBlock(S)){O.preventDefault(),x.insertBreak(f);return}if(Ge.isDeleteBackward(S)){O.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f);return}if(Ge.isDeleteForward(S)){O.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f);return}if(Ge.isDeleteLineBackward(S)){O.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"line"});return}if(Ge.isDeleteLineForward(S)){O.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"line"});return}if(Ge.isDeleteWordBackward(S)){O.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"backward"}):x.deleteBackward(f,{unit:"word"});return}if(Ge.isDeleteWordForward(S)){O.preventDefault(),L&&Y.isExpanded(L)?x.deleteFragment(f,{direction:"forward"}):x.deleteForward(f,{unit:"word"});return}}}},[s,f,v.onKeyDown]),onPaste:y.useCallback(O=>{!s&&te.hasEditableTarget(f,O.target)&&!ft(O,v.onPaste)&&(!dn||h1(O.nativeEvent)||Tr)&&(O.preventDefault(),te.insertData(f,O.clipboardData))},[s,f,v.onPaste])}),y.createElement(mC,{decorations:M,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},gC=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Wt({},t),n,mt&&y.createElement("br",null))},vC=()=>[],bC=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&Y.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),Jb(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},ft=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},oc=e=>bn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),yC=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},xC=y.createContext(!1),CC=y.createContext({});function wC(e){var t=y.useRef([]).current,n=y.useRef({editor:e}).current,r=y.useCallback(a=>{n.editor=a,t.forEach(s=>s(a))},[t,n]),i=y.useMemo(()=>({getSlate:()=>n.editor,addEventListener:a=>(t.push(a),()=>{t.splice(t.indexOf(a),1)})}),[t,n]);return{selectorContext:i,onChange:r}}var DC=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],EC=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:i,onValueChange:a,initialValue:s}=e,o=cr(e,DC),[l,u]=y.useState(()=>{if(!le.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(it.stringify(s)));if(!x.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(it.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:h}=wC(t),p=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":i==null||i(t.selection);break;default:a==null||a(t.children)}u(g=>({v:g.v+1,editor:t})),h(t)},[t,h,r,i,a]);y.useEffect(()=>(Hs.set(t,p),()=>{Hs.set(t,()=>{})}),[t,p]);var[m,v]=y.useState(te.isFocused(t));return y.useEffect(()=>{v(te.isFocused(t))},[t]),Yr(()=>{var f=()=>v(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(CC.Provider,{value:d},y.createElement(ch.Provider,{value:l},y.createElement(Lo.Provider,{value:l.editor},y.createElement(xC.Provider,{value:m},n))))},uc=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},lc=(e,t,n)=>{var r=te.toDOMRange(e,t).getBoundingClientRect(),i=te.toDOMRange(e,n).getBoundingClientRect();return uc(r,i)&&uc(i,r)},_C=(e,t)=>{var n=x.range(e,Y.end(t)),r=Array.from(x.positions(e,{at:t})),i=0,a=r.length,s=Math.floor(a/2);if(lc(e,x.range(e,r[i]),n))return x.range(e,r[i],n);if(r.length<2)return x.range(e,r[r.length-1],n);for(;s!==r.length&&s!==i;)lc(e,x.range(e,r[s]),n)?a=s:i=s,s=Math.floor((i+a)/2);return x.range(e,r[a],n)};function cc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function dc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cc(Object(n),!0).forEach(function(r){Nt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var kC=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",r=t,{apply:i,onChange:a,deleteBackward:s,addMark:o,removeMark:l}=r;return xa.set(r,new WeakMap),r.addMark=(u,d)=>{var h,p;(h=Uo.get(r))===null||h===void 0||h(),!Lt.get(r)&&(p=yt.get(r))!==null&&p!==void 0&&p.length&&Lt.set(r,null),nn.delete(r),o(u,d)},r.removeMark=u=>{var d;!Lt.get(r)&&(d=yt.get(r))!==null&&d!==void 0&&d.length&&Lt.set(r,null),nn.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&Y.isCollapsed(r.selection)){var d=x.above(r,{match:v=>fe.isElement(v)&&x.isBlock(r,v),at:r.selection});if(d){var[,h]=d,p=x.range(r,h,r.selection.anchor),m=_C(r,p);Y.isCollapsed(m)||X.delete(r,{at:m})}}},r.apply=u=>{var d=[],h=[],p=yt.get(r);if(p!=null&&p.length){var m=p.map(j=>k1(j,u)).filter(Boolean);yt.set(r,m)}var v=mn.get(r);v&&mn.set(r,Jl(r,v,u));var f=hn.get(r);if(f!=null&&f.at){var b=Te.isPoint(f==null?void 0:f.at)?Ys(r,f.at,u):Jl(r,f.at,u);hn.set(r,b?dc(dc({},f),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Hn(r,u.path));break}case"set_selection":{var g;(g=Mr.get(r))===null||g===void 0||g.unref(),Mr.delete(r);break}case"insert_node":case"remove_node":{d.push(...Hn(r,I.parent(u.path)));break}case"merge_node":{var D=I.previous(u.path);d.push(...Hn(r,D));break}case"move_node":{var w=I.common(I.parent(u.path),I.parent(u.newPath));d.push(...Hn(r,w));var F;I.isBefore(u.path,u.newPath)?(d.push(...Hn(r,I.parent(u.path))),F=u.newPath):(d.push(...Hn(r,I.parent(u.newPath))),F=u.path);var E=le.get(t,I.parent(F)),k=te.findKey(r,E),T=x.pathRef(r,I.parent(F));h.push([T,k]);break}}i(u);for(var[R,P]of d){var[z]=x.node(r,R);ea.set(z,P)}for(var[$,B]of h)if($.current){var[A]=x.node(r,$.current);ea.set(A,B)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[h,p]=Y.edges(d),m=x.void(r,{at:h.path}),v=x.void(r,{at:p.path});if(!(Y.isCollapsed(d)&&!m)){var f=te.toDOMRange(r,d),b=f.cloneContents(),g=b.childNodes[0];if(b.childNodes.forEach(z=>{z.textContent&&z.textContent.trim()!==""&&(g=z)}),v){var[D]=v,w=f.cloneRange(),F=te.toDOMNode(r,D);w.setEndAfter(F),b=w.cloneContents()}if(m&&(g=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(z=>{var $=z.getAttribute("data-slate-zero-width")==="n";z.textContent=$?`
81
- `:""}),Xf(g)){var E=g.ownerDocument.createElement("span");E.style.whiteSpace="pre",E.appendChild(g),b.appendChild(E),g=E}var k=r.getFragment(),T=JSON.stringify(k),R=window.btoa(encodeURIComponent(T));g.setAttribute("data-slate-fragment",R),u.setData("application/".concat(n),R);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",th(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))||b1(u);if(d){var h=decodeURIComponent(window.atob(d)),p=JSON.parse(h);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var d=u.getData("text/plain");if(d){var h=d.split(/\r\n|\r|\n/),p=!1;for(var m of h)p&&X.splitNodes(r,{always:!0}),r.insertText(m),p=!0;return!0}return!1},r.onChange=u=>{var d=Zf<18?Jc.unstable_batchedUpdates:h=>h();d(()=>{var h=Hs.get(r);h&&h(u),a(u)})},r},Hn=(e,t)=>{var n=[];for(var[r,i]of x.levels(e,{at:t})){var a=te.findKey(e,r);n.push([i,a])}return n};const Qs="MENTION: ",fh={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},fc={"mention-popover":35,default:-52},Ja=16,hh=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:i,mentionPopover:a}=y.useContext(ln),s=t==="link-editor"?i:a.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var m,v;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}=a,b=w=>{if(!x.hasPath(e,w.path))return!1;const F=le.get(e,w.path);return x.isEditor(F)||fe.isElement(F)?w.offset<=F.children.length:ge.isText(F)?w.offset<=F.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||fh).getBoundingClientRect();const D=(m=document.getElementById(n))==null?void 0:m.getBoundingClientRect();l.style.setProperty("--width",`${((D==null?void 0:D.width)||0)/Ja}rem`),d=(D==null?void 0:D.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(u=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}u||(u=(v=document.getElementById(n))==null?void 0:v.getBoundingClientRect());const h=fc[t]||fc.default,p=((u==null?void 0:u.top)||0)+window.scrollY+h;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=`${p/Ja}rem`,l.style.left=`${d/Ja}rem`},o),r},FC=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[i]=x.nodes(e,{at:r,match:a=>a.type===H.link});if(i){const a=i[0],s=co(a.link),o=a.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 Xn={[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 hc(e){if(e)throw e}var Mi=Object.prototype.hasOwnProperty,mh=Object.prototype.toString,mc=Object.defineProperty,pc=Object.getOwnPropertyDescriptor,gc=function(t){return typeof Array.isArray=="function"?Array.isArray(t):mh.call(t)==="[object Array]"},vc=function(t){if(!t||mh.call(t)!=="[object Object]")return!1;var n=Mi.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Mi.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Mi.call(t,i)},bc=function(t,n){mc&&n.name==="__proto__"?mc(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},yc=function(t,n){if(n==="__proto__")if(Mi.call(t,n)){if(pc)return pc(t,n).value}else return;return t[n]},AC=function e(){var t,n,r,i,a,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=yc(o,n),i=yc(t,n),o!==i&&(d&&i&&(vc(i)||(a=gc(i)))?(a?(a=!1,s=r&&gc(r)?r:[]):s=r&&vc(r)?r:{},bc(o,{name:n,newValue:e(d,s,i)})):typeof i<"u"&&bc(o,{name:n,newValue:i}));return o};const Xa=Nn(AC);function Js(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 BC(){const e=[],t={run:n,use:r};return t;function n(...i){let a=-1;const s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...i);function o(l,...u){const d=e[++a];let h=-1;if(l){s(l);return}for(;++h<i.length;)(u[h]===null||u[h]===void 0)&&(u[h]=i[h]);i=u,d?TC(d,o)(...u):s(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function TC(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(i);try{l=e.apply(this,s)}catch(u){const d=u;if(o&&n)throw d;return i(d)}o||(l&&l.then&&typeof l.then=="function"?l.then(a,i):l instanceof Error?i(l):a(l))}function i(s,...o){n||(n=!0,t(s,...o))}function a(s){i(null,s)}}function Nr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?xc(e.position):"start"in e||"end"in e?xc(e):"line"in e||"column"in e?Xs(e):""}function Xs(e){return Cc(e&&e.line)+":"+Cc(e&&e.column)}function xc(e){return Xs(e&&e.start)+"-"+Xs(e&&e.end)}function Cc(e){return e&&typeof e=="number"?e:1}class wt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},s=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?i=t:!a.cause&&t&&(s=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?a.ruleId=r:(a.source=r.slice(0,l),a.ruleId=r.slice(l+1))}if(!a.place&&a.ancestors&&a.ancestors){const l=a.ancestors[a.ancestors.length-1];l&&(a.place=l.position)}const o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=o?o.line:void 0,this.name=Nr(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=s&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual,this.expected,this.note,this.url}}wt.prototype.file="";wt.prototype.name="";wt.prototype.reason="";wt.prototype.message="";wt.prototype.stack="";wt.prototype.column=void 0;wt.prototype.line=void 0;wt.prototype.ancestors=void 0;wt.prototype.cause=void 0;wt.prototype.fatal=void 0;wt.prototype.place=void 0;wt.prototype.ruleId=void 0;wt.prototype.source=void 0;const Vt={basename:SC,dirname:jC,extname:OC,join:PC,sep:"/"};function SC(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ei(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else s<0&&(a=!0,s=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(r=i):(o=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function jC(e){if(ei(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 OC(e){ei(e);let t=e.length,n=-1,r=0,i=-1,a=0,s;for(;t--;){const o=e.codePointAt(t);if(o===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),o===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function PC(...e){let t=-1,n;for(;++t<e.length;)ei(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":MC(n)}function MC(e){ei(e);const t=e.codePointAt(0)===47;let n=NC(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function NC(e,t){let n="",r=0,i=-1,a=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(!(i===s-1||a===1))if(i!==s-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=s,a=0;continue}}else if(n.length>0){n="",r=0,i=s,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a>-1?a++:a=-1}return n}function ei(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const IC={cwd:RC};function RC(){return"/"}function eo(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function $C(e){if(typeof e=="string")e=new URL(e);else if(!eo(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return LC(e)}function LC(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const es=["history","path","basename","stem","extname","dirname"];class zC{constructor(t){let n;t?eo(t)?n={path:t}:typeof t=="string"||qC(t)?n={value:t}:n=t:n={},this.cwd=IC.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<es.length;){const a=es[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let i;for(i in n)es.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Vt.basename(this.path):void 0}set basename(t){ns(t,"basename"),ts(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){wc(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(ts(t,"extname"),wc(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){eo(t)&&(t=$C(t)),ns(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){ns(t,"stem"),ts(t,"stem"),this.path=Vt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new wt(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function ts(e,t){if(e&&e.includes(Vt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Vt.sep+"`")}function ns(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function wc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function qC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const UC=function(e){const r=this.constructor.prototype,i=r[e],a=function(){return i.apply(a,arguments)};Object.setPrototypeOf(a,r);const s=Object.getOwnPropertyNames(i);for(const o of s){const l=Object.getOwnPropertyDescriptor(i,o);l&&Object.defineProperty(a,o,l)}return a},WC={}.hasOwnProperty;class Ho extends UC{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=BC()}copy(){const t=new Ho;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Xa(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(as("data",this.frozen),this.namespace[t]=n,this):WC.call(this.namespace,t)&&this.namespace[t]||void 0:t?(as("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Ci(t),r=this.parser||this.Parser;return rs("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),rs("process",this.parser||this.Parser),is("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(a,s){const o=Ci(t),l=r.parse(o);r.run(l,o,function(d,h,p){if(d||!h||!p)return u(d);const m=h,v=r.stringify(m,p);KC(v)?p.value=v:p.result=v,u(d,p)});function u(d,h){d||!h?s(d):a?a(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),rs("processSync",this.parser||this.Parser),is("processSync",this.compiler||this.Compiler),this.process(t,i),Ec("processSync","process",n),r;function i(a,s){n=!0,hc(a),r=s}}run(t,n,r){Dc(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(s,o){const l=Ci(n);i.run(t,l,u);function u(d,h,p){const m=h||t;d?o(d):s?s(m):r(void 0,m,p)}}}runSync(t,n){let r=!1,i;return this.run(t,n,a),Ec("runSync","run",r),i;function a(s,o){hc(s),i=o,r=!0}}stringify(t,n){this.freeze();const r=Ci(n),i=this.compiler||this.Compiler;return is("stringify",i),Dc(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(as("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 a(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;l(d,h)}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&&(i.settings=Xa(!0,i.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];a(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let h=-1,p=-1;for(;++h<r.length;)if(r[h][0]===u){p=h;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[m,...v]=d;const f=r[p][1];Js(f)&&Js(m)&&(m=Xa(!0,f,m)),r[p]=[u,m,...v]}}}}const VC=new Ho().freeze();function rs(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function is(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function as(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 Dc(e){if(!Js(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ec(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Ci(e){return HC(e)?e:new zC(e)}function HC(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function KC(e){return typeof e=="string"||ZC(e)}function ZC(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const YC={};function GC(e,t){const n=t||YC,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ph(e,r,i)}function ph(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 _c(e.children,t,n)}return Array.isArray(e)?_c(e,t,n):""}function _c(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=ph(e[i],t,n);return r.join("")}function QC(e){return!!(e&&typeof e=="object")}const kc=document.createElement("i");function Ko(e){const t="&"+e+";";kc.innerHTML=t;const n=kc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function sn(e,t,n,r){const i=e.length;let a=0,s;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);a<r.length;)s=r.slice(a,a+1e4),s.unshift(t,0),e.splice(...s),a+=1e4,t+=1e4}function Ot(e,t){return e.length>0?(sn(e,e.length,0,t),e):t}const Fc={}.hasOwnProperty;function JC(e){const t={};let n=-1;for(;++n<e.length;)XC(t,e[n]);return t}function XC(e,t){let n;for(n in t){const i=(Fc.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let s;if(a)for(s in a){Fc.call(i,s)||(i[s]=[]);const o=a[s];ew(i[s],Array.isArray(o)?o:o?[o]:[])}}}function ew(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);sn(e,0,0,r)}function gh(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 rr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ht=wn(/[A-Za-z]/),zt=wn(/[\dA-Za-z]/),tw=wn(/[#-'*+\--9=?A-Z^-~]/);function to(e){return e!==null&&(e<32||e===127)}const no=wn(/\d/),nw=wn(/[\dA-Fa-f]/),rw=wn(/[!-/:-@[-`{-~]/);function we(e){return e!==null&&e<-2}function Ct(e){return e!==null&&(e<0||e===32)}function Ie(e){return e===-2||e===-1||e===32}const iw=wn(/\p{P}|\p{S}/u),aw=wn(/\s/);function wn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function He(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let a=0;return s;function s(l){return Ie(l)?(e.enter(n),o(l)):t(l)}function o(l){return Ie(l)&&a++<i?(e.consume(l),o):(e.exit(n),t(l))}}const sw={tokenize:ow};function ow(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),He(e,t,"linePrefix")}function i(o){return e.enter("paragraph"),a(o)}function a(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 we(o)?(e.consume(o),e.exit("chunkText"),a):(e.consume(o),s)}}const uw={tokenize:lw},Ac={tokenize:cw};function lw(e){const t=this,n=[];let r=0,i,a,s;return o;function o(w){if(r<n.length){const F=n[r];return t.containerState=F[1],e.attempt(F[0].continuation,l,u)(w)}return u(w)}function l(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&D();const F=t.events.length;let E=F,k;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){k=t.events[E][1].end;break}g(r);let T=F;for(;T<t.events.length;)t.events[T][1].end=Object.assign({},k),T++;return sn(t.events,E+1,0,t.events.slice(F)),t.events.length=T,u(w)}return o(w)}function u(w){if(r===n.length){if(!i)return p(w);if(i.currentConstruct&&i.currentConstruct.concrete)return v(w);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Ac,d,h)(w)}function d(w){return i&&D(),g(r),p(w)}function h(w){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,v(w)}function p(w){return t.containerState={},e.attempt(Ac,m,v)(w)}function m(w){return r++,n.push([t.currentConstruct,t.containerState]),p(w)}function v(w){if(w===null){i&&D(),g(0),e.consume(w);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:a,_tokenizer:i}),f(w)}function f(w){if(w===null){b(e.exit("chunkFlow"),!0),g(0),e.consume(w);return}return we(w)?(e.consume(w),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(w),f)}function b(w,F){const E=t.sliceStream(w);if(F&&E.push(null),w.previous=a,a&&(a.next=w),a=w,i.defineSkip(w.start),i.write(E),t.parser.lazy[w.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<s&&(!i.events[k][1].end||i.events[k][1].end.offset>s))return;const T=t.events.length;let R=T,P,z;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(P){z=t.events[R][1].end;break}P=!0}for(g(r),k=T;k<t.events.length;)t.events[k][1].end=Object.assign({},z),k++;sn(t.events,R+1,0,t.events.slice(T)),t.events.length=k}}function g(w){let F=n.length;for(;F-- >w;){const E=n[F];t.containerState=E[1],E[0].exit.call(t,e)}n.length=w}function D(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function cw(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 Bc(e){if(e===null||Ct(e)||aw(e))return 1;if(iw(e))return 2}function Zo(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const ro={name:"attention",tokenize:fw,resolveAll:dw};function dw(e,t){let n=-1,r,i,a,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 h=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);Tc(h,-l),Tc(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:p},a={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},i={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=Ot(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Ot(u,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",a,t]]),u=Ot(u,Zo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Ot(u,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Ot(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,sn(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 fw(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Bc(r);let a;return s;function s(l){return a=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===a)return e.consume(l),o;const u=e.exit("attentionSequence"),d=Bc(l),h=!d||d===2&&i||n.includes(l),p=!i||i===2&&d||n.includes(r);return u._open=!!(a===42?h:h&&(i||!p)),u._close=!!(a===42?p:p&&(d||!h)),t(l)}}function Tc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const hw={name:"autolink",tokenize:mw};function mw(e,t,n){let r=0;return i;function i(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(m){return Ht(m)?(e.consume(m),s):m===64?n(m):u(m)}function s(m){return m===43||m===45||m===46||zt(m)?(r=1,o(m)):u(m)}function o(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||zt(m))&&r++<32?(e.consume(m),o):(r=0,u(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||to(m)?n(m):(e.consume(m),l)}function u(m){return m===64?(e.consume(m),d):tw(m)?(e.consume(m),u):n(m)}function d(m){return zt(m)?h(m):n(m)}function h(m){return m===46?(e.consume(m),r=0,d):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):p(m)}function p(m){if((m===45||zt(m))&&r++<63){const v=m===45?p:h;return e.consume(m),v}return n(m)}}const Ca={tokenize:pw,partial:!0};function pw(e,t,n){return r;function r(a){return Ie(a)?He(e,i,"linePrefix")(a):i(a)}function i(a){return a===null||we(a)?t(a):n(a)}}const vh={name:"blockQuote",tokenize:gw,continuation:{tokenize:vw},exit:bw};function gw(e,t,n){const r=this;return i;function i(s){if(s===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),a}return n(s)}function a(s){return Ie(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function vw(e,t,n){const r=this;return i;function i(s){return Ie(s)?He(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):a(s)}function a(s){return e.attempt(vh,t,n)(s)}}function bw(e){e.exit("blockQuote")}const bh={name:"characterEscape",tokenize:yw};function yw(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),i}function i(a){return rw(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const yh={name:"characterReference",tokenize:xw};function xw(e,t,n){const r=this;let i=0,a,s;return o;function o(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),a=31,s=zt,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,s=nw,d):(e.enter("characterReferenceValue"),a=7,s=no,d(h))}function d(h){if(h===59&&i){const p=e.exit("characterReferenceValue");return s===zt&&!Ko(r.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&i++<a?(e.consume(h),d):n(h)}}const Sc={tokenize:ww,partial:!0},jc={name:"codeFenced",tokenize:Cw,concrete:!0};function Cw(e,t,n){const r=this,i={tokenize:E,partial:!0};let a=0,s=0,o;return l;function l(k){return u(k)}function u(k){const T=r.events[r.events.length-1];return a=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,h,"whitespace")(k):h(k))}function h(k){return k===null||we(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(Sc,f,F)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===null||we(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(k)):Ie(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),He(e,m,"whitespace")(k)):k===96&&k===o?n(k):(e.consume(k),p)}function m(k){return k===null||we(k)?h(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(k))}function v(k){return k===null||we(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(k)):k===96&&k===o?n(k):(e.consume(k),v)}function f(k){return e.attempt(i,F,b)(k)}function b(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),g}function g(k){return a>0&&Ie(k)?He(e,D,"linePrefix",a+1)(k):D(k)}function D(k){return k===null||we(k)?e.check(Sc,f,F)(k):(e.enter("codeFlowValue"),w(k))}function w(k){return k===null||we(k)?(e.exit("codeFlowValue"),D(k)):(e.consume(k),w)}function F(k){return e.exit("codeFenced"),t(k)}function E(k,T,R){let P=0;return z;function z(M){return k.enter("lineEnding"),k.consume(M),k.exit("lineEnding"),$}function $(M){return k.enter("codeFencedFence"),Ie(M)?He(k,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):B(M)}function B(M){return M===o?(k.enter("codeFencedFenceSequence"),A(M)):R(M)}function A(M){return M===o?(P++,k.consume(M),A):P>=s?(k.exit("codeFencedFenceSequence"),Ie(M)?He(k,j,"whitespace")(M):j(M)):R(M)}function j(M){return M===null||we(M)?(k.exit("codeFencedFence"),T(M)):R(M)}}}function ww(e,t,n){const r=this;return i;function i(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a)}function a(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const ss={name:"codeIndented",tokenize:Ew},Dw={tokenize:_w,partial:!0};function Ew(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),He(e,a,"linePrefix",4+1)(u)}function a(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):we(u)?e.attempt(Dw,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||we(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function _w(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):we(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):He(e,a,"linePrefix",4+1)(s)}function a(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):we(s)?i(s):n(s)}}const kw={name:"codeText",tokenize:Bw,resolve:Fw,previous:Aw};function Fw(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Aw(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Bw(e,t,n){let r=0,i,a;return s;function s(h){return e.enter("codeText"),e.enter("codeTextSequence"),o(h)}function o(h){return h===96?(e.consume(h),r++,o):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(a=e.enter("codeTextSequence"),i=0,d(h)):we(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||we(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(a.type="codeTextData",u(h))}}class Tw{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&kr(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),kr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),kr(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);kr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);kr(this.left,n.reverse())}}}function kr(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 xh(e){const t={};let n=-1,r,i,a,s,o,l,u;const d=new Tw(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,a=0,a<l.length&&l[a][1].type==="lineEndingBlank"&&(a+=2),a<l.length&&l[a][1].type==="content"))for(;++a<l.length&&l[a][1].type!=="content";)l[a][1].type==="chunkText"&&(l[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Sw(d,n)),n=t[n],u=!0);else if(r[1]._container){for(a=n,i=void 0;a--&&(s=d.get(a),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=a);i&&(r[1].end=Object.assign({},d.get(i)[1].start),o=d.slice(i,n),o.unshift(r),d.splice(i,n-i+1,o))}}return sn(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function Sw(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const a=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let d,h,p=-1,m=n,v=0,f=0;const b=[f];for(;m;){for(;e.get(++i)[1]!==m;);a.push(i),m._tokenizer||(d=r.sliceStream(m),m.next||d.push(null),h&&s.defineSkip(m.start),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(f=p+1,b.push(f),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(s.events=[],m?(m._tokenizer=void 0,m.previous=void 0):b.pop(),p=b.length;p--;){const g=o.slice(b[p],b[p+1]),D=a.pop();l.push([D,D+g.length-1]),e.splice(D,2,g)}for(l.reverse(),p=-1;++p<l.length;)u[v+l[p][0]]=v+l[p][1],v+=l[p][1]-l[p][0]-1;return u}const jw={tokenize:Mw,resolve:Pw},Ow={tokenize:Nw,partial:!0};function Pw(e){return xh(e),e}function Mw(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?a(o):we(o)?e.check(Ow,s,a)(o):(e.consume(o),i)}function a(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function s(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Nw(e,t,n){const r=this;return i;function i(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),He(e,a,"linePrefix")}function a(s){if(s===null||we(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 Ch(e,t,n,r,i,a,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(g){return g===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(g),e.exit(a),p):g===null||g===32||g===41||to(g)?n(g):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(g))}function p(g){return g===62?(e.enter(a),e.consume(g),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(g))}function m(g){return g===62?(e.exit("chunkString"),e.exit(o),p(g)):g===null||g===60||we(g)?n(g):(e.consume(g),g===92?v:m)}function v(g){return g===60||g===62||g===92?(e.consume(g),m):m(g)}function f(g){return!d&&(g===null||g===41||Ct(g))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(g)):d<u&&g===40?(e.consume(g),d++,f):g===41?(e.consume(g),d--,f):g===null||g===32||g===40||to(g)?n(g):(e.consume(g),g===92?b:f)}function b(g){return g===40||g===41||g===92?(e.consume(g),f):f(g)}}function wh(e,t,n,r,i,a){const s=this;let o=0,l;return u;function u(m){return e.enter(r),e.enter(i),e.consume(m),e.exit(i),e.enter(a),d}function d(m){return o>999||m===null||m===91||m===93&&!l||m===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(m):m===93?(e.exit(a),e.enter(i),e.consume(m),e.exit(i),e.exit(r),t):we(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||we(m)||o++>999?(e.exit("chunkString"),d(m)):(e.consume(m),l||(l=!Ie(m)),m===92?p:h)}function p(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}}function Dh(e,t,n,r,i,a){let s;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),s=p===40?41:p,l):n(p)}function l(p){return p===s?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(a),u(p))}function u(p){return p===s?(e.exit(a),l(s)):p===null?n(p):we(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),He(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===s||p===null||we(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:d)}function h(p){return p===s||p===92?(e.consume(p),d):d(p)}}function Ir(e,t){let n;return r;function r(i){return we(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ie(i)?He(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const Iw={name:"definition",tokenize:$w},Rw={tokenize:Lw,partial:!0};function $w(e,t,n){const r=this;let i;return a;function a(m){return e.enter("definition"),s(m)}function s(m){return wh.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return i=rr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):n(m)}function l(m){return Ct(m)?Ir(e,u)(m):u(m)}function u(m){return Ch(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(Rw,h,h)(m)}function h(m){return Ie(m)?He(e,p,"whitespace")(m):p(m)}function p(m){return m===null||we(m)?(e.exit("definition"),r.parser.defined.push(i),t(m)):n(m)}}function Lw(e,t,n){return r;function r(o){return Ct(o)?Ir(e,i)(o):n(o)}function i(o){return Dh(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function a(o){return Ie(o)?He(e,s,"whitespace")(o):s(o)}function s(o){return o===null||we(o)?t(o):n(o)}}const zw={name:"hardBreakEscape",tokenize:qw};function qw(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return we(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const Uw={name:"headingAtx",tokenize:Vw,resolve:Ww};function Ww(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},sn(e,r,n-r+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function Vw(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),a(d)}function a(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||Ct(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||we(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||Ct(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const Hw=["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"],Oc=["pre","script","style","textarea"],Kw={name:"htmlFlow",tokenize:Qw,resolveTo:Gw,concrete:!0},Zw={tokenize:Xw,partial:!0},Yw={tokenize:Jw,partial:!0};function Gw(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 i,a,s,o,l;return u;function u(_){return d(_)}function d(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),h}function h(_){return _===33?(e.consume(_),p):_===47?(e.consume(_),a=!0,f):_===63?(e.consume(_),i=3,r.interrupt?t:C):Ht(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function p(_){return _===45?(e.consume(_),i=2,m):_===91?(e.consume(_),i=5,o=0,v):Ht(_)?(e.consume(_),i=4,r.interrupt?t:C):n(_)}function m(_){return _===45?(e.consume(_),r.interrupt?t:C):n(_)}function v(_){const O="CDATA[";return _===O.charCodeAt(o++)?(e.consume(_),o===O.length?r.interrupt?t:B:v):n(_)}function f(_){return Ht(_)?(e.consume(_),s=String.fromCharCode(_),b):n(_)}function b(_){if(_===null||_===47||_===62||Ct(_)){const O=_===47,q=s.toLowerCase();return!O&&!a&&Oc.includes(q)?(i=1,r.interrupt?t(_):B(_)):Hw.includes(s.toLowerCase())?(i=6,O?(e.consume(_),g):r.interrupt?t(_):B(_)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):a?D(_):w(_))}return _===45||zt(_)?(e.consume(_),s+=String.fromCharCode(_),b):n(_)}function g(_){return _===62?(e.consume(_),r.interrupt?t:B):n(_)}function D(_){return Ie(_)?(e.consume(_),D):z(_)}function w(_){return _===47?(e.consume(_),z):_===58||_===95||Ht(_)?(e.consume(_),F):Ie(_)?(e.consume(_),w):z(_)}function F(_){return _===45||_===46||_===58||_===95||zt(_)?(e.consume(_),F):E(_)}function E(_){return _===61?(e.consume(_),k):Ie(_)?(e.consume(_),E):w(_)}function k(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,T):Ie(_)?(e.consume(_),k):R(_)}function T(_){return _===l?(e.consume(_),l=null,P):_===null||we(_)?n(_):(e.consume(_),T)}function R(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||Ct(_)?E(_):(e.consume(_),R)}function P(_){return _===47||_===62||Ie(_)?w(_):n(_)}function z(_){return _===62?(e.consume(_),$):n(_)}function $(_){return _===null||we(_)?B(_):Ie(_)?(e.consume(_),$):n(_)}function B(_){return _===45&&i===2?(e.consume(_),U):_===60&&i===1?(e.consume(_),W):_===62&&i===4?(e.consume(_),G):_===63&&i===3?(e.consume(_),C):_===93&&i===5?(e.consume(_),ae):we(_)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(Zw,ne,A)(_)):_===null||we(_)?(e.exit("htmlFlowData"),A(_)):(e.consume(_),B)}function A(_){return e.check(Yw,j,ne)(_)}function j(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),M}function M(_){return _===null||we(_)?A(_):(e.enter("htmlFlowData"),B(_))}function U(_){return _===45?(e.consume(_),C):B(_)}function W(_){return _===47?(e.consume(_),s="",ie):B(_)}function ie(_){if(_===62){const O=s.toLowerCase();return Oc.includes(O)?(e.consume(_),G):B(_)}return Ht(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),ie):B(_)}function ae(_){return _===93?(e.consume(_),C):B(_)}function C(_){return _===62?(e.consume(_),G):_===45&&i===2?(e.consume(_),C):B(_)}function G(_){return _===null||we(_)?(e.exit("htmlFlowData"),ne(_)):(e.consume(_),G)}function ne(_){return e.exit("htmlFlow"),t(_)}}function Jw(e,t,n){const r=this;return i;function i(s){return we(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):n(s)}function a(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function Xw(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Ca,t,n)}}const eD={name:"htmlText",tokenize:tD};function tD(e,t,n){const r=this;let i,a,s;return o;function o(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),l}function l(C){return C===33?(e.consume(C),u):C===47?(e.consume(C),E):C===63?(e.consume(C),w):Ht(C)?(e.consume(C),R):n(C)}function u(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),a=0,v):Ht(C)?(e.consume(C),D):n(C)}function d(C){return C===45?(e.consume(C),m):n(C)}function h(C){return C===null?n(C):C===45?(e.consume(C),p):we(C)?(s=h,W(C)):(e.consume(C),h)}function p(C){return C===45?(e.consume(C),m):h(C)}function m(C){return C===62?U(C):C===45?p(C):h(C)}function v(C){const G="CDATA[";return C===G.charCodeAt(a++)?(e.consume(C),a===G.length?f:v):n(C)}function f(C){return C===null?n(C):C===93?(e.consume(C),b):we(C)?(s=f,W(C)):(e.consume(C),f)}function b(C){return C===93?(e.consume(C),g):f(C)}function g(C){return C===62?U(C):C===93?(e.consume(C),g):f(C)}function D(C){return C===null||C===62?U(C):we(C)?(s=D,W(C)):(e.consume(C),D)}function w(C){return C===null?n(C):C===63?(e.consume(C),F):we(C)?(s=w,W(C)):(e.consume(C),w)}function F(C){return C===62?U(C):w(C)}function E(C){return Ht(C)?(e.consume(C),k):n(C)}function k(C){return C===45||zt(C)?(e.consume(C),k):T(C)}function T(C){return we(C)?(s=T,W(C)):Ie(C)?(e.consume(C),T):U(C)}function R(C){return C===45||zt(C)?(e.consume(C),R):C===47||C===62||Ct(C)?P(C):n(C)}function P(C){return C===47?(e.consume(C),U):C===58||C===95||Ht(C)?(e.consume(C),z):we(C)?(s=P,W(C)):Ie(C)?(e.consume(C),P):U(C)}function z(C){return C===45||C===46||C===58||C===95||zt(C)?(e.consume(C),z):$(C)}function $(C){return C===61?(e.consume(C),B):we(C)?(s=$,W(C)):Ie(C)?(e.consume(C),$):P(C)}function B(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),i=C,A):we(C)?(s=B,W(C)):Ie(C)?(e.consume(C),B):(e.consume(C),j)}function A(C){return C===i?(e.consume(C),i=void 0,M):C===null?n(C):we(C)?(s=A,W(C)):(e.consume(C),A)}function j(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||Ct(C)?P(C):(e.consume(C),j)}function M(C){return C===47||C===62||Ct(C)?P(C):n(C)}function U(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function W(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),ie}function ie(C){return Ie(C)?He(e,ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):ae(C)}function ae(C){return e.enter("htmlTextData"),s(C)}}const Yo={name:"labelEnd",tokenize:oD,resolveTo:sD,resolveAll:aD},nD={tokenize:uD},rD={tokenize:lD},iD={tokenize:cD};function aD(e){let t=-1;for(;++t<e.length;){const n=e[t][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(e.splice(t+1,n.type==="labelImage"?4:2),n.type="data",t++)}return e}function sD(e,t){let n=e.length,r=0,i,a,s,o;for(;n--;)if(i=e[n][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=n);const l={type:e[a][1].type==="labelLink"?"link":"image",start:Object.assign({},e[a][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[a][1].start),end:Object.assign({},e[s][1].end)},d={type:"labelText",start:Object.assign({},e[a+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=Ot(o,e.slice(a+1,a+r+3)),o=Ot(o,[["enter",d,t]]),o=Ot(o,Zo(t.parser.constructs.insideSpan.null,e.slice(a+r+4,s-3),t)),o=Ot(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=Ot(o,e.slice(s+1)),o=Ot(o,[["exit",l,t]]),sn(e,a,e.length,o),e}function oD(e,t,n){const r=this;let i=r.events.length,a,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){a=r.events[i][1];break}return o;function o(p){return a?a._inactive?h(p):(s=r.parser.defined.includes(rr(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(nD,d,s?d:h)(p):p===91?e.attempt(rD,d,s?u:h)(p):s?d(p):h(p)}function u(p){return e.attempt(iD,d,h)(p)}function d(p){return t(p)}function h(p){return a._balanced=!0,n(p)}}function uD(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),i}function i(h){return Ct(h)?Ir(e,a)(h):a(h)}function a(h){return h===41?d(h):Ch(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return Ct(h)?Ir(e,l)(h):d(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?Dh(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return Ct(h)?Ir(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function lD(e,t,n){const r=this;return i;function i(o){return wh.call(r,e,a,s,"reference","referenceMarker","referenceString")(o)}function a(o){return r.parser.defined.includes(rr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function cD(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),i}function i(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const dD={name:"labelStartImage",tokenize:fD,resolveAll:Yo.resolveAll};function fD(e,t,n){const r=this;return i;function i(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),a}function a(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),s):n(o)}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const hD={name:"labelStartLink",tokenize:mD,resolveAll:Yo.resolveAll};function mD(e,t,n){const r=this;return i;function i(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),a}function a(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const os={name:"lineEnding",tokenize:pD};function pD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),He(e,t,"linePrefix")}}const Ni={name:"thematicBreak",tokenize:gD};function gD(e,t,n){let r=0,i;return a;function a(u){return e.enter("thematicBreak"),s(u)}function s(u){return i=u,o(u)}function o(u){return u===i?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||we(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Ie(u)?He(e,o,"whitespace")(u):o(u))}}const vt={name:"list",tokenize:yD,continuation:{tokenize:xD},exit:wD},vD={tokenize:DD,partial:!0},bD={tokenize:CD,partial:!0};function yD(e,t,n){const r=this,i=r.events[r.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return o;function o(m){const v=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:no(m)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Ni,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return no(m)&&++s<10?(e.consume(m),l):(!r.interrupt||s<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(Ca,r.interrupt?n:d,e.attempt(vD,p,h))}function d(m){return r.containerState.initialBlankLine=!0,a++,p(m)}function h(m){return Ie(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function xD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ca,i,a);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,He(e,t,"listItemIndent",r.containerState.size+1)(o)}function a(o){return r.containerState.furtherBlankLines||!Ie(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(bD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,He(e,e.attempt(vt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function CD(e,t,n){const r=this;return He(e,i,"listItemIndent",r.containerState.size+1);function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(a):n(a)}}function wD(e){e.exit(this.containerState.type)}function DD(e,t,n){const r=this;return He(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function i(a){const s=r.events[r.events.length-1];return!Ie(a)&&s&&s[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const Pc={name:"setextUnderline",tokenize:_D,resolveTo:ED};function ED(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const s={type:"setextHeading",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",s,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[a][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}function _D(e,t,n){const r=this;let i;return a;function a(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),i=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===i?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Ie(u)?He(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||we(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const kD={tokenize:FD};function FD(e){const t=this,n=e.attempt(Ca,r,e.attempt(this.parser.constructs.flowInitial,i,He(e,e.attempt(this.parser.constructs.flow,i,e.attempt(jw,i)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const AD={resolveAll:_h()},BD=Eh("string"),TD=Eh("text");function Eh(e){return{tokenize:t,resolveAll:_h(e==="text"?SD:void 0)};function t(n){const r=this,i=this.parser.constructs[e],a=n.attempt(i,s,o);return s;function s(d){return u(d)?a(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"),a(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const h=i[d];let p=-1;if(h)for(;++p<h.length;){const m=h[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function _h(e){return t;function t(n,r){let i=-1,a;for(;++i<=n.length;)a===void 0?n[i]&&n[i][1].type==="data"&&(a=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==a+2&&(n[a][1].end=n[i-1][1].end,n.splice(a+2,i-a-2),i=a+2),a=void 0);return e?e(n,r):n}}function SD(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let a=i.length,s=-1,o=0,l;for(;a--;){const u=i[a];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){a++;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+a,_bufferIndex:a?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 jD(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const i={},a=[];let s=[],o=[];const l={consume:D,enter:w,exit:F,attempt:T(E),check:T(k),interrupt:T(k,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:m,sliceSerialize:p,now:v,defineSkip:f,write:h};let d=t.tokenize.call(u,l);return t.resolveAll&&a.push(t),u;function h($){return s=Ot(s,$),b(),s[s.length-1]!==null?[]:(R(t,0),u.events=Zo(a,u.events,u),u.events)}function p($,B){return PD(m($),B)}function m($){return OD(s,$)}function v(){const{line:$,column:B,offset:A,_index:j,_bufferIndex:M}=r;return{line:$,column:B,offset:A,_index:j,_bufferIndex:M}}function f($){i[$.line]=$.column,z()}function b(){let $;for(;r._index<s.length;){const B=s[r._index];if(typeof B=="string")for($=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===$&&r._bufferIndex<B.length;)g(B.charCodeAt(r._bufferIndex));else g(B)}}function g($){d=d($)}function D($){we($)?(r.line++,r.column=1,r.offset+=$===-3?2:1,z()):$!==-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=$}function w($,B){const A=B||{};return A.type=$,A.start=v(),u.events.push(["enter",A,u]),o.push(A),A}function F($){const B=o.pop();return B.end=v(),u.events.push(["exit",B,u]),B}function E($,B){R($,B.from)}function k($,B){B.restore()}function T($,B){return A;function A(j,M,U){let W,ie,ae,C;return Array.isArray(j)?ne(j):"tokenize"in j?ne([j]):G(j);function G(S){return L;function L(Q){const K=Q!==null&&S[Q],J=Q!==null&&S.null,ce=[...Array.isArray(K)?K:K?[K]:[],...Array.isArray(J)?J:J?[J]:[]];return ne(ce)(Q)}}function ne(S){return W=S,ie=0,S.length===0?U:_(S[ie])}function _(S){return L;function L(Q){return C=P(),ae=S,S.partial||(u.currentConstruct=S),S.name&&u.parser.constructs.disable.null.includes(S.name)?q():S.tokenize.call(B?Object.assign(Object.create(u),B):u,l,O,q)(Q)}}function O(S){return $(ae,C),M}function q(S){return C.restore(),++ie<W.length?_(W[ie]):U}}}function R($,B){$.resolveAll&&!a.includes($)&&a.push($),$.resolve&&sn(u.events,B,u.events.length-B,$.resolve(u.events.slice(B),u)),$.resolveTo&&(u.events=$.resolveTo(u.events,u))}function P(){const $=v(),B=u.previous,A=u.currentConstruct,j=u.events.length,M=Array.from(o);return{restore:U,from:j};function U(){r=$,u.previous=B,u.currentConstruct=A,u.events.length=j,o=M,z()}}function z(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function OD(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,a)];else{if(s=e.slice(n,i),r>-1){const o=s[0];typeof o=="string"?s[0]=o.slice(r):s.shift()}a>0&&s.push(e[i].slice(0,a))}return s}function PD(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const a=e[n];let s;if(typeof a=="string")s=a;else switch(a){case-5:{s="\r";break}case-4:{s=`
76
+ `)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var x;u=o,d=((x=o.textContent)===null||x===void 0?void 0:x.length)||0}var C=ne.toSlatePoint(e,[o,l],{exactMatch:i,suppressThrow:a});if(!C)return null;var F=m?C:ne.toSlatePoint(e,[u,d],{exactMatch:i,suppressThrow:a});if(!F)return null;var D={anchor:C,focus:F};return G.isExpanded(D)&&G.isForward(D)&&Mt(u)&&w.void(e,{at:D.focus,mode:"highest"})&&(D=w.unhangRange(e,D,{voids:!0})),D}};function _1(e,t){var{path:n,diff:r}=t;if(!w.hasPath(e,n))return!1;var i=le.get(e,n);if(!ge.isText(i))return!1;if(r.start!==i.text.length||r.text.length===0)return i.text.slice(r.start,r.start+r.text.length)===r.text;var a=I.next(n);if(!w.hasPath(e,a))return!1;var s=le.get(e,a);return ge.isText(s)&&s.text.startsWith(r.text)}function cm(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.reduce((i,a)=>i.slice(0,a.start)+a.text+i.slice(a.end),e)}function k1(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 F1(e,t,n){for(var r=Math.min(e.length,t.length,n),i=0;i<r;i++)if(e.charAt(e.length-i-1)!==t.charAt(t.length-i-1))return i;return r}function dm(e,t){var{start:n,end:r,text:i}=t,a=e.slice(n,r),s=k1(a,i),o=Math.min(a.length-s,i.length-s),l=F1(a,i,o),u={start:n+s,end:r-l,text:i.slice(s,i.length-l)};return u.start===u.end&&u.text.length===0?null:u}function A1(e,t,n){var r=Math.min(t.start,n.start),i=Math.max(0,Math.min(t.start+t.text.length,n.end)-n.start),a=cm(e,t,n),s=Math.max(n.start+n.text.length,t.start+t.text.length+(t.start+t.text.length>n.start?n.text.length:0)-i),o=a.slice(r,s),l=Math.max(t.end,n.end-t.text.length+(t.end-t.start));return dm(e,{start:r,end:l,text:o})}function B1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Zs(e,t){var{path:n,offset:r}=t;if(!w.hasPath(e,n))return null;var i=le.get(e,n);if(!ge.isText(i))return null;var a=w.above(e,{match:o=>me.isElement(o)&&w.isBlock(e,o),at:n});if(!a)return null;for(;r>i.text.length;){var s=w.next(e,{at:n,match:ge.isText});if(!s||!I.isDescendant(s[1],a[1]))return null;r-=i.text.length,i=s[0],n=s[1]}return{path:n,offset:r}}function rc(e,t){var n=Zs(e,t.anchor);if(!n)return null;if(G.isCollapsed(t))return{anchor:n,focus:n};var r=Zs(e,t.focus);return r?{anchor:n,focus:r}:null}function Ys(e,t,n){var r=xt.get(e),i=r==null?void 0:r.find(d=>{var{path:m}=d;return I.equals(m,t.path)});if(!i||t.offset<=i.diff.start)return Se.transform(t,n,{affinity:"backward"});var{diff:a}=i;if(t.offset<=a.start+a.text.length){var s={path:t.path,offset:a.start},o=Se.transform(s,n,{affinity:"backward"});return o?{path:o.path,offset:o.offset+t.offset-a.start}:null}var l={path:t.path,offset:t.offset-a.text.length+a.end-a.start},u=Se.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&I.equals(n.path,t.path)&&l.offset<n.position&&a.start<n.position?u:{path:u.path,offset:u.offset+a.text.length-a.end+a.start}:null}function ic(e,t,n){var r=Ys(e,t.anchor,n);if(!r)return null;if(G.isCollapsed(t))return{anchor:r,focus:r};var i=Ys(e,t.focus,n);return i?{anchor:r,focus:i}:null}function T1(e,t){var{path:n,diff:r,id:i}=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:i,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:i,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:i,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:i,path:n};case"split_node":return!I.equals(t.path,n)||t.position>=r.end?{diff:r,id:i,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:i,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:i,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:i,path:I.transform(n,t)}:{diff:r,id:i,path:I.transform(n,t)}}var a=I.transform(n,t);return a?{diff:r,path:a,id:i}:null}function ac(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ci(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){Nt(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 S1=25,j1=200,P1=function(){},O1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function M1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,i=!1,a=null,s=null,o=null,l=0,u=!1,d=()=>{var A=hn.get(t);if(hn.delete(t),A){var{selection:B}=t,j=rc(t,A);j&&(!B||!G.equals(j,B))&&X.select(t,j)}},m=()=>{var A=mn.get(t);if(mn.delete(t),!!A){if(A.at){var B=Se.isPoint(A.at)?Zs(t,A.at):rc(t,A.at);if(!B)return;var j=w.range(t,B);(!t.selection||!G.equals(t.selection,j))&&X.select(t,B)}A.run()}},h=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!F()&&!C()){d();return}i||(i=!0,setTimeout(()=>i=!1)),C()&&(i="action");var A=t.selection&&w.rangeRef(t,t.selection,{affinity:"forward"});nn.set(t,t.marks),P1("flush",mn.get(t),xt.get(t));for(var B=F(),j;j=(M=xt.get(t))===null||M===void 0?void 0:M[0];){var M,U,W=Lt.get(t);W!==void 0&&(Lt.delete(t),t.marks=W),W&&u===!1&&(u=null);var ie=B1(j);(!t.selection||!G.equals(t.selection,ie))&&X.select(t,ie),j.diff.text?w.insertText(t,j.diff.text):w.deleteFragment(t),xt.set(t,(U=xt.get(t))===null||U===void 0?void 0:U.filter(ee=>{var{id:Z}=ee;return Z!==j.id})),_1(t,j)||(B=!1,mn.delete(t),nn.delete(t),i="action",hn.delete(t),n.cancel(),r.cancel(),A==null||A.unref())}var se=A==null?void 0:A.unref();if(se&&!hn.get(t)&&(!t.selection||!G.equals(se,t.selection))&&X.select(t,se),C()){m();return}B&&n(),n.flush(),r.flush(),d();var E=nn.get(t);nn.delete(t),E!==void 0&&(t.marks=E,t.onChange())},p=A=>{a&&clearTimeout(a),a=setTimeout(()=>{Fn.set(t,!1),h()},S1)},v=A=>{Fn.set(t,!0),a&&(clearTimeout(a),a=null)},f=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=Ws.get(t);if(j){if(F()||B){j.style.display="none";return}j.style.removeProperty("display")}},b=(A,B)=>{var j,M=(j=xt.get(t))!==null&&j!==void 0?j:[];xt.set(t,M);var U=le.leaf(t,A),W=M.findIndex(E=>I.equals(E.path,A));if(W<0){var ie=dm(U.text,B);ie&&M.push({path:A,diff:B,id:l++}),f();return}var se=A1(U.text,M[W].diff,B);if(!se){M.splice(W,1),f();return}M[W]=Ci(Ci({},M[W]),{},{diff:se})},g=function(B){var{at:j}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,hn.delete(t),n.cancel(),r.cancel(),C()&&h(),mn.set(t,{at:j,run:B}),o=setTimeout(h)},x=A=>{var B;s&&(clearTimeout(s),s=null);var{inputType:j}=A,M=null,U=A.dataTransfer||A.data||void 0;u!==!1&&j!=="insertText"&&j!=="insertCompositionText"&&(u=!1);var[W]=A.getTargetRanges();W&&(M=ne.toSlateRange(t,W,{exactMatch:!1,suppressThrow:!0}));var ie=ne.getWindow(t),se=ie.getSelection();if(!M&&se&&(W=se,M=ne.toSlateRange(t,se,{exactMatch:!1,suppressThrow:!0})),M=(B=M)!==null&&B!==void 0?B:t.selection,!!M){var E=!0;if(j.startsWith("delete")){if(G.isExpanded(M)){var[ee,Z]=G.edges(M),k=le.leaf(t,ee.path);if(k.text.length===ee.offset&&Z.offset===0){var P=w.next(t,{at:ee.path,match:ge.isText});P&&I.equals(P[1],Z.path)&&(M={anchor:Z,focus:Z})}}var q=j.endsWith("Backward")?"backward":"forward",[S,L]=G.edges(M),[Q,Y]=w.leaf(t,S.path),te={text:"",start:S.offset,end:L.offset},ce=xt.get(t),J=ce==null?void 0:ce.find(he=>I.equals(he.path,Y)),pe=J?[J.diff,te]:[te],de=cm(Q.text,...pe);if(de.length===0&&(E=!1),G.isExpanded(M)){if(E&&I.equals(M.anchor.path,M.focus.path)){var xe={path:M.anchor.path,offset:S.offset},Be=w.range(t,xe,xe);return T(Be),b(M.anchor.path,{text:"",end:L.offset,start:S.offset})}return g(()=>w.deleteFragment(t,{direction:q}),{at:M})}}switch(j){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return g(()=>w.deleteFragment(t),{at:M});case"deleteContent":case"deleteContentForward":{var{anchor:Fe}=M;if(E&&G.isCollapsed(M)){var Ve=le.leaf(t,Fe.path);if(Fe.offset<Ve.text.length)return b(Fe.path,{text:"",start:Fe.offset,end:Fe.offset+1})}return g(()=>w.deleteForward(t),{at:M})}case"deleteContentBackward":{var Re,{anchor:Ne}=M,Qe=Ks(W)?W.isCollapsed:!!((Re=W)!==null&&Re!==void 0&&Re.collapsed);return E&&Qe&&G.isCollapsed(M)&&Ne.offset>0?b(Ne.path,{text:"",start:Ne.offset-1,end:Ne.offset}):g(()=>w.deleteBackward(t),{at:M})}case"deleteEntireSoftLine":return g(()=>{w.deleteBackward(t,{unit:"line"}),w.deleteForward(t,{unit:"line"})},{at:M});case"deleteHardLineBackward":return g(()=>w.deleteBackward(t,{unit:"block"}),{at:M});case"deleteSoftLineBackward":return g(()=>w.deleteBackward(t,{unit:"line"}),{at:M});case"deleteHardLineForward":return g(()=>w.deleteForward(t,{unit:"block"}),{at:M});case"deleteSoftLineForward":return g(()=>w.deleteForward(t,{unit:"line"}),{at:M});case"deleteWordBackward":return g(()=>w.deleteBackward(t,{unit:"word"}),{at:M});case"deleteWordForward":return g(()=>w.deleteForward(t,{unit:"word"}),{at:M});case"insertLineBreak":return g(()=>w.insertSoftBreak(t),{at:M});case"insertParagraph":return g(()=>w.insertBreak(t),{at:M});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(O1(U))return g(()=>ne.insertData(t,U),{at:M});var Ae=U??"";if(Lt.get(t)&&(Ae=Ae.replace("\uFEFF","")),j==="insertText"&&/.*\n.*\n$/.test(Ae)&&(Ae=Ae.slice(0,-1)),Ae.includes(`
77
+ `))return g(()=>{var he=Ae.split(`
78
+ `);he.forEach((ve,Te)=>{ve&&w.insertText(t,ve),Te!==he.length-1&&w.insertSoftBreak(t)})},{at:M});if(I.equals(M.anchor.path,M.focus.path)){var[Oe,Ee]=G.edges(M),K={start:Oe.offset,end:Ee.offset,text:Ae};if(Ae&&u&&j==="insertCompositionText"){var oe=u.start+u.text.search(/\S|$/),ae=K.start+K.text.search(/\S|$/);ae===oe+1&&K.end===u.start+u.text.length?(K.start-=1,u=null,z()):u=!1}else j==="insertText"?u===null?u=K:u&&G.isCollapsed(M)&&u.end+u.text.length===Oe.offset?u=Ci(Ci({},u),{},{text:u.text+Ae}):u=!1:u=!1;if(E){b(Oe.path,K);return}}return g(()=>w.insertText(t,Ae),{at:M})}}}},C=()=>!!mn.get(t),F=()=>{var A;return!!((A=xt.get(t))!==null&&A!==void 0&&A.length)},D=()=>C()||F(),_=()=>i,T=A=>{hn.set(t,A),s&&(clearTimeout(s),s=null);var{selection:B}=t;if(A){var j=!B||!I.equals(B.anchor.path,A.anchor.path),M=!B||!I.equals(B.anchor.path.slice(0,-1),A.anchor.path.slice(0,-1));(j&&u||M)&&(u=!1),(j||F())&&(s=setTimeout(h,j1))}},R=()=>{(C()||!F())&&h()},O=A=>{F()||(f(!0),setTimeout(f))},z=()=>{C()||(o=setTimeout(h))},$=A=>{if(!(F()||C())&&A.some(j=>Zo(t,j,A))){var B;(B=am.get(t))===null||B===void 0||B()}};return{flush:h,scheduleFlush:z,hasPendingDiffs:F,hasPendingAction:C,hasPendingChanges:D,isFlushing:_,handleUserSelect:T,handleCompositionEnd:p,handleCompositionStart:v,handleDOMBeforeInput:x,handleKeyDown:O,handleDomMutations:$,handleInput:R}}function N1(){var e=y.useRef(!1);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Qr=Mi?y.useLayoutEffect:y.useEffect;function I1(e,t,n){var[r]=y.useState(()=>new MutationObserver(t));Qr(()=>{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 R1=["node"];function sc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function $1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sc(Object(n),!0).forEach(function(r){Nt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var L1={subtree:!0,childList:!0,characterData:!0},z1=gt?e=>{var{node:t}=e,n=fr(e,R1);if(!gt)return null;var r=wn(),i=N1(),[a]=y.useState(()=>M1($1({editor:r},n)));return I1(t,a.handleDomMutations,L1),Ho.set(r,a.scheduleFlush),i&&a.flush(),a}:()=>null,q1=["anchor","focus"],U1=["anchor","focus"],W1=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),fm=(e,t)=>{var n=fr(e,q1),r=fr(t,U1);return e[mr]===t[mr]&&W1(n,r)},V1=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],i=t[n];if(!G.equals(r,i)||!fm(r,i))return!1}return!0},H1=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],i=t[n];if(r.anchor.offset!==i.anchor.offset||r.focus.offset!==i.focus.offset||!fm(r,i))return!1}return!0};function oc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function K1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oc(Object(n),!0).forEach(function(r){Nt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Z1=e=>{var{isLast:t,leaf:n,parent:r,text:i}=e,a=wn(),s=ne.findPath(a,i),o=I.parent(s),l=!!n[sm];return a.isVoid(r)?y.createElement(Qa,{length:le.string(r).length}):n.text===""&&r.children[r.children.length-1]===i&&!a.isInline(r)&&w.string(a,o)===""?y.createElement(Qa,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?y.createElement(Qa,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
79
+ `?y.createElement(uc,{isTrailing:!0,text:n.text}):y.createElement(uc,{text:n.text})},uc=e=>{var{text:t,isTrailing:n=!1}=e,r=y.useRef(null),i=()=>"".concat(t??"").concat(n?`
80
+ `:""),[a]=y.useState(i);return Qr(()=>{var s=i();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(Y1,{ref:r},a)},Y1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Qa=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,i={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(i["data-slate-mark-placeholder"]=!0),y.createElement("span",K1({},i),!gt||!n?"\uFEFF":null,n?y.createElement("br",null):null)};function lc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function mm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?lc(Object(n),!0).forEach(function(r){Nt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var G1=gt?300:0;function Q1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function cc(e){e.current&&(clearTimeout(e.current),e.current=null)}var J1=e=>{var{leaf:t,isLast:n,text:r,parent:i,renderPlaceholder:a,renderLeaf:s=x=>y.createElement(ew,mm({},x))}=e,o=wn(),l=y.useRef(null),u=y.useRef(null),[d,m]=y.useState(!1),h=y.useRef(null),p=y.useCallback(x=>{if(Q1(l,x==null),x==null){var C;Ws.delete(o),(C=t.onPlaceholderResize)===null||C===void 0||C.call(t,null)}else{if(Ws.set(o,x),!l.current){var F=window.ResizeObserver||e1;l.current=new F(()=>{var D;(D=t.onPlaceholderResize)===null||D===void 0||D.call(t,x)})}l.current.observe(x),u.current=x}},[u,t,o]),v=y.createElement(Z1,{isLast:n,leaf:t,parent:i,text:r}),f=!!t[mr];if(y.useEffect(()=>(f?h.current||(h.current=setTimeout(()=>{m(!0),h.current=null},G1)):(cc(h),m(!1)),()=>cc(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:Pr?"inherit":void 0},contentEditable:!1,ref:p}};v=y.createElement(y.Fragment,null,a(b),v)}var g={"data-slate-leaf":!0};return s({attributes:g,children:v,leaf:t,text:r})},X1=y.memo(J1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&ge.equals(t.leaf,e.leaf)&&t.leaf[mr]===e.leaf[mr]),ew=e=>{var{attributes:t,children:n}=e;return y.createElement("span",mm({},t),n)},tw=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:i,renderLeaf:a,text:s}=e,o=wn(),l=y.useRef(null),u=ge.decorations(s,t),d=ne.findKey(o,s),m=[],h=0;h<u.length;h++){var p=u[h];m.push(y.createElement(X1,{isLast:n&&h===u.length-1,key:"".concat(d.id,"-").concat(h),renderPlaceholder:i,leaf:p,text:s,parent:r,renderLeaf:a}))}var v=y.useCallback(f=>{var b=xa.get(o);f?(b==null||b.set(d,f),Tn.set(s,f),Gr.set(f,s)):(b==null||b.delete(d),Tn.delete(s),l.current&&Gr.delete(l.current)),l.current=f},[l,o,d,s]);return y.createElement("span",{"data-slate-node":"text",ref:v},m)},hm=y.memo(tw,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&H1(t.decorations,e.decorations));function dc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Gs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dc(Object(n),!0).forEach(function(r){Nt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var nw=e=>{var{decorations:t,element:n,renderElement:r=x=>y.createElement(iw,Gs({},x)),renderPlaceholder:i,renderLeaf:a,selection:s}=e,o=wn(),l=ow(),u=o.isInline(n),d=ne.findKey(o,n),m=y.useCallback(x=>{var C=xa.get(o);x?(C==null||C.set(d,x),Tn.set(n,x),Gr.set(x,n)):(C==null||C.delete(d),Tn.delete(n))},[o,d,n]),h=gm({decorations:t,node:n,renderElement:r,renderPlaceholder:i,renderLeaf:a,selection:s}),p={"data-slate-node":"element",ref:m};if(u&&(p["data-slate-inline"]=!0),!u&&w.hasInlines(o,n)){var v=le.string(n),f=Sf(v);f==="rtl"&&(p.dir=f)}if(w.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var b=u?"span":"div",[[g]]=le.texts(n);h=y.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(hm,{renderPlaceholder:i,decorations:[],isLast:!1,parent:n,text:g})),Wo.set(g,0),Vo.set(g,n)}return r({attributes:p,children:h,element:n})},rw=y.memo(nw,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&V1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&G.equals(e.selection,t.selection))),iw=e=>{var{attributes:t,children:n,element:r}=e,i=wn(),a=i.isInline(r)?"span":"div";return y.createElement(a,Gs(Gs({},t),{},{style:{position:"relative"}}),n)},pm=y.createContext(()=>[]),aw=()=>y.useContext(pm),sw=y.createContext(!1),gm=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:i,renderLeaf:a,selection:s}=e,o=aw(),l=wn(),u=ne.findPath(l,n),d=[],m=me.isElement(n)&&!l.isInline(n)&&w.hasInlines(l,n),h=0;h<n.children.length;h++){var p=u.concat(h),v=n.children[h],f=ne.findKey(l,v),b=w.range(l,p),g=s&&G.intersection(b,s),x=o([v,p]);for(var C of t){var F=G.intersection(C,b);F&&x.push(F)}me.isElement(v)?d.push(y.createElement(sw.Provider,{key:"provider-".concat(f.id),value:!!g},y.createElement(rw,{decorations:x,element:v,key:f.id,renderElement:r,renderPlaceholder:i,renderLeaf:a,selection:g}))):d.push(y.createElement(hm,{decorations:x,key:f.id,isLast:m&&h===n.children.length-1,parent:n,renderPlaceholder:i,renderLeaf:a,text:v})),Wo.set(v,h),Vo.set(v,n)}return d},vm=y.createContext(!1),ow=()=>y.useContext(vm),bm=y.createContext(null),zn=()=>{var e=y.useContext(bm);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function uw(){var e=wn(),t=y.useRef(!1),n=y.useRef(0),r=y.useCallback(()=>{if(!t.current){t.current=!0;var i=ne.getWindow(e);i.cancelAnimationFrame(n.current),n.current=i.requestAnimationFrame(()=>{t.current=!1})}},[e]);return y.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var lw=3,cw={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"},dw={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"},fw={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ye=e=>{var t=cw[e],n=dw[e],r=fw[e],i=t&&Ga(t),a=n&&Ga(n),s=r&&Ga(r);return o=>!!(i&&i(o)||nc&&a&&a(o)||!nc&&s&&s(o))},Je={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")},mw=(e,t)=>{var n=[],r=()=>{n=[]},i=s=>{if(t.current){var o=s.filter(l=>Zo(e,l,s));n.push(...o)}};function a(){n.length>0&&(n.reverse().forEach(s=>{s.type!=="characterData"&&(s.removedNodes.forEach(o=>{s.target.insertBefore(o,s.nextSibling)}),s.addedNodes.forEach(o=>{s.target.removeChild(o)}))}),r())}return{registerMutations:i,restoreDOM:a,clear:r}},hw={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class ym extends y.Component{constructor(){super(...arguments),Nt(this,"context",null),Nt(this,"manager",null),Nt(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,hw)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=mw(n,t),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var t,n,r,i=(t=this.mutationObserver)===null||t===void 0?void 0:t.takeRecords();if(i!=null&&i.length){var a;(a=this.manager)===null||a===void 0||a.registerMutations(i)}return(n=this.mutationObserver)===null||n===void 0||n.disconnect(),(r=this.manager)===null||r===void 0||r.restoreDOM(),null}componentDidUpdate(){var t;(t=this.manager)===null||t===void 0||t.clear(),this.observe()}componentWillUnmount(){var t;(t=this.mutationObserver)===null||t===void 0||t.disconnect()}render(){return this.props.children}}Nt(ym,"contextType",Uo);var pw=gt?ym:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},gw=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],vw=["text"];function fc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Wt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fc(Object(n),!0).forEach(function(r){Nt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var bw=e=>y.createElement(y.Fragment,null,gm(e)),yw=e=>{var t=y.useCallback(P=>y.createElement(xw,Wt({},P)),[]),{autoFocus:n,decorate:r=ww,onDOMBeforeInput:i,placeholder:a,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=Cw,style:m={},as:h="div",disableDefaultStyles:p=!1}=e,v=fr(e,gw),f=zn(),[b,g]=y.useState(!1),x=y.useRef(null),C=y.useRef([]),[F,D]=y.useState(),{onUserInput:_,receivedUserInput:T}=uw(),[,R]=y.useReducer(P=>P+1,0);am.set(f,R),Vs.set(f,s);var O=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{x.current&&n&&x.current.focus()},[n]);var z=y.useRef(),$=y.useMemo(()=>Xb(()=>{var P=z.current;if((gt||!ne.isComposing(f))&&(!O.isUpdatingSelection||P!=null&&P.isFlushing())&&!O.isDraggingInternally){var q=ne.findDocumentOrShadowRoot(f),{activeElement:S}=q,L=ne.toDOMNode(f,f),Q=q.getSelection();if(S===L?(O.latestElement=S,vn.set(f,!0)):vn.delete(f),!Q)return X.deselect(f);var{anchorNode:Y,focusNode:te}=Q,ce=ne.hasEditableTarget(f,Y)||ne.isTargetInsideNonReadonlyVoid(f,Y),J=ne.hasEditableTarget(f,te)||ne.isTargetInsideNonReadonlyVoid(f,te);if(ce&&J){var pe=ne.toSlateRange(f,Q,{exactMatch:!1,suppressThrow:!0});pe&&(!ne.isComposing(f)&&!(P!=null&&P.hasPendingChanges())&&!(P!=null&&P.isFlushing())?X.select(f,pe):P==null||P.handleUserSelect(pe))}s&&(!ce||!J)&&X.deselect(f)}},100),[f,s,O]),A=y.useMemo(()=>Kb($,0),[$]);z.current=z1({node:x,onDOMSelectionChange:$,scheduleOnDOMSelectionChange:A}),Qr(()=>{var P,q,S;x.current&&(S=Ko(x.current))?(im.set(f,S),Ni.set(f,x.current),Tn.set(f,x.current),Gr.set(x.current,f)):Tn.delete(f);var{selection:L}=f,Q=ne.findDocumentOrShadowRoot(f),Y=Q.getSelection();if(!(!Y||!ne.isFocused(f)||(P=z.current)!==null&&P!==void 0&&P.hasPendingAction())){var te=de=>{var xe=Y.type!=="None";if(!(!L&&!xe)){var Be=Y.focusNode,Fe;if(Xn&&Y.rangeCount>1){var Ve=Y.getRangeAt(0),Re=Y.getRangeAt(Y.rangeCount-1);Ve.startContainer===Be?Fe=Re.endContainer:Fe=Ve.startContainer}else Fe=Y.anchorNode;var Ne=Ni.get(f),Qe=!1;if(Ne.contains(Fe)&&Ne.contains(Be)&&(Qe=!0),xe&&Qe&&L&&!de){var Ae=ne.toSlateRange(f,Y,{exactMatch:!0,suppressThrow:!0});if(Ae&&G.equals(Ae,L)){var Oe;if(!O.hasMarkPlaceholder||(Oe=Fe)!==null&&Oe!==void 0&&(Oe=Oe.parentElement)!==null&&Oe!==void 0&&Oe.hasAttribute("data-slate-mark-placeholder"))return}}if(L&&!ne.hasRange(f,L)){f.selection=ne.toSlateRange(f,Y,{exactMatch:!1,suppressThrow:!0});return}O.isUpdatingSelection=!0;var Ee=L&&ne.toDOMRange(f,L);return Ee?(ne.isComposing(f)&&!gt?Y.collapseToEnd():G.isBackward(L)?Y.setBaseAndExtent(Ee.endContainer,Ee.endOffset,Ee.startContainer,Ee.startOffset):Y.setBaseAndExtent(Ee.startContainer,Ee.startOffset,Ee.endContainer,Ee.endOffset),d(f,Ee)):Y.removeAllRanges(),Ee}};Y.rangeCount<=1&&te();var ce=((q=z.current)===null||q===void 0?void 0:q.isFlushing())==="action";if(!gt||!ce){setTimeout(()=>{O.isUpdatingSelection=!1});return}var J=null,pe=requestAnimationFrame(()=>{if(ce){var de=xe=>{try{var Be=ne.toDOMNode(f,f);Be.focus(),te(xe)}catch{}};de(),J=setTimeout(()=>{de(!0),O.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(pe),J&&clearTimeout(J)}}});var B=y.useCallback(P=>{if(_(),!s&&ne.hasEditableTarget(f,P.target)&&!Dw(P,i)){var q;if(z.current)return z.current.handleDOMBeforeInput(P);A.flush(),$.flush();var{selection:S}=f,{inputType:L}=P,Q=P.dataTransfer||P.data||void 0,Y=L==="insertCompositionText"||L==="deleteCompositionText";if(Y&&ne.isComposing(f))return;var te=!1;if(L==="insertText"&&S&&G.isCollapsed(S)&&P.data&&P.data.length===1&&/[a-z ]/i.test(P.data)&&S.anchor.offset!==0){var ce,J;te=!0,f.marks&&(te=!1);var{anchor:pe}=S,[de,xe]=ne.toDOMPoint(f,pe),Be=(ce=de.parentElement)===null||ce===void 0?void 0:ce.closest("a"),Fe=ne.getWindow(f);if(te&&Be&&ne.hasDOMNode(f,Be)){var Ve,Re=Fe==null?void 0:Fe.document.createTreeWalker(Be,NodeFilter.SHOW_TEXT).lastChild();Re===de&&((Ve=Re.textContent)===null||Ve===void 0?void 0:Ve.length)===xe&&(te=!1)}if(te&&de.parentElement&&(Fe==null||(J=Fe.getComputedStyle(de.parentElement))===null||J===void 0?void 0:J.whiteSpace)==="pre"){var Ne=w.above(f,{at:pe.path,match:oe=>me.isElement(oe)&&w.isBlock(f,oe)});Ne&&le.string(Ne[0]).includes(" ")&&(te=!1)}}if(!L.startsWith("delete")||L.startsWith("deleteBy")){var[Qe]=P.getTargetRanges();if(Qe){var Ae=ne.toSlateRange(f,Qe,{exactMatch:!1,suppressThrow:!1});if(!S||!G.equals(S,Ae)){te=!1;var Oe=!Y&&f.selection&&w.rangeRef(f,f.selection);X.select(f,Ae),Oe&&Rr.set(f,Oe)}}}if(Y)return;if(te||P.preventDefault(),S&&G.isExpanded(S)&&L.startsWith("delete")){var Ee=L.endsWith("Backward")?"backward":"forward";w.deleteFragment(f,{direction:Ee});return}switch(L){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{w.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{w.deleteForward(f);break}case"deleteContentBackward":{w.deleteBackward(f);break}case"deleteEntireSoftLine":{w.deleteBackward(f,{unit:"line"}),w.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{w.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{w.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{w.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{w.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{w.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{w.deleteForward(f,{unit:"word"});break}case"insertLineBreak":w.insertSoftBreak(f);break;case"insertParagraph":{w.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{L==="insertFromComposition"&&ne.isComposing(f)&&(g(!1),Fn.set(f,!1)),(Q==null?void 0:Q.constructor.name)==="DataTransfer"?ne.insertData(f,Q):typeof Q=="string"&&(te?C.current.push(()=>w.insertText(f,Q)):w.insertText(f,Q));break}}var K=(q=Rr.get(f))===null||q===void 0?void 0:q.unref();Rr.delete(f),K&&(!f.selection||!G.equals(f.selection,K))&&X.select(f,K)}},[f,$,_,i,s,A]),j=y.useCallback(P=>{P==null?($.cancel(),A.cancel(),Ni.delete(f),Tn.delete(f),x.current&&dn&&x.current.removeEventListener("beforeinput",B)):dn&&P.addEventListener("beforeinput",B),x.current=P},[$,A,f,B]);Qr(()=>{var P=ne.getWindow(f);return P.document.addEventListener("selectionchange",A),()=>{P.document.removeEventListener("selectionchange",A)}},[A]);var M=r([f,[]]),U=a&&f.children.length===1&&Array.from(le.texts(f)).length===1&&le.string(f)===""&&!b,W=y.useCallback(P=>{if(P&&U){var q;D((q=P.getBoundingClientRect())===null||q===void 0?void 0:q.height)}else D(void 0)},[U]);if(U){var ie=w.start(f,[]);M.push({[mr]:!0,placeholder:a,onPlaceholderResize:W,anchor:ie,focus:ie})}var{marks:se}=f;if(O.hasMarkPlaceholder=!1,f.selection&&G.isCollapsed(f.selection)&&se){var{anchor:E}=f.selection,ee=le.leaf(f,E.path),Z=fr(ee,vw);if(!ge.equals(ee,se,{loose:!0})){O.hasMarkPlaceholder=!0;var k=Object.fromEntries(Object.keys(Z).map(P=>[P,null]));M.push(Wt(Wt(Wt({[sm]:!0},k),se),{},{anchor:E,focus:E}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:P}=f;if(P){var{anchor:q}=P,S=le.leaf(f,q.path);if(se&&!ge.equals(S,se,{loose:!0})){Lt.set(f,se);return}}Lt.delete(f)})}),y.createElement(vm.Provider,{value:s},y.createElement(pm.Provider,{value:r},y.createElement(pw,{node:x,receivedUserInput:T},y.createElement(h,Wt(Wt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},v),{},{spellCheck:dn||!Mi?v.spellCheck:!1,autoCorrect:dn||!Mi?v.autoCorrect:"false",autoCapitalize:dn||!Mi?v.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"},F?{minHeight:F}:{})),m),onBeforeInput:y.useCallback(P=>{if(!dn&&!s&&!ht(P,v.onBeforeInput)&&ne.hasSelectableTarget(f,P.target)&&(P.preventDefault(),!ne.isComposing(f))){var q=P.data;w.insertText(f,q)}},[v.onBeforeInput,f,s]),onInput:y.useCallback(P=>{if(!ht(P,v.onInput)){if(z.current){z.current.handleInput();return}for(var q of C.current)q();C.current=[]}},[v.onInput]),onBlur:y.useCallback(P=>{if(!(s||O.isUpdatingSelection||!ne.hasSelectableTarget(f,P.target)||ht(P,v.onBlur))){var q=ne.findDocumentOrShadowRoot(f);if(O.latestElement!==q.activeElement){var{relatedTarget:S}=P,L=ne.toDOMNode(f,f);if(S!==L&&!(Mt(S)&&S.hasAttribute("data-slate-spacer"))){if(S!=null&&bn(S)&&ne.hasDOMNode(f,S)){var Q=ne.toSlateNode(f,S);if(me.isElement(Q)&&!f.isVoid(Q))return}if(Pr){var Y=q.getSelection();Y==null||Y.removeAllRanges()}vn.delete(f)}}}},[s,O.isUpdatingSelection,O.latestElement,f,v.onBlur]),onClick:y.useCallback(P=>{if(ne.hasTarget(f,P.target)&&!ht(P,v.onClick)&&bn(P.target)){var q=ne.toSlateNode(f,P.target),S=ne.findPath(f,q);if(!w.hasPath(f,S)||le.get(f,S)!==q)return;if(P.detail===lw&&S.length>=1){var L=S;if(!(me.isElement(q)&&w.isBlock(f,q))){var Q,Y=w.above(f,{match:Be=>me.isElement(Be)&&w.isBlock(f,Be),at:S});L=(Q=Y==null?void 0:Y[1])!==null&&Q!==void 0?Q:S.slice(0,1)}var te=w.range(f,L);X.select(f,te);return}if(s)return;var ce=w.start(f,S),J=w.end(f,S),pe=w.void(f,{at:ce}),de=w.void(f,{at:J});if(pe&&de&&I.equals(pe[1],de[1])){var xe=w.range(f,ce);X.select(f,xe)}}},[f,v.onClick,s]),onCompositionEnd:y.useCallback(P=>{if(ne.hasSelectableTarget(f,P.target)){var q;if(ne.isComposing(f)&&Promise.resolve().then(()=>{g(!1),Fn.set(f,!1)}),(q=z.current)===null||q===void 0||q.handleCompositionEnd(P),ht(P,v.onCompositionEnd)||gt)return;if(!Pr&&!f1&&!u1&&!h1&&!m1&&P.data){var S=Lt.get(f);Lt.delete(f),S!==void 0&&(nn.set(f,f.marks),f.marks=S),w.insertText(f,P.data);var L=nn.get(f);nn.delete(f),L!==void 0&&(f.marks=L)}}},[v.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(P=>{ne.hasSelectableTarget(f,P.target)&&!ht(P,v.onCompositionUpdate)&&(ne.isComposing(f)||(g(!0),Fn.set(f,!0)))},[v.onCompositionUpdate,f]),onCompositionStart:y.useCallback(P=>{if(ne.hasSelectableTarget(f,P.target)){var q;if((q=z.current)===null||q===void 0||q.handleCompositionStart(P),ht(P,v.onCompositionStart)||gt)return;g(!0);var{selection:S}=f;if(S&&G.isExpanded(S)){w.deleteFragment(f);return}}},[v.onCompositionStart,f]),onCopy:y.useCallback(P=>{ne.hasSelectableTarget(f,P.target)&&!ht(P,v.onCopy)&&!mc(P)&&(P.preventDefault(),ne.setFragmentData(f,P.clipboardData,"copy"))},[v.onCopy,f]),onCut:y.useCallback(P=>{if(!s&&ne.hasSelectableTarget(f,P.target)&&!ht(P,v.onCut)&&!mc(P)){P.preventDefault(),ne.setFragmentData(f,P.clipboardData,"cut");var{selection:q}=f;if(q)if(G.isExpanded(q))w.deleteFragment(f);else{var S=le.parent(f,q.anchor.path);w.isVoid(f,S)&&X.delete(f)}}},[s,f,v.onCut]),onDragOver:y.useCallback(P=>{if(ne.hasTarget(f,P.target)&&!ht(P,v.onDragOver)){var q=ne.toSlateNode(f,P.target);me.isElement(q)&&w.isVoid(f,q)&&P.preventDefault()}},[v.onDragOver,f]),onDragStart:y.useCallback(P=>{if(!s&&ne.hasTarget(f,P.target)&&!ht(P,v.onDragStart)){var q=ne.toSlateNode(f,P.target),S=ne.findPath(f,q),L=me.isElement(q)&&w.isVoid(f,q)||w.void(f,{at:S,voids:!0});if(L){var Q=w.range(f,S);X.select(f,Q)}O.isDraggingInternally=!0,ne.setFragmentData(f,P.dataTransfer,"drag")}},[s,f,v.onDragStart,O]),onDrop:y.useCallback(P=>{if(!s&&ne.hasTarget(f,P.target)&&!ht(P,v.onDrop)){P.preventDefault();var q=f.selection,S=ne.findEventRange(f,P),L=P.dataTransfer;X.select(f,S),O.isDraggingInternally&&q&&!G.equals(q,S)&&!w.void(f,{at:S,voids:!0})&&X.delete(f,{at:q}),ne.insertData(f,L),ne.isFocused(f)||ne.focus(f)}O.isDraggingInternally=!1},[s,f,v.onDrop,O]),onDragEnd:y.useCallback(P=>{!s&&O.isDraggingInternally&&v.onDragEnd&&ne.hasTarget(f,P.target)&&v.onDragEnd(P),O.isDraggingInternally=!1},[s,O,v,f]),onFocus:y.useCallback(P=>{if(!s&&!O.isUpdatingSelection&&ne.hasEditableTarget(f,P.target)&&!ht(P,v.onFocus)){var q=ne.toDOMNode(f,f),S=ne.findDocumentOrShadowRoot(f);if(O.latestElement=S.activeElement,Xn&&P.target!==q){q.focus();return}vn.set(f,!0)}},[s,O,f,v.onFocus]),onKeyDown:y.useCallback(P=>{if(!s&&ne.hasEditableTarget(f,P.target)){var q;(q=z.current)===null||q===void 0||q.handleKeyDown(P);var{nativeEvent:S}=P;if(ne.isComposing(f)&&S.isComposing===!1&&(Fn.set(f,!1),g(!1)),ht(P,v.onKeyDown)||ne.isComposing(f))return;var{selection:L}=f,Q=f.children[L!==null?L.focus.path[0]:0],Y=Sf(le.string(Q))==="rtl";if(Je.isRedo(S)){P.preventDefault();var te=f;typeof te.redo=="function"&&te.redo();return}if(Je.isUndo(S)){P.preventDefault();var ce=f;typeof ce.undo=="function"&&ce.undo();return}if(Je.isMoveLineBackward(S)){P.preventDefault(),X.move(f,{unit:"line",reverse:!0});return}if(Je.isMoveLineForward(S)){P.preventDefault(),X.move(f,{unit:"line"});return}if(Je.isExtendLineBackward(S)){P.preventDefault(),X.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Je.isExtendLineForward(S)){P.preventDefault(),X.move(f,{unit:"line",edge:"focus"});return}if(Je.isMoveBackward(S)){P.preventDefault(),L&&G.isCollapsed(L)?X.move(f,{reverse:!Y}):X.collapse(f,{edge:Y?"end":"start"});return}if(Je.isMoveForward(S)){P.preventDefault(),L&&G.isCollapsed(L)?X.move(f,{reverse:Y}):X.collapse(f,{edge:Y?"start":"end"});return}if(Je.isMoveWordBackward(S)){P.preventDefault(),L&&G.isExpanded(L)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:!Y});return}if(Je.isMoveWordForward(S)){P.preventDefault(),L&&G.isExpanded(L)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:Y});return}if(dn){if((rm||Pr)&&L&&(Je.isDeleteBackward(S)||Je.isDeleteForward(S))&&G.isCollapsed(L)){var J=le.parent(f,L.anchor.path);if(me.isElement(J)&&w.isVoid(f,J)&&(w.isInline(f,J)||w.isBlock(f,J))){P.preventDefault(),w.deleteBackward(f,{unit:"block"});return}}}else{if(Je.isBold(S)||Je.isItalic(S)||Je.isTransposeCharacter(S)){P.preventDefault();return}if(Je.isSoftBreak(S)){P.preventDefault(),w.insertSoftBreak(f);return}if(Je.isSplitBlock(S)){P.preventDefault(),w.insertBreak(f);return}if(Je.isDeleteBackward(S)){P.preventDefault(),L&&G.isExpanded(L)?w.deleteFragment(f,{direction:"backward"}):w.deleteBackward(f);return}if(Je.isDeleteForward(S)){P.preventDefault(),L&&G.isExpanded(L)?w.deleteFragment(f,{direction:"forward"}):w.deleteForward(f);return}if(Je.isDeleteLineBackward(S)){P.preventDefault(),L&&G.isExpanded(L)?w.deleteFragment(f,{direction:"backward"}):w.deleteBackward(f,{unit:"line"});return}if(Je.isDeleteLineForward(S)){P.preventDefault(),L&&G.isExpanded(L)?w.deleteFragment(f,{direction:"forward"}):w.deleteForward(f,{unit:"line"});return}if(Je.isDeleteWordBackward(S)){P.preventDefault(),L&&G.isExpanded(L)?w.deleteFragment(f,{direction:"backward"}):w.deleteBackward(f,{unit:"word"});return}if(Je.isDeleteWordForward(S)){P.preventDefault(),L&&G.isExpanded(L)?w.deleteFragment(f,{direction:"forward"}):w.deleteForward(f,{unit:"word"});return}}}},[s,f,v.onKeyDown]),onPaste:y.useCallback(P=>{!s&&ne.hasEditableTarget(f,P.target)&&!ht(P,v.onPaste)&&(!dn||v1(P.nativeEvent)||Pr)&&(P.preventDefault(),ne.insertData(f,P.clipboardData))},[s,f,v.onPaste])}),y.createElement(bw,{decorations:M,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},xw=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Wt({},t),n,gt&&y.createElement("br",null))},ww=()=>[],Cw=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&G.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),n0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},ht=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},mc=e=>bn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),Dw=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},Ew=y.createContext(!1),_w=y.createContext({});function kw(e){var t=y.useRef([]).current,n=y.useRef({editor:e}).current,r=y.useCallback(a=>{n.editor=a,t.forEach(s=>s(a))},[t,n]),i=y.useMemo(()=>({getSlate:()=>n.editor,addEventListener:a=>(t.push(a),()=>{t.splice(t.indexOf(a),1)})}),[t,n]);return{selectorContext:i,onChange:r}}var Fw=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],Aw=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:i,onValueChange:a,initialValue:s}=e,o=fr(e,Fw),[l,u]=y.useState(()=>{if(!le.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(it.stringify(s)));if(!w.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(it.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:m}=kw(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":i==null||i(t.selection);break;default:a==null||a(t.children)}u(g=>({v:g.v+1,editor:t})),m(t)},[t,m,r,i,a]);y.useEffect(()=>(Hs.set(t,h),()=>{Hs.set(t,()=>{})}),[t,h]);var[p,v]=y.useState(ne.isFocused(t));return y.useEffect(()=>{v(ne.isFocused(t))},[t]),Qr(()=>{var f=()=>v(ne.isFocused(t));return nm>=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(_w.Provider,{value:d},y.createElement(bm.Provider,{value:l},y.createElement(Uo.Provider,{value:l.editor},y.createElement(Ew.Provider,{value:p},n))))},hc=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},pc=(e,t,n)=>{var r=ne.toDOMRange(e,t).getBoundingClientRect(),i=ne.toDOMRange(e,n).getBoundingClientRect();return hc(r,i)&&hc(i,r)},Bw=(e,t)=>{var n=w.range(e,G.end(t)),r=Array.from(w.positions(e,{at:t})),i=0,a=r.length,s=Math.floor(a/2);if(pc(e,w.range(e,r[i]),n))return w.range(e,r[i],n);if(r.length<2)return w.range(e,r[r.length-1],n);for(;s!==r.length&&s!==i;)pc(e,w.range(e,r[s]),n)?a=s:i=s,s=Math.floor((i+a)/2);return w.range(e,r[a],n)};function gc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function vc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gc(Object(n),!0).forEach(function(r){Nt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Tw=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",r=t,{apply:i,onChange:a,deleteBackward:s,addMark:o,removeMark:l}=r;return xa.set(r,new WeakMap),r.addMark=(u,d)=>{var m,h;(m=Ho.get(r))===null||m===void 0||m(),!Lt.get(r)&&(h=xt.get(r))!==null&&h!==void 0&&h.length&&Lt.set(r,null),nn.delete(r),o(u,d)},r.removeMark=u=>{var d;!Lt.get(r)&&(d=xt.get(r))!==null&&d!==void 0&&d.length&&Lt.set(r,null),nn.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&G.isCollapsed(r.selection)){var d=w.above(r,{match:v=>me.isElement(v)&&w.isBlock(r,v),at:r.selection});if(d){var[,m]=d,h=w.range(r,m,r.selection.anchor),p=Bw(r,h);G.isCollapsed(p)||X.delete(r,{at:p})}}},r.apply=u=>{var d=[],m=[],h=xt.get(r);if(h!=null&&h.length){var p=h.map(j=>T1(j,u)).filter(Boolean);xt.set(r,p)}var v=hn.get(r);v&&hn.set(r,ic(r,v,u));var f=mn.get(r);if(f!=null&&f.at){var b=Se.isPoint(f==null?void 0:f.at)?Ys(r,f.at,u):ic(r,f.at,u);mn.set(r,b?vc(vc({},f),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Kn(r,u.path));break}case"set_selection":{var g;(g=Rr.get(r))===null||g===void 0||g.unref(),Rr.delete(r);break}case"insert_node":case"remove_node":{d.push(...Kn(r,I.parent(u.path)));break}case"merge_node":{var x=I.previous(u.path);d.push(...Kn(r,x));break}case"move_node":{var C=I.common(I.parent(u.path),I.parent(u.newPath));d.push(...Kn(r,C));var F;I.isBefore(u.path,u.newPath)?(d.push(...Kn(r,I.parent(u.path))),F=u.newPath):(d.push(...Kn(r,I.parent(u.newPath))),F=u.path);var D=le.get(t,I.parent(F)),_=ne.findKey(r,D),T=w.pathRef(r,I.parent(F));m.push([T,_]);break}}i(u);for(var[R,O]of d){var[z]=w.node(r,R);ta.set(z,O)}for(var[$,A]of m)if($.current){var[B]=w.node(r,$.current);ta.set(B,A)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[m,h]=G.edges(d),p=w.void(r,{at:m.path}),v=w.void(r,{at:h.path});if(!(G.isCollapsed(d)&&!p)){var f=ne.toDOMRange(r,d),b=f.cloneContents(),g=b.childNodes[0];if(b.childNodes.forEach(z=>{z.textContent&&z.textContent.trim()!==""&&(g=z)}),v){var[x]=v,C=f.cloneRange(),F=ne.toDOMNode(r,x);C.setEndAfter(F),b=C.cloneContents()}if(p&&(g=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(z=>{var $=z.getAttribute("data-slate-zero-width")==="n";z.textContent=$?`
81
+ `:""}),om(g)){var D=g.ownerDocument.createElement("span");D.style.whiteSpace="pre",D.appendChild(g),b.appendChild(D),g=D}var _=r.getFragment(),T=JSON.stringify(_),R=window.btoa(encodeURIComponent(T));g.setAttribute("data-slate-fragment",R),u.setData("application/".concat(n),R);var O=b.ownerDocument.createElement("div");return O.appendChild(b),O.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(O),u.setData("text/html",O.innerHTML),u.setData("text/plain",lm(O)),b.ownerDocument.body.removeChild(O),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||C1(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&&X.splitNodes(r,{always:!0}),r.insertText(p),h=!0;return!0}return!1},r.onChange=u=>{var d=nm<18?id.unstable_batchedUpdates:m=>m();d(()=>{var m=Hs.get(r);m&&m(u),a(u)})},r},Kn=(e,t)=>{var n=[];for(var[r,i]of w.levels(e,{at:t})){var a=ne.findKey(e,r);n.push([i,a])}return n};const Qs="MENTION: ",xm={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},bc={"mention-popover":35,default:-52},Ja=16,wm=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:i,mentionPopover:a}=y.useContext(ln),s=t==="link-editor"?i:a.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var p,v;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}=a,b=C=>{if(!w.hasPath(e,C.path))return!1;const F=le.get(e,C.path);return w.isEditor(F)||me.isElement(F)?C.offset<=F.children.length:ge.isText(F)?C.offset<=F.text.length:!1};if(f&&(!b(f==null?void 0:f.anchor)||!b(f==null?void 0:f.focus)))return;u=ne.toDOMRange(e,f||xm).getBoundingClientRect();const x=(p=document.getElementById(n))==null?void 0:p.getBoundingClientRect();l.style.setProperty("--width",`${((x==null?void 0:x.width)||0)/Ja}rem`),d=(x==null?void 0:x.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(u=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}u||(u=(v=document.getElementById(n))==null?void 0:v.getBoundingClientRect());const m=bc[t]||bc.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/Ja}rem`,l.style.left=`${d/Ja}rem`},o),r},Sw=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[i]=w.nodes(e,{at:r,match:a=>a.type===H.link});if(i){const a=i[0],s=co(a.link),o=a.children[0],l=(o==null?void 0:o.text)||"";n({...s,text:l})}else n(null)},[e,e.selection]),t};var pt=(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))(pt||{});const er={[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 yc(e){if(e)throw e}var Ii=Object.prototype.hasOwnProperty,Cm=Object.prototype.toString,xc=Object.defineProperty,wc=Object.getOwnPropertyDescriptor,Cc=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Cm.call(t)==="[object Array]"},Dc=function(t){if(!t||Cm.call(t)!=="[object Object]")return!1;var n=Ii.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Ii.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||Ii.call(t,i)},Ec=function(t,n){xc&&n.name==="__proto__"?xc(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},_c=function(t,n){if(n==="__proto__")if(Ii.call(t,n)){if(wc)return wc(t,n).value}else return;return t[n]},jw=function e(){var t,n,r,i,a,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=_c(o,n),i=_c(t,n),o!==i&&(d&&i&&(Dc(i)||(a=Cc(i)))?(a?(a=!1,s=r&&Cc(r)?r:[]):s=r&&Dc(r)?r:{},Ec(o,{name:n,newValue:e(d,s,i)})):typeof i<"u"&&Ec(o,{name:n,newValue:i}));return o};const Xa=In(jw);function Js(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 Pw(){const e=[],t={run:n,use:r};return t;function n(...i){let a=-1;const s=i.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...i);function o(l,...u){const d=e[++a];let m=-1;if(l){s(l);return}for(;++m<i.length;)(u[m]===null||u[m]===void 0)&&(u[m]=i[m]);i=u,d?Ow(d,o)(...u):s(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function Ow(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(i);try{l=e.apply(this,s)}catch(u){const d=u;if(o&&n)throw d;return i(d)}o||(l&&l.then&&typeof l.then=="function"?l.then(a,i):l instanceof Error?i(l):a(l))}function i(s,...o){n||(n=!0,t(s,...o))}function a(s){i(null,s)}}function $r(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?kc(e.position):"start"in e||"end"in e?kc(e):"line"in e||"column"in e?Xs(e):""}function Xs(e){return Fc(e&&e.line)+":"+Fc(e&&e.column)}function kc(e){return Xs(e&&e.start)+"-"+Xs(e&&e.end)}function Fc(e){return e&&typeof e=="number"?e:1}class Et extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},s=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?i=t:!a.cause&&t&&(s=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?a.ruleId=r:(a.source=r.slice(0,l),a.ruleId=r.slice(l+1))}if(!a.place&&a.ancestors&&a.ancestors){const l=a.ancestors[a.ancestors.length-1];l&&(a.place=l.position)}const o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=o?o.line:void 0,this.name=$r(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=s&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual,this.expected,this.note,this.url}}Et.prototype.file="";Et.prototype.name="";Et.prototype.reason="";Et.prototype.message="";Et.prototype.stack="";Et.prototype.column=void 0;Et.prototype.line=void 0;Et.prototype.ancestors=void 0;Et.prototype.cause=void 0;Et.prototype.fatal=void 0;Et.prototype.place=void 0;Et.prototype.ruleId=void 0;Et.prototype.source=void 0;const Vt={basename:Mw,dirname:Nw,extname:Iw,join:Rw,sep:"/"};function Mw(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ni(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,o=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else s<0&&(a=!0,s=i+1),o>-1&&(e.codePointAt(i)===t.codePointAt(o--)?o<0&&(r=i):(o=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function Nw(e){if(ni(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 Iw(e){ni(e);let t=e.length,n=-1,r=0,i=-1,a=0,s;for(;t--;){const o=e.codePointAt(t);if(o===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),o===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function Rw(...e){let t=-1,n;for(;++t<e.length;)ni(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":$w(n)}function $w(e){ni(e);const t=e.codePointAt(0)===47;let n=Lw(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Lw(e,t){let n="",r=0,i=-1,a=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(!(i===s-1||a===1))if(i!==s-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=s,a=0;continue}}else if(n.length>0){n="",r=0,i=s,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a>-1?a++:a=-1}return n}function ni(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const zw={cwd:qw};function qw(){return"/"}function eo(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Uw(e){if(typeof e=="string")e=new URL(e);else if(!eo(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 Ww(e)}function Ww(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const es=["history","path","basename","stem","extname","dirname"];class Vw{constructor(t){let n;t?eo(t)?n={path:t}:typeof t=="string"||Hw(t)?n={value:t}:n=t:n={},this.cwd=zw.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<es.length;){const a=es[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let i;for(i in n)es.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Vt.basename(this.path):void 0}set basename(t){ns(t,"basename"),ts(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){Ac(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(ts(t,"extname"),Ac(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){eo(t)&&(t=Uw(t)),ns(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){ns(t,"stem"),ts(t,"stem"),this.path=Vt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new Et(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function ts(e,t){if(e&&e.includes(Vt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Vt.sep+"`")}function ns(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ac(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Hw(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Kw=function(e){const r=this.constructor.prototype,i=r[e],a=function(){return i.apply(a,arguments)};Object.setPrototypeOf(a,r);const s=Object.getOwnPropertyNames(i);for(const o of s){const l=Object.getOwnPropertyDescriptor(i,o);l&&Object.defineProperty(a,o,l)}return a},Zw={}.hasOwnProperty;class Yo extends Kw{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=Pw()}copy(){const t=new Yo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Xa(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(as("data",this.frozen),this.namespace[t]=n,this):Zw.call(this.namespace,t)&&this.namespace[t]||void 0:t?(as("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Di(t),r=this.parser||this.Parser;return rs("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),rs("process",this.parser||this.Parser),is("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(a,s){const o=Di(t),l=r.parse(o);r.run(l,o,function(d,m,h){if(d||!m||!h)return u(d);const p=m,v=r.stringify(p,h);Qw(v)?h.value=v:h.result=v,u(d,h)});function u(d,m){d||!m?s(d):a?a(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),rs("processSync",this.parser||this.Parser),is("processSync",this.compiler||this.Compiler),this.process(t,i),Tc("processSync","process",n),r;function i(a,s){n=!0,yc(a),r=s}}run(t,n,r){Bc(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(s,o){const l=Di(n);i.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,i;return this.run(t,n,a),Tc("runSync","run",r),i;function a(s,o){yc(s),i=o,r=!0}}stringify(t,n){this.freeze();const r=Di(n),i=this.compiler||this.Compiler;return is("stringify",i),Bc(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(as("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 a(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&&(i.settings=Xa(!0,i.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const m=u[d];a(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,...v]=d;const f=r[h][1];Js(f)&&Js(p)&&(p=Xa(!0,f,p)),r[h]=[u,p,...v]}}}}const Yw=new Yo().freeze();function rs(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function is(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function as(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 Bc(e){if(!Js(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Tc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Di(e){return Gw(e)?e:new Vw(e)}function Gw(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Qw(e){return typeof e=="string"||Jw(e)}function Jw(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Xw={};function eC(e,t){const n=t||Xw,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Dm(e,r,i)}function Dm(e,t,n){if(tC(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 Sc(e.children,t,n)}return Array.isArray(e)?Sc(e,t,n):""}function Sc(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=Dm(e[i],t,n);return r.join("")}function tC(e){return!!(e&&typeof e=="object")}const jc=document.createElement("i");function Go(e){const t="&"+e+";";jc.innerHTML=t;const n=jc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function sn(e,t,n,r){const i=e.length;let a=0,s;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);a<r.length;)s=r.slice(a,a+1e4),s.unshift(t,0),e.splice(...s),a+=1e4,t+=1e4}function Pt(e,t){return e.length>0?(sn(e,e.length,0,t),e):t}const Pc={}.hasOwnProperty;function nC(e){const t={};let n=-1;for(;++n<e.length;)rC(t,e[n]);return t}function rC(e,t){let n;for(n in t){const i=(Pc.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let s;if(a)for(s in a){Pc.call(i,s)||(i[s]=[]);const o=a[s];iC(i[s],Array.isArray(o)?o:o?[o]:[])}}}function iC(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);sn(e,0,0,r)}function Em(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=Cn(/[A-Za-z]/),zt=Cn(/[\dA-Za-z]/),aC=Cn(/[#-'*+\--9=?A-Z^-~]/);function to(e){return e!==null&&(e<32||e===127)}const no=Cn(/\d/),sC=Cn(/[\dA-Fa-f]/),oC=Cn(/[!-/:-@[-`{-~]/);function we(e){return e!==null&&e<-2}function Ct(e){return e!==null&&(e<0||e===32)}function Le(e){return e===-2||e===-1||e===32}const uC=Cn(/\p{P}|\p{S}/u),lC=Cn(/\s/);function Cn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ke(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let a=0;return s;function s(l){return Le(l)?(e.enter(n),o(l)):t(l)}function o(l){return Le(l)&&a++<i?(e.consume(l),o):(e.exit(n),t(l))}}const cC={tokenize:dC};function dC(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ke(e,t,"linePrefix")}function i(o){return e.enter("paragraph"),a(o)}function a(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 we(o)?(e.consume(o),e.exit("chunkText"),a):(e.consume(o),s)}}const fC={tokenize:mC},Oc={tokenize:hC};function mC(e){const t=this,n=[];let r=0,i,a,s;return o;function o(C){if(r<n.length){const F=n[r];return t.containerState=F[1],e.attempt(F[0].continuation,l,u)(C)}return u(C)}function l(C){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&x();const F=t.events.length;let D=F,_;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){_=t.events[D][1].end;break}g(r);let T=F;for(;T<t.events.length;)t.events[T][1].end=Object.assign({},_),T++;return sn(t.events,D+1,0,t.events.slice(F)),t.events.length=T,u(C)}return o(C)}function u(C){if(r===n.length){if(!i)return h(C);if(i.currentConstruct&&i.currentConstruct.concrete)return v(C);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Oc,d,m)(C)}function d(C){return i&&x(),g(r),h(C)}function m(C){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,v(C)}function h(C){return t.containerState={},e.attempt(Oc,p,v)(C)}function p(C){return r++,n.push([t.currentConstruct,t.containerState]),h(C)}function v(C){if(C===null){i&&x(),g(0),e.consume(C);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:a,_tokenizer:i}),f(C)}function f(C){if(C===null){b(e.exit("chunkFlow"),!0),g(0),e.consume(C);return}return we(C)?(e.consume(C),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(C),f)}function b(C,F){const D=t.sliceStream(C);if(F&&D.push(null),C.previous=a,a&&(a.next=C),a=C,i.defineSkip(C.start),i.write(D),t.parser.lazy[C.start.line]){let _=i.events.length;for(;_--;)if(i.events[_][1].start.offset<s&&(!i.events[_][1].end||i.events[_][1].end.offset>s))return;const T=t.events.length;let R=T,O,z;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(O){z=t.events[R][1].end;break}O=!0}for(g(r),_=T;_<t.events.length;)t.events[_][1].end=Object.assign({},z),_++;sn(t.events,R+1,0,t.events.slice(T)),t.events.length=_}}function g(C){let F=n.length;for(;F-- >C;){const D=n[F];t.containerState=D[1],D[0].exit.call(t,e)}n.length=C}function x(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function hC(e,t,n){return Ke(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Mc(e){if(e===null||Ct(e)||lC(e))return 1;if(uC(e))return 2}function Qo(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const ro={name:"attention",tokenize:gC,resolveAll:pC};function pC(e,t){let n=-1,r,i,a,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);Nc(m,-l),Nc(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},a={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},i={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=Pt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Pt(u,[["enter",i,t],["enter",s,t],["exit",s,t],["enter",a,t]]),u=Pt(u,Qo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Pt(u,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Pt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,sn(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 gC(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Mc(r);let a;return s;function s(l){return a=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===a)return e.consume(l),o;const u=e.exit("attentionSequence"),d=Mc(l),m=!d||d===2&&i||n.includes(l),h=!i||i===2&&d||n.includes(r);return u._open=!!(a===42?m:m&&(i||!h)),u._close=!!(a===42?h:h&&(d||!m)),t(l)}}function Nc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const vC={name:"autolink",tokenize:bC};function bC(e,t,n){let r=0;return i;function i(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(p){return Ht(p)?(e.consume(p),s):p===64?n(p):u(p)}function s(p){return p===43||p===45||p===46||zt(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||zt(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||to(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),d):aC(p)?(e.consume(p),u):n(p)}function d(p){return zt(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||zt(p))&&r++<63){const v=p===45?h:m;return e.consume(p),v}return n(p)}}const wa={tokenize:yC,partial:!0};function yC(e,t,n){return r;function r(a){return Le(a)?Ke(e,i,"linePrefix")(a):i(a)}function i(a){return a===null||we(a)?t(a):n(a)}}const _m={name:"blockQuote",tokenize:xC,continuation:{tokenize:wC},exit:CC};function xC(e,t,n){const r=this;return i;function i(s){if(s===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),a}return n(s)}function a(s){return Le(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function wC(e,t,n){const r=this;return i;function i(s){return Le(s)?Ke(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):a(s)}function a(s){return e.attempt(_m,t,n)(s)}}function CC(e){e.exit("blockQuote")}const km={name:"characterEscape",tokenize:DC};function DC(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),i}function i(a){return oC(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const Fm={name:"characterReference",tokenize:EC};function EC(e,t,n){const r=this;let i=0,a,s;return o;function o(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),l}function l(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),a=31,s=zt,d(m))}function u(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,s=sC,d):(e.enter("characterReferenceValue"),a=7,s=no,d(m))}function d(m){if(m===59&&i){const h=e.exit("characterReferenceValue");return s===zt&&!Go(r.sliceSerialize(h))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(m)&&i++<a?(e.consume(m),d):n(m)}}const Ic={tokenize:kC,partial:!0},Rc={name:"codeFenced",tokenize:_C,concrete:!0};function _C(e,t,n){const r=this,i={tokenize:D,partial:!0};let a=0,s=0,o;return l;function l(_){return u(_)}function u(_){const T=r.events[r.events.length-1];return a=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,o=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(_)}function d(_){return _===o?(s++,e.consume(_),d):s<3?n(_):(e.exit("codeFencedFenceSequence"),Le(_)?Ke(e,m,"whitespace")(_):m(_))}function m(_){return _===null||we(_)?(e.exit("codeFencedFence"),r.interrupt?t(_):e.check(Ic,f,F)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(_))}function h(_){return _===null||we(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(_)):Le(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ke(e,p,"whitespace")(_)):_===96&&_===o?n(_):(e.consume(_),h)}function p(_){return _===null||we(_)?m(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(_))}function v(_){return _===null||we(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(_)):_===96&&_===o?n(_):(e.consume(_),v)}function f(_){return e.attempt(i,F,b)(_)}function b(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),g}function g(_){return a>0&&Le(_)?Ke(e,x,"linePrefix",a+1)(_):x(_)}function x(_){return _===null||we(_)?e.check(Ic,f,F)(_):(e.enter("codeFlowValue"),C(_))}function C(_){return _===null||we(_)?(e.exit("codeFlowValue"),x(_)):(e.consume(_),C)}function F(_){return e.exit("codeFenced"),t(_)}function D(_,T,R){let O=0;return z;function z(M){return _.enter("lineEnding"),_.consume(M),_.exit("lineEnding"),$}function $(M){return _.enter("codeFencedFence"),Le(M)?Ke(_,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):A(M)}function A(M){return M===o?(_.enter("codeFencedFenceSequence"),B(M)):R(M)}function B(M){return M===o?(O++,_.consume(M),B):O>=s?(_.exit("codeFencedFenceSequence"),Le(M)?Ke(_,j,"whitespace")(M):j(M)):R(M)}function j(M){return M===null||we(M)?(_.exit("codeFencedFence"),T(M)):R(M)}}}function kC(e,t,n){const r=this;return i;function i(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a)}function a(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const ss={name:"codeIndented",tokenize:AC},FC={tokenize:BC,partial:!0};function AC(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),Ke(e,a,"linePrefix",4+1)(u)}function a(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):we(u)?e.attempt(FC,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||we(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function BC(e,t,n){const r=this;return i;function i(s){return r.parser.lazy[r.now().line]?n(s):we(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):Ke(e,a,"linePrefix",4+1)(s)}function a(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):we(s)?i(s):n(s)}}const TC={name:"codeText",tokenize:PC,resolve:SC,previous:jC};function SC(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function jC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function PC(e,t,n){let r=0,i,a;return s;function s(m){return e.enter("codeText"),e.enter("codeTextSequence"),o(m)}function o(m){return m===96?(e.consume(m),r++,o):(e.exit("codeTextSequence"),l(m))}function l(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),l):m===96?(a=e.enter("codeTextSequence"),i=0,d(m)):we(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||we(m)?(e.exit("codeTextData"),l(m)):(e.consume(m),u)}function d(m){return m===96?(e.consume(m),i++,d):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(a.type="codeTextData",u(m))}}class OC{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Br(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Br(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Br(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);Br(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Br(this.left,n.reverse())}}}function Br(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 Am(e){const t={};let n=-1,r,i,a,s,o,l,u;const d=new OC(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,a=0,a<l.length&&l[a][1].type==="lineEndingBlank"&&(a+=2),a<l.length&&l[a][1].type==="content"))for(;++a<l.length&&l[a][1].type!=="content";)l[a][1].type==="chunkText"&&(l[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,MC(d,n)),n=t[n],u=!0);else if(r[1]._container){for(a=n,i=void 0;a--&&(s=d.get(a),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),s[1].type="lineEnding",i=a);i&&(r[1].end=Object.assign({},d.get(i)[1].start),o=d.slice(i,n),o.unshift(r),d.splice(i,n-i+1,o))}}return sn(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function MC(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const a=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let d,m,h=-1,p=n,v=0,f=0;const b=[f];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),m&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),m=p,p=p.next}for(p=n;++h<o.length;)o[h][0]==="exit"&&o[h-1][0]==="enter"&&o[h][1].type===o[h-1][1].type&&o[h][1].start.line!==o[h][1].end.line&&(f=h+1,b.push(f),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):b.pop(),h=b.length;h--;){const g=o.slice(b[h],b[h+1]),x=a.pop();l.push([x,x+g.length-1]),e.splice(x,2,g)}for(l.reverse(),h=-1;++h<l.length;)u[v+l[h][0]]=v+l[h][1],v+=l[h][1]-l[h][0]-1;return u}const NC={tokenize:$C,resolve:RC},IC={tokenize:LC,partial:!0};function RC(e){return Am(e),e}function $C(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?a(o):we(o)?e.check(IC,s,a)(o):(e.consume(o),i)}function a(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function s(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function LC(e,t,n){const r=this;return i;function i(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ke(e,a,"linePrefix")}function a(s){if(s===null||we(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 Bm(e,t,n,r,i,a,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return m;function m(g){return g===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(g),e.exit(a),h):g===null||g===32||g===41||to(g)?n(g):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(g))}function h(g){return g===62?(e.enter(a),e.consume(g),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(o),h(g)):g===null||g===60||we(g)?n(g):(e.consume(g),g===92?v:p)}function v(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function f(g){return!d&&(g===null||g===41||Ct(g))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(g)):d<u&&g===40?(e.consume(g),d++,f):g===41?(e.consume(g),d--,f):g===null||g===32||g===40||to(g)?n(g):(e.consume(g),g===92?b:f)}function b(g){return g===40||g===41||g===92?(e.consume(g),f):f(g)}}function Tm(e,t,n,r,i,a){const s=this;let o=0,l;return u;function u(p){return e.enter(r),e.enter(i),e.consume(p),e.exit(i),e.enter(a),d}function d(p){return o>999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(a),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):we(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||we(p)||o++>999?(e.exit("chunkString"),d(p)):(e.consume(p),l||(l=!Le(p)),p===92?h:m)}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,m):m(p)}}function Sm(e,t,n,r,i,a){let s;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),s=h===40?41:h,l):n(h)}function l(h){return h===s?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(a),u(h))}function u(h){return h===s?(e.exit(a),l(s)):h===null?n(h):we(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Ke(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===s||h===null||we(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 Lr(e,t){let n;return r;function r(i){return we(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Le(i)?Ke(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const zC={name:"definition",tokenize:UC},qC={tokenize:WC,partial:!0};function UC(e,t,n){const r=this;let i;return a;function a(p){return e.enter("definition"),s(p)}function s(p){return Tm.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return i=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 Ct(p)?Lr(e,u)(p):u(p)}function u(p){return Bm(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(qC,m,m)(p)}function m(p){return Le(p)?Ke(e,h,"whitespace")(p):h(p)}function h(p){return p===null||we(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function WC(e,t,n){return r;function r(o){return Ct(o)?Lr(e,i)(o):n(o)}function i(o){return Sm(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function a(o){return Le(o)?Ke(e,s,"whitespace")(o):s(o)}function s(o){return o===null||we(o)?t(o):n(o)}}const VC={name:"hardBreakEscape",tokenize:HC};function HC(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return we(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const KC={name:"headingAtx",tokenize:YC,resolve:ZC};function ZC(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},sn(e,r,n-r+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function YC(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),a(d)}function a(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||Ct(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||we(d)?(e.exit("atxHeading"),t(d)):Le(d)?Ke(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||Ct(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const GC=["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"],$c=["pre","script","style","textarea"],QC={name:"htmlFlow",tokenize:tD,resolveTo:eD,concrete:!0},JC={tokenize:rD,partial:!0},XC={tokenize:nD,partial:!0};function eD(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 tD(e,t,n){const r=this;let i,a,s,o,l;return u;function u(k){return d(k)}function d(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),m}function m(k){return k===33?(e.consume(k),h):k===47?(e.consume(k),a=!0,f):k===63?(e.consume(k),i=3,r.interrupt?t:E):Ht(k)?(e.consume(k),s=String.fromCharCode(k),b):n(k)}function h(k){return k===45?(e.consume(k),i=2,p):k===91?(e.consume(k),i=5,o=0,v):Ht(k)?(e.consume(k),i=4,r.interrupt?t:E):n(k)}function p(k){return k===45?(e.consume(k),r.interrupt?t:E):n(k)}function v(k){const P="CDATA[";return k===P.charCodeAt(o++)?(e.consume(k),o===P.length?r.interrupt?t:A:v):n(k)}function f(k){return Ht(k)?(e.consume(k),s=String.fromCharCode(k),b):n(k)}function b(k){if(k===null||k===47||k===62||Ct(k)){const P=k===47,q=s.toLowerCase();return!P&&!a&&$c.includes(q)?(i=1,r.interrupt?t(k):A(k)):GC.includes(s.toLowerCase())?(i=6,P?(e.consume(k),g):r.interrupt?t(k):A(k)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(k):a?x(k):C(k))}return k===45||zt(k)?(e.consume(k),s+=String.fromCharCode(k),b):n(k)}function g(k){return k===62?(e.consume(k),r.interrupt?t:A):n(k)}function x(k){return Le(k)?(e.consume(k),x):z(k)}function C(k){return k===47?(e.consume(k),z):k===58||k===95||Ht(k)?(e.consume(k),F):Le(k)?(e.consume(k),C):z(k)}function F(k){return k===45||k===46||k===58||k===95||zt(k)?(e.consume(k),F):D(k)}function D(k){return k===61?(e.consume(k),_):Le(k)?(e.consume(k),D):C(k)}function _(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),l=k,T):Le(k)?(e.consume(k),_):R(k)}function T(k){return k===l?(e.consume(k),l=null,O):k===null||we(k)?n(k):(e.consume(k),T)}function R(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||Ct(k)?D(k):(e.consume(k),R)}function O(k){return k===47||k===62||Le(k)?C(k):n(k)}function z(k){return k===62?(e.consume(k),$):n(k)}function $(k){return k===null||we(k)?A(k):Le(k)?(e.consume(k),$):n(k)}function A(k){return k===45&&i===2?(e.consume(k),U):k===60&&i===1?(e.consume(k),W):k===62&&i===4?(e.consume(k),ee):k===63&&i===3?(e.consume(k),E):k===93&&i===5?(e.consume(k),se):we(k)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(JC,Z,B)(k)):k===null||we(k)?(e.exit("htmlFlowData"),B(k)):(e.consume(k),A)}function B(k){return e.check(XC,j,Z)(k)}function j(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),M}function M(k){return k===null||we(k)?B(k):(e.enter("htmlFlowData"),A(k))}function U(k){return k===45?(e.consume(k),E):A(k)}function W(k){return k===47?(e.consume(k),s="",ie):A(k)}function ie(k){if(k===62){const P=s.toLowerCase();return $c.includes(P)?(e.consume(k),ee):A(k)}return Ht(k)&&s.length<8?(e.consume(k),s+=String.fromCharCode(k),ie):A(k)}function se(k){return k===93?(e.consume(k),E):A(k)}function E(k){return k===62?(e.consume(k),ee):k===45&&i===2?(e.consume(k),E):A(k)}function ee(k){return k===null||we(k)?(e.exit("htmlFlowData"),Z(k)):(e.consume(k),ee)}function Z(k){return e.exit("htmlFlow"),t(k)}}function nD(e,t,n){const r=this;return i;function i(s){return we(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):n(s)}function a(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function rD(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(wa,t,n)}}const iD={name:"htmlText",tokenize:aD};function aD(e,t,n){const r=this;let i,a,s;return o;function o(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),l}function l(E){return E===33?(e.consume(E),u):E===47?(e.consume(E),D):E===63?(e.consume(E),C):Ht(E)?(e.consume(E),R):n(E)}function u(E){return E===45?(e.consume(E),d):E===91?(e.consume(E),a=0,v):Ht(E)?(e.consume(E),x):n(E)}function d(E){return E===45?(e.consume(E),p):n(E)}function m(E){return E===null?n(E):E===45?(e.consume(E),h):we(E)?(s=m,W(E)):(e.consume(E),m)}function h(E){return E===45?(e.consume(E),p):m(E)}function p(E){return E===62?U(E):E===45?h(E):m(E)}function v(E){const ee="CDATA[";return E===ee.charCodeAt(a++)?(e.consume(E),a===ee.length?f:v):n(E)}function f(E){return E===null?n(E):E===93?(e.consume(E),b):we(E)?(s=f,W(E)):(e.consume(E),f)}function b(E){return E===93?(e.consume(E),g):f(E)}function g(E){return E===62?U(E):E===93?(e.consume(E),g):f(E)}function x(E){return E===null||E===62?U(E):we(E)?(s=x,W(E)):(e.consume(E),x)}function C(E){return E===null?n(E):E===63?(e.consume(E),F):we(E)?(s=C,W(E)):(e.consume(E),C)}function F(E){return E===62?U(E):C(E)}function D(E){return Ht(E)?(e.consume(E),_):n(E)}function _(E){return E===45||zt(E)?(e.consume(E),_):T(E)}function T(E){return we(E)?(s=T,W(E)):Le(E)?(e.consume(E),T):U(E)}function R(E){return E===45||zt(E)?(e.consume(E),R):E===47||E===62||Ct(E)?O(E):n(E)}function O(E){return E===47?(e.consume(E),U):E===58||E===95||Ht(E)?(e.consume(E),z):we(E)?(s=O,W(E)):Le(E)?(e.consume(E),O):U(E)}function z(E){return E===45||E===46||E===58||E===95||zt(E)?(e.consume(E),z):$(E)}function $(E){return E===61?(e.consume(E),A):we(E)?(s=$,W(E)):Le(E)?(e.consume(E),$):O(E)}function A(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),i=E,B):we(E)?(s=A,W(E)):Le(E)?(e.consume(E),A):(e.consume(E),j)}function B(E){return E===i?(e.consume(E),i=void 0,M):E===null?n(E):we(E)?(s=B,W(E)):(e.consume(E),B)}function j(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||Ct(E)?O(E):(e.consume(E),j)}function M(E){return E===47||E===62||Ct(E)?O(E):n(E)}function U(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function W(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),ie}function ie(E){return Le(E)?Ke(e,se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):se(E)}function se(E){return e.enter("htmlTextData"),s(E)}}const Jo={name:"labelEnd",tokenize:dD,resolveTo:cD,resolveAll:lD},sD={tokenize:fD},oD={tokenize:mD},uD={tokenize:hD};function lD(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 cD(e,t){let n=e.length,r=0,i,a,s,o;for(;n--;)if(i=e[n][1],a){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(a=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(s=n);const l={type:e[a][1].type==="labelLink"?"link":"image",start:Object.assign({},e[a][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[a][1].start),end:Object.assign({},e[s][1].end)},d={type:"labelText",start:Object.assign({},e[a+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=Pt(o,e.slice(a+1,a+r+3)),o=Pt(o,[["enter",d,t]]),o=Pt(o,Qo(t.parser.constructs.insideSpan.null,e.slice(a+r+4,s-3),t)),o=Pt(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=Pt(o,e.slice(s+1)),o=Pt(o,[["exit",l,t]]),sn(e,a,e.length,o),e}function dD(e,t,n){const r=this;let i=r.events.length,a,s;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){a=r.events[i][1];break}return o;function o(h){return a?a._inactive?m(h):(s=r.parser.defined.includes(ir(r.sliceSerialize({start:a.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(sD,d,s?d:m)(h):h===91?e.attempt(oD,d,s?u:m)(h):s?d(h):m(h)}function u(h){return e.attempt(uD,d,m)(h)}function d(h){return t(h)}function m(h){return a._balanced=!0,n(h)}}function fD(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),i}function i(m){return Ct(m)?Lr(e,a)(m):a(m)}function a(m){return m===41?d(m):Bm(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function s(m){return Ct(m)?Lr(e,l)(m):d(m)}function o(m){return n(m)}function l(m){return m===34||m===39||m===40?Sm(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):d(m)}function u(m){return Ct(m)?Lr(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 mD(e,t,n){const r=this;return i;function i(o){return Tm.call(r,e,a,s,"reference","referenceMarker","referenceString")(o)}function a(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 hD(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),i}function i(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const pD={name:"labelStartImage",tokenize:gD,resolveAll:Jo.resolveAll};function gD(e,t,n){const r=this;return i;function i(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),a}function a(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),s):n(o)}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const vD={name:"labelStartLink",tokenize:bD,resolveAll:Jo.resolveAll};function bD(e,t,n){const r=this;return i;function i(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),a}function a(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const os={name:"lineEnding",tokenize:yD};function yD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ke(e,t,"linePrefix")}}const Ri={name:"thematicBreak",tokenize:xD};function xD(e,t,n){let r=0,i;return a;function a(u){return e.enter("thematicBreak"),s(u)}function s(u){return i=u,o(u)}function o(u){return u===i?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||we(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Le(u)?Ke(e,o,"whitespace")(u):o(u))}}const bt={name:"list",tokenize:DD,continuation:{tokenize:ED},exit:kD},wD={tokenize:FD,partial:!0},CD={tokenize:_D,partial:!0};function DD(e,t,n){const r=this,i=r.events[r.events.length-1];let a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return o;function o(p){const v=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:no(p)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Ri,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 no(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(wa,r.interrupt?n:d,e.attempt(wD,h,m))}function d(p){return r.containerState.initialBlankLine=!0,a++,h(p)}function m(p){return Le(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function ED(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(wa,i,a);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ke(e,t,"listItemIndent",r.containerState.size+1)(o)}function a(o){return r.containerState.furtherBlankLines||!Le(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(CD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ke(e,e.attempt(bt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function _D(e,t,n){const r=this;return Ke(e,i,"listItemIndent",r.containerState.size+1);function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(a):n(a)}}function kD(e){e.exit(this.containerState.type)}function FD(e,t,n){const r=this;return Ke(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function i(a){const s=r.events[r.events.length-1];return!Le(a)&&s&&s[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const Lc={name:"setextUnderline",tokenize:BD,resolveTo:AD};function AD(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const s={type:"setextHeading",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",s,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[a][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}function BD(e,t,n){const r=this;let i;return a;function a(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"),i=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===i?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Le(u)?Ke(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||we(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const TD={tokenize:SD};function SD(e){const t=this,n=e.attempt(wa,r,e.attempt(this.parser.constructs.flowInitial,i,Ke(e,e.attempt(this.parser.constructs.flow,i,e.attempt(NC,i)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const jD={resolveAll:Pm()},PD=jm("string"),OD=jm("text");function jm(e){return{tokenize:t,resolveAll:Pm(e==="text"?MD:void 0)};function t(n){const r=this,i=this.parser.constructs[e],a=n.attempt(i,s,o);return s;function s(d){return u(d)?a(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"),a(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const m=i[d];let h=-1;if(m)for(;++h<m.length;){const p=m[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function Pm(e){return t;function t(n,r){let i=-1,a;for(;++i<=n.length;)a===void 0?n[i]&&n[i][1].type==="data"&&(a=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==a+2&&(n[a][1].end=n[i-1][1].end,n.splice(a+2,i-a-2),i=a+2),a=void 0);return e?e(n,r):n}}function MD(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let a=i.length,s=-1,o=0,l;for(;a--;){const u=i[a];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){a++;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+a,_bufferIndex:a?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 ND(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const i={},a=[];let s=[],o=[];const l={consume:x,enter:C,exit:F,attempt:T(D),check:T(_),interrupt:T(_,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:h,now:v,defineSkip:f,write:m};let d=t.tokenize.call(u,l);return t.resolveAll&&a.push(t),u;function m($){return s=Pt(s,$),b(),s[s.length-1]!==null?[]:(R(t,0),u.events=Qo(a,u.events,u),u.events)}function h($,A){return RD(p($),A)}function p($){return ID(s,$)}function v(){const{line:$,column:A,offset:B,_index:j,_bufferIndex:M}=r;return{line:$,column:A,offset:B,_index:j,_bufferIndex:M}}function f($){i[$.line]=$.column,z()}function b(){let $;for(;r._index<s.length;){const A=s[r._index];if(typeof A=="string")for($=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===$&&r._bufferIndex<A.length;)g(A.charCodeAt(r._bufferIndex));else g(A)}}function g($){d=d($)}function x($){we($)?(r.line++,r.column=1,r.offset+=$===-3?2:1,z()):$!==-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=$}function C($,A){const B=A||{};return B.type=$,B.start=v(),u.events.push(["enter",B,u]),o.push(B),B}function F($){const A=o.pop();return A.end=v(),u.events.push(["exit",A,u]),A}function D($,A){R($,A.from)}function _($,A){A.restore()}function T($,A){return B;function B(j,M,U){let W,ie,se,E;return Array.isArray(j)?Z(j):"tokenize"in j?Z([j]):ee(j);function ee(S){return L;function L(Q){const Y=Q!==null&&S[Q],te=Q!==null&&S.null,ce=[...Array.isArray(Y)?Y:Y?[Y]:[],...Array.isArray(te)?te:te?[te]:[]];return Z(ce)(Q)}}function Z(S){return W=S,ie=0,S.length===0?U:k(S[ie])}function k(S){return L;function L(Q){return E=O(),se=S,S.partial||(u.currentConstruct=S),S.name&&u.parser.constructs.disable.null.includes(S.name)?q():S.tokenize.call(A?Object.assign(Object.create(u),A):u,l,P,q)(Q)}}function P(S){return $(se,E),M}function q(S){return E.restore(),++ie<W.length?k(W[ie]):U}}}function R($,A){$.resolveAll&&!a.includes($)&&a.push($),$.resolve&&sn(u.events,A,u.events.length-A,$.resolve(u.events.slice(A),u)),$.resolveTo&&(u.events=$.resolveTo(u.events,u))}function O(){const $=v(),A=u.previous,B=u.currentConstruct,j=u.events.length,M=Array.from(o);return{restore:U,from:j};function U(){r=$,u.previous=A,u.currentConstruct=B,u.events.length=j,o=M,z()}}function z(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function ID(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex;let s;if(n===i)s=[e[n].slice(r,a)];else{if(s=e.slice(n,i),r>-1){const o=s[0];typeof o=="string"?s[0]=o.slice(r):s.shift()}a>0&&s.push(e[i].slice(0,a))}return s}function RD(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const a=e[n];let s;if(typeof a=="string")s=a;else switch(a){case-5:{s="\r";break}case-4:{s=`
82
82
  `;break}case-3:{s=`\r
83
- `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&i)continue;s=" ";break}default:s=String.fromCharCode(a)}i=a===-2,r.push(s)}return r.join("")}const MD={42:vt,43:vt,45:vt,48:vt,49:vt,50:vt,51:vt,52:vt,53:vt,54:vt,55:vt,56:vt,57:vt,62:vh},ND={91:Iw},ID={[-2]:ss,[-1]:ss,32:ss},RD={35:Uw,42:Ni,45:[Pc,Ni],60:Kw,61:Pc,95:Ni,96:jc,126:jc},$D={38:yh,92:bh},LD={[-5]:os,[-4]:os,[-3]:os,33:dD,38:yh,42:ro,60:[hw,eD],91:hD,92:[zw,bh],93:Yo,95:ro,96:kw},zD={null:[ro,AD]},qD={null:[42,95]},UD={null:[]},WD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:qD,contentInitial:ND,disable:UD,document:MD,flow:RD,flowInitial:ID,insideSpan:zD,string:$D,text:LD},Symbol.toStringTag,{value:"Module"}));function VD(e){const n=JC([WD,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:i(sw),document:i(uw),flow:i(kD),string:i(BD),text:i(TD)};return r;function i(a){return s;function s(o){return jD(r,a,o)}}}function HD(e){for(;!xh(e););return e}const Mc=/[\0\t\n\r]/g;function KD(){let e=1,t="",n=!0,r;return i;function i(a,s,o){const l=[];let u,d,h,p,m;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(s||void 0).decode(a)),h=0,t="",n&&(a.charCodeAt(0)===65279&&h++,n=void 0);h<a.length;){if(Mc.lastIndex=h,u=Mc.exec(a),p=u&&u.index!==void 0?u.index:a.length,m=a.charCodeAt(p),!u){t=a.slice(h);break}if(m===10&&h===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<p&&(l.push(a.slice(h,p)),e+=p-h),m){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}h=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const ZD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function YD(e){return e.replace(ZD,GD)}function GD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),a=i===120||i===88;return gh(n.slice(a?2:1),a?16:10)}return Ko(n)||e}const kh={}.hasOwnProperty;function QD(e,t,n){return typeof t!="string"&&(n=t,t=void 0),JD(n)(HD(VD(n).document().write(KD()(e,t,!0))))}function JD(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(We),autolinkProtocol:P,autolinkEmail:P,atxHeading:a(ve),blockQuote:a(K),characterEscape:P,characterReference:P,codeFenced:a(J),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:a(J,s),codeText:a(ce,s),codeTextData:P,data:P,codeFlowValue:P,definition:a(ee),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:a(pe),hardBreakEscape:a(Ee),hardBreakTrailing:a(Ee),htmlFlow:a(Ce,s),htmlFlowData:P,htmlText:a(Ce,s),htmlTextData:P,image:a(Fe),label:s,link:a(We),listItem:a(ze),listItemValue:p,listOrdered:a(Me,h),listUnordered:a(Me),paragraph:a(Xe),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:a(ve),strong:a(Ae),thematicBreak:a(qe)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:Q,autolinkProtocol:L,blockQuote:l(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:q,characterReferenceMarkerNumeric:q,characterReferenceValue:S,codeFenced:l(b),codeFencedFence:f,codeFencedFenceInfo:m,codeFencedFenceMeta:v,codeFlowValue:z,codeIndented:l(g),codeText:l(M),codeTextData:z,data:z,definition:l(),definitionDestinationString:F,definitionLabelString:D,definitionTitleString:w,emphasis:l(),hardBreakEscape:l(B),hardBreakTrailing:l(B),htmlFlow:l(A),htmlFlowData:z,htmlText:l(j),htmlTextData:z,image:l(W),label:ae,labelText:ie,lineEnding:$,link:l(U),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:O,resourceDestinationString:C,resourceTitleString:G,resource:ne,setextHeading:l(R),setextHeadingLineSequence:T,setextHeadingText:k,strong:l(),thematicBreak:l()}};Fh(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Z){let oe={type:"root",children:[]};const se={stack:[oe],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},me=[];let be=-1;for(;++be<Z.length;)if(Z[be][1].type==="listOrdered"||Z[be][1].type==="listUnordered")if(Z[be][0]==="enter")me.push(be);else{const he=me.pop();be=i(Z,he,be)}for(be=-1;++be<Z.length;){const he=t[Z[be][0]];kh.call(he,Z[be][1].type)&&he[Z[be][1].type].call(Object.assign({sliceSerialize:Z[be][2].sliceSerialize},se),Z[be][1])}if(se.tokenStack.length>0){const he=se.tokenStack[se.tokenStack.length-1];(he[1]||Nc).call(se,void 0,he[0])}for(oe.position={start:fn(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:fn(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},be=-1;++be<t.transforms.length;)oe=t.transforms[be](oe)||oe;return oe}function i(Z,oe,se){let me=oe-1,be=-1,he=!1,xe,Qe,rt,gt;for(;++me<=se;){const et=Z[me];switch(et[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{et[0]==="enter"?be++:be--,gt=void 0;break}case"lineEndingBlank":{et[0]==="enter"&&(xe&&!gt&&!be&&!rt&&(rt=me),gt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:gt=void 0}if(!be&&et[0]==="enter"&&et[1].type==="listItemPrefix"||be===-1&&et[0]==="exit"&&(et[1].type==="listUnordered"||et[1].type==="listOrdered")){if(xe){let Dt=me;for(Qe=void 0;Dt--;){const Et=Z[Dt];if(Et[1].type==="lineEnding"||Et[1].type==="lineEndingBlank"){if(Et[0]==="exit")continue;Qe&&(Z[Qe][1].type="lineEndingBlank",he=!0),Et[1].type="lineEnding",Qe=Dt}else if(!(Et[1].type==="linePrefix"||Et[1].type==="blockQuotePrefix"||Et[1].type==="blockQuotePrefixWhitespace"||Et[1].type==="blockQuoteMarker"||Et[1].type==="listItemIndent"))break}rt&&(!Qe||rt<Qe)&&(xe._spread=!0),xe.end=Object.assign({},Qe?Z[Qe][1].start:et[1].end),Z.splice(Qe||me,0,["exit",xe,et[2]]),me++,se++}if(et[1].type==="listItemPrefix"){const Dt={type:"listItem",_spread:!1,start:Object.assign({},et[1].start),end:void 0};xe=Dt,Z.splice(me,0,["enter",Dt,et[2]]),me++,se++,rt=void 0,gt=!0}}}return Z[oe][1]._spread=he,se}function a(Z,oe){return se;function se(me){o.call(this,Z(me),me),oe&&oe.call(this,me)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(Z,oe,se){this.stack[this.stack.length-1].children.push(Z),this.stack.push(Z),this.tokenStack.push([oe,se]),Z.position={start:fn(oe.start),end:void 0}}function l(Z){return oe;function oe(se){Z&&Z.call(this,se),u.call(this,se)}}function u(Z,oe){const se=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==Z.type&&(oe?oe.call(this,Z,me[0]):(me[1]||Nc).call(this,Z,me[0]));else throw new Error("Cannot close `"+Z.type+"` ("+Nr({start:Z.start,end:Z.end})+"): it’s not open");se.position.end=fn(Z.end)}function d(){return GC(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(Z){if(this.data.expectingFirstListItemValue){const oe=this.stack[this.stack.length-2];oe.start=Number.parseInt(this.sliceSerialize(Z),10),this.data.expectingFirstListItemValue=void 0}}function m(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.lang=Z}function v(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.meta=Z}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z.replace(/(\r?\n|\r)$/g,"")}function D(Z){const oe=this.resume(),se=this.stack[this.stack.length-1];se.label=oe,se.identifier=rr(this.sliceSerialize(Z)).toLowerCase()}function w(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Z}function F(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Z}function E(Z){const oe=this.stack[this.stack.length-1];if(!oe.depth){const se=this.sliceSerialize(Z).length;oe.depth=se}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function T(Z){const oe=this.stack[this.stack.length-1];oe.depth=this.sliceSerialize(Z).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function P(Z){const se=this.stack[this.stack.length-1].children;let me=se[se.length-1];(!me||me.type!=="text")&&(me=je(),me.position={start:fn(Z.start),end:void 0},se.push(me)),this.stack.push(me)}function z(Z){const oe=this.stack.pop();oe.value+=this.sliceSerialize(Z),oe.position.end=fn(Z.end)}function $(Z){const oe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const se=oe.children[oe.children.length-1];se.position.end=fn(Z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(oe.type)&&(P.call(this,Z),z.call(this,Z))}function B(){this.data.atHardBreak=!0}function A(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function j(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function M(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.value=Z}function U(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=oe,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function W(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=oe,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function ie(Z){const oe=this.sliceSerialize(Z),se=this.stack[this.stack.length-2];se.label=YD(oe),se.identifier=rr(oe).toLowerCase()}function ae(){const Z=this.stack[this.stack.length-1],oe=this.resume(),se=this.stack[this.stack.length-1];if(this.data.inReference=!0,se.type==="link"){const me=Z.children;se.children=me}else se.alt=oe}function C(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.url=Z}function G(){const Z=this.resume(),oe=this.stack[this.stack.length-1];oe.title=Z}function ne(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function O(Z){const oe=this.resume(),se=this.stack[this.stack.length-1];se.label=oe,se.identifier=rr(this.sliceSerialize(Z)).toLowerCase(),this.data.referenceType="full"}function q(Z){this.data.characterReferenceType=Z.type}function S(Z){const oe=this.sliceSerialize(Z),se=this.data.characterReferenceType;let me;se?(me=gh(oe,se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=Ko(oe);const be=this.stack.pop();be.value+=me,be.position.end=fn(Z.end)}function L(Z){z.call(this,Z);const oe=this.stack[this.stack.length-1];oe.url=this.sliceSerialize(Z)}function Q(Z){z.call(this,Z);const oe=this.stack[this.stack.length-1];oe.url="mailto:"+this.sliceSerialize(Z)}function K(){return{type:"blockquote",children:[]}}function J(){return{type:"code",lang:null,meta:null,value:""}}function ce(){return{type:"inlineCode",value:""}}function ee(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function ve(){return{type:"heading",depth:0,children:[]}}function Ee(){return{type:"break"}}function Ce(){return{type:"html",value:""}}function Fe(){return{type:"image",title:null,url:"",alt:null}}function We(){return{type:"link",title:null,url:"",children:[]}}function Me(Z){return{type:"list",ordered:Z.type==="listOrdered",start:null,spread:Z._spread,children:[]}}function ze(Z){return{type:"listItem",spread:Z._spread,checked:null,children:[]}}function Xe(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function je(){return{type:"text",value:""}}function qe(){return{type:"thematicBreak"}}}function fn(e){return{line:e.line,column:e.column,offset:e.offset}}function Fh(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Fh(e,r):XD(e,r)}}function XD(e,t){let n;for(n in t)if(kh.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 Nc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Nr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Nr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Nr({start:t.start,end:t.end})+") is still open")}function eE(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 Ah(e,t){var l,u,d;const n={...Xn,...t==null?void 0:t.nodeTypes,[H.heading]:{...Xn[H.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[H.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",i=(t==null?void 0:t.imageSourceKey)??"link",a=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(h=>Ah({...h,ordered:e.ordered||!1},t))),e.type){case ht.heading:return{type:n[H.heading][e.depth||1],children:s.map(h=>({...h,[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:""}],[i]:e.url,[a]: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,...us(s),...wi(s)};case ht.strong:return{[n[Kt.strong]]:!0,...us(s),...wi(s)};case ht.delete:return{[n[Kt.delete]]:!0,...us(s),...wi(s)};case ht.inlineCode:return{[n[Kt.code]]:!0,text:e.value,...wi(s)};case ht.thematicBreak:return{type:n[H.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const us=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function wi(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const tE=function(t){const n=r=>r.children.map(i=>Ah(i,t));this.Compiler=n},nE=(e,t=n=>{})=>{VC().use(eE).use(tE).process(e).then(n=>{const r=Pt(n.result),i=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=>i(l))};r.forEach(i);const a=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(Qs)){const h=u,p=d.text.replace(Qs,""),m="link"in h&&h.link?h.link:"";h.type=H.mention,h.id=m,h.name=p,h.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in l&&l.children&&a(l.children)}};a(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 h=d.replace(/~~/g,""),p=o.text.indexOf(d),m=o.text.substring(0,p),v=o.text.substring(p+d.length),f=[{text:m},{text:h,[H.strikethrough]:!0},{text:v}];s.children.splice(l,1,...f)})}})}),t(r)})},Go=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},rE=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,i]=x.parent(e,n,{edge:"end"}),a=r;for(;a.type!==t&&i.length>0&&i.length!==1;)i=I.parent(i),r=le.get(e,i),a=r;return a.type===t?[r,i]:[null,null]},iE=e=>{const{selection:t}=e;return t?x.string(e,t):null},Ic=e=>{let t="";for(const n of le.descendants(e)){const[r]=n,i=r;i.text&&(t+=i.text)}return t},aE=e=>{for(const[t]of le.descendants(e)){const n=t;if(n.type===H.link)return n.link}return null},Rc={"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},sE=(e,t,n,r)=>{for(const i in Rc)if(e1(i,e)){e.stopPropagation(),e.preventDefault();const a=Rc[i];if(a===H.link){n([{type:"showLinkEditor",value:!0}]);return}if(gE(a)){Nh(t,a,r);return}Oh(t,a,r)}},Bh=(e,t,n,r)=>{var d;const{selectedUser:i,possibleUsers:a}=t,s=a[i];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:""}]};X.select(e,(t==null?void 0:t.position)||fh),X.insertNodes(e,[u,{text:" "}]),X.move(e,{distance:1,unit:"offset"}),Go(r)},oE=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:i})=>{const{selection:a}=e;if(a&&Y.isCollapsed(a)){const[s]=Y.edges(a),o=x.start(e,s.path),l=x.range(e,o,s),d=x.string(e,l).match(fd);if(d){const h=d.index||0,p={path:s.path,offset:h},m={path:s.path,offset:h+d[0].length},v=x.range(e,p,m),f=x.after(e,s),b=x.range(e,s,f);if(x.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const w=d[1];let F=[];r&&(F=await r({name:w})),i([{type:"mentionPopover",value:{show:F.length>0?!0:n!==null,selectedUser:0,possibleUsers:F,position:F.length>0?v:null,numberOfUsers:F.length>0?F.length:null}}]);return}}}t&&i([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},Th=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},Kn=e=>typeof e.text=="string",uE=[H.hr,H.image,H.mention],$c="<br>";function Sh(e,t={nodeTypes:Xn}){const{nodeTypes:n=Xn,ignoreParagraphNewline:r=!1,listDepth:i=0}=t,a=e.text||"";let s=e.type||"";const o={...Xn,...n,heading:{...Xn[H.heading],...n[H.heading]}},l=[o[H.ul],o[H.ol]];let u=a;if(!Kn(e)&&s!==H.mention&&(u=e.children.map(d=>{const h=Kn(d)?!1:l.includes(d.type||""),p=l.includes(e.type||"");let m=!1;return!Kn(e)&&Array.isArray(e.children)&&(m=e.children.some(v=>!Kn(v)&&v.type===o.link)),Sh({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||h||p||m)&&!d.break,listDepth:l.includes(d.type||"")?i+1:i,inBlockquote:s===o[H.blockquote]||e.parentType===o[H.blockquote]})}).join("")),!r&&(a===""||a===`
84
- `)&&e.parentType===o[H.paragraph]&&s!==o[H.mention]&&(s=o[H.paragraph],u=$c),!(u===""&&!uE.find(d=>o[d]===s)))switch(u!==$c&&Kn(e)&&(e[H.strikethrough]&&e[H.bold]&&e[H.italic]?u=Zn(u,"~~***"):e[H.bold]&&e[H.italic]?u=Zn(u,"***"):(e[H.bold]&&(u=Zn(u,"**")),e[H.italic]&&(u=Zn(u,"_")),e[H.strikethrough]&&(u=Zn(u,"~~")),e[H.code]&&(u=Zn(u,"`")))),s){case o[H.heading][1]:return`# ${u}
83
+ `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&i)continue;s=" ";break}default:s=String.fromCharCode(a)}i=a===-2,r.push(s)}return r.join("")}const $D={42:bt,43:bt,45:bt,48:bt,49:bt,50:bt,51:bt,52:bt,53:bt,54:bt,55:bt,56:bt,57:bt,62:_m},LD={91:zC},zD={[-2]:ss,[-1]:ss,32:ss},qD={35:KC,42:Ri,45:[Lc,Ri],60:QC,61:Lc,95:Ri,96:Rc,126:Rc},UD={38:Fm,92:km},WD={[-5]:os,[-4]:os,[-3]:os,33:pD,38:Fm,42:ro,60:[vC,iD],91:vD,92:[VC,km],93:Jo,95:ro,96:TC},VD={null:[ro,jD]},HD={null:[42,95]},KD={null:[]},ZD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:HD,contentInitial:LD,disable:KD,document:$D,flow:qD,flowInitial:zD,insideSpan:VD,string:UD,text:WD},Symbol.toStringTag,{value:"Module"}));function YD(e){const n=nC([ZD,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:i(cC),document:i(fC),flow:i(TD),string:i(PD),text:i(OD)};return r;function i(a){return s;function s(o){return ND(r,a,o)}}}function GD(e){for(;!Am(e););return e}const zc=/[\0\t\n\r]/g;function QD(){let e=1,t="",n=!0,r;return i;function i(a,s,o){const l=[];let u,d,m,h,p;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(s||void 0).decode(a)),m=0,t="",n&&(a.charCodeAt(0)===65279&&m++,n=void 0);m<a.length;){if(zc.lastIndex=m,u=zc.exec(a),h=u&&u.index!==void 0?u.index:a.length,p=a.charCodeAt(h),!u){t=a.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(a.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 JD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function XD(e){return e.replace(JD,eE)}function eE(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),a=i===120||i===88;return Em(n.slice(a?2:1),a?16:10)}return Go(n)||e}const Om={}.hasOwnProperty;function tE(e,t,n){return typeof t!="string"&&(n=t,t=void 0),nE(n)(GD(YD(n).document().write(QD()(e,t,!0))))}function nE(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(Ve),autolinkProtocol:O,autolinkEmail:O,atxHeading:a(de),blockQuote:a(Y),characterEscape:O,characterReference:O,codeFenced:a(te),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:a(te,s),codeText:a(ce,s),codeTextData:O,data:O,codeFlowValue:O,definition:a(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:a(pe),hardBreakEscape:a(xe),hardBreakTrailing:a(xe),htmlFlow:a(Be,s),htmlFlowData:O,htmlText:a(Be,s),htmlTextData:O,image:a(Fe),label:s,link:a(Ve),listItem:a(Ne),listItemValue:h,listOrdered:a(Re,m),listUnordered:a(Re),paragraph:a(Qe),reference:k,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:a(de),strong:a(Ae),thematicBreak:a(Ee)},exit:{atxHeading:l(),atxHeadingSequence:D,autolink:l(),autolinkEmail:Q,autolinkProtocol:L,blockQuote:l(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:q,characterReferenceMarkerNumeric:q,characterReferenceValue:S,codeFenced:l(b),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:v,codeFlowValue:z,codeIndented:l(g),codeText:l(M),codeTextData:z,data:z,definition:l(),definitionDestinationString:F,definitionLabelString:x,definitionTitleString:C,emphasis:l(),hardBreakEscape:l(A),hardBreakTrailing:l(A),htmlFlow:l(B),htmlFlowData:z,htmlText:l(j),htmlTextData:z,image:l(W),label:se,labelText:ie,lineEnding:$,link:l(U),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:P,resourceDestinationString:E,resourceTitleString:ee,resource:Z,setextHeading:l(R),setextHeadingLineSequence:T,setextHeadingText:_,strong:l(),thematicBreak:l()}};Mm(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(K){let oe={type:"root",children:[]};const ae={stack:[oe],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},he=[];let ve=-1;for(;++ve<K.length;)if(K[ve][1].type==="listOrdered"||K[ve][1].type==="listUnordered")if(K[ve][0]==="enter")he.push(ve);else{const Te=he.pop();ve=i(K,Te,ve)}for(ve=-1;++ve<K.length;){const Te=t[K[ve][0]];Om.call(Te,K[ve][1].type)&&Te[K[ve][1].type].call(Object.assign({sliceSerialize:K[ve][2].sliceSerialize},ae),K[ve][1])}if(ae.tokenStack.length>0){const Te=ae.tokenStack[ae.tokenStack.length-1];(Te[1]||qc).call(ae,void 0,Te[0])}for(oe.position={start:fn(K.length>0?K[0][1].start:{line:1,column:1,offset:0}),end:fn(K.length>0?K[K.length-2][1].end:{line:1,column:1,offset:0})},ve=-1;++ve<t.transforms.length;)oe=t.transforms[ve](oe)||oe;return oe}function i(K,oe,ae){let he=oe-1,ve=-1,Te=!1,be,je,st,et;for(;++he<=ae;){const tt=K[he];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?ve++:ve--,et=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(be&&!et&&!ve&&!st&&(st=he),et=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:et=void 0}if(!ve&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||ve===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(be){let _t=he;for(je=void 0;_t--;){const ut=K[_t];if(ut[1].type==="lineEnding"||ut[1].type==="lineEndingBlank"){if(ut[0]==="exit")continue;je&&(K[je][1].type="lineEndingBlank",Te=!0),ut[1].type="lineEnding",je=_t}else if(!(ut[1].type==="linePrefix"||ut[1].type==="blockQuotePrefix"||ut[1].type==="blockQuotePrefixWhitespace"||ut[1].type==="blockQuoteMarker"||ut[1].type==="listItemIndent"))break}st&&(!je||st<je)&&(be._spread=!0),be.end=Object.assign({},je?K[je][1].start:tt[1].end),K.splice(je||he,0,["exit",be,tt[2]]),he++,ae++}if(tt[1].type==="listItemPrefix"){const _t={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};be=_t,K.splice(he,0,["enter",_t,tt[2]]),he++,ae++,st=void 0,et=!0}}}return K[oe][1]._spread=Te,ae}function a(K,oe){return ae;function ae(he){o.call(this,K(he),he),oe&&oe.call(this,he)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(K,oe,ae){this.stack[this.stack.length-1].children.push(K),this.stack.push(K),this.tokenStack.push([oe,ae]),K.position={start:fn(oe.start),end:void 0}}function l(K){return oe;function oe(ae){K&&K.call(this,ae),u.call(this,ae)}}function u(K,oe){const ae=this.stack.pop(),he=this.tokenStack.pop();if(he)he[0].type!==K.type&&(oe?oe.call(this,K,he[0]):(he[1]||qc).call(this,K,he[0]));else throw new Error("Cannot close `"+K.type+"` ("+$r({start:K.start,end:K.end})+"): it’s not open");ae.position.end=fn(K.end)}function d(){return eC(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function h(K){if(this.data.expectingFirstListItemValue){const oe=this.stack[this.stack.length-2];oe.start=Number.parseInt(this.sliceSerialize(K),10),this.data.expectingFirstListItemValue=void 0}}function p(){const K=this.resume(),oe=this.stack[this.stack.length-1];oe.lang=K}function v(){const K=this.resume(),oe=this.stack[this.stack.length-1];oe.meta=K}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const K=this.resume(),oe=this.stack[this.stack.length-1];oe.value=K.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const K=this.resume(),oe=this.stack[this.stack.length-1];oe.value=K.replace(/(\r?\n|\r)$/g,"")}function x(K){const oe=this.resume(),ae=this.stack[this.stack.length-1];ae.label=oe,ae.identifier=ir(this.sliceSerialize(K)).toLowerCase()}function C(){const K=this.resume(),oe=this.stack[this.stack.length-1];oe.title=K}function F(){const K=this.resume(),oe=this.stack[this.stack.length-1];oe.url=K}function D(K){const oe=this.stack[this.stack.length-1];if(!oe.depth){const ae=this.sliceSerialize(K).length;oe.depth=ae}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function T(K){const oe=this.stack[this.stack.length-1];oe.depth=this.sliceSerialize(K).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function O(K){const ae=this.stack[this.stack.length-1].children;let he=ae[ae.length-1];(!he||he.type!=="text")&&(he=Oe(),he.position={start:fn(K.start),end:void 0},ae.push(he)),this.stack.push(he)}function z(K){const oe=this.stack.pop();oe.value+=this.sliceSerialize(K),oe.position.end=fn(K.end)}function $(K){const oe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ae=oe.children[oe.children.length-1];ae.position.end=fn(K.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(oe.type)&&(O.call(this,K),z.call(this,K))}function A(){this.data.atHardBreak=!0}function B(){const K=this.resume(),oe=this.stack[this.stack.length-1];oe.value=K}function j(){const K=this.resume(),oe=this.stack[this.stack.length-1];oe.value=K}function M(){const K=this.resume(),oe=this.stack[this.stack.length-1];oe.value=K}function U(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=oe,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function W(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const oe=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=oe,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function ie(K){const oe=this.sliceSerialize(K),ae=this.stack[this.stack.length-2];ae.label=XD(oe),ae.identifier=ir(oe).toLowerCase()}function se(){const K=this.stack[this.stack.length-1],oe=this.resume(),ae=this.stack[this.stack.length-1];if(this.data.inReference=!0,ae.type==="link"){const he=K.children;ae.children=he}else ae.alt=oe}function E(){const K=this.resume(),oe=this.stack[this.stack.length-1];oe.url=K}function ee(){const K=this.resume(),oe=this.stack[this.stack.length-1];oe.title=K}function Z(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function P(K){const oe=this.resume(),ae=this.stack[this.stack.length-1];ae.label=oe,ae.identifier=ir(this.sliceSerialize(K)).toLowerCase(),this.data.referenceType="full"}function q(K){this.data.characterReferenceType=K.type}function S(K){const oe=this.sliceSerialize(K),ae=this.data.characterReferenceType;let he;ae?(he=Em(oe,ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):he=Go(oe);const ve=this.stack.pop();ve.value+=he,ve.position.end=fn(K.end)}function L(K){z.call(this,K);const oe=this.stack[this.stack.length-1];oe.url=this.sliceSerialize(K)}function Q(K){z.call(this,K);const oe=this.stack[this.stack.length-1];oe.url="mailto:"+this.sliceSerialize(K)}function Y(){return{type:"blockquote",children:[]}}function te(){return{type:"code",lang:null,meta:null,value:""}}function ce(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function de(){return{type:"heading",depth:0,children:[]}}function xe(){return{type:"break"}}function Be(){return{type:"html",value:""}}function Fe(){return{type:"image",title:null,url:"",alt:null}}function Ve(){return{type:"link",title:null,url:"",children:[]}}function Re(K){return{type:"list",ordered:K.type==="listOrdered",start:null,spread:K._spread,children:[]}}function Ne(K){return{type:"listItem",spread:K._spread,checked:null,children:[]}}function Qe(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function Oe(){return{type:"text",value:""}}function Ee(){return{type:"thematicBreak"}}}function fn(e){return{line:e.line,column:e.column,offset:e.offset}}function Mm(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Mm(e,r):rE(e,r)}}function rE(e,t){let n;for(n in t)if(Om.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 qc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+$r({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+$r({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+$r({start:t.start,end:t.end})+") is still open")}function iE(e){const t=this;t.parser=n;function n(r){return tE(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Nm(e,t){var l,u,d;const n={...er,...t==null?void 0:t.nodeTypes,[H.heading]:{...er[H.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[H.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",i=(t==null?void 0:t.imageSourceKey)??"link",a=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(m=>Nm({...m,ordered:e.ordered||!1},t))),e.type){case pt.heading:return{type:n[H.heading][e.depth||1],children:s.map(m=>({...m,[n[H.heading][e.depth||1]]:!0}))};case pt.list:return{type:e.ordered?n[H.ol]:n[H.ul],children:s};case pt.listItem:return{type:n[H.li],children:s};case pt.paragraph:return{type:n[H.paragraph],children:s};case pt.link:return{type:n[H.link],[r]:e.url,children:s};case pt.image:return{type:n[H.image],children:[{text:""}],[i]:e.url,[a]:e.alt};case pt.blockquote:return{type:n[H.blockquote],children:s};case pt.code:return{type:n[H.codeblock],language:e.lang,children:[{text:e.value}]};case pt.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 pt.emphasis:return{[n[Kt.emphasis]]:!0,...us(s),...Ei(s)};case pt.strong:return{[n[Kt.strong]]:!0,...us(s),...Ei(s)};case pt.delete:return{[n[Kt.delete]]:!0,...us(s),...Ei(s)};case pt.inlineCode:return{[n[Kt.code]]:!0,text:e.value,...Ei(s)};case pt.thematicBreak:return{type:n[H.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const us=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Ei(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const aE=function(t){const n=r=>r.children.map(i=>Nm(i,t));this.Compiler=n},sE=(e,t=n=>{})=>{Yw().use(iE).use(aE).process(e).then(n=>{const r=Ot(n.result),i=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=>i(l))};r.forEach(i);const a=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(Qs)){const m=u,h=d.text.replace(Qs,""),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&&a(l.children)}};a(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),v=o.text.substring(h+d.length),f=[{text:p},{text:m,[H.strikethrough]:!0},{text:v}];s.children.splice(l,1,...f)})}})}),t(r)})},Xo=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},oE=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,i]=w.parent(e,n,{edge:"end"}),a=r;for(;a.type!==t&&i.length>0&&i.length!==1;)i=I.parent(i),r=le.get(e,i),a=r;return a.type===t?[r,i]:[null,null]},uE=e=>{const{selection:t}=e;return t?w.string(e,t):null},Uc=e=>{let t="";for(const n of le.descendants(e)){const[r]=n,i=r;i.text&&(t+=i.text)}return t},lE=e=>{for(const[t]of le.descendants(e)){const n=t;if(n.type===H.link)return n.link}return null},Wc={"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},cE=(e,t,n,r)=>{for(const i in Wc)if(i1(i,e)){e.stopPropagation(),e.preventDefault();const a=Wc[i];if(a===H.link){n([{type:"showLinkEditor",value:!0}]);return}if(xE(a)){Wm(t,a,r);return}zm(t,a,r)}},Im=(e,t,n,r)=>{var d;const{selectedUser:i,possibleUsers:a}=t,s=a[i];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:""}]};X.select(e,(t==null?void 0:t.position)||xm),X.insertNodes(e,[u,{text:" "}]),X.move(e,{distance:1,unit:"offset"}),Xo(r)},dE=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:i})=>{const{selection:a}=e;if(a&&G.isCollapsed(a)){const[s]=G.edges(a),o=w.start(e,s.path),l=w.range(e,o,s),d=w.string(e,l).match(bd);if(d){const m=d.index||0,h={path:s.path,offset:m},p={path:s.path,offset:m+d[0].length},v=w.range(e,h,p),f=w.after(e,s),b=w.range(e,s,f);if(w.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const C=d[1];let F=[];r&&(F=await r({name:C})),i([{type:"mentionPopover",value:{show:F.length>0?!0:n!==null,selectedUser:0,possibleUsers:F,position:F.length>0?v:null,numberOfUsers:F.length>0?F.length:null}}]);return}}}t&&i([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},Rm=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},Zn=e=>typeof e.text=="string",fE=[H.hr,H.image,H.mention],Vc="<br>";function $m(e,t={nodeTypes:er}){const{nodeTypes:n=er,ignoreParagraphNewline:r=!1,listDepth:i=0}=t,a=e.text||"";let s=e.type||"";const o={...er,...n,heading:{...er[H.heading],...n[H.heading]}},l=[o[H.ul],o[H.ol]];let u=a;if(!Zn(e)&&s!==H.mention&&(u=e.children.map(d=>{const m=Zn(d)?!1:l.includes(d.type||""),h=l.includes(e.type||"");let p=!1;return!Zn(e)&&Array.isArray(e.children)&&(p=e.children.some(v=>!Zn(v)&&v.type===o.link)),$m({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||m||h||p)&&!d.break,listDepth:l.includes(d.type||"")?i+1:i,inBlockquote:s===o[H.blockquote]||e.parentType===o[H.blockquote]})}).join("")),!r&&(a===""||a===`
84
+ `)&&e.parentType===o[H.paragraph]&&s!==o[H.mention]&&(s=o[H.paragraph],u=Vc),!(u===""&&!fE.find(d=>o[d]===s)))switch(u!==Vc&&Zn(e)&&(e[H.strikethrough]&&e[H.bold]&&e[H.italic]?u=Yn(u,"~~***"):e[H.bold]&&e[H.italic]?u=Yn(u,"***"):(e[H.bold]&&(u=Yn(u,"**")),e[H.italic]&&(u=Yn(u,"_")),e[H.strikethrough]&&(u=Yn(u,"~~")),e[H.code]&&(u=Yn(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}
@@ -95,18 +95,18 @@ ${u}
95
95
  `;case o[H.link]:return`[${u}](${e.link||""})`;case o.image:return`![${e.caption}](${e.link||""})`;case o[H.mention]:const{id:d}=e;return e?`@{{${d}}}`:u;case o[H.ul]:case o[H.ol]:return`
96
96
  ${u}
97
97
 
98
- `;case o[H.li]:const h=e&&e.parentType===o[H.ol],p=e.children.length===1&&Kn(e.children[0]);let m="";for(let v=0;i>v;v++)h?m+=" ":m+=" ";return t.inBlockquote&&(m="> "+m),`
99
- ${m}${h?"1.":"-"} ${u}${p?`
98
+ `;case o[H.li]:const m=e&&e.parentType===o[H.ol],h=e.children.length===1&&Zn(e.children[0]);let p="";for(let v=0;i>v;v++)m?p+=" ":p+=" ";return t.inBlockquote&&(p="> "+p),`
99
+ ${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 Zn(e,t){const n=e.trim(),r=n,i=`${t}${r}${Lc(t)}`;if(r.length===e.length)return i;const a=t+r+Lc(t);return e.replace(n,a)}const Lc=e=>e.split("").reverse().join(""),lE=e=>e.map(t=>Sh(t)).join("").trim();const cE=({onFallbackClick:e=()=>{}})=>{const t=re.useIntl(),n=Ln(),{dispatch:r,isInOverlay:i,mentionPopover:a,id:s,onMention:o}=y.useContext(ln),{show:l,selectedUser:u,possibleUsers:d}=a,h=hh(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const p=Th(i);return c.jsx(mr,{parent:p,children:c.jsx(vd,{ref:h,className:"mention-popover",onKeyDown:m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:m,user:v},f)=>c.jsx(rn,{element:"li",className:V({selected:f===u}),member:{id:m,...v,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const g={...a,selectedUser:f};r([{type:"mentionPopover",value:g}]),Bh(n,g,r,s),o&&o({id:m||"",name:v.name||""})}}},m)),c.jsx(rn,{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:m=>{m.preventDefault(),m.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})};const Qo=({formID:e,label:t,showLabel:n})=>{const{visible:r="",screenreader:i=""}=t||{};return n?c.jsx("label",{htmlFor:`${e}-input`,className:"rte-label text-small",onClick:a=>{a.preventDefault(),a.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:r}):c.jsx(Pe,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:i})},Jo=({id:e,active:t,hasDivider:n=!1,callback:r,className:i="",children:a,"aria-pressed":s,...o})=>{const l=re.useIntl(),u=Ln(),{id:d,tabbableOption:h,setFocus:p,openTooltip:m,dispatch:v}=y.useContext(ln),f={};return e!==h&&(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:()=>{v([{type:"openTooltip",value:e}])},onMouseLeave:()=>{v([{type:"openTooltip",value:null}])},onFocus:()=>{v([{type:"openTooltip",value:e}])},onBlur:b=>{b.stopPropagation();const g=[{type:"openTooltip",value:null}];u.selection&&g.push({type:"lastAnchor",value:u.selection.anchor}),v(g)},contentEditable:!1,children:[c.jsxs("button",{...o,...f,className:V(e,i,{active:t}),onClick:b=>{b.stopPropagation(),b.preventDefault()},onMouseDown:b=>{b.stopPropagation(),b.preventDefault(),r()},onKeyDown:b=>{var g,D,w,F;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=(g=E==null?void 0:E.parentElement)==null?void 0:g.lastElementChild}else k||(k=(D=E==null?void 0:E.parentElement)==null?void 0:D.firstElementChild);const T=k==null?void 0:k.className.split(" ")[0];T&&(p(T),(w=k==null?void 0:k.querySelector("button"))==null||w.focus());break;default:const R=b.currentTarget.closest("fieldset");if(R){(F=R==null?void 0:R.previousElementSibling)==null||F.focus();break}}},children:[c.jsx(Pe,{showOnFocus:!1,children:l.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(Rn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:m===e,accessibility:{"aria-hidden":!0},children:l.formatMessage({id:`richTextEditor_${e}`})})]}),a]})},zc=[H.ol,H.ul],jh=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(x.nodes(e,{at:x.unhangRange(e,n),match:i=>{const a=i;return!x.isEditor(i)&&fe.isElement(i)&&a.type===t}}));return!!r},dE=e=>{const[t]=x.nodes(e,{match:n=>n.type===H.blockquote});return!!t},Oh=(e,t,n)=>{try{const r=dE(e),i=jh(e,t),a=zc.includes(t);X.unwrapNodes(e,{match:l=>{const u=l;return!x.isEditor(u)&&fe.isElement(u)&&zc.includes(u.type)},split:!0});const o={type:i?H.paragraph:a?H.li:t};if(X.setNodes(e,o),t===H.h3){const l={type:t};i?x.removeMark(e,t):x.addMark(e,t,!0),X.setNodes(e,l)}if(a)if(i){const{selection:l}=e;if(!l)return;const[u,d]=x.parent(e,l,{edge:"end"});Array.from(x.nodes(e,{at:d,match:p=>{const m=p;return!x.isEditor(p)&&fe.isElement(p)&&m.type===H.li}})).forEach(([p,m])=>{le.string(p).trim()===""&&X.removeNodes(e,{at:m})})}else{if(r){const u={type:H.blockquote,children:[]};X.wrapNodes(e,u)}const l={type:t,children:[]};X.wrapNodes(e,l)}}catch(r){const i=r.message;n(`Error toggling block: ${i}`)}},qc=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(ln),i=Ln(),a=jh(i,e);return c.jsx(Jo,{id:e,active:a,hasDivider:t,callback:()=>{Oh(i,e,r),n(a?null:e)}})},Rr=e=>{const[t]=x.nodes(e,{match:n=>{const r=n;return!x.isEditor(n)&&fe.isElement(n)&&r.type===H.link}});return!!t},fE=(e,t,n,r)=>{e.selection&&Xo(e,t,n,r)},hE=(e,t,n,r)=>{const{selection:i}=e;if(i&&Y.isCollapsed(i)){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};X.setNodes(e,u,{at:l}),Go(n)}}else Xo(e,t,n,r)},Xo=(e,t,n,r=i=>{console.error(i)})=>{try{Rr(e)&&Ph(e);const{selection:i}=e,a=i&&Y.isCollapsed(i),s={type:H.link,link:t,children:a?[{text:t}]:[]};a?(X.insertNodes(e,s),X.move(e,{distance:1,unit:"offset"})):(X.wrapNodes(e,s,{split:!0}),X.collapse(e,{edge:"end"}),X.insertNodes(e,{text:""}),X.move(e,{distance:1,unit:"offset"})),Go(n)}catch(i){const a=i.message;r(`Error in wrapLink: ${a}`)}},Ph=e=>{X.unwrapNodes(e,{match:t=>{const n=t;return!x.isEditor(t)&&fe.isElement(t)&&n.type===H.link}})};let ls=null;const mE=()=>{const e=re.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:i,enrichedUrl:a,dispatch:s,getLinkPreview:o,reportError:l}=y.useContext(ln),u=Ln(),d=FC(u),h=(d==null?void 0:d.text)||iE(u),p=a!==!1,[m,v]=y.useState(Rr(u)),f=hh(u,"link-editor",`${n}-link`),b=y.useRef(null);y.useEffect(()=>{var E;!m&&r&&((E=b.current)==null||E.focus())},[m]),y.useEffect(()=>{ls&&clearTimeout(ls),ls=setTimeout(()=>{v(Rr(u))},500)},[u.selection]);const g=[],D=["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(g.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=()=>{v(!1)};break;case"remove":k.onClick=()=>{const T=[{type:"showLinkEditor",value:!1}];Rr(u)&&(Ph(u),T.push({type:"lastAnchor",value:null}),a&&(d==null?void 0:d.full)===(a==null?void 0:a.url)&&T.push({type:"enrichedUrl",value:!1})),s(T)};break}return k}),w=[{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,[]);X.select(u,k),te.focus(u)}}}}];h&&w.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",h]})});const F=Th(i);return c.jsx(mr,{parent:F,children:c.jsx(Rn,{ref:f,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!m},functions:{onBlur:()=>{s([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var E;return(E=b.current)==null?void 0:E.focus()})}},children:m?c.jsx(hr,{wrappers:g,buttons:D}):c.jsx(Jt,{element:"fieldset",id:`${n}-link-editor`,className:V({"show-labels":h}),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:R}=co(E.url);T=R,d!=null&&d.full?hE(u,T,n,l):fE(u,T,n,l),k.push({type:"lastAnchor",value:null})}if(s(k),E.url&&o&&(!p||a&&(d==null?void 0:d.full)===a.url)){const R=await o(T);R.url&&s([{type:"enrichedUrl",value:R}])}})}},fields:w,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},pE=()=>{const e=Ln(),{setFocus:t,dispatch:n}=y.useContext(ln),[r,i]=y.useState(!1);return y.useEffect(()=>{i(Rr(e))},[e.selection]),c.jsx(Jo,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),i(!0)},"aria-pressed":null})},gE=e=>[H.bold,H.italic,H.strikethrough].includes(e),Mh=(e,t)=>{const n=x.marks(e);return n?n[t]===!0:!1},Nh=(e,t,n)=>{try{Mh(e,t)?x.removeMark(e,t):x.addMark(e,t,!0)}catch(r){const i=r.message;n(`Error toggling mark: ${i}`)}},vE=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(ln),i=Ln(),a=Mh(i,e);return c.jsx(Jo,{id:e,active:a,hasDivider:t,callback:()=>{Nh(i,e,r),n(a?null:e)}})},ta=[H.bold,H.italic,H.strikethrough],bE=[H.ol,H.ul,H.blockquote];const yE=({styling:e={showHeadingOption:!1},...t})=>{const n=re.useIntl(),{id:r}=y.useContext(ln);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(qc,{format:H.h3,hasDivider:!0},H.h3),ta.map((i,a)=>c.jsx(vE,{format:i,hasDivider:a===ta.length-1},i)),c.jsx(pE,{}),bE.map((i,a)=>c.jsx(qc,{format:i,hasDivider:a===1},i))]})]}),c.jsx(mE,{})]})};function xE(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 io(e,t){return Array(t+1).join(e)}function CE(e){return e.replace(/^\n*/,"")}function wE(e){for(var t=e.length;t>0&&e[t-1]===`
104
- `;)t--;return e.substring(0,t)}var DE=["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 eu(e){return tu(e,DE)}var Ih=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Rh(e){return tu(e,Ih)}function EE(e){return Lh(e,Ih)}var $h=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function _E(e){return tu(e,$h)}function kE(e){return Lh(e,$h)}function tu(e,t){return t.indexOf(e.nodeName)>=0}function Lh(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var ct={};ct.paragraph={filter:"p",replacement:function(e){return`
103
+ `;default:return u}}function Yn(e,t){const n=e.trim(),r=n,i=`${t}${r}${Hc(t)}`;if(r.length===e.length)return i;const a=t+r+Hc(t);return e.replace(n,a)}const Hc=e=>e.split("").reverse().join(""),mE=e=>e.map(t=>$m(t)).join("").trim();const hE=({onFallbackClick:e=()=>{}})=>{const t=re.useIntl(),n=zn(),{dispatch:r,isInOverlay:i,mentionPopover:a,id:s,onMention:o}=y.useContext(ln),{show:l,selectedUser:u,possibleUsers:d}=a,m=wm(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const h=Rm(i);return c.jsx(gr,{parent:h,children:c.jsx(Dd,{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:v},f)=>c.jsx(rn,{element:"li",className:V({selected:f===u}),member:{id:p,...v,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const g={...a,selectedUser:f};r([{type:"mentionPopover",value:g}]),Im(n,g,r,s),o&&o({id:p||"",name:v.name||""})}}},p)),c.jsx(rn,{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 eu=({formID:e,label:t,showLabel:n})=>{const{visible:r="",screenreader:i=""}=t||{};return n?c.jsx("label",{htmlFor:`${e}-input`,className:"rte-label text-small",onClick:a=>{a.preventDefault(),a.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:r}):c.jsx(Ie,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:i})},tu=({id:e,active:t,hasDivider:n=!1,callback:r,className:i="",children:a,"aria-pressed":s,...o})=>{const l=re.useIntl(),u=zn(),{id:d,tabbableOption:m,setFocus:h,openTooltip:p,dispatch:v}=y.useContext(ln),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:()=>{v([{type:"openTooltip",value:e}])},onMouseLeave:()=>{v([{type:"openTooltip",value:null}])},onFocus:()=>{v([{type:"openTooltip",value:e}])},onBlur:b=>{b.stopPropagation();const g=[{type:"openTooltip",value:null}];u.selection&&g.push({type:"lastAnchor",value:u.selection.anchor}),v(g)},contentEditable:!1,children:[c.jsxs("button",{...o,...f,className:V(e,i,{active:t}),onClick:b=>{b.stopPropagation(),b.preventDefault()},onMouseDown:b=>{b.stopPropagation(),b.preventDefault(),r()},onKeyDown:b=>{var g,x,C,F;if(b.key!=="Tab")switch(b.key){case"Enter":b.stopPropagation(),b.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":b.stopPropagation(),b.preventDefault();const D=b.currentTarget.closest("li");let _=D==null?void 0:D.nextElementSibling;if(b.key==="ArrowLeft"){const O=D==null?void 0:D.previousElementSibling;O?_=O:_=(g=D==null?void 0:D.parentElement)==null?void 0:g.lastElementChild}else _||(_=(x=D==null?void 0:D.parentElement)==null?void 0:x.firstElementChild);const T=_==null?void 0:_.className.split(" ")[0];T&&(h(T),(C=_==null?void 0:_.querySelector("button"))==null||C.focus());break;default:const R=b.currentTarget.closest("fieldset");if(R){(F=R==null?void 0:R.previousElementSibling)==null||F.focus();break}}},children:[c.jsx(Ie,{showOnFocus:!1,children:l.formatMessage({id:`richTextEditor_${e}`})}),c.jsx($n,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,accessibility:{"aria-hidden":!0},children:l.formatMessage({id:`richTextEditor_${e}`})})]}),a]})},Kc=[H.ol,H.ul],Lm=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(w.nodes(e,{at:w.unhangRange(e,n),match:i=>{const a=i;return!w.isEditor(i)&&me.isElement(i)&&a.type===t}}));return!!r},pE=e=>{const[t]=w.nodes(e,{match:n=>n.type===H.blockquote});return!!t},zm=(e,t,n)=>{try{const r=pE(e),i=Lm(e,t),a=Kc.includes(t);X.unwrapNodes(e,{match:l=>{const u=l;return!w.isEditor(u)&&me.isElement(u)&&Kc.includes(u.type)},split:!0});const o={type:i?H.paragraph:a?H.li:t};if(X.setNodes(e,o),t===H.h3){const l={type:t};i?w.removeMark(e,t):w.addMark(e,t,!0),X.setNodes(e,l)}if(a)if(i){const{selection:l}=e;if(!l)return;const[u,d]=w.parent(e,l,{edge:"end"});Array.from(w.nodes(e,{at:d,match:h=>{const p=h;return!w.isEditor(h)&&me.isElement(h)&&p.type===H.li}})).forEach(([h,p])=>{le.string(h).trim()===""&&X.removeNodes(e,{at:p})})}else{if(r){const u={type:H.blockquote,children:[]};X.wrapNodes(e,u)}const l={type:t,children:[]};X.wrapNodes(e,l)}}catch(r){const i=r.message;n(`Error toggling block: ${i}`)}},Zc=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(ln),i=zn(),a=Lm(i,e);return c.jsx(tu,{id:e,active:a,hasDivider:t,callback:()=>{zm(i,e,r),n(a?null:e)}})},zr=e=>{const[t]=w.nodes(e,{match:n=>{const r=n;return!w.isEditor(n)&&me.isElement(n)&&r.type===H.link}});return!!t},gE=(e,t,n,r)=>{e.selection&&nu(e,t,n,r)},vE=(e,t,n,r)=>{const{selection:i}=e;if(i&&G.isCollapsed(i)){const[s]=w.nodes(e,{match:o=>{const l=o;return!w.isEditor(o)&&me.isElement(o)&&l.type===H.link}});if(s){const[o,l]=s,u={link:t};X.setNodes(e,u,{at:l}),Xo(n)}}else nu(e,t,n,r)},nu=(e,t,n,r=i=>{console.error(i)})=>{try{zr(e)&&qm(e);const{selection:i}=e,a=i&&G.isCollapsed(i),s={type:H.link,link:t,children:a?[{text:t}]:[]};a?(X.insertNodes(e,s),X.move(e,{distance:1,unit:"offset"})):(X.wrapNodes(e,s,{split:!0}),X.collapse(e,{edge:"end"}),X.insertNodes(e,{text:""}),X.move(e,{distance:1,unit:"offset"})),Xo(n)}catch(i){const a=i.message;r(`Error in wrapLink: ${a}`)}},qm=e=>{X.unwrapNodes(e,{match:t=>{const n=t;return!w.isEditor(t)&&me.isElement(t)&&n.type===H.link}})};let ls=null;const bE=()=>{const e=re.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:i,enrichedUrl:a,dispatch:s,getLinkPreview:o,reportError:l}=y.useContext(ln),u=zn(),d=Sw(u),m=(d==null?void 0:d.text)||uE(u),h=a!==!1,[p,v]=y.useState(zr(u)),f=wm(u,"link-editor",`${n}-link`),b=y.useRef(null);y.useEffect(()=>{var D;!p&&r&&((D=b.current)==null||D.focus())},[p]),y.useEffect(()=>{ls&&clearTimeout(ls),ls=setTimeout(()=>{v(zr(u))},500)},[u.selection]);const g=[],x=["open","edit","remove"].map(D=>{const _={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${D}`},{link:d==null?void 0:d.pretty})};switch(g.push({className:D}),D){case"open":_.href=(d==null?void 0:d.full)||"",_.onClick=T=>{T.preventDefault(),T.stopPropagation(),window.open((d==null?void 0:d.full)||"","_blank"),s([{type:"showLinkEditor",value:!1}])},_.children=c.jsxs(c.Fragment,{children:[_.children,c.jsx(Ie,{children:e.formatMessage({id:`${t}${D}_text`})})]});break;case"edit":_.onClick=()=>{v(!1)};break;case"remove":_.onClick=()=>{const T=[{type:"showLinkEditor",value:!1}];zr(u)&&(qm(u),T.push({type:"lastAnchor",value:null}),a&&(d==null?void 0:d.full)===(a==null?void 0:a.url)&&T.push({type:"enrichedUrl",value:!1})),s(T)};break}return _}),C=[{id:"url",type:"url",inputRef:b,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(d==null?void 0:d.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0,functions:{onChange:()=>{},onKeyDown:D=>{if(D.key==="Tab"){if(!u)return;D.preventDefault(),D.stopPropagation();const _=w.end(u,[]);X.select(u,_),ne.focus(u)}}}}];m&&C.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",m]})});const F=Rm(i);return c.jsx(gr,{parent:F,children:c.jsx($n,{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 D;return(D=b.current)==null?void 0:D.focus()})}},children:p?c.jsx(pr,{wrappers:g,buttons:x}):c.jsx(Jt,{element:"fieldset",id:`${n}-link-editor`,className:V({"show-labels":m}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async D=>{setTimeout(async()=>{const _=[{type:"showLinkEditor",value:!1}];let T=D.url;if(D.url){const{full:R}=co(D.url);T=R,d!=null&&d.full?vE(u,T,n,l):gE(u,T,n,l),_.push({type:"lastAnchor",value:null})}if(s(_),D.url&&o&&(!h||a&&(d==null?void 0:d.full)===a.url)){const R=await o(T);R.url&&s([{type:"enrichedUrl",value:R}])}})}},fields:C,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},yE=()=>{const e=zn(),{setFocus:t,dispatch:n}=y.useContext(ln),[r,i]=y.useState(!1);return y.useEffect(()=>{i(zr(e))},[e.selection]),c.jsx(tu,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),i(!0)},"aria-pressed":null})},xE=e=>[H.bold,H.italic,H.strikethrough].includes(e),Um=(e,t)=>{const n=w.marks(e);return n?n[t]===!0:!1},Wm=(e,t,n)=>{try{Um(e,t)?w.removeMark(e,t):w.addMark(e,t,!0)}catch(r){const i=r.message;n(`Error toggling mark: ${i}`)}},wE=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(ln),i=zn(),a=Um(i,e);return c.jsx(tu,{id:e,active:a,hasDivider:t,callback:()=>{Wm(i,e,r),n(a?null:e)}})},na=[H.bold,H.italic,H.strikethrough],CE=[H.ol,H.ul,H.blockquote];const DE=({styling:e={showHeadingOption:!1},...t})=>{const n=re.useIntl(),{id:r}=y.useContext(ln);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${r}`,className:"toolbar",...t,children:[c.jsx(Ie,{element:"legend",showOnFocus:!1,children:n.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[(e==null?void 0:e.showHeadingOption)&&c.jsx(Zc,{format:H.h3,hasDivider:!0},H.h3),na.map((i,a)=>c.jsx(wE,{format:i,hasDivider:a===na.length-1},i)),c.jsx(yE,{}),CE.map((i,a)=>c.jsx(Zc,{format:i,hasDivider:a===1},i))]})]}),c.jsx(bE,{})]})};function EE(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 io(e,t){return Array(t+1).join(e)}function _E(e){return e.replace(/^\n*/,"")}function kE(e){for(var t=e.length;t>0&&e[t-1]===`
104
+ `;)t--;return e.substring(0,t)}var FE=["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 ru(e){return iu(e,FE)}var Vm=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Hm(e){return iu(e,Vm)}function AE(e){return Zm(e,Vm)}var Km=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function BE(e){return iu(e,Km)}function TE(e){return Zm(e,Km)}function iu(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 ft={};ft.paragraph={filter:"p",replacement:function(e){return`
105
105
 
106
106
  `+e+`
107
107
 
108
- `}};ct.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+`
109
- `}};ct.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var i=io(r===1?"=":"-",e.length);return`
108
+ `}};ft.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+`
109
+ `}};ft.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var i=io(r===1?"=":"-",e.length);return`
110
110
 
111
111
  `+e+`
112
112
  `+i+`
@@ -115,40 +115,40 @@ ${m}${h?"1.":"-"} ${u}${p?`
115
115
 
116
116
  `+io("#",r)+" "+e+`
117
117
 
118
- `}};ct.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
118
+ `}};ft.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
119
119
 
120
120
  `+e+`
121
121
 
122
- `}};ct.list={filter:["ul","ol"],replacement:function(e,t){var n=t.parentNode;return n.nodeName==="LI"&&n.lastElementChild===t?`
122
+ `}};ft.list={filter:["ul","ol"],replacement:function(e,t){var n=t.parentNode;return n.nodeName==="LI"&&n.lastElementChild===t?`
123
123
  `+e:`
124
124
 
125
125
  `+e+`
126
126
 
127
- `}};ct.listItem={filter:"li",replacement:function(e,t,n){e=e.replace(/^\n+/,"").replace(/\n+$/,`
127
+ `}};ft.listItem={filter:"li",replacement:function(e,t,n){e=e.replace(/^\n+/,"").replace(/\n+$/,`
128
128
  `).replace(/\n/gm,`
129
129
  `);var r=n.bulletListMarker+" ",i=t.parentNode;if(i.nodeName==="OL"){var a=i.getAttribute("start"),s=Array.prototype.indexOf.call(i.children,t);r=(a?Number(a)+s:s+1)+". "}return r+e+(t.nextSibling&&!/\n$/.test(e)?`
130
- `:"")}};ct.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){return`
130
+ `:"")}};ft.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){return`
131
131
 
132
132
  `+t.firstChild.textContent.replace(/\n/g,`
133
133
  `)+`
134
134
 
135
- `}};ct.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",i=(r.match(/language-(\S+)/)||[null,""])[1],a=t.firstChild.textContent,s=n.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(a);)u[0].length>=o&&(o=u[0].length+1);var d=io(s,o);return`
135
+ `}};ft.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",i=(r.match(/language-(\S+)/)||[null,""])[1],a=t.firstChild.textContent,s=n.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(a);)u[0].length>=o&&(o=u[0].length+1);var d=io(s,o);return`
136
136
 
137
137
  `+d+i+`
138
138
  `+a.replace(/\n$/,"")+`
139
139
  `+d+`
140
140
 
141
- `}};ct.horizontalRule={filter:"hr",replacement:function(e,t,n){return`
141
+ `}};ft.horizontalRule={filter:"hr",replacement:function(e,t,n){return`
142
142
 
143
143
  `+n.hr+`
144
144
 
145
- `}};ct.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var n=t.getAttribute("href"),r=na(t.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+n+r+")"}};ct.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,n){var r=t.getAttribute("href"),i=na(t.getAttribute("title"));i&&(i=' "'+i+'"');var a,s;switch(n.linkReferenceStyle){case"collapsed":a="["+e+"][]",s="["+e+"]: "+r+i;break;case"shortcut":a="["+e+"]",s="["+e+"]: "+r+i;break;default:var o=this.references.length+1;a="["+e+"]["+o+"]",s="["+o+"]: "+r+i}return this.references.push(s),a},references:[],append:function(e){var t="";return this.references.length&&(t=`
145
+ `}};ft.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var n=t.getAttribute("href"),r=ra(t.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+n+r+")"}};ft.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,n){var r=t.getAttribute("href"),i=ra(t.getAttribute("title"));i&&(i=' "'+i+'"');var a,s;switch(n.linkReferenceStyle){case"collapsed":a="["+e+"][]",s="["+e+"]: "+r+i;break;case"shortcut":a="["+e+"]",s="["+e+"]: "+r+i;break;default:var o=this.references.length+1;a="["+e+"]["+o+"]",s="["+o+"]: "+r+i}return this.references.push(s),a},references:[],append:function(e){var t="";return this.references.length&&(t=`
146
146
 
147
147
  `+this.references.join(`
148
148
  `)+`
149
149
 
150
- `,this.references=[]),t}};ct.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};ct.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};ct.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}};ct.image={filter:"img",replacement:function(e,t){var n=na(t.getAttribute("alt")),r=t.getAttribute("src")||"",i=na(t.getAttribute("title")),a=i?' "'+i+'"':"";return r?"!["+n+"]("+r+a+")":""}};function na(e){return e?e.replace(/(\n+\s*)+/g,`
151
- `):""}function zh(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])}zh.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=cs(this.array,e,this.options))||(t=cs(this._keep,e,this.options))||(t=cs(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 cs(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(FE(i,t,n))return i}}function FE(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 AE(e){var t=e.element,n=e.isBlock,r=e.isVoid,i=e.isPre||function(h){return h.nodeName==="PRE"};if(!(!t.firstChild||i(t))){for(var a=null,s=!1,o=null,l=Uc(o,t,i);l!==t;){if(l.nodeType===3||l.nodeType===4){var u=l.data.replace(/[ \r\n\t]+/g," ");if((!a||/ $/.test(a.data))&&!s&&u[0]===" "&&(u=u.substr(1)),!u){l=ds(l);continue}l.data=u,a=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(a&&(a.data=a.data.replace(/ $/,"")),a=null,s=!1):r(l)||i(l)?(a=null,s=!0):a&&(s=!1);else{l=ds(l);continue}var d=Uc(o,l,i);o=l,l=d}a&&(a.data=a.data.replace(/ $/,""),a.data||ds(a))}}function ds(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Uc(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var nu=typeof window<"u"?window:{};function BE(){var e=nu.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function TE(){var e=function(){};return SE()?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 SE(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{nu.ActiveXObject&&(e=!0)}return e}var jE=BE()?nu.DOMParser:TE();function OE(e,t){var n;if(typeof e=="string"){var r=PE().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return AE({element:n,isBlock:eu,isVoid:Rh,isPre:t.preformattedCode?ME:null}),n}var fs;function PE(){return fs=fs||new jE,fs}function ME(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function NE(e,t){return e.isBlock=eu(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=IE(e),e.flankingWhitespace=RE(e,t),e}function IE(e){return!Rh(e)&&!_E(e)&&/^\s*$/i.test(e.textContent)&&!EE(e)&&!kE(e)}function RE(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=$E(e.textContent);return n.leadingAscii&&Wc("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Wc("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function $E(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 Wc(e,t,n){var r,i,a;return e==="left"?(r=t.previousSibling,i=/ $/):(r=t.nextSibling,i=/^ /),r&&(r.nodeType===3?a=i.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?a=!1:r.nodeType===1&&!eu(r)&&(a=i.test(r.textContent))),a}var LE=Array.prototype.reduce,zE=[[/\\/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:ct,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
150
+ `,this.references=[]),t}};ft.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};ft.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};ft.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}};ft.image={filter:"img",replacement:function(e,t){var n=ra(t.getAttribute("alt")),r=t.getAttribute("src")||"",i=ra(t.getAttribute("title")),a=i?' "'+i+'"':"";return r?"!["+n+"]("+r+a+")":""}};function ra(e){return e?e.replace(/(\n+\s*)+/g,`
151
+ `):""}function Ym(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])}Ym.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=cs(this.array,e,this.options))||(t=cs(this._keep,e,this.options))||(t=cs(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 cs(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(SE(i,t,n))return i}}function SE(e,t,n){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function jE(e){var t=e.element,n=e.isBlock,r=e.isVoid,i=e.isPre||function(m){return m.nodeName==="PRE"};if(!(!t.firstChild||i(t))){for(var a=null,s=!1,o=null,l=Yc(o,t,i);l!==t;){if(l.nodeType===3||l.nodeType===4){var u=l.data.replace(/[ \r\n\t]+/g," ");if((!a||/ $/.test(a.data))&&!s&&u[0]===" "&&(u=u.substr(1)),!u){l=ds(l);continue}l.data=u,a=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(a&&(a.data=a.data.replace(/ $/,"")),a=null,s=!1):r(l)||i(l)?(a=null,s=!0):a&&(s=!1);else{l=ds(l);continue}var d=Yc(o,l,i);o=l,l=d}a&&(a.data=a.data.replace(/ $/,""),a.data||ds(a))}}function ds(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Yc(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var au=typeof window<"u"?window:{};function PE(){var e=au.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function OE(){var e=function(){};return ME()?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 ME(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{au.ActiveXObject&&(e=!0)}return e}var NE=PE()?au.DOMParser:OE();function IE(e,t){var n;if(typeof e=="string"){var r=RE().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return jE({element:n,isBlock:ru,isVoid:Hm,isPre:t.preformattedCode?$E:null}),n}var fs;function RE(){return fs=fs||new NE,fs}function $E(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function LE(e,t){return e.isBlock=ru(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=zE(e),e.flankingWhitespace=qE(e,t),e}function zE(e){return!Hm(e)&&!BE(e)&&/^\s*$/i.test(e.textContent)&&!AE(e)&&!TE(e)}function qE(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=UE(e.textContent);return n.leadingAscii&&Gc("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Gc("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function UE(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 Gc(e,t,n){var r,i,a;return e==="left"?(r=t.previousSibling,i=/ $/):(r=t.nextSibling,i=/^ /),r&&(r.nodeType===3?a=i.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?a=!1:r.nodeType===1&&!ru(r)&&(a=i.test(r.textContent))),a}var WE=Array.prototype.reduce,VE=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Jr(e){if(!(this instanceof Jr))return new Jr(e);var t={rules:ft,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 @@ ${m}${h?"1.":"-"} ${u}${p?`
158
158
 
159
159
  `+n+`
160
160
 
161
- `:n}};this.options=xE({},t,e),this.rules=new zh(this.options)}Gr.prototype={turndown:function(e){if(!WE(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=qh.call(this,new OE(e,this.options));return qE.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 zE.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function qh(e){var t=this;return LE.call(e.childNodes,function(n,r){r=new NE(r,t.options);var i="";return r.nodeType===3?i=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(i=UE.call(t,r)),Uh(n,i)},"")}function qE(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=Uh(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function UE(e){var t=this.rules.forNode(e),n=qh.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 Uh(e,t){var n=wE(e),r=CE(t),i=Math.max(e.length-n.length,t.length-r.length),a=`
161
+ `:n}};this.options=EE({},t,e),this.rules=new Ym(this.options)}Jr.prototype={turndown:function(e){if(!ZE(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=Gm.call(this,new IE(e,this.options));return HE.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 VE.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function Gm(e){var t=this;return WE.call(e.childNodes,function(n,r){r=new LE(r,t.options);var i="";return r.nodeType===3?i=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(i=KE.call(t,r)),Qm(n,i)},"")}function HE(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=Qm(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function KE(e){var t=this.rules.forNode(e),n=Gm.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 Qm(e,t){var n=kE(e),r=_E(t),i=Math.max(e.length-n.length,t.length-r.length),a=`
162
162
 
163
- `.substring(0,i);return n+a+r}function WE(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var VE={isHistory(e){return st(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||gn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||gn.isOperationList(e.undos[0].operations))}},hs=new WeakMap,ms=new WeakMap,er={isHistoryEditor(e){return VE.isHistory(e.history)&&x.isEditor(e)},isMerging(e){return ms.get(e)},isSaving(e){return hs.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=er.isMerging(e);ms.set(e,!1),t(),ms.set(e,n)},withoutSaving(e,t){var n=er.isSaving(e);hs.set(e,!1),t(),hs.set(e,n)}},HE=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:i}=r;if(i.length>0){var a=i[i.length-1];a.selectionBefore&&X.setSelection(t,a.selectionBefore),er.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{for(var s of a.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",a)}},t.undo=()=>{var{history:r}=t,{undos:i}=r;if(i.length>0){var a=i[i.length-1];er.withoutSaving(t,()=>{x.withoutNormalizing(t,()=>{var s=a.operations.map(gn.inverse).reverse();for(var o of s)t.apply(o);a.selectionBefore&&X.setSelection(t,a.selectionBefore)})}),t.writeHistory("redos",a),r.undos.pop()}},t.apply=r=>{var{operations:i,history:a}=t,{undos:s}=a,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=er.isSaving(t),d=er.isMerging(t);if(u==null&&(u=ZE(r)),u){if(d==null&&(o==null?d=!1:i.length!==0?d=!0:d=KE(r,l)),o&&d)o.operations.push(r);else{var h={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",h)}for(;s.length>100;)s.shift();a.redos=[]}n(r)},t.writeHistory=(r,i)=>{t.history[r].push(i)},t},KE=(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)),ZE=(e,t)=>e.type!=="set_selection";const YE=(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 i=r.node;if(i.link){const a=new CustomEvent("linkRemoved",{detail:{url:i.link}});window.dispatchEvent(a)}}n(r)}}catch(r){const i=r.message;t(`Error in withLinkRemovalListener: ${i}`)}return e};var GE=e_,QE=/^(?:\w+:)?\/\/(\S+)$/,JE=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,XE=/^[^\s\.]+\.\S{2,}$/;function e_(e){if(typeof e!="string")return!1;var t=e.match(QE);if(!t)return!1;var n=t[1];return n?!!(JE.test(n)||XE.test(n)):!1}const t_=Nn(GE),n_=(e,t,n)=>{const{insertText:r,isInline:i}=e;try{e.isInline=a=>{const s=a;return[H.link].includes(s.type)||i(a)},e.insertText=a=>{a&&t_(a)?Xo(e,a,t):r(a)}}catch(a){const s=a.message;n(`Error in withInlines: ${s}`)}return e},r_=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:i}=e;try{e.isInline=a=>a.type===H.mention?!0:n(a),e.isVoid=a=>a.type===H.mention?!0:r(a),e.markableVoid=a=>a.type===H.mention||i(a)}catch(a){const s=a.message;t(`Error in withMentions: ${s}`)}return e},i_=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,i])=>{if(r.type===H.link&&le.string(r).trim()===""){X.removeNodes(e,{at:i});return}n([r,i])}}catch(r){const i=r.message;t(`Error in withoutEmptyLinks: ${i}`)}return e};const ru=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:i,functions:a,autoFocus:s,data:o,styling:l,...u})=>{const d=re.useIntl(),h=Om();typeof s>"u"&&(s=!0);const{isInOverlay:p=!1}=i||{},{listMembers:m,clickMentionFallback:v,onChange:f=()=>{},onChangeData:b=()=>{},getLinkPreview:g=()=>Promise.resolve({}),onMention:D=()=>{},reportError:w=S=>{console.error(S)}}=a||{},F=[{type:H.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const E={editorKey:null,originalValue:t||"",initialValue:t?null:F,tabbableOption:ta[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:R,originalValue:P,initialValue:z,stringValue:$,lastAnchor:B,lastKey:A,hasInteracted:j,hasLoaded:M,enrichedUrl:U,mentionPopover:W}=k,ie=S=>{S&&T([{type:"tabbableOption",value:S||ta[0]}])},ae=async S=>{const L=await g(S);L.url&&T([{type:"enrichedUrl",value:L}])},C=`rte-${e}`,G=y.useCallback(S=>c.jsx($v,{...S}),[]),ne=y.useCallback(S=>c.jsx(Lv,{...S}),[]),_=y.useMemo(()=>YE(n_(r_(i_(HE(kC(Bx())),w),w),C,w),w),[]),O=S=>{if(!_||S!==C)return;const L=x.end(_,[]);X.select(_,L),te.focus(_)};y.useEffect(()=>{const S=L=>{var J;const Q=L,K=((J=Q==null?void 0:Q.detail)==null?void 0:J.id)||null;K&&O(K)};return window.addEventListener("focusEditor",S),()=>{window.removeEventListener("focusEditor",S)}},[]),y.useEffect(()=>{if(_.children.length>0&&!M){if(T([{type:"hasLoaded",value:!0}]),!s)return;O(C)}},[_.children.length,z]),y.useEffect(()=>{P&&(async()=>{let L=Pt(P);if(L.includes("<")){Gr.prototype.escape=K=>K;const Q=new Gr;Q.addRule("br",{filter:["br"],replacement:K=>K+`
163
+ `.substring(0,i);return n+a+r}function ZE(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var YE={isHistory(e){return ot(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||gn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||gn.isOperationList(e.undos[0].operations))}},ms=new WeakMap,hs=new WeakMap,tr={isHistoryEditor(e){return YE.isHistory(e.history)&&w.isEditor(e)},isMerging(e){return hs.get(e)},isSaving(e){return ms.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=tr.isMerging(e);hs.set(e,!1),t(),hs.set(e,n)},withoutSaving(e,t){var n=tr.isSaving(e);ms.set(e,!1),t(),ms.set(e,n)}},GE=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:i}=r;if(i.length>0){var a=i[i.length-1];a.selectionBefore&&X.setSelection(t,a.selectionBefore),tr.withoutSaving(t,()=>{w.withoutNormalizing(t,()=>{for(var s of a.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",a)}},t.undo=()=>{var{history:r}=t,{undos:i}=r;if(i.length>0){var a=i[i.length-1];tr.withoutSaving(t,()=>{w.withoutNormalizing(t,()=>{var s=a.operations.map(gn.inverse).reverse();for(var o of s)t.apply(o);a.selectionBefore&&X.setSelection(t,a.selectionBefore)})}),t.writeHistory("redos",a),r.undos.pop()}},t.apply=r=>{var{operations:i,history:a}=t,{undos:s}=a,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=tr.isSaving(t),d=tr.isMerging(t);if(u==null&&(u=JE(r)),u){if(d==null&&(o==null?d=!1:i.length!==0?d=!0:d=QE(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();a.redos=[]}n(r)},t.writeHistory=(r,i)=>{t.history[r].push(i)},t},QE=(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)),JE=(e,t)=>e.type!=="set_selection";const XE=(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 i=r.node;if(i.link){const a=new CustomEvent("linkRemoved",{detail:{url:i.link}});window.dispatchEvent(a)}}n(r)}}catch(r){const i=r.message;t(`Error in withLinkRemovalListener: ${i}`)}return e};var e_=i_,t_=/^(?:\w+:)?\/\/(\S+)$/,n_=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,r_=/^[^\s\.]+\.\S{2,}$/;function i_(e){if(typeof e!="string")return!1;var t=e.match(t_);if(!t)return!1;var n=t[1];return n?!!(n_.test(n)||r_.test(n)):!1}const a_=In(e_),s_=(e,t,n)=>{const{insertText:r,isInline:i}=e;try{e.isInline=a=>{const s=a;return[H.link].includes(s.type)||i(a)},e.insertText=a=>{a&&a_(a)?nu(e,a,t):r(a)}}catch(a){const s=a.message;n(`Error in withInlines: ${s}`)}return e},o_=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:i}=e;try{e.isInline=a=>a.type===H.mention?!0:n(a),e.isVoid=a=>a.type===H.mention?!0:r(a),e.markableVoid=a=>a.type===H.mention||i(a)}catch(a){const s=a.message;t(`Error in withMentions: ${s}`)}return e},u_=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,i])=>{if(r.type===H.link&&le.string(r).trim()===""){X.removeNodes(e,{at:i});return}n([r,i])}}catch(r){const i=r.message;t(`Error in withoutEmptyLinks: ${i}`)}return e};const su=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:i,functions:a,autoFocus:s,data:o,styling:l,...u})=>{const d=re.useIntl(),m=zh();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=i||{},{listMembers:p,clickMentionFallback:v,onChange:f=()=>{},onChangeData:b=()=>{},getLinkPreview:g=()=>Promise.resolve({}),onMention:x=()=>{},reportError:C=S=>{console.error(S)}}=a||{},F=[{type:H.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const D={editorKey:null,originalValue:t||"",initialValue:t?null:F,tabbableOption:na[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},[_,T]=y.useReducer(ei,D),{editorKey:R,originalValue:O,initialValue:z,stringValue:$,lastAnchor:A,lastKey:B,hasInteracted:j,hasLoaded:M,enrichedUrl:U,mentionPopover:W}=_,ie=S=>{S&&T([{type:"tabbableOption",value:S||na[0]}])},se=async S=>{const L=await g(S);L.url&&T([{type:"enrichedUrl",value:L}])},E=`rte-${e}`,ee=y.useCallback(S=>c.jsx(Uv,{...S}),[]),Z=y.useCallback(S=>c.jsx(Wv,{...S}),[]),k=y.useMemo(()=>XE(s_(o_(u_(GE(Tw(Px())),C),C),E,C),C),[]),P=S=>{if(!k||S!==E)return;const L=w.end(k,[]);X.select(k,L),ne.focus(k)};y.useEffect(()=>{const S=L=>{var te;const Q=L,Y=((te=Q==null?void 0:Q.detail)==null?void 0:te.id)||null;Y&&P(Y)};return window.addEventListener("focusEditor",S),()=>{window.removeEventListener("focusEditor",S)}},[]),y.useEffect(()=>{if(k.children.length>0&&!M){if(T([{type:"hasLoaded",value:!0}]),!s)return;P(E)}},[k.children.length,z]),y.useEffect(()=>{O&&(async()=>{let L=Ot(O);if(L.includes("<")){Jr.prototype.escape=Y=>Y;const Q=new Jr;Q.addRule("br",{filter:["br"],replacement:Y=>Y+`
164
164
 
165
- `}),L=Q.turndown(L)}o&&o.mentions&&(L=await pd({text:L,template:`[${Qs}{{name}}]({{id}})`,mentions:o.mentions,listMembers:m||(()=>Promise.resolve([]))})),nE(L,Q=>{const K=[{type:"initialValue",value:Q},{type:"editorKey",value:P.toString()}];o!=null&&o.link&&(K.push({type:"enrichedUrl",value:o.link}),o.link.url&&ae(o.link.url)),T(K),setTimeout(()=>{T([{type:"stringValue",value:Ic(_)}])},150)})})()},[P]),y.useEffect(()=>{if(U===void 0&&_){const L=aE(_);L&&ae(L)}const S=L=>{var J;const Q=L,K=((J=Q==null?void 0:Q.detail)==null?void 0:J.url)||null;K&&U&&U.url===K&&T([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",S),()=>{window.removeEventListener("linkRemoved",S)}},[U]),y.useEffect(()=>{if(t){Lr.lastIndex=0;const S=t.match(Lr);S&&S.length===1&&S[0].length===t.length&&!j&&T([{type:"originalValue",value:t}])}t!==""||!_||Ri(P,t)&&!j||(x.withoutNormalizing(_,()=>{X.delete(_,{at:{anchor:x.start(_,[]),focus:x.end(_,[])}}),X.deselect(_),_.children.length!==0&&X.unwrapNodes(_,{at:[0]}),X.insertNodes(_,F,{at:[0]})}),T([{type:"initialValue",value:F},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),y.useEffect(()=>{b({link:U})},[U]),y.useEffect(()=>{$===""&&U&&T([{type:"enrichedUrl",value:void 0}])},[$]);const q=rd(()=>{oE({editor:_,isShowing:W.show,numberOfUsers:W.numberOfUsers,listMembers:m,dispatch:T})},100);return z?c.jsx("div",{id:C,className:"rich-text-editor",children:c.jsxs(ln.Provider,{value:{...k,id:C,isInOverlay:p,setFocus:ie,dispatch:T,getLinkPreview:g,onMention:D,reportError:w},children:[c.jsxs(EC,{editor:_,initialValue:z,onChange:S=>{if(_.operations.some(Q=>Q.type!=="set_selection")){let Q=lE(S);Q==="<br>"&&(Q=""),f(Q,U),T([{type:"stringValue",value:Ic(_)}]),j||T([{type:"hasInteracted",value:!0}]),q(),h&&console.log({serialized:Q,json:S})}},...u,children:[c.jsx(pC,{className:"input",renderElement:G,renderLeaf:ne,placeholder:n||d.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async S=>{const L=U!==!1,Q=S.clipboardData.getData("text");if((J=>{try{return new URL(J),!0}catch{return!1}})(Q)){let J=Q;if(Q){const{full:ce}=co(Q);J=ce}if(Q&&g&&!L){const ce=await g(J);ce.url&&T([{type:"enrichedUrl",value:ce}])}}},onKeyDown:S=>{if(S.key==="Enter"){W.show&&(S.preventDefault(),S.stopPropagation(),Bh(_,W,T,C));const{selection:L}=_;if(L){const Q=Y.isCollapsed(L),[K,J]=x.node(_,L,{depth:1});let ce=K,ee=ce.type;const pe=ce.children[0];if(pe&&(pe==null?void 0:pe[H.h3])===!0&&(S.stopPropagation(),S.preventDefault(),X.insertNodes(_,F)),pe&&[H.ol,H.ul].includes(pe.type)&&(ce=pe,ee=pe.type),ce&&fe.isElement(ce)&&ee!==H.paragraph){if(ee===H.blockquote&&!S.shiftKey){S.stopPropagation(),S.preventDefault(),X.insertNodes(_,F);return}if(Q){const[ve,Ee]=x.parent(_,L,{edge:"end"}),Fe=ve.type;if([H.ul,H.ol].includes(ee))if(S.stopPropagation(),S.preventDefault(),Fe===H.li&&A==="Enter"){ve.children.length===1&&"text"in ve.children[0]&&ve.children[0].text===""&&X.removeNodes(_,{at:Ee}),X.insertNodes(_,F,{at:I.next(J)}),X.select(_,x.end(_,I.next(J)));return}else{const[We,Me]=rE(_,H.li),ze={type:H.li,children:[{text:""}]};X.insertNodes(_,ze,{at:I.next(Me)}),X.select(_,x.end(_,I.next(Me)))}}}}}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:L,possibleUsers:Q}=W;let K=S.key==="ArrowUp"?L-1:L+1;K<0&&(K=Q.length-1),K>=Q.length+1&&(K=0),T([{type:"mentionPopover",value:{...W,selectedUser:K}}])}T([{type:"lastKey",value:S.key}]),sE(S,_,T,w)},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 L=0;if(ge.isText(S)?L=S.text.length:S.children&&(L=S.children.length),B.offset>L)return;try{X.select(_,{anchor:B,focus:B})}catch(Q){const K=Q.message;w(`Error focusing editor: ${K}`)}}}}),U?c.jsx(Fo,{data:U,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:U.title||d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(yE,{styling:l==null?void 0:l.toolbar}),m?c.jsx(cE,{onFallbackClick:v}):c.jsx(c.Fragment,{})]},R),c.jsx(Bo,{id:`character-limit-${e}`,limit:r,valueLength:ma($)})]})}):c.jsx(c.Fragment,{})};const a_=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:i=()=>{}},isDisabled:a=!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=>{a||(l(d),i(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:a,on:o===n[1].value}),children:n.map(d=>{const h=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:h,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:a}),c.jsx("label",{htmlFor:h,children:d.label})]},h)})})]})};function Wh({className:e="",userId:t,userName:n,src:r,uploadImage:i,button:a,callback:s}){const o=re.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[h,p]=y.useState(!1),[m,v]=y.useState(!1),f=y.useRef(null),b=async F=>{p(!0),v(!1);try{const E=F.target.files&&F.target.files[0];if(!E||!t)throw p(!1),new Error("Image file or userID is missing");const k=await i({fileObject:E,userId:t}),T={thumbnail:k.thumbnailURL,full:k.originalURL};d(T),s(T)}catch{v(!0)}finally{p(!1)}p(!1)},{upload:g=o.formatMessage({id:`${l}cta_upload`}),change:D=o.formatMessage({id:`${l}cta_change`}),uploading:w=o.formatMessage({id:`${l}cta_uploading`})}=(a==null?void 0:a.text)||{};return c.jsxs("div",{className:V("profile-image-change-figure",e),children:[c.jsx(on,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),m&&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(ke,{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:h,children:h?w:u?D:g})]})}const Vh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:i="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:i},functions:{onSuccess:t,onFailure:n},button:{className:"new"}})};const s_=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=re.useIntl();return c.jsx(xm.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:i=>{t(i),n(!i.length)},autoFocus:!1,getLabel:(i,a,s)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:i}),c.jsx(ke,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(a),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},a)})},Hh=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:i,labelColor:a,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:d="NOT_SUBMITTED"})=>{const[h,p]=y.useState([]),[m,v]=y.useState(!0),[f,b]=y.useState(d),{formatMessage:g}=re.useIntl(),D=async E=>{try{await u(h,E.message),p([]),b("SUCCESS")}catch(k){b("ERROR"),l(k)}},w=E=>{E.preventDefault(),b("NOT_SUBMITTED"),v(!0),p([])},F=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:g({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",g({id:"inviteForm_error"})]})}),c.jsx(qt,{}),c.jsx("div",{className:"footer",children:f==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(ke,{variant:"secondary",onClick:w,children:g({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(ke,{onClick:F,children:g({id:"inviteForm_ctaDone"})})]}):c.jsx(ke,{onClick:w,children:g({id:"inviteForm_ctaTryAgain"})})})]}):c.jsxs("div",{className:"invite-form-wrapper",style:{backgroundColor:s},children:[c.jsxs("div",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:i},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t})]}),c.jsx(Jt,{id:"invite-form",fields:[{component:s_,props:{emails:h,setEmails:p,setIsDisabled:v},required:!0},{id:"message",type:"textarea",label:g({id:"inviteForm_message_label"}),placeholder:n||g({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:D},button:{text:r,size:"medium",disabled:m}})]})},Ii=e=>e.map(t=>({condition:t})),St={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},o_=({functions:e,...t})=>{const{formatMessage:n}=re.useIntl(),[r,i]=y.useState(null),[a,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[St.NEW_PASSWORD]!==m[St.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=m=>!Bs(m[St.NEW_PASSWORD]).isValid,h=[{"data-testid":St.NEW_PASSWORD,id:St.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Ii(["required",d]),functions:{onChange:m=>l(Bs(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":St.CONFIRMED_PASSWORD,id:St.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Ii(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":St.CURRENT_PASSWORD,id:St.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Ii(["required"])}),a&&h.push({component:xf,props:{matchingRules:o}});const p={id:St.FORM_ID,fields:h,functions:{...e,onSuccess:async m=>(e.createPassword(m),e.onSuccess&&e.onSuccess(m)),onCatch:m=>i(m==null?void 0:m.statusCode),onFailure:(m,v)=>{(v.includes(St.NEW_PASSWORD)||v.includes(St.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Jt,{...p}),r&&c.jsx(xn,{variant:"error",text:r})]})};const Kh=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:i,...a})=>{var R;const s=re.useIntl(),o="profileForm_",l=y.useContext(at),[u,d]=y.useState(l.image),[h,p]=y.useState(!1),{uploadImage:m=()=>{},onSuccess:v=async P=>{},onCancel:f=()=>{},onFailure:b=()=>{}}=n,{buildLocation:g,isValidPlace:D,predictPlaces:w}=t.useMaps(),{context:F="ProfileForm",event:E="profile-form-submit-click"}=i||{},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:(R=l.location)==null?void 0:R.en,validation:[{condition:"required"},{condition:({location:P})=>P&&!h?!1:!D(P),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{h||p(!0)},onKeyInput:w}}],T=[{component:Wh,props:{userName:l.name,userId:l.id,src:u,uploadImage:m,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:qt}];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:F,event:E},functions:{onSuccess:async P=>{try{const z={...P,image:u||null,location:h?await g(P==null?void 0:P.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails($=>({...$,...z})),await v(z)}catch{b()}},onCancel:f,onFailure:b},button:{size:"large",text:{default:s.formatMessage({id:`${o}cta`}),submitting:s.formatMessage({id:`${o}cta_submitting`}),submitted:s.formatMessage({id:`${o}cta_submitted`})}},...a})},u_=()=>{const e=re.useIntl(),[t,n]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>{n(i=>{if(i>=95)return clearInterval(r),95;const a=Math.round(Math.random()*10);return Math.min(i+a,95)})},800);return()=>{clearInterval(r)}},[]),c.jsx(Pd,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};let ps=null;const ut="publishArticleForm_",Vc={},Hc=10,l_=({id:e="publish-article-form",values:t=Vc,functions:n,meta:r,gtm:i})=>{const a=re.useIntl(),s=y.useContext(at),{create:o,onSuccess:l=()=>{},onFailure:u=()=>{}}=n||{},{isInOverlay:d=!1}=r||{},[h,p]=y.useState(!1),[m,v]=y.useState(t.body||""),[f,b]=y.useState(!1),[g,D]=y.useState("");y.useEffect(()=>{Ri(t,Vc)||Li(t.body)&&t.body!==m&&t.body!==void 0&&v(t.body)},[t.body]);const w=()=>{!s||!s.id?b(a.formatMessage({id:`${ut}error_loggedOut`})):f&&b(!1)},F=R=>({condition:P=>{const z=P[R];return!z||typeof z!="string"?!0:z.length<Hc},error:a.formatMessage({id:`${ut}error_underMinLength`},{length:Hc})}),E=!!m&&Li(m),k=()=>c.jsxs(c.Fragment,{children:[c.jsx(qt,{}),c.jsx("p",{className:"text-medium",children:a.formatMessage({id:`${ut}disclaimer`})})]}),T=[{id:"title",type:"text",value:t.title||"",limit:65,label:a.formatMessage({id:`${ut}title_label`}),placeholder:a.formatMessage({id:`${ut}title_placeholder`}),functions:{onChange:w},validation:[{condition:"required"},F("title")]},{id:"subtitle",type:"text",value:t.subtitle,limit:115,label:a.formatMessage({id:`${ut}subtitle_label`}),placeholder:a.formatMessage({id:`${ut}subtitle_placeholder`}),functions:{onChange:w},validation:[{condition:"required"},F("subtitle")]},{component:Qo,props:{formID:e,label:{visible:a.formatMessage({id:`${ut}body_label`})},showLabel:!0}},{component:ru,props:{id:`${e}-input`,value:m,placeholder:a.formatMessage({id:`${ut}body_placeholder`}),meta:{isInOverlay:d},autoFocus:!1,functions:{onChange:R=>{v(R),w()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!f,"aria-errormessage":"error-message"}}];return h?T.push({component:qt}):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 R=>{if(!s||!s.id||!E)return;ps&&clearTimeout(ps),p(!0);const P={...R,body:m};try{o&&await o(P),ps=setTimeout(()=>{D(a.formatMessage({id:`${ut}aria_success`})),l(P)},500)}catch{b(a.formatMessage({id:`${ut}error`})),D(""),u()}},onFailure:u},fields:T,intlPath:ut,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":i==null?void 0:i.context,"data-gtm-event-type":"publish-article-click",disabled:!s||!s.id||!E,text:{default:a.formatMessage({id:`${ut}cta_submit`}),submitting:a.formatMessage({id:`${ut}cta_submitting`}),submitted:a.formatMessage({id:`${ut}cta_submitted`})},customOnSubmit:f?c.jsx(c.Fragment,{}):c.jsx(u_,{})},gtm:i}),f&&c.jsx(sr,{id:"error-message",className:"error",children:typeof f=="string"&&f.includes(" ")?f:a.formatMessage({id:`${ut}error`})}),g&&c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,children:g})]})};const Zh=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:i="search-bar",gtmEvent:a="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=re.useIntl(),u=y.useRef(null);ar(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=h=>{h.preventDefault(),h.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":i,"data-gtm-event-type":a,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:h=>{h.key==="Enter"&&d(h)}}),c.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.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"})})})]})})})},Kc=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const i=e.current.value.toString().toLowerCase().trim(),a={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},a);try{s=await t(i),s===void 0&&(s=a)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:i,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved: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:i,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(i)}},{type:"validFields.email",value:!0}])},c_=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"]}},d_=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:i,state:a})=>{if(!e.form||!e.form.current)throw new Error("No refs.form");if(!e.form.current.checkValidity()){e.hiddenValidation&&e.hiddenValidation.current&&e.hiddenValidation.current.click();return}const s=c_(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...a.values}),i([{type:"showSuccessMessage",value:!0}])},f_=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:i},refs:a,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,h=(m,v)=>{m.current&&s.validFields[v]!==m.current.validity.valid&&o([{type:`validFields.${v}`,value:m.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:a.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>h(a.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:a.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Kc({ref:a.email,validateEmail:r,dispatch:o})},onChange:(m,v)=>{o([{type:"shouldDisableButton",value:!0}]),v&&v({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:mf,props:{email:d.email,type:d.boxType,resendVerificationCode:i}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:a.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>h(a.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:a.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{h(a.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:m=>c.jsx("small",{children:m})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:m=>c.jsx("small",{className:"notes text-small",children:m})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:a.tc,label:u.formatMessage({id:"signup_terms"},{terms:m=>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:m}),privacy:m=>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:m})}),shownValue:"accepted",functions:{onChange:m=>{if(!m)return;const v=[];["name","email"].forEach(f=>{s.validFields[f]!==a[f].current.validity.valid&&(v.push({type:`validFields.${f}`,value:a[f].current.validity.valid}),f==="email"&&Kc({ref:a.email,validateEmail:r,dispatch:o}))}),v.length&&o(v)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const h_=({className:e=""})=>c.jsxs("div",{className:V("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(re.FormattedMessage,{id:"signup_success_title"})}),c.jsx(re.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const m_={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},p_=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:i={},submitButton:a,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=re.useIntl(),{title:u=!0,expectation:d=!1,url:h=!0,logInButton:p=!0,successMessage:m=!0}=i,v={title:u,expectation:d,url:h,logInButton:p,successMessage:m},[f,b]=y.useReducer(Jr,m_),{validFields:g,emailDetails:D,shouldManuallyApprove:w,shouldDisableButton:F,showSuccessMessage:E,showError:k}=f,[T,R]=so.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(()=>{w===!0&&P.jobTitle.current&&P.jobTitle.current.focus()},[w]),y.useEffect(()=>{T["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[T]),y.useEffect(()=>{E&&T["functional-cookie-consent"]&&R("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const z=y.useMemo(()=>f_({placeholders:n,labels:t,shouldShow:v,functions:r,refs:P,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,P,v,f]),$=F?!0:w?!Object.values(g).every(B=>B===!0):!g.name||!g.email||["exists","pending","verify"].includes(D.boxType);return v.successMessage&&E?c.jsx(h_,{className:e}):c.jsxs("fieldset",{className:V("signup-form-fieldset",e),"data-testid":"signup-form",children:[v.title&&c.jsx("p",{className:"signup-title",children:c.jsx(re.FormattedMessage,{id:"signup_title"})}),k&&c.jsx(xn,{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:a||l.formatMessage({id:"signup_button_join"}),disabled:$?{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:v.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await d_({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 Dn=({children:e,className:t="",styling:n={},...r})=>{const{background:i="default",padding:a="none"}=n;return c.jsx("section",{className:V("full-width-section",t,{[i]:i!=="default",[a]:a!=="none"}),...r,children:e})};const g_=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(i=>{r.push({href:i.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable new","data-gtm-event-type":"download-click","data-gtm-event-context":i.eventContext||"Download",target:"_blank",children:i.text})}),c.jsx(Dn,{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(hr,{buttons:r})]})})};const ao="editSection_";function Yh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const v_=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:i,setShowModal:a})=>{const{formatMessage:s}=re.useIntl();return c.jsxs(kt,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${ao}placeholder_description`})}),i&&c.jsx("p",{children:c.jsx(ke,{href:r,variant:"secondary",size:"small",onClick:()=>Yh({href:r,setShowModal:a}),children:n||s({id:`${ao}placeholder_cta`})})})]})},b_=({children:e,className:t="",formProps:n,formComponent:r,href:i,title:a,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=re.useIntl(),[h,p]=y.useState(!1),m=()=>p(!1),v=!!n||!!r,f=typeof i=="string"||v;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async g=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(g)}finally{m()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),m()}}})),c.jsxs("section",{className:V("edit-section",t),children:[v&&c.jsx(un,{title:o||`Edit ${a}`,isOpen:h,showDivider:!1,showIcon:!1,functions:{onClose:m},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 g=>{var D,w;(D=n==null?void 0:n.functions)!=null&&D.onSuccess&&await((w=n==null?void 0:n.functions)==null?void 0:w.onSuccess(g)),p(!1)},onCancel:m}}):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:a}),f&&c.jsx(ke,{href:i,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Yh({href:i,setShowModal:p}),children:d({id:`${ao}edit`})})]}),e||c.jsx(v_,{...l,href:i,setShowModal:p,showEditButton:f}),u&&c.jsx(qt,{})]})};const y_=({title:e=!1,text:t,logos:n=[],styling:r={},className:i=""})=>{const a=n.length;if(a===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:V("logos",i,`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":a===2||a===4,"three-col":a===5||a<=10&&a%3===0}),children:n.map(({logo:d,nameOfBusiness:h,link:p=!1,description:m=!1},v)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:h});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:p?c.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),m&&c.jsx("small",{children:m})]},window.btoa(`${d.url}_${v}`))})})]})};let gs;const vs="contactFooter_",x_=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,i]=y.useState(0),[a,s]=y.useState(!1),o=()=>{n.current&&i(n.current.clientHeight)},l=()=>{a||(s(!0),clearTimeout(gs),gs=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(gs),window.removeEventListener("resize",l)}),[]),c.jsx(Dn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(re.FormattedMessage,{id:`${vs}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:a?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(re.FormattedMessage,{id:`${vs}text`})}),c.jsx(yn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(re.FormattedMessage,{id:`${vs}email`})})]}),c.jsx(Vh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},C_=({activeLink:e,profile:t,...n})=>c.jsx(Dn,{children:c.jsx(ff,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(df,{activeLink:e,profile:t}),c.jsx(wd,{...n})]})})});const bs="cookieBanner_",ys=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],xs=new Date(Date.now()+12*30*24*60*60*1e3),Gh=()=>{const e=re.useIntl(),[t,n,r]=so.useCookies(ys),[i,a]=y.useState(!t["apol-cookie-banner"]),s=()=>{ys.forEach(d=>{n(d,!0,{path:"/",expires:xs,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),a(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:xs}),ys.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:xs});return}r(d)}),a(!1)};if(!i)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:`${bs}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${bs}title`})}),c.jsx("p",{children:e.formatMessage({id:`${bs}text`})}),c.jsx(hr,{buttons:u})]})},tn={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:Yn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Yn["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:Yn.support,gtmType:"concierge-email-click"},business:{email:Yn.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 tr="footer_",ra="SiteFooter",Zc=({group:e})=>{const t=tn[e].order||[];let n=!1;return"text"in tn[e]&&(n=tn[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(re.FormattedMessage,{id:`${tr}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:i,gtmType:a}=tn[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:i,className:"gtm-trackable","data-gtm-event-context":ra,"data-gtm-event-type":a,...s,children:c.jsx(re.FormattedMessage,{id:`${tr}${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(re.FormattedMessage,{id:`${tr}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(re.FormattedMessage,{id:`${tr}${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":ra,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},iu=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(oa,{element:"hr"}),c.jsx(Ao,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":ra,"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(Zc,{group:e}),Object.keys(tn[e]).includes("child")&&c.jsx(Zc,{group:tn[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(tn.social.order)&&tn.social.order.map(e=>{const t=tn.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":ra,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(re.FormattedMessage,{id:`${tr}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(re.FormattedMessage,{id:`${tr}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Le={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=a=>{const s=`logged${e?"In":"Out"}`;return t>=n[a][s]};let i={};return["navigation","search"].forEach(a=>{i[a]=r(a)}),i},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(i=>i===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:i=!1})=>{if(!i&&n[e]===t||!i&&e===_t.ACCOUNT&&t===!1&&n[_t.SITE]===!0)return;const a=Date.now();if(!i&&!t&&Le.handlerCalled[e]&&a-Le.handlerCalled[e]<500)return;Le.handlerCalled[e]=a;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case _t.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case _t.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case _t.ACCOUNT:o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const i=Xc(e[r],t);if(!(typeof i>"u")&&(!n||i[t]&&i[t].includes(n)||i.value&&i.value.includes(n)||i.toString().includes(n)))return e[r]}return e[0].children?Le.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:i})=>{var l;if(!t.current||!t.current.children)return;const a=n?"desktop":"default";if(r[e][a]){(l=document.querySelector(`#header ul a[href="${r[e][a]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case _t.SITE:if(n){const u=Le.findFirstChild(t.current.children,"className","has-submenu parent"),d=Le.findFirstChild(u.children,"id",_t.SITE);s=Le.findFirstChild(d.children,"href")}else s=Le.findFirstChild(t.current.children,"href");break;case _t.ACCOUNT:if(o=Le.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Le.findFirstChild(o.children,"href");break;default:return}s&&(i([{type:`focusElements.${e}.${a}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Le.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Le.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Le.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Le.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"}}}},ia=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:a=null})=>{const s=re.useIntl(),o=Xc(Qr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=a===null?l?o.doTrack:!0:a,d=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let w=o.gtmType||`${e}-click`;if(w.includes(".")){const F=w.split("."),E=F[F.length-2];w=`${E==="topics"?`${E}-`:""}${F[F.length-1]}`}p={href:o.withReturnTo?`${o.href}?returnTo=${window.location.pathname}`:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":w,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const m=o.order&&o.order[0]&&o[o.order[0]],v=m&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let b={},g={},D={};if(f&&(b={...b,"aria-current":"page"}),m){const w=o.menuId||e,F={onClick:E=>Le.events.onClick(E,{id:w,callback:i,isOpen:r[w]}),onFocus:()=>Le.events.onFocus({id:w}),onBlur:()=>Le.events.onBlur({id:w,callback:i}),onMouseLeave:()=>Le.events.onBlur({id:w,callback:i}),onMouseEnter:()=>Le.events.onMouseEnter({id:w,callback:i})};g={...F,id:w===_t.SITE?_t.SITE:_t.ACCOUNT},n&&(v&&(D={...F,className:"navigation-button",onKeyPress:E=>{E.key==="Enter"&&Le.events.onClick(E,{id:w,callback:i,isOpen:r[w]})},"aria-haspopup":!0,"aria-expanded":r[w],"aria-controls":w}),g={...g,hidden:w in r?!r[w]:!0}),v||(g={...g})}return c.jsxs("li",{className:V({[o.className]:o.className,"has-submenu":m,parent:v,active:f}),...b,children:[p?y.createElement(d?ke:"a",p,s.formatMessage({id:h})):n&&o.order&&v?c.jsxs("button",{...D,children:[s.formatMessage({id:h}),c.jsx(Pe,{children:s.formatMessage({id:`header_menu_${r[_t.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:h}),o.order&&c.jsx("ul",{...g,children:o.order.map(w=>{if(!o[w])return null;const F={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:l?u:null};return o[w].order?c.jsxs("li",{className:V({[o[w].className]:o[w].className}),children:[s.formatMessage({id:`${h}_${w}`}),c.jsx("ul",{children:o[w].order.map(E=>c.jsx(ia,{id:`${e}.${w}.${E}`,...F},E))})]},w):c.jsx(ia,{id:`${e}.${w}`,...F},w)})})]},e)};const w_={height:67,height_desktop:83};var _t=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(_t||{});const au=({showNavigation:e=!0})=>{const t=re.useIntl(),n=y.useContext(at),r=In(!0,!0),i=n&&typeof n.id=="string",a=y.useMemo(()=>Le.getIsDesktopVersion(i,r),[i,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,h=y.useRef(s);y.useEffect(()=>{h.current=s},[s]),ad({scrollPosition:w_[`height${a.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const g=h.current.menus;!a&&g["site-navigation"]||Le.shouldChangeHeaderIsVisible(!0,g,o)},scrollDown:()=>{const g=h.current.menus;!a&&g["site-navigation"]||Le.shouldChangeHeaderIsVisible(!1,g,o)}}});const p=(g,D,w=!1)=>{Le.handleMenus({id:g,value:D,menus:h.current.menus,dispatch:o,forceHandle:w})},m=y.useRef(null),v=g=>{g.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(D=>{h.current.menus[D]&&p(D,!1,!0)})};y.useEffect(()=>{var g;return(g=document.getElementById("header"))==null||g.addEventListener("keydown",v),()=>{var D;(D=document.getElementById("header"))==null||D.removeEventListener("keydown",v)}},[]),ar(()=>{u["site-navigation"]&&Le.autoFocus({menu:"site-navigation",navigationRef:m,isDesktopVersion:a.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),ar(()=>{u["account-navigation"]&&Le.autoFocus({menu:"account-navigation",navigationRef:m,isDesktopVersion:a.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!a.search&&c.jsx("button",{className:"search toggle-search-button",onClick:g=>{g.preventDefault(),g.stopPropagation(),p("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(Zh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:a.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!a.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:g=>{g.preventDefault(),g.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Pe,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:m,id:"navigation",hidden:a.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!a.navigation&&u["account-navigation"]?"account":"default",children:Qr.order.map(g=>c.jsx(ia,{id:g,isLoggedIn:i,isDesktopVersion:a.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},g))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:V({"logged-in":i,"logged-out":!i,visible:l}),children:[c.jsx(Pe,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(Ao,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[a.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),i?c.jsxs("button",{className:"account-button",onClick:g=>Le.events.onClick(g,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>Le.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>Le.events.onBlur({id:"account-navigation",callback:p}),"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(on,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:Qr.buttons.order.map(g=>c.jsx(ia,{id:`buttons.${g}`},g))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:V("overlay",{open:u["site-navigation"]||u["account-navigation"]||!a.search&&u.search})})]})};const D_=()=>{const e=re.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(au,{}),c.jsx("div",{id:"content",children:c.jsx(xn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(iu,{})]})},Qh=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:a={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=i,{background:d="default",variant:h="default",circle:p="default",modal:m="default"}=a,v=nd(),[f,b]=y.useState(""),g=k=>{const{detail:{message:T}}=k;b(T)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",g),()=>{document.removeEventListener("ariaLive",g)}),[v]);const D=Ai(e,{locale:o}),w=Ai(t,{locale:o}),F=Ai(n,{locale:o}),E={};return d!=="default"&&(E[d]=!0),h!=="default"&&(E[h]=!0),p!=="default"&&(E[p]=!0),c.jsx(ym.ErrorBoundary,{onError:r,fallback:c.jsx(D_,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:V(s,E,{"has-footer":u}),children:[c.jsx(au,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[w&&c.jsx("div",{className:V("additional-content prepended",{"large-modal":m==="large"}),children:w}),y.createElement(d==="bold"?vo:"div",{id:"content",children:D,className:V({"large-modal":m==="large"})})]}),F&&c.jsx("div",{className:"additional-content appended",children:F}),u&&c.jsx(iu,{}),c.jsx(Gh,{})]}),f&&c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Yc={default:"tags_",headerTopics:"header_topics_topics_"},Cs={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"},E_={getTagDetails:e=>{if(e.includes("topic_")){if(e=Cs.topic[e.replace("topic_","")],e){const t=Qr.topics.topics[e].href;return t?{id:e,href:t,text:`${Yc.headerTopics}${e}`}:null}return null}return Cs[e]?(e=Cs[e],{id:e,text:`${Yc.default}${e}`}):null}};const __=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:a="tag-click",gtmContext:s="tags"})=>{const o=re.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=E_.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:V("tags text-small",t,i,{"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":a,"data-gtm-event-context":s,children:d}):d},u.id)})})};const Jh=25,k_=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:i=!1,loadNextPage:a=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:d=!1,className:h=""})=>{const p=re.useIntl(),m="membersList",v=y.useContext(at),[f,b]=y.useState(!1);return e.length===0&&!d?null:c.jsxs("div",{className:V("members-list",h),children:[u?c.jsxs("h1",{children:[p.formatMessage({id:m}),c.jsx("span",{className:"count",children:t})]}):c.jsx(c.Fragment,{}),c.jsxs("ul",{children:[r?c.jsxs("li",{children:[c.jsx(rn,{member:v,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:n||""},{scope:lt.Platform,area:"all"}]}}),c.jsx(yn,{href:"/profiles/me",className:"text-small",onClick:g=>{g==null||g.preventDefault(),g==null||g.stopPropagation(),b(!0)},children:p.formatMessage({id:`${m}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((g,D)=>c.jsxs("li",{children:[c.jsx(rn,{member:g,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:n||""},{scope:lt.Platform,area:"all"}]}}),g.isAdmin&&c.jsx(Yt,{children:p.formatMessage({id:`${m}_admin`})})]},D)),d&&e.length===0&&t>0?[...new Array(Math.min(t,Jh))].map((g,D)=>c.jsx("li",{children:c.jsx(da,{layout:"member"})},D)):c.jsx(c.Fragment,{})]}),i&&c.jsx(Xr,{hasNextPage:i,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(Da,{form:s,showModal:f,content:{title:p.formatMessage({id:`${m}_modal_title`})},functions:{onClose:()=>{b(!1)}}}):c.jsx(c.Fragment,{})]})},Xh=k_,F_=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const i=re.useIntl();return t?c.jsx("small",{children:$t(i.formatMessage,`${e}explainer`,n,"action",{a:a=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:a})})}):c.jsx(c.Fragment,{})},A_=({intlPath:e,type:t,...n})=>{const r=re.useIntl();return c.jsx(Qo,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:$t(r.formatMessage,`${e}label_action`,t,"action")},...n})},Gc=5,B_=2,T_=e=>{var r;let t=0;const n=[];return(r=e==null?void 0:e["poll-options"])==null||r.forEach((i,a)=>{i!==""&&(t++,n.push({position:t,description:{en:i}}))}),{title:{en:e.title},options:n,settings:{allow_multiple_votes:e["multiple-answers"]||!1}}};let Di=null;const Ye="discussion_form_",ti=({id:e,parentId:t,content:n={type:Be.Response,slugs:{}},userHasPermissions:r=!0,meta:i,placeholder:a,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},functions:u,data:d={},gtmContext:h="DiscussionForm"})=>{var qe,Z,oe;const p=re.useIntl(),m=y.useContext(at),[v,f]=y.useState(n.type),[b,g]=y.useState(""),{isLoading:D=!1,isInWrapper:w=!1,isInOverlay:F=!1,isAutoFocused:E=!1,isEditing:k=!1,hasTitleField:T=!1,canBePrepopulated:R=!1,isPrepopulated:P=!1,showTitle:z=!1,showGuidelines:$=!0,showDivider:B=!1,showSuccessMessage:A=!0,showPostType:j=!1,postCategories:M=[]}=i||{},{onChange:U=()=>{},create:W=()=>{},createPoll:ie=()=>{},handleSaveEdit:ae=()=>{},handleCancel:C=()=>{},callback:G=()=>{},onMention:ne=()=>{},listMembers:_=()=>Promise.resolve([]),clickMentionFallback:O=()=>{},getLinkPreview:q=()=>Promise.resolve({}),props:S={create:{projectNames:["questions-answers"]}}}=u,[L,Q]=y.useState({body:k&&k.text||P&&P.text||"",data:d!=null&&d.link?{link:d==null?void 0:d.link}:{}}),[K,J]=y.useState(l.error||!1),ce={status:!1,title:T&&T.text||"",polls:0},[ee,pe]=y.useState(ce);if(y.useEffect(()=>{R&&!k&&P&&P!==L.body&&Q(se=>({...se,body:P.text||""}))},[P]),y.useEffect(()=>{f(n.type)},[n.type]),D)return c.jsx(It,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const ve=(se,me)=>{Q(he=>({...he,body:se,data:{link:me}})),U({body:se});let be;!m||!m.id?be=$t(p.formatMessage,`${Ye}error_loggedOut`,v,"action"):r?s>0&&se.length>=s&&(be=`${Ye}error_tooLong`):be=$t(p.formatMessage,`${Ye}error_noPermission`,v,"action"),be?J(be):K&&J(!1)};let Ee=`${v}-form`;if(v===Be.Response||v===Be.Reply){const se=((qe=n.slugs)==null?void 0:qe.reply)||((Z=n.slugs)==null?void 0:Z.answer)||((oe=n.slugs)==null?void 0:oe.question)||"";se&&(Ee=`${Ee}-${se.slice(-15)}`)}e&&(Ee=`${e}-${Ee}`);const Ce=async se=>{if(!m||!m.id||!r||ze)return;Di&&clearTimeout(Di),pe(be=>({...be,status:"submitting"}));const me=window.location.pathname;try{let be;switch(v){case Be.Post:be=await W({title:se.title,content:se.body,categories:se.categories,data:se.data});break;case Be.Poll:be=await ie(T_(se));break;case Be.Question:be=await W({title:se.body,authorId:m&&m.id,data:se.data,...S==null?void 0:S.create});break;case Be.Response:be=await W({questionSlug:n.slugs.question},{body:se.body,authorId:m&&m.id,contentPath:me,data:se.data});break;case Be.Reply:be=await W({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:se.body,authorId:m&&m.id,contentPath:me,data:se.data});break;default:break}await jm(1e3),G&&await G(be),Di=setTimeout(()=>{Q({body:"",data:{}}),f(Be.Post),pe(xe=>({...xe,status:"submitted"})),g($t(p.formatMessage,`${Ye}success`,v,"action"));const he=new Event(nt.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(he),Fe()},500)}catch(be){const he=be;let xe=`${Ye}error`;he!=null&&he.message.includes("entry already exists")&&(xe=$t(p.formatMessage,`${Ye}error_alreadyExists`,v,"action")),he!=null&&he.message.includes("429")?xe=$t(p.formatMessage,`${Ye}error_tooMany`,v,"action"):he!=null&&he.message.includes("400")&&(xe=`${Ye}error`),J(xe),Fe()}},Fe=()=>{Di=setTimeout(()=>{J(!1),pe(ce),g("")},5e3)},We=!L.body||!Li(L.body),Me=!ee.title||!Li(ee.title);let ze=!1;v!==Be.Poll&&(ze=We),T&&(ze=ze&&Me);const Xe=ee.status==="submitting",Ae=[];v===Be.Poll?Ae.push({id:"poll-options",label:p.formatMessage({id:`${Ye}option_label`}),type:"multiple-inputs",placeholder:p.formatMessage({id:`${Ye}option_placeholder`}),multipleInputs:{showCount:!0,maxInputs:Gc,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:p.formatMessage({id:`${Ye}option_cta`})}},functions:{onChange:se=>{var be;let me=0;se&&Array.isArray(se)&&(me=((be=se==null?void 0:se.filter(he=>he!==""))==null?void 0:be.length)||0),ee.polls!==me&&pe(he=>({...he,polls:me})),U({polls:se})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:p.formatMessage({id:`${Ye}multiplePollAnswers`}),className:"text-medium"}):Ae.push({component:A_,props:{formID:Ee,intlPath:Ye,showLabel:T!==!1,type:v}},{component:ru,props:{id:`${Ee}-input`,value:ee.status==="submitting"&&!K?"":L.body,placeholder:a||$t(p.formatMessage,`${Ye}placeholder`,v,"action"),maxLength:s,meta:{isInOverlay:F},functions:{onChange:ve,onChangeData:se=>{Q(me=>({...me,data:se}))},onMention:ne,listMembers:_,clickMentionFallback:O,getLinkPreview:q},data:d,autoFocus:k!==!1||E&&!T,"aria-invalid":!!K,"aria-errormessage":"error-message"}},{component:F_,props:{intlPath:Ye,showGuidelines:$,type:v,gtmContext:h}}),B&&Ae.push({component:qt}),T&&Ae.unshift({id:"title",type:"text",value:T.text,limit:v===Be.Poll?0:250,label:p.formatMessage({id:`${Ye}${v===Be.Poll?"question":"titleField"}_label`}),placeholder:p.formatMessage({id:`${Ye}${v===Be.Poll?"question":"titleField"}_placeholder`}),functions:{onChange:se=>{pe(me=>({...me,title:se})),U({title:se})}},validation:v===Be.Poll?[{condition:"required"}]:[]}),j&&Ae.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:p.formatMessage({id:`${Ye}postType_label`}),options:M.map(se=>({id:se.slug,label:se.name})),validation:[{condition:"required"}],functions:{onChange:se=>{U({postType:se}),se.includes(Be.Poll)?f(Be.Poll):v!==Be.Post&&f(Be.Post)}}});let je=!m||!m.id||!r||Xe;if(v===Be.Poll){const se=ee.polls;je=je||Me||se<B_||se>Gc}else je=je||ze,k&&(T?je=je||L.body===k.text&&ee.title===T.text:je=je||L.body===k.text);return c.jsxs(c.Fragment,{children:[c.jsxs(Jt,{id:Ee,className:V("discussion-card discussion-form",{"no-styling":w&&k}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:k&&!Xe||l.cancel},functions:{onSuccess:async se=>{const me={...L,...se};if(k){pe(be=>({...be,status:"submitting"})),ae(me);return}await Ce(me)},onCancel:C},fields:Ae,intlPath:Ye,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":h,"data-gtm-event-type":`${k?"save":"submit"}-${v}-click`,"data-testid":"save-button",disabled:je,text:{default:!k&&(o!=null&&o.submit)?o==null?void 0:o.submit:p.formatMessage({id:`${Ye}${k?"save":"post"}`}),submitting:p.formatMessage({id:`${Ye}${k?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":h,"data-gtm-event-type":`cancel-${v}-click`,disabled:!l.cancel&&(!m||!m.id||!L.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:p.formatMessage({id:`${Ye}cancel`})},gtm:{context:h,event:`${v}-form`},"data-testid":`discussion-${v}-form`,children:[z&&!k&&v===Be.Question&&c.jsx("h2",{children:$t(p.formatMessage,`${Ye}title`,v,"action")}),c.jsx(rn,{member:m?{...m,link:!1}:"community",gtmContext:h,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:t||""},{scope:lt.Platform,area:"all"}]}})]}),ee.status==="submitted"&&A&&c.jsx(sr,{className:"success","data-testid":"success",children:$t(p.formatMessage,`${Ye}success`,v,"action")}),K&&c.jsx(sr,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof K=="string"?K.includes(" ")?K:p.formatMessage({id:K},{action:p.formatMessage({id:`discussion_action_${v}`}),maxLength:s}):K}),b&&c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,children:b})]})},S_=Object.freeze(Object.defineProperty({__proto__:null,default:ti},Symbol.toStringTag,{value:"Module"}));const j_={showForm:!1},wa=y.createContext(j_),em=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(wa.Provider,{value:{...t,updateConversation:n},children:e})};function O_({author:e,originalAuthorId:t,createdAt:n,contentData:r,content:i,gtmContext:a,badges:s}){var h;const o="discussion_",l=re.useIntl(),u=(h=i==null?void 0:i.componentProps)==null?void 0:h.member.additionalContent,d=u?u.customMessage:{};return c.jsxs("div",{className:"author-section",children:[c.jsx(rn,{member:e,additionalContent:{createdAt:n,didEdit:r.didEdit,customMessage:d},className:typeof e!="string"&&e.id===t?"highlighted":"",styling:{additionalContentNewLine:!!d},gtmContext:a,gtmType:"profile-click",badges:s}),i.pinned&&c.jsx(Yt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Pe,{children:l.formatMessage({id:`${o}pinned_post`})})})]})}const ws=({children:e,class:t,...n})=>{const r={...n,class:V("subtle",t)};return c.jsx("blockquote",{...r,children:e})};function P_({content:e}){var t;return(t=e.categories)!=null&&t.length?c.jsx("ul",{className:"categories-list",children:e.categories.map(n=>c.jsx(Yt,{size:"small",element:"li",children:n.name},n.slug))}):c.jsx(c.Fragment,{})}var aa=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(aa||{});const M_=(e,t,n)=>n===void 0?0:e.some(i=>i.hasUserVoted)?t?e.findIndex(i=>!i.hasUserVoted):e.findIndex(i=>i.hasUserVoted):0,N_=(e,t,n,r=0)=>{if(!e)return{nextElement:null,nextIndex:0};let i=n==="next"?e.nextElementSibling:e.previousElementSibling,a=r+(n==="next"?1:-1);for(;i;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}const s=e.parentElement;if(s)for(i=n==="next"?s.firstElementChild:s.lastElementChild,a=n==="next"?0:s.childElementCount-1;i&&i!==e;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}return{nextElement:null,nextIndex:0}};const I_=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:i=!1,showResults:a=!1,hasVotedOnPoll:s=!1,isTabbable:o=!1,functions:l})=>{var b;const[u,d]=y.useState(t.hasUserVoted);let h=0,p={};const m=(i||!s)&&!t.hasUserVoted;a&&(h=Math.round(t.numVotes/r*100)||0,p={"--vote-perc":`${h}%`});const v=g=>{g.stopPropagation(),m&&(l==null||l.createVote(t),d(!0))},f={htmlFor:t.id,className:V({"can-vote":m}),tabIndex:o&&m?0:-1,"data-testid":"poll-option-label","data-gtm-event-type":"poll-option-click","data-gtm-event-context":"PollOption","aria-selected":t.hasUserVoted,onClick:v,onKeyDown:g=>{var D;if(g.code!=="Tab")switch(g.code){case"Enter":case"Space":g.preventDefault(),g.stopPropagation(),v(g),d(!0);break;case"ArrowUp":case"ArrowDown":g.stopPropagation(),g.preventDefault();const w=g.code==="ArrowUp"?"prev":"next",{nextElement:F,nextIndex:E}=N_(g.currentTarget.parentElement,"selected",w,n);F&&((D=F.querySelector("label"))==null||D.focus(),l==null||l.setTabbableOption(E));break}}};return c.jsxs("li",{"data-testid":"poll-option",style:p,className:V("poll-option text-small",{selected:t.hasUserVoted}),children:[c.jsx("label",{...f,children:c.jsx("span",{children:t.label})}),a&&c.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&c.jsx(on,{className:"author-profile-picture",name:e.name,src:(b=e==null?void 0:e.image)==null?void 0:b.thumbnail}),c.jsxs("p",{className:"vote-perc text-medium","data-testid":"vote-perc",children:[h,"%"]})]}),c.jsx("input",{type:i?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const tm=({title:e,options:t,settings:n,functions:r})=>{const i="poll_",a=re.useIntl(),s=y.useContext(at),{show_remove_vote:o=!0,allow_multiple_votes:l=!1,results_visibility:u=aa.AfterVoting}=n||{},[d,h]=y.useState(M_(t,l,s==null?void 0:s.id)),p=t.reduce((g,D)=>g+D.numVotes,0),m=t.filter(g=>g.hasUserVoted).length,v=t.filter(g=>g.hasUserVoted),f=y.useCallback(async g=>{await r.createVote({reactionId:g.id})},[]),b=y.useCallback(async()=>{t.forEach(async g=>{g.hasUserVoted&&g.userVote&&r.removeVote({reactionId:g.userVote.id})})},[t]);return c.jsxs("div",{className:"poll-wrapper",children:[c.jsx("p",{className:"poll-title",children:e}),c.jsxs("aside",{className:"poll-info",children:[c.jsx("p",{className:"poll-instructions","data-testid":"poll-instructions",children:c.jsx("small",{children:a.formatMessage({id:`${i}instructions`},{allow_multiple_votes:l})})}),c.jsx("p",{className:"poll-num-votes",children:c.jsx("small",{"data-testid":"poll-total-votes",children:a.formatMessage({id:`${i}num_votes`},{number:p})})}),o&&c.jsx("p",{className:"poll-remove-vote",children:c.jsx(ke,{variant:"tertiary",onClick:b,"data-testid":"remove-votes-button",disabled:m===0,children:c.jsx("small",{children:a.formatMessage({id:`${i}remove_vote_button`},{number:m})})})})]}),t&&c.jsx("form",{children:c.jsx("fieldset",{children:c.jsx("ul",{className:"poll-options",children:t==null?void 0:t.map((g,D)=>c.jsx(I_,{isTabbable:d===D,user:s,option:g,optionIndex:D,totalPollVotes:p,showResults:u==aa.Always||!!m,allowMultipleVotes:l,hasVotedOnPoll:!!m,functions:{createVote:f,setTabbableOption:h}},g.id))})})}),c.jsxs(Pe,{"aria-live":"polite",children:[a.formatMessage({id:`${i}aria_votes`},{number:m}),!!m&&c.jsx("ul",{children:v.map(g=>c.jsx("li",{children:g.label}))})]})]})};function R_({content:e,contentData:t,functions:n}){return c.jsx(tm,{title:t.title,options:(e==null?void 0:e.pollOptions)||[],settings:(e==null?void 0:e.pollSettings)||{},functions:{createVote:n.createVote,removeVote:n.removeVote}})}function $_({links:e={},contentData:t,postCutOff:n,content:r}){var i;return c.jsxs(c.Fragment,{children:[e.post?c.jsxs("a",{href:e.post,children:[(t==null?void 0:t.title)&&c.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),t.postBody.length>n?c.jsx(Cd,{text:t.postBody,markdownOptions:{overrides:{a:Ss,blockquote:{component:ws}}}}):c.jsx(Sn,{options:{overrides:{a:Ss,blockquote:{component:ws}}},children:t.postBody})]}):c.jsxs(c.Fragment,{children:[(t==null?void 0:t.title)&&c.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),c.jsx(Sn,{options:{wrapper:r.type===Be.Question?"h1":y.Fragment,forceWrapper:r.type===Be.Question,forceInline:r.type===Be.Question,forceBlock:r.type!==Be.Question,overrides:{blockquote:{component:ws}}},children:t.postBody})]}),(i=t.data)!=null&&i.link?c.jsx(Fo,{data:t.data.link}):c.jsx(c.Fragment,{})]})}const Rt="discussion_",L_=195;let Ei=null;const ni=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:i=!1,originalAuthorId:a,forceHide:s,functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:h,isTruncated:p=!1,setFocus:m=!1,isCommunity:v=!1,badges:f,basePath:b,parentId:g,locale:D="en"})=>{var qe,Z,oe,se,me,be;const w=re.useIntl(),F=y.useContext(wa),E=y.useContext(at),{createContent:k=async()=>{},deleteContent:T=async()=>{},updateContent:R=async()=>{}}=o.content||{},{createLike:P=()=>{},deleteLike:z=()=>{},listLikes:$=async()=>({})}=o.likes||{},{openComments:B=()=>{}}=o.comments||{},{listMembers:A=()=>Promise.resolve([]),clickMentionFallback:j=()=>{}}=o.form||{},{createVote:M=()=>{},removeVote:U=()=>{}}=o.polls||{},{author:W,canLike:ie,createdAt:ae,id:C,likes:G=0,userLiked:ne,comments:_=0,data:O}=t,q=Gg(t.title,D),S=E&&E.id&&typeof W!="string"&&W.id&&W.id===E.id||!1,L=typeof ie=="boolean"?ie:!0,Q=S&&(!t.createdAt||Tm(t.createdAt,10,"seconds")),K=y.useRef(null),[J,ce]=y.useState({title:t.body!==q&&q||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[ee,pe]=y.useState(!1),[ve,Ee]=y.useState(Q?"highlighted":"default"),[Ce,Fe]=y.useState("");y.useEffect(()=>{const he=K.current;if(!(!he||ve==="default"))return document.addEventListener(nt.DISCUSSION_FORM_SUBMITTED,We),he.addEventListener("transitionend",Me),()=>{document.removeEventListener(nt.DISCUSSION_FORM_SUBMITTED,We),he.removeEventListener("transitionend",Me)}},[]),y.useEffect(()=>{ce(he=>({...he,title:t&&q||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),y.useEffect(()=>{(async()=>{const xe=await _o(J.body,p,O==null?void 0:O.mentions,A);ce(Qe=>({...Qe,postBody:xe}))})()},[J.body,O==null?void 0:O.mentions]);const We=()=>{setTimeout(()=>{Ee("fading")},1e3)},Me=({propertyName:he})=>{he==="background-color"&&Ee(xe=>(xe==="default"&&(document.removeEventListener(nt.DISCUSSION_FORM_SUBMITTED,We),K.current&&K.current.removeEventListener("transitionend",Me)),xe==="fading"?"default":xe))};if(i||!t||t.type===Be.Answer&&(!t.slugs||!t.slugs.question)||J.postBody===""&&t.title==="")return c.jsx(It,{className:"discussion-card"});const ze=async({title:he,body:xe,data:Qe})=>{he||(he=""),xe||(xe=""),Fe("");try{if(!Ri(he,J.title)||!Ri(xe,J.body)){const rt=t.type===Be.Question?{title:xe}:{title:he,body:xe,data:Qe};await R(Ns(t.slugs),rt)}ce(rt=>({...rt,title:he||"",body:xe||"",data:{...rt.data,...Qe},isEditing:!1,didEdit:!0}))}catch{Fe(`${Rt}form_error`)}},Xe=()=>{if(F&&F.updateConversation){const he={showForm:!0},xe=t.author;xe&&xe.id&&(v&&(he.prepopulateForm=`@{{${xe.id}}}`),he.mentionData={id:xe.id,name:xe.name}),F.updateConversation(he)}setTimeout(()=>{var gt,et,Dt;const xe=`reply-form-${(t.type===Be.Answer?t.slug:((gt=t.slugs)==null?void 0:gt.reply)||((et=t.slugs)==null?void 0:et.answer)||((Dt=t.slugs)==null?void 0:Dt.question)||"").toLowerCase().slice(-15)}`,Qe=document.getElementById(xe),rt=document.getElementById(`${xe}-input`);rt&&rt.focus(),Qe&&Qe.scrollIntoView({behavior:"smooth"})},0)},Ae=async()=>{pe(!1);try{await T(Ns(t.slugs))}catch{Fe("delete-error")}},je=[];return n&&S&&(t.type!=="poll"&&je.push({text:w.formatMessage({id:`${Rt}moreMenu_edit`}),onClick:()=>ce(he=>({...he,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),je.push({text:w.formatMessage({id:`${Rt}moreMenu_delete`}),onClick:he=>{he.preventDefault(),he.stopPropagation(),pe(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...Zd(`delete-${t.slug}-modal`,ee)})),r&&o.pins&&je.push({text:w.formatMessage({id:`${Rt}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`}),m&&((qe=K==null?void 0:K.current)==null||qe.focus(),(Z=K==null?void 0:K.current)==null||Z.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:V("discussion-post",u,{[ve]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!J.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:K,tabIndex:m?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:he=>{if(!l.post||J.isEditing||t.type==="poll"&&Yg(he,["poll-options","poll-info"],"discussion-post"))return;he.preventDefault(),he.stopPropagation(),Ei&&clearTimeout(Ei),Ei=setTimeout(()=>{window.location.href=l.post},150);const xe=new CustomEvent(nt.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:Ei}});document.dispatchEvent(xe)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:C||t.slug,className:V("discussion-card",t.type,{editing:J.isEditing,"has-link":l.post&&!J.isEditing}),children:[!J.isEditing&&c.jsx(O_,{author:W,originalAuthorId:a,createdAt:ae,contentData:{didEdit:J.didEdit},content:t,gtmContext:d,badges:f}),J.isEditing?c.jsx(ti,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:i,isInWrapper:!0,hasTitleField:J.title!==""?{text:J.title}:!1,isEditing:{text:J.body,categories:[]},canBePrepopulated:v,isPrepopulated:!1},maxLength:t.type===Be.Question?250:5e4,forceShow:{error:Ce!==""&&Ce!=="delete-error"?w.formatMessage({id:Ce},{action:w.formatMessage({id:`${Rt}action_${t.type}`})}):!1},functions:{create:k,handleSaveEdit:ze,handleCancel:()=>{Fe(""),ce(he=>({...he,isEditing:!1}))},listMembers:A,clickMentionFallback:j},gtmContext:`${d}Form`,data:O}):c.jsxs(c.Fragment,{children:[t.type==="poll"?c.jsx(R_,{content:t,contentData:J,functions:{createVote:M,removeVote:U}}):c.jsx($_,{links:l,contentData:J,postCutOff:L_,content:t}),c.jsx(P_,{content:t})]}),!J.isEditing&&!(s!=null&&s.actionBar)&&c.jsx(uf,{className:t.type,gtmContext:d,contentType:t.type,likes:s!=null&&s.likes?!1:{count:G||0,userLiked:ne||!1,canLike:L,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:P,deleteLike:z,listLikes:$},basePath:b,parentId:g},comments:!(s!=null&&s.comments)&&([Be.Question,Be.Post].includes(t.type)||l.comments)?{count:_||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof B=="function"&&B()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{functions:{onClick:Xe}}:!1,shareLink:{url:`${window.location.origin}${(oe=t.slugs)==null?void 0:oe.question}/${(se=t.slugs)==null?void 0:se.answer}${(me=t.slugs)!=null&&me.reply?`#${(be=t.slugs)==null?void 0:be.reply}`:""}`},moreMenu:{options:je,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),h,c.jsx(un,{id:`delete-${t.slug}-modal`,isOpen:ee,functions:{onOpen:()=>{},onClose:()=>pe(!1)},forceShow:{error:Ce==="delete-error"?w.formatMessage({id:"${intlPath}delete_error"},{action:w.formatMessage({id:`${Rt}action_${t.type}`})}):!1},title:w.formatMessage({id:`${Rt}delete_title`},{action:w.formatMessage({id:`${Rt}action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>pe(!1),children:w.formatMessage({id:`${Rt}delete_cancel`})},{variant:"primary",className:"destructive",onClick:Ae,children:w.formatMessage({id:`${Rt}delete_delete`})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:c.jsx(re.FormattedMessage,{id:"discussion_delete_text",values:{p:he=>c.jsx("p",{children:he}),action:w.formatMessage({id:`${Rt}action_${t.type}`})}})})]})})};const z_=y.lazy(()=>Promise.resolve().then(()=>X_)),q_=65,nm=({forceShow:e,form:t,className:n})=>{const r=re.useIntl(),i="discussionFormCard_",a="DiscardDraftModal",o=y.useContext(at)||"community",l=fa(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,h]=y.useState({form:u||gd("showPost")==="true"||!1,warning:!1}),[p,m]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!p.showCachedText)return;(async()=>{const g=await _o(p.title||p.body||"",q_,p.mentions);m(D=>({...D,prettifiedText:g}))})()},[p.showCachedText,p.title,p.body]);const v=b=>{if(!p.showCachedText||typeof d.warning=="string")return;let g;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),g=b.detail.link;else{const D=b;D.preventDefault(),D.stopPropagation();const F=D.target.closest("a");g=F&&F.getAttribute("href")}h(D=>({...D,warning:g||!1}))};y.useEffect(()=>{if(!p.showCachedText){document.removeEventListener(nt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(nt.MEMBER_CLICKED,v),document.removeEventListener("click",v);return}return document.addEventListener(nt.DISCUSSION_POST_CLICKED,v),document.addEventListener(nt.MEMBER_CLICKED,v),document.addEventListener("click",v),()=>{document.removeEventListener(nt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(nt.MEMBER_CLICKED,v),document.removeEventListener("click",v)}},[p.showCachedText]),y.useEffect(()=>{const b=g=>{if(!(!p.showCachedText||d.warning!==!1))return g.preventDefault(),g.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[p.showCachedText,d.warning]);let f=r.formatMessage({id:`${i}placeholder`});return p.showCachedText&&(p.title||p.body)&&(f=p.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:V("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),h(g=>({...g,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(on,{name:l.name,src:l.image,alt:""}),c.jsx(Sn,{className:V("input",{placeholder:!p.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:jt,blockquote:jt,br:jt,em:jt,li:jt,ol:jt,p:jt,s:jt,span:jt,strong:jt,ul:jt}},children:f})]}),c.jsxs(mr,{children:[c.jsx(z_,{showModal:d.form,functions:{cacheText:m,onClose:()=>{h(b=>({...b,form:!1}))}},form:t,cachedText:p,className:"in-portal"}),c.jsx(un,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{h(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${i}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${i}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":a},{variant:"primary",children:r.formatMessage({id:`${i}overlay_cta_continue`}),onClick:()=>{h({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":a}],children:c.jsx("p",{children:r.formatMessage({id:`${i}overlay_text`})})})]})]})},U_=y.lazy(()=>Promise.resolve().then(()=>S_)),su=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:i,required:a,join:s,leave:o,notMemberStateText:l}})=>{if(a&&!i)return c.jsx(xn,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(xo,{isShort:!0,functions:{join:s,leave:o}})}});const{content:u,functions:d,meta:h,...p}=t,m={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:{...h,isEditing:(h==null?void 0:h.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...p,id:`add-post-${p.id||""}`};return e?c.jsx(nm,{form:m}):c.jsx(U_,{...m})},ou=({form:e})=>{const t=y.useContext(at),n=re.useIntl(),[r,i]=y.useState(!1),a=()=>{$m(t)||i(!0)};y.useEffect(()=>(document.addEventListener(nt.DISCUSSION_POST_ADDED,a),()=>{document.removeEventListener(nt.DISCUSSION_POST_ADDED,a)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(Da,{form:e,showModal:r,functions:{onClose:()=>{i(!1)}},content:s})};const Ds="discussion_responses_",rm=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=re.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${Ds}title`},{action:r.formatMessage({id:`${Ds}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:$t(r.formatMessage,`${Ds}empty`,e,e)})]})};const im=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:i})=>{const a=re.useIntl(),s=y.useContext(wa),o=Ai(i,{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:a.formatMessage({id:"discussion_thread_loadMore"}),error:a.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx(ti,{...r})]})};function W_(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 V_({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ue.useMutation({mutationFn:e,onMutate:({content:i,title:a})=>t(s=>(s&&(i!=null&&(s.content=i),a!=null&&(s.title=a)),s)),onError:n});return r}function H_({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,isFetching:a}=Ue.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:i,isFetching:a}}function K_({queryFns:{read:e,edit:t,like:n,unlike:r,pin:i,unpin:a},queryKey:s}){const o=Ue.useQueryClient(),l=ca(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Co(u),mutate:wo(u)},user:l,...u},h=V_({...d,mutationFn:t}),p=Z_({...d,mutationFn:n}),m=Y_({...d,mutationFn:r}),v=G_({...d,mutationFn:i}),f=Q_({...d,mutationFn:a}),{activity:b,...g}=H_({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:h,like:p,unlike:m,pin:v,unpin:f},user:l,...g}}function Z_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Ue.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Hi({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Hi({activity:l,reaction:s}),r.setQueryData(i,l)}});return a}function Y_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Ue.useMutation({mutationFn:e,onMutate:a=>t(s=>(s&&Gd({activity:s,user:r}),s)),onError:n});return i}function G_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=Ue.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ki({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ki({activity:l,reaction:s}),r.setQueryData(i,l)}});return a}function Q_({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=Ue.useMutation({mutationFn:e,onMutate:a=>(console.log("unpin"),t(s=>(s&&Qd({activity:s,user:r}),s))),onError:n});return i}const J_=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:i,functions:{activities:{remove:a,...s},likes:o,reactions:l,form:u,join:d,leave:h},profile:p,categories:m})=>{var W,ie,ae,C,G,ne;const v=re.useIntl(),{activity:f,error:b,isLoading:g,mutations:{edit:D,like:w,unlike:F,pin:E,unpin:k}}=K_({queryFns:s,queryKey:[e,t,n]});if(g)return c.jsx(It,{style:{height:"400px"}});if(b||!f)return c.jsx(xn,{variant:"error",text:v.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:T,verb:R,latest_reactions:P,mentioned_users:z,additional_data:$}=f,B=(((W=P==null?void 0:P.like)==null?void 0:W.length)||0)>0,A=(((ie=T==null?void 0:T.like)==null?void 0:ie.length)||0)>0,j=A?T==null?void 0:T.like[0].id:"",M=B?(ae=P==null?void 0:P.like)==null?void 0:ae.map(_=>{var O,q,S;return{id:(O=_==null?void 0:_.user)==null?void 0:O.id,name:(S=(q=_==null?void 0:_.user)==null?void 0:q.data)==null?void 0:S.name}}):!1,U=f==null?void 0:f.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(ni,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:Be.Post,title:f==null?void 0:f.title,body:f==null?void 0:f.content,categories:ko((f==null?void 0:f.categories)||[],m||[]),canLike:r,createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:pr(U),userLiked:A,likes:((C=f==null?void 0:f.reaction_counts)==null?void 0:C.like)||0,comments:(f==null?void 0:f.total_replies)||0,peopleWhoLiked:M,data:{mentions:z,...$||{}},pinned:((G=f==null?void 0:f.reaction_counts)==null?void 0:G.pin)&&((ne=f==null?void 0:f.reaction_counts)==null?void 0:ne.pin)>0||!1},originalAuthorId:U==null?void 0:U.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(_,{title:O,body:q})=>D({title:O,content:q})},likes:{createLike:()=>w({activityId:n}),deleteLike:()=>F({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:i,badges:{showBadges:!0,scopes:[{scope:lt.Communities,area:t||""},{scope:lt.Platform,area:"all"}]},basePath:e,parentId:t},n),c.jsx(rf,{basePath:e,parentId:t,activityId:n,showReplies:W_(R,P),activityTotalReplies:(f==null?void 0:f.total_replies)||0,isMember:r,functions:{reactions:l,likes:o,form:u,join:d,leave:h},profile:p})]})};const am=({showModal:e=!0,functions:t,form:n,cachedText:r,className:i})=>{const a=re.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:h}=n,{title:p="",body:m="",mentions:v}=r||{},f="discussion-form-modal";return c.jsx(un,{id:f,title:a.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(p!==""||m!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:V("discussion-form-modal",i),children:c.jsx(ti,{...n,data:{...u,mentions:v||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:m||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0,showPostType:!0},buttons:{submit:a.formatMessage({id:`${s}cta`})},functions:{...h,onChange:b=>{l(g=>({...g,...b}))},onMention:({id:b,name:g}={})=>{if(!b||!g)return;const D=v||{};D[b]={created_at:"",updated_at:"",id:b,data:{name:g}},l(w=>({...w,mentions:D}))},create:async b=>{o(),h.create&&await h.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),h.handleSaveEdit&&await h.handleSaveEdit(b),l({showCachedText:!1})}}})})},X_=Object.freeze(Object.defineProperty({__proto__:null,default:am},Symbol.toStringTag,{value:"Module"}));const ek=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:i,formLabel:a,ctaMessage:s,showIcon:o,onClose:l,reportError:u=()=>{},sendInvites:d})=>{const h=re.useIntl();return i||(i=h.formatMessage({id:"inviteModal_formTitle"})),a||(a=h.formatMessage({id:"inviteModal_formLabel"})),s||(s=h.formatMessage({id:"inviteModal_cta"})),c.jsx(un,{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(Hh,{title:i,label:a,messagePlaceholder:r,ctaMessage:s,onClose:l,sendInvites:d,reportError:u})})};const tk=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:i,form:a,className:s})=>{const o=re.useIntl(),[l,u]=y.useState(gd("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=i;return c.jsx(un,{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(Kh,{...a,meta:{shouldShowCancelButton:!1},functions:{...(a==null?void 0:a.functions)||{},onSuccess:async h=>{var p;try{(p=a==null?void 0:a.functions)!=null&&p.onSuccess&&await a.functions.onSuccess(h)}finally{d()}}}})]})})},Da=tk,nk=Object.freeze(Object.defineProperty({__proto__:null,default:Da},Symbol.toStringTag,{value:"Module"}));const rk=({members:e})=>{const[t,n]=y.useState(!1),r=i=>{const{fullName:a,jobTitle:s,organisation:o,photo:l}=i||{};return c.jsxs(c.Fragment,{children:[c.jsx(on,{name:a,src:l}),c.jsx("p",{children:a}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(i=>c.jsx("li",{children:c.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),n(i)},children:r(i)})},i.fullName))}),c.jsx(un,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(Sn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const ik=({author:e,authorCite:t,content:n,member:r,className:i=""})=>c.jsxs("blockquote",{className:V("testimonial-block",i),children:[c.jsx(Zt,{className:"testimonial",children:n}),r?c.jsx(rn,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:V("author",{"text-small":!i.includes("new")}),children:e}),t&&c.jsx("p",{className:V("author-cite",{"text-small":!i.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),ak=y.memo(ik);const sk=({items:e=[],selector:t="",className:n=""})=>{const r=re.useIntl(),[i,a]=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||""}));a(l)},[]),i&&i.length>0&&c.jsxs(kt,{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:i.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Ea=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:i=""})=>{const a=re.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const h=d/60,p=Math.floor(h),m=(h-p)*60,v=Math.round(m),f=`${a.formatMessage({id:`${s}hours`},{time:p})}${p>0&&v>0?", ":""}${a.formatMessage({id:`${s}minutes`},{time:v})}`;return{text:`${p>0?`${a.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${v>0?a.formatMessage({id:`${s}minutes_short`},{time:v}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:h}=o(e+t);l=a.formatMessage({id:`${s}range`},{early:l,late:d}),u=a.formatMessage({id:`${s}range_aria`},{early:u,late:h})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:V("time-to-complete",i),"aria-label":u,children:l})};const ok=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",c.jsx($n,{...n,className:V("banner",e),image:{...t,aspect:"banner"}})):null;const uk=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],lk=({className:e="",content:t,image:n,variant:r,spacing:i="normal",styling:a,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var v,f;const u={imageFullWidth:!0,...a};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],h={eyebrow:"small",title:"h1",text:"p"},p={};d.forEach(b=>{if(!t[b]){p[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){p[b]=t[b];const{text:g,element:D}=t[b];if(D&&uk.includes(D.toLowerCase()))return;p[b]={text:g,element:h[b]};return}p[b]={text:t[b],element:h[b]}}});const m=o&&o.text&&o.link;return m&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const g=document.getElementById(o.link.substring(1));g&&g.scrollIntoView({behavior:"smooth"})}),c.jsx(Dn,{className:V("banner-section",r,i,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":m,"has-extra-spacing":r!=="subtle"&&i==="normal"&&p.eyebrow&&p.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(p[b]&&typeof p[b]=="object"){const{text:g,element:D=""}=p[b];return b==="text"?c.jsx(Sn,{overrideType:"text-only",className:"text",children:g},b):y.createElement(D,{key:b,className:b},g)}return null}),l,m&&c.jsx(ke,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:V({new:r==="subtle",[(v=o.props)==null?void 0:v.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&c.jsx($n,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},ck=y.memo(lk);const dk=({image:e,variant:t="default",children:n,className:r=""})=>{const i={};return e&&(i["--image"]=`url(${e})`),c.jsx(Dn,{className:V("custom-content-banner",t,r,{"has-image":e}),style:i,children:c.jsx("div",{className:"content-slim",children:n})})};const fk=({alignImage:e="left",className:t,content:n,image:r})=>{const i=typeof n=="string"?c.jsx(Sn,{children:n}):n;return c.jsxs(Dn,{className:V("highlight-section",t),children:[r&&c.jsx("div",{className:V("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx($n,{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?i:c.jsx("div",{className:"content-default",children:i})})})]})},hk=y.memo(fk);const mk=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!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(ke,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"learn-more-click",children:t.text})]}),pk=({type:e,data:t})=>{const n=re.useIntl(),{answers:r,createdAt:i,dateHasPassed:a,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const h=i&&As(i);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})]})]})}if(d&&!a||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):lo(d)});if(o)return c.jsx(Yt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&As(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:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})})]})}return null},gk={title:66,text:3e3,secondaryText:1e3,partner:34},sa={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"}},vk=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const i=re.useIntl(),[a,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(g=>({...g,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:h}=e,p=e.contentType;let m="";if((f=sa[p])!=null&&f.gtmEvent&&(m=sa[p].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${m}-click`,children:o||i.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?c.jsx(ke,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${m}-click`,children:o||i.formatMessage({id:"card_cta_people"})}):null;const v=["communityPage","microcourse","event"];if(t&&t.onClick&&v.includes(p)&&d!=="premium"){const g=a.loading||a.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),D=async w=>{if(w.preventDefault(),w.stopPropagation(),!(g||!t||!t.onClick)){s(F=>({...F,loading:!0}));try{const F=await t.onClick(e);s(F==="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(ke,{onClick:D,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:g,"data-gtm-event-context":`${r}Page-${p}: ${h}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||i.formatMessage({id:`card_cta_${p}${g?`_${a.loading?"loading":"done"}`:""}`})})})}return null};function bk({buildMemberData:e,communitySlug:t}){const n=re.useIntl(),r=y.useContext(at),[i,a]=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),a({count:d.toString(),isMember:!!l,memberType:l})})},[t,e]),c.jsxs("span",{className:"member-information",children:[i.isMember&&c.jsx(Yt,{size:"small",variant:"registered",icon:(i==null?void 0:i.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${i.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:i.count})})]})}const uu=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:i,cta:a,gtmContext:s="Carousel",handleCardClick:o,meta:l})=>{var A,j;const u=re.useIntl(),d=y.useContext(at),h=!!(d!=null&&d.id),{isTabbable:p=!0,setFocus:m=!1}=l||{},v=y.useRef(null),[f,b]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(i,h).then(M=>{b({data:M,isLoading:!1})}).catch(()=>b(M=>({...M,isLoading:!1})))},[i,h,n]);const{data:g,isLoading:D}=f;if(D||!g)return c.jsx(It,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!a&&(a={text:u.formatMessage({id:`card_cta_${i.contentType}`}),onClick:o});const{contentType:w}=g;if(!w||!sa[w])return c.jsx(It,{element:"li",className:"card-wrapper"});const{basePath:F="",className:E,length:k,gtmEvent:T}=sa[w];let R=p&&g.slug?`${F}${g.slug}`:!1;p&&g.slug&&(g.slug.slice(0,4)==="http"||g.slug.slice(0,2)==="//"||g.slug.slice(0,6)==="mailto"||g.slug.slice(0,3)==="tel")&&(R=g.slug);const P=M=>{R&&(M.preventDefault(),M.stopPropagation(),window.location.href=R)},z={...gk,...k};let $={className:"card"},B={};return R&&(B={href:R,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`,"data-testid":"link"},g.openInNewTab&&(B.target="_blank"),$={onClick:P,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`}),m&&($={...$,tabIndex:"0"},(A=v==null?void 0:v.current)==null||A.focus(),(j=v==null?void 0:v.current)==null||j.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:V("card-wrapper text-medium",E,t,{"has-link":R,"no-link":!R,"has-image":g.banner}),"data-testid":`${w}-card`,children:c.jsxs("div",{...$,ref:v,children:[c.jsx(bd,{className:"card-label",contentType:w,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),w==="communityPage"&&(g==null?void 0:g.createdAt)&&Sm(g==null?void 0:g.createdAt,60)&&c.jsx(Yt,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),g.startDate&&!g.isOngoingEvent&&c.jsx(Yt,{size:"small",variant:g.dateHasPassed?"default":"information","data-testid":"date",children:g.dateHasPassed?u.formatMessage({id:"card_ended"}):hd(g.startDate)}),g.banner?c.jsxs("p",{className:"img",children:[g.registered&&c.jsx(Yt,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx($n,{image:{...g.banner,description:""}})]}):E==="people"?c.jsx(on,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&c.jsx(go,{contributors:{data:g.contributors},styling:{size:"small",showGap:E!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(w)?u.formatMessage({id:`card_contributors_${w}`}):void 0,"data-testid":"contributors"}),g.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:g.partner.length>1?u.formatMessage({id:"card_partner"},{partner:g.partner[0],number:g.partner.length-1}):ir(g.partner[0],z.partner)}),["title","text","secondaryText"].map(M=>{const U=g[M];if(!U)return null;const W=ud(M),ie={key:M,className:W,"data-testid":W},ae={wrapper:"p",forceWrapper:!0,forceInline:!0},C=ir(U,z[M]);return["title","text"].includes(M)&&R?(ae.wrapper="a",c.jsx("p",{...ie,children:c.jsx(Zt,{options:ae,...B,children:C})})):c.jsx(Zt,{options:ae,...ie,children:C})}),i.contentType==="communityPage"&&(i.slug||g.slug)&&r&&c.jsx(bk,{communitySlug:i.slug||g.slug,buildMemberData:r}),c.jsx(pk,{type:E||"",data:g}),c.jsx(vk,{data:g,cta:a,link:R||"",gtmContext:s})]})})};const sm=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:V("card-block",n),children:e.map((i,a)=>{const s=i.slug?`${i.slug}-${t[a]}`:`${t[a]}-${a}`;return c.jsx(uu,{id:s,card:{...i,contentType:t[a]},meta:{setFocus:a===(r==null?void 0:r.focusCardIndex)},...r},s)})}),yk=(e,t,n,r)=>{const i=t*n<=e,a=e<t*(n+1),s=r.includes(Math.floor(e/t));return{inView:i&&a,isLoaded:s}},xk=({id:e,title:t})=>{const n=re.useIntl();if(!t||!t.text)return null;const{text:r,element:i="h2",variant:a="default",size:s="medium",link:o}=t;return y.createElement(i,{className:V("title",a,s,{"highlighted-title":a==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const Es={fourCards:1024,threeCards:769,twoCards:480};let _i=null,_s=null;const Ck=({id:e,cards:t,cardTypes:n,buildCardData:r,title:i,className:a,gtmContext:s,...o})=>{const l=re.useIntl(),u="carousel_pagination_",[d,h]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:p,isLoading:m}=d,[v,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:g}=v,[D,w]=y.useState(""),F=t.length,E=Math.ceil(F/p),k=y.useRef(null),T=In(!0,!0,k==null?void 0:k.current);y.useEffect(()=>{let A=1;T&&(T>=Es.fourCards?A=4:T>=Es.threeCards?A=3:T>=Es.twoCards&&(A=2),A>F&&(A=F)),h(j=>({...j,cardsPerPage:A,isLoading:!1}))},[T,F]);const R=(A="next")=>{_s&&clearTimeout(_s);let j=b;if(typeof A=="string")if(A==="next")if(b<E-1)j=b+1;else return;else if(b>0)j=b-1;else return;else j=A;w(""),f(U=>({...U,currentPage:j,loadedPages:[...new Set([...g,j])]}));const M=()=>{const U=j*d.cardsPerPage,W=U+d.cardsPerPage;return t.slice(U,W).length};_s=setTimeout(()=>{w(l.formatMessage({id:`${u}ariaLive${typeof A=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof A=="string"?A:"next"}`}),slide:typeof A=="string"?1:A+1,count:M()}))},500)},P=A=>{_i=A.touches[0].clientX},z=A=>{if(_i===null)return;const j=A.touches[0].clientX,M=_i-j;M>5?R("next"):M<-5&&R("previous"),_i=null},$={"--width":`${T||0}px`,"--total-cards":F,"--cards-per-page":p,"--page":b};if(m)return c.jsx(da,{layout:`carousel${i?"-with-title":""}`});const B=(A,j)=>{var U;let M=null;return(U=A==null?void 0:A.sys)!=null&&U.id?M=`card-${A.sys.id}`:A!=null&&A.slug?M=`card-${A.slug}`:[n[j],A.contentType].includes("customCard")&&(M=`card-${window.btoa(`${A.title} ${A.createdAt}`)}-${j}`),M};return c.jsxs("section",{ref:k,className:V("carousel-wrapper",a),"data-testid":"carousel",children:[c.jsx(xk,{id:e,title:i}),c.jsx("ul",{className:"carousel",onTouchStart:P,onTouchMove:z,style:$,"data-testid":"carousel-list",children:t.map((A,j)=>{let M=B(A,j);const{inView:U,isLoaded:W}=yk(j,p,b,g);return M&&(U||W)?c.jsx(uu,{id:M,card:{...A,contentType:n[j]},buildCardData:r,gtmContext:s,meta:{isTabbable:U},...o},M):(M=M||`${e}-card-${j}`,c.jsx(It,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},M))})}),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(ke,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:A=>{A.preventDefault(),A.stopPropagation(),R("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:b<=0})}),[...Array(E)].map((A,j)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:V("page-indicator",{selected:j===b}),onClick:M=>{M.preventDefault(),M.stopPropagation(),R(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(ke,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:A=>{A.preventDefault(),A.stopPropagation(),R("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:b>=E-1})})]}),c.jsx(Pe,{"aria-live":"polite",showOnFocus:!1,children:D})]})]})},wk=({carousels:e=[],isLoading:t,title:n,className:r="",...i})=>!e||!e.length?null:e.map(({title:a,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=a?window.btoa(a):`carousel-${u}`,h=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(da,{layout:`carousel${a?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:c.jsx(qt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(Ck,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:a,link:s},...i}),h?null:c.jsx(qt,{})]},`carousel-${d}`)});const Dk=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:i,title:a,text:s,isPrivate:o,slug:l}=n;let u={};return l&&(u={onClick:h=>{l&&(h.preventDefault(),h.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":!i}),children:i&&c.jsx($n,{image:i})}),c.jsxs("div",{className:"content",children:[a&&c.jsx("p",{className:"title text-medium",children:a}),s&&c.jsx("p",{className:"text text-medium",children:s})]})]})})};const Ek=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:i=!0},graph:a,styling:s={},className:o=""})=>{const l=re.useIntl();let u=i?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":a==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:h=>c.jsx("strong",{children:h}),number:u})}),u<100&&i&&c.jsx(Ea,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(po,{progress:u,styling:{layout:a||"bar",size:a&&a==="circle"?"small":"default"}})]})})};const om=({element:e="span",sectionId:t,subsectionId:n,title:r,className:i=""})=>y.createElement(e,{className:V("lesson-name",i),"data-number":`${t}.${n}`,children:r});const um=({size:e="default",completionTime:t,icon:n,optional:r,type:i,children:a})=>{const s=re.useIntl(),o=ua(`lessonType_${i}`)?s.formatMessage({id:`lessonType_${i}`}):cd(i||"");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(Ea,{time:t})," ",a?c.jsx("span",{className:"additional",children:a}):null]})};const _k=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:i,sectionId:a,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const h=re.useIntl(),p="courseStructure_",m=u.toLowerCase().includes("course conclusion");return c.jsxs(la,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[h.formatMessage({id:`${p}section${m?"_end":""}`},{number:a})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:i&&l===0?h.formatMessage({id:`${p}time_completed`}):c.jsx(Ea,{time:s,appendedText:i?h.formatMessage({id:`${p}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:v,completionTime:f,contentType:b,icon:g,image:D,isIntroduction:w,optional:F,slug:E,subsectionId:k,title:T,type:R})=>{const P=i&&t||w,z={};return D&&(z.style={"--image":`url(${D})`}),c.jsx("li",{className:V({article:b===Fr.ARTICLE,discussion:b===Fr.DISCUSSION,quiz:b===Fr.QUIZ,completed:v&&b===Fr.ARTICLE,locked:!P}),...z,children:c.jsx(yn,{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(om,{sectionId:a,subsectionId:k,title:T,className:"course-title"})," ",c.jsx(um,{completionTime:f,icon:g,optional:F,type:R,children:d&&d[E]&&c.jsx("span",{className:"quiz-score",children:`${d[E]}%`})})]})})},E)})})]})};const kk=({isComplete:e=!1,onClick:t,...n})=>{const r=re.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(ke,{...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":""}`})})},Fk=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),Qc=[{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 ki="notFoundError_",Ak=()=>{const e=re.useIntl(),t=[];return Qc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ki}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(Qh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(Dn,{children:[c.jsx(sm,{cards:Qc,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),c.jsx(ke,{href:"/solution-articles/",children:e.formatMessage({id:`${ki}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${ki}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ki}text`})})]})};exports.ASSETS_BUCKET=Gt;exports.ActionBar=uf;exports.ActionButton=zr;exports.ActivitiesFeed=Qg;exports.ActivitySection=J_;exports.ActivityType=ha;exports.AddPost=su;exports.Badge=jd;exports.BadgeScope=lt;exports.Badges=Od;exports.BadgesContext=fo;exports.BadgesProvider=Ed;exports.Banner=ok;exports.BannerSection=ck;exports.Breadcrumbs=vv;exports.Buckets=Km;exports.Button=ke;exports.ButtonWrapper=hr;exports.COURSE_CONTENT_TYPES=Fr;exports.CacheProvider=_d;exports.Card=uu;exports.CardBlock=sm;exports.Carousel=wk;exports.CharacterLimit=Bo;exports.CollapsibleSection=la;exports.Columns=ff;exports.CommunityDetails=hg;exports.ContactFooter=x_;exports.ContactForm=Vh;exports.ContentTypeLabel=bd;exports.Contributors=go;exports.ConversationContext=wa;exports.CookieBanner=Gh;exports.CourseProgression=Ek;exports.CourseStructure=_k;exports.CustomContentBanner=dk;exports.CustomEvents=nt;exports.DELETED_USER_ID=$r;exports.Directory=rk;exports.DiscussionContentType=Be;exports.DiscussionConversation=em;exports.DiscussionForm=ti;exports.DiscussionFormCard=nm;exports.DiscussionFormModal=am;exports.DiscussionPost=ni;exports.DiscussionThread=im;exports.Divider=qt;exports.DownloadSection=g_;exports.EMAILS=Yn;exports.EditSection=b_;exports.EmailHelperTextBox=mf;exports.EmptyStateBox=xn;exports.EnrichedUrl=Fo;exports.FeatureFlags=Fd;exports.Filters=lf;exports.FlagsProvider=kd;exports.Footer=iu;exports.Form=Jt;exports.Formatting=H;exports.Fragment=jt;exports.FullWidthSection=Dn;exports.GET_STREAM_USER_PREFIX=Fs;exports.GlobalProviders=op;exports.Header=au;exports.HelperTextBox=xd;exports.HiddenFromScreenReaders=oa;exports.HideShowTextBox=Cd;exports.HighlightSection=hk;exports.HighlightedTextBox=kt;exports.INVALID_TOKEN=dd;exports.IconBulletedList=Gm;exports.ImageContainer=Um;exports.IntlProvider=Ad;exports.InviteForm=Hh;exports.InviteModal=ek;exports.JoinButton=xo;exports.Label=Qo;exports.LanguageContext=ho;exports.LanguageSwitcher=yv;exports.LessonName=om;exports.LessonType=um;exports.LikesButton=tf;exports.LikesFeed=af;exports.LikesModal=sf;exports.Link=yn;exports.LoadMore=Xr;exports.LoadingBlock=Pd;exports.LoadingPlaceholder=It;exports.LoadingState=da;exports.Logo=Ao;exports.LogoSection=y_;exports.MEMBERS_PER_PAGE=Jh;exports.MENTION_REGEX=fd;exports.MarkCompleteButton=kk;exports.MarkdownText=Sn;exports.MarketingBlock=mk;exports.Marks=Kt;exports.Member=rn;exports.MembersList=Xh;exports.Modal=vo;exports.MoreMenu=cf;exports.NUMBER_OF_COUNTRIES=Am;exports.NUMBER_OF_USERS=Fm;exports.NarrowCard=Dk;exports.NavigationMenu=df;exports.NotFoundError=Ak;exports.Overlay=un;exports.OverlayContext=mo;exports.OverlayProvider=Sd;exports.PageHeading=wd;exports.PageLayout=Qh;exports.PasswordForm=o_;exports.PasswordRules=xf;exports.Pill=Yt;exports.Poll=tm;exports.Popover=vd;exports.Portal=mr;exports.ProfileForm=Kh;exports.ProfileImageChange=Wh;exports.ProfileModal=Da;exports.ProfileModalLauncher=ou;exports.ProfilePicture=on;exports.ProgressBar=po;exports.ProgressTracker=Vm;exports.PublishArticleForm=l_;exports.Rating=Iv;exports.RepliesFeed=rf;exports.ResponsesHeading=rm;exports.ResponsiveImage=$n;exports.ResultsVisibility=aa;exports.ReturnToNavButton=Hm;exports.RichTextEditor=ru;exports.SearchForm=Zh;exports.ShareLink=of;exports.ShareLinks=_v;exports.SignupForm=p_;exports.Span=Ss;exports.StatusBanner=sr;exports.TableOfContents=sk;exports.Tabs=kv;exports.Tags=__;exports.TestimonialBlock=ak;exports.TimeToComplete=Ea;exports.Toggle=a_;exports.Tooltip=Rn;exports.TopLevelPage=C_;exports.UUID_V4_REGEX=Lr;exports.UserContext=at;exports.UserProvider=Bd;exports.VisuallyHidden=Pe;exports.addAriaProps=Zd;exports.basicReducer=Jr;exports.camelCaseToDashCase=ud;exports.checkIntlPathExists=ua;exports.enrichPostCategories=ko;exports.generateConditions=Ii;exports.generateCssIcon=Bm;exports.getAuthorData=pr;exports.getCharacterLimitProps=hf;exports.getLongDate=lo;exports.getMember=fa;exports.getPostBody=_o;exports.getShortDate=hd;exports.getValueLength=ma;exports.headerData=Qr;exports.likesResponseMock=pv;exports.mapGetStreamData=Fk;exports.pageReady=md;exports.passwordValidator=Bs;exports.repliesFeedMock=Jg;exports.supportedLanguages=Bi;exports.toCamelCase=ld;exports.toCapitalisedCase=km;exports.toSentenceCase=cd;exports.transformSlugs=Ns;exports.useBadges=Dd;exports.useCurrentPath=nd;exports.useEffectAfterMount=ar;exports.useElementWidth=In;exports.useOverlay=Td;exports.useScrollListener=ad;exports.useScrollToHash=oo;exports.useTooltips=uo;exports.useUser=ca;
165
+ `}),L=Q.turndown(L)}o&&o.mentions&&(L=await wd({text:L,template:`[${Qs}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),sE(L,Q=>{const Y=[{type:"initialValue",value:Q},{type:"editorKey",value:O.toString()}];o!=null&&o.link&&(Y.push({type:"enrichedUrl",value:o.link}),o.link.url&&se(o.link.url)),T(Y),setTimeout(()=>{T([{type:"stringValue",value:Uc(k)}])},150)})})()},[O]),y.useEffect(()=>{if(U===void 0&&k){const L=lE(k);L&&se(L)}const S=L=>{var te;const Q=L,Y=((te=Q==null?void 0:Q.detail)==null?void 0:te.url)||null;Y&&U&&U.url===Y&&T([{type:"enrichedUrl",value:void 0}])};return window.addEventListener("linkRemoved",S),()=>{window.removeEventListener("linkRemoved",S)}},[U]),y.useEffect(()=>{if(t){Ur.lastIndex=0;const S=t.match(Ur);S&&S.length===1&&S[0].length===t.length&&!j&&T([{type:"originalValue",value:t}])}t!==""||!k||Li(O,t)&&!j||(w.withoutNormalizing(k,()=>{X.delete(k,{at:{anchor:w.start(k,[]),focus:w.end(k,[])}}),X.deselect(k),k.children.length!==0&&X.unwrapNodes(k,{at:[0]}),X.insertNodes(k,F,{at:[0]})}),T([{type:"initialValue",value:F},{type:"lastAnchor",value:null},{type:"enrichedUrl",value:!1}]))},[t]),y.useEffect(()=>{b({link:U})},[U]),y.useEffect(()=>{$===""&&U&&T([{type:"enrichedUrl",value:void 0}])},[$]);const q=ld(()=>{dE({editor:k,isShowing:W.show,numberOfUsers:W.numberOfUsers,listMembers:p,dispatch:T})},100);return z?c.jsx("div",{id:E,className:"rich-text-editor",children:c.jsxs(ln.Provider,{value:{..._,id:E,isInOverlay:h,setFocus:ie,dispatch:T,getLinkPreview:g,onMention:x,reportError:C},children:[c.jsxs(Aw,{editor:k,initialValue:z,onChange:S=>{if(k.operations.some(Q=>Q.type!=="set_selection")){let Q=mE(S);Q==="<br>"&&(Q=""),f(Q,U),T([{type:"stringValue",value:Uc(k)}]),j||T([{type:"hasInteracted",value:!0}]),q(),m&&console.log({serialized:Q,json:S})}},...u,children:[c.jsx(yw,{className:"input",renderElement:ee,renderLeaf:Z,placeholder:n||d.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onPaste:async S=>{const L=U!==!1,Q=S.clipboardData.getData("text");if((te=>{try{return new URL(te),!0}catch{return!1}})(Q)){let te=Q;if(Q){const{full:ce}=co(Q);te=ce}if(Q&&g&&!L){const ce=await g(te);ce.url&&T([{type:"enrichedUrl",value:ce}])}}},onKeyDown:S=>{if(S.key==="Enter"){W.show&&(S.preventDefault(),S.stopPropagation(),Im(k,W,T,E));const{selection:L}=k;if(L){const Q=G.isCollapsed(L),[Y,te]=w.node(k,L,{depth:1});let ce=Y,J=ce.type;const pe=ce.children[0];if(pe&&(pe==null?void 0:pe[H.h3])===!0&&(S.stopPropagation(),S.preventDefault(),X.insertNodes(k,F)),pe&&[H.ol,H.ul].includes(pe.type)&&(ce=pe,J=pe.type),ce&&me.isElement(ce)&&J!==H.paragraph){if(J===H.blockquote&&!S.shiftKey){S.stopPropagation(),S.preventDefault(),X.insertNodes(k,F);return}if(Q){const[de,xe]=w.parent(k,L,{edge:"end"}),Fe=de.type;if([H.ul,H.ol].includes(J))if(S.stopPropagation(),S.preventDefault(),Fe===H.li&&B==="Enter"){de.children.length===1&&"text"in de.children[0]&&de.children[0].text===""&&X.removeNodes(k,{at:xe}),X.insertNodes(k,F,{at:I.next(te)}),X.select(k,w.end(k,I.next(te)));return}else{const[Ve,Re]=oE(k,H.li),Ne={type:H.li,children:[{text:""}]};X.insertNodes(k,Ne,{at:I.next(Re)}),X.select(k,w.end(k,I.next(Re)))}}}}}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:L,possibleUsers:Q}=W;let Y=S.key==="ArrowUp"?L-1:L+1;Y<0&&(Y=Q.length-1),Y>=Q.length+1&&(Y=0),T([{type:"mentionPopover",value:{...W,selectedUser:Y}}])}T([{type:"lastKey",value:S.key}]),cE(S,k,T,C)},onBlur:()=>{k.selection&&T([{type:"lastAnchor",value:k.selection.anchor}])},onFocus:()=>{if(A){if(!I.isPath(A.path)||!le.has(k,A.path))return;const S=le.get(k,A.path);let L=0;if(ge.isText(S)?L=S.text.length:S.children&&(L=S.children.length),A.offset>L)return;try{X.select(k,{anchor:A,focus:A})}catch(Q){const Y=Q.message;C(`Error focusing editor: ${Y}`)}}}}),U?c.jsx(To,{data:U,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:U.title||d.formatMessage({id:"richTextEditor_link_enrichedUrl_aria_fallback"})})}):c.jsx(c.Fragment,{}),c.jsx(DE,{styling:l==null?void 0:l.toolbar}),p?c.jsx(hE,{onFallbackClick:v}):c.jsx(c.Fragment,{})]},R),c.jsx(jo,{id:`character-limit-${e}`,limit:r,valueLength:ha($)})]})}):c.jsx(c.Fragment,{})};const l_=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:i=()=>{}},isDisabled:a=!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=>{a||(l(d),i(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:a,on:o===n[1].value}),children:n.map(d=>{const m=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:m,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:a}),c.jsx("label",{htmlFor:m,children:d.label})]},m)})})]})};function Jm({className:e="",userId:t,userName:n,src:r,uploadImage:i,button:a,callback:s}){const o=re.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[m,h]=y.useState(!1),[p,v]=y.useState(!1),f=y.useRef(null),b=async F=>{h(!0),v(!1);try{const D=F.target.files&&F.target.files[0];if(!D||!t)throw h(!1),new Error("Image file or userID is missing");const _=await i({fileObject:D,userId:t}),T={thumbnail:_.thumbnailURL,full:_.originalURL};d(T),s(T)}catch{v(!0)}finally{h(!1)}h(!1)},{upload:g=o.formatMessage({id:`${l}cta_upload`}),change:x=o.formatMessage({id:`${l}cta_change`}),uploading:C=o.formatMessage({id:`${l}cta_uploading`})}=(a==null?void 0:a.text)||{};return c.jsxs("div",{className:V("profile-image-change-figure",e),children:[c.jsx(on,{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(ke,{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?C:u?x:g})]})}const Xm=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:i="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:i},functions:{onSuccess:t,onFailure:n},button:{className:"new"}})};const c_=({emails:e,setEmails:t,setIsDisabled:n})=>{const{formatMessage:r}=re.useIntl();return c.jsx(Ah.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:r({id:"inviteForm_email_placeholder"}),emails:e,onChange:i=>{t(i),n(!i.length)},autoFocus:!1,getLabel:(i,a,s)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:i}),c.jsx(ke,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{s(a),n(!e.length)},className:"remove-email-button",screenreaderText:r({id:"overlay_close"})})]},a)})},eh=({title:e,label:t,messagePlaceholder:n,ctaMessage:r,titleColor:i,labelColor:a,backgroundColor:s,onClose:o,reportError:l,sendInvites:u,initialFormStatus:d="NOT_SUBMITTED"})=>{const[m,h]=y.useState([]),[p,v]=y.useState(!0),[f,b]=y.useState(d),{formatMessage:g}=re.useIntl(),x=async D=>{try{await u(m,D.message),h([]),b("SUCCESS")}catch(_){b("ERROR"),l(_)}},C=D=>{D.preventDefault(),b("NOT_SUBMITTED"),v(!0),h([])},F=D=>{D.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:g({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",g({id:"inviteForm_error"})]})}),c.jsx(qt,{}),c.jsx("div",{className:"footer",children:f==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(ke,{variant:"secondary",onClick:C,children:g({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(ke,{onClick:F,children:g({id:"inviteForm_ctaDone"})})]}):c.jsx(ke,{onClick:C,children:g({id:"inviteForm_ctaTryAgain"})})})]}):c.jsxs("div",{className:"invite-form-wrapper",style:{backgroundColor:s},children:[c.jsxs("div",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:i},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t})]}),c.jsx(Jt,{id:"invite-form",fields:[{component:c_,props:{emails:m,setEmails:h,setIsDisabled:v},required:!0},{id:"message",type:"textarea",label:g({id:"inviteForm_message_label"}),placeholder:n||g({id:"inviteForm_message_placeholder"})}],functions:{onSuccess:x},button:{text:r,size:"medium",disabled:p}})]})},$i=e=>e.map(t=>({condition:t})),St={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},d_=({functions:e,...t})=>{const{formatMessage:n}=re.useIntl(),[r,i]=y.useState(null),[a,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[St.NEW_PASSWORD]!==p[St.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=p=>!Bs(p[St.NEW_PASSWORD]).isValid,m=[{"data-testid":St.NEW_PASSWORD,id:St.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:$i(["required",d]),functions:{onChange:p=>l(Bs(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":St.CONFIRMED_PASSWORD,id:St.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:$i(["required",u])}];t.isPasswordChange&&m.unshift({"data-testid":St.CURRENT_PASSWORD,id:St.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:$i(["required"])}),a&&m.push({component:Af,props:{matchingRules:o}});const h={id:St.FORM_ID,fields:m,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>i(p==null?void 0:p.statusCode),onFailure:(p,v)=>{(v.includes(St.NEW_PASSWORD)||v.includes(St.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Jt,{...h}),r&&c.jsx(xn,{variant:"error",text:r})]})};const th=({isCreateProfile:e=!1,hooks:t,functions:n,meta:r={},gtm:i,...a})=>{var R;const s=re.useIntl(),o="profileForm_",l=y.useContext(at),[u,d]=y.useState(l.image),[m,h]=y.useState(!1),{uploadImage:p=()=>{},onSuccess:v=async O=>{},onCancel:f=()=>{},onFailure:b=()=>{}}=n,{buildLocation:g,isValidPlace:x,predictPlaces:C}=t.useMaps(),{context:F="ProfileForm",event:D="profile-form-submit-click"}=i||{},_=[{id:"jobTitle",type:"text",label:s.formatMessage({id:`${o}jobTitle`}),placeholder:s.formatMessage({id:`${o}jobTitle_placeholder`}),value: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:(R=l.location)==null?void 0:R.en,validation:[{condition:"required"},{condition:({location:O})=>O&&!m?!1:!x(O),error:s.formatMessage({id:`${o}location_error`})}],functions:{onChange:()=>{m||h(!0)},onKeyInput:C}}],T=[{component:Jm,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"}]},..._,{id:"biography",type:"textarea",label:s.formatMessage({id:`${o}bio`}),placeholder:s.formatMessage({id:`${o}bio_placeholder`}),limit:1e3,value:l.biography},{component:qt}];return c.jsx(Jt,{id:"profile-details-form",fields:e?_:T,meta:{shouldShowCancelButton:!e,shouldReset:!1,shouldHide:!1,showRequiredLabels:e,...r},intlPath:o,gtm:{context:F,event:D},functions:{onSuccess:async O=>{try{const z={...O,image:u||null,location:m?await g(O==null?void 0:O.location):l.location,...e?{onboardingState:"completed"}:{}};l.updateDetails&&l.updateDetails($=>({...$,...z})),await v(z)}catch{b()}},onCancel:f,onFailure:b},button:{size:"large",text:{default:s.formatMessage({id:`${o}cta`}),submitting:s.formatMessage({id:`${o}cta_submitting`}),submitted:s.formatMessage({id:`${o}cta_submitted`})}},...a})},f_=()=>{const e=re.useIntl(),[t,n]=y.useState(0);return y.useEffect(()=>{const r=setInterval(()=>{n(i=>{if(i>=95)return clearInterval(r),95;const a=Math.round(Math.random()*10);return Math.min(i+a,95)})},800);return()=>{clearInterval(r)}},[]),c.jsx(Ld,{progress:t,steps:{0:{icon:"layers",text:e.formatMessage({id:"publishArticleForm_progressBar"})}}})};let ps=null;const ct="publishArticleForm_",Qc={},Jc=10,m_=({id:e="publish-article-form",values:t=Qc,functions:n,meta:r,gtm:i})=>{const a=re.useIntl(),s=y.useContext(at),{create:o,onSuccess:l=()=>{},onFailure:u=()=>{}}=n||{},{isInOverlay:d=!1}=r||{},[m,h]=y.useState(!1),[p,v]=y.useState(t.body||""),[f,b]=y.useState(!1),[g,x]=y.useState("");y.useEffect(()=>{Li(t,Qc)||qi(t.body)&&t.body!==p&&t.body!==void 0&&v(t.body)},[t.body]);const C=()=>{!s||!s.id?b(a.formatMessage({id:`${ct}error_loggedOut`})):f&&b(!1)},F=R=>({condition:O=>{const z=O[R];return!z||typeof z!="string"?!0:z.length<Jc},error:a.formatMessage({id:`${ct}error_underMinLength`},{length:Jc})}),D=!!p&&qi(p),_=()=>c.jsxs(c.Fragment,{children:[c.jsx(qt,{}),c.jsx("p",{className:"text-medium",children:a.formatMessage({id:`${ct}disclaimer`})})]}),T=[{id:"title",type:"text",value:t.title||"",limit:65,label:a.formatMessage({id:`${ct}title_label`}),placeholder:a.formatMessage({id:`${ct}title_placeholder`}),functions:{onChange:C},validation:[{condition:"required"},F("title")]},{id:"subtitle",type:"text",value:t.subtitle,limit:115,label:a.formatMessage({id:`${ct}subtitle_label`}),placeholder:a.formatMessage({id:`${ct}subtitle_placeholder`}),functions:{onChange:C},validation:[{condition:"required"},F("subtitle")]},{component:eu,props:{formID:e,label:{visible:a.formatMessage({id:`${ct}body_label`})},showLabel:!0}},{component:su,props:{id:`${e}-input`,value:p,placeholder:a.formatMessage({id:`${ct}body_placeholder`}),meta:{isInOverlay:d},autoFocus:!1,functions:{onChange:R=>{v(R),C()}},styling:{toolbar:{showHeadingOption:!0}},"aria-invalid":!!f,"aria-errormessage":"error-message"}}];return m?T.push({component:qt}):T.push({component:_}),c.jsxs("section",{className:"publish-article-form",children:[c.jsx(Jt,{id:e,meta:{shouldReset:!1,shouldHide:!1,showRequiredLabels:!1},functions:{onSuccess:async R=>{if(!s||!s.id||!D)return;ps&&clearTimeout(ps),h(!0);const O={...R,body:p};try{o&&await o(O),ps=setTimeout(()=>{x(a.formatMessage({id:`${ct}aria_success`})),l(O)},500)}catch{b(a.formatMessage({id:`${ct}error`})),x(""),u()}},onFailure:u},fields:T,intlPath:ct,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":i==null?void 0:i.context,"data-gtm-event-type":"publish-article-click",disabled:!s||!s.id||!D,text:{default:a.formatMessage({id:`${ct}cta_submit`}),submitting:a.formatMessage({id:`${ct}cta_submitting`}),submitted:a.formatMessage({id:`${ct}cta_submitted`})},customOnSubmit:f?c.jsx(c.Fragment,{}):c.jsx(f_,{})},gtm:i}),f&&c.jsx(or,{id:"error-message",className:"error",children:typeof f=="string"&&f.includes(" ")?f:a.formatMessage({id:`${ct}error`})}),g&&c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:g})]})};const nh=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:i="search-bar",gtmEvent:a="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=re.useIntl(),u=y.useRef(null);sr(()=>{!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":i,"data-gtm-event-type":a,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Ie,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:m=>{m.key==="Enter"&&d(m)}}),c.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Ie,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Ie,{children:l.formatMessage({id:"search_cta"})})})]})})})},Xc=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const i=e.current.value.toString().toLowerCase().trim(),a={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},a);try{s=await t(i),s===void 0&&(s=a)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:i,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved: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:i,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(i)}},{type:"validFields.email",value:!0}])},h_=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"]}},p_=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:i,state:a})=>{if(!e.form||!e.form.current)throw new Error("No refs.form");if(!e.form.current.checkValidity()){e.hiddenValidation&&e.hiddenValidation.current&&e.hiddenValidation.current.click();return}const s=h_(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...a.values}),i([{type:"showSuccessMessage",value:!0}])},g_=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:i},refs:a,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,m=(p,v)=>{p.current&&s.validFields[v]!==p.current.validity.valid&&o([{type:`validFields.${v}`,value:p.current.validity.valid}])},h=[{id:"full_name",type:"text",inputRef:a.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>m(a.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:a.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Xc({ref:a.email,validateEmail:r,dispatch:o})},onChange:(p,v)=>{o([{type:"shouldDisableButton",value:!0}]),v&&v({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:Cf,props:{email:d.email,type:d.boxType,resendVerificationCode:i}}];return s.shouldManuallyApprove&&(h.push({id:"job_title",type:"text",inputRef:a.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>m(a.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:a.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{m(a.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&h.push({id:"url",type:"text",label: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:a.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 v=[];["name","email"].forEach(f=>{s.validFields[f]!==a[f].current.validity.valid&&(v.push({type:`validFields.${f}`,value:a[f].current.validity.valid}),f==="email"&&Xc({ref:a.email,validateEmail:r,dispatch:o}))}),v.length&&o(v)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),h};const v_=({className:e=""})=>c.jsxs("div",{className:V("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(re.FormattedMessage,{id:"signup_success_title"})}),c.jsx(re.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const b_={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},y_=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:i={},submitButton:a,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=re.useIntl(),{title:u=!0,expectation:d=!1,url:m=!0,logInButton:h=!0,successMessage:p=!0}=i,v={title:u,expectation:d,url:m,logInButton:h,successMessage:p},[f,b]=y.useReducer(ei,b_),{validFields:g,emailDetails:x,shouldManuallyApprove:C,shouldDisableButton:F,showSuccessMessage:D,showError:_}=f,[T,R]=so.useCookies(["signup-this-session","functional-cookie-consent"]),O={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{C===!0&&O.jobTitle.current&&O.jobTitle.current.focus()},[C]),y.useEffect(()=>{T["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[T]),y.useEffect(()=>{D&&T["functional-cookie-consent"]&&R("signup-this-session","true",{path:"/",maxAge:3600})},[D]);const z=y.useMemo(()=>g_({placeholders:n,labels:t,shouldShow:v,functions:r,refs:O,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,O,v,f]),$=F?!0:C?!Object.values(g).every(A=>A===!0):!g.name||!g.email||["exists","pending","verify"].includes(x.boxType);return v.successMessage&&D?c.jsx(v_,{className:e}):c.jsxs("fieldset",{className:V("signup-form-fieldset",e),"data-testid":"signup-form",children:[v.title&&c.jsx("p",{className:"signup-title",children:c.jsx(re.FormattedMessage,{id:"signup_title"})}),_&&c.jsx(xn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Jt,{className:"signup-form",formRef:O.form,id:"sign-up-form",fields:z,intlPath:"signup",button:{variant:"primary",size:"medium",text:a||l.formatMessage({id:"signup_button_join"}),disabled:$?{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:v.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await p_({refs:O,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:A=>{r.handleError(A),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:O.hiddenValidation})]})};const Dn=({children:e,className:t="",styling:n={},...r})=>{const{background:i="default",padding:a="none"}=n;return c.jsx("section",{className:V("full-width-section",t,{[i]:i!=="default",[a]:a!=="none"}),...r,children:e})};const x_=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(i=>{r.push({href:i.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable new","data-gtm-event-type":"download-click","data-gtm-event-context":i.eventContext||"Download",target:"_blank",children:i.text})}),c.jsx(Dn,{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 ao="editSection_";function rh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const w_=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:i,setShowModal:a})=>{const{formatMessage:s}=re.useIntl();return c.jsxs(Ft,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${ao}placeholder_description`})}),i&&c.jsx("p",{children:c.jsx(ke,{href:r,variant:"secondary",size:"small",onClick:()=>rh({href:r,setShowModal:a}),children:n||s({id:`${ao}placeholder_cta`})})})]})},C_=({children:e,className:t="",formProps:n,formComponent:r,href:i,title:a,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=re.useIntl(),[m,h]=y.useState(!1),p=()=>h(!1),v=!!n||!!r,f=typeof i=="string"||v;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async g=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(g)}finally{p()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),p()}}})),c.jsxs("section",{className:V("edit-section",t),children:[v&&c.jsx(un,{title:o||`Edit ${a}`,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 g=>{var x,C;(x=n==null?void 0:n.functions)!=null&&x.onSuccess&&await((C=n==null?void 0:n.functions)==null?void 0:C.onSuccess(g)),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:a}),f&&c.jsx(ke,{href:i,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>rh({href:i,setShowModal:h}),children:d({id:`${ao}edit`})})]}),e||c.jsx(w_,{...l,href:i,setShowModal:h,showEditButton:f}),u&&c.jsx(qt,{})]})};const D_=({title:e=!1,text:t,logos:n=[],styling:r={},className:i=""})=>{const a=n.length;if(a===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:V("logos",i,`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":a===2||a===4,"three-col":a===5||a<=10&&a%3===0}),children:n.map(({logo:d,nameOfBusiness:m,link:h=!1,description:p=!1},v)=>{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}_${v}`))})})]})};let gs;const vs="contactFooter_",E_=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,i]=y.useState(0),[a,s]=y.useState(!1),o=()=>{n.current&&i(n.current.clientHeight)},l=()=>{a||(s(!0),clearTimeout(gs),gs=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(gs),window.removeEventListener("resize",l)}),[]),c.jsx(Dn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(re.FormattedMessage,{id:`${vs}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:a?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(re.FormattedMessage,{id:`${vs}text`})}),c.jsx(yn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(re.FormattedMessage,{id:`${vs}email`})})]}),c.jsx(Xm,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},__=({activeLink:e,profile:t,...n})=>c.jsx(Dn,{children:c.jsx(xf,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(yf,{activeLink:e,profile:t}),c.jsx(Ad,{...n})]})})});const bs="cookieBanner_",ys=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],xs=new Date(Date.now()+12*30*24*60*60*1e3),ih=()=>{const e=re.useIntl(),[t,n,r]=so.useCookies(ys),[i,a]=y.useState(!t["apol-cookie-banner"]),s=()=>{ys.forEach(d=>{n(d,!0,{path:"/",expires:xs,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),a(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:xs}),ys.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:xs});return}r(d)}),a(!1)};if(!i)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:`${bs}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${bs}title`})}),c.jsx("p",{children:e.formatMessage({id:`${bs}text`})}),c.jsx(pr,{buttons:u})]})},tn={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:Gn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Gn["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:Gn.support,gtmType:"concierge-email-click"},business:{email:Gn.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 nr="footer_",ia="SiteFooter",ed=({group:e})=>{const t=tn[e].order||[];let n=!1;return"text"in tn[e]&&(n=tn[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(re.FormattedMessage,{id:`${nr}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:i,gtmType:a}=tn[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:i,className:"gtm-trackable","data-gtm-event-context":ia,"data-gtm-event-type":a,...s,children:c.jsx(re.FormattedMessage,{id:`${nr}${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(re.FormattedMessage,{id:`${nr}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(re.FormattedMessage,{id:`${nr}${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":ia,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},ou=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(ua,{element:"hr"}),c.jsx(So,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":ia,"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(ed,{group:e}),Object.keys(tn[e]).includes("child")&&c.jsx(ed,{group:tn[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(tn.social.order)&&tn.social.order.map(e=>{const t=tn.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":ia,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(re.FormattedMessage,{id:`${nr}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(re.FormattedMessage,{id:`${nr}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),We={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=a=>{const s=`logged${e?"In":"Out"}`;return t>=n[a][s]};let i={};return["navigation","search"].forEach(a=>{i[a]=r(a)}),i},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(i=>i===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:i=!1})=>{if(!i&&n[e]===t||!i&&e===kt.ACCOUNT&&t===!1&&n[kt.SITE]===!0)return;const a=Date.now();if(!i&&!t&&We.handlerCalled[e]&&a-We.handlerCalled[e]<500)return;We.handlerCalled[e]=a;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case kt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case kt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case kt.ACCOUNT:o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const i=ad(e[r],t);if(!(typeof i>"u")&&(!n||i[t]&&i[t].includes(n)||i.value&&i.value.includes(n)||i.toString().includes(n)))return e[r]}return e[0].children?We.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:i})=>{var l;if(!t.current||!t.current.children)return;const a=n?"desktop":"default";if(r[e][a]){(l=document.querySelector(`#header ul a[href="${r[e][a]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case kt.SITE:if(n){const u=We.findFirstChild(t.current.children,"className","has-submenu parent"),d=We.findFirstChild(u.children,"id",kt.SITE);s=We.findFirstChild(d.children,"href")}else s=We.findFirstChild(t.current.children,"href");break;case kt.ACCOUNT:if(o=We.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=We.findFirstChild(o.children,"href");break;default:return}s&&(i([{type:`focusElements.${e}.${a}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(We.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(We.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(We.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{We.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Xr={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"}}}},aa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:i=()=>{},doTrack:a=null})=>{const s=re.useIntl(),o=ad(Xr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=a===null?l?o.doTrack:!0:a,d=e.includes("buttons.");let m=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(m+=`_logged${t?"In":"Out"}`);let h=!1;if(o.href){let C=o.gtmType||`${e}-click`;if(C.includes(".")){const F=C.split("."),D=F[F.length-2];C=`${D==="topics"?`${D}-`:""}${F[F.length-1]}`}h={href:o.withReturnTo?`${o.href}?returnTo=${window.location.pathname}`:o.href},u&&(h={...h,className:"gtm-trackable","data-gtm-event-type":C,"data-gtm-event-context":"HeaderButtons"}),d&&(h={...h,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],v=p&&o[o.order[0]].order,f=h&&window.location.pathname===o.href;let b={},g={},x={};if(f&&(b={...b,"aria-current":"page"}),p){const C=o.menuId||e,F={onClick:D=>We.events.onClick(D,{id:C,callback:i,isOpen:r[C]}),onFocus:()=>We.events.onFocus({id:C}),onBlur:()=>We.events.onBlur({id:C,callback:i}),onMouseLeave:()=>We.events.onBlur({id:C,callback:i}),onMouseEnter:()=>We.events.onMouseEnter({id:C,callback:i})};g={...F,id:C===kt.SITE?kt.SITE:kt.ACCOUNT},n&&(v&&(x={...F,className:"navigation-button",onKeyPress:D=>{D.key==="Enter"&&We.events.onClick(D,{id:C,callback:i,isOpen:r[C]})},"aria-haspopup":!0,"aria-expanded":r[C],"aria-controls":C}),g={...g,hidden:C in r?!r[C]:!0}),v||(g={...g})}return c.jsxs("li",{className:V({[o.className]:o.className,"has-submenu":p,parent:v,active:f}),...b,children:[h?y.createElement(d?ke:"a",h,s.formatMessage({id:m})):n&&o.order&&v?c.jsxs("button",{...x,children:[s.formatMessage({id:m}),c.jsx(Ie,{children:s.formatMessage({id:`header_menu_${r[kt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:m}),o.order&&c.jsx("ul",{...g,children:o.order.map(C=>{if(!o[C])return null;const F={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:i,doTrack:l?u:null};return o[C].order?c.jsxs("li",{className:V({[o[C].className]:o[C].className}),children:[s.formatMessage({id:`${m}_${C}`}),c.jsx("ul",{children:o[C].order.map(D=>c.jsx(aa,{id:`${e}.${C}.${D}`,...F},D))})]},C):c.jsx(aa,{id:`${e}.${C}`,...F},C)})})]},e)};const k_={height:67,height_desktop:83};var kt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(kt||{});const uu=({showNavigation:e=!0})=>{const t=re.useIntl(),n=y.useContext(at),r=Rn(!0,!0),i=n&&typeof n.id=="string",a=y.useMemo(()=>We.getIsDesktopVersion(i,r),[i,r]),[s,o]=y.useReducer(ei,{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]),dd({scrollPosition:k_[`height${a.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const g=m.current.menus;!a&&g["site-navigation"]||We.shouldChangeHeaderIsVisible(!0,g,o)},scrollDown:()=>{const g=m.current.menus;!a&&g["site-navigation"]||We.shouldChangeHeaderIsVisible(!1,g,o)}}});const h=(g,x,C=!1)=>{We.handleMenus({id:g,value:x,menus:m.current.menus,dispatch:o,forceHandle:C})},p=y.useRef(null),v=g=>{g.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(x=>{m.current.menus[x]&&h(x,!1,!0)})};y.useEffect(()=>{var g;return(g=document.getElementById("header"))==null||g.addEventListener("keydown",v),()=>{var x;(x=document.getElementById("header"))==null||x.removeEventListener("keydown",v)}},[]),sr(()=>{u["site-navigation"]&&We.autoFocus({menu:"site-navigation",navigationRef:p,isDesktopVersion:a.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),sr(()=>{u["account-navigation"]&&We.autoFocus({menu:"account-navigation",navigationRef:p,isDesktopVersion:a.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!a.search&&c.jsx("button",{className:"search toggle-search-button",onClick:g=>{g.preventDefault(),g.stopPropagation(),h("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Ie,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(nh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:a.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!a.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:g=>{g.preventDefault(),g.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(Ie,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:p,id:"navigation",hidden:a.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!a.navigation&&u["account-navigation"]?"account":"default",children:Xr.order.map(g=>c.jsx(aa,{id:g,isLoggedIn:i,isDesktopVersion:a.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:h},g))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:V({"logged-in":i,"logged-out":!i,visible:l}),children:[c.jsx(Ie,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(So,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[a.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),i?c.jsxs("button",{className:"account-button",onClick:g=>We.events.onClick(g,{id:"account-navigation",callback:h,isOpen:u["account-navigation"]}),onMouseEnter:()=>We.events.onMouseEnter({id:"account-navigation",callback:h}),onMouseLeave:()=>We.events.onBlur({id:"account-navigation",callback:h}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Ie,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(on,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:Xr.buttons.order.map(g=>c.jsx(aa,{id:`buttons.${g}`},g))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:V("overlay",{open:u["site-navigation"]||u["account-navigation"]||!a.search&&u.search})})]})};const F_=()=>{const e=re.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(uu,{}),c.jsx("div",{id:"content",children:c.jsx(xn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(ou,{})]})},ah=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:i={},styling:a={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=i,{background:d="default",variant:m="default",circle:h="default",modal:p="default"}=a,v=ud(),[f,b]=y.useState(""),g=_=>{const{detail:{message:T}}=_;b(T)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",g),()=>{document.removeEventListener("ariaLive",g)}),[v]);const x=Ti(e,{locale:o}),C=Ti(t,{locale:o}),F=Ti(n,{locale:o}),D={};return d!=="default"&&(D[d]=!0),m!=="default"&&(D[m]=!0),h!=="default"&&(D[h]=!0),c.jsx(Fh.ErrorBoundary,{onError:r,fallback:c.jsx(F_,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:V(s,D,{"has-footer":u}),children:[c.jsx(uu,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[C&&c.jsx("div",{className:V("additional-content prepended",{"large-modal":p==="large"}),children:C}),y.createElement(d==="bold"?vo:"div",{id:"content",children:x,className:V({"large-modal":p==="large"})})]}),F&&c.jsx("div",{className:"additional-content appended",children:F}),u&&c.jsx(ou,{}),c.jsx(ih,{})]}),f&&c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},td={default:"tags_",headerTopics:"header_topics_topics_"},ws={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"},A_={getTagDetails:e=>{if(e.includes("topic_")){if(e=ws.topic[e.replace("topic_","")],e){const t=Xr.topics.topics[e].href;return t?{id:e,href:t,text:`${td.headerTopics}${e}`}:null}return null}return ws[e]?(e=ws[e],{id:e,text:`${td.default}${e}`}):null}};const B_=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:i="",gtmType:a="tag-click",gtmContext:s="tags"})=>{const o=re.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=A_.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:V("tags text-small",t,i,{"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":a,"data-gtm-event-context":s,children:d}):d},u.id)})})};const sh=25,T_=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:i=!1,loadNextPage:a=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",showHeader:u=!0,showPlaceholders:d=!1,className:m=""})=>{const h=re.useIntl(),p="membersList",v=y.useContext(at),[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(rn,{member:v,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:n||""},{scope:dt.Platform,area:"all"}]}}),c.jsx(yn,{href:"/profiles/me",className:"text-small",onClick:g=>{g==null||g.preventDefault(),g==null||g.stopPropagation(),b(!0)},children:h.formatMessage({id:`${p}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((g,x)=>c.jsxs("li",{children:[c.jsx(rn,{member:g,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:n||""},{scope:dt.Platform,area:"all"}]}}),g.isAdmin&&c.jsx(Yt,{children:h.formatMessage({id:`${p}_admin`})})]},x)),d&&e.length===0&&t>0?[...new Array(Math.min(t,sh))].map((g,x)=>c.jsx("li",{children:c.jsx(fa,{layout:"member"})},x)):c.jsx(c.Fragment,{})]}),i&&c.jsx(ti,{hasNextPage:i,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(Da,{form:s,showModal:f,content:{title:h.formatMessage({id:`${p}_modal_title`})},functions:{onClose:()=>{b(!1)}}}):c.jsx(c.Fragment,{})]})},oh=T_,S_=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const i=re.useIntl();return t?c.jsx("small",{children:$t(i.formatMessage,`${e}explainer`,n,"action",{a:a=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:a})})}):c.jsx(c.Fragment,{})},j_=({intlPath:e,type:t,...n})=>{const r=re.useIntl();return c.jsx(eu,{label:{visible:r.formatMessage({id:`${e}label`}),screenreader:$t(r.formatMessage,`${e}label_action`,t,"action")},...n})},nd=5,P_=2,O_=e=>{var r;let t=0;const n=[];return(r=e==null?void 0:e["poll-options"])==null||r.forEach((i,a)=>{i!==""&&(t++,n.push({position:t,description:{en:i}}))}),{title:{en:e.title},options:n,settings:{allow_multiple_votes:e["multiple-answers"]||!1}}};let _i=null;const Ge="discussion_form_",ri=({id:e,parentId:t,content:n={type:_e.Response,slugs:{}},userHasPermissions:r=!0,meta:i,placeholder:a,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},functions:u,data:d={},gtmContext:m="DiscussionForm"})=>{var Ee,K,oe;const h=re.useIntl(),p=y.useContext(at),[v,f]=y.useState(n.type),[b,g]=y.useState(""),{isLoading:x=!1,isInWrapper:C=!1,isInOverlay:F=!1,isAutoFocused:D=!1,isEditing:_=!1,hasTitleField:T=!1,canBePrepopulated:R=!1,isPrepopulated:O=!1,showTitle:z=!1,showGuidelines:$=!0,showDivider:A=!1,showSuccessMessage:B=!0,showPostType:j=!1,postCategories:M=[]}=i||{},{onChange:U=()=>{},create:W=()=>{},createPoll:ie=()=>{},handleSaveEdit:se=()=>{},handleCancel:E=()=>{},callback:ee=()=>{},onMention:Z=()=>{},listMembers:k=()=>Promise.resolve([]),clickMentionFallback:P=()=>{},getLinkPreview:q=()=>Promise.resolve({}),props:S={create:{projectNames:["questions-answers"]}}}=u,[L,Q]=y.useState({body:_&&_.text||O&&O.text||"",data:d!=null&&d.link?{link:d==null?void 0:d.link}:{}}),[Y,te]=y.useState(l.error||!1),ce={status:!1,title:T&&T.text||"",polls:0},[J,pe]=y.useState(ce);if(y.useEffect(()=>{R&&!_&&O&&O!==L.body&&Q(ae=>({...ae,body:O.text||""}))},[O]),y.useEffect(()=>{f(n.type)},[n.type]),x)return c.jsx(It,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const de=(ae,he)=>{Q(Te=>({...Te,body:ae,data:{link:he}})),U({body:ae});let ve;!p||!p.id?ve=$t(h.formatMessage,`${Ge}error_loggedOut`,v,"action"):r?s>0&&ae.length>=s&&(ve=`${Ge}error_tooLong`):ve=$t(h.formatMessage,`${Ge}error_noPermission`,v,"action"),ve?te(ve):Y&&te(!1)};let xe=`${v}-form`;if(v===_e.Response||v===_e.Reply){const ae=((Ee=n.slugs)==null?void 0:Ee.reply)||((K=n.slugs)==null?void 0:K.answer)||((oe=n.slugs)==null?void 0:oe.question)||"";ae&&(xe=`${xe}-${ae.slice(-15)}`)}e&&(xe=`${e}-${xe}`);const Be=async ae=>{if(!p||!p.id||!r||Ne)return;_i&&clearTimeout(_i),pe(ve=>({...ve,status:"submitting"}));const he=window.location.pathname;try{let ve;switch(v){case _e.Post:ve=await W({title:ae.title,content:ae.body,categories:ae.categories,data:ae.data});break;case _e.Poll:ve=await ie(O_(ae));break;case _e.Question:ve=await W({title:ae.body,authorId:p&&p.id,data:ae.data,...S==null?void 0:S.create});break;case _e.Response:ve=await W({questionSlug:n.slugs.question},{body:ae.body,authorId:p&&p.id,contentPath:he,data:ae.data});break;case _e.Reply:ve=await W({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:ae.body,authorId:p&&p.id,contentPath:he,data:ae.data});break;default:break}await Lh(1e3),ee&&await ee(ve),_i=setTimeout(()=>{Q({body:"",data:{}}),f(_e.Post),pe(be=>({...be,status:"submitted"})),g($t(h.formatMessage,`${Ge}success`,v,"action"));const Te=new Event(rt.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(Te),Fe()},500)}catch(ve){const Te=ve;let be=`${Ge}error`;Te!=null&&Te.message.includes("entry already exists")&&(be=$t(h.formatMessage,`${Ge}error_alreadyExists`,v,"action")),Te!=null&&Te.message.includes("429")?be=$t(h.formatMessage,`${Ge}error_tooMany`,v,"action"):Te!=null&&Te.message.includes("400")&&(be=`${Ge}error`),te(be),Fe()}},Fe=()=>{_i=setTimeout(()=>{te(!1),pe(ce),g("")},5e3)},Ve=!L.body||!qi(L.body),Re=!J.title||!qi(J.title);let Ne=!1;v!==_e.Poll&&(Ne=Ve),T&&(Ne=Ne&&Re);const Qe=J.status==="submitting",Ae=[];v===_e.Poll?Ae.push({id:"poll-options",label:h.formatMessage({id:`${Ge}option_label`}),type:"multiple-inputs",placeholder:h.formatMessage({id:`${Ge}option_placeholder`}),multipleInputs:{showCount:!0,maxInputs:nd,hasButton:{variant:"secondary",size:"small",styling:{muted:!0},icon:"plus",children:h.formatMessage({id:`${Ge}option_cta`})}},functions:{onChange:ae=>{var ve;let he=0;ae&&Array.isArray(ae)&&(he=((ve=ae==null?void 0:ae.filter(Te=>Te!==""))==null?void 0:ve.length)||0),J.polls!==he&&pe(Te=>({...Te,polls:he})),U({polls:ae})}},validation:[{condition:"required"}]},{type:"checkbox",id:"multiple-answers",label:h.formatMessage({id:`${Ge}multiplePollAnswers`}),className:"text-medium"}):Ae.push({component:j_,props:{formID:xe,intlPath:Ge,showLabel:T!==!1,type:v}},{component:su,props:{id:`${xe}-input`,value:J.status==="submitting"&&!Y?"":L.body,placeholder:a||$t(h.formatMessage,`${Ge}placeholder`,v,"action"),maxLength:s,meta:{isInOverlay:F},functions:{onChange:de,onChangeData:ae=>{Q(he=>({...he,data:ae}))},onMention:Z,listMembers:k,clickMentionFallback:P,getLinkPreview:q},data:d,autoFocus:_!==!1||D&&!T,"aria-invalid":!!Y,"aria-errormessage":"error-message"}},{component:S_,props:{intlPath:Ge,showGuidelines:$,type:v,gtmContext:m}}),A&&Ae.push({component:qt}),T&&Ae.unshift({id:"title",type:"text",value:T.text,limit:v===_e.Poll?0:250,label:h.formatMessage({id:`${Ge}${v===_e.Poll?"question":"titleField"}_label`}),placeholder:h.formatMessage({id:`${Ge}${v===_e.Poll?"question":"titleField"}_placeholder`}),functions:{onChange:ae=>{pe(he=>({...he,title:ae})),U({title:ae})}},validation:v===_e.Poll?[{condition:"required"}]:[]}),j&&Ae.unshift({id:"postType",type:"radio",value:"no-category",accessibilityOptions:{checkboxes:{navigateWithArrowKeys:!0}},styling:{displayOptionsAsPills:!0},label:h.formatMessage({id:`${Ge}postType_label`}),options:M.map(ae=>({id:ae.slug,label:ae.name})),validation:[{condition:"required"}],functions:{onChange:ae=>{U({postType:ae}),ae.includes(_e.Poll)?f(_e.Poll):v!==_e.Post&&f(_e.Post)}}});let Oe=!p||!p.id||!r||Qe;if(v===_e.Poll){const ae=J.polls;Oe=Oe||Re||ae<P_||ae>nd}else Oe=Oe||Ne,_&&(T?Oe=Oe||L.body===_.text&&J.title===T.text:Oe=Oe||L.body===_.text);return c.jsxs(c.Fragment,{children:[c.jsxs(Jt,{id:xe,className:V("discussion-card discussion-form",{"no-styling":C&&_}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:_&&!Qe||l.cancel},functions:{onSuccess:async ae=>{const he={...L,...ae};if(_){pe(ve=>({...ve,status:"submitting"})),se(he);return}await Be(he)},onCancel:E},fields:Ae,intlPath:Ge,button:{variant:"primary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"data-gtm-event-type":`${_?"save":"submit"}-${v}-click`,"data-testid":"save-button",disabled:Oe,text:{default:!_&&(o!=null&&o.submit)?o==null?void 0:o.submit:h.formatMessage({id:`${Ge}${_?"save":"post"}`}),submitting:h.formatMessage({id:`${Ge}${_?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},"data-gtm-event-context":m,"data-gtm-event-type":`cancel-${v}-click`,disabled:!l.cancel&&(!p||!p.id||!L.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:h.formatMessage({id:`${Ge}cancel`})},gtm:{context:m,event:`${v}-form`},"data-testid":`discussion-${v}-form`,children:[z&&!_&&v===_e.Question&&c.jsx("h2",{children:$t(h.formatMessage,`${Ge}title`,v,"action")}),c.jsx(rn,{member:p?{...p,link:!1}:"community",gtmContext:m,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:t||""},{scope:dt.Platform,area:"all"}]}})]}),J.status==="submitted"&&B&&c.jsx(or,{className:"success","data-testid":"success",children:$t(h.formatMessage,`${Ge}success`,v,"action")}),Y&&c.jsx(or,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof Y=="string"?Y.includes(" ")?Y:h.formatMessage({id:Y},{action:h.formatMessage({id:`discussion_action_${v}`}),maxLength:s}):Y}),b&&c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:b})]})},M_=Object.freeze(Object.defineProperty({__proto__:null,default:ri},Symbol.toStringTag,{value:"Module"}));const N_={showForm:!1},Ca=y.createContext(N_),uh=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(Ca.Provider,{value:{...t,updateConversation:n},children:e})};function I_({author:e,originalAuthorId:t,createdAt:n,contentData:r,content:i,gtmContext:a,badges:s}){var m;const o="discussion_",l=re.useIntl(),u=(m=i==null?void 0:i.componentProps)==null?void 0:m.member.additionalContent,d=u?u.customMessage:{};return c.jsxs("div",{className:"author-section",children:[c.jsx(rn,{member:e,additionalContent:{createdAt:n,didEdit:r.didEdit,customMessage:d},className:V({highlighted:typeof e!="string"&&e.id===t}),styling:{additionalContentNewLine:!!d},gtmContext:a,gtmType:"profile-click",badges:s}),i.pinned&&c.jsx(Yt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Ie,{children:l.formatMessage({id:`${o}pinned_post`})})})]})}const Cs=({children:e,class:t,...n})=>{const r={...n,class:V("subtle",t)};return c.jsx("blockquote",{...r,children:e})};function R_({content:e}){var t;return(t=e.categories)!=null&&t.length?c.jsx("ul",{className:"categories-list",children:e.categories.map(n=>c.jsx(Yt,{size:"small",element:"li",children:n.name},n.slug))}):c.jsx(c.Fragment,{})}var sa=(e=>(e.Always="always",e.AfterVoting="after-voting",e))(sa||{});const $_=(e,t,n)=>n===void 0?0:e.some(i=>i.hasUserVoted)?t?e.findIndex(i=>!i.hasUserVoted):e.findIndex(i=>i.hasUserVoted):0,L_=(e,t,n,r=0)=>{if(!e)return{nextElement:null,nextIndex:0};let i=n==="next"?e.nextElementSibling:e.previousElementSibling,a=r+(n==="next"?1:-1);for(;i;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}const s=e.parentElement;if(s)for(i=n==="next"?s.firstElementChild:s.lastElementChild,a=n==="next"?0:s.childElementCount-1;i&&i!==e;){if(!i.classList.contains(t))return{nextElement:i,nextIndex:a};i=n==="next"?i.nextElementSibling:i.previousElementSibling,a=a+(n==="next"?1:-1)}return{nextElement:null,nextIndex:0}};const z_=({user:e,option:t,optionIndex:n,totalPollVotes:r=0,allowMultipleVotes:i=!1,showResults:a=!1,hasVotedOnPoll:s=!1,isTabbable:o=!1,functions:l})=>{var b;const[u,d]=y.useState(t.hasUserVoted);let m=0,h={};const p=(i||!s)&&!t.hasUserVoted;a&&(m=Math.round(t.numVotes/r*100)||0,h={"--vote-perc":`${m}%`});const v=g=>{g.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:v,onKeyDown:g=>{var x;if(g.code!=="Tab")switch(g.code){case"Enter":case"Space":g.preventDefault(),g.stopPropagation(),v(g),d(!0);break;case"ArrowUp":case"ArrowDown":g.stopPropagation(),g.preventDefault();const C=g.code==="ArrowUp"?"prev":"next",{nextElement:F,nextIndex:D}=L_(g.currentTarget.parentElement,"selected",C,n);F&&((x=F.querySelector("label"))==null||x.focus(),l==null||l.setTabbableOption(D));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})}),a&&c.jsxs("div",{className:"vote-details",children:[t.hasUserVoted&&c.jsx(on,{className:"author-profile-picture",name:e.name,src:(b=e==null?void 0:e.image)==null?void 0:b.thumbnail}),c.jsxs("p",{className:"vote-perc text-medium","data-testid":"vote-perc",children:[m,"%"]})]}),c.jsx("input",{type:i?"radio":"checkbox",id:t.id,name:t.id,checked:u,tabIndex:-1})]})};const lh=({title:e,options:t,settings:n,functions:r})=>{const i="poll_",a=re.useIntl(),s=y.useContext(at),{showRemoveVote:o=!0,allowMultipleVotes:l=!1,resultsVisibility:u=sa.AfterVoting}=n||{},[d,m]=y.useState($_(t,l,s==null?void 0:s.id)),h=t.reduce((g,x)=>g+x.numVotes,0),p=t.filter(g=>g.hasUserVoted).length,v=t.filter(g=>g.hasUserVoted),f=y.useCallback(async g=>{await r.createVote({reactionId:g.id})},[]),b=y.useCallback(async()=>{t.forEach(async g=>{g.hasUserVoted&&g.userVote&&r.removeVote({reactionId:g.userVote.id})})},[t]);return c.jsxs("div",{className:"poll-wrapper",children:[c.jsx("p",{className:"poll-title",children:e}),c.jsxs("aside",{className:"poll-info",children:[c.jsx("p",{className:"poll-instructions","data-testid":"poll-instructions",children:c.jsx("small",{children:a.formatMessage({id:`${i}instructions`},{allowMultipleVotes:l})})}),c.jsx("p",{className:"poll-num-votes",children:c.jsx("small",{"data-testid":"poll-total-votes",children:a.formatMessage({id:`${i}num_votes`},{number:h})})}),o&&c.jsx("p",{className:"poll-remove-vote",children:c.jsx(ke,{variant:"tertiary",onClick:b,"data-testid":"remove-votes-button",disabled:p===0,children:c.jsx("small",{children:a.formatMessage({id:`${i}remove_vote_button`},{number:p})})})})]}),t&&c.jsx("form",{children:c.jsx("fieldset",{children:c.jsx("ul",{className:"poll-options",children:t==null?void 0:t.map((g,x)=>c.jsx(z_,{isTabbable:d===x,user:s,option:g,optionIndex:x,totalPollVotes:h,showResults:u==sa.Always||!!p,allowMultipleVotes:l,hasVotedOnPoll:!!p,functions:{createVote:f,setTabbableOption:m}},g.id))})})}),c.jsxs(Ie,{"aria-live":"polite",children:[a.formatMessage({id:`${i}aria_votes`},{number:p}),!!p&&c.jsx("ul",{children:v.map(g=>c.jsx("li",{children:g.label}))})]})]})};function q_({content:e,contentData:t,functions:n}){return c.jsx(lh,{title:t.title,options:(e==null?void 0:e.pollOptions)||[],settings:(e==null?void 0:e.pollSettings)||{},functions:{createVote:n.createVote,removeVote:n.removeVote}})}function U_({links:e={},contentData:t,postCutOff:n,content:r}){var i;return c.jsxs(c.Fragment,{children:[e.post?c.jsxs("a",{href:e.post,children:[(t==null?void 0:t.title)&&c.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),t.postBody.length>n?c.jsx(Fd,{text:t.postBody,markdownOptions:{overrides:{a:Ss,blockquote:{component:Cs}}}}):c.jsx(Sn,{options:{overrides:{a:Ss,blockquote:{component:Cs}}},children:t.postBody})]}):c.jsxs(c.Fragment,{children:[(t==null?void 0:t.title)&&c.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),c.jsx(Sn,{options:{wrapper:r.type===_e.Question?"h1":y.Fragment,forceWrapper:r.type===_e.Question,forceInline:r.type===_e.Question,forceBlock:r.type!==_e.Question,overrides:{blockquote:{component:Cs}}},children:t.postBody})]}),(i=t.data)!=null&&i.link?c.jsx(To,{data:t.data.link}):c.jsx(c.Fragment,{})]})}const Rt="discussion_",W_=195;let ki=null;const ii=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:i=!1,originalAuthorId:a,forceHide:s,functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:m,isTruncated:h=!1,setFocus:p=!1,isCommunity:v=!1,badges:f,basePath:b,parentId:g,locale:x="en"})=>{var K,oe,ae,he,ve,Te;const C=re.useIntl(),F=y.useContext(Ca),D=y.useContext(at),{createContent:_=async()=>{},deleteContent:T=async()=>{},updateContent:R=async()=>{}}=o.content||{},{createLike:O=()=>{},deleteLike:z=()=>{},listLikes:$=async()=>({})}=o.likes||{},{openComments:A=()=>{}}=o.comments||{},{listMembers:B=()=>Promise.resolve([]),clickMentionFallback:j=()=>{}}=o.form||{},{createVote:M=()=>{},removeVote:U=()=>{},removePoll:W=()=>{}}=o.polls||{},{author:ie,canLike:se,createdAt:E,id:ee,likes:Z=0,userLiked:k,comments:P=0,data:q}=t,S=ev(t.title,x),L=D&&D.id&&typeof ie!="string"&&ie.id&&ie.id===D.id||!1,Q=typeof se=="boolean"?se:!0,Y=L&&(!t.createdAt||Rh(t.createdAt,10,"seconds")),te=y.useRef(null),[ce,J]=y.useState({title:t.body!==S&&S||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:"",data:t&&t.data||{}}),[pe,de]=y.useState(!1),[xe,Be]=y.useState(Y?"highlighted":"default"),[Fe,Ve]=y.useState("");y.useEffect(()=>{const be=te.current;if(!(!be||xe==="default"))return document.addEventListener(rt.DISCUSSION_FORM_SUBMITTED,Re),be.addEventListener("transitionend",Ne),()=>{document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,Re),be.removeEventListener("transitionend",Ne)}},[]),y.useEffect(()=>{J(be=>({...be,title:t&&S||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1,data:t&&t.data||{}}))},[t.isEdited]),y.useEffect(()=>{(async()=>{const je=await Ao(ce.body,h,q==null?void 0:q.mentions,B);J(st=>({...st,postBody:je}))})()},[ce.body,q==null?void 0:q.mentions]);const Re=()=>{setTimeout(()=>{Be("fading")},1e3)},Ne=({propertyName:be})=>{be==="background-color"&&Be(je=>(je==="default"&&(document.removeEventListener(rt.DISCUSSION_FORM_SUBMITTED,Re),te.current&&te.current.removeEventListener("transitionend",Ne)),je==="fading"?"default":je))};if(i||!t||t.type===_e.Answer&&(!t.slugs||!t.slugs.question)||ce.postBody===""&&t.title==="")return c.jsx(It,{className:"discussion-card"});const Qe=async({title:be,body:je,data:st})=>{be||(be=""),je||(je=""),Ve("");try{if(!Li(be,ce.title)||!Li(je,ce.body)){const et=t.type===_e.Question?{title:je}:{title:be,body:je,data:st};await R(Ns(t.slugs),et)}J(et=>({...et,title:be||"",body:je||"",data:{...et.data,...st},isEditing:!1,didEdit:!0}))}catch{Ve(`${Rt}form_error`)}},Ae=()=>{if(F&&F.updateConversation){const be={showForm:!0},je=t.author;je&&je.id&&(v&&(be.prepopulateForm=`@{{${je.id}}}`),be.mentionData={id:je.id,name:je.name}),F.updateConversation(be)}setTimeout(()=>{var tt,_t,ut;const je=`reply-form-${(t.type===_e.Answer?t.slug:((tt=t.slugs)==null?void 0:tt.reply)||((_t=t.slugs)==null?void 0:_t.answer)||((ut=t.slugs)==null?void 0:ut.question)||"").toLowerCase().slice(-15)}`,st=document.getElementById(je),et=document.getElementById(`${je}-input`);et&&et.focus(),st&&st.scrollIntoView({behavior:"smooth"})},0)},Oe=async()=>{de(!1);try{t.type===_e.Poll?await W():await T(Ns(t.slugs))}catch{Ve("delete-error")}},Ee=[];return n&&L&&(t.type!==_e.Poll&&Ee.push({text:C.formatMessage({id:`${Rt}moreMenu_edit`}),onClick:()=>J(be=>({...be,isEditing:!0})),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),Ee.push({text:C.formatMessage({id:`${Rt}moreMenu_delete`}),onClick:be=>{be.preventDefault(),be.stopPropagation(),de(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...ef(`delete-${t.slug}-modal`,pe)})),r&&o.pins&&Ee.push({text:C.formatMessage({id:`${Rt}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&&((K=te==null?void 0:te.current)==null||K.focus(),(oe=te==null?void 0:te.current)==null||oe.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:V("discussion-post",u,{[xe]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!ce.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:te,tabIndex:p?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:be=>{if(!l.post||ce.isEditing||t.type===_e.Poll&&Xg(be,["poll-options","poll-info"],"discussion-post"))return;be.preventDefault(),be.stopPropagation(),ki&&clearTimeout(ki),ki=setTimeout(()=>{window.location.href=l.post},150);const je=new CustomEvent(rt.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:ki}});document.dispatchEvent(je)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:ee||t.slug,className:V("discussion-card",t.type,{editing:ce.isEditing,"has-link":l.post&&!ce.isEditing}),children:[!ce.isEditing&&c.jsx(I_,{author:ie,originalAuthorId:a,createdAt:E,contentData:{didEdit:ce.didEdit},content:t,gtmContext:d,badges:f}),ce.isEditing?c.jsx(ri,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:i,isInWrapper:!0,hasTitleField:ce.title!==""?{text:ce.title}:!1,isEditing:{text:ce.body,categories:[]},canBePrepopulated:v,isPrepopulated:!1},maxLength:t.type===_e.Question?250:5e4,forceShow:{error:Fe!==""&&Fe!=="delete-error"?C.formatMessage({id:Fe},{action:C.formatMessage({id:`${Rt}action_${t.type}`})}):!1},functions:{create:_,handleSaveEdit:Qe,handleCancel:()=>{Ve(""),J(be=>({...be,isEditing:!1}))},listMembers:B,clickMentionFallback:j},gtmContext:`${d}Form`,data:q}):c.jsxs(c.Fragment,{children:[t.type===_e.Poll?c.jsx(q_,{content:t,contentData:ce,functions:{createVote:M,removeVote:U}}):c.jsx(U_,{links:l,contentData:ce,postCutOff:W_,content:t}),c.jsx(R_,{content:t})]}),!ce.isEditing&&!(s!=null&&s.actionBar)&&c.jsx(gf,{className:t.type,gtmContext:d,contentType:t.type,likes:s!=null&&s.likes?!1:{count:Z||0,userLiked:k||!1,canLike:Q,peopleWhoLiked:t.peopleWhoLiked,activityId:t.id||t.slug,content:{slugs:t.slugs||{},slug:t.slug},functions:{createLike:O,deleteLike:z,listLikes:$},basePath:b,parentId:g},comments:!(s!=null&&s.comments)&&([_e.Question,_e.Post].includes(t.type)||l.comments)?{count:P||0,functions:{onClick:()=>{l!=null&&l.comments&&(window.location.href=l.comments),typeof A=="function"&&A()}}}:!1,replies:t.type==="answer"||t.type==="reply"?{functions:{onClick:Ae}}:!1,shareLink:{url:`${window.location.origin}${(ae=t.slugs)==null?void 0:ae.question}/${(he=t.slugs)==null?void 0:he.answer}${(ve=t.slugs)!=null&&ve.reply?`#${(Te=t.slugs)==null?void 0:Te.reply}`:""}`},moreMenu:{options:Ee,contentSlug:t.slug,reportData:{contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}}})]}),m,c.jsx(un,{id:`delete-${t.slug}-modal`,isOpen:pe,functions:{onOpen:()=>{},onClose:()=>de(!1)},forceShow:{error:Fe==="delete-error"?C.formatMessage({id:"${intlPath}delete_error"},{action:C.formatMessage({id:`${Rt}action_${t.type}`})}):!1},title:C.formatMessage({id:`${Rt}delete_title`},{action:C.formatMessage({id:`${Rt}action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>de(!1),children:C.formatMessage({id:`${Rt}delete_cancel`})},{variant:"primary",className:"destructive",onClick:Oe,children:C.formatMessage({id:`${Rt}delete_delete`})}],gtmContext:`${(t.type||"").charAt(0).toUpperCase()}${(t.type||"").slice(1)}:${t.slug}`,children:c.jsx(re.FormattedMessage,{id:"discussion_delete_text",values:{p:be=>c.jsx("p",{children:be}),action:C.formatMessage({id:`${Rt}action_${t.type}`})}})})]})})};const V_=y.lazy(()=>Promise.resolve().then(()=>ak)),H_=65,ch=({forceShow:e,form:t,className:n})=>{const r=re.useIntl(),i="discussionFormCard_",a="DiscardDraftModal",o=y.useContext(at)||"community",l=ma(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||Cd("showPost")==="true"||!1,warning:!1}),[h,p]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!h.showCachedText)return;(async()=>{const g=await Ao(h.title||h.body||"",H_,h.mentions);p(x=>({...x,prettifiedText:g}))})()},[h.showCachedText,h.title,h.body]);const v=b=>{if(!h.showCachedText||typeof d.warning=="string")return;let g;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),g=b.detail.link;else{const x=b;x.preventDefault(),x.stopPropagation();const F=x.target.closest("a");g=F&&F.getAttribute("href")}m(x=>({...x,warning:g||!1}))};y.useEffect(()=>{if(!h.showCachedText){document.removeEventListener(rt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(rt.MEMBER_CLICKED,v),document.removeEventListener("click",v);return}return document.addEventListener(rt.DISCUSSION_POST_CLICKED,v),document.addEventListener(rt.MEMBER_CLICKED,v),document.addEventListener("click",v),()=>{document.removeEventListener(rt.DISCUSSION_POST_CLICKED,v),document.removeEventListener(rt.MEMBER_CLICKED,v),document.removeEventListener("click",v)}},[h.showCachedText]),y.useEffect(()=>{const b=g=>{if(!(!h.showCachedText||d.warning!==!1))return g.preventDefault(),g.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[h.showCachedText,d.warning]);let f=r.formatMessage({id:`${i}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(g=>({...g,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(on,{name:l.name,src:l.image,alt:""}),c.jsx(Sn,{className:V("input",{placeholder:!h.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:jt,blockquote:jt,br:jt,em:jt,li:jt,ol:jt,p:jt,s:jt,span:jt,strong:jt,ul:jt}},children:f})]}),c.jsxs(gr,{children:[c.jsx(V_,{showModal:d.form,functions:{cacheText:p,onClose:()=>{m(b=>({...b,form:!1}))}},form:t,cachedText:h,className:"in-portal"}),c.jsx(un,{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:`${i}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${i}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":a},{variant:"primary",children:r.formatMessage({id:`${i}overlay_cta_continue`}),onClick:()=>{m({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":a}],children:c.jsx("p",{children:r.formatMessage({id:`${i}overlay_text`})})})]})]})},K_=y.lazy(()=>Promise.resolve().then(()=>M_)),lu=({isCard:e=!1,form:t,parentId:n,categories:r,membershipRequiredToPost:{isMember:i,required:a,join:s,leave:o,notMemberStateText:l},locale:u=wo})=>{if(a&&!i)return c.jsx(xn,{text:l,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(xo,{isShort:!0,functions:{join:s,leave:o}})}});const{content:d,functions:m,meta:h,...p}=t,v={content:{type:(d==null?void 0:d.type)||"reply",slugs:(d==null?void 0:d.slugs)||{}},functions:{...m,create:(m==null?void 0:m.create)||(()=>{})},parentId:n,meta:{...h,isEditing:(h==null?void 0:h.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1,postCategories:[{name:"Post",slug:"no-category"},...r||[]]},...p,id:`add-post-${p.id||""}`};return e?c.jsx(ch,{form:v}):c.jsx(K_,{...v})},cu=({form:e})=>{const t=y.useContext(at),n=re.useIntl(),[r,i]=y.useState(!1),a=()=>{Kh(t)||i(!0)};y.useEffect(()=>(document.addEventListener(rt.DISCUSSION_POST_ADDED,a),()=>{document.removeEventListener(rt.DISCUSSION_POST_ADDED,a)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(Da,{form:e,showModal:r,functions:{onClose:()=>{i(!1)}},content:s})};const Ds="discussion_responses_",dh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=re.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${Ds}title`},{action:r.formatMessage({id:`${Ds}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:$t(r.formatMessage,`${Ds}empty`,e,e)})]})};const fh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:i})=>{const a=re.useIntl(),s=y.useContext(Ca),o=Ti(i,{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(ti,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:a.formatMessage({id:"discussion_thread_loadMore"}),error:a.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx(ri,{...r})]})};function Z_(e){var n,r;let t=!1;return(r=(n=e.latest_reactions)==null?void 0:n["poll-option"])==null||r.forEach(i=>{var a,s;(s=(a=i.own_children)==null?void 0:a["poll-vote"])!=null&&s.length&&(t=!0)}),t}function Y_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i,user:a}){const{mutate:s}=ze.useMutation({mutationFn:e,onMutate:({reactionId:o})=>t(l=>(nf({activity:l,reactionId:o,user:a}),l)),onError:n,onSuccess:(o,{reactionId:l},u)=>{u&&rf({activity:u,reactionId:l,correctReactionId:o.body.id,user:a}),r.setQueryData(i,u)}});return s}function G_({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=ze.useMutation({mutationFn:e,onMutate:({content:i,title:a})=>t(s=>(s&&(i!=null&&(s.content=i),a!=null&&(s.title=a)),s)),onError:n});return r}function Q_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=ze.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Zi({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Zi({activity:l,reaction:s}),r.setQueryData(i,l)}});return a}function J_({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:i}){const{mutate:a}=ze.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Yi({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Yi({activity:l,reaction:s}),r.setQueryData(i,l)}});return a}function X_({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:i,isFetching:a}=ze.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:i,isFetching:a}}function ek({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=ze.useMutation({mutationFn:e,onMutate:({reactionId:a})=>t(s=>(af({activity:s,reactionId:a}),s)),onError:n});return i}function tk({queryFns:{read:e,edit:t,like:n,unlike:r,pin:i,unpin:a,createVote:s,removeVote:o},queryKey:l}){const u=ze.useQueryClient(),d=da(),m={queryClient:u,queryKey:l},h={mutationHandlers:{error:Co(m),mutate:Do(m)},user:d,...m},p=G_({...h,mutationFn:t}),v=Q_({...h,mutationFn:n}),f=nk({...h,mutationFn:r}),b=J_({...h,mutationFn:i}),g=rk({...h,mutationFn:a}),x=Y_({...h,mutationFn:s}),C=ek({...h,mutationFn:o}),{activity:F,...D}=X_({queryKey:l,queryFn:e});return{activity:F,mutations:{edit:p,like:v,unlike:f,pin:b,unpin:g,createVote:x,removeVote:C},user:d,...D}}function nk({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=ze.useMutation({mutationFn:e,onMutate:a=>t(s=>(s&&sf({activity:s,user:r}),s)),onError:n});return i}function rk({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:i}=ze.useMutation({mutationFn:e,onMutate:a=>(console.log("unpin"),t(s=>(s&&of({activity:s,user:r}),s))),onError:n});return i}const ik=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:i,functions:{activities:{remove:a,...s},likes:o,reactions:l,form:u,join:d,leave:m,polls:h},profile:p,categories:v,locale:f=wo})=>{var Z,k,P,q,S,L,Q,Y,te,ce,J,pe;const b=re.useIntl(),g={...s,...h},{activity:x,error:C,isLoading:F,mutations:{edit:D,like:_,unlike:T,pin:R,unpin:O,createVote:z,removeVote:$}}=tk({queryFns:g,queryKey:[e,t,n]});if(F)return c.jsx(It,{style:{height:"400px"}});if(C||!x)return c.jsx(xn,{variant:"error",text:b.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:A,verb:B,latest_reactions:j,mentioned_users:M,additional_data:U}=x,W=(((Z=j==null?void 0:j.like)==null?void 0:Z.length)||0)>0,ie=(((k=A==null?void 0:A.like)==null?void 0:k.length)||0)>0,se=ie?A==null?void 0:A.like[0].id:"",E=W?(P=j==null?void 0:j.like)==null?void 0:P.map(de=>{var xe,Be,Fe;return{id:(xe=de==null?void 0:de.user)==null?void 0:xe.id,name:(Fe=(Be=de==null?void 0:de.user)==null?void 0:Be.data)==null?void 0:Fe.name}}):!1,ee=x==null?void 0:x.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(ii,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:B,title:x==null?void 0:x.title,body:x==null?void 0:x.content,categories:Bo((x==null?void 0:x.categories)||[],v||[]),canLike:r,createdAt:(x==null?void 0:x.time)||"",slugs:{question:`${e}/${t}`,answer:x==null?void 0:x.id},slug:n,author:br(ee),userLiked:ie,likes:((q=x==null?void 0:x.reaction_counts)==null?void 0:q.like)||0,comments:(x==null?void 0:x.total_replies)||0,peopleWhoLiked:E,data:{mentions:M,...U||{}},pinned:((S=x==null?void 0:x.reaction_counts)==null?void 0:S.pin)&&((L=x==null?void 0:x.reaction_counts)==null?void 0:L.pin)>0||!1,pollOptions:tf(x,f),pollSettings:{showRemoveVote:(Q=x==null?void 0:x.settings)==null?void 0:Q.show_remove_vote,allowMultipleVotes:(Y=x==null?void 0:x.settings)==null?void 0:Y.allow_multiple_votes,deadlineAt:(te=x==null?void 0:x.settings)==null?void 0:te.deadline_at,hideParticipants:(ce=x==null?void 0:x.settings)==null?void 0:ce.hide_participants,numberOfWinners:(J=x==null?void 0:x.settings)==null?void 0:J.number_of_winners,resultsVisibility:(pe=x==null?void 0:x.settings)==null?void 0:pe.results_visibility}},originalAuthorId:ee==null?void 0:ee.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(de,{title:xe,body:Be})=>D({title:xe,content:Be})},likes:{createLike:()=>_({activityId:n}),deleteLike:()=>T({activityId:n,reactionId:se}),listLikes:de=>o.list({activityId:n,...de})},comments:{openComments:()=>{}},pins:{createPin:()=>R({activityId:n}),deletePin:()=>{var de;return O({activityId:n,reactionId:(de=j==null?void 0:j.pin)==null?void 0:de[0].id})}},polls:{createVote:({reactionId:de})=>z({reactionId:de}),removeVote:({reactionId:de})=>$({reactionId:de}),removePoll:h.removePoll},form:u},styling:{showShareLinkButton:!0},userHasOwnerPermissions:i,badges:{showBadges:!0,scopes:[{scope:dt.Communities,area:t||""},{scope:dt.Platform,area:"all"}]},basePath:e,parentId:t},n),c.jsx(ff,{basePath:e,parentId:t,activityId:n,showReplies:B===_e.Poll?Z_(x):!0,activityTotalReplies:(x==null?void 0:x.total_replies)||0,isMember:r,functions:{reactions:l,likes:o,form:u,join:d,leave:m},profile:p})]})};const mh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:i})=>{const a=re.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:m}=n,{title:h="",body:p="",mentions:v}=r||{},f="discussion-form-modal";return c.jsx(un,{id:f,title:a.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(h!==""||p!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:V("discussion-form-modal",i),children:c.jsx(ri,{...n,data:{...u,mentions:v||(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:a.formatMessage({id:`${s}cta`})},functions:{...m,onChange:b=>{l(g=>({...g,...b}))},onMention:({id:b,name:g}={})=>{if(!b||!g)return;const x=v||{};x[b]={created_at:"",updated_at:"",id:b,data:{name:g}},l(C=>({...C,mentions:x}))},create:async b=>{o(),m.create&&await m.create(b),l({showCachedText:!1})},createPoll:async b=>{o(),m.createPoll&&await m.createPoll(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),m.handleSaveEdit&&await m.handleSaveEdit(b),l({showCachedText:!1})}}})})},ak=Object.freeze(Object.defineProperty({__proto__:null,default:mh},Symbol.toStringTag,{value:"Module"}));const sk=({className:e,showModal:t=!0,title:n,messagePlaceholder:r,formTitle:i,formLabel:a,ctaMessage:s,showIcon:o,onClose:l,reportError:u=()=>{},sendInvites:d})=>{const m=re.useIntl();return i||(i=m.formatMessage({id:"inviteModal_formTitle"})),a||(a=m.formatMessage({id:"inviteModal_formLabel"})),s||(s=m.formatMessage({id:"inviteModal_cta"})),c.jsx(un,{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(eh,{title:i,label:a,messagePlaceholder:r,ctaMessage:s,onClose:l,sendInvites:d,reportError:u})})};const ok=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:i,form:a,className:s})=>{const o=re.useIntl(),[l,u]=y.useState(Cd("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=i;return c.jsx(un,{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(th,{...a,meta:{shouldShowCancelButton:!1},functions:{...(a==null?void 0:a.functions)||{},onSuccess:async m=>{var h;try{(h=a==null?void 0:a.functions)!=null&&h.onSuccess&&await a.functions.onSuccess(m)}finally{d()}}}})]})})},Da=ok,uk=Object.freeze(Object.defineProperty({__proto__:null,default:Da},Symbol.toStringTag,{value:"Module"}));const lk=({members:e})=>{const[t,n]=y.useState(!1),r=i=>{const{fullName:a,jobTitle:s,organisation:o,photo:l}=i||{};return c.jsxs(c.Fragment,{children:[c.jsx(on,{name:a,src:l}),c.jsx("p",{children:a}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(i=>c.jsx("li",{children:c.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),n(i)},children:r(i)})},i.fullName))}),c.jsx(un,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(Sn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const ck=({author:e,authorCite:t,content:n,member:r,className:i=""})=>c.jsxs("blockquote",{className:V("testimonial-block",i),children:[c.jsx(Zt,{className:"testimonial",children:n}),r?c.jsx(rn,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:V("author",{"text-small":!i.includes("new")}),children:e}),t&&c.jsx("p",{className:V("author-cite",{"text-small":!i.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),dk=y.memo(ck);const fk=({items:e=[],selector:t="",className:n=""})=>{const r=re.useIntl(),[i,a]=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||""}));a(l)},[]),i&&i.length>0&&c.jsxs(Ft,{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:i.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Ea=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:i=""})=>{const a=re.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,v=Math.round(p),f=`${a.formatMessage({id:`${s}hours`},{time:h})}${h>0&&v>0?", ":""}${a.formatMessage({id:`${s}minutes`},{time:v})}`;return{text:`${h>0?`${a.formatMessage({id:`${s}hours_short`},{time:h})} `:""}${v>0?a.formatMessage({id:`${s}minutes_short`},{time:v}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:m}=o(e+t);l=a.formatMessage({id:`${s}range`},{early:l,late:d}),u=a.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",i),"aria-label":u,children:l})};const mk=({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(Ln,{...n,className:V("banner",e),image:{...t,aspect:"banner"}})):null;const hk=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],pk=({className:e="",content:t,image:n,variant:r,spacing:i="normal",styling:a,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var v,f;const u={imageFullWidth:!0,...a};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:g,element:x}=t[b];if(x&&hk.includes(x.toLowerCase()))return;h[b]={text:g,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 g=document.getElementById(o.link.substring(1));g&&g.scrollIntoView({behavior:"smooth"})}),c.jsx(Dn,{className:V("banner-section",r,i,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&i==="normal"&&h.eyebrow&&h.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(b=>{if(h[b]&&typeof h[b]=="object"){const{text:g,element:x=""}=h[b];return b==="text"?c.jsx(Sn,{overrideType:"text-only",className:"text",children:g},b):y.createElement(x,{key:b,className:b},g)}return null}),l,p&&c.jsx(ke,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:V({new:r==="subtle",[(v=o.props)==null?void 0:v.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&c.jsx(Ln,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},gk=y.memo(pk);const vk=({image:e,variant:t="default",children:n,className:r=""})=>{const i={};return e&&(i["--image"]=`url(${e})`),c.jsx(Dn,{className:V("custom-content-banner",t,r,{"has-image":e}),style:i,children:c.jsx("div",{className:"content-slim",children:n})})};const bk=({alignImage:e="left",className:t,content:n,image:r})=>{const i=typeof n=="string"?c.jsx(Sn,{children:n}):n;return c.jsxs(Dn,{className:V("highlight-section",t),children:[r&&c.jsx("div",{className:V("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(Ln,{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?i:c.jsx("div",{className:"content-default",children:i})})})]})},yk=y.memo(bk);const xk=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:i})=>!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(ke,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":i,"data-gtm-event-type":"learn-more-click",children:t.text})]}),wk=({type:e,data:t})=>{const n=re.useIntl(),{answers:r,createdAt:i,dateHasPassed:a,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const m=i&&As(i);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),i&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})]})]})}if(d&&!a||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):lo(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&&As(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},Ck={title:66,text:3e3,secondaryText:1e3,partner:34},oa={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"}},Dk=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const i=re.useIntl(),[a,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(g=>({...g,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:m}=e,h=e.contentType;let p="";if((f=oa[h])!=null&&f.gtmEvent&&(p=oa[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||i.formatMessage({id:"card_watch"})}):null;if(h==="people")return n?c.jsx(ke,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||i.formatMessage({id:"card_cta_people"})}):null;const v=["communityPage","microcourse","event"];if(t&&t.onClick&&v.includes(h)&&d!=="premium"){const g=a.loading||a.registered||((b=e==null?void 0:e.members)==null?void 0:b.isMember),x=async C=>{if(C.preventDefault(),C.stopPropagation(),!(g||!t||!t.onClick)){s(F=>({...F,loading:!0}));try{const F=await t.onClick(e);s(F==="success"?()=>({registered:!0,loading:!1}):D=>({...D,loading:!1}))}catch{s(D=>({...D,loading:!1}))}}};return c.jsx("p",{className:V("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(ke,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:g,"data-gtm-event-context":`${r}Page-${h}: ${m}`,"data-gtm-event-type":`${r}-${h}-register-click`,"data-testid":"in-card-button",children:o||i.formatMessage({id:`card_cta_${h}${g?`_${a.loading?"loading":"done"}`:""}`})})})}return null};function Ek({buildMemberData:e,communitySlug:t}){const n=re.useIntl(),r=y.useContext(at),[i,a]=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),a({count:d.toString(),isMember:!!l,memberType:l})})},[t,e]),c.jsxs("span",{className:"member-information",children:[i.isMember&&c.jsx(Yt,{size:"small",variant:"registered",icon:(i==null?void 0:i.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${i.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:i.count})})]})}const du=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:i,cta:a,gtmContext:s="Carousel",handleCardClick:o,meta:l})=>{var B,j;const u=re.useIntl(),d=y.useContext(at),m=!!(d!=null&&d.id),{isTabbable:h=!0,setFocus:p=!1}=l||{},v=y.useRef(null),[f,b]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(i,m).then(M=>{b({data:M,isLoading:!1})}).catch(()=>b(M=>({...M,isLoading:!1})))},[i,m,n]);const{data:g,isLoading:x}=f;if(x||!g)return c.jsx(It,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!a&&(a={text:u.formatMessage({id:`card_cta_${i.contentType}`}),onClick:o});const{contentType:C}=g;if(!C||!oa[C])return c.jsx(It,{element:"li",className:"card-wrapper"});const{basePath:F="",className:D,length:_,gtmEvent:T}=oa[C];let R=h&&g.slug?`${F}${g.slug}`:!1;h&&g.slug&&(g.slug.slice(0,4)==="http"||g.slug.slice(0,2)==="//"||g.slug.slice(0,6)==="mailto"||g.slug.slice(0,3)==="tel")&&(R=g.slug);const O=M=>{R&&(M.preventDefault(),M.stopPropagation(),window.location.href=R)},z={...Ck,..._};let $={className:"card"},A={};return R&&(A={href:R,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`,"data-testid":"link"},g.openInNewTab&&(A.target="_blank"),$={onClick:O,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${T}-click`}),p&&($={...$,tabIndex:"0"},(B=v==null?void 0:v.current)==null||B.focus(),(j=v==null?void 0:v.current)==null||j.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:V("card-wrapper text-medium",D,t,{"has-link":R,"no-link":!R,"has-image":g.banner}),"data-testid":`${C}-card`,children:c.jsxs("div",{...$,ref:v,children:[c.jsx(Ed,{className:"card-label",contentType:C,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),C==="communityPage"&&(g==null?void 0:g.createdAt)&&$h(g==null?void 0:g.createdAt,60)&&c.jsx(Yt,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),g.startDate&&!g.isOngoingEvent&&c.jsx(Yt,{size:"small",variant:g.dateHasPassed?"default":"information","data-testid":"date",children:g.dateHasPassed?u.formatMessage({id:"card_ended"}):yd(g.startDate)}),g.banner?c.jsxs("p",{className:"img",children:[g.registered&&c.jsx(Yt,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(Ln,{image:{...g.banner,description:""}})]}):D==="people"?c.jsx(on,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&c.jsx(go,{contributors:{data:g.contributors},styling:{size:"small",showGap:D!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(C)?u.formatMessage({id:`card_contributors_${C}`}):void 0,"data-testid":"contributors"}),g.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:g.partner.length>1?u.formatMessage({id:"card_partner"},{partner:g.partner[0],number:g.partner.length-1}):ar(g.partner[0],z.partner)}),["title","text","secondaryText"].map(M=>{const U=g[M];if(!U)return null;const W=hd(M),ie={key:M,className:W,"data-testid":W},se={wrapper:"p",forceWrapper:!0,forceInline:!0},E=ar(U,z[M]);return["title","text"].includes(M)&&R?(se.wrapper="a",c.jsx("p",{...ie,children:c.jsx(Zt,{options:se,...A,children:E})})):c.jsx(Zt,{options:se,...ie,children:E})}),i.contentType==="communityPage"&&(i.slug||g.slug)&&r&&c.jsx(Ek,{communitySlug:i.slug||g.slug,buildMemberData:r}),c.jsx(wk,{type:D||"",data:g}),c.jsx(Dk,{data:g,cta:a,link:R||"",gtmContext:s})]})})};const hh=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:V("card-block",n),children:e.map((i,a)=>{const s=i.slug?`${i.slug}-${t[a]}`:`${t[a]}-${a}`;return c.jsx(du,{id:s,card:{...i,contentType:t[a]},meta:{setFocus:a===(r==null?void 0:r.focusCardIndex)},...r},s)})}),_k=(e,t,n,r)=>{const i=t*n<=e,a=e<t*(n+1),s=r.includes(Math.floor(e/t));return{inView:i&&a,isLoaded:s}},kk=({id:e,title:t})=>{const n=re.useIntl();if(!t||!t.text)return null;const{text:r,element:i="h2",variant:a="default",size:s="medium",link:o}=t;return y.createElement(i,{className:V("title",a,s,{"highlighted-title":a==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const Es={fourCards:1024,threeCards:769,twoCards:480};let Fi=null,_s=null;const Fk=({id:e,cards:t,cardTypes:n,buildCardData:r,title:i,className:a,gtmContext:s,...o})=>{const l=re.useIntl(),u="carousel_pagination_",[d,m]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:h,isLoading:p}=d,[v,f]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:b,loadedPages:g}=v,[x,C]=y.useState(""),F=t.length,D=Math.ceil(F/h),_=y.useRef(null),T=Rn(!0,!0,_==null?void 0:_.current);y.useEffect(()=>{let B=1;T&&(T>=Es.fourCards?B=4:T>=Es.threeCards?B=3:T>=Es.twoCards&&(B=2),B>F&&(B=F)),m(j=>({...j,cardsPerPage:B,isLoading:!1}))},[T,F]);const R=(B="next")=>{_s&&clearTimeout(_s);let j=b;if(typeof B=="string")if(B==="next")if(b<D-1)j=b+1;else return;else if(b>0)j=b-1;else return;else j=B;C(""),f(U=>({...U,currentPage:j,loadedPages:[...new Set([...g,j])]}));const M=()=>{const U=j*d.cardsPerPage,W=U+d.cardsPerPage;return t.slice(U,W).length};_s=setTimeout(()=>{C(l.formatMessage({id:`${u}ariaLive${typeof B=="string"?"":"_slide"}`},{direction:l.formatMessage({id:`${u}${typeof B=="string"?B:"next"}`}),slide:typeof B=="string"?1:B+1,count:M()}))},500)},O=B=>{Fi=B.touches[0].clientX},z=B=>{if(Fi===null)return;const j=B.touches[0].clientX,M=Fi-j;M>5?R("next"):M<-5&&R("previous"),Fi=null},$={"--width":`${T||0}px`,"--total-cards":F,"--cards-per-page":h,"--page":b};if(p)return c.jsx(fa,{layout:`carousel${i?"-with-title":""}`});const A=(B,j)=>{var U;let M=null;return(U=B==null?void 0:B.sys)!=null&&U.id?M=`card-${B.sys.id}`:B!=null&&B.slug?M=`card-${B.slug}`:[n[j],B.contentType].includes("customCard")&&(M=`card-${window.btoa(`${B.title} ${B.createdAt}`)}-${j}`),M};return c.jsxs("section",{ref:_,className:V("carousel-wrapper",a),"data-testid":"carousel",children:[c.jsx(kk,{id:e,title:i}),c.jsx("ul",{className:"carousel",onTouchStart:O,onTouchMove:z,style:$,"data-testid":"carousel-list",children:t.map((B,j)=>{let M=A(B,j);const{inView:U,isLoaded:W}=_k(j,h,b,g);return M&&(U||W)?c.jsx(du,{id:M,card:{...B,contentType:n[j]},buildCardData:r,gtmContext:s,meta:{isTabbable:U},...o},M):(M=M||`${e}-card-${j}`,c.jsx(It,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},M))})}),D<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(ke,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:B=>{B.preventDefault(),B.stopPropagation(),R("previous")},screenreaderText:l.formatMessage({id:`${u}previousSlide`}),disabled:b<=0})}),[...Array(D)].map((B,j)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:V("page-indicator",{selected:j===b}),onClick:M=>{M.preventDefault(),M.stopPropagation(),R(j)},children:c.jsx(Ie,{showOnFocus:!1,children:l.formatMessage({id:`${u}slide`},{number:j+1,total:D})})})},`page-indicator-${j}`)),c.jsx("li",{className:"arrow next",children:c.jsx(ke,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:B=>{B.preventDefault(),B.stopPropagation(),R("next")},screenreaderText:l.formatMessage({id:`${u}nextSlide`}),disabled:b>=D-1})})]}),c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:x})]})]})},Ak=({carousels:e=[],isLoading:t,title:n,className:r="",...i})=>!e||!e.length?null:e.map(({title:a,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=a?window.btoa(a):`carousel-${u}`,m=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(fa,{layout:`carousel${a?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:c.jsx(qt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(Fk,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:a,link:s},...i}),m?null:c.jsx(qt,{})]},`carousel-${d}`)});const Bk=({element:e="div",className:t="",card:n,gtmContext:r="NarrowCard"})=>{const{banner:i,title:a,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":!i}),children:i&&c.jsx(Ln,{image:i})}),c.jsxs("div",{className:"content",children:[a&&c.jsx("p",{className:"title text-medium",children:a}),s&&c.jsx("p",{className:"text text-medium",children:s})]})]})})};const Tk=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:i=!0},graph:a,styling:s={},className:o=""})=>{const l=re.useIntl();let u=i?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":a==="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&&i&&c.jsx(Ea,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(po,{progress:u,styling:{layout:a||"bar",size:a&&a==="circle"?"small":"default"}})]})})};const ph=({element:e="span",sectionId:t,subsectionId:n,title:r,className:i=""})=>y.createElement(e,{className:V("lesson-name",i),"data-number":`${t}.${n}`,children:r});const gh=({size:e="default",completionTime:t,icon:n,optional:r,type:i,children:a})=>{const s=re.useIntl(),o=la(`lessonType_${i}`)?s.formatMessage({id:`lessonType_${i}`}):gd(i||"");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(Ea,{time:t})," ",a?c.jsx("span",{className:"additional",children:a}):null]})};const Sk=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:i,sectionId:a,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const m=re.useIntl(),h="courseStructure_",p=u.toLowerCase().includes("course conclusion");return c.jsxs(ca,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[m.formatMessage({id:`${h}section${p?"_end":""}`},{number:a})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:i&&l===0?m.formatMessage({id:`${h}time_completed`}):c.jsx(Ea,{time:s,appendedText:i?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:v,completionTime:f,contentType:b,icon:g,image:x,isIntroduction:C,optional:F,slug:D,subsectionId:_,title:T,type:R})=>{const O=i&&t||C,z={};return x&&(z.style={"--image":`url(${x})`}),c.jsx("li",{className:V({article:b===Tr.ARTICLE,discussion:b===Tr.DISCUSSION,quiz:b===Tr.QUIZ,completed:v&&b===Tr.ARTICLE,locked:!O}),...z,children:c.jsx(yn,{href:O?`/microcourses/en/${o}/${D}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${pd(T)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(ph,{sectionId:a,subsectionId:_,title:T,className:"course-title"})," ",c.jsx(gh,{completionTime:f,icon:g,optional:F,type:R,children:d&&d[D]&&c.jsx("span",{className:"quiz-score",children:`${d[D]}%`})})]})})},D)})})]})};const jk=({isComplete:e=!1,onClick:t,...n})=>{const r=re.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(ke,{...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":""}`})})},Pk=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:i}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:i}}),rd=[{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 Ai="notFoundError_",Ok=()=>{const e=re.useIntl(),t=[];return rd.forEach((n,r)=>{n.title=e.formatMessage({id:`${Ai}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(ah,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(Dn,{children:[c.jsx(hh,{cards:rd,cardTypes:t,buildCardData:n=>new Promise((r,i)=>{r(n)})}),c.jsx(ke,{href:"/solution-articles/",children:e.formatMessage({id:`${Ai}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${Ai}title`})}),c.jsx("p",{children:e.formatMessage({id:`${Ai}text`})})]})};exports.ASSETS_BUCKET=Gt;exports.ActionBar=gf;exports.ActionButton=Wr;exports.ActivitiesFeed=tv;exports.ActivitySection=ik;exports.ActivityType=vr;exports.AddPost=lu;exports.Badge=Rd;exports.BadgeScope=dt;exports.Badges=$d;exports.BadgesContext=fo;exports.BadgesProvider=Td;exports.Banner=mk;exports.BannerSection=gk;exports.Breadcrumbs=wv;exports.Buckets=tp;exports.Button=ke;exports.ButtonWrapper=pr;exports.COURSE_CONTENT_TYPES=Tr;exports.CacheProvider=Sd;exports.Card=du;exports.CardBlock=hh;exports.Carousel=Ak;exports.CharacterLimit=jo;exports.CollapsibleSection=ca;exports.Columns=xf;exports.CommunityDetails=wg;exports.ContactFooter=E_;exports.ContactForm=Xm;exports.ContentTypeLabel=Ed;exports.Contributors=go;exports.ConversationContext=Ca;exports.CookieBanner=ih;exports.CourseProgression=Tk;exports.CourseStructure=Sk;exports.CustomContentBanner=vk;exports.CustomEvents=rt;exports.DELETED_USER_ID=qr;exports.Directory=lk;exports.DiscussionContentType=_e;exports.DiscussionConversation=uh;exports.DiscussionForm=ri;exports.DiscussionFormCard=ch;exports.DiscussionFormModal=mh;exports.DiscussionPost=ii;exports.DiscussionThread=fh;exports.Divider=qt;exports.DownloadSection=x_;exports.EMAILS=Gn;exports.EditSection=C_;exports.EmailHelperTextBox=Cf;exports.EmptyStateBox=xn;exports.EnrichedUrl=To;exports.FeatureFlags=Pd;exports.Filters=vf;exports.FlagsProvider=jd;exports.Footer=ou;exports.Form=Jt;exports.Formatting=H;exports.Fragment=jt;exports.FullWidthSection=Dn;exports.GET_STREAM_USER_PREFIX=Fs;exports.GlobalProviders=pp;exports.Header=uu;exports.HelperTextBox=kd;exports.HiddenFromScreenReaders=ua;exports.HideShowTextBox=Fd;exports.HighlightSection=yk;exports.HighlightedTextBox=Ft;exports.INVALID_TOKEN=vd;exports.IconBulletedList=ip;exports.ImageContainer=Qh;exports.IntlProvider=Od;exports.InviteForm=eh;exports.InviteModal=sk;exports.JoinButton=xo;exports.Label=eu;exports.LanguageContext=mo;exports.LanguageSwitcher=Dv;exports.LessonName=ph;exports.LessonType=gh;exports.LikesButton=cf;exports.LikesFeed=mf;exports.LikesModal=hf;exports.Link=yn;exports.LoadMore=ti;exports.LoadingBlock=Ld;exports.LoadingPlaceholder=It;exports.LoadingState=fa;exports.Logo=So;exports.LogoSection=D_;exports.MEMBERS_PER_PAGE=sh;exports.MENTION_REGEX=bd;exports.MarkCompleteButton=jk;exports.MarkdownText=Sn;exports.MarketingBlock=xk;exports.Marks=Kt;exports.Member=rn;exports.MembersList=oh;exports.Modal=vo;exports.MoreMenu=bf;exports.NUMBER_OF_COUNTRIES=Nh;exports.NUMBER_OF_USERS=Mh;exports.NarrowCard=Bk;exports.NavigationMenu=yf;exports.NotFoundError=Ok;exports.Overlay=un;exports.OverlayContext=ho;exports.OverlayProvider=Id;exports.PageHeading=Ad;exports.PageLayout=ah;exports.PasswordForm=d_;exports.PasswordRules=Af;exports.Pill=Yt;exports.Poll=lh;exports.Popover=Dd;exports.Portal=gr;exports.ProfileForm=th;exports.ProfileImageChange=Jm;exports.ProfileModal=Da;exports.ProfileModalLauncher=cu;exports.ProfilePicture=on;exports.ProgressBar=po;exports.ProgressTracker=Xh;exports.PublishArticleForm=m_;exports.Rating=zv;exports.RepliesFeed=ff;exports.ResponsesHeading=dh;exports.ResponsiveImage=Ln;exports.ResultsVisibility=sa;exports.ReturnToNavButton=ep;exports.RichTextEditor=su;exports.SearchForm=nh;exports.ShareLink=pf;exports.ShareLinks=Bv;exports.SignupForm=y_;exports.Span=Ss;exports.StatusBanner=or;exports.TableOfContents=fk;exports.Tabs=Tv;exports.Tags=B_;exports.TestimonialBlock=dk;exports.TimeToComplete=Ea;exports.Toggle=l_;exports.Tooltip=$n;exports.TopLevelPage=__;exports.UUID_V4_REGEX=Ur;exports.UserContext=at;exports.UserProvider=Md;exports.VisuallyHidden=Ie;exports.addAriaProps=ef;exports.basicReducer=ei;exports.camelCaseToDashCase=hd;exports.checkIntlPathExists=la;exports.enrichPostCategories=Bo;exports.generateConditions=$i;exports.generateCssIcon=Ih;exports.getAuthorData=br;exports.getCharacterLimitProps=wf;exports.getLongDate=lo;exports.getMember=ma;exports.getPostBody=Ao;exports.getShortDate=yd;exports.getValueLength=ha;exports.headerData=Xr;exports.likesResponseMock=yv;exports.mapGetStreamData=Pk;exports.pageReady=xd;exports.passwordValidator=Bs;exports.repliesFeedMock=nv;exports.supportedLanguages=Si;exports.toCamelCase=pd;exports.toCapitalisedCase=Oh;exports.toSentenceCase=gd;exports.transformSlugs=Ns;exports.useBadges=Bd;exports.useCurrentPath=ud;exports.useEffectAfterMount=sr;exports.useElementWidth=Rn;exports.useOverlay=Nd;exports.useScrollListener=dd;exports.useScrollToHash=oo;exports.useTooltips=uo;exports.useUser=da;