@apolitical/component-library 4.2.4-SW.0 → 4.2.4-SW.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),ue=require("react-intl"),pn=require("lodash.clonedeep"),yh=require("lodash.set"),vc=require("react-dom"),Pt=require("markdown-to-jsx"),Un=require("truncate"),Ke=require("@tanstack/react-query"),Dh=require("@tanstack/react-query-devtools"),sa=require("posthog-js"),Ps=require("react-cookie"),bc=require("lodash.isequal"),Ch=require("react-multi-email"),yc=require("lodash.get"),xh=require("react-error-boundary");var $r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Dc(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var Cc={exports:{}};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),ue=require("react-intl"),pn=require("lodash.clonedeep"),yh=require("lodash.set"),vc=require("react-dom"),Pt=require("markdown-to-jsx"),Hn=require("truncate"),Ke=require("@tanstack/react-query"),Dh=require("@tanstack/react-query-devtools"),sa=require("posthog-js"),Ps=require("react-cookie"),bc=require("lodash.isequal"),Ch=require("react-multi-email"),yc=require("lodash.get"),xh=require("react-error-boundary");var $r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Dc(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}),n}var Cc={exports:{}};/*!
2
2
  Copyright (c) 2018 Jed Watson.
3
3
  Licensed under the MIT License (MIT), see
4
4
  http://jedwatson.github.io/classnames
5
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a<arguments.length;a++){var i=arguments[a];if(i){var s=typeof i;if(s==="string"||s==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var o=n.apply(null,i);o&&r.push(o)}}else if(s==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var l in i)t.call(i,l)&&i[l]&&r.push(l)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Cc);var wh=Cc.exports;const Y=wn(wh),Eh=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>C.createElement(e,{...a,className:Y("hidden",r,{"show-on-focus":t}),children:n}),Me=C.memo(Eh),kh=({element:e="span",children:t=null,...n})=>C.createElement(e,{...n,"aria-hidden":!0},t),$a=C.memo(kh);var ts={exports:{}},sr={};/**
5
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r=[],a=0;a<arguments.length;a++){var i=arguments[a];if(i){var s=typeof i;if(s==="string"||s==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var o=n.apply(null,i);o&&r.push(o)}}else if(s==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var l in i)t.call(i,l)&&i[l]&&r.push(l)}}}return r.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Cc);var wh=Cc.exports;const Y=wn(wh),Eh=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>C.createElement(e,{...a,className:Y("hidden",r,{"show-on-focus":t}),children:n}),Me=C.memo(Eh),kh=({element:e="span",children:t=null,...n})=>C.createElement(e,{...n,"aria-hidden":!0},t),$a=C.memo(kh);var ts={exports:{}},ir={};/**
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 Ro;function _h(){if(Ro)return sr;Ro=1;var e=C,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var c,h={},m=null,p=null;u!==void 0&&(m=""+u),l.key!==void 0&&(m=""+l.key),l.ref!==void 0&&(p=l.ref);for(c in l)r.call(l,c)&&!i.hasOwnProperty(c)&&(h[c]=l[c]);if(o&&o.defaultProps)for(c in l=o.defaultProps,l)h[c]===void 0&&(h[c]=l[c]);return{$$typeof:t,type:o,key:m,ref:p,props:h,_owner:a.current}}return sr.Fragment=n,sr.jsx=s,sr.jsxs=s,sr}var or={};/**
13
+ */var Ro;function _h(){if(Ro)return ir;Ro=1;var e=C,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var c,h={},m=null,p=null;u!==void 0&&(m=""+u),l.key!==void 0&&(m=""+l.key),l.ref!==void 0&&(p=l.ref);for(c in l)r.call(l,c)&&!i.hasOwnProperty(c)&&(h[c]=l[c]);if(o&&o.defaultProps)for(c in l=o.defaultProps,l)h[c]===void 0&&(h[c]=l[c]);return{$$typeof:t,type:o,key:m,ref:p,props:h,_owner:a.current}}return ir.Fragment=n,ir.jsx=s,ir.jsxs=s,ir}var sr={};/**
14
14
  * @license React
15
15
  * react-jsx-runtime.development.js
16
16
  *
@@ -18,23 +18,23 @@
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 Mo;function Bh(){return Mo||(Mo=1,process.env.NODE_ENV!=="production"&&function(){var e=C,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function D(P){if(P===null||typeof P!="object")return null;var ae=g&&P[g]||P[f];return typeof ae=="function"?ae:null}var y=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(P){{for(var ae=arguments.length,le=new Array(ae>1?ae-1:0),De=1;De<ae;De++)le[De-1]=arguments[De];A("error",P,le)}}function A(P,ae,le){{var De=y.ReactDebugCurrentFrame,Se=De.getStackAddendum();Se!==""&&(ae+="%s",le=le.concat([Se]));var Re=le.map(function(Fe){return String(Fe)});Re.unshift("Warning: "+ae),Function.prototype.apply.call(console[P],console,Re)}}var _=!1,k=!1,F=!1,S=!1,$=!1,R;R=Symbol.for("react.module.reference");function I(P){return!!(typeof P=="string"||typeof P=="function"||P===r||P===i||$||P===a||P===u||P===c||S||P===p||_||k||F||typeof P=="object"&&P!==null&&(P.$$typeof===m||P.$$typeof===h||P.$$typeof===s||P.$$typeof===o||P.$$typeof===l||P.$$typeof===R||P.getModuleId!==void 0))}function M(P,ae,le){var De=P.displayName;if(De)return De;var Se=ae.displayName||ae.name||"";return Se!==""?le+"("+Se+")":le}function x(P){return P.displayName||"Context"}function E(P){if(P==null)return null;if(typeof P.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof P=="function")return P.displayName||P.name||null;if(typeof P=="string")return P;switch(P){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof P=="object")switch(P.$$typeof){case o:var ae=P;return x(ae)+".Consumer";case s:var le=P;return x(le._context)+".Provider";case l:return M(P,P.render,"ForwardRef");case h:var De=P.displayName||null;return De!==null?De:E(P.type)||"Memo";case m:{var Se=P,Re=Se._payload,Fe=Se._init;try{return E(Fe(Re))}catch{return null}}}return null}var O=Object.assign,j=0,q,z,re,X,v,H,ee;function B(){}B.__reactDisabledLog=!0;function T(){{if(j===0){q=console.log,z=console.info,re=console.warn,X=console.error,v=console.group,H=console.groupCollapsed,ee=console.groupEnd;var P={configurable:!0,enumerable:!0,value:B,writable:!0};Object.defineProperties(console,{info:P,log:P,warn:P,error:P,group:P,groupCollapsed:P,groupEnd:P})}j++}}function W(){{if(j--,j===0){var P={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:O({},P,{value:q}),info:O({},P,{value:z}),warn:O({},P,{value:re}),error:O({},P,{value:X}),group:O({},P,{value:v}),groupCollapsed:O({},P,{value:H}),groupEnd:O({},P,{value:ee})})}j<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var L=y.ReactCurrentDispatcher,U;function te(P,ae,le){{if(U===void 0)try{throw Error()}catch(Se){var De=Se.stack.trim().match(/\n( *(at )?)/);U=De&&De[1]||""}return`
21
+ */var Mo;function Bh(){return Mo||(Mo=1,process.env.NODE_ENV!=="production"&&function(){var e=C,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function y(P){if(P===null||typeof P!="object")return null;var ae=g&&P[g]||P[f];return typeof ae=="function"?ae:null}var D=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(P){{for(var ae=arguments.length,le=new Array(ae>1?ae-1:0),De=1;De<ae;De++)le[De-1]=arguments[De];A("error",P,le)}}function A(P,ae,le){{var De=D.ReactDebugCurrentFrame,Se=De.getStackAddendum();Se!==""&&(ae+="%s",le=le.concat([Se]));var Re=le.map(function(Fe){return String(Fe)});Re.unshift("Warning: "+ae),Function.prototype.apply.call(console[P],console,Re)}}var _=!1,k=!1,F=!1,S=!1,$=!1,R;R=Symbol.for("react.module.reference");function I(P){return!!(typeof P=="string"||typeof P=="function"||P===r||P===i||$||P===a||P===u||P===c||S||P===p||_||k||F||typeof P=="object"&&P!==null&&(P.$$typeof===m||P.$$typeof===h||P.$$typeof===s||P.$$typeof===o||P.$$typeof===l||P.$$typeof===R||P.getModuleId!==void 0))}function M(P,ae,le){var De=P.displayName;if(De)return De;var Se=ae.displayName||ae.name||"";return Se!==""?le+"("+Se+")":le}function w(P){return P.displayName||"Context"}function E(P){if(P==null)return null;if(typeof P.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof P=="function")return P.displayName||P.name||null;if(typeof P=="string")return P;switch(P){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof P=="object")switch(P.$$typeof){case o:var ae=P;return w(ae)+".Consumer";case s:var le=P;return w(le._context)+".Provider";case l:return M(P,P.render,"ForwardRef");case h:var De=P.displayName||null;return De!==null?De:E(P.type)||"Memo";case m:{var Se=P,Re=Se._payload,Fe=Se._init;try{return E(Fe(Re))}catch{return null}}}return null}var O=Object.assign,j=0,q,z,re,X,v,H,ee;function B(){}B.__reactDisabledLog=!0;function T(){{if(j===0){q=console.log,z=console.info,re=console.warn,X=console.error,v=console.group,H=console.groupCollapsed,ee=console.groupEnd;var P={configurable:!0,enumerable:!0,value:B,writable:!0};Object.defineProperties(console,{info:P,log:P,warn:P,error:P,group:P,groupCollapsed:P,groupEnd:P})}j++}}function W(){{if(j--,j===0){var P={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:O({},P,{value:q}),info:O({},P,{value:z}),warn:O({},P,{value:re}),error:O({},P,{value:X}),group:O({},P,{value:v}),groupCollapsed:O({},P,{value:H}),groupEnd:O({},P,{value:ee})})}j<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var L=D.ReactCurrentDispatcher,U;function te(P,ae,le){{if(U===void 0)try{throw Error()}catch(Se){var De=Se.stack.trim().match(/\n( *(at )?)/);U=De&&De[1]||""}return`
22
22
  `+U+P}}var ne=!1,ie;{var fe=typeof WeakMap=="function"?WeakMap:Map;ie=new fe}function Q(P,ae){if(!P||ne)return"";{var le=ie.get(P);if(le!==void 0)return le}var De;ne=!0;var Se=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Re;Re=L.current,L.current=null,T();try{if(ae){var Fe=function(){throw Error()};if(Object.defineProperty(Fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Fe,[])}catch($t){De=$t}Reflect.construct(P,[],Fe)}else{try{Fe.call()}catch($t){De=$t}P.call(Fe.prototype)}}else{try{throw Error()}catch($t){De=$t}P()}}catch($t){if($t&&De&&typeof $t.stack=="string"){for(var Ae=$t.stack.split(`
23
23
  `),rt=De.stack.split(`
24
24
  `),Ve=Ae.length-1,Ze=rt.length-1;Ve>=1&&Ze>=0&&Ae[Ve]!==rt[Ze];)Ze--;for(;Ve>=1&&Ze>=0;Ve--,Ze--)if(Ae[Ve]!==rt[Ze]){if(Ve!==1||Ze!==1)do if(Ve--,Ze--,Ze<0||Ae[Ve]!==rt[Ze]){var bt=`
25
- `+Ae[Ve].replace(" at new "," at ");return P.displayName&&bt.includes("<anonymous>")&&(bt=bt.replace("<anonymous>",P.displayName)),typeof P=="function"&&ie.set(P,bt),bt}while(Ve>=1&&Ze>=0);break}}}finally{ne=!1,L.current=Re,W(),Error.prepareStackTrace=Se}var Fn=P?P.displayName||P.name:"",No=Fn?te(Fn):"";return typeof P=="function"&&ie.set(P,No),No}function pe(P,ae,le){return Q(P,!1)}function ge(P){var ae=P.prototype;return!!(ae&&ae.isReactComponent)}function ke(P,ae,le){if(P==null)return"";if(typeof P=="function")return Q(P,ge(P));if(typeof P=="string")return te(P);switch(P){case u:return te("Suspense");case c:return te("SuspenseList")}if(typeof P=="object")switch(P.$$typeof){case l:return pe(P.render);case h:return ke(P.type,ae,le);case m:{var De=P,Se=De._payload,Re=De._init;try{return ke(Re(Se),ae,le)}catch{}}}return""}var xe=Object.prototype.hasOwnProperty,_e={},We=y.ReactDebugCurrentFrame;function Le(P){if(P){var ae=P._owner,le=ke(P.type,P._source,ae?ae.type:null);We.setExtraStackFrame(le)}else We.setExtraStackFrame(null)}function Ue(P,ae,le,De,Se){{var Re=Function.call.bind(xe);for(var Fe in P)if(Re(P,Fe)){var Ae=void 0;try{if(typeof P[Fe]!="function"){var rt=Error((De||"React class")+": "+le+" type `"+Fe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof P[Fe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw rt.name="Invariant Violation",rt}Ae=P[Fe](ae,Fe,De,le,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ve){Ae=Ve}Ae&&!(Ae instanceof Error)&&(Le(Se),w("%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",le,Fe,typeof Ae),Le(null)),Ae instanceof Error&&!(Ae.message in _e)&&(_e[Ae.message]=!0,Le(Se),w("Failed %s type: %s",le,Ae.message),Le(null))}}}var Qe=Array.isArray;function he(P){return Qe(P)}function Te(P){{var ae=typeof Symbol=="function"&&Symbol.toStringTag,le=ae&&P[Symbol.toStringTag]||P.constructor.name||"Object";return le}}function $e(P){try{return K(P),!1}catch{return!0}}function K(P){return""+P}function se(P){if($e(P))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Te(P)),K(P)}var me=y.ReactCurrentOwner,ve={key:!0,ref:!0,__self:!0,__source:!0},we,Ye,Ge;Ge={};function mt(P){if(xe.call(P,"ref")){var ae=Object.getOwnPropertyDescriptor(P,"ref").get;if(ae&&ae.isReactWarning)return!1}return P.ref!==void 0}function It(P){if(xe.call(P,"key")){var ae=Object.getOwnPropertyDescriptor(P,"key").get;if(ae&&ae.isReactWarning)return!1}return P.key!==void 0}function Et(P,ae){if(typeof P.ref=="string"&&me.current&&ae&&me.current.stateNode!==ae){var le=E(me.current.type);Ge[le]||(w('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',E(me.current.type),P.ref),Ge[le]=!0)}}function Xe(P,ae){{var le=function(){we||(we=!0,w("%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)",ae))};le.isReactWarning=!0,Object.defineProperty(P,"key",{get:le,configurable:!0})}}function At(P,ae){{var le=function(){Ye||(Ye=!0,w("%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)",ae))};le.isReactWarning=!0,Object.defineProperty(P,"ref",{get:le,configurable:!0})}}var pt=function(P,ae,le,De,Se,Re,Fe){var Ae={$$typeof:t,type:P,key:ae,ref:le,props:Fe,_owner:Re};return Ae._store={},Object.defineProperty(Ae._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ae,"_self",{configurable:!1,enumerable:!1,writable:!1,value:De}),Object.defineProperty(Ae,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Se}),Object.freeze&&(Object.freeze(Ae.props),Object.freeze(Ae)),Ae};function ti(P,ae,le,De,Se){{var Re,Fe={},Ae=null,rt=null;le!==void 0&&(se(le),Ae=""+le),It(ae)&&(se(ae.key),Ae=""+ae.key),mt(ae)&&(rt=ae.ref,Et(ae,Se));for(Re in ae)xe.call(ae,Re)&&!ve.hasOwnProperty(Re)&&(Fe[Re]=ae[Re]);if(P&&P.defaultProps){var Ve=P.defaultProps;for(Re in Ve)Fe[Re]===void 0&&(Fe[Re]=Ve[Re])}if(Ae||rt){var Ze=typeof P=="function"?P.displayName||P.name||"Unknown":P;Ae&&Xe(Fe,Ze),rt&&At(Fe,Ze)}return pt(P,Ae,rt,Se,De,me.current,Fe)}}var ir=y.ReactCurrentOwner,Ir=y.ReactDebugCurrentFrame;function An(P){if(P){var ae=P._owner,le=ke(P.type,P._source,ae?ae.type:null);Ir.setExtraStackFrame(le)}else Ir.setExtraStackFrame(null)}var ni;ni=!1;function ri(P){return typeof P=="object"&&P!==null&&P.$$typeof===t}function To(){{if(ir.current){var P=E(ir.current.type);if(P)return`
25
+ `+Ae[Ve].replace(" at new "," at ");return P.displayName&&bt.includes("<anonymous>")&&(bt=bt.replace("<anonymous>",P.displayName)),typeof P=="function"&&ie.set(P,bt),bt}while(Ve>=1&&Ze>=0);break}}}finally{ne=!1,L.current=Re,W(),Error.prepareStackTrace=Se}var Fn=P?P.displayName||P.name:"",No=Fn?te(Fn):"";return typeof P=="function"&&ie.set(P,No),No}function pe(P,ae,le){return Q(P,!1)}function ge(P){var ae=P.prototype;return!!(ae&&ae.isReactComponent)}function ke(P,ae,le){if(P==null)return"";if(typeof P=="function")return Q(P,ge(P));if(typeof P=="string")return te(P);switch(P){case u:return te("Suspense");case c:return te("SuspenseList")}if(typeof P=="object")switch(P.$$typeof){case l:return pe(P.render);case h:return ke(P.type,ae,le);case m:{var De=P,Se=De._payload,Re=De._init;try{return ke(Re(Se),ae,le)}catch{}}}return""}var xe=Object.prototype.hasOwnProperty,_e={},We=D.ReactDebugCurrentFrame;function Le(P){if(P){var ae=P._owner,le=ke(P.type,P._source,ae?ae.type:null);We.setExtraStackFrame(le)}else We.setExtraStackFrame(null)}function Ue(P,ae,le,De,Se){{var Re=Function.call.bind(xe);for(var Fe in P)if(Re(P,Fe)){var Ae=void 0;try{if(typeof P[Fe]!="function"){var rt=Error((De||"React class")+": "+le+" type `"+Fe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof P[Fe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw rt.name="Invariant Violation",rt}Ae=P[Fe](ae,Fe,De,le,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ve){Ae=Ve}Ae&&!(Ae instanceof Error)&&(Le(Se),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).",De||"React class",le,Fe,typeof Ae),Le(null)),Ae instanceof Error&&!(Ae.message in _e)&&(_e[Ae.message]=!0,Le(Se),x("Failed %s type: %s",le,Ae.message),Le(null))}}}var Qe=Array.isArray;function he(P){return Qe(P)}function Te(P){{var ae=typeof Symbol=="function"&&Symbol.toStringTag,le=ae&&P[Symbol.toStringTag]||P.constructor.name||"Object";return le}}function $e(P){try{return K(P),!1}catch{return!0}}function K(P){return""+P}function se(P){if($e(P))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Te(P)),K(P)}var me=D.ReactCurrentOwner,ve={key:!0,ref:!0,__self:!0,__source:!0},we,Ye,Ge;Ge={};function mt(P){if(xe.call(P,"ref")){var ae=Object.getOwnPropertyDescriptor(P,"ref").get;if(ae&&ae.isReactWarning)return!1}return P.ref!==void 0}function It(P){if(xe.call(P,"key")){var ae=Object.getOwnPropertyDescriptor(P,"key").get;if(ae&&ae.isReactWarning)return!1}return P.key!==void 0}function Et(P,ae){if(typeof P.ref=="string"&&me.current&&ae&&me.current.stateNode!==ae){var le=E(me.current.type);Ge[le]||(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',E(me.current.type),P.ref),Ge[le]=!0)}}function Xe(P,ae){{var le=function(){we||(we=!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)",ae))};le.isReactWarning=!0,Object.defineProperty(P,"key",{get:le,configurable:!0})}}function At(P,ae){{var le=function(){Ye||(Ye=!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)",ae))};le.isReactWarning=!0,Object.defineProperty(P,"ref",{get:le,configurable:!0})}}var pt=function(P,ae,le,De,Se,Re,Fe){var Ae={$$typeof:t,type:P,key:ae,ref:le,props:Fe,_owner:Re};return Ae._store={},Object.defineProperty(Ae._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ae,"_self",{configurable:!1,enumerable:!1,writable:!1,value:De}),Object.defineProperty(Ae,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Se}),Object.freeze&&(Object.freeze(Ae.props),Object.freeze(Ae)),Ae};function ti(P,ae,le,De,Se){{var Re,Fe={},Ae=null,rt=null;le!==void 0&&(se(le),Ae=""+le),It(ae)&&(se(ae.key),Ae=""+ae.key),mt(ae)&&(rt=ae.ref,Et(ae,Se));for(Re in ae)xe.call(ae,Re)&&!ve.hasOwnProperty(Re)&&(Fe[Re]=ae[Re]);if(P&&P.defaultProps){var Ve=P.defaultProps;for(Re in Ve)Fe[Re]===void 0&&(Fe[Re]=Ve[Re])}if(Ae||rt){var Ze=typeof P=="function"?P.displayName||P.name||"Unknown":P;Ae&&Xe(Fe,Ze),rt&&At(Fe,Ze)}return pt(P,Ae,rt,Se,De,me.current,Fe)}}var ar=D.ReactCurrentOwner,Ir=D.ReactDebugCurrentFrame;function An(P){if(P){var ae=P._owner,le=ke(P.type,P._source,ae?ae.type:null);Ir.setExtraStackFrame(le)}else Ir.setExtraStackFrame(null)}var ni;ni=!1;function ri(P){return typeof P=="object"&&P!==null&&P.$$typeof===t}function To(){{if(ar.current){var P=E(ar.current.type);if(P)return`
26
26
 
27
27
  Check the render method of \``+P+"`."}return""}}function dh(P){{if(P!==void 0){var ae=P.fileName.replace(/^.*[\\\/]/,""),le=P.lineNumber;return`
28
28
 
29
29
  Check your code at `+ae+":"+le+"."}return""}}var So={};function fh(P){{var ae=To();if(!ae){var le=typeof P=="string"?P:P.displayName||P.name;le&&(ae=`
30
30
 
31
- Check the top-level render call using <`+le+">.")}return ae}}function jo(P,ae){{if(!P._store||P._store.validated||P.key!=null)return;P._store.validated=!0;var le=fh(ae);if(So[le])return;So[le]=!0;var De="";P&&P._owner&&P._owner!==ir.current&&(De=" It was passed a child from "+E(P._owner.type)+"."),An(P),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',le,De),An(null)}}function Oo(P,ae){{if(typeof P!="object")return;if(he(P))for(var le=0;le<P.length;le++){var De=P[le];ri(De)&&jo(De,ae)}else if(ri(P))P._store&&(P._store.validated=!0);else if(P){var Se=D(P);if(typeof Se=="function"&&Se!==P.entries)for(var Re=Se.call(P),Fe;!(Fe=Re.next()).done;)ri(Fe.value)&&jo(Fe.value,ae)}}}function hh(P){{var ae=P.type;if(ae==null||typeof ae=="string")return;var le;if(typeof ae=="function")le=ae.propTypes;else if(typeof ae=="object"&&(ae.$$typeof===l||ae.$$typeof===h))le=ae.propTypes;else return;if(le){var De=E(ae);Ue(le,P.props,"prop",De,P)}else if(ae.PropTypes!==void 0&&!ni){ni=!0;var Se=E(ae);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Se||"Unknown")}typeof ae.getDefaultProps=="function"&&!ae.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function mh(P){{for(var ae=Object.keys(P.props),le=0;le<ae.length;le++){var De=ae[le];if(De!=="children"&&De!=="key"){An(P),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",De),An(null);break}}P.ref!==null&&(An(P),w("Invalid attribute `ref` supplied to `React.Fragment`."),An(null))}}function Po(P,ae,le,De,Se,Re){{var Fe=I(P);if(!Fe){var Ae="";(P===void 0||typeof P=="object"&&P!==null&&Object.keys(P).length===0)&&(Ae+=" 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 rt=dh(Se);rt?Ae+=rt:Ae+=To();var Ve;P===null?Ve="null":he(P)?Ve="array":P!==void 0&&P.$$typeof===t?(Ve="<"+(E(P.type)||"Unknown")+" />",Ae=" Did you accidentally export a JSX literal instead of a component?"):Ve=typeof P,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ve,Ae)}var Ze=ti(P,ae,le,Se,Re);if(Ze==null)return Ze;if(Fe){var bt=ae.children;if(bt!==void 0)if(De)if(he(bt)){for(var Fn=0;Fn<bt.length;Fn++)Oo(bt[Fn],P);Object.freeze&&Object.freeze(bt)}else w("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 Oo(bt,P)}return P===r?mh(Ze):hh(Ze),Ze}}function ph(P,ae,le){return Po(P,ae,le,!0)}function gh(P,ae,le){return Po(P,ae,le,!1)}var vh=gh,bh=ph;or.Fragment=r,or.jsx=vh,or.jsxs=bh}()),or}process.env.NODE_ENV==="production"?ts.exports=_h():ts.exports=Bh();var d=ts.exports;const xc=()=>{const[e,t]=C.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return C.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Vn=(e,t)=>{const n=C.useRef(!1);C.useEffect(()=>{n.current?e():n.current=!0},t)};function wc(e,t,n){var r=this,a=C.useRef(null),i=C.useRef(0),s=C.useRef(null),o=C.useRef([]),l=C.useRef(),u=C.useRef(),c=C.useRef(e),h=C.useRef(!0);c.current=e;var m=typeof window<"u",p=!t&&t!==0&&m;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,D="maxWait"in n,y="debounceOnServer"in n&&!!n.debounceOnServer,w=D?Math.max(+n.maxWait||0,t):null;C.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var A=C.useMemo(function(){var _=function(I){var M=o.current,x=l.current;return o.current=l.current=null,i.current=I,u.current=c.current.apply(x,M)},k=function(I,M){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(I):setTimeout(I,M)},F=function(I){if(!h.current)return!1;var M=I-a.current;return!a.current||M>=t||M<0||D&&I-i.current>=w},S=function(I){return s.current=null,f&&o.current?_(I):(o.current=l.current=null,u.current)},$=function I(){var M=Date.now();if(F(M))return S(M);if(h.current){var x=t-(M-a.current),E=D?Math.min(x,w-(M-i.current)):x;k(I,E)}},R=function(){if(m||y){var I=Date.now(),M=F(I);if(o.current=[].slice.call(arguments),l.current=r,a.current=I,M){if(!s.current&&h.current)return i.current=a.current,k($,t),g?_(a.current):u.current;if(D)return k($,t),_(a.current)}return s.current||k($,t),u.current}};return R.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},R.isPending=function(){return!!s.current},R.flush=function(){return s.current?S(Date.now()):u.current},R},[g,D,t,w,f,p,m,y]);return A}function Ec(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return wc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let ai;const Xn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=C.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];C.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(ai),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:c})=>{const{id:h}=c;n==="window"||!n.closest(`#${h}`)||s()===r||o()},u=Ec(()=>{s()!==r&&(t&&(clearTimeout(ai),document.body.classList.add("is-resizing"),ai=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},kc=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=C.useState({current:0,past:0})||[!1,()=>{}],[s,o]=C.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];C.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const c=window.scrollY,h=a.current,m=c-h,p=m>0?"down":"up";if(i({current:c,past:h}),p==="down"){c>=e+t.down&&!s.scrollDown&&(!s.scrollUp||m>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(m)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=Ec(()=>{l()},250);return a},Ns=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=C.useRef(!1);Vn(()=>{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)},Rs=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=C.useState(!1);return{showTooltip:t,tooltipProps:{onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const Io={},En=C.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},...l},u)=>{const c=ue.useIntl(),h=C.useRef(null),m=u||h,[p,g]=C.useState(n?"open":"hidden"),{extraPadding:f=!0,hasPointer:D=!1,hasForm:y=!1}=t,{onOpen:w=()=>{},onClose:A=()=>{}}=o;e||(e=Date.now().toString());const _=Io[e];C.useEffect(()=>{const $=m==null?void 0:m.current;if($)return $.addEventListener("transitionend",k),$.addEventListener("keydown",F),()=>{$.removeEventListener("transitionend",k),$.removeEventListener("keydown",F)}},[]);const k=({propertyName:$})=>{$==="opacity"&&(_!==!1&&clearTimeout(_),g(R=>(R==="open"?w():R==="closed"&&A(),R==="opening"?"open":R==="closing"?"closed":R==="closed"?"hidden":R)))},F=$=>{$.key==="Escape"&&($.stopPropagation(),$.preventDefault(),g("closing"))};Vn(()=>{_!==!1&&clearTimeout(_);let $="open";n?g("opening"):(g("closing"),$="hidden"),Io[e||""]=setTimeout(()=>{g($)},300)},[n]);const S={...l};return s&&s.onBlur&&(S.onBlur=s.onBlur),d.jsx("aside",{ref:m,className:Y("tooltip text-medium",p,i,{loading:r,"extra-padding":f,"has-pointer":D,bottom:D==="bottom","has-form":y}),...S,children:d.jsx("div",{className:"content",hidden:p==="hidden",children:r?d.jsx("p",{children:c.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?d.jsx("p",{children:a}):a})})}),Or=(e,t)=>{Array.isArray(t)||(t=[t]);const n=pn(e);return t.forEach(({type:r,value:a})=>{yh(n,r,a)}),n},_c=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Bc=(e,t,n)=>{let r=n.mobile;for(const a in t){const i=parseInt(String(t[a]));if(e>=i)r=n[i];else if(e<i)break}return r},Ac=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Fc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Tc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Ah=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Ht="https://storage.googleapis.com/apolitical-assets/",Rn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},hr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},ns="SU:",Sc="Invalid token error: Logging user out...",rs=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,jc=/^@(\w+)$/,Fh="200,000+",Th="160+";function Oc(e){return e?{"--icon":`url(${Ht}icons/${e}.svg)`}:{}}const fn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Pc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Ms=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),as=e=>{let t;const n=va(),r=va(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/fn.milliseconds.inHour,i=Math.floor(t/fn.milliseconds.inDay);if(i<1)return a<1?{path:"now"}:{path:"hours",number:Math.floor(a)};if(i<7)return{path:"days",number:i};const s=Math.floor(i/7);return s<=fn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/fn.year.days)}},va=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Sh=(e,t,n)=>{let r;const a=va(),i=va(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/fn.milliseconds.inSecond<=t;case"minutes":return r/fn.milliseconds.inMinute<=t;case"hours":return r/fn.milliseconds.inHour<=t}return!1},jh=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},Oh=e=>new Promise(t=>setTimeout(t,e)),Ph=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},er={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_next:"Next",carousel_pagination_page:"Page {number} of {total}",carousel_pagination_aria_live:"{direction} {count} cards available",activitySection_notFoundError:"Post not found",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",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_joining_aria_live:"You are joining this community",joinCommunityButton_leaving_aria_live:"You are leaving this community",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
31
+ Check the top-level render call using <`+le+">.")}return ae}}function jo(P,ae){{if(!P._store||P._store.validated||P.key!=null)return;P._store.validated=!0;var le=fh(ae);if(So[le])return;So[le]=!0;var De="";P&&P._owner&&P._owner!==ar.current&&(De=" It was passed a child from "+E(P._owner.type)+"."),An(P),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',le,De),An(null)}}function Oo(P,ae){{if(typeof P!="object")return;if(he(P))for(var le=0;le<P.length;le++){var De=P[le];ri(De)&&jo(De,ae)}else if(ri(P))P._store&&(P._store.validated=!0);else if(P){var Se=y(P);if(typeof Se=="function"&&Se!==P.entries)for(var Re=Se.call(P),Fe;!(Fe=Re.next()).done;)ri(Fe.value)&&jo(Fe.value,ae)}}}function hh(P){{var ae=P.type;if(ae==null||typeof ae=="string")return;var le;if(typeof ae=="function")le=ae.propTypes;else if(typeof ae=="object"&&(ae.$$typeof===l||ae.$$typeof===h))le=ae.propTypes;else return;if(le){var De=E(ae);Ue(le,P.props,"prop",De,P)}else if(ae.PropTypes!==void 0&&!ni){ni=!0;var Se=E(ae);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Se||"Unknown")}typeof ae.getDefaultProps=="function"&&!ae.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function mh(P){{for(var ae=Object.keys(P.props),le=0;le<ae.length;le++){var De=ae[le];if(De!=="children"&&De!=="key"){An(P),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",De),An(null);break}}P.ref!==null&&(An(P),x("Invalid attribute `ref` supplied to `React.Fragment`."),An(null))}}function Po(P,ae,le,De,Se,Re){{var Fe=I(P);if(!Fe){var Ae="";(P===void 0||typeof P=="object"&&P!==null&&Object.keys(P).length===0)&&(Ae+=" 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 rt=dh(Se);rt?Ae+=rt:Ae+=To();var Ve;P===null?Ve="null":he(P)?Ve="array":P!==void 0&&P.$$typeof===t?(Ve="<"+(E(P.type)||"Unknown")+" />",Ae=" Did you accidentally export a JSX literal instead of a component?"):Ve=typeof P,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ve,Ae)}var Ze=ti(P,ae,le,Se,Re);if(Ze==null)return Ze;if(Fe){var bt=ae.children;if(bt!==void 0)if(De)if(he(bt)){for(var Fn=0;Fn<bt.length;Fn++)Oo(bt[Fn],P);Object.freeze&&Object.freeze(bt)}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 Oo(bt,P)}return P===r?mh(Ze):hh(Ze),Ze}}function ph(P,ae,le){return Po(P,ae,le,!0)}function gh(P,ae,le){return Po(P,ae,le,!1)}var vh=gh,bh=ph;sr.Fragment=r,sr.jsx=vh,sr.jsxs=bh}()),sr}process.env.NODE_ENV==="production"?ts.exports=_h():ts.exports=Bh();var d=ts.exports;const xc=()=>{const[e,t]=C.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return C.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Un=(e,t)=>{const n=C.useRef(!1);C.useEffect(()=>{n.current?e():n.current=!0},t)};function wc(e,t,n){var r=this,a=C.useRef(null),i=C.useRef(0),s=C.useRef(null),o=C.useRef([]),l=C.useRef(),u=C.useRef(),c=C.useRef(e),h=C.useRef(!0);c.current=e;var m=typeof window<"u",p=!t&&t!==0&&m;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,y="maxWait"in n,D="debounceOnServer"in n&&!!n.debounceOnServer,x=y?Math.max(+n.maxWait||0,t):null;C.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var A=C.useMemo(function(){var _=function(I){var M=o.current,w=l.current;return o.current=l.current=null,i.current=I,u.current=c.current.apply(w,M)},k=function(I,M){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(I):setTimeout(I,M)},F=function(I){if(!h.current)return!1;var M=I-a.current;return!a.current||M>=t||M<0||y&&I-i.current>=x},S=function(I){return s.current=null,f&&o.current?_(I):(o.current=l.current=null,u.current)},$=function I(){var M=Date.now();if(F(M))return S(M);if(h.current){var w=t-(M-a.current),E=y?Math.min(w,x-(M-i.current)):w;k(I,E)}},R=function(){if(m||D){var I=Date.now(),M=F(I);if(o.current=[].slice.call(arguments),l.current=r,a.current=I,M){if(!s.current&&h.current)return i.current=a.current,k($,t),g?_(a.current):u.current;if(y)return k($,t),_(a.current)}return s.current||k($,t),u.current}};return R.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},R.isPending=function(){return!!s.current},R.flush=function(){return s.current?S(Date.now()):u.current},R},[g,y,t,x,f,p,m,D]);return A}function Ec(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return wc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let ai;const Jn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=C.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];C.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(ai),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:c})=>{const{id:h}=c;n==="window"||!n.closest(`#${h}`)||s()===r||o()},u=Ec(()=>{s()!==r&&(t&&(clearTimeout(ai),document.body.classList.add("is-resizing"),ai=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},kc=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=C.useState({current:0,past:0})||[!1,()=>{}],[s,o]=C.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];C.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const c=window.scrollY,h=a.current,m=c-h,p=m>0?"down":"up";if(i({current:c,past:h}),p==="down"){c>=e+t.down&&!s.scrollDown&&(!s.scrollUp||m>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(m)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=Ec(()=>{l()},250);return a},Ns=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=C.useRef(!1);Un(()=>{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)},Rs=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=C.useState(!1);return{showTooltip:t,tooltipProps:{onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const Io={},En=C.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},...l},u)=>{const c=ue.useIntl(),h=C.useRef(null),m=u||h,[p,g]=C.useState(n?"open":"hidden"),{extraPadding:f=!0,hasPointer:y=!1,hasForm:D=!1}=t,{onOpen:x=()=>{},onClose:A=()=>{}}=o;e||(e=Date.now().toString());const _=Io[e];C.useEffect(()=>{const $=m==null?void 0:m.current;if($)return $.addEventListener("transitionend",k),$.addEventListener("keydown",F),()=>{$.removeEventListener("transitionend",k),$.removeEventListener("keydown",F)}},[]);const k=({propertyName:$})=>{$==="opacity"&&(_!==!1&&clearTimeout(_),g(R=>(R==="open"?x():R==="closed"&&A(),R==="opening"?"open":R==="closing"?"closed":R==="closed"?"hidden":R)))},F=$=>{$.key==="Escape"&&($.stopPropagation(),$.preventDefault(),g("closing"))};Un(()=>{_!==!1&&clearTimeout(_);let $="open";n?g("opening"):(g("closing"),$="hidden"),Io[e||""]=setTimeout(()=>{g($)},300)},[n]);const S={...l};return s&&s.onBlur&&(S.onBlur=s.onBlur),d.jsx("aside",{ref:m,className:Y("tooltip text-medium",p,i,{loading:r,"extra-padding":f,"has-pointer":y,bottom:y==="bottom","has-form":D}),...S,children:d.jsx("div",{className:"content",hidden:p==="hidden",children:r?d.jsx("p",{children:c.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?d.jsx("p",{children:a}):a})})}),Or=(e,t)=>{Array.isArray(t)||(t=[t]);const n=pn(e);return t.forEach(({type:r,value:a})=>{yh(n,r,a)}),n},_c=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Bc=(e,t,n)=>{let r=n.mobile;for(const a in t){const i=parseInt(String(t[a]));if(e>=i)r=n[i];else if(e<i)break}return r},Ac=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Fc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Tc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Ah=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Ht="https://storage.googleapis.com/apolitical-assets/",Nn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},hr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},ns="SU:",Sc="Invalid token error: Logging user out...",rs=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,jc=/^@(\w+)$/,Fh="200,000+",Th="160+";function Oc(e){return e?{"--icon":`url(${Ht}icons/${e}.svg)`}:{}}const fn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Pc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Ms=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),as=e=>{let t;const n=va(),r=va(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/fn.milliseconds.inHour,i=Math.floor(t/fn.milliseconds.inDay);if(i<1)return a<1?{path:"now"}:{path:"hours",number:Math.floor(a)};if(i<7)return{path:"days",number:i};const s=Math.floor(i/7);return s<=fn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/fn.year.days)}},va=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Sh=(e,t,n)=>{let r;const a=va(),i=va(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/fn.milliseconds.inSecond<=t;case"minutes":return r/fn.milliseconds.inMinute<=t;case"hours":return r/fn.milliseconds.inHour<=t}return!1},jh=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},Oh=e=>new Promise(t=>setTimeout(t,e)),Ph=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},Xn={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_next:"Next",carousel_pagination_page:"Page {number} of {total}",carousel_pagination_aria_live:"{direction} {count} cards available",activitySection_notFoundError:"Post not found",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",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",membersList:"Members",membersList_admin:"Admin",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
32
32
 
33
33
  Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
34
34
 
35
- Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_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",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_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!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",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",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_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.",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_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_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",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>",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_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 and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",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",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 emails below.",inviteModal_cta:"Send",overlay_close:"Close",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",navigationMenu_profile:"My profile",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",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",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"},Nh={...er,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>"},Rh={...er,languageSwitcher_label:"Je voudrais lire cet article dans...",languageSwitcher_translation_original:"langue originale",languageSwitcher_translation_human:"traduit par un humain",languageSwitcher_translation_machine:"traduit par machine",languageSwitcher_disclaimer:"Ce contenu est traduit automatiquement et contiendra d’évantuelles erreurs de genre ou d’autres traductions directes. Nous essayons de résoudre ce problème, mais en attendant, si vous remarquez une erreur importante, faites-le nous savoir à <link>{email}</link>",collapsibleSection_summary:"En savoir plus"},Mh={...er,languageSwitcher_label:"Eu gostaria de ler este artigo em...",languageSwitcher_translation_original:"linguagem original",languageSwitcher_translation_human:"traduzido por um humano",languageSwitcher_translation_machine:"traduzido por máquina",languageSwitcher_disclaimer:"Este conteúdo foi traduzido automaticamente e, ocasionalmente, poderão ocorrer erros de linguagem de gênero ou outras traduções diretas. Estamos tentando resolver isso, porém se perceber algo errado por favor nos avise em <link>{email}</link>"},Ih=Object.freeze(Object.defineProperty({__proto__:null,en:er,es:Nh,fr:Rh,pt:Mh},Symbol.toStringTag,{value:"Module"})),La=(e,t=er)=>e in t,kt=(e,t,n,r,a={})=>{let i="";return La(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},$h=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let a=n.length-1;a>=0;a--){const i=Math.pow(10,(a+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&a<n.length-1&&(e=1,a++),r=`${e}${n[a]}`;break}}return r},oa=(e,t)=>C.Children.map(e,n=>Object.is(n,null)?n:C.cloneElement(n,{...t})),Nc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Lh=(e,t,n)=>!t.id||!t.name?"":n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Rc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(rs);if(!a)return e;for(const s of a){const o=s.replace(rs,(c,h)=>h),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"";else{const c=l;if(c.startsWith(ns))try{const h=c.replace(ns,"");u.id=h,await r({id:h}).then(m=>{const{name:p}=m;u.name=p||""})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Lh(e,u,t):s)}return e},Mc=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},zh=(e="")=>e.replace(/\s+/g,"").length>0,is=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 Be=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:c=!1,children:h=!1,...m})=>{const g=Xn(typeof t=="object"),{showTooltip:f,tooltipProps:D}=Rs(!!u);if(typeof t=="object"&&typeof g=="number"){const _=Object.assign({},t),k=_c(Object.keys(_));t=Bc(g,k,_)}!l&&u&&(u="");const y=[];typeof t=="string"&&y.push(t),r&&(y.push("icon"),typeof r=="object"?(y.push(r.icon),r.position?y.push(r.position):y.push("left"),r.hover&&y.push(`hover_${r.hover}`),r.animate&&(y.push("animate"),typeof r.animate=="string"&&y.push(r.animate))):(y.push(r),!r.includes("right")&&!r.includes("left")&&y.push("left"))),n.muted&&y.push("muted"),n.fullWidth&&y.push("full-width");const w={...m,className:Y(e,o,y,{"no-text":!h,disabled:l,button:a}),onClick:_=>{(!a||a[0]==="#")&&s&&(_.preventDefault(),_.stopPropagation()),s&&s(_)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",w.href=a);const A=C.createElement(i,w,h||(c?d.jsx(Me,{showOnFocus:!1,children:c}):null));return l&&u?d.jsxs("span",{className:"button-container",...D,children:[d.jsx(En,{isOpen:f,children:u}),A]}):A},kn=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?d.jsx(Be,{...s},o):d.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:d.jsx(Be,{...s})},o)});return C.createElement(a,{className:Y("button-wrapper",n),...r,children:i})};const tn=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return d.jsx("hr",{className:Y(e,{"has-max-width":t}),style:n})},$o={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"}},qh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?$o[e]:$o.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Wh=({format:e,height:t,query:n,width:r})=>{let a=`w=${r}&h=${t}`;return a=e?`${a}&fm=${e}`:a,a=n?`${a}&${n}`:a,a},ii=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Wh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const tr=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:c,fetchPriority:h}=e,{range:m,sizes:p}=qh(e),g=ii({format:"avif",query:s,range:m,url:o}),f=ii({format:"webp",query:s,range:m,url:o}),D=ii({format:"",query:s,range:m,url:o});return i&&i.includes("svg")?d.jsx("picture",{className:t,children:d.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})}):d.jsxs("picture",{className:t,children:[i!=="image/gif"&&d.jsx("source",{type:"image/avif",srcSet:g,sizes:p,"data-testid":"source"}),d.jsx("source",{type:"image/webp",srcSet:f,sizes:p,"data-testid":"source"}),d.jsx("img",{srcSet:D,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Hh=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(tr,{image:{...e},className:"image"})}),_n=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),d.jsx("a",{href:e,className:Y("gtm-trackable",r),...l,children:t})}return n?C.createElement(n,{children:t,className:r,...o}):d.jsx(d.Fragment,{children:t})};const Ic=C.forwardRef(({className:e="",children:t},n)=>{const r=C.useRef(null),a=n||r;return d.jsx("aside",{ref:a,className:Y("popover",e),"aria-live":"polite",children:t})}),Is=({children:e})=>typeof document=="object"?vc.createPortal(e,document.body):null;const Uh=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx(Me,{children:d.jsx(ue.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),d.jsx("div",{className:"progress-tracker",children:d.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return d.jsxs("div",{className:"dot-wrapper",children:[d.jsx("div",{className:Y("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),d.jsx("div",{className:Y("line",{active:a<e})})]},r)})})})]});const Vh=({elementId:e,offset:t=20})=>{const n=ue.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return d.jsx(Be,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const Kh=({items:e,className:t="",...n})=>d.jsx("ul",{className:Y("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>d.jsx("li",{className:"bucket text-medium",children:d.jsxs("a",{href:i,...s,children:[d.jsx("p",{className:"title",children:r}),d.jsx("p",{children:a})]})},o))}),Lo=300,zo="ease-in-out";class Zh{constructor(t){this.el=t,this.summary=t.querySelector("summary"),this.content=t.querySelector(".content"),this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.summary.addEventListener("click",n=>this.onClick(n))}cleanUp(){this.summary.removeEventListener("click",t=>this.onClick(t))}onClick(t){t.preventDefault(),t.stopPropagation(),this.el.style.overflow="hidden",this.isClosing||!this.el.open?this.open():(this.isExpanding||this.el.open)&&this.shrink()}shrink(){this.isClosing=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:Lo,easing:zo}),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:Lo,easing:zo}),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 za=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ue.useIntl(),i=C.useRef(null);return C.useEffect(()=>{let s;return r&&(s=new Zh(i.current)),()=>{r&&s&&s.cleanUp()}},[]),d.jsxs("details",{ref:i,className:Y("collapsible-section",t,{"should-animate":r}),children:[d.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),d.jsx("div",{className:"content",children:n})]})},qo={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Yh=e=>{let t=e;return Object.keys(qo).includes(e)&&(t=qo[e]),`url(${Ht}icons/${t}.svg)`};const Wo={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},$c=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ue.useIntl(),i=t?{"--custom-icon":Yh(t)}:{},s=La(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:Y("content-type-label text-small",e in Wo?Wo[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Nt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Ht}icons/${t}.svg)`}:{};return d.jsx("div",{className:Y("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const an=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let a=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,s=Xn(i);if(i&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),m=_c(Object.keys(h));a=Bc(s,m,h)}const{breakpoints:o,text:l="",component:u,...c}=n;return d.jsx(Nt,{variant:"subtle",className:Y("empty-state-box",e,r),children:d.jsxs(d.Fragment,{children:[t&&typeof t=="string"?d.jsx(Pt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||d.jsx(Be,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const ss=({children:e,...t})=>d.jsx("p",{...t,children:e}),Lc={q:ss,blockquote:ss};for(let e=1;e<=6;e++)Lc[`h${e}`]={component:ss,props:{className:"title"}};const zc=({type:e="default",className:t="",heading:n=!1,children:r})=>d.jsxs("div",{className:Y("helper-text-box text-small",e,t),children:[n&&d.jsx("p",{className:"title",children:n}),typeof r=="string"?d.jsx(Pt,{options:{wrapper:C.Fragment,forceBlock:!0,overrides:Lc},children:r}):d.jsx("p",{children:r})]});const qc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=ue.useIntl(),l=C.useRef(null);e||(e=Date.now().toString());const[u,c]=C.useState(""),[h,m]=C.useState("closed");C.useEffect(()=>{const f=l.current;if(f)return f.addEventListener("transitionend",p),()=>{f.removeEventListener("transitionend",p)}},[]),C.useEffect(()=>{if(!a||typeof a!="string")return;const f=a.split(`
35
+ Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_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",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_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!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",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",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_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.",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_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_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",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>",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_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 and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",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",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 emails below.",inviteModal_cta:"Send",overlay_close:"Close",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",navigationMenu_profile:"My profile",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",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",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"},Nh={...Xn,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>"},Rh={...Xn,languageSwitcher_label:"Je voudrais lire cet article dans...",languageSwitcher_translation_original:"langue originale",languageSwitcher_translation_human:"traduit par un humain",languageSwitcher_translation_machine:"traduit par machine",languageSwitcher_disclaimer:"Ce contenu est traduit automatiquement et contiendra d’évantuelles erreurs de genre ou d’autres traductions directes. Nous essayons de résoudre ce problème, mais en attendant, si vous remarquez une erreur importante, faites-le nous savoir à <link>{email}</link>",collapsibleSection_summary:"En savoir plus"},Mh={...Xn,languageSwitcher_label:"Eu gostaria de ler este artigo em...",languageSwitcher_translation_original:"linguagem original",languageSwitcher_translation_human:"traduzido por um humano",languageSwitcher_translation_machine:"traduzido por máquina",languageSwitcher_disclaimer:"Este conteúdo foi traduzido automaticamente e, ocasionalmente, poderão ocorrer erros de linguagem de gênero ou outras traduções diretas. Estamos tentando resolver isso, porém se perceber algo errado por favor nos avise em <link>{email}</link>"},Ih=Object.freeze(Object.defineProperty({__proto__:null,en:Xn,es:Nh,fr:Rh,pt:Mh},Symbol.toStringTag,{value:"Module"})),La=(e,t=Xn)=>e in t,kt=(e,t,n,r,a={})=>{let i="";return La(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},$h=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let a=n.length-1;a>=0;a--){const i=Math.pow(10,(a+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&a<n.length-1&&(e=1,a++),r=`${e}${n[a]}`;break}}return r},oa=(e,t)=>C.Children.map(e,n=>Object.is(n,null)?n:C.cloneElement(n,{...t})),Nc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Lh=(e,t,n)=>!t.id||!t.name?"":n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Rc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(rs);if(!a)return e;for(const s of a){const o=s.replace(rs,(c,h)=>h),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"";else{const c=l;if(c.startsWith(ns))try{const h=c.replace(ns,"");u.id=h,await r({id:h}).then(m=>{const{name:p}=m;u.name=p||""})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Lh(e,u,t):s)}return e},Mc=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},zh=(e="")=>e.replace(/\s+/g,"").length>0,is=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 Be=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:c=!1,children:h=!1,...m})=>{const g=Jn(typeof t=="object"),{showTooltip:f,tooltipProps:y}=Rs(!!u);if(typeof t=="object"&&typeof g=="number"){const _=Object.assign({},t),k=_c(Object.keys(_));t=Bc(g,k,_)}!l&&u&&(u="");const D=[];typeof t=="string"&&D.push(t),r&&(D.push("icon"),typeof r=="object"?(D.push(r.icon),r.position?D.push(r.position):D.push("left"),r.hover&&D.push(`hover_${r.hover}`),r.animate&&(D.push("animate"),typeof r.animate=="string"&&D.push(r.animate))):(D.push(r),!r.includes("right")&&!r.includes("left")&&D.push("left"))),n.muted&&D.push("muted"),n.fullWidth&&D.push("full-width");const x={...m,className:Y(e,o,D,{"no-text":!h,disabled:l,button:a}),onClick:_=>{(!a||a[0]==="#")&&s&&(_.preventDefault(),_.stopPropagation()),s&&s(_)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",x.href=a);const A=C.createElement(i,x,h||(c?d.jsx(Me,{showOnFocus:!1,children:c}):null));return l&&u?d.jsxs("span",{className:"button-container",...y,children:[d.jsx(En,{isOpen:f,children:u}),A]}):A},kn=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?d.jsx(Be,{...s},o):d.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:d.jsx(Be,{...s})},o)});return C.createElement(a,{className:Y("button-wrapper",n),...r,children:i})};const tn=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return d.jsx("hr",{className:Y(e,{"has-max-width":t}),style:n})},$o={card:{range:[{height:320,width:320},{height:425,width:687},{height:510,width:768}],sizes:"(min-width: 1024px) 720px, 30vw"},responsiveCard:{range:[{height:125,width:200},{height:188,width:300},{height:313,width:500}],sizes:"(min-width: 1024px) 720px, 30vw"},banner:{range:[{height:124,width:425},{height:320,width:768},{height:510,width:1368}],sizes:"(min-width: 1024px) 975px, 50vw"},feed:{range:[{height:270,width:124},{height:320,width:425},{height:425,width:687}],sizes:"(min-width: 1024px) 510px, 20vw"},fallback:{range:[{height:124,width:375},{height:320,width:687},{height:510,width:990}],sizes:"(min-width: 1024px) 885px, 35vw"},thumbnail:{range:[{height:124,width:124},{height:320,width:320},{height:510,width:510}],sizes:"(min-width: 1024px) 453px, 20vw"}},qh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?$o[e]:$o.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Wh=({format:e,height:t,query:n,width:r})=>{let a=`w=${r}&h=${t}`;return a=e?`${a}&fm=${e}`:a,a=n?`${a}&${n}`:a,a},ii=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Wh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const er=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:c,fetchPriority:h}=e,{range:m,sizes:p}=qh(e),g=ii({format:"avif",query:s,range:m,url:o}),f=ii({format:"webp",query:s,range:m,url:o}),y=ii({format:"",query:s,range:m,url:o});return i&&i.includes("svg")?d.jsx("picture",{className:t,children:d.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})}):d.jsxs("picture",{className:t,children:[i!=="image/gif"&&d.jsx("source",{type:"image/avif",srcSet:g,sizes:p,"data-testid":"source"}),d.jsx("source",{type:"image/webp",srcSet:f,sizes:p,"data-testid":"source"}),d.jsx("img",{srcSet:y,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Hh=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(er,{image:{...e},className:"image"})}),_n=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),d.jsx("a",{href:e,className:Y("gtm-trackable",r),...l,children:t})}return n?C.createElement(n,{children:t,className:r,...o}):d.jsx(d.Fragment,{children:t})};const Ic=C.forwardRef(({className:e="",children:t},n)=>{const r=C.useRef(null),a=n||r;return d.jsx("aside",{ref:a,className:Y("popover",e),"aria-live":"polite",children:t})}),Is=({children:e})=>typeof document=="object"?vc.createPortal(e,document.body):null;const Uh=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx(Me,{children:d.jsx(ue.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),d.jsx("div",{className:"progress-tracker",children:d.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return d.jsxs("div",{className:"dot-wrapper",children:[d.jsx("div",{className:Y("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),d.jsx("div",{className:Y("line",{active:a<e})})]},r)})})})]});const Vh=({elementId:e,offset:t=20})=>{const n=ue.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return d.jsx(Be,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const Kh=({items:e,className:t="",...n})=>d.jsx("ul",{className:Y("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>d.jsx("li",{className:"bucket text-medium",children:d.jsxs("a",{href:i,...s,children:[d.jsx("p",{className:"title",children:r}),d.jsx("p",{children:a})]})},o))}),Lo=300,zo="ease-in-out";class Zh{constructor(t){this.el=t,this.summary=t.querySelector("summary"),this.content=t.querySelector(".content"),this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.summary.addEventListener("click",n=>this.onClick(n))}cleanUp(){this.summary.removeEventListener("click",t=>this.onClick(t))}onClick(t){t.preventDefault(),t.stopPropagation(),this.el.style.overflow="hidden",this.isClosing||!this.el.open?this.open():(this.isExpanding||this.el.open)&&this.shrink()}shrink(){this.isClosing=!0;const t=`${this.el.offsetHeight}px`,n=`${this.summary.offsetHeight}px`;this.animation&&this.animation.cancel(),this.animation=this.el.animate({height:[t,n]},{duration:Lo,easing:zo}),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:Lo,easing:zo}),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 za=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ue.useIntl(),i=C.useRef(null);return C.useEffect(()=>{let s;return r&&(s=new Zh(i.current)),()=>{r&&s&&s.cleanUp()}},[]),d.jsxs("details",{ref:i,className:Y("collapsible-section",t,{"should-animate":r}),children:[d.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),d.jsx("div",{className:"content",children:n})]})},qo={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Yh=e=>{let t=e;return Object.keys(qo).includes(e)&&(t=qo[e]),`url(${Ht}icons/${t}.svg)`};const Wo={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},$c=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ue.useIntl(),i=t?{"--custom-icon":Yh(t)}:{},s=La(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:Y("content-type-label text-small",e in Wo?Wo[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Nt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Ht}icons/${t}.svg)`}:{};return d.jsx("div",{className:Y("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const an=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let a=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,s=Jn(i);if(i&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),m=_c(Object.keys(h));a=Bc(s,m,h)}const{breakpoints:o,text:l="",component:u,...c}=n;return d.jsx(Nt,{variant:"subtle",className:Y("empty-state-box",e,r),children:d.jsxs(d.Fragment,{children:[t&&typeof t=="string"?d.jsx(Pt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||d.jsx(Be,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const ss=({children:e,...t})=>d.jsx("p",{...t,children:e}),Lc={q:ss,blockquote:ss};for(let e=1;e<=6;e++)Lc[`h${e}`]={component:ss,props:{className:"title"}};const zc=({type:e="default",className:t="",heading:n=!1,children:r})=>d.jsxs("div",{className:Y("helper-text-box text-small",e,t),children:[n&&d.jsx("p",{className:"title",children:n}),typeof r=="string"?d.jsx(Pt,{options:{wrapper:C.Fragment,forceBlock:!0,overrides:Lc},children:r}):d.jsx("p",{children:r})]});const qc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=ue.useIntl(),l=C.useRef(null);e||(e=Date.now().toString());const[u,c]=C.useState(""),[h,m]=C.useState("closed");C.useEffect(()=>{const f=l.current;if(f)return f.addEventListener("transitionend",p),()=>{f.removeEventListener("transitionend",p)}},[]),C.useEffect(()=>{if(!a||typeof a!="string")return;const f=a.split(`
36
36
  `);c(f.length<3?`${a.substring(0,400)}...`:f.slice(0,3).join(`
37
- `))},[a]),C.useEffect(()=>{h==="ready-to-close"&&m("closing")},[h]);const p=({propertyName:f})=>{f==="max-height"&&m(D=>D==="opening"?"open":D==="closing"?"closed":D)};if(!a)return null;const g=["opening","open"].includes(h);return d.jsxs(Nt,{variant:"subtle",className:Y("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:Y("content",h),children:[d.jsx(Pt,{options:{forceBlock:!0,...i},children:h==="closed"?u:a}),h!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(Be,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Y({"rotate-180":g}),onClick:()=>{m(g?"ready-to-close":"opening")},"aria-expanded":g,"aria-controls":e,children:g?r||o.formatMessage({id:"hideShowTextBox_hide"}):n||o.formatMessage({id:"hideShowTextBox_show"})})})]})};const Gh=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return C.createElement(e,{className:Y("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const c={wrapper:C.Fragment,forceInline:!0},h={"--icon":`url(${Ht}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(C.Fragment,{children:[d.jsx("dt",{style:h,children:d.jsx(Pt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Pt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:h,children:typeof l.text=="string"?d.jsx(Pt,{options:c,children:l.text}):l.text},u)})})},tt=()=>C.Fragment,Qh=({children:e})=>d.jsx(Nt,{variant:"secondary",children:e}),Jh=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),Xh=["span","strong","h1","h2","h3","h4","h5","h6","p"],em=({children:e})=>{const t=ue.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(C.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of C.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&C.isValidElement(s)){const o=s.type;if(Xh.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return d.jsx(za,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},tm=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(Nt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(Nt,{variant:"primary",children:e});case"pink-textbox":return d.jsx(Nt,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{children:e}):e;default:return d.jsx("div",{...t,children:e})}return d.jsx("div",{...t,children:e})},nm=e=>{const t=ue.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),d.jsxs(d.Fragment,{children:[d.jsx(Me,{element:"a",href:`#content-after-iframe-${n}`,onClick:i=>{var s;i.preventDefault(),i.stopPropagation(),(s=document.getElementById(`content-after-iframe-${n}`))==null||s.scrollIntoView({behavior:"smooth"})},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),d.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),d.jsx("span",{id:`content-after-iframe-${n}`})]})},Ho=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},rm=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&C.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||Ho(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!C.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Ho(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(Be,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},os=({children:e,...t})=>d.jsx("span",{className:Y({url:t==null?void 0:t.href}),children:e});const am={default:{a:rm,CollapsibleSection:za,TextBox:Nt,CaseStudy:Qh,style:tt,details:em,div:tm,iframe:nm,center:Jh},"text-only":{h1:tt,h2:tt,h3:tt,h4:tt,h5:tt,h6:tt,style:tt,details:tt,div:tt,TextBox:tt,CollapsibleSection:tt,CaseStudy:tt,blockquote:tt,iframe:tt,button:tt}},Kn=({className:e="",options:t={},children:n,overrideType:r="default",styling:a={}})=>{if(!n)return null;const{highlightTitles:i=!1}=a;n=n.replace(/^<br\/?>/,"");const s={wrapper:C.Fragment,forceBlock:!0};let o=am[r];return t.overrides&&(o={...o,...t.overrides}),d.jsx("div",{className:Y("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Pt,{options:{...s,...t,overrides:o},children:n})})};const Wc=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return d.jsxs("section",{className:Y("page-heading",a),children:[d.jsxs("div",{className:Y("content",{"has-max-width":e}),style:i,children:[t&&t.text&&C.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&C.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const hn=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${Ht}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=Rs(!!a),c=d.jsx("span",{...u,className:Y("pill",e,t,n,{"has-icon":r}),style:o,...s,children:i});return a?d.jsxs("span",{className:"pill-wrapper",children:[d.jsx(En,{isOpen:l,children:a}),c]}):c};const Er=({element:e="p",children:t=null,className:n="",...r})=>C.createElement(e,{...r,className:Y("status-banner text-small",n),"aria-live":"assertive"},t);const im=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ue.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,c={"--progress":`${t}%`};return d.jsx("span",{className:Y(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:c,children:C.createElement(i?"span":Me,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},$s=C.memo(im);const si="loadingBlock_",sm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ue.useIntl();t||(t={0:{text:r.formatMessage({id:`${si}loading`})},75:{text:r.formatMessage({id:`${si}almostDone`})},100:{text:r.formatMessage({id:`${si}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${Ht}icons/${t[a].icon}.svg)`}:{};return d.jsxs(Nt,{className:Y("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&d.jsx("span",{className:"step",children:t[a].text}),d.jsx($s,{progress:e})]})},om=C.memo(sm);const wt=({element:e="div",className:t="",...n})=>d.jsx($a,{element:e,className:Y("loading-placeholder",t),...n});const us={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"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Hc=(e,t)=>e in us?d.jsx("div",{className:e,children:us[e].map((n,r)=>Hc(n,r))},t):d.jsx(wt,{className:e},t),Ls=({layout:e="overview-page",...t})=>d.jsx("div",{className:Y("loading-state",e),...t,children:us[e].map((n,r)=>Hc(n,r))}),Uc=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):""},Lr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],um=e=>{const t=Math.ceil(26/Lr.length),n=Uc(e).toLowerCase();if(n==="")return Lr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Lr.length;a++)if(r<=t*(a+1))return Lr[a]};const Uo=256,sn=({className:e="",src:t="",name:n,alt:r,width:a=Uo,height:i=Uo,...s})=>{const[o,l]=C.useState(!1),u=C.useRef(null);C.useEffect(()=>{const h=u.current;if(!h)return;const m=h.getContext("2d");if(!m)return;const p=a,g=i;typeof window<"u"&&window.devicePixelRatio&&(h.width=p*window.devicePixelRatio,h.height=g*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=um(n),m.fillRect(0,0,p,g),m.font=`${p/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Uc(n),p/2,g/1.6)},[n]);let c=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(c=!0),d.jsx("figure",{className:Y("profile-picture",e,{error:o}),...s,children:c?d.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:a,height:i}):d.jsx("canvas",{ref:u})})},zs=e=>e==="apolitical"?{image:`${Ht}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ht}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},lm=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const a=e!=="",i=t!=="",s=n!=="";if(!a&&!i&&!s)return"";const o=`${e}${a&&i?` — ${t}`:t}`;let l=`${o}${(a||i)&&s?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=Un(l,r)),l};const nr=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},functions:a={},gtmContext:i="member",gtmType:s="member-click",className:o=""})=>{const l=ue.useIntl(),{size:u="medium"}=r,c=zs(t);c.name||(c.name=l.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:h,image:m}=c;let{url:p}=c;t.link!==void 0&&(t.link===!1?p=void 0:p=t.link);const g=lm(c),f=n&&n.createdAt?as(n.createdAt):!1,D=n&&n.createdAt?Ms(n.createdAt):"";return C.createElement(e,{className:Y("member text-medium",u,o),...a,children:d.jsxs(_n,{href:p,gtmType:s,gtmContext:i,onClick:y=>{y==null||y.stopPropagation()},children:[d.jsx(sn,{name:h,src:m}),d.jsxs("p",{className:"details",children:[d.jsxs("strong",{children:[h,n&&d.jsxs("span",{className:"additional-content",children:[n.createdAt&&f&&d.jsx("span",{className:"date",title:D,"aria-label":D,children:l.formatMessage({id:`dates_${f.path}`},{number:f.number})}),n.didEdit&&d.jsx("em",{children:l.formatMessage({id:"discussion_edited"})})]})]}),g&&d.jsx("small",{className:Y({"text-medium":u==="large"}),children:g})]})]})})};const Vo={small:24,medium:48},qs=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...c})=>{const h=ue.useIntl();return!n||n.length===0?null:C.createElement(e,{...c,className:Y("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((m,p)=>{let g,f="";if(p<o){const{name:D="",image:y=""}=zs(m);if(s)return d.jsx(wt,{element:"li",className:"contributor"},p);g=d.jsx(sn,{name:D,src:y,width:Vo[a||"medium"],height:Vo[a||"medium"]})}else if(p===o){const D=(t||n.length)-o;g=d.jsxs("small",{className:Y({"large-number":D>99}),children:["+",$h(D,0)]}),f="number-left"}return g?d.jsx("li",{className:Y("contributor",f),children:g},p):null})}),r&&d.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?h.formatMessage({id:`member_${n[0]}`}):Un(n[0].name||"",20):l||null})]})})};const Ws=({limit:e,valueLength:t})=>{const n=ue.useIntl(),r="form_fieldWrapper_characterLimit";if(e===0)return null;const a=e-t,i=Math.abs(t-e);return d.jsxs("small",{className:Y("character-limit",{"near-limit":t>=.99*e,"approaching-limit":t>=.9*e&&t<.99*e}),"aria-live":"polite","aria-label":n.formatMessage({id:`${r}_aria_${a<0?"over":"default"}`},{remaining:a,over:i,limit:e}),children:[d.jsx("span",{className:"hidden",children:n.formatMessage({id:r})}),t," / ",e]})},qa=e=>(e==null?void 0:e.toString().length)||0,Vc=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{qa(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const zr="emailHelperTextBox_",Kc=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=ue.useIntl(),[i,s]=C.useState({path:`${zr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=C.useState(!1),u=C.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=f=>{s({path:`${zr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:D=>u(D),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:f})};if(typeof r!="function"){g(a.formatMessage({id:`${zr}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(f=>{g(f.message)}).finally(()=>{l(!1)})},[t,n,r]);C.useEffect(()=>{let p=zr,g="default",f={},D={};switch(e){case"gov":p+="autoApproved",g="success";break;case"nonGov":p+="unrecognisedEmail",g="error",f={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":p+="pendingApproval",g="error",D={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",g="error",f={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:y=>u(y),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",g="error",f={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},D={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",f={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:p,type:g,link:f,mail:D})},[e]);const c={};return["link","mail"].forEach(p=>{c[p]=Object.keys(i[p]).length?g=>d.jsx("a",{...i[p],children:g}):g=>g}),d.jsx(zc,{type:i.type,heading:o?!1:a.formatMessage({id:`${i.path}_title`}),children:o?d.jsxs(d.Fragment,{children:[d.jsx(wt,{element:"span"}),d.jsx(wt,{element:"span"})]}):a.formatMessage({id:`${i.path}_text`},{...c,strong:p=>d.jsx("strong",{children:p}),em:p=>d.jsx("em",{children:p}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:i.error})})},Mn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,...u})=>{const c=C.useRef(),h=r||c;return C.createElement(t,{ref:h,...u,type:o,id:n,name:i,className:Y(e,t,{"has-scrollbar":o==="textarea"&&h.current&&h.current.clientHeight<h.current.scrollHeight}),value:l,placeholder:s,...a,onChange:m=>{const p=m.target;a.onChange(p.value)}})};const Tn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},cm=500,dm=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:c},h]=C.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:m,activePredictionIndex:p,isPredictionSelected:g},f]=C.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:D}=ue.useIntl();r||(r=D({id:"inputAutocomplete_placeholder"})),C.useEffect(()=>{const _=setTimeout(()=>{g||h(k=>({...k,debouncedInput:l}))},cm);return()=>{clearTimeout(_)}},[l,g]),C.useEffect(()=>{c&&!g?(async()=>{try{const k=await o(c)||[];f(F=>({...F,predictions:k}))}catch(k){console.error("Error fetching predictions:",k),f(F=>({...F,predictions:[]}))}})():f(_=>({..._,predictions:[]}))},[c,g]),C.useEffect(()=>{p>=0&&m[p]&&h(_=>({..._,displayInput:m[p].description}))},[p,m]);const y=_=>{[Tn.DOWN,Tn.UP,Tn.ENTER].includes(_.key)&&(_.preventDefault(),_.key===Tn.DOWN&&p<m.length-1?f(k=>({...k,activePredictionIndex:p+1})):_.key===Tn.UP&&p>0?f(k=>({...k,activePredictionIndex:p-1})):_.key===Tn.ENTER&&p>-1&&(s(m[p].description),h(k=>({...k,input:m[p].description})),f(k=>({...k,predictions:[],isPredictionSelected:!0}))))},w=_=>{s(_.target.value),h(k=>({...k,input:_.target.value,displayInput:_.target.value})),f(k=>({...k,activePredictionIndex:-1,isPredictionSelected:!1}))},A=_=>{s(_.description),h(k=>({...k,input:_.description,displayInput:_.description})),f(k=>({...k,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:w,onKeyDown:y,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:m.map((_,k)=>d.jsx("li",{onClick:()=>A(_),onMouseEnter:()=>f(F=>({...F,activePredictionIndex:k})),className:Y("predictions-list-item",{active:k===p}),children:_.description},k))})]})};const Zc=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:c,...h})=>{const m=ue.useIntl(),{onChange:p,...g}=r,f=()=>{t||p(c?null:l)},D=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:y=>{(y.key==="Enter"||y.code==="Space")&&(y.preventDefault(),y.stopPropagation(),f())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||m.formatMessage({id:s?`${s}_${a}`:a})})]});return C.createElement(n,{onClick:y=>{const w=y.target;w.nodeName.toLowerCase()==="a"||w.parentNode&&w.parentNode.nodeName.toLowerCase()==="a"||(y.preventDefault(),y.stopPropagation(),f())},className:Y("checkbox-wrapper",e),...h,...g},D)};const fm=C.memo(function({direction:t="down"}){return d.jsx($a,{className:Y("rotating-chevron",`direction-${t}`)})});const hm=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const c=ue.useIntl(),[h,m]=C.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[f,D]=C.useState(g);let y;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?y=t&&f?t.find(S=>S.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?y=f[0]:y={id:"",label:""},C.useEffect(()=>{D(g)},[r,n]);const{onChange:w,onMultiSelectSubmit:A,..._}=a,k=S=>{if(o){let $=[];f!=null&&f.includes(S.id)?$=f.filter(R=>R!==S.id):$=[...f,S.id],D([...$]),w&&w([...$])}else D([S]),w&&w(S.id),m(!1)},F=S=>{if(S==="all"){const $=(t==null?void 0:t.map(R=>R.id))||[];D($),w&&w($)}else D([]),w&&w([])};return d.jsxs("div",{className:Y("dropdown-wrapper",e),children:[d.jsxs("button",{className:"input","aria-expanded":h,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),m(!h)},"data-testid":"dropdown-selector",..._,children:[o?`${s} · ${f.length}`:y.label,d.jsx(fm,{direction:h?"up":"down"})]}),d.jsx("select",{defaultValue:y.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const $=t&&t.find(R=>R.id===S.target.value);k($)},hidden:!h,..._,children:t==null?void 0:t.map(S=>d.jsx("option",{value:S.id,children:S.label},S.id))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!h,children:[d.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&d.jsxs("div",{className:"action-bar",children:[d.jsx("p",{children:`${f==null?void 0:f.length} selected`}),d.jsxs("ul",{children:[d.jsx("li",{children:d.jsx(Be,{variant:"tertiary",size:"small",onClick:()=>F("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(Be,{variant:"tertiary",size:"small",onClick:()=>F("none"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(S=>{const $=S.id===y.id||(f==null?void 0:f.includes(S))||(f==null?void 0:f.includes(S.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:Y("gtm-trackable",{selected:$,"selected-single":$&&!o}),"data-gtm-event-type":`${S}-click`,"data-gtm-event-context":i,onClick:R=>{R.preventDefault(),R.stopPropagation(),k(S)},role:"menuitem","aria-current":$,"data-testid":$?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:Y({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(Be,{variant:"secondary",onClick:()=>{A&&A(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),m(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const mm=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:c,...h})=>{const m=ue.useIntl(),p=i?c:[],g=c;return d.jsx("ul",{...h,className:Y("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:f,label:D=!1,value:y=f,disabled:w=!1})=>{const A=`${r}_${f}`,_=()=>{if(w)return;let k;if(i){const F=p==null?void 0:p.indexOf(y);Array.isArray(p)&&F>=0?(k=p,k.splice(F,1)):(!p||p.length===0?k=[]:k=p,k.push(y))}else k=g===y?void 0:y;t.onChange(k)};return d.jsx(Zc,{element:"li",id:A,type:u==="checkboxes"?"checkbox":"radio",shownValue:y,value:i?p==null?void 0:p.includes(y):g===y,functions:{...t,onChange:_},intlPath:n,label:D||m.formatMessage({id:n?`${n}_${f}`:f}),disabled:w},A)})})};const pm=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},...r})=>{const a=ue.useIntl(),i=C.useRef(),s=e||i,[o,l]=C.useState(!1),[u,c]=C.useState(t),h=()=>{var m;l(!o),c(o?"password":"text"),(m=s.current)==null||m.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:Y("show-password gtm-trackable",{"password-visible":o}),"data-gtm-event-context":n,"data-gtm-event-type":`${o?"hide":"show"}-password-click`,onClick:h,"aria-label":a.formatMessage({id:`showpassword_aria_${o?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${o?"hide":"show"}`})}),d.jsx(Mn,{inputRef:s,type:u,...r})]})};const Sn={text:{component:Mn},email:{component:Mn},url:{component:Mn},textarea:{component:Mn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Zc},checkboxes:{component:mm,props:{multiSelect:!0}},select:{component:hm},password:{component:pm},autocomplete:{component:dm}},gm=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:c,...h})=>{const m=ue.useIntl(),p=l&&l.some(({condition:k})=>k==="required"),g=qa(u),f=o&&Sn[o]&&Sn[o].component?Sn[o].component:Mn,D={};o&&["checkboxes"].includes(o)?D.element="span":D.htmlFor=e;let y={...h,id:e,name:e,className:r?"error":"",type:o,required:p,"aria-required":p,functions:pn(a),value:u};if(i>0){const k=Vc(i,a.onChange);y={...y,...k},k.functions&&typeof k.functions=="object"&&(y.functions={...y.functions,...k.functions})}o&&Sn[o]&&Sn[o].props&&(y={...y,...Sn[o].props}),o&&["checkboxes"].includes(o)&&(y.intlPath=`${t}_${e}`),r&&(y["aria-invalid"]=!0,y["aria-describedby"]=`error-${e}`);const w=h.label||m.formatMessage({id:t?`${t}_${e}`:e}),A=({...k})=>r?C.createElement(k.as||"dd",{id:`error-${e}`,className:"error text-small",role:"alert","aria-live":"assertive",...k},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(f,{...y,label:w,className:Y("field-wrapper",n)}),d.jsx(A,{as:"p"})]});const _=k=>C.createElement(k.element||"label",{...k,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsxs("dl",{className:Y("field-wrapper text-medium",n),children:[d.jsx("dt",{children:d.jsxs(_,{...D,children:[w,p&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",m.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),d.jsxs("dd",{children:[d.jsx(f,{...y}),d.jsx(Ws,{limit:i,valueLength:g})]}),d.jsx(A,{})]})},vm=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?pn(e.errors):{},i=e.values?pn(e.values):{};switch(n){case"toggleSubmitting":return{...e,isSubmitting:!e.isSubmitting};case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:c}=r,h=pn(Object.keys(a));for(const m of s)if(m.validation)for(let p=0;p<m.validation.length;p++){const{condition:g="required",error:f=!1}=m.validation[p];let D=!1;if(typeof g=="function"){const y=g(i);y&&(D=f||y)}else{const y=i[m.id];switch(g){case"required":(!y||typeof y=="string"&&y.trim().length===0)&&(D=f||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{y&&!/^([^0-9]*)$/.test(y)&&(D=f||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{y&&!/^(([^<>()[\]\\.,;:\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(y)&&(D=f||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{y&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(y)&&(D=f||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(D){o({type:"addError",payload:{key:m.id,value:D}}),h.push(m.id);break}}return h.length===0?l(i):u(i,h),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let oi=null;const rr=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,gtm:u={context:"Form",event:"form-submit-click"},functions:{onSuccess:c=async()=>{},onCancel:h=()=>{},onCatch:m=()=>{},onFailure:p=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...g})=>{const{customOnSubmit:f,hideButton:D,...y}=s,w=40,{shouldShowCancelButton:A=!1,shouldReset:_=!0,showRequiredLabels:k=!0,showSuccessMessage:F=!1}=l||{},S=ue.useIntl(),$={};t.length&&t.forEach(v=>{const H=v.id||v.name;H&&($[H]=v.value||"")});const[R,I]=C.useReducer(vm,{isSubmitting:!1,formSubmitted:!1,errors:{},values:$}),{errors:M,isSubmitting:x,formSubmitted:E,values:O}=R;C.useEffect(()=>{_&&E&&(oi=setTimeout(()=>{I({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[E]),C.useEffect(()=>()=>{oi&&clearTimeout(oi)},[]),C.useEffect(()=>{const v=H=>{I({type:"updateValue",payload:{key:H.detail.id,value:H.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",v),()=>{document.removeEventListener("dropdownMultiSelectSubmit",v)}},[]);const j=C.useRef(null),q=a||j;if(!t.length)return null;s.text||(s.text=S.formatMessage({id:"form_submit"}));const z=()=>{if(!x){if(I({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&I({type:"submitForm",payload:{fields:t,dispatch:I,intl:S}});return}I({type:"submitForm",payload:{fields:t,dispatch:I,onSuccess:async v=>{try{await c(v),I({type:_?"formSubmittedAndReset":"formSubmitted"})}catch(H){m(H),I({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(v,H)=>{p(v,H),I({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:S}})}},X=[{...y,icon:E?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:v=>{var B;if(v.preventDefault(),v.stopPropagation(),x)return;let H=0;if((B=q==null?void 0:q.current)!=null&&B.id){const T=document.getElementById(q.current.id);T&&(H=T.getBoundingClientRect().top+window.scrollY)}const ee=document.getElementById("header");ee&&(H=H-ee.offsetHeight-w),H<0&&(H=0),window.scrollTo({top:H,behavior:"smooth"}),z()},disabled:x||E||s.disabled,"data-gtm-event-context":u.context,"data-gtm-event-type":u.event,children:x||E?S.formatMessage({id:`form_${x?"submitting":"submitted"}`}):s.text}];return A&&X.unshift({...o,className:"gtm-trackable","data-gtm-event-context":u.context,"data-gtm-event-type":u.event,disabled:x||E,onClick:h,children:o.text||S.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[C.createElement(e,{...g,id:r,className:Y("form",n),ref:q},d.jsxs(d.Fragment,{children:[M!=null&&M.general?d.jsx(an,{variant:"error",text:S.formatMessage({id:"form_error_generalError"})}):null,(!_||!x&&!E||f)&&t.map((v,H)=>{const{id:ee=v.name||H,component:B,functions:T={onChange:()=>{}},submitOnEnter:W=!1}=v;if(B)return d.jsx(B,{...v.props||{}},`component-${ee}-${H}`);const L=O?O[ee]:"",U={...T,onChange:te=>{I({type:"updateValue",payload:{key:ee,value:te}}),T.onChange(te&&te.toString(),I)}};return W&&(U.onKeyDown=te=>{te.key==="Enter"&&(te.stopPropagation(),te.preventDefault(),z()),T.onKeyDown&&T.onKeyDown(te)}),d.jsx(gm,{intlPath:i,...v,showRequiredLabels:k,value:L,error:M==null?void 0:M[ee],functions:U},ee)}),D?null:(x||E)&&f?f:d.jsx(kn,{className:Y("cta",{center:x||E,submitted:E}),buttons:X})]})),F&&E&&d.jsx(Er,{className:"success",children:typeof F=="string"?F:S.formatMessage({id:"form_success"})})]})};const qr="passwordRules_",Yc="isMoreThanEightCharacters",Gc="includesNumberAndSymbol",Qc="includesLowerAndUppercase",bm={[Yc]:"8Characters",[Gc]:"numberSymbol",[Qc]:"lowercaseUppercase"},ym=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ue.useIntl();return d.jsxs("aside",{className:Y("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${qr}intro`})}),d.jsx("ul",{children:[Yc,Gc,Qc].map(r=>d.jsxs("li",{className:Y({matches:e[r]}),children:[d.jsxs(Me,{children:[n.formatMessage({id:`${qr}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${qr}rule_${bm[r]}`})}),!e[r]&&d.jsxs(Me,{element:"strong",children:[" ",n.formatMessage({id:`${qr}notMet`})]})]},`rule-${r}`))})]})},Jc=C.memo(ym);const Dm=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ue.useIntl(),[l,u]=C.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const y=await n();u(w=>({...w,setUp:!0,id:y&&y.id,disabled:!1}))}catch(y){u(w=>({...w,setUp:!0,disabled:!0})),a(y)}};if(C.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(wt,{className:"rating-placeholder"});const{id:h,rating:m,disabled:p}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},D=async y=>{if(!(!h||p))try{u(w=>({...w,rating:y,disabled:!0})),await r({id:h,value:y})}catch(w){u(A=>({...A,rating:null})),a(w)}finally{u(w=>({...w,disabled:!1}))}};return d.jsxs("div",{className:Y("rating",i),children:[d.jsx("span",{className:"label",children:f[m?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(y=>{const w=y+1;return d.jsx("li",{className:Y({selected:m&&w<=m}),children:d.jsx(Be,{variant:"tertiary",size:"small",icon:{icon:`star${!m||w>m?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:w,total:t})}${w===1||w===t?` - ${f[w===1?"low":"high"]}`:""}`,onClick:A=>{A.preventDefault(),A.stopPropagation(),D(w)},disabled:p})},`rating-${w}`)})})]})};function Cm(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 ls(e,t){return Array(t+1).join(e)}function xm(e){return e.replace(/^\n*/,"")}function wm(e){for(var t=e.length;t>0&&e[t-1]===`
37
+ `))},[a]),C.useEffect(()=>{h==="ready-to-close"&&m("closing")},[h]);const p=({propertyName:f})=>{f==="max-height"&&m(y=>y==="opening"?"open":y==="closing"?"closed":y)};if(!a)return null;const g=["opening","open"].includes(h);return d.jsxs(Nt,{variant:"subtle",className:Y("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:Y("content",h),children:[d.jsx(Pt,{options:{forceBlock:!0,...i},children:h==="closed"?u:a}),h!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(Be,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Y({"rotate-180":g}),onClick:()=>{m(g?"ready-to-close":"opening")},"aria-expanded":g,"aria-controls":e,children:g?r||o.formatMessage({id:"hideShowTextBox_hide"}):n||o.formatMessage({id:"hideShowTextBox_show"})})})]})};const Gh=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return C.createElement(e,{className:Y("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const c={wrapper:C.Fragment,forceInline:!0},h={"--icon":`url(${Ht}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(C.Fragment,{children:[d.jsx("dt",{style:h,children:d.jsx(Pt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Pt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:h,children:typeof l.text=="string"?d.jsx(Pt,{options:c,children:l.text}):l.text},u)})})},tt=()=>C.Fragment,Qh=({children:e})=>d.jsx(Nt,{variant:"secondary",children:e}),Jh=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),Xh=["span","strong","h1","h2","h3","h4","h5","h6","p"],em=({children:e})=>{const t=ue.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(C.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of C.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&C.isValidElement(s)){const o=s.type;if(Xh.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return d.jsx(za,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},tm=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(Nt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(Nt,{variant:"primary",children:e});case"pink-textbox":return d.jsx(Nt,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{children:e}):e;default:return d.jsx("div",{...t,children:e})}return d.jsx("div",{...t,children:e})},nm=e=>{const t=ue.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),d.jsxs(d.Fragment,{children:[d.jsx(Me,{element:"a",href:`#content-after-iframe-${n}`,onClick:i=>{var s;i.preventDefault(),i.stopPropagation(),(s=document.getElementById(`content-after-iframe-${n}`))==null||s.scrollIntoView({behavior:"smooth"})},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),d.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),d.jsx("span",{id:`content-after-iframe-${n}`})]})},Ho=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},rm=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&C.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||Ho(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!C.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Ho(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(Be,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},os=({children:e,...t})=>d.jsx("span",{className:Y({url:t==null?void 0:t.href}),children:e});const am={default:{a:rm,CollapsibleSection:za,TextBox:Nt,CaseStudy:Qh,style:tt,details:em,div:tm,iframe:nm,center:Jh},"text-only":{h1:tt,h2:tt,h3:tt,h4:tt,h5:tt,h6:tt,style:tt,details:tt,div:tt,TextBox:tt,CollapsibleSection:tt,CaseStudy:tt,blockquote:tt,iframe:tt,button:tt}},Vn=({className:e="",options:t={},children:n,overrideType:r="default",styling:a={}})=>{if(!n)return null;const{highlightTitles:i=!1}=a;n=n.replace(/^<br\/?>/,"");const s={wrapper:C.Fragment,forceBlock:!0};let o=am[r];return t.overrides&&(o={...o,...t.overrides}),d.jsx("div",{className:Y("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Pt,{options:{...s,...t,overrides:o},children:n})})};const Wc=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return d.jsxs("section",{className:Y("page-heading",a),children:[d.jsxs("div",{className:Y("content",{"has-max-width":e}),style:i,children:[t&&t.text&&C.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&C.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const hn=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${Ht}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=Rs(!!a),c=d.jsx("span",{...u,className:Y("pill",e,t,n,{"has-icon":r}),style:o,...s,children:i});return a?d.jsxs("span",{className:"pill-wrapper",children:[d.jsx(En,{isOpen:l,children:a}),c]}):c};const Er=({element:e="p",children:t=null,className:n="",...r})=>C.createElement(e,{...r,className:Y("status-banner text-small",n),"aria-live":"assertive"},t);const im=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ue.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,c={"--progress":`${t}%`};return d.jsx("span",{className:Y(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:c,children:C.createElement(i?"span":Me,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},$s=C.memo(im);const si="loadingBlock_",sm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ue.useIntl();t||(t={0:{text:r.formatMessage({id:`${si}loading`})},75:{text:r.formatMessage({id:`${si}almostDone`})},100:{text:r.formatMessage({id:`${si}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${Ht}icons/${t[a].icon}.svg)`}:{};return d.jsxs(Nt,{className:Y("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&d.jsx("span",{className:"step",children:t[a].text}),d.jsx($s,{progress:e})]})},om=C.memo(sm);const wt=({element:e="div",className:t="",...n})=>d.jsx($a,{element:e,className:Y("loading-placeholder",t),...n});const us={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"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Hc=(e,t)=>e in us?d.jsx("div",{className:e,children:us[e].map((n,r)=>Hc(n,r))},t):d.jsx(wt,{className:e},t),Ls=({layout:e="overview-page",...t})=>d.jsx("div",{className:Y("loading-state",e),...t,children:us[e].map((n,r)=>Hc(n,r))}),Uc=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):""},Lr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],um=e=>{const t=Math.ceil(26/Lr.length),n=Uc(e).toLowerCase();if(n==="")return Lr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Lr.length;a++)if(r<=t*(a+1))return Lr[a]};const Uo=256,sn=({className:e="",src:t="",name:n,alt:r,width:a=Uo,height:i=Uo,...s})=>{const[o,l]=C.useState(!1),u=C.useRef(null);C.useEffect(()=>{const h=u.current;if(!h)return;const m=h.getContext("2d");if(!m)return;const p=a,g=i;typeof window<"u"&&window.devicePixelRatio&&(h.width=p*window.devicePixelRatio,h.height=g*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=um(n),m.fillRect(0,0,p,g),m.font=`${p/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Uc(n),p/2,g/1.6)},[n]);let c=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(c=!0),d.jsx("figure",{className:Y("profile-picture",e,{error:o}),...s,children:c?d.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:a,height:i}):d.jsx("canvas",{ref:u})})},zs=e=>e==="apolitical"?{image:`${Ht}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ht}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},lm=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const a=e!=="",i=t!=="",s=n!=="";if(!a&&!i&&!s)return"";const o=`${e}${a&&i?` — ${t}`:t}`;let l=`${o}${(a||i)&&s?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=Hn(l,r)),l};const tr=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},functions:a={},gtmContext:i="member",gtmType:s="member-click",className:o=""})=>{const l=ue.useIntl(),{size:u="medium"}=r,c=zs(t);c.name||(c.name=l.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:h,image:m}=c;let{url:p}=c;t.link!==void 0&&(t.link===!1?p=void 0:p=t.link);const g=lm(c),f=n&&n.createdAt?as(n.createdAt):!1,y=n&&n.createdAt?Ms(n.createdAt):"";return C.createElement(e,{className:Y("member text-medium",u,o),...a,children:d.jsxs(_n,{href:p,gtmType:s,gtmContext:i,onClick:D=>{D==null||D.stopPropagation()},children:[d.jsx(sn,{name:h,src:m}),d.jsxs("p",{className:"details",children:[d.jsxs("strong",{children:[h,n&&d.jsxs("span",{className:"additional-content",children:[n.createdAt&&f&&d.jsx("span",{className:"date",title:y,"aria-label":y,children:l.formatMessage({id:`dates_${f.path}`},{number:f.number})}),n.didEdit&&d.jsx("em",{children:l.formatMessage({id:"discussion_edited"})})]})]}),g&&d.jsx("small",{className:Y({"text-medium":u==="large"}),children:g})]})]})})};const Vo={small:24,medium:48},qs=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...c})=>{const h=ue.useIntl();return!n||n.length===0?null:C.createElement(e,{...c,className:Y("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((m,p)=>{let g,f="";if(p<o){const{name:y="",image:D=""}=zs(m);if(s)return d.jsx(wt,{element:"li",className:"contributor"},p);g=d.jsx(sn,{name:y,src:D,width:Vo[a||"medium"],height:Vo[a||"medium"]})}else if(p===o){const y=(t||n.length)-o;g=d.jsxs("small",{className:Y({"large-number":y>99}),children:["+",$h(y,0)]}),f="number-left"}return g?d.jsx("li",{className:Y("contributor",f),children:g},p):null})}),r&&d.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?h.formatMessage({id:`member_${n[0]}`}):Hn(n[0].name||"",20):l||null})]})})};const Ws=({limit:e,valueLength:t})=>{const n=ue.useIntl(),r="form_fieldWrapper_characterLimit";if(e===0)return null;const a=e-t,i=Math.abs(t-e);return d.jsxs("small",{className:Y("character-limit",{"near-limit":t>=.99*e,"approaching-limit":t>=.9*e&&t<.99*e}),"aria-live":"polite","aria-label":n.formatMessage({id:`${r}_aria_${a<0?"over":"default"}`},{remaining:a,over:i,limit:e}),children:[d.jsx("span",{className:"hidden",children:n.formatMessage({id:r})}),t," / ",e]})},qa=e=>(e==null?void 0:e.toString().length)||0,Vc=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{qa(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const zr="emailHelperTextBox_",Kc=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=ue.useIntl(),[i,s]=C.useState({path:`${zr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=C.useState(!1),u=C.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=f=>{s({path:`${zr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:y=>u(y),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:f})};if(typeof r!="function"){g(a.formatMessage({id:`${zr}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(f=>{g(f.message)}).finally(()=>{l(!1)})},[t,n,r]);C.useEffect(()=>{let p=zr,g="default",f={},y={};switch(e){case"gov":p+="autoApproved",g="success";break;case"nonGov":p+="unrecognisedEmail",g="error",f={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":p+="pendingApproval",g="error",y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",g="error",f={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:D=>u(D),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",g="error",f={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",f={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:p,type:g,link:f,mail:y})},[e]);const c={};return["link","mail"].forEach(p=>{c[p]=Object.keys(i[p]).length?g=>d.jsx("a",{...i[p],children:g}):g=>g}),d.jsx(zc,{type:i.type,heading:o?!1:a.formatMessage({id:`${i.path}_title`}),children:o?d.jsxs(d.Fragment,{children:[d.jsx(wt,{element:"span"}),d.jsx(wt,{element:"span"})]}):a.formatMessage({id:`${i.path}_text`},{...c,strong:p=>d.jsx("strong",{children:p}),em:p=>d.jsx("em",{children:p}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:i.error})})},Rn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,...u})=>{const c=C.useRef(),h=r||c;return C.createElement(t,{ref:h,...u,type:o,id:n,name:i,className:Y(e,t,{"has-scrollbar":o==="textarea"&&h.current&&h.current.clientHeight<h.current.scrollHeight}),value:l,placeholder:s,...a,onChange:m=>{const p=m.target;a.onChange(p.value)}})};const Tn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},cm=500,dm=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:c},h]=C.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:m,activePredictionIndex:p,isPredictionSelected:g},f]=C.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:y}=ue.useIntl();r||(r=y({id:"inputAutocomplete_placeholder"})),C.useEffect(()=>{const _=setTimeout(()=>{g||h(k=>({...k,debouncedInput:l}))},cm);return()=>{clearTimeout(_)}},[l,g]),C.useEffect(()=>{c&&!g?(async()=>{try{const k=await o(c)||[];f(F=>({...F,predictions:k}))}catch(k){console.error("Error fetching predictions:",k),f(F=>({...F,predictions:[]}))}})():f(_=>({..._,predictions:[]}))},[c,g]),C.useEffect(()=>{p>=0&&m[p]&&h(_=>({..._,displayInput:m[p].description}))},[p,m]);const D=_=>{[Tn.DOWN,Tn.UP,Tn.ENTER].includes(_.key)&&(_.preventDefault(),_.key===Tn.DOWN&&p<m.length-1?f(k=>({...k,activePredictionIndex:p+1})):_.key===Tn.UP&&p>0?f(k=>({...k,activePredictionIndex:p-1})):_.key===Tn.ENTER&&p>-1&&(s(m[p].description),h(k=>({...k,input:m[p].description})),f(k=>({...k,predictions:[],isPredictionSelected:!0}))))},x=_=>{s(_.target.value),h(k=>({...k,input:_.target.value,displayInput:_.target.value})),f(k=>({...k,activePredictionIndex:-1,isPredictionSelected:!1}))},A=_=>{s(_.description),h(k=>({...k,input:_.description,displayInput:_.description})),f(k=>({...k,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:x,onKeyDown:D,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:m.map((_,k)=>d.jsx("li",{onClick:()=>A(_),onMouseEnter:()=>f(F=>({...F,activePredictionIndex:k})),className:Y("predictions-list-item",{active:k===p}),children:_.description},k))})]})};const Zc=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:c,...h})=>{const m=ue.useIntl(),{onChange:p,...g}=r,f=()=>{t||p(c?null:l)},y=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:D=>{(D.key==="Enter"||D.code==="Space")&&(D.preventDefault(),D.stopPropagation(),f())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||m.formatMessage({id:s?`${s}_${a}`:a})})]});return C.createElement(n,{onClick:D=>{const x=D.target;x.nodeName.toLowerCase()==="a"||x.parentNode&&x.parentNode.nodeName.toLowerCase()==="a"||(D.preventDefault(),D.stopPropagation(),f())},className:Y("checkbox-wrapper",e),...h,...g},y)};const fm=C.memo(function({direction:t="down"}){return d.jsx($a,{className:Y("rotating-chevron",`direction-${t}`)})});const hm=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const c=ue.useIntl(),[h,m]=C.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[f,y]=C.useState(g);let D;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?D=t&&f?t.find(S=>S.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?D=f[0]:D={id:"",label:""},C.useEffect(()=>{y(g)},[r,n]);const{onChange:x,onMultiSelectSubmit:A,..._}=a,k=S=>{if(o){let $=[];f!=null&&f.includes(S.id)?$=f.filter(R=>R!==S.id):$=[...f,S.id],y([...$]),x&&x([...$])}else y([S]),x&&x(S.id),m(!1)},F=S=>{if(S==="all"){const $=(t==null?void 0:t.map(R=>R.id))||[];y($),x&&x($)}else y([]),x&&x([])};return d.jsxs("div",{className:Y("dropdown-wrapper",e),children:[d.jsxs("button",{className:"input","aria-expanded":h,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),m(!h)},"data-testid":"dropdown-selector",..._,children:[o?`${s} · ${f.length}`:D.label,d.jsx(fm,{direction:h?"up":"down"})]}),d.jsx("select",{defaultValue:D.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const $=t&&t.find(R=>R.id===S.target.value);k($)},hidden:!h,..._,children:t==null?void 0:t.map(S=>d.jsx("option",{value:S.id,children:S.label},S.id))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!h,children:[d.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&d.jsxs("div",{className:"action-bar",children:[d.jsx("p",{children:`${f==null?void 0:f.length} selected`}),d.jsxs("ul",{children:[d.jsx("li",{children:d.jsx(Be,{variant:"tertiary",size:"small",onClick:()=>F("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(Be,{variant:"tertiary",size:"small",onClick:()=>F("none"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(S=>{const $=S.id===D.id||(f==null?void 0:f.includes(S))||(f==null?void 0:f.includes(S.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:Y("gtm-trackable",{selected:$,"selected-single":$&&!o}),"data-gtm-event-type":`${S}-click`,"data-gtm-event-context":i,onClick:R=>{R.preventDefault(),R.stopPropagation(),k(S)},role:"menuitem","aria-current":$,"data-testid":$?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:Y({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(Be,{variant:"secondary",onClick:()=>{A&&A(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),m(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const mm=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:c,...h})=>{const m=ue.useIntl(),p=i?c:[],g=c;return d.jsx("ul",{...h,className:Y("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:f,label:y=!1,value:D=f,disabled:x=!1})=>{const A=`${r}_${f}`,_=()=>{if(x)return;let k;if(i){const F=p==null?void 0:p.indexOf(D);Array.isArray(p)&&F>=0?(k=p,k.splice(F,1)):(!p||p.length===0?k=[]:k=p,k.push(D))}else k=g===D?void 0:D;t.onChange(k)};return d.jsx(Zc,{element:"li",id:A,type:u==="checkboxes"?"checkbox":"radio",shownValue:D,value:i?p==null?void 0:p.includes(D):g===D,functions:{...t,onChange:_},intlPath:n,label:y||m.formatMessage({id:n?`${n}_${f}`:f}),disabled:x},A)})})};const pm=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},...r})=>{const a=ue.useIntl(),i=C.useRef(),s=e||i,[o,l]=C.useState(!1),[u,c]=C.useState(t),h=()=>{var m;l(!o),c(o?"password":"text"),(m=s.current)==null||m.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:Y("show-password gtm-trackable",{"password-visible":o}),"data-gtm-event-context":n,"data-gtm-event-type":`${o?"hide":"show"}-password-click`,onClick:h,"aria-label":a.formatMessage({id:`showpassword_aria_${o?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${o?"hide":"show"}`})}),d.jsx(Rn,{inputRef:s,type:u,...r})]})};const Sn={text:{component:Rn},email:{component:Rn},url:{component:Rn},textarea:{component:Rn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Zc},checkboxes:{component:mm,props:{multiSelect:!0}},select:{component:hm},password:{component:pm},autocomplete:{component:dm}},gm=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:c,...h})=>{const m=ue.useIntl(),p=l&&l.some(({condition:k})=>k==="required"),g=qa(u),f=o&&Sn[o]&&Sn[o].component?Sn[o].component:Rn,y={};o&&["checkboxes"].includes(o)?y.element="span":y.htmlFor=e;let D={...h,id:e,name:e,className:r?"error":"",type:o,required:p,"aria-required":p,functions:pn(a),value:u};if(i>0){const k=Vc(i,a.onChange);D={...D,...k},k.functions&&typeof k.functions=="object"&&(D.functions={...D.functions,...k.functions})}o&&Sn[o]&&Sn[o].props&&(D={...D,...Sn[o].props}),o&&["checkboxes"].includes(o)&&(D.intlPath=`${t}_${e}`),r&&(D["aria-invalid"]=!0,D["aria-describedby"]=`error-${e}`);const x=h.label||m.formatMessage({id:t?`${t}_${e}`:e}),A=({...k})=>r?C.createElement(k.as||"dd",{id:`error-${e}`,className:"error text-small",role:"alert","aria-live":"assertive",...k},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(f,{...D,label:x,className:Y("field-wrapper",n)}),d.jsx(A,{as:"p"})]});const _=k=>C.createElement(k.element||"label",{...k,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsxs("dl",{className:Y("field-wrapper text-medium",n),children:[d.jsx("dt",{children:d.jsxs(_,{...y,children:[x,p&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",m.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),d.jsxs("dd",{children:[d.jsx(f,{...D}),d.jsx(Ws,{limit:i,valueLength:g})]}),d.jsx(A,{})]})},vm=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?pn(e.errors):{},i=e.values?pn(e.values):{};switch(n){case"toggleSubmitting":return{...e,isSubmitting:!e.isSubmitting};case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:c}=r,h=pn(Object.keys(a));for(const m of s)if(m.validation)for(let p=0;p<m.validation.length;p++){const{condition:g="required",error:f=!1}=m.validation[p];let y=!1;if(typeof g=="function"){const D=g(i);D&&(y=f||D)}else{const D=i[m.id];switch(g){case"required":(!D||typeof D=="string"&&D.trim().length===0)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{D&&!/^([^0-9]*)$/.test(D)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{D&&!/^(([^<>()[\]\\.,;:\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(D)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{D&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(D)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(y){o({type:"addError",payload:{key:m.id,value:y}}),h.push(m.id);break}}return h.length===0?l(i):u(i,h),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let oi=null;const nr=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,gtm:u={context:"Form",event:"form-submit-click"},functions:{onSuccess:c=async()=>{},onCancel:h=()=>{},onCatch:m=()=>{},onFailure:p=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...g})=>{const{customOnSubmit:f,hideButton:y,...D}=s,x=40,{shouldShowCancelButton:A=!1,shouldReset:_=!0,showRequiredLabels:k=!0,showSuccessMessage:F=!1}=l||{},S=ue.useIntl(),$={};t.length&&t.forEach(v=>{const H=v.id||v.name;H&&($[H]=v.value||"")});const[R,I]=C.useReducer(vm,{isSubmitting:!1,formSubmitted:!1,errors:{},values:$}),{errors:M,isSubmitting:w,formSubmitted:E,values:O}=R;C.useEffect(()=>{_&&E&&(oi=setTimeout(()=>{I({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[E]),C.useEffect(()=>()=>{oi&&clearTimeout(oi)},[]),C.useEffect(()=>{const v=H=>{I({type:"updateValue",payload:{key:H.detail.id,value:H.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",v),()=>{document.removeEventListener("dropdownMultiSelectSubmit",v)}},[]);const j=C.useRef(null),q=a||j;if(!t.length)return null;s.text||(s.text=S.formatMessage({id:"form_submit"}));const z=()=>{if(!w){if(I({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&I({type:"submitForm",payload:{fields:t,dispatch:I,intl:S}});return}I({type:"submitForm",payload:{fields:t,dispatch:I,onSuccess:async v=>{try{await c(v),I({type:_?"formSubmittedAndReset":"formSubmitted"})}catch(H){m(H),I({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(v,H)=>{p(v,H),I({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:S}})}},X=[{...D,icon:E?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:v=>{var B;if(v.preventDefault(),v.stopPropagation(),w)return;let H=0;if((B=q==null?void 0:q.current)!=null&&B.id){const T=document.getElementById(q.current.id);T&&(H=T.getBoundingClientRect().top+window.scrollY)}const ee=document.getElementById("header");ee&&(H=H-ee.offsetHeight-x),H<0&&(H=0),window.scrollTo({top:H,behavior:"smooth"}),z()},disabled:w||E||s.disabled,"data-gtm-event-context":u.context,"data-gtm-event-type":u.event,children:w||E?S.formatMessage({id:`form_${w?"submitting":"submitted"}`}):s.text}];return A&&X.unshift({...o,className:"gtm-trackable","data-gtm-event-context":u.context,"data-gtm-event-type":u.event,disabled:w||E,onClick:h,children:o.text||S.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[C.createElement(e,{...g,id:r,className:Y("form",n),ref:q},d.jsxs(d.Fragment,{children:[M!=null&&M.general?d.jsx(an,{variant:"error",text:S.formatMessage({id:"form_error_generalError"})}):null,(!_||!w&&!E||f)&&t.map((v,H)=>{const{id:ee=v.name||H,component:B,functions:T={onChange:()=>{}},submitOnEnter:W=!1}=v;if(B)return d.jsx(B,{...v.props||{}},`component-${ee}-${H}`);const L=O?O[ee]:"",U={...T,onChange:te=>{I({type:"updateValue",payload:{key:ee,value:te}}),T.onChange(te&&te.toString(),I)}};return W&&(U.onKeyDown=te=>{te.key==="Enter"&&(te.stopPropagation(),te.preventDefault(),z()),T.onKeyDown&&T.onKeyDown(te)}),d.jsx(gm,{intlPath:i,...v,showRequiredLabels:k,value:L,error:M==null?void 0:M[ee],functions:U},ee)}),y?null:(w||E)&&f?f:d.jsx(kn,{className:Y("cta",{center:w||E,submitted:E}),buttons:X})]})),F&&E&&d.jsx(Er,{className:"success",children:typeof F=="string"?F:S.formatMessage({id:"form_success"})})]})};const qr="passwordRules_",Yc="isMoreThanEightCharacters",Gc="includesNumberAndSymbol",Qc="includesLowerAndUppercase",bm={[Yc]:"8Characters",[Gc]:"numberSymbol",[Qc]:"lowercaseUppercase"},ym=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ue.useIntl();return d.jsxs("aside",{className:Y("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${qr}intro`})}),d.jsx("ul",{children:[Yc,Gc,Qc].map(r=>d.jsxs("li",{className:Y({matches:e[r]}),children:[d.jsxs(Me,{children:[n.formatMessage({id:`${qr}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${qr}rule_${bm[r]}`})}),!e[r]&&d.jsxs(Me,{element:"strong",children:[" ",n.formatMessage({id:`${qr}notMet`})]})]},`rule-${r}`))})]})},Jc=C.memo(ym);const Dm=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ue.useIntl(),[l,u]=C.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const D=await n();u(x=>({...x,setUp:!0,id:D&&D.id,disabled:!1}))}catch(D){u(x=>({...x,setUp:!0,disabled:!0})),a(D)}};if(C.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(wt,{className:"rating-placeholder"});const{id:h,rating:m,disabled:p}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},y=async D=>{if(!(!h||p))try{u(x=>({...x,rating:D,disabled:!0})),await r({id:h,value:D})}catch(x){u(A=>({...A,rating:null})),a(x)}finally{u(x=>({...x,disabled:!1}))}};return d.jsxs("div",{className:Y("rating",i),children:[d.jsx("span",{className:"label",children:f[m?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(D=>{const x=D+1;return d.jsx("li",{className:Y({selected:m&&x<=m}),children:d.jsx(Be,{variant:"tertiary",size:"small",icon:{icon:`star${!m||x>m?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:x,total:t})}${x===1||x===t?` - ${f[x===1?"low":"high"]}`:""}`,onClick:A=>{A.preventDefault(),A.stopPropagation(),y(x)},disabled:p})},`rating-${x}`)})})]})};function Cm(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 ls(e,t){return Array(t+1).join(e)}function xm(e){return e.replace(/^\n*/,"")}function wm(e){for(var t=e.length;t>0&&e[t-1]===`
38
38
  `;)t--;return e.substring(0,t)}var Em=["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 Hs(e){return Us(e,Em)}var Xc=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function ed(e){return Us(e,Xc)}function km(e){return nd(e,Xc)}var td=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function _m(e){return Us(e,td)}function Bm(e){return nd(e,td)}function Us(e,t){return t.indexOf(e.nodeName)>=0}function nd(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var nt={};nt.paragraph={filter:"p",replacement:function(e){return`
39
39
 
40
40
  `+e+`
@@ -99,19 +99,19 @@ Thank you for helping to protect the Apolitical community from abusive content.`
99
99
  *
100
100
  * Copyright (c) 2014-2017, Jon Schlinkert.
101
101
  * Released under the MIT License.
102
- */function Yo(e){return Object.prototype.toString.call(e)==="[object Object]"}function et(e){var t,n;return Yo(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Yo(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var sd=Symbol.for("immer-nothing"),Go=Symbol.for("immer-draftable"),gt=Symbol.for("immer-state"),Vm=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 dt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Vm[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 Zn=Object.getPrototypeOf;function yn(e){return!!e&&!!e[gt]}function Dn(e){var t;return e?od(e)||Array.isArray(e)||!!e[Go]||!!((t=e.constructor)!=null&&t[Go])||Ha(e)||Ua(e):!1}var Km=Object.prototype.constructor.toString();function od(e){if(!e||typeof e!="object")return!1;const t=Zn(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)===Km}function Da(e,t){Wa(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Wa(e){const t=e[gt];return t?t.type_:Array.isArray(e)?1:Ha(e)?2:Ua(e)?3:0}function cs(e,t){return Wa(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ud(e,t,n){const r=Wa(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Zm(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ha(e){return e instanceof Map}function Ua(e){return e instanceof Set}function cn(e){return e.copy_||e.base_}function ds(e,t){if(Ha(e))return new Map(e);if(Ua(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&od(e))return Zn(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[gt];let r=Reflect.ownKeys(n);for(let a=0;a<r.length;a++){const i=r[a],s=n[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Zn(e),n)}function Ks(e,t=!1){return Va(e)||yn(e)||!Dn(e)||(Wa(e)>1&&(e.set=e.add=e.clear=e.delete=Ym),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ks(r,!0))),e}function Ym(){dt(2)}function Va(e){return Object.isFrozen(e)}var Gm={};function Cn(e){const t=Gm[e];return t||dt(0,e),t}var kr;function ld(){return kr}function Qm(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Qo(e,t){t&&(Cn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fs(e){hs(e),e.drafts_.forEach(Jm),e.drafts_=null}function hs(e){e===kr&&(kr=e.parent_)}function Jo(e){return kr=Qm(kr,e)}function Jm(e){const t=e[gt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Xo(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[gt].modified_&&(fs(t),dt(4)),Dn(e)&&(e=Ca(t,e),t.parent_||xa(t,e)),t.patches_&&Cn("Patches").generateReplacementPatches_(n[gt].base_,e,t.patches_,t.inversePatches_)):e=Ca(t,n,[]),fs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==sd?e:void 0}function Ca(e,t,n){if(Va(t))return t;const r=t[gt];if(!r)return Da(t,(a,i)=>eu(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return xa(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const a=r.copy_;let i=a,s=!1;r.type_===3&&(i=new Set(a),a.clear(),s=!0),Da(i,(o,l)=>eu(e,r,a,o,l,n,s)),xa(e,a,!1),n&&e.patches_&&Cn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function eu(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&dt(5),yn(a)){const o=i&&t&&t.type_!==3&&!cs(t.assigned_,r)?i.concat(r):void 0,l=Ca(e,a,o);if(ud(n,r,l),yn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Dn(a)&&!Va(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ca(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&xa(e,a)}}function xa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ks(t,n)}function Xm(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ld(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=Zs;n&&(a=[r],i=_r);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var Zs={get(e,t){if(t===gt)return e;const n=cn(e);if(!cs(n,t))return ep(e,n,t);const r=n[t];return e.finalized_||!Dn(r)?r:r===di(e.base_,t)?(fi(e),e.copy_[t]=ps(r,e)):r},has(e,t){return t in cn(e)},ownKeys(e){return Reflect.ownKeys(cn(e))},set(e,t,n){const r=cd(cn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=di(cn(e),t),i=a==null?void 0:a[gt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Zm(n,a)&&(n!==void 0||cs(e.base_,t)))return!0;fi(e),ms(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 di(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,fi(e),ms(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=cn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){dt(11)},getPrototypeOf(e){return Zn(e.base_)},setPrototypeOf(){dt(12)}},_r={};Da(Zs,(e,t)=>{_r[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});_r.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&dt(13),_r.set.call(this,e,t,void 0)};_r.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&dt(14),Zs.set.call(this,e[0],t,n,e[0])};function di(e,t){const n=e[gt];return(n?cn(n):e)[t]}function ep(e,t,n){var a;const r=cd(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function cd(e,t){if(!(t in e))return;let n=Zn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Zn(n)}}function ms(e){e.modified_||(e.modified_=!0,e.parent_&&ms(e.parent_))}function fi(e){e.copy_||(e.copy_=ds(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var tp=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,c=>n.call(this,c,...u))}}typeof n!="function"&&dt(6),r!==void 0&&typeof r!="function"&&dt(7);let a;if(Dn(t)){const i=Jo(this),s=ps(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?fs(i):hs(i)}return Qo(i,r),Xo(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===sd&&(a=void 0),this.autoFreeze_&&Ks(a,!0),r){const i=[],s=[];Cn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else dt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,l=>t(l,...o));let r,a;return[this.produce(t,n,(s,o)=>{r=s,a=o}),r,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Dn(e)||dt(8),yn(e)&&(e=np(e));const t=Jo(this),n=ps(e,void 0);return n[gt].isManual_=!0,hs(t),n}finishDraft(e,t){const n=e&&e[gt];(!n||!n.isManual_)&&dt(9);const{scope_:r}=n;return Qo(r,t),Xo(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const a=t[n];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}n>-1&&(t=t.slice(n+1));const r=Cn("Patches").applyPatches_;return yn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function ps(e,t){const n=Ha(e)?Cn("MapSet").proxyMap_(e,t):Ua(e)?Cn("MapSet").proxySet_(e,t):Xm(e,t);return(t?t.scope_:ld()).drafts_.push(n),n}function np(e){return yn(e)||dt(10,e),dd(e)}function dd(e){if(!Dn(e)||Va(e))return e;const t=e[gt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ds(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ds(e,!0);return Da(n,(r,a)=>{ud(n,r,dd(a))}),t&&(t.finalized_=!1),n}var vt=new tp,Ys=vt.produce;vt.produceWithPatches.bind(vt);vt.setAutoFreeze.bind(vt);vt.setUseStrictShallowCopy.bind(vt);vt.applyPatches.bind(vt);var tu=vt.createDraft.bind(vt),nu=vt.finishDraft.bind(vt),rp={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=N.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},ap={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Ee.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},ip={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=V.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},wa=new WeakMap,Ea=new WeakMap,gr=new WeakMap,fd=new WeakMap,ru=new WeakMap,au=new WeakMap,iu=new WeakMap,N={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=N.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var a=e[r],i=t[r];if(a!==i)break;n.push(a)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return N.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return N.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return N.equals(r,a)&&i<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return N.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&N.compare(e,t)===0},isBefore(e,t){return N.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&N.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&N.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&N.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&N.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),a=e[e.length-1],i=t[t.length-1];return a!==i&&N.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!N.isAncestor(t,e)&&!N.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(N.equals(i,r)||N.endsBefore(i,r)||N.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(N.equals(s,r)||N.isAncestor(s,r))return null;N.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;N.equals(o,r)||N.endsBefore(o,r)?r[o.length-1]-=1:N.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:c}=t;if(N.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else N.endsBefore(u,r)?r[u.length-1]+=1:N.isAncestor(u,r)&&e[u.length]>=c&&(r[u.length-1]+=1,r[u.length]-=c);break}case"move_node":{var{path:h,newPath:m}=t;if(N.equals(h,m))return r;if(N.isAncestor(h,r)||N.equals(h,r)){var p=m.slice();return N.endsBefore(h,m)&&h.length<m.length&&(p[h.length-1]-=1),p.concat(r.slice(h.length))}else N.isSibling(h,m)&&(N.isAncestor(m,r)||N.equals(m,r))?N.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:N.endsBefore(m,r)||N.equals(m,r)||N.isAncestor(m,r)?(N.endsBefore(h,r)&&(r[h.length-1]-=1),r[m.length-1]+=1):N.endsBefore(h,r)&&(N.equals(m,r)&&(r[m.length-1]+=1),r[h.length-1]-=1);break}}return r}};function Br(e){"@babel/helpers - typeof";return Br=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},Br(e)}function sp(e,t){if(Br(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Br(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function op(e){var t=sp(e,"string");return Br(t)==="symbol"?t:String(t)}function ut(e,t,n){return t=op(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function su(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ur(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?su(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):su(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var up=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=oe.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of V.points(t))t[l]=Ee.transform(o,n);break}case"insert_text":{var{path:u,offset:c,text:h}=n;if(h.length===0)break;var m=oe.leaf(e,u),p=m.text.slice(0,c),g=m.text.slice(c);if(m.text=p+h+g,t)for(var[f,D]of V.points(t))t[D]=Ee.transform(f,n);break}case"merge_node":{var{path:y}=n,w=oe.get(e,y),A=N.previous(y),_=oe.get(e,A),k=oe.parent(e,y),F=y[y.length-1];if(de.isText(w)&&de.isText(_))_.text+=w.text;else if(!de.isText(w)&&!de.isText(_))_.children.push(...w.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(y,"] to nodes of different interfaces: ").concat(Je.stringify(w)," ").concat(Je.stringify(_)));if(k.children.splice(F,1),t)for(var[S,$]of V.points(t))t[$]=Ee.transform(S,n);break}case"move_node":{var{path:R,newPath:I}=n;if(N.isAncestor(R,I))throw new Error("Cannot move a path [".concat(R,"] to new path [").concat(I,"] because the destination is inside itself."));var M=oe.get(e,R),x=oe.parent(e,R),E=R[R.length-1];x.children.splice(E,1);var O=N.transform(R,n),j=oe.get(e,N.parent(O)),q=O[O.length-1];if(j.children.splice(q,0,M),t)for(var[z,re]of V.points(t))t[re]=Ee.transform(z,n);break}case"remove_node":{var{path:X}=n,v=X[X.length-1],H=oe.parent(e,X);if(H.children.splice(v,1),t)for(var[ee,B]of V.points(t)){var T=Ee.transform(ee,n);if(t!=null&&T!=null)t[B]=T;else{var W=void 0,L=void 0;for(var[U,te]of oe.texts(e))if(N.compare(te,X)===-1)W=[U,te];else{L=[U,te];break}var ne=!1;W&&L&&(N.equals(L[1],X)?ne=!N.hasPrevious(L[1]):ne=N.common(W[1],X).length<N.common(L[1],X).length),W&&!ne?(ee.path=W[1],ee.offset=W[0].text.length):L?(ee.path=L[1],ee.offset=0):t=null}}break}case"remove_text":{var{path:ie,offset:fe,text:Q}=n;if(Q.length===0)break;var pe=oe.leaf(e,ie),ge=pe.text.slice(0,fe),ke=pe.text.slice(fe+Q.length);if(pe.text=ge+ke,t)for(var[xe,_e]of V.points(t))t[_e]=Ee.transform(xe,n);break}case"set_node":{var{path:We,properties:Le,newProperties:Ue}=n;if(We.length===0)throw new Error("Cannot set properties on the root node!");var Qe=oe.get(e,We);for(var he in Ue){if(he==="children"||he==="text")throw new Error('Cannot set the "'.concat(he,'" property of nodes!'));var Te=Ue[he];Te==null?delete Qe[he]:Qe[he]=Te}for(var $e in Le)Ue.hasOwnProperty($e)||delete Qe[$e];break}case"set_selection":{var{newProperties:K}=n;if(K==null)t=K;else{if(t==null){if(!V.isRange(K))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Je.stringify(K)," when there is no current selection."));t=ur({},K)}for(var se in K){var me=K[se];if(me==null){if(se==="anchor"||se==="focus")throw new Error('Cannot remove the "'.concat(se,'" selection property'));delete t[se]}else t[se]=me}}break}case"split_node":{var{path:ve,position:we,properties:Ye}=n;if(ve.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ve,"] because the root node cannot be split."));var Ge=oe.get(e,ve),mt=oe.parent(e,ve),It=ve[ve.length-1],Et;if(de.isText(Ge)){var Xe=Ge.text.slice(0,we),At=Ge.text.slice(we);Ge.text=Xe,Et=ur(ur({},Ye),{},{text:At})}else{var pt=Ge.children.slice(0,we),ti=Ge.children.slice(we);Ge.children=pt,Et=ur(ur({},Ye),{},{children:ti})}if(mt.children.splice(It+1,0,Et),t)for(var[ir,Ir]of V.points(t))t[Ir]=Ee.transform(ir,n);break}}return t},lp={transform(e,t){e.children=tu(e.children);var n=e.selection&&tu(e.selection);try{n=up(e,n,t)}finally{e.children=nu(e.children),n?e.selection=yn(n)?nu(n):n:e.selection=null}}},cp={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)}},dp={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)}},hd=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(et(r)&&et(a)){if(!hd(r,a))return!1}else if(Array.isArray(r)&&Array.isArray(a)){if(r.length!==a.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==a[i])return!1}else if(r!==a)return!1}for(var s in t)if(e[s]===void 0&&t[s]!==void 0)return!1;return!0};function fp(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Ut(e,t){if(e==null)return{};var n=fp(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var hp=["anchor","focus"];function ou(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function mp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ou(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ou(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var V={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return V.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=V.edges(e);return t},equals(e,t){return Ee.equals(e.anchor,t.anchor)&&Ee.equals(e.focus,t.focus)},includes(e,t){if(V.isRange(t)){if(V.includes(e,t.anchor)||V.includes(e,t.focus))return!0;var[n,r]=V.edges(e),[a,i]=V.edges(t);return Ee.isBefore(n,a)&&Ee.isAfter(r,i)}var[s,o]=V.edges(e),l=!1,u=!1;return Ee.isPoint(t)?(l=Ee.compare(t,s)>=0,u=Ee.compare(t,o)<=0):(l=N.compare(t,s.path)>=0,u=N.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=Ut(e,hp),[r,a]=V.edges(e),[i,s]=V.edges(t),o=Ee.isBefore(r,i)?i:r,l=Ee.isBefore(a,s)?a:s;return Ee.isBefore(l,o)?null:mp({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return Ee.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Ee.equals(t,n)},isExpanded(e){return!V.isCollapsed(e)},isForward(e){return!V.isBackward(e)},isRange(e){return et(e)&&Ee.isPoint(e.anchor)&&Ee.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=V.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ys(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=V.isCollapsed(r);V.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?V.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=Ee.transform(r.anchor,t,{affinity:i}),u=Ee.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},uu=e=>et(e)&&oe.isNodeList(e.children)&&!b.isEditor(e),ce={isAncestor(e){return et(e)&&oe.isNodeList(e.children)},isElement:uu,isElementList(e){return Array.isArray(e)&&e.every(t=>ce.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 uu(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},pp=["children"],gp=["text"],lu=new WeakMap,oe={ancestor(e,t){var n=oe.get(e,t);if(de.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(Je.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of N.ancestors(t,n)){var a=oe.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(de.isText(e))throw new Error("Cannot get the child of a text node: ".concat(Je.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Je.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=oe.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=oe.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=N.common(t,n),a=oe.get(e,r);return[a,r]},descendant(e,t){var n=oe.get(e,t);if(b.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Je.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of oe.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 oe.nodes(e,t))ce.isElement(n)&&(yield[n,r])}()},extractProps(e){if(ce.isAncestor(e)){var t=Ut(e,pp);return t}else{var t=Ut(e,gp);return t}},first(e,t){for(var n=t.slice(),r=oe.get(e,n);r&&!(de.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(de.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(Je.stringify(e)));var n=Ys({children:e.children},r=>{var[a,i]=V.edges(t),s=oe.nodes(r,{reverse:!0,pass:m=>{var[,p]=m;return!V.includes(t,p)}});for(var[,o]of s){if(!V.includes(t,o)){var l=oe.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(N.equals(o,i.path)){var c=oe.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(N.equals(o,a.path)){var h=oe.leaf(r,o);h.text=h.text.slice(a.offset)}}b.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(de.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Je.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(de.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return de.isText(e)||ce.isElement(e)||b.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=lu.get(e);if(t!==void 0)return t;var n=e.every(r=>oe.isNode(r));return lu.set(e,n),n},last(e,t){for(var n=t.slice(),r=oe.get(e,n);r&&!(de.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=oe.get(e,t);if(!de.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(Je.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of N.levels(t,n)){var a=oe.get(e,r);yield[a,r]}}()},matches(e,t){return ce.isElement(e)&&ce.isElementProps(t)&&ce.matches(e,t)||de.isText(e)&&de.isTextProps(t)&&de.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?N.isBefore(o,i):N.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!de.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;N.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=oe.get(e,o);continue}if(o.length===0)break;if(!r){var c=N.next(o);if(oe.has(e,c)){o=c,l=oe.get(e,o);continue}}if(r&&o[o.length-1]!==0){var h=N.previous(o);o=h,l=oe.get(e,o);continue}o=N.parent(o),l=oe.get(e,o),s.add(l)}}()},parent(e,t){var n=N.parent(t),r=oe.get(e,n);if(de.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 de.isText(e)?e.text:e.children.map(oe.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of oe.nodes(e,t))de.isText(n)&&(yield[n,r])}()}};function cu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ze(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Xt={isNodeOperation(e){return Xt.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!et(e))return!1;switch(e.type){case"insert_node":return N.isPath(e.path)&&oe.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&N.isPath(e.path);case"merge_node":return typeof e.position=="number"&&N.isPath(e.path)&&et(e.properties);case"move_node":return N.isPath(e.path)&&N.isPath(e.newPath);case"remove_node":return N.isPath(e.path)&&oe.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&N.isPath(e.path);case"set_node":return N.isPath(e.path)&&et(e.properties)&&et(e.newProperties);case"set_selection":return e.properties===null&&V.isRange(e.newProperties)||e.newProperties===null&&V.isRange(e.properties)||et(e.properties)&&et(e.newProperties);case"split_node":return N.isPath(e.path)&&typeof e.position=="number"&&et(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>Xt.isOperation(t))},isSelectionOperation(e){return Xt.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return Xt.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:N.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(N.equals(t,n))return e;if(N.isSibling(n,t))return ze(ze({},e),{},{path:t,newPath:n});var r=N.transform(n,e),a=N.transform(N.next(n),e);return ze(ze({},e),{},{path:r,newPath:a})}case"remove_node":return ze(ze({},e),{},{type:"insert_node"});case"remove_text":return ze(ze({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return ze(ze({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?ze(ze({},e),{},{properties:l,newProperties:null}):l==null?ze(ze({},e),{},{properties:null,newProperties:o}):ze(ze({},e),{},{properties:l,newProperties:o})}case"split_node":return ze(ze({},e),{},{type:"merge_node",path:N.next(e.path)})}}},du=new WeakMap,vp=e=>{var t=du.get(e);if(t!==void 0)return t;if(!et(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||et(e.marks))&&(e.selection===null||V.isRange(e.selection))&&oe.isNodeList(e.children)&&Xt.isOperationList(e.operations);return du.set(e,n),n},b={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 vp(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)}},bp={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(N.isPath)}};function fu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function hu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ee={compare(e,t){var n=N.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return Ee.compare(e,t)===1},isBefore(e,t){return Ee.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&N.equals(e.path,t.path)},isPoint(e){return et(e)&&typeof e.offset=="number"&&N.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ys(e,r=>{if(r===null)return null;var{affinity:a="forward"}=n,{path:i,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=N.transform(i,t,n);break}case"insert_text":{N.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{N.equals(t.path,i)&&(r.offset+=t.position),r.path=N.transform(i,t,n);break}case"remove_text":{N.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(N.equals(t.path,i)||N.isAncestor(t.path,i))return null;r.path=N.transform(i,t,n);break}case"split_node":{if(N.equals(t.path,i)){if(t.position===s&&a==null)return null;(t.position<s||t.position===s&&a==="forward")&&(r.offset-=t.position,r.path=N.transform(i,t,hu(hu({},n),{},{affinity:"forward"})))}else r.path=N.transform(i,t,n);break}}})}},mu=void 0,Je={setScrubber(e){mu=e},stringify(e){return JSON.stringify(e,mu)}},yp=["text"],Dp=["anchor","focus"];function pu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Lt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var de={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Ut(i,yp);return s}return hd(r?a(e):e,r?a(t):t)},isText(e){return et(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>de.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=[Lt({},e)];for(var r of t){var a=Ut(r,Dp),[i,s]=V.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var h of n){var{length:m}=h.text,p=l;if(l+=m,u<=p&&l<=c){Object.assign(h,a),o.push(h);continue}if(u!==c&&(u===l||c===p)||u>l||c<p||c===p&&p!==0){o.push(h);continue}var g=h,f=void 0,D=void 0;if(c<l){var y=c-p;D=Lt(Lt({},g),{},{text:g.text.slice(y)}),g=Lt(Lt({},g),{},{text:g.text.slice(0,y)})}if(u>p){var w=u-p;f=Lt(Lt({},g),{},{text:g.text.slice(0,w)}),g=Lt(Lt({},g),{},{text:g.text.slice(w)})}Object.assign(g,a),f&&o.push(f),o.push(g),D&&o.push(D)}n=o}return n}},Gs=e=>e.selection?e.selection:e.children.length>0?b.end(e,[]):[0],ar=(e,t)=>{var[n]=b.node(e,t);return r=>r===n},Qs=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?_p(t):t,i=Ce.None,s=Ce.None,o=0,l=null,u=null;for(var c of a){var h=c.codePointAt(0);if(!h)break;var m=Ip(c,h);if([i,s]=r?[s,m]:[m,i],In(i,Ce.ZWJ)&&In(s,Ce.ExtPict)&&(r?l=gu(t.substring(0,o)):l=gu(t.substring(0,t.length-o)),!l)||In(i,Ce.RI)&&In(s,Ce.RI)&&(u!==null?u=!u:r?u=!0:u=Wp(t.substring(0,t.length-o)),!u)||i!==Ce.None&&s!==Ce.None&&Lp(i,s))break;o+=c.length}return o||1},Cp=/\s/,xp=/[\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]/,wp=/['\u2018\u2019]/,Ep=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=Qs(t,n),[s,o]=Js(t,i,n);if(kp(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Js=(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)]},kp=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(Cp.test(t))return!1;if(wp.test(t)){var a=Qs(n,r),[i,s]=Js(n,a,r);if(e(i,s,r))return!0}return!xp.test(t)},_p=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(Ap(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(Bp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},Bp=e=>e>=55296&&e<=56319,Ap=e=>e>=56320&&e<=57343,Ce;(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"})(Ce||(Ce={}));var Fp=/^(?:[\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])$/,Tp=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,Sp=/^(?:[\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])$/,jp=/^[\u1100-\u115F\uA960-\uA97C]$/,Op=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,Pp=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,Np=/^[\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]$/,Rp=/^[\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]$/,Mp=/^(?:[\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])$/,Ip=(e,t)=>{var n=Ce.Any;return e.search(Fp)!==-1&&(n|=Ce.Extend),t===8205&&(n|=Ce.ZWJ),t>=127462&&t<=127487&&(n|=Ce.RI),e.search(Tp)!==-1&&(n|=Ce.Prepend),e.search(Sp)!==-1&&(n|=Ce.SpacingMark),e.search(jp)!==-1&&(n|=Ce.L),e.search(Op)!==-1&&(n|=Ce.V),e.search(Pp)!==-1&&(n|=Ce.T),e.search(Np)!==-1&&(n|=Ce.LV),e.search(Rp)!==-1&&(n|=Ce.LVT),e.search(Mp)!==-1&&(n|=Ce.ExtPict),n};function In(e,t){return(e&t)!==0}var $p=[[Ce.L,Ce.L|Ce.V|Ce.LV|Ce.LVT],[Ce.LV|Ce.V,Ce.V|Ce.T],[Ce.LVT|Ce.T,Ce.T],[Ce.Any,Ce.Extend|Ce.ZWJ],[Ce.Any,Ce.SpacingMark],[Ce.Prepend,Ce.Any],[Ce.ZWJ,Ce.ExtPict],[Ce.RI,Ce.RI]];function Lp(e,t){return $p.findIndex(n=>In(e,n[0])&&In(t,n[1]))===-1}var zp=/(?:[\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$/,gu=e=>e.search(zp)!==-1,qp=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Wp=e=>{var t=e.match(qp);if(t===null)return!1;var n=t[0].length/2;return n%2===1},Hp={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]:{};b.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=Gs(e)}=n;if(N.isPath(a)&&(a=b.range(e,a)),V.isRange(a))if(V.isCollapsed(a))a=a.anchor;else{var i=V.end(a);if(!r&&b.void(e,{at:i}))return;var s=V.start(a),o=b.pointRef(e,s),l=b.pointRef(e,i);G.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,G.setSelection(e,{anchor:a,focus:a})}if(!(!r&&b.void(e,{at:a})||b.elementReadOnly(e,{at:a}))){var{path:h,offset:m}=a;t.length>0&&e.apply({type:"insert_text",path:h,offset:m,text:t})}})}};function vu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Wr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var G=Wr(Wr(Wr(Wr({},lp),cp),dp),Hp),ua=new WeakMap,Up=e=>ua.get(e)||!1,Vp=(e,t,n)=>{var r=ua.get(e)||!1;ua.set(e,!0);try{t(),n()}finally{ua.set(e,r)}};function md(e,t,n){var r=wa.get(e)||[],a=Ea.get(e)||new Set,i,s,o=h=>{if(h){var m=h.join(",");s.has(m)||(s.add(m),i.push(h))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var c of t)o(c);wa.set(e,i),Ea.set(e,s)}var Kp=(e,t)=>{for(var n of b.pathRefs(e))rp.transform(n,t);for(var r of b.pointRefs(e))ap.transform(r,t);for(var a of b.rangeRefs(e))ip.transform(a,t);if(!Up(e)){var i=N.operationCanTransformPath(t)?s=>N.transform(s,t):void 0;md(e,e.getDirtyPaths(t),i)}G.transform(e,t),e.operations.push(t),b.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),gr.get(e)||(gr.set(e,!0),Promise.resolve().then(()=>{gr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Zp=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return N.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=N.levels(a),s=de.isText(r)?[]:Array.from(oe.nodes(r),I=>{var[,M]=I;return a.concat(M)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=N.ancestors(o),u=N.previous(o);return[...l,u]}case"move_node":{var{path:c,newPath:h}=t;if(N.equals(c,h))return[];var m=[],p=[];for(var g of N.ancestors(c)){var f=N.transform(g,t);m.push(f)}for(var D of N.ancestors(h)){var y=N.transform(D,t);p.push(y)}var w=p[p.length-1],A=h[h.length-1],_=w.concat(A);return[...m,...p,_]}case"remove_node":{var{path:k}=t,F=N.ancestors(k);return[...F]}case"split_node":{var{path:S}=t,$=N.levels(S),R=N.next(S);return[...$,R]}default:return[]}},Yp=e=>{var{selection:t}=e;return t?oe.fragment(e,t):[]},Gp=(e,t)=>{var[n,r]=t;if(!de.isText(n)){if(ce.isElement(n)&&n.children.length===0){var a={text:""};G.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=b.isEditor(n)?!1:ce.isElement(n)&&(e.isInline(n)||n.children.length===0||de.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=oe.get(e,r);if(!de.isText(l)){var u=l.children[s],c=l.children[s-1],h=o===n.children.length-1,m=de.isText(u)||ce.isElement(u)&&e.isInline(u);if(m!==i)G.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(ce.isElement(u)){if(e.isInline(u)){if(c==null||!de.isText(c)){var p={text:""};G.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(h){var g={text:""};G.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&de.isText(c)&&(de.equals(u,c,{loose:!0})?(G.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(G.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(G.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Qp=(e,t)=>{var{iteration:n,initialDirtyPathsLength:r}=t,a=r*42;if(n>a)throw new Error("Could not completely normalize the editor after ".concat(a," iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state."));return!0},Jp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:s}=n;if(i){var o=b.path(t,i),l=a==="lowest";for(var[u,c]of b.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!de.isText(u)){if(V.isRange(i)){if(N.isAncestor(c,i.anchor.path)&&N.isAncestor(c,i.focus.path))return[u,c]}else if(!N.equals(o,c))return[u,c]}}};function bu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function yu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Xp=(e,t,n)=>{var{selection:r}=e;if(r){var a=(h,m)=>{if(!de.isText(h))return!1;var[p,g]=b.parent(e,m);return!e.isVoid(p)||e.markableVoid(p)},i=V.isExpanded(r),s=!1;if(!i){var[o,l]=b.node(e,r);if(o&&a(o,l)){var[u]=b.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)G.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=yu(yu({},b.marks(e)||{}),{},{[t]:n});e.marks=c,gr.get(e)||e.onChange()}}};function Du(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Cu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Du(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Du(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var eg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.point(t,n,{edge:"end"}),i=b.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of b.positions(t,Cu(Cu({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};function xu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function wu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var tg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.start(t,[]),i=b.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of b.positions(t,wu(wu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},ng=(e,t)=>{var{selection:n}=e;n&&V.isCollapsed(n)&&G.delete(e,{unit:t,reverse:!0})},rg=(e,t)=>{var{selection:n}=e;n&&V.isCollapsed(n)&&G.delete(e,{unit:t})},ag=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&V.isExpanded(r)&&G.delete(t,{reverse:n==="backward"})},ig=(e,t)=>[b.start(e,t),b.end(e,t)];function Eu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ku(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Eu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Eu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var sg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,ku(ku({},n),{},{match:r=>ce.isElement(r)&&b.isElementReadOnly(t,r)}))},og=(e,t)=>b.point(e,t,{edge:"end"}),ug=(e,t)=>{var n=b.path(e,t,{edge:"start"});return b.node(e,n)},lg=(e,t)=>{var n=b.range(e,t);return oe.fragment(e,n)};function _u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Bu(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){ut(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}var cg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,Bu(Bu({},n),{},{match:r=>ce.isElement(r)&&b.isVoid(t,r)}))},dg=(e,t)=>t.children.some(n=>ce.isElement(n)&&b.isBlock(e,n)),fg=(e,t)=>t.children.some(n=>de.isText(n)||b.isInline(e,n)),hg=(e,t)=>oe.has(e,t),mg=(e,t)=>t.children.every(n=>de.isText(n)),pg=e=>{G.splitNodes(e,{always:!0})},gg=(e,t,n)=>{G.insertNodes(e,t,n)},vg=e=>{G.splitNodes(e,{always:!0})};function Au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function bg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Au(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Au(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var yg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a,marks:i}=t;if(a){if(i){var s=bg({text:n},i);G.insertNodes(t,s,{at:r.at,voids:r.voids})}else G.insertText(t,n,r);t.marks=null}},Dg=(e,t)=>!e.isInline(t),Cg=(e,t,n)=>b.isStart(e,t,n)||b.isEnd(e,t,n),xg=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&de.isText(r)&&r.text===""&&!e.isVoid(t)},wg=(e,t,n)=>{var r=b.end(e,n);return Ee.equals(t,r)},Eg=e=>{var t=fd.get(e);return t===void 0?!0:t},kg=(e,t,n)=>{if(t.offset!==0)return!1;var r=b.start(e,n);return Ee.equals(t,r)},_g=(e,t)=>{var n=b.path(e,t,{edge:"end"});return b.node(e,n)},Bg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=oe.leaf(t,a);return[i,a]};function Ag(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var s=[],o=b.path(e,n);for(var[l,u]of oe.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&ce.isElement(l)&&b.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var Fg=["text"],Tg=["text"],Sg=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(V.isExpanded(r)){var s=b.isEnd(t,a,a.path);if(s){var o=b.after(t,a);o&&(a=o)}var[l]=b.nodes(t,{match:de.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=Ut(u,Fg);return c}else return{}}var{path:h}=a,[m]=b.leaf(t,h);if(a.offset===0){var p=b.previous(t,{at:h,match:de.isText}),g=b.above(t,{match:_=>ce.isElement(_)&&b.isVoid(t,_)&&t.markableVoid(_)});if(!g){var f=b.above(t,{match:_=>ce.isElement(_)&&b.isBlock(t,_)});if(p&&f){var[D,y]=p,[,w]=f;N.isAncestor(w,y)&&(m=D)}}}var A=Ut(m,Tg);return A},jg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=b.after(t,s,{voids:a});if(o){var[,l]=b.last(t,[]),u=[o.path,l];if(N.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(N.isPath(s)){var[c]=b.parent(t,s);i=m=>c.children.includes(m)}else i=()=>!0;var[h]=b.nodes(t,{at:u,match:i,mode:r,voids:a});return h}}},Og=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=oe.get(t,a);return[i,a]};function Pg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,c;if(bp.isSpan(n))u=n[0],c=n[1];else{var h=b.path(e,n,{edge:"start"}),m=b.path(e,n,{edge:"end"});u=i?m:h,c=i?h:m}var p=oe.nodes(e,{reverse:i,from:u,to:c,pass:_=>{var[k]=_;return ce.isElement(k)?!!(!s&&(b.isVoid(e,k)||b.isElementReadOnly(e,k))||o&&!b.isSelectable(e,k)):!1}}),g=[],f;for(var[D,y]of p)if(!(o&&ce.isElement(D)&&!b.isSelectable(e,D))){var w=f&&N.compare(y,f[1])===0;if(!(r==="highest"&&w)){if(!l(D,y)){if(a&&!w&&de.isText(D))return;continue}if(r==="lowest"&&w){f=[D,y];continue}var A=r==="lowest"?f:[D,y];A&&(a?g.push(A):yield A),f=[D,y]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var Ng=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>wa.get(c)||[],s=c=>Ea.get(c)||new Set,o=c=>{var h=i(c).pop(),m=h.join(",");return s(c).delete(m),h};if(b.isNormalizing(t)){if(r){var l=Array.from(oe.nodes(t),c=>{var[,h]=c;return h}),u=new Set(l.map(c=>c.join(",")));wa.set(t,l),Ea.set(t,u)}i(t).length!==0&&b.withoutNormalizing(t,()=>{for(var c of i(t))if(oe.has(t,c)){var h=b.node(t,c),[m,p]=h;ce.isElement(m)&&m.children.length===0&&t.normalizeNode(h,{operation:a})}for(var g=i(t),f=g.length,D=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:D,initialDirtyPathsLength:f,operation:a}))return;var y=o(t);if(oe.has(t,y)){var w=b.node(t,y);t.normalizeNode(w,{operation:a})}D++,g=i(t)}})}},Rg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=N.parent(a),s=b.node(t,i);return s},Mg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.pathRefs(t);return l.delete(i),i.current=null,o}},s=b.pathRefs(t);return s.add(i),i},Ig=e=>{var t=ru.get(e);return t||(t=new Set,ru.set(e,t)),t},$g=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(N.isPath(n)){if(i==="start"){var[,s]=oe.first(t,n);n=s}else if(i==="end"){var[,o]=oe.last(t,n);n=o}}return V.isRange(n)&&(i==="start"?n=V.start(n):i==="end"?n=V.end(n):n=N.common(n.anchor.path,n.focus.path)),Ee.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},Lg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.pointRefs(t);return l.delete(i),i.current=null,o}},s=b.pointRefs(t);return s.add(i),i},zg=e=>{var t=au.get(e);return t||(t=new Set,au.set(e,t)),t},qg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(N.isPath(n)){var i;if(a==="end"){var[,s]=oe.last(t,n);i=s}else{var[,o]=oe.first(t,n);i=o}var l=oe.get(t,i);if(!de.isText(l))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?l.text.length:0}}if(V.isRange(n)){var[u,c]=V.edges(n);return a==="start"?u:c}return n};function Wg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:a=!1,voids:i=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=b.range(e,n),[l,u]=V.edges(o),c=a?u:l,h=!1,m="",p=0,g=0,f=0;for(var[D,y]of b.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(ce.isElement(D)){if(!i&&(e.isVoid(D)||e.isElementReadOnly(D))){yield b.start(e,y);continue}if(e.isInline(D))continue;if(b.hasInlines(e,D)){var w=N.isAncestor(y,u.path)?u:b.end(e,y),A=N.isAncestor(y,l.path)?l:b.start(e,y);m=b.string(e,{anchor:A,focus:w},{voids:i}),h=!0}}if(de.isText(D)){var _=N.equals(y,c.path);for(_?(g=a?c.offset:D.text.length-c.offset,f=c.offset):(g=D.text.length,f=a?g:0),(_||h||r==="offset")&&(yield{path:y,offset:f},h=!1);;){if(p===0){if(m==="")break;p=k(m,r,a),m=Js(m,p,a)[1]}if(f=a?f-p:f+p,g=g-p,g<0){p=-g;break}p=0,yield{path:y,offset:f}}}}function k(F,S,$){return S==="character"?Qs(F,$):S==="word"?Ep(F,$):S==="line"||S==="block"?F.length:1}}()}var Hg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=b.before(t,s,{voids:a});if(o){var[,l]=b.first(t,[]),u=[o.path,l];if(N.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(N.isPath(s)){var[c]=b.parent(t,s);i=m=>c.children.includes(m)}else i=()=>!0;var[h]=b.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return h}}},Ug=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.rangeRefs(t);return l.delete(i),i.current=null,o}},s=b.rangeRefs(t);return s.add(i),i},Vg=e=>{var t=iu.get(e);return t||(t=new Set,iu.set(e,t)),t},Kg=(e,t,n)=>{if(V.isRange(t)&&!n)return t;var r=b.start(e,t),a=b.end(e,n||t);return{anchor:r,focus:a}};function Fu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Zg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Fu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Yg=(e,t)=>{var{selection:n}=e;if(n){var r=(c,h)=>{if(!de.isText(c))return!1;var[m,p]=b.parent(e,h);return!e.isVoid(m)||e.markableVoid(m)},a=V.isExpanded(n),i=!1;if(!a){var[s,o]=b.node(e,n);if(s&&r(s,o)){var[l]=b.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)G.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Zg({},b.marks(e)||{});delete u[t],e.marks=u,gr.get(e)||e.onChange()}}},Gg=(e,t)=>{fd.set(e,t)},Qg=(e,t)=>b.point(e,t,{edge:"start"}),Jg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=b.range(t,n),[s,o]=V.edges(i),l="";for(var[u,c]of b.nodes(t,{at:i,match:de.isText,voids:a})){var h=u.text;N.equals(c,o.path)&&(h=h.slice(0,o.offset)),N.equals(c,s.path)&&(h=h.slice(s.offset)),l+=h}return l},Xg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=V.edges(n);if(i.offset!==0||s.offset!==0||V.isCollapsed(n)||N.hasPrevious(s.path))return n;var o=b.above(t,{at:s,match:g=>ce.isElement(g)&&b.isBlock(t,g),voids:a}),l=o?o[1]:[],u=b.start(t,i),c={anchor:u,focus:s},h=!0;for(var[m,p]of b.nodes(t,{at:c,match:de.isText,reverse:!0,voids:a})){if(h){h=!1;continue}if(m.text!==""||N.isBefore(p,l)){s={path:p,offset:m.text.length};break}}return{anchor:i,focus:s}},ev=(e,t)=>{var n=b.isNormalizing(e);b.setNormalizing(e,!1);try{t()}finally{b.setNormalizing(e,n)}b.normalize(e)},tv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:c=!1}=n;if(u){var h=!1;if(V.isRange(u)&&V.isCollapsed(u)&&(h=!0,u=u.anchor),Ee.isPoint(u)){var m=b.void(t,{at:u,mode:"highest"});if(!l&&m){var[,p]=m;u=p}else{var g={unit:s,distance:o},f=i?b.before(t,u,g)||b.start(t,[]):b.after(t,u,g)||b.end(t,[]);u={anchor:u,focus:f},c=!0}}if(N.isPath(u)){G.removeNodes(t,{at:u,voids:l});return}if(!V.isCollapsed(u)){if(!c){var[,D]=V.edges(u),y=b.end(t,[]);Ee.equals(D,y)||(u=b.unhangRange(t,u,{voids:l}))}var[w,A]=V.edges(u),_=b.above(t,{match:ge=>ce.isElement(ge)&&b.isBlock(t,ge),at:w,voids:l}),k=b.above(t,{match:ge=>ce.isElement(ge)&&b.isBlock(t,ge),at:A,voids:l}),F=_&&k&&!N.equals(_[1],k[1]),S=N.equals(w.path,A.path),$=l?null:(r=b.void(t,{at:w,mode:"highest"}))!==null&&r!==void 0?r:b.elementReadOnly(t,{at:w,mode:"highest"}),R=l?null:(a=b.void(t,{at:A,mode:"highest"}))!==null&&a!==void 0?a:b.elementReadOnly(t,{at:A,mode:"highest"});if($){var I=b.before(t,w);I&&_&&N.isAncestor(_[1],I.path)&&(w=I)}if(R){var M=b.after(t,A);M&&k&&N.isAncestor(k[1],M.path)&&(A=M)}var x=[],E;for(var O of b.nodes(t,{at:u,voids:l})){var[j,q]=O;E&&N.compare(q,E)===0||(!l&&ce.isElement(j)&&(b.isVoid(t,j)||b.isElementReadOnly(t,j))||!N.isCommon(q,w.path)&&!N.isCommon(q,A.path))&&(x.push(O),E=q)}var z=Array.from(x,ge=>{var[,ke]=ge;return b.pathRef(t,ke)}),re=b.pointRef(t,w),X=b.pointRef(t,A),v="";if(!S&&!$){var H=re.current,[ee]=b.leaf(t,H),{path:B}=H,{offset:T}=w,W=ee.text.slice(T);W.length>0&&(t.apply({type:"remove_text",path:B,offset:T,text:W}),v=W)}if(z.reverse().map(ge=>ge.unref()).filter(ge=>ge!==null).forEach(ge=>G.removeNodes(t,{at:ge,voids:l})),!R){var L=X.current,[U]=b.leaf(t,L),{path:te}=L,ne=S?w.offset:0,ie=U.text.slice(ne,A.offset);ie.length>0&&(t.apply({type:"remove_text",path:te,offset:ne,text:ie}),v=ie)}!S&&F&&X.current&&re.current&&G.mergeNodes(t,{at:X.current,hanging:!0,voids:l}),h&&i&&s==="character"&&v.length>1&&v.match(/[\u0E00-\u0E7F]+/)&&G.insertText(t,v.slice(0,v.length-o));var fe=re.unref(),Q=X.unref(),pe=i?fe||Q:Q||fe;n.at==null&&pe&&G.select(t,pe)}}})},nv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=Gs(t),batchDirty:o=!0}=r;if(n.length){if(V.isRange(s))if(a||(s=b.unhangRange(t,s,{voids:i})),V.isCollapsed(s))s=s.anchor;else{var[,l]=V.edges(s);if(!i&&b.void(t,{at:l}))return;var u=b.pointRef(t,l);G.delete(t,{at:s}),s=u.unref()}else N.isPath(s)&&(s=b.start(t,s));if(!(!i&&b.void(t,{at:s}))){var c=b.above(t,{at:s,match:W=>ce.isElement(W)&&b.isInline(t,W),mode:"highest",voids:i});if(c){var[,h]=c;if(b.isEnd(t,s,h)){var m=b.after(t,h);s=m}else if(b.isStart(t,s,h)){var p=b.before(t,h);s=p}}var g=b.above(t,{match:W=>ce.isElement(W)&&b.isBlock(t,W),at:s,voids:i}),[,f]=g,D=b.isStart(t,s,f),y=b.isEnd(t,s,f),w=D&&y,A=!D||D&&y,_=!y,[,k]=oe.first({children:n},[]),[,F]=oe.last({children:n},[]),S=[],$=W=>{var[L,U]=W,te=U.length===0;return te?!1:w?!0:!(A&&N.isAncestor(U,k)&&ce.isElement(L)&&!t.isVoid(L)&&!t.isInline(L)||_&&N.isAncestor(U,F)&&ce.isElement(L)&&!t.isVoid(L)&&!t.isInline(L))};for(var R of oe.nodes({children:n},{pass:$}))$(R)&&S.push(R);var I=[],M=[],x=[],E=!0,O=!1;for(var[j]of S)ce.isElement(j)&&!t.isInline(j)?(E=!1,O=!0,M.push(j)):E?I.push(j):x.push(j);var[q]=b.nodes(t,{at:s,match:W=>de.isText(W)||b.isInline(t,W),mode:"highest",voids:i}),[,z]=q,re=b.isStart(t,s,z),X=b.isEnd(t,s,z),v=b.pathRef(t,y&&!x.length?N.next(f):f),H=b.pathRef(t,X?N.next(z):z);G.splitNodes(t,{at:s,match:W=>O?ce.isElement(W)&&b.isBlock(t,W):de.isText(W)||b.isInline(t,W),mode:O?"lowest":"highest",always:O&&(!D||I.length>0)&&(!y||x.length>0),voids:i});var ee=b.pathRef(t,!re||re&&X?N.next(z):z);if(G.insertNodes(t,I,{at:ee.current,match:W=>de.isText(W)||b.isInline(t,W),mode:"highest",voids:i,batchDirty:o}),w&&!I.length&&M.length&&!x.length&&G.delete(t,{at:f,voids:i}),G.insertNodes(t,M,{at:v.current,match:W=>ce.isElement(W)&&b.isBlock(t,W),mode:"lowest",voids:i,batchDirty:o}),G.insertNodes(t,x,{at:H.current,match:W=>de.isText(W)||b.isInline(t,W),mode:"highest",voids:i,batchDirty:o}),!r.at){var B;if(x.length>0&&H.current?B=N.previous(H.current):M.length>0&&v.current?B=N.previous(v.current):ee.current&&(B=N.previous(ee.current)),B){var T=b.end(t,B);G.select(t,T)}}ee.unref(),v.unref(),H.unref()}}})},rv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")G.select(t,a.anchor);else if(r==="focus")G.select(t,a.focus);else if(r==="start"){var[i]=V.edges(a);G.select(t,i)}else if(r==="end"){var[,s]=V.edges(a);G.select(t,s)}}else return},av=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},iv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:a=1,unit:i="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=V.isBackward(r)?"focus":"anchor"),o==="end"&&(o=V.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,c={distance:a,unit:i,ignoreNonSelectable:!0},h={};if(o==null||o==="anchor"){var m=s?b.before(t,l,c):b.after(t,l,c);m&&(h.anchor=m)}if(o==null||o==="focus"){var p=s?b.before(t,u,c):b.after(t,u,c);p&&(h.focus=p)}G.setSelection(t,h)}},sv=(e,t)=>{var{selection:n}=e;if(t=b.range(e,t),n){G.setSelection(e,t);return}if(!V.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(Je.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function Tu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Su(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Tu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ov=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a}=t,{edge:i="both"}=r;if(a){i==="start"&&(i=V.isBackward(a)?"focus":"anchor"),i==="end"&&(i=V.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;G.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Su(Su({},l),n)})}},uv=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!Ee.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!Ee.equals(t.focus,n.focus)||i!=="anchor"&&i!=="focus"&&t[i]!==n[i])&&(r[i]=n[i],a[i]=t[i]);Object.keys(r).length>0&&e.apply({type:"set_selection",properties:r,newProperties:a})}},lv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:c}=r;if(oe.isNode(n)&&(n=[n]),n.length!==0){var[h]=n;if(l||(l=Gs(t),c!==!1&&(c=!0)),c==null&&(c=!1),V.isRange(l))if(a||(l=b.unhangRange(t,l,{voids:i})),V.isCollapsed(l))l=l.anchor;else{var[,m]=V.edges(l),p=b.pointRef(t,m);G.delete(t,{at:l}),l=p.unref()}if(Ee.isPoint(l)){u==null&&(de.isText(h)?u=I=>de.isText(I):t.isInline(h)?u=I=>de.isText(I)||b.isInline(t,I):u=I=>ce.isElement(I)&&b.isBlock(t,I));var[g]=b.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,D=b.pathRef(t,f),y=b.isEnd(t,l,f);G.splitNodes(t,{at:l,match:u,mode:s,voids:i});var w=D.unref();l=y?N.next(w):w}else return}var A=N.parent(l),_=l[l.length-1];if(!(!i&&b.void(t,{at:A}))){if(o){var k=[],F=N.levels(A);Vp(t,()=>{var I=function(){var E=A.concat(_);_++;var O={type:"insert_node",path:E,node:M};t.apply(O),l=N.next(l),k.push(O),de.isText?F.push(...Array.from(oe.nodes(M),j=>{var[,q]=j;return E.concat(q)})):F.push(E)};for(var M of n)I()},()=>{md(t,F,I=>{var M=I;for(var x of k)if(N.operationCanTransformPath(x)&&(M=N.transform(M,x),!M))return null;return M})})}else for(var S of n){var $=A.concat(_);_++,t.apply({type:"insert_node",path:$,node:S}),l=N.next(l)}if(l=N.previous(l),c){var R=b.end(t,l);R&&G.select(t,R)}}}})},cv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=N.isPath(r)?ar(t,r):_=>ce.isElement(_)&&b.isBlock(t,_)),!!r){var o=b.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,_=>{var[,k]=_;return b.pathRef(t,k)});for(var u of l){var c=u.unref();if(c.length<2)throw new Error("Cannot lift node at a path [".concat(c,"] because it has a depth of less than `2`."));var h=b.node(t,N.parent(c)),[m,p]=h,g=c[c.length-1],{length:f}=m.children;if(f===1){var D=N.next(p);G.moveNodes(t,{at:c,to:D,voids:i}),G.removeNodes(t,{at:p,voids:i})}else if(g===0)G.moveNodes(t,{at:c,to:p,voids:i});else if(g===f-1){var y=N.next(p);G.moveNodes(t,{at:c,to:y,voids:i})}else{var w=N.next(c),A=N.next(p);G.splitNodes(t,{at:w,voids:i}),G.moveNodes(t,{at:c,to:A,voids:i})}}}})},dv=["text"],fv=["children"],pd=(e,t)=>{if(ce.isElement(t)){var n=t;return b.isVoid(e,t)?!0:n.children.length===1?pd(e,n.children[0]):!1}else return!b.isEditor(t)},hv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(N.isPath(a)){var[l]=b.parent(t,a);r=I=>l.children.includes(I)}else r=I=>ce.isElement(I)&&b.isBlock(t,I);if(!i&&V.isRange(a)&&(a=b.unhangRange(t,a,{voids:s})),V.isRange(a))if(V.isCollapsed(a))a=a.anchor;else{var[,u]=V.edges(a),c=b.pointRef(t,u);G.delete(t,{at:a}),a=c.unref(),n.at==null&&G.select(t,a)}var[h]=b.nodes(t,{at:a,match:r,voids:s,mode:o}),m=b.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!h||!m)){var[p,g]=h,[f,D]=m;if(!(g.length===0||D.length===0)){var y=N.next(D),w=N.common(g,D),A=N.isSibling(g,D),_=Array.from(b.levels(t,{at:g}),I=>{var[M]=I;return M}).slice(w.length).slice(0,-1),k=b.above(t,{at:g,mode:"highest",match:I=>_.includes(I)&&pd(t,I)}),F=k&&b.pathRef(t,k[1]),S,$;if(de.isText(p)&&de.isText(f)){var R=Ut(p,dv);$=f.text.length,S=R}else if(ce.isElement(p)&&ce.isElement(f)){var R=Ut(p,fv);$=f.children.length,S=R}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(Je.stringify(p)," ").concat(Je.stringify(f)));A||G.moveNodes(t,{at:g,to:y,voids:s}),F&&G.removeNodes(t,{at:F.current,voids:s}),ce.isElement(f)&&b.isEmpty(t,f)||de.isText(f)&&f.text===""&&D[D.length-1]!==0?G.removeNodes(t,{at:D,voids:s}):t.apply({type:"merge_node",path:y,position:$,properties:S}),F&&F.unref()}}}})},mv=(e,t)=>{b.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=N.isPath(r)?ar(e,r):p=>ce.isElement(p)&&b.isBlock(e,p));var o=b.pathRef(e,n),l=b.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,p=>{var[,g]=p;return b.pathRef(e,g)});for(var c of u){var h=c.unref(),m=o.current;h.length!==0&&e.apply({type:"move_node",path:h,newPath:m}),o.current&&N.isSibling(m,h)&&N.isAfter(m,h)&&(o.current=N.next(o.current))}o.unref()}})},pv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=N.isPath(s)?ar(t,s):p=>ce.isElement(p)&&b.isBlock(t,p)),!r&&V.isRange(s)&&(s=b.unhangRange(t,s,{voids:a}));var l=b.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,p=>{var[,g]=p;return b.pathRef(t,g)});for(var c of u){var h=c.unref();if(h){var[m]=b.node(t,h);t.apply({type:"remove_node",path:h,node:m})}}}})},gv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:c=!1,voids:h=!1}=r;if(i){if(a==null&&(a=N.isPath(i)?ar(t,i):$=>ce.isElement($)&&b.isBlock(t,$)),!l&&V.isRange(i)&&(i=b.unhangRange(t,i,{voids:h})),c&&V.isRange(i)){if(V.isCollapsed(i)&&b.leaf(t,i.anchor)[0].text.length>0)return;var m=b.rangeRef(t,i,{affinity:"inward"}),[p,g]=V.edges(i),f=u==="lowest"?"lowest":"highest",D=b.isEnd(t,g,g.path);G.splitNodes(t,{at:g,match:a,mode:f,voids:h,always:!D});var y=b.isStart(t,p,p.path);G.splitNodes(t,{at:p,match:a,mode:f,voids:h,always:!y}),i=m.unref(),r.at==null&&G.select(t,i)}s||(s=($,R)=>$!==R);for(var[w,A]of b.nodes(t,{at:i,match:a,mode:u,voids:h})){var _={},k={};if(A.length!==0){var F=!1;for(var S in n)S==="children"||S==="text"||s(n[S],w[S])&&(F=!0,w.hasOwnProperty(S)&&(_[S]=w[S]),o?n[S]!=null&&(k[S]=o(w[S],n[S])):n[S]!=null&&(k[S]=n[S]));F&&t.apply({type:"set_node",path:A,properties:_,newProperties:k})}}}})},vv=(e,t)=>{if(V.isCollapsed(t))return t.anchor;var[,n]=V.edges(t),r=b.pointRef(e,n);return G.delete(e,{at:t}),r.unref()},bv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=X=>ce.isElement(X)&&b.isBlock(t,X)),V.isRange(s)&&(s=vv(t,s)),N.isPath(s)){var u=s,c=b.point(t,u),[h]=b.parent(t,u);i=X=>X===h,o=c.path.length-u.length+1,s=c,l=!0}if(s){var m=b.pointRef(t,s,{affinity:"backward"}),p;try{var[g]=b.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=b.void(t,{at:s,mode:"highest"}),D=0;if(!a&&f){var[y,w]=f;if(ce.isElement(y)&&t.isInline(y)){var A=b.after(t,w);if(!A){var _={text:""},k=N.next(w);G.insertNodes(t,_,{at:k,voids:a}),A=b.point(t,k)}s=A,l=!0}var F=s.path.length-w.length;o=F+1,l=!0}p=b.pointRef(t,s);var S=s.path.length-o,[,$]=g,R=s.path.slice(0,S),I=o===0?s.offset:s.path[S]+D;for(var[M,x]of b.levels(t,{at:R,reverse:!0,voids:a})){var E=!1;if(x.length<$.length||x.length===0||!a&&ce.isElement(M)&&b.isVoid(t,M))break;var O=m.current,j=b.isEnd(t,O,x);if(l||!m||!b.isEdge(t,O,x)){E=!0;var q=oe.extractProps(M);t.apply({type:"split_node",path:x,position:I,properties:q})}I=x[x.length-1]+(E||j?1:0)}if(n.at==null){var z=p.current||b.end(t,[]);G.select(t,z)}}finally{var re;m.unref(),(re=p)===null||re===void 0||re.unref()}}})},yv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var a={};for(var i of n)a[i]=null;G.setNodes(t,a,r)},Dv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=N.isPath(s)?ar(t,s):p=>ce.isElement(p)&&b.isBlock(t,p)),N.isPath(s)&&(s=b.range(t,s));var l=V.isRange(s)?b.rangeRef(t,s):null,u=b.nodes(t,{at:s,match:o,mode:r,voids:i}),c=Array.from(u,p=>{var[,g]=p;return b.pathRef(t,g)}).reverse(),h=function(){var g=m.unref(),[f]=b.node(t,g),D=b.range(t,g);a&&l&&(D=V.intersection(l.current,D)),G.liftNodes(t,{at:D,match:y=>ce.isAncestor(f)&&f.children.includes(y),voids:i})};for(var m of c)h();l&&l.unref()}})};function ju(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ou(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ju(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ju(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Cv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(N.isPath(l)?o=ar(t,l):t.isInline(n)?o=D=>ce.isElement(D)&&b.isInline(t,D)||de.isText(D):o=D=>ce.isElement(D)&&b.isBlock(t,D)),i&&V.isRange(l)){var[u,c]=V.edges(l),h=b.rangeRef(t,l,{affinity:"inward"});G.splitNodes(t,{at:c,match:o,voids:s}),G.splitNodes(t,{at:u,match:o,voids:s}),l=h.unref(),r.at==null&&G.select(t,l)}var m=Array.from(b.nodes(t,{at:l,match:t.isInline(n)?D=>ce.isElement(D)&&b.isBlock(t,D):D=>b.isEditor(D),mode:"lowest",voids:s})),p=function(){var y=V.isRange(l)?V.intersection(l,b.range(t,f)):l;if(!y)return 0;var w=Array.from(b.nodes(t,{at:y,match:o,mode:a,voids:s}));if(w.length>0){var[A]=w,_=w[w.length-1],[,k]=A,[,F]=_;if(k.length===0&&F.length===0)return 0;var S=N.equals(k,F)?N.parent(k):N.common(k,F),$=b.range(t,k,F),R=b.node(t,S),[I]=R,M=S.length+1,x=N.next(F.slice(0,M)),E=Ou(Ou({},n),{},{children:[]});G.insertNodes(t,E,{at:x,voids:s}),G.moveNodes(t,{at:$,match:O=>ce.isAncestor(I)&&I.children.includes(O),to:x.concat(0),voids:s})}},g;for(var[,f]of m)g=p()}})},xv=()=>{var e={children:[],operations:[],selection:null,marks:null,isElementReadOnly:()=>!1,isInline:()=>!1,isSelectable:()=>!0,isVoid:()=>!1,markableVoid:()=>!1,onChange:()=>{},apply:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kp(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xp(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ng(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rg(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ag(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yp(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pg(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vg(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nv(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gg(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gp(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yg(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zp(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qp(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jp(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eg(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tg(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rv(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tv(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return av(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ig(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sg(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return og(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ug(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lg(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sg(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dg(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fg(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hg(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mg(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lv(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cv(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hv(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iv(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mv(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hg(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kg(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ug(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pv(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sv(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gv(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gg(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ov(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uv(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bv(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qg(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xg(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yv(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dv(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cg(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ev(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cv(e,...r)}};return e},wv={isHistory(e){return et(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||Xt.isOperationList(e.redos[0].operations))&&(e.undos.length===0||Xt.isOperationList(e.undos[0].operations))}},hi=new WeakMap,mi=new WeakMap,$n={isHistoryEditor(e){return wv.isHistory(e.history)&&b.isEditor(e)},isMerging(e){return mi.get(e)},isSaving(e){return hi.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=$n.isMerging(e);mi.set(e,!1),t(),mi.set(e,n)},withoutSaving(e,t){var n=$n.isSaving(e);hi.set(e,!1),t(),hi.set(e,n)}},Ev=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&G.setSelection(t,i.selectionBefore),$n.withoutSaving(t,()=>{b.withoutNormalizing(t,()=>{for(var s of i.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:r}=t,{undos:a}=r;if(a.length>0){var i=a[a.length-1];$n.withoutSaving(t,()=>{b.withoutNormalizing(t,()=>{var s=i.operations.map(Xt.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&G.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=$n.isSaving(t),c=$n.isMerging(t);if(u==null&&(u=_v(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=kv(r,l)),o&&c)o.operations.push(r);else{var h={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",h)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},kv=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&N.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&N.equals(e.path,t.path)),_v=(e,t)=>e.type!=="set_selection",Bv=Tv,gd="֑-߿יִ-﷽ﹰ-ﻼ",vd="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Av=new RegExp("^[^"+vd+"]*["+gd+"]"),Fv=new RegExp("^[^"+gd+"]*["+vd+"]");function Tv(e){return e=String(e||""),Av.test(e)?"rtl":Fv.test(e)?"ltr":"neutral"}const bd=wn(Bv);function Sv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Xs=Sv,jv=typeof $r=="object"&&$r&&$r.Object===Object&&$r,Ov=jv,Pv=Ov,Nv=typeof self=="object"&&self&&self.Object===Object&&self,Rv=Pv||Nv||Function("return this")(),yd=Rv,Mv=yd,Iv=function(){return Mv.Date.now()},$v=Iv,Lv=/\s/;function zv(e){for(var t=e.length;t--&&Lv.test(e.charAt(t)););return t}var qv=zv,Wv=qv,Hv=/^\s+/;function Uv(e){return e&&e.slice(0,Wv(e)+1).replace(Hv,"")}var Vv=Uv,Kv=yd,Zv=Kv.Symbol,Dd=Zv,Pu=Dd,Cd=Object.prototype,Yv=Cd.hasOwnProperty,Gv=Cd.toString,lr=Pu?Pu.toStringTag:void 0;function Qv(e){var t=Yv.call(e,lr),n=e[lr];try{e[lr]=void 0;var r=!0}catch{}var a=Gv.call(e);return r&&(t?e[lr]=n:delete e[lr]),a}var Jv=Qv,Xv=Object.prototype,e0=Xv.toString;function t0(e){return e0.call(e)}var n0=t0,Nu=Dd,r0=Jv,a0=n0,i0="[object Null]",s0="[object Undefined]",Ru=Nu?Nu.toStringTag:void 0;function o0(e){return e==null?e===void 0?s0:i0:Ru&&Ru in Object(e)?r0(e):a0(e)}var u0=o0;function l0(e){return e!=null&&typeof e=="object"}var c0=l0,d0=u0,f0=c0,h0="[object Symbol]";function m0(e){return typeof e=="symbol"||f0(e)&&d0(e)==h0}var p0=m0,g0=Vv,Mu=Xs,v0=p0,Iu=0/0,b0=/^[-+]0x[0-9a-f]+$/i,y0=/^0b[01]+$/i,D0=/^0o[0-7]+$/i,C0=parseInt;function x0(e){if(typeof e=="number")return e;if(v0(e))return Iu;if(Mu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Mu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=g0(e);var n=y0.test(e);return n||D0.test(e)?C0(e.slice(2),n?2:8):b0.test(e)?Iu:+e}var w0=x0,E0=Xs,pi=$v,$u=w0,k0="Expected a function",_0=Math.max,B0=Math.min;function A0(e,t,n){var r,a,i,s,o,l,u=0,c=!1,h=!1,m=!0;if(typeof e!="function")throw new TypeError(k0);t=$u(t)||0,E0(n)&&(c=!!n.leading,h="maxWait"in n,i=h?_0($u(n.maxWait)||0,t):i,m="trailing"in n?!!n.trailing:m);function p(F){var S=r,$=a;return r=a=void 0,u=F,s=e.apply($,S),s}function g(F){return u=F,o=setTimeout(y,t),c?p(F):s}function f(F){var S=F-l,$=F-u,R=t-S;return h?B0(R,i-$):R}function D(F){var S=F-l,$=F-u;return l===void 0||S>=t||S<0||h&&$>=i}function y(){var F=pi();if(D(F))return w(F);o=setTimeout(y,f(F))}function w(F){return o=void 0,m&&r?p(F):(r=a=void 0,s)}function A(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function _(){return o===void 0?s:w(pi())}function k(){var F=pi(),S=D(F);if(r=arguments,a=this,l=F,S){if(o===void 0)return g(l);if(h)return clearTimeout(o),o=setTimeout(y,t),p(l)}return o===void 0&&(o=setTimeout(y,t)),s}return k.cancel=A,k.flush=_,k}var xd=A0;const F0=wn(xd);var T0=xd,S0=Xs,j0="Expected a function";function O0(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(j0);return S0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),T0(e,t,{leading:r,maxWait:t,trailing:a})}var P0=O0;const N0=wn(P0),Lu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,zu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",gi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return zu(n.overflowY,t)||zu(n.overflowX,t)||(r=>{const a=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!a&&(a.clientHeight<r.scrollHeight||a.clientWidth<r.scrollWidth)})(e)}return!1},Hr=(e,t,n,r,a,i,s,o)=>i<e&&s>t||i>e&&s<t?0:i<=e&&o<=n||s>=t&&o>=n?i-e-r:s>t&&o<n||i<e&&o>n?s-t+a:0,R0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},qu=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,h=typeof u=="function"?u:q=>q!==u;if(!Lu(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let g=e;for(;Lu(g)&&h(g);){if(g=R0(g),g===m){p.push(g);break}g!=null&&g===document.body&&gi(g)&&!gi(document.documentElement)||g!=null&&gi(g,c)&&p.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,D=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:y,scrollY:w}=window,{height:A,width:_,top:k,right:F,bottom:S,left:$}=e.getBoundingClientRect(),{top:R,right:I,bottom:M,left:x}=(q=>{const z=window.getComputedStyle(q);return{top:parseFloat(z.scrollMarginTop)||0,right:parseFloat(z.scrollMarginRight)||0,bottom:parseFloat(z.scrollMarginBottom)||0,left:parseFloat(z.scrollMarginLeft)||0}})(e);let E=o==="start"||o==="nearest"?k-R:o==="end"?S+M:k+A/2-R+M,O=l==="center"?$+_/2-x+I:l==="end"?F+I:$-x;const j=[];for(let q=0;q<p.length;q++){const z=p[q],{height:re,width:X,top:v,right:H,bottom:ee,left:B}=z.getBoundingClientRect();if(s==="if-needed"&&k>=0&&$>=0&&S<=D&&F<=f&&k>=v&&S<=ee&&$>=B&&F<=H)return j;const T=getComputedStyle(z),W=parseInt(T.borderLeftWidth,10),L=parseInt(T.borderTopWidth,10),U=parseInt(T.borderRightWidth,10),te=parseInt(T.borderBottomWidth,10);let ne=0,ie=0;const fe="offsetWidth"in z?z.offsetWidth-z.clientWidth-W-U:0,Q="offsetHeight"in z?z.offsetHeight-z.clientHeight-L-te:0,pe="offsetWidth"in z?z.offsetWidth===0?0:X/z.offsetWidth:0,ge="offsetHeight"in z?z.offsetHeight===0?0:re/z.offsetHeight:0;if(m===z)ne=o==="start"?E:o==="end"?E-D:o==="nearest"?Hr(w,w+D,D,L,te,w+E,w+E+A,A):E-D/2,ie=l==="start"?O:l==="center"?O-f/2:l==="end"?O-f:Hr(y,y+f,f,W,U,y+O,y+O+_,_),ne=Math.max(0,ne+w),ie=Math.max(0,ie+y);else{ne=o==="start"?E-v-L:o==="end"?E-ee+te+Q:o==="nearest"?Hr(v,ee,re,L,te+Q,E,E+A,A):E-(v+re/2)+Q/2,ie=l==="start"?O-B-W:l==="center"?O-(B+X/2)+fe/2:l==="end"?O-H+U+fe:Hr(B,H,X,W,U+fe,O,O+_,_);const{scrollLeft:ke,scrollTop:xe}=z;ne=ge===0?0:Math.max(0,Math.min(xe+ne/ge,z.scrollHeight-re/ge+Q)),ie=pe===0?0:Math.max(0,Math.min(ke+ie/pe,z.scrollWidth-X/pe+fe)),E+=xe-ne,O+=ke-ie}j.push({el:z,top:ne,left:ie})}return j},M0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function I0(e,t){if(!e.isConnected||!(a=>{let i=a;for(;i&&i.parentNode;){if(i.parentNode===document)return!0;i=i.parentNode instanceof ShadowRoot?i.parentNode.host:i.parentNode}return!1})(e))return;const n=(a=>{const i=window.getComputedStyle(a);return{top:parseFloat(i.scrollMarginTop)||0,right:parseFloat(i.scrollMarginRight)||0,bottom:parseFloat(i.scrollMarginBottom)||0,left:parseFloat(i.scrollMarginLeft)||0}})(e);if((a=>typeof a=="object"&&typeof a.behavior=="function")(t))return t.behavior(qu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of qu(e,M0(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var gn=[],$0=function(){return gn.some(function(e){return e.activeTargets.length>0})},L0=function(){return gn.some(function(e){return e.skippedTargets.length>0})},Wu="ResizeObserver loop completed with undelivered notifications.",z0=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Wu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Wu),window.dispatchEvent(e)},Ar;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Ar||(Ar={}));var vn=function(e){return Object.freeze(e)},q0=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,vn(this)}return e}(),wd=function(){function e(t,n,r,a){return this.x=t,this.y=n,this.width=r,this.height=a,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,vn(this)}return e.prototype.toJSON=function(){var t=this,n=t.x,r=t.y,a=t.top,i=t.right,s=t.bottom,o=t.left,l=t.width,u=t.height;return{x:n,y:r,top:a,right:i,bottom:s,left:o,width:l,height:u}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),eo=function(e){return e instanceof SVGElement&&"getBBox"in e},Ed=function(e){if(eo(e)){var t=e.getBBox(),n=t.width,r=t.height;return!n&&!r}var a=e,i=a.offsetWidth,s=a.offsetHeight;return!(i||s||e.getClientRects().length)},Hu=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)},W0=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},vr=typeof window<"u"?window:{},Ur=new WeakMap,Uu=/auto|scroll/,H0=/^tb|vertical/,U0=/msie|trident/i.test(vr.navigator&&vr.navigator.userAgent),Ft=function(e){return parseFloat(e||"0")},Wn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new q0((n?t:e)||0,(n?e:t)||0)},Vu=vn({devicePixelContentBoxSize:Wn(),borderBoxSize:Wn(),contentBoxSize:Wn(),contentRect:new wd(0,0,0,0)}),kd=function(e,t){if(t===void 0&&(t=!1),Ur.has(e)&&!t)return Ur.get(e);if(Ed(e))return Ur.set(e,Vu),Vu;var n=getComputedStyle(e),r=eo(e)&&e.ownerSVGElement&&e.getBBox(),a=!U0&&n.boxSizing==="border-box",i=H0.test(n.writingMode||""),s=!r&&Uu.test(n.overflowY||""),o=!r&&Uu.test(n.overflowX||""),l=r?0:Ft(n.paddingTop),u=r?0:Ft(n.paddingRight),c=r?0:Ft(n.paddingBottom),h=r?0:Ft(n.paddingLeft),m=r?0:Ft(n.borderTopWidth),p=r?0:Ft(n.borderRightWidth),g=r?0:Ft(n.borderBottomWidth),f=r?0:Ft(n.borderLeftWidth),D=h+u,y=l+c,w=f+p,A=m+g,_=o?e.offsetHeight-A-e.clientHeight:0,k=s?e.offsetWidth-w-e.clientWidth:0,F=a?D+w:0,S=a?y+A:0,$=r?r.width:Ft(n.width)-F-k,R=r?r.height:Ft(n.height)-S-_,I=$+D+k+w,M=R+y+_+A,x=vn({devicePixelContentBoxSize:Wn(Math.round($*devicePixelRatio),Math.round(R*devicePixelRatio),i),borderBoxSize:Wn(I,M,i),contentBoxSize:Wn($,R,i),contentRect:new wd(h,l,$,R)});return Ur.set(e,x),x},_d=function(e,t,n){var r=kd(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Ar.DEVICE_PIXEL_CONTENT_BOX:return s;case Ar.BORDER_BOX:return a;default:return i}},V0=function(){function e(t){var n=kd(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=vn([n.borderBoxSize]),this.contentBoxSize=vn([n.contentBoxSize]),this.devicePixelContentBoxSize=vn([n.devicePixelContentBoxSize])}return e}(),Bd=function(e){if(Ed(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},K0=function(){var e=1/0,t=[];gn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var c=new V0(u.target),h=Bd(u.target);o.push(c),u.lastReportedSize=_d(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 a=r[n];a()}return e},Ku=function(e){gn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(Bd(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},Z0=function(){var e=0;for(Ku(e);$0();)e=K0(),Ku(e);return L0()&&z0(),e>0},vi,Ad=[],Y0=function(){return Ad.splice(0).forEach(function(e){return e()})},G0=function(e){if(!vi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Y0()}).observe(n,r),vi=function(){n.textContent="".concat(t?t--:t++)}}Ad.push(e),vi()},Q0=function(e){G0(function(){requestAnimationFrame(e)})},la=0,J0=function(){return!!la},X0=250,eb={attributes:!0,characterData:!0,childList:!0,subtree:!0},Zu=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Yu=function(e){return e===void 0&&(e=0),Date.now()+e},bi=!1,tb=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=X0),!bi){bi=!0;var r=Yu(t);Q0(function(){var a=!1;try{a=Z0()}finally{if(bi=!1,t=r-Yu(),!J0())return;a?n.run(1e3):t>0?n.run(t):n.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var t=this,n=function(){return t.observer&&t.observer.observe(document.body,eb)};document.body?n():vr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Zu.forEach(function(n){return vr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Zu.forEach(function(n){return vr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),gs=new tb,Gu=function(e){!la&&e>0&&gs.start(),la+=e,!la&&gs.stop()},nb=function(e){return!eo(e)&&!W0(e)&&getComputedStyle(e).display==="inline"},rb=function(){function e(t,n){this.target=t,this.observedBox=n||Ar.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=_d(this.target,this.observedBox,!0);return nb(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),ab=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Vr=new WeakMap,Qu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Kr=function(){function e(){}return e.connect=function(t,n){var r=new ab(t,n);Vr.set(t,r)},e.observe=function(t,n,r){var a=Vr.get(t),i=a.observationTargets.length===0;Qu(a.observationTargets,n)<0&&(i&&gn.push(a),a.observationTargets.push(new rb(n,r&&r.box)),Gu(1),gs.schedule())},e.unobserve=function(t,n){var r=Vr.get(t),a=Qu(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&gn.splice(gn.indexOf(r),1),r.observationTargets.splice(a,1),Gu(-1))},e.disconnect=function(t){var n=this,r=Vr.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),ib=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.");Kr.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(!Hu(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Kr.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(!Hu(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Kr.unobserve(this,t)},e.prototype.disconnect=function(){Kr.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Vt={};Object.defineProperty(Vt,"__esModule",{value:!0});var sb=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),yi={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Fd={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:sb?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},to={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 Zr=1;Zr<20;Zr++)to["f"+Zr]=111+Zr;function Ka(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Td(s,t)}),a=function(o){return r.some(function(l){return Sd(l,o)})},i=n==null?a:a(n);return i}function ob(e,t){return Ka(e,t)}function ub(e,t){return Ka(e,{byKey:!0},t)}function Td(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in yi)r[yi[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var c=a[Symbol.iterator](),h;!(o=(h=c.next()).done);o=!0){var m=h.value,p=m.endsWith("?")&&m.length>1;p&&(m=m.slice(0,-1));var g=no(m),f=yi[g];if(m.length>1&&!f&&!Fd[m]&&!to[g])throw new TypeError('Unknown modifier: "'+m+'"');(i===1||!f)&&(n?r.key=g:r.which=jd(m)),f&&(r[f]=p?null:!0)}}catch(D){l=!0,u=D}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Sd(e,t){for(var n in e){var r=e[n],a=void 0;if(r!=null&&(n==="key"&&t.key!=null?a=t.key.toLowerCase():n==="which"?a=r===91&&t.which===93?91:t.which:a=t[n],!(a==null&&r===!1)&&a!==r))return!1}return!0}function jd(e){e=no(e);var t=to[e]||e.toUpperCase().charCodeAt(0);return t}function no(e){return e=e.toLowerCase(),e=Fd[e]||e,e}var lb=Vt.default=Ka,Di=Vt.isHotkey=Ka;Vt.isCodeHotkey=ob;Vt.isKeyHotkey=ub;Vt.parseHotkey=Td;Vt.compareHotkey=Sd;Vt.toKeyCode=jd;Vt.toKeyName=no;function cb(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Yn(e,t){if(e==null)return{};var n=cb(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Fr(e){"@babel/helpers - typeof";return Fr=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},Fr(e)}function db(e,t){if(Fr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Fr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fb(e){var t=db(e,"string");return Fr(t)==="symbol"?t:String(t)}function xt(e,t,n){return t=fb(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ro=C.createContext(null),on=()=>{var e=C.useContext(ro);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Od=parseInt(C.version.split(".")[0],10),hb=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Ju=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),ot=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Ln=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),mr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),mb=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Pd=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),pb=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),gb=ot&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),vb=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),bb=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),yb=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ca=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Zt=(!pb||!gb)&&!mb&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",ao=new WeakMap,io=new WeakMap,Nd=new WeakMap,da=new WeakMap,vs=new WeakMap,Tr=new WeakMap,bn=new WeakMap,ka=new WeakMap,Za=new WeakMap,bs=new WeakMap,en=new WeakMap,mn=new WeakMap,br=new WeakMap,ys=new WeakMap,so=new WeakMap,_t=new WeakMap,Wt=new WeakMap,ct=new WeakMap,Gt=new WeakMap,Qt=new WeakMap,Rd=new WeakMap,Gn=Symbol("placeholder"),Md=Symbol("mark-placeholder"),Db=globalThis.Text,oo=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,Cb=e=>nn(e)&&e.nodeType===8,Ct=e=>nn(e)&&e.nodeType===1,nn=e=>{var t=oo(e);return!!t&&e instanceof t.Node},Ds=e=>{var t=e&&e.anchorNode&&oo(e.anchorNode);return!!t&&e instanceof t.Selection},Id=e=>nn(e)&&e.nodeType===3,xb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,wb=e=>{var[t,n]=e;if(Ct(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=$d(t,a,r?"backward":"forward"),r=a<n;Ct(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=kb(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},Eb=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},$d=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(Cb(a)||Ct(a)&&a.childNodes.length===0||Ct(a)&&a.getAttribute("contenteditable")==="false")&&!(s&&o);){if(i>=r.length){s=!0,i=t-1,n="backward";continue}if(i<0){o=!0,i=t+1,n="forward";continue}a=r[i],t=i,i+=n==="forward"?1:-1}return[a,t]},kb=(e,t,n)=>{var[r]=$d(e,t,n);return r},Ld=e=>{var t="";if(Id(e)&&e.nodeValue)return e.nodeValue;if(Ct(e)){for(var n of Array.from(e.childNodes))t+=Ld(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
103
- `)}return t},_b=/data-slate-fragment="(.+?)"/m,Bb=e=>{var t=e.getData("text/html"),[,n]=t.match(_b)||[];return n},uo=(e,t,n)=>{var{target:r}=t;if(Ct(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=J.getWindow(e);if(a.contains(r))return J.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var c of l)if(c===r||c.contains(r))return!0});return!i||i===t?!1:uo(e,i,n)},Ab=0;class Fb{constructor(){xt(this,"id",void 0),this.id="".concat(Ab++)}}var J={androidPendingDiffs:e=>ct.get(e),androidScheduleFlush:e=>{var t;(t=so.get(e))===null||t===void 0||t()},blur:e=>{var t=J.toDOMNode(e,e),n=J.findDocumentOrShadowRoot(e);en.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=J.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&G.deselect(e)},findDocumentOrShadowRoot:e=>{var t=J.toDOMNode(e,e),n=t.getRootNode();return(n instanceof Document||n instanceof ShadowRoot)&&n.getSelection!=null?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:a}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i=J.toSlateNode(e,t.target),s=J.findPath(e,i);if(ce.isElement(i)&&b.isVoid(e,i)){var o=a.getBoundingClientRect(),l=e.isInline(i)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,u=b.point(e,s,{edge:l?"start":"end"}),c=l?b.before(e,u):b.after(e,u);if(c){var h=b.range(e,c);return h}}var m,{document:p}=J.getWindow(e);if(p.caretRangeFromPoint)m=p.caretRangeFromPoint(n,r);else{var g=p.caretPositionFromPoint(n,r);g&&(m=p.createRange(),m.setStart(g.offsetNode,g.offset),m.setEnd(g.offsetNode,g.offset))}if(!m)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=J.toSlateRange(e,m,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=ka.get(t);return n||(n=new Fb,ka.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=io.get(r);if(a==null){if(b.isEditor(r))return n;break}var i=ao.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(Je.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!en.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(()=>{J.focus(t,{retries:n.retries-1})},10);return}var r=J.toDOMNode(t,t),a=J.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=J.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(G.select(t,b.start(t,[])),t.onChange()),en.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=Nd.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{editable:a=!1}=r,i=J.toDOMNode(t,t),s;try{s=Ct(n)?n:n.parentElement}catch(o){if(o instanceof Error&&!o.message.includes('Permission denied to access property "nodeType"'))throw o}return s?s.closest("[data-slate-editor]")===i&&(!a||s.isContentEditable?!0:typeof s.isContentEditable=="boolean"&&s.closest('[contenteditable="false"]')===i||!!s.getAttribute("data-slate-zero-width")):!1},hasEditableTarget:(e,t)=>nn(t)&&J.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return b.hasPath(e,n.path)&&b.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>J.hasEditableTarget(e,t)||J.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>nn(t)&&J.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!mn.get(e),isFocused:e=>!!en.get(e),isReadOnly:e=>!!bs.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(bs.get(e))return!1;var n=J.hasTarget(e,t)&&J.toSlateNode(e,t);return ce.isElement(n)&&b.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=Za.get(e),r=b.isEditor(t)?da.get(e):n==null?void 0:n.get(J.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(Je.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=b.node(e,t.path),r=J.toDOMNode(e,n),a;b.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],c=u.childNodes[0];if(!(c==null||c.textContent==null)){var{length:h}=c.textContent,m=u.getAttribute("data-slate-length"),p=m==null?h:parseInt(m,10),g=o+p,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var D,y=f.childNodes[0];a=[y instanceof Db?y:f,(D=f.textContent)!==null&&D!==void 0&&D.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var w=Math.min(h,Math.max(0,t.offset-o));a=[c,w];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(Je.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=V.isBackward(t),i=J.toDOMPoint(e,n),s=V.isCollapsed(t)?i:J.toDOMPoint(e,r),o=J.getWindow(e),l=o.document.createRange(),[u,c]=a?s:i,[h,m]=a?i:s,p=Ct(u)?u:u.parentElement,g=!!p.getAttribute("data-slate-zero-width"),f=Ct(h)?h:h.parentElement,D=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:c),l.setEnd(h,D?1:m),l},toSlateNode:(e,t)=>{var n=Ct(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Tr.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},toSlatePoint:(e,t,n)=>{var{exactMatch:r,suppressThrow:a}=n,[i,s]=r?t:wb(t),o=i.parentNode,l=null,u=0;if(o){var c,h,m=J.toDOMNode(e,e),p=o.closest('[data-slate-void="true"]'),g=p&&m.contains(p)?p:null,f=o.closest("[data-slate-leaf]"),D=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var y=J.getWindow(e),w=y.document.createRange();w.setStart(l,0),w.setEnd(i,s);var A=w.cloneContents(),_=[...Array.prototype.slice.call(A.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(A.querySelectorAll("[contenteditable=false]"))];_.forEach(O=>{if(ot&&!r&&O.hasAttribute("data-slate-zero-width")&&O.textContent.length>0&&O.textContext!=="\uFEFF"){O.textContent.startsWith("\uFEFF")&&(O.textContent=O.textContent.slice(1));return}O.parentNode.removeChild(O)}),u=A.textContent.length,D=l}}else if(g){for(var k=g.querySelectorAll("[data-slate-leaf]"),F=0;F<k.length;F++){var S=k[F];if(J.hasDOMNode(e,S)){f=S;break}}f?(l=f.closest('[data-slate-node="text"]'),D=f,u=D.textContent.length,D.querySelectorAll("[data-slate-zero-width]").forEach(O=>{u-=O.textContent.length})):u=1}D&&u===D.textContent.length&&ot&&D.getAttribute("data-slate-zero-width")==="z"&&(c=D.textContent)!==null&&c!==void 0&&c.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Ln&&(h=D.textContent)!==null&&h!==void 0&&h.endsWith(`
102
+ */function Yo(e){return Object.prototype.toString.call(e)==="[object Object]"}function et(e){var t,n;return Yo(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Yo(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var sd=Symbol.for("immer-nothing"),Go=Symbol.for("immer-draftable"),gt=Symbol.for("immer-state"),Vm=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 dt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Vm[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 Kn=Object.getPrototypeOf;function yn(e){return!!e&&!!e[gt]}function Dn(e){var t;return e?od(e)||Array.isArray(e)||!!e[Go]||!!((t=e.constructor)!=null&&t[Go])||Ha(e)||Ua(e):!1}var Km=Object.prototype.constructor.toString();function od(e){if(!e||typeof e!="object")return!1;const t=Kn(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)===Km}function Da(e,t){Wa(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Wa(e){const t=e[gt];return t?t.type_:Array.isArray(e)?1:Ha(e)?2:Ua(e)?3:0}function cs(e,t){return Wa(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ud(e,t,n){const r=Wa(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Zm(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ha(e){return e instanceof Map}function Ua(e){return e instanceof Set}function cn(e){return e.copy_||e.base_}function ds(e,t){if(Ha(e))return new Map(e);if(Ua(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&od(e))return Kn(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[gt];let r=Reflect.ownKeys(n);for(let a=0;a<r.length;a++){const i=r[a],s=n[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Kn(e),n)}function Ks(e,t=!1){return Va(e)||yn(e)||!Dn(e)||(Wa(e)>1&&(e.set=e.add=e.clear=e.delete=Ym),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ks(r,!0))),e}function Ym(){dt(2)}function Va(e){return Object.isFrozen(e)}var Gm={};function Cn(e){const t=Gm[e];return t||dt(0,e),t}var kr;function ld(){return kr}function Qm(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Qo(e,t){t&&(Cn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fs(e){hs(e),e.drafts_.forEach(Jm),e.drafts_=null}function hs(e){e===kr&&(kr=e.parent_)}function Jo(e){return kr=Qm(kr,e)}function Jm(e){const t=e[gt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Xo(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[gt].modified_&&(fs(t),dt(4)),Dn(e)&&(e=Ca(t,e),t.parent_||xa(t,e)),t.patches_&&Cn("Patches").generateReplacementPatches_(n[gt].base_,e,t.patches_,t.inversePatches_)):e=Ca(t,n,[]),fs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==sd?e:void 0}function Ca(e,t,n){if(Va(t))return t;const r=t[gt];if(!r)return Da(t,(a,i)=>eu(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return xa(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const a=r.copy_;let i=a,s=!1;r.type_===3&&(i=new Set(a),a.clear(),s=!0),Da(i,(o,l)=>eu(e,r,a,o,l,n,s)),xa(e,a,!1),n&&e.patches_&&Cn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function eu(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&dt(5),yn(a)){const o=i&&t&&t.type_!==3&&!cs(t.assigned_,r)?i.concat(r):void 0,l=Ca(e,a,o);if(ud(n,r,l),yn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Dn(a)&&!Va(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ca(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&xa(e,a)}}function xa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ks(t,n)}function Xm(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ld(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=Zs;n&&(a=[r],i=_r);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var Zs={get(e,t){if(t===gt)return e;const n=cn(e);if(!cs(n,t))return ep(e,n,t);const r=n[t];return e.finalized_||!Dn(r)?r:r===di(e.base_,t)?(fi(e),e.copy_[t]=ps(r,e)):r},has(e,t){return t in cn(e)},ownKeys(e){return Reflect.ownKeys(cn(e))},set(e,t,n){const r=cd(cn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=di(cn(e),t),i=a==null?void 0:a[gt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Zm(n,a)&&(n!==void 0||cs(e.base_,t)))return!0;fi(e),ms(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 di(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,fi(e),ms(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=cn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){dt(11)},getPrototypeOf(e){return Kn(e.base_)},setPrototypeOf(){dt(12)}},_r={};Da(Zs,(e,t)=>{_r[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});_r.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&dt(13),_r.set.call(this,e,t,void 0)};_r.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&dt(14),Zs.set.call(this,e[0],t,n,e[0])};function di(e,t){const n=e[gt];return(n?cn(n):e)[t]}function ep(e,t,n){var a;const r=cd(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function cd(e,t){if(!(t in e))return;let n=Kn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Kn(n)}}function ms(e){e.modified_||(e.modified_=!0,e.parent_&&ms(e.parent_))}function fi(e){e.copy_||(e.copy_=ds(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var tp=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,c=>n.call(this,c,...u))}}typeof n!="function"&&dt(6),r!==void 0&&typeof r!="function"&&dt(7);let a;if(Dn(t)){const i=Jo(this),s=ps(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?fs(i):hs(i)}return Qo(i,r),Xo(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===sd&&(a=void 0),this.autoFreeze_&&Ks(a,!0),r){const i=[],s=[];Cn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else dt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,l=>t(l,...o));let r,a;return[this.produce(t,n,(s,o)=>{r=s,a=o}),r,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Dn(e)||dt(8),yn(e)&&(e=np(e));const t=Jo(this),n=ps(e,void 0);return n[gt].isManual_=!0,hs(t),n}finishDraft(e,t){const n=e&&e[gt];(!n||!n.isManual_)&&dt(9);const{scope_:r}=n;return Qo(r,t),Xo(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const a=t[n];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}n>-1&&(t=t.slice(n+1));const r=Cn("Patches").applyPatches_;return yn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function ps(e,t){const n=Ha(e)?Cn("MapSet").proxyMap_(e,t):Ua(e)?Cn("MapSet").proxySet_(e,t):Xm(e,t);return(t?t.scope_:ld()).drafts_.push(n),n}function np(e){return yn(e)||dt(10,e),dd(e)}function dd(e){if(!Dn(e)||Va(e))return e;const t=e[gt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ds(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ds(e,!0);return Da(n,(r,a)=>{ud(n,r,dd(a))}),t&&(t.finalized_=!1),n}var vt=new tp,Ys=vt.produce;vt.produceWithPatches.bind(vt);vt.setAutoFreeze.bind(vt);vt.setUseStrictShallowCopy.bind(vt);vt.applyPatches.bind(vt);var tu=vt.createDraft.bind(vt),nu=vt.finishDraft.bind(vt),rp={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=N.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},ap={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Ee.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},ip={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=V.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},wa=new WeakMap,Ea=new WeakMap,gr=new WeakMap,fd=new WeakMap,ru=new WeakMap,au=new WeakMap,iu=new WeakMap,N={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=N.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var a=e[r],i=t[r];if(a!==i)break;n.push(a)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return N.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return N.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return N.equals(r,a)&&i<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return N.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&N.compare(e,t)===0},isBefore(e,t){return N.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&N.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&N.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&N.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&N.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),a=e[e.length-1],i=t[t.length-1];return a!==i&&N.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!N.isAncestor(t,e)&&!N.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(N.equals(i,r)||N.endsBefore(i,r)||N.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(N.equals(s,r)||N.isAncestor(s,r))return null;N.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;N.equals(o,r)||N.endsBefore(o,r)?r[o.length-1]-=1:N.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:c}=t;if(N.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else N.endsBefore(u,r)?r[u.length-1]+=1:N.isAncestor(u,r)&&e[u.length]>=c&&(r[u.length-1]+=1,r[u.length]-=c);break}case"move_node":{var{path:h,newPath:m}=t;if(N.equals(h,m))return r;if(N.isAncestor(h,r)||N.equals(h,r)){var p=m.slice();return N.endsBefore(h,m)&&h.length<m.length&&(p[h.length-1]-=1),p.concat(r.slice(h.length))}else N.isSibling(h,m)&&(N.isAncestor(m,r)||N.equals(m,r))?N.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:N.endsBefore(m,r)||N.equals(m,r)||N.isAncestor(m,r)?(N.endsBefore(h,r)&&(r[h.length-1]-=1),r[m.length-1]+=1):N.endsBefore(h,r)&&(N.equals(m,r)&&(r[m.length-1]+=1),r[h.length-1]-=1);break}}return r}};function Br(e){"@babel/helpers - typeof";return Br=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},Br(e)}function sp(e,t){if(Br(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Br(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function op(e){var t=sp(e,"string");return Br(t)==="symbol"?t:String(t)}function ut(e,t,n){return t=op(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function su(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function or(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?su(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):su(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var up=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=oe.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of V.points(t))t[l]=Ee.transform(o,n);break}case"insert_text":{var{path:u,offset:c,text:h}=n;if(h.length===0)break;var m=oe.leaf(e,u),p=m.text.slice(0,c),g=m.text.slice(c);if(m.text=p+h+g,t)for(var[f,y]of V.points(t))t[y]=Ee.transform(f,n);break}case"merge_node":{var{path:D}=n,x=oe.get(e,D),A=N.previous(D),_=oe.get(e,A),k=oe.parent(e,D),F=D[D.length-1];if(de.isText(x)&&de.isText(_))_.text+=x.text;else if(!de.isText(x)&&!de.isText(_))_.children.push(...x.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(D,"] to nodes of different interfaces: ").concat(Je.stringify(x)," ").concat(Je.stringify(_)));if(k.children.splice(F,1),t)for(var[S,$]of V.points(t))t[$]=Ee.transform(S,n);break}case"move_node":{var{path:R,newPath:I}=n;if(N.isAncestor(R,I))throw new Error("Cannot move a path [".concat(R,"] to new path [").concat(I,"] because the destination is inside itself."));var M=oe.get(e,R),w=oe.parent(e,R),E=R[R.length-1];w.children.splice(E,1);var O=N.transform(R,n),j=oe.get(e,N.parent(O)),q=O[O.length-1];if(j.children.splice(q,0,M),t)for(var[z,re]of V.points(t))t[re]=Ee.transform(z,n);break}case"remove_node":{var{path:X}=n,v=X[X.length-1],H=oe.parent(e,X);if(H.children.splice(v,1),t)for(var[ee,B]of V.points(t)){var T=Ee.transform(ee,n);if(t!=null&&T!=null)t[B]=T;else{var W=void 0,L=void 0;for(var[U,te]of oe.texts(e))if(N.compare(te,X)===-1)W=[U,te];else{L=[U,te];break}var ne=!1;W&&L&&(N.equals(L[1],X)?ne=!N.hasPrevious(L[1]):ne=N.common(W[1],X).length<N.common(L[1],X).length),W&&!ne?(ee.path=W[1],ee.offset=W[0].text.length):L?(ee.path=L[1],ee.offset=0):t=null}}break}case"remove_text":{var{path:ie,offset:fe,text:Q}=n;if(Q.length===0)break;var pe=oe.leaf(e,ie),ge=pe.text.slice(0,fe),ke=pe.text.slice(fe+Q.length);if(pe.text=ge+ke,t)for(var[xe,_e]of V.points(t))t[_e]=Ee.transform(xe,n);break}case"set_node":{var{path:We,properties:Le,newProperties:Ue}=n;if(We.length===0)throw new Error("Cannot set properties on the root node!");var Qe=oe.get(e,We);for(var he in Ue){if(he==="children"||he==="text")throw new Error('Cannot set the "'.concat(he,'" property of nodes!'));var Te=Ue[he];Te==null?delete Qe[he]:Qe[he]=Te}for(var $e in Le)Ue.hasOwnProperty($e)||delete Qe[$e];break}case"set_selection":{var{newProperties:K}=n;if(K==null)t=K;else{if(t==null){if(!V.isRange(K))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Je.stringify(K)," when there is no current selection."));t=or({},K)}for(var se in K){var me=K[se];if(me==null){if(se==="anchor"||se==="focus")throw new Error('Cannot remove the "'.concat(se,'" selection property'));delete t[se]}else t[se]=me}}break}case"split_node":{var{path:ve,position:we,properties:Ye}=n;if(ve.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ve,"] because the root node cannot be split."));var Ge=oe.get(e,ve),mt=oe.parent(e,ve),It=ve[ve.length-1],Et;if(de.isText(Ge)){var Xe=Ge.text.slice(0,we),At=Ge.text.slice(we);Ge.text=Xe,Et=or(or({},Ye),{},{text:At})}else{var pt=Ge.children.slice(0,we),ti=Ge.children.slice(we);Ge.children=pt,Et=or(or({},Ye),{},{children:ti})}if(mt.children.splice(It+1,0,Et),t)for(var[ar,Ir]of V.points(t))t[Ir]=Ee.transform(ar,n);break}}return t},lp={transform(e,t){e.children=tu(e.children);var n=e.selection&&tu(e.selection);try{n=up(e,n,t)}finally{e.children=nu(e.children),n?e.selection=yn(n)?nu(n):n:e.selection=null}}},cp={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)}},dp={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)}},hd=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(et(r)&&et(a)){if(!hd(r,a))return!1}else if(Array.isArray(r)&&Array.isArray(a)){if(r.length!==a.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==a[i])return!1}else if(r!==a)return!1}for(var s in t)if(e[s]===void 0&&t[s]!==void 0)return!1;return!0};function fp(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Ut(e,t){if(e==null)return{};var n=fp(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var hp=["anchor","focus"];function ou(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function mp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ou(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ou(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var V={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return V.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=V.edges(e);return t},equals(e,t){return Ee.equals(e.anchor,t.anchor)&&Ee.equals(e.focus,t.focus)},includes(e,t){if(V.isRange(t)){if(V.includes(e,t.anchor)||V.includes(e,t.focus))return!0;var[n,r]=V.edges(e),[a,i]=V.edges(t);return Ee.isBefore(n,a)&&Ee.isAfter(r,i)}var[s,o]=V.edges(e),l=!1,u=!1;return Ee.isPoint(t)?(l=Ee.compare(t,s)>=0,u=Ee.compare(t,o)<=0):(l=N.compare(t,s.path)>=0,u=N.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=Ut(e,hp),[r,a]=V.edges(e),[i,s]=V.edges(t),o=Ee.isBefore(r,i)?i:r,l=Ee.isBefore(a,s)?a:s;return Ee.isBefore(l,o)?null:mp({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return Ee.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Ee.equals(t,n)},isExpanded(e){return!V.isCollapsed(e)},isForward(e){return!V.isBackward(e)},isRange(e){return et(e)&&Ee.isPoint(e.anchor)&&Ee.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=V.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ys(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=V.isCollapsed(r);V.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?V.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=Ee.transform(r.anchor,t,{affinity:i}),u=Ee.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},uu=e=>et(e)&&oe.isNodeList(e.children)&&!b.isEditor(e),ce={isAncestor(e){return et(e)&&oe.isNodeList(e.children)},isElement:uu,isElementList(e){return Array.isArray(e)&&e.every(t=>ce.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 uu(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},pp=["children"],gp=["text"],lu=new WeakMap,oe={ancestor(e,t){var n=oe.get(e,t);if(de.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(Je.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of N.ancestors(t,n)){var a=oe.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(de.isText(e))throw new Error("Cannot get the child of a text node: ".concat(Je.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Je.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=oe.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=oe.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=N.common(t,n),a=oe.get(e,r);return[a,r]},descendant(e,t){var n=oe.get(e,t);if(b.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Je.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of oe.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 oe.nodes(e,t))ce.isElement(n)&&(yield[n,r])}()},extractProps(e){if(ce.isAncestor(e)){var t=Ut(e,pp);return t}else{var t=Ut(e,gp);return t}},first(e,t){for(var n=t.slice(),r=oe.get(e,n);r&&!(de.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(de.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(Je.stringify(e)));var n=Ys({children:e.children},r=>{var[a,i]=V.edges(t),s=oe.nodes(r,{reverse:!0,pass:m=>{var[,p]=m;return!V.includes(t,p)}});for(var[,o]of s){if(!V.includes(t,o)){var l=oe.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(N.equals(o,i.path)){var c=oe.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(N.equals(o,a.path)){var h=oe.leaf(r,o);h.text=h.text.slice(a.offset)}}b.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(de.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Je.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(de.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return de.isText(e)||ce.isElement(e)||b.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=lu.get(e);if(t!==void 0)return t;var n=e.every(r=>oe.isNode(r));return lu.set(e,n),n},last(e,t){for(var n=t.slice(),r=oe.get(e,n);r&&!(de.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=oe.get(e,t);if(!de.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(Je.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of N.levels(t,n)){var a=oe.get(e,r);yield[a,r]}}()},matches(e,t){return ce.isElement(e)&&ce.isElementProps(t)&&ce.matches(e,t)||de.isText(e)&&de.isTextProps(t)&&de.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?N.isBefore(o,i):N.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!de.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;N.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=oe.get(e,o);continue}if(o.length===0)break;if(!r){var c=N.next(o);if(oe.has(e,c)){o=c,l=oe.get(e,o);continue}}if(r&&o[o.length-1]!==0){var h=N.previous(o);o=h,l=oe.get(e,o);continue}o=N.parent(o),l=oe.get(e,o),s.add(l)}}()},parent(e,t){var n=N.parent(t),r=oe.get(e,n);if(de.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 de.isText(e)?e.text:e.children.map(oe.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of oe.nodes(e,t))de.isText(n)&&(yield[n,r])}()}};function cu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ze(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Xt={isNodeOperation(e){return Xt.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!et(e))return!1;switch(e.type){case"insert_node":return N.isPath(e.path)&&oe.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&N.isPath(e.path);case"merge_node":return typeof e.position=="number"&&N.isPath(e.path)&&et(e.properties);case"move_node":return N.isPath(e.path)&&N.isPath(e.newPath);case"remove_node":return N.isPath(e.path)&&oe.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&N.isPath(e.path);case"set_node":return N.isPath(e.path)&&et(e.properties)&&et(e.newProperties);case"set_selection":return e.properties===null&&V.isRange(e.newProperties)||e.newProperties===null&&V.isRange(e.properties)||et(e.properties)&&et(e.newProperties);case"split_node":return N.isPath(e.path)&&typeof e.position=="number"&&et(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>Xt.isOperation(t))},isSelectionOperation(e){return Xt.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return Xt.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:N.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(N.equals(t,n))return e;if(N.isSibling(n,t))return ze(ze({},e),{},{path:t,newPath:n});var r=N.transform(n,e),a=N.transform(N.next(n),e);return ze(ze({},e),{},{path:r,newPath:a})}case"remove_node":return ze(ze({},e),{},{type:"insert_node"});case"remove_text":return ze(ze({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return ze(ze({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?ze(ze({},e),{},{properties:l,newProperties:null}):l==null?ze(ze({},e),{},{properties:null,newProperties:o}):ze(ze({},e),{},{properties:l,newProperties:o})}case"split_node":return ze(ze({},e),{},{type:"merge_node",path:N.next(e.path)})}}},du=new WeakMap,vp=e=>{var t=du.get(e);if(t!==void 0)return t;if(!et(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||et(e.marks))&&(e.selection===null||V.isRange(e.selection))&&oe.isNodeList(e.children)&&Xt.isOperationList(e.operations);return du.set(e,n),n},b={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 vp(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)}},bp={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(N.isPath)}};function fu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function hu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ee={compare(e,t){var n=N.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return Ee.compare(e,t)===1},isBefore(e,t){return Ee.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&N.equals(e.path,t.path)},isPoint(e){return et(e)&&typeof e.offset=="number"&&N.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ys(e,r=>{if(r===null)return null;var{affinity:a="forward"}=n,{path:i,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=N.transform(i,t,n);break}case"insert_text":{N.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{N.equals(t.path,i)&&(r.offset+=t.position),r.path=N.transform(i,t,n);break}case"remove_text":{N.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(N.equals(t.path,i)||N.isAncestor(t.path,i))return null;r.path=N.transform(i,t,n);break}case"split_node":{if(N.equals(t.path,i)){if(t.position===s&&a==null)return null;(t.position<s||t.position===s&&a==="forward")&&(r.offset-=t.position,r.path=N.transform(i,t,hu(hu({},n),{},{affinity:"forward"})))}else r.path=N.transform(i,t,n);break}}})}},mu=void 0,Je={setScrubber(e){mu=e},stringify(e){return JSON.stringify(e,mu)}},yp=["text"],Dp=["anchor","focus"];function pu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Lt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var de={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Ut(i,yp);return s}return hd(r?a(e):e,r?a(t):t)},isText(e){return et(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>de.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=[Lt({},e)];for(var r of t){var a=Ut(r,Dp),[i,s]=V.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var h of n){var{length:m}=h.text,p=l;if(l+=m,u<=p&&l<=c){Object.assign(h,a),o.push(h);continue}if(u!==c&&(u===l||c===p)||u>l||c<p||c===p&&p!==0){o.push(h);continue}var g=h,f=void 0,y=void 0;if(c<l){var D=c-p;y=Lt(Lt({},g),{},{text:g.text.slice(D)}),g=Lt(Lt({},g),{},{text:g.text.slice(0,D)})}if(u>p){var x=u-p;f=Lt(Lt({},g),{},{text:g.text.slice(0,x)}),g=Lt(Lt({},g),{},{text:g.text.slice(x)})}Object.assign(g,a),f&&o.push(f),o.push(g),y&&o.push(y)}n=o}return n}},Gs=e=>e.selection?e.selection:e.children.length>0?b.end(e,[]):[0],rr=(e,t)=>{var[n]=b.node(e,t);return r=>r===n},Qs=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?_p(t):t,i=Ce.None,s=Ce.None,o=0,l=null,u=null;for(var c of a){var h=c.codePointAt(0);if(!h)break;var m=Ip(c,h);if([i,s]=r?[s,m]:[m,i],Mn(i,Ce.ZWJ)&&Mn(s,Ce.ExtPict)&&(r?l=gu(t.substring(0,o)):l=gu(t.substring(0,t.length-o)),!l)||Mn(i,Ce.RI)&&Mn(s,Ce.RI)&&(u!==null?u=!u:r?u=!0:u=Wp(t.substring(0,t.length-o)),!u)||i!==Ce.None&&s!==Ce.None&&Lp(i,s))break;o+=c.length}return o||1},Cp=/\s/,xp=/[\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]/,wp=/['\u2018\u2019]/,Ep=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=Qs(t,n),[s,o]=Js(t,i,n);if(kp(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Js=(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)]},kp=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(Cp.test(t))return!1;if(wp.test(t)){var a=Qs(n,r),[i,s]=Js(n,a,r);if(e(i,s,r))return!0}return!xp.test(t)},_p=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(Ap(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(Bp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},Bp=e=>e>=55296&&e<=56319,Ap=e=>e>=56320&&e<=57343,Ce;(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"})(Ce||(Ce={}));var Fp=/^(?:[\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])$/,Tp=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,Sp=/^(?:[\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])$/,jp=/^[\u1100-\u115F\uA960-\uA97C]$/,Op=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,Pp=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,Np=/^[\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]$/,Rp=/^[\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]$/,Mp=/^(?:[\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])$/,Ip=(e,t)=>{var n=Ce.Any;return e.search(Fp)!==-1&&(n|=Ce.Extend),t===8205&&(n|=Ce.ZWJ),t>=127462&&t<=127487&&(n|=Ce.RI),e.search(Tp)!==-1&&(n|=Ce.Prepend),e.search(Sp)!==-1&&(n|=Ce.SpacingMark),e.search(jp)!==-1&&(n|=Ce.L),e.search(Op)!==-1&&(n|=Ce.V),e.search(Pp)!==-1&&(n|=Ce.T),e.search(Np)!==-1&&(n|=Ce.LV),e.search(Rp)!==-1&&(n|=Ce.LVT),e.search(Mp)!==-1&&(n|=Ce.ExtPict),n};function Mn(e,t){return(e&t)!==0}var $p=[[Ce.L,Ce.L|Ce.V|Ce.LV|Ce.LVT],[Ce.LV|Ce.V,Ce.V|Ce.T],[Ce.LVT|Ce.T,Ce.T],[Ce.Any,Ce.Extend|Ce.ZWJ],[Ce.Any,Ce.SpacingMark],[Ce.Prepend,Ce.Any],[Ce.ZWJ,Ce.ExtPict],[Ce.RI,Ce.RI]];function Lp(e,t){return $p.findIndex(n=>Mn(e,n[0])&&Mn(t,n[1]))===-1}var zp=/(?:[\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$/,gu=e=>e.search(zp)!==-1,qp=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Wp=e=>{var t=e.match(qp);if(t===null)return!1;var n=t[0].length/2;return n%2===1},Hp={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]:{};b.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=Gs(e)}=n;if(N.isPath(a)&&(a=b.range(e,a)),V.isRange(a))if(V.isCollapsed(a))a=a.anchor;else{var i=V.end(a);if(!r&&b.void(e,{at:i}))return;var s=V.start(a),o=b.pointRef(e,s),l=b.pointRef(e,i);G.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,G.setSelection(e,{anchor:a,focus:a})}if(!(!r&&b.void(e,{at:a})||b.elementReadOnly(e,{at:a}))){var{path:h,offset:m}=a;t.length>0&&e.apply({type:"insert_text",path:h,offset:m,text:t})}})}};function vu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Wr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var G=Wr(Wr(Wr(Wr({},lp),cp),dp),Hp),ua=new WeakMap,Up=e=>ua.get(e)||!1,Vp=(e,t,n)=>{var r=ua.get(e)||!1;ua.set(e,!0);try{t(),n()}finally{ua.set(e,r)}};function md(e,t,n){var r=wa.get(e)||[],a=Ea.get(e)||new Set,i,s,o=h=>{if(h){var m=h.join(",");s.has(m)||(s.add(m),i.push(h))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var c of t)o(c);wa.set(e,i),Ea.set(e,s)}var Kp=(e,t)=>{for(var n of b.pathRefs(e))rp.transform(n,t);for(var r of b.pointRefs(e))ap.transform(r,t);for(var a of b.rangeRefs(e))ip.transform(a,t);if(!Up(e)){var i=N.operationCanTransformPath(t)?s=>N.transform(s,t):void 0;md(e,e.getDirtyPaths(t),i)}G.transform(e,t),e.operations.push(t),b.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),gr.get(e)||(gr.set(e,!0),Promise.resolve().then(()=>{gr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Zp=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return N.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=N.levels(a),s=de.isText(r)?[]:Array.from(oe.nodes(r),I=>{var[,M]=I;return a.concat(M)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=N.ancestors(o),u=N.previous(o);return[...l,u]}case"move_node":{var{path:c,newPath:h}=t;if(N.equals(c,h))return[];var m=[],p=[];for(var g of N.ancestors(c)){var f=N.transform(g,t);m.push(f)}for(var y of N.ancestors(h)){var D=N.transform(y,t);p.push(D)}var x=p[p.length-1],A=h[h.length-1],_=x.concat(A);return[...m,...p,_]}case"remove_node":{var{path:k}=t,F=N.ancestors(k);return[...F]}case"split_node":{var{path:S}=t,$=N.levels(S),R=N.next(S);return[...$,R]}default:return[]}},Yp=e=>{var{selection:t}=e;return t?oe.fragment(e,t):[]},Gp=(e,t)=>{var[n,r]=t;if(!de.isText(n)){if(ce.isElement(n)&&n.children.length===0){var a={text:""};G.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=b.isEditor(n)?!1:ce.isElement(n)&&(e.isInline(n)||n.children.length===0||de.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=oe.get(e,r);if(!de.isText(l)){var u=l.children[s],c=l.children[s-1],h=o===n.children.length-1,m=de.isText(u)||ce.isElement(u)&&e.isInline(u);if(m!==i)G.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(ce.isElement(u)){if(e.isInline(u)){if(c==null||!de.isText(c)){var p={text:""};G.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(h){var g={text:""};G.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&de.isText(c)&&(de.equals(u,c,{loose:!0})?(G.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(G.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(G.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Qp=(e,t)=>{var{iteration:n,initialDirtyPathsLength:r}=t,a=r*42;if(n>a)throw new Error("Could not completely normalize the editor after ".concat(a," iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state."));return!0},Jp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:s}=n;if(i){var o=b.path(t,i),l=a==="lowest";for(var[u,c]of b.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!de.isText(u)){if(V.isRange(i)){if(N.isAncestor(c,i.anchor.path)&&N.isAncestor(c,i.focus.path))return[u,c]}else if(!N.equals(o,c))return[u,c]}}};function bu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function yu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Xp=(e,t,n)=>{var{selection:r}=e;if(r){var a=(h,m)=>{if(!de.isText(h))return!1;var[p,g]=b.parent(e,m);return!e.isVoid(p)||e.markableVoid(p)},i=V.isExpanded(r),s=!1;if(!i){var[o,l]=b.node(e,r);if(o&&a(o,l)){var[u]=b.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)G.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=yu(yu({},b.marks(e)||{}),{},{[t]:n});e.marks=c,gr.get(e)||e.onChange()}}};function Du(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Cu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Du(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Du(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var eg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.point(t,n,{edge:"end"}),i=b.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of b.positions(t,Cu(Cu({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};function xu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function wu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var tg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.start(t,[]),i=b.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of b.positions(t,wu(wu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},ng=(e,t)=>{var{selection:n}=e;n&&V.isCollapsed(n)&&G.delete(e,{unit:t,reverse:!0})},rg=(e,t)=>{var{selection:n}=e;n&&V.isCollapsed(n)&&G.delete(e,{unit:t})},ag=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&V.isExpanded(r)&&G.delete(t,{reverse:n==="backward"})},ig=(e,t)=>[b.start(e,t),b.end(e,t)];function Eu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ku(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Eu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Eu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var sg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,ku(ku({},n),{},{match:r=>ce.isElement(r)&&b.isElementReadOnly(t,r)}))},og=(e,t)=>b.point(e,t,{edge:"end"}),ug=(e,t)=>{var n=b.path(e,t,{edge:"start"});return b.node(e,n)},lg=(e,t)=>{var n=b.range(e,t);return oe.fragment(e,n)};function _u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Bu(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){ut(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}var cg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,Bu(Bu({},n),{},{match:r=>ce.isElement(r)&&b.isVoid(t,r)}))},dg=(e,t)=>t.children.some(n=>ce.isElement(n)&&b.isBlock(e,n)),fg=(e,t)=>t.children.some(n=>de.isText(n)||b.isInline(e,n)),hg=(e,t)=>oe.has(e,t),mg=(e,t)=>t.children.every(n=>de.isText(n)),pg=e=>{G.splitNodes(e,{always:!0})},gg=(e,t,n)=>{G.insertNodes(e,t,n)},vg=e=>{G.splitNodes(e,{always:!0})};function Au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function bg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Au(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Au(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var yg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a,marks:i}=t;if(a){if(i){var s=bg({text:n},i);G.insertNodes(t,s,{at:r.at,voids:r.voids})}else G.insertText(t,n,r);t.marks=null}},Dg=(e,t)=>!e.isInline(t),Cg=(e,t,n)=>b.isStart(e,t,n)||b.isEnd(e,t,n),xg=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&de.isText(r)&&r.text===""&&!e.isVoid(t)},wg=(e,t,n)=>{var r=b.end(e,n);return Ee.equals(t,r)},Eg=e=>{var t=fd.get(e);return t===void 0?!0:t},kg=(e,t,n)=>{if(t.offset!==0)return!1;var r=b.start(e,n);return Ee.equals(t,r)},_g=(e,t)=>{var n=b.path(e,t,{edge:"end"});return b.node(e,n)},Bg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=oe.leaf(t,a);return[i,a]};function Ag(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var s=[],o=b.path(e,n);for(var[l,u]of oe.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&ce.isElement(l)&&b.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var Fg=["text"],Tg=["text"],Sg=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(V.isExpanded(r)){var s=b.isEnd(t,a,a.path);if(s){var o=b.after(t,a);o&&(a=o)}var[l]=b.nodes(t,{match:de.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=Ut(u,Fg);return c}else return{}}var{path:h}=a,[m]=b.leaf(t,h);if(a.offset===0){var p=b.previous(t,{at:h,match:de.isText}),g=b.above(t,{match:_=>ce.isElement(_)&&b.isVoid(t,_)&&t.markableVoid(_)});if(!g){var f=b.above(t,{match:_=>ce.isElement(_)&&b.isBlock(t,_)});if(p&&f){var[y,D]=p,[,x]=f;N.isAncestor(x,D)&&(m=y)}}}var A=Ut(m,Tg);return A},jg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=b.after(t,s,{voids:a});if(o){var[,l]=b.last(t,[]),u=[o.path,l];if(N.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(N.isPath(s)){var[c]=b.parent(t,s);i=m=>c.children.includes(m)}else i=()=>!0;var[h]=b.nodes(t,{at:u,match:i,mode:r,voids:a});return h}}},Og=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=oe.get(t,a);return[i,a]};function Pg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,c;if(bp.isSpan(n))u=n[0],c=n[1];else{var h=b.path(e,n,{edge:"start"}),m=b.path(e,n,{edge:"end"});u=i?m:h,c=i?h:m}var p=oe.nodes(e,{reverse:i,from:u,to:c,pass:_=>{var[k]=_;return ce.isElement(k)?!!(!s&&(b.isVoid(e,k)||b.isElementReadOnly(e,k))||o&&!b.isSelectable(e,k)):!1}}),g=[],f;for(var[y,D]of p)if(!(o&&ce.isElement(y)&&!b.isSelectable(e,y))){var x=f&&N.compare(D,f[1])===0;if(!(r==="highest"&&x)){if(!l(y,D)){if(a&&!x&&de.isText(y))return;continue}if(r==="lowest"&&x){f=[y,D];continue}var A=r==="lowest"?f:[y,D];A&&(a?g.push(A):yield A),f=[y,D]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var Ng=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>wa.get(c)||[],s=c=>Ea.get(c)||new Set,o=c=>{var h=i(c).pop(),m=h.join(",");return s(c).delete(m),h};if(b.isNormalizing(t)){if(r){var l=Array.from(oe.nodes(t),c=>{var[,h]=c;return h}),u=new Set(l.map(c=>c.join(",")));wa.set(t,l),Ea.set(t,u)}i(t).length!==0&&b.withoutNormalizing(t,()=>{for(var c of i(t))if(oe.has(t,c)){var h=b.node(t,c),[m,p]=h;ce.isElement(m)&&m.children.length===0&&t.normalizeNode(h,{operation:a})}for(var g=i(t),f=g.length,y=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:y,initialDirtyPathsLength:f,operation:a}))return;var D=o(t);if(oe.has(t,D)){var x=b.node(t,D);t.normalizeNode(x,{operation:a})}y++,g=i(t)}})}},Rg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=N.parent(a),s=b.node(t,i);return s},Mg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.pathRefs(t);return l.delete(i),i.current=null,o}},s=b.pathRefs(t);return s.add(i),i},Ig=e=>{var t=ru.get(e);return t||(t=new Set,ru.set(e,t)),t},$g=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(N.isPath(n)){if(i==="start"){var[,s]=oe.first(t,n);n=s}else if(i==="end"){var[,o]=oe.last(t,n);n=o}}return V.isRange(n)&&(i==="start"?n=V.start(n):i==="end"?n=V.end(n):n=N.common(n.anchor.path,n.focus.path)),Ee.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},Lg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.pointRefs(t);return l.delete(i),i.current=null,o}},s=b.pointRefs(t);return s.add(i),i},zg=e=>{var t=au.get(e);return t||(t=new Set,au.set(e,t)),t},qg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(N.isPath(n)){var i;if(a==="end"){var[,s]=oe.last(t,n);i=s}else{var[,o]=oe.first(t,n);i=o}var l=oe.get(t,i);if(!de.isText(l))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?l.text.length:0}}if(V.isRange(n)){var[u,c]=V.edges(n);return a==="start"?u:c}return n};function Wg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:a=!1,voids:i=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=b.range(e,n),[l,u]=V.edges(o),c=a?u:l,h=!1,m="",p=0,g=0,f=0;for(var[y,D]of b.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(ce.isElement(y)){if(!i&&(e.isVoid(y)||e.isElementReadOnly(y))){yield b.start(e,D);continue}if(e.isInline(y))continue;if(b.hasInlines(e,y)){var x=N.isAncestor(D,u.path)?u:b.end(e,D),A=N.isAncestor(D,l.path)?l:b.start(e,D);m=b.string(e,{anchor:A,focus:x},{voids:i}),h=!0}}if(de.isText(y)){var _=N.equals(D,c.path);for(_?(g=a?c.offset:y.text.length-c.offset,f=c.offset):(g=y.text.length,f=a?g:0),(_||h||r==="offset")&&(yield{path:D,offset:f},h=!1);;){if(p===0){if(m==="")break;p=k(m,r,a),m=Js(m,p,a)[1]}if(f=a?f-p:f+p,g=g-p,g<0){p=-g;break}p=0,yield{path:D,offset:f}}}}function k(F,S,$){return S==="character"?Qs(F,$):S==="word"?Ep(F,$):S==="line"||S==="block"?F.length:1}}()}var Hg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=b.before(t,s,{voids:a});if(o){var[,l]=b.first(t,[]),u=[o.path,l];if(N.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(N.isPath(s)){var[c]=b.parent(t,s);i=m=>c.children.includes(m)}else i=()=>!0;var[h]=b.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return h}}},Ug=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.rangeRefs(t);return l.delete(i),i.current=null,o}},s=b.rangeRefs(t);return s.add(i),i},Vg=e=>{var t=iu.get(e);return t||(t=new Set,iu.set(e,t)),t},Kg=(e,t,n)=>{if(V.isRange(t)&&!n)return t;var r=b.start(e,t),a=b.end(e,n||t);return{anchor:r,focus:a}};function Fu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Zg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Fu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Yg=(e,t)=>{var{selection:n}=e;if(n){var r=(c,h)=>{if(!de.isText(c))return!1;var[m,p]=b.parent(e,h);return!e.isVoid(m)||e.markableVoid(m)},a=V.isExpanded(n),i=!1;if(!a){var[s,o]=b.node(e,n);if(s&&r(s,o)){var[l]=b.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)G.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Zg({},b.marks(e)||{});delete u[t],e.marks=u,gr.get(e)||e.onChange()}}},Gg=(e,t)=>{fd.set(e,t)},Qg=(e,t)=>b.point(e,t,{edge:"start"}),Jg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=b.range(t,n),[s,o]=V.edges(i),l="";for(var[u,c]of b.nodes(t,{at:i,match:de.isText,voids:a})){var h=u.text;N.equals(c,o.path)&&(h=h.slice(0,o.offset)),N.equals(c,s.path)&&(h=h.slice(s.offset)),l+=h}return l},Xg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=V.edges(n);if(i.offset!==0||s.offset!==0||V.isCollapsed(n)||N.hasPrevious(s.path))return n;var o=b.above(t,{at:s,match:g=>ce.isElement(g)&&b.isBlock(t,g),voids:a}),l=o?o[1]:[],u=b.start(t,i),c={anchor:u,focus:s},h=!0;for(var[m,p]of b.nodes(t,{at:c,match:de.isText,reverse:!0,voids:a})){if(h){h=!1;continue}if(m.text!==""||N.isBefore(p,l)){s={path:p,offset:m.text.length};break}}return{anchor:i,focus:s}},ev=(e,t)=>{var n=b.isNormalizing(e);b.setNormalizing(e,!1);try{t()}finally{b.setNormalizing(e,n)}b.normalize(e)},tv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:c=!1}=n;if(u){var h=!1;if(V.isRange(u)&&V.isCollapsed(u)&&(h=!0,u=u.anchor),Ee.isPoint(u)){var m=b.void(t,{at:u,mode:"highest"});if(!l&&m){var[,p]=m;u=p}else{var g={unit:s,distance:o},f=i?b.before(t,u,g)||b.start(t,[]):b.after(t,u,g)||b.end(t,[]);u={anchor:u,focus:f},c=!0}}if(N.isPath(u)){G.removeNodes(t,{at:u,voids:l});return}if(!V.isCollapsed(u)){if(!c){var[,y]=V.edges(u),D=b.end(t,[]);Ee.equals(y,D)||(u=b.unhangRange(t,u,{voids:l}))}var[x,A]=V.edges(u),_=b.above(t,{match:ge=>ce.isElement(ge)&&b.isBlock(t,ge),at:x,voids:l}),k=b.above(t,{match:ge=>ce.isElement(ge)&&b.isBlock(t,ge),at:A,voids:l}),F=_&&k&&!N.equals(_[1],k[1]),S=N.equals(x.path,A.path),$=l?null:(r=b.void(t,{at:x,mode:"highest"}))!==null&&r!==void 0?r:b.elementReadOnly(t,{at:x,mode:"highest"}),R=l?null:(a=b.void(t,{at:A,mode:"highest"}))!==null&&a!==void 0?a:b.elementReadOnly(t,{at:A,mode:"highest"});if($){var I=b.before(t,x);I&&_&&N.isAncestor(_[1],I.path)&&(x=I)}if(R){var M=b.after(t,A);M&&k&&N.isAncestor(k[1],M.path)&&(A=M)}var w=[],E;for(var O of b.nodes(t,{at:u,voids:l})){var[j,q]=O;E&&N.compare(q,E)===0||(!l&&ce.isElement(j)&&(b.isVoid(t,j)||b.isElementReadOnly(t,j))||!N.isCommon(q,x.path)&&!N.isCommon(q,A.path))&&(w.push(O),E=q)}var z=Array.from(w,ge=>{var[,ke]=ge;return b.pathRef(t,ke)}),re=b.pointRef(t,x),X=b.pointRef(t,A),v="";if(!S&&!$){var H=re.current,[ee]=b.leaf(t,H),{path:B}=H,{offset:T}=x,W=ee.text.slice(T);W.length>0&&(t.apply({type:"remove_text",path:B,offset:T,text:W}),v=W)}if(z.reverse().map(ge=>ge.unref()).filter(ge=>ge!==null).forEach(ge=>G.removeNodes(t,{at:ge,voids:l})),!R){var L=X.current,[U]=b.leaf(t,L),{path:te}=L,ne=S?x.offset:0,ie=U.text.slice(ne,A.offset);ie.length>0&&(t.apply({type:"remove_text",path:te,offset:ne,text:ie}),v=ie)}!S&&F&&X.current&&re.current&&G.mergeNodes(t,{at:X.current,hanging:!0,voids:l}),h&&i&&s==="character"&&v.length>1&&v.match(/[\u0E00-\u0E7F]+/)&&G.insertText(t,v.slice(0,v.length-o));var fe=re.unref(),Q=X.unref(),pe=i?fe||Q:Q||fe;n.at==null&&pe&&G.select(t,pe)}}})},nv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=Gs(t),batchDirty:o=!0}=r;if(n.length){if(V.isRange(s))if(a||(s=b.unhangRange(t,s,{voids:i})),V.isCollapsed(s))s=s.anchor;else{var[,l]=V.edges(s);if(!i&&b.void(t,{at:l}))return;var u=b.pointRef(t,l);G.delete(t,{at:s}),s=u.unref()}else N.isPath(s)&&(s=b.start(t,s));if(!(!i&&b.void(t,{at:s}))){var c=b.above(t,{at:s,match:W=>ce.isElement(W)&&b.isInline(t,W),mode:"highest",voids:i});if(c){var[,h]=c;if(b.isEnd(t,s,h)){var m=b.after(t,h);s=m}else if(b.isStart(t,s,h)){var p=b.before(t,h);s=p}}var g=b.above(t,{match:W=>ce.isElement(W)&&b.isBlock(t,W),at:s,voids:i}),[,f]=g,y=b.isStart(t,s,f),D=b.isEnd(t,s,f),x=y&&D,A=!y||y&&D,_=!D,[,k]=oe.first({children:n},[]),[,F]=oe.last({children:n},[]),S=[],$=W=>{var[L,U]=W,te=U.length===0;return te?!1:x?!0:!(A&&N.isAncestor(U,k)&&ce.isElement(L)&&!t.isVoid(L)&&!t.isInline(L)||_&&N.isAncestor(U,F)&&ce.isElement(L)&&!t.isVoid(L)&&!t.isInline(L))};for(var R of oe.nodes({children:n},{pass:$}))$(R)&&S.push(R);var I=[],M=[],w=[],E=!0,O=!1;for(var[j]of S)ce.isElement(j)&&!t.isInline(j)?(E=!1,O=!0,M.push(j)):E?I.push(j):w.push(j);var[q]=b.nodes(t,{at:s,match:W=>de.isText(W)||b.isInline(t,W),mode:"highest",voids:i}),[,z]=q,re=b.isStart(t,s,z),X=b.isEnd(t,s,z),v=b.pathRef(t,D&&!w.length?N.next(f):f),H=b.pathRef(t,X?N.next(z):z);G.splitNodes(t,{at:s,match:W=>O?ce.isElement(W)&&b.isBlock(t,W):de.isText(W)||b.isInline(t,W),mode:O?"lowest":"highest",always:O&&(!y||I.length>0)&&(!D||w.length>0),voids:i});var ee=b.pathRef(t,!re||re&&X?N.next(z):z);if(G.insertNodes(t,I,{at:ee.current,match:W=>de.isText(W)||b.isInline(t,W),mode:"highest",voids:i,batchDirty:o}),x&&!I.length&&M.length&&!w.length&&G.delete(t,{at:f,voids:i}),G.insertNodes(t,M,{at:v.current,match:W=>ce.isElement(W)&&b.isBlock(t,W),mode:"lowest",voids:i,batchDirty:o}),G.insertNodes(t,w,{at:H.current,match:W=>de.isText(W)||b.isInline(t,W),mode:"highest",voids:i,batchDirty:o}),!r.at){var B;if(w.length>0&&H.current?B=N.previous(H.current):M.length>0&&v.current?B=N.previous(v.current):ee.current&&(B=N.previous(ee.current)),B){var T=b.end(t,B);G.select(t,T)}}ee.unref(),v.unref(),H.unref()}}})},rv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")G.select(t,a.anchor);else if(r==="focus")G.select(t,a.focus);else if(r==="start"){var[i]=V.edges(a);G.select(t,i)}else if(r==="end"){var[,s]=V.edges(a);G.select(t,s)}}else return},av=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},iv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:a=1,unit:i="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=V.isBackward(r)?"focus":"anchor"),o==="end"&&(o=V.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,c={distance:a,unit:i,ignoreNonSelectable:!0},h={};if(o==null||o==="anchor"){var m=s?b.before(t,l,c):b.after(t,l,c);m&&(h.anchor=m)}if(o==null||o==="focus"){var p=s?b.before(t,u,c):b.after(t,u,c);p&&(h.focus=p)}G.setSelection(t,h)}},sv=(e,t)=>{var{selection:n}=e;if(t=b.range(e,t),n){G.setSelection(e,t);return}if(!V.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(Je.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function Tu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Su(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Tu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ov=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a}=t,{edge:i="both"}=r;if(a){i==="start"&&(i=V.isBackward(a)?"focus":"anchor"),i==="end"&&(i=V.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;G.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Su(Su({},l),n)})}},uv=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!Ee.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!Ee.equals(t.focus,n.focus)||i!=="anchor"&&i!=="focus"&&t[i]!==n[i])&&(r[i]=n[i],a[i]=t[i]);Object.keys(r).length>0&&e.apply({type:"set_selection",properties:r,newProperties:a})}},lv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:c}=r;if(oe.isNode(n)&&(n=[n]),n.length!==0){var[h]=n;if(l||(l=Gs(t),c!==!1&&(c=!0)),c==null&&(c=!1),V.isRange(l))if(a||(l=b.unhangRange(t,l,{voids:i})),V.isCollapsed(l))l=l.anchor;else{var[,m]=V.edges(l),p=b.pointRef(t,m);G.delete(t,{at:l}),l=p.unref()}if(Ee.isPoint(l)){u==null&&(de.isText(h)?u=I=>de.isText(I):t.isInline(h)?u=I=>de.isText(I)||b.isInline(t,I):u=I=>ce.isElement(I)&&b.isBlock(t,I));var[g]=b.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,y=b.pathRef(t,f),D=b.isEnd(t,l,f);G.splitNodes(t,{at:l,match:u,mode:s,voids:i});var x=y.unref();l=D?N.next(x):x}else return}var A=N.parent(l),_=l[l.length-1];if(!(!i&&b.void(t,{at:A}))){if(o){var k=[],F=N.levels(A);Vp(t,()=>{var I=function(){var E=A.concat(_);_++;var O={type:"insert_node",path:E,node:M};t.apply(O),l=N.next(l),k.push(O),de.isText?F.push(...Array.from(oe.nodes(M),j=>{var[,q]=j;return E.concat(q)})):F.push(E)};for(var M of n)I()},()=>{md(t,F,I=>{var M=I;for(var w of k)if(N.operationCanTransformPath(w)&&(M=N.transform(M,w),!M))return null;return M})})}else for(var S of n){var $=A.concat(_);_++,t.apply({type:"insert_node",path:$,node:S}),l=N.next(l)}if(l=N.previous(l),c){var R=b.end(t,l);R&&G.select(t,R)}}}})},cv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=N.isPath(r)?rr(t,r):_=>ce.isElement(_)&&b.isBlock(t,_)),!!r){var o=b.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,_=>{var[,k]=_;return b.pathRef(t,k)});for(var u of l){var c=u.unref();if(c.length<2)throw new Error("Cannot lift node at a path [".concat(c,"] because it has a depth of less than `2`."));var h=b.node(t,N.parent(c)),[m,p]=h,g=c[c.length-1],{length:f}=m.children;if(f===1){var y=N.next(p);G.moveNodes(t,{at:c,to:y,voids:i}),G.removeNodes(t,{at:p,voids:i})}else if(g===0)G.moveNodes(t,{at:c,to:p,voids:i});else if(g===f-1){var D=N.next(p);G.moveNodes(t,{at:c,to:D,voids:i})}else{var x=N.next(c),A=N.next(p);G.splitNodes(t,{at:x,voids:i}),G.moveNodes(t,{at:c,to:A,voids:i})}}}})},dv=["text"],fv=["children"],pd=(e,t)=>{if(ce.isElement(t)){var n=t;return b.isVoid(e,t)?!0:n.children.length===1?pd(e,n.children[0]):!1}else return!b.isEditor(t)},hv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(N.isPath(a)){var[l]=b.parent(t,a);r=I=>l.children.includes(I)}else r=I=>ce.isElement(I)&&b.isBlock(t,I);if(!i&&V.isRange(a)&&(a=b.unhangRange(t,a,{voids:s})),V.isRange(a))if(V.isCollapsed(a))a=a.anchor;else{var[,u]=V.edges(a),c=b.pointRef(t,u);G.delete(t,{at:a}),a=c.unref(),n.at==null&&G.select(t,a)}var[h]=b.nodes(t,{at:a,match:r,voids:s,mode:o}),m=b.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!h||!m)){var[p,g]=h,[f,y]=m;if(!(g.length===0||y.length===0)){var D=N.next(y),x=N.common(g,y),A=N.isSibling(g,y),_=Array.from(b.levels(t,{at:g}),I=>{var[M]=I;return M}).slice(x.length).slice(0,-1),k=b.above(t,{at:g,mode:"highest",match:I=>_.includes(I)&&pd(t,I)}),F=k&&b.pathRef(t,k[1]),S,$;if(de.isText(p)&&de.isText(f)){var R=Ut(p,dv);$=f.text.length,S=R}else if(ce.isElement(p)&&ce.isElement(f)){var R=Ut(p,fv);$=f.children.length,S=R}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(Je.stringify(p)," ").concat(Je.stringify(f)));A||G.moveNodes(t,{at:g,to:D,voids:s}),F&&G.removeNodes(t,{at:F.current,voids:s}),ce.isElement(f)&&b.isEmpty(t,f)||de.isText(f)&&f.text===""&&y[y.length-1]!==0?G.removeNodes(t,{at:y,voids:s}):t.apply({type:"merge_node",path:D,position:$,properties:S}),F&&F.unref()}}}})},mv=(e,t)=>{b.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=N.isPath(r)?rr(e,r):p=>ce.isElement(p)&&b.isBlock(e,p));var o=b.pathRef(e,n),l=b.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,p=>{var[,g]=p;return b.pathRef(e,g)});for(var c of u){var h=c.unref(),m=o.current;h.length!==0&&e.apply({type:"move_node",path:h,newPath:m}),o.current&&N.isSibling(m,h)&&N.isAfter(m,h)&&(o.current=N.next(o.current))}o.unref()}})},pv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=N.isPath(s)?rr(t,s):p=>ce.isElement(p)&&b.isBlock(t,p)),!r&&V.isRange(s)&&(s=b.unhangRange(t,s,{voids:a}));var l=b.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,p=>{var[,g]=p;return b.pathRef(t,g)});for(var c of u){var h=c.unref();if(h){var[m]=b.node(t,h);t.apply({type:"remove_node",path:h,node:m})}}}})},gv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:c=!1,voids:h=!1}=r;if(i){if(a==null&&(a=N.isPath(i)?rr(t,i):$=>ce.isElement($)&&b.isBlock(t,$)),!l&&V.isRange(i)&&(i=b.unhangRange(t,i,{voids:h})),c&&V.isRange(i)){if(V.isCollapsed(i)&&b.leaf(t,i.anchor)[0].text.length>0)return;var m=b.rangeRef(t,i,{affinity:"inward"}),[p,g]=V.edges(i),f=u==="lowest"?"lowest":"highest",y=b.isEnd(t,g,g.path);G.splitNodes(t,{at:g,match:a,mode:f,voids:h,always:!y});var D=b.isStart(t,p,p.path);G.splitNodes(t,{at:p,match:a,mode:f,voids:h,always:!D}),i=m.unref(),r.at==null&&G.select(t,i)}s||(s=($,R)=>$!==R);for(var[x,A]of b.nodes(t,{at:i,match:a,mode:u,voids:h})){var _={},k={};if(A.length!==0){var F=!1;for(var S in n)S==="children"||S==="text"||s(n[S],x[S])&&(F=!0,x.hasOwnProperty(S)&&(_[S]=x[S]),o?n[S]!=null&&(k[S]=o(x[S],n[S])):n[S]!=null&&(k[S]=n[S]));F&&t.apply({type:"set_node",path:A,properties:_,newProperties:k})}}}})},vv=(e,t)=>{if(V.isCollapsed(t))return t.anchor;var[,n]=V.edges(t),r=b.pointRef(e,n);return G.delete(e,{at:t}),r.unref()},bv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=X=>ce.isElement(X)&&b.isBlock(t,X)),V.isRange(s)&&(s=vv(t,s)),N.isPath(s)){var u=s,c=b.point(t,u),[h]=b.parent(t,u);i=X=>X===h,o=c.path.length-u.length+1,s=c,l=!0}if(s){var m=b.pointRef(t,s,{affinity:"backward"}),p;try{var[g]=b.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=b.void(t,{at:s,mode:"highest"}),y=0;if(!a&&f){var[D,x]=f;if(ce.isElement(D)&&t.isInline(D)){var A=b.after(t,x);if(!A){var _={text:""},k=N.next(x);G.insertNodes(t,_,{at:k,voids:a}),A=b.point(t,k)}s=A,l=!0}var F=s.path.length-x.length;o=F+1,l=!0}p=b.pointRef(t,s);var S=s.path.length-o,[,$]=g,R=s.path.slice(0,S),I=o===0?s.offset:s.path[S]+y;for(var[M,w]of b.levels(t,{at:R,reverse:!0,voids:a})){var E=!1;if(w.length<$.length||w.length===0||!a&&ce.isElement(M)&&b.isVoid(t,M))break;var O=m.current,j=b.isEnd(t,O,w);if(l||!m||!b.isEdge(t,O,w)){E=!0;var q=oe.extractProps(M);t.apply({type:"split_node",path:w,position:I,properties:q})}I=w[w.length-1]+(E||j?1:0)}if(n.at==null){var z=p.current||b.end(t,[]);G.select(t,z)}}finally{var re;m.unref(),(re=p)===null||re===void 0||re.unref()}}})},yv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var a={};for(var i of n)a[i]=null;G.setNodes(t,a,r)},Dv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=N.isPath(s)?rr(t,s):p=>ce.isElement(p)&&b.isBlock(t,p)),N.isPath(s)&&(s=b.range(t,s));var l=V.isRange(s)?b.rangeRef(t,s):null,u=b.nodes(t,{at:s,match:o,mode:r,voids:i}),c=Array.from(u,p=>{var[,g]=p;return b.pathRef(t,g)}).reverse(),h=function(){var g=m.unref(),[f]=b.node(t,g),y=b.range(t,g);a&&l&&(y=V.intersection(l.current,y)),G.liftNodes(t,{at:y,match:D=>ce.isAncestor(f)&&f.children.includes(D),voids:i})};for(var m of c)h();l&&l.unref()}})};function ju(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ou(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ju(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ju(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Cv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(N.isPath(l)?o=rr(t,l):t.isInline(n)?o=y=>ce.isElement(y)&&b.isInline(t,y)||de.isText(y):o=y=>ce.isElement(y)&&b.isBlock(t,y)),i&&V.isRange(l)){var[u,c]=V.edges(l),h=b.rangeRef(t,l,{affinity:"inward"});G.splitNodes(t,{at:c,match:o,voids:s}),G.splitNodes(t,{at:u,match:o,voids:s}),l=h.unref(),r.at==null&&G.select(t,l)}var m=Array.from(b.nodes(t,{at:l,match:t.isInline(n)?y=>ce.isElement(y)&&b.isBlock(t,y):y=>b.isEditor(y),mode:"lowest",voids:s})),p=function(){var D=V.isRange(l)?V.intersection(l,b.range(t,f)):l;if(!D)return 0;var x=Array.from(b.nodes(t,{at:D,match:o,mode:a,voids:s}));if(x.length>0){var[A]=x,_=x[x.length-1],[,k]=A,[,F]=_;if(k.length===0&&F.length===0)return 0;var S=N.equals(k,F)?N.parent(k):N.common(k,F),$=b.range(t,k,F),R=b.node(t,S),[I]=R,M=S.length+1,w=N.next(F.slice(0,M)),E=Ou(Ou({},n),{},{children:[]});G.insertNodes(t,E,{at:w,voids:s}),G.moveNodes(t,{at:$,match:O=>ce.isAncestor(I)&&I.children.includes(O),to:w.concat(0),voids:s})}},g;for(var[,f]of m)g=p()}})},xv=()=>{var e={children:[],operations:[],selection:null,marks:null,isElementReadOnly:()=>!1,isInline:()=>!1,isSelectable:()=>!0,isVoid:()=>!1,markableVoid:()=>!1,onChange:()=>{},apply:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kp(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xp(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ng(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rg(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ag(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yp(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pg(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vg(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nv(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gg(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gp(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yg(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zp(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qp(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jp(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eg(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tg(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rv(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tv(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return av(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ig(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sg(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return og(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ug(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lg(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sg(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dg(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fg(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hg(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mg(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lv(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cv(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hv(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iv(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mv(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hg(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kg(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ug(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pv(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sv(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gv(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gg(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ov(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uv(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bv(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qg(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xg(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yv(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dv(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cg(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ev(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cv(e,...r)}};return e},wv={isHistory(e){return et(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||Xt.isOperationList(e.redos[0].operations))&&(e.undos.length===0||Xt.isOperationList(e.undos[0].operations))}},hi=new WeakMap,mi=new WeakMap,In={isHistoryEditor(e){return wv.isHistory(e.history)&&b.isEditor(e)},isMerging(e){return mi.get(e)},isSaving(e){return hi.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=In.isMerging(e);mi.set(e,!1),t(),mi.set(e,n)},withoutSaving(e,t){var n=In.isSaving(e);hi.set(e,!1),t(),hi.set(e,n)}},Ev=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&G.setSelection(t,i.selectionBefore),In.withoutSaving(t,()=>{b.withoutNormalizing(t,()=>{for(var s of i.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:r}=t,{undos:a}=r;if(a.length>0){var i=a[a.length-1];In.withoutSaving(t,()=>{b.withoutNormalizing(t,()=>{var s=i.operations.map(Xt.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&G.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=In.isSaving(t),c=In.isMerging(t);if(u==null&&(u=_v(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=kv(r,l)),o&&c)o.operations.push(r);else{var h={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",h)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},kv=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&N.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&N.equals(e.path,t.path)),_v=(e,t)=>e.type!=="set_selection",Bv=Tv,gd="֑-߿יִ-﷽ﹰ-ﻼ",vd="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Av=new RegExp("^[^"+vd+"]*["+gd+"]"),Fv=new RegExp("^[^"+gd+"]*["+vd+"]");function Tv(e){return e=String(e||""),Av.test(e)?"rtl":Fv.test(e)?"ltr":"neutral"}const bd=wn(Bv);function Sv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Xs=Sv,jv=typeof $r=="object"&&$r&&$r.Object===Object&&$r,Ov=jv,Pv=Ov,Nv=typeof self=="object"&&self&&self.Object===Object&&self,Rv=Pv||Nv||Function("return this")(),yd=Rv,Mv=yd,Iv=function(){return Mv.Date.now()},$v=Iv,Lv=/\s/;function zv(e){for(var t=e.length;t--&&Lv.test(e.charAt(t)););return t}var qv=zv,Wv=qv,Hv=/^\s+/;function Uv(e){return e&&e.slice(0,Wv(e)+1).replace(Hv,"")}var Vv=Uv,Kv=yd,Zv=Kv.Symbol,Dd=Zv,Pu=Dd,Cd=Object.prototype,Yv=Cd.hasOwnProperty,Gv=Cd.toString,ur=Pu?Pu.toStringTag:void 0;function Qv(e){var t=Yv.call(e,ur),n=e[ur];try{e[ur]=void 0;var r=!0}catch{}var a=Gv.call(e);return r&&(t?e[ur]=n:delete e[ur]),a}var Jv=Qv,Xv=Object.prototype,e0=Xv.toString;function t0(e){return e0.call(e)}var n0=t0,Nu=Dd,r0=Jv,a0=n0,i0="[object Null]",s0="[object Undefined]",Ru=Nu?Nu.toStringTag:void 0;function o0(e){return e==null?e===void 0?s0:i0:Ru&&Ru in Object(e)?r0(e):a0(e)}var u0=o0;function l0(e){return e!=null&&typeof e=="object"}var c0=l0,d0=u0,f0=c0,h0="[object Symbol]";function m0(e){return typeof e=="symbol"||f0(e)&&d0(e)==h0}var p0=m0,g0=Vv,Mu=Xs,v0=p0,Iu=0/0,b0=/^[-+]0x[0-9a-f]+$/i,y0=/^0b[01]+$/i,D0=/^0o[0-7]+$/i,C0=parseInt;function x0(e){if(typeof e=="number")return e;if(v0(e))return Iu;if(Mu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Mu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=g0(e);var n=y0.test(e);return n||D0.test(e)?C0(e.slice(2),n?2:8):b0.test(e)?Iu:+e}var w0=x0,E0=Xs,pi=$v,$u=w0,k0="Expected a function",_0=Math.max,B0=Math.min;function A0(e,t,n){var r,a,i,s,o,l,u=0,c=!1,h=!1,m=!0;if(typeof e!="function")throw new TypeError(k0);t=$u(t)||0,E0(n)&&(c=!!n.leading,h="maxWait"in n,i=h?_0($u(n.maxWait)||0,t):i,m="trailing"in n?!!n.trailing:m);function p(F){var S=r,$=a;return r=a=void 0,u=F,s=e.apply($,S),s}function g(F){return u=F,o=setTimeout(D,t),c?p(F):s}function f(F){var S=F-l,$=F-u,R=t-S;return h?B0(R,i-$):R}function y(F){var S=F-l,$=F-u;return l===void 0||S>=t||S<0||h&&$>=i}function D(){var F=pi();if(y(F))return x(F);o=setTimeout(D,f(F))}function x(F){return o=void 0,m&&r?p(F):(r=a=void 0,s)}function A(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function _(){return o===void 0?s:x(pi())}function k(){var F=pi(),S=y(F);if(r=arguments,a=this,l=F,S){if(o===void 0)return g(l);if(h)return clearTimeout(o),o=setTimeout(D,t),p(l)}return o===void 0&&(o=setTimeout(D,t)),s}return k.cancel=A,k.flush=_,k}var xd=A0;const F0=wn(xd);var T0=xd,S0=Xs,j0="Expected a function";function O0(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(j0);return S0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),T0(e,t,{leading:r,maxWait:t,trailing:a})}var P0=O0;const N0=wn(P0),Lu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,zu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",gi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return zu(n.overflowY,t)||zu(n.overflowX,t)||(r=>{const a=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!a&&(a.clientHeight<r.scrollHeight||a.clientWidth<r.scrollWidth)})(e)}return!1},Hr=(e,t,n,r,a,i,s,o)=>i<e&&s>t||i>e&&s<t?0:i<=e&&o<=n||s>=t&&o>=n?i-e-r:s>t&&o<n||i<e&&o>n?s-t+a:0,R0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},qu=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,h=typeof u=="function"?u:q=>q!==u;if(!Lu(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let g=e;for(;Lu(g)&&h(g);){if(g=R0(g),g===m){p.push(g);break}g!=null&&g===document.body&&gi(g)&&!gi(document.documentElement)||g!=null&&gi(g,c)&&p.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,y=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:D,scrollY:x}=window,{height:A,width:_,top:k,right:F,bottom:S,left:$}=e.getBoundingClientRect(),{top:R,right:I,bottom:M,left:w}=(q=>{const z=window.getComputedStyle(q);return{top:parseFloat(z.scrollMarginTop)||0,right:parseFloat(z.scrollMarginRight)||0,bottom:parseFloat(z.scrollMarginBottom)||0,left:parseFloat(z.scrollMarginLeft)||0}})(e);let E=o==="start"||o==="nearest"?k-R:o==="end"?S+M:k+A/2-R+M,O=l==="center"?$+_/2-w+I:l==="end"?F+I:$-w;const j=[];for(let q=0;q<p.length;q++){const z=p[q],{height:re,width:X,top:v,right:H,bottom:ee,left:B}=z.getBoundingClientRect();if(s==="if-needed"&&k>=0&&$>=0&&S<=y&&F<=f&&k>=v&&S<=ee&&$>=B&&F<=H)return j;const T=getComputedStyle(z),W=parseInt(T.borderLeftWidth,10),L=parseInt(T.borderTopWidth,10),U=parseInt(T.borderRightWidth,10),te=parseInt(T.borderBottomWidth,10);let ne=0,ie=0;const fe="offsetWidth"in z?z.offsetWidth-z.clientWidth-W-U:0,Q="offsetHeight"in z?z.offsetHeight-z.clientHeight-L-te:0,pe="offsetWidth"in z?z.offsetWidth===0?0:X/z.offsetWidth:0,ge="offsetHeight"in z?z.offsetHeight===0?0:re/z.offsetHeight:0;if(m===z)ne=o==="start"?E:o==="end"?E-y:o==="nearest"?Hr(x,x+y,y,L,te,x+E,x+E+A,A):E-y/2,ie=l==="start"?O:l==="center"?O-f/2:l==="end"?O-f:Hr(D,D+f,f,W,U,D+O,D+O+_,_),ne=Math.max(0,ne+x),ie=Math.max(0,ie+D);else{ne=o==="start"?E-v-L:o==="end"?E-ee+te+Q:o==="nearest"?Hr(v,ee,re,L,te+Q,E,E+A,A):E-(v+re/2)+Q/2,ie=l==="start"?O-B-W:l==="center"?O-(B+X/2)+fe/2:l==="end"?O-H+U+fe:Hr(B,H,X,W,U+fe,O,O+_,_);const{scrollLeft:ke,scrollTop:xe}=z;ne=ge===0?0:Math.max(0,Math.min(xe+ne/ge,z.scrollHeight-re/ge+Q)),ie=pe===0?0:Math.max(0,Math.min(ke+ie/pe,z.scrollWidth-X/pe+fe)),E+=xe-ne,O+=ke-ie}j.push({el:z,top:ne,left:ie})}return j},M0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function I0(e,t){if(!e.isConnected||!(a=>{let i=a;for(;i&&i.parentNode;){if(i.parentNode===document)return!0;i=i.parentNode instanceof ShadowRoot?i.parentNode.host:i.parentNode}return!1})(e))return;const n=(a=>{const i=window.getComputedStyle(a);return{top:parseFloat(i.scrollMarginTop)||0,right:parseFloat(i.scrollMarginRight)||0,bottom:parseFloat(i.scrollMarginBottom)||0,left:parseFloat(i.scrollMarginLeft)||0}})(e);if((a=>typeof a=="object"&&typeof a.behavior=="function")(t))return t.behavior(qu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of qu(e,M0(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var gn=[],$0=function(){return gn.some(function(e){return e.activeTargets.length>0})},L0=function(){return gn.some(function(e){return e.skippedTargets.length>0})},Wu="ResizeObserver loop completed with undelivered notifications.",z0=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Wu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Wu),window.dispatchEvent(e)},Ar;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Ar||(Ar={}));var vn=function(e){return Object.freeze(e)},q0=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,vn(this)}return e}(),wd=function(){function e(t,n,r,a){return this.x=t,this.y=n,this.width=r,this.height=a,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,vn(this)}return e.prototype.toJSON=function(){var t=this,n=t.x,r=t.y,a=t.top,i=t.right,s=t.bottom,o=t.left,l=t.width,u=t.height;return{x:n,y:r,top:a,right:i,bottom:s,left:o,width:l,height:u}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),eo=function(e){return e instanceof SVGElement&&"getBBox"in e},Ed=function(e){if(eo(e)){var t=e.getBBox(),n=t.width,r=t.height;return!n&&!r}var a=e,i=a.offsetWidth,s=a.offsetHeight;return!(i||s||e.getClientRects().length)},Hu=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)},W0=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},vr=typeof window<"u"?window:{},Ur=new WeakMap,Uu=/auto|scroll/,H0=/^tb|vertical/,U0=/msie|trident/i.test(vr.navigator&&vr.navigator.userAgent),Ft=function(e){return parseFloat(e||"0")},qn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new q0((n?t:e)||0,(n?e:t)||0)},Vu=vn({devicePixelContentBoxSize:qn(),borderBoxSize:qn(),contentBoxSize:qn(),contentRect:new wd(0,0,0,0)}),kd=function(e,t){if(t===void 0&&(t=!1),Ur.has(e)&&!t)return Ur.get(e);if(Ed(e))return Ur.set(e,Vu),Vu;var n=getComputedStyle(e),r=eo(e)&&e.ownerSVGElement&&e.getBBox(),a=!U0&&n.boxSizing==="border-box",i=H0.test(n.writingMode||""),s=!r&&Uu.test(n.overflowY||""),o=!r&&Uu.test(n.overflowX||""),l=r?0:Ft(n.paddingTop),u=r?0:Ft(n.paddingRight),c=r?0:Ft(n.paddingBottom),h=r?0:Ft(n.paddingLeft),m=r?0:Ft(n.borderTopWidth),p=r?0:Ft(n.borderRightWidth),g=r?0:Ft(n.borderBottomWidth),f=r?0:Ft(n.borderLeftWidth),y=h+u,D=l+c,x=f+p,A=m+g,_=o?e.offsetHeight-A-e.clientHeight:0,k=s?e.offsetWidth-x-e.clientWidth:0,F=a?y+x:0,S=a?D+A:0,$=r?r.width:Ft(n.width)-F-k,R=r?r.height:Ft(n.height)-S-_,I=$+y+k+x,M=R+D+_+A,w=vn({devicePixelContentBoxSize:qn(Math.round($*devicePixelRatio),Math.round(R*devicePixelRatio),i),borderBoxSize:qn(I,M,i),contentBoxSize:qn($,R,i),contentRect:new wd(h,l,$,R)});return Ur.set(e,w),w},_d=function(e,t,n){var r=kd(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Ar.DEVICE_PIXEL_CONTENT_BOX:return s;case Ar.BORDER_BOX:return a;default:return i}},V0=function(){function e(t){var n=kd(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=vn([n.borderBoxSize]),this.contentBoxSize=vn([n.contentBoxSize]),this.devicePixelContentBoxSize=vn([n.devicePixelContentBoxSize])}return e}(),Bd=function(e){if(Ed(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},K0=function(){var e=1/0,t=[];gn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var c=new V0(u.target),h=Bd(u.target);o.push(c),u.lastReportedSize=_d(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 a=r[n];a()}return e},Ku=function(e){gn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(Bd(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},Z0=function(){var e=0;for(Ku(e);$0();)e=K0(),Ku(e);return L0()&&z0(),e>0},vi,Ad=[],Y0=function(){return Ad.splice(0).forEach(function(e){return e()})},G0=function(e){if(!vi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Y0()}).observe(n,r),vi=function(){n.textContent="".concat(t?t--:t++)}}Ad.push(e),vi()},Q0=function(e){G0(function(){requestAnimationFrame(e)})},la=0,J0=function(){return!!la},X0=250,eb={attributes:!0,characterData:!0,childList:!0,subtree:!0},Zu=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Yu=function(e){return e===void 0&&(e=0),Date.now()+e},bi=!1,tb=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=X0),!bi){bi=!0;var r=Yu(t);Q0(function(){var a=!1;try{a=Z0()}finally{if(bi=!1,t=r-Yu(),!J0())return;a?n.run(1e3):t>0?n.run(t):n.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var t=this,n=function(){return t.observer&&t.observer.observe(document.body,eb)};document.body?n():vr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Zu.forEach(function(n){return vr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Zu.forEach(function(n){return vr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),gs=new tb,Gu=function(e){!la&&e>0&&gs.start(),la+=e,!la&&gs.stop()},nb=function(e){return!eo(e)&&!W0(e)&&getComputedStyle(e).display==="inline"},rb=function(){function e(t,n){this.target=t,this.observedBox=n||Ar.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=_d(this.target,this.observedBox,!0);return nb(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),ab=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Vr=new WeakMap,Qu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Kr=function(){function e(){}return e.connect=function(t,n){var r=new ab(t,n);Vr.set(t,r)},e.observe=function(t,n,r){var a=Vr.get(t),i=a.observationTargets.length===0;Qu(a.observationTargets,n)<0&&(i&&gn.push(a),a.observationTargets.push(new rb(n,r&&r.box)),Gu(1),gs.schedule())},e.unobserve=function(t,n){var r=Vr.get(t),a=Qu(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&gn.splice(gn.indexOf(r),1),r.observationTargets.splice(a,1),Gu(-1))},e.disconnect=function(t){var n=this,r=Vr.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),ib=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.");Kr.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(!Hu(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Kr.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(!Hu(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Kr.unobserve(this,t)},e.prototype.disconnect=function(){Kr.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Vt={};Object.defineProperty(Vt,"__esModule",{value:!0});var sb=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),yi={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Fd={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:sb?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},to={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 Zr=1;Zr<20;Zr++)to["f"+Zr]=111+Zr;function Ka(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Td(s,t)}),a=function(o){return r.some(function(l){return Sd(l,o)})},i=n==null?a:a(n);return i}function ob(e,t){return Ka(e,t)}function ub(e,t){return Ka(e,{byKey:!0},t)}function Td(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in yi)r[yi[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var c=a[Symbol.iterator](),h;!(o=(h=c.next()).done);o=!0){var m=h.value,p=m.endsWith("?")&&m.length>1;p&&(m=m.slice(0,-1));var g=no(m),f=yi[g];if(m.length>1&&!f&&!Fd[m]&&!to[g])throw new TypeError('Unknown modifier: "'+m+'"');(i===1||!f)&&(n?r.key=g:r.which=jd(m)),f&&(r[f]=p?null:!0)}}catch(y){l=!0,u=y}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Sd(e,t){for(var n in e){var r=e[n],a=void 0;if(r!=null&&(n==="key"&&t.key!=null?a=t.key.toLowerCase():n==="which"?a=r===91&&t.which===93?91:t.which:a=t[n],!(a==null&&r===!1)&&a!==r))return!1}return!0}function jd(e){e=no(e);var t=to[e]||e.toUpperCase().charCodeAt(0);return t}function no(e){return e=e.toLowerCase(),e=Fd[e]||e,e}var lb=Vt.default=Ka,Di=Vt.isHotkey=Ka;Vt.isCodeHotkey=ob;Vt.isKeyHotkey=ub;Vt.parseHotkey=Td;Vt.compareHotkey=Sd;Vt.toKeyCode=jd;Vt.toKeyName=no;function cb(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Zn(e,t){if(e==null)return{};var n=cb(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Fr(e){"@babel/helpers - typeof";return Fr=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},Fr(e)}function db(e,t){if(Fr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Fr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fb(e){var t=db(e,"string");return Fr(t)==="symbol"?t:String(t)}function xt(e,t,n){return t=fb(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ro=C.createContext(null),on=()=>{var e=C.useContext(ro);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Od=parseInt(C.version.split(".")[0],10),hb=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Ju=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),ot=typeof navigator<"u"&&/Android/.test(navigator.userAgent),$n=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),mr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),mb=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Pd=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),pb=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),gb=ot&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),vb=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),bb=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),yb=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ca=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Zt=(!pb||!gb)&&!mb&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",ao=new WeakMap,io=new WeakMap,Nd=new WeakMap,da=new WeakMap,vs=new WeakMap,Tr=new WeakMap,bn=new WeakMap,ka=new WeakMap,Za=new WeakMap,bs=new WeakMap,en=new WeakMap,mn=new WeakMap,br=new WeakMap,ys=new WeakMap,so=new WeakMap,_t=new WeakMap,Wt=new WeakMap,ct=new WeakMap,Gt=new WeakMap,Qt=new WeakMap,Rd=new WeakMap,Yn=Symbol("placeholder"),Md=Symbol("mark-placeholder"),Db=globalThis.Text,oo=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,Cb=e=>nn(e)&&e.nodeType===8,Ct=e=>nn(e)&&e.nodeType===1,nn=e=>{var t=oo(e);return!!t&&e instanceof t.Node},Ds=e=>{var t=e&&e.anchorNode&&oo(e.anchorNode);return!!t&&e instanceof t.Selection},Id=e=>nn(e)&&e.nodeType===3,xb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,wb=e=>{var[t,n]=e;if(Ct(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=$d(t,a,r?"backward":"forward"),r=a<n;Ct(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=kb(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},Eb=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},$d=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(Cb(a)||Ct(a)&&a.childNodes.length===0||Ct(a)&&a.getAttribute("contenteditable")==="false")&&!(s&&o);){if(i>=r.length){s=!0,i=t-1,n="backward";continue}if(i<0){o=!0,i=t+1,n="forward";continue}a=r[i],t=i,i+=n==="forward"?1:-1}return[a,t]},kb=(e,t,n)=>{var[r]=$d(e,t,n);return r},Ld=e=>{var t="";if(Id(e)&&e.nodeValue)return e.nodeValue;if(Ct(e)){for(var n of Array.from(e.childNodes))t+=Ld(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
103
+ `)}return t},_b=/data-slate-fragment="(.+?)"/m,Bb=e=>{var t=e.getData("text/html"),[,n]=t.match(_b)||[];return n},uo=(e,t,n)=>{var{target:r}=t;if(Ct(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=J.getWindow(e);if(a.contains(r))return J.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var c of l)if(c===r||c.contains(r))return!0});return!i||i===t?!1:uo(e,i,n)},Ab=0;class Fb{constructor(){xt(this,"id",void 0),this.id="".concat(Ab++)}}var J={androidPendingDiffs:e=>ct.get(e),androidScheduleFlush:e=>{var t;(t=so.get(e))===null||t===void 0||t()},blur:e=>{var t=J.toDOMNode(e,e),n=J.findDocumentOrShadowRoot(e);en.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=J.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&G.deselect(e)},findDocumentOrShadowRoot:e=>{var t=J.toDOMNode(e,e),n=t.getRootNode();return(n instanceof Document||n instanceof ShadowRoot)&&n.getSelection!=null?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:a}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i=J.toSlateNode(e,t.target),s=J.findPath(e,i);if(ce.isElement(i)&&b.isVoid(e,i)){var o=a.getBoundingClientRect(),l=e.isInline(i)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,u=b.point(e,s,{edge:l?"start":"end"}),c=l?b.before(e,u):b.after(e,u);if(c){var h=b.range(e,c);return h}}var m,{document:p}=J.getWindow(e);if(p.caretRangeFromPoint)m=p.caretRangeFromPoint(n,r);else{var g=p.caretPositionFromPoint(n,r);g&&(m=p.createRange(),m.setStart(g.offsetNode,g.offset),m.setEnd(g.offsetNode,g.offset))}if(!m)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=J.toSlateRange(e,m,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=ka.get(t);return n||(n=new Fb,ka.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=io.get(r);if(a==null){if(b.isEditor(r))return n;break}var i=ao.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(Je.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!en.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(()=>{J.focus(t,{retries:n.retries-1})},10);return}var r=J.toDOMNode(t,t),a=J.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=J.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(G.select(t,b.start(t,[])),t.onChange()),en.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=Nd.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{editable:a=!1}=r,i=J.toDOMNode(t,t),s;try{s=Ct(n)?n:n.parentElement}catch(o){if(o instanceof Error&&!o.message.includes('Permission denied to access property "nodeType"'))throw o}return s?s.closest("[data-slate-editor]")===i&&(!a||s.isContentEditable?!0:typeof s.isContentEditable=="boolean"&&s.closest('[contenteditable="false"]')===i||!!s.getAttribute("data-slate-zero-width")):!1},hasEditableTarget:(e,t)=>nn(t)&&J.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return b.hasPath(e,n.path)&&b.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>J.hasEditableTarget(e,t)||J.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>nn(t)&&J.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!mn.get(e),isFocused:e=>!!en.get(e),isReadOnly:e=>!!bs.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(bs.get(e))return!1;var n=J.hasTarget(e,t)&&J.toSlateNode(e,t);return ce.isElement(n)&&b.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=Za.get(e),r=b.isEditor(t)?da.get(e):n==null?void 0:n.get(J.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(Je.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=b.node(e,t.path),r=J.toDOMNode(e,n),a;b.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],c=u.childNodes[0];if(!(c==null||c.textContent==null)){var{length:h}=c.textContent,m=u.getAttribute("data-slate-length"),p=m==null?h:parseInt(m,10),g=o+p,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var y,D=f.childNodes[0];a=[D instanceof Db?D:f,(y=f.textContent)!==null&&y!==void 0&&y.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var x=Math.min(h,Math.max(0,t.offset-o));a=[c,x];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(Je.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=V.isBackward(t),i=J.toDOMPoint(e,n),s=V.isCollapsed(t)?i:J.toDOMPoint(e,r),o=J.getWindow(e),l=o.document.createRange(),[u,c]=a?s:i,[h,m]=a?i:s,p=Ct(u)?u:u.parentElement,g=!!p.getAttribute("data-slate-zero-width"),f=Ct(h)?h:h.parentElement,y=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:c),l.setEnd(h,y?1:m),l},toSlateNode:(e,t)=>{var n=Ct(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Tr.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},toSlatePoint:(e,t,n)=>{var{exactMatch:r,suppressThrow:a}=n,[i,s]=r?t:wb(t),o=i.parentNode,l=null,u=0;if(o){var c,h,m=J.toDOMNode(e,e),p=o.closest('[data-slate-void="true"]'),g=p&&m.contains(p)?p:null,f=o.closest("[data-slate-leaf]"),y=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var D=J.getWindow(e),x=D.document.createRange();x.setStart(l,0),x.setEnd(i,s);var A=x.cloneContents(),_=[...Array.prototype.slice.call(A.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(A.querySelectorAll("[contenteditable=false]"))];_.forEach(O=>{if(ot&&!r&&O.hasAttribute("data-slate-zero-width")&&O.textContent.length>0&&O.textContext!=="\uFEFF"){O.textContent.startsWith("\uFEFF")&&(O.textContent=O.textContent.slice(1));return}O.parentNode.removeChild(O)}),u=A.textContent.length,y=l}}else if(g){for(var k=g.querySelectorAll("[data-slate-leaf]"),F=0;F<k.length;F++){var S=k[F];if(J.hasDOMNode(e,S)){f=S;break}}f?(l=f.closest('[data-slate-node="text"]'),y=f,u=y.textContent.length,y.querySelectorAll("[data-slate-zero-width]").forEach(O=>{u-=O.textContent.length})):u=1}y&&u===y.textContent.length&&ot&&y.getAttribute("data-slate-zero-width")==="z"&&(c=y.textContent)!==null&&c!==void 0&&c.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||$n&&(h=y.textContent)!==null&&h!==void 0&&h.endsWith(`
104
104
 
105
- `))&&u--}if(ot&&!l&&!r){var $=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if($&&J.hasDOMNode(e,$,{editable:!0})){var R=J.toSlateNode(e,$),{path:I,offset:M}=b.start(e,J.findPath(e,R));return $.querySelector("[data-slate-leaf]")||(M=s),{path:I,offset:M}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var x=J.toSlateNode(e,l),E=J.findPath(e,x);return{path:E,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=Ds(t)?t.anchorNode:t.startContainer,o,l,u,c,h;if(s)if(Ds(t)){if(Ln&&t.rangeCount>1){u=t.focusNode;var m=t.getRangeAt(0),p=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&m.startContainer instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement){let F=function(S){return S.childElementCount>0?F(S.children[0]):S};var g=m.startContainer,f=p.startContainer,D=F(g.children[m.startOffset]),y=F(f.children[p.startOffset]);c=0,y.childNodes.length>0?o=y.childNodes[0]:o=y,D.childNodes.length>0?u=D.childNodes[0]:u=D,y instanceof HTMLElement?l=y.innerHTML.length:l=0}else m.startContainer===u?(o=p.endContainer,l=p.endOffset,c=m.startOffset):(o=m.startContainer,l=m.endOffset,c=p.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,c=t.focusOffset;Pd&&Eb(o)||Ln?h=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:h=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,c=t.endOffset,h=t.collapsed;if(o==null||u==null||l==null||c==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(Ln&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
105
+ `))&&u--}if(ot&&!l&&!r){var $=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if($&&J.hasDOMNode(e,$,{editable:!0})){var R=J.toSlateNode(e,$),{path:I,offset:M}=b.start(e,J.findPath(e,R));return $.querySelector("[data-slate-leaf]")||(M=s),{path:I,offset:M}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var w=J.toSlateNode(e,l),E=J.findPath(e,w);return{path:E,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=Ds(t)?t.anchorNode:t.startContainer,o,l,u,c,h;if(s)if(Ds(t)){if($n&&t.rangeCount>1){u=t.focusNode;var m=t.getRangeAt(0),p=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&m.startContainer instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement){let F=function(S){return S.childElementCount>0?F(S.children[0]):S};var g=m.startContainer,f=p.startContainer,y=F(g.children[m.startOffset]),D=F(f.children[p.startOffset]);c=0,D.childNodes.length>0?o=D.childNodes[0]:o=D,y.childNodes.length>0?u=y.childNodes[0]:u=y,D instanceof HTMLElement?l=D.innerHTML.length:l=0}else m.startContainer===u?(o=p.endContainer,l=p.endOffset,c=m.startOffset):(o=m.startContainer,l=m.endOffset,c=p.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,c=t.focusOffset;Pd&&Eb(o)||$n?h=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:h=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,c=t.endOffset,h=t.collapsed;if(o==null||u==null||l==null||c==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if($n&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
106
106
 
107
- `)&&c===u.textContent.length&&c--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var w;u=o,c=((w=o.textContent)===null||w===void 0?void 0:w.length)||0}var A=J.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!A)return null;var _=h?A:J.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!_)return null;var k={anchor:A,focus:_};return V.isExpanded(k)&&V.isForward(k)&&Ct(u)&&b.void(e,{at:k.focus,mode:"highest"})&&(k=b.unhangRange(e,k,{voids:!0})),k}};function Tb(e,t){var{path:n,diff:r}=t;if(!b.hasPath(e,n))return!1;var a=oe.get(e,n);if(!de.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=N.next(n);if(!b.hasPath(e,i))return!1;var s=oe.get(e,i);return de.isText(s)&&s.text.startsWith(r.text)}function zd(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.reduce((a,i)=>a.slice(0,i.start)+i.text+a.slice(i.end),e)}function Sb(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 jb(e,t,n){for(var r=Math.min(e.length,t.length,n),a=0;a<r;a++)if(e.charAt(e.length-a-1)!==t.charAt(t.length-a-1))return a;return r}function qd(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=Sb(i,a),o=Math.min(i.length-s,a.length-s),l=jb(i,a,o),u={start:n+s,end:r-l,text:a.slice(s,a.length-l)};return u.start===u.end&&u.text.length===0?null:u}function Ob(e,t,n){var r=Math.min(t.start,n.start),a=Math.max(0,Math.min(t.start+t.text.length,n.end)-n.start),i=zd(e,t,n),s=Math.max(n.start+n.text.length,t.start+t.text.length+(t.start+t.text.length>n.start?n.text.length:0)-a),o=i.slice(r,s),l=Math.max(t.end,n.end-t.text.length+(t.end-t.start));return qd(e,{start:r,end:l,text:o})}function Pb(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Cs(e,t){var{path:n,offset:r}=t;if(!b.hasPath(e,n))return null;var a=oe.get(e,n);if(!de.isText(a))return null;var i=b.above(e,{match:o=>ce.isElement(o)&&b.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=b.next(e,{at:n,match:de.isText});if(!s||!N.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Xu(e,t){var n=Cs(e,t.anchor);if(!n)return null;if(V.isCollapsed(t))return{anchor:n,focus:n};var r=Cs(e,t.focus);return r?{anchor:n,focus:r}:null}function xs(e,t,n){var r=ct.get(e),a=r==null?void 0:r.find(c=>{var{path:h}=c;return N.equals(h,t.path)});if(!a||t.offset<=a.diff.start)return Ee.transform(t,n,{affinity:"backward"});var{diff:i}=a;if(t.offset<=i.start+i.text.length){var s={path:t.path,offset:i.start},o=Ee.transform(s,n,{affinity:"backward"});return o?{path:o.path,offset:o.offset+t.offset-i.start}:null}var l={path:t.path,offset:t.offset-i.text.length+i.end-i.start},u=Ee.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&N.equals(n.path,t.path)&&l.offset<n.position&&i.start<n.position?u:{path:u.path,offset:u.offset+i.text.length-i.end+i.start}:null}function el(e,t,n){var r=xs(e,t.anchor,n);if(!r)return null;if(V.isCollapsed(t))return{anchor:r,focus:r};var a=xs(e,t.focus,n);return a?{anchor:r,focus:a}:null}function Nb(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!N.equals(t.path,n)||t.offset>=r.end?e:t.offset<=r.start?{diff:{start:t.text.length+r.start,end:t.text.length+r.end,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:a,path:n};case"remove_text":return!N.equals(t.path,n)||t.offset>=r.end?e:t.offset+t.text.length<=r.start?{diff:{start:r.start-t.text.length,end:r.end-t.text.length,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:a,path:n};case"split_node":return!N.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:N.transform(n,t,{affinity:"backward"})}:t.position>r.start?{diff:{start:r.start,end:Math.min(t.position,r.end),text:r.text},id:a,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:a,path:N.transform(n,t,{affinity:"forward"})};case"merge_node":return N.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:N.transform(n,t)}:{diff:r,id:a,path:N.transform(n,t)}}var i=N.transform(n,t);return i?{diff:r,path:i,id:a}:null}function tl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Yr(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){xt(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 Rb=25,Mb=200,Ib=function(){},$b=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function Lb(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,c=()=>{var x=Qt.get(t);if(Qt.delete(t),x){var{selection:E}=t,O=Xu(t,x);O&&(!E||!V.equals(O,E))&&G.select(t,O)}},h=()=>{var x=Gt.get(t);if(Gt.delete(t),!!x){if(x.at){var E=Ee.isPoint(x.at)?Cs(t,x.at):Xu(t,x.at);if(!E)return;var O=b.range(t,E);(!t.selection||!V.equals(t.selection,O))&&G.select(t,E)}x.run()}},m=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!_()&&!A()){c();return}a||(a=!0,setTimeout(()=>a=!1)),A()&&(a="action");var x=t.selection&&b.rangeRef(t,t.selection,{affinity:"forward"});Wt.set(t,t.marks),Ib("flush",Gt.get(t),ct.get(t));for(var E=_(),O;O=(j=ct.get(t))===null||j===void 0?void 0:j[0];){var j,q,z=_t.get(t);z!==void 0&&(_t.delete(t),t.marks=z),z&&u===!1&&(u=null);var re=Pb(O);(!t.selection||!V.equals(t.selection,re))&&G.select(t,re),O.diff.text?b.insertText(t,O.diff.text):b.deleteFragment(t),ct.set(t,(q=ct.get(t))===null||q===void 0?void 0:q.filter(H=>{var{id:ee}=H;return ee!==O.id})),Tb(t,O)||(E=!1,Gt.delete(t),Wt.delete(t),a="action",Qt.delete(t),n.cancel(),r.cancel(),x==null||x.unref())}var X=x==null?void 0:x.unref();if(X&&!Qt.get(t)&&(!t.selection||!V.equals(X,t.selection))&&G.select(t,X),A()){h();return}E&&n(),n.flush(),r.flush(),c();var v=Wt.get(t);Wt.delete(t),v!==void 0&&(t.marks=v,t.onChange())},p=x=>{i&&clearTimeout(i),i=setTimeout(()=>{mn.set(t,!1),m()},Rb)},g=x=>{mn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,O=vs.get(t);if(O){if(_()||E){O.style.display="none";return}O.style.removeProperty("display")}},D=(x,E)=>{var O,j=(O=ct.get(t))!==null&&O!==void 0?O:[];ct.set(t,j);var q=oe.leaf(t,x),z=j.findIndex(v=>N.equals(v.path,x));if(z<0){var re=qd(q.text,E);re&&j.push({path:x,diff:E,id:l++}),f();return}var X=Ob(q.text,j[z].diff,E);if(!X){j.splice(z,1),f();return}j[z]=Yr(Yr({},j[z]),{},{diff:X})},y=function(E){var{at:O}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,Qt.delete(t),n.cancel(),r.cancel(),A()&&m(),Gt.set(t,{at:O,run:E}),o=setTimeout(m)},w=x=>{var E;s&&(clearTimeout(s),s=null);var{inputType:O}=x,j=null,q=x.dataTransfer||x.data||void 0;u!==!1&&O!=="insertText"&&O!=="insertCompositionText"&&(u=!1);var[z]=x.getTargetRanges();z&&(j=J.toSlateRange(t,z,{exactMatch:!1,suppressThrow:!0}));var re=J.getWindow(t),X=re.getSelection();if(!j&&X&&(z=X,j=J.toSlateRange(t,X,{exactMatch:!1,suppressThrow:!0})),j=(E=j)!==null&&E!==void 0?E:t.selection,!!j){var v=!0;if(O.startsWith("delete")){if(V.isExpanded(j)){var[H,ee]=V.edges(j),B=oe.leaf(t,H.path);if(B.text.length===H.offset&&ee.offset===0){var T=b.next(t,{at:H.path,match:de.isText});T&&N.equals(T[1],ee.path)&&(j={anchor:ee,focus:ee})}}var W=O.endsWith("Backward")?"backward":"forward",[L,U]=V.edges(j),[te,ne]=b.leaf(t,L.path),ie={text:"",start:L.offset,end:U.offset},fe=ct.get(t),Q=fe==null?void 0:fe.find(ve=>N.equals(ve.path,ne)),pe=Q?[Q.diff,ie]:[ie],ge=zd(te.text,...pe);if(ge.length===0&&(v=!1),V.isExpanded(j)){if(v&&N.equals(j.anchor.path,j.focus.path)){var ke={path:j.anchor.path,offset:L.offset},xe=b.range(t,ke,ke);return S(xe),D(j.anchor.path,{text:"",end:U.offset,start:L.offset})}return y(()=>b.deleteFragment(t,{direction:W}),{at:j})}}switch(O){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return y(()=>b.deleteFragment(t),{at:j});case"deleteContent":case"deleteContentForward":{var{anchor:_e}=j;if(v&&V.isCollapsed(j)){var We=oe.leaf(t,_e.path);if(_e.offset<We.text.length)return D(_e.path,{text:"",start:_e.offset,end:_e.offset+1})}return y(()=>b.deleteForward(t),{at:j})}case"deleteContentBackward":{var Le,{anchor:Ue}=j,Qe=Ds(z)?z.isCollapsed:!!((Le=z)!==null&&Le!==void 0&&Le.collapsed);return v&&Qe&&V.isCollapsed(j)&&Ue.offset>0?D(Ue.path,{text:"",start:Ue.offset-1,end:Ue.offset}):y(()=>b.deleteBackward(t),{at:j})}case"deleteEntireSoftLine":return y(()=>{b.deleteBackward(t,{unit:"line"}),b.deleteForward(t,{unit:"line"})},{at:j});case"deleteHardLineBackward":return y(()=>b.deleteBackward(t,{unit:"block"}),{at:j});case"deleteSoftLineBackward":return y(()=>b.deleteBackward(t,{unit:"line"}),{at:j});case"deleteHardLineForward":return y(()=>b.deleteForward(t,{unit:"block"}),{at:j});case"deleteSoftLineForward":return y(()=>b.deleteForward(t,{unit:"line"}),{at:j});case"deleteWordBackward":return y(()=>b.deleteBackward(t,{unit:"word"}),{at:j});case"deleteWordForward":return y(()=>b.deleteForward(t,{unit:"word"}),{at:j});case"insertLineBreak":return y(()=>b.insertSoftBreak(t),{at:j});case"insertParagraph":return y(()=>b.insertBreak(t),{at:j});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if($b(q))return y(()=>J.insertData(t,q),{at:j});var he=q??"";if(_t.get(t)&&(he=he.replace("\uFEFF","")),O==="insertText"&&/.*\n.*\n$/.test(he)&&(he=he.slice(0,-1)),he.includes(`
108
- `))return y(()=>{var ve=he.split(`
109
- `);ve.forEach((we,Ye)=>{we&&b.insertText(t,we),Ye!==ve.length-1&&b.insertSoftBreak(t)})},{at:j});if(N.equals(j.anchor.path,j.focus.path)){var[Te,$e]=V.edges(j),K={start:Te.offset,end:$e.offset,text:he};if(he&&u&&O==="insertCompositionText"){var se=u.start+u.text.search(/\S|$/),me=K.start+K.text.search(/\S|$/);me===se+1&&K.end===u.start+u.text.length?(K.start-=1,u=null,I()):u=!1}else O==="insertText"?u===null?u=K:u&&V.isCollapsed(j)&&u.end+u.text.length===Te.offset?u=Yr(Yr({},u),{},{text:u.text+he}):u=!1:u=!1;if(v){D(Te.path,K);return}}return y(()=>b.insertText(t,he),{at:j})}}}},A=()=>!!Gt.get(t),_=()=>{var x;return!!((x=ct.get(t))!==null&&x!==void 0&&x.length)},k=()=>A()||_(),F=()=>a,S=x=>{Qt.set(t,x),s&&(clearTimeout(s),s=null);var{selection:E}=t;if(x){var O=!E||!N.equals(E.anchor.path,x.anchor.path),j=!E||!N.equals(E.anchor.path.slice(0,-1),x.anchor.path.slice(0,-1));(O&&u||j)&&(u=!1),(O||_())&&(s=setTimeout(m,Mb))}},$=()=>{(A()||!_())&&m()},R=x=>{_()||(f(!0),setTimeout(f))},I=()=>{A()||(o=setTimeout(m))},M=x=>{if(!(_()||A())&&x.some(O=>uo(t,O,x))){var E;(E=Rd.get(t))===null||E===void 0||E()}};return{flush:m,scheduleFlush:I,hasPendingDiffs:_,hasPendingAction:A,hasPendingChanges:k,isFlushing:F,handleUserSelect:S,handleCompositionEnd:p,handleCompositionStart:g,handleDOMBeforeInput:w,handleKeyDown:R,handleDomMutations:M,handleInput:$}}function zb(){var e=C.useRef(!1);return C.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Sr=ca?C.useLayoutEffect:C.useEffect;function qb(e,t,n){var[r]=C.useState(()=>new MutationObserver(t));Sr(()=>{r.takeRecords()}),C.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 Wb=["node"];function nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Hb(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){xt(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 Ub={subtree:!0,childList:!0,characterData:!0},Vb=ot?e=>{var{node:t}=e,n=Yn(e,Wb);if(!ot)return null;var r=on(),a=zb(),[i]=C.useState(()=>Lb(Hb({editor:r},n)));return qb(t,i.handleDomMutations,Ub),so.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,Kb=["anchor","focus"],Zb=["anchor","focus"],Yb=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),Wd=(e,t)=>{var n=Yn(e,Kb),r=Yn(t,Zb);return e[Gn]===t[Gn]&&Yb(n,r)},Gb=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(!V.equals(r,a)||!Wd(r,a))return!1}return!0},Qb=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(r.anchor.offset!==a.anchor.offset||r.focus.offset!==a.focus.offset||!Wd(r,a))return!1}return!0};function rl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Jb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rl(Object(n),!0).forEach(function(r){xt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Xb=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=on(),s=J.findPath(i,a),o=N.parent(s),l=!!n[Md];return i.isVoid(r)?C.createElement(Ci,{length:oe.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&b.string(i,o)===""?C.createElement(Ci,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?C.createElement(Ci,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
107
+ `)&&c===u.textContent.length&&c--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var x;u=o,c=((x=o.textContent)===null||x===void 0?void 0:x.length)||0}var A=J.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!A)return null;var _=h?A:J.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!_)return null;var k={anchor:A,focus:_};return V.isExpanded(k)&&V.isForward(k)&&Ct(u)&&b.void(e,{at:k.focus,mode:"highest"})&&(k=b.unhangRange(e,k,{voids:!0})),k}};function Tb(e,t){var{path:n,diff:r}=t;if(!b.hasPath(e,n))return!1;var a=oe.get(e,n);if(!de.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=N.next(n);if(!b.hasPath(e,i))return!1;var s=oe.get(e,i);return de.isText(s)&&s.text.startsWith(r.text)}function zd(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.reduce((a,i)=>a.slice(0,i.start)+i.text+a.slice(i.end),e)}function Sb(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 jb(e,t,n){for(var r=Math.min(e.length,t.length,n),a=0;a<r;a++)if(e.charAt(e.length-a-1)!==t.charAt(t.length-a-1))return a;return r}function qd(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=Sb(i,a),o=Math.min(i.length-s,a.length-s),l=jb(i,a,o),u={start:n+s,end:r-l,text:a.slice(s,a.length-l)};return u.start===u.end&&u.text.length===0?null:u}function Ob(e,t,n){var r=Math.min(t.start,n.start),a=Math.max(0,Math.min(t.start+t.text.length,n.end)-n.start),i=zd(e,t,n),s=Math.max(n.start+n.text.length,t.start+t.text.length+(t.start+t.text.length>n.start?n.text.length:0)-a),o=i.slice(r,s),l=Math.max(t.end,n.end-t.text.length+(t.end-t.start));return qd(e,{start:r,end:l,text:o})}function Pb(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Cs(e,t){var{path:n,offset:r}=t;if(!b.hasPath(e,n))return null;var a=oe.get(e,n);if(!de.isText(a))return null;var i=b.above(e,{match:o=>ce.isElement(o)&&b.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=b.next(e,{at:n,match:de.isText});if(!s||!N.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Xu(e,t){var n=Cs(e,t.anchor);if(!n)return null;if(V.isCollapsed(t))return{anchor:n,focus:n};var r=Cs(e,t.focus);return r?{anchor:n,focus:r}:null}function xs(e,t,n){var r=ct.get(e),a=r==null?void 0:r.find(c=>{var{path:h}=c;return N.equals(h,t.path)});if(!a||t.offset<=a.diff.start)return Ee.transform(t,n,{affinity:"backward"});var{diff:i}=a;if(t.offset<=i.start+i.text.length){var s={path:t.path,offset:i.start},o=Ee.transform(s,n,{affinity:"backward"});return o?{path:o.path,offset:o.offset+t.offset-i.start}:null}var l={path:t.path,offset:t.offset-i.text.length+i.end-i.start},u=Ee.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&N.equals(n.path,t.path)&&l.offset<n.position&&i.start<n.position?u:{path:u.path,offset:u.offset+i.text.length-i.end+i.start}:null}function el(e,t,n){var r=xs(e,t.anchor,n);if(!r)return null;if(V.isCollapsed(t))return{anchor:r,focus:r};var a=xs(e,t.focus,n);return a?{anchor:r,focus:a}:null}function Nb(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!N.equals(t.path,n)||t.offset>=r.end?e:t.offset<=r.start?{diff:{start:t.text.length+r.start,end:t.text.length+r.end,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:a,path:n};case"remove_text":return!N.equals(t.path,n)||t.offset>=r.end?e:t.offset+t.text.length<=r.start?{diff:{start:r.start-t.text.length,end:r.end-t.text.length,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:a,path:n};case"split_node":return!N.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:N.transform(n,t,{affinity:"backward"})}:t.position>r.start?{diff:{start:r.start,end:Math.min(t.position,r.end),text:r.text},id:a,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:a,path:N.transform(n,t,{affinity:"forward"})};case"merge_node":return N.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:N.transform(n,t)}:{diff:r,id:a,path:N.transform(n,t)}}var i=N.transform(n,t);return i?{diff:r,path:i,id:a}:null}function tl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Yr(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){xt(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 Rb=25,Mb=200,Ib=function(){},$b=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function Lb(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,c=()=>{var w=Qt.get(t);if(Qt.delete(t),w){var{selection:E}=t,O=Xu(t,w);O&&(!E||!V.equals(O,E))&&G.select(t,O)}},h=()=>{var w=Gt.get(t);if(Gt.delete(t),!!w){if(w.at){var E=Ee.isPoint(w.at)?Cs(t,w.at):Xu(t,w.at);if(!E)return;var O=b.range(t,E);(!t.selection||!V.equals(t.selection,O))&&G.select(t,E)}w.run()}},m=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!_()&&!A()){c();return}a||(a=!0,setTimeout(()=>a=!1)),A()&&(a="action");var w=t.selection&&b.rangeRef(t,t.selection,{affinity:"forward"});Wt.set(t,t.marks),Ib("flush",Gt.get(t),ct.get(t));for(var E=_(),O;O=(j=ct.get(t))===null||j===void 0?void 0:j[0];){var j,q,z=_t.get(t);z!==void 0&&(_t.delete(t),t.marks=z),z&&u===!1&&(u=null);var re=Pb(O);(!t.selection||!V.equals(t.selection,re))&&G.select(t,re),O.diff.text?b.insertText(t,O.diff.text):b.deleteFragment(t),ct.set(t,(q=ct.get(t))===null||q===void 0?void 0:q.filter(H=>{var{id:ee}=H;return ee!==O.id})),Tb(t,O)||(E=!1,Gt.delete(t),Wt.delete(t),a="action",Qt.delete(t),n.cancel(),r.cancel(),w==null||w.unref())}var X=w==null?void 0:w.unref();if(X&&!Qt.get(t)&&(!t.selection||!V.equals(X,t.selection))&&G.select(t,X),A()){h();return}E&&n(),n.flush(),r.flush(),c();var v=Wt.get(t);Wt.delete(t),v!==void 0&&(t.marks=v,t.onChange())},p=w=>{i&&clearTimeout(i),i=setTimeout(()=>{mn.set(t,!1),m()},Rb)},g=w=>{mn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,O=vs.get(t);if(O){if(_()||E){O.style.display="none";return}O.style.removeProperty("display")}},y=(w,E)=>{var O,j=(O=ct.get(t))!==null&&O!==void 0?O:[];ct.set(t,j);var q=oe.leaf(t,w),z=j.findIndex(v=>N.equals(v.path,w));if(z<0){var re=qd(q.text,E);re&&j.push({path:w,diff:E,id:l++}),f();return}var X=Ob(q.text,j[z].diff,E);if(!X){j.splice(z,1),f();return}j[z]=Yr(Yr({},j[z]),{},{diff:X})},D=function(E){var{at:O}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,Qt.delete(t),n.cancel(),r.cancel(),A()&&m(),Gt.set(t,{at:O,run:E}),o=setTimeout(m)},x=w=>{var E;s&&(clearTimeout(s),s=null);var{inputType:O}=w,j=null,q=w.dataTransfer||w.data||void 0;u!==!1&&O!=="insertText"&&O!=="insertCompositionText"&&(u=!1);var[z]=w.getTargetRanges();z&&(j=J.toSlateRange(t,z,{exactMatch:!1,suppressThrow:!0}));var re=J.getWindow(t),X=re.getSelection();if(!j&&X&&(z=X,j=J.toSlateRange(t,X,{exactMatch:!1,suppressThrow:!0})),j=(E=j)!==null&&E!==void 0?E:t.selection,!!j){var v=!0;if(O.startsWith("delete")){if(V.isExpanded(j)){var[H,ee]=V.edges(j),B=oe.leaf(t,H.path);if(B.text.length===H.offset&&ee.offset===0){var T=b.next(t,{at:H.path,match:de.isText});T&&N.equals(T[1],ee.path)&&(j={anchor:ee,focus:ee})}}var W=O.endsWith("Backward")?"backward":"forward",[L,U]=V.edges(j),[te,ne]=b.leaf(t,L.path),ie={text:"",start:L.offset,end:U.offset},fe=ct.get(t),Q=fe==null?void 0:fe.find(ve=>N.equals(ve.path,ne)),pe=Q?[Q.diff,ie]:[ie],ge=zd(te.text,...pe);if(ge.length===0&&(v=!1),V.isExpanded(j)){if(v&&N.equals(j.anchor.path,j.focus.path)){var ke={path:j.anchor.path,offset:L.offset},xe=b.range(t,ke,ke);return S(xe),y(j.anchor.path,{text:"",end:U.offset,start:L.offset})}return D(()=>b.deleteFragment(t,{direction:W}),{at:j})}}switch(O){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return D(()=>b.deleteFragment(t),{at:j});case"deleteContent":case"deleteContentForward":{var{anchor:_e}=j;if(v&&V.isCollapsed(j)){var We=oe.leaf(t,_e.path);if(_e.offset<We.text.length)return y(_e.path,{text:"",start:_e.offset,end:_e.offset+1})}return D(()=>b.deleteForward(t),{at:j})}case"deleteContentBackward":{var Le,{anchor:Ue}=j,Qe=Ds(z)?z.isCollapsed:!!((Le=z)!==null&&Le!==void 0&&Le.collapsed);return v&&Qe&&V.isCollapsed(j)&&Ue.offset>0?y(Ue.path,{text:"",start:Ue.offset-1,end:Ue.offset}):D(()=>b.deleteBackward(t),{at:j})}case"deleteEntireSoftLine":return D(()=>{b.deleteBackward(t,{unit:"line"}),b.deleteForward(t,{unit:"line"})},{at:j});case"deleteHardLineBackward":return D(()=>b.deleteBackward(t,{unit:"block"}),{at:j});case"deleteSoftLineBackward":return D(()=>b.deleteBackward(t,{unit:"line"}),{at:j});case"deleteHardLineForward":return D(()=>b.deleteForward(t,{unit:"block"}),{at:j});case"deleteSoftLineForward":return D(()=>b.deleteForward(t,{unit:"line"}),{at:j});case"deleteWordBackward":return D(()=>b.deleteBackward(t,{unit:"word"}),{at:j});case"deleteWordForward":return D(()=>b.deleteForward(t,{unit:"word"}),{at:j});case"insertLineBreak":return D(()=>b.insertSoftBreak(t),{at:j});case"insertParagraph":return D(()=>b.insertBreak(t),{at:j});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if($b(q))return D(()=>J.insertData(t,q),{at:j});var he=q??"";if(_t.get(t)&&(he=he.replace("\uFEFF","")),O==="insertText"&&/.*\n.*\n$/.test(he)&&(he=he.slice(0,-1)),he.includes(`
108
+ `))return D(()=>{var ve=he.split(`
109
+ `);ve.forEach((we,Ye)=>{we&&b.insertText(t,we),Ye!==ve.length-1&&b.insertSoftBreak(t)})},{at:j});if(N.equals(j.anchor.path,j.focus.path)){var[Te,$e]=V.edges(j),K={start:Te.offset,end:$e.offset,text:he};if(he&&u&&O==="insertCompositionText"){var se=u.start+u.text.search(/\S|$/),me=K.start+K.text.search(/\S|$/);me===se+1&&K.end===u.start+u.text.length?(K.start-=1,u=null,I()):u=!1}else O==="insertText"?u===null?u=K:u&&V.isCollapsed(j)&&u.end+u.text.length===Te.offset?u=Yr(Yr({},u),{},{text:u.text+he}):u=!1:u=!1;if(v){y(Te.path,K);return}}return D(()=>b.insertText(t,he),{at:j})}}}},A=()=>!!Gt.get(t),_=()=>{var w;return!!((w=ct.get(t))!==null&&w!==void 0&&w.length)},k=()=>A()||_(),F=()=>a,S=w=>{Qt.set(t,w),s&&(clearTimeout(s),s=null);var{selection:E}=t;if(w){var O=!E||!N.equals(E.anchor.path,w.anchor.path),j=!E||!N.equals(E.anchor.path.slice(0,-1),w.anchor.path.slice(0,-1));(O&&u||j)&&(u=!1),(O||_())&&(s=setTimeout(m,Mb))}},$=()=>{(A()||!_())&&m()},R=w=>{_()||(f(!0),setTimeout(f))},I=()=>{A()||(o=setTimeout(m))},M=w=>{if(!(_()||A())&&w.some(O=>uo(t,O,w))){var E;(E=Rd.get(t))===null||E===void 0||E()}};return{flush:m,scheduleFlush:I,hasPendingDiffs:_,hasPendingAction:A,hasPendingChanges:k,isFlushing:F,handleUserSelect:S,handleCompositionEnd:p,handleCompositionStart:g,handleDOMBeforeInput:x,handleKeyDown:R,handleDomMutations:M,handleInput:$}}function zb(){var e=C.useRef(!1);return C.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Sr=ca?C.useLayoutEffect:C.useEffect;function qb(e,t,n){var[r]=C.useState(()=>new MutationObserver(t));Sr(()=>{r.takeRecords()}),C.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 Wb=["node"];function nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Hb(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){xt(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 Ub={subtree:!0,childList:!0,characterData:!0},Vb=ot?e=>{var{node:t}=e,n=Zn(e,Wb);if(!ot)return null;var r=on(),a=zb(),[i]=C.useState(()=>Lb(Hb({editor:r},n)));return qb(t,i.handleDomMutations,Ub),so.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,Kb=["anchor","focus"],Zb=["anchor","focus"],Yb=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),Wd=(e,t)=>{var n=Zn(e,Kb),r=Zn(t,Zb);return e[Yn]===t[Yn]&&Yb(n,r)},Gb=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(!V.equals(r,a)||!Wd(r,a))return!1}return!0},Qb=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(r.anchor.offset!==a.anchor.offset||r.focus.offset!==a.focus.offset||!Wd(r,a))return!1}return!0};function rl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Jb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?rl(Object(n),!0).forEach(function(r){xt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Xb=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=on(),s=J.findPath(i,a),o=N.parent(s),l=!!n[Md];return i.isVoid(r)?C.createElement(Ci,{length:oe.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&b.string(i,o)===""?C.createElement(Ci,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?C.createElement(Ci,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
110
110
  `?C.createElement(al,{isTrailing:!0,text:n.text}):C.createElement(al,{text:n.text})},al=e=>{var{text:t,isTrailing:n=!1}=e,r=C.useRef(null),a=()=>"".concat(t??"").concat(n?`
111
- `:""),[i]=C.useState(a);return Sr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),C.createElement(ey,{ref:r},i)},ey=C.memo(C.forwardRef((e,t)=>C.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Ci=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),C.createElement("span",Jb({},a),!ot||!n?"\uFEFF":null,n?C.createElement("br",null):null)};function il(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Hd(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){xt(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 ty=ot?300:0;function ny(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function sl(e){e.current&&(clearTimeout(e.current),e.current=null)}var ry=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=w=>C.createElement(iy,Hd({},w))}=e,o=on(),l=C.useRef(null),u=C.useRef(null),[c,h]=C.useState(!1),m=C.useRef(null),p=C.useCallback(w=>{if(ny(l,w==null),w==null){var A;vs.delete(o),(A=t.onPlaceholderResize)===null||A===void 0||A.call(t,null)}else{if(vs.set(o,w),!l.current){var _=window.ResizeObserver||ib;l.current=new _(()=>{var k;(k=t.onPlaceholderResize)===null||k===void 0||k.call(t,w)})}l.current.observe(w),u.current=w}},[u,t,o]),g=C.createElement(Xb,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[Gn];if(C.useEffect(()=>(f?m.current||(m.current=setTimeout(()=>{h(!0),m.current=null},ty)):(sl(m),h(!1)),()=>sl(m)),[f,h]),f&&c){var D={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:mr?"inherit":void 0},contentEditable:!1,ref:p}};g=C.createElement(C.Fragment,null,i(D),g)}var y={"data-slate-leaf":!0};return s({attributes:y,children:g,leaf:t,text:r})},ay=C.memo(ry,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&de.equals(t.leaf,e.leaf)&&t.leaf[Gn]===e.leaf[Gn]),iy=e=>{var{attributes:t,children:n}=e;return C.createElement("span",Hd({},t),n)},sy=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=on(),l=C.useRef(null),u=de.decorations(s,t),c=J.findKey(o,s),h=[],m=0;m<u.length;m++){var p=u[m];h.push(C.createElement(ay,{isLast:n&&m===u.length-1,key:"".concat(c.id,"-").concat(m),renderPlaceholder:a,leaf:p,text:s,parent:r,renderLeaf:i}))}var g=C.useCallback(f=>{var D=Za.get(o);f?(D==null||D.set(c,f),bn.set(s,f),Tr.set(f,s)):(D==null||D.delete(c),bn.delete(s),l.current&&Tr.delete(l.current)),l.current=f},[l,o,c,s]);return C.createElement("span",{"data-slate-node":"text",ref:g},h)},Ud=C.memo(sy,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&Qb(t.decorations,e.decorations));function ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ws(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){xt(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 oy=e=>{var{decorations:t,element:n,renderElement:r=w=>C.createElement(ly,ws({},w)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=on(),l=fy(),u=o.isInline(n),c=J.findKey(o,n),h=C.useCallback(w=>{var A=Za.get(o);w?(A==null||A.set(c,w),bn.set(n,w),Tr.set(w,n)):(A==null||A.delete(c),bn.delete(n))},[o,c,n]),m=Kd({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),p={"data-slate-node":"element",ref:h};if(u&&(p["data-slate-inline"]=!0),!u&&b.hasInlines(o,n)){var g=oe.string(n),f=bd(g);f==="rtl"&&(p.dir=f)}if(b.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var D=u?"span":"div",[[y]]=oe.texts(n);m=C.createElement(D,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},C.createElement(Ud,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:y})),ao.set(y,0),io.set(y,n)}return r({attributes:p,children:m,element:n})},uy=C.memo(oy,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&Gb(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&V.equals(e.selection,t.selection))),ly=e=>{var{attributes:t,children:n,element:r}=e,a=on(),i=a.isInline(r)?"span":"div";return C.createElement(i,ws(ws({},t),{},{style:{position:"relative"}}),n)},Vd=C.createContext(()=>[]),cy=()=>C.useContext(Vd),dy=C.createContext(!1),Kd=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=cy(),l=on(),u=J.findPath(l,n),c=[],h=ce.isElement(n)&&!l.isInline(n)&&b.hasInlines(l,n),m=0;m<n.children.length;m++){var p=u.concat(m),g=n.children[m],f=J.findKey(l,g),D=b.range(l,p),y=s&&V.intersection(D,s),w=o([g,p]);for(var A of t){var _=V.intersection(A,D);_&&w.push(_)}ce.isElement(g)?c.push(C.createElement(dy.Provider,{key:"provider-".concat(f.id),value:!!y},C.createElement(uy,{decorations:w,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:y}))):c.push(C.createElement(Ud,{decorations:w,key:f.id,isLast:h&&m===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),ao.set(g,m),io.set(g,n)}return c},Zd=C.createContext(!1),fy=()=>C.useContext(Zd),Yd=C.createContext(null),Bn=()=>{var e=C.useContext(Yd);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function hy(){var e=on(),t=C.useRef(!1),n=C.useRef(0),r=C.useCallback(()=>{if(!t.current){t.current=!0;var a=J.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return C.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var my=3,py={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"},gy={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"},vy={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},qe=e=>{var t=py[e],n=gy[e],r=vy[e],a=t&&Di(t),i=n&&Di(n),s=r&&Di(r);return o=>!!(a&&a(o)||Ju&&i&&i(o)||!Ju&&s&&s(o))},He={isBold:qe("bold"),isCompose:qe("compose"),isMoveBackward:qe("moveBackward"),isMoveForward:qe("moveForward"),isDeleteBackward:qe("deleteBackward"),isDeleteForward:qe("deleteForward"),isDeleteLineBackward:qe("deleteLineBackward"),isDeleteLineForward:qe("deleteLineForward"),isDeleteWordBackward:qe("deleteWordBackward"),isDeleteWordForward:qe("deleteWordForward"),isExtendBackward:qe("extendBackward"),isExtendForward:qe("extendForward"),isExtendLineBackward:qe("extendLineBackward"),isExtendLineForward:qe("extendLineForward"),isItalic:qe("italic"),isMoveLineBackward:qe("moveLineBackward"),isMoveLineForward:qe("moveLineForward"),isMoveWordBackward:qe("moveWordBackward"),isMoveWordForward:qe("moveWordForward"),isRedo:qe("redo"),isSoftBreak:qe("insertSoftBreak"),isSplitBlock:qe("splitBlock"),isTransposeCharacter:qe("transposeCharacter"),isUndo:qe("undo")},by=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>uo(e,l,s));n.push(...o)}};function i(){n.length>0&&(n.reverse().forEach(s=>{s.type!=="characterData"&&(s.removedNodes.forEach(o=>{s.target.insertBefore(o,s.nextSibling)}),s.addedNodes.forEach(o=>{s.target.removeChild(o)}))}),r())}return{registerMutations:a,restoreDOM:i,clear:r}},yy={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Gd extends C.Component{constructor(){super(...arguments),xt(this,"context",null),xt(this,"manager",null),xt(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,yy)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=by(n,t),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var t,n,r,a=(t=this.mutationObserver)===null||t===void 0?void 0:t.takeRecords();if(a!=null&&a.length){var i;(i=this.manager)===null||i===void 0||i.registerMutations(a)}return(n=this.mutationObserver)===null||n===void 0||n.disconnect(),(r=this.manager)===null||r===void 0||r.restoreDOM(),null}componentDidUpdate(){var t;(t=this.manager)===null||t===void 0||t.clear(),this.observe()}componentWillUnmount(){var t;(t=this.mutationObserver)===null||t===void 0||t.disconnect()}render(){return this.props.children}}xt(Gd,"contextType",ro);var Dy=ot?Gd:e=>{var{children:t}=e;return C.createElement(C.Fragment,null,t)},Cy=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],xy=["text"];function ul(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Tt(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){xt(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 wy=e=>C.createElement(C.Fragment,null,Kd(e)),Ey=e=>{var t=C.useCallback(T=>C.createElement(ky,Tt({},T)),[]),{autoFocus:n,decorate:r=_y,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=By,style:h={},as:m="div",disableDefaultStyles:p=!1}=e,g=Yn(e,Cy),f=Bn(),[D,y]=C.useState(!1),w=C.useRef(null),A=C.useRef([]),[_,k]=C.useState(),{onUserInput:F,receivedUserInput:S}=hy(),[,$]=C.useReducer(T=>T+1,0);Rd.set(f,$),bs.set(f,s);var R=C.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);C.useEffect(()=>{w.current&&n&&w.current.focus()},[n]);var I=C.useRef(),M=C.useMemo(()=>N0(()=>{var T=I.current;if((ot||!J.isComposing(f))&&(!R.isUpdatingSelection||T!=null&&T.isFlushing())&&!R.isDraggingInternally){var W=J.findDocumentOrShadowRoot(f),{activeElement:L}=W,U=J.toDOMNode(f,f),te=W.getSelection();if(L===U?(R.latestElement=L,en.set(f,!0)):en.delete(f),!te)return G.deselect(f);var{anchorNode:ne,focusNode:ie}=te,fe=J.hasEditableTarget(f,ne)||J.isTargetInsideNonReadonlyVoid(f,ne),Q=J.hasEditableTarget(f,ie)||J.isTargetInsideNonReadonlyVoid(f,ie);if(fe&&Q){var pe=J.toSlateRange(f,te,{exactMatch:!1,suppressThrow:!0});pe&&(!J.isComposing(f)&&!(T!=null&&T.hasPendingChanges())&&!(T!=null&&T.isFlushing())?G.select(f,pe):T==null||T.handleUserSelect(pe))}s&&(!fe||!Q)&&G.deselect(f)}},100),[f,s,R]),x=C.useMemo(()=>F0(M,0),[M]);I.current=Vb({node:w,onDOMSelectionChange:M,scheduleOnDOMSelectionChange:x}),Sr(()=>{var T,W,L;w.current&&(L=oo(w.current))?(Nd.set(f,L),da.set(f,w.current),bn.set(f,w.current),Tr.set(w.current,f)):bn.delete(f);var{selection:U}=f,te=J.findDocumentOrShadowRoot(f),ne=te.getSelection();if(!(!ne||!J.isFocused(f)||(T=I.current)!==null&&T!==void 0&&T.hasPendingAction())){var ie=ge=>{var ke=ne.type!=="None";if(!(!U&&!ke)){var xe=ne.focusNode,_e;if(Ln&&ne.rangeCount>1){var We=ne.getRangeAt(0),Le=ne.getRangeAt(ne.rangeCount-1);We.startContainer===xe?_e=Le.endContainer:_e=We.startContainer}else _e=ne.anchorNode;var Ue=da.get(f),Qe=!1;if(Ue.contains(_e)&&Ue.contains(xe)&&(Qe=!0),ke&&Qe&&U&&!ge){var he=J.toSlateRange(f,ne,{exactMatch:!0,suppressThrow:!0});if(he&&V.equals(he,U)){var Te;if(!R.hasMarkPlaceholder||(Te=_e)!==null&&Te!==void 0&&(Te=Te.parentElement)!==null&&Te!==void 0&&Te.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!J.hasRange(f,U)){f.selection=J.toSlateRange(f,ne,{exactMatch:!1,suppressThrow:!0});return}R.isUpdatingSelection=!0;var $e=U&&J.toDOMRange(f,U);return $e?(J.isComposing(f)&&!ot?ne.collapseToEnd():V.isBackward(U)?ne.setBaseAndExtent($e.endContainer,$e.endOffset,$e.startContainer,$e.startOffset):ne.setBaseAndExtent($e.startContainer,$e.startOffset,$e.endContainer,$e.endOffset),c(f,$e)):ne.removeAllRanges(),$e}};ne.rangeCount<=1&&ie();var fe=((W=I.current)===null||W===void 0?void 0:W.isFlushing())==="action";if(!ot||!fe){setTimeout(()=>{R.isUpdatingSelection=!1});return}var Q=null,pe=requestAnimationFrame(()=>{if(fe){var ge=ke=>{try{var xe=J.toDOMNode(f,f);xe.focus(),ie(ke)}catch{}};ge(),Q=setTimeout(()=>{ge(!0),R.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(pe),Q&&clearTimeout(Q)}}});var E=C.useCallback(T=>{if(F(),!s&&J.hasEditableTarget(f,T.target)&&!Ay(T,a)){var W;if(I.current)return I.current.handleDOMBeforeInput(T);x.flush(),M.flush();var{selection:L}=f,{inputType:U}=T,te=T.dataTransfer||T.data||void 0,ne=U==="insertCompositionText"||U==="deleteCompositionText";if(ne&&J.isComposing(f))return;var ie=!1;if(U==="insertText"&&L&&V.isCollapsed(L)&&T.data&&T.data.length===1&&/[a-z ]/i.test(T.data)&&L.anchor.offset!==0){var fe,Q;ie=!0,f.marks&&(ie=!1);var{anchor:pe}=L,[ge,ke]=J.toDOMPoint(f,pe),xe=(fe=ge.parentElement)===null||fe===void 0?void 0:fe.closest("a"),_e=J.getWindow(f);if(ie&&xe&&J.hasDOMNode(f,xe)){var We,Le=_e==null?void 0:_e.document.createTreeWalker(xe,NodeFilter.SHOW_TEXT).lastChild();Le===ge&&((We=Le.textContent)===null||We===void 0?void 0:We.length)===ke&&(ie=!1)}if(ie&&ge.parentElement&&(_e==null||(Q=_e.getComputedStyle(ge.parentElement))===null||Q===void 0?void 0:Q.whiteSpace)==="pre"){var Ue=b.above(f,{at:pe.path,match:se=>ce.isElement(se)&&b.isBlock(f,se)});Ue&&oe.string(Ue[0]).includes(" ")&&(ie=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[Qe]=T.getTargetRanges();if(Qe){var he=J.toSlateRange(f,Qe,{exactMatch:!1,suppressThrow:!1});if(!L||!V.equals(L,he)){ie=!1;var Te=!ne&&f.selection&&b.rangeRef(f,f.selection);G.select(f,he),Te&&br.set(f,Te)}}}if(ne)return;if(ie||T.preventDefault(),L&&V.isExpanded(L)&&U.startsWith("delete")){var $e=U.endsWith("Backward")?"backward":"forward";b.deleteFragment(f,{direction:$e});return}switch(U){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{b.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{b.deleteForward(f);break}case"deleteContentBackward":{b.deleteBackward(f);break}case"deleteEntireSoftLine":{b.deleteBackward(f,{unit:"line"}),b.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{b.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{b.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{b.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{b.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{b.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{b.deleteForward(f,{unit:"word"});break}case"insertLineBreak":b.insertSoftBreak(f);break;case"insertParagraph":{b.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{U==="insertFromComposition"&&J.isComposing(f)&&(y(!1),mn.set(f,!1)),(te==null?void 0:te.constructor.name)==="DataTransfer"?J.insertData(f,te):typeof te=="string"&&(ie?A.current.push(()=>b.insertText(f,te)):b.insertText(f,te));break}}var K=(W=br.get(f))===null||W===void 0?void 0:W.unref();br.delete(f),K&&(!f.selection||!V.equals(f.selection,K))&&G.select(f,K)}},[f,M,F,a,s,x]),O=C.useCallback(T=>{T==null?(M.cancel(),x.cancel(),da.delete(f),bn.delete(f),w.current&&Zt&&w.current.removeEventListener("beforeinput",E)):Zt&&T.addEventListener("beforeinput",E),w.current=T},[M,x,f,E]);Sr(()=>{var T=J.getWindow(f);return T.document.addEventListener("selectionchange",x),()=>{T.document.removeEventListener("selectionchange",x)}},[x]);var j=r([f,[]]),q=i&&f.children.length===1&&Array.from(oe.texts(f)).length===1&&oe.string(f)===""&&!D,z=C.useCallback(T=>{if(T&&q){var W;k((W=T.getBoundingClientRect())===null||W===void 0?void 0:W.height)}else k(void 0)},[q]);if(q){var re=b.start(f,[]);j.push({[Gn]:!0,placeholder:i,onPlaceholderResize:z,anchor:re,focus:re})}var{marks:X}=f;if(R.hasMarkPlaceholder=!1,f.selection&&V.isCollapsed(f.selection)&&X){var{anchor:v}=f.selection,H=oe.leaf(f,v.path),ee=Yn(H,xy);if(!de.equals(H,X,{loose:!0})){R.hasMarkPlaceholder=!0;var B=Object.fromEntries(Object.keys(ee).map(T=>[T,null]));j.push(Tt(Tt(Tt({[Md]:!0},B),X),{},{anchor:v,focus:v}))}}return C.useEffect(()=>{setTimeout(()=>{var{selection:T}=f;if(T){var{anchor:W}=T,L=oe.leaf(f,W.path);if(X&&!de.equals(L,X,{loose:!0})){_t.set(f,X);return}}_t.delete(f)})}),C.createElement(Zd.Provider,{value:s},C.createElement(Vd.Provider,{value:r},C.createElement(Dy,{node:w,receivedUserInput:S},C.createElement(m,Tt(Tt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Zt||!ca?g.spellCheck:!1,autoCorrect:Zt||!ca?g.autoCorrect:"false",autoCapitalize:Zt||!ca?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:O,style:Tt(Tt({},p?{}:Tt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},_?{minHeight:_}:{})),h),onBeforeInput:C.useCallback(T=>{if(!Zt&&!s&&!at(T,g.onBeforeInput)&&J.hasSelectableTarget(f,T.target)&&(T.preventDefault(),!J.isComposing(f))){var W=T.data;b.insertText(f,W)}},[g.onBeforeInput,f,s]),onInput:C.useCallback(T=>{if(!at(T,g.onInput)){if(I.current){I.current.handleInput();return}for(var W of A.current)W();A.current=[]}},[g.onInput]),onBlur:C.useCallback(T=>{if(!(s||R.isUpdatingSelection||!J.hasSelectableTarget(f,T.target)||at(T,g.onBlur))){var W=J.findDocumentOrShadowRoot(f);if(R.latestElement!==W.activeElement){var{relatedTarget:L}=T,U=J.toDOMNode(f,f);if(L!==U&&!(Ct(L)&&L.hasAttribute("data-slate-spacer"))){if(L!=null&&nn(L)&&J.hasDOMNode(f,L)){var te=J.toSlateNode(f,L);if(ce.isElement(te)&&!f.isVoid(te))return}if(mr){var ne=W.getSelection();ne==null||ne.removeAllRanges()}en.delete(f)}}}},[s,R.isUpdatingSelection,R.latestElement,f,g.onBlur]),onClick:C.useCallback(T=>{if(J.hasTarget(f,T.target)&&!at(T,g.onClick)&&nn(T.target)){var W=J.toSlateNode(f,T.target),L=J.findPath(f,W);if(!b.hasPath(f,L)||oe.get(f,L)!==W)return;if(T.detail===my&&L.length>=1){var U=L;if(!(ce.isElement(W)&&b.isBlock(f,W))){var te,ne=b.above(f,{match:xe=>ce.isElement(xe)&&b.isBlock(f,xe),at:L});U=(te=ne==null?void 0:ne[1])!==null&&te!==void 0?te:L.slice(0,1)}var ie=b.range(f,U);G.select(f,ie);return}if(s)return;var fe=b.start(f,L),Q=b.end(f,L),pe=b.void(f,{at:fe}),ge=b.void(f,{at:Q});if(pe&&ge&&N.equals(pe[1],ge[1])){var ke=b.range(f,fe);G.select(f,ke)}}},[f,g.onClick,s]),onCompositionEnd:C.useCallback(T=>{if(J.hasSelectableTarget(f,T.target)){var W;if(J.isComposing(f)&&Promise.resolve().then(()=>{y(!1),mn.set(f,!1)}),(W=I.current)===null||W===void 0||W.handleCompositionEnd(T),at(T,g.onCompositionEnd)||ot)return;if(!mr&&!vb&&!hb&&!yb&&!bb&&T.data){var L=_t.get(f);_t.delete(f),L!==void 0&&(Wt.set(f,f.marks),f.marks=L),b.insertText(f,T.data);var U=Wt.get(f);Wt.delete(f),U!==void 0&&(f.marks=U)}}},[g.onCompositionEnd,f]),onCompositionUpdate:C.useCallback(T=>{J.hasSelectableTarget(f,T.target)&&!at(T,g.onCompositionUpdate)&&(J.isComposing(f)||(y(!0),mn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:C.useCallback(T=>{if(J.hasSelectableTarget(f,T.target)){var W;if((W=I.current)===null||W===void 0||W.handleCompositionStart(T),at(T,g.onCompositionStart)||ot)return;y(!0);var{selection:L}=f;if(L&&V.isExpanded(L)){b.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:C.useCallback(T=>{J.hasSelectableTarget(f,T.target)&&!at(T,g.onCopy)&&!ll(T)&&(T.preventDefault(),J.setFragmentData(f,T.clipboardData,"copy"))},[g.onCopy,f]),onCut:C.useCallback(T=>{if(!s&&J.hasSelectableTarget(f,T.target)&&!at(T,g.onCut)&&!ll(T)){T.preventDefault(),J.setFragmentData(f,T.clipboardData,"cut");var{selection:W}=f;if(W)if(V.isExpanded(W))b.deleteFragment(f);else{var L=oe.parent(f,W.anchor.path);b.isVoid(f,L)&&G.delete(f)}}},[s,f,g.onCut]),onDragOver:C.useCallback(T=>{if(J.hasTarget(f,T.target)&&!at(T,g.onDragOver)){var W=J.toSlateNode(f,T.target);ce.isElement(W)&&b.isVoid(f,W)&&T.preventDefault()}},[g.onDragOver,f]),onDragStart:C.useCallback(T=>{if(!s&&J.hasTarget(f,T.target)&&!at(T,g.onDragStart)){var W=J.toSlateNode(f,T.target),L=J.findPath(f,W),U=ce.isElement(W)&&b.isVoid(f,W)||b.void(f,{at:L,voids:!0});if(U){var te=b.range(f,L);G.select(f,te)}R.isDraggingInternally=!0,J.setFragmentData(f,T.dataTransfer,"drag")}},[s,f,g.onDragStart,R]),onDrop:C.useCallback(T=>{if(!s&&J.hasTarget(f,T.target)&&!at(T,g.onDrop)){T.preventDefault();var W=f.selection,L=J.findEventRange(f,T),U=T.dataTransfer;G.select(f,L),R.isDraggingInternally&&W&&!V.equals(W,L)&&!b.void(f,{at:L,voids:!0})&&G.delete(f,{at:W}),J.insertData(f,U),J.isFocused(f)||J.focus(f)}R.isDraggingInternally=!1},[s,f,g.onDrop,R]),onDragEnd:C.useCallback(T=>{!s&&R.isDraggingInternally&&g.onDragEnd&&J.hasTarget(f,T.target)&&g.onDragEnd(T),R.isDraggingInternally=!1},[s,R,g,f]),onFocus:C.useCallback(T=>{if(!s&&!R.isUpdatingSelection&&J.hasEditableTarget(f,T.target)&&!at(T,g.onFocus)){var W=J.toDOMNode(f,f),L=J.findDocumentOrShadowRoot(f);if(R.latestElement=L.activeElement,Ln&&T.target!==W){W.focus();return}en.set(f,!0)}},[s,R,f,g.onFocus]),onKeyDown:C.useCallback(T=>{if(!s&&J.hasEditableTarget(f,T.target)){var W;(W=I.current)===null||W===void 0||W.handleKeyDown(T);var{nativeEvent:L}=T;if(J.isComposing(f)&&L.isComposing===!1&&(mn.set(f,!1),y(!1)),at(T,g.onKeyDown)||J.isComposing(f))return;var{selection:U}=f,te=f.children[U!==null?U.focus.path[0]:0],ne=bd(oe.string(te))==="rtl";if(He.isRedo(L)){T.preventDefault();var ie=f;typeof ie.redo=="function"&&ie.redo();return}if(He.isUndo(L)){T.preventDefault();var fe=f;typeof fe.undo=="function"&&fe.undo();return}if(He.isMoveLineBackward(L)){T.preventDefault(),G.move(f,{unit:"line",reverse:!0});return}if(He.isMoveLineForward(L)){T.preventDefault(),G.move(f,{unit:"line"});return}if(He.isExtendLineBackward(L)){T.preventDefault(),G.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(He.isExtendLineForward(L)){T.preventDefault(),G.move(f,{unit:"line",edge:"focus"});return}if(He.isMoveBackward(L)){T.preventDefault(),U&&V.isCollapsed(U)?G.move(f,{reverse:!ne}):G.collapse(f,{edge:ne?"end":"start"});return}if(He.isMoveForward(L)){T.preventDefault(),U&&V.isCollapsed(U)?G.move(f,{reverse:ne}):G.collapse(f,{edge:ne?"start":"end"});return}if(He.isMoveWordBackward(L)){T.preventDefault(),U&&V.isExpanded(U)&&G.collapse(f,{edge:"focus"}),G.move(f,{unit:"word",reverse:!ne});return}if(He.isMoveWordForward(L)){T.preventDefault(),U&&V.isExpanded(U)&&G.collapse(f,{edge:"focus"}),G.move(f,{unit:"word",reverse:ne});return}if(Zt){if((Pd||mr)&&U&&(He.isDeleteBackward(L)||He.isDeleteForward(L))&&V.isCollapsed(U)){var Q=oe.parent(f,U.anchor.path);if(ce.isElement(Q)&&b.isVoid(f,Q)&&(b.isInline(f,Q)||b.isBlock(f,Q))){T.preventDefault(),b.deleteBackward(f,{unit:"block"});return}}}else{if(He.isBold(L)||He.isItalic(L)||He.isTransposeCharacter(L)){T.preventDefault();return}if(He.isSoftBreak(L)){T.preventDefault(),b.insertSoftBreak(f);return}if(He.isSplitBlock(L)){T.preventDefault(),b.insertBreak(f);return}if(He.isDeleteBackward(L)){T.preventDefault(),U&&V.isExpanded(U)?b.deleteFragment(f,{direction:"backward"}):b.deleteBackward(f);return}if(He.isDeleteForward(L)){T.preventDefault(),U&&V.isExpanded(U)?b.deleteFragment(f,{direction:"forward"}):b.deleteForward(f);return}if(He.isDeleteLineBackward(L)){T.preventDefault(),U&&V.isExpanded(U)?b.deleteFragment(f,{direction:"backward"}):b.deleteBackward(f,{unit:"line"});return}if(He.isDeleteLineForward(L)){T.preventDefault(),U&&V.isExpanded(U)?b.deleteFragment(f,{direction:"forward"}):b.deleteForward(f,{unit:"line"});return}if(He.isDeleteWordBackward(L)){T.preventDefault(),U&&V.isExpanded(U)?b.deleteFragment(f,{direction:"backward"}):b.deleteBackward(f,{unit:"word"});return}if(He.isDeleteWordForward(L)){T.preventDefault(),U&&V.isExpanded(U)?b.deleteFragment(f,{direction:"forward"}):b.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:C.useCallback(T=>{!s&&J.hasEditableTarget(f,T.target)&&!at(T,g.onPaste)&&(!Zt||xb(T.nativeEvent)||mr)&&(T.preventDefault(),J.insertData(f,T.clipboardData))},[s,f,g.onPaste])}),C.createElement(wy,{decorations:j,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},ky=e=>{var{attributes:t,children:n}=e;return C.createElement("span",Tt({},t),n,ot&&C.createElement("br",null))},_y=()=>[],By=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&V.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),I0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},at=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},ll=e=>nn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),Ay=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},Fy=C.createContext(!1),Ty=C.createContext({});function Sy(e){var t=C.useRef([]).current,n=C.useRef({editor:e}).current,r=C.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=C.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var jy=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],Oy=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Yn(e,jy),[l,u]=C.useState(()=>{if(!oe.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Je.stringify(s)));if(!b.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Je.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:c,onChange:h}=Sy(t),m=C.useCallback(f=>{var D;switch(r&&r(t.children),f==null||(D=f.operation)===null||D===void 0?void 0:D.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(y=>({v:y.v+1,editor:t})),h(t)},[t,h,r,a,i]);C.useEffect(()=>(ys.set(t,m),()=>{ys.set(t,()=>{})}),[t,m]);var[p,g]=C.useState(J.isFocused(t));return C.useEffect(()=>{g(J.isFocused(t))},[t]),Sr(()=>{var f=()=>g(J.isFocused(t));return Od>=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)})},[]),C.createElement(Ty.Provider,{value:c},C.createElement(Yd.Provider,{value:l},C.createElement(ro.Provider,{value:l.editor},C.createElement(Fy.Provider,{value:p},n))))},cl=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},dl=(e,t,n)=>{var r=J.toDOMRange(e,t).getBoundingClientRect(),a=J.toDOMRange(e,n).getBoundingClientRect();return cl(r,a)&&cl(a,r)},Py=(e,t)=>{var n=b.range(e,V.end(t)),r=Array.from(b.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(dl(e,b.range(e,r[a]),n))return b.range(e,r[a],n);if(r.length<2)return b.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)dl(e,b.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return b.range(e,r[i],n)};function fl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function hl(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){xt(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 Ny=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",r=t,{apply:a,onChange:i,deleteBackward:s,addMark:o,removeMark:l}=r;return Za.set(r,new WeakMap),r.addMark=(u,c)=>{var h,m;(h=so.get(r))===null||h===void 0||h(),!_t.get(r)&&(m=ct.get(r))!==null&&m!==void 0&&m.length&&_t.set(r,null),Wt.delete(r),o(u,c)},r.removeMark=u=>{var c;!_t.get(r)&&(c=ct.get(r))!==null&&c!==void 0&&c.length&&_t.set(r,null),Wt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&V.isCollapsed(r.selection)){var c=b.above(r,{match:g=>ce.isElement(g)&&b.isBlock(r,g),at:r.selection});if(c){var[,h]=c,m=b.range(r,h,r.selection.anchor),p=Py(r,m);V.isCollapsed(p)||G.delete(r,{at:p})}}},r.apply=u=>{var c=[],h=[],m=ct.get(r);if(m!=null&&m.length){var p=m.map(O=>Nb(O,u)).filter(Boolean);ct.set(r,p)}var g=Qt.get(r);g&&Qt.set(r,el(r,g,u));var f=Gt.get(r);if(f!=null&&f.at){var D=Ee.isPoint(f==null?void 0:f.at)?xs(r,f.at,u):el(r,f.at,u);Gt.set(r,D?hl(hl({},f),{},{at:D}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...jn(r,u.path));break}case"set_selection":{var y;(y=br.get(r))===null||y===void 0||y.unref(),br.delete(r);break}case"insert_node":case"remove_node":{c.push(...jn(r,N.parent(u.path)));break}case"merge_node":{var w=N.previous(u.path);c.push(...jn(r,w));break}case"move_node":{var A=N.common(N.parent(u.path),N.parent(u.newPath));c.push(...jn(r,A));var _;N.isBefore(u.path,u.newPath)?(c.push(...jn(r,N.parent(u.path))),_=u.newPath):(c.push(...jn(r,N.parent(u.newPath))),_=u.path);var k=oe.get(t,N.parent(_)),F=J.findKey(r,k),S=b.pathRef(r,N.parent(_));h.push([S,F]);break}}a(u);for(var[$,R]of c){var[I]=b.node(r,$);ka.set(I,R)}for(var[M,x]of h)if(M.current){var[E]=b.node(r,M.current);ka.set(E,x)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[h,m]=V.edges(c),p=b.void(r,{at:h.path}),g=b.void(r,{at:m.path});if(!(V.isCollapsed(c)&&!p)){var f=J.toDOMRange(r,c),D=f.cloneContents(),y=D.childNodes[0];if(D.childNodes.forEach(I=>{I.textContent&&I.textContent.trim()!==""&&(y=I)}),g){var[w]=g,A=f.cloneRange(),_=J.toDOMNode(r,w);A.setEndAfter(_),D=A.cloneContents()}if(p&&(y=D.querySelector("[data-slate-spacer]")),Array.from(D.querySelectorAll("[data-slate-zero-width]")).forEach(I=>{var M=I.getAttribute("data-slate-zero-width")==="n";I.textContent=M?`
112
- `:""}),Id(y)){var k=y.ownerDocument.createElement("span");k.style.whiteSpace="pre",k.appendChild(y),D.appendChild(k),y=k}var F=r.getFragment(),S=JSON.stringify(F),$=window.btoa(encodeURIComponent(S));y.setAttribute("data-slate-fragment",$),u.setData("application/".concat(n),$);var R=D.ownerDocument.createElement("div");return R.appendChild(D),R.setAttribute("hidden","true"),D.ownerDocument.body.appendChild(R),u.setData("text/html",R.innerHTML),u.setData("text/plain",Ld(R)),D.ownerDocument.body.removeChild(R),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||Bb(u);if(c){var h=decodeURIComponent(window.atob(c)),m=JSON.parse(h);return r.insertFragment(m),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var h=c.split(/\r\n|\r|\n/),m=!1;for(var p of h)m&&G.splitNodes(r,{always:!0}),r.insertText(p),m=!0;return!0}return!1},r.onChange=u=>{var c=Od<18?vc.unstable_batchedUpdates:h=>h();c(()=>{var h=ys.get(r);h&&h(u),i(u)})},r},jn=(e,t)=>{var n=[];for(var[r,a]of b.levels(e,{at:t})){var i=J.findKey(e,r);n.push([a,i])}return n};const Ry={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null},lastAnchor:null,dispatch:()=>{},reportError:e=>{console.error(e)}},Kt=C.createContext(Ry);var Z=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e))(Z||{}),Ot=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Ot||{});const My=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case Z.blockquote:return d.jsx("blockquote",{className:"subtle",...e,children:t});case Z.link:return d.jsx("a",{...e,children:t});case Z.li:return d.jsx("li",{...e,children:t});case Z.mention:const a=r;return d.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case Z.ol:return d.jsx("ol",{...e,children:t});case Z.ul:return d.jsx("ul",{...e,children:t});case Z.span:return d.jsx("span",{...e,children:t});case Z.paragraph:return d.jsx("p",{...e,children:t});default:return d.jsx("span",{...e,children:t})}},Iy=({attributes:e,children:t,leaf:n})=>{const r=n;return r[Z.bold]&&(t=d.jsx("strong",{children:t})),r[Z.italic]&&(t=d.jsx("em",{children:t})),r[Z.strikethrough]&&(t=d.jsx("s",{children:t})),d.jsx("span",{...e,children:t})},Es="MENTION: ",Qd={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},ml={"mention-popover":35,default:-52},xi=16,Jd=(e,t,n)=>{const r=C.useRef(null),{showLinkEditor:a,mentionPopover:i}=C.useContext(Kt),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),C.useEffect(()=>{var p,g;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,c=0;if(t==="mention-popover"){const{position:f}=i,D=A=>{if(!b.hasPath(e,A.path))return!1;const _=oe.get(e,A.path);return b.isEditor(_)||ce.isElement(_)?A.offset<=_.children.length:de.isText(_)?A.offset<=_.text.length:!1};if(f&&(!D(f==null?void 0:f.anchor)||!D(f==null?void 0:f.focus)))return;u=J.toDOMRange(e,f||Qd).getBoundingClientRect();const w=(p=document.getElementById(n))==null?void 0:p.getBoundingClientRect();l.style.setProperty("--width",`${((w==null?void 0:w.width)||0)/xi}rem`),c=(w==null?void 0:w.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(u=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}u||(u=(g=document.getElementById(n))==null?void 0:g.getBoundingClientRect());const h=ml[t]||ml.default,m=((u==null?void 0:u.top)||0)+window.scrollY+h;c===0&&(c=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${m/xi}rem`,l.style.left=`${c/xi}rem`},o),r},$y=e=>{const[t,n]=C.useState(null);return C.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=b.nodes(e,{at:r,match:i=>i.type===Z.link});if(a){const i=a[0],s=Mc(i.link),o=i.children[0],l=(o==null?void 0:o.text)||"";n({...s,text:l})}else n(null)},[e,e.selection]),t};var st=(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))(st||{});const zn={[Z.paragraph]:Z.paragraph,[Z.blockquote]:Z.blockquote,[Z.codeblock]:Z.codeblock,[Z.link]:Z.link,[Z.ul]:Z.ul,[Z.ol]:Z.ol,[Z.li]:Z.li,[Z.mention]:Z.mention,[Z.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Ot.emphasis]:Z.italic,[Ot.strong]:Z.bold,[Ot.delete]:Z.strikethrough,[Ot.code]:Z.code,[Z.hr]:Z.hr,[Z.image]:Z.image};function pl(e){if(e)throw e}var fa=Object.prototype.hasOwnProperty,Xd=Object.prototype.toString,gl=Object.defineProperty,vl=Object.getOwnPropertyDescriptor,bl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Xd.call(t)==="[object Array]"},yl=function(t){if(!t||Xd.call(t)!=="[object Object]")return!1;var n=fa.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&fa.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||fa.call(t,a)},Dl=function(t,n){gl&&n.name==="__proto__"?gl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Cl=function(t,n){if(n==="__proto__")if(fa.call(t,n)){if(vl)return vl(t,n).value}else return;return t[n]},Ly=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,c=!1;for(typeof o=="boolean"&&(c=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=Cl(o,n),a=Cl(t,n),o!==a&&(c&&a&&(yl(a)||(i=bl(a)))?(i?(i=!1,s=r&&bl(r)?r:[]):s=r&&yl(r)?r:{},Dl(o,{name:n,newValue:e(c,s,a)})):typeof a<"u"&&Dl(o,{name:n,newValue:a}));return o};const wi=wn(Ly);function ks(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 zy(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const c=e[++i];let h=-1;if(l){s(l);return}for(;++h<a.length;)(u[h]===null||u[h]===void 0)&&(u[h]=a[h]);a=u,c?qy(c,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function qy(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const c=u;if(o&&n)throw c;return a(c)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function yr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?xl(e.position):"start"in e||"end"in e?xl(e):"line"in e||"column"in e?_s(e):""}function _s(e){return wl(e&&e.line)+":"+wl(e&&e.column)}function xl(e){return _s(e&&e.start)+"-"+_s(e&&e.end)}function wl(e){return e&&typeof e=="number"?e:1}class ht extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=o?o.line:void 0,this.name=yr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}ht.prototype.file="";ht.prototype.name="";ht.prototype.reason="";ht.prototype.message="";ht.prototype.stack="";ht.prototype.column=void 0;ht.prototype.line=void 0;ht.prototype.ancestors=void 0;ht.prototype.cause=void 0;ht.prototype.fatal=void 0;ht.prototype.place=void 0;ht.prototype.ruleId=void 0;ht.prototype.source=void 0;const St={basename:Wy,dirname:Hy,extname:Uy,join:Vy,sep:"/"};function Wy(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Pr(e);let n=0,r=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else r<0&&(i=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function Hy(e){if(Pr(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 Uy(e){Pr(e);let t=e.length,n=-1,r=0,a=-1,i=0,s;for(;t--;){const o=e.codePointAt(t);if(o===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),o===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function Vy(...e){let t=-1,n;for(;++t<e.length;)Pr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Ky(n)}function Ky(e){Pr(e);const t=e.codePointAt(0)===47;let n=Zy(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Zy(e,t){let n="",r=0,a=-1,i=0,s=-1,o,l;for(;++s<=e.length;){if(s<e.length)o=e.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(a===s-1||i===1))if(a!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),a=s,i=0;continue}}else if(n.length>0){n="",r=0,a=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,s):n=e.slice(a+1,s),r=s-a-1;a=s,i=0}else o===46&&i>-1?i++:i=-1}return n}function Pr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Yy={cwd:Gy};function Gy(){return"/"}function Bs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Qy(e){if(typeof e=="string")e=new URL(e);else if(!Bs(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 Jy(e)}function Jy(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Ei=["history","path","basename","stem","extname","dirname"];class Xy{constructor(t){let n;t?Bs(t)?n={path:t}:typeof t=="string"||e1(t)?n={value:t}:n=t:n={},this.cwd=Yy.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ei.length;){const i=Ei[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)Ei.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?St.basename(this.path):void 0}set basename(t){_i(t,"basename"),ki(t,"basename"),this.path=St.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?St.dirname(this.path):void 0}set dirname(t){El(this.basename,"dirname"),this.path=St.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?St.extname(this.path):void 0}set extname(t){if(ki(t,"extname"),El(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=St.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Bs(t)&&(t=Qy(t)),_i(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?St.basename(this.path,this.extname):void 0}set stem(t){_i(t,"stem"),ki(t,"stem"),this.path=St.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new ht(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function ki(e,t){if(e&&e.includes(St.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+St.sep+"`")}function _i(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function El(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function e1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const t1=function(e){const r=this.constructor.prototype,a=r[e],i=function(){return a.apply(i,arguments)};Object.setPrototypeOf(i,r);const s=Object.getOwnPropertyNames(a);for(const o of s){const l=Object.getOwnPropertyDescriptor(a,o);l&&Object.defineProperty(i,o,l)}return i},n1={}.hasOwnProperty;class lo extends t1{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=zy()}copy(){const t=new lo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(wi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Fi("data",this.frozen),this.namespace[t]=n,this):n1.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Fi("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Gr(t),r=this.parser||this.Parser;return Bi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Bi("process",this.parser||this.Parser),Ai("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=Gr(t),l=r.parse(o);r.run(l,o,function(c,h,m){if(c||!h||!m)return u(c);const p=h,g=r.stringify(p,m);i1(g)?m.value=g:m.result=g,u(c,m)});function u(c,h){c||!h?s(c):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Bi("processSync",this.parser||this.Parser),Ai("processSync",this.compiler||this.Compiler),this.process(t,a),_l("processSync","process",n),r;function a(i,s){n=!0,pl(i),r=s}}run(t,n,r){kl(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,o){const l=Gr(n);a.run(t,l,u);function u(c,h,m){const p=h||t;c?o(c):s?s(p):r(void 0,p,m)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),_l("runSync","run",r),a;function i(s,o){pl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=Gr(n),a=this.compiler||this.Compiler;return Ai("stringify",a),kl(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Fi("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...h]=u;l(c,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&&(a.settings=wi(!0,a.settings,u.settings))}function o(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const h=u[c];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let h=-1,m=-1;for(;++h<r.length;)if(r[h][0]===u){m=h;break}if(m===-1)r.push([u,...c]);else if(c.length>0){let[p,...g]=c;const f=r[m][1];ks(f)&&ks(p)&&(p=wi(!0,f,p)),r[m]=[u,p,...g]}}}}const r1=new lo().freeze();function Bi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ai(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Fi(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 kl(e){if(!ks(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function _l(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Gr(e){return a1(e)?e:new Xy(e)}function a1(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function i1(e){return typeof e=="string"||s1(e)}function s1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const o1={};function u1(e,t){const n=t||o1,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ef(e,r,a)}function ef(e,t,n){if(l1(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 Bl(e.children,t,n)}return Array.isArray(e)?Bl(e,t,n):""}function Bl(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=ef(e[a],t,n);return r.join("")}function l1(e){return!!(e&&typeof e=="object")}const Al=document.createElement("i");function co(e){const t="&"+e+";";Al.innerHTML=t;const n=Al.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Rt(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function Dt(e,t){return e.length>0?(Rt(e,e.length,0,t),e):t}const Fl={}.hasOwnProperty;function c1(e){const t={};let n=-1;for(;++n<e.length;)d1(t,e[n]);return t}function d1(e,t){let n;for(n in t){const a=(Fl.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){Fl.call(a,s)||(a[s]=[]);const o=i[s];f1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function f1(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Rt(e,0,0,r)}function tf(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 Hn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const jt=un(/[A-Za-z]/),Bt=un(/[\dA-Za-z]/),h1=un(/[#-'*+\--9=?A-Z^-~]/);function As(e){return e!==null&&(e<32||e===127)}const Fs=un(/\d/),m1=un(/[\dA-Fa-f]/),p1=un(/[!-/:-@[-`{-~]/);function ye(e){return e!==null&&e<-2}function ft(e){return e!==null&&(e<0||e===32)}function je(e){return e===-2||e===-1||e===32}const g1=un(/\p{P}|\p{S}/u),v1=un(/\s/);function un(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ie(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return je(l)?(e.enter(n),o(l)):t(l)}function o(l){return je(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const b1={tokenize:y1};function y1(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ie(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return ye(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const D1={tokenize:C1},Tl={tokenize:x1};function C1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(A){if(r<n.length){const _=n[r];return t.containerState=_[1],e.attempt(_[0].continuation,l,u)(A)}return u(A)}function l(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&w();const _=t.events.length;let k=_,F;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){F=t.events[k][1].end;break}y(r);let S=_;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},F),S++;return Rt(t.events,k+1,0,t.events.slice(_)),t.events.length=S,u(A)}return o(A)}function u(A){if(r===n.length){if(!a)return m(A);if(a.currentConstruct&&a.currentConstruct.concrete)return g(A);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Tl,c,h)(A)}function c(A){return a&&w(),y(r),m(A)}function h(A){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(A)}function m(A){return t.containerState={},e.attempt(Tl,p,g)(A)}function p(A){return r++,n.push([t.currentConstruct,t.containerState]),m(A)}function g(A){if(A===null){a&&w(),y(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(A)}function f(A){if(A===null){D(e.exit("chunkFlow"),!0),y(0),e.consume(A);return}return ye(A)?(e.consume(A),D(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(A),f)}function D(A,_){const k=t.sliceStream(A);if(_&&k.push(null),A.previous=i,i&&(i.next=A),i=A,a.defineSkip(A.start),a.write(k),t.parser.lazy[A.start.line]){let F=a.events.length;for(;F--;)if(a.events[F][1].start.offset<s&&(!a.events[F][1].end||a.events[F][1].end.offset>s))return;const S=t.events.length;let $=S,R,I;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(R){I=t.events[$][1].end;break}R=!0}for(y(r),F=S;F<t.events.length;)t.events[F][1].end=Object.assign({},I),F++;Rt(t.events,$+1,0,t.events.slice(S)),t.events.length=F}}function y(A){let _=n.length;for(;_-- >A;){const k=n[_];t.containerState=k[1],k[0].exit.call(t,e)}n.length=A}function w(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function x1(e,t,n){return Ie(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Sl(e){if(e===null||ft(e)||v1(e))return 1;if(g1(e))return 2}function fo(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Ts={name:"attention",tokenize:E1,resolveAll:w1};function w1(e,t){let n=-1,r,a,i,s,o,l,u,c;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),m=Object.assign({},e[n][1].start);jl(h,-l),jl(m,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:m},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Dt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Dt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Dt(u,fo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Dt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=Dt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Rt(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function E1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Sl(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),c=Sl(l),h=!c||c===2&&a||n.includes(l),m=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?h:h&&(a||!m)),u._close=!!(i===42?m:m&&(c||!h)),t(l)}}function jl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const k1={name:"autolink",tokenize:_1};function _1(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return jt(p)?(e.consume(p),s):u(p)}function s(p){return p===43||p===45||p===46||Bt(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||Bt(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||As(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),c):h1(p)?(e.consume(p),u):n(p)}function c(p){return Bt(p)?h(p):n(p)}function h(p){return p===46?(e.consume(p),r=0,c):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):m(p)}function m(p){if((p===45||Bt(p))&&r++<63){const g=p===45?m:h;return e.consume(p),g}return n(p)}}const Ya={tokenize:B1,partial:!0};function B1(e,t,n){return r;function r(i){return je(i)?Ie(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ye(i)?t(i):n(i)}}const nf={name:"blockQuote",tokenize:A1,continuation:{tokenize:F1},exit:T1};function A1(e,t,n){const r=this;return a;function a(s){if(s===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return je(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function F1(e,t,n){const r=this;return a;function a(s){return je(s)?Ie(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(nf,t,n)(s)}}function T1(e){e.exit("blockQuote")}const rf={name:"characterEscape",tokenize:S1};function S1(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return p1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const af={name:"characterReference",tokenize:j1};function j1(e,t,n){const r=this;let a=0,i,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"),i=31,s=Bt,c(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=m1,c):(e.enter("characterReferenceValue"),i=7,s=Fs,c(h))}function c(h){if(h===59&&a){const m=e.exit("characterReferenceValue");return s===Bt&&!co(r.sliceSerialize(m))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&a++<i?(e.consume(h),c):n(h)}}const Ol={tokenize:P1,partial:!0},Pl={name:"codeFenced",tokenize:O1,concrete:!0};function O1(e,t,n){const r=this,a={tokenize:k,partial:!0};let i=0,s=0,o;return l;function l(F){return u(F)}function u(F){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=F,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(F)}function c(F){return F===o?(s++,e.consume(F),c):s<3?n(F):(e.exit("codeFencedFenceSequence"),je(F)?Ie(e,h,"whitespace")(F):h(F))}function h(F){return F===null||ye(F)?(e.exit("codeFencedFence"),r.interrupt?t(F):e.check(Ol,f,_)(F)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(F))}function m(F){return F===null||ye(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(F)):je(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ie(e,p,"whitespace")(F)):F===96&&F===o?n(F):(e.consume(F),m)}function p(F){return F===null||ye(F)?h(F):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(F))}function g(F){return F===null||ye(F)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(F)):F===96&&F===o?n(F):(e.consume(F),g)}function f(F){return e.attempt(a,_,D)(F)}function D(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),y}function y(F){return i>0&&je(F)?Ie(e,w,"linePrefix",i+1)(F):w(F)}function w(F){return F===null||ye(F)?e.check(Ol,f,_)(F):(e.enter("codeFlowValue"),A(F))}function A(F){return F===null||ye(F)?(e.exit("codeFlowValue"),w(F)):(e.consume(F),A)}function _(F){return e.exit("codeFenced"),t(F)}function k(F,S,$){let R=0;return I;function I(j){return F.enter("lineEnding"),F.consume(j),F.exit("lineEnding"),M}function M(j){return F.enter("codeFencedFence"),je(j)?Ie(F,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):x(j)}function x(j){return j===o?(F.enter("codeFencedFenceSequence"),E(j)):$(j)}function E(j){return j===o?(R++,F.consume(j),E):R>=s?(F.exit("codeFencedFenceSequence"),je(j)?Ie(F,O,"whitespace")(j):O(j)):$(j)}function O(j){return j===null||ye(j)?(F.exit("codeFencedFence"),S(j)):$(j)}}}function P1(e,t,n){const r=this;return a;function a(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const Ti={name:"codeIndented",tokenize:R1},N1={tokenize:M1,partial:!0};function R1(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Ie(e,i,"linePrefix",4+1)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):ye(u)?e.attempt(N1,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||ye(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function M1(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):ye(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Ie(e,i,"linePrefix",4+1)(s)}function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):ye(s)?a(s):n(s)}}const I1={name:"codeText",tokenize:z1,resolve:$1,previous:L1};function $1(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function L1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function z1(e,t,n){let r=0,a,i;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?(i=e.enter("codeTextSequence"),a=0,c(h)):ye(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||ye(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),u)}function c(h){return h===96?(e.consume(h),a++,c):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}function sf(e){const t={};let n=-1,r,a,i,s,o,l,u;for(;++n<e.length;){for(;n in t;)n=t[n];if(r=e[n],n&&r[1].type==="chunkFlow"&&e[n-1][1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,q1(e,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=e[i],s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(e[a][1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},e[a][1].start),o=e.slice(a,n),o.unshift(r),Rt(e,a,n-a+1,o))}}return!u}function q1(e,t){const n=e[t][1],r=e[t][2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let c,h,m=-1,p=n,g=0,f=0;const D=[f];for(;p;){for(;e[++a][1]!==p;);i.push(a),p._tokenizer||(c=r.sliceStream(p),p.next||c.push(null),h&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=n;++m<o.length;)o[m][0]==="exit"&&o[m-1][0]==="enter"&&o[m][1].type===o[m-1][1].type&&o[m][1].start.line!==o[m][1].end.line&&(f=m+1,D.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):D.pop(),m=D.length;m--;){const y=o.slice(D[m],D[m+1]),w=i.pop();l.unshift([w,w+y.length-1]),Rt(e,w,2,y)}for(m=-1;++m<l.length;)u[g+l[m][0]]=g+l[m][1],g+=l[m][1]-l[m][0]-1;return u}const W1={tokenize:V1,resolve:U1},H1={tokenize:K1,partial:!0};function U1(e){return sf(e),e}function V1(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):ye(o)?e.check(H1,s,i)(o):(e.consume(o),a)}function i(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function s(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function K1(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ie(e,i,"linePrefix")}function i(s){if(s===null||ye(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 of(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return h;function h(y){return y===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(y),e.exit(i),m):y===null||y===32||y===41||As(y)?n(y):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(y))}function m(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(o),m(y)):y===null||y===60||ye(y)?n(y):(e.consume(y),y===92?g:p)}function g(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function f(y){return!c&&(y===null||y===41||ft(y))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(y)):c<u&&y===40?(e.consume(y),c++,f):y===41?(e.consume(y),c--,f):y===null||y===32||y===40||As(y)?n(y):(e.consume(y),y===92?D:f)}function D(y){return y===40||y===41||y===92?(e.consume(y),f):f(y)}}function uf(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),c}function c(p){return o>999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):ye(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||ye(p)||o++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!je(p)),p===92?m:h)}function m(p){return p===91||p===92||p===93?(e.consume(p),o++,h):h(p)}}function lf(e,t,n,r,a,i){let s;return o;function o(m){return m===34||m===39||m===40?(e.enter(r),e.enter(a),e.consume(m),e.exit(a),s=m===40?41:m,l):n(m)}function l(m){return m===s?(e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):(e.enter(i),u(m))}function u(m){return m===s?(e.exit(i),l(s)):m===null?n(m):ye(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Ie(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(m))}function c(m){return m===s||m===null||ye(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?h:c)}function h(m){return m===s||m===92?(e.consume(m),c):c(m)}}function Dr(e,t){let n;return r;function r(a){return ye(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):je(a)?Ie(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const Z1={name:"definition",tokenize:G1},Y1={tokenize:Q1,partial:!0};function G1(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return uf.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return a=Hn(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 ft(p)?Dr(e,u)(p):u(p)}function u(p){return of(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(Y1,h,h)(p)}function h(p){return je(p)?Ie(e,m,"whitespace")(p):m(p)}function m(p){return p===null||ye(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function Q1(e,t,n){return r;function r(o){return ft(o)?Dr(e,a)(o):n(o)}function a(o){return lf(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return je(o)?Ie(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ye(o)?t(o):n(o)}}const J1={name:"hardBreakEscape",tokenize:X1};function X1(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return ye(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const eD={name:"headingAtx",tokenize:nD,resolve:tD};function tD(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Rt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function nD(e,t,n){let r=0;return a;function a(c){return e.enter("atxHeading"),i(c)}function i(c){return e.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(e.consume(c),s):c===null||ft(c)?(e.exit("atxHeadingSequence"),o(c)):n(c)}function o(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||ye(c)?(e.exit("atxHeading"),t(c)):je(c)?Ie(e,o,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),o(c))}function u(c){return c===null||c===35||ft(c)?(e.exit("atxHeadingText"),o(c)):(e.consume(c),u)}}const rD=["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"],Nl=["pre","script","style","textarea"],aD={name:"htmlFlow",tokenize:uD,resolveTo:oD,concrete:!0},iD={tokenize:cD,partial:!0},sD={tokenize:lD,partial:!0};function oD(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 uD(e,t,n){const r=this;let a,i,s,o,l;return u;function u(B){return c(B)}function c(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),h}function h(B){return B===33?(e.consume(B),m):B===47?(e.consume(B),i=!0,f):B===63?(e.consume(B),a=3,r.interrupt?t:v):jt(B)?(e.consume(B),s=String.fromCharCode(B),D):n(B)}function m(B){return B===45?(e.consume(B),a=2,p):B===91?(e.consume(B),a=5,o=0,g):jt(B)?(e.consume(B),a=4,r.interrupt?t:v):n(B)}function p(B){return B===45?(e.consume(B),r.interrupt?t:v):n(B)}function g(B){const T="CDATA[";return B===T.charCodeAt(o++)?(e.consume(B),o===T.length?r.interrupt?t:x:g):n(B)}function f(B){return jt(B)?(e.consume(B),s=String.fromCharCode(B),D):n(B)}function D(B){if(B===null||B===47||B===62||ft(B)){const T=B===47,W=s.toLowerCase();return!T&&!i&&Nl.includes(W)?(a=1,r.interrupt?t(B):x(B)):rD.includes(s.toLowerCase())?(a=6,T?(e.consume(B),y):r.interrupt?t(B):x(B)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):i?w(B):A(B))}return B===45||Bt(B)?(e.consume(B),s+=String.fromCharCode(B),D):n(B)}function y(B){return B===62?(e.consume(B),r.interrupt?t:x):n(B)}function w(B){return je(B)?(e.consume(B),w):I(B)}function A(B){return B===47?(e.consume(B),I):B===58||B===95||jt(B)?(e.consume(B),_):je(B)?(e.consume(B),A):I(B)}function _(B){return B===45||B===46||B===58||B===95||Bt(B)?(e.consume(B),_):k(B)}function k(B){return B===61?(e.consume(B),F):je(B)?(e.consume(B),k):A(B)}function F(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),l=B,S):je(B)?(e.consume(B),F):$(B)}function S(B){return B===l?(e.consume(B),l=null,R):B===null||ye(B)?n(B):(e.consume(B),S)}function $(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||ft(B)?k(B):(e.consume(B),$)}function R(B){return B===47||B===62||je(B)?A(B):n(B)}function I(B){return B===62?(e.consume(B),M):n(B)}function M(B){return B===null||ye(B)?x(B):je(B)?(e.consume(B),M):n(B)}function x(B){return B===45&&a===2?(e.consume(B),q):B===60&&a===1?(e.consume(B),z):B===62&&a===4?(e.consume(B),H):B===63&&a===3?(e.consume(B),v):B===93&&a===5?(e.consume(B),X):ye(B)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(iD,ee,E)(B)):B===null||ye(B)?(e.exit("htmlFlowData"),E(B)):(e.consume(B),x)}function E(B){return e.check(sD,O,ee)(B)}function O(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),j}function j(B){return B===null||ye(B)?E(B):(e.enter("htmlFlowData"),x(B))}function q(B){return B===45?(e.consume(B),v):x(B)}function z(B){return B===47?(e.consume(B),s="",re):x(B)}function re(B){if(B===62){const T=s.toLowerCase();return Nl.includes(T)?(e.consume(B),H):x(B)}return jt(B)&&s.length<8?(e.consume(B),s+=String.fromCharCode(B),re):x(B)}function X(B){return B===93?(e.consume(B),v):x(B)}function v(B){return B===62?(e.consume(B),H):B===45&&a===2?(e.consume(B),v):x(B)}function H(B){return B===null||ye(B)?(e.exit("htmlFlowData"),ee(B)):(e.consume(B),H)}function ee(B){return e.exit("htmlFlow"),t(B)}}function lD(e,t,n){const r=this;return a;function a(s){return ye(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function cD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Ya,t,n)}}const dD={name:"htmlText",tokenize:fD};function fD(e,t,n){const r=this;let a,i,s;return o;function o(v){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(v),l}function l(v){return v===33?(e.consume(v),u):v===47?(e.consume(v),k):v===63?(e.consume(v),A):jt(v)?(e.consume(v),$):n(v)}function u(v){return v===45?(e.consume(v),c):v===91?(e.consume(v),i=0,g):jt(v)?(e.consume(v),w):n(v)}function c(v){return v===45?(e.consume(v),p):n(v)}function h(v){return v===null?n(v):v===45?(e.consume(v),m):ye(v)?(s=h,z(v)):(e.consume(v),h)}function m(v){return v===45?(e.consume(v),p):h(v)}function p(v){return v===62?q(v):v===45?m(v):h(v)}function g(v){const H="CDATA[";return v===H.charCodeAt(i++)?(e.consume(v),i===H.length?f:g):n(v)}function f(v){return v===null?n(v):v===93?(e.consume(v),D):ye(v)?(s=f,z(v)):(e.consume(v),f)}function D(v){return v===93?(e.consume(v),y):f(v)}function y(v){return v===62?q(v):v===93?(e.consume(v),y):f(v)}function w(v){return v===null||v===62?q(v):ye(v)?(s=w,z(v)):(e.consume(v),w)}function A(v){return v===null?n(v):v===63?(e.consume(v),_):ye(v)?(s=A,z(v)):(e.consume(v),A)}function _(v){return v===62?q(v):A(v)}function k(v){return jt(v)?(e.consume(v),F):n(v)}function F(v){return v===45||Bt(v)?(e.consume(v),F):S(v)}function S(v){return ye(v)?(s=S,z(v)):je(v)?(e.consume(v),S):q(v)}function $(v){return v===45||Bt(v)?(e.consume(v),$):v===47||v===62||ft(v)?R(v):n(v)}function R(v){return v===47?(e.consume(v),q):v===58||v===95||jt(v)?(e.consume(v),I):ye(v)?(s=R,z(v)):je(v)?(e.consume(v),R):q(v)}function I(v){return v===45||v===46||v===58||v===95||Bt(v)?(e.consume(v),I):M(v)}function M(v){return v===61?(e.consume(v),x):ye(v)?(s=M,z(v)):je(v)?(e.consume(v),M):R(v)}function x(v){return v===null||v===60||v===61||v===62||v===96?n(v):v===34||v===39?(e.consume(v),a=v,E):ye(v)?(s=x,z(v)):je(v)?(e.consume(v),x):(e.consume(v),O)}function E(v){return v===a?(e.consume(v),a=void 0,j):v===null?n(v):ye(v)?(s=E,z(v)):(e.consume(v),E)}function O(v){return v===null||v===34||v===39||v===60||v===61||v===96?n(v):v===47||v===62||ft(v)?R(v):(e.consume(v),O)}function j(v){return v===47||v===62||ft(v)?R(v):n(v)}function q(v){return v===62?(e.consume(v),e.exit("htmlTextData"),e.exit("htmlText"),t):n(v)}function z(v){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),re}function re(v){return je(v)?Ie(e,X,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(v):X(v)}function X(v){return e.enter("htmlTextData"),s(v)}}const ho={name:"labelEnd",tokenize:bD,resolveTo:vD,resolveAll:gD},hD={tokenize:yD},mD={tokenize:DD},pD={tokenize:CD};function gD(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 vD(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},c={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=Dt(o,e.slice(i+1,i+r+3)),o=Dt(o,[["enter",c,t]]),o=Dt(o,fo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=Dt(o,[["exit",c,t],e[s-2],e[s-1],["exit",u,t]]),o=Dt(o,e.slice(s+1)),o=Dt(o,[["exit",l,t]]),Rt(e,i,e.length,o),e}function bD(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(m){return i?i._inactive?h(m):(s=r.parser.defined.includes(Hn(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):n(m)}function l(m){return m===40?e.attempt(hD,c,s?c:h)(m):m===91?e.attempt(mD,c,s?u:h)(m):s?c(m):h(m)}function u(m){return e.attempt(pD,c,h)(m)}function c(m){return t(m)}function h(m){return i._balanced=!0,n(m)}}function yD(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),a}function a(h){return ft(h)?Dr(e,i)(h):i(h)}function i(h){return h===41?c(h):of(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return ft(h)?Dr(e,l)(h):c(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?lf(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):c(h)}function u(h){return ft(h)?Dr(e,c)(h):c(h)}function c(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function DD(e,t,n){const r=this;return a;function a(o){return uf.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Hn(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(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const xD={name:"labelStartImage",tokenize:wD,resolveAll:ho.resolveAll};function wD(e,t,n){const r=this;return a;function a(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),s):n(o)}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const ED={name:"labelStartLink",tokenize:kD,resolveAll:ho.resolveAll};function kD(e,t,n){const r=this;return a;function a(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Si={name:"lineEnding",tokenize:_D};function _D(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ie(e,t,"linePrefix")}}const ha={name:"thematicBreak",tokenize:BD};function BD(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||ye(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),je(u)?Ie(e,o,"whitespace")(u):o(u))}}const lt={name:"list",tokenize:TD,continuation:{tokenize:SD},exit:OD},AD={tokenize:PD,partial:!0},FD={tokenize:jD,partial:!0};function TD(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Fs(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ha,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 Fs(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(Ya,r.interrupt?n:c,e.attempt(AD,m,h))}function c(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function h(p){return je(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function SD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ya,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ie(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!je(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(FD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ie(e,e.attempt(lt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function jD(e,t,n){const r=this;return Ie(e,a,"listItemIndent",r.containerState.size+1);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function OD(e){e.exit(this.containerState.type)}function PD(e,t,n){const r=this;return Ie(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function a(i){const s=r.events[r.events.length-1];return!je(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Rl={name:"setextUnderline",tokenize:RD,resolveTo:ND};function ND(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:Object.assign({},e[a][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[i][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}function RD(e,t,n){const r=this;let a;return i;function i(u){let c=r.events.length,h;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){h=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),je(u)?Ie(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ye(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const MD={tokenize:ID};function ID(e){const t=this,n=e.attempt(Ya,r,e.attempt(this.parser.constructs.flowInitial,a,Ie(e,e.attempt(this.parser.constructs.flow,a,e.attempt(W1,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const $D={resolveAll:df()},LD=cf("string"),zD=cf("text");function cf(e){return{tokenize:t,resolveAll:df(e==="text"?qD:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(c){return u(c)?i(c):o(c)}function o(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const h=a[c];let m=-1;if(h)for(;++m<h.length;){const p=h[m];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function df(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function qD(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let i=a.length,s=-1,o=0,l;for(;i--;){const u=a[i];if(typeof u=="string"){for(s=u.length;u.charCodeAt(s-1)===32;)o++,s--;if(s)break;s=-1}else if(u===-2)l=!0,o++;else if(u!==-1){i++;break}}if(o){const u={type:n===e.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-o,offset:r.end.offset-o,_index:r.start._index+i,_bufferIndex:i?s:r.start._bufferIndex+s},end:Object.assign({},r.end)};r.end=Object.assign({},u.start),r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}function WD(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:w,enter:A,exit:_,attempt:S(k),check:S(F),interrupt:S(F,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:m,now:g,defineSkip:f,write:h};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function h(M){return s=Dt(s,M),D(),s[s.length-1]!==null?[]:($(t,0),u.events=fo(i,u.events,u),u.events)}function m(M,x){return UD(p(M),x)}function p(M){return HD(s,M)}function g(){const{line:M,column:x,offset:E,_index:O,_bufferIndex:j}=r;return{line:M,column:x,offset:E,_index:O,_bufferIndex:j}}function f(M){a[M.line]=M.column,I()}function D(){let M;for(;r._index<s.length;){const x=s[r._index];if(typeof x=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<x.length;)y(x.charCodeAt(r._bufferIndex));else y(x)}}function y(M){c=c(M)}function w(M){ye(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,I()):M!==-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=M}function A(M,x){const E=x||{};return E.type=M,E.start=g(),u.events.push(["enter",E,u]),o.push(E),E}function _(M){const x=o.pop();return x.end=g(),u.events.push(["exit",x,u]),x}function k(M,x){$(M,x.from)}function F(M,x){x.restore()}function S(M,x){return E;function E(O,j,q){let z,re,X,v;return Array.isArray(O)?ee(O):"tokenize"in O?ee([O]):H(O);function H(L){return U;function U(te){const ne=te!==null&&L[te],ie=te!==null&&L.null,fe=[...Array.isArray(ne)?ne:ne?[ne]:[],...Array.isArray(ie)?ie:ie?[ie]:[]];return ee(fe)(te)}}function ee(L){return z=L,re=0,L.length===0?q:B(L[re])}function B(L){return U;function U(te){return v=R(),X=L,L.partial||(u.currentConstruct=L),L.name&&u.parser.constructs.disable.null.includes(L.name)?W():L.tokenize.call(x?Object.assign(Object.create(u),x):u,l,T,W)(te)}}function T(L){return M(X,v),j}function W(L){return v.restore(),++re<z.length?B(z[re]):q}}}function $(M,x){M.resolveAll&&!i.includes(M)&&i.push(M),M.resolve&&Rt(u.events,x,u.events.length-x,M.resolve(u.events.slice(x),u)),M.resolveTo&&(u.events=M.resolveTo(u.events,u))}function R(){const M=g(),x=u.previous,E=u.currentConstruct,O=u.events.length,j=Array.from(o);return{restore:q,from:O};function q(){r=M,u.previous=x,u.currentConstruct=E,u.events.length=O,o=j,I()}}function I(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function HD(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let s;if(n===a)s=[e[n].slice(r,i)];else{if(s=e.slice(n,a),r>-1){const o=s[0];typeof o=="string"?s[0]=o.slice(r):s.shift()}i>0&&s.push(e[a].slice(0,i))}return s}function UD(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
111
+ `:""),[i]=C.useState(a);return Sr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),C.createElement(ey,{ref:r},i)},ey=C.memo(C.forwardRef((e,t)=>C.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Ci=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),C.createElement("span",Jb({},a),!ot||!n?"\uFEFF":null,n?C.createElement("br",null):null)};function il(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Hd(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){xt(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 ty=ot?300:0;function ny(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function sl(e){e.current&&(clearTimeout(e.current),e.current=null)}var ry=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=x=>C.createElement(iy,Hd({},x))}=e,o=on(),l=C.useRef(null),u=C.useRef(null),[c,h]=C.useState(!1),m=C.useRef(null),p=C.useCallback(x=>{if(ny(l,x==null),x==null){var A;vs.delete(o),(A=t.onPlaceholderResize)===null||A===void 0||A.call(t,null)}else{if(vs.set(o,x),!l.current){var _=window.ResizeObserver||ib;l.current=new _(()=>{var k;(k=t.onPlaceholderResize)===null||k===void 0||k.call(t,x)})}l.current.observe(x),u.current=x}},[u,t,o]),g=C.createElement(Xb,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[Yn];if(C.useEffect(()=>(f?m.current||(m.current=setTimeout(()=>{h(!0),m.current=null},ty)):(sl(m),h(!1)),()=>sl(m)),[f,h]),f&&c){var y={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:mr?"inherit":void 0},contentEditable:!1,ref:p}};g=C.createElement(C.Fragment,null,i(y),g)}var D={"data-slate-leaf":!0};return s({attributes:D,children:g,leaf:t,text:r})},ay=C.memo(ry,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&de.equals(t.leaf,e.leaf)&&t.leaf[Yn]===e.leaf[Yn]),iy=e=>{var{attributes:t,children:n}=e;return C.createElement("span",Hd({},t),n)},sy=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=on(),l=C.useRef(null),u=de.decorations(s,t),c=J.findKey(o,s),h=[],m=0;m<u.length;m++){var p=u[m];h.push(C.createElement(ay,{isLast:n&&m===u.length-1,key:"".concat(c.id,"-").concat(m),renderPlaceholder:a,leaf:p,text:s,parent:r,renderLeaf:i}))}var g=C.useCallback(f=>{var y=Za.get(o);f?(y==null||y.set(c,f),bn.set(s,f),Tr.set(f,s)):(y==null||y.delete(c),bn.delete(s),l.current&&Tr.delete(l.current)),l.current=f},[l,o,c,s]);return C.createElement("span",{"data-slate-node":"text",ref:g},h)},Ud=C.memo(sy,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&Qb(t.decorations,e.decorations));function ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ws(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){xt(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 oy=e=>{var{decorations:t,element:n,renderElement:r=x=>C.createElement(ly,ws({},x)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=on(),l=fy(),u=o.isInline(n),c=J.findKey(o,n),h=C.useCallback(x=>{var A=Za.get(o);x?(A==null||A.set(c,x),bn.set(n,x),Tr.set(x,n)):(A==null||A.delete(c),bn.delete(n))},[o,c,n]),m=Kd({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),p={"data-slate-node":"element",ref:h};if(u&&(p["data-slate-inline"]=!0),!u&&b.hasInlines(o,n)){var g=oe.string(n),f=bd(g);f==="rtl"&&(p.dir=f)}if(b.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var y=u?"span":"div",[[D]]=oe.texts(n);m=C.createElement(y,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},C.createElement(Ud,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:D})),ao.set(D,0),io.set(D,n)}return r({attributes:p,children:m,element:n})},uy=C.memo(oy,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&Gb(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&V.equals(e.selection,t.selection))),ly=e=>{var{attributes:t,children:n,element:r}=e,a=on(),i=a.isInline(r)?"span":"div";return C.createElement(i,ws(ws({},t),{},{style:{position:"relative"}}),n)},Vd=C.createContext(()=>[]),cy=()=>C.useContext(Vd),dy=C.createContext(!1),Kd=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=cy(),l=on(),u=J.findPath(l,n),c=[],h=ce.isElement(n)&&!l.isInline(n)&&b.hasInlines(l,n),m=0;m<n.children.length;m++){var p=u.concat(m),g=n.children[m],f=J.findKey(l,g),y=b.range(l,p),D=s&&V.intersection(y,s),x=o([g,p]);for(var A of t){var _=V.intersection(A,y);_&&x.push(_)}ce.isElement(g)?c.push(C.createElement(dy.Provider,{key:"provider-".concat(f.id),value:!!D},C.createElement(uy,{decorations:x,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:D}))):c.push(C.createElement(Ud,{decorations:x,key:f.id,isLast:h&&m===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),ao.set(g,m),io.set(g,n)}return c},Zd=C.createContext(!1),fy=()=>C.useContext(Zd),Yd=C.createContext(null),Bn=()=>{var e=C.useContext(Yd);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function hy(){var e=on(),t=C.useRef(!1),n=C.useRef(0),r=C.useCallback(()=>{if(!t.current){t.current=!0;var a=J.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return C.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var my=3,py={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"},gy={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"},vy={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},qe=e=>{var t=py[e],n=gy[e],r=vy[e],a=t&&Di(t),i=n&&Di(n),s=r&&Di(r);return o=>!!(a&&a(o)||Ju&&i&&i(o)||!Ju&&s&&s(o))},He={isBold:qe("bold"),isCompose:qe("compose"),isMoveBackward:qe("moveBackward"),isMoveForward:qe("moveForward"),isDeleteBackward:qe("deleteBackward"),isDeleteForward:qe("deleteForward"),isDeleteLineBackward:qe("deleteLineBackward"),isDeleteLineForward:qe("deleteLineForward"),isDeleteWordBackward:qe("deleteWordBackward"),isDeleteWordForward:qe("deleteWordForward"),isExtendBackward:qe("extendBackward"),isExtendForward:qe("extendForward"),isExtendLineBackward:qe("extendLineBackward"),isExtendLineForward:qe("extendLineForward"),isItalic:qe("italic"),isMoveLineBackward:qe("moveLineBackward"),isMoveLineForward:qe("moveLineForward"),isMoveWordBackward:qe("moveWordBackward"),isMoveWordForward:qe("moveWordForward"),isRedo:qe("redo"),isSoftBreak:qe("insertSoftBreak"),isSplitBlock:qe("splitBlock"),isTransposeCharacter:qe("transposeCharacter"),isUndo:qe("undo")},by=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>uo(e,l,s));n.push(...o)}};function i(){n.length>0&&(n.reverse().forEach(s=>{s.type!=="characterData"&&(s.removedNodes.forEach(o=>{s.target.insertBefore(o,s.nextSibling)}),s.addedNodes.forEach(o=>{s.target.removeChild(o)}))}),r())}return{registerMutations:a,restoreDOM:i,clear:r}},yy={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Gd extends C.Component{constructor(){super(...arguments),xt(this,"context",null),xt(this,"manager",null),xt(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,yy)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=by(n,t),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var t,n,r,a=(t=this.mutationObserver)===null||t===void 0?void 0:t.takeRecords();if(a!=null&&a.length){var i;(i=this.manager)===null||i===void 0||i.registerMutations(a)}return(n=this.mutationObserver)===null||n===void 0||n.disconnect(),(r=this.manager)===null||r===void 0||r.restoreDOM(),null}componentDidUpdate(){var t;(t=this.manager)===null||t===void 0||t.clear(),this.observe()}componentWillUnmount(){var t;(t=this.mutationObserver)===null||t===void 0||t.disconnect()}render(){return this.props.children}}xt(Gd,"contextType",ro);var Dy=ot?Gd:e=>{var{children:t}=e;return C.createElement(C.Fragment,null,t)},Cy=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],xy=["text"];function ul(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Tt(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){xt(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 wy=e=>C.createElement(C.Fragment,null,Kd(e)),Ey=e=>{var t=C.useCallback(T=>C.createElement(ky,Tt({},T)),[]),{autoFocus:n,decorate:r=_y,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=By,style:h={},as:m="div",disableDefaultStyles:p=!1}=e,g=Zn(e,Cy),f=Bn(),[y,D]=C.useState(!1),x=C.useRef(null),A=C.useRef([]),[_,k]=C.useState(),{onUserInput:F,receivedUserInput:S}=hy(),[,$]=C.useReducer(T=>T+1,0);Rd.set(f,$),bs.set(f,s);var R=C.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);C.useEffect(()=>{x.current&&n&&x.current.focus()},[n]);var I=C.useRef(),M=C.useMemo(()=>N0(()=>{var T=I.current;if((ot||!J.isComposing(f))&&(!R.isUpdatingSelection||T!=null&&T.isFlushing())&&!R.isDraggingInternally){var W=J.findDocumentOrShadowRoot(f),{activeElement:L}=W,U=J.toDOMNode(f,f),te=W.getSelection();if(L===U?(R.latestElement=L,en.set(f,!0)):en.delete(f),!te)return G.deselect(f);var{anchorNode:ne,focusNode:ie}=te,fe=J.hasEditableTarget(f,ne)||J.isTargetInsideNonReadonlyVoid(f,ne),Q=J.hasEditableTarget(f,ie)||J.isTargetInsideNonReadonlyVoid(f,ie);if(fe&&Q){var pe=J.toSlateRange(f,te,{exactMatch:!1,suppressThrow:!0});pe&&(!J.isComposing(f)&&!(T!=null&&T.hasPendingChanges())&&!(T!=null&&T.isFlushing())?G.select(f,pe):T==null||T.handleUserSelect(pe))}s&&(!fe||!Q)&&G.deselect(f)}},100),[f,s,R]),w=C.useMemo(()=>F0(M,0),[M]);I.current=Vb({node:x,onDOMSelectionChange:M,scheduleOnDOMSelectionChange:w}),Sr(()=>{var T,W,L;x.current&&(L=oo(x.current))?(Nd.set(f,L),da.set(f,x.current),bn.set(f,x.current),Tr.set(x.current,f)):bn.delete(f);var{selection:U}=f,te=J.findDocumentOrShadowRoot(f),ne=te.getSelection();if(!(!ne||!J.isFocused(f)||(T=I.current)!==null&&T!==void 0&&T.hasPendingAction())){var ie=ge=>{var ke=ne.type!=="None";if(!(!U&&!ke)){var xe=ne.focusNode,_e;if($n&&ne.rangeCount>1){var We=ne.getRangeAt(0),Le=ne.getRangeAt(ne.rangeCount-1);We.startContainer===xe?_e=Le.endContainer:_e=We.startContainer}else _e=ne.anchorNode;var Ue=da.get(f),Qe=!1;if(Ue.contains(_e)&&Ue.contains(xe)&&(Qe=!0),ke&&Qe&&U&&!ge){var he=J.toSlateRange(f,ne,{exactMatch:!0,suppressThrow:!0});if(he&&V.equals(he,U)){var Te;if(!R.hasMarkPlaceholder||(Te=_e)!==null&&Te!==void 0&&(Te=Te.parentElement)!==null&&Te!==void 0&&Te.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!J.hasRange(f,U)){f.selection=J.toSlateRange(f,ne,{exactMatch:!1,suppressThrow:!0});return}R.isUpdatingSelection=!0;var $e=U&&J.toDOMRange(f,U);return $e?(J.isComposing(f)&&!ot?ne.collapseToEnd():V.isBackward(U)?ne.setBaseAndExtent($e.endContainer,$e.endOffset,$e.startContainer,$e.startOffset):ne.setBaseAndExtent($e.startContainer,$e.startOffset,$e.endContainer,$e.endOffset),c(f,$e)):ne.removeAllRanges(),$e}};ne.rangeCount<=1&&ie();var fe=((W=I.current)===null||W===void 0?void 0:W.isFlushing())==="action";if(!ot||!fe){setTimeout(()=>{R.isUpdatingSelection=!1});return}var Q=null,pe=requestAnimationFrame(()=>{if(fe){var ge=ke=>{try{var xe=J.toDOMNode(f,f);xe.focus(),ie(ke)}catch{}};ge(),Q=setTimeout(()=>{ge(!0),R.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(pe),Q&&clearTimeout(Q)}}});var E=C.useCallback(T=>{if(F(),!s&&J.hasEditableTarget(f,T.target)&&!Ay(T,a)){var W;if(I.current)return I.current.handleDOMBeforeInput(T);w.flush(),M.flush();var{selection:L}=f,{inputType:U}=T,te=T.dataTransfer||T.data||void 0,ne=U==="insertCompositionText"||U==="deleteCompositionText";if(ne&&J.isComposing(f))return;var ie=!1;if(U==="insertText"&&L&&V.isCollapsed(L)&&T.data&&T.data.length===1&&/[a-z ]/i.test(T.data)&&L.anchor.offset!==0){var fe,Q;ie=!0,f.marks&&(ie=!1);var{anchor:pe}=L,[ge,ke]=J.toDOMPoint(f,pe),xe=(fe=ge.parentElement)===null||fe===void 0?void 0:fe.closest("a"),_e=J.getWindow(f);if(ie&&xe&&J.hasDOMNode(f,xe)){var We,Le=_e==null?void 0:_e.document.createTreeWalker(xe,NodeFilter.SHOW_TEXT).lastChild();Le===ge&&((We=Le.textContent)===null||We===void 0?void 0:We.length)===ke&&(ie=!1)}if(ie&&ge.parentElement&&(_e==null||(Q=_e.getComputedStyle(ge.parentElement))===null||Q===void 0?void 0:Q.whiteSpace)==="pre"){var Ue=b.above(f,{at:pe.path,match:se=>ce.isElement(se)&&b.isBlock(f,se)});Ue&&oe.string(Ue[0]).includes(" ")&&(ie=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[Qe]=T.getTargetRanges();if(Qe){var he=J.toSlateRange(f,Qe,{exactMatch:!1,suppressThrow:!1});if(!L||!V.equals(L,he)){ie=!1;var Te=!ne&&f.selection&&b.rangeRef(f,f.selection);G.select(f,he),Te&&br.set(f,Te)}}}if(ne)return;if(ie||T.preventDefault(),L&&V.isExpanded(L)&&U.startsWith("delete")){var $e=U.endsWith("Backward")?"backward":"forward";b.deleteFragment(f,{direction:$e});return}switch(U){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{b.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{b.deleteForward(f);break}case"deleteContentBackward":{b.deleteBackward(f);break}case"deleteEntireSoftLine":{b.deleteBackward(f,{unit:"line"}),b.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{b.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{b.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{b.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{b.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{b.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{b.deleteForward(f,{unit:"word"});break}case"insertLineBreak":b.insertSoftBreak(f);break;case"insertParagraph":{b.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{U==="insertFromComposition"&&J.isComposing(f)&&(D(!1),mn.set(f,!1)),(te==null?void 0:te.constructor.name)==="DataTransfer"?J.insertData(f,te):typeof te=="string"&&(ie?A.current.push(()=>b.insertText(f,te)):b.insertText(f,te));break}}var K=(W=br.get(f))===null||W===void 0?void 0:W.unref();br.delete(f),K&&(!f.selection||!V.equals(f.selection,K))&&G.select(f,K)}},[f,M,F,a,s,w]),O=C.useCallback(T=>{T==null?(M.cancel(),w.cancel(),da.delete(f),bn.delete(f),x.current&&Zt&&x.current.removeEventListener("beforeinput",E)):Zt&&T.addEventListener("beforeinput",E),x.current=T},[M,w,f,E]);Sr(()=>{var T=J.getWindow(f);return T.document.addEventListener("selectionchange",w),()=>{T.document.removeEventListener("selectionchange",w)}},[w]);var j=r([f,[]]),q=i&&f.children.length===1&&Array.from(oe.texts(f)).length===1&&oe.string(f)===""&&!y,z=C.useCallback(T=>{if(T&&q){var W;k((W=T.getBoundingClientRect())===null||W===void 0?void 0:W.height)}else k(void 0)},[q]);if(q){var re=b.start(f,[]);j.push({[Yn]:!0,placeholder:i,onPlaceholderResize:z,anchor:re,focus:re})}var{marks:X}=f;if(R.hasMarkPlaceholder=!1,f.selection&&V.isCollapsed(f.selection)&&X){var{anchor:v}=f.selection,H=oe.leaf(f,v.path),ee=Zn(H,xy);if(!de.equals(H,X,{loose:!0})){R.hasMarkPlaceholder=!0;var B=Object.fromEntries(Object.keys(ee).map(T=>[T,null]));j.push(Tt(Tt(Tt({[Md]:!0},B),X),{},{anchor:v,focus:v}))}}return C.useEffect(()=>{setTimeout(()=>{var{selection:T}=f;if(T){var{anchor:W}=T,L=oe.leaf(f,W.path);if(X&&!de.equals(L,X,{loose:!0})){_t.set(f,X);return}}_t.delete(f)})}),C.createElement(Zd.Provider,{value:s},C.createElement(Vd.Provider,{value:r},C.createElement(Dy,{node:x,receivedUserInput:S},C.createElement(m,Tt(Tt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Zt||!ca?g.spellCheck:!1,autoCorrect:Zt||!ca?g.autoCorrect:"false",autoCapitalize:Zt||!ca?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:O,style:Tt(Tt({},p?{}:Tt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},_?{minHeight:_}:{})),h),onBeforeInput:C.useCallback(T=>{if(!Zt&&!s&&!at(T,g.onBeforeInput)&&J.hasSelectableTarget(f,T.target)&&(T.preventDefault(),!J.isComposing(f))){var W=T.data;b.insertText(f,W)}},[g.onBeforeInput,f,s]),onInput:C.useCallback(T=>{if(!at(T,g.onInput)){if(I.current){I.current.handleInput();return}for(var W of A.current)W();A.current=[]}},[g.onInput]),onBlur:C.useCallback(T=>{if(!(s||R.isUpdatingSelection||!J.hasSelectableTarget(f,T.target)||at(T,g.onBlur))){var W=J.findDocumentOrShadowRoot(f);if(R.latestElement!==W.activeElement){var{relatedTarget:L}=T,U=J.toDOMNode(f,f);if(L!==U&&!(Ct(L)&&L.hasAttribute("data-slate-spacer"))){if(L!=null&&nn(L)&&J.hasDOMNode(f,L)){var te=J.toSlateNode(f,L);if(ce.isElement(te)&&!f.isVoid(te))return}if(mr){var ne=W.getSelection();ne==null||ne.removeAllRanges()}en.delete(f)}}}},[s,R.isUpdatingSelection,R.latestElement,f,g.onBlur]),onClick:C.useCallback(T=>{if(J.hasTarget(f,T.target)&&!at(T,g.onClick)&&nn(T.target)){var W=J.toSlateNode(f,T.target),L=J.findPath(f,W);if(!b.hasPath(f,L)||oe.get(f,L)!==W)return;if(T.detail===my&&L.length>=1){var U=L;if(!(ce.isElement(W)&&b.isBlock(f,W))){var te,ne=b.above(f,{match:xe=>ce.isElement(xe)&&b.isBlock(f,xe),at:L});U=(te=ne==null?void 0:ne[1])!==null&&te!==void 0?te:L.slice(0,1)}var ie=b.range(f,U);G.select(f,ie);return}if(s)return;var fe=b.start(f,L),Q=b.end(f,L),pe=b.void(f,{at:fe}),ge=b.void(f,{at:Q});if(pe&&ge&&N.equals(pe[1],ge[1])){var ke=b.range(f,fe);G.select(f,ke)}}},[f,g.onClick,s]),onCompositionEnd:C.useCallback(T=>{if(J.hasSelectableTarget(f,T.target)){var W;if(J.isComposing(f)&&Promise.resolve().then(()=>{D(!1),mn.set(f,!1)}),(W=I.current)===null||W===void 0||W.handleCompositionEnd(T),at(T,g.onCompositionEnd)||ot)return;if(!mr&&!vb&&!hb&&!yb&&!bb&&T.data){var L=_t.get(f);_t.delete(f),L!==void 0&&(Wt.set(f,f.marks),f.marks=L),b.insertText(f,T.data);var U=Wt.get(f);Wt.delete(f),U!==void 0&&(f.marks=U)}}},[g.onCompositionEnd,f]),onCompositionUpdate:C.useCallback(T=>{J.hasSelectableTarget(f,T.target)&&!at(T,g.onCompositionUpdate)&&(J.isComposing(f)||(D(!0),mn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:C.useCallback(T=>{if(J.hasSelectableTarget(f,T.target)){var W;if((W=I.current)===null||W===void 0||W.handleCompositionStart(T),at(T,g.onCompositionStart)||ot)return;D(!0);var{selection:L}=f;if(L&&V.isExpanded(L)){b.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:C.useCallback(T=>{J.hasSelectableTarget(f,T.target)&&!at(T,g.onCopy)&&!ll(T)&&(T.preventDefault(),J.setFragmentData(f,T.clipboardData,"copy"))},[g.onCopy,f]),onCut:C.useCallback(T=>{if(!s&&J.hasSelectableTarget(f,T.target)&&!at(T,g.onCut)&&!ll(T)){T.preventDefault(),J.setFragmentData(f,T.clipboardData,"cut");var{selection:W}=f;if(W)if(V.isExpanded(W))b.deleteFragment(f);else{var L=oe.parent(f,W.anchor.path);b.isVoid(f,L)&&G.delete(f)}}},[s,f,g.onCut]),onDragOver:C.useCallback(T=>{if(J.hasTarget(f,T.target)&&!at(T,g.onDragOver)){var W=J.toSlateNode(f,T.target);ce.isElement(W)&&b.isVoid(f,W)&&T.preventDefault()}},[g.onDragOver,f]),onDragStart:C.useCallback(T=>{if(!s&&J.hasTarget(f,T.target)&&!at(T,g.onDragStart)){var W=J.toSlateNode(f,T.target),L=J.findPath(f,W),U=ce.isElement(W)&&b.isVoid(f,W)||b.void(f,{at:L,voids:!0});if(U){var te=b.range(f,L);G.select(f,te)}R.isDraggingInternally=!0,J.setFragmentData(f,T.dataTransfer,"drag")}},[s,f,g.onDragStart,R]),onDrop:C.useCallback(T=>{if(!s&&J.hasTarget(f,T.target)&&!at(T,g.onDrop)){T.preventDefault();var W=f.selection,L=J.findEventRange(f,T),U=T.dataTransfer;G.select(f,L),R.isDraggingInternally&&W&&!V.equals(W,L)&&!b.void(f,{at:L,voids:!0})&&G.delete(f,{at:W}),J.insertData(f,U),J.isFocused(f)||J.focus(f)}R.isDraggingInternally=!1},[s,f,g.onDrop,R]),onDragEnd:C.useCallback(T=>{!s&&R.isDraggingInternally&&g.onDragEnd&&J.hasTarget(f,T.target)&&g.onDragEnd(T),R.isDraggingInternally=!1},[s,R,g,f]),onFocus:C.useCallback(T=>{if(!s&&!R.isUpdatingSelection&&J.hasEditableTarget(f,T.target)&&!at(T,g.onFocus)){var W=J.toDOMNode(f,f),L=J.findDocumentOrShadowRoot(f);if(R.latestElement=L.activeElement,$n&&T.target!==W){W.focus();return}en.set(f,!0)}},[s,R,f,g.onFocus]),onKeyDown:C.useCallback(T=>{if(!s&&J.hasEditableTarget(f,T.target)){var W;(W=I.current)===null||W===void 0||W.handleKeyDown(T);var{nativeEvent:L}=T;if(J.isComposing(f)&&L.isComposing===!1&&(mn.set(f,!1),D(!1)),at(T,g.onKeyDown)||J.isComposing(f))return;var{selection:U}=f,te=f.children[U!==null?U.focus.path[0]:0],ne=bd(oe.string(te))==="rtl";if(He.isRedo(L)){T.preventDefault();var ie=f;typeof ie.redo=="function"&&ie.redo();return}if(He.isUndo(L)){T.preventDefault();var fe=f;typeof fe.undo=="function"&&fe.undo();return}if(He.isMoveLineBackward(L)){T.preventDefault(),G.move(f,{unit:"line",reverse:!0});return}if(He.isMoveLineForward(L)){T.preventDefault(),G.move(f,{unit:"line"});return}if(He.isExtendLineBackward(L)){T.preventDefault(),G.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(He.isExtendLineForward(L)){T.preventDefault(),G.move(f,{unit:"line",edge:"focus"});return}if(He.isMoveBackward(L)){T.preventDefault(),U&&V.isCollapsed(U)?G.move(f,{reverse:!ne}):G.collapse(f,{edge:ne?"end":"start"});return}if(He.isMoveForward(L)){T.preventDefault(),U&&V.isCollapsed(U)?G.move(f,{reverse:ne}):G.collapse(f,{edge:ne?"start":"end"});return}if(He.isMoveWordBackward(L)){T.preventDefault(),U&&V.isExpanded(U)&&G.collapse(f,{edge:"focus"}),G.move(f,{unit:"word",reverse:!ne});return}if(He.isMoveWordForward(L)){T.preventDefault(),U&&V.isExpanded(U)&&G.collapse(f,{edge:"focus"}),G.move(f,{unit:"word",reverse:ne});return}if(Zt){if((Pd||mr)&&U&&(He.isDeleteBackward(L)||He.isDeleteForward(L))&&V.isCollapsed(U)){var Q=oe.parent(f,U.anchor.path);if(ce.isElement(Q)&&b.isVoid(f,Q)&&(b.isInline(f,Q)||b.isBlock(f,Q))){T.preventDefault(),b.deleteBackward(f,{unit:"block"});return}}}else{if(He.isBold(L)||He.isItalic(L)||He.isTransposeCharacter(L)){T.preventDefault();return}if(He.isSoftBreak(L)){T.preventDefault(),b.insertSoftBreak(f);return}if(He.isSplitBlock(L)){T.preventDefault(),b.insertBreak(f);return}if(He.isDeleteBackward(L)){T.preventDefault(),U&&V.isExpanded(U)?b.deleteFragment(f,{direction:"backward"}):b.deleteBackward(f);return}if(He.isDeleteForward(L)){T.preventDefault(),U&&V.isExpanded(U)?b.deleteFragment(f,{direction:"forward"}):b.deleteForward(f);return}if(He.isDeleteLineBackward(L)){T.preventDefault(),U&&V.isExpanded(U)?b.deleteFragment(f,{direction:"backward"}):b.deleteBackward(f,{unit:"line"});return}if(He.isDeleteLineForward(L)){T.preventDefault(),U&&V.isExpanded(U)?b.deleteFragment(f,{direction:"forward"}):b.deleteForward(f,{unit:"line"});return}if(He.isDeleteWordBackward(L)){T.preventDefault(),U&&V.isExpanded(U)?b.deleteFragment(f,{direction:"backward"}):b.deleteBackward(f,{unit:"word"});return}if(He.isDeleteWordForward(L)){T.preventDefault(),U&&V.isExpanded(U)?b.deleteFragment(f,{direction:"forward"}):b.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:C.useCallback(T=>{!s&&J.hasEditableTarget(f,T.target)&&!at(T,g.onPaste)&&(!Zt||xb(T.nativeEvent)||mr)&&(T.preventDefault(),J.insertData(f,T.clipboardData))},[s,f,g.onPaste])}),C.createElement(wy,{decorations:j,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},ky=e=>{var{attributes:t,children:n}=e;return C.createElement("span",Tt({},t),n,ot&&C.createElement("br",null))},_y=()=>[],By=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&V.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),I0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},at=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},ll=e=>nn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),Ay=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},Fy=C.createContext(!1),Ty=C.createContext({});function Sy(e){var t=C.useRef([]).current,n=C.useRef({editor:e}).current,r=C.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=C.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var jy=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],Oy=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Zn(e,jy),[l,u]=C.useState(()=>{if(!oe.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Je.stringify(s)));if(!b.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Je.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:c,onChange:h}=Sy(t),m=C.useCallback(f=>{var y;switch(r&&r(t.children),f==null||(y=f.operation)===null||y===void 0?void 0:y.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(D=>({v:D.v+1,editor:t})),h(t)},[t,h,r,a,i]);C.useEffect(()=>(ys.set(t,m),()=>{ys.set(t,()=>{})}),[t,m]);var[p,g]=C.useState(J.isFocused(t));return C.useEffect(()=>{g(J.isFocused(t))},[t]),Sr(()=>{var f=()=>g(J.isFocused(t));return Od>=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)})},[]),C.createElement(Ty.Provider,{value:c},C.createElement(Yd.Provider,{value:l},C.createElement(ro.Provider,{value:l.editor},C.createElement(Fy.Provider,{value:p},n))))},cl=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},dl=(e,t,n)=>{var r=J.toDOMRange(e,t).getBoundingClientRect(),a=J.toDOMRange(e,n).getBoundingClientRect();return cl(r,a)&&cl(a,r)},Py=(e,t)=>{var n=b.range(e,V.end(t)),r=Array.from(b.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(dl(e,b.range(e,r[a]),n))return b.range(e,r[a],n);if(r.length<2)return b.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)dl(e,b.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return b.range(e,r[i],n)};function fl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function hl(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){xt(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 Ny=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",r=t,{apply:a,onChange:i,deleteBackward:s,addMark:o,removeMark:l}=r;return Za.set(r,new WeakMap),r.addMark=(u,c)=>{var h,m;(h=so.get(r))===null||h===void 0||h(),!_t.get(r)&&(m=ct.get(r))!==null&&m!==void 0&&m.length&&_t.set(r,null),Wt.delete(r),o(u,c)},r.removeMark=u=>{var c;!_t.get(r)&&(c=ct.get(r))!==null&&c!==void 0&&c.length&&_t.set(r,null),Wt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&V.isCollapsed(r.selection)){var c=b.above(r,{match:g=>ce.isElement(g)&&b.isBlock(r,g),at:r.selection});if(c){var[,h]=c,m=b.range(r,h,r.selection.anchor),p=Py(r,m);V.isCollapsed(p)||G.delete(r,{at:p})}}},r.apply=u=>{var c=[],h=[],m=ct.get(r);if(m!=null&&m.length){var p=m.map(O=>Nb(O,u)).filter(Boolean);ct.set(r,p)}var g=Qt.get(r);g&&Qt.set(r,el(r,g,u));var f=Gt.get(r);if(f!=null&&f.at){var y=Ee.isPoint(f==null?void 0:f.at)?xs(r,f.at,u):el(r,f.at,u);Gt.set(r,y?hl(hl({},f),{},{at:y}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...jn(r,u.path));break}case"set_selection":{var D;(D=br.get(r))===null||D===void 0||D.unref(),br.delete(r);break}case"insert_node":case"remove_node":{c.push(...jn(r,N.parent(u.path)));break}case"merge_node":{var x=N.previous(u.path);c.push(...jn(r,x));break}case"move_node":{var A=N.common(N.parent(u.path),N.parent(u.newPath));c.push(...jn(r,A));var _;N.isBefore(u.path,u.newPath)?(c.push(...jn(r,N.parent(u.path))),_=u.newPath):(c.push(...jn(r,N.parent(u.newPath))),_=u.path);var k=oe.get(t,N.parent(_)),F=J.findKey(r,k),S=b.pathRef(r,N.parent(_));h.push([S,F]);break}}a(u);for(var[$,R]of c){var[I]=b.node(r,$);ka.set(I,R)}for(var[M,w]of h)if(M.current){var[E]=b.node(r,M.current);ka.set(E,w)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[h,m]=V.edges(c),p=b.void(r,{at:h.path}),g=b.void(r,{at:m.path});if(!(V.isCollapsed(c)&&!p)){var f=J.toDOMRange(r,c),y=f.cloneContents(),D=y.childNodes[0];if(y.childNodes.forEach(I=>{I.textContent&&I.textContent.trim()!==""&&(D=I)}),g){var[x]=g,A=f.cloneRange(),_=J.toDOMNode(r,x);A.setEndAfter(_),y=A.cloneContents()}if(p&&(D=y.querySelector("[data-slate-spacer]")),Array.from(y.querySelectorAll("[data-slate-zero-width]")).forEach(I=>{var M=I.getAttribute("data-slate-zero-width")==="n";I.textContent=M?`
112
+ `:""}),Id(D)){var k=D.ownerDocument.createElement("span");k.style.whiteSpace="pre",k.appendChild(D),y.appendChild(k),D=k}var F=r.getFragment(),S=JSON.stringify(F),$=window.btoa(encodeURIComponent(S));D.setAttribute("data-slate-fragment",$),u.setData("application/".concat(n),$);var R=y.ownerDocument.createElement("div");return R.appendChild(y),R.setAttribute("hidden","true"),y.ownerDocument.body.appendChild(R),u.setData("text/html",R.innerHTML),u.setData("text/plain",Ld(R)),y.ownerDocument.body.removeChild(R),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||Bb(u);if(c){var h=decodeURIComponent(window.atob(c)),m=JSON.parse(h);return r.insertFragment(m),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var h=c.split(/\r\n|\r|\n/),m=!1;for(var p of h)m&&G.splitNodes(r,{always:!0}),r.insertText(p),m=!0;return!0}return!1},r.onChange=u=>{var c=Od<18?vc.unstable_batchedUpdates:h=>h();c(()=>{var h=ys.get(r);h&&h(u),i(u)})},r},jn=(e,t)=>{var n=[];for(var[r,a]of b.levels(e,{at:t})){var i=J.findKey(e,r);n.push([a,i])}return n};const Ry={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null},lastAnchor:null,dispatch:()=>{},reportError:e=>{console.error(e)}},Kt=C.createContext(Ry);var Z=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e))(Z||{}),Ot=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Ot||{});const My=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case Z.blockquote:return d.jsx("blockquote",{className:"subtle",...e,children:t});case Z.link:return d.jsx("a",{...e,children:t});case Z.li:return d.jsx("li",{...e,children:t});case Z.mention:const a=r;return d.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case Z.ol:return d.jsx("ol",{...e,children:t});case Z.ul:return d.jsx("ul",{...e,children:t});case Z.span:return d.jsx("span",{...e,children:t});case Z.paragraph:return d.jsx("p",{...e,children:t});default:return d.jsx("span",{...e,children:t})}},Iy=({attributes:e,children:t,leaf:n})=>{const r=n;return r[Z.bold]&&(t=d.jsx("strong",{children:t})),r[Z.italic]&&(t=d.jsx("em",{children:t})),r[Z.strikethrough]&&(t=d.jsx("s",{children:t})),d.jsx("span",{...e,children:t})},Es="MENTION: ",Qd={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},ml={"mention-popover":35,default:-52},xi=16,Jd=(e,t,n)=>{const r=C.useRef(null),{showLinkEditor:a,mentionPopover:i}=C.useContext(Kt),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),C.useEffect(()=>{var p,g;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,c=0;if(t==="mention-popover"){const{position:f}=i,y=A=>{if(!b.hasPath(e,A.path))return!1;const _=oe.get(e,A.path);return b.isEditor(_)||ce.isElement(_)?A.offset<=_.children.length:de.isText(_)?A.offset<=_.text.length:!1};if(f&&(!y(f==null?void 0:f.anchor)||!y(f==null?void 0:f.focus)))return;u=J.toDOMRange(e,f||Qd).getBoundingClientRect();const x=(p=document.getElementById(n))==null?void 0:p.getBoundingClientRect();l.style.setProperty("--width",`${((x==null?void 0:x.width)||0)/xi}rem`),c=(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=(g=document.getElementById(n))==null?void 0:g.getBoundingClientRect());const h=ml[t]||ml.default,m=((u==null?void 0:u.top)||0)+window.scrollY+h;c===0&&(c=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${m/xi}rem`,l.style.left=`${c/xi}rem`},o),r},$y=e=>{const[t,n]=C.useState(null);return C.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=b.nodes(e,{at:r,match:i=>i.type===Z.link});if(a){const i=a[0],s=Mc(i.link),o=i.children[0],l=(o==null?void 0:o.text)||"";n({...s,text:l})}else n(null)},[e,e.selection]),t};var st=(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))(st||{});const Ln={[Z.paragraph]:Z.paragraph,[Z.blockquote]:Z.blockquote,[Z.codeblock]:Z.codeblock,[Z.link]:Z.link,[Z.ul]:Z.ul,[Z.ol]:Z.ol,[Z.li]:Z.li,[Z.mention]:Z.mention,[Z.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Ot.emphasis]:Z.italic,[Ot.strong]:Z.bold,[Ot.delete]:Z.strikethrough,[Ot.code]:Z.code,[Z.hr]:Z.hr,[Z.image]:Z.image};function pl(e){if(e)throw e}var fa=Object.prototype.hasOwnProperty,Xd=Object.prototype.toString,gl=Object.defineProperty,vl=Object.getOwnPropertyDescriptor,bl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Xd.call(t)==="[object Array]"},yl=function(t){if(!t||Xd.call(t)!=="[object Object]")return!1;var n=fa.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&fa.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||fa.call(t,a)},Dl=function(t,n){gl&&n.name==="__proto__"?gl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Cl=function(t,n){if(n==="__proto__")if(fa.call(t,n)){if(vl)return vl(t,n).value}else return;return t[n]},Ly=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,c=!1;for(typeof o=="boolean"&&(c=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=Cl(o,n),a=Cl(t,n),o!==a&&(c&&a&&(yl(a)||(i=bl(a)))?(i?(i=!1,s=r&&bl(r)?r:[]):s=r&&yl(r)?r:{},Dl(o,{name:n,newValue:e(c,s,a)})):typeof a<"u"&&Dl(o,{name:n,newValue:a}));return o};const wi=wn(Ly);function ks(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 zy(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const c=e[++i];let h=-1;if(l){s(l);return}for(;++h<a.length;)(u[h]===null||u[h]===void 0)&&(u[h]=a[h]);a=u,c?qy(c,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function qy(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const c=u;if(o&&n)throw c;return a(c)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function yr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?xl(e.position):"start"in e||"end"in e?xl(e):"line"in e||"column"in e?_s(e):""}function _s(e){return wl(e&&e.line)+":"+wl(e&&e.column)}function xl(e){return _s(e&&e.start)+"-"+_s(e&&e.end)}function wl(e){return e&&typeof e=="number"?e:1}class ht extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=o?o.line:void 0,this.name=yr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}ht.prototype.file="";ht.prototype.name="";ht.prototype.reason="";ht.prototype.message="";ht.prototype.stack="";ht.prototype.column=void 0;ht.prototype.line=void 0;ht.prototype.ancestors=void 0;ht.prototype.cause=void 0;ht.prototype.fatal=void 0;ht.prototype.place=void 0;ht.prototype.ruleId=void 0;ht.prototype.source=void 0;const St={basename:Wy,dirname:Hy,extname:Uy,join:Vy,sep:"/"};function Wy(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Pr(e);let n=0,r=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else r<0&&(i=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function Hy(e){if(Pr(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 Uy(e){Pr(e);let t=e.length,n=-1,r=0,a=-1,i=0,s;for(;t--;){const o=e.codePointAt(t);if(o===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),o===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function Vy(...e){let t=-1,n;for(;++t<e.length;)Pr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Ky(n)}function Ky(e){Pr(e);const t=e.codePointAt(0)===47;let n=Zy(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Zy(e,t){let n="",r=0,a=-1,i=0,s=-1,o,l;for(;++s<=e.length;){if(s<e.length)o=e.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(a===s-1||i===1))if(a!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),a=s,i=0;continue}}else if(n.length>0){n="",r=0,a=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,s):n=e.slice(a+1,s),r=s-a-1;a=s,i=0}else o===46&&i>-1?i++:i=-1}return n}function Pr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Yy={cwd:Gy};function Gy(){return"/"}function Bs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Qy(e){if(typeof e=="string")e=new URL(e);else if(!Bs(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 Jy(e)}function Jy(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Ei=["history","path","basename","stem","extname","dirname"];class Xy{constructor(t){let n;t?Bs(t)?n={path:t}:typeof t=="string"||e1(t)?n={value:t}:n=t:n={},this.cwd=Yy.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ei.length;){const i=Ei[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)Ei.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?St.basename(this.path):void 0}set basename(t){_i(t,"basename"),ki(t,"basename"),this.path=St.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?St.dirname(this.path):void 0}set dirname(t){El(this.basename,"dirname"),this.path=St.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?St.extname(this.path):void 0}set extname(t){if(ki(t,"extname"),El(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=St.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Bs(t)&&(t=Qy(t)),_i(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?St.basename(this.path,this.extname):void 0}set stem(t){_i(t,"stem"),ki(t,"stem"),this.path=St.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new ht(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function ki(e,t){if(e&&e.includes(St.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+St.sep+"`")}function _i(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function El(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function e1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const t1=function(e){const r=this.constructor.prototype,a=r[e],i=function(){return a.apply(i,arguments)};Object.setPrototypeOf(i,r);const s=Object.getOwnPropertyNames(a);for(const o of s){const l=Object.getOwnPropertyDescriptor(a,o);l&&Object.defineProperty(i,o,l)}return i},n1={}.hasOwnProperty;class lo extends t1{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=zy()}copy(){const t=new lo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(wi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Fi("data",this.frozen),this.namespace[t]=n,this):n1.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Fi("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Gr(t),r=this.parser||this.Parser;return Bi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Bi("process",this.parser||this.Parser),Ai("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=Gr(t),l=r.parse(o);r.run(l,o,function(c,h,m){if(c||!h||!m)return u(c);const p=h,g=r.stringify(p,m);i1(g)?m.value=g:m.result=g,u(c,m)});function u(c,h){c||!h?s(c):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Bi("processSync",this.parser||this.Parser),Ai("processSync",this.compiler||this.Compiler),this.process(t,a),_l("processSync","process",n),r;function a(i,s){n=!0,pl(i),r=s}}run(t,n,r){kl(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,o){const l=Gr(n);a.run(t,l,u);function u(c,h,m){const p=h||t;c?o(c):s?s(p):r(void 0,p,m)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),_l("runSync","run",r),a;function i(s,o){pl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=Gr(n),a=this.compiler||this.Compiler;return Ai("stringify",a),kl(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Fi("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...h]=u;l(c,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&&(a.settings=wi(!0,a.settings,u.settings))}function o(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const h=u[c];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let h=-1,m=-1;for(;++h<r.length;)if(r[h][0]===u){m=h;break}if(m===-1)r.push([u,...c]);else if(c.length>0){let[p,...g]=c;const f=r[m][1];ks(f)&&ks(p)&&(p=wi(!0,f,p)),r[m]=[u,p,...g]}}}}const r1=new lo().freeze();function Bi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ai(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Fi(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 kl(e){if(!ks(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function _l(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Gr(e){return a1(e)?e:new Xy(e)}function a1(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function i1(e){return typeof e=="string"||s1(e)}function s1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const o1={};function u1(e,t){const n=t||o1,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ef(e,r,a)}function ef(e,t,n){if(l1(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 Bl(e.children,t,n)}return Array.isArray(e)?Bl(e,t,n):""}function Bl(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=ef(e[a],t,n);return r.join("")}function l1(e){return!!(e&&typeof e=="object")}const Al=document.createElement("i");function co(e){const t="&"+e+";";Al.innerHTML=t;const n=Al.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Rt(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function Dt(e,t){return e.length>0?(Rt(e,e.length,0,t),e):t}const Fl={}.hasOwnProperty;function c1(e){const t={};let n=-1;for(;++n<e.length;)d1(t,e[n]);return t}function d1(e,t){let n;for(n in t){const a=(Fl.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){Fl.call(a,s)||(a[s]=[]);const o=i[s];f1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function f1(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Rt(e,0,0,r)}function tf(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 Wn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const jt=un(/[A-Za-z]/),Bt=un(/[\dA-Za-z]/),h1=un(/[#-'*+\--9=?A-Z^-~]/);function As(e){return e!==null&&(e<32||e===127)}const Fs=un(/\d/),m1=un(/[\dA-Fa-f]/),p1=un(/[!-/:-@[-`{-~]/);function ye(e){return e!==null&&e<-2}function ft(e){return e!==null&&(e<0||e===32)}function je(e){return e===-2||e===-1||e===32}const g1=un(/\p{P}|\p{S}/u),v1=un(/\s/);function un(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ie(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return je(l)?(e.enter(n),o(l)):t(l)}function o(l){return je(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const b1={tokenize:y1};function y1(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ie(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return ye(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const D1={tokenize:C1},Tl={tokenize:x1};function C1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(A){if(r<n.length){const _=n[r];return t.containerState=_[1],e.attempt(_[0].continuation,l,u)(A)}return u(A)}function l(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&x();const _=t.events.length;let k=_,F;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){F=t.events[k][1].end;break}D(r);let S=_;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},F),S++;return Rt(t.events,k+1,0,t.events.slice(_)),t.events.length=S,u(A)}return o(A)}function u(A){if(r===n.length){if(!a)return m(A);if(a.currentConstruct&&a.currentConstruct.concrete)return g(A);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Tl,c,h)(A)}function c(A){return a&&x(),D(r),m(A)}function h(A){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(A)}function m(A){return t.containerState={},e.attempt(Tl,p,g)(A)}function p(A){return r++,n.push([t.currentConstruct,t.containerState]),m(A)}function g(A){if(A===null){a&&x(),D(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(A)}function f(A){if(A===null){y(e.exit("chunkFlow"),!0),D(0),e.consume(A);return}return ye(A)?(e.consume(A),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(A),f)}function y(A,_){const k=t.sliceStream(A);if(_&&k.push(null),A.previous=i,i&&(i.next=A),i=A,a.defineSkip(A.start),a.write(k),t.parser.lazy[A.start.line]){let F=a.events.length;for(;F--;)if(a.events[F][1].start.offset<s&&(!a.events[F][1].end||a.events[F][1].end.offset>s))return;const S=t.events.length;let $=S,R,I;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(R){I=t.events[$][1].end;break}R=!0}for(D(r),F=S;F<t.events.length;)t.events[F][1].end=Object.assign({},I),F++;Rt(t.events,$+1,0,t.events.slice(S)),t.events.length=F}}function D(A){let _=n.length;for(;_-- >A;){const k=n[_];t.containerState=k[1],k[0].exit.call(t,e)}n.length=A}function x(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function x1(e,t,n){return Ie(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Sl(e){if(e===null||ft(e)||v1(e))return 1;if(g1(e))return 2}function fo(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Ts={name:"attention",tokenize:E1,resolveAll:w1};function w1(e,t){let n=-1,r,a,i,s,o,l,u,c;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),m=Object.assign({},e[n][1].start);jl(h,-l),jl(m,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:m},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Dt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Dt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Dt(u,fo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Dt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=Dt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Rt(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function E1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Sl(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),c=Sl(l),h=!c||c===2&&a||n.includes(l),m=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?h:h&&(a||!m)),u._close=!!(i===42?m:m&&(c||!h)),t(l)}}function jl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const k1={name:"autolink",tokenize:_1};function _1(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return jt(p)?(e.consume(p),s):u(p)}function s(p){return p===43||p===45||p===46||Bt(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||Bt(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||As(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),c):h1(p)?(e.consume(p),u):n(p)}function c(p){return Bt(p)?h(p):n(p)}function h(p){return p===46?(e.consume(p),r=0,c):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):m(p)}function m(p){if((p===45||Bt(p))&&r++<63){const g=p===45?m:h;return e.consume(p),g}return n(p)}}const Ya={tokenize:B1,partial:!0};function B1(e,t,n){return r;function r(i){return je(i)?Ie(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ye(i)?t(i):n(i)}}const nf={name:"blockQuote",tokenize:A1,continuation:{tokenize:F1},exit:T1};function A1(e,t,n){const r=this;return a;function a(s){if(s===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return je(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function F1(e,t,n){const r=this;return a;function a(s){return je(s)?Ie(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(nf,t,n)(s)}}function T1(e){e.exit("blockQuote")}const rf={name:"characterEscape",tokenize:S1};function S1(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return p1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const af={name:"characterReference",tokenize:j1};function j1(e,t,n){const r=this;let a=0,i,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"),i=31,s=Bt,c(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=m1,c):(e.enter("characterReferenceValue"),i=7,s=Fs,c(h))}function c(h){if(h===59&&a){const m=e.exit("characterReferenceValue");return s===Bt&&!co(r.sliceSerialize(m))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&a++<i?(e.consume(h),c):n(h)}}const Ol={tokenize:P1,partial:!0},Pl={name:"codeFenced",tokenize:O1,concrete:!0};function O1(e,t,n){const r=this,a={tokenize:k,partial:!0};let i=0,s=0,o;return l;function l(F){return u(F)}function u(F){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=F,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(F)}function c(F){return F===o?(s++,e.consume(F),c):s<3?n(F):(e.exit("codeFencedFenceSequence"),je(F)?Ie(e,h,"whitespace")(F):h(F))}function h(F){return F===null||ye(F)?(e.exit("codeFencedFence"),r.interrupt?t(F):e.check(Ol,f,_)(F)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(F))}function m(F){return F===null||ye(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(F)):je(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ie(e,p,"whitespace")(F)):F===96&&F===o?n(F):(e.consume(F),m)}function p(F){return F===null||ye(F)?h(F):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(F))}function g(F){return F===null||ye(F)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(F)):F===96&&F===o?n(F):(e.consume(F),g)}function f(F){return e.attempt(a,_,y)(F)}function y(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),D}function D(F){return i>0&&je(F)?Ie(e,x,"linePrefix",i+1)(F):x(F)}function x(F){return F===null||ye(F)?e.check(Ol,f,_)(F):(e.enter("codeFlowValue"),A(F))}function A(F){return F===null||ye(F)?(e.exit("codeFlowValue"),x(F)):(e.consume(F),A)}function _(F){return e.exit("codeFenced"),t(F)}function k(F,S,$){let R=0;return I;function I(j){return F.enter("lineEnding"),F.consume(j),F.exit("lineEnding"),M}function M(j){return F.enter("codeFencedFence"),je(j)?Ie(F,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):w(j)}function w(j){return j===o?(F.enter("codeFencedFenceSequence"),E(j)):$(j)}function E(j){return j===o?(R++,F.consume(j),E):R>=s?(F.exit("codeFencedFenceSequence"),je(j)?Ie(F,O,"whitespace")(j):O(j)):$(j)}function O(j){return j===null||ye(j)?(F.exit("codeFencedFence"),S(j)):$(j)}}}function P1(e,t,n){const r=this;return a;function a(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const Ti={name:"codeIndented",tokenize:R1},N1={tokenize:M1,partial:!0};function R1(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Ie(e,i,"linePrefix",4+1)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):ye(u)?e.attempt(N1,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||ye(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function M1(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):ye(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Ie(e,i,"linePrefix",4+1)(s)}function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):ye(s)?a(s):n(s)}}const I1={name:"codeText",tokenize:z1,resolve:$1,previous:L1};function $1(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function L1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function z1(e,t,n){let r=0,a,i;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?(i=e.enter("codeTextSequence"),a=0,c(h)):ye(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||ye(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),u)}function c(h){return h===96?(e.consume(h),a++,c):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}function sf(e){const t={};let n=-1,r,a,i,s,o,l,u;for(;++n<e.length;){for(;n in t;)n=t[n];if(r=e[n],n&&r[1].type==="chunkFlow"&&e[n-1][1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,q1(e,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=e[i],s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(e[a][1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},e[a][1].start),o=e.slice(a,n),o.unshift(r),Rt(e,a,n-a+1,o))}}return!u}function q1(e,t){const n=e[t][1],r=e[t][2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let c,h,m=-1,p=n,g=0,f=0;const y=[f];for(;p;){for(;e[++a][1]!==p;);i.push(a),p._tokenizer||(c=r.sliceStream(p),p.next||c.push(null),h&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=p,p=p.next}for(p=n;++m<o.length;)o[m][0]==="exit"&&o[m-1][0]==="enter"&&o[m][1].type===o[m-1][1].type&&o[m][1].start.line!==o[m][1].end.line&&(f=m+1,y.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):y.pop(),m=y.length;m--;){const D=o.slice(y[m],y[m+1]),x=i.pop();l.unshift([x,x+D.length-1]),Rt(e,x,2,D)}for(m=-1;++m<l.length;)u[g+l[m][0]]=g+l[m][1],g+=l[m][1]-l[m][0]-1;return u}const W1={tokenize:V1,resolve:U1},H1={tokenize:K1,partial:!0};function U1(e){return sf(e),e}function V1(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):ye(o)?e.check(H1,s,i)(o):(e.consume(o),a)}function i(o){return e.exit("chunkContent"),e.exit("content"),t(o)}function s(o){return e.consume(o),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function K1(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ie(e,i,"linePrefix")}function i(s){if(s===null||ye(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 of(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return h;function h(D){return D===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(D),e.exit(i),m):D===null||D===32||D===41||As(D)?n(D):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(D))}function m(D){return D===62?(e.enter(i),e.consume(D),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(D))}function p(D){return D===62?(e.exit("chunkString"),e.exit(o),m(D)):D===null||D===60||ye(D)?n(D):(e.consume(D),D===92?g:p)}function g(D){return D===60||D===62||D===92?(e.consume(D),p):p(D)}function f(D){return!c&&(D===null||D===41||ft(D))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(D)):c<u&&D===40?(e.consume(D),c++,f):D===41?(e.consume(D),c--,f):D===null||D===32||D===40||As(D)?n(D):(e.consume(D),D===92?y:f)}function y(D){return D===40||D===41||D===92?(e.consume(D),f):f(D)}}function uf(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),c}function c(p){return o>999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):ye(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||ye(p)||o++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!je(p)),p===92?m:h)}function m(p){return p===91||p===92||p===93?(e.consume(p),o++,h):h(p)}}function lf(e,t,n,r,a,i){let s;return o;function o(m){return m===34||m===39||m===40?(e.enter(r),e.enter(a),e.consume(m),e.exit(a),s=m===40?41:m,l):n(m)}function l(m){return m===s?(e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):(e.enter(i),u(m))}function u(m){return m===s?(e.exit(i),l(s)):m===null?n(m):ye(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Ie(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(m))}function c(m){return m===s||m===null||ye(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?h:c)}function h(m){return m===s||m===92?(e.consume(m),c):c(m)}}function Dr(e,t){let n;return r;function r(a){return ye(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):je(a)?Ie(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const Z1={name:"definition",tokenize:G1},Y1={tokenize:Q1,partial:!0};function G1(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return uf.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return a=Wn(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 ft(p)?Dr(e,u)(p):u(p)}function u(p){return of(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(Y1,h,h)(p)}function h(p){return je(p)?Ie(e,m,"whitespace")(p):m(p)}function m(p){return p===null||ye(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function Q1(e,t,n){return r;function r(o){return ft(o)?Dr(e,a)(o):n(o)}function a(o){return lf(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return je(o)?Ie(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ye(o)?t(o):n(o)}}const J1={name:"hardBreakEscape",tokenize:X1};function X1(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return ye(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const eD={name:"headingAtx",tokenize:nD,resolve:tD};function tD(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Rt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function nD(e,t,n){let r=0;return a;function a(c){return e.enter("atxHeading"),i(c)}function i(c){return e.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(e.consume(c),s):c===null||ft(c)?(e.exit("atxHeadingSequence"),o(c)):n(c)}function o(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||ye(c)?(e.exit("atxHeading"),t(c)):je(c)?Ie(e,o,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),o(c))}function u(c){return c===null||c===35||ft(c)?(e.exit("atxHeadingText"),o(c)):(e.consume(c),u)}}const rD=["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"],Nl=["pre","script","style","textarea"],aD={name:"htmlFlow",tokenize:uD,resolveTo:oD,concrete:!0},iD={tokenize:cD,partial:!0},sD={tokenize:lD,partial:!0};function oD(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 uD(e,t,n){const r=this;let a,i,s,o,l;return u;function u(B){return c(B)}function c(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),h}function h(B){return B===33?(e.consume(B),m):B===47?(e.consume(B),i=!0,f):B===63?(e.consume(B),a=3,r.interrupt?t:v):jt(B)?(e.consume(B),s=String.fromCharCode(B),y):n(B)}function m(B){return B===45?(e.consume(B),a=2,p):B===91?(e.consume(B),a=5,o=0,g):jt(B)?(e.consume(B),a=4,r.interrupt?t:v):n(B)}function p(B){return B===45?(e.consume(B),r.interrupt?t:v):n(B)}function g(B){const T="CDATA[";return B===T.charCodeAt(o++)?(e.consume(B),o===T.length?r.interrupt?t:w:g):n(B)}function f(B){return jt(B)?(e.consume(B),s=String.fromCharCode(B),y):n(B)}function y(B){if(B===null||B===47||B===62||ft(B)){const T=B===47,W=s.toLowerCase();return!T&&!i&&Nl.includes(W)?(a=1,r.interrupt?t(B):w(B)):rD.includes(s.toLowerCase())?(a=6,T?(e.consume(B),D):r.interrupt?t(B):w(B)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):i?x(B):A(B))}return B===45||Bt(B)?(e.consume(B),s+=String.fromCharCode(B),y):n(B)}function D(B){return B===62?(e.consume(B),r.interrupt?t:w):n(B)}function x(B){return je(B)?(e.consume(B),x):I(B)}function A(B){return B===47?(e.consume(B),I):B===58||B===95||jt(B)?(e.consume(B),_):je(B)?(e.consume(B),A):I(B)}function _(B){return B===45||B===46||B===58||B===95||Bt(B)?(e.consume(B),_):k(B)}function k(B){return B===61?(e.consume(B),F):je(B)?(e.consume(B),k):A(B)}function F(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),l=B,S):je(B)?(e.consume(B),F):$(B)}function S(B){return B===l?(e.consume(B),l=null,R):B===null||ye(B)?n(B):(e.consume(B),S)}function $(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||ft(B)?k(B):(e.consume(B),$)}function R(B){return B===47||B===62||je(B)?A(B):n(B)}function I(B){return B===62?(e.consume(B),M):n(B)}function M(B){return B===null||ye(B)?w(B):je(B)?(e.consume(B),M):n(B)}function w(B){return B===45&&a===2?(e.consume(B),q):B===60&&a===1?(e.consume(B),z):B===62&&a===4?(e.consume(B),H):B===63&&a===3?(e.consume(B),v):B===93&&a===5?(e.consume(B),X):ye(B)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(iD,ee,E)(B)):B===null||ye(B)?(e.exit("htmlFlowData"),E(B)):(e.consume(B),w)}function E(B){return e.check(sD,O,ee)(B)}function O(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),j}function j(B){return B===null||ye(B)?E(B):(e.enter("htmlFlowData"),w(B))}function q(B){return B===45?(e.consume(B),v):w(B)}function z(B){return B===47?(e.consume(B),s="",re):w(B)}function re(B){if(B===62){const T=s.toLowerCase();return Nl.includes(T)?(e.consume(B),H):w(B)}return jt(B)&&s.length<8?(e.consume(B),s+=String.fromCharCode(B),re):w(B)}function X(B){return B===93?(e.consume(B),v):w(B)}function v(B){return B===62?(e.consume(B),H):B===45&&a===2?(e.consume(B),v):w(B)}function H(B){return B===null||ye(B)?(e.exit("htmlFlowData"),ee(B)):(e.consume(B),H)}function ee(B){return e.exit("htmlFlow"),t(B)}}function lD(e,t,n){const r=this;return a;function a(s){return ye(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function cD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Ya,t,n)}}const dD={name:"htmlText",tokenize:fD};function fD(e,t,n){const r=this;let a,i,s;return o;function o(v){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(v),l}function l(v){return v===33?(e.consume(v),u):v===47?(e.consume(v),k):v===63?(e.consume(v),A):jt(v)?(e.consume(v),$):n(v)}function u(v){return v===45?(e.consume(v),c):v===91?(e.consume(v),i=0,g):jt(v)?(e.consume(v),x):n(v)}function c(v){return v===45?(e.consume(v),p):n(v)}function h(v){return v===null?n(v):v===45?(e.consume(v),m):ye(v)?(s=h,z(v)):(e.consume(v),h)}function m(v){return v===45?(e.consume(v),p):h(v)}function p(v){return v===62?q(v):v===45?m(v):h(v)}function g(v){const H="CDATA[";return v===H.charCodeAt(i++)?(e.consume(v),i===H.length?f:g):n(v)}function f(v){return v===null?n(v):v===93?(e.consume(v),y):ye(v)?(s=f,z(v)):(e.consume(v),f)}function y(v){return v===93?(e.consume(v),D):f(v)}function D(v){return v===62?q(v):v===93?(e.consume(v),D):f(v)}function x(v){return v===null||v===62?q(v):ye(v)?(s=x,z(v)):(e.consume(v),x)}function A(v){return v===null?n(v):v===63?(e.consume(v),_):ye(v)?(s=A,z(v)):(e.consume(v),A)}function _(v){return v===62?q(v):A(v)}function k(v){return jt(v)?(e.consume(v),F):n(v)}function F(v){return v===45||Bt(v)?(e.consume(v),F):S(v)}function S(v){return ye(v)?(s=S,z(v)):je(v)?(e.consume(v),S):q(v)}function $(v){return v===45||Bt(v)?(e.consume(v),$):v===47||v===62||ft(v)?R(v):n(v)}function R(v){return v===47?(e.consume(v),q):v===58||v===95||jt(v)?(e.consume(v),I):ye(v)?(s=R,z(v)):je(v)?(e.consume(v),R):q(v)}function I(v){return v===45||v===46||v===58||v===95||Bt(v)?(e.consume(v),I):M(v)}function M(v){return v===61?(e.consume(v),w):ye(v)?(s=M,z(v)):je(v)?(e.consume(v),M):R(v)}function w(v){return v===null||v===60||v===61||v===62||v===96?n(v):v===34||v===39?(e.consume(v),a=v,E):ye(v)?(s=w,z(v)):je(v)?(e.consume(v),w):(e.consume(v),O)}function E(v){return v===a?(e.consume(v),a=void 0,j):v===null?n(v):ye(v)?(s=E,z(v)):(e.consume(v),E)}function O(v){return v===null||v===34||v===39||v===60||v===61||v===96?n(v):v===47||v===62||ft(v)?R(v):(e.consume(v),O)}function j(v){return v===47||v===62||ft(v)?R(v):n(v)}function q(v){return v===62?(e.consume(v),e.exit("htmlTextData"),e.exit("htmlText"),t):n(v)}function z(v){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),re}function re(v){return je(v)?Ie(e,X,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(v):X(v)}function X(v){return e.enter("htmlTextData"),s(v)}}const ho={name:"labelEnd",tokenize:bD,resolveTo:vD,resolveAll:gD},hD={tokenize:yD},mD={tokenize:DD},pD={tokenize:CD};function gD(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 vD(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},c={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=Dt(o,e.slice(i+1,i+r+3)),o=Dt(o,[["enter",c,t]]),o=Dt(o,fo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=Dt(o,[["exit",c,t],e[s-2],e[s-1],["exit",u,t]]),o=Dt(o,e.slice(s+1)),o=Dt(o,[["exit",l,t]]),Rt(e,i,e.length,o),e}function bD(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(m){return i?i._inactive?h(m):(s=r.parser.defined.includes(Wn(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):n(m)}function l(m){return m===40?e.attempt(hD,c,s?c:h)(m):m===91?e.attempt(mD,c,s?u:h)(m):s?c(m):h(m)}function u(m){return e.attempt(pD,c,h)(m)}function c(m){return t(m)}function h(m){return i._balanced=!0,n(m)}}function yD(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),a}function a(h){return ft(h)?Dr(e,i)(h):i(h)}function i(h){return h===41?c(h):of(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return ft(h)?Dr(e,l)(h):c(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?lf(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):c(h)}function u(h){return ft(h)?Dr(e,c)(h):c(h)}function c(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function DD(e,t,n){const r=this;return a;function a(o){return uf.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Wn(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(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const xD={name:"labelStartImage",tokenize:wD,resolveAll:ho.resolveAll};function wD(e,t,n){const r=this;return a;function a(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),s):n(o)}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const ED={name:"labelStartLink",tokenize:kD,resolveAll:ho.resolveAll};function kD(e,t,n){const r=this;return a;function a(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Si={name:"lineEnding",tokenize:_D};function _D(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ie(e,t,"linePrefix")}}const ha={name:"thematicBreak",tokenize:BD};function BD(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||ye(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),je(u)?Ie(e,o,"whitespace")(u):o(u))}}const lt={name:"list",tokenize:TD,continuation:{tokenize:SD},exit:OD},AD={tokenize:PD,partial:!0},FD={tokenize:jD,partial:!0};function TD(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Fs(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ha,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 Fs(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(Ya,r.interrupt?n:c,e.attempt(AD,m,h))}function c(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function h(p){return je(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function SD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ya,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ie(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!je(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(FD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ie(e,e.attempt(lt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function jD(e,t,n){const r=this;return Ie(e,a,"listItemIndent",r.containerState.size+1);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function OD(e){e.exit(this.containerState.type)}function PD(e,t,n){const r=this;return Ie(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function a(i){const s=r.events[r.events.length-1];return!je(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Rl={name:"setextUnderline",tokenize:RD,resolveTo:ND};function ND(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:Object.assign({},e[a][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[i][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}function RD(e,t,n){const r=this;let a;return i;function i(u){let c=r.events.length,h;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){h=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),je(u)?Ie(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ye(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const MD={tokenize:ID};function ID(e){const t=this,n=e.attempt(Ya,r,e.attempt(this.parser.constructs.flowInitial,a,Ie(e,e.attempt(this.parser.constructs.flow,a,e.attempt(W1,a)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const $D={resolveAll:df()},LD=cf("string"),zD=cf("text");function cf(e){return{tokenize:t,resolveAll:df(e==="text"?qD:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(c){return u(c)?i(c):o(c)}function o(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const h=a[c];let m=-1;if(h)for(;++m<h.length;){const p=h[m];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function df(e){return t;function t(n,r){let a=-1,i;for(;++a<=n.length;)i===void 0?n[a]&&n[a][1].type==="data"&&(i=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==i+2&&(n[i][1].end=n[a-1][1].end,n.splice(i+2,a-i-2),a=i+2),i=void 0);return e?e(n,r):n}}function qD(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let i=a.length,s=-1,o=0,l;for(;i--;){const u=a[i];if(typeof u=="string"){for(s=u.length;u.charCodeAt(s-1)===32;)o++,s--;if(s)break;s=-1}else if(u===-2)l=!0,o++;else if(u!==-1){i++;break}}if(o){const u={type:n===e.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-o,offset:r.end.offset-o,_index:r.start._index+i,_bufferIndex:i?s:r.start._bufferIndex+s},end:Object.assign({},r.end)};r.end=Object.assign({},u.start),r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}function WD(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:x,enter:A,exit:_,attempt:S(k),check:S(F),interrupt:S(F,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:m,now:g,defineSkip:f,write:h};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function h(M){return s=Dt(s,M),y(),s[s.length-1]!==null?[]:($(t,0),u.events=fo(i,u.events,u),u.events)}function m(M,w){return UD(p(M),w)}function p(M){return HD(s,M)}function g(){const{line:M,column:w,offset:E,_index:O,_bufferIndex:j}=r;return{line:M,column:w,offset:E,_index:O,_bufferIndex:j}}function f(M){a[M.line]=M.column,I()}function y(){let M;for(;r._index<s.length;){const w=s[r._index];if(typeof w=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<w.length;)D(w.charCodeAt(r._bufferIndex));else D(w)}}function D(M){c=c(M)}function x(M){ye(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,I()):M!==-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=M}function A(M,w){const E=w||{};return E.type=M,E.start=g(),u.events.push(["enter",E,u]),o.push(E),E}function _(M){const w=o.pop();return w.end=g(),u.events.push(["exit",w,u]),w}function k(M,w){$(M,w.from)}function F(M,w){w.restore()}function S(M,w){return E;function E(O,j,q){let z,re,X,v;return Array.isArray(O)?ee(O):"tokenize"in O?ee([O]):H(O);function H(L){return U;function U(te){const ne=te!==null&&L[te],ie=te!==null&&L.null,fe=[...Array.isArray(ne)?ne:ne?[ne]:[],...Array.isArray(ie)?ie:ie?[ie]:[]];return ee(fe)(te)}}function ee(L){return z=L,re=0,L.length===0?q:B(L[re])}function B(L){return U;function U(te){return v=R(),X=L,L.partial||(u.currentConstruct=L),L.name&&u.parser.constructs.disable.null.includes(L.name)?W():L.tokenize.call(w?Object.assign(Object.create(u),w):u,l,T,W)(te)}}function T(L){return M(X,v),j}function W(L){return v.restore(),++re<z.length?B(z[re]):q}}}function $(M,w){M.resolveAll&&!i.includes(M)&&i.push(M),M.resolve&&Rt(u.events,w,u.events.length-w,M.resolve(u.events.slice(w),u)),M.resolveTo&&(u.events=M.resolveTo(u.events,u))}function R(){const M=g(),w=u.previous,E=u.currentConstruct,O=u.events.length,j=Array.from(o);return{restore:q,from:O};function q(){r=M,u.previous=w,u.currentConstruct=E,u.events.length=O,o=j,I()}}function I(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function HD(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,i=t.end._bufferIndex;let s;if(n===a)s=[e[n].slice(r,i)];else{if(s=e.slice(n,a),r>-1){const o=s[0];typeof o=="string"?s[0]=o.slice(r):s.shift()}i>0&&s.push(e[a].slice(0,i))}return s}function UD(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
113
113
  `;break}case-3:{s=`\r
114
- `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const VD={42:lt,43:lt,45:lt,48:lt,49:lt,50:lt,51:lt,52:lt,53:lt,54:lt,55:lt,56:lt,57:lt,62:nf},KD={91:Z1},ZD={[-2]:Ti,[-1]:Ti,32:Ti},YD={35:eD,42:ha,45:[Rl,ha],60:aD,61:Rl,95:ha,96:Pl,126:Pl},GD={38:af,92:rf},QD={[-5]:Si,[-4]:Si,[-3]:Si,33:xD,38:af,42:Ts,60:[k1,dD],91:ED,92:[J1,rf],93:ho,95:Ts,96:I1},JD={null:[Ts,$D]},XD={null:[42,95]},eC={null:[]},tC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:XD,contentInitial:KD,disable:eC,document:VD,flow:YD,flowInitial:ZD,insideSpan:JD,string:GD,text:QD},Symbol.toStringTag,{value:"Module"}));function nC(e){const n=c1([tC,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(b1),document:a(D1),flow:a(MD),string:a(LD),text:a(zD)};return r;function a(i){return s;function s(o){return WD(r,i,o)}}}function rC(e){for(;!sf(e););return e}const Ml=/[\0\t\n\r]/g;function aC(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,h,m,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(Ml.lastIndex=h,u=Ml.exec(i),m=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(m),!u){t=i.slice(h);break}if(p===10&&h===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<m&&(l.push(i.slice(h,m)),e+=m-h),p){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}h=m+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const iC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function sC(e){return e.replace(iC,oC)}function oC(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return tf(n.slice(i?2:1),i?16:10)}return co(n)||e}const ff={}.hasOwnProperty;function uC(e,t,n){return typeof t!="string"&&(n=t,t=void 0),lC(n)(rC(nC(n).document().write(aC()(e,t,!0))))}function lC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(We),autolinkProtocol:R,autolinkEmail:R,atxHeading:i(ge),blockQuote:i(ne),characterEscape:R,characterReference:R,codeFenced:i(ie),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ie,s),codeText:i(fe,s),codeTextData:R,data:R,codeFlowValue:R,definition:i(Q),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(pe),hardBreakEscape:i(ke),hardBreakTrailing:i(ke),htmlFlow:i(xe,s),htmlFlowData:R,htmlText:i(xe,s),htmlTextData:R,image:i(_e),label:s,link:i(We),listItem:i(Ue),listItemValue:m,listOrdered:i(Le,h),listUnordered:i(Le),paragraph:i(Qe),reference:B,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(ge),strong:i(he),thematicBreak:i($e)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:te,autolinkProtocol:U,blockQuote:l(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:W,characterReferenceMarkerNumeric:W,characterReferenceValue:L,codeFenced:l(D),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:I,codeIndented:l(y),codeText:l(j),codeTextData:I,data:I,definition:l(),definitionDestinationString:_,definitionLabelString:w,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(x),hardBreakTrailing:l(x),htmlFlow:l(E),htmlFlowData:I,htmlText:l(O),htmlTextData:I,image:l(z),label:X,labelText:re,lineEnding:M,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:T,resourceDestinationString:v,resourceTitleString:H,resource:ee,setextHeading:l($),setextHeadingLineSequence:S,setextHeadingText:F,strong:l(),thematicBreak:l()}};hf(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(K){let se={type:"root",children:[]};const me={stack:[se],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:c,data:n},ve=[];let we=-1;for(;++we<K.length;)if(K[we][1].type==="listOrdered"||K[we][1].type==="listUnordered")if(K[we][0]==="enter")ve.push(we);else{const Ye=ve.pop();we=a(K,Ye,we)}for(we=-1;++we<K.length;){const Ye=t[K[we][0]];ff.call(Ye,K[we][1].type)&&Ye[K[we][1].type].call(Object.assign({sliceSerialize:K[we][2].sliceSerialize},me),K[we][1])}if(me.tokenStack.length>0){const Ye=me.tokenStack[me.tokenStack.length-1];(Ye[1]||Il).call(me,void 0,Ye[0])}for(se.position={start:Yt(K.length>0?K[0][1].start:{line:1,column:1,offset:0}),end:Yt(K.length>0?K[K.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<t.transforms.length;)se=t.transforms[we](se)||se;return se}function a(K,se,me){let ve=se-1,we=-1,Ye=!1,Ge,mt,It,Et;for(;++ve<=me;){const Xe=K[ve];switch(Xe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Xe[0]==="enter"?we++:we--,Et=void 0;break}case"lineEndingBlank":{Xe[0]==="enter"&&(Ge&&!Et&&!we&&!It&&(It=ve),Et=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Et=void 0}if(!we&&Xe[0]==="enter"&&Xe[1].type==="listItemPrefix"||we===-1&&Xe[0]==="exit"&&(Xe[1].type==="listUnordered"||Xe[1].type==="listOrdered")){if(Ge){let At=ve;for(mt=void 0;At--;){const pt=K[At];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;mt&&(K[mt][1].type="lineEndingBlank",Ye=!0),pt[1].type="lineEnding",mt=At}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}It&&(!mt||It<mt)&&(Ge._spread=!0),Ge.end=Object.assign({},mt?K[mt][1].start:Xe[1].end),K.splice(mt||ve,0,["exit",Ge,Xe[2]]),ve++,me++}if(Xe[1].type==="listItemPrefix"){const At={type:"listItem",_spread:!1,start:Object.assign({},Xe[1].start),end:void 0};Ge=At,K.splice(ve,0,["enter",At,Xe[2]]),ve++,me++,It=void 0,Et=!0}}}return K[se][1]._spread=Ye,me}function i(K,se){return me;function me(ve){o.call(this,K(ve),ve),se&&se.call(this,ve)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(K,se,me){this.stack[this.stack.length-1].children.push(K),this.stack.push(K),this.tokenStack.push([se,me]),K.position={start:Yt(se.start),end:void 0}}function l(K){return se;function se(me){K&&K.call(this,me),u.call(this,me)}}function u(K,se){const me=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==K.type&&(se?se.call(this,K,ve[0]):(ve[1]||Il).call(this,K,ve[0]));else throw new Error("Cannot close `"+K.type+"` ("+yr({start:K.start,end:K.end})+"): it’s not open");me.position.end=Yt(K.end)}function c(){return u1(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function m(K){if(this.data.expectingFirstListItemValue){const se=this.stack[this.stack.length-2];se.start=Number.parseInt(this.sliceSerialize(K),10),this.data.expectingFirstListItemValue=void 0}}function p(){const K=this.resume(),se=this.stack[this.stack.length-1];se.lang=K}function g(){const K=this.resume(),se=this.stack[this.stack.length-1];se.meta=K}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function D(){const K=this.resume(),se=this.stack[this.stack.length-1];se.value=K.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const K=this.resume(),se=this.stack[this.stack.length-1];se.value=K.replace(/(\r?\n|\r)$/g,"")}function w(K){const se=this.resume(),me=this.stack[this.stack.length-1];me.label=se,me.identifier=Hn(this.sliceSerialize(K)).toLowerCase()}function A(){const K=this.resume(),se=this.stack[this.stack.length-1];se.title=K}function _(){const K=this.resume(),se=this.stack[this.stack.length-1];se.url=K}function k(K){const se=this.stack[this.stack.length-1];if(!se.depth){const me=this.sliceSerialize(K).length;se.depth=me}}function F(){this.data.setextHeadingSlurpLineEnding=!0}function S(K){const se=this.stack[this.stack.length-1];se.depth=this.sliceSerialize(K).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function R(K){const me=this.stack[this.stack.length-1].children;let ve=me[me.length-1];(!ve||ve.type!=="text")&&(ve=Te(),ve.position={start:Yt(K.start),end:void 0},me.push(ve)),this.stack.push(ve)}function I(K){const se=this.stack.pop();se.value+=this.sliceSerialize(K),se.position.end=Yt(K.end)}function M(K){const se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const me=se.children[se.children.length-1];me.position.end=Yt(K.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(se.type)&&(R.call(this,K),I.call(this,K))}function x(){this.data.atHardBreak=!0}function E(){const K=this.resume(),se=this.stack[this.stack.length-1];se.value=K}function O(){const K=this.resume(),se=this.stack[this.stack.length-1];se.value=K}function j(){const K=this.resume(),se=this.stack[this.stack.length-1];se.value=K}function q(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=se,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function z(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=se,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function re(K){const se=this.sliceSerialize(K),me=this.stack[this.stack.length-2];me.label=sC(se),me.identifier=Hn(se).toLowerCase()}function X(){const K=this.stack[this.stack.length-1],se=this.resume(),me=this.stack[this.stack.length-1];if(this.data.inReference=!0,me.type==="link"){const ve=K.children;me.children=ve}else me.alt=se}function v(){const K=this.resume(),se=this.stack[this.stack.length-1];se.url=K}function H(){const K=this.resume(),se=this.stack[this.stack.length-1];se.title=K}function ee(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function T(K){const se=this.resume(),me=this.stack[this.stack.length-1];me.label=se,me.identifier=Hn(this.sliceSerialize(K)).toLowerCase(),this.data.referenceType="full"}function W(K){this.data.characterReferenceType=K.type}function L(K){const se=this.sliceSerialize(K),me=this.data.characterReferenceType;let ve;me?(ve=tf(se,me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=co(se);const we=this.stack.pop();we.value+=ve,we.position.end=Yt(K.end)}function U(K){I.call(this,K);const se=this.stack[this.stack.length-1];se.url=this.sliceSerialize(K)}function te(K){I.call(this,K);const se=this.stack[this.stack.length-1];se.url="mailto:"+this.sliceSerialize(K)}function ne(){return{type:"blockquote",children:[]}}function ie(){return{type:"code",lang:null,meta:null,value:""}}function fe(){return{type:"inlineCode",value:""}}function Q(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function ge(){return{type:"heading",depth:0,children:[]}}function ke(){return{type:"break"}}function xe(){return{type:"html",value:""}}function _e(){return{type:"image",title:null,url:"",alt:null}}function We(){return{type:"link",title:null,url:"",children:[]}}function Le(K){return{type:"list",ordered:K.type==="listOrdered",start:null,spread:K._spread,children:[]}}function Ue(K){return{type:"listItem",spread:K._spread,checked:null,children:[]}}function Qe(){return{type:"paragraph",children:[]}}function he(){return{type:"strong",children:[]}}function Te(){return{type:"text",value:""}}function $e(){return{type:"thematicBreak"}}}function Yt(e){return{line:e.line,column:e.column,offset:e.offset}}function hf(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?hf(e,r):cC(e,r)}}function cC(e,t){let n;for(n in t)if(ff.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 Il(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+yr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+yr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+yr({start:t.start,end:t.end})+") is still open")}function dC(e){const t=this;t.parser=n;function n(r){return uC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function mf(e,t){var l,u,c;const n={...zn,...t==null?void 0:t.nodeTypes,[Z.heading]:{...zn[Z.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[Z.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(h=>mf({...h,ordered:e.ordered||!1},t))),e.type){case st.heading:return{type:n[Z.heading][e.depth||1],children:s};case st.list:return{type:e.ordered?n[Z.ol]:n[Z.ul],children:s};case st.listItem:return{type:n[Z.li],children:s};case st.paragraph:return{type:n[Z.paragraph],children:s};case st.link:return{type:n[Z.link],[r]:e.url,children:s};case st.image:return{type:n[Z.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case st.blockquote:return{type:n[Z.blockquote],children:s};case st.code:return{type:n[Z.codeblock],language:e.lang,children:[{text:e.value}]};case st.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[Z.paragraph],children:[{text:((c=e.value)==null?void 0:c.replace(/<br>/g,""))||""}]}:{type:Z.paragraph,children:[{text:e.value||""}]};case st.emphasis:return{[n[Ot.emphasis]]:!0,...ji(s),...Qr(s)};case st.strong:return{[n[Ot.strong]]:!0,...ji(s),...Qr(s)};case st.delete:return{[n[Ot.delete]]:!0,...ji(s),...Qr(s)};case st.inlineCode:return{[n[Ot.code]]:!0,text:e.value,...Qr(s)};case st.thematicBreak:return{type:n[Z.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const ji=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Qr(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const fC=function(t){const n=r=>r.children.map(a=>mf(a,t));this.Compiler=n},hC=(e,t=n=>{})=>{r1().use(dC).use(fC).process(e).then(n=>{const r=pn(n.result),a=s=>{const o=s;[Z.li,Z.blockquote].includes(o.type)&&o.children.map((l,u)=>{const c=l;c.type===Z.paragraph&&o.children.splice(u,1,...c.children)}),"children"in s&&s.children&&s.children.forEach(l=>a(l))};r.forEach(a);const i=s=>{const o=s;if(o.type===Z.link){const l=o.children&&o.children[0];if(l&&"text"in l&&l.text.includes(Es)){const u=o,c=l.text.replace(Es,""),h="link"in u&&u.link?u.link:"";u.type=Z.mention,u.id=h,u.name=c,u.children=[{text:""}]}}"children"in s&&s.children&&s.children.forEach(l=>i(l))};r.forEach(i),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(c=>{const h=c.replace(/~~/g,""),m=o.text.indexOf(c),p=o.text.substring(0,m),g=o.text.substring(m+c.length),f=[{text:p},{text:h,[Z.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},mo=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},mC=e=>{const{selection:t}=e;return t?b.string(e,t):null},$l=e=>{let t="";for(const n of oe.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},Ll={"mod+b":Z.bold,"mod+i":Z.italic,"mod+shift+x":Z.strikethrough,"mod+k":Z.link,"mod+shift+7":Z.ol,"mod+shift+8":Z.ul,"mod+shift+9":Z.blockquote},pC=(e,t,n,r)=>{for(const a in Ll)if(lb(a,e)){e.stopPropagation(),e.preventDefault();const i=Ll[a];if(i===Z.link){n([{type:"showLinkEditor",value:!0}]);return}if(_C(i)){Cf(t,i,r);return}bf(t,i,r)}},pf=(e,t,n,r)=>{var c;const{selectedUser:a,possibleUsers:i}=t,s=i[a];if(!s)return;const o=s.userId||"",l=(c=s.user)==null?void 0:c.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const u={type:Z.mention,id:o,name:l,children:[{text:""}]};G.select(e,(t==null?void 0:t.position)||Qd),G.insertNodes(e,[u,{text:" "}]),G.move(e,{distance:1,unit:"offset"}),mo(r)},gC=async(e,t,n,r)=>{const{selection:a}=e;if(a&&V.isCollapsed(a)){const[i]=V.edges(a),s=b.before(e,i,{unit:"word"}),o=s&&b.before(e,s),l=o&&b.range(e,o,i),u=l&&b.string(e,l),c=u&&u.match(jc),h=b.after(e,i),m=b.range(e,i,h),g=b.string(e,m).match(/^(\s|$)/);if(c&&g){const f=c[1];let D=[];n&&(D=await n({name:f})),r([{type:"mentionPopover",value:{show:!0,selectedUser:0,possibleUsers:D,position:l}}]);return}}t&&r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])},On=e=>typeof e.text=="string",vC=[Z.hr,Z.image,Z.mention],zl="<br>";function gf(e,t={nodeTypes:zn}){const{nodeTypes:n=zn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...zn,...n,heading:{...zn[Z.heading],...n[Z.heading]}},l=[o[Z.ul],o[Z.ol]];let u=i;if(!On(e)&&s!==Z.mention&&(u=e.children.map(c=>{const h=On(c)?!1:l.includes(c.type||""),m=l.includes(e.type||"");let p=!1;return!On(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!On(g)&&g.type===o.link)),gf({...c,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||h||m||p)&&!c.break,listDepth:l.includes(c.type||"")?a+1:a,inBlockquote:s===o[Z.blockquote]||e.parentType===o[Z.blockquote]})}).join("")),!r&&(i===""||i===`
114
+ `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const VD={42:lt,43:lt,45:lt,48:lt,49:lt,50:lt,51:lt,52:lt,53:lt,54:lt,55:lt,56:lt,57:lt,62:nf},KD={91:Z1},ZD={[-2]:Ti,[-1]:Ti,32:Ti},YD={35:eD,42:ha,45:[Rl,ha],60:aD,61:Rl,95:ha,96:Pl,126:Pl},GD={38:af,92:rf},QD={[-5]:Si,[-4]:Si,[-3]:Si,33:xD,38:af,42:Ts,60:[k1,dD],91:ED,92:[J1,rf],93:ho,95:Ts,96:I1},JD={null:[Ts,$D]},XD={null:[42,95]},eC={null:[]},tC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:XD,contentInitial:KD,disable:eC,document:VD,flow:YD,flowInitial:ZD,insideSpan:JD,string:GD,text:QD},Symbol.toStringTag,{value:"Module"}));function nC(e){const n=c1([tC,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(b1),document:a(D1),flow:a(MD),string:a(LD),text:a(zD)};return r;function a(i){return s;function s(o){return WD(r,i,o)}}}function rC(e){for(;!sf(e););return e}const Ml=/[\0\t\n\r]/g;function aC(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,h,m,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(Ml.lastIndex=h,u=Ml.exec(i),m=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(m),!u){t=i.slice(h);break}if(p===10&&h===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<m&&(l.push(i.slice(h,m)),e+=m-h),p){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}h=m+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const iC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function sC(e){return e.replace(iC,oC)}function oC(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return tf(n.slice(i?2:1),i?16:10)}return co(n)||e}const ff={}.hasOwnProperty;function uC(e,t,n){return typeof t!="string"&&(n=t,t=void 0),lC(n)(rC(nC(n).document().write(aC()(e,t,!0))))}function lC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(We),autolinkProtocol:R,autolinkEmail:R,atxHeading:i(ge),blockQuote:i(ne),characterEscape:R,characterReference:R,codeFenced:i(ie),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ie,s),codeText:i(fe,s),codeTextData:R,data:R,codeFlowValue:R,definition:i(Q),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(pe),hardBreakEscape:i(ke),hardBreakTrailing:i(ke),htmlFlow:i(xe,s),htmlFlowData:R,htmlText:i(xe,s),htmlTextData:R,image:i(_e),label:s,link:i(We),listItem:i(Ue),listItemValue:m,listOrdered:i(Le,h),listUnordered:i(Le),paragraph:i(Qe),reference:B,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(ge),strong:i(he),thematicBreak:i($e)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:te,autolinkProtocol:U,blockQuote:l(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:W,characterReferenceMarkerNumeric:W,characterReferenceValue:L,codeFenced:l(y),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:I,codeIndented:l(D),codeText:l(j),codeTextData:I,data:I,definition:l(),definitionDestinationString:_,definitionLabelString:x,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(w),hardBreakTrailing:l(w),htmlFlow:l(E),htmlFlowData:I,htmlText:l(O),htmlTextData:I,image:l(z),label:X,labelText:re,lineEnding:M,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:T,resourceDestinationString:v,resourceTitleString:H,resource:ee,setextHeading:l($),setextHeadingLineSequence:S,setextHeadingText:F,strong:l(),thematicBreak:l()}};hf(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(K){let se={type:"root",children:[]};const me={stack:[se],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:c,data:n},ve=[];let we=-1;for(;++we<K.length;)if(K[we][1].type==="listOrdered"||K[we][1].type==="listUnordered")if(K[we][0]==="enter")ve.push(we);else{const Ye=ve.pop();we=a(K,Ye,we)}for(we=-1;++we<K.length;){const Ye=t[K[we][0]];ff.call(Ye,K[we][1].type)&&Ye[K[we][1].type].call(Object.assign({sliceSerialize:K[we][2].sliceSerialize},me),K[we][1])}if(me.tokenStack.length>0){const Ye=me.tokenStack[me.tokenStack.length-1];(Ye[1]||Il).call(me,void 0,Ye[0])}for(se.position={start:Yt(K.length>0?K[0][1].start:{line:1,column:1,offset:0}),end:Yt(K.length>0?K[K.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<t.transforms.length;)se=t.transforms[we](se)||se;return se}function a(K,se,me){let ve=se-1,we=-1,Ye=!1,Ge,mt,It,Et;for(;++ve<=me;){const Xe=K[ve];switch(Xe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Xe[0]==="enter"?we++:we--,Et=void 0;break}case"lineEndingBlank":{Xe[0]==="enter"&&(Ge&&!Et&&!we&&!It&&(It=ve),Et=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Et=void 0}if(!we&&Xe[0]==="enter"&&Xe[1].type==="listItemPrefix"||we===-1&&Xe[0]==="exit"&&(Xe[1].type==="listUnordered"||Xe[1].type==="listOrdered")){if(Ge){let At=ve;for(mt=void 0;At--;){const pt=K[At];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;mt&&(K[mt][1].type="lineEndingBlank",Ye=!0),pt[1].type="lineEnding",mt=At}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}It&&(!mt||It<mt)&&(Ge._spread=!0),Ge.end=Object.assign({},mt?K[mt][1].start:Xe[1].end),K.splice(mt||ve,0,["exit",Ge,Xe[2]]),ve++,me++}if(Xe[1].type==="listItemPrefix"){const At={type:"listItem",_spread:!1,start:Object.assign({},Xe[1].start),end:void 0};Ge=At,K.splice(ve,0,["enter",At,Xe[2]]),ve++,me++,It=void 0,Et=!0}}}return K[se][1]._spread=Ye,me}function i(K,se){return me;function me(ve){o.call(this,K(ve),ve),se&&se.call(this,ve)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(K,se,me){this.stack[this.stack.length-1].children.push(K),this.stack.push(K),this.tokenStack.push([se,me]),K.position={start:Yt(se.start),end:void 0}}function l(K){return se;function se(me){K&&K.call(this,me),u.call(this,me)}}function u(K,se){const me=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==K.type&&(se?se.call(this,K,ve[0]):(ve[1]||Il).call(this,K,ve[0]));else throw new Error("Cannot close `"+K.type+"` ("+yr({start:K.start,end:K.end})+"): it’s not open");me.position.end=Yt(K.end)}function c(){return u1(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function m(K){if(this.data.expectingFirstListItemValue){const se=this.stack[this.stack.length-2];se.start=Number.parseInt(this.sliceSerialize(K),10),this.data.expectingFirstListItemValue=void 0}}function p(){const K=this.resume(),se=this.stack[this.stack.length-1];se.lang=K}function g(){const K=this.resume(),se=this.stack[this.stack.length-1];se.meta=K}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const K=this.resume(),se=this.stack[this.stack.length-1];se.value=K.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function D(){const K=this.resume(),se=this.stack[this.stack.length-1];se.value=K.replace(/(\r?\n|\r)$/g,"")}function x(K){const se=this.resume(),me=this.stack[this.stack.length-1];me.label=se,me.identifier=Wn(this.sliceSerialize(K)).toLowerCase()}function A(){const K=this.resume(),se=this.stack[this.stack.length-1];se.title=K}function _(){const K=this.resume(),se=this.stack[this.stack.length-1];se.url=K}function k(K){const se=this.stack[this.stack.length-1];if(!se.depth){const me=this.sliceSerialize(K).length;se.depth=me}}function F(){this.data.setextHeadingSlurpLineEnding=!0}function S(K){const se=this.stack[this.stack.length-1];se.depth=this.sliceSerialize(K).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function R(K){const me=this.stack[this.stack.length-1].children;let ve=me[me.length-1];(!ve||ve.type!=="text")&&(ve=Te(),ve.position={start:Yt(K.start),end:void 0},me.push(ve)),this.stack.push(ve)}function I(K){const se=this.stack.pop();se.value+=this.sliceSerialize(K),se.position.end=Yt(K.end)}function M(K){const se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const me=se.children[se.children.length-1];me.position.end=Yt(K.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(se.type)&&(R.call(this,K),I.call(this,K))}function w(){this.data.atHardBreak=!0}function E(){const K=this.resume(),se=this.stack[this.stack.length-1];se.value=K}function O(){const K=this.resume(),se=this.stack[this.stack.length-1];se.value=K}function j(){const K=this.resume(),se=this.stack[this.stack.length-1];se.value=K}function q(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=se,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function z(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=se,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function re(K){const se=this.sliceSerialize(K),me=this.stack[this.stack.length-2];me.label=sC(se),me.identifier=Wn(se).toLowerCase()}function X(){const K=this.stack[this.stack.length-1],se=this.resume(),me=this.stack[this.stack.length-1];if(this.data.inReference=!0,me.type==="link"){const ve=K.children;me.children=ve}else me.alt=se}function v(){const K=this.resume(),se=this.stack[this.stack.length-1];se.url=K}function H(){const K=this.resume(),se=this.stack[this.stack.length-1];se.title=K}function ee(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function T(K){const se=this.resume(),me=this.stack[this.stack.length-1];me.label=se,me.identifier=Wn(this.sliceSerialize(K)).toLowerCase(),this.data.referenceType="full"}function W(K){this.data.characterReferenceType=K.type}function L(K){const se=this.sliceSerialize(K),me=this.data.characterReferenceType;let ve;me?(ve=tf(se,me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=co(se);const we=this.stack.pop();we.value+=ve,we.position.end=Yt(K.end)}function U(K){I.call(this,K);const se=this.stack[this.stack.length-1];se.url=this.sliceSerialize(K)}function te(K){I.call(this,K);const se=this.stack[this.stack.length-1];se.url="mailto:"+this.sliceSerialize(K)}function ne(){return{type:"blockquote",children:[]}}function ie(){return{type:"code",lang:null,meta:null,value:""}}function fe(){return{type:"inlineCode",value:""}}function Q(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function ge(){return{type:"heading",depth:0,children:[]}}function ke(){return{type:"break"}}function xe(){return{type:"html",value:""}}function _e(){return{type:"image",title:null,url:"",alt:null}}function We(){return{type:"link",title:null,url:"",children:[]}}function Le(K){return{type:"list",ordered:K.type==="listOrdered",start:null,spread:K._spread,children:[]}}function Ue(K){return{type:"listItem",spread:K._spread,checked:null,children:[]}}function Qe(){return{type:"paragraph",children:[]}}function he(){return{type:"strong",children:[]}}function Te(){return{type:"text",value:""}}function $e(){return{type:"thematicBreak"}}}function Yt(e){return{line:e.line,column:e.column,offset:e.offset}}function hf(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?hf(e,r):cC(e,r)}}function cC(e,t){let n;for(n in t)if(ff.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 Il(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+yr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+yr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+yr({start:t.start,end:t.end})+") is still open")}function dC(e){const t=this;t.parser=n;function n(r){return uC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function mf(e,t){var l,u,c;const n={...Ln,...t==null?void 0:t.nodeTypes,[Z.heading]:{...Ln[Z.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[Z.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(h=>mf({...h,ordered:e.ordered||!1},t))),e.type){case st.heading:return{type:n[Z.heading][e.depth||1],children:s};case st.list:return{type:e.ordered?n[Z.ol]:n[Z.ul],children:s};case st.listItem:return{type:n[Z.li],children:s};case st.paragraph:return{type:n[Z.paragraph],children:s};case st.link:return{type:n[Z.link],[r]:e.url,children:s};case st.image:return{type:n[Z.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case st.blockquote:return{type:n[Z.blockquote],children:s};case st.code:return{type:n[Z.codeblock],language:e.lang,children:[{text:e.value}]};case st.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[Z.paragraph],children:[{text:((c=e.value)==null?void 0:c.replace(/<br>/g,""))||""}]}:{type:Z.paragraph,children:[{text:e.value||""}]};case st.emphasis:return{[n[Ot.emphasis]]:!0,...ji(s),...Qr(s)};case st.strong:return{[n[Ot.strong]]:!0,...ji(s),...Qr(s)};case st.delete:return{[n[Ot.delete]]:!0,...ji(s),...Qr(s)};case st.inlineCode:return{[n[Ot.code]]:!0,text:e.value,...Qr(s)};case st.thematicBreak:return{type:n[Z.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const ji=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Qr(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const fC=function(t){const n=r=>r.children.map(a=>mf(a,t));this.Compiler=n},hC=(e,t=n=>{})=>{r1().use(dC).use(fC).process(e).then(n=>{const r=pn(n.result),a=s=>{const o=s;[Z.li,Z.blockquote].includes(o.type)&&o.children.map((l,u)=>{const c=l;c.type===Z.paragraph&&o.children.splice(u,1,...c.children)}),"children"in s&&s.children&&s.children.forEach(l=>a(l))};r.forEach(a);const i=s=>{const o=s;if(o.type===Z.link){const l=o.children&&o.children[0];if(l&&"text"in l&&l.text.includes(Es)){const u=o,c=l.text.replace(Es,""),h="link"in u&&u.link?u.link:"";u.type=Z.mention,u.id=h,u.name=c,u.children=[{text:""}]}}"children"in s&&s.children&&s.children.forEach(l=>i(l))};r.forEach(i),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(c=>{const h=c.replace(/~~/g,""),m=o.text.indexOf(c),p=o.text.substring(0,m),g=o.text.substring(m+c.length),f=[{text:p},{text:h,[Z.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},mo=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},mC=e=>{const{selection:t}=e;return t?b.string(e,t):null},$l=e=>{let t="";for(const n of oe.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},Ll={"mod+b":Z.bold,"mod+i":Z.italic,"mod+shift+x":Z.strikethrough,"mod+k":Z.link,"mod+shift+7":Z.ol,"mod+shift+8":Z.ul,"mod+shift+9":Z.blockquote},pC=(e,t,n,r)=>{for(const a in Ll)if(lb(a,e)){e.stopPropagation(),e.preventDefault();const i=Ll[a];if(i===Z.link){n([{type:"showLinkEditor",value:!0}]);return}if(_C(i)){Cf(t,i,r);return}bf(t,i,r)}},pf=(e,t,n,r)=>{var c;const{selectedUser:a,possibleUsers:i}=t,s=i[a];if(!s)return;const o=s.userId||"",l=(c=s.user)==null?void 0:c.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const u={type:Z.mention,id:o,name:l,children:[{text:""}]};G.select(e,(t==null?void 0:t.position)||Qd),G.insertNodes(e,[u,{text:" "}]),G.move(e,{distance:1,unit:"offset"}),mo(r)},gC=async(e,t,n,r)=>{const{selection:a}=e;if(a&&V.isCollapsed(a)){const[i]=V.edges(a),s=b.before(e,i,{unit:"word"}),o=s&&b.before(e,s),l=o&&b.range(e,o,i),u=l&&b.string(e,l),c=u&&u.match(jc),h=b.after(e,i),m=b.range(e,i,h),g=b.string(e,m).match(/^(\s|$)/);if(c&&g){const f=c[1];let y=[];n&&(y=await n({name:f})),r([{type:"mentionPopover",value:{show:!0,selectedUser:0,possibleUsers:y,position:l}}]);return}}t&&r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])},On=e=>typeof e.text=="string",vC=[Z.hr,Z.image,Z.mention],zl="<br>";function gf(e,t={nodeTypes:Ln}){const{nodeTypes:n=Ln,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Ln,...n,heading:{...Ln[Z.heading],...n[Z.heading]}},l=[o[Z.ul],o[Z.ol]];let u=i;if(!On(e)&&s!==Z.mention&&(u=e.children.map(c=>{const h=On(c)?!1:l.includes(c.type||""),m=l.includes(e.type||"");let p=!1;return!On(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!On(g)&&g.type===o.link)),gf({...c,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||h||m||p)&&!c.break,listDepth:l.includes(c.type||"")?a+1:a,inBlockquote:s===o[Z.blockquote]||e.parentType===o[Z.blockquote]})}).join("")),!r&&(i===""||i===`
115
115
  `)&&e.parentType===o[Z.paragraph]&&s!==o[Z.mention]&&(s=o[Z.paragraph],u=zl),!(u===""&&!vC.find(c=>o[c]===s)))switch(u!==zl&&On(e)&&(e[Z.strikethrough]&&e[Z.bold]&&e[Z.italic]?u=Pn(u,"~~***"):e[Z.bold]&&e[Z.italic]?u=Pn(u,"***"):(e[Z.bold]&&(u=Pn(u,"**")),e[Z.italic]&&(u=Pn(u,"_")),e[Z.strikethrough]&&(u=Pn(u,"~~")),e[Z.code]&&(u=Pn(u,"`")))),s){case o[Z.heading][1]:return`# ${u}
116
116
  `;case o[Z.heading][2]:return`## ${u}
117
117
  `;case o[Z.heading][3]:return`### ${u}
@@ -129,31 +129,31 @@ ${u}
129
129
  `:""}`;case o[Z.paragraph]:return`${u}
130
130
 
131
131
  `;case o[Z.hr]:return`---
132
- `;default:return u}}function Pn(e,t){const n=e.trim(),r=n,a=`${t}${r}${ql(t)}`;if(r.length===e.length)return a;const i=t+r+ql(t);return e.replace(n,i)}const ql=e=>e.split("").reverse().join(""),bC=e=>e.map(t=>gf(t)).join("").trim();const yC=()=>{const e=Bn(),{dispatch:t,mentionPopover:n,id:r}=C.useContext(Kt),{show:a,selectedUser:i,possibleUsers:s}=n,o=Jd(e,"mention-popover",`toolbar-${r}`);return!a||!s.length?null:d.jsx(Is,{children:d.jsx(Ic,{ref:o,className:"mention-popover",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),t([{type:"showMentionPopover",value:!1}]))},children:d.jsx("ul",{children:s.map(({userId:l,user:u},c)=>d.jsx(nr,{element:"li",className:Y({selected:c===i}),member:{id:l,...u,link:!1},functions:{onClick:h=>{h.preventDefault(),h.stopPropagation();const m={...n,selectedUser:c};t([{type:"mentionPopover",value:m}]),pf(e,m,t,r)}}},l))})})})},po=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=ue.useIntl(),l=Bn(),{id:u,tabbableOption:c,setFocus:h,openTooltip:m,dispatch:p}=C.useContext(Kt),g={};return e!==c&&(g.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:Y(e,{"has-divider":n}),onMouseEnter:()=>{p([{type:"openTooltip",value:e}])},onMouseLeave:()=>{p([{type:"openTooltip",value:null}])},onFocus:()=>{p([{type:"openTooltip",value:e}])},onBlur:f=>{f.stopPropagation();const D=[{type:"openTooltip",value:null}];l.selection&&D.push({type:"lastAnchor",value:l.selection.anchor}),p(D)},contentEditable:!1,children:[d.jsxs("button",{...s,...g,className:Y(e,a,{active:t}),onClick:f=>{f.stopPropagation(),f.preventDefault()},onMouseDown:f=>{f.stopPropagation(),f.preventDefault(),r()},onKeyDown:f=>{var D,y,w,A;if(f.key!=="Tab")switch(f.key){case"Enter":f.stopPropagation(),f.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":f.stopPropagation(),f.preventDefault();const _=f.currentTarget.closest("li");let k=_==null?void 0:_.nextElementSibling;if(f.key==="ArrowLeft"){const $=_==null?void 0:_.previousElementSibling;$?k=$:k=(D=_==null?void 0:_.parentElement)==null?void 0:D.lastElementChild}else k||(k=(y=_==null?void 0:_.parentElement)==null?void 0:y.firstElementChild);const F=k==null?void 0:k.className.split(" ")[0];F&&(h(F),(w=k==null?void 0:k.querySelector("button"))==null||w.focus());break;default:const S=f.currentTarget.closest("fieldset");if(S){(A=S==null?void 0:S.previousElementSibling)==null||A.focus();break}}},children:[d.jsx(Me,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(En,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:m===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Wl=[Z.ol,Z.ul],vf=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(b.nodes(e,{at:b.unhangRange(e,n),match:a=>{const i=a;return!b.isEditor(a)&&ce.isElement(a)&&i.type===t}}));return!!r},DC=e=>{const[t]=b.nodes(e,{match:n=>n.type===Z.blockquote});return!!t},bf=(e,t,n)=>{try{const r=DC(e),a=vf(e,t),i=Wl.includes(t);G.unwrapNodes(e,{match:l=>{const u=l;return!b.isEditor(u)&&ce.isElement(u)&&Wl.includes(u.type)},split:!0});const o={type:a?Z.paragraph:i?Z.li:t};if(G.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,c]=b.parent(e,l,{edge:"end"});Array.from(b.nodes(e,{at:c,match:m=>{const p=m;return!b.isEditor(m)&&ce.isElement(m)&&p.type===Z.li}})).forEach(([m,p])=>{oe.string(m).trim()===""&&G.removeNodes(e,{at:p})})}else{if(r){const u={type:Z.blockquote,children:[]};G.wrapNodes(e,u)}const l={type:t,children:[]};G.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},CC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(Kt),a=Bn(),i=vf(a,e);return d.jsx(po,{id:e,active:i,hasDivider:t,callback:()=>{bf(a,e,r),n(i?null:e)}})},Cr=e=>{const[t]=b.nodes(e,{match:n=>{const r=n;return!b.isEditor(n)&&ce.isElement(n)&&r.type===Z.link}});return!!t},xC=(e,t,n,r)=>{e.selection&&go(e,t,n,r)},wC=(e,t,n,r)=>{const{selection:a}=e;if(a&&V.isCollapsed(a)){const[s]=b.nodes(e,{match:o=>{const l=o;return!b.isEditor(o)&&ce.isElement(o)&&l.type===Z.link}});if(s){const[o,l]=s,u={link:t};G.setNodes(e,u,{at:l}),mo(n)}}else go(e,t,n,r)},go=(e,t,n,r=a=>{console.error(a)})=>{try{Cr(e)&&yf(e);const{selection:a}=e,i=a&&V.isCollapsed(a),s={type:Z.link,link:t,children:i?[{text:t}]:[]};i?(G.insertNodes(e,s),G.move(e,{distance:1,unit:"offset"})):(G.wrapNodes(e,s,{split:!0}),G.collapse(e,{edge:"end"}),G.insertNodes(e,{text:""}),G.move(e,{distance:1,unit:"offset"})),mo(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},yf=e=>{G.unwrapNodes(e,{match:t=>{const n=t;return!b.isEditor(t)&&ce.isElement(t)&&n.type===Z.link}})};let Oi=null;const EC=()=>{const e=ue.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,dispatch:a,reportError:i}=C.useContext(Kt),s=Bn(),o=$y(s),l=(o==null?void 0:o.text)||mC(s),[u,c]=C.useState(Cr(s)),h=Jd(s,"link-editor",`${n}-link`),m=C.useRef(null);C.useEffect(()=>{var D;!u&&r&&((D=m.current)==null||D.focus())},[u]),C.useEffect(()=>{Oi&&clearTimeout(Oi),Oi=setTimeout(()=>{c(Cr(s))},500)},[s.selection]);const p=[],g=["open","edit","remove"].map(D=>{const y={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${D}`},{link:o==null?void 0:o.pretty})};switch(p.push({className:D}),D){case"open":y.href=(o==null?void 0:o.full)||"",y.onClick=w=>{w.preventDefault(),w.stopPropagation(),window.open((o==null?void 0:o.full)||"","_blank"),a([{type:"showLinkEditor",value:!1}])},y.children=d.jsxs(d.Fragment,{children:[y.children,d.jsx(Me,{children:e.formatMessage({id:`${t}${D}_text`})})]});break;case"edit":y.onClick=()=>{c(!1)};break;case"remove":y.onClick=()=>{const w=[{type:"showLinkEditor",value:!1}];Cr(s)&&(yf(s),w.push({type:"lastAnchor",value:null})),a(w)};break}return y}),f=[{id:"url",type:"url",inputRef:m,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(o==null?void 0:o.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];return l&&f.unshift({component:()=>d.jsxs("p",{children:[d.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",l]})}),d.jsx(Is,{children:d.jsx(En,{ref:h,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!u},functions:{onBlur:()=>{a([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var D;return(D=m.current)==null?void 0:D.focus()})}},children:u?d.jsx(kn,{wrappers:p,buttons:g}):d.jsx(rr,{element:"fieldset",id:`${n}-link-editor`,className:Y({"show-labels":l}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async D=>{setTimeout(()=>{const y=[{type:"showLinkEditor",value:!1}];if(D.url){const{full:w}=Mc(D.url);o!=null&&o.full?wC(s,w,n,i):xC(s,w,n,i),y.push({type:"lastAnchor",value:null})}a(y)})}},fields:f,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},kC=()=>{const e=Bn(),{setFocus:t,dispatch:n}=C.useContext(Kt),[r,a]=C.useState(!1);return C.useEffect(()=>{a(Cr(e))},[e.selection]),d.jsx(po,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},_C=e=>[Z.bold,Z.italic,Z.strikethrough].includes(e),Df=(e,t)=>{const n=b.marks(e);return n?n[t]===!0:!1},Cf=(e,t,n)=>{try{Df(e,t)?b.removeMark(e,t):b.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},BC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(Kt),a=Bn(),i=Df(a,e);return d.jsx(po,{id:e,active:i,hasDivider:t,callback:()=>{Cf(a,e,r),n(i?null:e)}})},_a=[Z.bold,Z.italic,Z.strikethrough],AC=[Z.ol,Z.ul,Z.blockquote];const FC=({...e})=>{const t=ue.useIntl(),{id:n}=C.useContext(Kt);return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[d.jsx(Me,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[_a.map((r,a)=>d.jsx(BC,{format:r,hasDivider:a===_a.length-1},r)),d.jsx(kC,{}),AC.map((r,a)=>d.jsx(CC,{format:r,hasDivider:a===1},r))]})]}),d.jsx(EC,{})]})};var TC=PC,SC=/^(?:\w+:)?\/\/(\S+)$/,jC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,OC=/^[^\s\.]+\.\S{2,}$/;function PC(e){if(typeof e!="string")return!1;var t=e.match(SC);if(!t)return!1;var n=t[1];return n?!!(jC.test(n)||OC.test(n)):!1}const NC=wn(TC),RC=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[Z.link].includes(s.type)||a(i)},e.insertText=i=>{i&&NC(i)?go(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},MC=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===Z.mention?!0:n(i),e.isVoid=i=>i.type===Z.mention?!0:r(i),e.markableVoid=i=>i.type===Z.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},IC=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===Z.link&&oe.string(r).trim()===""){G.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const xf=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,functions:a,autoFocus:i=!0,data:s,...o})=>{const l=ue.useIntl(),u=Ph(),{listMembers:c,onChange:h=()=>{},reportError:m=j=>{console.error(j)}}=a||{},p=[{type:Z.paragraph,children:[{text:""}]}],g={originalValue:t||"",initialValue:t?null:p,tabbableOption:_a[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[f,D]=C.useReducer(Or,g),{originalValue:y,initialValue:w,stringValue:A,lastAnchor:_,lastKey:k,hasInteracted:F,hasLoaded:S,mentionPopover:$}=f,R=j=>{const q=j||_a[0];j&&D([{type:"tabbableOption",value:q}])},I=`rte-${e}`,M=C.useCallback(j=>d.jsx(My,{...j}),[]),x=C.useCallback(j=>d.jsx(Iy,{...j}),[]),E=C.useMemo(()=>RC(MC(IC(Ev(Ny(xv())),m),m),I,m),[]);C.useEffect(()=>{t&&(async()=>{let q=pn(t);q.includes("<")&&(q=new ya().turndown(q)),s&&s.mentions&&(q=await Rc({text:q,template:`[${Es}{{name}}]({{id}})`,mentions:s.mentions,listMembers:c||(()=>Promise.resolve([]))})),hC(q,z=>{D([{type:"initialValue",value:z}]),setTimeout(()=>{D([{type:"stringValue",value:$l(E)}])},150)})})()},[]),C.useEffect(()=>{if(E.children.length>0&&!S){if(D([{type:"hasLoaded",value:!0}]),!i)return;const j=b.end(E,[]);G.select(E,j),J.focus(E)}},[E.children.length]),C.useEffect(()=>{t!==""||!E||bc(y,t)&&!F||(b.withoutNormalizing(E,()=>{G.delete(E,{at:{anchor:b.start(E,[]),focus:b.end(E,[])}}),G.deselect(E),E.children.length!==0&&G.unwrapNodes(E,{at:[0]}),G.insertNodes(E,p,{at:[0]})}),D([{type:"initialValue",value:p},{type:"lastAnchor",value:null}]))},[t]);const O=wc(()=>{gC(E,$.show,c,D)},100);return w?d.jsx("div",{id:I,className:"rich-text-editor",children:d.jsxs(Kt.Provider,{value:{...f,id:I,setFocus:R,dispatch:D,reportError:m},children:[d.jsxs(Oy,{editor:E,initialValue:w,onChange:j=>{if(E.operations.some(z=>z.type!=="set_selection")){const z=bC(j);h(z),D([{type:"stringValue",value:$l(E)}]),F||D([{type:"hasInteracted",value:!0}]),O(),u&&console.log({serialized:z,json:j})}},...o,children:[d.jsx(Ey,{className:"input",renderElement:M,renderLeaf:x,placeholder:n||l.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:i,tabIndex:0,onKeyDown:j=>{if(j.key==="Enter"){$.show&&(j.preventDefault(),j.stopPropagation(),pf(E,$,D,I));const{selection:q}=E;if(q){const z=V.isCollapsed(q),[re,X]=b.node(E,q,{depth:1});let v=re,H=v.type;const ee=v.children[0];if(ee&&[Z.ol,Z.ul].includes(ee.type)&&(v=ee,H=ee.type),v&&ce.isElement(v)&&H!==Z.paragraph){if(H===Z.blockquote&&!j.shiftKey){j.stopPropagation(),j.preventDefault(),G.insertNodes(E,p);return}if(z){const[B]=b.parent(E,q,{edge:"end"}),W=B.type;if(k==="Enter"&&W===Z.li&&[Z.ul,Z.ol].includes(H)){j.stopPropagation(),j.preventDefault(),G.insertNodes(E,p,{at:N.next(X)}),G.select(E,b.end(E,N.next(X)));return}}}}}else if(j.key==="Escape"){if($.show){j.preventDefault(),j.stopPropagation(),D([{type:"mentionPopover",value:{...$,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(j.key)&&$.show){j.preventDefault(),j.stopPropagation();const{selectedUser:q,possibleUsers:z}=$;let re=j.key==="ArrowUp"?q-1:q+1;re<0&&(re=z.length-1),re>=z.length&&(re=0),D([{type:"mentionPopover",value:{...$,selectedUser:re}}])}D([{type:"lastKey",value:j.key}]),pC(j,E,D,m)},onBlur:()=>{E.selection&&D([{type:"lastAnchor",value:E.selection.anchor}])},onFocus:()=>{if(_){if(!N.isPath(_.path)||!oe.has(E,_.path))return;const j=oe.get(E,_.path);let q=0;if(de.isText(j)?q=j.text.length:j.children&&(q=j.children.length),_.offset>q)return;try{G.select(E,{anchor:_,focus:_})}catch(z){const re=z.message;m(`Error focusing editor: ${re}`)}}}}),d.jsx(FC,{}),c?d.jsx(yC,{}):null]}),d.jsx(Ws,{limit:r,valueLength:qa(A)})]})}):null};const $C=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=C.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);C.useEffect(()=>{r&&l(r)},[r]);const u=c=>{i||(l(c),a(c))};return d.jsxs("div",{className:Y("toggle",s),onClick:c=>{c.preventDefault(),c.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[d.jsx("p",{children:t}),d.jsx("ul",{className:Y("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(c=>{const h=`${e}-${c.value}`;return d.jsxs("li",{className:"hidden",children:[d.jsx("input",{type:"radio",id:h,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:i}),d.jsx("label",{htmlFor:h,children:c.label})]},h)})})]})};function LC({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=C.useState(!1),[l,u]=C.useState(!1),c=C.useRef(null),h=async m=>{o(!0),u(!1);try{const p=m.target.files&&m.target.files[0];if(!p||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:p,userId:t});a(f=>({...f,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return d.jsxs("div",{className:Y("profile-image-change-figure",e),children:[d.jsx(sn,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&d.jsx("p",{className:"error text-small",children:d.jsx(ue.FormattedMessage,{id:"profile_image_change_error"})}),d.jsx("input",{id:"file",type:"file",accept:"image/*",ref:c,onChange:h,hidden:!0,"data-testid":"file-input"}),d.jsx(Be,{onClick:()=>c.current&&c.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:s,children:d.jsx(ue.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const wf=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(rr,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const Ef=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[c,h]=C.useState([]),[m,p]=C.useState(!0),[g,f]=C.useState(u),{formatMessage:D}=ue.useIntl(),y=async _=>{_.preventDefault();try{await l(c),h([]),f("SUCCESS")}catch(k){f("ERROR"),o(k)}},w=_=>{_.preventDefault(),f("NOT_SUBMITTED"),p(!0),h([])},A=_=>{_.preventDefault(),s(),f("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?d.jsxs("div",{className:"invite-form-wrapper",children:[d.jsx("div",{className:"content centred",children:g==="SUCCESS"?d.jsx("h2",{className:"success-title",children:D({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",D({id:"inviteForm_error"})]})}),d.jsx(tn,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(Be,{variant:"secondary",onClick:w,children:D({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(Be,{onClick:A,children:D({id:"inviteForm_ctaDone"})})]}):d.jsx(Be,{onClick:w,children:D({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:y,className:Y("invite-form gtm-trackable"),children:[d.jsxs("fieldset",{className:"content",children:[d.jsx("h2",{className:"title",style:{color:r},children:e}),d.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),d.jsx(Ch.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:D({id:"inviteForm_email_placeholder"}),emails:c,onChange:_=>{h(_),p(!_.length)},autoFocus:!1,getLabel:(_,k,F)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:_}),d.jsx(Be,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{F(k),p(!c.length)},className:"remove-email-button",screenreaderText:D({id:"overlay_close"})})]},k)})]}),d.jsx(tn,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(Be,{className:"sendEmailsButton",disabled:m,children:n})})]})})},ma=e=>e.map(t=>({condition:t})),yt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},zC=({functions:e,...t})=>{const{formatMessage:n}=ue.useIntl(),[r,a]=C.useState(null),[i,s]=C.useState(!1),[o,l]=C.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[yt.NEW_PASSWORD]!==p[yt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=p=>!is(p[yt.NEW_PASSWORD]).isValid,h=[{"data-testid":yt.NEW_PASSWORD,id:yt.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ma(["required",c]),functions:{onChange:p=>l(is(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":yt.CONFIRMED_PASSWORD,id:yt.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ma(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":yt.CURRENT_PASSWORD,id:yt.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ma(["required"])}),i&&h.push({component:Jc,props:{matchingRules:o}});const m={id:yt.FORM_ID,fields:h,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>a(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(yt.NEW_PASSWORD)||g.includes(yt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(rr,{...m}),r&&d.jsx(an,{variant:"error",text:r})]})};const kf=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=ue.useIntl(),u=C.useRef(null);Vn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=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 d.jsx("form",{onSubmit:c,className:Y("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:d.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:d.jsxs("p",{children:[d.jsx(Me,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),d.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:h=>{h.key==="Enter"&&c(h)}}),d.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:d.jsx(Me,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Me,{children:l.formatMessage({id:"search_cta"})})})]})})})},Hl=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let c="";return o?c=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?c=u.auth?"verify":"pending":c="exists":u.auth&&(c="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:c,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},qC=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"]}},WC=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:a,state:i})=>{if(!e.form||!e.form.current)throw new Error("No refs.form");if(!e.form.current.checkValidity()){e.hiddenValidation&&e.hiddenValidation.current&&e.hiddenValidation.current.click();return}const s=qC(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...i.values}),a([{type:"showSuccessMessage",value:!0}])},HC=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,h=(p,g)=>{p.current&&s.validFields[g]!==p.current.validity.valid&&o([{type:`validFields.${g}`,value:p.current.validity.valid}])},m=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>h(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{Hl({ref:i.email,validateEmail:r,dispatch:o})},onChange:(p,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Kc,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(m.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>h(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{h(i.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),e.url&&m.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>d.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&m.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>d.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"}),m.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>d.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=>d.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Hl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),m};const UC=({className:e=""})=>d.jsxs("div",{className:Y("success-message",e),"data-testid":"success-message",children:[d.jsx("p",{className:"success-title",children:d.jsx(ue.FormattedMessage,{id:"signup_success_title"})}),d.jsx(ue.FormattedMessage,{id:"signup_success_text",values:{p:t=>d.jsx("p",{children:t})}})]});const VC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},KC=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ue.useIntl(),{title:u=!0,expectation:c=!1,url:h=!0,logInButton:m=!0,successMessage:p=!0}=a,g={title:u,expectation:c,url:h,logInButton:m,successMessage:p},[f,D]=C.useReducer(Or,VC),{validFields:y,emailDetails:w,shouldManuallyApprove:A,shouldDisableButton:_,showSuccessMessage:k,showError:F}=f,[S,$]=Ps.useCookies(["signup-this-session","functional-cookie-consent"]),R={form:C.createRef(),name:C.createRef(),email:C.createRef(),jobTitle:C.createRef(),organisation:C.createRef(),tc:C.createRef(),hiddenValidation:C.createRef()};C.useEffect(()=>{A===!0&&R.jobTitle.current&&R.jobTitle.current.focus()},[A]),C.useEffect(()=>{S["signup-this-session"]&&D([{type:"showSuccessMessage",value:!0}])},[S]),C.useEffect(()=>{k&&S["functional-cookie-consent"]&&$("signup-this-session","true",{path:"/",maxAge:3600})},[k]);const I=C.useMemo(()=>HC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:R,state:f,dispatch:D,dataToSubmit:s,intl:l}),[s,r,l,R,g,f]),M=_?!0:A?!Object.values(y).every(x=>x===!0):!y.name||!y.email||["exists","pending","verify"].includes(w.boxType);return g.successMessage&&k?d.jsx(UC,{className:e}):d.jsxs("fieldset",{className:Y("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&d.jsx("p",{className:"signup-title",children:d.jsx(ue.FormattedMessage,{id:"signup_title"})}),F&&d.jsx(an,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(rr,{className:"signup-form",formRef:R.form,id:"sign-up-form",fields:I,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:M?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await WC({refs:R,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:D,state:f})},onCatch:x=>{r.handleError(x),D([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:R.hiddenValidation})]})};var Ss={exports:{}},Jr={exports:{}},Oe={};/** @license React v16.13.1
132
+ `;default:return u}}function Pn(e,t){const n=e.trim(),r=n,a=`${t}${r}${ql(t)}`;if(r.length===e.length)return a;const i=t+r+ql(t);return e.replace(n,i)}const ql=e=>e.split("").reverse().join(""),bC=e=>e.map(t=>gf(t)).join("").trim();const yC=()=>{const e=Bn(),{dispatch:t,mentionPopover:n,id:r}=C.useContext(Kt),{show:a,selectedUser:i,possibleUsers:s}=n,o=Jd(e,"mention-popover",`toolbar-${r}`);return!a||!s.length?null:d.jsx(Is,{children:d.jsx(Ic,{ref:o,className:"mention-popover",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),t([{type:"showMentionPopover",value:!1}]))},children:d.jsx("ul",{children:s.map(({userId:l,user:u},c)=>d.jsx(tr,{element:"li",className:Y({selected:c===i}),member:{id:l,...u,link:!1},functions:{onClick:h=>{h.preventDefault(),h.stopPropagation();const m={...n,selectedUser:c};t([{type:"mentionPopover",value:m}]),pf(e,m,t,r)}}},l))})})})},po=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=ue.useIntl(),l=Bn(),{id:u,tabbableOption:c,setFocus:h,openTooltip:m,dispatch:p}=C.useContext(Kt),g={};return e!==c&&(g.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:Y(e,{"has-divider":n}),onMouseEnter:()=>{p([{type:"openTooltip",value:e}])},onMouseLeave:()=>{p([{type:"openTooltip",value:null}])},onFocus:()=>{p([{type:"openTooltip",value:e}])},onBlur:f=>{f.stopPropagation();const y=[{type:"openTooltip",value:null}];l.selection&&y.push({type:"lastAnchor",value:l.selection.anchor}),p(y)},contentEditable:!1,children:[d.jsxs("button",{...s,...g,className:Y(e,a,{active:t}),onClick:f=>{f.stopPropagation(),f.preventDefault()},onMouseDown:f=>{f.stopPropagation(),f.preventDefault(),r()},onKeyDown:f=>{var y,D,x,A;if(f.key!=="Tab")switch(f.key){case"Enter":f.stopPropagation(),f.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":f.stopPropagation(),f.preventDefault();const _=f.currentTarget.closest("li");let k=_==null?void 0:_.nextElementSibling;if(f.key==="ArrowLeft"){const $=_==null?void 0:_.previousElementSibling;$?k=$:k=(y=_==null?void 0:_.parentElement)==null?void 0:y.lastElementChild}else k||(k=(D=_==null?void 0:_.parentElement)==null?void 0:D.firstElementChild);const F=k==null?void 0:k.className.split(" ")[0];F&&(h(F),(x=k==null?void 0:k.querySelector("button"))==null||x.focus());break;default:const S=f.currentTarget.closest("fieldset");if(S){(A=S==null?void 0:S.previousElementSibling)==null||A.focus();break}}},children:[d.jsx(Me,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(En,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:m===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Wl=[Z.ol,Z.ul],vf=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(b.nodes(e,{at:b.unhangRange(e,n),match:a=>{const i=a;return!b.isEditor(a)&&ce.isElement(a)&&i.type===t}}));return!!r},DC=e=>{const[t]=b.nodes(e,{match:n=>n.type===Z.blockquote});return!!t},bf=(e,t,n)=>{try{const r=DC(e),a=vf(e,t),i=Wl.includes(t);G.unwrapNodes(e,{match:l=>{const u=l;return!b.isEditor(u)&&ce.isElement(u)&&Wl.includes(u.type)},split:!0});const o={type:a?Z.paragraph:i?Z.li:t};if(G.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,c]=b.parent(e,l,{edge:"end"});Array.from(b.nodes(e,{at:c,match:m=>{const p=m;return!b.isEditor(m)&&ce.isElement(m)&&p.type===Z.li}})).forEach(([m,p])=>{oe.string(m).trim()===""&&G.removeNodes(e,{at:p})})}else{if(r){const u={type:Z.blockquote,children:[]};G.wrapNodes(e,u)}const l={type:t,children:[]};G.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},CC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(Kt),a=Bn(),i=vf(a,e);return d.jsx(po,{id:e,active:i,hasDivider:t,callback:()=>{bf(a,e,r),n(i?null:e)}})},Cr=e=>{const[t]=b.nodes(e,{match:n=>{const r=n;return!b.isEditor(n)&&ce.isElement(n)&&r.type===Z.link}});return!!t},xC=(e,t,n,r)=>{e.selection&&go(e,t,n,r)},wC=(e,t,n,r)=>{const{selection:a}=e;if(a&&V.isCollapsed(a)){const[s]=b.nodes(e,{match:o=>{const l=o;return!b.isEditor(o)&&ce.isElement(o)&&l.type===Z.link}});if(s){const[o,l]=s,u={link:t};G.setNodes(e,u,{at:l}),mo(n)}}else go(e,t,n,r)},go=(e,t,n,r=a=>{console.error(a)})=>{try{Cr(e)&&yf(e);const{selection:a}=e,i=a&&V.isCollapsed(a),s={type:Z.link,link:t,children:i?[{text:t}]:[]};i?(G.insertNodes(e,s),G.move(e,{distance:1,unit:"offset"})):(G.wrapNodes(e,s,{split:!0}),G.collapse(e,{edge:"end"}),G.insertNodes(e,{text:""}),G.move(e,{distance:1,unit:"offset"})),mo(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},yf=e=>{G.unwrapNodes(e,{match:t=>{const n=t;return!b.isEditor(t)&&ce.isElement(t)&&n.type===Z.link}})};let Oi=null;const EC=()=>{const e=ue.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,dispatch:a,reportError:i}=C.useContext(Kt),s=Bn(),o=$y(s),l=(o==null?void 0:o.text)||mC(s),[u,c]=C.useState(Cr(s)),h=Jd(s,"link-editor",`${n}-link`),m=C.useRef(null);C.useEffect(()=>{var y;!u&&r&&((y=m.current)==null||y.focus())},[u]),C.useEffect(()=>{Oi&&clearTimeout(Oi),Oi=setTimeout(()=>{c(Cr(s))},500)},[s.selection]);const p=[],g=["open","edit","remove"].map(y=>{const D={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${y}`},{link:o==null?void 0:o.pretty})};switch(p.push({className:y}),y){case"open":D.href=(o==null?void 0:o.full)||"",D.onClick=x=>{x.preventDefault(),x.stopPropagation(),window.open((o==null?void 0:o.full)||"","_blank"),a([{type:"showLinkEditor",value:!1}])},D.children=d.jsxs(d.Fragment,{children:[D.children,d.jsx(Me,{children:e.formatMessage({id:`${t}${y}_text`})})]});break;case"edit":D.onClick=()=>{c(!1)};break;case"remove":D.onClick=()=>{const x=[{type:"showLinkEditor",value:!1}];Cr(s)&&(yf(s),x.push({type:"lastAnchor",value:null})),a(x)};break}return D}),f=[{id:"url",type:"url",inputRef:m,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(o==null?void 0:o.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];return l&&f.unshift({component:()=>d.jsxs("p",{children:[d.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",l]})}),d.jsx(Is,{children:d.jsx(En,{ref:h,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!u},functions:{onBlur:()=>{a([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var y;return(y=m.current)==null?void 0:y.focus()})}},children:u?d.jsx(kn,{wrappers:p,buttons:g}):d.jsx(nr,{element:"fieldset",id:`${n}-link-editor`,className:Y({"show-labels":l}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async y=>{setTimeout(()=>{const D=[{type:"showLinkEditor",value:!1}];if(y.url){const{full:x}=Mc(y.url);o!=null&&o.full?wC(s,x,n,i):xC(s,x,n,i),D.push({type:"lastAnchor",value:null})}a(D)})}},fields:f,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},kC=()=>{const e=Bn(),{setFocus:t,dispatch:n}=C.useContext(Kt),[r,a]=C.useState(!1);return C.useEffect(()=>{a(Cr(e))},[e.selection]),d.jsx(po,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},_C=e=>[Z.bold,Z.italic,Z.strikethrough].includes(e),Df=(e,t)=>{const n=b.marks(e);return n?n[t]===!0:!1},Cf=(e,t,n)=>{try{Df(e,t)?b.removeMark(e,t):b.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},BC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(Kt),a=Bn(),i=Df(a,e);return d.jsx(po,{id:e,active:i,hasDivider:t,callback:()=>{Cf(a,e,r),n(i?null:e)}})},_a=[Z.bold,Z.italic,Z.strikethrough],AC=[Z.ol,Z.ul,Z.blockquote];const FC=({...e})=>{const t=ue.useIntl(),{id:n}=C.useContext(Kt);return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[d.jsx(Me,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[_a.map((r,a)=>d.jsx(BC,{format:r,hasDivider:a===_a.length-1},r)),d.jsx(kC,{}),AC.map((r,a)=>d.jsx(CC,{format:r,hasDivider:a===1},r))]})]}),d.jsx(EC,{})]})};var TC=PC,SC=/^(?:\w+:)?\/\/(\S+)$/,jC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,OC=/^[^\s\.]+\.\S{2,}$/;function PC(e){if(typeof e!="string")return!1;var t=e.match(SC);if(!t)return!1;var n=t[1];return n?!!(jC.test(n)||OC.test(n)):!1}const NC=wn(TC),RC=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[Z.link].includes(s.type)||a(i)},e.insertText=i=>{i&&NC(i)?go(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},MC=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===Z.mention?!0:n(i),e.isVoid=i=>i.type===Z.mention?!0:r(i),e.markableVoid=i=>i.type===Z.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},IC=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===Z.link&&oe.string(r).trim()===""){G.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const xf=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,functions:a,autoFocus:i=!0,data:s,...o})=>{const l=ue.useIntl(),u=Ph(),{listMembers:c,onChange:h=()=>{},reportError:m=j=>{console.error(j)}}=a||{},p=[{type:Z.paragraph,children:[{text:""}]}],g={originalValue:t||"",initialValue:t?null:p,tabbableOption:_a[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[f,y]=C.useReducer(Or,g),{originalValue:D,initialValue:x,stringValue:A,lastAnchor:_,lastKey:k,hasInteracted:F,hasLoaded:S,mentionPopover:$}=f,R=j=>{const q=j||_a[0];j&&y([{type:"tabbableOption",value:q}])},I=`rte-${e}`,M=C.useCallback(j=>d.jsx(My,{...j}),[]),w=C.useCallback(j=>d.jsx(Iy,{...j}),[]),E=C.useMemo(()=>RC(MC(IC(Ev(Ny(xv())),m),m),I,m),[]);C.useEffect(()=>{t&&(async()=>{let q=pn(t);q.includes("<")&&(q=new ya().turndown(q)),s&&s.mentions&&(q=await Rc({text:q,template:`[${Es}{{name}}]({{id}})`,mentions:s.mentions,listMembers:c||(()=>Promise.resolve([]))})),hC(q,z=>{y([{type:"initialValue",value:z}]),setTimeout(()=>{y([{type:"stringValue",value:$l(E)}])},150)})})()},[]),C.useEffect(()=>{if(E.children.length>0&&!S){if(y([{type:"hasLoaded",value:!0}]),!i)return;const j=b.end(E,[]);G.select(E,j),J.focus(E)}},[E.children.length]),C.useEffect(()=>{t!==""||!E||bc(D,t)&&!F||(b.withoutNormalizing(E,()=>{G.delete(E,{at:{anchor:b.start(E,[]),focus:b.end(E,[])}}),G.deselect(E),E.children.length!==0&&G.unwrapNodes(E,{at:[0]}),G.insertNodes(E,p,{at:[0]})}),y([{type:"initialValue",value:p},{type:"lastAnchor",value:null}]))},[t]);const O=wc(()=>{gC(E,$.show,c,y)},100);return x?d.jsx("div",{id:I,className:"rich-text-editor",children:d.jsxs(Kt.Provider,{value:{...f,id:I,setFocus:R,dispatch:y,reportError:m},children:[d.jsxs(Oy,{editor:E,initialValue:x,onChange:j=>{if(E.operations.some(z=>z.type!=="set_selection")){const z=bC(j);h(z),y([{type:"stringValue",value:$l(E)}]),F||y([{type:"hasInteracted",value:!0}]),O(),u&&console.log({serialized:z,json:j})}},...o,children:[d.jsx(Ey,{className:"input",renderElement:M,renderLeaf:w,placeholder:n||l.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:i,tabIndex:0,onKeyDown:j=>{if(j.key==="Enter"){$.show&&(j.preventDefault(),j.stopPropagation(),pf(E,$,y,I));const{selection:q}=E;if(q){const z=V.isCollapsed(q),[re,X]=b.node(E,q,{depth:1});let v=re,H=v.type;const ee=v.children[0];if(ee&&[Z.ol,Z.ul].includes(ee.type)&&(v=ee,H=ee.type),v&&ce.isElement(v)&&H!==Z.paragraph){if(H===Z.blockquote&&!j.shiftKey){j.stopPropagation(),j.preventDefault(),G.insertNodes(E,p);return}if(z){const[B]=b.parent(E,q,{edge:"end"}),W=B.type;if(k==="Enter"&&W===Z.li&&[Z.ul,Z.ol].includes(H)){j.stopPropagation(),j.preventDefault(),G.insertNodes(E,p,{at:N.next(X)}),G.select(E,b.end(E,N.next(X)));return}}}}}else if(j.key==="Escape"){if($.show){j.preventDefault(),j.stopPropagation(),y([{type:"mentionPopover",value:{...$,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(j.key)&&$.show){j.preventDefault(),j.stopPropagation();const{selectedUser:q,possibleUsers:z}=$;let re=j.key==="ArrowUp"?q-1:q+1;re<0&&(re=z.length-1),re>=z.length&&(re=0),y([{type:"mentionPopover",value:{...$,selectedUser:re}}])}y([{type:"lastKey",value:j.key}]),pC(j,E,y,m)},onBlur:()=>{E.selection&&y([{type:"lastAnchor",value:E.selection.anchor}])},onFocus:()=>{if(_){if(!N.isPath(_.path)||!oe.has(E,_.path))return;const j=oe.get(E,_.path);let q=0;if(de.isText(j)?q=j.text.length:j.children&&(q=j.children.length),_.offset>q)return;try{G.select(E,{anchor:_,focus:_})}catch(z){const re=z.message;m(`Error focusing editor: ${re}`)}}}}),d.jsx(FC,{}),c?d.jsx(yC,{}):null]}),d.jsx(Ws,{limit:r,valueLength:qa(A)})]})}):null};const $C=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=C.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);C.useEffect(()=>{r&&l(r)},[r]);const u=c=>{i||(l(c),a(c))};return d.jsxs("div",{className:Y("toggle",s),onClick:c=>{c.preventDefault(),c.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[d.jsx("p",{children:t}),d.jsx("ul",{className:Y("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(c=>{const h=`${e}-${c.value}`;return d.jsxs("li",{className:"hidden",children:[d.jsx("input",{type:"radio",id:h,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:i}),d.jsx("label",{htmlFor:h,children:c.label})]},h)})})]})};function LC({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=C.useState(!1),[l,u]=C.useState(!1),c=C.useRef(null),h=async m=>{o(!0),u(!1);try{const p=m.target.files&&m.target.files[0];if(!p||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:p,userId:t});a(f=>({...f,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return d.jsxs("div",{className:Y("profile-image-change-figure",e),children:[d.jsx(sn,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&d.jsx("p",{className:"error text-small",children:d.jsx(ue.FormattedMessage,{id:"profile_image_change_error"})}),d.jsx("input",{id:"file",type:"file",accept:"image/*",ref:c,onChange:h,hidden:!0,"data-testid":"file-input"}),d.jsx(Be,{onClick:()=>c.current&&c.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:s,children:d.jsx(ue.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const wf=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(nr,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const Ef=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[c,h]=C.useState([]),[m,p]=C.useState(!0),[g,f]=C.useState(u),{formatMessage:y}=ue.useIntl(),D=async _=>{_.preventDefault();try{await l(c),h([]),f("SUCCESS")}catch(k){f("ERROR"),o(k)}},x=_=>{_.preventDefault(),f("NOT_SUBMITTED"),p(!0),h([])},A=_=>{_.preventDefault(),s(),f("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?d.jsxs("div",{className:"invite-form-wrapper",children:[d.jsx("div",{className:"content centred",children:g==="SUCCESS"?d.jsx("h2",{className:"success-title",children:y({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",y({id:"inviteForm_error"})]})}),d.jsx(tn,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(Be,{variant:"secondary",onClick:x,children:y({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(Be,{onClick:A,children:y({id:"inviteForm_ctaDone"})})]}):d.jsx(Be,{onClick:x,children:y({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:D,className:Y("invite-form gtm-trackable"),children:[d.jsxs("fieldset",{className:"content",children:[d.jsx("h2",{className:"title",style:{color:r},children:e}),d.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),d.jsx(Ch.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:y({id:"inviteForm_email_placeholder"}),emails:c,onChange:_=>{h(_),p(!_.length)},autoFocus:!1,getLabel:(_,k,F)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:_}),d.jsx(Be,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{F(k),p(!c.length)},className:"remove-email-button",screenreaderText:y({id:"overlay_close"})})]},k)})]}),d.jsx(tn,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(Be,{className:"sendEmailsButton",disabled:m,children:n})})]})})},ma=e=>e.map(t=>({condition:t})),yt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},zC=({functions:e,...t})=>{const{formatMessage:n}=ue.useIntl(),[r,a]=C.useState(null),[i,s]=C.useState(!1),[o,l]=C.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[yt.NEW_PASSWORD]!==p[yt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=p=>!is(p[yt.NEW_PASSWORD]).isValid,h=[{"data-testid":yt.NEW_PASSWORD,id:yt.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ma(["required",c]),functions:{onChange:p=>l(is(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":yt.CONFIRMED_PASSWORD,id:yt.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ma(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":yt.CURRENT_PASSWORD,id:yt.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ma(["required"])}),i&&h.push({component:Jc,props:{matchingRules:o}});const m={id:yt.FORM_ID,fields:h,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>a(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(yt.NEW_PASSWORD)||g.includes(yt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(nr,{...m}),r&&d.jsx(an,{variant:"error",text:r})]})};const kf=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=ue.useIntl(),u=C.useRef(null);Un(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=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 d.jsx("form",{onSubmit:c,className:Y("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:d.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:d.jsxs("p",{children:[d.jsx(Me,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),d.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:h=>{h.key==="Enter"&&c(h)}}),d.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:d.jsx(Me,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Me,{children:l.formatMessage({id:"search_cta"})})})]})})})},Hl=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let c="";return o?c=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?c=u.auth?"verify":"pending":c="exists":u.auth&&(c="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:c,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},qC=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"]}},WC=async({refs:e,dataToSubmit:t,createAccount:n,onSuccess:r,dispatch:a,state:i})=>{if(!e.form||!e.form.current)throw new Error("No refs.form");if(!e.form.current.checkValidity()){e.hiddenValidation&&e.hiddenValidation.current&&e.hiddenValidation.current.click();return}const s=qC(new FormData(e.form.current)),o=Object.assign(s,t);await n(o),localStorage.setItem("email",s.email),r&&r({...s,...i.values}),a([{type:"showSuccessMessage",value:!0}])},HC=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,h=(p,g)=>{p.current&&s.validFields[g]!==p.current.validity.valid&&o([{type:`validFields.${g}`,value:p.current.validity.valid}])},m=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>h(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{Hl({ref:i.email,validateEmail:r,dispatch:o})},onChange:(p,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Kc,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(m.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>h(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{h(i.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),e.url&&m.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>d.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&m.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>d.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"}),m.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>d.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=>d.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Hl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),m};const UC=({className:e=""})=>d.jsxs("div",{className:Y("success-message",e),"data-testid":"success-message",children:[d.jsx("p",{className:"success-title",children:d.jsx(ue.FormattedMessage,{id:"signup_success_title"})}),d.jsx(ue.FormattedMessage,{id:"signup_success_text",values:{p:t=>d.jsx("p",{children:t})}})]});const VC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},KC=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ue.useIntl(),{title:u=!0,expectation:c=!1,url:h=!0,logInButton:m=!0,successMessage:p=!0}=a,g={title:u,expectation:c,url:h,logInButton:m,successMessage:p},[f,y]=C.useReducer(Or,VC),{validFields:D,emailDetails:x,shouldManuallyApprove:A,shouldDisableButton:_,showSuccessMessage:k,showError:F}=f,[S,$]=Ps.useCookies(["signup-this-session","functional-cookie-consent"]),R={form:C.createRef(),name:C.createRef(),email:C.createRef(),jobTitle:C.createRef(),organisation:C.createRef(),tc:C.createRef(),hiddenValidation:C.createRef()};C.useEffect(()=>{A===!0&&R.jobTitle.current&&R.jobTitle.current.focus()},[A]),C.useEffect(()=>{S["signup-this-session"]&&y([{type:"showSuccessMessage",value:!0}])},[S]),C.useEffect(()=>{k&&S["functional-cookie-consent"]&&$("signup-this-session","true",{path:"/",maxAge:3600})},[k]);const I=C.useMemo(()=>HC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:R,state:f,dispatch:y,dataToSubmit:s,intl:l}),[s,r,l,R,g,f]),M=_?!0:A?!Object.values(D).every(w=>w===!0):!D.name||!D.email||["exists","pending","verify"].includes(x.boxType);return g.successMessage&&k?d.jsx(UC,{className:e}):d.jsxs("fieldset",{className:Y("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&d.jsx("p",{className:"signup-title",children:d.jsx(ue.FormattedMessage,{id:"signup_title"})}),F&&d.jsx(an,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(nr,{className:"signup-form",formRef:R.form,id:"sign-up-form",fields:I,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:M?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await WC({refs:R,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:y,state:f})},onCatch:w=>{r.handleError(w),y([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:R.hiddenValidation})]})};var Ss={exports:{}},Jr={exports:{}},Oe={};/** @license React v16.13.1
133
133
  * react-is.production.min.js
134
134
  *
135
135
  * Copyright (c) Facebook, Inc. and its affiliates.
136
136
  *
137
137
  * This source code is licensed under the MIT license found in the
138
138
  * LICENSE file in the root directory of this source tree.
139
- */var Ul;function ZC(){if(Ul)return Oe;Ul=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,D=e?Symbol.for("react.fundamental"):60117,y=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function A(k){if(typeof k=="object"&&k!==null){var F=k.$$typeof;switch(F){case t:switch(k=k.type,k){case l:case u:case r:case i:case a:case h:return k;default:switch(k=k&&k.$$typeof,k){case o:case c:case g:case p:case s:return k;default:return F}}case n:return F}}}function _(k){return A(k)===u}return Oe.AsyncMode=l,Oe.ConcurrentMode=u,Oe.ContextConsumer=o,Oe.ContextProvider=s,Oe.Element=t,Oe.ForwardRef=c,Oe.Fragment=r,Oe.Lazy=g,Oe.Memo=p,Oe.Portal=n,Oe.Profiler=i,Oe.StrictMode=a,Oe.Suspense=h,Oe.isAsyncMode=function(k){return _(k)||A(k)===l},Oe.isConcurrentMode=_,Oe.isContextConsumer=function(k){return A(k)===o},Oe.isContextProvider=function(k){return A(k)===s},Oe.isElement=function(k){return typeof k=="object"&&k!==null&&k.$$typeof===t},Oe.isForwardRef=function(k){return A(k)===c},Oe.isFragment=function(k){return A(k)===r},Oe.isLazy=function(k){return A(k)===g},Oe.isMemo=function(k){return A(k)===p},Oe.isPortal=function(k){return A(k)===n},Oe.isProfiler=function(k){return A(k)===i},Oe.isStrictMode=function(k){return A(k)===a},Oe.isSuspense=function(k){return A(k)===h},Oe.isValidElementType=function(k){return typeof k=="string"||typeof k=="function"||k===r||k===u||k===i||k===a||k===h||k===m||typeof k=="object"&&k!==null&&(k.$$typeof===g||k.$$typeof===p||k.$$typeof===s||k.$$typeof===o||k.$$typeof===c||k.$$typeof===D||k.$$typeof===y||k.$$typeof===w||k.$$typeof===f)},Oe.typeOf=A,Oe}var Pe={};/** @license React v16.13.1
139
+ */var Ul;function ZC(){if(Ul)return Oe;Ul=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,D=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function A(k){if(typeof k=="object"&&k!==null){var F=k.$$typeof;switch(F){case t:switch(k=k.type,k){case l:case u:case r:case i:case a:case h:return k;default:switch(k=k&&k.$$typeof,k){case o:case c:case g:case p:case s:return k;default:return F}}case n:return F}}}function _(k){return A(k)===u}return Oe.AsyncMode=l,Oe.ConcurrentMode=u,Oe.ContextConsumer=o,Oe.ContextProvider=s,Oe.Element=t,Oe.ForwardRef=c,Oe.Fragment=r,Oe.Lazy=g,Oe.Memo=p,Oe.Portal=n,Oe.Profiler=i,Oe.StrictMode=a,Oe.Suspense=h,Oe.isAsyncMode=function(k){return _(k)||A(k)===l},Oe.isConcurrentMode=_,Oe.isContextConsumer=function(k){return A(k)===o},Oe.isContextProvider=function(k){return A(k)===s},Oe.isElement=function(k){return typeof k=="object"&&k!==null&&k.$$typeof===t},Oe.isForwardRef=function(k){return A(k)===c},Oe.isFragment=function(k){return A(k)===r},Oe.isLazy=function(k){return A(k)===g},Oe.isMemo=function(k){return A(k)===p},Oe.isPortal=function(k){return A(k)===n},Oe.isProfiler=function(k){return A(k)===i},Oe.isStrictMode=function(k){return A(k)===a},Oe.isSuspense=function(k){return A(k)===h},Oe.isValidElementType=function(k){return typeof k=="string"||typeof k=="function"||k===r||k===u||k===i||k===a||k===h||k===m||typeof k=="object"&&k!==null&&(k.$$typeof===g||k.$$typeof===p||k.$$typeof===s||k.$$typeof===o||k.$$typeof===c||k.$$typeof===y||k.$$typeof===D||k.$$typeof===x||k.$$typeof===f)},Oe.typeOf=A,Oe}var Pe={};/** @license React v16.13.1
140
140
  * react-is.development.js
141
141
  *
142
142
  * Copyright (c) Facebook, Inc. and its affiliates.
143
143
  *
144
144
  * This source code is licensed under the MIT license found in the
145
145
  * LICENSE file in the root directory of this source tree.
146
- */var Vl;function YC(){return Vl||(Vl=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,D=e?Symbol.for("react.fundamental"):60117,y=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function A(Q){return typeof Q=="string"||typeof Q=="function"||Q===r||Q===u||Q===i||Q===a||Q===h||Q===m||typeof Q=="object"&&Q!==null&&(Q.$$typeof===g||Q.$$typeof===p||Q.$$typeof===s||Q.$$typeof===o||Q.$$typeof===c||Q.$$typeof===D||Q.$$typeof===y||Q.$$typeof===w||Q.$$typeof===f)}function _(Q){if(typeof Q=="object"&&Q!==null){var pe=Q.$$typeof;switch(pe){case t:var ge=Q.type;switch(ge){case l:case u:case r:case i:case a:case h:return ge;default:var ke=ge&&ge.$$typeof;switch(ke){case o:case c:case g:case p:case s:return ke;default:return pe}}case n:return pe}}}var k=l,F=u,S=o,$=s,R=t,I=c,M=r,x=g,E=p,O=n,j=i,q=a,z=h,re=!1;function X(Q){return re||(re=!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.")),v(Q)||_(Q)===l}function v(Q){return _(Q)===u}function H(Q){return _(Q)===o}function ee(Q){return _(Q)===s}function B(Q){return typeof Q=="object"&&Q!==null&&Q.$$typeof===t}function T(Q){return _(Q)===c}function W(Q){return _(Q)===r}function L(Q){return _(Q)===g}function U(Q){return _(Q)===p}function te(Q){return _(Q)===n}function ne(Q){return _(Q)===i}function ie(Q){return _(Q)===a}function fe(Q){return _(Q)===h}Pe.AsyncMode=k,Pe.ConcurrentMode=F,Pe.ContextConsumer=S,Pe.ContextProvider=$,Pe.Element=R,Pe.ForwardRef=I,Pe.Fragment=M,Pe.Lazy=x,Pe.Memo=E,Pe.Portal=O,Pe.Profiler=j,Pe.StrictMode=q,Pe.Suspense=z,Pe.isAsyncMode=X,Pe.isConcurrentMode=v,Pe.isContextConsumer=H,Pe.isContextProvider=ee,Pe.isElement=B,Pe.isForwardRef=T,Pe.isFragment=W,Pe.isLazy=L,Pe.isMemo=U,Pe.isPortal=te,Pe.isProfiler=ne,Pe.isStrictMode=ie,Pe.isSuspense=fe,Pe.isValidElementType=A,Pe.typeOf=_}()),Pe}var Kl;function _f(){return Kl||(Kl=1,process.env.NODE_ENV==="production"?Jr.exports=ZC():Jr.exports=YC()),Jr.exports}/*
146
+ */var Vl;function YC(){return Vl||(Vl=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,D=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function A(Q){return typeof Q=="string"||typeof Q=="function"||Q===r||Q===u||Q===i||Q===a||Q===h||Q===m||typeof Q=="object"&&Q!==null&&(Q.$$typeof===g||Q.$$typeof===p||Q.$$typeof===s||Q.$$typeof===o||Q.$$typeof===c||Q.$$typeof===y||Q.$$typeof===D||Q.$$typeof===x||Q.$$typeof===f)}function _(Q){if(typeof Q=="object"&&Q!==null){var pe=Q.$$typeof;switch(pe){case t:var ge=Q.type;switch(ge){case l:case u:case r:case i:case a:case h:return ge;default:var ke=ge&&ge.$$typeof;switch(ke){case o:case c:case g:case p:case s:return ke;default:return pe}}case n:return pe}}}var k=l,F=u,S=o,$=s,R=t,I=c,M=r,w=g,E=p,O=n,j=i,q=a,z=h,re=!1;function X(Q){return re||(re=!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.")),v(Q)||_(Q)===l}function v(Q){return _(Q)===u}function H(Q){return _(Q)===o}function ee(Q){return _(Q)===s}function B(Q){return typeof Q=="object"&&Q!==null&&Q.$$typeof===t}function T(Q){return _(Q)===c}function W(Q){return _(Q)===r}function L(Q){return _(Q)===g}function U(Q){return _(Q)===p}function te(Q){return _(Q)===n}function ne(Q){return _(Q)===i}function ie(Q){return _(Q)===a}function fe(Q){return _(Q)===h}Pe.AsyncMode=k,Pe.ConcurrentMode=F,Pe.ContextConsumer=S,Pe.ContextProvider=$,Pe.Element=R,Pe.ForwardRef=I,Pe.Fragment=M,Pe.Lazy=w,Pe.Memo=E,Pe.Portal=O,Pe.Profiler=j,Pe.StrictMode=q,Pe.Suspense=z,Pe.isAsyncMode=X,Pe.isConcurrentMode=v,Pe.isContextConsumer=H,Pe.isContextProvider=ee,Pe.isElement=B,Pe.isForwardRef=T,Pe.isFragment=W,Pe.isLazy=L,Pe.isMemo=U,Pe.isPortal=te,Pe.isProfiler=ne,Pe.isStrictMode=ie,Pe.isSuspense=fe,Pe.isValidElementType=A,Pe.typeOf=_}()),Pe}var Kl;function _f(){return Kl||(Kl=1,process.env.NODE_ENV==="production"?Jr.exports=ZC():Jr.exports=YC()),Jr.exports}/*
147
147
  object-assign
148
148
  (c) Sindre Sorhus
149
149
  @license MIT
150
- */var Pi,Zl;function GC(){if(Zl)return Pi;Zl=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(c){return s[c]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(c){u[c]=c}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Pi=a()?Object.assign:function(i,s){for(var o,l=r(i),u,c=1;c<arguments.length;c++){o=Object(arguments[c]);for(var h in o)t.call(o,h)&&(l[h]=o[h]);if(e){u=e(o);for(var m=0;m<u.length;m++)n.call(o,u[m])&&(l[u[m]]=o[u[m]])}}return l},Pi}var Ni,Yl;function vo(){if(Yl)return Ni;Yl=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ni=e,Ni}var Ri,Gl;function Bf(){return Gl||(Gl=1,Ri=Function.call.bind(Object.prototype.hasOwnProperty)),Ri}var Mi,Ql;function QC(){if(Ql)return Mi;Ql=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=vo(),n={},r=Bf();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var c in i)if(r(i,c)){var h;try{if(typeof i[c]!="function"){var m=Error((l||"React class")+": "+o+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}h=i[c](s,c,l,o,null,t)}catch(g){h=g}if(h&&!(h instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof h+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),h instanceof Error&&!(h.message in n)){n[h.message]=!0;var p=u?u():"";e("Failed "+o+" type: "+h.message+(p??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Mi=a,Mi}var Ii,Jl;function JC(){if(Jl)return Ii;Jl=1;var e=_f(),t=GC(),n=vo(),r=Bf(),a=QC(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(o){var l="Warning: "+o;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function s(){return null}return Ii=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,c="@@iterator";function h(v){var H=v&&(u&&v[u]||v[c]);if(typeof H=="function")return H}var m="<<anonymous>>",p={array:y("array"),bigint:y("bigint"),bool:y("boolean"),func:y("function"),number:y("number"),object:y("object"),string:y("string"),symbol:y("symbol"),any:w(),arrayOf:A,element:_(),elementType:k(),instanceOf:F,node:I(),objectOf:$,oneOf:S,oneOfType:R,shape:x,exact:E};function g(v,H){return v===H?v!==0||1/v===1/H:v!==v&&H!==H}function f(v,H){this.message=v,this.data=H&&typeof H=="object"?H:{},this.stack=""}f.prototype=Error.prototype;function D(v){if(process.env.NODE_ENV!=="production")var H={},ee=0;function B(W,L,U,te,ne,ie,fe){if(te=te||m,ie=ie||U,fe!==n){if(l){var Q=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 Q.name="Invariant Violation",Q}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var pe=te+":"+U;!H[pe]&&ee<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ie+"` prop on `"+te+"`. 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."),H[pe]=!0,ee++)}}return L[U]==null?W?L[U]===null?new f("The "+ne+" `"+ie+"` is marked as required "+("in `"+te+"`, but its value is `null`.")):new f("The "+ne+" `"+ie+"` is marked as required in "+("`"+te+"`, but its value is `undefined`.")):null:v(L,U,te,ne,ie)}var T=B.bind(null,!1);return T.isRequired=B.bind(null,!0),T}function y(v){function H(ee,B,T,W,L,U){var te=ee[B],ne=q(te);if(ne!==v){var ie=z(te);return new f("Invalid "+W+" `"+L+"` of type "+("`"+ie+"` supplied to `"+T+"`, expected ")+("`"+v+"`."),{expectedType:v})}return null}return D(H)}function w(){return D(s)}function A(v){function H(ee,B,T,W,L){if(typeof v!="function")return new f("Property `"+L+"` of component `"+T+"` has invalid PropType notation inside arrayOf.");var U=ee[B];if(!Array.isArray(U)){var te=q(U);return new f("Invalid "+W+" `"+L+"` of type "+("`"+te+"` supplied to `"+T+"`, expected an array."))}for(var ne=0;ne<U.length;ne++){var ie=v(U,ne,T,W,L+"["+ne+"]",n);if(ie instanceof Error)return ie}return null}return D(H)}function _(){function v(H,ee,B,T,W){var L=H[ee];if(!o(L)){var U=q(L);return new f("Invalid "+T+" `"+W+"` of type "+("`"+U+"` supplied to `"+B+"`, expected a single ReactElement."))}return null}return D(v)}function k(){function v(H,ee,B,T,W){var L=H[ee];if(!e.isValidElementType(L)){var U=q(L);return new f("Invalid "+T+" `"+W+"` of type "+("`"+U+"` supplied to `"+B+"`, expected a single ReactElement type."))}return null}return D(v)}function F(v){function H(ee,B,T,W,L){if(!(ee[B]instanceof v)){var U=v.name||m,te=X(ee[B]);return new f("Invalid "+W+" `"+L+"` of type "+("`"+te+"` supplied to `"+T+"`, expected ")+("instance of `"+U+"`."))}return null}return D(H)}function S(v){if(!Array.isArray(v))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function H(ee,B,T,W,L){for(var U=ee[B],te=0;te<v.length;te++)if(g(U,v[te]))return null;var ne=JSON.stringify(v,function(fe,Q){var pe=z(Q);return pe==="symbol"?String(Q):Q});return new f("Invalid "+W+" `"+L+"` of value `"+String(U)+"` "+("supplied to `"+T+"`, expected one of "+ne+"."))}return D(H)}function $(v){function H(ee,B,T,W,L){if(typeof v!="function")return new f("Property `"+L+"` of component `"+T+"` has invalid PropType notation inside objectOf.");var U=ee[B],te=q(U);if(te!=="object")return new f("Invalid "+W+" `"+L+"` of type "+("`"+te+"` supplied to `"+T+"`, expected an object."));for(var ne in U)if(r(U,ne)){var ie=v(U,ne,T,W,L+"."+ne,n);if(ie instanceof Error)return ie}return null}return D(H)}function R(v){if(!Array.isArray(v))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var H=0;H<v.length;H++){var ee=v[H];if(typeof ee!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+re(ee)+" at index "+H+"."),s}function B(T,W,L,U,te){for(var ne=[],ie=0;ie<v.length;ie++){var fe=v[ie],Q=fe(T,W,L,U,te,n);if(Q==null)return null;Q.data&&r(Q.data,"expectedType")&&ne.push(Q.data.expectedType)}var pe=ne.length>0?", expected one of type ["+ne.join(", ")+"]":"";return new f("Invalid "+U+" `"+te+"` supplied to "+("`"+L+"`"+pe+"."))}return D(B)}function I(){function v(H,ee,B,T,W){return O(H[ee])?null:new f("Invalid "+T+" `"+W+"` supplied to "+("`"+B+"`, expected a ReactNode."))}return D(v)}function M(v,H,ee,B,T){return new f((v||"React class")+": "+H+" type `"+ee+"."+B+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+T+"`.")}function x(v){function H(ee,B,T,W,L){var U=ee[B],te=q(U);if(te!=="object")return new f("Invalid "+W+" `"+L+"` of type `"+te+"` "+("supplied to `"+T+"`, expected `object`."));for(var ne in v){var ie=v[ne];if(typeof ie!="function")return M(T,W,L,ne,z(ie));var fe=ie(U,ne,T,W,L+"."+ne,n);if(fe)return fe}return null}return D(H)}function E(v){function H(ee,B,T,W,L){var U=ee[B],te=q(U);if(te!=="object")return new f("Invalid "+W+" `"+L+"` of type `"+te+"` "+("supplied to `"+T+"`, expected `object`."));var ne=t({},ee[B],v);for(var ie in ne){var fe=v[ie];if(r(v,ie)&&typeof fe!="function")return M(T,W,L,ie,z(fe));if(!fe)return new f("Invalid "+W+" `"+L+"` key `"+ie+"` supplied to `"+T+"`.\nBad object: "+JSON.stringify(ee[B],null," ")+`
151
- Valid keys: `+JSON.stringify(Object.keys(v),null," "));var Q=fe(U,ie,T,W,L+"."+ie,n);if(Q)return Q}return null}return D(H)}function O(v){switch(typeof v){case"number":case"string":case"undefined":return!0;case"boolean":return!v;case"object":if(Array.isArray(v))return v.every(O);if(v===null||o(v))return!0;var H=h(v);if(H){var ee=H.call(v),B;if(H!==v.entries){for(;!(B=ee.next()).done;)if(!O(B.value))return!1}else for(;!(B=ee.next()).done;){var T=B.value;if(T&&!O(T[1]))return!1}}else return!1;return!0;default:return!1}}function j(v,H){return v==="symbol"?!0:H?H["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&H instanceof Symbol:!1}function q(v){var H=typeof v;return Array.isArray(v)?"array":v instanceof RegExp?"object":j(H,v)?"symbol":H}function z(v){if(typeof v>"u"||v===null)return""+v;var H=q(v);if(H==="object"){if(v instanceof Date)return"date";if(v instanceof RegExp)return"regexp"}return H}function re(v){var H=z(v);switch(H){case"array":case"object":return"an "+H;case"boolean":case"date":case"regexp":return"a "+H;default:return H}}function X(v){return!v.constructor||!v.constructor.name?m:v.constructor.name}return p.checkPropTypes=a,p.resetWarningCache=a.resetWarningCache,p.PropTypes=p,p},Ii}var $i,Xl;function XC(){if(Xl)return $i;Xl=1;var e=vo();function t(){}function n(){}return n.resetWarningCache=t,$i=function(){function r(s,o,l,u,c,h){if(h!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},$i}if(process.env.NODE_ENV!=="production"){var ex=_f(),tx=!0;Ss.exports=JC()(ex.isElement,tx)}else Ss.exports=XC()();var nx=Ss.exports;/*!
150
+ */var Pi,Zl;function GC(){if(Zl)return Pi;Zl=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(c){return s[c]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(c){u[c]=c}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Pi=a()?Object.assign:function(i,s){for(var o,l=r(i),u,c=1;c<arguments.length;c++){o=Object(arguments[c]);for(var h in o)t.call(o,h)&&(l[h]=o[h]);if(e){u=e(o);for(var m=0;m<u.length;m++)n.call(o,u[m])&&(l[u[m]]=o[u[m]])}}return l},Pi}var Ni,Yl;function vo(){if(Yl)return Ni;Yl=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ni=e,Ni}var Ri,Gl;function Bf(){return Gl||(Gl=1,Ri=Function.call.bind(Object.prototype.hasOwnProperty)),Ri}var Mi,Ql;function QC(){if(Ql)return Mi;Ql=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=vo(),n={},r=Bf();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var c in i)if(r(i,c)){var h;try{if(typeof i[c]!="function"){var m=Error((l||"React class")+": "+o+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}h=i[c](s,c,l,o,null,t)}catch(g){h=g}if(h&&!(h instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof h+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),h instanceof Error&&!(h.message in n)){n[h.message]=!0;var p=u?u():"";e("Failed "+o+" type: "+h.message+(p??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Mi=a,Mi}var Ii,Jl;function JC(){if(Jl)return Ii;Jl=1;var e=_f(),t=GC(),n=vo(),r=Bf(),a=QC(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(o){var l="Warning: "+o;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function s(){return null}return Ii=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,c="@@iterator";function h(v){var H=v&&(u&&v[u]||v[c]);if(typeof H=="function")return H}var m="<<anonymous>>",p={array:D("array"),bigint:D("bigint"),bool:D("boolean"),func:D("function"),number:D("number"),object:D("object"),string:D("string"),symbol:D("symbol"),any:x(),arrayOf:A,element:_(),elementType:k(),instanceOf:F,node:I(),objectOf:$,oneOf:S,oneOfType:R,shape:w,exact:E};function g(v,H){return v===H?v!==0||1/v===1/H:v!==v&&H!==H}function f(v,H){this.message=v,this.data=H&&typeof H=="object"?H:{},this.stack=""}f.prototype=Error.prototype;function y(v){if(process.env.NODE_ENV!=="production")var H={},ee=0;function B(W,L,U,te,ne,ie,fe){if(te=te||m,ie=ie||U,fe!==n){if(l){var Q=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 Q.name="Invariant Violation",Q}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var pe=te+":"+U;!H[pe]&&ee<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ie+"` prop on `"+te+"`. 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."),H[pe]=!0,ee++)}}return L[U]==null?W?L[U]===null?new f("The "+ne+" `"+ie+"` is marked as required "+("in `"+te+"`, but its value is `null`.")):new f("The "+ne+" `"+ie+"` is marked as required in "+("`"+te+"`, but its value is `undefined`.")):null:v(L,U,te,ne,ie)}var T=B.bind(null,!1);return T.isRequired=B.bind(null,!0),T}function D(v){function H(ee,B,T,W,L,U){var te=ee[B],ne=q(te);if(ne!==v){var ie=z(te);return new f("Invalid "+W+" `"+L+"` of type "+("`"+ie+"` supplied to `"+T+"`, expected ")+("`"+v+"`."),{expectedType:v})}return null}return y(H)}function x(){return y(s)}function A(v){function H(ee,B,T,W,L){if(typeof v!="function")return new f("Property `"+L+"` of component `"+T+"` has invalid PropType notation inside arrayOf.");var U=ee[B];if(!Array.isArray(U)){var te=q(U);return new f("Invalid "+W+" `"+L+"` of type "+("`"+te+"` supplied to `"+T+"`, expected an array."))}for(var ne=0;ne<U.length;ne++){var ie=v(U,ne,T,W,L+"["+ne+"]",n);if(ie instanceof Error)return ie}return null}return y(H)}function _(){function v(H,ee,B,T,W){var L=H[ee];if(!o(L)){var U=q(L);return new f("Invalid "+T+" `"+W+"` of type "+("`"+U+"` supplied to `"+B+"`, expected a single ReactElement."))}return null}return y(v)}function k(){function v(H,ee,B,T,W){var L=H[ee];if(!e.isValidElementType(L)){var U=q(L);return new f("Invalid "+T+" `"+W+"` of type "+("`"+U+"` supplied to `"+B+"`, expected a single ReactElement type."))}return null}return y(v)}function F(v){function H(ee,B,T,W,L){if(!(ee[B]instanceof v)){var U=v.name||m,te=X(ee[B]);return new f("Invalid "+W+" `"+L+"` of type "+("`"+te+"` supplied to `"+T+"`, expected ")+("instance of `"+U+"`."))}return null}return y(H)}function S(v){if(!Array.isArray(v))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function H(ee,B,T,W,L){for(var U=ee[B],te=0;te<v.length;te++)if(g(U,v[te]))return null;var ne=JSON.stringify(v,function(fe,Q){var pe=z(Q);return pe==="symbol"?String(Q):Q});return new f("Invalid "+W+" `"+L+"` of value `"+String(U)+"` "+("supplied to `"+T+"`, expected one of "+ne+"."))}return y(H)}function $(v){function H(ee,B,T,W,L){if(typeof v!="function")return new f("Property `"+L+"` of component `"+T+"` has invalid PropType notation inside objectOf.");var U=ee[B],te=q(U);if(te!=="object")return new f("Invalid "+W+" `"+L+"` of type "+("`"+te+"` supplied to `"+T+"`, expected an object."));for(var ne in U)if(r(U,ne)){var ie=v(U,ne,T,W,L+"."+ne,n);if(ie instanceof Error)return ie}return null}return y(H)}function R(v){if(!Array.isArray(v))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var H=0;H<v.length;H++){var ee=v[H];if(typeof ee!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+re(ee)+" at index "+H+"."),s}function B(T,W,L,U,te){for(var ne=[],ie=0;ie<v.length;ie++){var fe=v[ie],Q=fe(T,W,L,U,te,n);if(Q==null)return null;Q.data&&r(Q.data,"expectedType")&&ne.push(Q.data.expectedType)}var pe=ne.length>0?", expected one of type ["+ne.join(", ")+"]":"";return new f("Invalid "+U+" `"+te+"` supplied to "+("`"+L+"`"+pe+"."))}return y(B)}function I(){function v(H,ee,B,T,W){return O(H[ee])?null:new f("Invalid "+T+" `"+W+"` supplied to "+("`"+B+"`, expected a ReactNode."))}return y(v)}function M(v,H,ee,B,T){return new f((v||"React class")+": "+H+" type `"+ee+"."+B+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+T+"`.")}function w(v){function H(ee,B,T,W,L){var U=ee[B],te=q(U);if(te!=="object")return new f("Invalid "+W+" `"+L+"` of type `"+te+"` "+("supplied to `"+T+"`, expected `object`."));for(var ne in v){var ie=v[ne];if(typeof ie!="function")return M(T,W,L,ne,z(ie));var fe=ie(U,ne,T,W,L+"."+ne,n);if(fe)return fe}return null}return y(H)}function E(v){function H(ee,B,T,W,L){var U=ee[B],te=q(U);if(te!=="object")return new f("Invalid "+W+" `"+L+"` of type `"+te+"` "+("supplied to `"+T+"`, expected `object`."));var ne=t({},ee[B],v);for(var ie in ne){var fe=v[ie];if(r(v,ie)&&typeof fe!="function")return M(T,W,L,ie,z(fe));if(!fe)return new f("Invalid "+W+" `"+L+"` key `"+ie+"` supplied to `"+T+"`.\nBad object: "+JSON.stringify(ee[B],null," ")+`
151
+ Valid keys: `+JSON.stringify(Object.keys(v),null," "));var Q=fe(U,ie,T,W,L+"."+ie,n);if(Q)return Q}return null}return y(H)}function O(v){switch(typeof v){case"number":case"string":case"undefined":return!0;case"boolean":return!v;case"object":if(Array.isArray(v))return v.every(O);if(v===null||o(v))return!0;var H=h(v);if(H){var ee=H.call(v),B;if(H!==v.entries){for(;!(B=ee.next()).done;)if(!O(B.value))return!1}else for(;!(B=ee.next()).done;){var T=B.value;if(T&&!O(T[1]))return!1}}else return!1;return!0;default:return!1}}function j(v,H){return v==="symbol"?!0:H?H["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&H instanceof Symbol:!1}function q(v){var H=typeof v;return Array.isArray(v)?"array":v instanceof RegExp?"object":j(H,v)?"symbol":H}function z(v){if(typeof v>"u"||v===null)return""+v;var H=q(v);if(H==="object"){if(v instanceof Date)return"date";if(v instanceof RegExp)return"regexp"}return H}function re(v){var H=z(v);switch(H){case"array":case"object":return"an "+H;case"boolean":case"date":case"regexp":return"a "+H;default:return H}}function X(v){return!v.constructor||!v.constructor.name?m:v.constructor.name}return p.checkPropTypes=a,p.resetWarningCache=a.resetWarningCache,p.PropTypes=p,p},Ii}var $i,Xl;function XC(){if(Xl)return $i;Xl=1;var e=vo();function t(){}function n(){}return n.resetWarningCache=t,$i=function(){function r(s,o,l,u,c,h){if(h!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},$i}if(process.env.NODE_ENV!=="production"){var ex=_f(),tx=!0;Ss.exports=JC()(ex.isElement,tx)}else Ss.exports=XC()();var nx=Ss.exports;/*!
152
152
  * tabbable 6.2.0
153
153
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
154
154
  */var Af=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Ba=Af.join(","),Ff=typeof Element>"u",xn=Ff?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Aa=!Ff&&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},Fa=function e(t,n){var r;n===void 0&&(n=!0);var a=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=a===""||a==="true",s=i||n&&t&&e(t.parentNode);return s},rx=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Tf=function(t,n,r){if(Fa(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(Ba));return n&&xn.call(t,Ba)&&a.unshift(t),a=a.filter(r),a},Sf=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!Fa(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var c=xn.call(s,Ba);c&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var h=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),m=!Fa(h,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(h&&m){var p=e(h===!0?s.children:h.children,!0,r);r.flatten?a.push.apply(a,p):a.push({scopeParent:s,candidates:p})}else i.unshift.apply(i,s.children)}}return a},jf=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Jt=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||rx(t))&&!jf(t)?0:t.tabIndex},ax=function(t,n){var r=Jt(t);return r<0&&n&&!jf(t)?0:r},ix=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Of=function(t){return t.tagName==="INPUT"},sx=function(t){return Of(t)&&t.type==="hidden"},ox=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},ux=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},lx=function(t){if(!t.name)return!0;var n=t.form||Aa(t),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},a;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")a=r(window.CSS.escape(t.name));else try{a=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=ux(a,t.form);return!i||i===t},cx=function(t){return Of(t)&&t.type==="radio"},dx=function(t){return cx(t)&&!lx(t)},fx=function(t){var n,r=t&&Aa(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,c,h;r=Aa(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((c=a)!==null&&c!==void 0&&(h=c.ownerDocument)!==null&&h!==void 0&&h.contains(a))}}return i},ec=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},hx=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=xn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(xn.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof a=="function"){for(var o=t;t;){var l=t.parentElement,u=Aa(t);if(l&&!l.shadowRoot&&a(l)===!0)return ec(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(fx(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return ec(t);return!1},mx=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var a=n.children.item(r);if(a.tagName==="LEGEND")return xn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},Ta=function(t,n){return!(n.disabled||Fa(n)||sx(n)||hx(n,t)||ox(n)||mx(n))},js=function(t,n){return!(dx(n)||Jt(n)<0||!Ta(t,n))},px=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},gx=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=ax(o,s),u=s?e(a.candidates):o;l===0?s?n.push.apply(n,u):n.push(o):r.push({documentOrder:i,tabIndex:l,item:a,isScope:s,content:u})}),r.sort(ix).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},Pf=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Sf([t],n.includeContainer,{filter:js.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:px}):r=Tf(t,n.includeContainer,js.bind(null,n)),gx(r)},Nf=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Sf([t],n.includeContainer,{filter:Ta.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Tf(t,n.includeContainer,Ta.bind(null,n)),r},dn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return xn.call(t,Ba)===!1?!1:js(n,t)},vx=Af.concat("iframe").join(","),pa=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return xn.call(t,vx)===!1?!1:Ta(n,t)};const bx=Object.freeze(Object.defineProperty({__proto__:null,focusable:Nf,getTabIndex:Jt,isFocusable:pa,isTabbable:dn,tabbable:Pf},Symbol.toStringTag,{value:"Module"}));/*!
155
155
  * focus-trap 7.5.4
156
156
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
157
- */function tc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function nc(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){yx(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}function yx(e,t,n){return t=Cx(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dx(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 Cx(e){var t=Dx(e,"string");return typeof t=="symbol"?t:String(t)}var rc={activateTrap:function(t,n){if(t.length>0){var r=t[t.length-1];r!==n&&r.pause()}var a=t.indexOf(n);a===-1||t.splice(a,1),t.push(n)},deactivateTrap:function(t,n){var r=t.indexOf(n);r!==-1&&t.splice(r,1),t.length>0&&t[t.length-1].unpause()}},xx=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},wx=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},xr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},Ex=function(t){return xr(t)&&!t.shiftKey},kx=function(t){return xr(t)&&t.shiftKey},ac=function(t){return setTimeout(t,0)},ic=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},cr=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return typeof t=="function"?t.apply(void 0,r):t},Xr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},_x=[],Bx=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||_x,i=nc({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Ex,isKeyBackward:kx},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(x,E,O){return x&&x[E]!==void 0?x[E]:i[O||E]},u=function(x,E){var O=typeof(E==null?void 0:E.composedPath)=="function"?E.composedPath():void 0;return s.containerGroups.findIndex(function(j){var q=j.container,z=j.tabbableNodes;return q.contains(x)||(O==null?void 0:O.includes(q))||z.find(function(re){return re===x})})},c=function(x){var E=i[x];if(typeof E=="function"){for(var O=arguments.length,j=new Array(O>1?O-1:0),q=1;q<O;q++)j[q-1]=arguments[q];E=E.apply(void 0,j)}if(E===!0&&(E=void 0),!E){if(E===void 0||E===!1)return E;throw new Error("`".concat(x,"` was specified but was not a node, or did not return a node"))}var z=E;if(typeof E=="string"&&(z=r.querySelector(E),!z))throw new Error("`".concat(x,"` as selector refers to no known node"));return z},h=function(){var x=c("initialFocus");if(x===!1)return!1;if(x===void 0||!pa(x,i.tabbableOptions))if(u(r.activeElement)>=0)x=r.activeElement;else{var E=s.tabbableGroups[0],O=E&&E.firstTabbableNode;x=O||c("fallbackFocus")}if(!x)throw new Error("Your focus-trap needs to have at least one focusable element");return x},m=function(){if(s.containerGroups=s.containers.map(function(x){var E=Pf(x,i.tabbableOptions),O=Nf(x,i.tabbableOptions),j=E.length>0?E[0]:void 0,q=E.length>0?E[E.length-1]:void 0,z=O.find(function(v){return dn(v)}),re=O.slice().reverse().find(function(v){return dn(v)}),X=!!E.find(function(v){return Jt(v)>0});return{container:x,tabbableNodes:E,focusableNodes:O,posTabIndexesFound:X,firstTabbableNode:j,lastTabbableNode:q,firstDomTabbableNode:z,lastDomTabbableNode:re,nextTabbableNode:function(H){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,B=E.indexOf(H);return B<0?ee?O.slice(O.indexOf(H)+1).find(function(T){return dn(T)}):O.slice(0,O.indexOf(H)).reverse().find(function(T){return dn(T)}):E[B+(ee?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(x){return x.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!c("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(x){return x.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 M(x){var E=x.activeElement;if(E)return E.shadowRoot&&E.shadowRoot.activeElement!==null?M(E.shadowRoot):E},g=function M(x){if(x!==!1&&x!==p(document)){if(!x||!x.focus){M(h());return}x.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=x,xx(x)&&x.select()}},f=function(x){var E=c("setReturnFocus",x);return E||(E===!1?!1:x)},D=function(x){var E=x.target,O=x.event,j=x.isBackward,q=j===void 0?!1:j;E=E||Xr(O),m();var z=null;if(s.tabbableGroups.length>0){var re=u(E,O),X=re>=0?s.containerGroups[re]:void 0;if(re<0)q?z=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:z=s.tabbableGroups[0].firstTabbableNode;else if(q){var v=ic(s.tabbableGroups,function(L){var U=L.firstTabbableNode;return E===U});if(v<0&&(X.container===E||pa(E,i.tabbableOptions)&&!dn(E,i.tabbableOptions)&&!X.nextTabbableNode(E,!1))&&(v=re),v>=0){var H=v===0?s.tabbableGroups.length-1:v-1,ee=s.tabbableGroups[H];z=Jt(E)>=0?ee.lastTabbableNode:ee.lastDomTabbableNode}else xr(O)||(z=X.nextTabbableNode(E,!1))}else{var B=ic(s.tabbableGroups,function(L){var U=L.lastTabbableNode;return E===U});if(B<0&&(X.container===E||pa(E,i.tabbableOptions)&&!dn(E,i.tabbableOptions)&&!X.nextTabbableNode(E))&&(B=re),B>=0){var T=B===s.tabbableGroups.length-1?0:B+1,W=s.tabbableGroups[T];z=Jt(E)>=0?W.firstTabbableNode:W.firstDomTabbableNode}else xr(O)||(z=X.nextTabbableNode(E))}}else z=c("fallbackFocus");return z},y=function(x){var E=Xr(x);if(!(u(E,x)>=0)){if(cr(i.clickOutsideDeactivates,x)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}cr(i.allowOutsideClick,x)||x.preventDefault()}},w=function(x){var E=Xr(x),O=u(E,x)>=0;if(O||E instanceof Document)O&&(s.mostRecentlyFocusedNode=E);else{x.stopImmediatePropagation();var j,q=!0;if(s.mostRecentlyFocusedNode)if(Jt(s.mostRecentlyFocusedNode)>0){var z=u(s.mostRecentlyFocusedNode),re=s.containerGroups[z].tabbableNodes;if(re.length>0){var X=re.findIndex(function(v){return v===s.mostRecentlyFocusedNode});X>=0&&(i.isKeyForward(s.recentNavEvent)?X+1<re.length&&(j=re[X+1],q=!1):X-1>=0&&(j=re[X-1],q=!1))}}else s.containerGroups.some(function(v){return v.tabbableNodes.some(function(H){return Jt(H)>0})})||(q=!1);else q=!1;q&&(j=D({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(j||s.mostRecentlyFocusedNode||h())}s.recentNavEvent=void 0},A=function(x){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=x;var O=D({event:x,isBackward:E});O&&(xr(x)&&x.preventDefault(),g(O))},_=function(x){if(wx(x)&&cr(i.escapeDeactivates,x)!==!1){x.preventDefault(),o.deactivate();return}(i.isKeyForward(x)||i.isKeyBackward(x))&&A(x,i.isKeyBackward(x))},k=function(x){var E=Xr(x);u(E,x)>=0||cr(i.clickOutsideDeactivates,x)||cr(i.allowOutsideClick,x)||(x.preventDefault(),x.stopImmediatePropagation())},F=function(){if(s.active)return rc.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?ac(function(){g(h())}):g(h()),r.addEventListener("focusin",w,!0),r.addEventListener("mousedown",y,{capture:!0,passive:!1}),r.addEventListener("touchstart",y,{capture:!0,passive:!1}),r.addEventListener("click",k,{capture:!0,passive:!1}),r.addEventListener("keydown",_,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",w,!0),r.removeEventListener("mousedown",y,!0),r.removeEventListener("touchstart",y,!0),r.removeEventListener("click",k,!0),r.removeEventListener("keydown",_,!0),o},$=function(x){var E=x.some(function(O){var j=Array.from(O.removedNodes);return j.some(function(q){return q===s.mostRecentlyFocusedNode})});E&&g(h())},R=typeof window<"u"&&"MutationObserver"in window?new MutationObserver($):void 0,I=function(){R&&(R.disconnect(),s.active&&!s.paused&&s.containers.map(function(x){R.observe(x,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(x){if(s.active)return this;var E=l(x,"onActivate"),O=l(x,"onPostActivate"),j=l(x,"checkCanFocusTrap");j||m(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,E==null||E();var q=function(){j&&m(),F(),I(),O==null||O()};return j?(j(s.containers.concat()).then(q,q),this):(q(),this)},deactivate:function(x){if(!s.active)return this;var E=nc({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},x);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,I(),rc.deactivateTrap(a,o);var O=l(E,"onDeactivate"),j=l(E,"onPostDeactivate"),q=l(E,"checkCanReturnFocus"),z=l(E,"returnFocus","returnFocusOnDeactivate");O==null||O();var re=function(){ac(function(){z&&g(f(s.nodeFocusedBeforeActivation)),j==null||j()})};return z&&q?(q(f(s.nodeFocusedBeforeActivation)).then(re,re),this):(re(),this)},pause:function(x){if(s.paused||!s.active)return this;var E=l(x,"onPause"),O=l(x,"onPostPause");return s.paused=!0,E==null||E(),S(),I(),O==null||O(),this},unpause:function(x){if(!s.paused||!s.active)return this;var E=l(x,"onUnpause"),O=l(x,"onPostUnpause");return s.paused=!1,E==null||E(),m(),F(),I(),O==null||O(),this},updateContainerElements:function(x){var E=[].concat(x).filter(Boolean);return s.containers=E.map(function(O){return typeof O=="string"?r.querySelector(O):O}),s.active&&m(),I(),this}},o.updateContainerElements(t),o};const Ax=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Bx},Symbol.toStringTag,{value:"Module"})),Fx=Dc(Ax),Tx=Dc(bx);function Qn(e){"@babel/helpers - typeof";return Qn=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},Qn(e)}function Sx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sc(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,Rf(r.key),r)}}function jx(e,t,n){return t&&sc(e.prototype,t),n&&sc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ox(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Os(e,t)}function Os(e,t){return Os=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Os(e,t)}function Px(e){var t=Rx();return function(){var r=Sa(e),a;if(t){var i=Sa(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return Nx(this,a)}}function Nx(e,t){if(t&&(Qn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return pr(e)}function pr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rx(){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 Sa(e){return Sa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Sa(e)}function Mx(e,t,n){return t=Rf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rf(e){var t=Ix(e,"string");return Qn(t)==="symbol"?t:String(t)}function Ix(e,t){if(Qn(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Qn(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ea=C,be=nx,$x=Fx,Lx=$x.createFocusTrap,zx=Tx,qx=zx.isFocusable,bo=function(e){Ox(n,e);var t=Px(n);function n(r){var a;Sx(this,n),a=t.call(this,r),Mx(pr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var c=arguments.length,h=new Array(c>1?c-1:0),m=1;m<c;m++)h[m-1]=arguments[m];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 p=u;if(typeof u=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),a.handleDeactivate=a.handleDeactivate.bind(pr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(pr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(pr(a)),a.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:a.handleDeactivate,onPostDeactivate:a.handlePostDeactivate,clickOutsideDeactivates:a.handleClickOutsideDeactivates},a.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){a.originalOptions[s]=i[s];continue}a.internalOptions[s]=i[s]}return a.outsideClick=null,a.focusTrapElements=r.containerElements||[],a.updatePreviousElement(),a}return jx(n,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var a=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return a||(a===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var a=this.getDocument();a&&(this.previouslyFocusedElement=a.activeElement)}},{key:"deactivateTrap",value:function(){!this.focusTrap||!this.focusTrap.active||this.focusTrap.deactivate({returnFocus:!1,checkCanReturnFocus:null,onDeactivate:this.originalOptions.onDeactivate})}},{key:"handleClickOutsideDeactivates",value:function(a){var i=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,a):this.originalOptions.clickOutsideDeactivates;return i&&(this.outsideClick={target:a.target,allowDeactivation:i}),i}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var a=this,i=function(){var o=a.getReturnFocusNode(),l=!!(a.originalOptions.returnFocusOnDeactivate&&o!==null&&o!==void 0&&o.focus&&(!a.outsideClick||a.outsideClick.allowDeactivation&&!qx(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,c=u===void 0?!1:u;l&&o.focus({preventScroll:c}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?ea.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===ea.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var c=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=c||[u]},o=ea.cloneElement(i,{ref:s});return o}return null}}]),n}(ea.Component),dr=typeof Element>"u"?Function:Element;bo.propTypes={active:be.bool,paused:be.bool,focusTrapOptions:be.shape({document:be.object,onActivate:be.func,onPostActivate:be.func,checkCanFocusTrap:be.func,onPause:be.func,onPostPause:be.func,onUnpause:be.func,onPostUnpause:be.func,onDeactivate:be.func,onPostDeactivate:be.func,checkCanReturnFocus:be.func,initialFocus:be.oneOfType([be.instanceOf(dr),be.string,be.bool,be.func]),fallbackFocus:be.oneOfType([be.instanceOf(dr),be.string,be.func]),escapeDeactivates:be.oneOfType([be.bool,be.func]),clickOutsideDeactivates:be.oneOfType([be.bool,be.func]),returnFocusOnDeactivate:be.bool,setReturnFocus:be.oneOfType([be.instanceOf(dr),be.string,be.bool,be.func]),allowOutsideClick:be.oneOfType([be.bool,be.func]),preventScroll:be.bool,tabbableOptions:be.shape({displayCheck:be.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:be.oneOfType([be.bool,be.func])}),trapStack:be.array,isKeyForward:be.func,isKeyBackward:be.func}),containerElements:be.arrayOf(be.instanceOf(dr)),children:be.oneOfType([be.element,be.instanceOf(dr)])};bo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:Lx};var Wx=bo;const Hx=wn(Wx),Mf=({showDevTools:e=!0,children:t})=>{const n=new Ke.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return d.jsxs(Ke.QueryClientProvider,{client:n,children:[t,e&&d.jsx(Dh.ReactQueryDevtools,{initialIsOpen:!1})]})};var Ux=C.createContext({client:sa});function Vx(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=C.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(sa.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),sa.init(r,a)),sa)},[n,r]);return C.createElement(Ux.Provider,{value:{client:i}},t)}const If=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(Vx,{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}):d.jsx(d.Fragment,{children:e}),$f=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Ih[r],...n||{}};return d.jsx(ue.IntlProvider,{locale:r,messages:a,children:e})},yo=C.createContext({}),ga={en:"English",es:"Español",fr:"Français",pt:"Português"},Mt=C.createContext({isLoading:!0});function Ga(){return C.useContext(Mt)}const Lf=({children:e,user:t})=>d.jsx(Mt.Provider,{value:t,children:e}),Do=C.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),zf=()=>C.useContext(Do),qf=({children:e})=>{const[t,n]=C.useState([]);C.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=C.useCallback(i=>{n(s=>[...s,i])},[]),a=C.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return d.jsx(Do.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Kx=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=C.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=C.useState(s),u=c=>{localStorage.setItem("language",c),l(c)};return C.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),Nc(5e3)}).catch(c=>{c.message===Sc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(yo.Provider,{value:{language:o,updateLanguage:u},children:d.jsx($f,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(Ps.CookiesProvider,{children:d.jsx(Lf,{user:a,children:d.jsx(qf,{children:d.jsx(Mf,{showDevTools:r,children:d.jsx(If,{user:a,children:t})})})})})})})};const Co=({element:e="section",children:t,className:n,...r})=>C.createElement(e,{className:Y("modal",n),children:typeof t=="string"?d.jsx("p",{children:t}):t,...r});const Nr=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:c="",gtmContext:h="Modal"})=>{const m=ue.useIntl(),{registerOverlay:p,unregisterOverlay:g}=zf(),[f,D]=C.useState(t),y=_=>{_.key==="Escape"&&w(!1)};C.useEffect(()=>(window.addEventListener("keyup",y),()=>{window.removeEventListener("keyup",y)}));const w=_=>{D(_),_?(a(),p(e)):(i(),g(e))};C.useEffect(()=>(w(t),()=>{f&&g(e)}),[t]);const A=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{className:Y("overlay",{open:f}),role:"dialog",children:d.jsx(Co,{id:e,className:Y("overlay-modal",c,{"has-max-width":r}),hidden:!f,style:A,children:t&&d.jsx(Hx,{children:d.jsxs("div",{className:"overlay-content",children:[d.jsxs("div",{className:"top",children:[o&&d.jsx("h2",{className:"modal-title",children:o}),d.jsx(Be,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>w(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":h,screenreaderText:m.formatMessage({id:"overlay_close"})})]}),n&&d.jsx(tn,{}),l,u&&d.jsxs("div",{className:"bottom",children:[d.jsx(tn,{}),d.jsx(kn,{buttons:u})]}),s&&d.jsx(Er,{className:"error",children:s})]})})})})},Wf=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Zx=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const c=ue.useIntl();return r||(r=c.formatMessage({id:"inviteModal_formTitle"})),a||(a=c.formatMessage({id:"inviteModal_formLabel"})),i||(i=c.formatMessage({id:"inviteModal_cta"})),d.jsx(Nr,{title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:Y("invite-modal",e,{success:!!n}),children:d.jsx(Ef,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const Yx=({members:e})=>{const[t,n]=C.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return d.jsxs(d.Fragment,{children:[d.jsx(sn,{name:i,src:l}),d.jsx("p",{children:i}),d.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return d.jsxs("div",{className:"directory-wrapper",children:[d.jsx("ul",{className:"directory",children:e.map(a=>d.jsx("li",{children:d.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),d.jsx(Nr,{isOpen:t!==!1,children:t===!1?"":d.jsxs(d.Fragment,{children:[r(t),d.jsx(Kn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const Gx=({author:e,authorCite:t,content:n,member:r,className:a=""})=>d.jsxs("blockquote",{className:Y("testimonial-block",a),children:[d.jsx(Pt,{className:"testimonial",children:n}),r?d.jsx(nr,{member:r,styling:{size:"large"}}):d.jsxs(d.Fragment,{children:[e&&d.jsx("p",{className:Y("author",{"text-small":!a.includes("new")}),children:e}),t&&d.jsx("p",{className:Y("author-cite",{"text-small":!a.includes("new")}),children:d.jsx("cite",{children:t})})]})]}),Qx=C.memo(Gx);const Jx=({items:e=[],selector:t="",className:n=""})=>{const r=ue.useIntl(),[a,i]=C.useState(e);return C.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,c)=>{s+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&d.jsxs(Nt,{variant:"subtle",className:Y("table-of-contents",n),children:[d.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),d.jsx("nav",{children:d.jsx("ul",{children:a.map(({id:s,text:o})=>d.jsx("li",{children:d.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Qa=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ue.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=c=>{const h=c/60,m=Math.floor(h),p=(h-m)*60,g=Math.round(p),f=`${i.formatMessage({id:`${s}hours`},{time:m})}${m>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${m>0?`${i.formatMessage({id:`${s}hours_short`},{time:m})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:c,ariaText:h}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:c}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:h})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),d.jsx("span",{className:Y("time-to-complete",a),"aria-label":u,children:l})};const Xx=({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",d.jsx(tr,{...n,className:Y("banner",e),image:{...t,aspect:"banner"}})):null;const ln=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return d.jsx("section",{className:Y("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const ew=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),d.jsx(ln,{className:Y("download-section",n),children:d.jsxs("div",{className:"content-default",children:[C.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),d.jsx(kn,{buttons:r})]})})};function Hf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const tw=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ue.useIntl();return d.jsxs("div",{className:Y("edit-section-placeholder",{"has-icon":!!e}),style:Oc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(Be,{href:r,variant:"secondary",size:"small",onClick:()=>Hf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},nw=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=C.useState(!1),c=typeof r=="string"||!!n,h=()=>u(!1);return d.jsxs("section",{className:Y("edit-section",t),children:[n&&d.jsx(Nr,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:h},className:Y("edit-section-modal"),children:d.jsx(rr,{...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 m=>{var p,g;(p=n==null?void 0:n.functions)!=null&&p.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(m)),u(!1)},onCancel:h}})}),d.jsxs("div",{className:"edit-section-header",children:[d.jsx("h2",{className:"edit-section-header-title",children:a}),c&&d.jsx(Be,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Hf({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(tw,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(tn,{})]})};const rw=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return d.jsxs("div",{className:Y("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&C.createElement(s.element,{className:Y("title",s.className)},s.text),t&&d.jsx("p",{children:t}),d.jsx("ul",{className:Y({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:c,nameOfBusiness:h,link:m=!1,description:p=!1},g)=>{if(!c||!c.url)return null;const f=d.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:h});return d.jsxs("li",{children:[d.jsx("p",{className:"img-wrapper",children:m?d.jsx("a",{href:m,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),p&&d.jsx("small",{children:p})]},window.btoa(`${c.url}_${g}`))})})]})};const aw=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],iw=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],h={eyebrow:"small",title:"h1",text:"p"},m={};c.forEach(D=>{if(!t[D]){m[D]=!1;return}if(!s[D]){if(typeof t[D]=="object"){m[D]=t[D];const{text:y,element:w}=t[D];if(w&&aw.includes(w.toLowerCase()))return;m[D]={text:y,element:h[D]};return}m[D]={text:t[D],element:h[D]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=D=>{D.preventDefault(),D.stopPropagation();const y=document.getElementById(o.link.substring(1));y&&y.scrollIntoView({behavior:"smooth"})}),d.jsx(ln,{className:Y("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&a==="normal"&&m.eyebrow&&m.title}),children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"content-wrapper",children:[c.map(D=>{if(m[D]&&typeof m[D]=="object"){const{text:y,element:w=""}=m[D];return D==="text"?d.jsx(Kn,{overrideType:"text-only",className:"text",children:y},D):C.createElement(w,{key:D,className:D},y)}return null}),l,p&&d.jsx(Be,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:Y({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&d.jsx(tr,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},sw=C.memo(iw);const ow=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),d.jsx(ln,{className:Y("custom-content-banner",t,r,{"has-image":e}),style:a,children:d.jsx("div",{className:"content-slim",children:n})})};const uw=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx(Kn,{children:n}):n;return d.jsxs(ln,{className:Y("highlight-section",t),children:[r&&d.jsx("div",{className:Y("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:d.jsx(tr,{image:r})}),d.jsx("div",{className:Y("highlight-container highlight-content-wrapper",{"no-image":!r}),children:d.jsx("div",{className:Y("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:d.jsx("div",{className:"content-default",children:a})})})]})},lw=C.memo(uw);const cw=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:d.jsxs("aside",{className:Y("marketing-block",e),children:[n&&d.jsx("p",{className:"title",children:n}),r&&d.jsx("p",{children:r}),t&&d.jsx(Be,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),dw=({type:e,data:t})=>{const n=ue.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const h=a&&as(a);return d.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&d.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(c&&!i||s)return d.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):Ms(c)});if(o)return d.jsx(hn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&as(u);return d.jsxs("ul",{className:"details",children:[l&&d.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&d.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},ja={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"}},fw=({data:e,cta:t,link:n,gtmContext:r})=>{var f,D;const a=ue.useIntl(),[i,s]=C.useState({loading:!1,registered:e.registered||!1});C.useEffect(()=>{e.registered&&s(y=>({...y,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:c,slug:h}=e,m=e.contentType;let p="";if((f=ja[m])!=null&&f.gtmEvent&&(p=ja[m].gtmEvent),l&&u)return n?d.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(m==="people")return n?d.jsx(Be,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(m)&&c!=="premium"){const y=i.loading||i.registered||((D=e==null?void 0:e.members)==null?void 0:D.isMember),w=async A=>{if(A.preventDefault(),A.stopPropagation(),!(y||!t||!t.onClick)){s(_=>({..._,loading:!0}));try{const _=await t.onClick(e);s(_==="success"?()=>({registered:!0,loading:!1}):k=>({...k,loading:!1}))}catch{s(k=>({...k,loading:!1}))}}};return d.jsx("p",{className:Y("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:d.jsx(Be,{onClick:w,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:y,"data-gtm-event-context":`${r}Page-${m}: ${h}`,"data-gtm-event-type":`${r}-${m}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${m}${y?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const hw={title:66,text:3e3,secondaryText:1e3,partner:25},xo=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s,setFocus:o=!1})=>{var M,x,E,O,j;const l=ue.useIntl(),u=C.useContext(Mt),c=u&&typeof u.id=="string",h=C.useRef(null),[m,p]=C.useState({data:null,isLoading:!0}),{data:g,isLoading:f}=m,D=C.useCallback(()=>{n(t,c).then(q=>{p(()=>({data:q,isLoading:!1}))}).catch(()=>p(q=>({...q,isLoading:!1})))},[e]);if(C.useEffect(()=>{D()},[]),f||!g)return d.jsx(wt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:l.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:y}=g;if(!y||!ja[y])return d.jsx(wt,{element:"li",className:"card-wrapper"});const{basePath:w="",className:A,length:_,gtmEvent:k}=ja[y];let F=g.slug?`${w}${g.slug}`:!1;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")&&(F=g.slug);const S=q=>{F&&(q.preventDefault(),q.stopPropagation(),window.location.href=F)},$={...hw,..._};let R={className:"card"},I={};return F&&(I={href:F,className:"gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${k}-click`,"data-testid":"link"},g.openInNewTab&&(I.target="_blank"),R={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${k}-click`}),o&&(R={...R,tabIndex:"0"},(M=h==null?void 0:h.current)==null||M.focus(),(x=h==null?void 0:h.current)==null||x.scrollIntoView({behavior:"smooth"})),d.jsx("li",{className:Y("card-wrapper text-medium",A,i,{"has-link":F,"no-link":!F,"has-image":g.banner}),"data-testid":`${y}-card`,children:d.jsxs("div",{...R,ref:h,children:[d.jsx($c,{className:"card-label",contentType:y,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),y==="communityPage"&&(g==null?void 0:g.createdAt)&&jh(g==null?void 0:g.createdAt,60)&&d.jsx(hn,{size:"small",variant:"information","data-testid":"new-community",children:l.formatMessage({id:"card_new"})}),g.startDate&&!g.isOngoingEvent&&d.jsx(hn,{size:"small",variant:g.dateHasPassed?"default":"information","data-testid":"date",children:g.dateHasPassed?l.formatMessage({id:"card_ended"}):Pc(g.startDate)}),g.banner?d.jsxs("p",{className:"img",children:[g.registered&&d.jsx(hn,{size:"small",variant:"registered",children:l.formatMessage({id:"card_registered"})}),d.jsx(tr,{image:{...g.banner,description:""}})]}):A==="people"?d.jsx(sn,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&d.jsx(qs,{contributors:{data:g.contributors},styling:{size:"small",showGap:A!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(y)?l.formatMessage({id:`card_contributors_${y}`}):void 0,"data-testid":"contributors"}),g.partner&&d.jsx("p",{className:"partners","data-testid":"partners",children:g.partner.length>1?l.formatMessage({id:"card_partner"},{partner:g.partner[0],number:g.partner.length-1}):Un(g.partner[0],$.partner)}),["title","text","secondaryText"].map(q=>{const z=g[q];if(!z)return null;const re=Ac(q),X={key:q,className:re,"data-testid":re},v={wrapper:"p",forceWrapper:!0,forceInline:!0},H=Un(z,$[q]);return["title","text"].includes(q)&&F?(v.wrapper="a",d.jsx("p",{...X,children:d.jsx(Pt,{options:v,...I,children:H})})):d.jsx(Pt,{options:v,...X,children:H})}),(u==null?void 0:u.id)&&(g==null?void 0:g.members)&&d.jsxs("span",{className:"member-information",children:[((E=g==null?void 0:g.members)==null?void 0:E.isMember)&&d.jsx(hn,{size:"small",variant:"registered",icon:((O=g==null?void 0:g.members)==null?void 0:O.memberType)==="owner"?"user":"tick",children:l.formatMessage({id:`card_member_type_${(j=g==null?void 0:g.members)==null?void 0:j.memberType}`})}),d.jsx("br",{}),d.jsx("span",{className:"label member-count",children:l.formatMessage({id:"card_member_count"},{count:g==null?void 0:g.members.count})})]}),d.jsx(dw,{type:A||"",data:g}),d.jsx(fw,{data:g,cta:r,link:F||"",gtmContext:a})]})})};const Uf=({cards:e,cardTypes:t,className:n="",...r})=>d.jsx("ul",{className:Y("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return d.jsx(xo,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),mw=(e,t,n,r)=>{const a=t*n<=e,i=e<t*(n+1),s=r.includes(Math.floor(e/t));return a&&i||s},pw=({id:e,title:t})=>{const n=ue.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return C.createElement(a,{className:Y("title",i,s,{"highlighted-title":i==="highlighted"}),children:d.jsxs(d.Fragment,{children:[r,o&&d.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 Li={fourCards:1024,threeCards:769,twoCards:480};let ta=null;const gw=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ue.useIntl(),[u,c]=C.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:h,isLoading:m}=u,[p,g]=C.useState({currentPage:0,loadedPages:[0]}),{currentPage:f,loadedPages:D}=p,[y,w]=C.useState(""),A=t.length,_=Math.ceil(A/h),k=C.useRef(null),F=Xn(!0,!0,k==null?void 0:k.current);C.useEffect(()=>{let x=1;F&&(F>=Li.fourCards?x=4:F>=Li.threeCards?x=3:F>=Li.twoCards&&(x=2),x>A&&(x=A)),c(E=>({...E,cardsPerPage:x,isLoading:!1}))},[F,A]);const S=(x="next")=>{let E=f;if(typeof x=="string")if(x==="next")if(f<_-1)E=f+1;else return;else if(f>0)E=f-1;else return;else E=x;g(j=>({...j,currentPage:E,loadedPages:[...new Set([...D,E])]}));const O=()=>{const j=E*u.cardsPerPage,q=j+u.cardsPerPage;return t.slice(j,q).length};w(l.formatMessage({id:"carousel_pagination_aria_live"},{direction:x,count:O()}))},$=x=>{ta=x.touches[0].clientX},R=x=>{if(ta===null)return;const E=x.touches[0].clientX,O=ta-E;O>5?S("next"):O<-5&&S("previous"),ta=null},I={"--width":`${F||0}px`,"--total-cards":A,"--cards-per-page":h,"--page":f};if(m)return d.jsx(Ls,{layout:`carousel${a?"-with-title":""}`});const M=(x,E)=>{var j;let O=null;return(j=x==null?void 0:x.sys)!=null&&j.id?O=`card-${x.sys.id}`:x!=null&&x.slug?O=`card-${x.slug}`:[n[E],x.contentType].includes("customCard")&&(O=`card-${window.btoa(`${x.title} ${x.createdAt}`)}-${E}`),O};return d.jsxs("section",{ref:k,className:Y("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx(pw,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:$,onTouchMove:R,style:I,"data-testid":"carousel-list",children:t.map((x,E)=>{let O=M(x,E);return O&&mw(E,h,f,D)?d.jsx(xo,{id:O,card:{...x,contentType:n[E]},buildCardData:r,gtmContext:s,...o},O):(O=O||`${e}-card-${E}`,d.jsx(wt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},O))})}),_<=1?null:d.jsxs(d.Fragment,{children:[d.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[d.jsx("li",{className:"arrow previous",children:d.jsx(Be,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:x=>{x.preventDefault(),x.stopPropagation(),S("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:f<=0})}),[...Array(_)].map((x,E)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:Y("page-indicator",{selected:E===f}),onClick:O=>{O.preventDefault(),O.stopPropagation(),S(E)},children:d.jsx(Me,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:E+1,total:_})})})},`page-indicator-${E}`)),d.jsx("li",{className:"arrow next",children:d.jsx(Be,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:x=>{x.preventDefault(),x.stopPropagation(),S("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:f>=_-1})})]}),d.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:y})]})]})},vw=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const c=i?window.btoa(i):`carousel-${u}`,h=u===e.length-1;return t?d.jsxs(C.Fragment,{children:[d.jsx(Ls,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:d.jsx(tn,{})]},`placeholder-${c}`):d.jsxs(C.Fragment,{children:[d.jsx(gw,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),h?null:d.jsx(tn,{})]},`carousel-${c}`)});const Nn="joinCommunityButton",wo=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ue.useIntl(),o=C.useContext(Mt),l=o&&typeof o.id=="string",u=r||!l,[c,h]=C.useState(e),[m,p]=C.useState(e?"joined":"notJoined");C.useEffect(()=>{m==="joining"?p("joined"):m==="leaving"&&p("notJoined")},[c]);const g={},f={};return c&&m!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${Nn}_leave`}),g["aria-label"]=s.formatMessage({id:`${Nn}_member_aria`}),f["aria-hidden"]="true"),d.jsx(Be,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&m!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!c?s.formatMessage({id:`${Nn}_closed_tooltip`}):"",onClick:async D=>{if(!u){if(D.currentTarget.blur(),c){p("leaving");const y=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${Nn}_leaving_aria_live`})}});document.dispatchEvent(y),typeof i=="function"&&setTimeout(async()=>{await i()},500)}else{p("joining");const y=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${Nn}_joining_aria_live`})}});document.dispatchEvent(y),typeof a=="function"&&setTimeout(async()=>{await a()},500)}h(!c)}},className:Y("join-community-button",m,{active:m==="joining"}),disabled:u,"data-testid":"join-button",...g,children:d.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${Nn}${["joining","leaving"].includes(m)?`_${m}`:c?"_member":n?"_short":""}`})})})};const zi="communityDetails_",bw=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=ue.useIntl(),u=5,c=a||i.length,h=i.length?i:Array(u).fill({}),m=`/communities/${r}/members`===window.location.pathname,p=t||n,g=!n&&!t;return d.jsxs("div",{className:Y("community-details",e),children:[p&&d.jsxs("div",{className:"member-details",children:[d.jsxs("div",{className:"top",children:[d.jsxs("h4",{children:[l.formatMessage({id:`${zi}members`}),d.jsx("span",{className:"count",children:c})]}),!m&&d.jsx("p",{className:"text-small",children:d.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${zi}viewAll`})})})]}),d.jsx(qs,{contributors:{total:a,data:h},styling:{size:"medium",showGap:!0,showPlaceholders:c===0},cutoff:u})]}),d.jsx(wo,{isMember:t,isOpen:n,disabled:g,functions:{...o}}),t&&d.jsx(Be,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${zi}invite`})})]})};const yw=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Me,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),d.jsx("ul",{className:Y("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),d.jsxs("li",{children:[s&&d.jsx(Me,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),d.jsx(_n,{href:s?void 0:i,...l,children:Un(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Dw=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=ue.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=C.useState(t?["all"]:[]),u=(c,h)=>{let m=[];o.includes(c)?m=o.filter(p=>p!==c):c==="all"?m=["all"]:n?m=[...o.filter(p=>p!=="all"),c]:m=[c],l(p=>(r&&typeof r=="function"&&r({current:m,previous:p}),m)),h&&typeof h=="function"&&h()};return d.jsx("ul",{className:Y("filters",a),children:s.map(({id:c,text:h,disabled:m=!1,callback:p=()=>{}})=>{let g={};return m&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:h})}),d.jsx("li",{children:d.jsx("button",{className:Y(c,{selected:o.includes(c)}),onClick:f=>{f.preventDefault(),f.stopPropagation(),u(c,p)},...g,children:h})},c)})})},Cw=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let a="",i=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(a+=`/${s}`,i=!0):(a.includes(`/${r}/`)||(a+=`/${r}`),a+=`/${s}`)}),a.includes(`/${r}/`)||(a+=`/${r}`),t&&(a+=`/${t}`),i?{url:a,urlForRouter:`/${a.split("/").slice(2).join("/")}`}:a};const na="languageSwitcher_",xw=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ue.useIntl(),{updateLanguage:c=()=>{}}=C.useContext(yo),[h,m]=C.useState(e);if(C.useEffect(()=>{e!==h&&m(e)},[e]),!r||!Object.values(r).some(D=>D&&D.post_name))return null;const g=Object.keys(r),f=h!==e;return d.jsxs("div",{className:Y("language-switcher text-small",s,l),children:[d.jsxs("nav",{children:[s!=="short"&&d.jsx("p",{children:o||u.formatMessage({id:`${na}label`})}),d.jsx("ul",{children:g.map(D=>{var A;if(!ga[D])return null;const y=(A=r[D])==null?void 0:A.post_name;let w={className:D};if(h===D)w["aria-label"]=u.formatMessage({id:`${na}selected`},{language:ga[D]});else{const _=Cw(D,y,i);w={...w,href:typeof _=="string"?_:_.url,onClick:k=>{m(D),c(D),typeof a<"u"&&(k.preventDefault(),k.stopPropagation(),a(D,typeof _=="string"?_:_.urlForRouter))}}}return d.jsx("li",{children:d.jsx(_n,{...w,fallbackElement:"span",children:ga[D]})},D)})}),s!=="short"&&!f&&d.jsx("p",{children:u.formatMessage({id:`${na}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${na}disclaimer`},{email:Rn.support,link:D=>{const y=`mailto:${D}`;return d.jsx("a",{href:y,children:D})}})})]})};const qi=ue.createIntl({locale:"en",messages:er}),Rr=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:a="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:qi.formatMessage({id:"loadMore_button"}),endOfFeed:qi.formatMessage({id:"loadMore_endOfFeed"}),error:qi.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,h]=C.useState(""),m=async p=>{if(!n)try{await t(p)}catch(g){g instanceof Error?h(g.message):h("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:d.jsx("footer",{className:Y("load-more",l),children:!c&&e?d.jsx(Be,{variant:r,size:a,styling:i,icon:s,onClick:m,"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&&(!c||c!=null&&c.includes("Cannot read items"))?d.jsx("p",{children:o.endOfFeed}):c&&d.jsx("p",{className:"error",children:o.error})})};const Eo=({variant:e="default",version:t="default",className:n="",...r})=>d.jsx("p",{className:"logo-wrapper",children:d.jsx("a",{href:"/home/",className:Y("logo",e,t,n),...r,children:d.jsx(Me,{children:d.jsx(ue.FormattedMessage,{id:"apolitical"})})})});let ra=!1;const Vf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ue.useIntl(),i=C.useRef(null),[s,o]=C.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return C.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),C.createElement(e,{ref:i,className:Y("more-menu text-medium",r),children:d.jsxs(d.Fragment,{children:[d.jsx(Be,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),d.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:c,text:h,icon:m,...p},g)=>{const f={...p,onClick:D=>{o(!1),typeof c=="function"&&c(D)},onFocus:()=>{ra&&(clearTimeout(ra),ra=!1)},onBlur:()=>{ra=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),d.jsx("li",{className:"more-menu-list-item",children:d.jsx(Be,{variant:"tertiary",size:"medium",icon:m?{icon:m,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${g}`)})})]})})},ww=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Ew=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Kf=({activeLink:e})=>{const t=ue.useIntl(),n=C.useContext(Mt),r=n&&typeof n.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Ew.map(({key:a,href:i})=>{const s=ww(i,e),o={};return s&&(o["aria-current"]="page"),d.jsx("li",{className:Y(a,{active:s}),children:d.jsx("a",{href:i,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...o,children:t.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),r&&d.jsx("li",{className:"profile","data-testid":"profile-link",children:d.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[d.jsx(sn,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),d.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},fr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,kw=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${fr(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(`${fr(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(`${fr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
157
+ */function tc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function nc(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){yx(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}function yx(e,t,n){return t=Cx(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dx(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 Cx(e){var t=Dx(e,"string");return typeof t=="symbol"?t:String(t)}var rc={activateTrap:function(t,n){if(t.length>0){var r=t[t.length-1];r!==n&&r.pause()}var a=t.indexOf(n);a===-1||t.splice(a,1),t.push(n)},deactivateTrap:function(t,n){var r=t.indexOf(n);r!==-1&&t.splice(r,1),t.length>0&&t[t.length-1].unpause()}},xx=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},wx=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},xr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},Ex=function(t){return xr(t)&&!t.shiftKey},kx=function(t){return xr(t)&&t.shiftKey},ac=function(t){return setTimeout(t,0)},ic=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},lr=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return typeof t=="function"?t.apply(void 0,r):t},Xr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},_x=[],Bx=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||_x,i=nc({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Ex,isKeyBackward:kx},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(w,E,O){return w&&w[E]!==void 0?w[E]:i[O||E]},u=function(w,E){var O=typeof(E==null?void 0:E.composedPath)=="function"?E.composedPath():void 0;return s.containerGroups.findIndex(function(j){var q=j.container,z=j.tabbableNodes;return q.contains(w)||(O==null?void 0:O.includes(q))||z.find(function(re){return re===w})})},c=function(w){var E=i[w];if(typeof E=="function"){for(var O=arguments.length,j=new Array(O>1?O-1:0),q=1;q<O;q++)j[q-1]=arguments[q];E=E.apply(void 0,j)}if(E===!0&&(E=void 0),!E){if(E===void 0||E===!1)return E;throw new Error("`".concat(w,"` was specified but was not a node, or did not return a node"))}var z=E;if(typeof E=="string"&&(z=r.querySelector(E),!z))throw new Error("`".concat(w,"` as selector refers to no known node"));return z},h=function(){var w=c("initialFocus");if(w===!1)return!1;if(w===void 0||!pa(w,i.tabbableOptions))if(u(r.activeElement)>=0)w=r.activeElement;else{var E=s.tabbableGroups[0],O=E&&E.firstTabbableNode;w=O||c("fallbackFocus")}if(!w)throw new Error("Your focus-trap needs to have at least one focusable element");return w},m=function(){if(s.containerGroups=s.containers.map(function(w){var E=Pf(w,i.tabbableOptions),O=Nf(w,i.tabbableOptions),j=E.length>0?E[0]:void 0,q=E.length>0?E[E.length-1]:void 0,z=O.find(function(v){return dn(v)}),re=O.slice().reverse().find(function(v){return dn(v)}),X=!!E.find(function(v){return Jt(v)>0});return{container:w,tabbableNodes:E,focusableNodes:O,posTabIndexesFound:X,firstTabbableNode:j,lastTabbableNode:q,firstDomTabbableNode:z,lastDomTabbableNode:re,nextTabbableNode:function(H){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,B=E.indexOf(H);return B<0?ee?O.slice(O.indexOf(H)+1).find(function(T){return dn(T)}):O.slice(0,O.indexOf(H)).reverse().find(function(T){return dn(T)}):E[B+(ee?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(w){return w.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!c("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(w){return w.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 M(w){var E=w.activeElement;if(E)return E.shadowRoot&&E.shadowRoot.activeElement!==null?M(E.shadowRoot):E},g=function M(w){if(w!==!1&&w!==p(document)){if(!w||!w.focus){M(h());return}w.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=w,xx(w)&&w.select()}},f=function(w){var E=c("setReturnFocus",w);return E||(E===!1?!1:w)},y=function(w){var E=w.target,O=w.event,j=w.isBackward,q=j===void 0?!1:j;E=E||Xr(O),m();var z=null;if(s.tabbableGroups.length>0){var re=u(E,O),X=re>=0?s.containerGroups[re]:void 0;if(re<0)q?z=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:z=s.tabbableGroups[0].firstTabbableNode;else if(q){var v=ic(s.tabbableGroups,function(L){var U=L.firstTabbableNode;return E===U});if(v<0&&(X.container===E||pa(E,i.tabbableOptions)&&!dn(E,i.tabbableOptions)&&!X.nextTabbableNode(E,!1))&&(v=re),v>=0){var H=v===0?s.tabbableGroups.length-1:v-1,ee=s.tabbableGroups[H];z=Jt(E)>=0?ee.lastTabbableNode:ee.lastDomTabbableNode}else xr(O)||(z=X.nextTabbableNode(E,!1))}else{var B=ic(s.tabbableGroups,function(L){var U=L.lastTabbableNode;return E===U});if(B<0&&(X.container===E||pa(E,i.tabbableOptions)&&!dn(E,i.tabbableOptions)&&!X.nextTabbableNode(E))&&(B=re),B>=0){var T=B===s.tabbableGroups.length-1?0:B+1,W=s.tabbableGroups[T];z=Jt(E)>=0?W.firstTabbableNode:W.firstDomTabbableNode}else xr(O)||(z=X.nextTabbableNode(E))}}else z=c("fallbackFocus");return z},D=function(w){var E=Xr(w);if(!(u(E,w)>=0)){if(lr(i.clickOutsideDeactivates,w)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}lr(i.allowOutsideClick,w)||w.preventDefault()}},x=function(w){var E=Xr(w),O=u(E,w)>=0;if(O||E instanceof Document)O&&(s.mostRecentlyFocusedNode=E);else{w.stopImmediatePropagation();var j,q=!0;if(s.mostRecentlyFocusedNode)if(Jt(s.mostRecentlyFocusedNode)>0){var z=u(s.mostRecentlyFocusedNode),re=s.containerGroups[z].tabbableNodes;if(re.length>0){var X=re.findIndex(function(v){return v===s.mostRecentlyFocusedNode});X>=0&&(i.isKeyForward(s.recentNavEvent)?X+1<re.length&&(j=re[X+1],q=!1):X-1>=0&&(j=re[X-1],q=!1))}}else s.containerGroups.some(function(v){return v.tabbableNodes.some(function(H){return Jt(H)>0})})||(q=!1);else q=!1;q&&(j=y({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(j||s.mostRecentlyFocusedNode||h())}s.recentNavEvent=void 0},A=function(w){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=w;var O=y({event:w,isBackward:E});O&&(xr(w)&&w.preventDefault(),g(O))},_=function(w){if(wx(w)&&lr(i.escapeDeactivates,w)!==!1){w.preventDefault(),o.deactivate();return}(i.isKeyForward(w)||i.isKeyBackward(w))&&A(w,i.isKeyBackward(w))},k=function(w){var E=Xr(w);u(E,w)>=0||lr(i.clickOutsideDeactivates,w)||lr(i.allowOutsideClick,w)||(w.preventDefault(),w.stopImmediatePropagation())},F=function(){if(s.active)return rc.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?ac(function(){g(h())}):g(h()),r.addEventListener("focusin",x,!0),r.addEventListener("mousedown",D,{capture:!0,passive:!1}),r.addEventListener("touchstart",D,{capture:!0,passive:!1}),r.addEventListener("click",k,{capture:!0,passive:!1}),r.addEventListener("keydown",_,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",x,!0),r.removeEventListener("mousedown",D,!0),r.removeEventListener("touchstart",D,!0),r.removeEventListener("click",k,!0),r.removeEventListener("keydown",_,!0),o},$=function(w){var E=w.some(function(O){var j=Array.from(O.removedNodes);return j.some(function(q){return q===s.mostRecentlyFocusedNode})});E&&g(h())},R=typeof window<"u"&&"MutationObserver"in window?new MutationObserver($):void 0,I=function(){R&&(R.disconnect(),s.active&&!s.paused&&s.containers.map(function(w){R.observe(w,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(w){if(s.active)return this;var E=l(w,"onActivate"),O=l(w,"onPostActivate"),j=l(w,"checkCanFocusTrap");j||m(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,E==null||E();var q=function(){j&&m(),F(),I(),O==null||O()};return j?(j(s.containers.concat()).then(q,q),this):(q(),this)},deactivate:function(w){if(!s.active)return this;var E=nc({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},w);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,I(),rc.deactivateTrap(a,o);var O=l(E,"onDeactivate"),j=l(E,"onPostDeactivate"),q=l(E,"checkCanReturnFocus"),z=l(E,"returnFocus","returnFocusOnDeactivate");O==null||O();var re=function(){ac(function(){z&&g(f(s.nodeFocusedBeforeActivation)),j==null||j()})};return z&&q?(q(f(s.nodeFocusedBeforeActivation)).then(re,re),this):(re(),this)},pause:function(w){if(s.paused||!s.active)return this;var E=l(w,"onPause"),O=l(w,"onPostPause");return s.paused=!0,E==null||E(),S(),I(),O==null||O(),this},unpause:function(w){if(!s.paused||!s.active)return this;var E=l(w,"onUnpause"),O=l(w,"onPostUnpause");return s.paused=!1,E==null||E(),m(),F(),I(),O==null||O(),this},updateContainerElements:function(w){var E=[].concat(w).filter(Boolean);return s.containers=E.map(function(O){return typeof O=="string"?r.querySelector(O):O}),s.active&&m(),I(),this}},o.updateContainerElements(t),o};const Ax=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Bx},Symbol.toStringTag,{value:"Module"})),Fx=Dc(Ax),Tx=Dc(bx);function Gn(e){"@babel/helpers - typeof";return Gn=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},Gn(e)}function Sx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sc(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,Rf(r.key),r)}}function jx(e,t,n){return t&&sc(e.prototype,t),n&&sc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ox(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Os(e,t)}function Os(e,t){return Os=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Os(e,t)}function Px(e){var t=Rx();return function(){var r=Sa(e),a;if(t){var i=Sa(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return Nx(this,a)}}function Nx(e,t){if(t&&(Gn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return pr(e)}function pr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rx(){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 Sa(e){return Sa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Sa(e)}function Mx(e,t,n){return t=Rf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rf(e){var t=Ix(e,"string");return Gn(t)==="symbol"?t:String(t)}function Ix(e,t){if(Gn(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Gn(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ea=C,be=nx,$x=Fx,Lx=$x.createFocusTrap,zx=Tx,qx=zx.isFocusable,bo=function(e){Ox(n,e);var t=Px(n);function n(r){var a;Sx(this,n),a=t.call(this,r),Mx(pr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var c=arguments.length,h=new Array(c>1?c-1:0),m=1;m<c;m++)h[m-1]=arguments[m];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 p=u;if(typeof u=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),a.handleDeactivate=a.handleDeactivate.bind(pr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(pr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(pr(a)),a.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:a.handleDeactivate,onPostDeactivate:a.handlePostDeactivate,clickOutsideDeactivates:a.handleClickOutsideDeactivates},a.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){a.originalOptions[s]=i[s];continue}a.internalOptions[s]=i[s]}return a.outsideClick=null,a.focusTrapElements=r.containerElements||[],a.updatePreviousElement(),a}return jx(n,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var a=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return a||(a===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var a=this.getDocument();a&&(this.previouslyFocusedElement=a.activeElement)}},{key:"deactivateTrap",value:function(){!this.focusTrap||!this.focusTrap.active||this.focusTrap.deactivate({returnFocus:!1,checkCanReturnFocus:null,onDeactivate:this.originalOptions.onDeactivate})}},{key:"handleClickOutsideDeactivates",value:function(a){var i=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,a):this.originalOptions.clickOutsideDeactivates;return i&&(this.outsideClick={target:a.target,allowDeactivation:i}),i}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var a=this,i=function(){var o=a.getReturnFocusNode(),l=!!(a.originalOptions.returnFocusOnDeactivate&&o!==null&&o!==void 0&&o.focus&&(!a.outsideClick||a.outsideClick.allowDeactivation&&!qx(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,c=u===void 0?!1:u;l&&o.focus({preventScroll:c}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?ea.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===ea.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var c=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=c||[u]},o=ea.cloneElement(i,{ref:s});return o}return null}}]),n}(ea.Component),cr=typeof Element>"u"?Function:Element;bo.propTypes={active:be.bool,paused:be.bool,focusTrapOptions:be.shape({document:be.object,onActivate:be.func,onPostActivate:be.func,checkCanFocusTrap:be.func,onPause:be.func,onPostPause:be.func,onUnpause:be.func,onPostUnpause:be.func,onDeactivate:be.func,onPostDeactivate:be.func,checkCanReturnFocus:be.func,initialFocus:be.oneOfType([be.instanceOf(cr),be.string,be.bool,be.func]),fallbackFocus:be.oneOfType([be.instanceOf(cr),be.string,be.func]),escapeDeactivates:be.oneOfType([be.bool,be.func]),clickOutsideDeactivates:be.oneOfType([be.bool,be.func]),returnFocusOnDeactivate:be.bool,setReturnFocus:be.oneOfType([be.instanceOf(cr),be.string,be.bool,be.func]),allowOutsideClick:be.oneOfType([be.bool,be.func]),preventScroll:be.bool,tabbableOptions:be.shape({displayCheck:be.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:be.oneOfType([be.bool,be.func])}),trapStack:be.array,isKeyForward:be.func,isKeyBackward:be.func}),containerElements:be.arrayOf(be.instanceOf(cr)),children:be.oneOfType([be.element,be.instanceOf(cr)])};bo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:Lx};var Wx=bo;const Hx=wn(Wx),Mf=({showDevTools:e=!0,children:t})=>{const n=new Ke.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return d.jsxs(Ke.QueryClientProvider,{client:n,children:[t,e&&d.jsx(Dh.ReactQueryDevtools,{initialIsOpen:!1})]})};var Ux=C.createContext({client:sa});function Vx(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=C.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(sa.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),sa.init(r,a)),sa)},[n,r]);return C.createElement(Ux.Provider,{value:{client:i}},t)}const If=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(Vx,{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}):d.jsx(d.Fragment,{children:e}),$f=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Ih[r],...n||{}};return d.jsx(ue.IntlProvider,{locale:r,messages:a,children:e})},yo=C.createContext({}),ga={en:"English",es:"Español",fr:"Français",pt:"Português"},Mt=C.createContext({isLoading:!0});function Ga(){return C.useContext(Mt)}const Lf=({children:e,user:t})=>d.jsx(Mt.Provider,{value:t,children:e}),Do=C.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),zf=()=>C.useContext(Do),qf=({children:e})=>{const[t,n]=C.useState([]);C.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=C.useCallback(i=>{n(s=>[...s,i])},[]),a=C.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return d.jsx(Do.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Kx=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=C.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=C.useState(s),u=c=>{localStorage.setItem("language",c),l(c)};return C.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),Nc(5e3)}).catch(c=>{c.message===Sc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(yo.Provider,{value:{language:o,updateLanguage:u},children:d.jsx($f,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(Ps.CookiesProvider,{children:d.jsx(Lf,{user:a,children:d.jsx(qf,{children:d.jsx(Mf,{showDevTools:r,children:d.jsx(If,{user:a,children:t})})})})})})})};const Co=({element:e="section",children:t,className:n,...r})=>C.createElement(e,{className:Y("modal",n),children:typeof t=="string"?d.jsx("p",{children:t}):t,...r});const Nr=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:c="",gtmContext:h="Modal"})=>{const m=ue.useIntl(),{registerOverlay:p,unregisterOverlay:g}=zf(),[f,y]=C.useState(t),D=_=>{_.key==="Escape"&&x(!1)};C.useEffect(()=>(window.addEventListener("keyup",D),()=>{window.removeEventListener("keyup",D)}));const x=_=>{y(_),_?(a(),p(e)):(i(),g(e))};C.useEffect(()=>(x(t),()=>{f&&g(e)}),[t]);const A=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{className:Y("overlay",{open:f}),role:"dialog",children:d.jsx(Co,{id:e,className:Y("overlay-modal",c,{"has-max-width":r}),hidden:!f,style:A,children:t&&d.jsx(Hx,{children:d.jsxs("div",{className:"overlay-content",children:[d.jsxs("div",{className:"top",children:[o&&d.jsx("h2",{className:"modal-title",children:o}),d.jsx(Be,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>x(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":h,screenreaderText:m.formatMessage({id:"overlay_close"})})]}),n&&d.jsx(tn,{}),l,u&&d.jsxs("div",{className:"bottom",children:[d.jsx(tn,{}),d.jsx(kn,{buttons:u})]}),s&&d.jsx(Er,{className:"error",children:s})]})})})})},Wf=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Zx=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const c=ue.useIntl();return r||(r=c.formatMessage({id:"inviteModal_formTitle"})),a||(a=c.formatMessage({id:"inviteModal_formLabel"})),i||(i=c.formatMessage({id:"inviteModal_cta"})),d.jsx(Nr,{title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:Y("invite-modal",e,{success:!!n}),children:d.jsx(Ef,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const Yx=({members:e})=>{const[t,n]=C.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return d.jsxs(d.Fragment,{children:[d.jsx(sn,{name:i,src:l}),d.jsx("p",{children:i}),d.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return d.jsxs("div",{className:"directory-wrapper",children:[d.jsx("ul",{className:"directory",children:e.map(a=>d.jsx("li",{children:d.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),d.jsx(Nr,{isOpen:t!==!1,children:t===!1?"":d.jsxs(d.Fragment,{children:[r(t),d.jsx(Vn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const Gx=({author:e,authorCite:t,content:n,member:r,className:a=""})=>d.jsxs("blockquote",{className:Y("testimonial-block",a),children:[d.jsx(Pt,{className:"testimonial",children:n}),r?d.jsx(tr,{member:r,styling:{size:"large"}}):d.jsxs(d.Fragment,{children:[e&&d.jsx("p",{className:Y("author",{"text-small":!a.includes("new")}),children:e}),t&&d.jsx("p",{className:Y("author-cite",{"text-small":!a.includes("new")}),children:d.jsx("cite",{children:t})})]})]}),Qx=C.memo(Gx);const Jx=({items:e=[],selector:t="",className:n=""})=>{const r=ue.useIntl(),[a,i]=C.useState(e);return C.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,c)=>{s+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&d.jsxs(Nt,{variant:"subtle",className:Y("table-of-contents",n),children:[d.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),d.jsx("nav",{children:d.jsx("ul",{children:a.map(({id:s,text:o})=>d.jsx("li",{children:d.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Qa=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ue.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=c=>{const h=c/60,m=Math.floor(h),p=(h-m)*60,g=Math.round(p),f=`${i.formatMessage({id:`${s}hours`},{time:m})}${m>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${m>0?`${i.formatMessage({id:`${s}hours_short`},{time:m})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:c,ariaText:h}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:c}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:h})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),d.jsx("span",{className:Y("time-to-complete",a),"aria-label":u,children:l})};const Xx=({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",d.jsx(er,{...n,className:Y("banner",e),image:{...t,aspect:"banner"}})):null;const ln=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return d.jsx("section",{className:Y("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const ew=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),d.jsx(ln,{className:Y("download-section",n),children:d.jsxs("div",{className:"content-default",children:[C.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),d.jsx(kn,{buttons:r})]})})};function Hf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const tw=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ue.useIntl();return d.jsxs("div",{className:Y("edit-section-placeholder",{"has-icon":!!e}),style:Oc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(Be,{href:r,variant:"secondary",size:"small",onClick:()=>Hf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},nw=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=C.useState(!1),c=typeof r=="string"||!!n,h=()=>u(!1);return d.jsxs("section",{className:Y("edit-section",t),children:[n&&d.jsx(Nr,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:h},className:Y("edit-section-modal"),children:d.jsx(nr,{...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 m=>{var p,g;(p=n==null?void 0:n.functions)!=null&&p.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(m)),u(!1)},onCancel:h}})}),d.jsxs("div",{className:"edit-section-header",children:[d.jsx("h2",{className:"edit-section-header-title",children:a}),c&&d.jsx(Be,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Hf({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(tw,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(tn,{})]})};const rw=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return d.jsxs("div",{className:Y("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&C.createElement(s.element,{className:Y("title",s.className)},s.text),t&&d.jsx("p",{children:t}),d.jsx("ul",{className:Y({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:c,nameOfBusiness:h,link:m=!1,description:p=!1},g)=>{if(!c||!c.url)return null;const f=d.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:h});return d.jsxs("li",{children:[d.jsx("p",{className:"img-wrapper",children:m?d.jsx("a",{href:m,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),p&&d.jsx("small",{children:p})]},window.btoa(`${c.url}_${g}`))})})]})};const aw=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],iw=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],h={eyebrow:"small",title:"h1",text:"p"},m={};c.forEach(y=>{if(!t[y]){m[y]=!1;return}if(!s[y]){if(typeof t[y]=="object"){m[y]=t[y];const{text:D,element:x}=t[y];if(x&&aw.includes(x.toLowerCase()))return;m[y]={text:D,element:h[y]};return}m[y]={text:t[y],element:h[y]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=y=>{y.preventDefault(),y.stopPropagation();const D=document.getElementById(o.link.substring(1));D&&D.scrollIntoView({behavior:"smooth"})}),d.jsx(ln,{className:Y("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&a==="normal"&&m.eyebrow&&m.title}),children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"content-wrapper",children:[c.map(y=>{if(m[y]&&typeof m[y]=="object"){const{text:D,element:x=""}=m[y];return y==="text"?d.jsx(Vn,{overrideType:"text-only",className:"text",children:D},y):C.createElement(x,{key:y,className:y},D)}return null}),l,p&&d.jsx(Be,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:Y({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&d.jsx(er,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},sw=C.memo(iw);const ow=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),d.jsx(ln,{className:Y("custom-content-banner",t,r,{"has-image":e}),style:a,children:d.jsx("div",{className:"content-slim",children:n})})};const uw=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx(Vn,{children:n}):n;return d.jsxs(ln,{className:Y("highlight-section",t),children:[r&&d.jsx("div",{className:Y("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:d.jsx(er,{image:r})}),d.jsx("div",{className:Y("highlight-container highlight-content-wrapper",{"no-image":!r}),children:d.jsx("div",{className:Y("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:d.jsx("div",{className:"content-default",children:a})})})]})},lw=C.memo(uw);const cw=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:d.jsxs("aside",{className:Y("marketing-block",e),children:[n&&d.jsx("p",{className:"title",children:n}),r&&d.jsx("p",{children:r}),t&&d.jsx(Be,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),dw=({type:e,data:t})=>{const n=ue.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const h=a&&as(a);return d.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&d.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(c&&!i||s)return d.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):Ms(c)});if(o)return d.jsx(hn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&as(u);return d.jsxs("ul",{className:"details",children:[l&&d.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&d.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},ja={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"}},fw=({data:e,cta:t,link:n,gtmContext:r})=>{var f,y;const a=ue.useIntl(),[i,s]=C.useState({loading:!1,registered:e.registered||!1});C.useEffect(()=>{e.registered&&s(D=>({...D,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:c,slug:h}=e,m=e.contentType;let p="";if((f=ja[m])!=null&&f.gtmEvent&&(p=ja[m].gtmEvent),l&&u)return n?d.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(m==="people")return n?d.jsx(Be,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(m)&&c!=="premium"){const D=i.loading||i.registered||((y=e==null?void 0:e.members)==null?void 0:y.isMember),x=async A=>{if(A.preventDefault(),A.stopPropagation(),!(D||!t||!t.onClick)){s(_=>({..._,loading:!0}));try{const _=await t.onClick(e);s(_==="success"?()=>({registered:!0,loading:!1}):k=>({...k,loading:!1}))}catch{s(k=>({...k,loading:!1}))}}};return d.jsx("p",{className:Y("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:d.jsx(Be,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:D,"data-gtm-event-context":`${r}Page-${m}: ${h}`,"data-gtm-event-type":`${r}-${m}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${m}${D?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const hw={title:66,text:3e3,secondaryText:1e3,partner:25},xo=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s,setFocus:o=!1})=>{var M,w,E,O,j;const l=ue.useIntl(),u=C.useContext(Mt),c=u&&typeof u.id=="string",h=C.useRef(null),[m,p]=C.useState({data:null,isLoading:!0}),{data:g,isLoading:f}=m,y=C.useCallback(()=>{n(t,c).then(q=>{p(()=>({data:q,isLoading:!1}))}).catch(()=>p(q=>({...q,isLoading:!1})))},[e]);if(C.useEffect(()=>{y()},[]),f||!g)return d.jsx(wt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:l.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:D}=g;if(!D||!ja[D])return d.jsx(wt,{element:"li",className:"card-wrapper"});const{basePath:x="",className:A,length:_,gtmEvent:k}=ja[D];let F=g.slug?`${x}${g.slug}`:!1;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")&&(F=g.slug);const S=q=>{F&&(q.preventDefault(),q.stopPropagation(),window.location.href=F)},$={...hw,..._};let R={className:"card"},I={};return F&&(I={href:F,className:"gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${k}-click`,"data-testid":"link"},g.openInNewTab&&(I.target="_blank"),R={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${k}-click`}),o&&(R={...R,tabIndex:"0"},(M=h==null?void 0:h.current)==null||M.focus(),(w=h==null?void 0:h.current)==null||w.scrollIntoView({behavior:"smooth"})),d.jsx("li",{className:Y("card-wrapper text-medium",A,i,{"has-link":F,"no-link":!F,"has-image":g.banner}),"data-testid":`${D}-card`,children:d.jsxs("div",{...R,ref:h,children:[d.jsx($c,{className:"card-label",contentType:D,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),D==="communityPage"&&(g==null?void 0:g.createdAt)&&jh(g==null?void 0:g.createdAt,60)&&d.jsx(hn,{size:"small",variant:"information","data-testid":"new-community",children:l.formatMessage({id:"card_new"})}),g.startDate&&!g.isOngoingEvent&&d.jsx(hn,{size:"small",variant:g.dateHasPassed?"default":"information","data-testid":"date",children:g.dateHasPassed?l.formatMessage({id:"card_ended"}):Pc(g.startDate)}),g.banner?d.jsxs("p",{className:"img",children:[g.registered&&d.jsx(hn,{size:"small",variant:"registered",children:l.formatMessage({id:"card_registered"})}),d.jsx(er,{image:{...g.banner,description:""}})]}):A==="people"?d.jsx(sn,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&d.jsx(qs,{contributors:{data:g.contributors},styling:{size:"small",showGap:A!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(D)?l.formatMessage({id:`card_contributors_${D}`}):void 0,"data-testid":"contributors"}),g.partner&&d.jsx("p",{className:"partners","data-testid":"partners",children:g.partner.length>1?l.formatMessage({id:"card_partner"},{partner:g.partner[0],number:g.partner.length-1}):Hn(g.partner[0],$.partner)}),["title","text","secondaryText"].map(q=>{const z=g[q];if(!z)return null;const re=Ac(q),X={key:q,className:re,"data-testid":re},v={wrapper:"p",forceWrapper:!0,forceInline:!0},H=Hn(z,$[q]);return["title","text"].includes(q)&&F?(v.wrapper="a",d.jsx("p",{...X,children:d.jsx(Pt,{options:v,...I,children:H})})):d.jsx(Pt,{options:v,...X,children:H})}),(u==null?void 0:u.id)&&(g==null?void 0:g.members)&&d.jsxs("span",{className:"member-information",children:[((E=g==null?void 0:g.members)==null?void 0:E.isMember)&&d.jsx(hn,{size:"small",variant:"registered",icon:((O=g==null?void 0:g.members)==null?void 0:O.memberType)==="owner"?"user":"tick",children:l.formatMessage({id:`card_member_type_${(j=g==null?void 0:g.members)==null?void 0:j.memberType}`})}),d.jsx("br",{}),d.jsx("span",{className:"label member-count",children:l.formatMessage({id:"card_member_count"},{count:g==null?void 0:g.members.count})})]}),d.jsx(dw,{type:A||"",data:g}),d.jsx(fw,{data:g,cta:r,link:F||"",gtmContext:a})]})})};const Uf=({cards:e,cardTypes:t,className:n="",...r})=>d.jsx("ul",{className:Y("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return d.jsx(xo,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),mw=(e,t,n,r)=>{const a=t*n<=e,i=e<t*(n+1),s=r.includes(Math.floor(e/t));return a&&i||s},pw=({id:e,title:t})=>{const n=ue.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return C.createElement(a,{className:Y("title",i,s,{"highlighted-title":i==="highlighted"}),children:d.jsxs(d.Fragment,{children:[r,o&&d.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 Li={fourCards:1024,threeCards:769,twoCards:480};let ta=null;const gw=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ue.useIntl(),[u,c]=C.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:h,isLoading:m}=u,[p,g]=C.useState({currentPage:0,loadedPages:[0]}),{currentPage:f,loadedPages:y}=p,[D,x]=C.useState(""),A=t.length,_=Math.ceil(A/h),k=C.useRef(null),F=Jn(!0,!0,k==null?void 0:k.current);C.useEffect(()=>{let w=1;F&&(F>=Li.fourCards?w=4:F>=Li.threeCards?w=3:F>=Li.twoCards&&(w=2),w>A&&(w=A)),c(E=>({...E,cardsPerPage:w,isLoading:!1}))},[F,A]);const S=(w="next")=>{let E=f;if(typeof w=="string")if(w==="next")if(f<_-1)E=f+1;else return;else if(f>0)E=f-1;else return;else E=w;g(j=>({...j,currentPage:E,loadedPages:[...new Set([...y,E])]}));const O=()=>{const j=E*u.cardsPerPage,q=j+u.cardsPerPage;return t.slice(j,q).length};x(l.formatMessage({id:"carousel_pagination_aria_live"},{direction:w,count:O()}))},$=w=>{ta=w.touches[0].clientX},R=w=>{if(ta===null)return;const E=w.touches[0].clientX,O=ta-E;O>5?S("next"):O<-5&&S("previous"),ta=null},I={"--width":`${F||0}px`,"--total-cards":A,"--cards-per-page":h,"--page":f};if(m)return d.jsx(Ls,{layout:`carousel${a?"-with-title":""}`});const M=(w,E)=>{var j;let O=null;return(j=w==null?void 0:w.sys)!=null&&j.id?O=`card-${w.sys.id}`:w!=null&&w.slug?O=`card-${w.slug}`:[n[E],w.contentType].includes("customCard")&&(O=`card-${window.btoa(`${w.title} ${w.createdAt}`)}-${E}`),O};return d.jsxs("section",{ref:k,className:Y("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx(pw,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:$,onTouchMove:R,style:I,"data-testid":"carousel-list",children:t.map((w,E)=>{let O=M(w,E);return O&&mw(E,h,f,y)?d.jsx(xo,{id:O,card:{...w,contentType:n[E]},buildCardData:r,gtmContext:s,...o},O):(O=O||`${e}-card-${E}`,d.jsx(wt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},O))})}),_<=1?null:d.jsxs(d.Fragment,{children:[d.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[d.jsx("li",{className:"arrow previous",children:d.jsx(Be,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:w=>{w.preventDefault(),w.stopPropagation(),S("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:f<=0})}),[...Array(_)].map((w,E)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:Y("page-indicator",{selected:E===f}),onClick:O=>{O.preventDefault(),O.stopPropagation(),S(E)},children:d.jsx(Me,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:E+1,total:_})})})},`page-indicator-${E}`)),d.jsx("li",{className:"arrow next",children:d.jsx(Be,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:w=>{w.preventDefault(),w.stopPropagation(),S("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:f>=_-1})})]}),d.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:D})]})]})},vw=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const c=i?window.btoa(i):`carousel-${u}`,h=u===e.length-1;return t?d.jsxs(C.Fragment,{children:[d.jsx(Ls,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:d.jsx(tn,{})]},`placeholder-${c}`):d.jsxs(C.Fragment,{children:[d.jsx(gw,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),h?null:d.jsx(tn,{})]},`carousel-${c}`)});const dr="joinCommunityButton",wo=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ue.useIntl(),o=C.useContext(Mt),l=o&&typeof o.id=="string",u=r||!l,[c,h]=C.useState(e),[m,p]=C.useState(e?"joined":"notJoined");C.useEffect(()=>{m==="joining"?p("joined"):m==="leaving"&&p("notJoined")},[c]);const g={},f={};return c&&m!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${dr}_leave`}),g["aria-label"]=s.formatMessage({id:`${dr}_member_aria`}),f["aria-hidden"]="true"),d.jsx(Be,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&m!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!c?s.formatMessage({id:`${dr}_closed_tooltip`}):"",onClick:async y=>{if(u)return;y.currentTarget.blur(),p(c?"leaving":"joining");const D=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${dr}_aria_live`},{action:c?"leaving":"joining"})}});document.dispatchEvent(D);const x=c?i:a;typeof x=="function"&&setTimeout(async()=>{await x()},500),h(!c)},className:Y("join-community-button",m,{active:m==="joining"}),disabled:u,"data-testid":"join-button",...g,children:d.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${dr}${["joining","leaving"].includes(m)?`_${m}`:c?"_member":n?"_short":""}`})})})};const zi="communityDetails_",bw=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=ue.useIntl(),u=5,c=a||i.length,h=i.length?i:Array(u).fill({}),m=`/communities/${r}/members`===window.location.pathname,p=t||n,g=!n&&!t;return d.jsxs("div",{className:Y("community-details",e),children:[p&&d.jsxs("div",{className:"member-details",children:[d.jsxs("div",{className:"top",children:[d.jsxs("h4",{children:[l.formatMessage({id:`${zi}members`}),d.jsx("span",{className:"count",children:c})]}),!m&&d.jsx("p",{className:"text-small",children:d.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${zi}viewAll`})})})]}),d.jsx(qs,{contributors:{total:a,data:h},styling:{size:"medium",showGap:!0,showPlaceholders:c===0},cutoff:u})]}),d.jsx(wo,{isMember:t,isOpen:n,disabled:g,functions:{...o}}),t&&d.jsx(Be,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${zi}invite`})})]})};const yw=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Me,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),d.jsx("ul",{className:Y("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),d.jsxs("li",{children:[s&&d.jsx(Me,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),d.jsx(_n,{href:s?void 0:i,...l,children:Hn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Dw=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=ue.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=C.useState(t?["all"]:[]),u=(c,h)=>{let m=[];o.includes(c)?m=o.filter(p=>p!==c):c==="all"?m=["all"]:n?m=[...o.filter(p=>p!=="all"),c]:m=[c],l(p=>(r&&typeof r=="function"&&r({current:m,previous:p}),m)),h&&typeof h=="function"&&h()};return d.jsx("ul",{className:Y("filters",a),children:s.map(({id:c,text:h,disabled:m=!1,callback:p=()=>{}})=>{let g={};return m&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:h})}),d.jsx("li",{children:d.jsx("button",{className:Y(c,{selected:o.includes(c)}),onClick:f=>{f.preventDefault(),f.stopPropagation(),u(c,p)},...g,children:h})},c)})})},Cw=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let a="",i=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(a+=`/${s}`,i=!0):(a.includes(`/${r}/`)||(a+=`/${r}`),a+=`/${s}`)}),a.includes(`/${r}/`)||(a+=`/${r}`),t&&(a+=`/${t}`),i?{url:a,urlForRouter:`/${a.split("/").slice(2).join("/")}`}:a};const na="languageSwitcher_",xw=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ue.useIntl(),{updateLanguage:c=()=>{}}=C.useContext(yo),[h,m]=C.useState(e);if(C.useEffect(()=>{e!==h&&m(e)},[e]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const g=Object.keys(r),f=h!==e;return d.jsxs("div",{className:Y("language-switcher text-small",s,l),children:[d.jsxs("nav",{children:[s!=="short"&&d.jsx("p",{children:o||u.formatMessage({id:`${na}label`})}),d.jsx("ul",{children:g.map(y=>{var A;if(!ga[y])return null;const D=(A=r[y])==null?void 0:A.post_name;let x={className:y};if(h===y)x["aria-label"]=u.formatMessage({id:`${na}selected`},{language:ga[y]});else{const _=Cw(y,D,i);x={...x,href:typeof _=="string"?_:_.url,onClick:k=>{m(y),c(y),typeof a<"u"&&(k.preventDefault(),k.stopPropagation(),a(y,typeof _=="string"?_:_.urlForRouter))}}}return d.jsx("li",{children:d.jsx(_n,{...x,fallbackElement:"span",children:ga[y]})},y)})}),s!=="short"&&!f&&d.jsx("p",{children:u.formatMessage({id:`${na}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${na}disclaimer`},{email:Nn.support,link:y=>{const D=`mailto:${y}`;return d.jsx("a",{href:D,children:y})}})})]})};const qi=ue.createIntl({locale:"en",messages:Xn}),Rr=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:a="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:qi.formatMessage({id:"loadMore_button"}),endOfFeed:qi.formatMessage({id:"loadMore_endOfFeed"}),error:qi.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,h]=C.useState(""),m=async p=>{if(!n)try{await t(p)}catch(g){g instanceof Error?h(g.message):h("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:d.jsx("footer",{className:Y("load-more",l),children:!c&&e?d.jsx(Be,{variant:r,size:a,styling:i,icon:s,onClick:m,"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&&(!c||c!=null&&c.includes("Cannot read items"))?d.jsx("p",{children:o.endOfFeed}):c&&d.jsx("p",{className:"error",children:o.error})})};const Eo=({variant:e="default",version:t="default",className:n="",...r})=>d.jsx("p",{className:"logo-wrapper",children:d.jsx("a",{href:"/home/",className:Y("logo",e,t,n),...r,children:d.jsx(Me,{children:d.jsx(ue.FormattedMessage,{id:"apolitical"})})})});let ra=!1;const Vf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ue.useIntl(),i=C.useRef(null),[s,o]=C.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return C.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),C.createElement(e,{ref:i,className:Y("more-menu text-medium",r),children:d.jsxs(d.Fragment,{children:[d.jsx(Be,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),d.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:c,text:h,icon:m,...p},g)=>{const f={...p,onClick:y=>{o(!1),typeof c=="function"&&c(y)},onFocus:()=>{ra&&(clearTimeout(ra),ra=!1)},onBlur:()=>{ra=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),d.jsx("li",{className:"more-menu-list-item",children:d.jsx(Be,{variant:"tertiary",size:"medium",icon:m?{icon:m,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${g}`)})})]})})},ww=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Ew=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Kf=({activeLink:e})=>{const t=ue.useIntl(),n=C.useContext(Mt),r=n&&typeof n.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Ew.map(({key:a,href:i})=>{const s=ww(i,e),o={};return s&&(o["aria-current"]="page"),d.jsx("li",{className:Y(a,{active:s}),children:d.jsx("a",{href:i,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...o,children:t.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),r&&d.jsx("li",{className:"profile","data-testid":"profile-link",children:d.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[d.jsx(sn,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),d.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},fr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,kw=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${fr(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(`${fr(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(`${fr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
158
158
 
159
- ${fr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:fr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const _w="shareLinks_",Bw=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ue.useIntl(),l=kw({title:e,link:t,referrer:n});return d.jsxs("aside",{className:Y("share-links",a,i,s),children:[d.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),d.jsx("ul",{children:l.map(({key:u,icon:c,url:h,shouldRender:m=!0,onClick:p})=>{if(typeof m=="function"&&!m())return null;const g={};return p&&(g.onClick=f=>p(f,h)),d.jsx("li",{children:d.jsx(Be,{size:a,variant:"tertiary",icon:{icon:c||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:`${_w}link_${u}`}),...g})},u)})})]})};const Aw=({tabs:e,className:t="",preventLocationChange:n})=>{var u;const r=(c,h,m)=>(c||(c=`panel-${window.btoa(h)}-${m}`),c);let a=e.findIndex(c=>c.current===!0);if(a<0&&(a=0),window.location.hash){const c=window.location.hash.replace("#","");if(e.find(m=>m.id===c)){for(let m=0;m<e.length;m++)if(r(e[m].id,e[m].text,m)===c){a=m;break}}}const[i,s]=C.useState((u=e[a])!=null&&u.id?e[a].id:r(e[a].id,e[a].text,a));C.useEffect(()=>{if(e[a].hasCarousel){const c=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(c)}},[i]);const o=[],l=[];return e.forEach(({id:c,text:h,content:m,href:p,hasCarousel:g},f)=>{c=r(c,h,f);const D=i===c,y={};p||(y["aria-controls"]=c,y.onClick=w=>{w.preventDefault(),w.stopPropagation(),s(c),!n&&(window.location.hash=`#${c}`)},l.push(d.jsx("section",{id:c,hidden:!D,role:"tabpanel","aria-labelledby":`tab-${c}`,"aria-live":D?"assertive":"off",children:typeof m=="string"?d.jsx("p",{children:m}):m},`section-${c}`))),o.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:p||`#${c}`,id:`tab-${c}`,className:Y({selected:D}),role:"tab","aria-selected":D,...y,children:h})},`tab-${c}`))}),d.jsxs("div",{className:Y("tabs-wrapper",t),children:[d.jsx("ul",{className:"tabs",role:"tablist",children:o}),d.jsx("div",{className:"tab-content",children:l})]})};const Fw={"2-1":901,"1-3":769,"1-1":769},Zf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Xn(!0);let s=a;return C.Children.count(a)===1&&(s=C.Children.toArray(a)[0],s.props&&(s=s.props.children)),d.jsx("section",{className:Y("columns",`layout-${e}`,r,{"has-containers":n}),children:C.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Fw[e]?null:o)})};let Wi;const Hi="contactFooter_",Tw=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=C.useRef(null),[r,a]=C.useState(0),[i,s]=C.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(Wi),Wi=setTimeout(()=>{o(),s(!1)},500))};return C.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(Wi),window.removeEventListener("resize",l)}),[]),d.jsx(ln,{id:"contactForm",className:"contact-footer",children:d.jsxs("div",{className:"inner-wrapper",children:[d.jsx("h2",{children:d.jsx(ue.FormattedMessage,{id:`${Hi}title`})}),d.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[d.jsxs("aside",{children:[d.jsx("p",{children:d.jsx(ue.FormattedMessage,{id:`${Hi}text`})}),d.jsx(_n,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(ue.FormattedMessage,{id:`${Hi}email`})})]}),d.jsx(wf,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Sw=({activeLink:e,...t})=>d.jsx(ln,{children:d.jsx(Zf,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(Kf,{activeLink:e}),d.jsx(Wc,{...t})]})})});const Ui="cookieBanner_",Vi=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Ki=new Date(Date.now()+12*30*24*60*60*1e3),Yf=()=>{const e=ue.useIntl(),[t,n,r]=Ps.useCookies(Vi),[a,i]=C.useState(!t["apol-cookie-banner"]),s=()=>{Vi.forEach(c=>{n(c,!0,{path:"/",expires:Ki,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Ki}),Vi.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:Ki});return}r(c)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(c=>{u.push({variant:c.href?"tertiary":"primary",href:c.href,onClick:c.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${c.gtmType}-click`,children:e.formatMessage({id:`${Ui}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${Ui}title`})}),d.jsx("p",{children:e.formatMessage({id:`${Ui}text`})}),d.jsx(kn,{buttons:u})]})},qt={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","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-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:Rn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Rn["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:Rn.support,gtmType:"concierge-email-click"},business:{email:Rn.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 qn="footer_",Oa="SiteFooter",oc=({group:e})=>{const t=qt[e].order||[];let n=!1;return"text"in qt[e]&&(n=qt[e].text),d.jsxs(C.Fragment,{children:[d.jsx("p",{className:"pre-title",children:d.jsx(ue.FormattedMessage,{id:`${qn}${e}`})}),Array.isArray(t)&&t.length>0&&d.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=qt[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),d.jsx("li",{children:d.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":i,...s,children:d.jsx(ue.FormattedMessage,{id:`${qn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&d.jsx("dl",{className:"text-medium",children:n.order.map(r=>d.jsxs(C.Fragment,{children:[d.jsx("dt",{children:d.jsx(ue.FormattedMessage,{id:`${qn}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(ue.FormattedMessage,{id:`${qn}${e}_${r}_address`,values:{br:d.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&d.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},ko=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx($a,{element:"hr"}),d.jsx(Eo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":"logo-homepage-link"}),d.jsx("footer",{children:["platform","community","company","contact"].map(e=>d.jsxs("div",{className:"group",children:[d.jsx(oc,{group:e}),Object.keys(qt[e]).includes("child")&&d.jsx(oc,{group:qt[e].child})]},e))}),d.jsx("hr",{}),d.jsxs("div",{className:"sub-footer",children:[d.jsx("ul",{children:Array.isArray(qt.social.order)&&qt.social.order.map(e=>{const t=qt.social[e];return d.jsx("li",{className:e,children:d.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(ue.FormattedMessage,{id:`${qn}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(ue.FormattedMessage,{id:`${qn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Ne={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e==="account"&&t===!1&&n.navigation===!0)return;const i=Date.now();if(!a&&!t&&Ne.handlerCalled[e]&&i-Ne.handlerCalled[e]<500)return;Ne.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case"navigation":o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation > li.parent"));break;case"search":o=document.querySelector("#header .toggle-search-button");break;case"account":o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=yc(e[r],t);if(!(typeof a>"u")&&(!n||a[t]&&a[t].includes(n)||a.value&&a.value.includes(n)||a.toString().includes(n)))return e[r]}return e[0].children?Ne.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case"navigation":if(n){const u=Ne.findFirstChild(t.current.children,"attributes.aria-controls","navigation");s=Ne.findFirstChild(u.children,"href")}else s=Ne.findFirstChild(t.current.children,"href");break;case"account":if(o=Ne.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Ne.findFirstChild(o.children,"href");break;default:return}s&&(a([{type:`focusElements.${e}.${i}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Ne.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Ne.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Ne.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Ne.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},jr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"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:{order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},Pa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ue.useIntl(),o=yc(jr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,c=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let m=!1;if(o.href){let w=o.gtmType||`${e}-click`;if(w.includes(".")){const A=w.split("."),_=A[A.length-2];w=`${_==="topics"?`${_}-`:""}${A[A.length-1]}`}m={href:o.href},u&&(m={...m,className:"gtm-trackable","data-gtm-event-type":w,"data-gtm-event-context":"HeaderButtons"}),c&&(m={...m,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],g=p&&o[o.order[0]].order,f=m&&window.location.pathname===o.href;let D={},y={};if(f&&(D={...D,"aria-current":"page"}),p){const w=o.menuId||e,A={onClick:_=>Ne.events.onClick(_,{id:w,callback:a,isOpen:r[w]}),onFocus:()=>Ne.events.onFocus({id:w}),onBlur:()=>Ne.events.onBlur({id:w,callback:a}),onMouseLeave:()=>Ne.events.onBlur({id:w,callback:a}),onMouseEnter:()=>Ne.events.onMouseEnter({id:w,callback:a})};n&&(g&&(D={...A,onKeyPress:_=>{_.key==="Enter"&&Ne.events.onClick(_,{id:w,callback:a,isOpen:r[w]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[w],"aria-controls":w}),y={hidden:w in r?!r[w]:!0}),g||(y={...y,...A})}return d.jsxs("li",{className:Y({[o.className]:o.className,"has-submenu":p,parent:g,active:f}),...D,children:[m?C.createElement(c?Be:"a",m,s.formatMessage({id:h})):s.formatMessage({id:h}),o.order&&d.jsx("ul",{...y,children:o.order.map(w=>{if(!o[w])return null;const A={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[w].order?d.jsxs("li",{className:Y({[o[w].className]:o[w].className}),children:[s.formatMessage({id:`${h}_${w}`}),d.jsx("ul",{children:o[w].order.map(_=>d.jsx(Pa,{id:`${e}.${w}.${_}`,...A},_))})]},w):d.jsx(Pa,{id:`${e}.${w}`,...A},w)})})]},e)};const jw={height:67,height_desktop:83},_o=({showNavigation:e=!0})=>{const t=ue.useIntl(),n=C.useContext(Mt),r=Xn(!0,!0),a=n&&typeof n.id=="string",i=C.useMemo(()=>Ne.getIsDesktopVersion(a,r),[a,r]),[s,o]=C.useReducer(Or,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:c}=s,h=C.useRef(s);C.useEffect(()=>{h.current=s},[s]),kc({scrollPosition:jw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const f=h.current.menus;!i&&f.navigation||Ne.shouldChangeHeaderIsVisible(!0,f,o)},scrollDown:()=>{const f=h.current.menus;!i&&f.navigation||Ne.shouldChangeHeaderIsVisible(!1,f,o)}}});const m=(f,D,y=!1)=>{Ne.handleMenus({id:f,value:D,menus:h.current.menus,dispatch:o,forceHandle:y})},p=C.useRef(null),g=f=>{f.key==="Escape"&&["navigation","search","account"].forEach(D=>{h.current.menus[D]&&m(D,!1,!0)})};return C.useEffect(()=>{var f;return(f=document.getElementById("header"))==null||f.addEventListener("keydown",g),()=>{var D;(D=document.getElementById("header"))==null||D.removeEventListener("keydown",g)}},[]),Vn(()=>{u.navigation&&Ne.autoFocus({menu:"navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.navigation]),Vn(()=>{u.account&&Ne.autoFocus({menu:"account",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.account]),n&&n.isLoading?null:d.jsxs(d.Fragment,{children:[d.jsxs("nav",{id:"header",className:Y({"logged-in":a,"logged-out":!a,visible:l}),children:[d.jsx(Me,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),d.jsx(Eo,{variant:"monochrome"}),e&&d.jsxs(d.Fragment,{children:[!i.navigation&&d.jsx("button",{className:"menu-button gtm-trackable",onClick:f=>{f.preventDefault(),f.stopPropagation(),m("navigation",!u.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u.navigation,"aria-controls":"navigation",children:d.jsx(Me,{children:t.formatMessage({id:`header_menu_${u.navigation?"hide":"show"}`})})}),d.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||u.account?!1:!u.navigation,"data-showing":!i.navigation&&u.account?"account":"default",children:jr.order.map(f=>d.jsx(Pa,{id:f,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{navigation:u.navigation,account:u.account},callback:m},f))}),!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:f=>{f.preventDefault(),f.stopPropagation(),m("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:d.jsx(Me,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),d.jsx(kf,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),a?d.jsxs("button",{className:"account-button",onClick:f=>Ne.events.onClick(f,{id:"account",callback:m,isOpen:u.account}),onMouseEnter:()=>Ne.events.onMouseEnter({id:"account",callback:m}),onMouseLeave:()=>Ne.events.onBlur({id:"account",callback:m}),"aria-haspopup":"true","aria-expanded":u.account,"aria-controls":"navigation",children:[d.jsx(Me,{children:t.formatMessage({id:`header_account_${u.account?"hide":"show"}`})}),d.jsx(sn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):d.jsx("ul",{className:"sign-in-buttons",children:jr.buttons.order.map(f=>d.jsx(Pa,{id:`buttons.${f}`},f))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:Y("overlay",{open:u.navigation||u.account||!i.search&&u.search})})]})};const Ow=()=>{const e=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(_o,{}),d.jsx("div",{id:"content",children:d.jsx(an,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(ko,{})]})},Gf=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:c="default",variant:h="default",circle:m="default",modal:p="default"}=i,g=xc(),[f,D]=C.useState(""),y=F=>{const{detail:{message:S}}=F;D(S)};C.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",y),()=>{document.removeEventListener("ariaLive",y)}),[g]);const w=oa(e,{locale:o}),A=oa(t,{locale:o}),_=oa(n,{locale:o}),k={};return c!=="default"&&(k[c]=!0),h!=="default"&&(k[h]=!0),m!=="default"&&(k[m]=!0),d.jsx(xh.ErrorBoundary,{onError:r,fallback:d.jsx(Ow,{}),children:d.jsxs(C.Suspense,{fallback:null,children:[d.jsxs("div",{id:"wrapper",className:Y(s,k,{"has-footer":u}),children:[d.jsx(_o,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[A&&d.jsx("div",{className:Y("additional-content prepended",{"large-modal":p==="large"}),children:A}),C.createElement(c==="bold"?Co:"div",{id:"content",children:w,className:Y({"large-modal":p==="large"})})]}),_&&d.jsx("div",{className:"additional-content appended",children:_}),u&&d.jsx(ko,{}),d.jsx(Yf,{})]}),f&&d.jsx(Me,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},uc={default:"tags_",headerTopics:"header_topics_topics_"},Zi={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"},Pw={getTagDetails:e=>{if(e.includes("topic_")){if(e=Zi.topic[e.replace("topic_","")],e){const t=jr.topics.topics[e].href;return t?{id:e,href:t,text:`${uc.headerTopics}${e}`}:null}return null}return Zi[e]?(e=Zi[e],{id:e,text:`${uc.default}${e}`}):null}};const Nw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ue.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=Pw.getTagDetails(u);c&&l.push(c)}),l.length<1?null:d.jsx("ul",{className:Y("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const c=o.formatMessage({id:u.text});return d.jsx("li",{children:u.href&&r?d.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:c}):c},u.id)})})};const Rw=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=ue.useIntl();return e.length===0?null:d.jsxs("div",{className:Y("members-list",s),children:[d.jsxs("h1",{children:[o.formatMessage({id:"membersList"}),d.jsx("span",{className:"count",children:t})]}),d.jsx("ul",{children:e.map((l,u)=>d.jsxs("li",{children:[d.jsx(nr,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(hn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx(Rr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const Mw=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ue.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=s;return C.createElement(e,{className:Y("course-progression",o,{"highlight-percentage":c,"has-circle-graph":i==="circle"}),children:d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:h=>d.jsx("strong",{children:h}),number:u})}),u<100&&a&&d.jsx(Qa,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx($s,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Qf=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>C.createElement(e,{className:Y("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Jf=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ue.useIntl(),o=La(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Tc(a||"");return d.jsxs("small",{className:Y("content-type",{[e]:e!=="default"}),children:[d.jsx("span",{className:Y("type",n),children:o})," ",t>0&&!r&&d.jsx(Qa,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const Iw=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const h=ue.useIntl(),m="courseStructure_",p=u.toLowerCase().includes("course conclusion");return d.jsxs(za,{className:"course-structure",label:d.jsxs(d.Fragment,{children:[d.jsxs("small",{children:[h.formatMessage({id:`${m}section${p?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?h.formatMessage({id:`${m}time_completed`}):d.jsx(Qa,{time:s,appendedText:a?h.formatMessage({id:`${m}time_left`}):""})})]}),d.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[d.jsx("p",{children:n}),d.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:f,contentType:D,icon:y,image:w,isIntroduction:A,optional:_,slug:k,subsectionId:F,title:S,type:$})=>{const R=a&&t||A,I={};return w&&(I.style={"--image":`url(${w})`}),d.jsx("li",{className:Y({article:D===hr.ARTICLE,discussion:D===hr.DISCUSSION,quiz:D===hr.QUIZ,completed:g&&D===hr.ARTICLE,locked:!R}),...I,children:d.jsx(_n,{href:R?`/microcourses/en/${o}/${k}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Fc(S)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(Qf,{sectionId:i,subsectionId:F,title:S,className:"course-title"})," ",d.jsx(Jf,{completionTime:f,icon:y,optional:_,type:$,children:c&&c[k]&&d.jsx("span",{className:"quiz-score",children:`${c[k]}%`})})]})})},k)})})]})};const $w=({isComplete:e=!1,onClick:t,...n})=>{const r=ue.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),d.jsx(Be,{...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:Y("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})};let aa=null;const it="discussion_form_",Ja=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},placeholder:a,maxLength:i=0,forceShow:s={cancel:!1,error:!1},functions:o={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},listMembers:()=>Promise.resolve([]),props:{create:{projectNames:["questions-answers"]}}},data:l={},gtmContext:u="DiscussionForm"})=>{var M,x,E;const c=ue.useIntl(),h=C.useContext(Mt),[m,p]=C.useState(""),[g,f]=C.useState(r.isEditing&&r.isEditing.text||""),[D,y]=C.useState(s.error||!1),[w,A]=C.useState(!1);if(r.isLoading)return d.jsx(wt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const _=O=>{f(O);let j;!h||!h.id?j=kt(c.formatMessage,`${it}error_loggedOut`,t.type,"action"):n?i>0&&O.length>=i&&(j=`${it}error_tooLong`):j=kt(c.formatMessage,`${it}error_noPermission`,t.type,"action"),j?y(j):D&&y(!1)};let k=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const O=((M=t.slugs)==null?void 0:M.reply)||((x=t.slugs)==null?void 0:x.answer)||((E=t.slugs)==null?void 0:E.question)||"";O&&(k=`${k}-${O.slice(-15)}`)}e&&(k=`${e}-${k}`);const F=async O=>{var q;if(O.preventDefault(),O.stopPropagation(),!h||!h.id||!n||$)return;aa&&clearTimeout(aa),A("submitting");const j=window.location.pathname;try{let z;switch(t.type){case"post":z=await o.create({content:g});break;case"question":z=await o.create({title:g,authorId:h&&h.id,...(q=o.props)==null?void 0:q.create});break;case"response":z=await o.create({questionSlug:t.slugs.question},{body:g,authorId:h&&h.id,contentPath:j});break;case"reply":z=await o.create({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:g,authorId:h&&h.id,contentPath:j});break;default:break}await Oh(1e3),o.callback&&await o.callback(z),aa=setTimeout(()=>{f(""),A("submitted"),p(kt(c.formatMessage,`${it}success`,t.type,"action"));const re=new Event("discussionFormSubmitted");document.dispatchEvent(re),S()},500)}catch(z){const re=z;let X=`${it}error`;re!=null&&re.message.includes("entry already exists")&&(X=kt(c.formatMessage,`${it}error_alreadyExists`,t.type,"action")),re!=null&&re.message.includes("429")?X=kt(c.formatMessage,`${it}error_tooMany`,t.type,"action"):re!=null&&re.message.includes("400")&&(X=`${it}error`),y(X),S()}},S=()=>{aa=setTimeout(()=>{y(!1),A(!1),p("")},5e3)},$=!g||!zh(g),R=w==="submitting",I=[];return(r.isEditing&&!R||s.cancel)&&I.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!s.cancel&&(!h||!h.id||!g),children:c.formatMessage({id:`${it}cancel`})}),I.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:O=>{if(r.isEditing){A("submitting"),o.handleSaveEdit&&o.handleSaveEdit(g);return}F(O)},className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`${r.isEditing?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:!h||!h.id||!n||$||R||r.isEditing&&g===r.isEditing.text,children:c.formatMessage({id:`${it}${R?r.isEditing?"saving":"posting":r.isEditing?"save":"post"}`})}),d.jsxs(d.Fragment,{children:[d.jsxs("form",{id:k,className:Y("discussion-card discussion-form",{"no-styling":r.isInWrapper&&r.isEditing}),"data-testid":`discussion-${t.type}-form`,children:[(r==null?void 0:r.showTitle)&&!r.isEditing&&["question"].includes(t.type)&&d.jsx("h2",{children:kt(c.formatMessage,`${it}title`,t.type,"action")}),d.jsx(nr,{member:h||"community",gtmContext:u,gtmType:"profile-click"}),d.jsx(Me,{element:"label",showOnFocus:!1,htmlFor:`${k}-input`,children:kt(c.formatMessage,`${it}label`,t.type,"action")}),d.jsx(xf,{id:`${k}-input`,value:w==="submitting"&&!D?"":g,placeholder:a||kt(c.formatMessage,`${it}placeholder`,t.type,"action"),maxLength:i,functions:{onChange:_,listMembers:o.listMembers},data:l,autoFocus:!!r.isEditing,"aria-invalid":!!D,"aria-errormessage":"error-message"}),d.jsx("small",{children:kt(c.formatMessage,`${it}explainer`,t.type,"action",{a:O=>d.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:O})})}),d.jsx(kn,{buttons:I}),w==="submitted"&&r.showSuccessMessage&&d.jsx(Er,{className:"success","data-testid":"success",children:kt(c.formatMessage,`${it}success`,t.type,"action")}),D&&d.jsx(Er,{id:"error-message",className:"error","data-testid":"error",children:s.error?s.error:typeof D=="string"?D.includes(" ")?D:c.formatMessage({id:D},{action:c.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):D})]}),m&&d.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:m})]})},Bo=({form:e,membershipRequiredToPost:{isMember:t,required:n,join:r,leave:a,notMemberStateText:i}})=>{if(n&&!t)return d.jsx(an,{text:i,button:{breakpoints:{mobile:!0,901:!1},component:d.jsx(wo,{isShort:!0,functions:{join:r,leave:a}})}});const{content:s,functions:o,meta:l,...u}=e;return d.jsx(Ja,{content:{type:(s==null?void 0:s.type)||"reply",slugs:(s==null?void 0:s.slugs)||{}},functions:{...o,create:(o==null?void 0:o.create)||(()=>{})},meta:{...l,isEditing:(l==null?void 0:l.isEditing)||!1,showSuccessMessage:!1},...u,id:`add-post-${u.id||""}`})},Lw={showForm:!1},Xa=C.createContext(Lw),Xf=({children:e})=>{const[t,n]=C.useState({showForm:!1});return d.jsx(Xa.Provider,{value:{...t,updateConversation:n},children:e})},zw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),qw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Na=({icon:e,...t})=>d.jsx(Be,{className:"discussion-button",variant:"tertiary",icon:e,...t});let wr=!1;const Yi=()=>{wr!==!1&&(clearTimeout(wr),wr=!1)},Gi=5;let Qi=null;const eh=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const u=ue.useIntl(),c={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[h,m]=C.useReducer(Or,c),{numberOfLikes:p,userLikedContent:g,ignoreInteractions:f,showLikers:D,tabbableLink:y}=h;C.useEffect(()=>{m([{type:"userLikedContent",value:a}])},[a]);const w=C.useMemo(()=>qw(n,Gi),[n]),A=S=>{if(S.preventDefault(),S.stopPropagation(),m([{type:"showLikers",value:!1}]),wr)return Yi(),!1;if(Yi(),f||!s)return!1;wr=setTimeout(_,350)},_=async()=>{if(Yi(),f||!s)return!1;let S=g?p-1:p+1;S<0&&(S=0),m([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const $=zw(i.slugs);g?await l($):await o({...$,payload:{contentPath:window.location.pathname}})}}catch{m([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{m([{type:"ignoreInteractions",value:!1}])}},k=()=>{Qi=setTimeout(()=>{m([{type:"showLikers",value:!1}])},500)},F=()=>{Qi&&clearTimeout(Qi)};return C.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&m([{type:"showLikers",value:!1}])},onMouseEnter:()=>{F(),m([{type:"showLikers",value:!0}])},onMouseLeave:()=>{k()}},d.jsxs(d.Fragment,{children:[d.jsx(Na,{className:Y("discussion-button text-medium action-button",{"show-spinner":f,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:A,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:p})})}),n&&d.jsxs(d.Fragment,{children:[d.jsx(Me,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{F()},onBlur:()=>k,onClick:S=>{var R;S.preventDefault(),S.stopPropagation(),F(),m([{type:"showLikers",value:!0}]);const $=(R=S.currentTarget.nextSibling)==null?void 0:R.childNodes[0];if($){const I=$.querySelector("li:first-child a");I&&(m([{type:"tabbableLink",value:0}]),setTimeout(()=>{I.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),k())},"aria-expanded":D,"aria-controls":`likes-tooltip-${i.slug}`,children:d.jsx(Me,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),d.jsx(En,{id:`likes-tooltip-${i.slug}`,isOpen:D,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[w.map((S,$)=>{if(typeof S=="string"||!S.name)return null;const R={};return y!==$&&(R.tabIndex=-1),d.jsx("li",{"data-index":$,children:d.jsx(_n,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:I=>I==null?void 0:I.stopPropagation(),onFocus:()=>F(),onKeyDown:I=>{var j,q,z,re;if(!I||!["ArrowUp","ArrowDown"].includes(I.key||""))return;I.stopPropagation(),I.preventDefault();const M=I.key==="ArrowUp"?"up":"down",x=(j=I.currentTarget)==null?void 0:j.parentElement;let E=x==null?void 0:x.nextElementSibling;if(M==="up"){const X=x==null?void 0:x.previousElementSibling;X?E=X:(E=(q=x==null?void 0:x.parentElement)==null?void 0:q.lastElementChild,(E==null?void 0:E.getAttribute("data-index"))==="-1"&&(E=E==null?void 0:E.previousElementSibling))}else(!E||(E==null?void 0:E.getAttribute("data-index"))==="-1")&&(E=(z=x==null?void 0:x.parentElement)==null?void 0:z.firstElementChild);if(!E)return;const O=(E==null?void 0:E.getAttribute("data-index"))||"0";m([{type:"tabbableLink",value:O}]),(re=E==null?void 0:E.querySelector("a"))==null||re.focus()},...R,children:S.name})},S.id||window.btoa(S.name))}),t>Gi&&d.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Gi})})]})})]})]}))},lc=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},ei=(e,t)=>e&&!t,Ji=({children:e,class:t,...n})=>{const r={...n,class:Y("subtle",t)};return d.jsx("blockquote",{...r,children:e})},Ww=280,Hw=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Un(e,Ww):e;return a=a.trim(),n?await Rc({text:a,template:'<a href="/profiles/{{id}}" class="mentioned-user">@{{name}}</a>',mentions:n,listMembers:r}):a};const Uw=3e3,Vw=({url:e})=>{const t=ue.useIntl(),[n,r]=C.useState({isOpen:!1,isCopied:!1});return d.jsxs("li",{children:[d.jsx(En,{className:Y("tooltip-share-link",{"tooltip-share-link-copied":n.isCopied}),isOpen:n.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.isCopied?t.formatMessage({id:"discussion_share_copy_link_success"}):t.formatMessage({id:"discussion_share_copy_link"})}),d.jsx(Na,{icon:{icon:"link_chain"},onMouseOver:()=>r({...n,isOpen:!0}),onFocus:()=>r({...n,isOpen:!0}),onMouseOut:()=>r({isOpen:!1,isCopied:!1}),onBlur:()=>r({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{r({isOpen:!0,isCopied:!0}),setTimeout(()=>{r({isOpen:!1,isCopied:!1})},Uw)})}})]})},zt="discussion_",Kw=195,Mr=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,forceHide:i={actionBar:!1,comments:!1,likes:!1},functions:s,links:o={},className:l,gtmContext:u="DiscussionAnswer",children:c,isTruncated:h=!1,styling:{showShareLinkButton:m=!1}={},setFocus:p=!1})=>{var ge,ke,xe,_e,We,Le,Ue,Qe;const g=ue.useIntl(),f=C.useContext(Mt),D=C.useContext(Xa),{createContent:y=async()=>{},deleteContent:w=async()=>{},updateContent:A=async()=>{}}=s.content||{},{createLike:_=()=>{},deleteLike:k=()=>{}}=s.likes||{},{openComments:F=()=>{}}=s.comments||{},{listMembers:S=()=>Promise.resolve([])}=s.mentions||{},{author:$,canLike:R,createdAt:I,id:M,likes:x=0,userLiked:E,comments:O=0,mentions:j}=t,q=f&&f.id&&typeof $!="string"&&$.id&&$.id===f.id||!1,z=typeof R=="boolean"?R:n?!q:!1,re=q&&(!t.createdAt||Sh(t.createdAt,10,"seconds")),X=C.useRef(null),[v,H]=C.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[ee,B]=C.useState(!1),[T,W]=C.useState(re?"highlighted":"default"),[L,U]=C.useState("");C.useEffect(()=>{const he=X.current;if(!(!he||T==="default"))return document.addEventListener("discussionFormSubmitted",te),he.addEventListener("transitionend",ne),()=>{document.removeEventListener("discussionFormSubmitted",te),he.removeEventListener("transitionend",ne)}},[]),C.useEffect(()=>{H({...v,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),C.useEffect(()=>{(async()=>{const Te=await Hw(v.body,h,j,S);H({...v,postBody:Te})})()},[v.body,j]);const te=()=>{setTimeout(()=>{W("fading")},1e3)},ne=({propertyName:he})=>{he==="background-color"&&W(Te=>(Te==="default"&&(document.removeEventListener("discussionFormSubmitted",te),X.current&&X.current.removeEventListener("transitionend",ne)),Te==="fading"?"default":Te))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||v.postBody==="")return d.jsx(wt,{className:"discussion-card discussion-post"});const ie=async he=>{he||(he=""),U("");try{if(!bc(he,v.body)){const Te=t.type==="question"?{title:he}:{body:he};await A(lc(t.slugs),Te)}H({...v,body:he,isEditing:!1,didEdit:!0})}catch{U(`${zt}form_error`)}},fe=()=>{D&&D.updateConversation&&D.updateConversation({showForm:!0}),setTimeout(()=>{var se,me,ve;const Te=`reply-form-${(t.type==="answer"?t.slug:((se=t.slugs)==null?void 0:se.reply)||((me=t.slugs)==null?void 0:me.answer)||((ve=t.slugs)==null?void 0:ve.question)||"").toLowerCase().slice(-15)}`,$e=document.getElementById(Te),K=document.getElementById(`${Te}-input`);K&&K.focus(),$e&&$e.scrollIntoView({behavior:"smooth"})},0)},Q=async()=>{B(!1);try{await w(lc(t.slugs))}catch{U("delete-error")}},pe=[{text:g.formatMessage({id:`${zt}moreMenu_report`}),onClick:he=>{he.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(g.formatMessage({id:`${zt}report_subject`}))}&body=${encodeURI(g.formatMessage({id:`${zt}report_body`},{contentType:t.type||"",contentSlug:t.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}))}`,icon:"flag"}];return n&&q&&pe.push({text:g.formatMessage({id:`${zt}moreMenu_edit`}),onClick:()=>H({...v,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`edit-${t.type}-click`},{text:g.formatMessage({id:`${zt}moreMenu_delete`}),onClick:he=>{he.preventDefault(),he.stopPropagation(),B(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`delete-${t.type}-click`,...Wf(`delete-${t.slug}-modal`,ee)}),p&&((ge=X==null?void 0:X.current)==null||ge.focus(),(ke=X==null?void 0:X.current)==null||ke.scrollIntoView({behavior:"smooth"})),C.createElement(e,{className:Y("discussion-post",l,{[T]:!l||!l.includes("highlighted-text-box"),"has-link":o.post&&!v.isEditing}),ref:X,tabIndex:p?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${u}-post-click`,onClick:he=>{!o.post||v.isEditing||(he.preventDefault(),he.stopPropagation(),window.location.href=o.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:M||t.slug,className:Y("discussion-card",t.type,{editing:v.isEditing,"has-link":o.post&&!v.isEditing}),children:[!v.isEditing&&d.jsx(nr,{member:$,additionalContent:{createdAt:I,didEdit:v.didEdit},className:typeof $!="string"&&$.id===a?"highlighted":"",gtmContext:u,gtmType:"profile-click"}),v.isEditing?d.jsx(Ja,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:v.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:L!==""&&L!=="delete-error"?g.formatMessage({id:L},{action:g.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:y,handleSaveEdit:ie,handleCancel:()=>{U(""),H({...v,isEditing:!1})},listMembers:S},gtmContext:`${u}Form`,data:{mentions:t.mentions}}):o.post?d.jsxs("a",{href:o.post,children:[(t==null?void 0:t.title)&&d.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),v.postBody.length>Kw?d.jsx(qc,{text:v.postBody,markdownOptions:{overrides:{a:os,blockquote:{component:Ji}}}}):d.jsx(Kn,{options:{overrides:{a:os,blockquote:{component:Ji}}},children:v.postBody})]}):d.jsx(Kn,{options:{wrapper:t.type==="question"?"h1":C.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:Ji}}},children:v.postBody}),!v.isEditing&&!(i!=null&&i.actionBar)&&d.jsxs("ul",{className:Y("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!i.likes&&d.jsx(eh,{element:"li",likes:x,isShort:!1,userLiked:E,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:z,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:_,deleteLike:k}}),!i.comments&&(["question","post"].includes(t.type)||o.comments||typeof F=="function")&&d.jsx("li",{children:d.jsx(Na,{onClick:he=>{he.preventDefault(),he.stopPropagation(),o.comments&&(window.location.href=o.comments),typeof F=="function"&&F()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":u,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:g.formatMessage({id:`${zt}comments_screenReader`},{count:O}),children:g.formatMessage({id:`${zt}comments`},{count:O})})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(Na,{styling:{muted:!0},onClick:fe,icon:{icon:"speech-bubble_square"},children:g.formatMessage({id:`${zt}reply`})})}),m&&d.jsx(Vw,{url:(xe=t.slugs)!=null&&xe.reply?`${window.location.origin}${(_e=t.slugs)==null?void 0:_e.question}/${(We=t.slugs)==null?void 0:We.answer}#${(Le=t.slugs)==null?void 0:Le.reply}`:`${window.location.origin}${(Ue=t.slugs)==null?void 0:Ue.question}/${(Qe=t.slugs)==null?void 0:Qe.answer}`}),d.jsx(Vf,{element:"li",id:`more-${t.slug}`,options:pe})]})]}),c,d.jsx(Nr,{id:`delete-${t.slug}-modal`,isOpen:ee,functions:{onOpen:()=>{},onClose:()=>B(!1)},forceShow:{error:L==="delete-error"?g.formatMessage({id:"discussion_delete_error"},{action:g.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:g.formatMessage({id:"discussion_delete_title"},{action:g.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>B(!1),children:g.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:Q,children:g.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:d.jsx(ue.FormattedMessage,{id:"discussion_delete_text",values:{p:he=>d.jsx("p",{children:he}),action:g.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Xi="discussion_responses_",th=({type:e="answer",responses:t=0})=>{const n=ue.useIntl();return t=parseInt(t),d.jsxs("div",{className:"responses-heading",children:[d.jsx("h4",{children:n.formatMessage({id:`${Xi}title`},{action:n.formatMessage({id:`${Xi}${e}`}),count:t})}),t===0&&d.jsx("p",{children:kt(n.formatMessage,`${Xi}empty`,e,e)})]})};const nh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ue.useIntl(),s=C.useContext(Xa),o=oa(a,{element:"li"});return d.jsxs("div",{className:Y("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&d.jsx("ul",{className:"thread",children:o}),!e&&d.jsx(Rr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&d.jsx(Ja,{...r})]})},Zw="post",Yw="reply",rh="00000000-0000-0000-0000-000000000000";function Ao({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Fo({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return e.setQueryData(t,r),a}return n}function Gw(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Qw(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function ah(e){const{id:t="",name:n="",organization:r="",jobTitle:a="",image:i={}}=e,{thumbnail:s=""}=i;return{id:t,data:{name:n,organization:r,jobTitle:a,thumbnail:s}}}function Jw({content:e}){return{content:e,id:rh,time:new Date().toISOString(),verb:Zw}}function cc({activity:e,user:t}){return{...e,actor:ah(t),...Gw()}}function Ra({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((a=e.own_reactions)==null?void 0:a.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function ih({activity:e,user:t}){var n,r,a;e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like-1:0},t!=null&&t.id&&(e.latest_reactions={...e.latest_reactions||{},like:(((r=e.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((a=e.own_reactions)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function Xw({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:rh,kind:Yw,parent:t||""}}function dc({reply:e,user:t}){const n=ah(t);return{...e,user_id:n.id,user:n,...Qw()}}function fc({reply:e,reaction:t}){var n,r,a;t?(e.latest_children={...e.latest_children||{},like:[...((r=e.latest_children)==null?void 0:r.like)||[],t]},e.own_children={...e.own_children||{},like:[...((a=e.own_children)==null?void 0:a.like)||[],t]}):e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like+1:1}}function eE({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}const sh=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let hc,es=0;const oh=()=>{C.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(hc);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),es=0;return}es++,!(es>10)&&(hc=setTimeout(()=>{e(t)},50))}},Jn=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}),rn=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}),uh=Object.freeze({actor:`SU:${Jn.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"}),tE=Object.freeze({actor:`SU:${rn.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"}),nE=Object.freeze({actor:`SU:${Jn.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"}),rE=Object.freeze({actor:`SU:${rn.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:uh.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:rn.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:rn.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:rn.id,user:{id:rn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:uh.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:Jn.id,user:{id:Jn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:tE.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:rn.id,user:{id:rn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:nE.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:Jn.id,user:{id:Jn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:rE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function aE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=cc({activity:Jw(o),user:i});return mc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=cc({activity:o,user:i});r.setQueryData(a,mc(c,u,!0)),setTimeout(()=>{sh(c.id)},0)}});return s}function iE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Ma(a,s);return o&&(o.content=i),s}),onError:n});return r}function sE({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ke.useQueryClient(),l=Ga(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:Ao(u),mutate:Fo(u)},user:l,...u},h=aE({...c,mutationFn:e}),m=iE({...c,mutationFn:t}),p=oE({...c,mutationFn:n}),g=lE({...c,mutationFn:a}),f=cE({...c,mutationFn:i}),{activities:D,...y}=uE({queryKey:s,queryFn:r});return{activities:D,mutations:{create:h,edit:m,remove:g,like:p,unlike:f},user:l,...y}}function oE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Ma(s,o);return l&&Ra({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Ma(o,l);u&&Ra({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function uE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{activities:fE(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function lE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>dE(a,i)),onError:n});return r}function cE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Ma(i,s);return o&&ih({activity:o,user:r}),s}),onError:n});return a}function mc(e,t,n=!1){return t?(n?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t):{pages:[{next:"",results:[e]}],pageParams:[""]}}function Ma(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function dE(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function fE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const hE=({basePath:e,parentId:t,isMember:n,functions:{activities:r,mentions:a,join:i,leave:s}})=>{const o=ue.useIntl(),{activities:l,error:u,fetchNextPage:c,hasNextPage:h,isLoading:m,mutations:{create:p,edit:g,remove:f,like:D,unlike:y},user:w}=sE({queryKey:[e,t,"activities"],queryFns:r}),[A,_]=C.useState(null),k=()=>{_(l.length),c()};return oh(),u?d.jsx(an,{variant:"error",text:u.message}):d.jsxs("section",{children:[d.jsx(Bo,{form:{content:{type:"post",slugs:{}},functions:{create:p,listMembers:a.listMembers},meta:{isEditing:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),l==null?void 0:l.map((F,S)=>{var X,v,H,ee,B,T,W,L;const{id:$,own_reactions:R,latest_reactions:I,reaction_counts:M,mentioned_users:x}=F,E=(((X=I==null?void 0:I.like)==null?void 0:X.length)||0)>0,O=(((v=R==null?void 0:R.like)==null?void 0:v.length)||0)>0,j=O?R==null?void 0:R.like[0].id:"",q=E?(H=I==null?void 0:I.like)==null?void 0:H.map(U=>{var te,ne,ie;return{id:(te=U==null?void 0:U.user)==null?void 0:te.id,name:(ie=(ne=U==null?void 0:U.user)==null?void 0:ne.data)==null?void 0:ie.name}}):!1,z=F==null?void 0:F.actor,re=(z==null?void 0:z.id)===(w==null?void 0:w.id);return d.jsx(C.Fragment,{children:d.jsx(Mr,{content:{type:"post",title:F==null?void 0:F.title,body:F==null?void 0:F.content,canLike:ei(n,re),createdAt:(F==null?void 0:F.time)||"",slugs:{question:`${e}/${t}`,answer:$},slug:$,author:{id:z==null?void 0:z.id,name:(ee=z==null?void 0:z.data)==null?void 0:ee.name,organization:(B=z==null?void 0:z.data)==null?void 0:B.organization,jobTitle:(T=z==null?void 0:z.data)==null?void 0:T.jobTitle,location:(W=z==null?void 0:z.data)==null?void 0:W.location,image:{thumbnail:((L=z==null?void 0:z.data)==null?void 0:L.thumbnail)||void 0}},userLiked:O,likes:(M==null?void 0:M.like)||0,comments:(M==null?void 0:M.reply)||0,peopleWhoLiked:q,mentions:x},links:{post:`${e}/${t}/${$}`,comments:`${e}/${t}/${$}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>f({activityId:$}),updateContent:(U,{body:te})=>g({activityId:$,content:te})},likes:{createLike:()=>D({activityId:$}),deleteLike:()=>y({activityId:$,reactionId:j})},comments:{openComments:()=>null},mentions:a},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:S===A})},$)}),!m&&d.jsx(Rr,{hasNextPage:h,loadNextPage:k,icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})},mE={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function pE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=dc({reply:Xw(o),user:i});return pc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=dc({reply:o,user:i});r.setQueryData(a,pc(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{sh(c.id)},0)}});return s}function gE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ia(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function lh({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ke.useQueryClient(),l=Ga(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:Ao(u),mutate:Fo(u)},user:l,...u},h=pE({...c,mutationFn:e}),m=gE({...c,mutationFn:t}),p=vE({...c,mutationFn:n}),g=yE({...c,mutationFn:a}),f=DE({...c,mutationFn:i}),{replies:D,...y}=bE({queryKey:s,queryFn:r});return{replies:D,mutations:{create:h,edit:m,remove:g,like:p,unlike:f},user:l,...y}}function vE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Ia(s,o);return l&&fc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ia(o,l);u&&fc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function bE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=kE(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function yE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>EE(a,i)),onError:n});return r}function DE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ia(i,s);return o&&eE({reply:o,user:r}),s}),onError:n});return a}function CE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function xE(e,t,n){const r=t.pages.length-1,a=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[a]=e:t.pages[r].results.push(e),t}function wE(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 pc(e,t,n){return t?n!=null&&n.append?xE(e,t,n):wE(e,t,n):CE(e)}function Ia(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function EE(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function kE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const _E=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=ue.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:c,isLoading:h,mutations:{create:m,edit:p,like:g,remove:f,unlike:D},user:y}=lh({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:_=>i.list({..._,reactionId:r})}});Ns([h]);const[w,A]=C.useState(!0);return d.jsxs(d.Fragment,{children:[(l==null?void 0:l.length)>=o&&d.jsx(Be,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${w?"up_left":"down_right"}`,position:"left"},onClick:()=>A(!w),children:s.formatMessage({id:`discussion_thread_${w?"hide":"show"}`},{count:l==null?void 0:l.length})}),w&&d.jsx(nh,{loadMore:{isLoading:h,hasNextPage:c,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(_,{body:k})=>m({activityId:n,replyId:r,content:k}),listMembers:i.listMembers},meta:{isEditing:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(_=>{var v,H,ee,B,T,W,L,U,te,ne,ie,fe;const{id:k,own_children:F,latest_children:S,children_counts:$,data:{mentioned_users:R}}=_,M=(((v=F==null?void 0:F.like)==null?void 0:v.length)||0)>0?(H=F==null?void 0:F.like)==null?void 0:H.find(Q=>{var pe;return((pe=Q==null?void 0:Q.user)==null?void 0:pe.id)===(y==null?void 0:y.id)}):!1,x=M?M==null?void 0:M.id:"",E=!!M,j=(((ee=S==null?void 0:S.like)==null?void 0:ee.length)||0)>0?(B=S==null?void 0:S.like)==null?void 0:B.map(Q=>{var pe,ge,ke;return{id:(pe=Q==null?void 0:Q.user)==null?void 0:pe.id,name:(ke=(ge=Q==null?void 0:Q.user)==null?void 0:ge.data)==null?void 0:ke.name}}):!1,q=_==null?void 0:_.user,z=(q==null?void 0:q.id)===(y==null?void 0:y.id),re=ei(a,z),X=typeof _.data.content=="string"?(T=_==null?void 0:_.data)==null?void 0:T.content:((L=(W=_==null?void 0:_.data)==null?void 0:W.content)==null?void 0:L.text)||"";return d.jsx(Mr,{content:{id:k,type:"reply",body:X,canLike:re,createdAt:_==null?void 0:_.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:_==null?void 0:_.parent},slug:"",author:{id:q==null?void 0:q.id,name:(U=q.data)==null?void 0:U.name,organization:(te=q.data)==null?void 0:te.organization,jobTitle:(ne=q.data)==null?void 0:ne.jobTitle,location:(ie=q.data)==null?void 0:ie.location,image:{thumbnail:((fe=q.data)==null?void 0:fe.thumbnail)||void 0}},userLiked:E,likes:($==null?void 0:$.like)||0,peopleWhoLiked:j,mentions:R},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:k}),updateContent:(Q,{body:pe})=>p({replyId:k,content:pe})},likes:{createLike:()=>g({replyId:k}),deleteLike:()=>D({replyId:k,reactionId:x})},comments:{},mentions:{listMembers:i.listMembers}},styling:{showShareLinkButton:!0}},k)}):null})]})};const ch=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,mentions:i,join:s,leave:o}})=>{const l=ue.useIntl(),{replies:u,repliesCount:c,fetchNextPage:h,hasNextPage:m,isLoading:p,mutations:{create:g,edit:f,like:D,remove:y,unlike:w},user:A}=lh({queryKey:[e,t,n,"replies"],queryFns:a}),_=()=>{F(u.length),h()},[k,F]=C.useState(null);return Ns([p]),oh(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(th,{type:"comment",responses:c}),d.jsx(Bo,{form:{content:{type:"reply",slugs:{}},functions:{create:(S,{body:$})=>g({activityId:n,content:$}),...i},meta:{isEditing:!1,showSuccessMessage:!1},placeholder:l.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:s,leave:o,notMemberStateText:l.formatMessage({id:"community_joinToPost"})}}),u==null?void 0:u.map((S,$)=>{var T,W,L,U,te,ne,ie,fe,Q,pe,ge,ke;const{id:R,own_children:I,latest_children:M,children_counts:x,data:{mentioned_users:E}}=S,j=(((T=I==null?void 0:I.like)==null?void 0:T.length)||0)>0?(W=I==null?void 0:I.like)==null?void 0:W.find(xe=>{var _e;return((_e=xe==null?void 0:xe.user)==null?void 0:_e.id)===(A==null?void 0:A.id)}):!1,q=j?j==null?void 0:j.id:"",z=!!j,X=(((L=M==null?void 0:M.like)==null?void 0:L.length)||0)>0?(U=M==null?void 0:M.like)==null?void 0:U.map(xe=>{var _e,We,Le;return{id:(_e=xe==null?void 0:xe.user)==null?void 0:_e.id,name:(Le=(We=xe==null?void 0:xe.user)==null?void 0:We.data)==null?void 0:Le.name}}):!1,v=S==null?void 0:S.user,H=(v==null?void 0:v.id)===(A==null?void 0:A.id),ee=ei(r,H),B=typeof S.data.content=="string"?(te=S==null?void 0:S.data)==null?void 0:te.content:((ie=(ne=S==null?void 0:S.data)==null?void 0:ne.content)==null?void 0:ie.text)||"";return d.jsx(Xf,{children:d.jsx(Mr,{content:{id:R,type:"reply",body:B,canLike:ee,createdAt:S==null?void 0:S.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:R},slug:R,author:{id:v==null?void 0:v.id,name:(fe=v.data)==null?void 0:fe.name,organization:(Q=v.data)==null?void 0:Q.organization,jobTitle:(pe=v.data)==null?void 0:pe.jobTitle,location:(ge=v.data)==null?void 0:ge.location,image:{thumbnail:((ke=v.data)==null?void 0:ke.thumbnail)||void 0}},userLiked:z,likes:(x==null?void 0:x.like)||0,peopleWhoLiked:X,mentions:E},functions:{content:{createContent:()=>null,deleteContent:()=>y({replyId:R}),updateContent:(xe,{body:_e})=>f({replyId:R,content:_e})},likes:{createLike:()=>D({replyId:R}),deleteLike:()=>w({replyId:R,reactionId:q})},comments:{},mentions:i},children:d.jsx(_E,{basePath:e,parentId:t,activityId:n,replyId:R,isMember:r,functions:{...a,...i}}),styling:{showShareLinkButton:!0},setFocus:$===k},R)},R)}),!p&&d.jsx(Rr,{hasNextPage:m,loadNextPage:_,icon:{icon:"arrow-down",position:"right"},messages:{button:l.formatMessage({id:"loadMore_button"}),error:l.formatMessage({id:"loadMore_error"})}})]})};function BE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({content:a})=>t(i=>(i&&(i.content=a),i)),onError:n});return r}function AE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=Ke.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function FE({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=Ke.useQueryClient(),s=Ga(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:Ao(o),mutate:Fo(o)},user:s,...o},u=BE({...l,mutationFn:t}),c=TE({...l,mutationFn:n}),h=SE({...l,mutationFn:r}),{activity:m,...p}=AE({queryKey:a,queryFn:e});return{activity:m,mutations:{edit:u,like:c,unlike:h},user:s,...p}}function TE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ra({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ra({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function SE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&ih({activity:s,user:r}),s)),onError:n});return a}const jE=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,mentions:o,join:l,leave:u}})=>{var M,x,E,O,j,q,z,re,X,v;const c=ue.useIntl(),h=C.useContext(Mt),{activity:m,error:p,isLoading:g,mutations:{edit:f,like:D,unlike:y}}=FE({queryFns:i,queryKey:[e,t,n]});if(g)return d.jsx(wt,{style:{height:"400px"}});if(p||!m)return d.jsx(an,{variant:"error",text:c.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:w,latest_reactions:A,mentioned_users:_}=m,k=(((M=A==null?void 0:A.like)==null?void 0:M.length)||0)>0,F=(((x=w==null?void 0:w.like)==null?void 0:x.length)||0)>0,S=F?w==null?void 0:w.like[0].id:"",$=k?(E=A==null?void 0:A.like)==null?void 0:E.map(H=>{var ee,B,T;return{id:(ee=H==null?void 0:H.user)==null?void 0:ee.id,name:(T=(B=H==null?void 0:H.user)==null?void 0:B.data)==null?void 0:T.name}}):!1,R=m==null?void 0:m.actor,I=(R==null?void 0:R.id)===(h==null?void 0:h.id);return d.jsxs("section",{className:"activity-section",children:[d.jsx(Mr,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:m==null?void 0:m.content,canLike:ei(r,I),createdAt:(m==null?void 0:m.time)||"",slugs:{question:`${e}/${t}`,answer:m==null?void 0:m.id},slug:n,author:{id:R.id,name:(O=R.data)==null?void 0:O.name,organization:(j=R.data)==null?void 0:j.organization,jobTitle:(q=R.data)==null?void 0:q.jobTitle,location:(z=R.data)==null?void 0:z.location,image:{thumbnail:((re=R.data)==null?void 0:re.thumbnail)||void 0}},userLiked:F,likes:((X=m==null?void 0:m.reaction_counts)==null?void 0:X.like)||0,comments:((v=m==null?void 0:m.reaction_counts)==null?void 0:v.reply)||0,peopleWhoLiked:$,mentions:_},originalAuthorId:R==null?void 0:R.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(H,{body:ee})=>f({content:ee})},likes:{createLike:()=>D({activityId:n}),deleteLike:()=>y({activityId:n,reactionId:S})},comments:{openComments:()=>{}},mentions:o},styling:{showShareLinkButton:!0}},n),d.jsx(ch,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,mentions:o,join:l,leave:u}})]})},OE=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),gc=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ia="notFoundError_",PE=()=>{const e=ue.useIntl(),t=[];return gc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ia}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(Gf,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(ln,{children:[d.jsx(Uf,{cards:gc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(Be,{href:"/solution-articles/",children:e.formatMessage({id:`${ia}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ia}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ia}text`})})]})};exports.ASSETS_BUCKET=Ht;exports.ActivitiesFeed=hE;exports.ActivitySection=jE;exports.AddPost=Bo;exports.Banner=Xx;exports.BannerSection=sw;exports.Breadcrumbs=yw;exports.Buckets=Kh;exports.Button=Be;exports.ButtonWrapper=kn;exports.COURSE_CONTENT_TYPES=hr;exports.CacheProvider=Mf;exports.Card=xo;exports.CardBlock=Uf;exports.Carousel=vw;exports.CharacterLimit=Ws;exports.CollapsibleSection=za;exports.Columns=Zf;exports.CommunityDetails=bw;exports.ContactFooter=Tw;exports.ContactForm=wf;exports.ContentTypeLabel=$c;exports.Contributors=qs;exports.ConversationContext=Xa;exports.CookieBanner=Yf;exports.CourseProgression=Mw;exports.CourseStructure=Iw;exports.CustomContentBanner=ow;exports.Directory=Yx;exports.DiscussionConversation=Xf;exports.DiscussionForm=Ja;exports.DiscussionLikes=eh;exports.DiscussionPost=Mr;exports.DiscussionThread=nh;exports.Divider=tn;exports.DownloadSection=ew;exports.EMAILS=Rn;exports.EditSection=nw;exports.EmailHelperTextBox=Kc;exports.EmptyStateBox=an;exports.Filters=Dw;exports.FlagsProvider=If;exports.Footer=ko;exports.Form=rr;exports.Formatting=Z;exports.FullWidthSection=ln;exports.GET_STREAM_USER_PREFIX=ns;exports.GlobalProviders=Kx;exports.Header=_o;exports.HelperTextBox=zc;exports.HiddenFromScreenReaders=$a;exports.HideShowTextBox=qc;exports.HighlightSection=lw;exports.HighlightedTextBox=Nt;exports.INVALID_TOKEN=Sc;exports.IconBulletedList=Gh;exports.ImageContainer=Hh;exports.IntlProvider=$f;exports.InviteForm=Ef;exports.InviteModal=Zx;exports.JoinButton=wo;exports.LanguageContext=yo;exports.LanguageSwitcher=xw;exports.LessonName=Qf;exports.LessonType=Jf;exports.Link=_n;exports.LoadMore=Rr;exports.LoadingBlock=om;exports.LoadingPlaceholder=wt;exports.LoadingState=Ls;exports.Logo=Eo;exports.LogoSection=rw;exports.MENTION_REGEX=jc;exports.MarkCompleteButton=$w;exports.MarkdownText=Kn;exports.MarketingBlock=cw;exports.Marks=Ot;exports.Member=nr;exports.MembersList=Rw;exports.Modal=Co;exports.MoreMenu=Vf;exports.NUMBER_OF_COUNTRIES=Th;exports.NUMBER_OF_USERS=Fh;exports.NavigationMenu=Kf;exports.NotFoundError=PE;exports.Overlay=Nr;exports.OverlayContext=Do;exports.OverlayProvider=qf;exports.PageHeading=Wc;exports.PageLayout=Gf;exports.PasswordForm=zC;exports.PasswordRules=Jc;exports.Pill=hn;exports.Popover=Ic;exports.Portal=Is;exports.ProfileImageChange=LC;exports.ProfilePicture=sn;exports.ProgressBar=$s;exports.ProgressTracker=Uh;exports.Rating=Dm;exports.RepliesFeed=ch;exports.ResponsesHeading=th;exports.ResponsiveImage=tr;exports.ReturnToNavButton=Vh;exports.RichTextEditor=xf;exports.SearchForm=kf;exports.ShareLinks=Bw;exports.SignupForm=KC;exports.Span=os;exports.StatusBanner=Er;exports.TableOfContents=Jx;exports.Tabs=Aw;exports.Tags=Nw;exports.TestimonialBlock=Qx;exports.TimeToComplete=Qa;exports.Toggle=$C;exports.Tooltip=En;exports.TopLevelPage=Sw;exports.UUID_V4_REGEX=rs;exports.UserContext=Mt;exports.UserProvider=Lf;exports.VisuallyHidden=Me;exports.addAriaProps=Wf;exports.basicReducer=Or;exports.camelCaseToDashCase=Ac;exports.checkIntlPathExists=La;exports.generateConditions=ma;exports.generateCssIcon=Oc;exports.getCharacterLimitProps=Vc;exports.getLongDate=Ms;exports.getMember=zs;exports.getShortDate=Pc;exports.getValueLength=qa;exports.headerData=jr;exports.mapGetStreamData=OE;exports.pageReady=Nc;exports.passwordValidator=is;exports.repliesFeedMock=mE;exports.supportedLanguages=ga;exports.toCamelCase=Fc;exports.toCapitalisedCase=Ah;exports.toSentenceCase=Tc;exports.useCurrentPath=xc;exports.useEffectAfterMount=Vn;exports.useElementWidth=Xn;exports.useOverlay=zf;exports.useScrollListener=kc;exports.useScrollToHash=Ns;exports.useTooltips=Rs;exports.useUser=Ga;
159
+ ${fr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:fr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const _w="shareLinks_",Bw=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ue.useIntl(),l=kw({title:e,link:t,referrer:n});return d.jsxs("aside",{className:Y("share-links",a,i,s),children:[d.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),d.jsx("ul",{children:l.map(({key:u,icon:c,url:h,shouldRender:m=!0,onClick:p})=>{if(typeof m=="function"&&!m())return null;const g={};return p&&(g.onClick=f=>p(f,h)),d.jsx("li",{children:d.jsx(Be,{size:a,variant:"tertiary",icon:{icon:c||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:`${_w}link_${u}`}),...g})},u)})})]})};const Aw=({tabs:e,className:t="",preventLocationChange:n})=>{var u;const r=(c,h,m)=>(c||(c=`panel-${window.btoa(h)}-${m}`),c);let a=e.findIndex(c=>c.current===!0);if(a<0&&(a=0),window.location.hash){const c=window.location.hash.replace("#","");if(e.find(m=>m.id===c)){for(let m=0;m<e.length;m++)if(r(e[m].id,e[m].text,m)===c){a=m;break}}}const[i,s]=C.useState((u=e[a])!=null&&u.id?e[a].id:r(e[a].id,e[a].text,a));C.useEffect(()=>{if(e[a].hasCarousel){const c=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(c)}},[i]);const o=[],l=[];return e.forEach(({id:c,text:h,content:m,href:p,hasCarousel:g},f)=>{c=r(c,h,f);const y=i===c,D={};p||(D["aria-controls"]=c,D.onClick=x=>{x.preventDefault(),x.stopPropagation(),s(c),!n&&(window.location.hash=`#${c}`)},l.push(d.jsx("section",{id:c,hidden:!y,role:"tabpanel","aria-labelledby":`tab-${c}`,"aria-live":y?"assertive":"off",children:typeof m=="string"?d.jsx("p",{children:m}):m},`section-${c}`))),o.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:p||`#${c}`,id:`tab-${c}`,className:Y({selected:y}),role:"tab","aria-selected":y,...D,children:h})},`tab-${c}`))}),d.jsxs("div",{className:Y("tabs-wrapper",t),children:[d.jsx("ul",{className:"tabs",role:"tablist",children:o}),d.jsx("div",{className:"tab-content",children:l})]})};const Fw={"2-1":901,"1-3":769,"1-1":769},Zf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Jn(!0);let s=a;return C.Children.count(a)===1&&(s=C.Children.toArray(a)[0],s.props&&(s=s.props.children)),d.jsx("section",{className:Y("columns",`layout-${e}`,r,{"has-containers":n}),children:C.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Fw[e]?null:o)})};let Wi;const Hi="contactFooter_",Tw=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=C.useRef(null),[r,a]=C.useState(0),[i,s]=C.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(Wi),Wi=setTimeout(()=>{o(),s(!1)},500))};return C.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(Wi),window.removeEventListener("resize",l)}),[]),d.jsx(ln,{id:"contactForm",className:"contact-footer",children:d.jsxs("div",{className:"inner-wrapper",children:[d.jsx("h2",{children:d.jsx(ue.FormattedMessage,{id:`${Hi}title`})}),d.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[d.jsxs("aside",{children:[d.jsx("p",{children:d.jsx(ue.FormattedMessage,{id:`${Hi}text`})}),d.jsx(_n,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(ue.FormattedMessage,{id:`${Hi}email`})})]}),d.jsx(wf,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Sw=({activeLink:e,...t})=>d.jsx(ln,{children:d.jsx(Zf,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(Kf,{activeLink:e}),d.jsx(Wc,{...t})]})})});const Ui="cookieBanner_",Vi=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Ki=new Date(Date.now()+12*30*24*60*60*1e3),Yf=()=>{const e=ue.useIntl(),[t,n,r]=Ps.useCookies(Vi),[a,i]=C.useState(!t["apol-cookie-banner"]),s=()=>{Vi.forEach(c=>{n(c,!0,{path:"/",expires:Ki,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Ki}),Vi.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:Ki});return}r(c)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(c=>{u.push({variant:c.href?"tertiary":"primary",href:c.href,onClick:c.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${c.gtmType}-click`,children:e.formatMessage({id:`${Ui}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${Ui}title`})}),d.jsx("p",{children:e.formatMessage({id:`${Ui}text`})}),d.jsx(kn,{buttons:u})]})},qt={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","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-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:Nn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Nn["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:Nn.support,gtmType:"concierge-email-click"},business:{email:Nn.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 zn="footer_",Oa="SiteFooter",oc=({group:e})=>{const t=qt[e].order||[];let n=!1;return"text"in qt[e]&&(n=qt[e].text),d.jsxs(C.Fragment,{children:[d.jsx("p",{className:"pre-title",children:d.jsx(ue.FormattedMessage,{id:`${zn}${e}`})}),Array.isArray(t)&&t.length>0&&d.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=qt[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),d.jsx("li",{children:d.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":i,...s,children:d.jsx(ue.FormattedMessage,{id:`${zn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&d.jsx("dl",{className:"text-medium",children:n.order.map(r=>d.jsxs(C.Fragment,{children:[d.jsx("dt",{children:d.jsx(ue.FormattedMessage,{id:`${zn}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(ue.FormattedMessage,{id:`${zn}${e}_${r}_address`,values:{br:d.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&d.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},ko=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx($a,{element:"hr"}),d.jsx(Eo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":"logo-homepage-link"}),d.jsx("footer",{children:["platform","community","company","contact"].map(e=>d.jsxs("div",{className:"group",children:[d.jsx(oc,{group:e}),Object.keys(qt[e]).includes("child")&&d.jsx(oc,{group:qt[e].child})]},e))}),d.jsx("hr",{}),d.jsxs("div",{className:"sub-footer",children:[d.jsx("ul",{children:Array.isArray(qt.social.order)&&qt.social.order.map(e=>{const t=qt.social[e];return d.jsx("li",{className:e,children:d.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(ue.FormattedMessage,{id:`${zn}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(ue.FormattedMessage,{id:`${zn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Ne={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e==="account"&&t===!1&&n.navigation===!0)return;const i=Date.now();if(!a&&!t&&Ne.handlerCalled[e]&&i-Ne.handlerCalled[e]<500)return;Ne.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case"navigation":o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation > li.parent"));break;case"search":o=document.querySelector("#header .toggle-search-button");break;case"account":o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=yc(e[r],t);if(!(typeof a>"u")&&(!n||a[t]&&a[t].includes(n)||a.value&&a.value.includes(n)||a.toString().includes(n)))return e[r]}return e[0].children?Ne.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case"navigation":if(n){const u=Ne.findFirstChild(t.current.children,"attributes.aria-controls","navigation");s=Ne.findFirstChild(u.children,"href")}else s=Ne.findFirstChild(t.current.children,"href");break;case"account":if(o=Ne.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Ne.findFirstChild(o.children,"href");break;default:return}s&&(a([{type:`focusElements.${e}.${i}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout(Ne.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Ne.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Ne.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Ne.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},jr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"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:{order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},Pa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ue.useIntl(),o=yc(jr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,c=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let m=!1;if(o.href){let x=o.gtmType||`${e}-click`;if(x.includes(".")){const A=x.split("."),_=A[A.length-2];x=`${_==="topics"?`${_}-`:""}${A[A.length-1]}`}m={href:o.href},u&&(m={...m,className:"gtm-trackable","data-gtm-event-type":x,"data-gtm-event-context":"HeaderButtons"}),c&&(m={...m,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],g=p&&o[o.order[0]].order,f=m&&window.location.pathname===o.href;let y={},D={};if(f&&(y={...y,"aria-current":"page"}),p){const x=o.menuId||e,A={onClick:_=>Ne.events.onClick(_,{id:x,callback:a,isOpen:r[x]}),onFocus:()=>Ne.events.onFocus({id:x}),onBlur:()=>Ne.events.onBlur({id:x,callback:a}),onMouseLeave:()=>Ne.events.onBlur({id:x,callback:a}),onMouseEnter:()=>Ne.events.onMouseEnter({id:x,callback:a})};n&&(g&&(y={...A,onKeyPress:_=>{_.key==="Enter"&&Ne.events.onClick(_,{id:x,callback:a,isOpen:r[x]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[x],"aria-controls":x}),D={hidden:x in r?!r[x]:!0}),g||(D={...D,...A})}return d.jsxs("li",{className:Y({[o.className]:o.className,"has-submenu":p,parent:g,active:f}),...y,children:[m?C.createElement(c?Be:"a",m,s.formatMessage({id:h})):s.formatMessage({id:h}),o.order&&d.jsx("ul",{...D,children:o.order.map(x=>{if(!o[x])return null;const A={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[x].order?d.jsxs("li",{className:Y({[o[x].className]:o[x].className}),children:[s.formatMessage({id:`${h}_${x}`}),d.jsx("ul",{children:o[x].order.map(_=>d.jsx(Pa,{id:`${e}.${x}.${_}`,...A},_))})]},x):d.jsx(Pa,{id:`${e}.${x}`,...A},x)})})]},e)};const jw={height:67,height_desktop:83},_o=({showNavigation:e=!0})=>{const t=ue.useIntl(),n=C.useContext(Mt),r=Jn(!0,!0),a=n&&typeof n.id=="string",i=C.useMemo(()=>Ne.getIsDesktopVersion(a,r),[a,r]),[s,o]=C.useReducer(Or,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:c}=s,h=C.useRef(s);C.useEffect(()=>{h.current=s},[s]),kc({scrollPosition:jw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const f=h.current.menus;!i&&f.navigation||Ne.shouldChangeHeaderIsVisible(!0,f,o)},scrollDown:()=>{const f=h.current.menus;!i&&f.navigation||Ne.shouldChangeHeaderIsVisible(!1,f,o)}}});const m=(f,y,D=!1)=>{Ne.handleMenus({id:f,value:y,menus:h.current.menus,dispatch:o,forceHandle:D})},p=C.useRef(null),g=f=>{f.key==="Escape"&&["navigation","search","account"].forEach(y=>{h.current.menus[y]&&m(y,!1,!0)})};return C.useEffect(()=>{var f;return(f=document.getElementById("header"))==null||f.addEventListener("keydown",g),()=>{var y;(y=document.getElementById("header"))==null||y.removeEventListener("keydown",g)}},[]),Un(()=>{u.navigation&&Ne.autoFocus({menu:"navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.navigation]),Un(()=>{u.account&&Ne.autoFocus({menu:"account",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.account]),n&&n.isLoading?null:d.jsxs(d.Fragment,{children:[d.jsxs("nav",{id:"header",className:Y({"logged-in":a,"logged-out":!a,visible:l}),children:[d.jsx(Me,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),d.jsx(Eo,{variant:"monochrome"}),e&&d.jsxs(d.Fragment,{children:[!i.navigation&&d.jsx("button",{className:"menu-button gtm-trackable",onClick:f=>{f.preventDefault(),f.stopPropagation(),m("navigation",!u.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u.navigation,"aria-controls":"navigation",children:d.jsx(Me,{children:t.formatMessage({id:`header_menu_${u.navigation?"hide":"show"}`})})}),d.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||u.account?!1:!u.navigation,"data-showing":!i.navigation&&u.account?"account":"default",children:jr.order.map(f=>d.jsx(Pa,{id:f,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{navigation:u.navigation,account:u.account},callback:m},f))}),!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:f=>{f.preventDefault(),f.stopPropagation(),m("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:d.jsx(Me,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),d.jsx(kf,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),a?d.jsxs("button",{className:"account-button",onClick:f=>Ne.events.onClick(f,{id:"account",callback:m,isOpen:u.account}),onMouseEnter:()=>Ne.events.onMouseEnter({id:"account",callback:m}),onMouseLeave:()=>Ne.events.onBlur({id:"account",callback:m}),"aria-haspopup":"true","aria-expanded":u.account,"aria-controls":"navigation",children:[d.jsx(Me,{children:t.formatMessage({id:`header_account_${u.account?"hide":"show"}`})}),d.jsx(sn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):d.jsx("ul",{className:"sign-in-buttons",children:jr.buttons.order.map(f=>d.jsx(Pa,{id:`buttons.${f}`},f))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:Y("overlay",{open:u.navigation||u.account||!i.search&&u.search})})]})};const Ow=()=>{const e=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(_o,{}),d.jsx("div",{id:"content",children:d.jsx(an,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(ko,{})]})},Gf=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:c="default",variant:h="default",circle:m="default",modal:p="default"}=i,g=xc(),[f,y]=C.useState(""),D=F=>{const{detail:{message:S}}=F;y(S)};C.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",D),()=>{document.removeEventListener("ariaLive",D)}),[g]);const x=oa(e,{locale:o}),A=oa(t,{locale:o}),_=oa(n,{locale:o}),k={};return c!=="default"&&(k[c]=!0),h!=="default"&&(k[h]=!0),m!=="default"&&(k[m]=!0),d.jsx(xh.ErrorBoundary,{onError:r,fallback:d.jsx(Ow,{}),children:d.jsxs(C.Suspense,{fallback:null,children:[d.jsxs("div",{id:"wrapper",className:Y(s,k,{"has-footer":u}),children:[d.jsx(_o,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[A&&d.jsx("div",{className:Y("additional-content prepended",{"large-modal":p==="large"}),children:A}),C.createElement(c==="bold"?Co:"div",{id:"content",children:x,className:Y({"large-modal":p==="large"})})]}),_&&d.jsx("div",{className:"additional-content appended",children:_}),u&&d.jsx(ko,{}),d.jsx(Yf,{})]}),f&&d.jsx(Me,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},uc={default:"tags_",headerTopics:"header_topics_topics_"},Zi={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"},Pw={getTagDetails:e=>{if(e.includes("topic_")){if(e=Zi.topic[e.replace("topic_","")],e){const t=jr.topics.topics[e].href;return t?{id:e,href:t,text:`${uc.headerTopics}${e}`}:null}return null}return Zi[e]?(e=Zi[e],{id:e,text:`${uc.default}${e}`}):null}};const Nw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ue.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=Pw.getTagDetails(u);c&&l.push(c)}),l.length<1?null:d.jsx("ul",{className:Y("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const c=o.formatMessage({id:u.text});return d.jsx("li",{children:u.href&&r?d.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:c}):c},u.id)})})};const Rw=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=ue.useIntl();return e.length===0?null:d.jsxs("div",{className:Y("members-list",s),children:[d.jsxs("h1",{children:[o.formatMessage({id:"membersList"}),d.jsx("span",{className:"count",children:t})]}),d.jsx("ul",{children:e.map((l,u)=>d.jsxs("li",{children:[d.jsx(tr,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(hn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx(Rr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const Mw=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ue.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=s;return C.createElement(e,{className:Y("course-progression",o,{"highlight-percentage":c,"has-circle-graph":i==="circle"}),children:d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:h=>d.jsx("strong",{children:h}),number:u})}),u<100&&a&&d.jsx(Qa,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx($s,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Qf=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>C.createElement(e,{className:Y("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Jf=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ue.useIntl(),o=La(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Tc(a||"");return d.jsxs("small",{className:Y("content-type",{[e]:e!=="default"}),children:[d.jsx("span",{className:Y("type",n),children:o})," ",t>0&&!r&&d.jsx(Qa,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const Iw=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const h=ue.useIntl(),m="courseStructure_",p=u.toLowerCase().includes("course conclusion");return d.jsxs(za,{className:"course-structure",label:d.jsxs(d.Fragment,{children:[d.jsxs("small",{children:[h.formatMessage({id:`${m}section${p?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?h.formatMessage({id:`${m}time_completed`}):d.jsx(Qa,{time:s,appendedText:a?h.formatMessage({id:`${m}time_left`}):""})})]}),d.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[d.jsx("p",{children:n}),d.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:f,contentType:y,icon:D,image:x,isIntroduction:A,optional:_,slug:k,subsectionId:F,title:S,type:$})=>{const R=a&&t||A,I={};return x&&(I.style={"--image":`url(${x})`}),d.jsx("li",{className:Y({article:y===hr.ARTICLE,discussion:y===hr.DISCUSSION,quiz:y===hr.QUIZ,completed:g&&y===hr.ARTICLE,locked:!R}),...I,children:d.jsx(_n,{href:R?`/microcourses/en/${o}/${k}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Fc(S)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(Qf,{sectionId:i,subsectionId:F,title:S,className:"course-title"})," ",d.jsx(Jf,{completionTime:f,icon:D,optional:_,type:$,children:c&&c[k]&&d.jsx("span",{className:"quiz-score",children:`${c[k]}%`})})]})})},k)})})]})};const $w=({isComplete:e=!1,onClick:t,...n})=>{const r=ue.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),d.jsx(Be,{...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:Y("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})};let aa=null;const it="discussion_form_",Ja=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},placeholder:a,maxLength:i=0,forceShow:s={cancel:!1,error:!1},functions:o={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},listMembers:()=>Promise.resolve([]),props:{create:{projectNames:["questions-answers"]}}},data:l={},gtmContext:u="DiscussionForm"})=>{var M,w,E;const c=ue.useIntl(),h=C.useContext(Mt),[m,p]=C.useState(""),[g,f]=C.useState(r.isEditing&&r.isEditing.text||""),[y,D]=C.useState(s.error||!1),[x,A]=C.useState(!1);if(r.isLoading)return d.jsx(wt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const _=O=>{f(O);let j;!h||!h.id?j=kt(c.formatMessage,`${it}error_loggedOut`,t.type,"action"):n?i>0&&O.length>=i&&(j=`${it}error_tooLong`):j=kt(c.formatMessage,`${it}error_noPermission`,t.type,"action"),j?D(j):y&&D(!1)};let k=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const O=((M=t.slugs)==null?void 0:M.reply)||((w=t.slugs)==null?void 0:w.answer)||((E=t.slugs)==null?void 0:E.question)||"";O&&(k=`${k}-${O.slice(-15)}`)}e&&(k=`${e}-${k}`);const F=async O=>{var q;if(O.preventDefault(),O.stopPropagation(),!h||!h.id||!n||$)return;aa&&clearTimeout(aa),A("submitting");const j=window.location.pathname;try{let z;switch(t.type){case"post":z=await o.create({content:g});break;case"question":z=await o.create({title:g,authorId:h&&h.id,...(q=o.props)==null?void 0:q.create});break;case"response":z=await o.create({questionSlug:t.slugs.question},{body:g,authorId:h&&h.id,contentPath:j});break;case"reply":z=await o.create({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:g,authorId:h&&h.id,contentPath:j});break;default:break}await Oh(1e3),o.callback&&await o.callback(z),aa=setTimeout(()=>{f(""),A("submitted"),p(kt(c.formatMessage,`${it}success`,t.type,"action"));const re=new Event("discussionFormSubmitted");document.dispatchEvent(re),S()},500)}catch(z){const re=z;let X=`${it}error`;re!=null&&re.message.includes("entry already exists")&&(X=kt(c.formatMessage,`${it}error_alreadyExists`,t.type,"action")),re!=null&&re.message.includes("429")?X=kt(c.formatMessage,`${it}error_tooMany`,t.type,"action"):re!=null&&re.message.includes("400")&&(X=`${it}error`),D(X),S()}},S=()=>{aa=setTimeout(()=>{D(!1),A(!1),p("")},5e3)},$=!g||!zh(g),R=x==="submitting",I=[];return(r.isEditing&&!R||s.cancel)&&I.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!s.cancel&&(!h||!h.id||!g),children:c.formatMessage({id:`${it}cancel`})}),I.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:O=>{if(r.isEditing){A("submitting"),o.handleSaveEdit&&o.handleSaveEdit(g);return}F(O)},className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`${r.isEditing?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:!h||!h.id||!n||$||R||r.isEditing&&g===r.isEditing.text,children:c.formatMessage({id:`${it}${R?r.isEditing?"saving":"posting":r.isEditing?"save":"post"}`})}),d.jsxs(d.Fragment,{children:[d.jsxs("form",{id:k,className:Y("discussion-card discussion-form",{"no-styling":r.isInWrapper&&r.isEditing}),"data-testid":`discussion-${t.type}-form`,children:[(r==null?void 0:r.showTitle)&&!r.isEditing&&["question"].includes(t.type)&&d.jsx("h2",{children:kt(c.formatMessage,`${it}title`,t.type,"action")}),d.jsx(tr,{member:h||"community",gtmContext:u,gtmType:"profile-click"}),d.jsx(Me,{element:"label",showOnFocus:!1,htmlFor:`${k}-input`,children:kt(c.formatMessage,`${it}label`,t.type,"action")}),d.jsx(xf,{id:`${k}-input`,value:x==="submitting"&&!y?"":g,placeholder:a||kt(c.formatMessage,`${it}placeholder`,t.type,"action"),maxLength:i,functions:{onChange:_,listMembers:o.listMembers},data:l,autoFocus:!!r.isEditing,"aria-invalid":!!y,"aria-errormessage":"error-message"}),d.jsx("small",{children:kt(c.formatMessage,`${it}explainer`,t.type,"action",{a:O=>d.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:O})})}),d.jsx(kn,{buttons:I}),x==="submitted"&&r.showSuccessMessage&&d.jsx(Er,{className:"success","data-testid":"success",children:kt(c.formatMessage,`${it}success`,t.type,"action")}),y&&d.jsx(Er,{id:"error-message",className:"error","data-testid":"error",children:s.error?s.error:typeof y=="string"?y.includes(" ")?y:c.formatMessage({id:y},{action:c.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):y})]}),m&&d.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:m})]})},Bo=({form:e,membershipRequiredToPost:{isMember:t,required:n,join:r,leave:a,notMemberStateText:i}})=>{if(n&&!t)return d.jsx(an,{text:i,button:{breakpoints:{mobile:!0,901:!1},component:d.jsx(wo,{isShort:!0,functions:{join:r,leave:a}})}});const{content:s,functions:o,meta:l,...u}=e;return d.jsx(Ja,{content:{type:(s==null?void 0:s.type)||"reply",slugs:(s==null?void 0:s.slugs)||{}},functions:{...o,create:(o==null?void 0:o.create)||(()=>{})},meta:{...l,isEditing:(l==null?void 0:l.isEditing)||!1,showSuccessMessage:!1},...u,id:`add-post-${u.id||""}`})},Lw={showForm:!1},Xa=C.createContext(Lw),Xf=({children:e})=>{const[t,n]=C.useState({showForm:!1});return d.jsx(Xa.Provider,{value:{...t,updateConversation:n},children:e})},zw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),qw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Na=({icon:e,...t})=>d.jsx(Be,{className:"discussion-button",variant:"tertiary",icon:e,...t});let wr=!1;const Yi=()=>{wr!==!1&&(clearTimeout(wr),wr=!1)},Gi=5;let Qi=null;const eh=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const u=ue.useIntl(),c={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[h,m]=C.useReducer(Or,c),{numberOfLikes:p,userLikedContent:g,ignoreInteractions:f,showLikers:y,tabbableLink:D}=h;C.useEffect(()=>{m([{type:"userLikedContent",value:a}])},[a]);const x=C.useMemo(()=>qw(n,Gi),[n]),A=S=>{if(S.preventDefault(),S.stopPropagation(),m([{type:"showLikers",value:!1}]),wr)return Yi(),!1;if(Yi(),f||!s)return!1;wr=setTimeout(_,350)},_=async()=>{if(Yi(),f||!s)return!1;let S=g?p-1:p+1;S<0&&(S=0),m([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const $=zw(i.slugs);g?await l($):await o({...$,payload:{contentPath:window.location.pathname}})}}catch{m([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{m([{type:"ignoreInteractions",value:!1}])}},k=()=>{Qi=setTimeout(()=>{m([{type:"showLikers",value:!1}])},500)},F=()=>{Qi&&clearTimeout(Qi)};return C.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&m([{type:"showLikers",value:!1}])},onMouseEnter:()=>{F(),m([{type:"showLikers",value:!0}])},onMouseLeave:()=>{k()}},d.jsxs(d.Fragment,{children:[d.jsx(Na,{className:Y("discussion-button text-medium action-button",{"show-spinner":f,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:A,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:p})})}),n&&d.jsxs(d.Fragment,{children:[d.jsx(Me,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{F()},onBlur:()=>k,onClick:S=>{var R;S.preventDefault(),S.stopPropagation(),F(),m([{type:"showLikers",value:!0}]);const $=(R=S.currentTarget.nextSibling)==null?void 0:R.childNodes[0];if($){const I=$.querySelector("li:first-child a");I&&(m([{type:"tabbableLink",value:0}]),setTimeout(()=>{I.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),k())},"aria-expanded":y,"aria-controls":`likes-tooltip-${i.slug}`,children:d.jsx(Me,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),d.jsx(En,{id:`likes-tooltip-${i.slug}`,isOpen:y,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[x.map((S,$)=>{if(typeof S=="string"||!S.name)return null;const R={};return D!==$&&(R.tabIndex=-1),d.jsx("li",{"data-index":$,children:d.jsx(_n,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:I=>I==null?void 0:I.stopPropagation(),onFocus:()=>F(),onKeyDown:I=>{var j,q,z,re;if(!I||!["ArrowUp","ArrowDown"].includes(I.key||""))return;I.stopPropagation(),I.preventDefault();const M=I.key==="ArrowUp"?"up":"down",w=(j=I.currentTarget)==null?void 0:j.parentElement;let E=w==null?void 0:w.nextElementSibling;if(M==="up"){const X=w==null?void 0:w.previousElementSibling;X?E=X:(E=(q=w==null?void 0:w.parentElement)==null?void 0:q.lastElementChild,(E==null?void 0:E.getAttribute("data-index"))==="-1"&&(E=E==null?void 0:E.previousElementSibling))}else(!E||(E==null?void 0:E.getAttribute("data-index"))==="-1")&&(E=(z=w==null?void 0:w.parentElement)==null?void 0:z.firstElementChild);if(!E)return;const O=(E==null?void 0:E.getAttribute("data-index"))||"0";m([{type:"tabbableLink",value:O}]),(re=E==null?void 0:E.querySelector("a"))==null||re.focus()},...R,children:S.name})},S.id||window.btoa(S.name))}),t>Gi&&d.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Gi})})]})})]})]}))},lc=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},ei=(e,t)=>e&&!t,Ji=({children:e,class:t,...n})=>{const r={...n,class:Y("subtle",t)};return d.jsx("blockquote",{...r,children:e})},Ww=280,Hw=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Hn(e,Ww):e;return a=a.trim(),n?await Rc({text:a,template:'<a href="/profiles/{{id}}" class="mentioned-user">@{{name}}</a>',mentions:n,listMembers:r}):a};const Uw=3e3,Vw=({url:e})=>{const t=ue.useIntl(),[n,r]=C.useState({isOpen:!1,isCopied:!1});return d.jsxs("li",{children:[d.jsx(En,{className:Y("tooltip-share-link",{"tooltip-share-link-copied":n.isCopied}),isOpen:n.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.isCopied?t.formatMessage({id:"discussion_share_copy_link_success"}):t.formatMessage({id:"discussion_share_copy_link"})}),d.jsx(Na,{icon:{icon:"link_chain"},onMouseOver:()=>r({...n,isOpen:!0}),onFocus:()=>r({...n,isOpen:!0}),onMouseOut:()=>r({isOpen:!1,isCopied:!1}),onBlur:()=>r({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{r({isOpen:!0,isCopied:!0}),setTimeout(()=>{r({isOpen:!1,isCopied:!1})},Uw)})}})]})},zt="discussion_",Kw=195,Mr=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,forceHide:i={actionBar:!1,comments:!1,likes:!1},functions:s,links:o={},className:l,gtmContext:u="DiscussionAnswer",children:c,isTruncated:h=!1,styling:{showShareLinkButton:m=!1}={},setFocus:p=!1})=>{var ge,ke,xe,_e,We,Le,Ue,Qe;const g=ue.useIntl(),f=C.useContext(Mt),y=C.useContext(Xa),{createContent:D=async()=>{},deleteContent:x=async()=>{},updateContent:A=async()=>{}}=s.content||{},{createLike:_=()=>{},deleteLike:k=()=>{}}=s.likes||{},{openComments:F=()=>{}}=s.comments||{},{listMembers:S=()=>Promise.resolve([])}=s.mentions||{},{author:$,canLike:R,createdAt:I,id:M,likes:w=0,userLiked:E,comments:O=0,mentions:j}=t,q=f&&f.id&&typeof $!="string"&&$.id&&$.id===f.id||!1,z=typeof R=="boolean"?R:n?!q:!1,re=q&&(!t.createdAt||Sh(t.createdAt,10,"seconds")),X=C.useRef(null),[v,H]=C.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[ee,B]=C.useState(!1),[T,W]=C.useState(re?"highlighted":"default"),[L,U]=C.useState("");C.useEffect(()=>{const he=X.current;if(!(!he||T==="default"))return document.addEventListener("discussionFormSubmitted",te),he.addEventListener("transitionend",ne),()=>{document.removeEventListener("discussionFormSubmitted",te),he.removeEventListener("transitionend",ne)}},[]),C.useEffect(()=>{H({...v,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),C.useEffect(()=>{(async()=>{const Te=await Hw(v.body,h,j,S);H({...v,postBody:Te})})()},[v.body,j]);const te=()=>{setTimeout(()=>{W("fading")},1e3)},ne=({propertyName:he})=>{he==="background-color"&&W(Te=>(Te==="default"&&(document.removeEventListener("discussionFormSubmitted",te),X.current&&X.current.removeEventListener("transitionend",ne)),Te==="fading"?"default":Te))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||v.postBody==="")return d.jsx(wt,{className:"discussion-card discussion-post"});const ie=async he=>{he||(he=""),U("");try{if(!bc(he,v.body)){const Te=t.type==="question"?{title:he}:{body:he};await A(lc(t.slugs),Te)}H({...v,body:he,isEditing:!1,didEdit:!0})}catch{U(`${zt}form_error`)}},fe=()=>{y&&y.updateConversation&&y.updateConversation({showForm:!0}),setTimeout(()=>{var se,me,ve;const Te=`reply-form-${(t.type==="answer"?t.slug:((se=t.slugs)==null?void 0:se.reply)||((me=t.slugs)==null?void 0:me.answer)||((ve=t.slugs)==null?void 0:ve.question)||"").toLowerCase().slice(-15)}`,$e=document.getElementById(Te),K=document.getElementById(`${Te}-input`);K&&K.focus(),$e&&$e.scrollIntoView({behavior:"smooth"})},0)},Q=async()=>{B(!1);try{await x(lc(t.slugs))}catch{U("delete-error")}},pe=[{text:g.formatMessage({id:`${zt}moreMenu_report`}),onClick:he=>{he.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(g.formatMessage({id:`${zt}report_subject`}))}&body=${encodeURI(g.formatMessage({id:`${zt}report_body`},{contentType:t.type||"",contentSlug:t.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}))}`,icon:"flag"}];return n&&q&&pe.push({text:g.formatMessage({id:`${zt}moreMenu_edit`}),onClick:()=>H({...v,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`edit-${t.type}-click`},{text:g.formatMessage({id:`${zt}moreMenu_delete`}),onClick:he=>{he.preventDefault(),he.stopPropagation(),B(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`delete-${t.type}-click`,...Wf(`delete-${t.slug}-modal`,ee)}),p&&((ge=X==null?void 0:X.current)==null||ge.focus(),(ke=X==null?void 0:X.current)==null||ke.scrollIntoView({behavior:"smooth"})),C.createElement(e,{className:Y("discussion-post",l,{[T]:!l||!l.includes("highlighted-text-box"),"has-link":o.post&&!v.isEditing}),ref:X,tabIndex:p?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${u}-post-click`,onClick:he=>{!o.post||v.isEditing||(he.preventDefault(),he.stopPropagation(),window.location.href=o.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:M||t.slug,className:Y("discussion-card",t.type,{editing:v.isEditing,"has-link":o.post&&!v.isEditing}),children:[!v.isEditing&&d.jsx(tr,{member:$,additionalContent:{createdAt:I,didEdit:v.didEdit},className:typeof $!="string"&&$.id===a?"highlighted":"",gtmContext:u,gtmType:"profile-click"}),v.isEditing?d.jsx(Ja,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:v.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:L!==""&&L!=="delete-error"?g.formatMessage({id:L},{action:g.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:D,handleSaveEdit:ie,handleCancel:()=>{U(""),H({...v,isEditing:!1})},listMembers:S},gtmContext:`${u}Form`,data:{mentions:t.mentions}}):o.post?d.jsxs("a",{href:o.post,children:[(t==null?void 0:t.title)&&d.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),v.postBody.length>Kw?d.jsx(qc,{text:v.postBody,markdownOptions:{overrides:{a:os,blockquote:{component:Ji}}}}):d.jsx(Vn,{options:{overrides:{a:os,blockquote:{component:Ji}}},children:v.postBody})]}):d.jsx(Vn,{options:{wrapper:t.type==="question"?"h1":C.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:Ji}}},children:v.postBody}),!v.isEditing&&!(i!=null&&i.actionBar)&&d.jsxs("ul",{className:Y("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!i.likes&&d.jsx(eh,{element:"li",likes:w,isShort:!1,userLiked:E,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:z,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:_,deleteLike:k}}),!i.comments&&(["question","post"].includes(t.type)||o.comments||typeof F=="function")&&d.jsx("li",{children:d.jsx(Na,{onClick:he=>{he.preventDefault(),he.stopPropagation(),o.comments&&(window.location.href=o.comments),typeof F=="function"&&F()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":u,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:g.formatMessage({id:`${zt}comments_screenReader`},{count:O}),children:g.formatMessage({id:`${zt}comments`},{count:O})})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(Na,{styling:{muted:!0},onClick:fe,icon:{icon:"speech-bubble_square"},children:g.formatMessage({id:`${zt}reply`})})}),m&&d.jsx(Vw,{url:(xe=t.slugs)!=null&&xe.reply?`${window.location.origin}${(_e=t.slugs)==null?void 0:_e.question}/${(We=t.slugs)==null?void 0:We.answer}#${(Le=t.slugs)==null?void 0:Le.reply}`:`${window.location.origin}${(Ue=t.slugs)==null?void 0:Ue.question}/${(Qe=t.slugs)==null?void 0:Qe.answer}`}),d.jsx(Vf,{element:"li",id:`more-${t.slug}`,options:pe})]})]}),c,d.jsx(Nr,{id:`delete-${t.slug}-modal`,isOpen:ee,functions:{onOpen:()=>{},onClose:()=>B(!1)},forceShow:{error:L==="delete-error"?g.formatMessage({id:"discussion_delete_error"},{action:g.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:g.formatMessage({id:"discussion_delete_title"},{action:g.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>B(!1),children:g.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:Q,children:g.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:d.jsx(ue.FormattedMessage,{id:"discussion_delete_text",values:{p:he=>d.jsx("p",{children:he}),action:g.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Xi="discussion_responses_",th=({type:e="answer",responses:t=0})=>{const n=ue.useIntl();return t=parseInt(t),d.jsxs("div",{className:"responses-heading",children:[d.jsx("h4",{children:n.formatMessage({id:`${Xi}title`},{action:n.formatMessage({id:`${Xi}${e}`}),count:t})}),t===0&&d.jsx("p",{children:kt(n.formatMessage,`${Xi}empty`,e,e)})]})};const nh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ue.useIntl(),s=C.useContext(Xa),o=oa(a,{element:"li"});return d.jsxs("div",{className:Y("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&d.jsx("ul",{className:"thread",children:o}),!e&&d.jsx(Rr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&d.jsx(Ja,{...r})]})},Zw="post",Yw="reply",rh="00000000-0000-0000-0000-000000000000";function Ao({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Fo({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return e.setQueryData(t,r),a}return n}function Gw(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Qw(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function ah(e){const{id:t="",name:n="",organization:r="",jobTitle:a="",image:i={}}=e,{thumbnail:s=""}=i;return{id:t,data:{name:n,organization:r,jobTitle:a,thumbnail:s}}}function Jw({content:e}){return{content:e,id:rh,time:new Date().toISOString(),verb:Zw}}function cc({activity:e,user:t}){return{...e,actor:ah(t),...Gw()}}function Ra({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((a=e.own_reactions)==null?void 0:a.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function ih({activity:e,user:t}){var n,r,a;e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like-1:0},t!=null&&t.id&&(e.latest_reactions={...e.latest_reactions||{},like:(((r=e.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((a=e.own_reactions)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function Xw({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:rh,kind:Yw,parent:t||""}}function dc({reply:e,user:t}){const n=ah(t);return{...e,user_id:n.id,user:n,...Qw()}}function fc({reply:e,reaction:t}){var n,r,a;t?(e.latest_children={...e.latest_children||{},like:[...((r=e.latest_children)==null?void 0:r.like)||[],t]},e.own_children={...e.own_children||{},like:[...((a=e.own_children)==null?void 0:a.like)||[],t]}):e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like+1:1}}function eE({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}const sh=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let hc,es=0;const oh=()=>{C.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(hc);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),es=0;return}es++,!(es>10)&&(hc=setTimeout(()=>{e(t)},50))}},Qn=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}),rn=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}),uh=Object.freeze({actor:`SU:${Qn.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"}),tE=Object.freeze({actor:`SU:${rn.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"}),nE=Object.freeze({actor:`SU:${Qn.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"}),rE=Object.freeze({actor:`SU:${rn.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:uh.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:rn.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:rn.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:rn.id,user:{id:rn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:uh.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:Qn.id,user:{id:Qn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:tE.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:rn.id,user:{id:rn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:nE.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:Qn.id,user:{id:Qn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:rE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function aE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=cc({activity:Jw(o),user:i});return mc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=cc({activity:o,user:i});r.setQueryData(a,mc(c,u,!0)),setTimeout(()=>{sh(c.id)},0)}});return s}function iE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Ma(a,s);return o&&(o.content=i),s}),onError:n});return r}function sE({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ke.useQueryClient(),l=Ga(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:Ao(u),mutate:Fo(u)},user:l,...u},h=aE({...c,mutationFn:e}),m=iE({...c,mutationFn:t}),p=oE({...c,mutationFn:n}),g=lE({...c,mutationFn:a}),f=cE({...c,mutationFn:i}),{activities:y,...D}=uE({queryKey:s,queryFn:r});return{activities:y,mutations:{create:h,edit:m,remove:g,like:p,unlike:f},user:l,...D}}function oE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Ma(s,o);return l&&Ra({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Ma(o,l);u&&Ra({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function uE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{activities:fE(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function lE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>dE(a,i)),onError:n});return r}function cE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Ma(i,s);return o&&ih({activity:o,user:r}),s}),onError:n});return a}function mc(e,t,n=!1){return t?(n?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t):{pages:[{next:"",results:[e]}],pageParams:[""]}}function Ma(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function dE(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function fE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const hE=({basePath:e,parentId:t,isMember:n,functions:{activities:r,mentions:a,join:i,leave:s}})=>{const o=ue.useIntl(),{activities:l,error:u,fetchNextPage:c,hasNextPage:h,isLoading:m,mutations:{create:p,edit:g,remove:f,like:y,unlike:D},user:x}=sE({queryKey:[e,t,"activities"],queryFns:r}),[A,_]=C.useState(null),k=()=>{_(l.length),c()};return oh(),u?d.jsx(an,{variant:"error",text:u.message}):d.jsxs("section",{children:[d.jsx(Bo,{form:{content:{type:"post",slugs:{}},functions:{create:p,listMembers:a.listMembers},meta:{isEditing:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),l==null?void 0:l.map((F,S)=>{var X,v,H,ee,B,T,W,L;const{id:$,own_reactions:R,latest_reactions:I,reaction_counts:M,mentioned_users:w}=F,E=(((X=I==null?void 0:I.like)==null?void 0:X.length)||0)>0,O=(((v=R==null?void 0:R.like)==null?void 0:v.length)||0)>0,j=O?R==null?void 0:R.like[0].id:"",q=E?(H=I==null?void 0:I.like)==null?void 0:H.map(U=>{var te,ne,ie;return{id:(te=U==null?void 0:U.user)==null?void 0:te.id,name:(ie=(ne=U==null?void 0:U.user)==null?void 0:ne.data)==null?void 0:ie.name}}):!1,z=F==null?void 0:F.actor,re=(z==null?void 0:z.id)===(x==null?void 0:x.id);return d.jsx(C.Fragment,{children:d.jsx(Mr,{content:{type:"post",title:F==null?void 0:F.title,body:F==null?void 0:F.content,canLike:ei(n,re),createdAt:(F==null?void 0:F.time)||"",slugs:{question:`${e}/${t}`,answer:$},slug:$,author:{id:z==null?void 0:z.id,name:(ee=z==null?void 0:z.data)==null?void 0:ee.name,organization:(B=z==null?void 0:z.data)==null?void 0:B.organization,jobTitle:(T=z==null?void 0:z.data)==null?void 0:T.jobTitle,location:(W=z==null?void 0:z.data)==null?void 0:W.location,image:{thumbnail:((L=z==null?void 0:z.data)==null?void 0:L.thumbnail)||void 0}},userLiked:O,likes:(M==null?void 0:M.like)||0,comments:(M==null?void 0:M.reply)||0,peopleWhoLiked:q,mentions:w},links:{post:`${e}/${t}/${$}`,comments:`${e}/${t}/${$}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>f({activityId:$}),updateContent:(U,{body:te})=>g({activityId:$,content:te})},likes:{createLike:()=>y({activityId:$}),deleteLike:()=>D({activityId:$,reactionId:j})},comments:{openComments:()=>null},mentions:a},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:S===A})},$)}),!m&&d.jsx(Rr,{hasNextPage:h,loadNextPage:k,icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})},mE={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function pE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=dc({reply:Xw(o),user:i});return pc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=dc({reply:o,user:i});r.setQueryData(a,pc(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{sh(c.id)},0)}});return s}function gE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ia(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function lh({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ke.useQueryClient(),l=Ga(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:Ao(u),mutate:Fo(u)},user:l,...u},h=pE({...c,mutationFn:e}),m=gE({...c,mutationFn:t}),p=vE({...c,mutationFn:n}),g=yE({...c,mutationFn:a}),f=DE({...c,mutationFn:i}),{replies:y,...D}=bE({queryKey:s,queryFn:r});return{replies:y,mutations:{create:h,edit:m,remove:g,like:p,unlike:f},user:l,...D}}function vE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Ia(s,o);return l&&fc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ia(o,l);u&&fc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function bE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=kE(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function yE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>EE(a,i)),onError:n});return r}function DE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ia(i,s);return o&&eE({reply:o,user:r}),s}),onError:n});return a}function CE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function xE(e,t,n){const r=t.pages.length-1,a=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[a]=e:t.pages[r].results.push(e),t}function wE(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 pc(e,t,n){return t?n!=null&&n.append?xE(e,t,n):wE(e,t,n):CE(e)}function Ia(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function EE(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function kE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const _E=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=ue.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:c,isLoading:h,mutations:{create:m,edit:p,like:g,remove:f,unlike:y},user:D}=lh({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:_=>i.list({..._,reactionId:r})}});Ns([h]);const[x,A]=C.useState(!0);return d.jsxs(d.Fragment,{children:[(l==null?void 0:l.length)>=o&&d.jsx(Be,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${x?"up_left":"down_right"}`,position:"left"},onClick:()=>A(!x),children:s.formatMessage({id:`discussion_thread_${x?"hide":"show"}`},{count:l==null?void 0:l.length})}),x&&d.jsx(nh,{loadMore:{isLoading:h,hasNextPage:c,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(_,{body:k})=>m({activityId:n,replyId:r,content:k}),listMembers:i.listMembers},meta:{isEditing:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(_=>{var v,H,ee,B,T,W,L,U,te,ne,ie,fe;const{id:k,own_children:F,latest_children:S,children_counts:$,data:{mentioned_users:R}}=_,M=(((v=F==null?void 0:F.like)==null?void 0:v.length)||0)>0?(H=F==null?void 0:F.like)==null?void 0:H.find(Q=>{var pe;return((pe=Q==null?void 0:Q.user)==null?void 0:pe.id)===(D==null?void 0:D.id)}):!1,w=M?M==null?void 0:M.id:"",E=!!M,j=(((ee=S==null?void 0:S.like)==null?void 0:ee.length)||0)>0?(B=S==null?void 0:S.like)==null?void 0:B.map(Q=>{var pe,ge,ke;return{id:(pe=Q==null?void 0:Q.user)==null?void 0:pe.id,name:(ke=(ge=Q==null?void 0:Q.user)==null?void 0:ge.data)==null?void 0:ke.name}}):!1,q=_==null?void 0:_.user,z=(q==null?void 0:q.id)===(D==null?void 0:D.id),re=ei(a,z),X=typeof _.data.content=="string"?(T=_==null?void 0:_.data)==null?void 0:T.content:((L=(W=_==null?void 0:_.data)==null?void 0:W.content)==null?void 0:L.text)||"";return d.jsx(Mr,{content:{id:k,type:"reply",body:X,canLike:re,createdAt:_==null?void 0:_.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:_==null?void 0:_.parent},slug:"",author:{id:q==null?void 0:q.id,name:(U=q.data)==null?void 0:U.name,organization:(te=q.data)==null?void 0:te.organization,jobTitle:(ne=q.data)==null?void 0:ne.jobTitle,location:(ie=q.data)==null?void 0:ie.location,image:{thumbnail:((fe=q.data)==null?void 0:fe.thumbnail)||void 0}},userLiked:E,likes:($==null?void 0:$.like)||0,peopleWhoLiked:j,mentions:R},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:k}),updateContent:(Q,{body:pe})=>p({replyId:k,content:pe})},likes:{createLike:()=>g({replyId:k}),deleteLike:()=>y({replyId:k,reactionId:w})},comments:{},mentions:{listMembers:i.listMembers}},styling:{showShareLinkButton:!0}},k)}):null})]})};const ch=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,mentions:i,join:s,leave:o}})=>{const l=ue.useIntl(),{replies:u,repliesCount:c,fetchNextPage:h,hasNextPage:m,isLoading:p,mutations:{create:g,edit:f,like:y,remove:D,unlike:x},user:A}=lh({queryKey:[e,t,n,"replies"],queryFns:a}),_=()=>{F(u.length),h()},[k,F]=C.useState(null);return Ns([p]),oh(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(th,{type:"comment",responses:c}),d.jsx(Bo,{form:{content:{type:"reply",slugs:{}},functions:{create:(S,{body:$})=>g({activityId:n,content:$}),...i},meta:{isEditing:!1,showSuccessMessage:!1},placeholder:l.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:s,leave:o,notMemberStateText:l.formatMessage({id:"community_joinToPost"})}}),u==null?void 0:u.map((S,$)=>{var T,W,L,U,te,ne,ie,fe,Q,pe,ge,ke;const{id:R,own_children:I,latest_children:M,children_counts:w,data:{mentioned_users:E}}=S,j=(((T=I==null?void 0:I.like)==null?void 0:T.length)||0)>0?(W=I==null?void 0:I.like)==null?void 0:W.find(xe=>{var _e;return((_e=xe==null?void 0:xe.user)==null?void 0:_e.id)===(A==null?void 0:A.id)}):!1,q=j?j==null?void 0:j.id:"",z=!!j,X=(((L=M==null?void 0:M.like)==null?void 0:L.length)||0)>0?(U=M==null?void 0:M.like)==null?void 0:U.map(xe=>{var _e,We,Le;return{id:(_e=xe==null?void 0:xe.user)==null?void 0:_e.id,name:(Le=(We=xe==null?void 0:xe.user)==null?void 0:We.data)==null?void 0:Le.name}}):!1,v=S==null?void 0:S.user,H=(v==null?void 0:v.id)===(A==null?void 0:A.id),ee=ei(r,H),B=typeof S.data.content=="string"?(te=S==null?void 0:S.data)==null?void 0:te.content:((ie=(ne=S==null?void 0:S.data)==null?void 0:ne.content)==null?void 0:ie.text)||"";return d.jsx(Xf,{children:d.jsx(Mr,{content:{id:R,type:"reply",body:B,canLike:ee,createdAt:S==null?void 0:S.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:R},slug:R,author:{id:v==null?void 0:v.id,name:(fe=v.data)==null?void 0:fe.name,organization:(Q=v.data)==null?void 0:Q.organization,jobTitle:(pe=v.data)==null?void 0:pe.jobTitle,location:(ge=v.data)==null?void 0:ge.location,image:{thumbnail:((ke=v.data)==null?void 0:ke.thumbnail)||void 0}},userLiked:z,likes:(w==null?void 0:w.like)||0,peopleWhoLiked:X,mentions:E},functions:{content:{createContent:()=>null,deleteContent:()=>D({replyId:R}),updateContent:(xe,{body:_e})=>f({replyId:R,content:_e})},likes:{createLike:()=>y({replyId:R}),deleteLike:()=>x({replyId:R,reactionId:q})},comments:{},mentions:i},children:d.jsx(_E,{basePath:e,parentId:t,activityId:n,replyId:R,isMember:r,functions:{...a,...i}}),styling:{showShareLinkButton:!0},setFocus:$===k},R)},R)}),!p&&d.jsx(Rr,{hasNextPage:m,loadNextPage:_,icon:{icon:"arrow-down",position:"right"},messages:{button:l.formatMessage({id:"loadMore_button"}),error:l.formatMessage({id:"loadMore_error"})}})]})};function BE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({content:a})=>t(i=>(i&&(i.content=a),i)),onError:n});return r}function AE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=Ke.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function FE({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=Ke.useQueryClient(),s=Ga(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:Ao(o),mutate:Fo(o)},user:s,...o},u=BE({...l,mutationFn:t}),c=TE({...l,mutationFn:n}),h=SE({...l,mutationFn:r}),{activity:m,...p}=AE({queryKey:a,queryFn:e});return{activity:m,mutations:{edit:u,like:c,unlike:h},user:s,...p}}function TE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ra({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ra({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function SE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&ih({activity:s,user:r}),s)),onError:n});return a}const jE=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,mentions:o,join:l,leave:u}})=>{var M,w,E,O,j,q,z,re,X,v;const c=ue.useIntl(),h=C.useContext(Mt),{activity:m,error:p,isLoading:g,mutations:{edit:f,like:y,unlike:D}}=FE({queryFns:i,queryKey:[e,t,n]});if(g)return d.jsx(wt,{style:{height:"400px"}});if(p||!m)return d.jsx(an,{variant:"error",text:c.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:x,latest_reactions:A,mentioned_users:_}=m,k=(((M=A==null?void 0:A.like)==null?void 0:M.length)||0)>0,F=(((w=x==null?void 0:x.like)==null?void 0:w.length)||0)>0,S=F?x==null?void 0:x.like[0].id:"",$=k?(E=A==null?void 0:A.like)==null?void 0:E.map(H=>{var ee,B,T;return{id:(ee=H==null?void 0:H.user)==null?void 0:ee.id,name:(T=(B=H==null?void 0:H.user)==null?void 0:B.data)==null?void 0:T.name}}):!1,R=m==null?void 0:m.actor,I=(R==null?void 0:R.id)===(h==null?void 0:h.id);return d.jsxs("section",{className:"activity-section",children:[d.jsx(Mr,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:m==null?void 0:m.content,canLike:ei(r,I),createdAt:(m==null?void 0:m.time)||"",slugs:{question:`${e}/${t}`,answer:m==null?void 0:m.id},slug:n,author:{id:R.id,name:(O=R.data)==null?void 0:O.name,organization:(j=R.data)==null?void 0:j.organization,jobTitle:(q=R.data)==null?void 0:q.jobTitle,location:(z=R.data)==null?void 0:z.location,image:{thumbnail:((re=R.data)==null?void 0:re.thumbnail)||void 0}},userLiked:F,likes:((X=m==null?void 0:m.reaction_counts)==null?void 0:X.like)||0,comments:((v=m==null?void 0:m.reaction_counts)==null?void 0:v.reply)||0,peopleWhoLiked:$,mentions:_},originalAuthorId:R==null?void 0:R.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(H,{body:ee})=>f({content:ee})},likes:{createLike:()=>y({activityId:n}),deleteLike:()=>D({activityId:n,reactionId:S})},comments:{openComments:()=>{}},mentions:o},styling:{showShareLinkButton:!0}},n),d.jsx(ch,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,mentions:o,join:l,leave:u}})]})},OE=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),gc=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ia="notFoundError_",PE=()=>{const e=ue.useIntl(),t=[];return gc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ia}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(Gf,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(ln,{children:[d.jsx(Uf,{cards:gc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(Be,{href:"/solution-articles/",children:e.formatMessage({id:`${ia}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ia}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ia}text`})})]})};exports.ASSETS_BUCKET=Ht;exports.ActivitiesFeed=hE;exports.ActivitySection=jE;exports.AddPost=Bo;exports.Banner=Xx;exports.BannerSection=sw;exports.Breadcrumbs=yw;exports.Buckets=Kh;exports.Button=Be;exports.ButtonWrapper=kn;exports.COURSE_CONTENT_TYPES=hr;exports.CacheProvider=Mf;exports.Card=xo;exports.CardBlock=Uf;exports.Carousel=vw;exports.CharacterLimit=Ws;exports.CollapsibleSection=za;exports.Columns=Zf;exports.CommunityDetails=bw;exports.ContactFooter=Tw;exports.ContactForm=wf;exports.ContentTypeLabel=$c;exports.Contributors=qs;exports.ConversationContext=Xa;exports.CookieBanner=Yf;exports.CourseProgression=Mw;exports.CourseStructure=Iw;exports.CustomContentBanner=ow;exports.Directory=Yx;exports.DiscussionConversation=Xf;exports.DiscussionForm=Ja;exports.DiscussionLikes=eh;exports.DiscussionPost=Mr;exports.DiscussionThread=nh;exports.Divider=tn;exports.DownloadSection=ew;exports.EMAILS=Nn;exports.EditSection=nw;exports.EmailHelperTextBox=Kc;exports.EmptyStateBox=an;exports.Filters=Dw;exports.FlagsProvider=If;exports.Footer=ko;exports.Form=nr;exports.Formatting=Z;exports.FullWidthSection=ln;exports.GET_STREAM_USER_PREFIX=ns;exports.GlobalProviders=Kx;exports.Header=_o;exports.HelperTextBox=zc;exports.HiddenFromScreenReaders=$a;exports.HideShowTextBox=qc;exports.HighlightSection=lw;exports.HighlightedTextBox=Nt;exports.INVALID_TOKEN=Sc;exports.IconBulletedList=Gh;exports.ImageContainer=Hh;exports.IntlProvider=$f;exports.InviteForm=Ef;exports.InviteModal=Zx;exports.JoinButton=wo;exports.LanguageContext=yo;exports.LanguageSwitcher=xw;exports.LessonName=Qf;exports.LessonType=Jf;exports.Link=_n;exports.LoadMore=Rr;exports.LoadingBlock=om;exports.LoadingPlaceholder=wt;exports.LoadingState=Ls;exports.Logo=Eo;exports.LogoSection=rw;exports.MENTION_REGEX=jc;exports.MarkCompleteButton=$w;exports.MarkdownText=Vn;exports.MarketingBlock=cw;exports.Marks=Ot;exports.Member=tr;exports.MembersList=Rw;exports.Modal=Co;exports.MoreMenu=Vf;exports.NUMBER_OF_COUNTRIES=Th;exports.NUMBER_OF_USERS=Fh;exports.NavigationMenu=Kf;exports.NotFoundError=PE;exports.Overlay=Nr;exports.OverlayContext=Do;exports.OverlayProvider=qf;exports.PageHeading=Wc;exports.PageLayout=Gf;exports.PasswordForm=zC;exports.PasswordRules=Jc;exports.Pill=hn;exports.Popover=Ic;exports.Portal=Is;exports.ProfileImageChange=LC;exports.ProfilePicture=sn;exports.ProgressBar=$s;exports.ProgressTracker=Uh;exports.Rating=Dm;exports.RepliesFeed=ch;exports.ResponsesHeading=th;exports.ResponsiveImage=er;exports.ReturnToNavButton=Vh;exports.RichTextEditor=xf;exports.SearchForm=kf;exports.ShareLinks=Bw;exports.SignupForm=KC;exports.Span=os;exports.StatusBanner=Er;exports.TableOfContents=Jx;exports.Tabs=Aw;exports.Tags=Nw;exports.TestimonialBlock=Qx;exports.TimeToComplete=Qa;exports.Toggle=$C;exports.Tooltip=En;exports.TopLevelPage=Sw;exports.UUID_V4_REGEX=rs;exports.UserContext=Mt;exports.UserProvider=Lf;exports.VisuallyHidden=Me;exports.addAriaProps=Wf;exports.basicReducer=Or;exports.camelCaseToDashCase=Ac;exports.checkIntlPathExists=La;exports.generateConditions=ma;exports.generateCssIcon=Oc;exports.getCharacterLimitProps=Vc;exports.getLongDate=Ms;exports.getMember=zs;exports.getShortDate=Pc;exports.getValueLength=qa;exports.headerData=jr;exports.mapGetStreamData=OE;exports.pageReady=Nc;exports.passwordValidator=is;exports.repliesFeedMock=mE;exports.supportedLanguages=ga;exports.toCamelCase=Fc;exports.toCapitalisedCase=Ah;exports.toSentenceCase=Tc;exports.useCurrentPath=xc;exports.useEffectAfterMount=Un;exports.useElementWidth=Jn;exports.useOverlay=zf;exports.useScrollListener=kc;exports.useScrollToHash=Ns;exports.useTooltips=Rs;exports.useUser=Ga;