@apolitical/component-library 4.5.9-beta.0 → 4.5.9

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 D=require("react"),ue=require("react-intl"),bn=require("lodash.clonedeep"),Ah=require("lodash.set"),Ec=require("react-dom"),Rt=require("markdown-to-jsx"),Yn=require("truncate"),Ye=require("@tanstack/react-query"),Th=require("@tanstack/react-query-devtools"),ha=require("posthog-js"),Ls=require("react-cookie"),os=require("lodash.isequal"),Sh=require("react-multi-email"),kc=require("lodash.get"),jh=require("react-error-boundary");var Hr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function _c(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 Bc={exports:{}};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),ue=require("react-intl"),bn=require("lodash.clonedeep"),Bh=require("lodash.set"),xc=require("react-dom"),Rt=require("markdown-to-jsx"),Zn=require("truncate"),Ye=require("@tanstack/react-query"),Fh=require("@tanstack/react-query-devtools"),da=require("posthog-js"),Is=require("react-cookie"),is=require("lodash.isequal"),Ah=require("react-multi-email"),wc=require("lodash.get"),Th=require("react-error-boundary");var Hr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ec(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 kc={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})()})(Bc);var Oh=Bc.exports;const Y=Fn(Oh),Ph=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>D.createElement(e,{...a,className:Y("hidden",r,{"show-on-focus":t}),children:n}),Ie=D.memo(Ph),Nh=({element:e="span",children:t=null,...n})=>D.createElement(e,{...n,"aria-hidden":!0},t),Ua=D.memo(Nh);var us={exports:{}},ur={};/**
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})()})(kc);var Sh=kc.exports;const Y=Fn(Sh),jh=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>y.createElement(e,{...a,className:Y("hidden",r,{"show-on-focus":t}),children:n}),Ie=y.memo(jh),Oh=({element:e="span",children:t=null,...n})=>y.createElement(e,{...n,"aria-hidden":!0},t),Wa=y.memo(Oh);var ss={exports:{}},ur={};/**
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 qo;function Rh(){if(qo)return ur;qo=1;var e=D,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var d,f={},p=null,m=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(m=l.ref);for(d in l)r.call(l,d)&&!i.hasOwnProperty(d)&&(f[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:t,type:o,key:p,ref:m,props:f,_owner:a.current}}return ur.Fragment=n,ur.jsx=s,ur.jsxs=s,ur}var lr={};/**
13
+ */var Lo;function Ph(){if(Lo)return ur;Lo=1;var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var c,h={},p=null,m=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(m=l.ref);for(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:p,ref:m,props:h,_owner:a.current}}return ur.Fragment=n,ur.jsx=s,ur.jsxs=s,ur}var lr={};/**
14
14
  * @license React
15
15
  * react-jsx-runtime.development.js
16
16
  *
@@ -18,38 +18,38 @@
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 Wo;function Mh(){return Wo||(Wo=1,process.env.NODE_ENV!=="production"&&function(){var e=D,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),g=Symbol.iterator,h="@@iterator";function y(O){if(O===null||typeof O!="object")return null;var se=g&&O[g]||O[h];return typeof se=="function"?se:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(O){{for(var se=arguments.length,ce=new Array(se>1?se-1:0),Ce=1;Ce<se;Ce++)ce[Ce-1]=arguments[Ce];_("error",O,ce)}}function _(O,se,ce){{var Ce=v.ReactDebugCurrentFrame,Oe=Ce.getStackAddendum();Oe!==""&&(se+="%s",ce=ce.concat([Oe]));var Le=ce.map(function(je){return String(je)});Le.unshift("Warning: "+se),Function.prototype.apply.call(console[O],console,Le)}}var x=!1,k=!1,T=!1,S=!1,q=!1,N;N=Symbol.for("react.module.reference");function I(O){return!!(typeof O=="string"||typeof O=="function"||O===r||O===i||q||O===a||O===u||O===d||S||O===m||x||k||T||typeof O=="object"&&O!==null&&(O.$$typeof===p||O.$$typeof===f||O.$$typeof===s||O.$$typeof===o||O.$$typeof===l||O.$$typeof===N||O.getModuleId!==void 0))}function z(O,se,ce){var Ce=O.displayName;if(Ce)return Ce;var Oe=se.displayName||se.name||"";return Oe!==""?ce+"("+Oe+")":ce}function E(O){return O.displayName||"Context"}function F(O){if(O==null)return null;if(typeof O.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof O=="function")return O.displayName||O.name||null;if(typeof O=="string")return O;switch(O){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if(typeof O=="object")switch(O.$$typeof){case o:var se=O;return E(se)+".Consumer";case s:var ce=O;return E(ce._context)+".Provider";case l:return z(O,O.render,"ForwardRef");case f:var Ce=O.displayName||null;return Ce!==null?Ce:F(O.type)||"Memo";case p:{var Oe=O,Le=Oe._payload,je=Oe._init;try{return F(je(Le))}catch{return null}}}return null}var j=Object.assign,M=0,V,G,J,ae,C,R,W;function B(){}B.__reactDisabledLog=!0;function A(){{if(M===0){V=console.log,G=console.info,J=console.warn,ae=console.error,C=console.group,R=console.groupCollapsed,W=console.groupEnd;var O={configurable:!0,enumerable:!0,value:B,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}M++}}function L(){{if(M--,M===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},O,{value:V}),info:j({},O,{value:G}),warn:j({},O,{value:J}),error:j({},O,{value:ae}),group:j({},O,{value:C}),groupCollapsed:j({},O,{value:R}),groupEnd:j({},O,{value:W})})}M<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var $=v.ReactCurrentDispatcher,U;function re(O,se,ce){{if(U===void 0)try{throw Error()}catch(Oe){var Ce=Oe.stack.trim().match(/\n( *(at )?)/);U=Ce&&Ce[1]||""}return`
21
+ */var zo;function Nh(){return zo||(zo=1,process.env.NODE_ENV!=="production"&&function(){var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function D(O){if(O===null||typeof O!="object")return null;var se=g&&O[g]||O[f];return typeof se=="function"?se:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(O){{for(var se=arguments.length,ce=new Array(se>1?se-1:0),Ce=1;Ce<se;Ce++)ce[Ce-1]=arguments[Ce];B("error",O,ce)}}function B(O,se,ce){{var Ce=v.ReactDebugCurrentFrame,Oe=Ce.getStackAddendum();Oe!==""&&(se+="%s",ce=ce.concat([Oe]));var Le=ce.map(function(je){return String(je)});Le.unshift("Warning: "+se),Function.prototype.apply.call(console[O],console,Le)}}var x=!1,k=!1,T=!1,S=!1,q=!1,N;N=Symbol.for("react.module.reference");function I(O){return!!(typeof O=="string"||typeof O=="function"||O===r||O===i||q||O===a||O===u||O===c||S||O===m||x||k||T||typeof O=="object"&&O!==null&&(O.$$typeof===p||O.$$typeof===h||O.$$typeof===s||O.$$typeof===o||O.$$typeof===l||O.$$typeof===N||O.getModuleId!==void 0))}function z(O,se,ce){var Ce=O.displayName;if(Ce)return Ce;var Oe=se.displayName||se.name||"";return Oe!==""?ce+"("+Oe+")":ce}function w(O){return O.displayName||"Context"}function F(O){if(O==null)return null;if(typeof O.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof O=="function")return O.displayName||O.name||null;if(typeof O=="string")return O;switch(O){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 O=="object")switch(O.$$typeof){case o:var se=O;return w(se)+".Consumer";case s:var ce=O;return w(ce._context)+".Provider";case l:return z(O,O.render,"ForwardRef");case h:var Ce=O.displayName||null;return Ce!==null?Ce:F(O.type)||"Memo";case p:{var Oe=O,Le=Oe._payload,je=Oe._init;try{return F(je(Le))}catch{return null}}}return null}var j=Object.assign,M=0,V,G,J,ae,C,R,W;function _(){}_.__reactDisabledLog=!0;function A(){{if(M===0){V=console.log,G=console.info,J=console.warn,ae=console.error,C=console.group,R=console.groupCollapsed,W=console.groupEnd;var O={configurable:!0,enumerable:!0,value:_,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}M++}}function L(){{if(M--,M===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},O,{value:V}),info:j({},O,{value:G}),warn:j({},O,{value:J}),error:j({},O,{value:ae}),group:j({},O,{value:C}),groupCollapsed:j({},O,{value:R}),groupEnd:j({},O,{value:W})})}M<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var $=v.ReactCurrentDispatcher,U;function re(O,se,ce){{if(U===void 0)try{throw Error()}catch(Oe){var Ce=Oe.stack.trim().match(/\n( *(at )?)/);U=Ce&&Ce[1]||""}return`
22
22
  `+U+O}}var te=!1,ne;{var le=typeof WeakMap=="function"?WeakMap:Map;ne=new le}function Q(O,se){if(!O||te)return"";{var ce=ne.get(O);if(ce!==void 0)return ce}var Ce;te=!0;var Oe=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Le;Le=$.current,$.current=null,A();try{if(se){var je=function(){throw Error()};if(Object.defineProperty(je.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(je,[])}catch(qt){Ce=qt}Reflect.construct(O,[],je)}else{try{je.call()}catch(qt){Ce=qt}O.call(je.prototype)}}else{try{throw Error()}catch(qt){Ce=qt}O()}}catch(qt){if(qt&&Ce&&typeof qt.stack=="string"){for(var Be=qt.stack.split(`
23
23
  `),at=Ce.stack.split(`
24
24
  `),Ze=Be.length-1,Ge=at.length-1;Ze>=1&&Ge>=0&&Be[Ze]!==at[Ge];)Ge--;for(;Ze>=1&&Ge>=0;Ze--,Ge--)if(Be[Ze]!==at[Ge]){if(Ze!==1||Ge!==1)do if(Ze--,Ge--,Ge<0||Be[Ze]!==at[Ge]){var yt=`
25
- `+Be[Ze].replace(" at new "," at ");return O.displayName&&yt.includes("<anonymous>")&&(yt=yt.replace("<anonymous>",O.displayName)),typeof O=="function"&&ne.set(O,yt),yt}while(Ze>=1&&Ge>=0);break}}}finally{te=!1,$.current=Le,L(),Error.prepareStackTrace=Oe}var Pn=O?O.displayName||O.name:"",zo=Pn?re(Pn):"";return typeof O=="function"&&ne.set(O,zo),zo}function pe(O,se,ce){return Q(O,!1)}function he(O){var se=O.prototype;return!!(se&&se.isReactComponent)}function ye(O,se,ce){if(O==null)return"";if(typeof O=="function")return Q(O,he(O));if(typeof O=="string")return re(O);switch(O){case u:return re("Suspense");case d:return re("SuspenseList")}if(typeof O=="object")switch(O.$$typeof){case l:return pe(O.render);case f:return ye(O.type,se,ce);case p:{var Ce=O,Oe=Ce._payload,Le=Ce._init;try{return ye(Le(Oe),se,ce)}catch{}}}return""}var Fe=Object.prototype.hasOwnProperty,Ae={},He=v.ReactDebugCurrentFrame;function Se(O){if(O){var se=O._owner,ce=ye(O.type,O._source,se?se.type:null);He.setExtraStackFrame(ce)}else He.setExtraStackFrame(null)}function Te(O,se,ce,Ce,Oe){{var Le=Function.call.bind(Fe);for(var je in O)if(Le(O,je)){var Be=void 0;try{if(typeof O[je]!="function"){var at=Error((Ce||"React class")+": "+ce+" type `"+je+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[je]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw at.name="Invariant Violation",at}Be=O[je](se,je,Ce,ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ze){Be=Ze}Be&&!(Be instanceof Error)&&(Se(Oe),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).",Ce||"React class",ce,je,typeof Be),Se(null)),Be instanceof Error&&!(Be.message in Ae)&&(Ae[Be.message]=!0,Se(Oe),w("Failed %s type: %s",ce,Be.message),Se(null))}}}var Ne=Array.isArray;function ke(O){return Ne(O)}function Ue(O){{var se=typeof Symbol=="function"&&Symbol.toStringTag,ce=se&&O[Symbol.toStringTag]||O.constructor.name||"Object";return ce}}function ge(O){try{return H(O),!1}catch{return!0}}function H(O){return""+O}function ie(O){if(ge(O))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ue(O)),H(O)}var me=v.ReactCurrentOwner,ve={key:!0,ref:!0,__self:!0,__source:!0},we,Ke,Qe;Qe={};function mt(O){if(Fe.call(O,"ref")){var se=Object.getOwnPropertyDescriptor(O,"ref").get;if(se&&se.isReactWarning)return!1}return O.ref!==void 0}function zt(O){if(Fe.call(O,"key")){var se=Object.getOwnPropertyDescriptor(O,"key").get;if(se&&se.isReactWarning)return!1}return O.key!==void 0}function _t(O,se){if(typeof O.ref=="string"&&me.current&&se&&me.current.stateNode!==se){var ce=F(me.current.type);Qe[ce]||(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',F(me.current.type),O.ref),Qe[ce]=!0)}}function et(O,se){{var ce=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)",se))};ce.isReactWarning=!0,Object.defineProperty(O,"key",{get:ce,configurable:!0})}}function Tt(O,se){{var ce=function(){Ke||(Ke=!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)",se))};ce.isReactWarning=!0,Object.defineProperty(O,"ref",{get:ce,configurable:!0})}}var pt=function(O,se,ce,Ce,Oe,Le,je){var Be={$$typeof:t,type:O,key:se,ref:ce,props:je,_owner:Le};return Be._store={},Object.defineProperty(Be._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Be,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Ce}),Object.defineProperty(Be,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Oe}),Object.freeze&&(Object.freeze(Be.props),Object.freeze(Be)),Be};function oi(O,se,ce,Ce,Oe){{var Le,je={},Be=null,at=null;ce!==void 0&&(ie(ce),Be=""+ce),zt(se)&&(ie(se.key),Be=""+se.key),mt(se)&&(at=se.ref,_t(se,Oe));for(Le in se)Fe.call(se,Le)&&!ve.hasOwnProperty(Le)&&(je[Le]=se[Le]);if(O&&O.defaultProps){var Ze=O.defaultProps;for(Le in Ze)je[Le]===void 0&&(je[Le]=Ze[Le])}if(Be||at){var Ge=typeof O=="function"?O.displayName||O.name||"Unknown":O;Be&&et(je,Ge),at&&Tt(je,Ge)}return pt(O,Be,at,Oe,Ce,me.current,je)}}var or=v.ReactCurrentOwner,Wr=v.ReactDebugCurrentFrame;function On(O){if(O){var se=O._owner,ce=ye(O.type,O._source,se?se.type:null);Wr.setExtraStackFrame(ce)}else Wr.setExtraStackFrame(null)}var ui;ui=!1;function li(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function Ro(){{if(or.current){var O=F(or.current.type);if(O)return`
25
+ `+Be[Ze].replace(" at new "," at ");return O.displayName&&yt.includes("<anonymous>")&&(yt=yt.replace("<anonymous>",O.displayName)),typeof O=="function"&&ne.set(O,yt),yt}while(Ze>=1&&Ge>=0);break}}}finally{te=!1,$.current=Le,L(),Error.prepareStackTrace=Oe}var On=O?O.displayName||O.name:"",$o=On?re(On):"";return typeof O=="function"&&ne.set(O,$o),$o}function pe(O,se,ce){return Q(O,!1)}function he(O){var se=O.prototype;return!!(se&&se.isReactComponent)}function ye(O,se,ce){if(O==null)return"";if(typeof O=="function")return Q(O,he(O));if(typeof O=="string")return re(O);switch(O){case u:return re("Suspense");case c:return re("SuspenseList")}if(typeof O=="object")switch(O.$$typeof){case l:return pe(O.render);case h:return ye(O.type,se,ce);case p:{var Ce=O,Oe=Ce._payload,Le=Ce._init;try{return ye(Le(Oe),se,ce)}catch{}}}return""}var Fe=Object.prototype.hasOwnProperty,Ae={},He=v.ReactDebugCurrentFrame;function Se(O){if(O){var se=O._owner,ce=ye(O.type,O._source,se?se.type:null);He.setExtraStackFrame(ce)}else He.setExtraStackFrame(null)}function Te(O,se,ce,Ce,Oe){{var Le=Function.call.bind(Fe);for(var je in O)if(Le(O,je)){var Be=void 0;try{if(typeof O[je]!="function"){var at=Error((Ce||"React class")+": "+ce+" type `"+je+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[je]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw at.name="Invariant Violation",at}Be=O[je](se,je,Ce,ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ze){Be=Ze}Be&&!(Be instanceof Error)&&(Se(Oe),E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Ce||"React class",ce,je,typeof Be),Se(null)),Be instanceof Error&&!(Be.message in Ae)&&(Ae[Be.message]=!0,Se(Oe),E("Failed %s type: %s",ce,Be.message),Se(null))}}}var Ne=Array.isArray;function ke(O){return Ne(O)}function Ue(O){{var se=typeof Symbol=="function"&&Symbol.toStringTag,ce=se&&O[Symbol.toStringTag]||O.constructor.name||"Object";return ce}}function ge(O){try{return H(O),!1}catch{return!0}}function H(O){return""+O}function ie(O){if(ge(O))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ue(O)),H(O)}var me=v.ReactCurrentOwner,ve={key:!0,ref:!0,__self:!0,__source:!0},we,Ke,Qe;Qe={};function mt(O){if(Fe.call(O,"ref")){var se=Object.getOwnPropertyDescriptor(O,"ref").get;if(se&&se.isReactWarning)return!1}return O.ref!==void 0}function zt(O){if(Fe.call(O,"key")){var se=Object.getOwnPropertyDescriptor(O,"key").get;if(se&&se.isReactWarning)return!1}return O.key!==void 0}function _t(O,se){if(typeof O.ref=="string"&&me.current&&se&&me.current.stateNode!==se){var ce=F(me.current.type);Qe[ce]||(E('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',F(me.current.type),O.ref),Qe[ce]=!0)}}function et(O,se){{var ce=function(){we||(we=!0,E("%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)",se))};ce.isReactWarning=!0,Object.defineProperty(O,"key",{get:ce,configurable:!0})}}function Tt(O,se){{var ce=function(){Ke||(Ke=!0,E("%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)",se))};ce.isReactWarning=!0,Object.defineProperty(O,"ref",{get:ce,configurable:!0})}}var pt=function(O,se,ce,Ce,Oe,Le,je){var Be={$$typeof:t,type:O,key:se,ref:ce,props:je,_owner:Le};return Be._store={},Object.defineProperty(Be._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Be,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Ce}),Object.defineProperty(Be,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Oe}),Object.freeze&&(Object.freeze(Be.props),Object.freeze(Be)),Be};function ii(O,se,ce,Ce,Oe){{var Le,je={},Be=null,at=null;ce!==void 0&&(ie(ce),Be=""+ce),zt(se)&&(ie(se.key),Be=""+se.key),mt(se)&&(at=se.ref,_t(se,Oe));for(Le in se)Fe.call(se,Le)&&!ve.hasOwnProperty(Le)&&(je[Le]=se[Le]);if(O&&O.defaultProps){var Ze=O.defaultProps;for(Le in Ze)je[Le]===void 0&&(je[Le]=Ze[Le])}if(Be||at){var Ge=typeof O=="function"?O.displayName||O.name||"Unknown":O;Be&&et(je,Ge),at&&Tt(je,Ge)}return pt(O,Be,at,Oe,Ce,me.current,je)}}var or=v.ReactCurrentOwner,Wr=v.ReactDebugCurrentFrame;function jn(O){if(O){var se=O._owner,ce=ye(O.type,O._source,se?se.type:null);Wr.setExtraStackFrame(ce)}else Wr.setExtraStackFrame(null)}var si;si=!1;function oi(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function Po(){{if(or.current){var O=F(or.current.type);if(O)return`
26
26
 
27
- Check the render method of \``+O+"`."}return""}}function Ch(O){{if(O!==void 0){var se=O.fileName.replace(/^.*[\\\/]/,""),ce=O.lineNumber;return`
27
+ Check the render method of \``+O+"`."}return""}}function yh(O){{if(O!==void 0){var se=O.fileName.replace(/^.*[\\\/]/,""),ce=O.lineNumber;return`
28
28
 
29
- Check your code at `+se+":"+ce+"."}return""}}var Mo={};function xh(O){{var se=Ro();if(!se){var ce=typeof O=="string"?O:O.displayName||O.name;ce&&(se=`
29
+ Check your code at `+se+":"+ce+"."}return""}}var No={};function Dh(O){{var se=Po();if(!se){var ce=typeof O=="string"?O:O.displayName||O.name;ce&&(se=`
30
30
 
31
- Check the top-level render call using <`+ce+">.")}return se}}function Io(O,se){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var ce=xh(se);if(Mo[ce])return;Mo[ce]=!0;var Ce="";O&&O._owner&&O._owner!==or.current&&(Ce=" It was passed a child from "+F(O._owner.type)+"."),On(O),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ce,Ce),On(null)}}function $o(O,se){{if(typeof O!="object")return;if(ke(O))for(var ce=0;ce<O.length;ce++){var Ce=O[ce];li(Ce)&&Io(Ce,se)}else if(li(O))O._store&&(O._store.validated=!0);else if(O){var Oe=y(O);if(typeof Oe=="function"&&Oe!==O.entries)for(var Le=Oe.call(O),je;!(je=Le.next()).done;)li(je.value)&&Io(je.value,se)}}}function wh(O){{var se=O.type;if(se==null||typeof se=="string")return;var ce;if(typeof se=="function")ce=se.propTypes;else if(typeof se=="object"&&(se.$$typeof===l||se.$$typeof===f))ce=se.propTypes;else return;if(ce){var Ce=F(se);Te(ce,O.props,"prop",Ce,O)}else if(se.PropTypes!==void 0&&!ui){ui=!0;var Oe=F(se);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Oe||"Unknown")}typeof se.getDefaultProps=="function"&&!se.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Eh(O){{for(var se=Object.keys(O.props),ce=0;ce<se.length;ce++){var Ce=se[ce];if(Ce!=="children"&&Ce!=="key"){On(O),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Ce),On(null);break}}O.ref!==null&&(On(O),w("Invalid attribute `ref` supplied to `React.Fragment`."),On(null))}}function Lo(O,se,ce,Ce,Oe,Le){{var je=I(O);if(!je){var Be="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(Be+=" 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 at=Ch(Oe);at?Be+=at:Be+=Ro();var Ze;O===null?Ze="null":ke(O)?Ze="array":O!==void 0&&O.$$typeof===t?(Ze="<"+(F(O.type)||"Unknown")+" />",Be=" Did you accidentally export a JSX literal instead of a component?"):Ze=typeof O,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ze,Be)}var Ge=oi(O,se,ce,Oe,Le);if(Ge==null)return Ge;if(je){var yt=se.children;if(yt!==void 0)if(Ce)if(ke(yt)){for(var Pn=0;Pn<yt.length;Pn++)$o(yt[Pn],O);Object.freeze&&Object.freeze(yt)}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 $o(yt,O)}return O===r?Eh(Ge):wh(Ge),Ge}}function kh(O,se,ce){return Lo(O,se,ce,!0)}function _h(O,se,ce){return Lo(O,se,ce,!1)}var Bh=_h,Fh=kh;lr.Fragment=r,lr.jsx=Bh,lr.jsxs=Fh}()),lr}process.env.NODE_ENV==="production"?us.exports=Rh():us.exports=Mh();var c=us.exports;const Fc=()=>{const[e,t]=D.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return D.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Gn=(e,t)=>{const n=D.useRef(!1);D.useEffect(()=>{n.current?e():n.current=!0},t)};function Ac(e,t,n){var r=this,a=D.useRef(null),i=D.useRef(0),s=D.useRef(null),o=D.useRef([]),l=D.useRef(),u=D.useRef(),d=D.useRef(e),f=D.useRef(!0);d.current=e;var p=typeof window<"u",m=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,h=!("trailing"in n)||!!n.trailing,y="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,w=y?Math.max(+n.maxWait||0,t):null;D.useEffect(function(){return f.current=!0,function(){f.current=!1}},[]);var _=D.useMemo(function(){var x=function(I){var z=o.current,E=l.current;return o.current=l.current=null,i.current=I,u.current=d.current.apply(E,z)},k=function(I,z){m&&cancelAnimationFrame(s.current),s.current=m?requestAnimationFrame(I):setTimeout(I,z)},T=function(I){if(!f.current)return!1;var z=I-a.current;return!a.current||z>=t||z<0||y&&I-i.current>=w},S=function(I){return s.current=null,h&&o.current?x(I):(o.current=l.current=null,u.current)},q=function I(){var z=Date.now();if(T(z))return S(z);if(f.current){var E=t-(z-a.current),F=y?Math.min(E,w-(z-i.current)):E;k(I,F)}},N=function(){if(p||v){var I=Date.now(),z=T(I);if(o.current=[].slice.call(arguments),l.current=r,a.current=I,z){if(!s.current&&f.current)return i.current=a.current,k(q,t),g?x(a.current):u.current;if(y)return k(q,t),x(a.current)}return s.current||k(q,t),u.current}};return N.cancel=function(){s.current&&(m?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},N.isPending=function(){return!!s.current},N.flush=function(){return s.current?S(Date.now()):u.current},N},[g,y,t,w,h,m,p,v]);return _}function Tc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return Ac(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let ci;const nr=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=D.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];D.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(ci),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:d})=>{const{id:f}=d;n==="window"||!n.closest(`#${f}`)||s()===r||o()},u=Tc(()=>{s()!==r&&(t&&(clearTimeout(ci),document.body.classList.add("is-resizing"),ci=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Sc=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=D.useState({current:0,past:0})||[!1,()=>{}],[s,o]=D.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];D.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const d=window.scrollY,f=a.current,p=d-f,m=p>0?"down":"up";if(i({current:d,past:f}),m==="down"){d>=e+t.down&&!s.scrollDown&&(!s.scrollUp||p>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=Tc(()=>{l()},250);return a},zs=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=D.useRef(!1);Gn(()=>{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)},qs=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=D.useState(!1);return{showTooltip:t,tooltipProps:{onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const Ho={},An=D.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},...l},u)=>{const d=ue.useIntl(),f=D.useRef(null),p=u||f,[m,g]=D.useState(n?"open":"hidden"),{extraPadding:h=!0,hasPointer:y=!1,hasForm:v=!1}=t,{onOpen:w=()=>{},onClose:_=()=>{}}=o;e||(e=Date.now().toString());const x=Ho[e];D.useEffect(()=>{const q=p==null?void 0:p.current;if(q)return q.addEventListener("transitionend",k),q.addEventListener("keydown",T),()=>{q.removeEventListener("transitionend",k),q.removeEventListener("keydown",T)}},[]);const k=({propertyName:q})=>{q==="opacity"&&(x!==!1&&clearTimeout(x),g(N=>(N==="open"?w():N==="closed"&&_(),N==="opening"?"open":N==="closing"?"closed":N==="closed"?"hidden":N)))},T=q=>{q.key==="Escape"&&(q.stopPropagation(),q.preventDefault(),g("closing"))};Gn(()=>{x!==!1&&clearTimeout(x);let q="open";n?g("opening"):(g("closing"),q="hidden"),Ho[e||""]=setTimeout(()=>{g(q)},300)},[n]);const S={...l};return s&&s.onBlur&&(S.onBlur=s.onBlur),c.jsx("aside",{ref:p,className:Y("tooltip text-medium",m,i,{loading:r,"extra-padding":h,"has-pointer":y,bottom:y==="bottom","has-form":v}),...S,children:c.jsx("div",{className:"content",hidden:m==="hidden",children:r?c.jsx("p",{children:d.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?c.jsx("p",{children:a}):a})})}),Ir=(e,t)=>{Array.isArray(t)||(t=[t]);const n=bn(e);return t.forEach(({type:r,value:a})=>{Ah(n,r,a)}),n},jc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Oc=(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},Pc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Nc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Rc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Ih=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),It="https://storage.googleapis.com/apolitical-assets/",Ln={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},gr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},ls="SU:",Mc="Invalid token error: Logging user out...",$h="200,000+",Lh="160+",Br=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Ic=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function $c(e){return e?{"--icon":`url(${It}icons/${e}.svg)`}:{}}const pn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Lc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Ws=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),cs=e=>{let t;const n=Ea(),r=Ea(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/pn.milliseconds.inHour,i=Math.floor(t/pn.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<=pn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/pn.year.days)}},Ea=e=>{const n=(e||new Date).toUTCString();return new Date(n)},zh=(e,t,n)=>{let r;const a=Ea(),i=Ea(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/pn.milliseconds.inSecond<=t;case"minutes":return r/pn.milliseconds.inMinute<=t;case"hours":return r/pn.milliseconds.inHour<=t}return!1},qh=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},Wh=e=>new Promise(t=>setTimeout(t,e)),Hh=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},rr={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",activitiesFeed_sorting_label:"Choose feed sorting method",activitiesFeed_rankingMethod_recent:"Recent",activitiesFeed_rankingMethod_popular:"Popular",activitiesFeed_rankingMethod_internalTesting:"Apolitical Testing",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}.
31
+ Check the top-level render call using <`+ce+">.")}return se}}function Ro(O,se){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var ce=Dh(se);if(No[ce])return;No[ce]=!0;var Ce="";O&&O._owner&&O._owner!==or.current&&(Ce=" It was passed a child from "+F(O._owner.type)+"."),jn(O),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ce,Ce),jn(null)}}function Mo(O,se){{if(typeof O!="object")return;if(ke(O))for(var ce=0;ce<O.length;ce++){var Ce=O[ce];oi(Ce)&&Ro(Ce,se)}else if(oi(O))O._store&&(O._store.validated=!0);else if(O){var Oe=D(O);if(typeof Oe=="function"&&Oe!==O.entries)for(var Le=Oe.call(O),je;!(je=Le.next()).done;)oi(je.value)&&Ro(je.value,se)}}}function Ch(O){{var se=O.type;if(se==null||typeof se=="string")return;var ce;if(typeof se=="function")ce=se.propTypes;else if(typeof se=="object"&&(se.$$typeof===l||se.$$typeof===h))ce=se.propTypes;else return;if(ce){var Ce=F(se);Te(ce,O.props,"prop",Ce,O)}else if(se.PropTypes!==void 0&&!si){si=!0;var Oe=F(se);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Oe||"Unknown")}typeof se.getDefaultProps=="function"&&!se.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function xh(O){{for(var se=Object.keys(O.props),ce=0;ce<se.length;ce++){var Ce=se[ce];if(Ce!=="children"&&Ce!=="key"){jn(O),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Ce),jn(null);break}}O.ref!==null&&(jn(O),E("Invalid attribute `ref` supplied to `React.Fragment`."),jn(null))}}function Io(O,se,ce,Ce,Oe,Le){{var je=I(O);if(!je){var Be="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(Be+=" 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 at=yh(Oe);at?Be+=at:Be+=Po();var Ze;O===null?Ze="null":ke(O)?Ze="array":O!==void 0&&O.$$typeof===t?(Ze="<"+(F(O.type)||"Unknown")+" />",Be=" Did you accidentally export a JSX literal instead of a component?"):Ze=typeof O,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ze,Be)}var Ge=ii(O,se,ce,Oe,Le);if(Ge==null)return Ge;if(je){var yt=se.children;if(yt!==void 0)if(Ce)if(ke(yt)){for(var On=0;On<yt.length;On++)Mo(yt[On],O);Object.freeze&&Object.freeze(yt)}else E("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 Mo(yt,O)}return O===r?xh(Ge):Ch(Ge),Ge}}function wh(O,se,ce){return Io(O,se,ce,!0)}function Eh(O,se,ce){return Io(O,se,ce,!1)}var kh=Eh,_h=wh;lr.Fragment=r,lr.jsx=kh,lr.jsxs=_h}()),lr}process.env.NODE_ENV==="production"?ss.exports=Ph():ss.exports=Nh();var d=ss.exports;const _c=()=>{const[e,t]=y.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return y.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Yn=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function Bc(e,t,n){var r=this,a=y.useRef(null),i=y.useRef(0),s=y.useRef(null),o=y.useRef([]),l=y.useRef(),u=y.useRef(),c=y.useRef(e),h=y.useRef(!0);c.current=e;var p=typeof window<"u",m=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,D="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,E=D?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var B=y.useMemo(function(){var x=function(I){var z=o.current,w=l.current;return o.current=l.current=null,i.current=I,u.current=c.current.apply(w,z)},k=function(I,z){m&&cancelAnimationFrame(s.current),s.current=m?requestAnimationFrame(I):setTimeout(I,z)},T=function(I){if(!h.current)return!1;var z=I-a.current;return!a.current||z>=t||z<0||D&&I-i.current>=E},S=function(I){return s.current=null,f&&o.current?x(I):(o.current=l.current=null,u.current)},q=function I(){var z=Date.now();if(T(z))return S(z);if(h.current){var w=t-(z-a.current),F=D?Math.min(w,E-(z-i.current)):w;k(I,F)}},N=function(){if(p||v){var I=Date.now(),z=T(I);if(o.current=[].slice.call(arguments),l.current=r,a.current=I,z){if(!s.current&&h.current)return i.current=a.current,k(q,t),g?x(a.current):u.current;if(D)return k(q,t),x(a.current)}return s.current||k(q,t),u.current}};return N.cancel=function(){s.current&&(m?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},N.isPending=function(){return!!s.current},N.flush=function(){return s.current?S(Date.now()):u.current},N},[g,D,t,E,f,m,p,v]);return B}function Fc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return Bc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let ui;const tr=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=y.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];y.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(ui),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=Fc(()=>{s()!==r&&(t&&(clearTimeout(ui),document.body.classList.add("is-resizing"),ui=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Ac=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=y.useState({current:0,past:0})||[!1,()=>{}],[s,o]=y.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];y.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const c=window.scrollY,h=a.current,p=c-h,m=p>0?"down":"up";if(i({current:c,past:h}),m==="down"){c>=e+t.down&&!s.scrollDown&&(!s.scrollUp||p>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=Fc(()=>{l()},250);return a},$s=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.useRef(!1);Yn(()=>{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)},Ls=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=y.useState(!1);return{showTooltip:t,tooltipProps:{onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const qo={},An=y.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=y.useRef(null),p=u||h,[m,g]=y.useState(n?"open":"hidden"),{extraPadding:f=!0,hasPointer:D=!1,hasForm:v=!1}=t,{onOpen:E=()=>{},onClose:B=()=>{}}=o;e||(e=Date.now().toString());const x=qo[e];y.useEffect(()=>{const q=p==null?void 0:p.current;if(q)return q.addEventListener("transitionend",k),q.addEventListener("keydown",T),()=>{q.removeEventListener("transitionend",k),q.removeEventListener("keydown",T)}},[]);const k=({propertyName:q})=>{q==="opacity"&&(x!==!1&&clearTimeout(x),g(N=>(N==="open"?E():N==="closed"&&B(),N==="opening"?"open":N==="closing"?"closed":N==="closed"?"hidden":N)))},T=q=>{q.key==="Escape"&&(q.stopPropagation(),q.preventDefault(),g("closing"))};Yn(()=>{x!==!1&&clearTimeout(x);let q="open";n?g("opening"):(g("closing"),q="hidden"),qo[e||""]=setTimeout(()=>{g(q)},300)},[n]);const S={...l};return s&&s.onBlur&&(S.onBlur=s.onBlur),d.jsx("aside",{ref:p,className:Y("tooltip text-medium",m,i,{loading:r,"extra-padding":f,"has-pointer":D,bottom:D==="bottom","has-form":v}),...S,children:d.jsx("div",{className:"content",hidden:m==="hidden",children:r?d.jsx("p",{children:c.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?d.jsx("p",{children:a}):a})})}),Ir=(e,t)=>{Array.isArray(t)||(t=[t]);const n=bn(e);return t.forEach(({type:r,value:a})=>{Bh(n,r,a)}),n},Tc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Sc=(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},jc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Oc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Pc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Rh=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),It="https://storage.googleapis.com/apolitical-assets/",$n={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},gr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},os="SU:",Nc="Invalid token error: Logging user out...",Mh="200,000+",Ih="160+",Br=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Rc=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function Mc(e){return e?{"--icon":`url(${It}icons/${e}.svg)`}:{}}const pn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Ic=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),zs=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),us=e=>{let t;const n=xa(),r=xa(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/pn.milliseconds.inHour,i=Math.floor(t/pn.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<=pn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/pn.year.days)}},xa=e=>{const n=(e||new Date).toUTCString();return new Date(n)},$h=(e,t,n)=>{let r;const a=xa(),i=xa(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/pn.milliseconds.inSecond<=t;case"minutes":return r/pn.milliseconds.inMinute<=t;case"hours":return r/pn.milliseconds.inHour<=t}return!1},Lh=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},zh=e=>new Promise(t=>setTimeout(t,e)),qh=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},nr={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",activitiesFeed_sorting_label:"Choose feed sorting method",activitiesFeed_rankingMethod_recent:"Recent",activitiesFeed_rankingMethod_popular:"Popular",activitiesFeed_rankingMethod_internalTesting:"Testing",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.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussionFormCard_overlay_title:"Discard post",discussionFormCard_overlay_text:"Are you sure you want to leave without posting? Changes you have made will not be saved.",discussionFormCard_overlay_cta_discard:"Discard",discussionFormCard_overlay_cta_continue:"Continue editing",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Share a question, insight, or announcement with the community",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_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_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their email addresses below",inviteForm_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",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_insights:"Insights",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital 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",discussionFormModal_title:"Create a post",discussionFormModal_cta:"Create post",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their email addresses below.",inviteModal_cta:"Send",overlay_close:"Close",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"},Uh={...rr,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>"},Vh={...rr,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"},Kh={...rr,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>"},Zh=Object.freeze(Object.defineProperty({__proto__:null,en:rr,es:Uh,fr:Vh,pt:Kh},Symbol.toStringTag,{value:"Module"})),Va=(e,t=rr)=>e in t,Bt=(e,t,n,r,a={})=>{let i="";return Va(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},Yh=(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},ma=(e,t)=>D.Children.map(e,n=>Object.is(n,null)?n:D.cloneElement(n,{...t})),zc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Gh=(e,t,n)=>!t.id||!t.name?"":n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),qc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(Br);if(!a)return e;for(const s of a){const o=s.replace(Br,(d,f)=>f),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 d=l;if(d.startsWith(ls))try{const f=d.replace(ls,"");u.id=f,await r({id:f}).then(p=>{const{name:m}=p;u.name=m||""})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Gh(e,u,t):s)}return e},Wc=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Qh=e=>new URLSearchParams(window.location.search).get(e),Uo=(e="")=>e.replace(/\s+/g,"").length>0,ds=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 _e=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:d=!1,children:f=!1,...p})=>{const g=nr(typeof t=="object"),{showTooltip:h,tooltipProps:y}=qs(!!u);if(typeof t=="object"&&typeof g=="number"){const x=Object.assign({},t),k=jc(Object.keys(x));t=Oc(g,k,x)}!l&&u&&(u="");const v=[];typeof t=="string"&&v.push(t),r&&(v.push("icon"),typeof r=="object"?(v.push(r.icon),r.position?v.push(r.position):v.push("left"),r.hover&&v.push(`hover_${r.hover}`),r.animate&&(v.push("animate"),typeof r.animate=="string"&&v.push(r.animate))):(v.push(r),!r.includes("right")&&!r.includes("left")&&v.push("left"))),n.muted&&v.push("muted"),n.fullWidth&&v.push("full-width");const w={...p,className:Y(e,o,v,{"no-text":!f,disabled:l,button:a}),onClick:x=>{(!a||a[0]==="#")&&s&&(x.preventDefault(),x.stopPropagation()),s&&s(x)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",w.href=a);const _=D.createElement(i,w,f||(d?c.jsx(Ie,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...y,children:[c.jsx(An,{isOpen:h,children:u}),_]}):_},ar=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?c.jsx(_e,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(_e,{...s})},o)});return D.createElement(a,{className:Y("button-wrapper",n),...r,children:i})};const Kt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:Y(e,{"has-max-width":t}),style:n})},Vo={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"}},Jh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?Vo[e]:Vo.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Xh=({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},di=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Xh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const ir=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:f}=e,{range:p,sizes:m}=Jh(e),g=di({format:"avif",query:s,range:p,url:o}),h=di({format:"webp",query:s,range:p,url:o}),y=di({format:"",query:s,range:p,url:o});return i&&i.includes("svg")?c.jsx("picture",{className:t,children:c.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[i!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:g,sizes:m,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:h,sizes:m,"data-testid":"source"}),c.jsx("img",{srcSet:y,sizes:m,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})]})};const em=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(ir,{image:{...e},className:"image"})}),Tn=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),c.jsx("a",{href:e,className:Y("gtm-trackable",r),...l,children:t})}return n?D.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const Hc=D.forwardRef(({className:e="",children:t},n)=>{const r=D.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:Y("popover",e),"aria-live":"polite",children:t})}),Ka=({parent:e=document.body,children:t})=>typeof document=="object"?Ec.createPortal(t,e):null;const tm=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Ie,{children:c.jsx(ue.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),c.jsx("div",{className:"progress-tracker",children:c.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:Y("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:Y("line",{active:a<e})})]},r)})})})]});const nm=({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 c.jsx(_e,{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 rm=({items:e,className:t="",...n})=>c.jsx("ul",{className:Y("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:i,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:a})]})},o))}),Ko=300,Zo="ease-in-out";class am{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:Ko,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:Ko,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=D.useRef(null);return D.useEffect(()=>{let s;return r&&(s=new am(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:Y("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},Yo={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},im=e=>{let t=e;return Object.keys(Yo).includes(e)&&(t=Yo[e]),`url(${It}icons/${t}.svg)`};const Go={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Uc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ue.useIntl(),i=t?{"--custom-icon":im(t)}:{},s=Va(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:Y("content-type-label text-small",e in Go?Go[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Mt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${It}icons/${t}.svg)`}:{};return c.jsx("div",{className:Y("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const un=({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=nr(i);if(i&&typeof n=="object"&&typeof s=="number"){const f=Object.assign({},n.breakpoints),p=jc(Object.keys(f));a=Oc(s,p,f)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(Mt,{variant:"subtle",className:Y("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(Rt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(_e,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const fs=({children:e,...t})=>c.jsx("p",{...t,children:e}),Vc={q:fs,blockquote:fs};for(let e=1;e<=6;e++)Vc[`h${e}`]={component:fs,props:{className:"title"}};const Kc=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:Y("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(Rt,{options:{wrapper:D.Fragment,forceBlock:!0,overrides:Vc},children:r}):c.jsx("p",{children:r})]});const Zc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=ue.useIntl(),l=D.useRef(null);e||(e=Date.now().toString());const[u,d]=D.useState(""),[f,p]=D.useState("closed");D.useEffect(()=>{const h=l.current;if(h)return h.addEventListener("transitionend",m),()=>{h.removeEventListener("transitionend",m)}},[]),D.useEffect(()=>{if(!a||typeof a!="string")return;const h=a.split(`
36
- `);d(h.length<3?`${a.substring(0,400)}...`:h.slice(0,3).join(`
37
- `))},[a]),D.useEffect(()=>{f==="ready-to-close"&&p("closing")},[f]);const m=({propertyName:h})=>{h==="max-height"&&p(y=>y==="opening"?"open":y==="closing"?"closed":y)};if(!a)return null;const g=["opening","open"].includes(f);return c.jsxs(Mt,{variant:"subtle",className:Y("hide-show-text-box",t),children:[c.jsxs("div",{ref:l,id:e,className:Y("content",f),children:[c.jsx(Rt,{options:{forceBlock:!0,...i},children:f==="closed"?u:a}),f!=="closed"&&s]}),c.jsx("p",{className:"cta",children:c.jsx(_e,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Y({"rotate-180":g}),onClick:()=>{p(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 sm=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return D.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 d={wrapper:D.Fragment,forceInline:!0},f={"--icon":`url(${It}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(D.Fragment,{children:[c.jsx("dt",{style:f,children:c.jsx(Rt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(Rt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:f,children:typeof l.text=="string"?c.jsx(Rt,{options:d,children:l.text}):l.text},u)})})},nt=()=>D.Fragment,om=({children:e})=>c.jsx(Mt,{variant:"secondary",children:e}),um=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),lm=["span","strong","h1","h2","h3","h4","h5","h6","p"],cm=({children:e})=>{const t=ue.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of D.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(D.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of D.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&D.isValidElement(s)){const o=s.type;if(lm.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return c.jsx(Za,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},dm=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(Mt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(Mt,{variant:"primary",children:e});case"pink-textbox":return c.jsx(Mt,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{children:e}):e;default:return c.jsx("div",{...t,children:e})}return c.jsx("div",{...t,children:e})},Ct=({children:e})=>c.jsx(c.Fragment,{children:e}),fm=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"),c.jsxs(c.Fragment,{children:[c.jsx(Ie,{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}`}`})}),c.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),c.jsx("span",{id:`content-after-iframe-${n}`})]})},Qo=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},hm=({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 D.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&D.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"||Qo(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!D.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Qo(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(_e,{variant:"primary",size:"medium",...n,children:r})})):c.jsx("a",{...n,children:r})},hs=({children:e,...t})=>c.jsx("span",{className:Y({url:t==null?void 0:t.href}),children:e});const mm={default:{a:hm,CollapsibleSection:Za,TextBox:Mt,CaseStudy:om,style:nt,details:cm,div:dm,iframe:fm,center:um},"text-only":{h1:nt,h2:nt,h3:nt,h4:nt,h5:nt,h6:nt,style:nt,details:nt,div:nt,TextBox:nt,CollapsibleSection:nt,CaseStudy:nt,blockquote:nt,iframe:nt,button:nt}},xn=({element:e="div",className:t="",options:n={},children:r,overrideType:a="default",styling:i={}})=>{if(!r)return null;const{highlightTitles:s=!1}=i;r=r.replace(/^<br\/?>/,"");const o={wrapper:D.Fragment,forceBlock:!0};let l=mm[a];return n.overrides&&(l={...l,...n.overrides}),D.createElement(e,{className:Y("markdown-text",t,{"highlight-titles":s}),children:c.jsx(Rt,{options:{...o,...n,overrides:l},children:r})})};const Yc=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:Y("page-heading",a),children:[c.jsxs("div",{className:Y("content",{"has-max-width":e}),style:i,children:[t&&t.text&&D.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&D.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const gn=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${It}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=qs(!!a),d=c.jsx("span",{...u,className:Y("pill",e,t,n,{"has-icon":r}),style:o,...s,children:i});return a?c.jsxs("span",{className:"pill-wrapper",children:[c.jsx(An,{isOpen:l,children:a}),d]}):d};const Fr=({element:e="p",children:t=null,className:n="",...r})=>D.createElement(e,{...r,className:Y("status-banner text-small",n),"aria-live":"assertive"},t);const pm=({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,d={"--progress":`${t}%`};return c.jsx("span",{className:Y(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:D.createElement(i?"span":Ie,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},Hs=D.memo(pm);const fi="loadingBlock_",gm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ue.useIntl();t||(t={0:{text:r.formatMessage({id:`${fi}loading`})},75:{text:r.formatMessage({id:`${fi}almostDone`})},100:{text:r.formatMessage({id:`${fi}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${It}icons/${t[a].icon}.svg)`}:{};return c.jsxs(Mt,{className:Y("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&c.jsx("span",{className:"step",children:t[a].text}),c.jsx(Hs,{progress:e})]})},vm=D.memo(gm);const kt=({element:e="div",className:t="",...n})=>c.jsx(Ua,{element:e,className:Y("loading-placeholder",t),...n});const ms={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"]},Gc=(e,t)=>e in ms?c.jsx("div",{className:e,children:ms[e].map((n,r)=>Gc(n,r))},t):c.jsx(kt,{className:e},t),Us=({layout:e="overview-page",...t})=>c.jsx("div",{className:Y("loading-state",e),...t,children:ms[e].map((n,r)=>Gc(n,r))}),Qc=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):""},Ur=["#5AB6A3","#A2D7AF","#806056","#3962B3"],bm=e=>{const t=Math.ceil(26/Ur.length),n=Qc(e).toLowerCase();if(n==="")return Ur[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Ur.length;a++)if(r<=t*(a+1))return Ur[a]};const Jo=256,Yt=({className:e="",src:t="",name:n,alt:r,width:a=Jo,height:i=Jo,...s})=>{const[o,l]=D.useState(!1),u=D.useRef(null),d=r??n;D.useEffect(()=>{const p=u.current;if(!p)return;const m=p.getContext("2d");if(!m)return;const g=a,h=i;typeof window<"u"&&window.devicePixelRatio&&(p.width=g*window.devicePixelRatio,p.height=h*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=bm(n),m.fillRect(0,0,g,h),m.font=`${g/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Qc(n),g/2,h/1.6)},[n]);let f=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(f=!0),c.jsx("figure",{className:Y("profile-picture",e,{error:o}),...s,children:f?c.jsx("img",{src:t,alt:d,onError:()=>{l(!0)},width:a,height:i}):c.jsx("canvas",{ref:u})})},Ya=e=>e==="apolitical"?{image:`${It}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${It}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},ym=({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=Yn(l,r)),l};let Vr=null;const wn=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},functions:a={},gtmContext:i="member",gtmType:s="member-click",className:o="",alt:l=""})=>{const u=ue.useIntl(),{size:d="medium"}=r,f=Ya(t);f.name||(f.name=u.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:p,image:m}=f;let{url:g}=f;t.link!==void 0&&(t.link===!1?g=void 0:g=t.link);const h=ym(f),y=n&&n.createdAt?cs(n.createdAt):!1,v=n&&n.createdAt?Ws(n.createdAt):"";return D.createElement(e,{className:Y("member text-medium",d,o),...a,children:c.jsxs(Tn,{href:g,gtmType:s,gtmContext:i,onClick:w=>{w==null||w.preventDefault(),w==null||w.stopPropagation(),Vr&&clearTimeout(Vr),Vr=setTimeout(()=>{window.location.href=g},150);const _=new CustomEvent("memberClicked",{detail:{link:g,timeout:Vr}});document.dispatchEvent(_)},children:[c.jsx(Yt,{name:p,src:m,alt:l}),c.jsxs("p",{className:"details",children:[c.jsxs("strong",{children:[p,n&&c.jsxs("span",{className:"additional-content",children:[n.createdAt&&y&&c.jsx("span",{className:"date",title:v,"aria-label":v,children:u.formatMessage({id:`dates_${y.path}`},{number:y.number})}),n.didEdit&&c.jsx("em",{children:u.formatMessage({id:"discussion_edited"})})]})]}),h&&c.jsx("small",{className:Y({"text-medium":d==="large"}),children:h})]})]})})};const Xo={small:24,medium:48},Vs=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...d})=>{const f=ue.useIntl();return!n||n.length===0?null:D.createElement(e,{...d,className:Y("contributors",u,a,{"has-gap":i}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((p,m)=>{let g,h="";if(m<o){const{name:y="",image:v=""}=Ya(p);if(s)return c.jsx(kt,{element:"li",className:"contributor"},m);g=c.jsx(Yt,{name:y,src:v,width:Xo[a||"medium"],height:Xo[a||"medium"]})}else if(m===o){const y=(t||n.length)-o;g=c.jsxs("small",{className:Y({"large-number":y>99}),children:["+",Yh(y,0)]}),h="number-left"}return g?c.jsx("li",{className:Y("contributor",h),children:g},m):null})}),r&&c.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?f.formatMessage({id:`member_${n[0]}`}):Yn(n[0].name||"",20):l||null})]})})},Jc=({showDevTools:e=!0,children:t})=>{const n=new Ye.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(Ye.QueryClientProvider,{client:n,children:[t,e&&c.jsx(Th.ReactQueryDevtools,{initialIsOpen:!1})]})};var Xc=D.createContext({client:ha});function Dm(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=D.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&&(ha.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),ha.init(r,a)),ha)},[n,r]);return D.createElement(Xc.Provider,{value:{client:i}},t)}var Cm=function(){var e=D.useContext(Xc).client;return e};function xm(e){var t=Cm(),n=D.useState(),r=n[0],a=n[1];return D.useEffect(function(){return t.onFeatureFlags(function(){a(t.getFeatureFlagPayload(e))})},[t,e]),r}const ed=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(Dm,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):c.jsx(c.Fragment,{children:e});var Ks=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(Ks||{});const td=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Zh[r],...n||{}};return c.jsx(ue.IntlProvider,{locale:r,messages:a,children:e})},Zs=D.createContext({}),pa={en:"English",es:"Español",fr:"Français",pt:"Português"},Lt=D.createContext({isLoading:!0});function Ga(){return D.useContext(Lt)}const nd=({children:e,user:t})=>c.jsx(Lt.Provider,{value:t,children:e}),Ys=D.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),rd=()=>D.useContext(Ys),ad=({children:e})=>{const[t,n]=D.useState([]);D.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=D.useCallback(i=>{n(s=>[...s,i])},[]),a=D.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return c.jsx(Ys.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},wm=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=D.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=D.useState(s),u=d=>{localStorage.setItem("language",d),l(d)};return D.useEffect(()=>{e().then(d=>{i({...d,isLoading:!1}),zc(5e3)}).catch(d=>{d.message===Mc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),c.jsx(Zs.Provider,{value:{language:o,updateLanguage:u},children:c.jsx(td,{locale:o,messages:n==null?void 0:n.messages,children:c.jsx(Ls.CookiesProvider,{children:c.jsx(nd,{user:a,children:c.jsx(ad,{children:c.jsx(Jc,{showDevTools:r,children:c.jsx(ed,{user:a,children:t})})})})})})})};const cr="joinCommunityButton",Gs=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ue.useIntl(),o=D.useContext(Lt),l=o&&typeof o.id=="string",u=r||!l,[d,f]=D.useState(e),[p,m]=D.useState(e?"joined":"notJoined");D.useEffect(()=>{p==="joining"?m("joined"):p==="leaving"&&m("notJoined")},[d]);const g={},h={};return d&&p!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${cr}_leave`}),g["aria-label"]=s.formatMessage({id:`${cr}_member_aria`}),h["aria-hidden"]="true"),c.jsx(_e,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&p!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${cr}_closed_tooltip`}):"",onClick:async y=>{if(u)return;y.currentTarget.blur(),m(d?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${cr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(v);const w=d?i:a;typeof w=="function"&&setTimeout(async()=>{await w()},500),f(!d)},className:Y("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...g,children:c.jsx("span",{className:"text",...h,children:s.formatMessage({id:`${cr}${["joining","leaving"].includes(p)?`_${p}`:d?"_member":n?"_short":""}`})})})};const hi="communityDetails_",Em=({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,d=a||i.length,f=i.length?i:Array(u).fill({}),p=`/communities/${r}/members`===window.location.pathname,m=t||n,g=!n&&!t;return c.jsxs("div",{className:Y("community-details",e),children:[m&&c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[l.formatMessage({id:`${hi}members`}),c.jsx("span",{className:"count",children:d})]}),!p&&c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${hi}viewAll`})})})]}),c.jsx(Vs,{contributors:{total:a,data:f},styling:{size:"medium",showGap:!0,showPlaceholders:d===0},cutoff:u})]}),c.jsx(Gs,{isMember:t,isOpen:n,disabled:g,functions:{...o}}),t&&c.jsx(_e,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${hi}invite`})})]})};const km=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ue.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Ie,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.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"),c.jsxs("li",{children:[s&&c.jsx(Ie,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(Tn,{href:s?void 0:i,...l,children:Yn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const _m=({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]=D.useState(t?["all"]:[]),u=(d,f)=>{let p=[];o.includes(d)?p=o.filter(m=>m!==d):d==="all"?p=["all"]:n?p=[...o.filter(m=>m!=="all"),d]:p=[d],l(m=>(r&&typeof r=="function"&&r({current:p,previous:m}),p)),f&&typeof f=="function"&&f()};return c.jsx("ul",{className:Y("filters",a),children:s.map(({id:d,text:f,disabled:p=!1,callback:m=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:f})}),c.jsx("li",{children:c.jsx("button",{className:Y(d,{selected:o.includes(d)}),onClick:h=>{h.preventDefault(),h.stopPropagation(),u(d,m)},...g,children:f})},d)})})},Bm=(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 Kr="languageSwitcher_",Fm=({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:d=()=>{}}=D.useContext(Zs),[f,p]=D.useState(e);if(D.useEffect(()=>{e!==f&&p(e)},[e]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const g=Object.keys(r),h=f!==e;return c.jsxs("div",{className:Y("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${Kr}label`})}),c.jsx("ul",{children:g.map(y=>{var _;if(!pa[y])return null;const v=(_=r[y])==null?void 0:_.post_name;let w={className:y};if(f===y)w["aria-label"]=u.formatMessage({id:`${Kr}selected`},{language:pa[y]});else{const x=Bm(y,v,i);w={...w,href:typeof x=="string"?x:x.url,onClick:k=>{p(y),d(y),typeof a<"u"&&(k.preventDefault(),k.stopPropagation(),a(y,typeof x=="string"?x:x.urlForRouter))}}}return c.jsx("li",{children:c.jsx(Tn,{...w,fallbackElement:"span",children:pa[y]})},y)})}),s!=="short"&&!h&&c.jsx("p",{children:u.formatMessage({id:`${Kr}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!h&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${Kr}disclaimer`},{email:Ln.support,link:y=>{const v=`mailto:${y}`;return c.jsx("a",{href:v,children:y})}})})]})};const mi=ue.createIntl({locale:"en",messages:rr}),$r=({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:mi.formatMessage({id:"loadMore_button"}),endOfFeed:mi.formatMessage({id:"loadMore_endOfFeed"}),error:mi.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,f]=D.useState(""),p=async m=>{if(!n)try{await t(m)}catch(g){g instanceof Error?f(g.message):f("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:Y("load-more",l),children:!d&&e?c.jsx(_e,{variant:r,size:a,styling:i,icon:s,onClick:p,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const Qs=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:Y("logo",e,t,n),...r,children:c.jsx(Ie,{children:c.jsx(ue.FormattedMessage,{id:"apolitical"})})})});let Zr=!1;const id=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ue.useIntl(),i=D.useRef(null),[s,o]=D.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return D.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),D.createElement(e,{ref:i,className:Y("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(_e,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:d,text:f,icon:p,...m},g)=>{const h={...m,onClick:y=>{o(!1),typeof d=="function"&&d(y)},onFocus:()=>{Zr&&(clearTimeout(Zr),Zr=!1)},onBlur:()=>{Zr=setTimeout(()=>{o(!1)},100)}};return u&&(h.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(_e,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...h,children:f})},`${window.btoa(f)}_${g}`)})})]})})},Am=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Tm=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],sd=({activeLink:e})=>{const t=ue.useIntl(),n=D.useContext(Lt),r=n&&typeof n.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Tm.map(({key:a,href:i})=>{const s=Am(i,e),o={};return s&&(o["aria-current"]="page"),c.jsx("li",{className:Y(a,{active:s}),children:c.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&&c.jsx("li",{className:"profile","data-testid":"profile-link",children:c.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[c.jsx(Yt,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),c.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},dr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Sm=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${dr(t,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(e)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${dr(t,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(e)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${dr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
35
+ Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Share a question, insight, or announcement with the community",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_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_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their email addresses below",inviteForm_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",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_insights:"Insights",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital 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",discussionFormModal_title:"Create a post",discussionFormModal_cta:"Create post",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their email addresses below.",inviteModal_cta:"Send",overlay_close:"Close",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"},Wh={...nr,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>"},Hh={...nr,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"},Uh={...nr,languageSwitcher_label:"Eu gostaria de ler este artigo em...",languageSwitcher_translation_original:"linguagem original",languageSwitcher_translation_human:"traduzido por um humano",languageSwitcher_translation_machine:"traduzido por máquina",languageSwitcher_disclaimer:"Este conteúdo foi traduzido automaticamente e, ocasionalmente, poderão ocorrer erros de linguagem de gênero ou outras traduções diretas. Estamos tentando resolver isso, porém se perceber algo errado por favor nos avise em <link>{email}</link>"},Vh=Object.freeze(Object.defineProperty({__proto__:null,en:nr,es:Wh,fr:Hh,pt:Uh},Symbol.toStringTag,{value:"Module"})),Ha=(e,t=nr)=>e in t,Bt=(e,t,n,r,a={})=>{let i="";return Ha(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},Kh=(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},fa=(e,t)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),$c=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Zh=(e,t,n)=>!t.id||!t.name?"":n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Lc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(Br);if(!a)return e;for(const s of a){const o=s.replace(Br,(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(os))try{const h=c.replace(os,"");u.id=h,await r({id:h}).then(p=>{const{name:m}=p;u.name=m||""})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Zh(e,u,t):s)}return e},zc=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Yh=e=>new URLSearchParams(window.location.search).get(e),Wo=(e="")=>e.replace(/\s+/g,"").length>0,ls=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 _e=({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,...p})=>{const g=tr(typeof t=="object"),{showTooltip:f,tooltipProps:D}=Ls(!!u);if(typeof t=="object"&&typeof g=="number"){const x=Object.assign({},t),k=Tc(Object.keys(x));t=Sc(g,k,x)}!l&&u&&(u="");const v=[];typeof t=="string"&&v.push(t),r&&(v.push("icon"),typeof r=="object"?(v.push(r.icon),r.position?v.push(r.position):v.push("left"),r.hover&&v.push(`hover_${r.hover}`),r.animate&&(v.push("animate"),typeof r.animate=="string"&&v.push(r.animate))):(v.push(r),!r.includes("right")&&!r.includes("left")&&v.push("left"))),n.muted&&v.push("muted"),n.fullWidth&&v.push("full-width");const E={...p,className:Y(e,o,v,{"no-text":!h,disabled:l,button:a}),onClick:x=>{(!a||a[0]==="#")&&s&&(x.preventDefault(),x.stopPropagation()),s&&s(x)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",E.href=a);const B=y.createElement(i,E,h||(c?d.jsx(Ie,{showOnFocus:!1,children:c}):null));return l&&u?d.jsxs("span",{className:"button-container",...D,children:[d.jsx(An,{isOpen:f,children:u}),B]}):B},rr=({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(_e,{...s},o):d.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:d.jsx(_e,{...s})},o)});return y.createElement(a,{className:Y("button-wrapper",n),...r,children:i})};const Kt=({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})},Ho={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"}},Gh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?Ho[e]:Ho.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Qh=({format:e,height:t,query:n,width:r})=>{let a=`w=${r}&h=${t}`;return a=e?`${a}&fm=${e}`:a,a=n?`${a}&${n}`:a,a},li=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Qh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const ar=({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:p,sizes:m}=Gh(e),g=li({format:"avif",query:s,range:p,url:o}),f=li({format:"webp",query:s,range:p,url:o}),D=li({format:"",query:s,range:p,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:m,"data-testid":"source"}),d.jsx("source",{type:"image/webp",srcSet:f,sizes:m,"data-testid":"source"}),d.jsx("img",{srcSet:D,sizes:m,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Jh=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(ar,{image:{...e},className:"image"})}),Tn=({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?y.createElement(n,{children:t,className:r,...o}):d.jsx(d.Fragment,{children:t})};const qc=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),a=n||r;return d.jsx("aside",{ref:a,className:Y("popover",e),"aria-live":"polite",children:t})}),Ua=({parent:e=document.body,children:t})=>typeof document=="object"?xc.createPortal(t,e):null;const Xh=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx(Ie,{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 em=({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(_e,{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 tm=({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))}),Uo=300,Vo="ease-in-out";class nm{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:Uo,easing:Vo}),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:Uo,easing:Vo}),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 Va=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ue.useIntl(),i=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new nm(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})]})},Ko={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},rm=e=>{let t=e;return Object.keys(Ko).includes(e)&&(t=Ko[e]),`url(${It}icons/${t}.svg)`};const Zo={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Wc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ue.useIntl(),i=t?{"--custom-icon":rm(t)}:{},s=Ha(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:Y("content-type-label text-small",e in Zo?Zo[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Mt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${It}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 un=({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=tr(i);if(i&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),p=Tc(Object.keys(h));a=Sc(s,p,h)}const{breakpoints:o,text:l="",component:u,...c}=n;return d.jsx(Mt,{variant:"subtle",className:Y("empty-state-box",e,r),children:d.jsxs(d.Fragment,{children:[t&&typeof t=="string"?d.jsx(Rt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||d.jsx(_e,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const cs=({children:e,...t})=>d.jsx("p",{...t,children:e}),Hc={q:cs,blockquote:cs};for(let e=1;e<=6;e++)Hc[`h${e}`]={component:cs,props:{className:"title"}};const Uc=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>d.jsxs("div",{...a,className:Y("helper-text-box text-small",e,t),children:[n&&d.jsx("p",{className:"title",children:n}),typeof r=="string"?d.jsx(Rt,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:Hc},children:r}):d.jsx("p",{children:r})]});const Vc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=ue.useIntl(),l=y.useRef(null);e||(e=Date.now().toString());const[u,c]=y.useState(""),[h,p]=y.useState("closed");y.useEffect(()=>{const f=l.current;if(f)return f.addEventListener("transitionend",m),()=>{f.removeEventListener("transitionend",m)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const f=a.split(`
36
+ `);c(f.length<3?`${a.substring(0,400)}...`:f.slice(0,3).join(`
37
+ `))},[a]),y.useEffect(()=>{h==="ready-to-close"&&p("closing")},[h]);const m=({propertyName:f})=>{f==="max-height"&&p(D=>D==="opening"?"open":D==="closing"?"closed":D)};if(!a)return null;const g=["opening","open"].includes(h);return d.jsxs(Mt,{variant:"subtle",className:Y("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:Y("content",h),children:[d.jsx(Rt,{options:{forceBlock:!0,...i},children:h==="closed"?u:a}),h!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(_e,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Y({"rotate-180":g}),onClick:()=>{p(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 am=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return y.createElement(e,{className: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:y.Fragment,forceInline:!0},h={"--icon":`url(${It}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(y.Fragment,{children:[d.jsx("dt",{style:h,children:d.jsx(Rt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Rt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:h,children:typeof l.text=="string"?d.jsx(Rt,{options:c,children:l.text}):l.text},u)})})},nt=()=>y.Fragment,im=({children:e})=>d.jsx(Mt,{variant:"secondary",children:e}),sm=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),om=["span","strong","h1","h2","h3","h4","h5","h6","p"],um=({children:e})=>{const t=ue.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of y.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(y.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of y.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&y.isValidElement(s)){const o=s.type;if(om.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(Va,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},lm=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(Mt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(Mt,{variant:"primary",children:e});case"pink-textbox":return d.jsx(Mt,{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})},Ct=({children:e})=>d.jsx(d.Fragment,{children:e}),cm=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(Ie,{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}`})]})},Yo=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},dm=({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 y.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&y.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"||Yo(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!y.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Yo(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(_e,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},ds=({children:e,...t})=>d.jsx("span",{className:Y({url:t==null?void 0:t.href}),children:e});const fm={default:{a:dm,CollapsibleSection:Va,TextBox:Mt,CaseStudy:im,style:nt,details:um,div:lm,iframe:cm,center:sm},"text-only":{h1:nt,h2:nt,h3:nt,h4:nt,h5:nt,h6:nt,style:nt,details:nt,div:nt,TextBox:nt,CollapsibleSection:nt,CaseStudy:nt,blockquote:nt,iframe:nt,button:nt}},xn=({element:e="div",className:t="",options:n={},children:r,overrideType:a="default",styling:i={}})=>{if(!r)return null;const{highlightTitles:s=!1}=i;r=r.replace(/^<br\/?>/,"");const o={wrapper:y.Fragment,forceBlock:!0};let l=fm[a];return n.overrides&&(l={...l,...n.overrides}),y.createElement(e,{className:Y("markdown-text",t,{"highlight-titles":s}),children:d.jsx(Rt,{options:{...o,...n,overrides:l},children:r})})};const Kc=({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&&y.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&y.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const gn=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${It}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=Ls(!!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(An,{isOpen:l,children:a}),c]}):c};const Fr=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:Y("status-banner text-small",n),"aria-live":"assertive"},t);const hm=({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:y.createElement(i?"span":Ie,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},qs=y.memo(hm);const ci="loadingBlock_",mm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ue.useIntl();t||(t={0:{text:r.formatMessage({id:`${ci}loading`})},75:{text:r.formatMessage({id:`${ci}almostDone`})},100:{text:r.formatMessage({id:`${ci}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(${It}icons/${t[a].icon}.svg)`}:{};return d.jsxs(Mt,{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(qs,{progress:e})]})},pm=y.memo(mm);const kt=({element:e="div",className:t="",...n})=>d.jsx(Wa,{element:e,className:Y("loading-placeholder",t),...n});const fs={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"]},Zc=(e,t)=>e in fs?d.jsx("div",{className:e,children:fs[e].map((n,r)=>Zc(n,r))},t):d.jsx(kt,{className:e},t),Ws=({layout:e="overview-page",...t})=>d.jsx("div",{className:Y("loading-state",e),...t,children:fs[e].map((n,r)=>Zc(n,r))}),Yc=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):""},Ur=["#5AB6A3","#A2D7AF","#806056","#3962B3"],gm=e=>{const t=Math.ceil(26/Ur.length),n=Yc(e).toLowerCase();if(n==="")return Ur[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Ur.length;a++)if(r<=t*(a+1))return Ur[a]};const Go=256,Yt=({className:e="",src:t="",name:n,alt:r,width:a=Go,height:i=Go,...s})=>{const[o,l]=y.useState(!1),u=y.useRef(null),c=r??n;y.useEffect(()=>{const p=u.current;if(!p)return;const m=p.getContext("2d");if(!m)return;const g=a,f=i;typeof window<"u"&&window.devicePixelRatio&&(p.width=g*window.devicePixelRatio,p.height=f*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=gm(n),m.fillRect(0,0,g,f),m.font=`${g/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Yc(n),g/2,f/1.6)},[n]);let h=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(h=!0),d.jsx("figure",{className:Y("profile-picture",e,{error:o}),...s,children:h?d.jsx("img",{src:t,alt:c,onError:()=>{l(!0)},width:a,height:i}):d.jsx("canvas",{ref:u})})},Ka=e=>e==="apolitical"?{image:`${It}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${It}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},vm=({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=Zn(l,r)),l};const wn=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},functions:a={},gtmContext:i="member",gtmType:s="member-click",className:o="",alt:l=""})=>{const u=ue.useIntl(),{size:c="medium"}=r,h=Ka(t);h.name||(h.name=u.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:p,image:m}=h;let{url:g}=h;t.link!==void 0&&(t.link===!1?g=void 0:g=t.link);const f=vm(h),D=n&&n.createdAt?us(n.createdAt):!1,v=n&&n.createdAt?zs(n.createdAt):"";return y.createElement(e,{className:Y("member text-medium",c,o),...a,children:d.jsxs(Tn,{href:g,gtmType:s,gtmContext:i,onClick:E=>{E==null||E.stopPropagation()},children:[d.jsx(Yt,{name:p,src:m,alt:l}),d.jsxs("p",{className:"details",children:[d.jsxs("strong",{children:[p,n&&d.jsxs("span",{className:"additional-content",children:[n.createdAt&&D&&d.jsx("span",{className:"date",title:v,"aria-label":v,children:u.formatMessage({id:`dates_${D.path}`},{number:D.number})}),n.didEdit&&d.jsx("em",{children:u.formatMessage({id:"discussion_edited"})})]})]}),f&&d.jsx("small",{className:Y({"text-medium":c==="large"}),children:f})]})]})})};const Qo={small:24,medium:48},Hs=({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:y.createElement(e,{...c,className:Y("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((p,m)=>{let g,f="";if(m<o){const{name:D="",image:v=""}=Ka(p);if(s)return d.jsx(kt,{element:"li",className:"contributor"},m);g=d.jsx(Yt,{name:D,src:v,width:Qo[a||"medium"],height:Qo[a||"medium"]})}else if(m===o){const D=(t||n.length)-o;g=d.jsxs("small",{className:Y({"large-number":D>99}),children:["+",Kh(D,0)]}),f="number-left"}return g?d.jsx("li",{className:Y("contributor",f),children:g},m):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]}`}):Zn(n[0].name||"",20):l||null})]})})},Gc=({showDevTools:e=!0,children:t})=>{const n=new Ye.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return d.jsxs(Ye.QueryClientProvider,{client:n,children:[t,e&&d.jsx(Fh.ReactQueryDevtools,{initialIsOpen:!1})]})};var Qc=y.createContext({client:da});function bm(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=y.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(da.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),da.init(r,a)),da)},[n,r]);return y.createElement(Qc.Provider,{value:{client:i}},t)}var ym=function(){var e=y.useContext(Qc).client;return e};function Dm(e){var t=ym(),n=y.useState(),r=n[0],a=n[1];return y.useEffect(function(){return t.onFeatureFlags(function(){a(t.getFeatureFlagPayload(e))})},[t,e]),r}const Jc=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(bm,{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});var Us=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(Us||{});const Xc=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Vh[r],...n||{}};return d.jsx(ue.IntlProvider,{locale:r,messages:a,children:e})},Vs=y.createContext({}),ha={en:"English",es:"Español",fr:"Français",pt:"Português"},Lt=y.createContext({isLoading:!0});function Za(){return y.useContext(Lt)}const ed=({children:e,user:t})=>d.jsx(Lt.Provider,{value:t,children:e}),Ks=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),td=()=>y.useContext(Ks),nd=({children:e})=>{const[t,n]=y.useState([]);y.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=y.useCallback(i=>{n(s=>[...s,i])},[]),a=y.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return d.jsx(Ks.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Cm=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=y.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=y.useState(s),u=c=>{localStorage.setItem("language",c),l(c)};return y.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),$c(5e3)}).catch(c=>{c.message===Nc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(Vs.Provider,{value:{language:o,updateLanguage:u},children:d.jsx(Xc,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(Is.CookiesProvider,{children:d.jsx(ed,{user:a,children:d.jsx(nd,{children:d.jsx(Gc,{showDevTools:r,children:d.jsx(Jc,{user:a,children:t})})})})})})})};const cr="joinCommunityButton",Zs=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ue.useIntl(),o=y.useContext(Lt),l=o&&typeof o.id=="string",u=r||!l,[c,h]=y.useState(e),[p,m]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{p==="joining"?m("joined"):p==="leaving"&&m("notJoined")},[c]);const g={},f={};return c&&p!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${cr}_leave`}),g["aria-label"]=s.formatMessage({id:`${cr}_member_aria`}),f["aria-hidden"]="true"),d.jsx(_e,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&p!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!c?s.formatMessage({id:`${cr}_closed_tooltip`}):"",onClick:async D=>{if(u)return;D.currentTarget.blur(),m(c?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${cr}_aria_live`},{action:c?"leaving":"joining"})}});document.dispatchEvent(v);const E=c?i:a;typeof E=="function"&&setTimeout(async()=>{await E()},500),h(!c)},className:Y("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...g,children:d.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${cr}${["joining","leaving"].includes(p)?`_${p}`:c?"_member":n?"_short":""}`})})})};const di="communityDetails_",xm=({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({}),p=`/communities/${r}/members`===window.location.pathname,m=t||n,g=!n&&!t;return d.jsxs("div",{className:Y("community-details",e),children:[m&&d.jsxs("div",{className:"member-details",children:[d.jsxs("div",{className:"top",children:[d.jsxs("h4",{children:[l.formatMessage({id:`${di}members`}),d.jsx("span",{className:"count",children:c})]}),!p&&d.jsx("p",{className:"text-small",children:d.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${di}viewAll`})})})]}),d.jsx(Hs,{contributors:{total:a,data:h},styling:{size:"medium",showGap:!0,showPlaceholders:c===0},cutoff:u})]}),d.jsx(Zs,{isMember:t,isOpen:n,disabled:g,functions:{...o}}),t&&d.jsx(_e,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${di}invite`})})]})};const wm=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Ie,{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(Ie,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),d.jsx(Tn,{href:s?void 0:i,...l,children:Zn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Em=({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]=y.useState(t?["all"]:[]),u=(c,h)=>{let p=[];o.includes(c)?p=o.filter(m=>m!==c):c==="all"?p=["all"]:n?p=[...o.filter(m=>m!=="all"),c]:p=[c],l(m=>(r&&typeof r=="function"&&r({current:p,previous:m}),p)),h&&typeof h=="function"&&h()};return d.jsx("ul",{className:Y("filters",a),children:s.map(({id:c,text:h,disabled:p=!1,callback:m=()=>{}})=>{let g={};return p&&(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,m)},...g,children:h})},c)})})},km=(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 Vr="languageSwitcher_",_m=({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=()=>{}}=y.useContext(Vs),[h,p]=y.useState(e);if(y.useEffect(()=>{e!==h&&p(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:`${Vr}label`})}),d.jsx("ul",{children:g.map(D=>{var B;if(!ha[D])return null;const v=(B=r[D])==null?void 0:B.post_name;let E={className:D};if(h===D)E["aria-label"]=u.formatMessage({id:`${Vr}selected`},{language:ha[D]});else{const x=km(D,v,i);E={...E,href:typeof x=="string"?x:x.url,onClick:k=>{p(D),c(D),typeof a<"u"&&(k.preventDefault(),k.stopPropagation(),a(D,typeof x=="string"?x:x.urlForRouter))}}}return d.jsx("li",{children:d.jsx(Tn,{...E,fallbackElement:"span",children:ha[D]})},D)})}),s!=="short"&&!f&&d.jsx("p",{children:u.formatMessage({id:`${Vr}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${Vr}disclaimer`},{email:$n.support,link:D=>{const v=`mailto:${D}`;return d.jsx("a",{href:v,children:D})}})})]})};const fi=ue.createIntl({locale:"en",messages:nr}),$r=({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:fi.formatMessage({id:"loadMore_button"}),endOfFeed:fi.formatMessage({id:"loadMore_endOfFeed"}),error:fi.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,h]=y.useState(""),p=async m=>{if(!n)try{await t(m)}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(_e,{variant:r,size:a,styling:i,icon:s,onClick:p,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!c||c!=null&&c.includes("Cannot read items"))?d.jsx("p",{children:o.endOfFeed}):c&&d.jsx("p",{className:"error",children:o.error})})};const Ys=({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(Ie,{children:d.jsx(ue.FormattedMessage,{id:"apolitical"})})})});let Kr=!1;const rd=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ue.useIntl(),i=y.useRef(null),[s,o]=y.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return y.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),y.createElement(e,{ref:i,className:Y("more-menu text-medium",r),children:d.jsxs(d.Fragment,{children:[d.jsx(_e,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),d.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:c,text:h,icon:p,...m},g)=>{const f={...m,onClick:D=>{o(!1),typeof c=="function"&&c(D)},onFocus:()=>{Kr&&(clearTimeout(Kr),Kr=!1)},onBlur:()=>{Kr=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),d.jsx("li",{className:"more-menu-list-item",children:d.jsx(_e,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${g}`)})})]})})},Bm=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Fm=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],ad=({activeLink:e})=>{const t=ue.useIntl(),n=y.useContext(Lt),r=n&&typeof n.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Fm.map(({key:a,href:i})=>{const s=Bm(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(Yt,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),d.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},dr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Am=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${dr(t,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(e)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${dr(t,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(e)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${dr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
38
38
 
39
- ${dr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:dr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const jm="shareLinks_",Om=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ue.useIntl(),l=Sm({title:e,link:t,referrer:n});return c.jsxs("aside",{className:Y("share-links",a,i,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:l.map(({key:u,icon:d,url:f,shouldRender:p=!0,onClick:m})=>{if(typeof p=="function"&&!p())return null;const g={};return m&&(g.onClick=h=>m(h,f)),c.jsx("li",{children:c.jsx(_e,{size:a,variant:"tertiary",icon:{icon:d||u},href:f,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:`${jm}link_${u}`}),...g})},u)})})]})};const Pm=({tabs:e,className:t="",preventLocationChange:n})=>{var p;const r=(m,g,h)=>(m||(m=`panel-${window.btoa(g)}-${h}`),m);let a=e.findIndex(m=>m.current===!0);if(a<0&&(a=0),window.location.hash){const m=window.location.hash.replace("#","");if(e.find(h=>h.id===m)){for(let h=0;h<e.length;h++)if(r(e[h].id,e[h].text,h)===m){a=h;break}}}const[i,s]=D.useState((p=e[a])!=null&&p.id?e[a].id:r(e[a].id,e[a].text,a)),[o,l]=D.useState(""),u=(m,g)=>{switch(m.key){case"ArrowLeft":case"ArrowRight":{m.preventDefault();let h=g;m.key==="ArrowLeft"?g>0?h=g-1:h=e.length-1:m.key==="ArrowRight"&&(g<e.length-1?h=g+1:h=0);const y=r(e[h].id,e[h].text,h),v=document.getElementById(`tab-${y}`);v==null||v.focus(),l(y);break}case"Enter":s(o),window.location.hash=`#${o}`;break}};D.useEffect(()=>{if(e[a].hasCarousel){const m=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(m)}},[i]);const d=[],f=[];return e.forEach(({id:m,text:g,content:h,href:y,hasCarousel:v},w)=>{m=r(m,g,w);const _=i===m,x={};y||(x["aria-controls"]=m,x.onClick=k=>{k.preventDefault(),k.stopPropagation(),s(m),!n&&(window.location.hash=`#${m}`)},f.push(c.jsx("section",{id:m,hidden:!_,role:"tabpanel","aria-labelledby":`tab-${m}`,"aria-live":_?"assertive":"off",children:typeof h=="string"?c.jsx("p",{children:h}):h},`section-${m}`))),d.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:y||`#${m}`,id:`tab-${m}`,"aria-controls":m,className:Y({selected:_}),role:"tab",tabIndex:_?0:-1,"aria-selected":_,onKeyDown:k=>u(k,w),...x,children:g})},`tab-${m}`))}),c.jsxs("div",{className:Y("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:d}),c.jsx("div",{className:"tab-content",children:f})]})};const Nm={"2-1":901,"1-3":769,"1-1":769},od=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=nr(!0);let s=a;return D.Children.count(a)===1&&(s=D.Children.toArray(a)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:Y("columns",`layout-${e}`,r,{"has-containers":n}),children:D.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Nm[e]?null:o)})};const Js=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=ue.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:Y("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":d?"":a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:a.formatMessage({id:i})}),n," / ",t]})}),c.jsx(Ie,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},Qa=e=>(e==null?void 0:e.toString().length)||0,ud=(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 Yr="emailHelperTextBox_",ld=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=ue.useIntl(),[s,o]=D.useState({path:`${Yr}default`,type:"default",link:{},mail:{},error:""}),[l,u]=D.useState(!1),d=D.useCallback(g=>{g.preventDefault(),g.stopPropagation();const h=y=>{o({path:`${Yr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>d(v),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:y})};if(typeof a!="function"){h(i.formatMessage({id:`${Yr}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(y=>{h(y.message)}).finally(()=>{u(!1)})},[n,r,a]);D.useEffect(()=>{let g=Yr,h="default",y={},v={};switch(t){case"gov":g+="autoApproved",h="success";break;case"nonGov":g+="unrecognisedEmail",h="error",y={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":g+="pendingApproval",h="error",v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":g+="emailUnverified",h="error",y={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:w=>d(w),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",h="error",y={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",y={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:g,type:h,link:y,mail:v})},[t]);const f={};return["link","mail"].forEach(g=>{f[g]=Object.keys(s[g]).length?h=>c.jsx("a",{...s[g],children:h}):h=>h}),c.jsx(Kc,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),children:l?c.jsxs(c.Fragment,{children:[c.jsx(kt,{element:"span"}),c.jsx(kt,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...f,strong:g=>c.jsx("strong",{children:g}),em:g=>c.jsx("em",{children:g}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},zn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,autoFocus:u,...d})=>{const f=D.useRef(),p=r||f;return D.useEffect(()=>{var m;u&&((m=p.current)==null||m.focus())},[]),!(d!=null&&d.autoComplete)&&["email"].includes(o)&&(d.autoComplete="email"),D.createElement(t,{ref:p,...d,type:o,id:n,name:i,className:Y(e,t,{"has-scrollbar":o==="textarea"&&p.current&&p.current.clientHeight<p.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:m=>{const g=m.target;a.onChange(g.value)}})};const Nn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Rm=500,Mm=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:d},f]=D.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:m,isPredictionSelected:g},h]=D.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:y}=ue.useIntl();r||(r=y({id:"inputAutocomplete_placeholder"})),D.useEffect(()=>{const x=setTimeout(()=>{g||f(k=>({...k,debouncedInput:l}))},Rm);return()=>{clearTimeout(x)}},[l,g]),D.useEffect(()=>{d&&!g?(async()=>{try{const k=await o(d)||[];h(T=>({...T,predictions:k}))}catch(k){console.error("Error fetching predictions:",k),h(T=>({...T,predictions:[]}))}})():h(x=>({...x,predictions:[]}))},[d,g]),D.useEffect(()=>{m>=0&&p[m]&&f(x=>({...x,displayInput:p[m].description}))},[m,p]);const v=x=>{[Nn.DOWN,Nn.UP,Nn.ENTER].includes(x.key)&&(x.preventDefault(),x.key===Nn.DOWN&&m<p.length-1?h(k=>({...k,activePredictionIndex:m+1})):x.key===Nn.UP&&m>0?h(k=>({...k,activePredictionIndex:m-1})):x.key===Nn.ENTER&&m>-1&&(s(p[m].description),f(k=>({...k,input:p[m].description})),h(k=>({...k,predictions:[],isPredictionSelected:!0}))))},w=x=>{s(x.target.value),f(k=>({...k,input:x.target.value,displayInput:x.target.value})),h(k=>({...k,activePredictionIndex:-1,isPredictionSelected:!1}))},_=x=>{s(x.description),f(k=>({...k,input:x.description,displayInput:x.description})),h(k=>({...k,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:w,onKeyDown:v,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:p.map((x,k)=>c.jsx("li",{onClick:()=>_(x),onMouseEnter:()=>h(T=>({...T,activePredictionIndex:k})),className:Y("predictions-list-item",{active:k===m}),children:x.description},k))})]})};const cd=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:d,...f})=>{const p=ue.useIntl(),{onChange:m,...g}=r,h=()=>{t||m(d?null:l)},y=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:d,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),h())},readOnly:!0,disabled:t}),c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:a,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return D.createElement(n,{onClick:v=>{const w=v.target;w.nodeName.toLowerCase()==="a"||w.parentNode&&w.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),h())},className:Y("checkbox-wrapper",e),...f,...g},y)};const Im=D.memo(function({direction:t="down"}){return c.jsx(Ua,{className:Y("rotating-chevron",`direction-${t}`)})});const $m=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const d=ue.useIntl(),[f,p]=D.useState(!1),m=r||n,g=Array.isArray(m)?[...m]:m?[m]:[],[h,y]=D.useState(g);let v;Array.isArray(h)&&h.length===1&&typeof h[0]=="string"?v=t&&h?t.find(S=>S.id===h[0]):t?t[0]:{id:"",label:""}:Array.isArray(h)&&h.length===1&&typeof h[0]!="string"?v=h[0]:v={id:"",label:""},D.useEffect(()=>{y(g)},[r,n]);const{onChange:w,onMultiSelectSubmit:_,...x}=a,k=S=>{if(o){let q=[];h!=null&&h.includes(S.id)?q=h.filter(N=>N!==S.id):q=[...h,S.id],y([...q]),w&&w([...q])}else y([S]),w&&w(S.id),p(!1)},T=S=>{if(S==="all"){const q=(t==null?void 0:t.map(N=>N.id))||[];y(q),w&&w(q)}else y([]),w&&w([])};return c.jsxs("div",{className:Y("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":f,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),p(!f)},"data-testid":"dropdown-selector",...x,children:[o?`${s} · ${h.length}`:v.label,c.jsx(Im,{direction:f?"up":"down"})]}),c.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const q=t&&t.find(N=>N.id===S.target.value);k(q)},hidden:!f,...x,children:t==null?void 0:t.map(S=>c.jsx("option",{value:S.id,children:S.label},S.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!f,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${h==null?void 0:h.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>T("all"),className:"gtm-trackable",children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>T("none"),className:"gtm-trackable",children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(S=>{const q=S.id===v.id||(h==null?void 0:h.includes(S))||(h==null?void 0:h.includes(S.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:Y("gtm-trackable",{selected:q,"selected-single":q&&!o}),"data-gtm-event-type":`${S}-click`,"data-gtm-event-context":i,onClick:N=>{N.preventDefault(),N.stopPropagation(),k(S)},role:"menuitem","aria-current":q,"data-testid":q?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:Y({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(_e,{variant:"secondary",onClick:()=>{_&&_(h),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:h}})),p(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})};const Lm=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:d,...f})=>{const p=ue.useIntl(),m=i?d:[],g=d;return c.jsx("ul",{...f,className:Y("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:h,label:y=!1,value:v=h,disabled:w=!1})=>{const _=`${r}_${h}`,x=()=>{if(w)return;let k;if(i){const T=m==null?void 0:m.indexOf(v);Array.isArray(m)&&T>=0?(k=m,k.splice(T,1)):(!m||m.length===0?k=[]:k=m,k.push(v))}else k=g===v?void 0:v;t.onChange(k)};return c.jsx(cd,{element:"li",id:_,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?m==null?void 0:m.includes(v):g===v,functions:{...t,onChange:x},intlPath:n,label:y||p.formatMessage({id:n?`${n}_${h}`:h}),disabled:w},_)})})};const zm=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=ue.useIntl(),s=D.useRef(),o=e||s,[l,u]=D.useState(!1),[d,f]=D.useState(t),p=()=>{var m;u(!l),f(l?"password":"text"),(m=o.current)==null||m.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:Y("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:p,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(zn,{inputRef:o,type:d,autoComplete:r,...a})]})};const Rn={text:{component:zn},email:{component:zn},url:{component:zn},textarea:{component:zn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:cd},checkboxes:{component:Lm,props:{multiSelect:!0}},select:{component:$m},password:{component:zm},autocomplete:{component:Mm}},qm=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:d,...f})=>{const p=ue.useIntl(),m=l&&l.some(({condition:N})=>N==="required"),g=Qa(u),h=o&&Rn[o]&&Rn[o].component?Rn[o].component:zn,y=o&&["checkboxes"].includes(o),v=r&&`error-${e}`,w=`character-limit-${e}`,_={};y?_.element="legend":_.htmlFor=e;let x={...f,id:e,name:e,className:r?"error":"",type:o,required:m,"aria-required":m,functions:bn(a),value:u};const k=N=>{x["aria-describedby"]?x["aria-describedby"]+=` ${N}`:x["aria-describedby"]=N};if(i>0){const N=ud(i,a.onChange);k(`${w}-info`),x={...x,...N},N.functions&&typeof N.functions=="object"&&(x.functions={...x.functions,...N.functions})}o&&Rn[o]&&Rn[o].props&&(x={...x,...Rn[o].props}),y&&(x.intlPath=`${t}_${e}`),r&&(x["aria-invalid"]=!0,x["aria-errormessage"]=v,k(v));const T=f.label||p.formatMessage({id:t?`${t}_${e}`:e}),S=({...N})=>r?D.createElement(N.as||"p",{id:v,className:"error text-small",...N},r):null;if(o&&["checkbox"].includes(o))return c.jsxs(c.Fragment,{children:[c.jsx(h,{...x,label:T,className:Y("field-wrapper",n)}),c.jsx(S,{as:"p"})]});const q=N=>D.createElement(N.element||"label",{...N,className:"checkboxes-label text-small","data-testid":`label-${e}`});return c.jsx(c.Fragment,{children:D.createElement(y?"fieldset":"div",{className:Y("field-wrapper text-medium",n)},c.jsxs(c.Fragment,{children:[D.createElement(y?"div":"p",{className:"field-label"},c.jsx(c.Fragment,{children:c.jsxs(q,{..._,children:[T,m&&s&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})})),D.createElement(y?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(h,{...x}),c.jsx(Js,{id:w,limit:i,valueLength:g})]})),c.jsx(S,{})]}))})},Wm=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?bn(e.errors):{},i=e.values?bn(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:d}=r,f=bn(Object.keys(a));for(const p of s)if(p.validation)for(let m=0;m<p.validation.length;m++){const{condition:g="required",error:h=!1}=p.validation[m];let y=!1;if(typeof g=="function"){const v=g(i);v&&(y=h||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(y=h||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(y=h||(d==null?void 0:d.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(y=h||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(y=h||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(y){o({type:"addError",payload:{key:p.id,value:y}}),f.push(p.id);break}}return f.length===0?l(i):u(i,f),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let pi=null;const ln=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:{onSuccess:f=async()=>{},onCancel:p=()=>{},onCatch:m=()=>{},onFailure:g=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...h})=>{const{customOnSubmit:y,hideButton:v,overwriteSubmittingText:w=!1,..._}=s,x=40,{shouldShowCancelButton:k=!1,shouldReset:T=!0,shouldHide:S=!0,showRequiredLabels:q=!0,showSuccessMessage:N=!1}=l||{},I=ue.useIntl(),z={};t.length&&t.forEach(A=>{const L=A.id||A.name;L&&(z[L]=A.value||"")});const[E,F]=D.useReducer(Wm,{isSubmitting:!1,formSubmitted:!1,errors:{},values:z}),{errors:j,isSubmitting:M,formSubmitted:V,values:G}=E;D.useEffect(()=>{T&&V&&(pi=setTimeout(()=>{F({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[V]),D.useEffect(()=>()=>{pi&&clearTimeout(pi)},[]),D.useEffect(()=>{const A=L=>{F({type:"updateValue",payload:{key:L.detail.id,value:L.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",A),()=>{document.removeEventListener("dropdownMultiSelectSubmit",A)}},[]);const J=D.useRef(null),ae=a||J;if(!t.length)return null;let C=_.text;C||(C=s.children||I.formatMessage({id:"form_submit"})),delete _.text;const R=()=>{if(!M){if(F({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&F({type:"submitForm",payload:{fields:t,dispatch:F,intl:I}});return}F({type:"submitForm",payload:{fields:t,dispatch:F,onSuccess:async A=>{try{await f(A),F({type:T?"formSubmittedAndReset":"formSubmitted"})}catch(L){m(L),F({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(A,L)=>{g(A,L),F({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:I}})}},B=[{..._,icon:V?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:A=>{var U;if(A.preventDefault(),A.stopPropagation(),M)return;let L=0;if((U=ae==null?void 0:ae.current)!=null&&U.id){const re=document.getElementById(ae.current.id);re&&(L=re.getBoundingClientRect().top+window.scrollY)}const $=document.getElementById("header");$&&(L=L-$.offsetHeight-x),L<0&&(L=0),window.scrollTo({top:L,behavior:"smooth"}),R()},disabled:M||V||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:w?C:M||V?I.formatMessage({id:`form_${M?"submitting":"submitted"}`}):C}];return k&&B.unshift({...o,className:"gtm-trackable","data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:M||V,onClick:p,children:o.text||I.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[D.createElement(e,{...h,id:r,className:Y("form",n),ref:ae},c.jsxs(c.Fragment,{children:[j!=null&&j.general?c.jsx(un,{variant:"error",text:I.formatMessage({id:"form_error_generalError"})}):null,u,(!S||!M&&!V||y)&&t.map((A,L)=>{const{id:$=A.name||L,component:U,functions:re={onChange:()=>{}},submitOnEnter:te=!1}=A;if(U)return c.jsx(U,{...A.props||{}},`component-${$}-${L}`);const ne=(G==null?void 0:G[$])||"",le={...re,onChange:Q=>{F({type:"updateValue",payload:{key:$,value:Q}}),re.onChange(Q&&Q.toString(),F)}};return te&&(le.onKeyDown=Q=>{Q.key==="Enter"&&(Q.stopPropagation(),Q.preventDefault(),R()),re.onKeyDown&&re.onKeyDown(Q)}),c.jsx(qm,{intlPath:i,...A,showRequiredLabels:q,value:ne,error:j==null?void 0:j[$],functions:le},$)}),v?null:(M||V)&&y?y:c.jsx(ar,{className:Y("cta",{center:M||V,submitted:V}),buttons:B})]})),N&&V&&c.jsx(Fr,{className:"success",children:typeof N=="string"?N:I.formatMessage({id:"form_success"})})]})};const Gr="passwordRules_",dd="isMoreThanEightCharacters",fd="includesNumberAndSymbol",hd="includesLowerAndUppercase",Hm={[dd]:"8Characters",[fd]:"numberSymbol",[hd]:"lowercaseUppercase"},Um=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ue.useIntl();return c.jsxs("aside",{className:Y("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${Gr}intro`})}),c.jsx("ul",{children:[dd,fd,hd].map(r=>c.jsxs("li",{className:Y({matches:e[r]}),children:[c.jsxs(Ie,{children:[n.formatMessage({id:`${Gr}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${Gr}rule_${Hm[r]}`})}),!e[r]&&c.jsxs(Ie,{element:"strong",children:[" ",n.formatMessage({id:`${Gr}notMet`})]})]},`rule-${r}`))})]})},md=D.memo(Um);const Vm=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ue.useIntl(),[l,u]=D.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const v=await n();u(w=>({...w,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(w=>({...w,setUp:!0,disabled:!0})),a(v)}};if(D.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(kt,{className:"rating-placeholder"});const{id:f,rating:p,disabled:m}=l,g="ratings_",h={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 v=>{if(!(!f||m))try{u(w=>({...w,rating:v,disabled:!0})),await r({id:f,value:v})}catch(w){u(_=>({..._,rating:null})),a(w)}finally{u(w=>({...w,disabled:!1}))}};return c.jsxs("div",{className:Y("rating",i),children:[c.jsx("span",{className:"label",children:h[p?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const w=v+1;return c.jsx("li",{className:Y({selected:p&&w<=p}),children:c.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:`star${!p||w>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:w,total:t})}${w===1||w===t?` - ${h[w===1?"low":"high"]}`:""}`,onClick:_=>{_.preventDefault(),_.stopPropagation(),y(w)},disabled:m})},`rating-${w}`)})})]})};function Km(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 ps(e,t){return Array(t+1).join(e)}function Zm(e){return e.replace(/^\n*/,"")}function Ym(e){for(var t=e.length;t>0&&e[t-1]===`
40
- `;)t--;return e.substring(0,t)}var Gm=["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 Xs(e){return eo(e,Gm)}var pd=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function gd(e){return eo(e,pd)}function Qm(e){return bd(e,pd)}var vd=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function Jm(e){return eo(e,vd)}function Xm(e){return bd(e,vd)}function eo(e,t){return t.indexOf(e.nodeName)>=0}function bd(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var rt={};rt.paragraph={filter:"p",replacement:function(e){return`
39
+ ${dr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:dr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const Tm="shareLinks_",Sm=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ue.useIntl(),l=Am({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:p=!0,onClick:m})=>{if(typeof p=="function"&&!p())return null;const g={};return m&&(g.onClick=f=>m(f,h)),d.jsx("li",{children:d.jsx(_e,{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:`${Tm}link_${u}`}),...g})},u)})})]})};const jm=({tabs:e,className:t="",preventLocationChange:n})=>{var p;const r=(m,g,f)=>(m||(m=`panel-${window.btoa(g)}-${f}`),m);let a=e.findIndex(m=>m.current===!0);if(a<0&&(a=0),window.location.hash){const m=window.location.hash.replace("#","");if(e.find(f=>f.id===m)){for(let f=0;f<e.length;f++)if(r(e[f].id,e[f].text,f)===m){a=f;break}}}const[i,s]=y.useState((p=e[a])!=null&&p.id?e[a].id:r(e[a].id,e[a].text,a)),[o,l]=y.useState(""),u=(m,g)=>{switch(m.key){case"ArrowLeft":case"ArrowRight":{m.preventDefault();let f=g;m.key==="ArrowLeft"?g>0?f=g-1:f=e.length-1:m.key==="ArrowRight"&&(g<e.length-1?f=g+1:f=0);const D=r(e[f].id,e[f].text,f),v=document.getElementById(`tab-${D}`);v==null||v.focus(),l(D);break}case"Enter":s(o),window.location.hash=`#${o}`;break}};y.useEffect(()=>{if(e[a].hasCarousel){const m=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(m)}},[i]);const c=[],h=[];return e.forEach(({id:m,text:g,content:f,href:D,hasCarousel:v},E)=>{m=r(m,g,E);const B=i===m,x={};D||(x["aria-controls"]=m,x.onClick=k=>{k.preventDefault(),k.stopPropagation(),s(m),!n&&(window.location.hash=`#${m}`)},h.push(d.jsx("section",{id:m,hidden:!B,role:"tabpanel","aria-labelledby":`tab-${m}`,"aria-live":B?"assertive":"off",children:typeof f=="string"?d.jsx("p",{children:f}):f},`section-${m}`))),c.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:D||`#${m}`,id:`tab-${m}`,"aria-controls":m,className:Y({selected:B}),role:"tab",tabIndex:B?0:-1,"aria-selected":B,onKeyDown:k=>u(k,E),...x,children:g})},`tab-${m}`))}),d.jsxs("div",{className:Y("tabs-wrapper",t),children:[d.jsx("ul",{className:"tabs",role:"tablist",children:c}),d.jsx("div",{className:"tab-content",children:h})]})};const Om={"2-1":901,"1-3":769,"1-1":769},id=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=tr(!0);let s=a;return y.Children.count(a)===1&&(s=y.Children.toArray(a)[0],s.props&&(s=s.props.children)),d.jsx("section",{className:Y("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Om[e]?null:o)})};const Gs=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=ue.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,c=n>t;return d.jsxs(d.Fragment,{children:[d.jsx("small",{id:e,className:Y("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":c?"":a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:c?a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hidden",children:a.formatMessage({id:i})}),n," / ",t]})}),d.jsx(Ie,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},Ya=e=>(e==null?void 0:e.toString().length)||0,sd=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{Ya(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const Zr="emailHelperTextBox_",od=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=ue.useIntl(),[s,o]=y.useState({path:`${Zr}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),c=y.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=D=>{o({path:`${Zr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>c(v),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:D})};if(typeof a!="function"){f(i.formatMessage({id:`${Zr}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(D=>{f(D.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let g=Zr,f="default",D={},v={};switch(t){case"gov":g+="autoApproved",f="success";break;case"nonGov":g+="unrecognisedEmail",f="error",D={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":g+="pendingApproval",f="error",v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":g+="emailUnverified",f="error",D={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:E=>c(E),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",D={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",D={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:g,type:f,link:D,mail:v})},[t]);const h={};return["link","mail"].forEach(g=>{h[g]=Object.keys(s[g]).length?f=>d.jsx("a",{...s[g],children:f}):f=>f}),d.jsx(Uc,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),children:l?d.jsxs(d.Fragment,{children:[d.jsx(kt,{element:"span"}),d.jsx(kt,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...h,strong:g=>d.jsx("strong",{children:g}),em:g=>d.jsx("em",{children:g}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:s.error})})},Ln=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,autoFocus:u,...c})=>{const h=y.useRef(),p=r||h;return y.useEffect(()=>{var m;u&&((m=p.current)==null||m.focus())},[]),!(c!=null&&c.autoComplete)&&["email"].includes(o)&&(c.autoComplete="email"),y.createElement(t,{ref:p,...c,type:o,id:n,name:i,className:Y(e,t,{"has-scrollbar":o==="textarea"&&p.current&&p.current.clientHeight<p.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:m=>{const g=m.target;a.onChange(g.value)}})};const Pn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Pm=500,Nm=({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]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:m,isPredictionSelected:g},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:D}=ue.useIntl();r||(r=D({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const x=setTimeout(()=>{g||h(k=>({...k,debouncedInput:l}))},Pm);return()=>{clearTimeout(x)}},[l,g]),y.useEffect(()=>{c&&!g?(async()=>{try{const k=await o(c)||[];f(T=>({...T,predictions:k}))}catch(k){console.error("Error fetching predictions:",k),f(T=>({...T,predictions:[]}))}})():f(x=>({...x,predictions:[]}))},[c,g]),y.useEffect(()=>{m>=0&&p[m]&&h(x=>({...x,displayInput:p[m].description}))},[m,p]);const v=x=>{[Pn.DOWN,Pn.UP,Pn.ENTER].includes(x.key)&&(x.preventDefault(),x.key===Pn.DOWN&&m<p.length-1?f(k=>({...k,activePredictionIndex:m+1})):x.key===Pn.UP&&m>0?f(k=>({...k,activePredictionIndex:m-1})):x.key===Pn.ENTER&&m>-1&&(s(p[m].description),h(k=>({...k,input:p[m].description})),f(k=>({...k,predictions:[],isPredictionSelected:!0}))))},E=x=>{s(x.target.value),h(k=>({...k,input:x.target.value,displayInput:x.target.value})),f(k=>({...k,activePredictionIndex:-1,isPredictionSelected:!1}))},B=x=>{s(x.description),h(k=>({...k,input:x.description,displayInput:x.description})),f(k=>({...k,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:E,onKeyDown:v,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:p.map((x,k)=>d.jsx("li",{onClick:()=>B(x),onMouseEnter:()=>f(T=>({...T,activePredictionIndex:k})),className:Y("predictions-list-item",{active:k===m}),children:x.description},k))})]})};const ud=({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 p=ue.useIntl(),{onChange:m,...g}=r,f=()=>{t||m(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:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),f())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return y.createElement(n,{onClick:v=>{const E=v.target;E.nodeName.toLowerCase()==="a"||E.parentNode&&E.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),f())},className:Y("checkbox-wrapper",e),...h,...g},D)};const Rm=y.memo(function({direction:t="down"}){return d.jsx(Wa,{className:Y("rotating-chevron",`direction-${t}`)})});const Mm=({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,p]=y.useState(!1),m=r||n,g=Array.isArray(m)?[...m]:m?[m]:[],[f,D]=y.useState(g);let v;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?v=t&&f?t.find(S=>S.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?v=f[0]:v={id:"",label:""},y.useEffect(()=>{D(g)},[r,n]);const{onChange:E,onMultiSelectSubmit:B,...x}=a,k=S=>{if(o){let q=[];f!=null&&f.includes(S.id)?q=f.filter(N=>N!==S.id):q=[...f,S.id],D([...q]),E&&E([...q])}else D([S]),E&&E(S.id),p(!1)},T=S=>{if(S==="all"){const q=(t==null?void 0:t.map(N=>N.id))||[];D(q),E&&E(q)}else D([]),E&&E([])};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(),p(!h)},"data-testid":"dropdown-selector",...x,children:[o?`${s} · ${f.length}`:v.label,d.jsx(Rm,{direction:h?"up":"down"})]}),d.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const q=t&&t.find(N=>N.id===S.target.value);k(q)},hidden:!h,...x,children:t==null?void 0:t.map(S=>d.jsx("option",{value:S.id,className:"gtm-trackable","data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,children:S.label},S.id))}),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(_e,{variant:"tertiary",size:"small",onClick:()=>T("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":i,children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>T("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":i,children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(S=>{const q=S.id===v.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:q,"selected-single":q&&!o}),"data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,onClick:N=>{N.preventDefault(),N.stopPropagation(),k(S)},role:"menuitem","aria-current":q,"data-testid":q?"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(_e,{variant:"secondary",onClick:()=>{B&&B(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),p(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const Im=({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 p=ue.useIntl(),m=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:v=f,disabled:E=!1})=>{const B=`${r}_${f}`,x=()=>{if(E)return;let k;if(i){const T=m==null?void 0:m.indexOf(v);Array.isArray(m)&&T>=0?(k=m,k.splice(T,1)):(!m||m.length===0?k=[]:k=m,k.push(v))}else k=g===v?void 0:v;t.onChange(k)};return d.jsx(ud,{element:"li",id:B,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?m==null?void 0:m.includes(v):g===v,functions:{...t,onChange:x},intlPath:n,label:D||p.formatMessage({id:n?`${n}_${f}`:f}),disabled:E},B)})})};const $m=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=ue.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[c,h]=y.useState(t),p=()=>{var m;u(!l),h(l?"password":"text"),(m=o.current)==null||m.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:Y("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:p,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),d.jsx(Ln,{inputRef:o,type:c,autoComplete:r,...a})]})};const Nn={text:{component:Ln},email:{component:Ln},url:{component:Ln},textarea:{component:Ln,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:ud},checkboxes:{component:Im,props:{multiSelect:!0}},select:{component:Mm},password:{component:$m},autocomplete:{component:Nm}},Lm=({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 p=ue.useIntl(),m=l&&l.some(({condition:N})=>N==="required"),g=Ya(u),f=o&&Nn[o]&&Nn[o].component?Nn[o].component:Ln,D=o&&["checkboxes"].includes(o),v=r&&`error-${e}`,E=`character-limit-${e}`,B={};D?B.element="legend":B.htmlFor=e;let x={...h,id:e,name:e,className:r?"error":"",type:o,required:m,"aria-required":m,functions:bn(a),value:u};const k=N=>{x["aria-describedby"]?x["aria-describedby"]+=` ${N}`:x["aria-describedby"]=N};if(i>0){const N=sd(i,a.onChange);k(`${E}-info`),x={...x,...N},N.functions&&typeof N.functions=="object"&&(x.functions={...x.functions,...N.functions})}o&&Nn[o]&&Nn[o].props&&(x={...x,...Nn[o].props}),D&&(x.intlPath=`${t}_${e}`),r&&(x["aria-invalid"]=!0,x["aria-errormessage"]=v,k(v));const T=h.label||p.formatMessage({id:t?`${t}_${e}`:e}),S=({...N})=>r?y.createElement(N.as||"p",{id:v,className:"error text-small",...N},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(f,{...x,label:T,className:Y("field-wrapper",n)}),d.jsx(S,{as:"p"})]});const q=N=>y.createElement(N.element||"label",{...N,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsx(d.Fragment,{children:y.createElement(D?"fieldset":"div",{className:Y("field-wrapper text-medium",n)},d.jsxs(d.Fragment,{children:[y.createElement(D?"div":"p",{className:"field-label"},d.jsx(d.Fragment,{children:d.jsxs(q,{...B,children:[T,m&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})})),y.createElement(D?"div":"p",{className:"field-component"},d.jsxs(d.Fragment,{children:[d.jsx(f,{...x}),d.jsx(Gs,{id:E,limit:i,valueLength:g})]})),d.jsx(S,{})]}))})},zm=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?bn(e.errors):{},i=e.values?bn(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=bn(Object.keys(a));for(const p of s)if(p.validation)for(let m=0;m<p.validation.length;m++){const{condition:g="required",error:f=!1}=p.validation[m];let D=!1;if(typeof g=="function"){const v=g(i);v&&(D=f||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(D=f||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(D=f||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(D=f||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(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:p.id,value:D}}),h.push(p.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 hi=null;const ln=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:c={context:"Form",event:"form-submit-click"},functions:{onSuccess:h=async()=>{},onCancel:p=()=>{},onCatch:m=()=>{},onFailure:g=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...f})=>{const{customOnSubmit:D,hideButton:v,overwriteSubmittingText:E=!1,...B}=s,x=40,{shouldShowCancelButton:k=!1,shouldReset:T=!0,shouldHide:S=!0,showRequiredLabels:q=!0,showSuccessMessage:N=!1}=l||{},I=ue.useIntl(),z={};t.length&&t.forEach(A=>{const L=A.id||A.name;L&&(z[L]=A.value||"")});const[w,F]=y.useReducer(zm,{isSubmitting:!1,formSubmitted:!1,errors:{},values:z}),{errors:j,isSubmitting:M,formSubmitted:V,values:G}=w;y.useEffect(()=>{T&&V&&(hi=setTimeout(()=>{F({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[V]),y.useEffect(()=>()=>{hi&&clearTimeout(hi)},[]),y.useEffect(()=>{const A=L=>{F({type:"updateValue",payload:{key:L.detail.id,value:L.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",A),()=>{document.removeEventListener("dropdownMultiSelectSubmit",A)}},[]);const J=y.useRef(null),ae=a||J;if(!t.length)return null;let C=B.text;C||(C=s.children||I.formatMessage({id:"form_submit"})),delete B.text;const R=()=>{if(!M){if(F({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&F({type:"submitForm",payload:{fields:t,dispatch:F,intl:I}});return}F({type:"submitForm",payload:{fields:t,dispatch:F,onSuccess:async A=>{try{await h(A),F({type:T?"formSubmittedAndReset":"formSubmitted"})}catch(L){m(L),F({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(A,L)=>{g(A,L),F({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:I}})}},_=[{...B,icon:V?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:A=>{var U;if(A.preventDefault(),A.stopPropagation(),M)return;let L=0;if((U=ae==null?void 0:ae.current)!=null&&U.id){const re=document.getElementById(ae.current.id);re&&(L=re.getBoundingClientRect().top+window.scrollY)}const $=document.getElementById("header");$&&(L=L-$.offsetHeight-x),L<0&&(L=0),window.scrollTo({top:L,behavior:"smooth"}),R()},disabled:M||V||s.disabled,"data-gtm-event-context":c.context,"data-gtm-event-type":c.event,children:E?C:M||V?I.formatMessage({id:`form_${M?"submitting":"submitted"}`}):C}];return k&&_.unshift({...o,className:"gtm-trackable","data-gtm-event-context":c.context,"data-gtm-event-type":c.event,disabled:M||V,onClick:p,children:o.text||I.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[y.createElement(e,{...f,id:r,className:Y("form",n),ref:ae},d.jsxs(d.Fragment,{children:[j!=null&&j.general?d.jsx(un,{variant:"error",text:I.formatMessage({id:"form_error_generalError"})}):null,u,(!S||!M&&!V||D)&&t.map((A,L)=>{const{id:$=A.name||L,component:U,functions:re={onChange:()=>{}},submitOnEnter:te=!1}=A;if(U)return d.jsx(U,{...A.props||{}},`component-${$}-${L}`);const ne=(G==null?void 0:G[$])||"",le={...re,onChange:Q=>{F({type:"updateValue",payload:{key:$,value:Q}}),re.onChange(Q&&Q.toString(),F)}};return te&&(le.onKeyDown=Q=>{Q.key==="Enter"&&(Q.stopPropagation(),Q.preventDefault(),R()),re.onKeyDown&&re.onKeyDown(Q)}),d.jsx(Lm,{intlPath:i,...A,showRequiredLabels:q,value:ne,error:j==null?void 0:j[$],functions:le},$)}),v?null:(M||V)&&D?D:d.jsx(rr,{className:Y("cta",{center:M||V,submitted:V}),buttons:_})]})),N&&V&&d.jsx(Fr,{className:"success",children:typeof N=="string"?N:I.formatMessage({id:"form_success"})})]})};const Yr="passwordRules_",ld="isMoreThanEightCharacters",cd="includesNumberAndSymbol",dd="includesLowerAndUppercase",qm={[ld]:"8Characters",[cd]:"numberSymbol",[dd]:"lowercaseUppercase"},Wm=({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:`${Yr}intro`})}),d.jsx("ul",{children:[ld,cd,dd].map(r=>d.jsxs("li",{className:Y({matches:e[r]}),children:[d.jsxs(Ie,{children:[n.formatMessage({id:`${Yr}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${Yr}rule_${qm[r]}`})}),!e[r]&&d.jsxs(Ie,{element:"strong",children:[" ",n.formatMessage({id:`${Yr}notMet`})]})]},`rule-${r}`))})]})},fd=y.memo(Wm);const Hm=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ue.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const v=await n();u(E=>({...E,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(E=>({...E,setUp:!0,disabled:!0})),a(v)}};if(y.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(kt,{className:"rating-placeholder"});const{id:h,rating:p,disabled:m}=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 v=>{if(!(!h||m))try{u(E=>({...E,rating:v,disabled:!0})),await r({id:h,value:v})}catch(E){u(B=>({...B,rating:null})),a(E)}finally{u(E=>({...E,disabled:!1}))}};return d.jsxs("div",{className:Y("rating",i),children:[d.jsx("span",{className:"label",children:f[p?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const E=v+1;return d.jsx("li",{className:Y({selected:p&&E<=p}),children:d.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:`star${!p||E>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:E,total:t})}${E===1||E===t?` - ${f[E===1?"low":"high"]}`:""}`,onClick:B=>{B.preventDefault(),B.stopPropagation(),D(E)},disabled:m})},`rating-${E}`)})})]})};function Um(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 hs(e,t){return Array(t+1).join(e)}function Vm(e){return e.replace(/^\n*/,"")}function Km(e){for(var t=e.length;t>0&&e[t-1]===`
40
+ `;)t--;return e.substring(0,t)}var Zm=["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 Qs(e){return Js(e,Zm)}var hd=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function md(e){return Js(e,hd)}function Ym(e){return gd(e,hd)}var pd=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function Gm(e){return Js(e,pd)}function Qm(e){return gd(e,pd)}function Js(e,t){return t.indexOf(e.nodeName)>=0}function gd(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var rt={};rt.paragraph={filter:"p",replacement:function(e){return`
41
41
 
42
42
  `+e+`
43
43
 
44
44
  `}};rt.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+`
45
- `}};rt.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var a=ps(r===1?"=":"-",e.length);return`
45
+ `}};rt.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var a=hs(r===1?"=":"-",e.length);return`
46
46
 
47
47
  `+e+`
48
48
  `+a+`
49
49
 
50
50
  `}else return`
51
51
 
52
- `+ps("#",r)+" "+e+`
52
+ `+hs("#",r)+" "+e+`
53
53
 
54
54
  `}};rt.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
55
55
 
@@ -68,23 +68,23 @@ ${dr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",
68
68
  `+t.firstChild.textContent.replace(/\n/g,`
69
69
  `)+`
70
70
 
71
- `}};rt.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",a=(r.match(/language-(\S+)/)||[null,""])[1],i=t.firstChild.textContent,s=n.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(i);)u[0].length>=o&&(o=u[0].length+1);var d=ps(s,o);return`
71
+ `}};rt.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",a=(r.match(/language-(\S+)/)||[null,""])[1],i=t.firstChild.textContent,s=n.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(i);)u[0].length>=o&&(o=u[0].length+1);var c=hs(s,o);return`
72
72
 
73
- `+d+a+`
73
+ `+c+a+`
74
74
  `+i.replace(/\n$/,"")+`
75
- `+d+`
75
+ `+c+`
76
76
 
77
77
  `}};rt.horizontalRule={filter:"hr",replacement:function(e,t,n){return`
78
78
 
79
79
  `+n.hr+`
80
80
 
81
- `}};rt.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var n=t.getAttribute("href"),r=ka(t.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+n+r+")"}};rt.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,n){var r=t.getAttribute("href"),a=ka(t.getAttribute("title"));a&&(a=' "'+a+'"');var i,s;switch(n.linkReferenceStyle){case"collapsed":i="["+e+"][]",s="["+e+"]: "+r+a;break;case"shortcut":i="["+e+"]",s="["+e+"]: "+r+a;break;default:var o=this.references.length+1;i="["+e+"]["+o+"]",s="["+o+"]: "+r+a}return this.references.push(s),i},references:[],append:function(e){var t="";return this.references.length&&(t=`
81
+ `}};rt.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var n=t.getAttribute("href"),r=wa(t.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+n+r+")"}};rt.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,n){var r=t.getAttribute("href"),a=wa(t.getAttribute("title"));a&&(a=' "'+a+'"');var i,s;switch(n.linkReferenceStyle){case"collapsed":i="["+e+"][]",s="["+e+"]: "+r+a;break;case"shortcut":i="["+e+"]",s="["+e+"]: "+r+a;break;default:var o=this.references.length+1;i="["+e+"]["+o+"]",s="["+o+"]: "+r+a}return this.references.push(s),i},references:[],append:function(e){var t="";return this.references.length&&(t=`
82
82
 
83
83
  `+this.references.join(`
84
84
  `)+`
85
85
 
86
- `,this.references=[]),t}};rt.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};rt.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};rt.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",r=e.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+t+e+t+n}};rt.image={filter:"img",replacement:function(e,t){var n=ka(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=ka(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"!["+n+"]("+r+i+")":""}};function ka(e){return e?e.replace(/(\n+\s*)+/g,`
87
- `):""}function yd(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}yd.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=gi(this.array,e,this.options))||(t=gi(this._keep,e,this.options))||(t=gi(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function gi(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(ep(a,t,n))return a}}function ep(e,t,n){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function tp(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(f){return f.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=eu(o,t,a);l!==t;){if(l.nodeType===3||l.nodeType===4){var u=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!s&&u[0]===" "&&(u=u.substr(1)),!u){l=vi(l);continue}l.data=u,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,s=!1):r(l)||a(l)?(i=null,s=!0):i&&(s=!1);else{l=vi(l);continue}var d=eu(o,l,a);o=l,l=d}i&&(i.data=i.data.replace(/ $/,""),i.data||vi(i))}}function vi(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function eu(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var to=typeof window<"u"?window:{};function np(){var e=to.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function rp(){var e=function(){};return ap()?e.prototype.parseFromString=function(t){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(t),n.close(),n}:e.prototype.parseFromString=function(t){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(t),n.close(),n},e}function ap(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{to.ActiveXObject&&(e=!0)}return e}var ip=np()?to.DOMParser:rp();function sp(e,t){var n;if(typeof e=="string"){var r=op().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return tp({element:n,isBlock:Xs,isVoid:gd,isPre:t.preformattedCode?up:null}),n}var bi;function op(){return bi=bi||new ip,bi}function up(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function lp(e,t){return e.isBlock=Xs(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=cp(e),e.flankingWhitespace=dp(e,t),e}function cp(e){return!gd(e)&&!Jm(e)&&/^\s*$/i.test(e.textContent)&&!Qm(e)&&!Xm(e)}function dp(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=fp(e.textContent);return n.leadingAscii&&tu("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&tu("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function fp(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function tu(e,t,n){var r,a,i;return e==="left"?(r=t.previousSibling,a=/ $/):(r=t.nextSibling,a=/^ /),r&&(r.nodeType===3?i=a.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!Xs(r)&&(i=a.test(r.textContent))),i}var hp=Array.prototype.reduce,mp=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Ar(e){if(!(this instanceof Ar))return new Ar(e);var t={rules:rt,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
86
+ `,this.references=[]),t}};rt.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};rt.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};rt.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",r=e.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+t+e+t+n}};rt.image={filter:"img",replacement:function(e,t){var n=wa(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=wa(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"!["+n+"]("+r+i+")":""}};function wa(e){return e?e.replace(/(\n+\s*)+/g,`
87
+ `):""}function vd(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}vd.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=mi(this.array,e,this.options))||(t=mi(this._keep,e,this.options))||(t=mi(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function mi(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(Jm(a,t,n))return a}}function Jm(e,t,n){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function Xm(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(h){return h.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=Jo(o,t,a);l!==t;){if(l.nodeType===3||l.nodeType===4){var u=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!s&&u[0]===" "&&(u=u.substr(1)),!u){l=pi(l);continue}l.data=u,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,s=!1):r(l)||a(l)?(i=null,s=!0):i&&(s=!1);else{l=pi(l);continue}var c=Jo(o,l,a);o=l,l=c}i&&(i.data=i.data.replace(/ $/,""),i.data||pi(i))}}function pi(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Jo(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var Xs=typeof window<"u"?window:{};function ep(){var e=Xs.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function tp(){var e=function(){};return np()?e.prototype.parseFromString=function(t){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(t),n.close(),n}:e.prototype.parseFromString=function(t){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(t),n.close(),n},e}function np(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{Xs.ActiveXObject&&(e=!0)}return e}var rp=ep()?Xs.DOMParser:tp();function ap(e,t){var n;if(typeof e=="string"){var r=ip().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return Xm({element:n,isBlock:Qs,isVoid:md,isPre:t.preformattedCode?sp:null}),n}var gi;function ip(){return gi=gi||new rp,gi}function sp(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function op(e,t){return e.isBlock=Qs(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=up(e),e.flankingWhitespace=lp(e,t),e}function up(e){return!md(e)&&!Gm(e)&&/^\s*$/i.test(e.textContent)&&!Ym(e)&&!Qm(e)}function lp(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=cp(e.textContent);return n.leadingAscii&&Xo("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Xo("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function cp(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function Xo(e,t,n){var r,a,i;return e==="left"?(r=t.previousSibling,a=/ $/):(r=t.nextSibling,a=/^ /),r&&(r.nodeType===3?i=a.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!Qs(r)&&(i=a.test(r.textContent))),i}var dp=Array.prototype.reduce,fp=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Ar(e){if(!(this instanceof Ar))return new Ar(e);var t={rules:rt,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
88
88
 
89
89
  `:""},keepReplacement:function(n,r){return r.isBlock?`
90
90
 
@@ -94,27 +94,27 @@ ${dr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",
94
94
 
95
95
  `+n+`
96
96
 
97
- `:n}};this.options=Km({},t,e),this.rules=new yd(this.options)}Ar.prototype={turndown:function(e){if(!vp(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=Dd.call(this,new sp(e,this.options));return pp.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e=="function")e(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return mp.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function Dd(e){var t=this;return hp.call(e.childNodes,function(n,r){r=new lp(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=gp.call(t,r)),Cd(n,a)},"")}function pp(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=Cd(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function gp(e){var t=this.rules.forNode(e),n=Dd.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function Cd(e,t){var n=Ym(e),r=Zm(t),a=Math.max(e.length-n.length,t.length-r.length),i=`
97
+ `:n}};this.options=Um({},t,e),this.rules=new vd(this.options)}Ar.prototype={turndown:function(e){if(!pp(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=bd.call(this,new ap(e,this.options));return hp.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e=="function")e(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return fp.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function bd(e){var t=this;return dp.call(e.childNodes,function(n,r){r=new op(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=mp.call(t,r)),yd(n,a)},"")}function hp(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=yd(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function mp(e){var t=this.rules.forNode(e),n=bd.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function yd(e,t){var n=Km(e),r=Vm(t),a=Math.max(e.length-n.length,t.length-r.length),i=`
98
98
 
99
- `.substring(0,a);return n+i+r}function vp(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}/*!
99
+ `.substring(0,a);return n+i+r}function pp(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}/*!
100
100
  * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
101
101
  *
102
102
  * Copyright (c) 2014-2017, Jon Schlinkert.
103
103
  * Released under the MIT License.
104
- */function nu(e){return Object.prototype.toString.call(e)==="[object Object]"}function tt(e){var t,n;return nu(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(nu(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var xd=Symbol.for("immer-nothing"),ru=Symbol.for("immer-draftable"),vt=Symbol.for("immer-state"),bp=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=bp[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 Qn=Object.getPrototypeOf;function En(e){return!!e&&!!e[vt]}function kn(e){var t;return e?wd(e)||Array.isArray(e)||!!e[ru]||!!((t=e.constructor)!=null&&t[ru])||Xa(e)||ei(e):!1}var yp=Object.prototype.constructor.toString();function wd(e){if(!e||typeof e!="object")return!1;const t=Qn(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)===yp}function _a(e,t){Ja(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Ja(e){const t=e[vt];return t?t.type_:Array.isArray(e)?1:Xa(e)?2:ei(e)?3:0}function gs(e,t){return Ja(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ed(e,t,n){const r=Ja(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Dp(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Xa(e){return e instanceof Map}function ei(e){return e instanceof Set}function hn(e){return e.copy_||e.base_}function vs(e,t){if(Xa(e))return new Map(e);if(ei(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&wd(e))return Qn(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[vt];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(Qn(e),n)}function no(e,t=!1){return ti(e)||En(e)||!kn(e)||(Ja(e)>1&&(e.set=e.add=e.clear=e.delete=Cp),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>no(r,!0))),e}function Cp(){dt(2)}function ti(e){return Object.isFrozen(e)}var xp={};function _n(e){const t=xp[e];return t||dt(0,e),t}var Tr;function kd(){return Tr}function wp(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function au(e,t){t&&(_n("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function bs(e){ys(e),e.drafts_.forEach(Ep),e.drafts_=null}function ys(e){e===Tr&&(Tr=e.parent_)}function iu(e){return Tr=wp(Tr,e)}function Ep(e){const t=e[vt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function su(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[vt].modified_&&(bs(t),dt(4)),kn(e)&&(e=Ba(t,e),t.parent_||Fa(t,e)),t.patches_&&_n("Patches").generateReplacementPatches_(n[vt].base_,e,t.patches_,t.inversePatches_)):e=Ba(t,n,[]),bs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==xd?e:void 0}function Ba(e,t,n){if(ti(t))return t;const r=t[vt];if(!r)return _a(t,(a,i)=>ou(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Fa(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),_a(i,(o,l)=>ou(e,r,a,o,l,n,s)),Fa(e,a,!1),n&&e.patches_&&_n("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function ou(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&dt(5),En(a)){const o=i&&t&&t.type_!==3&&!gs(t.assigned_,r)?i.concat(r):void 0,l=Ba(e,a,o);if(Ed(n,r,l),En(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(kn(a)&&!ti(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ba(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Fa(e,a)}}function Fa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&no(t,n)}function kp(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:kd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=ro;n&&(a=[r],i=Sr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var ro={get(e,t){if(t===vt)return e;const n=hn(e);if(!gs(n,t))return _p(e,n,t);const r=n[t];return e.finalized_||!kn(r)?r:r===yi(e.base_,t)?(Di(e),e.copy_[t]=Cs(r,e)):r},has(e,t){return t in hn(e)},ownKeys(e){return Reflect.ownKeys(hn(e))},set(e,t,n){const r=_d(hn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=yi(hn(e),t),i=a==null?void 0:a[vt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Dp(n,a)&&(n!==void 0||gs(e.base_,t)))return!0;Di(e),Ds(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 yi(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Di(e),Ds(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=hn(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 Qn(e.base_)},setPrototypeOf(){dt(12)}},Sr={};_a(ro,(e,t)=>{Sr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Sr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&dt(13),Sr.set.call(this,e,t,void 0)};Sr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&dt(14),ro.set.call(this,e[0],t,n,e[0])};function yi(e,t){const n=e[vt];return(n?hn(n):e)[t]}function _p(e,t,n){var a;const r=_d(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function _d(e,t){if(!(t in e))return;let n=Qn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Qn(n)}}function Ds(e){e.modified_||(e.modified_=!0,e.parent_&&Ds(e.parent_))}function Di(e){e.copy_||(e.copy_=vs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Bp=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,d=>n.call(this,d,...u))}}typeof n!="function"&&dt(6),r!==void 0&&typeof r!="function"&&dt(7);let a;if(kn(t)){const i=iu(this),s=Cs(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?bs(i):ys(i)}return au(i,r),su(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===xd&&(a=void 0),this.autoFreeze_&&no(a,!0),r){const i=[],s=[];_n("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){kn(e)||dt(8),En(e)&&(e=Fp(e));const t=iu(this),n=Cs(e,void 0);return n[vt].isManual_=!0,ys(t),n}finishDraft(e,t){const n=e&&e[vt];(!n||!n.isManual_)&&dt(9);const{scope_:r}=n;return au(r,t),su(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=_n("Patches").applyPatches_;return En(e)?r(e,t):this.produce(e,a=>r(a,t))}};function Cs(e,t){const n=Xa(e)?_n("MapSet").proxyMap_(e,t):ei(e)?_n("MapSet").proxySet_(e,t):kp(e,t);return(t?t.scope_:kd()).drafts_.push(n),n}function Fp(e){return En(e)||dt(10,e),Bd(e)}function Bd(e){if(!kn(e)||ti(e))return e;const t=e[vt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=vs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=vs(e,!0);return _a(n,(r,a)=>{Ed(n,r,Bd(a))}),t&&(t.finalized_=!1),n}var bt=new Bp,ao=bt.produce;bt.produceWithPatches.bind(bt);bt.setAutoFreeze.bind(bt);bt.setUseStrictShallowCopy.bind(bt);bt.applyPatches.bind(bt);var uu=bt.createDraft.bind(bt),lu=bt.finishDraft.bind(bt),Ap={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=P.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Tp={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()}}},Sp={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=K.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Aa=new WeakMap,Ta=new WeakMap,yr=new WeakMap,Fd=new WeakMap,cu=new WeakMap,du=new WeakMap,fu=new WeakMap,P={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=P.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 P.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return P.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 P.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 P.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&P.compare(e,t)===0},isBefore(e,t){return P.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&P.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&P.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&P.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&P.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&&P.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(!P.isAncestor(t,e)&&!P.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;(P.equals(i,r)||P.endsBefore(i,r)||P.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(P.equals(s,r)||P.isAncestor(s,r))return null;P.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;P.equals(o,r)||P.endsBefore(o,r)?r[o.length-1]-=1:P.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:d}=t;if(P.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else P.endsBefore(u,r)?r[u.length-1]+=1:P.isAncestor(u,r)&&e[u.length]>=d&&(r[u.length-1]+=1,r[u.length]-=d);break}case"move_node":{var{path:f,newPath:p}=t;if(P.equals(f,p))return r;if(P.isAncestor(f,r)||P.equals(f,r)){var m=p.slice();return P.endsBefore(f,p)&&f.length<p.length&&(m[f.length-1]-=1),m.concat(r.slice(f.length))}else P.isSibling(f,p)&&(P.isAncestor(p,r)||P.equals(p,r))?P.endsBefore(f,r)?r[f.length-1]-=1:r[f.length-1]+=1:P.endsBefore(p,r)||P.equals(p,r)||P.isAncestor(p,r)?(P.endsBefore(f,r)&&(r[f.length-1]-=1),r[p.length-1]+=1):P.endsBefore(f,r)&&(P.equals(p,r)&&(r[p.length-1]+=1),r[f.length-1]-=1);break}}return r}};function jr(e){"@babel/helpers - typeof";return jr=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},jr(e)}function jp(e,t){if(jr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(jr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Op(e){var t=jp(e,"string");return jr(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 hu(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 fr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Pp=(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 K.points(t))t[l]=Ee.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:f}=n;if(f.length===0)break;var p=oe.leaf(e,u),m=p.text.slice(0,d),g=p.text.slice(d);if(p.text=m+f+g,t)for(var[h,y]of K.points(t))t[y]=Ee.transform(h,n);break}case"merge_node":{var{path:v}=n,w=oe.get(e,v),_=P.previous(v),x=oe.get(e,_),k=oe.parent(e,v),T=v[v.length-1];if(fe.isText(w)&&fe.isText(x))x.text+=w.text;else if(!fe.isText(w)&&!fe.isText(x))x.children.push(...w.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(Xe.stringify(w)," ").concat(Xe.stringify(x)));if(k.children.splice(T,1),t)for(var[S,q]of K.points(t))t[q]=Ee.transform(S,n);break}case"move_node":{var{path:N,newPath:I}=n;if(P.isAncestor(N,I))throw new Error("Cannot move a path [".concat(N,"] to new path [").concat(I,"] because the destination is inside itself."));var z=oe.get(e,N),E=oe.parent(e,N),F=N[N.length-1];E.children.splice(F,1);var j=P.transform(N,n),M=oe.get(e,P.parent(j)),V=j[j.length-1];if(M.children.splice(V,0,z),t)for(var[G,J]of K.points(t))t[J]=Ee.transform(G,n);break}case"remove_node":{var{path:ae}=n,C=ae[ae.length-1],R=oe.parent(e,ae);if(R.children.splice(C,1),t)for(var[W,B]of K.points(t)){var A=Ee.transform(W,n);if(t!=null&&A!=null)t[B]=A;else{var L=void 0,$=void 0;for(var[U,re]of oe.texts(e))if(P.compare(re,ae)===-1)L=[U,re];else{$=[U,re];break}var te=!1;L&&$&&(P.equals($[1],ae)?te=!P.hasPrevious($[1]):te=P.common(L[1],ae).length<P.common($[1],ae).length),L&&!te?(W.path=L[1],W.offset=L[0].text.length):$?(W.path=$[1],W.offset=0):t=null}}break}case"remove_text":{var{path:ne,offset:le,text:Q}=n;if(Q.length===0)break;var pe=oe.leaf(e,ne),he=pe.text.slice(0,le),ye=pe.text.slice(le+Q.length);if(pe.text=he+ye,t)for(var[Fe,Ae]of K.points(t))t[Ae]=Ee.transform(Fe,n);break}case"set_node":{var{path:He,properties:Se,newProperties:Te}=n;if(He.length===0)throw new Error("Cannot set properties on the root node!");var Ne=oe.get(e,He);for(var ke in Te){if(ke==="children"||ke==="text")throw new Error('Cannot set the "'.concat(ke,'" property of nodes!'));var Ue=Te[ke];Ue==null?delete Ne[ke]:Ne[ke]=Ue}for(var ge in Se)Te.hasOwnProperty(ge)||delete Ne[ge];break}case"set_selection":{var{newProperties:H}=n;if(H==null)t=H;else{if(t==null){if(!K.isRange(H))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Xe.stringify(H)," when there is no current selection."));t=fr({},H)}for(var ie in H){var me=H[ie];if(me==null){if(ie==="anchor"||ie==="focus")throw new Error('Cannot remove the "'.concat(ie,'" selection property'));delete t[ie]}else t[ie]=me}}break}case"split_node":{var{path:ve,position:we,properties:Ke}=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 Qe=oe.get(e,ve),mt=oe.parent(e,ve),zt=ve[ve.length-1],_t;if(fe.isText(Qe)){var et=Qe.text.slice(0,we),Tt=Qe.text.slice(we);Qe.text=et,_t=fr(fr({},Ke),{},{text:Tt})}else{var pt=Qe.children.slice(0,we),oi=Qe.children.slice(we);Qe.children=pt,_t=fr(fr({},Ke),{},{children:oi})}if(mt.children.splice(zt+1,0,_t),t)for(var[or,Wr]of K.points(t))t[Wr]=Ee.transform(or,n);break}}return t},Np={transform(e,t){e.children=uu(e.children);var n=e.selection&&uu(e.selection);try{n=Pp(e,n,t)}finally{e.children=lu(e.children),n?e.selection=En(n)?lu(n):n:e.selection=null}}},Rp={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)}},Mp={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)}},Ad=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(tt(r)&&tt(a)){if(!Ad(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 Ip(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 Zt(e,t){if(e==null)return{};var n=Ip(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 $p=["anchor","focus"];function mu(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 Lp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?mu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var K={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return K.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=K.edges(e);return t},equals(e,t){return Ee.equals(e.anchor,t.anchor)&&Ee.equals(e.focus,t.focus)},includes(e,t){if(K.isRange(t)){if(K.includes(e,t.anchor)||K.includes(e,t.focus))return!0;var[n,r]=K.edges(e),[a,i]=K.edges(t);return Ee.isBefore(n,a)&&Ee.isAfter(r,i)}var[s,o]=K.edges(e),l=!1,u=!1;return Ee.isPoint(t)?(l=Ee.compare(t,s)>=0,u=Ee.compare(t,o)<=0):(l=P.compare(t,s.path)>=0,u=P.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=Zt(e,$p),[r,a]=K.edges(e),[i,s]=K.edges(t),o=Ee.isBefore(r,i)?i:r,l=Ee.isBefore(a,s)?a:s;return Ee.isBefore(l,o)?null:Lp({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!K.isCollapsed(e)},isForward(e){return!K.isBackward(e)},isRange(e){return tt(e)&&Ee.isPoint(e.anchor)&&Ee.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=K.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return ao(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=K.isCollapsed(r);K.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?K.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})}},pu=e=>tt(e)&&oe.isNodeList(e.children)&&!b.isEditor(e),de={isAncestor(e){return tt(e)&&oe.isNodeList(e.children)},isElement:pu,isElementList(e){return Array.isArray(e)&&e.every(t=>de.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 pu(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},zp=["children"],qp=["text"],gu=new WeakMap,oe={ancestor(e,t){var n=oe.get(e,t);if(fe.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(Xe.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.ancestors(t,n)){var a=oe.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(fe.isText(e))throw new Error("Cannot get the child of a text node: ".concat(Xe.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Xe.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=P.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(Xe.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))de.isElement(n)&&(yield[n,r])}()},extractProps(e){if(de.isAncestor(e)){var t=Zt(e,zp);return t}else{var t=Zt(e,qp);return t}},first(e,t){for(var n=t.slice(),r=oe.get(e,n);r&&!(fe.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(fe.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(Xe.stringify(e)));var n=ao({children:e.children},r=>{var[a,i]=K.edges(t),s=oe.nodes(r,{reverse:!0,pass:p=>{var[,m]=p;return!K.includes(t,m)}});for(var[,o]of s){if(!K.includes(t,o)){var l=oe.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(P.equals(o,i.path)){var d=oe.leaf(r,o);d.text=d.text.slice(0,i.offset)}if(P.equals(o,a.path)){var f=oe.leaf(r,o);f.text=f.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(fe.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Xe.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(fe.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return fe.isText(e)||de.isElement(e)||b.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=gu.get(e);if(t!==void 0)return t;var n=e.every(r=>oe.isNode(r));return gu.set(e,n),n},last(e,t){for(var n=t.slice(),r=oe.get(e,n);r&&!(fe.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(!fe.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(Xe.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.levels(t,n)){var a=oe.get(e,r);yield[a,r]}}()},matches(e,t){return de.isElement(e)&&de.isElementProps(t)&&de.matches(e,t)||fe.isText(e)&&fe.isTextProps(t)&&fe.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?P.isBefore(o,i):P.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!fe.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;P.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 d=P.next(o);if(oe.has(e,d)){o=d,l=oe.get(e,o);continue}}if(r&&o[o.length-1]!==0){var f=P.previous(o);o=f,l=oe.get(e,o);continue}o=P.parent(o),l=oe.get(e,o),s.add(l)}}()},parent(e,t){var n=P.parent(t),r=oe.get(e,n);if(fe.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 fe.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))fe.isText(n)&&(yield[n,r])}()}};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 qe(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 rn={isNodeOperation(e){return rn.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!tt(e))return!1;switch(e.type){case"insert_node":return P.isPath(e.path)&&oe.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"merge_node":return typeof e.position=="number"&&P.isPath(e.path)&&tt(e.properties);case"move_node":return P.isPath(e.path)&&P.isPath(e.newPath);case"remove_node":return P.isPath(e.path)&&oe.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"set_node":return P.isPath(e.path)&&tt(e.properties)&&tt(e.newProperties);case"set_selection":return e.properties===null&&K.isRange(e.newProperties)||e.newProperties===null&&K.isRange(e.properties)||tt(e.properties)&&tt(e.newProperties);case"split_node":return P.isPath(e.path)&&typeof e.position=="number"&&tt(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>rn.isOperation(t))},isSelectionOperation(e){return rn.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return rn.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return qe(qe({},e),{},{type:"remove_node"});case"insert_text":return qe(qe({},e),{},{type:"remove_text"});case"merge_node":return qe(qe({},e),{},{type:"split_node",path:P.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(P.equals(t,n))return e;if(P.isSibling(n,t))return qe(qe({},e),{},{path:t,newPath:n});var r=P.transform(n,e),a=P.transform(P.next(n),e);return qe(qe({},e),{},{path:r,newPath:a})}case"remove_node":return qe(qe({},e),{},{type:"insert_node"});case"remove_text":return qe(qe({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return qe(qe({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?qe(qe({},e),{},{properties:l,newProperties:null}):l==null?qe(qe({},e),{},{properties:null,newProperties:o}):qe(qe({},e),{},{properties:l,newProperties:o})}case"split_node":return qe(qe({},e),{},{type:"merge_node",path:P.next(e.path)})}}},bu=new WeakMap,Wp=e=>{var t=bu.get(e);if(t!==void 0)return t;if(!tt(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||tt(e.marks))&&(e.selection===null||K.isRange(e.selection))&&oe.isNodeList(e.children)&&rn.isOperationList(e.operations);return bu.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 Wp(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)}},Hp={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(P.isPath)}};function yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Du(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ee={compare(e,t){var n=P.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&&P.equals(e.path,t.path)},isPoint(e){return tt(e)&&typeof e.offset=="number"&&P.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return ao(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=P.transform(i,t,n);break}case"insert_text":{P.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{P.equals(t.path,i)&&(r.offset+=t.position),r.path=P.transform(i,t,n);break}case"remove_text":{P.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(P.equals(t.path,i)||P.isAncestor(t.path,i))return null;r.path=P.transform(i,t,n);break}case"split_node":{if(P.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=P.transform(i,t,Du(Du({},n),{},{affinity:"forward"})))}else r.path=P.transform(i,t,n);break}}})}},Cu=void 0,Xe={setScrubber(e){Cu=e},stringify(e){return JSON.stringify(e,Cu)}},Up=["text"],Vp=["anchor","focus"];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 Wt(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 fe={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Zt(i,Up);return s}return Ad(r?a(e):e,r?a(t):t)},isText(e){return tt(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>fe.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=[Wt({},e)];for(var r of t){var a=Zt(r,Vp),[i,s]=K.edges(r),o=[],l=0,u=i.offset,d=s.offset;for(var f of n){var{length:p}=f.text,m=l;if(l+=p,u<=m&&l<=d){Object.assign(f,a),o.push(f);continue}if(u!==d&&(u===l||d===m)||u>l||d<m||d===m&&m!==0){o.push(f);continue}var g=f,h=void 0,y=void 0;if(d<l){var v=d-m;y=Wt(Wt({},g),{},{text:g.text.slice(v)}),g=Wt(Wt({},g),{},{text:g.text.slice(0,v)})}if(u>m){var w=u-m;h=Wt(Wt({},g),{},{text:g.text.slice(0,w)}),g=Wt(Wt({},g),{},{text:g.text.slice(w)})}Object.assign(g,a),h&&o.push(h),o.push(g),y&&o.push(y)}n=o}return n}},io=e=>e.selection?e.selection:e.children.length>0?b.end(e,[]):[0],sr=(e,t)=>{var[n]=b.node(e,t);return r=>r===n},so=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?Jp(t):t,i=xe.None,s=xe.None,o=0,l=null,u=null;for(var d of a){var f=d.codePointAt(0);if(!f)break;var p=cg(d,f);if([i,s]=r?[s,p]:[p,i],qn(i,xe.ZWJ)&&qn(s,xe.ExtPict)&&(r?l=wu(t.substring(0,o)):l=wu(t.substring(0,t.length-o)),!l)||qn(i,xe.RI)&&qn(s,xe.RI)&&(u!==null?u=!u:r?u=!0:u=pg(t.substring(0,t.length-o)),!u)||i!==xe.None&&s!==xe.None&&fg(i,s))break;o+=d.length}return o||1},Kp=/\s/,Zp=/[\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]/,Yp=/['\u2018\u2019]/,Gp=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=so(t,n),[s,o]=oo(t,i,n);if(Qp(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},oo=(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)]},Qp=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(Kp.test(t))return!1;if(Yp.test(t)){var a=so(n,r),[i,s]=oo(n,a,r);if(e(i,s,r))return!0}return!Zp.test(t)},Jp=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(eg(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(Xp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},Xp=e=>e>=55296&&e<=56319,eg=e=>e>=56320&&e<=57343,xe;(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"})(xe||(xe={}));var tg=/^(?:[\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])$/,ng=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,rg=/^(?:[\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])$/,ag=/^[\u1100-\u115F\uA960-\uA97C]$/,ig=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,sg=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,og=/^[\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]$/,ug=/^[\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]$/,lg=/^(?:[\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])$/,cg=(e,t)=>{var n=xe.Any;return e.search(tg)!==-1&&(n|=xe.Extend),t===8205&&(n|=xe.ZWJ),t>=127462&&t<=127487&&(n|=xe.RI),e.search(ng)!==-1&&(n|=xe.Prepend),e.search(rg)!==-1&&(n|=xe.SpacingMark),e.search(ag)!==-1&&(n|=xe.L),e.search(ig)!==-1&&(n|=xe.V),e.search(sg)!==-1&&(n|=xe.T),e.search(og)!==-1&&(n|=xe.LV),e.search(ug)!==-1&&(n|=xe.LVT),e.search(lg)!==-1&&(n|=xe.ExtPict),n};function qn(e,t){return(e&t)!==0}var dg=[[xe.L,xe.L|xe.V|xe.LV|xe.LVT],[xe.LV|xe.V,xe.V|xe.T],[xe.LVT|xe.T,xe.T],[xe.Any,xe.Extend|xe.ZWJ],[xe.Any,xe.SpacingMark],[xe.Prepend,xe.Any],[xe.ZWJ,xe.ExtPict],[xe.RI,xe.RI]];function fg(e,t){return dg.findIndex(n=>qn(e,n[0])&&qn(t,n[1]))===-1}var hg=/(?:[\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$/,wu=e=>e.search(hg)!==-1,mg=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,pg=e=>{var t=e.match(mg);if(t===null)return!1;var n=t[0].length/2;return n%2===1},gg={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=io(e)}=n;if(P.isPath(a)&&(a=b.range(e,a)),K.isRange(a))if(K.isCollapsed(a))a=a.anchor;else{var i=K.end(a);if(!r&&b.void(e,{at:i}))return;var s=K.start(a),o=b.pointRef(e,s),l=b.pointRef(e,i);X.delete(e,{at:a,voids:r});var u=o.unref(),d=l.unref();a=u||d,X.setSelection(e,{anchor:a,focus:a})}if(!(!r&&b.void(e,{at:a})||b.elementReadOnly(e,{at:a}))){var{path:f,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:f,offset:p,text: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 Qr(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 X=Qr(Qr(Qr(Qr({},Np),Rp),Mp),gg),ga=new WeakMap,vg=e=>ga.get(e)||!1,bg=(e,t,n)=>{var r=ga.get(e)||!1;ga.set(e,!0);try{t(),n()}finally{ga.set(e,r)}};function Td(e,t,n){var r=Aa.get(e)||[],a=Ta.get(e)||new Set,i,s,o=f=>{if(f){var p=f.join(",");s.has(p)||(s.add(p),i.push(f))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var d of t)o(d);Aa.set(e,i),Ta.set(e,s)}var yg=(e,t)=>{for(var n of b.pathRefs(e))Ap.transform(n,t);for(var r of b.pointRefs(e))Tp.transform(r,t);for(var a of b.rangeRefs(e))Sp.transform(a,t);if(!vg(e)){var i=P.operationCanTransformPath(t)?s=>P.transform(s,t):void 0;Td(e,e.getDirtyPaths(t),i)}X.transform(e,t),e.operations.push(t),b.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),yr.get(e)||(yr.set(e,!0),Promise.resolve().then(()=>{yr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Dg=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return P.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=P.levels(a),s=fe.isText(r)?[]:Array.from(oe.nodes(r),I=>{var[,z]=I;return a.concat(z)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=P.ancestors(o),u=P.previous(o);return[...l,u]}case"move_node":{var{path:d,newPath:f}=t;if(P.equals(d,f))return[];var p=[],m=[];for(var g of P.ancestors(d)){var h=P.transform(g,t);p.push(h)}for(var y of P.ancestors(f)){var v=P.transform(y,t);m.push(v)}var w=m[m.length-1],_=f[f.length-1],x=w.concat(_);return[...p,...m,x]}case"remove_node":{var{path:k}=t,T=P.ancestors(k);return[...T]}case"split_node":{var{path:S}=t,q=P.levels(S),N=P.next(S);return[...q,N]}default:return[]}},Cg=e=>{var{selection:t}=e;return t?oe.fragment(e,t):[]},xg=(e,t)=>{var[n,r]=t;if(!fe.isText(n)){if(de.isElement(n)&&n.children.length===0){var a={text:""};X.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=b.isEditor(n)?!1:de.isElement(n)&&(e.isInline(n)||n.children.length===0||fe.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(!fe.isText(l)){var u=l.children[s],d=l.children[s-1],f=o===n.children.length-1,p=fe.isText(u)||de.isElement(u)&&e.isInline(u);if(p!==i)X.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(de.isElement(u)){if(e.isInline(u)){if(d==null||!fe.isText(d)){var m={text:""};X.insertNodes(e,m,{at:r.concat(s),voids:!0}),s++}else if(f){var g={text:""};X.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&fe.isText(d)&&(fe.equals(u,d,{loose:!0})?(X.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(X.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(X.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},wg=(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},Eg=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,d]of b.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!fe.isText(u)){if(K.isRange(i)){if(P.isAncestor(d,i.anchor.path)&&P.isAncestor(d,i.focus.path))return[u,d]}else if(!P.equals(o,d))return[u,d]}}};function ku(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 _u(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ku(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ku(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var kg=(e,t,n)=>{var{selection:r}=e;if(r){var a=(f,p)=>{if(!fe.isText(f))return!1;var[m,g]=b.parent(e,p);return!e.isVoid(m)||e.markableVoid(m)},i=K.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)X.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var d=_u(_u({},b.marks(e)||{}),{},{[t]:n});e.marks=d,yr.get(e)||e.onChange()}}};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 Fu(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 _g=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 d of b.positions(t,Fu(Fu({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};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 Tu(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 Bg=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 d of b.positions(t,Tu(Tu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},Fg=(e,t)=>{var{selection:n}=e;n&&K.isCollapsed(n)&&X.delete(e,{unit:t,reverse:!0})},Ag=(e,t)=>{var{selection:n}=e;n&&K.isCollapsed(n)&&X.delete(e,{unit:t})},Tg=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&K.isExpanded(r)&&X.delete(t,{reverse:n==="backward"})},Sg=(e,t)=>[b.start(e,t),b.end(e,t)];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 ju(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 jg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,ju(ju({},n),{},{match:r=>de.isElement(r)&&b.isElementReadOnly(t,r)}))},Og=(e,t)=>b.point(e,t,{edge:"end"}),Pg=(e,t)=>{var n=b.path(e,t,{edge:"start"});return b.node(e,n)},Ng=(e,t)=>{var n=b.range(e,t);return oe.fragment(e,n)};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 Pu(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 Rg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,Pu(Pu({},n),{},{match:r=>de.isElement(r)&&b.isVoid(t,r)}))},Mg=(e,t)=>t.children.some(n=>de.isElement(n)&&b.isBlock(e,n)),Ig=(e,t)=>t.children.some(n=>fe.isText(n)||b.isInline(e,n)),$g=(e,t)=>oe.has(e,t),Lg=(e,t)=>t.children.every(n=>fe.isText(n)),zg=e=>{X.splitNodes(e,{always:!0})},qg=(e,t,n)=>{X.insertNodes(e,t,n)},Wg=e=>{X.splitNodes(e,{always:!0})};function Nu(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 Hg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ug=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=Hg({text:n},i);X.insertNodes(t,s,{at:r.at,voids:r.voids})}else X.insertText(t,n,r);t.marks=null}},Vg=(e,t)=>!e.isInline(t),Kg=(e,t,n)=>b.isStart(e,t,n)||b.isEnd(e,t,n),Zg=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&fe.isText(r)&&r.text===""&&!e.isVoid(t)},Yg=(e,t,n)=>{var r=b.end(e,n);return Ee.equals(t,r)},Gg=e=>{var t=Fd.get(e);return t===void 0?!0:t},Qg=(e,t,n)=>{if(t.offset!==0)return!1;var r=b.start(e,n);return Ee.equals(t,r)},Jg=(e,t)=>{var n=b.path(e,t,{edge:"end"});return b.node(e,n)},Xg=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 ev(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&&de.isElement(l)&&b.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var tv=["text"],nv=["text"],rv=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(K.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:fe.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,d=Zt(u,tv);return d}else return{}}var{path:f}=a,[p]=b.leaf(t,f);if(a.offset===0){var m=b.previous(t,{at:f,match:fe.isText}),g=b.above(t,{match:x=>de.isElement(x)&&b.isVoid(t,x)&&t.markableVoid(x)});if(!g){var h=b.above(t,{match:x=>de.isElement(x)&&b.isBlock(t,x)});if(m&&h){var[y,v]=m,[,w]=h;P.isAncestor(w,v)&&(p=y)}}}var _=Zt(p,nv);return _},av=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(P.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(P.isPath(s)){var[d]=b.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[f]=b.nodes(t,{at:u,match:i,mode:r,voids:a});return f}}},iv=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 sv(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,d;if(Hp.isSpan(n))u=n[0],d=n[1];else{var f=b.path(e,n,{edge:"start"}),p=b.path(e,n,{edge:"end"});u=i?p:f,d=i?f:p}var m=oe.nodes(e,{reverse:i,from:u,to:d,pass:x=>{var[k]=x;return de.isElement(k)?!!(!s&&(b.isVoid(e,k)||b.isElementReadOnly(e,k))||o&&!b.isSelectable(e,k)):!1}}),g=[],h;for(var[y,v]of m)if(!(o&&de.isElement(y)&&!b.isSelectable(e,y))){var w=h&&P.compare(v,h[1])===0;if(!(r==="highest"&&w)){if(!l(y,v)){if(a&&!w&&fe.isText(y))return;continue}if(r==="lowest"&&w){h=[y,v];continue}var _=r==="lowest"?h:[y,v];_&&(a?g.push(_):yield _),h=[y,v]}}r==="lowest"&&h&&(a?g.push(h):yield h),a&&(yield*g)}}()}var ov=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=d=>Aa.get(d)||[],s=d=>Ta.get(d)||new Set,o=d=>{var f=i(d).pop(),p=f.join(",");return s(d).delete(p),f};if(b.isNormalizing(t)){if(r){var l=Array.from(oe.nodes(t),d=>{var[,f]=d;return f}),u=new Set(l.map(d=>d.join(",")));Aa.set(t,l),Ta.set(t,u)}i(t).length!==0&&b.withoutNormalizing(t,()=>{for(var d of i(t))if(oe.has(t,d)){var f=b.node(t,d),[p,m]=f;de.isElement(p)&&p.children.length===0&&t.normalizeNode(f,{operation:a})}for(var g=i(t),h=g.length,y=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:y,initialDirtyPathsLength:h,operation:a}))return;var v=o(t);if(oe.has(t,v)){var w=b.node(t,v);t.normalizeNode(w,{operation:a})}y++,g=i(t)}})}},uv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=P.parent(a),s=b.node(t,i);return s},lv=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},cv=e=>{var t=cu.get(e);return t||(t=new Set,cu.set(e,t)),t},dv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(P.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 K.isRange(n)&&(i==="start"?n=K.start(n):i==="end"?n=K.end(n):n=P.common(n.anchor.path,n.focus.path)),Ee.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},fv=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},hv=e=>{var t=du.get(e);return t||(t=new Set,du.set(e,t)),t},mv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(P.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(!fe.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(K.isRange(n)){var[u,d]=K.edges(n);return a==="start"?u:d}return n};function pv(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]=K.edges(o),d=a?u:l,f=!1,p="",m=0,g=0,h=0;for(var[y,v]of b.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(y)){if(!i&&(e.isVoid(y)||e.isElementReadOnly(y))){yield b.start(e,v);continue}if(e.isInline(y))continue;if(b.hasInlines(e,y)){var w=P.isAncestor(v,u.path)?u:b.end(e,v),_=P.isAncestor(v,l.path)?l:b.start(e,v);p=b.string(e,{anchor:_,focus:w},{voids:i}),f=!0}}if(fe.isText(y)){var x=P.equals(v,d.path);for(x?(g=a?d.offset:y.text.length-d.offset,h=d.offset):(g=y.text.length,h=a?g:0),(x||f||r==="offset")&&(yield{path:v,offset:h},f=!1);;){if(m===0){if(p==="")break;m=k(p,r,a),p=oo(p,m,a)[1]}if(h=a?h-m:h+m,g=g-m,g<0){m=-g;break}m=0,yield{path:v,offset:h}}}}function k(T,S,q){return S==="character"?so(T,q):S==="word"?Gp(T,q):S==="line"||S==="block"?T.length:1}}()}var gv=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(P.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(P.isPath(s)){var[d]=b.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[f]=b.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return f}}},vv=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},bv=e=>{var t=fu.get(e);return t||(t=new Set,fu.set(e,t)),t},yv=(e,t,n)=>{if(K.isRange(t)&&!n)return t;var r=b.start(e,t),a=b.end(e,n||t);return{anchor:r,focus:a}};function Ru(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 Dv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ru(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ru(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Cv=(e,t)=>{var{selection:n}=e;if(n){var r=(d,f)=>{if(!fe.isText(d))return!1;var[p,m]=b.parent(e,f);return!e.isVoid(p)||e.markableVoid(p)},a=K.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)X.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Dv({},b.marks(e)||{});delete u[t],e.marks=u,yr.get(e)||e.onChange()}}},xv=(e,t)=>{Fd.set(e,t)},wv=(e,t)=>b.point(e,t,{edge:"start"}),Ev=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]=K.edges(i),l="";for(var[u,d]of b.nodes(t,{at:i,match:fe.isText,voids:a})){var f=u.text;P.equals(d,o.path)&&(f=f.slice(0,o.offset)),P.equals(d,s.path)&&(f=f.slice(s.offset)),l+=f}return l},kv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=K.edges(n);if(i.offset!==0||s.offset!==0||K.isCollapsed(n)||P.hasPrevious(s.path))return n;var o=b.above(t,{at:s,match:g=>de.isElement(g)&&b.isBlock(t,g),voids:a}),l=o?o[1]:[],u=b.start(t,i),d={anchor:u,focus:s},f=!0;for(var[p,m]of b.nodes(t,{at:d,match:fe.isText,reverse:!0,voids:a})){if(f){f=!1;continue}if(p.text!==""||P.isBefore(m,l)){s={path:m,offset:p.text.length};break}}return{anchor:i,focus:s}},_v=(e,t)=>{var n=b.isNormalizing(e);b.setNormalizing(e,!1);try{t()}finally{b.setNormalizing(e,n)}b.normalize(e)},Bv=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:d=!1}=n;if(u){var f=!1;if(K.isRange(u)&&K.isCollapsed(u)&&(f=!0,u=u.anchor),Ee.isPoint(u)){var p=b.void(t,{at:u,mode:"highest"});if(!l&&p){var[,m]=p;u=m}else{var g={unit:s,distance:o},h=i?b.before(t,u,g)||b.start(t,[]):b.after(t,u,g)||b.end(t,[]);u={anchor:u,focus:h},d=!0}}if(P.isPath(u)){X.removeNodes(t,{at:u,voids:l});return}if(!K.isCollapsed(u)){if(!d){var[,y]=K.edges(u),v=b.end(t,[]);Ee.equals(y,v)||(u=b.unhangRange(t,u,{voids:l}))}var[w,_]=K.edges(u),x=b.above(t,{match:he=>de.isElement(he)&&b.isBlock(t,he),at:w,voids:l}),k=b.above(t,{match:he=>de.isElement(he)&&b.isBlock(t,he),at:_,voids:l}),T=x&&k&&!P.equals(x[1],k[1]),S=P.equals(w.path,_.path),q=l?null:(r=b.void(t,{at:w,mode:"highest"}))!==null&&r!==void 0?r:b.elementReadOnly(t,{at:w,mode:"highest"}),N=l?null:(a=b.void(t,{at:_,mode:"highest"}))!==null&&a!==void 0?a:b.elementReadOnly(t,{at:_,mode:"highest"});if(q){var I=b.before(t,w);I&&x&&P.isAncestor(x[1],I.path)&&(w=I)}if(N){var z=b.after(t,_);z&&k&&P.isAncestor(k[1],z.path)&&(_=z)}var E=[],F;for(var j of b.nodes(t,{at:u,voids:l})){var[M,V]=j;F&&P.compare(V,F)===0||(!l&&de.isElement(M)&&(b.isVoid(t,M)||b.isElementReadOnly(t,M))||!P.isCommon(V,w.path)&&!P.isCommon(V,_.path))&&(E.push(j),F=V)}var G=Array.from(E,he=>{var[,ye]=he;return b.pathRef(t,ye)}),J=b.pointRef(t,w),ae=b.pointRef(t,_),C="";if(!S&&!q){var R=J.current,[W]=b.leaf(t,R),{path:B}=R,{offset:A}=w,L=W.text.slice(A);L.length>0&&(t.apply({type:"remove_text",path:B,offset:A,text:L}),C=L)}if(G.reverse().map(he=>he.unref()).filter(he=>he!==null).forEach(he=>X.removeNodes(t,{at:he,voids:l})),!N){var $=ae.current,[U]=b.leaf(t,$),{path:re}=$,te=S?w.offset:0,ne=U.text.slice(te,_.offset);ne.length>0&&(t.apply({type:"remove_text",path:re,offset:te,text:ne}),C=ne)}!S&&T&&ae.current&&J.current&&X.mergeNodes(t,{at:ae.current,hanging:!0,voids:l}),f&&i&&s==="character"&&C.length>1&&C.match(/[\u0E00-\u0E7F]+/)&&X.insertText(t,C.slice(0,C.length-o));var le=J.unref(),Q=ae.unref(),pe=i?le||Q:Q||le;n.at==null&&pe&&X.select(t,pe)}}})},Fv=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=io(t),batchDirty:o=!0}=r;if(n.length){if(K.isRange(s))if(a||(s=b.unhangRange(t,s,{voids:i})),K.isCollapsed(s))s=s.anchor;else{var[,l]=K.edges(s);if(!i&&b.void(t,{at:l}))return;var u=b.pointRef(t,l);X.delete(t,{at:s}),s=u.unref()}else P.isPath(s)&&(s=b.start(t,s));if(!(!i&&b.void(t,{at:s}))){var d=b.above(t,{at:s,match:L=>de.isElement(L)&&b.isInline(t,L),mode:"highest",voids:i});if(d){var[,f]=d;if(b.isEnd(t,s,f)){var p=b.after(t,f);s=p}else if(b.isStart(t,s,f)){var m=b.before(t,f);s=m}}var g=b.above(t,{match:L=>de.isElement(L)&&b.isBlock(t,L),at:s,voids:i}),[,h]=g,y=b.isStart(t,s,h),v=b.isEnd(t,s,h),w=y&&v,_=!y||y&&v,x=!v,[,k]=oe.first({children:n},[]),[,T]=oe.last({children:n},[]),S=[],q=L=>{var[$,U]=L,re=U.length===0;return re?!1:w?!0:!(_&&P.isAncestor(U,k)&&de.isElement($)&&!t.isVoid($)&&!t.isInline($)||x&&P.isAncestor(U,T)&&de.isElement($)&&!t.isVoid($)&&!t.isInline($))};for(var N of oe.nodes({children:n},{pass:q}))q(N)&&S.push(N);var I=[],z=[],E=[],F=!0,j=!1;for(var[M]of S)de.isElement(M)&&!t.isInline(M)?(F=!1,j=!0,z.push(M)):F?I.push(M):E.push(M);var[V]=b.nodes(t,{at:s,match:L=>fe.isText(L)||b.isInline(t,L),mode:"highest",voids:i}),[,G]=V,J=b.isStart(t,s,G),ae=b.isEnd(t,s,G),C=b.pathRef(t,v&&!E.length?P.next(h):h),R=b.pathRef(t,ae?P.next(G):G);X.splitNodes(t,{at:s,match:L=>j?de.isElement(L)&&b.isBlock(t,L):fe.isText(L)||b.isInline(t,L),mode:j?"lowest":"highest",always:j&&(!y||I.length>0)&&(!v||E.length>0),voids:i});var W=b.pathRef(t,!J||J&&ae?P.next(G):G);if(X.insertNodes(t,I,{at:W.current,match:L=>fe.isText(L)||b.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),w&&!I.length&&z.length&&!E.length&&X.delete(t,{at:h,voids:i}),X.insertNodes(t,z,{at:C.current,match:L=>de.isElement(L)&&b.isBlock(t,L),mode:"lowest",voids:i,batchDirty:o}),X.insertNodes(t,E,{at:R.current,match:L=>fe.isText(L)||b.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),!r.at){var B;if(E.length>0&&R.current?B=P.previous(R.current):z.length>0&&C.current?B=P.previous(C.current):W.current&&(B=P.previous(W.current)),B){var A=b.end(t,B);X.select(t,A)}}W.unref(),C.unref(),R.unref()}}})},Av=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")X.select(t,a.anchor);else if(r==="focus")X.select(t,a.focus);else if(r==="start"){var[i]=K.edges(a);X.select(t,i)}else if(r==="end"){var[,s]=K.edges(a);X.select(t,s)}}else return},Tv=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},Sv=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=K.isBackward(r)?"focus":"anchor"),o==="end"&&(o=K.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:a,unit:i,ignoreNonSelectable:!0},f={};if(o==null||o==="anchor"){var p=s?b.before(t,l,d):b.after(t,l,d);p&&(f.anchor=p)}if(o==null||o==="focus"){var m=s?b.before(t,u,d):b.after(t,u,d);m&&(f.focus=m)}X.setSelection(t,f)}},jv=(e,t)=>{var{selection:n}=e;if(t=b.range(e,t),n){X.setSelection(e,t);return}if(!K.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(Xe.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function Mu(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 Iu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Mu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mu(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=K.isBackward(a)?"focus":"anchor"),i==="end"&&(i=K.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;X.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Iu(Iu({},l),n)})}},Pv=(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})}},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,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:d}=r;if(oe.isNode(n)&&(n=[n]),n.length!==0){var[f]=n;if(l||(l=io(t),d!==!1&&(d=!0)),d==null&&(d=!1),K.isRange(l))if(a||(l=b.unhangRange(t,l,{voids:i})),K.isCollapsed(l))l=l.anchor;else{var[,p]=K.edges(l),m=b.pointRef(t,p);X.delete(t,{at:l}),l=m.unref()}if(Ee.isPoint(l)){u==null&&(fe.isText(f)?u=I=>fe.isText(I):t.isInline(f)?u=I=>fe.isText(I)||b.isInline(t,I):u=I=>de.isElement(I)&&b.isBlock(t,I));var[g]=b.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,h]=g,y=b.pathRef(t,h),v=b.isEnd(t,l,h);X.splitNodes(t,{at:l,match:u,mode:s,voids:i});var w=y.unref();l=v?P.next(w):w}else return}var _=P.parent(l),x=l[l.length-1];if(!(!i&&b.void(t,{at:_}))){if(o){var k=[],T=P.levels(_);bg(t,()=>{var I=function(){var F=_.concat(x);x++;var j={type:"insert_node",path:F,node:z};t.apply(j),l=P.next(l),k.push(j),fe.isText?T.push(...Array.from(oe.nodes(z),M=>{var[,V]=M;return F.concat(V)})):T.push(F)};for(var z of n)I()},()=>{Td(t,T,I=>{var z=I;for(var E of k)if(P.operationCanTransformPath(E)&&(z=P.transform(z,E),!z))return null;return z})})}else for(var S of n){var q=_.concat(x);x++,t.apply({type:"insert_node",path:q,node:S}),l=P.next(l)}if(l=P.previous(l),d){var N=b.end(t,l);N&&X.select(t,N)}}}})},Rv=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=P.isPath(r)?sr(t,r):x=>de.isElement(x)&&b.isBlock(t,x)),!!r){var o=b.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,x=>{var[,k]=x;return b.pathRef(t,k)});for(var u of l){var d=u.unref();if(d.length<2)throw new Error("Cannot lift node at a path [".concat(d,"] because it has a depth of less than `2`."));var f=b.node(t,P.parent(d)),[p,m]=f,g=d[d.length-1],{length:h}=p.children;if(h===1){var y=P.next(m);X.moveNodes(t,{at:d,to:y,voids:i}),X.removeNodes(t,{at:m,voids:i})}else if(g===0)X.moveNodes(t,{at:d,to:m,voids:i});else if(g===h-1){var v=P.next(m);X.moveNodes(t,{at:d,to:v,voids:i})}else{var w=P.next(d),_=P.next(m);X.splitNodes(t,{at:w,voids:i}),X.moveNodes(t,{at:d,to:_,voids:i})}}}})},Mv=["text"],Iv=["children"],Sd=(e,t)=>{if(de.isElement(t)){var n=t;return b.isVoid(e,t)?!0:n.children.length===1?Sd(e,n.children[0]):!1}else return!b.isEditor(t)},$v=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(P.isPath(a)){var[l]=b.parent(t,a);r=I=>l.children.includes(I)}else r=I=>de.isElement(I)&&b.isBlock(t,I);if(!i&&K.isRange(a)&&(a=b.unhangRange(t,a,{voids:s})),K.isRange(a))if(K.isCollapsed(a))a=a.anchor;else{var[,u]=K.edges(a),d=b.pointRef(t,u);X.delete(t,{at:a}),a=d.unref(),n.at==null&&X.select(t,a)}var[f]=b.nodes(t,{at:a,match:r,voids:s,mode:o}),p=b.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!f||!p)){var[m,g]=f,[h,y]=p;if(!(g.length===0||y.length===0)){var v=P.next(y),w=P.common(g,y),_=P.isSibling(g,y),x=Array.from(b.levels(t,{at:g}),I=>{var[z]=I;return z}).slice(w.length).slice(0,-1),k=b.above(t,{at:g,mode:"highest",match:I=>x.includes(I)&&Sd(t,I)}),T=k&&b.pathRef(t,k[1]),S,q;if(fe.isText(m)&&fe.isText(h)){var N=Zt(m,Mv);q=h.text.length,S=N}else if(de.isElement(m)&&de.isElement(h)){var N=Zt(m,Iv);q=h.children.length,S=N}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(Xe.stringify(m)," ").concat(Xe.stringify(h)));_||X.moveNodes(t,{at:g,to:v,voids:s}),T&&X.removeNodes(t,{at:T.current,voids:s}),de.isElement(h)&&b.isEmpty(t,h)||fe.isText(h)&&h.text===""&&y[y.length-1]!==0?X.removeNodes(t,{at:y,voids:s}):t.apply({type:"merge_node",path:v,position:q,properties:S}),T&&T.unref()}}}})},Lv=(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=P.isPath(r)?sr(e,r):m=>de.isElement(m)&&b.isBlock(e,m));var o=b.pathRef(e,n),l=b.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,m=>{var[,g]=m;return b.pathRef(e,g)});for(var d of u){var f=d.unref(),p=o.current;f.length!==0&&e.apply({type:"move_node",path:f,newPath:p}),o.current&&P.isSibling(p,f)&&P.isAfter(p,f)&&(o.current=P.next(o.current))}o.unref()}})},zv=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=P.isPath(s)?sr(t,s):m=>de.isElement(m)&&b.isBlock(t,m)),!r&&K.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,m=>{var[,g]=m;return b.pathRef(t,g)});for(var d of u){var f=d.unref();if(f){var[p]=b.node(t,f);t.apply({type:"remove_node",path:f,node:p})}}}})},qv=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:d=!1,voids:f=!1}=r;if(i){if(a==null&&(a=P.isPath(i)?sr(t,i):q=>de.isElement(q)&&b.isBlock(t,q)),!l&&K.isRange(i)&&(i=b.unhangRange(t,i,{voids:f})),d&&K.isRange(i)){if(K.isCollapsed(i)&&b.leaf(t,i.anchor)[0].text.length>0)return;var p=b.rangeRef(t,i,{affinity:"inward"}),[m,g]=K.edges(i),h=u==="lowest"?"lowest":"highest",y=b.isEnd(t,g,g.path);X.splitNodes(t,{at:g,match:a,mode:h,voids:f,always:!y});var v=b.isStart(t,m,m.path);X.splitNodes(t,{at:m,match:a,mode:h,voids:f,always:!v}),i=p.unref(),r.at==null&&X.select(t,i)}s||(s=(q,N)=>q!==N);for(var[w,_]of b.nodes(t,{at:i,match:a,mode:u,voids:f})){var x={},k={};if(_.length!==0){var T=!1;for(var S in n)S==="children"||S==="text"||s(n[S],w[S])&&(T=!0,w.hasOwnProperty(S)&&(x[S]=w[S]),o?n[S]!=null&&(k[S]=o(w[S],n[S])):n[S]!=null&&(k[S]=n[S]));T&&t.apply({type:"set_node",path:_,properties:x,newProperties:k})}}}})},Wv=(e,t)=>{if(K.isCollapsed(t))return t.anchor;var[,n]=K.edges(t),r=b.pointRef(e,n);return X.delete(e,{at:t}),r.unref()},Hv=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=ae=>de.isElement(ae)&&b.isBlock(t,ae)),K.isRange(s)&&(s=Wv(t,s)),P.isPath(s)){var u=s,d=b.point(t,u),[f]=b.parent(t,u);i=ae=>ae===f,o=d.path.length-u.length+1,s=d,l=!0}if(s){var p=b.pointRef(t,s,{affinity:"backward"}),m;try{var[g]=b.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var h=b.void(t,{at:s,mode:"highest"}),y=0;if(!a&&h){var[v,w]=h;if(de.isElement(v)&&t.isInline(v)){var _=b.after(t,w);if(!_){var x={text:""},k=P.next(w);X.insertNodes(t,x,{at:k,voids:a}),_=b.point(t,k)}s=_,l=!0}var T=s.path.length-w.length;o=T+1,l=!0}m=b.pointRef(t,s);var S=s.path.length-o,[,q]=g,N=s.path.slice(0,S),I=o===0?s.offset:s.path[S]+y;for(var[z,E]of b.levels(t,{at:N,reverse:!0,voids:a})){var F=!1;if(E.length<q.length||E.length===0||!a&&de.isElement(z)&&b.isVoid(t,z))break;var j=p.current,M=b.isEnd(t,j,E);if(l||!p||!b.isEdge(t,j,E)){F=!0;var V=oe.extractProps(z);t.apply({type:"split_node",path:E,position:I,properties:V})}I=E[E.length-1]+(F||M?1:0)}if(n.at==null){var G=m.current||b.end(t,[]);X.select(t,G)}}finally{var J;p.unref(),(J=m)===null||J===void 0||J.unref()}}})},Uv=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;X.setNodes(t,a,r)},Vv=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=P.isPath(s)?sr(t,s):m=>de.isElement(m)&&b.isBlock(t,m)),P.isPath(s)&&(s=b.range(t,s));var l=K.isRange(s)?b.rangeRef(t,s):null,u=b.nodes(t,{at:s,match:o,mode:r,voids:i}),d=Array.from(u,m=>{var[,g]=m;return b.pathRef(t,g)}).reverse(),f=function(){var g=p.unref(),[h]=b.node(t,g),y=b.range(t,g);a&&l&&(y=K.intersection(l.current,y)),X.liftNodes(t,{at:y,match:v=>de.isAncestor(h)&&h.children.includes(v),voids:i})};for(var p of d)f();l&&l.unref()}})};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 Lu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$u(Object(n),!0).forEach(function(r){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 Kv=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&&(P.isPath(l)?o=sr(t,l):t.isInline(n)?o=y=>de.isElement(y)&&b.isInline(t,y)||fe.isText(y):o=y=>de.isElement(y)&&b.isBlock(t,y)),i&&K.isRange(l)){var[u,d]=K.edges(l),f=b.rangeRef(t,l,{affinity:"inward"});X.splitNodes(t,{at:d,match:o,voids:s}),X.splitNodes(t,{at:u,match:o,voids:s}),l=f.unref(),r.at==null&&X.select(t,l)}var p=Array.from(b.nodes(t,{at:l,match:t.isInline(n)?y=>de.isElement(y)&&b.isBlock(t,y):y=>b.isEditor(y),mode:"lowest",voids:s})),m=function(){var v=K.isRange(l)?K.intersection(l,b.range(t,h)):l;if(!v)return 0;var w=Array.from(b.nodes(t,{at:v,match:o,mode:a,voids:s}));if(w.length>0){var[_]=w,x=w[w.length-1],[,k]=_,[,T]=x;if(k.length===0&&T.length===0)return 0;var S=P.equals(k,T)?P.parent(k):P.common(k,T),q=b.range(t,k,T),N=b.node(t,S),[I]=N,z=S.length+1,E=P.next(T.slice(0,z)),F=Lu(Lu({},n),{},{children:[]});X.insertNodes(t,F,{at:E,voids:s}),X.moveNodes(t,{at:q,match:j=>de.isAncestor(I)&&I.children.includes(j),to:E.concat(0),voids:s})}},g;for(var[,h]of p)g=m()}})},Zv=()=>{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 yg(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fg(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tg(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fv(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ug(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cv(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Av(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bv(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tv(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sg(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(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 Pg(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rv(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Nv(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kg(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zg(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yg(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gg(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qg(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ev(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rv(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $v(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sv(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lv(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return av(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iv(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sv(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ov(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uv(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dv(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lv(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cv(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mv(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fv(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hv(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pv(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gv(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yv(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vv(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bv(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zv(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jv(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qv(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xv(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 Pv(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hv(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wv(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ev(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kv(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Uv(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vv(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _v(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kv(e,...r)}};return e},Yv={isHistory(e){return tt(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||rn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||rn.isOperationList(e.undos[0].operations))}},Ci=new WeakMap,xi=new WeakMap,Wn={isHistoryEditor(e){return Yv.isHistory(e.history)&&b.isEditor(e)},isMerging(e){return xi.get(e)},isSaving(e){return Ci.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Wn.isMerging(e);xi.set(e,!1),t(),xi.set(e,n)},withoutSaving(e,t){var n=Wn.isSaving(e);Ci.set(e,!1),t(),Ci.set(e,n)}},Gv=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&&X.setSelection(t,i.selectionBefore),Wn.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];Wn.withoutSaving(t,()=>{b.withoutNormalizing(t,()=>{var s=i.operations.map(rn.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&X.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=Wn.isSaving(t),d=Wn.isMerging(t);if(u==null&&(u=Jv(r)),u){if(d==null&&(o==null?d=!1:a.length!==0?d=!0:d=Qv(r,l)),o&&d)o.operations.push(r);else{var f={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",f)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},Qv=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&P.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&P.equals(e.path,t.path)),Jv=(e,t)=>e.type!=="set_selection",Xv=n0,jd="֑-߿יִ-﷽ﹰ-ﻼ",Od="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",e0=new RegExp("^[^"+Od+"]*["+jd+"]"),t0=new RegExp("^[^"+jd+"]*["+Od+"]");function n0(e){return e=String(e||""),e0.test(e)?"rtl":t0.test(e)?"ltr":"neutral"}const Pd=Fn(Xv);function r0(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var uo=r0,a0=typeof Hr=="object"&&Hr&&Hr.Object===Object&&Hr,i0=a0,s0=i0,o0=typeof self=="object"&&self&&self.Object===Object&&self,u0=s0||o0||Function("return this")(),Nd=u0,l0=Nd,c0=function(){return l0.Date.now()},d0=c0,f0=/\s/;function h0(e){for(var t=e.length;t--&&f0.test(e.charAt(t)););return t}var m0=h0,p0=m0,g0=/^\s+/;function v0(e){return e&&e.slice(0,p0(e)+1).replace(g0,"")}var b0=v0,y0=Nd,D0=y0.Symbol,Rd=D0,zu=Rd,Md=Object.prototype,C0=Md.hasOwnProperty,x0=Md.toString,hr=zu?zu.toStringTag:void 0;function w0(e){var t=C0.call(e,hr),n=e[hr];try{e[hr]=void 0;var r=!0}catch{}var a=x0.call(e);return r&&(t?e[hr]=n:delete e[hr]),a}var E0=w0,k0=Object.prototype,_0=k0.toString;function B0(e){return _0.call(e)}var F0=B0,qu=Rd,A0=E0,T0=F0,S0="[object Null]",j0="[object Undefined]",Wu=qu?qu.toStringTag:void 0;function O0(e){return e==null?e===void 0?j0:S0:Wu&&Wu in Object(e)?A0(e):T0(e)}var P0=O0;function N0(e){return e!=null&&typeof e=="object"}var R0=N0,M0=P0,I0=R0,$0="[object Symbol]";function L0(e){return typeof e=="symbol"||I0(e)&&M0(e)==$0}var z0=L0,q0=b0,Hu=uo,W0=z0,Uu=0/0,H0=/^[-+]0x[0-9a-f]+$/i,U0=/^0b[01]+$/i,V0=/^0o[0-7]+$/i,K0=parseInt;function Z0(e){if(typeof e=="number")return e;if(W0(e))return Uu;if(Hu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Hu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=q0(e);var n=U0.test(e);return n||V0.test(e)?K0(e.slice(2),n?2:8):H0.test(e)?Uu:+e}var Y0=Z0,G0=uo,wi=d0,Vu=Y0,Q0="Expected a function",J0=Math.max,X0=Math.min;function eb(e,t,n){var r,a,i,s,o,l,u=0,d=!1,f=!1,p=!0;if(typeof e!="function")throw new TypeError(Q0);t=Vu(t)||0,G0(n)&&(d=!!n.leading,f="maxWait"in n,i=f?J0(Vu(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function m(T){var S=r,q=a;return r=a=void 0,u=T,s=e.apply(q,S),s}function g(T){return u=T,o=setTimeout(v,t),d?m(T):s}function h(T){var S=T-l,q=T-u,N=t-S;return f?X0(N,i-q):N}function y(T){var S=T-l,q=T-u;return l===void 0||S>=t||S<0||f&&q>=i}function v(){var T=wi();if(y(T))return w(T);o=setTimeout(v,h(T))}function w(T){return o=void 0,p&&r?m(T):(r=a=void 0,s)}function _(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function x(){return o===void 0?s:w(wi())}function k(){var T=wi(),S=y(T);if(r=arguments,a=this,l=T,S){if(o===void 0)return g(l);if(f)return clearTimeout(o),o=setTimeout(v,t),m(l)}return o===void 0&&(o=setTimeout(v,t)),s}return k.cancel=_,k.flush=x,k}var Id=eb;const tb=Fn(Id);var nb=Id,rb=uo,ab="Expected a function";function ib(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(ab);return rb(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),nb(e,t,{leading:r,maxWait:t,trailing:a})}var sb=ib;const ob=Fn(sb),Ku=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Zu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Ei=(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},Jr=(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,ub=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Yu=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,f=typeof u=="function"?u:V=>V!==u;if(!Ku(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,m=[];let g=e;for(;Ku(g)&&f(g);){if(g=ub(g),g===p){m.push(g);break}g!=null&&g===document.body&&Ei(g)&&!Ei(document.documentElement)||g!=null&&Ei(g,d)&&m.push(g)}const h=(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:v,scrollY:w}=window,{height:_,width:x,top:k,right:T,bottom:S,left:q}=e.getBoundingClientRect(),{top:N,right:I,bottom:z,left:E}=(V=>{const G=window.getComputedStyle(V);return{top:parseFloat(G.scrollMarginTop)||0,right:parseFloat(G.scrollMarginRight)||0,bottom:parseFloat(G.scrollMarginBottom)||0,left:parseFloat(G.scrollMarginLeft)||0}})(e);let F=o==="start"||o==="nearest"?k-N:o==="end"?S+z:k+_/2-N+z,j=l==="center"?q+x/2-E+I:l==="end"?T+I:q-E;const M=[];for(let V=0;V<m.length;V++){const G=m[V],{height:J,width:ae,top:C,right:R,bottom:W,left:B}=G.getBoundingClientRect();if(s==="if-needed"&&k>=0&&q>=0&&S<=y&&T<=h&&k>=C&&S<=W&&q>=B&&T<=R)return M;const A=getComputedStyle(G),L=parseInt(A.borderLeftWidth,10),$=parseInt(A.borderTopWidth,10),U=parseInt(A.borderRightWidth,10),re=parseInt(A.borderBottomWidth,10);let te=0,ne=0;const le="offsetWidth"in G?G.offsetWidth-G.clientWidth-L-U:0,Q="offsetHeight"in G?G.offsetHeight-G.clientHeight-$-re:0,pe="offsetWidth"in G?G.offsetWidth===0?0:ae/G.offsetWidth:0,he="offsetHeight"in G?G.offsetHeight===0?0:J/G.offsetHeight:0;if(p===G)te=o==="start"?F:o==="end"?F-y:o==="nearest"?Jr(w,w+y,y,$,re,w+F,w+F+_,_):F-y/2,ne=l==="start"?j:l==="center"?j-h/2:l==="end"?j-h:Jr(v,v+h,h,L,U,v+j,v+j+x,x),te=Math.max(0,te+w),ne=Math.max(0,ne+v);else{te=o==="start"?F-C-$:o==="end"?F-W+re+Q:o==="nearest"?Jr(C,W,J,$,re+Q,F,F+_,_):F-(C+J/2)+Q/2,ne=l==="start"?j-B-L:l==="center"?j-(B+ae/2)+le/2:l==="end"?j-R+U+le:Jr(B,R,ae,L,U+le,j,j+x,x);const{scrollLeft:ye,scrollTop:Fe}=G;te=he===0?0:Math.max(0,Math.min(Fe+te/he,G.scrollHeight-J/he+Q)),ne=pe===0?0:Math.max(0,Math.min(ye+ne/pe,G.scrollWidth-ae/pe+le)),F+=Fe-te,j+=ye-ne}M.push({el:G,top:te,left:ne})}return M},lb=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function cb(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(Yu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Yu(e,lb(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var yn=[],db=function(){return yn.some(function(e){return e.activeTargets.length>0})},fb=function(){return yn.some(function(e){return e.skippedTargets.length>0})},Gu="ResizeObserver loop completed with undelivered notifications.",hb=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Gu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Gu),window.dispatchEvent(e)},Or;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Or||(Or={}));var Dn=function(e){return Object.freeze(e)},mb=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,Dn(this)}return e}(),$d=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,Dn(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}(),lo=function(e){return e instanceof SVGElement&&"getBBox"in e},Ld=function(e){if(lo(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)},Qu=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)},pb=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},Dr=typeof window<"u"?window:{},Xr=new WeakMap,Ju=/auto|scroll/,gb=/^tb|vertical/,vb=/msie|trident/i.test(Dr.navigator&&Dr.navigator.userAgent),St=function(e){return parseFloat(e||"0")},Kn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new mb((n?t:e)||0,(n?e:t)||0)},Xu=Dn({devicePixelContentBoxSize:Kn(),borderBoxSize:Kn(),contentBoxSize:Kn(),contentRect:new $d(0,0,0,0)}),zd=function(e,t){if(t===void 0&&(t=!1),Xr.has(e)&&!t)return Xr.get(e);if(Ld(e))return Xr.set(e,Xu),Xu;var n=getComputedStyle(e),r=lo(e)&&e.ownerSVGElement&&e.getBBox(),a=!vb&&n.boxSizing==="border-box",i=gb.test(n.writingMode||""),s=!r&&Ju.test(n.overflowY||""),o=!r&&Ju.test(n.overflowX||""),l=r?0:St(n.paddingTop),u=r?0:St(n.paddingRight),d=r?0:St(n.paddingBottom),f=r?0:St(n.paddingLeft),p=r?0:St(n.borderTopWidth),m=r?0:St(n.borderRightWidth),g=r?0:St(n.borderBottomWidth),h=r?0:St(n.borderLeftWidth),y=f+u,v=l+d,w=h+m,_=p+g,x=o?e.offsetHeight-_-e.clientHeight:0,k=s?e.offsetWidth-w-e.clientWidth:0,T=a?y+w:0,S=a?v+_:0,q=r?r.width:St(n.width)-T-k,N=r?r.height:St(n.height)-S-x,I=q+y+k+w,z=N+v+x+_,E=Dn({devicePixelContentBoxSize:Kn(Math.round(q*devicePixelRatio),Math.round(N*devicePixelRatio),i),borderBoxSize:Kn(I,z,i),contentBoxSize:Kn(q,N,i),contentRect:new $d(f,l,q,N)});return Xr.set(e,E),E},qd=function(e,t,n){var r=zd(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Or.DEVICE_PIXEL_CONTENT_BOX:return s;case Or.BORDER_BOX:return a;default:return i}},bb=function(){function e(t){var n=zd(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=Dn([n.borderBoxSize]),this.contentBoxSize=Dn([n.contentBoxSize]),this.devicePixelContentBoxSize=Dn([n.devicePixelContentBoxSize])}return e}(),Wd=function(e){if(Ld(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},yb=function(){var e=1/0,t=[];yn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new bb(u.target),f=Wd(u.target);o.push(d),u.lastReportedSize=qd(u.target,u.observedBox),f<e&&(e=f)}),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},el=function(e){yn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(Wd(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},Db=function(){var e=0;for(el(e);db();)e=yb(),el(e);return fb()&&hb(),e>0},ki,Hd=[],Cb=function(){return Hd.splice(0).forEach(function(e){return e()})},xb=function(e){if(!ki){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Cb()}).observe(n,r),ki=function(){n.textContent="".concat(t?t--:t++)}}Hd.push(e),ki()},wb=function(e){xb(function(){requestAnimationFrame(e)})},va=0,Eb=function(){return!!va},kb=250,_b={attributes:!0,characterData:!0,childList:!0,subtree:!0},tl=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],nl=function(e){return e===void 0&&(e=0),Date.now()+e},_i=!1,Bb=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=kb),!_i){_i=!0;var r=nl(t);wb(function(){var a=!1;try{a=Db()}finally{if(_i=!1,t=r-nl(),!Eb())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,_b)};document.body?n():Dr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),tl.forEach(function(n){return Dr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),tl.forEach(function(n){return Dr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),xs=new Bb,rl=function(e){!va&&e>0&&xs.start(),va+=e,!va&&xs.stop()},Fb=function(e){return!lo(e)&&!pb(e)&&getComputedStyle(e).display==="inline"},Ab=function(){function e(t,n){this.target=t,this.observedBox=n||Or.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=qd(this.target,this.observedBox,!0);return Fb(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Tb=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),ea=new WeakMap,al=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},ta=function(){function e(){}return e.connect=function(t,n){var r=new Tb(t,n);ea.set(t,r)},e.observe=function(t,n,r){var a=ea.get(t),i=a.observationTargets.length===0;al(a.observationTargets,n)<0&&(i&&yn.push(a),a.observationTargets.push(new Ab(n,r&&r.box)),rl(1),xs.schedule())},e.unobserve=function(t,n){var r=ea.get(t),a=al(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&yn.splice(yn.indexOf(r),1),r.observationTargets.splice(a,1),rl(-1))},e.disconnect=function(t){var n=this,r=ea.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Sb=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.");ta.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(!Qu(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ta.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(!Qu(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ta.unobserve(this,t)},e.prototype.disconnect=function(){ta.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Gt={};Object.defineProperty(Gt,"__esModule",{value:!0});var jb=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Bi={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Ud={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:jb?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},co={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 na=1;na<20;na++)co["f"+na]=111+na;function ni(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Vd(s,t)}),a=function(o){return r.some(function(l){return Kd(l,o)})},i=n==null?a:a(n);return i}function Ob(e,t){return ni(e,t)}function Pb(e,t){return ni(e,{byKey:!0},t)}function Vd(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in Bi)r[Bi[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var d=a[Symbol.iterator](),f;!(o=(f=d.next()).done);o=!0){var p=f.value,m=p.endsWith("?")&&p.length>1;m&&(p=p.slice(0,-1));var g=fo(p),h=Bi[g];if(p.length>1&&!h&&!Ud[p]&&!co[g])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!h)&&(n?r.key=g:r.which=Zd(p)),h&&(r[h]=m?null:!0)}}catch(y){l=!0,u=y}finally{try{!o&&d.return&&d.return()}finally{if(l)throw u}}return r}function Kd(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 Zd(e){e=fo(e);var t=co[e]||e.toUpperCase().charCodeAt(0);return t}function fo(e){return e=e.toLowerCase(),e=Ud[e]||e,e}var Nb=Gt.default=ni,Fi=Gt.isHotkey=ni;Gt.isCodeHotkey=Ob;Gt.isKeyHotkey=Pb;Gt.parseHotkey=Vd;Gt.compareHotkey=Kd;Gt.toKeyCode=Zd;Gt.toKeyName=fo;function Rb(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 Jn(e,t){if(e==null)return{};var n=Rb(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 Pr(e){"@babel/helpers - typeof";return Pr=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},Pr(e)}function Mb(e,t){if(Pr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Pr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ib(e){var t=Mb(e,"string");return Pr(t)==="symbol"?t:String(t)}function Et(e,t,n){return t=Ib(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ho=D.createContext(null),cn=()=>{var e=D.useContext(ho);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Yd=parseInt(D.version.split(".")[0],10),$b=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,il=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),ot=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Hn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),vr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),Lb=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Gd=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),zb=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),qb=ot&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),Wb=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),Hb=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),Ub=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ba=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Jt=(!zb||!qb)&&!Lb&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",mo=new WeakMap,po=new WeakMap,Qd=new WeakMap,ya=new WeakMap,ws=new WeakMap,Nr=new WeakMap,Cn=new WeakMap,Sa=new WeakMap,ri=new WeakMap,Es=new WeakMap,an=new WeakMap,vn=new WeakMap,Cr=new WeakMap,ks=new WeakMap,go=new WeakMap,Ft=new WeakMap,Vt=new WeakMap,ct=new WeakMap,en=new WeakMap,tn=new WeakMap,Jd=new WeakMap,Xn=Symbol("placeholder"),Xd=Symbol("mark-placeholder"),Vb=globalThis.Text,vo=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,Kb=e=>sn(e)&&e.nodeType===8,wt=e=>sn(e)&&e.nodeType===1,sn=e=>{var t=vo(e);return!!t&&e instanceof t.Node},_s=e=>{var t=e&&e.anchorNode&&vo(e.anchorNode);return!!t&&e instanceof t.Selection},ef=e=>sn(e)&&e.nodeType===3,Zb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,Yb=e=>{var[t,n]=e;if(wt(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=tf(t,a,r?"backward":"forward"),r=a<n;wt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=Qb(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},Gb=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},tf=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(Kb(a)||wt(a)&&a.childNodes.length===0||wt(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]},Qb=(e,t,n)=>{var[r]=tf(e,t,n);return r},nf=e=>{var t="";if(ef(e)&&e.nodeValue)return e.nodeValue;if(wt(e)){for(var n of Array.from(e.childNodes))t+=nf(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
105
- `)}return t},Jb=/data-slate-fragment="(.+?)"/m,Xb=e=>{var t=e.getData("text/html"),[,n]=t.match(Jb)||[];return n},bo=(e,t,n)=>{var{target:r}=t;if(wt(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=ee.getWindow(e);if(a.contains(r))return ee.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var d of l)if(d===r||d.contains(r))return!0});return!i||i===t?!1:bo(e,i,n)},ey=0;class ty{constructor(){Et(this,"id",void 0),this.id="".concat(ey++)}}var ee={androidPendingDiffs:e=>ct.get(e),androidScheduleFlush:e=>{var t;(t=go.get(e))===null||t===void 0||t()},blur:e=>{var t=ee.toDOMNode(e,e),n=ee.findDocumentOrShadowRoot(e);an.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=ee.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&X.deselect(e)},findDocumentOrShadowRoot:e=>{var t=ee.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=ee.toSlateNode(e,t.target),s=ee.findPath(e,i);if(de.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"}),d=l?b.before(e,u):b.after(e,u);if(d){var f=b.range(e,d);return f}}var p,{document:m}=ee.getWindow(e);if(m.caretRangeFromPoint)p=m.caretRangeFromPoint(n,r);else{var g=m.caretPositionFromPoint(n,r);g&&(p=m.createRange(),p.setStart(g.offsetNode,g.offset),p.setEnd(g.offsetNode,g.offset))}if(!p)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var h=ee.toSlateRange(e,p,{exactMatch:!1,suppressThrow:!1});return h},findKey:(e,t)=>{var n=Sa.get(t);return n||(n=new ty,Sa.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=po.get(r);if(a==null){if(b.isEditor(r))return n;break}var i=mo.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(Xe.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!an.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(()=>{ee.focus(t,{retries:n.retries-1})},10);return}var r=ee.toDOMNode(t,t),a=ee.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=ee.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(X.select(t,b.start(t,[])),t.onChange()),an.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=Qd.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=ee.toDOMNode(t,t),s;try{s=wt(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)=>sn(t)&&ee.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)=>ee.hasEditableTarget(e,t)||ee.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>sn(t)&&ee.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!vn.get(e),isFocused:e=>!!an.get(e),isReadOnly:e=>!!Es.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Es.get(e))return!1;var n=ee.hasTarget(e,t)&&ee.toSlateNode(e,t);return de.isElement(n)&&b.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=ri.get(e),r=b.isEditor(t)?ya.get(e):n==null?void 0:n.get(ee.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(Xe.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=b.node(e,t.path),r=ee.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],d=u.childNodes[0];if(!(d==null||d.textContent==null)){var{length:f}=d.textContent,p=u.getAttribute("data-slate-length"),m=p==null?f:parseInt(p,10),g=o+m,h=s[l+1];if(t.offset===g&&h!==null&&h!==void 0&&h.hasAttribute("data-slate-mark-placeholder")){var y,v=h.childNodes[0];a=[v instanceof Vb?v:h,(y=h.textContent)!==null&&y!==void 0&&y.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var w=Math.min(f,Math.max(0,t.offset-o));a=[d,w];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(Xe.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=K.isBackward(t),i=ee.toDOMPoint(e,n),s=K.isCollapsed(t)?i:ee.toDOMPoint(e,r),o=ee.getWindow(e),l=o.document.createRange(),[u,d]=a?s:i,[f,p]=a?i:s,m=wt(u)?u:u.parentElement,g=!!m.getAttribute("data-slate-zero-width"),h=wt(f)?f:f.parentElement,y=!!h.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:d),l.setEnd(f,y?1:p),l},toSlateNode:(e,t)=>{var n=wt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Nr.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:Yb(t),o=i.parentNode,l=null,u=0;if(o){var d,f,p=ee.toDOMNode(e,e),m=o.closest('[data-slate-void="true"]'),g=m&&p.contains(m)?m:null,h=o.closest("[data-slate-leaf]"),y=null;if(h){if(l=h.closest('[data-slate-node="text"]'),l){var v=ee.getWindow(e),w=v.document.createRange();w.setStart(l,0),w.setEnd(i,s);var _=w.cloneContents(),x=[...Array.prototype.slice.call(_.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(_.querySelectorAll("[contenteditable=false]"))];x.forEach(j=>{if(ot&&!r&&j.hasAttribute("data-slate-zero-width")&&j.textContent.length>0&&j.textContext!=="\uFEFF"){j.textContent.startsWith("\uFEFF")&&(j.textContent=j.textContent.slice(1));return}j.parentNode.removeChild(j)}),u=_.textContent.length,y=l}}else if(g){for(var k=g.querySelectorAll("[data-slate-leaf]"),T=0;T<k.length;T++){var S=k[T];if(ee.hasDOMNode(e,S)){h=S;break}}h?(l=h.closest('[data-slate-node="text"]'),y=h,u=y.textContent.length,y.querySelectorAll("[data-slate-zero-width]").forEach(j=>{u-=j.textContent.length})):u=1}y&&u===y.textContent.length&&ot&&y.getAttribute("data-slate-zero-width")==="z"&&(d=y.textContent)!==null&&d!==void 0&&d.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Hn&&(f=y.textContent)!==null&&f!==void 0&&f.endsWith(`
104
+ */function eu(e){return Object.prototype.toString.call(e)==="[object Object]"}function tt(e){var t,n;return eu(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(eu(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Dd=Symbol.for("immer-nothing"),tu=Symbol.for("immer-draftable"),vt=Symbol.for("immer-state"),gp=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=gp[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 Gn=Object.getPrototypeOf;function En(e){return!!e&&!!e[vt]}function kn(e){var t;return e?Cd(e)||Array.isArray(e)||!!e[tu]||!!((t=e.constructor)!=null&&t[tu])||Qa(e)||Ja(e):!1}var vp=Object.prototype.constructor.toString();function Cd(e){if(!e||typeof e!="object")return!1;const t=Gn(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)===vp}function Ea(e,t){Ga(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Ga(e){const t=e[vt];return t?t.type_:Array.isArray(e)?1:Qa(e)?2:Ja(e)?3:0}function ms(e,t){return Ga(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function xd(e,t,n){const r=Ga(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function bp(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Qa(e){return e instanceof Map}function Ja(e){return e instanceof Set}function hn(e){return e.copy_||e.base_}function ps(e,t){if(Qa(e))return new Map(e);if(Ja(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Cd(e))return Gn(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[vt];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(Gn(e),n)}function eo(e,t=!1){return Xa(e)||En(e)||!kn(e)||(Ga(e)>1&&(e.set=e.add=e.clear=e.delete=yp),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>eo(r,!0))),e}function yp(){dt(2)}function Xa(e){return Object.isFrozen(e)}var Dp={};function _n(e){const t=Dp[e];return t||dt(0,e),t}var Tr;function wd(){return Tr}function Cp(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function nu(e,t){t&&(_n("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function gs(e){vs(e),e.drafts_.forEach(xp),e.drafts_=null}function vs(e){e===Tr&&(Tr=e.parent_)}function ru(e){return Tr=Cp(Tr,e)}function xp(e){const t=e[vt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function au(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[vt].modified_&&(gs(t),dt(4)),kn(e)&&(e=ka(t,e),t.parent_||_a(t,e)),t.patches_&&_n("Patches").generateReplacementPatches_(n[vt].base_,e,t.patches_,t.inversePatches_)):e=ka(t,n,[]),gs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Dd?e:void 0}function ka(e,t,n){if(Xa(t))return t;const r=t[vt];if(!r)return Ea(t,(a,i)=>iu(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return _a(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),Ea(i,(o,l)=>iu(e,r,a,o,l,n,s)),_a(e,a,!1),n&&e.patches_&&_n("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function iu(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&dt(5),En(a)){const o=i&&t&&t.type_!==3&&!ms(t.assigned_,r)?i.concat(r):void 0,l=ka(e,a,o);if(xd(n,r,l),En(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(kn(a)&&!Xa(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ka(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&_a(e,a)}}function _a(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&eo(t,n)}function wp(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:wd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=to;n&&(a=[r],i=Sr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var to={get(e,t){if(t===vt)return e;const n=hn(e);if(!ms(n,t))return Ep(e,n,t);const r=n[t];return e.finalized_||!kn(r)?r:r===vi(e.base_,t)?(bi(e),e.copy_[t]=ys(r,e)):r},has(e,t){return t in hn(e)},ownKeys(e){return Reflect.ownKeys(hn(e))},set(e,t,n){const r=Ed(hn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=vi(hn(e),t),i=a==null?void 0:a[vt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(bp(n,a)&&(n!==void 0||ms(e.base_,t)))return!0;bi(e),bs(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 vi(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,bi(e),bs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=hn(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 Gn(e.base_)},setPrototypeOf(){dt(12)}},Sr={};Ea(to,(e,t)=>{Sr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Sr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&dt(13),Sr.set.call(this,e,t,void 0)};Sr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&dt(14),to.set.call(this,e[0],t,n,e[0])};function vi(e,t){const n=e[vt];return(n?hn(n):e)[t]}function Ep(e,t,n){var a;const r=Ed(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Ed(e,t){if(!(t in e))return;let n=Gn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Gn(n)}}function bs(e){e.modified_||(e.modified_=!0,e.parent_&&bs(e.parent_))}function bi(e){e.copy_||(e.copy_=ps(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var kp=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(kn(t)){const i=ru(this),s=ys(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?gs(i):vs(i)}return nu(i,r),au(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===Dd&&(a=void 0),this.autoFreeze_&&eo(a,!0),r){const i=[],s=[];_n("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){kn(e)||dt(8),En(e)&&(e=_p(e));const t=ru(this),n=ys(e,void 0);return n[vt].isManual_=!0,vs(t),n}finishDraft(e,t){const n=e&&e[vt];(!n||!n.isManual_)&&dt(9);const{scope_:r}=n;return nu(r,t),au(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=_n("Patches").applyPatches_;return En(e)?r(e,t):this.produce(e,a=>r(a,t))}};function ys(e,t){const n=Qa(e)?_n("MapSet").proxyMap_(e,t):Ja(e)?_n("MapSet").proxySet_(e,t):wp(e,t);return(t?t.scope_:wd()).drafts_.push(n),n}function _p(e){return En(e)||dt(10,e),kd(e)}function kd(e){if(!kn(e)||Xa(e))return e;const t=e[vt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ps(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ps(e,!0);return Ea(n,(r,a)=>{xd(n,r,kd(a))}),t&&(t.finalized_=!1),n}var bt=new kp,no=bt.produce;bt.produceWithPatches.bind(bt);bt.setAutoFreeze.bind(bt);bt.setUseStrictShallowCopy.bind(bt);bt.applyPatches.bind(bt);var su=bt.createDraft.bind(bt),ou=bt.finishDraft.bind(bt),Bp={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=P.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Fp={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()}}},Ap={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=K.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Ba=new WeakMap,Fa=new WeakMap,yr=new WeakMap,_d=new WeakMap,uu=new WeakMap,lu=new WeakMap,cu=new WeakMap,P={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=P.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 P.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return P.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 P.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 P.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&P.compare(e,t)===0},isBefore(e,t){return P.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&P.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&P.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&P.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&P.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&&P.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(!P.isAncestor(t,e)&&!P.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;(P.equals(i,r)||P.endsBefore(i,r)||P.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(P.equals(s,r)||P.isAncestor(s,r))return null;P.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;P.equals(o,r)||P.endsBefore(o,r)?r[o.length-1]-=1:P.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:c}=t;if(P.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else P.endsBefore(u,r)?r[u.length-1]+=1:P.isAncestor(u,r)&&e[u.length]>=c&&(r[u.length-1]+=1,r[u.length]-=c);break}case"move_node":{var{path:h,newPath:p}=t;if(P.equals(h,p))return r;if(P.isAncestor(h,r)||P.equals(h,r)){var m=p.slice();return P.endsBefore(h,p)&&h.length<p.length&&(m[h.length-1]-=1),m.concat(r.slice(h.length))}else P.isSibling(h,p)&&(P.isAncestor(p,r)||P.equals(p,r))?P.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:P.endsBefore(p,r)||P.equals(p,r)||P.isAncestor(p,r)?(P.endsBefore(h,r)&&(r[h.length-1]-=1),r[p.length-1]+=1):P.endsBefore(h,r)&&(P.equals(p,r)&&(r[p.length-1]+=1),r[h.length-1]-=1);break}}return r}};function jr(e){"@babel/helpers - typeof";return jr=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},jr(e)}function Tp(e,t){if(jr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(jr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sp(e){var t=Tp(e,"string");return jr(t)==="symbol"?t:String(t)}function ut(e,t,n){return t=Sp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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 fr(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 jp=(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 K.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 p=oe.leaf(e,u),m=p.text.slice(0,c),g=p.text.slice(c);if(p.text=m+h+g,t)for(var[f,D]of K.points(t))t[D]=Ee.transform(f,n);break}case"merge_node":{var{path:v}=n,E=oe.get(e,v),B=P.previous(v),x=oe.get(e,B),k=oe.parent(e,v),T=v[v.length-1];if(fe.isText(E)&&fe.isText(x))x.text+=E.text;else if(!fe.isText(E)&&!fe.isText(x))x.children.push(...E.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(Xe.stringify(E)," ").concat(Xe.stringify(x)));if(k.children.splice(T,1),t)for(var[S,q]of K.points(t))t[q]=Ee.transform(S,n);break}case"move_node":{var{path:N,newPath:I}=n;if(P.isAncestor(N,I))throw new Error("Cannot move a path [".concat(N,"] to new path [").concat(I,"] because the destination is inside itself."));var z=oe.get(e,N),w=oe.parent(e,N),F=N[N.length-1];w.children.splice(F,1);var j=P.transform(N,n),M=oe.get(e,P.parent(j)),V=j[j.length-1];if(M.children.splice(V,0,z),t)for(var[G,J]of K.points(t))t[J]=Ee.transform(G,n);break}case"remove_node":{var{path:ae}=n,C=ae[ae.length-1],R=oe.parent(e,ae);if(R.children.splice(C,1),t)for(var[W,_]of K.points(t)){var A=Ee.transform(W,n);if(t!=null&&A!=null)t[_]=A;else{var L=void 0,$=void 0;for(var[U,re]of oe.texts(e))if(P.compare(re,ae)===-1)L=[U,re];else{$=[U,re];break}var te=!1;L&&$&&(P.equals($[1],ae)?te=!P.hasPrevious($[1]):te=P.common(L[1],ae).length<P.common($[1],ae).length),L&&!te?(W.path=L[1],W.offset=L[0].text.length):$?(W.path=$[1],W.offset=0):t=null}}break}case"remove_text":{var{path:ne,offset:le,text:Q}=n;if(Q.length===0)break;var pe=oe.leaf(e,ne),he=pe.text.slice(0,le),ye=pe.text.slice(le+Q.length);if(pe.text=he+ye,t)for(var[Fe,Ae]of K.points(t))t[Ae]=Ee.transform(Fe,n);break}case"set_node":{var{path:He,properties:Se,newProperties:Te}=n;if(He.length===0)throw new Error("Cannot set properties on the root node!");var Ne=oe.get(e,He);for(var ke in Te){if(ke==="children"||ke==="text")throw new Error('Cannot set the "'.concat(ke,'" property of nodes!'));var Ue=Te[ke];Ue==null?delete Ne[ke]:Ne[ke]=Ue}for(var ge in Se)Te.hasOwnProperty(ge)||delete Ne[ge];break}case"set_selection":{var{newProperties:H}=n;if(H==null)t=H;else{if(t==null){if(!K.isRange(H))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Xe.stringify(H)," when there is no current selection."));t=fr({},H)}for(var ie in H){var me=H[ie];if(me==null){if(ie==="anchor"||ie==="focus")throw new Error('Cannot remove the "'.concat(ie,'" selection property'));delete t[ie]}else t[ie]=me}}break}case"split_node":{var{path:ve,position:we,properties:Ke}=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 Qe=oe.get(e,ve),mt=oe.parent(e,ve),zt=ve[ve.length-1],_t;if(fe.isText(Qe)){var et=Qe.text.slice(0,we),Tt=Qe.text.slice(we);Qe.text=et,_t=fr(fr({},Ke),{},{text:Tt})}else{var pt=Qe.children.slice(0,we),ii=Qe.children.slice(we);Qe.children=pt,_t=fr(fr({},Ke),{},{children:ii})}if(mt.children.splice(zt+1,0,_t),t)for(var[or,Wr]of K.points(t))t[Wr]=Ee.transform(or,n);break}}return t},Op={transform(e,t){e.children=su(e.children);var n=e.selection&&su(e.selection);try{n=jp(e,n,t)}finally{e.children=ou(e.children),n?e.selection=En(n)?ou(n):n:e.selection=null}}},Pp={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)}},Np={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)}},Bd=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(tt(r)&&tt(a)){if(!Bd(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 Rp(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 Zt(e,t){if(e==null)return{};var n=Rp(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 Mp=["anchor","focus"];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 Ip(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 K={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return K.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=K.edges(e);return t},equals(e,t){return Ee.equals(e.anchor,t.anchor)&&Ee.equals(e.focus,t.focus)},includes(e,t){if(K.isRange(t)){if(K.includes(e,t.anchor)||K.includes(e,t.focus))return!0;var[n,r]=K.edges(e),[a,i]=K.edges(t);return Ee.isBefore(n,a)&&Ee.isAfter(r,i)}var[s,o]=K.edges(e),l=!1,u=!1;return Ee.isPoint(t)?(l=Ee.compare(t,s)>=0,u=Ee.compare(t,o)<=0):(l=P.compare(t,s.path)>=0,u=P.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=Zt(e,Mp),[r,a]=K.edges(e),[i,s]=K.edges(t),o=Ee.isBefore(r,i)?i:r,l=Ee.isBefore(a,s)?a:s;return Ee.isBefore(l,o)?null:Ip({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!K.isCollapsed(e)},isForward(e){return!K.isBackward(e)},isRange(e){return tt(e)&&Ee.isPoint(e.anchor)&&Ee.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=K.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return no(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=K.isCollapsed(r);K.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?K.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})}},hu=e=>tt(e)&&oe.isNodeList(e.children)&&!b.isEditor(e),de={isAncestor(e){return tt(e)&&oe.isNodeList(e.children)},isElement:hu,isElementList(e){return Array.isArray(e)&&e.every(t=>de.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 hu(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},$p=["children"],Lp=["text"],mu=new WeakMap,oe={ancestor(e,t){var n=oe.get(e,t);if(fe.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(Xe.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.ancestors(t,n)){var a=oe.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(fe.isText(e))throw new Error("Cannot get the child of a text node: ".concat(Xe.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Xe.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=P.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(Xe.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))de.isElement(n)&&(yield[n,r])}()},extractProps(e){if(de.isAncestor(e)){var t=Zt(e,$p);return t}else{var t=Zt(e,Lp);return t}},first(e,t){for(var n=t.slice(),r=oe.get(e,n);r&&!(fe.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(fe.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(Xe.stringify(e)));var n=no({children:e.children},r=>{var[a,i]=K.edges(t),s=oe.nodes(r,{reverse:!0,pass:p=>{var[,m]=p;return!K.includes(t,m)}});for(var[,o]of s){if(!K.includes(t,o)){var l=oe.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(P.equals(o,i.path)){var c=oe.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(P.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(fe.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Xe.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(fe.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return fe.isText(e)||de.isElement(e)||b.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=mu.get(e);if(t!==void 0)return t;var n=e.every(r=>oe.isNode(r));return mu.set(e,n),n},last(e,t){for(var n=t.slice(),r=oe.get(e,n);r&&!(fe.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(!fe.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(Xe.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.levels(t,n)){var a=oe.get(e,r);yield[a,r]}}()},matches(e,t){return de.isElement(e)&&de.isElementProps(t)&&de.matches(e,t)||fe.isText(e)&&fe.isTextProps(t)&&fe.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?P.isBefore(o,i):P.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!fe.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;P.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=P.next(o);if(oe.has(e,c)){o=c,l=oe.get(e,o);continue}}if(r&&o[o.length-1]!==0){var h=P.previous(o);o=h,l=oe.get(e,o);continue}o=P.parent(o),l=oe.get(e,o),s.add(l)}}()},parent(e,t){var n=P.parent(t),r=oe.get(e,n);if(fe.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 fe.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))fe.isText(n)&&(yield[n,r])}()}};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 qe(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 rn={isNodeOperation(e){return rn.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!tt(e))return!1;switch(e.type){case"insert_node":return P.isPath(e.path)&&oe.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"merge_node":return typeof e.position=="number"&&P.isPath(e.path)&&tt(e.properties);case"move_node":return P.isPath(e.path)&&P.isPath(e.newPath);case"remove_node":return P.isPath(e.path)&&oe.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"set_node":return P.isPath(e.path)&&tt(e.properties)&&tt(e.newProperties);case"set_selection":return e.properties===null&&K.isRange(e.newProperties)||e.newProperties===null&&K.isRange(e.properties)||tt(e.properties)&&tt(e.newProperties);case"split_node":return P.isPath(e.path)&&typeof e.position=="number"&&tt(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>rn.isOperation(t))},isSelectionOperation(e){return rn.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return rn.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return qe(qe({},e),{},{type:"remove_node"});case"insert_text":return qe(qe({},e),{},{type:"remove_text"});case"merge_node":return qe(qe({},e),{},{type:"split_node",path:P.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(P.equals(t,n))return e;if(P.isSibling(n,t))return qe(qe({},e),{},{path:t,newPath:n});var r=P.transform(n,e),a=P.transform(P.next(n),e);return qe(qe({},e),{},{path:r,newPath:a})}case"remove_node":return qe(qe({},e),{},{type:"insert_node"});case"remove_text":return qe(qe({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return qe(qe({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?qe(qe({},e),{},{properties:l,newProperties:null}):l==null?qe(qe({},e),{},{properties:null,newProperties:o}):qe(qe({},e),{},{properties:l,newProperties:o})}case"split_node":return qe(qe({},e),{},{type:"merge_node",path:P.next(e.path)})}}},gu=new WeakMap,zp=e=>{var t=gu.get(e);if(t!==void 0)return t;if(!tt(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||tt(e.marks))&&(e.selection===null||K.isRange(e.selection))&&oe.isNodeList(e.children)&&rn.isOperationList(e.operations);return gu.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 zp(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)}},qp={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(P.isPath)}};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 bu(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 Ee={compare(e,t){var n=P.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&&P.equals(e.path,t.path)},isPoint(e){return tt(e)&&typeof e.offset=="number"&&P.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return no(e,r=>{if(r===null)return null;var{affinity:a="forward"}=n,{path:i,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=P.transform(i,t,n);break}case"insert_text":{P.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{P.equals(t.path,i)&&(r.offset+=t.position),r.path=P.transform(i,t,n);break}case"remove_text":{P.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(P.equals(t.path,i)||P.isAncestor(t.path,i))return null;r.path=P.transform(i,t,n);break}case"split_node":{if(P.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=P.transform(i,t,bu(bu({},n),{},{affinity:"forward"})))}else r.path=P.transform(i,t,n);break}}})}},yu=void 0,Xe={setScrubber(e){yu=e},stringify(e){return JSON.stringify(e,yu)}},Wp=["text"],Hp=["anchor","focus"];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 Wt(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 fe={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Zt(i,Wp);return s}return Bd(r?a(e):e,r?a(t):t)},isText(e){return tt(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>fe.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=[Wt({},e)];for(var r of t){var a=Zt(r,Hp),[i,s]=K.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var h of n){var{length:p}=h.text,m=l;if(l+=p,u<=m&&l<=c){Object.assign(h,a),o.push(h);continue}if(u!==c&&(u===l||c===m)||u>l||c<m||c===m&&m!==0){o.push(h);continue}var g=h,f=void 0,D=void 0;if(c<l){var v=c-m;D=Wt(Wt({},g),{},{text:g.text.slice(v)}),g=Wt(Wt({},g),{},{text:g.text.slice(0,v)})}if(u>m){var E=u-m;f=Wt(Wt({},g),{},{text:g.text.slice(0,E)}),g=Wt(Wt({},g),{},{text:g.text.slice(E)})}Object.assign(g,a),f&&o.push(f),o.push(g),D&&o.push(D)}n=o}return n}},ro=e=>e.selection?e.selection:e.children.length>0?b.end(e,[]):[0],ir=(e,t)=>{var[n]=b.node(e,t);return r=>r===n},ao=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?Gp(t):t,i=xe.None,s=xe.None,o=0,l=null,u=null;for(var c of a){var h=c.codePointAt(0);if(!h)break;var p=ug(c,h);if([i,s]=r?[s,p]:[p,i],zn(i,xe.ZWJ)&&zn(s,xe.ExtPict)&&(r?l=Cu(t.substring(0,o)):l=Cu(t.substring(0,t.length-o)),!l)||zn(i,xe.RI)&&zn(s,xe.RI)&&(u!==null?u=!u:r?u=!0:u=hg(t.substring(0,t.length-o)),!u)||i!==xe.None&&s!==xe.None&&cg(i,s))break;o+=c.length}return o||1},Up=/\s/,Vp=/[\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]/,Kp=/['\u2018\u2019]/,Zp=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=ao(t,n),[s,o]=io(t,i,n);if(Yp(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},io=(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)]},Yp=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(Up.test(t))return!1;if(Kp.test(t)){var a=ao(n,r),[i,s]=io(n,a,r);if(e(i,s,r))return!0}return!Vp.test(t)},Gp=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(Jp(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(Qp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},Qp=e=>e>=55296&&e<=56319,Jp=e=>e>=56320&&e<=57343,xe;(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"})(xe||(xe={}));var Xp=/^(?:[\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])$/,eg=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,tg=/^(?:[\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])$/,ng=/^[\u1100-\u115F\uA960-\uA97C]$/,rg=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,ag=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,ig=/^[\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]$/,sg=/^[\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]$/,og=/^(?:[\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])$/,ug=(e,t)=>{var n=xe.Any;return e.search(Xp)!==-1&&(n|=xe.Extend),t===8205&&(n|=xe.ZWJ),t>=127462&&t<=127487&&(n|=xe.RI),e.search(eg)!==-1&&(n|=xe.Prepend),e.search(tg)!==-1&&(n|=xe.SpacingMark),e.search(ng)!==-1&&(n|=xe.L),e.search(rg)!==-1&&(n|=xe.V),e.search(ag)!==-1&&(n|=xe.T),e.search(ig)!==-1&&(n|=xe.LV),e.search(sg)!==-1&&(n|=xe.LVT),e.search(og)!==-1&&(n|=xe.ExtPict),n};function zn(e,t){return(e&t)!==0}var lg=[[xe.L,xe.L|xe.V|xe.LV|xe.LVT],[xe.LV|xe.V,xe.V|xe.T],[xe.LVT|xe.T,xe.T],[xe.Any,xe.Extend|xe.ZWJ],[xe.Any,xe.SpacingMark],[xe.Prepend,xe.Any],[xe.ZWJ,xe.ExtPict],[xe.RI,xe.RI]];function cg(e,t){return lg.findIndex(n=>zn(e,n[0])&&zn(t,n[1]))===-1}var dg=/(?:[\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$/,Cu=e=>e.search(dg)!==-1,fg=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,hg=e=>{var t=e.match(fg);if(t===null)return!1;var n=t[0].length/2;return n%2===1},mg={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=ro(e)}=n;if(P.isPath(a)&&(a=b.range(e,a)),K.isRange(a))if(K.isCollapsed(a))a=a.anchor;else{var i=K.end(a);if(!r&&b.void(e,{at:i}))return;var s=K.start(a),o=b.pointRef(e,s),l=b.pointRef(e,i);X.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,X.setSelection(e,{anchor:a,focus:a})}if(!(!r&&b.void(e,{at:a})||b.elementReadOnly(e,{at:a}))){var{path:h,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:h,offset:p,text:t})}})}};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 Gr(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 X=Gr(Gr(Gr(Gr({},Op),Pp),Np),mg),ma=new WeakMap,pg=e=>ma.get(e)||!1,gg=(e,t,n)=>{var r=ma.get(e)||!1;ma.set(e,!0);try{t(),n()}finally{ma.set(e,r)}};function Fd(e,t,n){var r=Ba.get(e)||[],a=Fa.get(e)||new Set,i,s,o=h=>{if(h){var p=h.join(",");s.has(p)||(s.add(p),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);Ba.set(e,i),Fa.set(e,s)}var vg=(e,t)=>{for(var n of b.pathRefs(e))Bp.transform(n,t);for(var r of b.pointRefs(e))Fp.transform(r,t);for(var a of b.rangeRefs(e))Ap.transform(a,t);if(!pg(e)){var i=P.operationCanTransformPath(t)?s=>P.transform(s,t):void 0;Fd(e,e.getDirtyPaths(t),i)}X.transform(e,t),e.operations.push(t),b.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),yr.get(e)||(yr.set(e,!0),Promise.resolve().then(()=>{yr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},bg=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return P.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=P.levels(a),s=fe.isText(r)?[]:Array.from(oe.nodes(r),I=>{var[,z]=I;return a.concat(z)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=P.ancestors(o),u=P.previous(o);return[...l,u]}case"move_node":{var{path:c,newPath:h}=t;if(P.equals(c,h))return[];var p=[],m=[];for(var g of P.ancestors(c)){var f=P.transform(g,t);p.push(f)}for(var D of P.ancestors(h)){var v=P.transform(D,t);m.push(v)}var E=m[m.length-1],B=h[h.length-1],x=E.concat(B);return[...p,...m,x]}case"remove_node":{var{path:k}=t,T=P.ancestors(k);return[...T]}case"split_node":{var{path:S}=t,q=P.levels(S),N=P.next(S);return[...q,N]}default:return[]}},yg=e=>{var{selection:t}=e;return t?oe.fragment(e,t):[]},Dg=(e,t)=>{var[n,r]=t;if(!fe.isText(n)){if(de.isElement(n)&&n.children.length===0){var a={text:""};X.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=b.isEditor(n)?!1:de.isElement(n)&&(e.isInline(n)||n.children.length===0||fe.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(!fe.isText(l)){var u=l.children[s],c=l.children[s-1],h=o===n.children.length-1,p=fe.isText(u)||de.isElement(u)&&e.isInline(u);if(p!==i)X.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(de.isElement(u)){if(e.isInline(u)){if(c==null||!fe.isText(c)){var m={text:""};X.insertNodes(e,m,{at:r.concat(s),voids:!0}),s++}else if(h){var g={text:""};X.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&fe.isText(c)&&(fe.equals(u,c,{loose:!0})?(X.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(X.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(X.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Cg=(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},xg=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(!fe.isText(u)){if(K.isRange(i)){if(P.isAncestor(c,i.anchor.path)&&P.isAncestor(c,i.focus.path))return[u,c]}else if(!P.equals(o,c))return[u,c]}}};function wu(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 Eu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?wu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var wg=(e,t,n)=>{var{selection:r}=e;if(r){var a=(h,p)=>{if(!fe.isText(h))return!1;var[m,g]=b.parent(e,p);return!e.isVoid(m)||e.markableVoid(m)},i=K.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)X.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=Eu(Eu({},b.marks(e)||{}),{},{[t]:n});e.marks=c,yr.get(e)||e.onChange()}}};function ku(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 _u(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ku(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ku(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,_u(_u({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};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 Fu(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 kg=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,Fu(Fu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},_g=(e,t)=>{var{selection:n}=e;n&&K.isCollapsed(n)&&X.delete(e,{unit:t,reverse:!0})},Bg=(e,t)=>{var{selection:n}=e;n&&K.isCollapsed(n)&&X.delete(e,{unit:t})},Fg=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&K.isExpanded(r)&&X.delete(t,{reverse:n==="backward"})},Ag=(e,t)=>[b.start(e,t),b.end(e,t)];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 Tu(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 Tg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,Tu(Tu({},n),{},{match:r=>de.isElement(r)&&b.isElementReadOnly(t,r)}))},Sg=(e,t)=>b.point(e,t,{edge:"end"}),jg=(e,t)=>{var n=b.path(e,t,{edge:"start"});return b.node(e,n)},Og=(e,t)=>{var n=b.range(e,t);return oe.fragment(e,n)};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 ju(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 Pg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,ju(ju({},n),{},{match:r=>de.isElement(r)&&b.isVoid(t,r)}))},Ng=(e,t)=>t.children.some(n=>de.isElement(n)&&b.isBlock(e,n)),Rg=(e,t)=>t.children.some(n=>fe.isText(n)||b.isInline(e,n)),Mg=(e,t)=>oe.has(e,t),Ig=(e,t)=>t.children.every(n=>fe.isText(n)),$g=e=>{X.splitNodes(e,{always:!0})},Lg=(e,t,n)=>{X.insertNodes(e,t,n)},zg=e=>{X.splitNodes(e,{always:!0})};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 qg(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 Wg=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=qg({text:n},i);X.insertNodes(t,s,{at:r.at,voids:r.voids})}else X.insertText(t,n,r);t.marks=null}},Hg=(e,t)=>!e.isInline(t),Ug=(e,t,n)=>b.isStart(e,t,n)||b.isEnd(e,t,n),Vg=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&fe.isText(r)&&r.text===""&&!e.isVoid(t)},Kg=(e,t,n)=>{var r=b.end(e,n);return Ee.equals(t,r)},Zg=e=>{var t=_d.get(e);return t===void 0?!0:t},Yg=(e,t,n)=>{if(t.offset!==0)return!1;var r=b.start(e,n);return Ee.equals(t,r)},Gg=(e,t)=>{var n=b.path(e,t,{edge:"end"});return b.node(e,n)},Qg=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 Jg(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&&de.isElement(l)&&b.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var Xg=["text"],ev=["text"],tv=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(K.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:fe.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=Zt(u,Xg);return c}else return{}}var{path:h}=a,[p]=b.leaf(t,h);if(a.offset===0){var m=b.previous(t,{at:h,match:fe.isText}),g=b.above(t,{match:x=>de.isElement(x)&&b.isVoid(t,x)&&t.markableVoid(x)});if(!g){var f=b.above(t,{match:x=>de.isElement(x)&&b.isBlock(t,x)});if(m&&f){var[D,v]=m,[,E]=f;P.isAncestor(E,v)&&(p=D)}}}var B=Zt(p,ev);return B},nv=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(P.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(P.isPath(s)){var[c]=b.parent(t,s);i=p=>c.children.includes(p)}else i=()=>!0;var[h]=b.nodes(t,{at:u,match:i,mode:r,voids:a});return h}}},rv=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 av(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(qp.isSpan(n))u=n[0],c=n[1];else{var h=b.path(e,n,{edge:"start"}),p=b.path(e,n,{edge:"end"});u=i?p:h,c=i?h:p}var m=oe.nodes(e,{reverse:i,from:u,to:c,pass:x=>{var[k]=x;return de.isElement(k)?!!(!s&&(b.isVoid(e,k)||b.isElementReadOnly(e,k))||o&&!b.isSelectable(e,k)):!1}}),g=[],f;for(var[D,v]of m)if(!(o&&de.isElement(D)&&!b.isSelectable(e,D))){var E=f&&P.compare(v,f[1])===0;if(!(r==="highest"&&E)){if(!l(D,v)){if(a&&!E&&fe.isText(D))return;continue}if(r==="lowest"&&E){f=[D,v];continue}var B=r==="lowest"?f:[D,v];B&&(a?g.push(B):yield B),f=[D,v]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var iv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>Ba.get(c)||[],s=c=>Fa.get(c)||new Set,o=c=>{var h=i(c).pop(),p=h.join(",");return s(c).delete(p),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(",")));Ba.set(t,l),Fa.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),[p,m]=h;de.isElement(p)&&p.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 v=o(t);if(oe.has(t,v)){var E=b.node(t,v);t.normalizeNode(E,{operation:a})}D++,g=i(t)}})}},sv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=P.parent(a),s=b.node(t,i);return s},ov=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},uv=e=>{var t=uu.get(e);return t||(t=new Set,uu.set(e,t)),t},lv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(P.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 K.isRange(n)&&(i==="start"?n=K.start(n):i==="end"?n=K.end(n):n=P.common(n.anchor.path,n.focus.path)),Ee.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},cv=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},dv=e=>{var t=lu.get(e);return t||(t=new Set,lu.set(e,t)),t},fv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(P.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(!fe.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(K.isRange(n)){var[u,c]=K.edges(n);return a==="start"?u:c}return n};function hv(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]=K.edges(o),c=a?u:l,h=!1,p="",m=0,g=0,f=0;for(var[D,v]of b.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(D)){if(!i&&(e.isVoid(D)||e.isElementReadOnly(D))){yield b.start(e,v);continue}if(e.isInline(D))continue;if(b.hasInlines(e,D)){var E=P.isAncestor(v,u.path)?u:b.end(e,v),B=P.isAncestor(v,l.path)?l:b.start(e,v);p=b.string(e,{anchor:B,focus:E},{voids:i}),h=!0}}if(fe.isText(D)){var x=P.equals(v,c.path);for(x?(g=a?c.offset:D.text.length-c.offset,f=c.offset):(g=D.text.length,f=a?g:0),(x||h||r==="offset")&&(yield{path:v,offset:f},h=!1);;){if(m===0){if(p==="")break;m=k(p,r,a),p=io(p,m,a)[1]}if(f=a?f-m:f+m,g=g-m,g<0){m=-g;break}m=0,yield{path:v,offset:f}}}}function k(T,S,q){return S==="character"?ao(T,q):S==="word"?Zp(T,q):S==="line"||S==="block"?T.length:1}}()}var mv=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(P.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(P.isPath(s)){var[c]=b.parent(t,s);i=p=>c.children.includes(p)}else i=()=>!0;var[h]=b.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return h}}},pv=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},gv=e=>{var t=cu.get(e);return t||(t=new Set,cu.set(e,t)),t},vv=(e,t,n)=>{if(K.isRange(t)&&!n)return t;var r=b.start(e,t),a=b.end(e,n||t);return{anchor:r,focus:a}};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 bv(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 yv=(e,t)=>{var{selection:n}=e;if(n){var r=(c,h)=>{if(!fe.isText(c))return!1;var[p,m]=b.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},a=K.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)X.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=bv({},b.marks(e)||{});delete u[t],e.marks=u,yr.get(e)||e.onChange()}}},Dv=(e,t)=>{_d.set(e,t)},Cv=(e,t)=>b.point(e,t,{edge:"start"}),xv=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]=K.edges(i),l="";for(var[u,c]of b.nodes(t,{at:i,match:fe.isText,voids:a})){var h=u.text;P.equals(c,o.path)&&(h=h.slice(0,o.offset)),P.equals(c,s.path)&&(h=h.slice(s.offset)),l+=h}return l},wv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=K.edges(n);if(i.offset!==0||s.offset!==0||K.isCollapsed(n)||P.hasPrevious(s.path))return n;var o=b.above(t,{at:s,match:g=>de.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[p,m]of b.nodes(t,{at:c,match:fe.isText,reverse:!0,voids:a})){if(h){h=!1;continue}if(p.text!==""||P.isBefore(m,l)){s={path:m,offset:p.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)},kv=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(K.isRange(u)&&K.isCollapsed(u)&&(h=!0,u=u.anchor),Ee.isPoint(u)){var p=b.void(t,{at:u,mode:"highest"});if(!l&&p){var[,m]=p;u=m}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(P.isPath(u)){X.removeNodes(t,{at:u,voids:l});return}if(!K.isCollapsed(u)){if(!c){var[,D]=K.edges(u),v=b.end(t,[]);Ee.equals(D,v)||(u=b.unhangRange(t,u,{voids:l}))}var[E,B]=K.edges(u),x=b.above(t,{match:he=>de.isElement(he)&&b.isBlock(t,he),at:E,voids:l}),k=b.above(t,{match:he=>de.isElement(he)&&b.isBlock(t,he),at:B,voids:l}),T=x&&k&&!P.equals(x[1],k[1]),S=P.equals(E.path,B.path),q=l?null:(r=b.void(t,{at:E,mode:"highest"}))!==null&&r!==void 0?r:b.elementReadOnly(t,{at:E,mode:"highest"}),N=l?null:(a=b.void(t,{at:B,mode:"highest"}))!==null&&a!==void 0?a:b.elementReadOnly(t,{at:B,mode:"highest"});if(q){var I=b.before(t,E);I&&x&&P.isAncestor(x[1],I.path)&&(E=I)}if(N){var z=b.after(t,B);z&&k&&P.isAncestor(k[1],z.path)&&(B=z)}var w=[],F;for(var j of b.nodes(t,{at:u,voids:l})){var[M,V]=j;F&&P.compare(V,F)===0||(!l&&de.isElement(M)&&(b.isVoid(t,M)||b.isElementReadOnly(t,M))||!P.isCommon(V,E.path)&&!P.isCommon(V,B.path))&&(w.push(j),F=V)}var G=Array.from(w,he=>{var[,ye]=he;return b.pathRef(t,ye)}),J=b.pointRef(t,E),ae=b.pointRef(t,B),C="";if(!S&&!q){var R=J.current,[W]=b.leaf(t,R),{path:_}=R,{offset:A}=E,L=W.text.slice(A);L.length>0&&(t.apply({type:"remove_text",path:_,offset:A,text:L}),C=L)}if(G.reverse().map(he=>he.unref()).filter(he=>he!==null).forEach(he=>X.removeNodes(t,{at:he,voids:l})),!N){var $=ae.current,[U]=b.leaf(t,$),{path:re}=$,te=S?E.offset:0,ne=U.text.slice(te,B.offset);ne.length>0&&(t.apply({type:"remove_text",path:re,offset:te,text:ne}),C=ne)}!S&&T&&ae.current&&J.current&&X.mergeNodes(t,{at:ae.current,hanging:!0,voids:l}),h&&i&&s==="character"&&C.length>1&&C.match(/[\u0E00-\u0E7F]+/)&&X.insertText(t,C.slice(0,C.length-o));var le=J.unref(),Q=ae.unref(),pe=i?le||Q:Q||le;n.at==null&&pe&&X.select(t,pe)}}})},_v=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=ro(t),batchDirty:o=!0}=r;if(n.length){if(K.isRange(s))if(a||(s=b.unhangRange(t,s,{voids:i})),K.isCollapsed(s))s=s.anchor;else{var[,l]=K.edges(s);if(!i&&b.void(t,{at:l}))return;var u=b.pointRef(t,l);X.delete(t,{at:s}),s=u.unref()}else P.isPath(s)&&(s=b.start(t,s));if(!(!i&&b.void(t,{at:s}))){var c=b.above(t,{at:s,match:L=>de.isElement(L)&&b.isInline(t,L),mode:"highest",voids:i});if(c){var[,h]=c;if(b.isEnd(t,s,h)){var p=b.after(t,h);s=p}else if(b.isStart(t,s,h)){var m=b.before(t,h);s=m}}var g=b.above(t,{match:L=>de.isElement(L)&&b.isBlock(t,L),at:s,voids:i}),[,f]=g,D=b.isStart(t,s,f),v=b.isEnd(t,s,f),E=D&&v,B=!D||D&&v,x=!v,[,k]=oe.first({children:n},[]),[,T]=oe.last({children:n},[]),S=[],q=L=>{var[$,U]=L,re=U.length===0;return re?!1:E?!0:!(B&&P.isAncestor(U,k)&&de.isElement($)&&!t.isVoid($)&&!t.isInline($)||x&&P.isAncestor(U,T)&&de.isElement($)&&!t.isVoid($)&&!t.isInline($))};for(var N of oe.nodes({children:n},{pass:q}))q(N)&&S.push(N);var I=[],z=[],w=[],F=!0,j=!1;for(var[M]of S)de.isElement(M)&&!t.isInline(M)?(F=!1,j=!0,z.push(M)):F?I.push(M):w.push(M);var[V]=b.nodes(t,{at:s,match:L=>fe.isText(L)||b.isInline(t,L),mode:"highest",voids:i}),[,G]=V,J=b.isStart(t,s,G),ae=b.isEnd(t,s,G),C=b.pathRef(t,v&&!w.length?P.next(f):f),R=b.pathRef(t,ae?P.next(G):G);X.splitNodes(t,{at:s,match:L=>j?de.isElement(L)&&b.isBlock(t,L):fe.isText(L)||b.isInline(t,L),mode:j?"lowest":"highest",always:j&&(!D||I.length>0)&&(!v||w.length>0),voids:i});var W=b.pathRef(t,!J||J&&ae?P.next(G):G);if(X.insertNodes(t,I,{at:W.current,match:L=>fe.isText(L)||b.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),E&&!I.length&&z.length&&!w.length&&X.delete(t,{at:f,voids:i}),X.insertNodes(t,z,{at:C.current,match:L=>de.isElement(L)&&b.isBlock(t,L),mode:"lowest",voids:i,batchDirty:o}),X.insertNodes(t,w,{at:R.current,match:L=>fe.isText(L)||b.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),!r.at){var _;if(w.length>0&&R.current?_=P.previous(R.current):z.length>0&&C.current?_=P.previous(C.current):W.current&&(_=P.previous(W.current)),_){var A=b.end(t,_);X.select(t,A)}}W.unref(),C.unref(),R.unref()}}})},Bv=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")X.select(t,a.anchor);else if(r==="focus")X.select(t,a.focus);else if(r==="start"){var[i]=K.edges(a);X.select(t,i)}else if(r==="end"){var[,s]=K.edges(a);X.select(t,s)}}else return},Fv=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},Av=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=K.isBackward(r)?"focus":"anchor"),o==="end"&&(o=K.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,c={distance:a,unit:i,ignoreNonSelectable:!0},h={};if(o==null||o==="anchor"){var p=s?b.before(t,l,c):b.after(t,l,c);p&&(h.anchor=p)}if(o==null||o==="focus"){var m=s?b.before(t,u,c):b.after(t,u,c);m&&(h.focus=m)}X.setSelection(t,h)}},Tv=(e,t)=>{var{selection:n}=e;if(t=b.range(e,t),n){X.setSelection(e,t);return}if(!K.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(Xe.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function Nu(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 Ru(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Sv=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=K.isBackward(a)?"focus":"anchor"),i==="end"&&(i=K.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;X.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Ru(Ru({},l),n)})}},jv=(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})}},Ov=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=ro(t),c!==!1&&(c=!0)),c==null&&(c=!1),K.isRange(l))if(a||(l=b.unhangRange(t,l,{voids:i})),K.isCollapsed(l))l=l.anchor;else{var[,p]=K.edges(l),m=b.pointRef(t,p);X.delete(t,{at:l}),l=m.unref()}if(Ee.isPoint(l)){u==null&&(fe.isText(h)?u=I=>fe.isText(I):t.isInline(h)?u=I=>fe.isText(I)||b.isInline(t,I):u=I=>de.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),v=b.isEnd(t,l,f);X.splitNodes(t,{at:l,match:u,mode:s,voids:i});var E=D.unref();l=v?P.next(E):E}else return}var B=P.parent(l),x=l[l.length-1];if(!(!i&&b.void(t,{at:B}))){if(o){var k=[],T=P.levels(B);gg(t,()=>{var I=function(){var F=B.concat(x);x++;var j={type:"insert_node",path:F,node:z};t.apply(j),l=P.next(l),k.push(j),fe.isText?T.push(...Array.from(oe.nodes(z),M=>{var[,V]=M;return F.concat(V)})):T.push(F)};for(var z of n)I()},()=>{Fd(t,T,I=>{var z=I;for(var w of k)if(P.operationCanTransformPath(w)&&(z=P.transform(z,w),!z))return null;return z})})}else for(var S of n){var q=B.concat(x);x++,t.apply({type:"insert_node",path:q,node:S}),l=P.next(l)}if(l=P.previous(l),c){var N=b.end(t,l);N&&X.select(t,N)}}}})},Pv=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=P.isPath(r)?ir(t,r):x=>de.isElement(x)&&b.isBlock(t,x)),!!r){var o=b.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,x=>{var[,k]=x;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,P.parent(c)),[p,m]=h,g=c[c.length-1],{length:f}=p.children;if(f===1){var D=P.next(m);X.moveNodes(t,{at:c,to:D,voids:i}),X.removeNodes(t,{at:m,voids:i})}else if(g===0)X.moveNodes(t,{at:c,to:m,voids:i});else if(g===f-1){var v=P.next(m);X.moveNodes(t,{at:c,to:v,voids:i})}else{var E=P.next(c),B=P.next(m);X.splitNodes(t,{at:E,voids:i}),X.moveNodes(t,{at:c,to:B,voids:i})}}}})},Nv=["text"],Rv=["children"],Ad=(e,t)=>{if(de.isElement(t)){var n=t;return b.isVoid(e,t)?!0:n.children.length===1?Ad(e,n.children[0]):!1}else return!b.isEditor(t)},Mv=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(P.isPath(a)){var[l]=b.parent(t,a);r=I=>l.children.includes(I)}else r=I=>de.isElement(I)&&b.isBlock(t,I);if(!i&&K.isRange(a)&&(a=b.unhangRange(t,a,{voids:s})),K.isRange(a))if(K.isCollapsed(a))a=a.anchor;else{var[,u]=K.edges(a),c=b.pointRef(t,u);X.delete(t,{at:a}),a=c.unref(),n.at==null&&X.select(t,a)}var[h]=b.nodes(t,{at:a,match:r,voids:s,mode:o}),p=b.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!h||!p)){var[m,g]=h,[f,D]=p;if(!(g.length===0||D.length===0)){var v=P.next(D),E=P.common(g,D),B=P.isSibling(g,D),x=Array.from(b.levels(t,{at:g}),I=>{var[z]=I;return z}).slice(E.length).slice(0,-1),k=b.above(t,{at:g,mode:"highest",match:I=>x.includes(I)&&Ad(t,I)}),T=k&&b.pathRef(t,k[1]),S,q;if(fe.isText(m)&&fe.isText(f)){var N=Zt(m,Nv);q=f.text.length,S=N}else if(de.isElement(m)&&de.isElement(f)){var N=Zt(m,Rv);q=f.children.length,S=N}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(Xe.stringify(m)," ").concat(Xe.stringify(f)));B||X.moveNodes(t,{at:g,to:v,voids:s}),T&&X.removeNodes(t,{at:T.current,voids:s}),de.isElement(f)&&b.isEmpty(t,f)||fe.isText(f)&&f.text===""&&D[D.length-1]!==0?X.removeNodes(t,{at:D,voids:s}):t.apply({type:"merge_node",path:v,position:q,properties:S}),T&&T.unref()}}}})},Iv=(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=P.isPath(r)?ir(e,r):m=>de.isElement(m)&&b.isBlock(e,m));var o=b.pathRef(e,n),l=b.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,m=>{var[,g]=m;return b.pathRef(e,g)});for(var c of u){var h=c.unref(),p=o.current;h.length!==0&&e.apply({type:"move_node",path:h,newPath:p}),o.current&&P.isSibling(p,h)&&P.isAfter(p,h)&&(o.current=P.next(o.current))}o.unref()}})},$v=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=P.isPath(s)?ir(t,s):m=>de.isElement(m)&&b.isBlock(t,m)),!r&&K.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,m=>{var[,g]=m;return b.pathRef(t,g)});for(var c of u){var h=c.unref();if(h){var[p]=b.node(t,h);t.apply({type:"remove_node",path:h,node:p})}}}})},Lv=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=P.isPath(i)?ir(t,i):q=>de.isElement(q)&&b.isBlock(t,q)),!l&&K.isRange(i)&&(i=b.unhangRange(t,i,{voids:h})),c&&K.isRange(i)){if(K.isCollapsed(i)&&b.leaf(t,i.anchor)[0].text.length>0)return;var p=b.rangeRef(t,i,{affinity:"inward"}),[m,g]=K.edges(i),f=u==="lowest"?"lowest":"highest",D=b.isEnd(t,g,g.path);X.splitNodes(t,{at:g,match:a,mode:f,voids:h,always:!D});var v=b.isStart(t,m,m.path);X.splitNodes(t,{at:m,match:a,mode:f,voids:h,always:!v}),i=p.unref(),r.at==null&&X.select(t,i)}s||(s=(q,N)=>q!==N);for(var[E,B]of b.nodes(t,{at:i,match:a,mode:u,voids:h})){var x={},k={};if(B.length!==0){var T=!1;for(var S in n)S==="children"||S==="text"||s(n[S],E[S])&&(T=!0,E.hasOwnProperty(S)&&(x[S]=E[S]),o?n[S]!=null&&(k[S]=o(E[S],n[S])):n[S]!=null&&(k[S]=n[S]));T&&t.apply({type:"set_node",path:B,properties:x,newProperties:k})}}}})},zv=(e,t)=>{if(K.isCollapsed(t))return t.anchor;var[,n]=K.edges(t),r=b.pointRef(e,n);return X.delete(e,{at:t}),r.unref()},qv=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=ae=>de.isElement(ae)&&b.isBlock(t,ae)),K.isRange(s)&&(s=zv(t,s)),P.isPath(s)){var u=s,c=b.point(t,u),[h]=b.parent(t,u);i=ae=>ae===h,o=c.path.length-u.length+1,s=c,l=!0}if(s){var p=b.pointRef(t,s,{affinity:"backward"}),m;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[v,E]=f;if(de.isElement(v)&&t.isInline(v)){var B=b.after(t,E);if(!B){var x={text:""},k=P.next(E);X.insertNodes(t,x,{at:k,voids:a}),B=b.point(t,k)}s=B,l=!0}var T=s.path.length-E.length;o=T+1,l=!0}m=b.pointRef(t,s);var S=s.path.length-o,[,q]=g,N=s.path.slice(0,S),I=o===0?s.offset:s.path[S]+D;for(var[z,w]of b.levels(t,{at:N,reverse:!0,voids:a})){var F=!1;if(w.length<q.length||w.length===0||!a&&de.isElement(z)&&b.isVoid(t,z))break;var j=p.current,M=b.isEnd(t,j,w);if(l||!p||!b.isEdge(t,j,w)){F=!0;var V=oe.extractProps(z);t.apply({type:"split_node",path:w,position:I,properties:V})}I=w[w.length-1]+(F||M?1:0)}if(n.at==null){var G=m.current||b.end(t,[]);X.select(t,G)}}finally{var J;p.unref(),(J=m)===null||J===void 0||J.unref()}}})},Wv=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;X.setNodes(t,a,r)},Hv=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=P.isPath(s)?ir(t,s):m=>de.isElement(m)&&b.isBlock(t,m)),P.isPath(s)&&(s=b.range(t,s));var l=K.isRange(s)?b.rangeRef(t,s):null,u=b.nodes(t,{at:s,match:o,mode:r,voids:i}),c=Array.from(u,m=>{var[,g]=m;return b.pathRef(t,g)}).reverse(),h=function(){var g=p.unref(),[f]=b.node(t,g),D=b.range(t,g);a&&l&&(D=K.intersection(l.current,D)),X.liftNodes(t,{at:D,match:v=>de.isAncestor(f)&&f.children.includes(v),voids:i})};for(var p of c)h();l&&l.unref()}})};function Mu(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 Iu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Mu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Uv=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&&(P.isPath(l)?o=ir(t,l):t.isInline(n)?o=D=>de.isElement(D)&&b.isInline(t,D)||fe.isText(D):o=D=>de.isElement(D)&&b.isBlock(t,D)),i&&K.isRange(l)){var[u,c]=K.edges(l),h=b.rangeRef(t,l,{affinity:"inward"});X.splitNodes(t,{at:c,match:o,voids:s}),X.splitNodes(t,{at:u,match:o,voids:s}),l=h.unref(),r.at==null&&X.select(t,l)}var p=Array.from(b.nodes(t,{at:l,match:t.isInline(n)?D=>de.isElement(D)&&b.isBlock(t,D):D=>b.isEditor(D),mode:"lowest",voids:s})),m=function(){var v=K.isRange(l)?K.intersection(l,b.range(t,f)):l;if(!v)return 0;var E=Array.from(b.nodes(t,{at:v,match:o,mode:a,voids:s}));if(E.length>0){var[B]=E,x=E[E.length-1],[,k]=B,[,T]=x;if(k.length===0&&T.length===0)return 0;var S=P.equals(k,T)?P.parent(k):P.common(k,T),q=b.range(t,k,T),N=b.node(t,S),[I]=N,z=S.length+1,w=P.next(T.slice(0,z)),F=Iu(Iu({},n),{},{children:[]});X.insertNodes(t,F,{at:w,voids:s}),X.moveNodes(t,{at:q,match:j=>de.isAncestor(I)&&I.children.includes(j),to:w.concat(0),voids:s})}},g;for(var[,f]of p)g=m()}})},Vv=()=>{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 vg(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fg(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _v(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yv(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bg(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(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 kg(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bv(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kv(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fv(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tg(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sg(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tv(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ov(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hg(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ug(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kg(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zg(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yg(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gg(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pv(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mv(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Av(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Iv(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nv(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rv(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return av(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iv(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sv(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lv(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ov(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uv(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fv(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cv(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dv(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hv(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mv(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vv(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pv(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gv(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $v(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tv(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lv(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dv(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sv(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jv(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qv(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cv(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xv(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wv(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wv(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hv(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(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 Uv(e,...r)}};return e},Kv={isHistory(e){return tt(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||rn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||rn.isOperationList(e.undos[0].operations))}},yi=new WeakMap,Di=new WeakMap,qn={isHistoryEditor(e){return Kv.isHistory(e.history)&&b.isEditor(e)},isMerging(e){return Di.get(e)},isSaving(e){return yi.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=qn.isMerging(e);Di.set(e,!1),t(),Di.set(e,n)},withoutSaving(e,t){var n=qn.isSaving(e);yi.set(e,!1),t(),yi.set(e,n)}},Zv=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&&X.setSelection(t,i.selectionBefore),qn.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];qn.withoutSaving(t,()=>{b.withoutNormalizing(t,()=>{var s=i.operations.map(rn.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&X.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=qn.isSaving(t),c=qn.isMerging(t);if(u==null&&(u=Gv(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=Yv(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},Yv=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&P.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&P.equals(e.path,t.path)),Gv=(e,t)=>e.type!=="set_selection",Qv=e0,Td="֑-߿יִ-﷽ﹰ-ﻼ",Sd="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Jv=new RegExp("^[^"+Sd+"]*["+Td+"]"),Xv=new RegExp("^[^"+Td+"]*["+Sd+"]");function e0(e){return e=String(e||""),Jv.test(e)?"rtl":Xv.test(e)?"ltr":"neutral"}const jd=Fn(Qv);function t0(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var so=t0,n0=typeof Hr=="object"&&Hr&&Hr.Object===Object&&Hr,r0=n0,a0=r0,i0=typeof self=="object"&&self&&self.Object===Object&&self,s0=a0||i0||Function("return this")(),Od=s0,o0=Od,u0=function(){return o0.Date.now()},l0=u0,c0=/\s/;function d0(e){for(var t=e.length;t--&&c0.test(e.charAt(t)););return t}var f0=d0,h0=f0,m0=/^\s+/;function p0(e){return e&&e.slice(0,h0(e)+1).replace(m0,"")}var g0=p0,v0=Od,b0=v0.Symbol,Pd=b0,$u=Pd,Nd=Object.prototype,y0=Nd.hasOwnProperty,D0=Nd.toString,hr=$u?$u.toStringTag:void 0;function C0(e){var t=y0.call(e,hr),n=e[hr];try{e[hr]=void 0;var r=!0}catch{}var a=D0.call(e);return r&&(t?e[hr]=n:delete e[hr]),a}var x0=C0,w0=Object.prototype,E0=w0.toString;function k0(e){return E0.call(e)}var _0=k0,Lu=Pd,B0=x0,F0=_0,A0="[object Null]",T0="[object Undefined]",zu=Lu?Lu.toStringTag:void 0;function S0(e){return e==null?e===void 0?T0:A0:zu&&zu in Object(e)?B0(e):F0(e)}var j0=S0;function O0(e){return e!=null&&typeof e=="object"}var P0=O0,N0=j0,R0=P0,M0="[object Symbol]";function I0(e){return typeof e=="symbol"||R0(e)&&N0(e)==M0}var $0=I0,L0=g0,qu=so,z0=$0,Wu=0/0,q0=/^[-+]0x[0-9a-f]+$/i,W0=/^0b[01]+$/i,H0=/^0o[0-7]+$/i,U0=parseInt;function V0(e){if(typeof e=="number")return e;if(z0(e))return Wu;if(qu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=qu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=L0(e);var n=W0.test(e);return n||H0.test(e)?U0(e.slice(2),n?2:8):q0.test(e)?Wu:+e}var K0=V0,Z0=so,Ci=l0,Hu=K0,Y0="Expected a function",G0=Math.max,Q0=Math.min;function J0(e,t,n){var r,a,i,s,o,l,u=0,c=!1,h=!1,p=!0;if(typeof e!="function")throw new TypeError(Y0);t=Hu(t)||0,Z0(n)&&(c=!!n.leading,h="maxWait"in n,i=h?G0(Hu(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function m(T){var S=r,q=a;return r=a=void 0,u=T,s=e.apply(q,S),s}function g(T){return u=T,o=setTimeout(v,t),c?m(T):s}function f(T){var S=T-l,q=T-u,N=t-S;return h?Q0(N,i-q):N}function D(T){var S=T-l,q=T-u;return l===void 0||S>=t||S<0||h&&q>=i}function v(){var T=Ci();if(D(T))return E(T);o=setTimeout(v,f(T))}function E(T){return o=void 0,p&&r?m(T):(r=a=void 0,s)}function B(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function x(){return o===void 0?s:E(Ci())}function k(){var T=Ci(),S=D(T);if(r=arguments,a=this,l=T,S){if(o===void 0)return g(l);if(h)return clearTimeout(o),o=setTimeout(v,t),m(l)}return o===void 0&&(o=setTimeout(v,t)),s}return k.cancel=B,k.flush=x,k}var Rd=J0;const X0=Fn(Rd);var eb=Rd,tb=so,nb="Expected a function";function rb(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(nb);return tb(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),eb(e,t,{leading:r,maxWait:t,trailing:a})}var ab=rb;const ib=Fn(ab),Uu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Vu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",xi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Vu(n.overflowY,t)||Vu(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},Qr=(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,sb=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Ku=(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:V=>V!==u;if(!Uu(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,m=[];let g=e;for(;Uu(g)&&h(g);){if(g=sb(g),g===p){m.push(g);break}g!=null&&g===document.body&&xi(g)&&!xi(document.documentElement)||g!=null&&xi(g,c)&&m.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:v,scrollY:E}=window,{height:B,width:x,top:k,right:T,bottom:S,left:q}=e.getBoundingClientRect(),{top:N,right:I,bottom:z,left:w}=(V=>{const G=window.getComputedStyle(V);return{top:parseFloat(G.scrollMarginTop)||0,right:parseFloat(G.scrollMarginRight)||0,bottom:parseFloat(G.scrollMarginBottom)||0,left:parseFloat(G.scrollMarginLeft)||0}})(e);let F=o==="start"||o==="nearest"?k-N:o==="end"?S+z:k+B/2-N+z,j=l==="center"?q+x/2-w+I:l==="end"?T+I:q-w;const M=[];for(let V=0;V<m.length;V++){const G=m[V],{height:J,width:ae,top:C,right:R,bottom:W,left:_}=G.getBoundingClientRect();if(s==="if-needed"&&k>=0&&q>=0&&S<=D&&T<=f&&k>=C&&S<=W&&q>=_&&T<=R)return M;const A=getComputedStyle(G),L=parseInt(A.borderLeftWidth,10),$=parseInt(A.borderTopWidth,10),U=parseInt(A.borderRightWidth,10),re=parseInt(A.borderBottomWidth,10);let te=0,ne=0;const le="offsetWidth"in G?G.offsetWidth-G.clientWidth-L-U:0,Q="offsetHeight"in G?G.offsetHeight-G.clientHeight-$-re:0,pe="offsetWidth"in G?G.offsetWidth===0?0:ae/G.offsetWidth:0,he="offsetHeight"in G?G.offsetHeight===0?0:J/G.offsetHeight:0;if(p===G)te=o==="start"?F:o==="end"?F-D:o==="nearest"?Qr(E,E+D,D,$,re,E+F,E+F+B,B):F-D/2,ne=l==="start"?j:l==="center"?j-f/2:l==="end"?j-f:Qr(v,v+f,f,L,U,v+j,v+j+x,x),te=Math.max(0,te+E),ne=Math.max(0,ne+v);else{te=o==="start"?F-C-$:o==="end"?F-W+re+Q:o==="nearest"?Qr(C,W,J,$,re+Q,F,F+B,B):F-(C+J/2)+Q/2,ne=l==="start"?j-_-L:l==="center"?j-(_+ae/2)+le/2:l==="end"?j-R+U+le:Qr(_,R,ae,L,U+le,j,j+x,x);const{scrollLeft:ye,scrollTop:Fe}=G;te=he===0?0:Math.max(0,Math.min(Fe+te/he,G.scrollHeight-J/he+Q)),ne=pe===0?0:Math.max(0,Math.min(ye+ne/pe,G.scrollWidth-ae/pe+le)),F+=Fe-te,j+=ye-ne}M.push({el:G,top:te,left:ne})}return M},ob=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function ub(e,t){if(!e.isConnected||!(a=>{let i=a;for(;i&&i.parentNode;){if(i.parentNode===document)return!0;i=i.parentNode instanceof ShadowRoot?i.parentNode.host:i.parentNode}return!1})(e))return;const n=(a=>{const i=window.getComputedStyle(a);return{top:parseFloat(i.scrollMarginTop)||0,right:parseFloat(i.scrollMarginRight)||0,bottom:parseFloat(i.scrollMarginBottom)||0,left:parseFloat(i.scrollMarginLeft)||0}})(e);if((a=>typeof a=="object"&&typeof a.behavior=="function")(t))return t.behavior(Ku(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Ku(e,ob(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var yn=[],lb=function(){return yn.some(function(e){return e.activeTargets.length>0})},cb=function(){return yn.some(function(e){return e.skippedTargets.length>0})},Zu="ResizeObserver loop completed with undelivered notifications.",db=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Zu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Zu),window.dispatchEvent(e)},Or;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Or||(Or={}));var Dn=function(e){return Object.freeze(e)},fb=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,Dn(this)}return e}(),Md=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,Dn(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}(),oo=function(e){return e instanceof SVGElement&&"getBBox"in e},Id=function(e){if(oo(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)},Yu=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)},hb=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},Dr=typeof window<"u"?window:{},Jr=new WeakMap,Gu=/auto|scroll/,mb=/^tb|vertical/,pb=/msie|trident/i.test(Dr.navigator&&Dr.navigator.userAgent),St=function(e){return parseFloat(e||"0")},Vn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new fb((n?t:e)||0,(n?e:t)||0)},Qu=Dn({devicePixelContentBoxSize:Vn(),borderBoxSize:Vn(),contentBoxSize:Vn(),contentRect:new Md(0,0,0,0)}),$d=function(e,t){if(t===void 0&&(t=!1),Jr.has(e)&&!t)return Jr.get(e);if(Id(e))return Jr.set(e,Qu),Qu;var n=getComputedStyle(e),r=oo(e)&&e.ownerSVGElement&&e.getBBox(),a=!pb&&n.boxSizing==="border-box",i=mb.test(n.writingMode||""),s=!r&&Gu.test(n.overflowY||""),o=!r&&Gu.test(n.overflowX||""),l=r?0:St(n.paddingTop),u=r?0:St(n.paddingRight),c=r?0:St(n.paddingBottom),h=r?0:St(n.paddingLeft),p=r?0:St(n.borderTopWidth),m=r?0:St(n.borderRightWidth),g=r?0:St(n.borderBottomWidth),f=r?0:St(n.borderLeftWidth),D=h+u,v=l+c,E=f+m,B=p+g,x=o?e.offsetHeight-B-e.clientHeight:0,k=s?e.offsetWidth-E-e.clientWidth:0,T=a?D+E:0,S=a?v+B:0,q=r?r.width:St(n.width)-T-k,N=r?r.height:St(n.height)-S-x,I=q+D+k+E,z=N+v+x+B,w=Dn({devicePixelContentBoxSize:Vn(Math.round(q*devicePixelRatio),Math.round(N*devicePixelRatio),i),borderBoxSize:Vn(I,z,i),contentBoxSize:Vn(q,N,i),contentRect:new Md(h,l,q,N)});return Jr.set(e,w),w},Ld=function(e,t,n){var r=$d(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Or.DEVICE_PIXEL_CONTENT_BOX:return s;case Or.BORDER_BOX:return a;default:return i}},gb=function(){function e(t){var n=$d(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=Dn([n.borderBoxSize]),this.contentBoxSize=Dn([n.contentBoxSize]),this.devicePixelContentBoxSize=Dn([n.devicePixelContentBoxSize])}return e}(),zd=function(e){if(Id(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},vb=function(){var e=1/0,t=[];yn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var c=new gb(u.target),h=zd(u.target);o.push(c),u.lastReportedSize=Ld(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},Ju=function(e){yn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(zd(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},bb=function(){var e=0;for(Ju(e);lb();)e=vb(),Ju(e);return cb()&&db(),e>0},wi,qd=[],yb=function(){return qd.splice(0).forEach(function(e){return e()})},Db=function(e){if(!wi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return yb()}).observe(n,r),wi=function(){n.textContent="".concat(t?t--:t++)}}qd.push(e),wi()},Cb=function(e){Db(function(){requestAnimationFrame(e)})},pa=0,xb=function(){return!!pa},wb=250,Eb={attributes:!0,characterData:!0,childList:!0,subtree:!0},Xu=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],el=function(e){return e===void 0&&(e=0),Date.now()+e},Ei=!1,kb=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=wb),!Ei){Ei=!0;var r=el(t);Cb(function(){var a=!1;try{a=bb()}finally{if(Ei=!1,t=r-el(),!xb())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():Dr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Xu.forEach(function(n){return Dr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Xu.forEach(function(n){return Dr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),Ds=new kb,tl=function(e){!pa&&e>0&&Ds.start(),pa+=e,!pa&&Ds.stop()},_b=function(e){return!oo(e)&&!hb(e)&&getComputedStyle(e).display==="inline"},Bb=function(){function e(t,n){this.target=t,this.observedBox=n||Or.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=Ld(this.target,this.observedBox,!0);return _b(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Fb=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Xr=new WeakMap,nl=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},ea=function(){function e(){}return e.connect=function(t,n){var r=new Fb(t,n);Xr.set(t,r)},e.observe=function(t,n,r){var a=Xr.get(t),i=a.observationTargets.length===0;nl(a.observationTargets,n)<0&&(i&&yn.push(a),a.observationTargets.push(new Bb(n,r&&r.box)),tl(1),Ds.schedule())},e.unobserve=function(t,n){var r=Xr.get(t),a=nl(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&yn.splice(yn.indexOf(r),1),r.observationTargets.splice(a,1),tl(-1))},e.disconnect=function(t){var n=this,r=Xr.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Ab=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.");ea.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(!Yu(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ea.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(!Yu(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ea.unobserve(this,t)},e.prototype.disconnect=function(){ea.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Gt={};Object.defineProperty(Gt,"__esModule",{value:!0});var Tb=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),ki={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Wd={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Tb?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},uo={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 ta=1;ta<20;ta++)uo["f"+ta]=111+ta;function ei(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Hd(s,t)}),a=function(o){return r.some(function(l){return Ud(l,o)})},i=n==null?a:a(n);return i}function Sb(e,t){return ei(e,t)}function jb(e,t){return ei(e,{byKey:!0},t)}function Hd(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in ki)r[ki[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var c=a[Symbol.iterator](),h;!(o=(h=c.next()).done);o=!0){var p=h.value,m=p.endsWith("?")&&p.length>1;m&&(p=p.slice(0,-1));var g=lo(p),f=ki[g];if(p.length>1&&!f&&!Wd[p]&&!uo[g])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!f)&&(n?r.key=g:r.which=Vd(p)),f&&(r[f]=m?null:!0)}}catch(D){l=!0,u=D}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Ud(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 Vd(e){e=lo(e);var t=uo[e]||e.toUpperCase().charCodeAt(0);return t}function lo(e){return e=e.toLowerCase(),e=Wd[e]||e,e}var Ob=Gt.default=ei,_i=Gt.isHotkey=ei;Gt.isCodeHotkey=Sb;Gt.isKeyHotkey=jb;Gt.parseHotkey=Hd;Gt.compareHotkey=Ud;Gt.toKeyCode=Vd;Gt.toKeyName=lo;function Pb(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 Qn(e,t){if(e==null)return{};var n=Pb(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 Pr(e){"@babel/helpers - typeof";return Pr=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},Pr(e)}function Nb(e,t){if(Pr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Pr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rb(e){var t=Nb(e,"string");return Pr(t)==="symbol"?t:String(t)}function Et(e,t,n){return t=Rb(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var co=y.createContext(null),cn=()=>{var e=y.useContext(co);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Kd=parseInt(y.version.split(".")[0],10),Mb=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,rl=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),ot=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Wn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),vr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),Ib=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Zd=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),$b=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Lb=ot&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),zb=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),qb=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),Wb=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ga=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Jt=(!$b||!Lb)&&!Ib&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",fo=new WeakMap,ho=new WeakMap,Yd=new WeakMap,va=new WeakMap,Cs=new WeakMap,Nr=new WeakMap,Cn=new WeakMap,Aa=new WeakMap,ti=new WeakMap,xs=new WeakMap,an=new WeakMap,vn=new WeakMap,Cr=new WeakMap,ws=new WeakMap,mo=new WeakMap,Ft=new WeakMap,Vt=new WeakMap,ct=new WeakMap,en=new WeakMap,tn=new WeakMap,Gd=new WeakMap,Jn=Symbol("placeholder"),Qd=Symbol("mark-placeholder"),Hb=globalThis.Text,po=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,Ub=e=>sn(e)&&e.nodeType===8,wt=e=>sn(e)&&e.nodeType===1,sn=e=>{var t=po(e);return!!t&&e instanceof t.Node},Es=e=>{var t=e&&e.anchorNode&&po(e.anchorNode);return!!t&&e instanceof t.Selection},Jd=e=>sn(e)&&e.nodeType===3,Vb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,Kb=e=>{var[t,n]=e;if(wt(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=Xd(t,a,r?"backward":"forward"),r=a<n;wt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=Yb(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},Zb=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Xd=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(Ub(a)||wt(a)&&a.childNodes.length===0||wt(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]},Yb=(e,t,n)=>{var[r]=Xd(e,t,n);return r},ef=e=>{var t="";if(Jd(e)&&e.nodeValue)return e.nodeValue;if(wt(e)){for(var n of Array.from(e.childNodes))t+=ef(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
105
+ `)}return t},Gb=/data-slate-fragment="(.+?)"/m,Qb=e=>{var t=e.getData("text/html"),[,n]=t.match(Gb)||[];return n},go=(e,t,n)=>{var{target:r}=t;if(wt(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=ee.getWindow(e);if(a.contains(r))return ee.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:go(e,i,n)},Jb=0;class Xb{constructor(){Et(this,"id",void 0),this.id="".concat(Jb++)}}var ee={androidPendingDiffs:e=>ct.get(e),androidScheduleFlush:e=>{var t;(t=mo.get(e))===null||t===void 0||t()},blur:e=>{var t=ee.toDOMNode(e,e),n=ee.findDocumentOrShadowRoot(e);an.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=ee.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&X.deselect(e)},findDocumentOrShadowRoot:e=>{var t=ee.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=ee.toSlateNode(e,t.target),s=ee.findPath(e,i);if(de.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 p,{document:m}=ee.getWindow(e);if(m.caretRangeFromPoint)p=m.caretRangeFromPoint(n,r);else{var g=m.caretPositionFromPoint(n,r);g&&(p=m.createRange(),p.setStart(g.offsetNode,g.offset),p.setEnd(g.offsetNode,g.offset))}if(!p)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=ee.toSlateRange(e,p,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=Aa.get(t);return n||(n=new Xb,Aa.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=ho.get(r);if(a==null){if(b.isEditor(r))return n;break}var i=fo.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(Xe.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!an.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(()=>{ee.focus(t,{retries:n.retries-1})},10);return}var r=ee.toDOMNode(t,t),a=ee.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=ee.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(X.select(t,b.start(t,[])),t.onChange()),an.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=Yd.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=ee.toDOMNode(t,t),s;try{s=wt(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)=>sn(t)&&ee.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)=>ee.hasEditableTarget(e,t)||ee.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>sn(t)&&ee.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!vn.get(e),isFocused:e=>!!an.get(e),isReadOnly:e=>!!xs.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(xs.get(e))return!1;var n=ee.hasTarget(e,t)&&ee.toSlateNode(e,t);return de.isElement(n)&&b.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=ti.get(e),r=b.isEditor(t)?va.get(e):n==null?void 0:n.get(ee.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(Xe.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=b.node(e,t.path),r=ee.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,p=u.getAttribute("data-slate-length"),m=p==null?h:parseInt(p,10),g=o+m,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var D,v=f.childNodes[0];a=[v instanceof Hb?v:f,(D=f.textContent)!==null&&D!==void 0&&D.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var E=Math.min(h,Math.max(0,t.offset-o));a=[c,E];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(Xe.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=K.isBackward(t),i=ee.toDOMPoint(e,n),s=K.isCollapsed(t)?i:ee.toDOMPoint(e,r),o=ee.getWindow(e),l=o.document.createRange(),[u,c]=a?s:i,[h,p]=a?i:s,m=wt(u)?u:u.parentElement,g=!!m.getAttribute("data-slate-zero-width"),f=wt(h)?h:h.parentElement,D=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:c),l.setEnd(h,D?1:p),l},toSlateNode:(e,t)=>{var n=wt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Nr.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:Kb(t),o=i.parentNode,l=null,u=0;if(o){var c,h,p=ee.toDOMNode(e,e),m=o.closest('[data-slate-void="true"]'),g=m&&p.contains(m)?m:null,f=o.closest("[data-slate-leaf]"),D=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var v=ee.getWindow(e),E=v.document.createRange();E.setStart(l,0),E.setEnd(i,s);var B=E.cloneContents(),x=[...Array.prototype.slice.call(B.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(B.querySelectorAll("[contenteditable=false]"))];x.forEach(j=>{if(ot&&!r&&j.hasAttribute("data-slate-zero-width")&&j.textContent.length>0&&j.textContext!=="\uFEFF"){j.textContent.startsWith("\uFEFF")&&(j.textContent=j.textContent.slice(1));return}j.parentNode.removeChild(j)}),u=B.textContent.length,D=l}}else if(g){for(var k=g.querySelectorAll("[data-slate-leaf]"),T=0;T<k.length;T++){var S=k[T];if(ee.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(j=>{u-=j.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")||Wn&&(h=D.textContent)!==null&&h!==void 0&&h.endsWith(`
106
106
 
107
- `))&&u--}if(ot&&!l&&!r){var q=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(q&&ee.hasDOMNode(e,q,{editable:!0})){var N=ee.toSlateNode(e,q),{path:I,offset:z}=b.start(e,ee.findPath(e,N));return q.querySelector("[data-slate-leaf]")||(z=s),{path:I,offset:z}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var E=ee.toSlateNode(e,l),F=ee.findPath(e,E);return{path:F,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=_s(t)?t.anchorNode:t.startContainer,o,l,u,d,f;if(s)if(_s(t)){if(Hn&&t.rangeCount>1){u=t.focusNode;var p=t.getRangeAt(0),m=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement&&m.startContainer instanceof HTMLTableRowElement){let T=function(S){return S.childElementCount>0?T(S.children[0]):S};var g=p.startContainer,h=m.startContainer,y=T(g.children[p.startOffset]),v=T(h.children[m.startOffset]);d=0,v.childNodes.length>0?o=v.childNodes[0]:o=v,y.childNodes.length>0?u=y.childNodes[0]:u=y,v instanceof HTMLElement?l=v.innerHTML.length:l=0}else p.startContainer===u?(o=m.endContainer,l=m.endOffset,d=p.startOffset):(o=p.startContainer,l=p.endOffset,d=m.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,d=t.focusOffset;Gd&&Gb(o)||Hn?f=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:f=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,d=t.endOffset,f=t.collapsed;if(o==null||u==null||l==null||d==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(Hn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
107
+ `))&&u--}if(ot&&!l&&!r){var q=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(q&&ee.hasDOMNode(e,q,{editable:!0})){var N=ee.toSlateNode(e,q),{path:I,offset:z}=b.start(e,ee.findPath(e,N));return q.querySelector("[data-slate-leaf]")||(z=s),{path:I,offset:z}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var w=ee.toSlateNode(e,l),F=ee.findPath(e,w);return{path:F,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=Es(t)?t.anchorNode:t.startContainer,o,l,u,c,h;if(s)if(Es(t)){if(Wn&&t.rangeCount>1){u=t.focusNode;var p=t.getRangeAt(0),m=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement&&m.startContainer instanceof HTMLTableRowElement){let T=function(S){return S.childElementCount>0?T(S.children[0]):S};var g=p.startContainer,f=m.startContainer,D=T(g.children[p.startOffset]),v=T(f.children[m.startOffset]);c=0,v.childNodes.length>0?o=v.childNodes[0]:o=v,D.childNodes.length>0?u=D.childNodes[0]:u=D,v instanceof HTMLElement?l=v.innerHTML.length:l=0}else p.startContainer===u?(o=m.endContainer,l=m.endOffset,c=p.startOffset):(o=p.startContainer,l=p.endOffset,c=m.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,c=t.focusOffset;Zd&&Zb(o)||Wn?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(Wn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
108
108
 
109
- `)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var w;u=o,d=((w=o.textContent)===null||w===void 0?void 0:w.length)||0}var _=ee.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!_)return null;var x=f?_:ee.toSlatePoint(e,[u,d],{exactMatch:a,suppressThrow:i});if(!x)return null;var k={anchor:_,focus:x};return K.isExpanded(k)&&K.isForward(k)&&wt(u)&&b.void(e,{at:k.focus,mode:"highest"})&&(k=b.unhangRange(e,k,{voids:!0})),k}};function ny(e,t){var{path:n,diff:r}=t;if(!b.hasPath(e,n))return!1;var a=oe.get(e,n);if(!fe.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=P.next(n);if(!b.hasPath(e,i))return!1;var s=oe.get(e,i);return fe.isText(s)&&s.text.startsWith(r.text)}function rf(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 ry(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 ay(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 af(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=ry(i,a),o=Math.min(i.length-s,a.length-s),l=ay(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 iy(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=rf(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 af(e,{start:r,end:l,text:o})}function sy(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Bs(e,t){var{path:n,offset:r}=t;if(!b.hasPath(e,n))return null;var a=oe.get(e,n);if(!fe.isText(a))return null;var i=b.above(e,{match:o=>de.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:fe.isText});if(!s||!P.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function sl(e,t){var n=Bs(e,t.anchor);if(!n)return null;if(K.isCollapsed(t))return{anchor:n,focus:n};var r=Bs(e,t.focus);return r?{anchor:n,focus:r}:null}function Fs(e,t,n){var r=ct.get(e),a=r==null?void 0:r.find(d=>{var{path:f}=d;return P.equals(f,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"&&P.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 ol(e,t,n){var r=Fs(e,t.anchor,n);if(!r)return null;if(K.isCollapsed(t))return{anchor:r,focus:r};var a=Fs(e,t.focus,n);return a?{anchor:r,focus:a}:null}function oy(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!P.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!P.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!P.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:P.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:P.transform(n,t,{affinity:"forward"})};case"merge_node":return P.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:P.transform(n,t)}:{diff:r,id:a,path:P.transform(n,t)}}var i=P.transform(n,t);return i?{diff:r,path:i,id:a}:null}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 ra(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){Et(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 uy=25,ly=200,cy=function(){},dy=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function fy(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,d=()=>{var E=tn.get(t);if(tn.delete(t),E){var{selection:F}=t,j=sl(t,E);j&&(!F||!K.equals(j,F))&&X.select(t,j)}},f=()=>{var E=en.get(t);if(en.delete(t),!!E){if(E.at){var F=Ee.isPoint(E.at)?Bs(t,E.at):sl(t,E.at);if(!F)return;var j=b.range(t,F);(!t.selection||!K.equals(t.selection,j))&&X.select(t,F)}E.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!x()&&!_()){d();return}a||(a=!0,setTimeout(()=>a=!1)),_()&&(a="action");var E=t.selection&&b.rangeRef(t,t.selection,{affinity:"forward"});Vt.set(t,t.marks),cy("flush",en.get(t),ct.get(t));for(var F=x(),j;j=(M=ct.get(t))===null||M===void 0?void 0:M[0];){var M,V,G=Ft.get(t);G!==void 0&&(Ft.delete(t),t.marks=G),G&&u===!1&&(u=null);var J=sy(j);(!t.selection||!K.equals(t.selection,J))&&X.select(t,J),j.diff.text?b.insertText(t,j.diff.text):b.deleteFragment(t),ct.set(t,(V=ct.get(t))===null||V===void 0?void 0:V.filter(R=>{var{id:W}=R;return W!==j.id})),ny(t,j)||(F=!1,en.delete(t),Vt.delete(t),a="action",tn.delete(t),n.cancel(),r.cancel(),E==null||E.unref())}var ae=E==null?void 0:E.unref();if(ae&&!tn.get(t)&&(!t.selection||!K.equals(ae,t.selection))&&X.select(t,ae),_()){f();return}F&&n(),n.flush(),r.flush(),d();var C=Vt.get(t);Vt.delete(t),C!==void 0&&(t.marks=C,t.onChange())},m=E=>{i&&clearTimeout(i),i=setTimeout(()=>{vn.set(t,!1),p()},uy)},g=E=>{vn.set(t,!0),i&&(clearTimeout(i),i=null)},h=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=ws.get(t);if(j){if(x()||F){j.style.display="none";return}j.style.removeProperty("display")}},y=(E,F)=>{var j,M=(j=ct.get(t))!==null&&j!==void 0?j:[];ct.set(t,M);var V=oe.leaf(t,E),G=M.findIndex(C=>P.equals(C.path,E));if(G<0){var J=af(V.text,F);J&&M.push({path:E,diff:F,id:l++}),h();return}var ae=iy(V.text,M[G].diff,F);if(!ae){M.splice(G,1),h();return}M[G]=ra(ra({},M[G]),{},{diff:ae})},v=function(F){var{at:j}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,tn.delete(t),n.cancel(),r.cancel(),_()&&p(),en.set(t,{at:j,run:F}),o=setTimeout(p)},w=E=>{var F;s&&(clearTimeout(s),s=null);var{inputType:j}=E,M=null,V=E.dataTransfer||E.data||void 0;u!==!1&&j!=="insertText"&&j!=="insertCompositionText"&&(u=!1);var[G]=E.getTargetRanges();G&&(M=ee.toSlateRange(t,G,{exactMatch:!1,suppressThrow:!0}));var J=ee.getWindow(t),ae=J.getSelection();if(!M&&ae&&(G=ae,M=ee.toSlateRange(t,ae,{exactMatch:!1,suppressThrow:!0})),M=(F=M)!==null&&F!==void 0?F:t.selection,!!M){var C=!0;if(j.startsWith("delete")){if(K.isExpanded(M)){var[R,W]=K.edges(M),B=oe.leaf(t,R.path);if(B.text.length===R.offset&&W.offset===0){var A=b.next(t,{at:R.path,match:fe.isText});A&&P.equals(A[1],W.path)&&(M={anchor:W,focus:W})}}var L=j.endsWith("Backward")?"backward":"forward",[$,U]=K.edges(M),[re,te]=b.leaf(t,$.path),ne={text:"",start:$.offset,end:U.offset},le=ct.get(t),Q=le==null?void 0:le.find(ve=>P.equals(ve.path,te)),pe=Q?[Q.diff,ne]:[ne],he=rf(re.text,...pe);if(he.length===0&&(C=!1),K.isExpanded(M)){if(C&&P.equals(M.anchor.path,M.focus.path)){var ye={path:M.anchor.path,offset:$.offset},Fe=b.range(t,ye,ye);return S(Fe),y(M.anchor.path,{text:"",end:U.offset,start:$.offset})}return v(()=>b.deleteFragment(t,{direction:L}),{at:M})}}switch(j){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>b.deleteFragment(t),{at:M});case"deleteContent":case"deleteContentForward":{var{anchor:Ae}=M;if(C&&K.isCollapsed(M)){var He=oe.leaf(t,Ae.path);if(Ae.offset<He.text.length)return y(Ae.path,{text:"",start:Ae.offset,end:Ae.offset+1})}return v(()=>b.deleteForward(t),{at:M})}case"deleteContentBackward":{var Se,{anchor:Te}=M,Ne=_s(G)?G.isCollapsed:!!((Se=G)!==null&&Se!==void 0&&Se.collapsed);return C&&Ne&&K.isCollapsed(M)&&Te.offset>0?y(Te.path,{text:"",start:Te.offset-1,end:Te.offset}):v(()=>b.deleteBackward(t),{at:M})}case"deleteEntireSoftLine":return v(()=>{b.deleteBackward(t,{unit:"line"}),b.deleteForward(t,{unit:"line"})},{at:M});case"deleteHardLineBackward":return v(()=>b.deleteBackward(t,{unit:"block"}),{at:M});case"deleteSoftLineBackward":return v(()=>b.deleteBackward(t,{unit:"line"}),{at:M});case"deleteHardLineForward":return v(()=>b.deleteForward(t,{unit:"block"}),{at:M});case"deleteSoftLineForward":return v(()=>b.deleteForward(t,{unit:"line"}),{at:M});case"deleteWordBackward":return v(()=>b.deleteBackward(t,{unit:"word"}),{at:M});case"deleteWordForward":return v(()=>b.deleteForward(t,{unit:"word"}),{at:M});case"insertLineBreak":return v(()=>b.insertSoftBreak(t),{at:M});case"insertParagraph":return v(()=>b.insertBreak(t),{at:M});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(dy(V))return v(()=>ee.insertData(t,V),{at:M});var ke=V??"";if(Ft.get(t)&&(ke=ke.replace("\uFEFF","")),j==="insertText"&&/.*\n.*\n$/.test(ke)&&(ke=ke.slice(0,-1)),ke.includes(`
109
+ `)&&c===u.textContent.length&&c--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var E;u=o,c=((E=o.textContent)===null||E===void 0?void 0:E.length)||0}var B=ee.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!B)return null;var x=h?B:ee.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!x)return null;var k={anchor:B,focus:x};return K.isExpanded(k)&&K.isForward(k)&&wt(u)&&b.void(e,{at:k.focus,mode:"highest"})&&(k=b.unhangRange(e,k,{voids:!0})),k}};function ey(e,t){var{path:n,diff:r}=t;if(!b.hasPath(e,n))return!1;var a=oe.get(e,n);if(!fe.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=P.next(n);if(!b.hasPath(e,i))return!1;var s=oe.get(e,i);return fe.isText(s)&&s.text.startsWith(r.text)}function tf(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 ty(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 ny(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 nf(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=ty(i,a),o=Math.min(i.length-s,a.length-s),l=ny(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 ry(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=tf(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 nf(e,{start:r,end:l,text:o})}function ay(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function ks(e,t){var{path:n,offset:r}=t;if(!b.hasPath(e,n))return null;var a=oe.get(e,n);if(!fe.isText(a))return null;var i=b.above(e,{match:o=>de.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:fe.isText});if(!s||!P.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function al(e,t){var n=ks(e,t.anchor);if(!n)return null;if(K.isCollapsed(t))return{anchor:n,focus:n};var r=ks(e,t.focus);return r?{anchor:n,focus:r}:null}function _s(e,t,n){var r=ct.get(e),a=r==null?void 0:r.find(c=>{var{path:h}=c;return P.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"&&P.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 il(e,t,n){var r=_s(e,t.anchor,n);if(!r)return null;if(K.isCollapsed(t))return{anchor:r,focus:r};var a=_s(e,t.focus,n);return a?{anchor:r,focus:a}:null}function iy(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!P.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!P.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!P.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:P.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:P.transform(n,t,{affinity:"forward"})};case"merge_node":return P.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:P.transform(n,t)}:{diff:r,id:a,path:P.transform(n,t)}}var i=P.transform(n,t);return i?{diff:r,path:i,id:a}:null}function sl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function na(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sl(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var sy=25,oy=200,uy=function(){},ly=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function cy(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,c=()=>{var w=tn.get(t);if(tn.delete(t),w){var{selection:F}=t,j=al(t,w);j&&(!F||!K.equals(j,F))&&X.select(t,j)}},h=()=>{var w=en.get(t);if(en.delete(t),!!w){if(w.at){var F=Ee.isPoint(w.at)?ks(t,w.at):al(t,w.at);if(!F)return;var j=b.range(t,F);(!t.selection||!K.equals(t.selection,j))&&X.select(t,F)}w.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!x()&&!B()){c();return}a||(a=!0,setTimeout(()=>a=!1)),B()&&(a="action");var w=t.selection&&b.rangeRef(t,t.selection,{affinity:"forward"});Vt.set(t,t.marks),uy("flush",en.get(t),ct.get(t));for(var F=x(),j;j=(M=ct.get(t))===null||M===void 0?void 0:M[0];){var M,V,G=Ft.get(t);G!==void 0&&(Ft.delete(t),t.marks=G),G&&u===!1&&(u=null);var J=ay(j);(!t.selection||!K.equals(t.selection,J))&&X.select(t,J),j.diff.text?b.insertText(t,j.diff.text):b.deleteFragment(t),ct.set(t,(V=ct.get(t))===null||V===void 0?void 0:V.filter(R=>{var{id:W}=R;return W!==j.id})),ey(t,j)||(F=!1,en.delete(t),Vt.delete(t),a="action",tn.delete(t),n.cancel(),r.cancel(),w==null||w.unref())}var ae=w==null?void 0:w.unref();if(ae&&!tn.get(t)&&(!t.selection||!K.equals(ae,t.selection))&&X.select(t,ae),B()){h();return}F&&n(),n.flush(),r.flush(),c();var C=Vt.get(t);Vt.delete(t),C!==void 0&&(t.marks=C,t.onChange())},m=w=>{i&&clearTimeout(i),i=setTimeout(()=>{vn.set(t,!1),p()},sy)},g=w=>{vn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=Cs.get(t);if(j){if(x()||F){j.style.display="none";return}j.style.removeProperty("display")}},D=(w,F)=>{var j,M=(j=ct.get(t))!==null&&j!==void 0?j:[];ct.set(t,M);var V=oe.leaf(t,w),G=M.findIndex(C=>P.equals(C.path,w));if(G<0){var J=nf(V.text,F);J&&M.push({path:w,diff:F,id:l++}),f();return}var ae=ry(V.text,M[G].diff,F);if(!ae){M.splice(G,1),f();return}M[G]=na(na({},M[G]),{},{diff:ae})},v=function(F){var{at:j}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,tn.delete(t),n.cancel(),r.cancel(),B()&&p(),en.set(t,{at:j,run:F}),o=setTimeout(p)},E=w=>{var F;s&&(clearTimeout(s),s=null);var{inputType:j}=w,M=null,V=w.dataTransfer||w.data||void 0;u!==!1&&j!=="insertText"&&j!=="insertCompositionText"&&(u=!1);var[G]=w.getTargetRanges();G&&(M=ee.toSlateRange(t,G,{exactMatch:!1,suppressThrow:!0}));var J=ee.getWindow(t),ae=J.getSelection();if(!M&&ae&&(G=ae,M=ee.toSlateRange(t,ae,{exactMatch:!1,suppressThrow:!0})),M=(F=M)!==null&&F!==void 0?F:t.selection,!!M){var C=!0;if(j.startsWith("delete")){if(K.isExpanded(M)){var[R,W]=K.edges(M),_=oe.leaf(t,R.path);if(_.text.length===R.offset&&W.offset===0){var A=b.next(t,{at:R.path,match:fe.isText});A&&P.equals(A[1],W.path)&&(M={anchor:W,focus:W})}}var L=j.endsWith("Backward")?"backward":"forward",[$,U]=K.edges(M),[re,te]=b.leaf(t,$.path),ne={text:"",start:$.offset,end:U.offset},le=ct.get(t),Q=le==null?void 0:le.find(ve=>P.equals(ve.path,te)),pe=Q?[Q.diff,ne]:[ne],he=tf(re.text,...pe);if(he.length===0&&(C=!1),K.isExpanded(M)){if(C&&P.equals(M.anchor.path,M.focus.path)){var ye={path:M.anchor.path,offset:$.offset},Fe=b.range(t,ye,ye);return S(Fe),D(M.anchor.path,{text:"",end:U.offset,start:$.offset})}return v(()=>b.deleteFragment(t,{direction:L}),{at:M})}}switch(j){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>b.deleteFragment(t),{at:M});case"deleteContent":case"deleteContentForward":{var{anchor:Ae}=M;if(C&&K.isCollapsed(M)){var He=oe.leaf(t,Ae.path);if(Ae.offset<He.text.length)return D(Ae.path,{text:"",start:Ae.offset,end:Ae.offset+1})}return v(()=>b.deleteForward(t),{at:M})}case"deleteContentBackward":{var Se,{anchor:Te}=M,Ne=Es(G)?G.isCollapsed:!!((Se=G)!==null&&Se!==void 0&&Se.collapsed);return C&&Ne&&K.isCollapsed(M)&&Te.offset>0?D(Te.path,{text:"",start:Te.offset-1,end:Te.offset}):v(()=>b.deleteBackward(t),{at:M})}case"deleteEntireSoftLine":return v(()=>{b.deleteBackward(t,{unit:"line"}),b.deleteForward(t,{unit:"line"})},{at:M});case"deleteHardLineBackward":return v(()=>b.deleteBackward(t,{unit:"block"}),{at:M});case"deleteSoftLineBackward":return v(()=>b.deleteBackward(t,{unit:"line"}),{at:M});case"deleteHardLineForward":return v(()=>b.deleteForward(t,{unit:"block"}),{at:M});case"deleteSoftLineForward":return v(()=>b.deleteForward(t,{unit:"line"}),{at:M});case"deleteWordBackward":return v(()=>b.deleteBackward(t,{unit:"word"}),{at:M});case"deleteWordForward":return v(()=>b.deleteForward(t,{unit:"word"}),{at:M});case"insertLineBreak":return v(()=>b.insertSoftBreak(t),{at:M});case"insertParagraph":return v(()=>b.insertBreak(t),{at:M});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(ly(V))return v(()=>ee.insertData(t,V),{at:M});var ke=V??"";if(Ft.get(t)&&(ke=ke.replace("\uFEFF","")),j==="insertText"&&/.*\n.*\n$/.test(ke)&&(ke=ke.slice(0,-1)),ke.includes(`
110
110
  `))return v(()=>{var ve=ke.split(`
111
- `);ve.forEach((we,Ke)=>{we&&b.insertText(t,we),Ke!==ve.length-1&&b.insertSoftBreak(t)})},{at:M});if(P.equals(M.anchor.path,M.focus.path)){var[Ue,ge]=K.edges(M),H={start:Ue.offset,end:ge.offset,text:ke};if(ke&&u&&j==="insertCompositionText"){var ie=u.start+u.text.search(/\S|$/),me=H.start+H.text.search(/\S|$/);me===ie+1&&H.end===u.start+u.text.length?(H.start-=1,u=null,I()):u=!1}else j==="insertText"?u===null?u=H:u&&K.isCollapsed(M)&&u.end+u.text.length===Ue.offset?u=ra(ra({},u),{},{text:u.text+ke}):u=!1:u=!1;if(C){y(Ue.path,H);return}}return v(()=>b.insertText(t,ke),{at:M})}}}},_=()=>!!en.get(t),x=()=>{var E;return!!((E=ct.get(t))!==null&&E!==void 0&&E.length)},k=()=>_()||x(),T=()=>a,S=E=>{tn.set(t,E),s&&(clearTimeout(s),s=null);var{selection:F}=t;if(E){var j=!F||!P.equals(F.anchor.path,E.anchor.path),M=!F||!P.equals(F.anchor.path.slice(0,-1),E.anchor.path.slice(0,-1));(j&&u||M)&&(u=!1),(j||x())&&(s=setTimeout(p,ly))}},q=()=>{(_()||!x())&&p()},N=E=>{x()||(h(!0),setTimeout(h))},I=()=>{_()||(o=setTimeout(p))},z=E=>{if(!(x()||_())&&E.some(j=>bo(t,j,E))){var F;(F=Jd.get(t))===null||F===void 0||F()}};return{flush:p,scheduleFlush:I,hasPendingDiffs:x,hasPendingAction:_,hasPendingChanges:k,isFlushing:T,handleUserSelect:S,handleCompositionEnd:m,handleCompositionStart:g,handleDOMBeforeInput:w,handleKeyDown:N,handleDomMutations:z,handleInput:q}}function hy(){var e=D.useRef(!1);return D.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Rr=ba?D.useLayoutEffect:D.useEffect;function my(e,t,n){var[r]=D.useState(()=>new MutationObserver(t));Rr(()=>{r.takeRecords()}),D.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 py=["node"];function ll(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function gy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ll(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ll(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var vy={subtree:!0,childList:!0,characterData:!0},by=ot?e=>{var{node:t}=e,n=Jn(e,py);if(!ot)return null;var r=cn(),a=hy(),[i]=D.useState(()=>fy(gy({editor:r},n)));return my(t,i.handleDomMutations,vy),go.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,yy=["anchor","focus"],Dy=["anchor","focus"],Cy=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),sf=(e,t)=>{var n=Jn(e,yy),r=Jn(t,Dy);return e[Xn]===t[Xn]&&Cy(n,r)},xy=(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(!K.equals(r,a)||!sf(r,a))return!1}return!0},wy=(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||!sf(r,a))return!1}return!0};function cl(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 Ey(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cl(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ky=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=cn(),s=ee.findPath(i,a),o=P.parent(s),l=!!n[Xd];return i.isVoid(r)?D.createElement(Ai,{length:oe.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&b.string(i,o)===""?D.createElement(Ai,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?D.createElement(Ai,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
112
- `?D.createElement(dl,{isTrailing:!0,text:n.text}):D.createElement(dl,{text:n.text})},dl=e=>{var{text:t,isTrailing:n=!1}=e,r=D.useRef(null),a=()=>"".concat(t??"").concat(n?`
113
- `:""),[i]=D.useState(a);return Rr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),D.createElement(_y,{ref:r},i)},_y=D.memo(D.forwardRef((e,t)=>D.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Ai=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),D.createElement("span",Ey({},a),!ot||!n?"\uFEFF":null,n?D.createElement("br",null):null)};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 of(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){Et(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 By=ot?300:0;function Fy(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function hl(e){e.current&&(clearTimeout(e.current),e.current=null)}var Ay=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=w=>D.createElement(Sy,of({},w))}=e,o=cn(),l=D.useRef(null),u=D.useRef(null),[d,f]=D.useState(!1),p=D.useRef(null),m=D.useCallback(w=>{if(Fy(l,w==null),w==null){var _;ws.delete(o),(_=t.onPlaceholderResize)===null||_===void 0||_.call(t,null)}else{if(ws.set(o,w),!l.current){var x=window.ResizeObserver||Sb;l.current=new x(()=>{var k;(k=t.onPlaceholderResize)===null||k===void 0||k.call(t,w)})}l.current.observe(w),u.current=w}},[u,t,o]),g=D.createElement(ky,{isLast:n,leaf:t,parent:a,text:r}),h=!!t[Xn];if(D.useEffect(()=>(h?p.current||(p.current=setTimeout(()=>{f(!0),p.current=null},By)):(hl(p),f(!1)),()=>hl(p)),[h,f]),h&&d){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:vr?"inherit":void 0},contentEditable:!1,ref:m}};g=D.createElement(D.Fragment,null,i(y),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},Ty=D.memo(Ay,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&fe.equals(t.leaf,e.leaf)&&t.leaf[Xn]===e.leaf[Xn]),Sy=e=>{var{attributes:t,children:n}=e;return D.createElement("span",of({},t),n)},jy=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=cn(),l=D.useRef(null),u=fe.decorations(s,t),d=ee.findKey(o,s),f=[],p=0;p<u.length;p++){var m=u[p];f.push(D.createElement(Ty,{isLast:n&&p===u.length-1,key:"".concat(d.id,"-").concat(p),renderPlaceholder:a,leaf:m,text:s,parent:r,renderLeaf:i}))}var g=D.useCallback(h=>{var y=ri.get(o);h?(y==null||y.set(d,h),Cn.set(s,h),Nr.set(h,s)):(y==null||y.delete(d),Cn.delete(s),l.current&&Nr.delete(l.current)),l.current=h},[l,o,d,s]);return D.createElement("span",{"data-slate-node":"text",ref:g},f)},uf=D.memo(jy,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&wy(t.decorations,e.decorations));function ml(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function As(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ml(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ml(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Oy=e=>{var{decorations:t,element:n,renderElement:r=w=>D.createElement(Ny,As({},w)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=cn(),l=Iy(),u=o.isInline(n),d=ee.findKey(o,n),f=D.useCallback(w=>{var _=ri.get(o);w?(_==null||_.set(d,w),Cn.set(n,w),Nr.set(w,n)):(_==null||_.delete(d),Cn.delete(n))},[o,d,n]),p=cf({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),m={"data-slate-node":"element",ref:f};if(u&&(m["data-slate-inline"]=!0),!u&&b.hasInlines(o,n)){var g=oe.string(n),h=Pd(g);h==="rtl"&&(m.dir=h)}if(b.isVoid(o,n)){m["data-slate-void"]=!0,!l&&u&&(m.contentEditable=!1);var y=u?"span":"div",[[v]]=oe.texts(n);p=D.createElement(y,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},D.createElement(uf,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),mo.set(v,0),po.set(v,n)}return r({attributes:m,children:p,element:n})},Py=D.memo(Oy,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&xy(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&K.equals(e.selection,t.selection))),Ny=e=>{var{attributes:t,children:n,element:r}=e,a=cn(),i=a.isInline(r)?"span":"div";return D.createElement(i,As(As({},t),{},{style:{position:"relative"}}),n)},lf=D.createContext(()=>[]),Ry=()=>D.useContext(lf),My=D.createContext(!1),cf=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=Ry(),l=cn(),u=ee.findPath(l,n),d=[],f=de.isElement(n)&&!l.isInline(n)&&b.hasInlines(l,n),p=0;p<n.children.length;p++){var m=u.concat(p),g=n.children[p],h=ee.findKey(l,g),y=b.range(l,m),v=s&&K.intersection(y,s),w=o([g,m]);for(var _ of t){var x=K.intersection(_,y);x&&w.push(x)}de.isElement(g)?d.push(D.createElement(My.Provider,{key:"provider-".concat(h.id),value:!!v},D.createElement(Py,{decorations:w,element:g,key:h.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):d.push(D.createElement(uf,{decorations:w,key:h.id,isLast:f&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),mo.set(g,p),po.set(g,n)}return d},df=D.createContext(!1),Iy=()=>D.useContext(df),ff=D.createContext(null),Sn=()=>{var e=D.useContext(ff);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function $y(){var e=cn(),t=D.useRef(!1),n=D.useRef(0),r=D.useCallback(()=>{if(!t.current){t.current=!0;var a=ee.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return D.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var Ly=3,zy={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"},qy={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"},Wy={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},We=e=>{var t=zy[e],n=qy[e],r=Wy[e],a=t&&Fi(t),i=n&&Fi(n),s=r&&Fi(r);return o=>!!(a&&a(o)||il&&i&&i(o)||!il&&s&&s(o))},Ve={isBold:We("bold"),isCompose:We("compose"),isMoveBackward:We("moveBackward"),isMoveForward:We("moveForward"),isDeleteBackward:We("deleteBackward"),isDeleteForward:We("deleteForward"),isDeleteLineBackward:We("deleteLineBackward"),isDeleteLineForward:We("deleteLineForward"),isDeleteWordBackward:We("deleteWordBackward"),isDeleteWordForward:We("deleteWordForward"),isExtendBackward:We("extendBackward"),isExtendForward:We("extendForward"),isExtendLineBackward:We("extendLineBackward"),isExtendLineForward:We("extendLineForward"),isItalic:We("italic"),isMoveLineBackward:We("moveLineBackward"),isMoveLineForward:We("moveLineForward"),isMoveWordBackward:We("moveWordBackward"),isMoveWordForward:We("moveWordForward"),isRedo:We("redo"),isSoftBreak:We("insertSoftBreak"),isSplitBlock:We("splitBlock"),isTransposeCharacter:We("transposeCharacter"),isUndo:We("undo")},Hy=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>bo(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}},Uy={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class hf extends D.Component{constructor(){super(...arguments),Et(this,"context",null),Et(this,"manager",null),Et(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,Uy)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=Hy(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}}Et(hf,"contextType",ho);var Vy=ot?hf:e=>{var{children:t}=e;return D.createElement(D.Fragment,null,t)},Ky=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],Zy=["text"];function pl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function jt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pl(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Yy=e=>D.createElement(D.Fragment,null,cf(e)),Gy=e=>{var t=D.useCallback(A=>D.createElement(Qy,jt({},A)),[]),{autoFocus:n,decorate:r=Jy,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=Xy,style:f={},as:p="div",disableDefaultStyles:m=!1}=e,g=Jn(e,Ky),h=Sn(),[y,v]=D.useState(!1),w=D.useRef(null),_=D.useRef([]),[x,k]=D.useState(),{onUserInput:T,receivedUserInput:S}=$y(),[,q]=D.useReducer(A=>A+1,0);Jd.set(h,q),Es.set(h,s);var N=D.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);D.useEffect(()=>{w.current&&n&&w.current.focus()},[n]);var I=D.useRef(),z=D.useMemo(()=>ob(()=>{var A=I.current;if((ot||!ee.isComposing(h))&&(!N.isUpdatingSelection||A!=null&&A.isFlushing())&&!N.isDraggingInternally){var L=ee.findDocumentOrShadowRoot(h),{activeElement:$}=L,U=ee.toDOMNode(h,h),re=L.getSelection();if($===U?(N.latestElement=$,an.set(h,!0)):an.delete(h),!re)return X.deselect(h);var{anchorNode:te,focusNode:ne}=re,le=ee.hasEditableTarget(h,te)||ee.isTargetInsideNonReadonlyVoid(h,te),Q=ee.hasEditableTarget(h,ne)||ee.isTargetInsideNonReadonlyVoid(h,ne);if(le&&Q){var pe=ee.toSlateRange(h,re,{exactMatch:!1,suppressThrow:!0});pe&&(!ee.isComposing(h)&&!(A!=null&&A.hasPendingChanges())&&!(A!=null&&A.isFlushing())?X.select(h,pe):A==null||A.handleUserSelect(pe))}s&&(!le||!Q)&&X.deselect(h)}},100),[h,s,N]),E=D.useMemo(()=>tb(z,0),[z]);I.current=by({node:w,onDOMSelectionChange:z,scheduleOnDOMSelectionChange:E}),Rr(()=>{var A,L,$;w.current&&($=vo(w.current))?(Qd.set(h,$),ya.set(h,w.current),Cn.set(h,w.current),Nr.set(w.current,h)):Cn.delete(h);var{selection:U}=h,re=ee.findDocumentOrShadowRoot(h),te=re.getSelection();if(!(!te||!ee.isFocused(h)||(A=I.current)!==null&&A!==void 0&&A.hasPendingAction())){var ne=he=>{var ye=te.type!=="None";if(!(!U&&!ye)){var Fe=te.focusNode,Ae;if(Hn&&te.rangeCount>1){var He=te.getRangeAt(0),Se=te.getRangeAt(te.rangeCount-1);He.startContainer===Fe?Ae=Se.endContainer:Ae=He.startContainer}else Ae=te.anchorNode;var Te=ya.get(h),Ne=!1;if(Te.contains(Ae)&&Te.contains(Fe)&&(Ne=!0),ye&&Ne&&U&&!he){var ke=ee.toSlateRange(h,te,{exactMatch:!0,suppressThrow:!0});if(ke&&K.equals(ke,U)){var Ue;if(!N.hasMarkPlaceholder||(Ue=Ae)!==null&&Ue!==void 0&&(Ue=Ue.parentElement)!==null&&Ue!==void 0&&Ue.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!ee.hasRange(h,U)){h.selection=ee.toSlateRange(h,te,{exactMatch:!1,suppressThrow:!0});return}N.isUpdatingSelection=!0;var ge=U&&ee.toDOMRange(h,U);return ge?(ee.isComposing(h)&&!ot?te.collapseToEnd():K.isBackward(U)?te.setBaseAndExtent(ge.endContainer,ge.endOffset,ge.startContainer,ge.startOffset):te.setBaseAndExtent(ge.startContainer,ge.startOffset,ge.endContainer,ge.endOffset),d(h,ge)):te.removeAllRanges(),ge}};te.rangeCount<=1&&ne();var le=((L=I.current)===null||L===void 0?void 0:L.isFlushing())==="action";if(!ot||!le){setTimeout(()=>{N.isUpdatingSelection=!1});return}var Q=null,pe=requestAnimationFrame(()=>{if(le){var he=ye=>{try{var Fe=ee.toDOMNode(h,h);Fe.focus(),ne(ye)}catch{}};he(),Q=setTimeout(()=>{he(!0),N.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(pe),Q&&clearTimeout(Q)}}});var F=D.useCallback(A=>{if(T(),!s&&ee.hasEditableTarget(h,A.target)&&!e1(A,a)){var L;if(I.current)return I.current.handleDOMBeforeInput(A);E.flush(),z.flush();var{selection:$}=h,{inputType:U}=A,re=A.dataTransfer||A.data||void 0,te=U==="insertCompositionText"||U==="deleteCompositionText";if(te&&ee.isComposing(h))return;var ne=!1;if(U==="insertText"&&$&&K.isCollapsed($)&&A.data&&A.data.length===1&&/[a-z ]/i.test(A.data)&&$.anchor.offset!==0){var le,Q;ne=!0,h.marks&&(ne=!1);var{anchor:pe}=$,[he,ye]=ee.toDOMPoint(h,pe),Fe=(le=he.parentElement)===null||le===void 0?void 0:le.closest("a"),Ae=ee.getWindow(h);if(ne&&Fe&&ee.hasDOMNode(h,Fe)){var He,Se=Ae==null?void 0:Ae.document.createTreeWalker(Fe,NodeFilter.SHOW_TEXT).lastChild();Se===he&&((He=Se.textContent)===null||He===void 0?void 0:He.length)===ye&&(ne=!1)}if(ne&&he.parentElement&&(Ae==null||(Q=Ae.getComputedStyle(he.parentElement))===null||Q===void 0?void 0:Q.whiteSpace)==="pre"){var Te=b.above(h,{at:pe.path,match:ie=>de.isElement(ie)&&b.isBlock(h,ie)});Te&&oe.string(Te[0]).includes(" ")&&(ne=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[Ne]=A.getTargetRanges();if(Ne){var ke=ee.toSlateRange(h,Ne,{exactMatch:!1,suppressThrow:!1});if(!$||!K.equals($,ke)){ne=!1;var Ue=!te&&h.selection&&b.rangeRef(h,h.selection);X.select(h,ke),Ue&&Cr.set(h,Ue)}}}if(te)return;if(ne||A.preventDefault(),$&&K.isExpanded($)&&U.startsWith("delete")){var ge=U.endsWith("Backward")?"backward":"forward";b.deleteFragment(h,{direction:ge});return}switch(U){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{b.deleteFragment(h);break}case"deleteContent":case"deleteContentForward":{b.deleteForward(h);break}case"deleteContentBackward":{b.deleteBackward(h);break}case"deleteEntireSoftLine":{b.deleteBackward(h,{unit:"line"}),b.deleteForward(h,{unit:"line"});break}case"deleteHardLineBackward":{b.deleteBackward(h,{unit:"block"});break}case"deleteSoftLineBackward":{b.deleteBackward(h,{unit:"line"});break}case"deleteHardLineForward":{b.deleteForward(h,{unit:"block"});break}case"deleteSoftLineForward":{b.deleteForward(h,{unit:"line"});break}case"deleteWordBackward":{b.deleteBackward(h,{unit:"word"});break}case"deleteWordForward":{b.deleteForward(h,{unit:"word"});break}case"insertLineBreak":b.insertSoftBreak(h);break;case"insertParagraph":{b.insertBreak(h);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{U==="insertFromComposition"&&ee.isComposing(h)&&(v(!1),vn.set(h,!1)),(re==null?void 0:re.constructor.name)==="DataTransfer"?ee.insertData(h,re):typeof re=="string"&&(ne?_.current.push(()=>b.insertText(h,re)):b.insertText(h,re));break}}var H=(L=Cr.get(h))===null||L===void 0?void 0:L.unref();Cr.delete(h),H&&(!h.selection||!K.equals(h.selection,H))&&X.select(h,H)}},[h,z,T,a,s,E]),j=D.useCallback(A=>{A==null?(z.cancel(),E.cancel(),ya.delete(h),Cn.delete(h),w.current&&Jt&&w.current.removeEventListener("beforeinput",F)):Jt&&A.addEventListener("beforeinput",F),w.current=A},[z,E,h,F]);Rr(()=>{var A=ee.getWindow(h);return A.document.addEventListener("selectionchange",E),()=>{A.document.removeEventListener("selectionchange",E)}},[E]);var M=r([h,[]]),V=i&&h.children.length===1&&Array.from(oe.texts(h)).length===1&&oe.string(h)===""&&!y,G=D.useCallback(A=>{if(A&&V){var L;k((L=A.getBoundingClientRect())===null||L===void 0?void 0:L.height)}else k(void 0)},[V]);if(V){var J=b.start(h,[]);M.push({[Xn]:!0,placeholder:i,onPlaceholderResize:G,anchor:J,focus:J})}var{marks:ae}=h;if(N.hasMarkPlaceholder=!1,h.selection&&K.isCollapsed(h.selection)&&ae){var{anchor:C}=h.selection,R=oe.leaf(h,C.path),W=Jn(R,Zy);if(!fe.equals(R,ae,{loose:!0})){N.hasMarkPlaceholder=!0;var B=Object.fromEntries(Object.keys(W).map(A=>[A,null]));M.push(jt(jt(jt({[Xd]:!0},B),ae),{},{anchor:C,focus:C}))}}return D.useEffect(()=>{setTimeout(()=>{var{selection:A}=h;if(A){var{anchor:L}=A,$=oe.leaf(h,L.path);if(ae&&!fe.equals($,ae,{loose:!0})){Ft.set(h,ae);return}}Ft.delete(h)})}),D.createElement(df.Provider,{value:s},D.createElement(lf.Provider,{value:r},D.createElement(Vy,{node:w,receivedUserInput:S},D.createElement(p,jt(jt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Jt||!ba?g.spellCheck:!1,autoCorrect:Jt||!ba?g.autoCorrect:"false",autoCapitalize:Jt||!ba?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:j,style:jt(jt({},m?{}:jt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},x?{minHeight:x}:{})),f),onBeforeInput:D.useCallback(A=>{if(!Jt&&!s&&!it(A,g.onBeforeInput)&&ee.hasSelectableTarget(h,A.target)&&(A.preventDefault(),!ee.isComposing(h))){var L=A.data;b.insertText(h,L)}},[g.onBeforeInput,h,s]),onInput:D.useCallback(A=>{if(!it(A,g.onInput)){if(I.current){I.current.handleInput();return}for(var L of _.current)L();_.current=[]}},[g.onInput]),onBlur:D.useCallback(A=>{if(!(s||N.isUpdatingSelection||!ee.hasSelectableTarget(h,A.target)||it(A,g.onBlur))){var L=ee.findDocumentOrShadowRoot(h);if(N.latestElement!==L.activeElement){var{relatedTarget:$}=A,U=ee.toDOMNode(h,h);if($!==U&&!(wt($)&&$.hasAttribute("data-slate-spacer"))){if($!=null&&sn($)&&ee.hasDOMNode(h,$)){var re=ee.toSlateNode(h,$);if(de.isElement(re)&&!h.isVoid(re))return}if(vr){var te=L.getSelection();te==null||te.removeAllRanges()}an.delete(h)}}}},[s,N.isUpdatingSelection,N.latestElement,h,g.onBlur]),onClick:D.useCallback(A=>{if(ee.hasTarget(h,A.target)&&!it(A,g.onClick)&&sn(A.target)){var L=ee.toSlateNode(h,A.target),$=ee.findPath(h,L);if(!b.hasPath(h,$)||oe.get(h,$)!==L)return;if(A.detail===Ly&&$.length>=1){var U=$;if(!(de.isElement(L)&&b.isBlock(h,L))){var re,te=b.above(h,{match:Fe=>de.isElement(Fe)&&b.isBlock(h,Fe),at:$});U=(re=te==null?void 0:te[1])!==null&&re!==void 0?re:$.slice(0,1)}var ne=b.range(h,U);X.select(h,ne);return}if(s)return;var le=b.start(h,$),Q=b.end(h,$),pe=b.void(h,{at:le}),he=b.void(h,{at:Q});if(pe&&he&&P.equals(pe[1],he[1])){var ye=b.range(h,le);X.select(h,ye)}}},[h,g.onClick,s]),onCompositionEnd:D.useCallback(A=>{if(ee.hasSelectableTarget(h,A.target)){var L;if(ee.isComposing(h)&&Promise.resolve().then(()=>{v(!1),vn.set(h,!1)}),(L=I.current)===null||L===void 0||L.handleCompositionEnd(A),it(A,g.onCompositionEnd)||ot)return;if(!vr&&!Wb&&!$b&&!Ub&&!Hb&&A.data){var $=Ft.get(h);Ft.delete(h),$!==void 0&&(Vt.set(h,h.marks),h.marks=$),b.insertText(h,A.data);var U=Vt.get(h);Vt.delete(h),U!==void 0&&(h.marks=U)}}},[g.onCompositionEnd,h]),onCompositionUpdate:D.useCallback(A=>{ee.hasSelectableTarget(h,A.target)&&!it(A,g.onCompositionUpdate)&&(ee.isComposing(h)||(v(!0),vn.set(h,!0)))},[g.onCompositionUpdate,h]),onCompositionStart:D.useCallback(A=>{if(ee.hasSelectableTarget(h,A.target)){var L;if((L=I.current)===null||L===void 0||L.handleCompositionStart(A),it(A,g.onCompositionStart)||ot)return;v(!0);var{selection:$}=h;if($&&K.isExpanded($)){b.deleteFragment(h);return}}},[g.onCompositionStart,h]),onCopy:D.useCallback(A=>{ee.hasSelectableTarget(h,A.target)&&!it(A,g.onCopy)&&!gl(A)&&(A.preventDefault(),ee.setFragmentData(h,A.clipboardData,"copy"))},[g.onCopy,h]),onCut:D.useCallback(A=>{if(!s&&ee.hasSelectableTarget(h,A.target)&&!it(A,g.onCut)&&!gl(A)){A.preventDefault(),ee.setFragmentData(h,A.clipboardData,"cut");var{selection:L}=h;if(L)if(K.isExpanded(L))b.deleteFragment(h);else{var $=oe.parent(h,L.anchor.path);b.isVoid(h,$)&&X.delete(h)}}},[s,h,g.onCut]),onDragOver:D.useCallback(A=>{if(ee.hasTarget(h,A.target)&&!it(A,g.onDragOver)){var L=ee.toSlateNode(h,A.target);de.isElement(L)&&b.isVoid(h,L)&&A.preventDefault()}},[g.onDragOver,h]),onDragStart:D.useCallback(A=>{if(!s&&ee.hasTarget(h,A.target)&&!it(A,g.onDragStart)){var L=ee.toSlateNode(h,A.target),$=ee.findPath(h,L),U=de.isElement(L)&&b.isVoid(h,L)||b.void(h,{at:$,voids:!0});if(U){var re=b.range(h,$);X.select(h,re)}N.isDraggingInternally=!0,ee.setFragmentData(h,A.dataTransfer,"drag")}},[s,h,g.onDragStart,N]),onDrop:D.useCallback(A=>{if(!s&&ee.hasTarget(h,A.target)&&!it(A,g.onDrop)){A.preventDefault();var L=h.selection,$=ee.findEventRange(h,A),U=A.dataTransfer;X.select(h,$),N.isDraggingInternally&&L&&!K.equals(L,$)&&!b.void(h,{at:$,voids:!0})&&X.delete(h,{at:L}),ee.insertData(h,U),ee.isFocused(h)||ee.focus(h)}N.isDraggingInternally=!1},[s,h,g.onDrop,N]),onDragEnd:D.useCallback(A=>{!s&&N.isDraggingInternally&&g.onDragEnd&&ee.hasTarget(h,A.target)&&g.onDragEnd(A),N.isDraggingInternally=!1},[s,N,g,h]),onFocus:D.useCallback(A=>{if(!s&&!N.isUpdatingSelection&&ee.hasEditableTarget(h,A.target)&&!it(A,g.onFocus)){var L=ee.toDOMNode(h,h),$=ee.findDocumentOrShadowRoot(h);if(N.latestElement=$.activeElement,Hn&&A.target!==L){L.focus();return}an.set(h,!0)}},[s,N,h,g.onFocus]),onKeyDown:D.useCallback(A=>{if(!s&&ee.hasEditableTarget(h,A.target)){var L;(L=I.current)===null||L===void 0||L.handleKeyDown(A);var{nativeEvent:$}=A;if(ee.isComposing(h)&&$.isComposing===!1&&(vn.set(h,!1),v(!1)),it(A,g.onKeyDown)||ee.isComposing(h))return;var{selection:U}=h,re=h.children[U!==null?U.focus.path[0]:0],te=Pd(oe.string(re))==="rtl";if(Ve.isRedo($)){A.preventDefault();var ne=h;typeof ne.redo=="function"&&ne.redo();return}if(Ve.isUndo($)){A.preventDefault();var le=h;typeof le.undo=="function"&&le.undo();return}if(Ve.isMoveLineBackward($)){A.preventDefault(),X.move(h,{unit:"line",reverse:!0});return}if(Ve.isMoveLineForward($)){A.preventDefault(),X.move(h,{unit:"line"});return}if(Ve.isExtendLineBackward($)){A.preventDefault(),X.move(h,{unit:"line",edge:"focus",reverse:!0});return}if(Ve.isExtendLineForward($)){A.preventDefault(),X.move(h,{unit:"line",edge:"focus"});return}if(Ve.isMoveBackward($)){A.preventDefault(),U&&K.isCollapsed(U)?X.move(h,{reverse:!te}):X.collapse(h,{edge:te?"end":"start"});return}if(Ve.isMoveForward($)){A.preventDefault(),U&&K.isCollapsed(U)?X.move(h,{reverse:te}):X.collapse(h,{edge:te?"start":"end"});return}if(Ve.isMoveWordBackward($)){A.preventDefault(),U&&K.isExpanded(U)&&X.collapse(h,{edge:"focus"}),X.move(h,{unit:"word",reverse:!te});return}if(Ve.isMoveWordForward($)){A.preventDefault(),U&&K.isExpanded(U)&&X.collapse(h,{edge:"focus"}),X.move(h,{unit:"word",reverse:te});return}if(Jt){if((Gd||vr)&&U&&(Ve.isDeleteBackward($)||Ve.isDeleteForward($))&&K.isCollapsed(U)){var Q=oe.parent(h,U.anchor.path);if(de.isElement(Q)&&b.isVoid(h,Q)&&(b.isInline(h,Q)||b.isBlock(h,Q))){A.preventDefault(),b.deleteBackward(h,{unit:"block"});return}}}else{if(Ve.isBold($)||Ve.isItalic($)||Ve.isTransposeCharacter($)){A.preventDefault();return}if(Ve.isSoftBreak($)){A.preventDefault(),b.insertSoftBreak(h);return}if(Ve.isSplitBlock($)){A.preventDefault(),b.insertBreak(h);return}if(Ve.isDeleteBackward($)){A.preventDefault(),U&&K.isExpanded(U)?b.deleteFragment(h,{direction:"backward"}):b.deleteBackward(h);return}if(Ve.isDeleteForward($)){A.preventDefault(),U&&K.isExpanded(U)?b.deleteFragment(h,{direction:"forward"}):b.deleteForward(h);return}if(Ve.isDeleteLineBackward($)){A.preventDefault(),U&&K.isExpanded(U)?b.deleteFragment(h,{direction:"backward"}):b.deleteBackward(h,{unit:"line"});return}if(Ve.isDeleteLineForward($)){A.preventDefault(),U&&K.isExpanded(U)?b.deleteFragment(h,{direction:"forward"}):b.deleteForward(h,{unit:"line"});return}if(Ve.isDeleteWordBackward($)){A.preventDefault(),U&&K.isExpanded(U)?b.deleteFragment(h,{direction:"backward"}):b.deleteBackward(h,{unit:"word"});return}if(Ve.isDeleteWordForward($)){A.preventDefault(),U&&K.isExpanded(U)?b.deleteFragment(h,{direction:"forward"}):b.deleteForward(h,{unit:"word"});return}}}},[s,h,g.onKeyDown]),onPaste:D.useCallback(A=>{!s&&ee.hasEditableTarget(h,A.target)&&!it(A,g.onPaste)&&(!Jt||Zb(A.nativeEvent)||vr)&&(A.preventDefault(),ee.insertData(h,A.clipboardData))},[s,h,g.onPaste])}),D.createElement(Yy,{decorations:M,node:h,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:h.selection})))))},Qy=e=>{var{attributes:t,children:n}=e;return D.createElement("span",jt({},t),n,ot&&D.createElement("br",null))},Jy=()=>[],Xy=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&K.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),cb(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},it=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},gl=e=>sn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),e1=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},t1=D.createContext(!1),n1=D.createContext({});function r1(e){var t=D.useRef([]).current,n=D.useRef({editor:e}).current,r=D.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=D.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var a1=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],i1=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Jn(e,a1),[l,u]=D.useState(()=>{if(!oe.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Xe.stringify(s)));if(!b.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Xe.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:f}=r1(t),p=D.useCallback(h=>{var y;switch(r&&r(t.children),h==null||(y=h.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(v=>({v:v.v+1,editor:t})),f(t)},[t,f,r,a,i]);D.useEffect(()=>(ks.set(t,p),()=>{ks.set(t,()=>{})}),[t,p]);var[m,g]=D.useState(ee.isFocused(t));return D.useEffect(()=>{g(ee.isFocused(t))},[t]),Rr(()=>{var h=()=>g(ee.isFocused(t));return Yd>=17?(document.addEventListener("focusin",h),document.addEventListener("focusout",h),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",h)}):(document.addEventListener("focus",h,!0),document.addEventListener("blur",h,!0),()=>{document.removeEventListener("focus",h,!0),document.removeEventListener("blur",h,!0)})},[]),D.createElement(n1.Provider,{value:d},D.createElement(ff.Provider,{value:l},D.createElement(ho.Provider,{value:l.editor},D.createElement(t1.Provider,{value:m},n))))},vl=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},bl=(e,t,n)=>{var r=ee.toDOMRange(e,t).getBoundingClientRect(),a=ee.toDOMRange(e,n).getBoundingClientRect();return vl(r,a)&&vl(a,r)},s1=(e,t)=>{var n=b.range(e,K.end(t)),r=Array.from(b.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(bl(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;)bl(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 yl(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 Dl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yl(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var o1=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 ri.set(r,new WeakMap),r.addMark=(u,d)=>{var f,p;(f=go.get(r))===null||f===void 0||f(),!Ft.get(r)&&(p=ct.get(r))!==null&&p!==void 0&&p.length&&Ft.set(r,null),Vt.delete(r),o(u,d)},r.removeMark=u=>{var d;!Ft.get(r)&&(d=ct.get(r))!==null&&d!==void 0&&d.length&&Ft.set(r,null),Vt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&K.isCollapsed(r.selection)){var d=b.above(r,{match:g=>de.isElement(g)&&b.isBlock(r,g),at:r.selection});if(d){var[,f]=d,p=b.range(r,f,r.selection.anchor),m=s1(r,p);K.isCollapsed(m)||X.delete(r,{at:m})}}},r.apply=u=>{var d=[],f=[],p=ct.get(r);if(p!=null&&p.length){var m=p.map(j=>oy(j,u)).filter(Boolean);ct.set(r,m)}var g=tn.get(r);g&&tn.set(r,ol(r,g,u));var h=en.get(r);if(h!=null&&h.at){var y=Ee.isPoint(h==null?void 0:h.at)?Fs(r,h.at,u):ol(r,h.at,u);en.set(r,y?Dl(Dl({},h),{},{at:y}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Mn(r,u.path));break}case"set_selection":{var v;(v=Cr.get(r))===null||v===void 0||v.unref(),Cr.delete(r);break}case"insert_node":case"remove_node":{d.push(...Mn(r,P.parent(u.path)));break}case"merge_node":{var w=P.previous(u.path);d.push(...Mn(r,w));break}case"move_node":{var _=P.common(P.parent(u.path),P.parent(u.newPath));d.push(...Mn(r,_));var x;P.isBefore(u.path,u.newPath)?(d.push(...Mn(r,P.parent(u.path))),x=u.newPath):(d.push(...Mn(r,P.parent(u.newPath))),x=u.path);var k=oe.get(t,P.parent(x)),T=ee.findKey(r,k),S=b.pathRef(r,P.parent(x));f.push([S,T]);break}}a(u);for(var[q,N]of d){var[I]=b.node(r,q);Sa.set(I,N)}for(var[z,E]of f)if(z.current){var[F]=b.node(r,z.current);Sa.set(F,E)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[f,p]=K.edges(d),m=b.void(r,{at:f.path}),g=b.void(r,{at:p.path});if(!(K.isCollapsed(d)&&!m)){var h=ee.toDOMRange(r,d),y=h.cloneContents(),v=y.childNodes[0];if(y.childNodes.forEach(I=>{I.textContent&&I.textContent.trim()!==""&&(v=I)}),g){var[w]=g,_=h.cloneRange(),x=ee.toDOMNode(r,w);_.setEndAfter(x),y=_.cloneContents()}if(m&&(v=y.querySelector("[data-slate-spacer]")),Array.from(y.querySelectorAll("[data-slate-zero-width]")).forEach(I=>{var z=I.getAttribute("data-slate-zero-width")==="n";I.textContent=z?`
114
- `:""}),ef(v)){var k=v.ownerDocument.createElement("span");k.style.whiteSpace="pre",k.appendChild(v),y.appendChild(k),v=k}var T=r.getFragment(),S=JSON.stringify(T),q=window.btoa(encodeURIComponent(S));v.setAttribute("data-slate-fragment",q),u.setData("application/".concat(n),q);var N=y.ownerDocument.createElement("div");return N.appendChild(y),N.setAttribute("hidden","true"),y.ownerDocument.body.appendChild(N),u.setData("text/html",N.innerHTML),u.setData("text/plain",nf(N)),y.ownerDocument.body.removeChild(N),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||Xb(u);if(d){var f=decodeURIComponent(window.atob(d)),p=JSON.parse(f);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var d=u.getData("text/plain");if(d){var f=d.split(/\r\n|\r|\n/),p=!1;for(var m of f)p&&X.splitNodes(r,{always:!0}),r.insertText(m),p=!0;return!0}return!1},r.onChange=u=>{var d=Yd<18?Ec.unstable_batchedUpdates:f=>f();d(()=>{var f=ks.get(r);f&&f(u),i(u)})},r},Mn=(e,t)=>{var n=[];for(var[r,a]of b.levels(e,{at:t})){var i=ee.findKey(e,r);n.push([a,i])}return n};const u1={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},onMention:()=>{},reportError:e=>{console.error(e)}},Qt=D.createContext(u1);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||{}),Nt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Nt||{});const l1=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case Z.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case Z.link:return c.jsx("a",{...e,children:t});case Z.li:return c.jsx("li",{...e,children:t});case Z.mention:const a=r;return c.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case Z.ol:return c.jsx("ol",{...e,children:t});case Z.ul:return c.jsx("ul",{...e,children:t});case Z.span:return c.jsx("span",{...e,children:t});case Z.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},c1=({attributes:e,children:t,leaf:n})=>{const r=n;return r[Z.bold]&&(t=c.jsx("strong",{children:t})),r[Z.italic]&&(t=c.jsx("em",{children:t})),r[Z.strikethrough]&&(t=c.jsx("s",{children:t})),c.jsx("span",{...e,children:t})},Ts="MENTION: ",mf={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},Cl={"mention-popover":35,default:-52},Ti=16,pf=(e,t,n)=>{const r=D.useRef(null),{showLinkEditor:a,mentionPopover:i}=D.useContext(Qt),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),D.useEffect(()=>{var m,g;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,d=0;if(t==="mention-popover"){const{position:h}=i,y=_=>{if(!b.hasPath(e,_.path))return!1;const x=oe.get(e,_.path);return b.isEditor(x)||de.isElement(x)?_.offset<=x.children.length:fe.isText(x)?_.offset<=x.text.length:!1};if(h&&(!y(h==null?void 0:h.anchor)||!y(h==null?void 0:h.focus)))return;u=ee.toDOMRange(e,h||mf).getBoundingClientRect();const w=(m=document.getElementById(n))==null?void 0:m.getBoundingClientRect();l.style.setProperty("--width",`${((w==null?void 0:w.width)||0)/Ti}rem`),d=(w==null?void 0:w.left)||0}else{const h=document.getSelection();h!=null&&h.toString().trim().length&&(u=h==null?void 0:h.getRangeAt(0).getBoundingClientRect())}u||(u=(g=document.getElementById(n))==null?void 0:g.getBoundingClientRect());const f=Cl[t]||Cl.default,p=((u==null?void 0:u.top)||0)+window.scrollY+f;d===0&&(d=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${p/Ti}rem`,l.style.left=`${d/Ti}rem`},o),r},d1=e=>{const[t,n]=D.useState(null);return D.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=Wc(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 Un={[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"},[Nt.emphasis]:Z.italic,[Nt.strong]:Z.bold,[Nt.delete]:Z.strikethrough,[Nt.code]:Z.code,[Z.hr]:Z.hr,[Z.image]:Z.image};function xl(e){if(e)throw e}var Da=Object.prototype.hasOwnProperty,gf=Object.prototype.toString,wl=Object.defineProperty,El=Object.getOwnPropertyDescriptor,kl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):gf.call(t)==="[object Array]"},_l=function(t){if(!t||gf.call(t)!=="[object Object]")return!1;var n=Da.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Da.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||Da.call(t,a)},Bl=function(t,n){wl&&n.name==="__proto__"?wl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Fl=function(t,n){if(n==="__proto__")if(Da.call(t,n)){if(El)return El(t,n).value}else return;return t[n]},f1=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=Fl(o,n),a=Fl(t,n),o!==a&&(d&&a&&(_l(a)||(i=kl(a)))?(i?(i=!1,s=r&&kl(r)?r:[]):s=r&&_l(r)?r:{},Bl(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&Bl(o,{name:n,newValue:a}));return o};const Si=Fn(f1);function Ss(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 h1(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const d=e[++i];let f=-1;if(l){s(l);return}for(;++f<a.length;)(u[f]===null||u[f]===void 0)&&(u[f]=a[f]);a=u,d?m1(d,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function m1(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const d=u;if(o&&n)throw d;return a(d)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function xr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Al(e.position):"start"in e||"end"in e?Al(e):"line"in e||"column"in e?js(e):""}function js(e){return Tl(e&&e.line)+":"+Tl(e&&e.column)}function Al(e){return js(e&&e.start)+"-"+js(e&&e.end)}function Tl(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=xr(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 Ot={basename:p1,dirname:g1,extname:v1,join:b1,sep:"/"};function p1(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Lr(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 g1(e){if(Lr(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 v1(e){Lr(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 b1(...e){let t=-1,n;for(;++t<e.length;)Lr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":y1(n)}function y1(e){Lr(e);const t=e.codePointAt(0)===47;let n=D1(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function D1(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 Lr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const C1={cwd:x1};function x1(){return"/"}function Os(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function w1(e){if(typeof e=="string")e=new URL(e);else if(!Os(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 E1(e)}function E1(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const ji=["history","path","basename","stem","extname","dirname"];class k1{constructor(t){let n;t?Os(t)?n={path:t}:typeof t=="string"||_1(t)?n={value:t}:n=t:n={},this.cwd=C1.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ji.length;){const i=ji[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)ji.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ot.basename(this.path):void 0}set basename(t){Pi(t,"basename"),Oi(t,"basename"),this.path=Ot.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ot.dirname(this.path):void 0}set dirname(t){Sl(this.basename,"dirname"),this.path=Ot.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ot.extname(this.path):void 0}set extname(t){if(Oi(t,"extname"),Sl(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=Ot.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Os(t)&&(t=w1(t)),Pi(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ot.basename(this.path,this.extname):void 0}set stem(t){Pi(t,"stem"),Oi(t,"stem"),this.path=Ot.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 Oi(e,t){if(e&&e.includes(Ot.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ot.sep+"`")}function Pi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Sl(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function _1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const B1=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},F1={}.hasOwnProperty;class yo extends B1{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=h1()}copy(){const t=new yo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Si(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Mi("data",this.frozen),this.namespace[t]=n,this):F1.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Mi("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=aa(t),r=this.parser||this.Parser;return Ni("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ni("process",this.parser||this.Parser),Ri("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=aa(t),l=r.parse(o);r.run(l,o,function(d,f,p){if(d||!f||!p)return u(d);const m=f,g=r.stringify(m,p);S1(g)?p.value=g:p.result=g,u(d,p)});function u(d,f){d||!f?s(d):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),Ni("processSync",this.parser||this.Parser),Ri("processSync",this.compiler||this.Compiler),this.process(t,a),Ol("processSync","process",n),r;function a(i,s){n=!0,xl(i),r=s}}run(t,n,r){jl(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=aa(n);a.run(t,l,u);function u(d,f,p){const m=f||t;d?o(d):s?s(m):r(void 0,m,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),Ol("runSync","run",r),a;function i(s,o){xl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=aa(n),a=this.compiler||this.Compiler;return Ri("stringify",a),jl(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Mi("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;l(d,f)}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=Si(!0,a.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let f=-1,p=-1;for(;++f<r.length;)if(r[f][0]===u){p=f;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[m,...g]=d;const h=r[p][1];Ss(h)&&Ss(m)&&(m=Si(!0,h,m)),r[p]=[u,m,...g]}}}}const A1=new yo().freeze();function Ni(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ri(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Mi(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 jl(e){if(!Ss(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ol(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function aa(e){return T1(e)?e:new k1(e)}function T1(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function S1(e){return typeof e=="string"||j1(e)}function j1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const O1={};function P1(e,t){const n=t||O1,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return vf(e,r,a)}function vf(e,t,n){if(N1(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 Pl(e.children,t,n)}return Array.isArray(e)?Pl(e,t,n):""}function Pl(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=vf(e[a],t,n);return r.join("")}function N1(e){return!!(e&&typeof e=="object")}const Nl=document.createElement("i");function Do(e){const t="&"+e+";";Nl.innerHTML=t;const n=Nl.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function $t(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 xt(e,t){return e.length>0?($t(e,e.length,0,t),e):t}const Rl={}.hasOwnProperty;function R1(e){const t={};let n=-1;for(;++n<e.length;)M1(t,e[n]);return t}function M1(e,t){let n;for(n in t){const a=(Rl.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){Rl.call(a,s)||(a[s]=[]);const o=i[s];I1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function I1(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);$t(e,0,0,r)}function bf(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 Zn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Pt=dn(/[A-Za-z]/),At=dn(/[\dA-Za-z]/),$1=dn(/[#-'*+\--9=?A-Z^-~]/);function Ps(e){return e!==null&&(e<32||e===127)}const Ns=dn(/\d/),L1=dn(/[\dA-Fa-f]/),z1=dn(/[!-/:-@[-`{-~]/);function De(e){return e!==null&&e<-2}function ft(e){return e!==null&&(e<0||e===32)}function Pe(e){return e===-2||e===-1||e===32}const q1=dn(/\p{P}|\p{S}/u),W1=dn(/\s/);function dn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ze(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Pe(l)?(e.enter(n),o(l)):t(l)}function o(l){return Pe(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const H1={tokenize:U1};function U1(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"),ze(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 De(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const V1={tokenize:K1},Ml={tokenize:Z1};function K1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(_){if(r<n.length){const x=n[r];return t.containerState=x[1],e.attempt(x[0].continuation,l,u)(_)}return u(_)}function l(_){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&w();const x=t.events.length;let k=x,T;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){T=t.events[k][1].end;break}v(r);let S=x;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},T),S++;return $t(t.events,k+1,0,t.events.slice(x)),t.events.length=S,u(_)}return o(_)}function u(_){if(r===n.length){if(!a)return p(_);if(a.currentConstruct&&a.currentConstruct.concrete)return g(_);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Ml,d,f)(_)}function d(_){return a&&w(),v(r),p(_)}function f(_){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(_)}function p(_){return t.containerState={},e.attempt(Ml,m,g)(_)}function m(_){return r++,n.push([t.currentConstruct,t.containerState]),p(_)}function g(_){if(_===null){a&&w(),v(0),e.consume(_);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),h(_)}function h(_){if(_===null){y(e.exit("chunkFlow"),!0),v(0),e.consume(_);return}return De(_)?(e.consume(_),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(_),h)}function y(_,x){const k=t.sliceStream(_);if(x&&k.push(null),_.previous=i,i&&(i.next=_),i=_,a.defineSkip(_.start),a.write(k),t.parser.lazy[_.start.line]){let T=a.events.length;for(;T--;)if(a.events[T][1].start.offset<s&&(!a.events[T][1].end||a.events[T][1].end.offset>s))return;const S=t.events.length;let q=S,N,I;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){if(N){I=t.events[q][1].end;break}N=!0}for(v(r),T=S;T<t.events.length;)t.events[T][1].end=Object.assign({},I),T++;$t(t.events,q+1,0,t.events.slice(S)),t.events.length=T}}function v(_){let x=n.length;for(;x-- >_;){const k=n[x];t.containerState=k[1],k[0].exit.call(t,e)}n.length=_}function w(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function Z1(e,t,n){return ze(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Il(e){if(e===null||ft(e)||W1(e))return 1;if(q1(e))return 2}function Co(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 Rs={name:"attention",tokenize:G1,resolveAll:Y1};function Y1(e,t){let n=-1,r,a,i,s,o,l,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);$l(f,-l),$l(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:p},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=xt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=xt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=xt(u,Co(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=xt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=xt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,$t(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function G1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Il(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),d=Il(l),f=!d||d===2&&a||n.includes(l),p=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?f:f&&(a||!p)),u._close=!!(i===42?p:p&&(d||!f)),t(l)}}function $l(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Q1={name:"autolink",tokenize:J1};function J1(e,t,n){let r=0;return a;function a(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return Pt(m)?(e.consume(m),s):u(m)}function s(m){return m===43||m===45||m===46||At(m)?(r=1,o(m)):u(m)}function o(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||At(m))&&r++<32?(e.consume(m),o):(r=0,u(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||Ps(m)?n(m):(e.consume(m),l)}function u(m){return m===64?(e.consume(m),d):$1(m)?(e.consume(m),u):n(m)}function d(m){return At(m)?f(m):n(m)}function f(m){return m===46?(e.consume(m),r=0,d):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):p(m)}function p(m){if((m===45||At(m))&&r++<63){const g=m===45?p:f;return e.consume(m),g}return n(m)}}const ai={tokenize:X1,partial:!0};function X1(e,t,n){return r;function r(i){return Pe(i)?ze(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||De(i)?t(i):n(i)}}const yf={name:"blockQuote",tokenize:eD,continuation:{tokenize:tD},exit:nD};function eD(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 Pe(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function tD(e,t,n){const r=this;return a;function a(s){return Pe(s)?ze(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(yf,t,n)(s)}}function nD(e){e.exit("blockQuote")}const Df={name:"characterEscape",tokenize:rD};function rD(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 z1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Cf={name:"characterReference",tokenize:aD};function aD(e,t,n){const r=this;let a=0,i,s;return o;function o(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=At,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=L1,d):(e.enter("characterReferenceValue"),i=7,s=Ns,d(f))}function d(f){if(f===59&&a){const p=e.exit("characterReferenceValue");return s===At&&!Do(r.sliceSerialize(p))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(f)&&a++<i?(e.consume(f),d):n(f)}}const Ll={tokenize:sD,partial:!0},zl={name:"codeFenced",tokenize:iD,concrete:!0};function iD(e,t,n){const r=this,a={tokenize:k,partial:!0};let i=0,s=0,o;return l;function l(T){return u(T)}function u(T){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(T)}function d(T){return T===o?(s++,e.consume(T),d):s<3?n(T):(e.exit("codeFencedFenceSequence"),Pe(T)?ze(e,f,"whitespace")(T):f(T))}function f(T){return T===null||De(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(Ll,h,x)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(T))}function p(T){return T===null||De(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(T)):Pe(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ze(e,m,"whitespace")(T)):T===96&&T===o?n(T):(e.consume(T),p)}function m(T){return T===null||De(T)?f(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||De(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(T)):T===96&&T===o?n(T):(e.consume(T),g)}function h(T){return e.attempt(a,x,y)(T)}function y(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),v}function v(T){return i>0&&Pe(T)?ze(e,w,"linePrefix",i+1)(T):w(T)}function w(T){return T===null||De(T)?e.check(Ll,h,x)(T):(e.enter("codeFlowValue"),_(T))}function _(T){return T===null||De(T)?(e.exit("codeFlowValue"),w(T)):(e.consume(T),_)}function x(T){return e.exit("codeFenced"),t(T)}function k(T,S,q){let N=0;return I;function I(M){return T.enter("lineEnding"),T.consume(M),T.exit("lineEnding"),z}function z(M){return T.enter("codeFencedFence"),Pe(M)?ze(T,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):E(M)}function E(M){return M===o?(T.enter("codeFencedFenceSequence"),F(M)):q(M)}function F(M){return M===o?(N++,T.consume(M),F):N>=s?(T.exit("codeFencedFenceSequence"),Pe(M)?ze(T,j,"whitespace")(M):j(M)):q(M)}function j(M){return M===null||De(M)?(T.exit("codeFencedFence"),S(M)):q(M)}}}function sD(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 Ii={name:"codeIndented",tokenize:uD},oD={tokenize:lD,partial:!0};function uD(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),ze(e,i,"linePrefix",4+1)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):De(u)?e.attempt(oD,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||De(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function lD(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):De(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):ze(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):De(s)?a(s):n(s)}}const cD={name:"codeText",tokenize:hD,resolve:dD,previous:fD};function dD(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 fD(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function hD(e,t,n){let r=0,a,i;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),o(f)}function o(f){return f===96?(e.consume(f),r++,o):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(i=e.enter("codeTextSequence"),a=0,d(f)):De(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||De(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}function xf(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,mD(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),$t(e,a,n-a+1,o))}}return!u}function mD(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 d,f,p=-1,m=n,g=0,h=0;const y=[h];for(;m;){for(;e[++a][1]!==m;);i.push(a),m._tokenizer||(d=r.sliceStream(m),m.next||d.push(null),f&&s.defineSkip(m.start),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=m,m=m.next}for(m=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(h=p+1,y.push(h),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(s.events=[],m?(m._tokenizer=void 0,m.previous=void 0):y.pop(),p=y.length;p--;){const v=o.slice(y[p],y[p+1]),w=i.pop();l.unshift([w,w+v.length-1]),$t(e,w,2,v)}for(p=-1;++p<l.length;)u[g+l[p][0]]=g+l[p][1],g+=l[p][1]-l[p][0]-1;return u}const pD={tokenize:bD,resolve:vD},gD={tokenize:yD,partial:!0};function vD(e){return xf(e),e}function bD(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):De(o)?e.check(gD,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 yD(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ze(e,i,"linePrefix")}function i(s){if(s===null||De(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 wf(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return f;function f(v){return v===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(v),e.exit(i),p):v===null||v===32||v===41||Ps(v)?n(v):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),h(v))}function p(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(v))}function m(v){return v===62?(e.exit("chunkString"),e.exit(o),p(v)):v===null||v===60||De(v)?n(v):(e.consume(v),v===92?g:m)}function g(v){return v===60||v===62||v===92?(e.consume(v),m):m(v)}function h(v){return!d&&(v===null||v===41||ft(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):d<u&&v===40?(e.consume(v),d++,h):v===41?(e.consume(v),d--,h):v===null||v===32||v===40||Ps(v)?n(v):(e.consume(v),v===92?y:h)}function y(v){return v===40||v===41||v===92?(e.consume(v),h):h(v)}}function Ef(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(m){return e.enter(r),e.enter(a),e.consume(m),e.exit(a),e.enter(i),d}function d(m){return o>999||m===null||m===91||m===93&&!l||m===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(m):m===93?(e.exit(i),e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):De(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===null||m===91||m===93||De(m)||o++>999?(e.exit("chunkString"),d(m)):(e.consume(m),l||(l=!Pe(m)),m===92?p:f)}function p(m){return m===91||m===92||m===93?(e.consume(m),o++,f):f(m)}}function kf(e,t,n,r,a,i){let s;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(a),e.consume(p),e.exit(a),s=p===40?41:p,l):n(p)}function l(p){return p===s?(e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===s?(e.exit(i),l(s)):p===null?n(p):De(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),ze(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===s||p===null||De(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?f:d)}function f(p){return p===s||p===92?(e.consume(p),d):d(p)}}function wr(e,t){let n;return r;function r(a){return De(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Pe(a)?ze(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const DD={name:"definition",tokenize:xD},CD={tokenize:wD,partial:!0};function xD(e,t,n){const r=this;let a;return i;function i(m){return e.enter("definition"),s(m)}function s(m){return Ef.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return a=Zn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):n(m)}function l(m){return ft(m)?wr(e,u)(m):u(m)}function u(m){return wf(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(CD,f,f)(m)}function f(m){return Pe(m)?ze(e,p,"whitespace")(m):p(m)}function p(m){return m===null||De(m)?(e.exit("definition"),r.parser.defined.push(a),t(m)):n(m)}}function wD(e,t,n){return r;function r(o){return ft(o)?wr(e,a)(o):n(o)}function a(o){return kf(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Pe(o)?ze(e,s,"whitespace")(o):s(o)}function s(o){return o===null||De(o)?t(o):n(o)}}const ED={name:"hardBreakEscape",tokenize:kD};function kD(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return De(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const _D={name:"headingAtx",tokenize:FD,resolve:BD};function BD(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"},$t(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function FD(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||ft(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||De(d)?(e.exit("atxHeading"),t(d)):Pe(d)?ze(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||ft(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const AD=["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"],ql=["pre","script","style","textarea"],TD={name:"htmlFlow",tokenize:PD,resolveTo:OD,concrete:!0},SD={tokenize:RD,partial:!0},jD={tokenize:ND,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 PD(e,t,n){const r=this;let a,i,s,o,l;return u;function u(B){return d(B)}function d(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),f}function f(B){return B===33?(e.consume(B),p):B===47?(e.consume(B),i=!0,h):B===63?(e.consume(B),a=3,r.interrupt?t:C):Pt(B)?(e.consume(B),s=String.fromCharCode(B),y):n(B)}function p(B){return B===45?(e.consume(B),a=2,m):B===91?(e.consume(B),a=5,o=0,g):Pt(B)?(e.consume(B),a=4,r.interrupt?t:C):n(B)}function m(B){return B===45?(e.consume(B),r.interrupt?t:C):n(B)}function g(B){const A="CDATA[";return B===A.charCodeAt(o++)?(e.consume(B),o===A.length?r.interrupt?t:E:g):n(B)}function h(B){return Pt(B)?(e.consume(B),s=String.fromCharCode(B),y):n(B)}function y(B){if(B===null||B===47||B===62||ft(B)){const A=B===47,L=s.toLowerCase();return!A&&!i&&ql.includes(L)?(a=1,r.interrupt?t(B):E(B)):AD.includes(s.toLowerCase())?(a=6,A?(e.consume(B),v):r.interrupt?t(B):E(B)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):i?w(B):_(B))}return B===45||At(B)?(e.consume(B),s+=String.fromCharCode(B),y):n(B)}function v(B){return B===62?(e.consume(B),r.interrupt?t:E):n(B)}function w(B){return Pe(B)?(e.consume(B),w):I(B)}function _(B){return B===47?(e.consume(B),I):B===58||B===95||Pt(B)?(e.consume(B),x):Pe(B)?(e.consume(B),_):I(B)}function x(B){return B===45||B===46||B===58||B===95||At(B)?(e.consume(B),x):k(B)}function k(B){return B===61?(e.consume(B),T):Pe(B)?(e.consume(B),k):_(B)}function T(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),l=B,S):Pe(B)?(e.consume(B),T):q(B)}function S(B){return B===l?(e.consume(B),l=null,N):B===null||De(B)?n(B):(e.consume(B),S)}function q(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),q)}function N(B){return B===47||B===62||Pe(B)?_(B):n(B)}function I(B){return B===62?(e.consume(B),z):n(B)}function z(B){return B===null||De(B)?E(B):Pe(B)?(e.consume(B),z):n(B)}function E(B){return B===45&&a===2?(e.consume(B),V):B===60&&a===1?(e.consume(B),G):B===62&&a===4?(e.consume(B),R):B===63&&a===3?(e.consume(B),C):B===93&&a===5?(e.consume(B),ae):De(B)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(SD,W,F)(B)):B===null||De(B)?(e.exit("htmlFlowData"),F(B)):(e.consume(B),E)}function F(B){return e.check(jD,j,W)(B)}function j(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),M}function M(B){return B===null||De(B)?F(B):(e.enter("htmlFlowData"),E(B))}function V(B){return B===45?(e.consume(B),C):E(B)}function G(B){return B===47?(e.consume(B),s="",J):E(B)}function J(B){if(B===62){const A=s.toLowerCase();return ql.includes(A)?(e.consume(B),R):E(B)}return Pt(B)&&s.length<8?(e.consume(B),s+=String.fromCharCode(B),J):E(B)}function ae(B){return B===93?(e.consume(B),C):E(B)}function C(B){return B===62?(e.consume(B),R):B===45&&a===2?(e.consume(B),C):E(B)}function R(B){return B===null||De(B)?(e.exit("htmlFlowData"),W(B)):(e.consume(B),R)}function W(B){return e.exit("htmlFlow"),t(B)}}function ND(e,t,n){const r=this;return a;function a(s){return De(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 RD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(ai,t,n)}}const MD={name:"htmlText",tokenize:ID};function ID(e,t,n){const r=this;let a,i,s;return o;function o(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),l}function l(C){return C===33?(e.consume(C),u):C===47?(e.consume(C),k):C===63?(e.consume(C),_):Pt(C)?(e.consume(C),q):n(C)}function u(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),i=0,g):Pt(C)?(e.consume(C),w):n(C)}function d(C){return C===45?(e.consume(C),m):n(C)}function f(C){return C===null?n(C):C===45?(e.consume(C),p):De(C)?(s=f,G(C)):(e.consume(C),f)}function p(C){return C===45?(e.consume(C),m):f(C)}function m(C){return C===62?V(C):C===45?p(C):f(C)}function g(C){const R="CDATA[";return C===R.charCodeAt(i++)?(e.consume(C),i===R.length?h:g):n(C)}function h(C){return C===null?n(C):C===93?(e.consume(C),y):De(C)?(s=h,G(C)):(e.consume(C),h)}function y(C){return C===93?(e.consume(C),v):h(C)}function v(C){return C===62?V(C):C===93?(e.consume(C),v):h(C)}function w(C){return C===null||C===62?V(C):De(C)?(s=w,G(C)):(e.consume(C),w)}function _(C){return C===null?n(C):C===63?(e.consume(C),x):De(C)?(s=_,G(C)):(e.consume(C),_)}function x(C){return C===62?V(C):_(C)}function k(C){return Pt(C)?(e.consume(C),T):n(C)}function T(C){return C===45||At(C)?(e.consume(C),T):S(C)}function S(C){return De(C)?(s=S,G(C)):Pe(C)?(e.consume(C),S):V(C)}function q(C){return C===45||At(C)?(e.consume(C),q):C===47||C===62||ft(C)?N(C):n(C)}function N(C){return C===47?(e.consume(C),V):C===58||C===95||Pt(C)?(e.consume(C),I):De(C)?(s=N,G(C)):Pe(C)?(e.consume(C),N):V(C)}function I(C){return C===45||C===46||C===58||C===95||At(C)?(e.consume(C),I):z(C)}function z(C){return C===61?(e.consume(C),E):De(C)?(s=z,G(C)):Pe(C)?(e.consume(C),z):N(C)}function E(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),a=C,F):De(C)?(s=E,G(C)):Pe(C)?(e.consume(C),E):(e.consume(C),j)}function F(C){return C===a?(e.consume(C),a=void 0,M):C===null?n(C):De(C)?(s=F,G(C)):(e.consume(C),F)}function j(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||ft(C)?N(C):(e.consume(C),j)}function M(C){return C===47||C===62||ft(C)?N(C):n(C)}function V(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function G(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),J}function J(C){return Pe(C)?ze(e,ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):ae(C)}function ae(C){return e.enter("htmlTextData"),s(C)}}const xo={name:"labelEnd",tokenize:HD,resolveTo:WD,resolveAll:qD},$D={tokenize:UD},LD={tokenize:VD},zD={tokenize:KD};function qD(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 WD(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},d={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=xt(o,e.slice(i+1,i+r+3)),o=xt(o,[["enter",d,t]]),o=xt(o,Co(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=xt(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=xt(o,e.slice(s+1)),o=xt(o,[["exit",l,t]]),$t(e,i,e.length,o),e}function HD(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(p){return i?i._inactive?f(p):(s=r.parser.defined.includes(Zn(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt($D,d,s?d:f)(p):p===91?e.attempt(LD,d,s?u:f)(p):s?d(p):f(p)}function u(p){return e.attempt(zD,d,f)(p)}function d(p){return t(p)}function f(p){return i._balanced=!0,n(p)}}function UD(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),a}function a(f){return ft(f)?wr(e,i)(f):i(f)}function i(f){return f===41?d(f):wf(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return ft(f)?wr(e,l)(f):d(f)}function o(f){return n(f)}function l(f){return f===34||f===39||f===40?kf(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return ft(f)?wr(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function VD(e,t,n){const r=this;return a;function a(o){return Ef.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Zn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function KD(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 ZD={name:"labelStartImage",tokenize:YD,resolveAll:xo.resolveAll};function YD(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 GD={name:"labelStartLink",tokenize:QD,resolveAll:xo.resolveAll};function QD(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 $i={name:"lineEnding",tokenize:JD};function JD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ze(e,t,"linePrefix")}}const Ca={name:"thematicBreak",tokenize:XD};function XD(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||De(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Pe(u)?ze(e,o,"whitespace")(u):o(u))}}const lt={name:"list",tokenize:nC,continuation:{tokenize:rC},exit:iC},eC={tokenize:sC,partial:!0},tC={tokenize:aC,partial:!0};function nC(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(m){const g=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Ns(m)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Ca,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return Ns(m)&&++s<10?(e.consume(m),l):(!r.interrupt||s<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(ai,r.interrupt?n:d,e.attempt(eC,p,f))}function d(m){return r.containerState.initialBlankLine=!0,i++,p(m)}function f(m){return Pe(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function rC(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ai,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ze(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Pe(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(tC,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,ze(e,e.attempt(lt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function aC(e,t,n){const r=this;return ze(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 iC(e){e.exit(this.containerState.type)}function sC(e,t,n){const r=this;return ze(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!Pe(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Wl={name:"setextUnderline",tokenize:uC,resolveTo:oC};function oC(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 uC(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(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"),Pe(u)?ze(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||De(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const lC={tokenize:cC};function cC(e){const t=this,n=e.attempt(ai,r,e.attempt(this.parser.constructs.flowInitial,a,ze(e,e.attempt(this.parser.constructs.flow,a,e.attempt(pD,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 dC={resolveAll:Bf()},fC=_f("string"),hC=_f("text");function _f(e){return{tokenize:t,resolveAll:Bf(e==="text"?mC:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const f=a[d];let p=-1;if(f)for(;++p<f.length;){const m=f[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function Bf(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 mC(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 pC(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:_,exit:x,attempt:S(k),check:S(T),interrupt:S(T,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:m,sliceSerialize:p,now:g,defineSkip:h,write:f};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function f(z){return s=xt(s,z),y(),s[s.length-1]!==null?[]:(q(t,0),u.events=Co(i,u.events,u),u.events)}function p(z,E){return vC(m(z),E)}function m(z){return gC(s,z)}function g(){const{line:z,column:E,offset:F,_index:j,_bufferIndex:M}=r;return{line:z,column:E,offset:F,_index:j,_bufferIndex:M}}function h(z){a[z.line]=z.column,I()}function y(){let z;for(;r._index<s.length;){const E=s[r._index];if(typeof E=="string")for(z=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===z&&r._bufferIndex<E.length;)v(E.charCodeAt(r._bufferIndex));else v(E)}}function v(z){d=d(z)}function w(z){De(z)?(r.line++,r.column=1,r.offset+=z===-3?2:1,I()):z!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=z}function _(z,E){const F=E||{};return F.type=z,F.start=g(),u.events.push(["enter",F,u]),o.push(F),F}function x(z){const E=o.pop();return E.end=g(),u.events.push(["exit",E,u]),E}function k(z,E){q(z,E.from)}function T(z,E){E.restore()}function S(z,E){return F;function F(j,M,V){let G,J,ae,C;return Array.isArray(j)?W(j):"tokenize"in j?W([j]):R(j);function R($){return U;function U(re){const te=re!==null&&$[re],ne=re!==null&&$.null,le=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(ne)?ne:ne?[ne]:[]];return W(le)(re)}}function W($){return G=$,J=0,$.length===0?V:B($[J])}function B($){return U;function U(re){return C=N(),ae=$,$.partial||(u.currentConstruct=$),$.name&&u.parser.constructs.disable.null.includes($.name)?L():$.tokenize.call(E?Object.assign(Object.create(u),E):u,l,A,L)(re)}}function A($){return z(ae,C),M}function L($){return C.restore(),++J<G.length?B(G[J]):V}}}function q(z,E){z.resolveAll&&!i.includes(z)&&i.push(z),z.resolve&&$t(u.events,E,u.events.length-E,z.resolve(u.events.slice(E),u)),z.resolveTo&&(u.events=z.resolveTo(u.events,u))}function N(){const z=g(),E=u.previous,F=u.currentConstruct,j=u.events.length,M=Array.from(o);return{restore:V,from:j};function V(){r=z,u.previous=E,u.currentConstruct=F,u.events.length=j,o=M,I()}}function I(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function gC(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 vC(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
+ `);ve.forEach((we,Ke)=>{we&&b.insertText(t,we),Ke!==ve.length-1&&b.insertSoftBreak(t)})},{at:M});if(P.equals(M.anchor.path,M.focus.path)){var[Ue,ge]=K.edges(M),H={start:Ue.offset,end:ge.offset,text:ke};if(ke&&u&&j==="insertCompositionText"){var ie=u.start+u.text.search(/\S|$/),me=H.start+H.text.search(/\S|$/);me===ie+1&&H.end===u.start+u.text.length?(H.start-=1,u=null,I()):u=!1}else j==="insertText"?u===null?u=H:u&&K.isCollapsed(M)&&u.end+u.text.length===Ue.offset?u=na(na({},u),{},{text:u.text+ke}):u=!1:u=!1;if(C){D(Ue.path,H);return}}return v(()=>b.insertText(t,ke),{at:M})}}}},B=()=>!!en.get(t),x=()=>{var w;return!!((w=ct.get(t))!==null&&w!==void 0&&w.length)},k=()=>B()||x(),T=()=>a,S=w=>{tn.set(t,w),s&&(clearTimeout(s),s=null);var{selection:F}=t;if(w){var j=!F||!P.equals(F.anchor.path,w.anchor.path),M=!F||!P.equals(F.anchor.path.slice(0,-1),w.anchor.path.slice(0,-1));(j&&u||M)&&(u=!1),(j||x())&&(s=setTimeout(p,oy))}},q=()=>{(B()||!x())&&p()},N=w=>{x()||(f(!0),setTimeout(f))},I=()=>{B()||(o=setTimeout(p))},z=w=>{if(!(x()||B())&&w.some(j=>go(t,j,w))){var F;(F=Gd.get(t))===null||F===void 0||F()}};return{flush:p,scheduleFlush:I,hasPendingDiffs:x,hasPendingAction:B,hasPendingChanges:k,isFlushing:T,handleUserSelect:S,handleCompositionEnd:m,handleCompositionStart:g,handleDOMBeforeInput:E,handleKeyDown:N,handleDomMutations:z,handleInput:q}}function dy(){var e=y.useRef(!1);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Rr=ga?y.useLayoutEffect:y.useEffect;function fy(e,t,n){var[r]=y.useState(()=>new MutationObserver(t));Rr(()=>{r.takeRecords()}),y.useEffect(()=>{if(!e.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");return r.observe(e.current,n),()=>r.disconnect()},[r,e,n])}var hy=["node"];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 my(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){Et(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 py={subtree:!0,childList:!0,characterData:!0},gy=ot?e=>{var{node:t}=e,n=Qn(e,hy);if(!ot)return null;var r=cn(),a=dy(),[i]=y.useState(()=>cy(my({editor:r},n)));return fy(t,i.handleDomMutations,py),mo.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,vy=["anchor","focus"],by=["anchor","focus"],yy=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),rf=(e,t)=>{var n=Qn(e,vy),r=Qn(t,by);return e[Jn]===t[Jn]&&yy(n,r)},Dy=(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(!K.equals(r,a)||!rf(r,a))return!1}return!0},Cy=(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||!rf(r,a))return!1}return!0};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 xy(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){Et(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=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=cn(),s=ee.findPath(i,a),o=P.parent(s),l=!!n[Qd];return i.isVoid(r)?y.createElement(Bi,{length:oe.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&b.string(i,o)===""?y.createElement(Bi,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?y.createElement(Bi,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
112
+ `?y.createElement(ll,{isTrailing:!0,text:n.text}):y.createElement(ll,{text:n.text})},ll=e=>{var{text:t,isTrailing:n=!1}=e,r=y.useRef(null),a=()=>"".concat(t??"").concat(n?`
113
+ `:""),[i]=y.useState(a);return Rr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(Ey,{ref:r},i)},Ey=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Bi=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),y.createElement("span",xy({},a),!ot||!n?"\uFEFF":null,n?y.createElement("br",null):null)};function cl(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 af(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cl(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ky=ot?300:0;function _y(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function dl(e){e.current&&(clearTimeout(e.current),e.current=null)}var By=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=E=>y.createElement(Ay,af({},E))}=e,o=cn(),l=y.useRef(null),u=y.useRef(null),[c,h]=y.useState(!1),p=y.useRef(null),m=y.useCallback(E=>{if(_y(l,E==null),E==null){var B;Cs.delete(o),(B=t.onPlaceholderResize)===null||B===void 0||B.call(t,null)}else{if(Cs.set(o,E),!l.current){var x=window.ResizeObserver||Ab;l.current=new x(()=>{var k;(k=t.onPlaceholderResize)===null||k===void 0||k.call(t,E)})}l.current.observe(E),u.current=E}},[u,t,o]),g=y.createElement(wy,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[Jn];if(y.useEffect(()=>(f?p.current||(p.current=setTimeout(()=>{h(!0),p.current=null},ky)):(dl(p),h(!1)),()=>dl(p)),[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:vr?"inherit":void 0},contentEditable:!1,ref:m}};g=y.createElement(y.Fragment,null,i(D),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},Fy=y.memo(By,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&fe.equals(t.leaf,e.leaf)&&t.leaf[Jn]===e.leaf[Jn]),Ay=e=>{var{attributes:t,children:n}=e;return y.createElement("span",af({},t),n)},Ty=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=cn(),l=y.useRef(null),u=fe.decorations(s,t),c=ee.findKey(o,s),h=[],p=0;p<u.length;p++){var m=u[p];h.push(y.createElement(Fy,{isLast:n&&p===u.length-1,key:"".concat(c.id,"-").concat(p),renderPlaceholder:a,leaf:m,text:s,parent:r,renderLeaf:i}))}var g=y.useCallback(f=>{var D=ti.get(o);f?(D==null||D.set(c,f),Cn.set(s,f),Nr.set(f,s)):(D==null||D.delete(c),Cn.delete(s),l.current&&Nr.delete(l.current)),l.current=f},[l,o,c,s]);return y.createElement("span",{"data-slate-node":"text",ref:g},h)},sf=y.memo(Ty,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&Cy(t.decorations,e.decorations));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 Bs(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){Et(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 Sy=e=>{var{decorations:t,element:n,renderElement:r=E=>y.createElement(Oy,Bs({},E)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=cn(),l=Ry(),u=o.isInline(n),c=ee.findKey(o,n),h=y.useCallback(E=>{var B=ti.get(o);E?(B==null||B.set(c,E),Cn.set(n,E),Nr.set(E,n)):(B==null||B.delete(c),Cn.delete(n))},[o,c,n]),p=uf({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),m={"data-slate-node":"element",ref:h};if(u&&(m["data-slate-inline"]=!0),!u&&b.hasInlines(o,n)){var g=oe.string(n),f=jd(g);f==="rtl"&&(m.dir=f)}if(b.isVoid(o,n)){m["data-slate-void"]=!0,!l&&u&&(m.contentEditable=!1);var D=u?"span":"div",[[v]]=oe.texts(n);p=y.createElement(D,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(sf,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),fo.set(v,0),ho.set(v,n)}return r({attributes:m,children:p,element:n})},jy=y.memo(Sy,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&Dy(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&K.equals(e.selection,t.selection))),Oy=e=>{var{attributes:t,children:n,element:r}=e,a=cn(),i=a.isInline(r)?"span":"div";return y.createElement(i,Bs(Bs({},t),{},{style:{position:"relative"}}),n)},of=y.createContext(()=>[]),Py=()=>y.useContext(of),Ny=y.createContext(!1),uf=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=Py(),l=cn(),u=ee.findPath(l,n),c=[],h=de.isElement(n)&&!l.isInline(n)&&b.hasInlines(l,n),p=0;p<n.children.length;p++){var m=u.concat(p),g=n.children[p],f=ee.findKey(l,g),D=b.range(l,m),v=s&&K.intersection(D,s),E=o([g,m]);for(var B of t){var x=K.intersection(B,D);x&&E.push(x)}de.isElement(g)?c.push(y.createElement(Ny.Provider,{key:"provider-".concat(f.id),value:!!v},y.createElement(jy,{decorations:E,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):c.push(y.createElement(sf,{decorations:E,key:f.id,isLast:h&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),fo.set(g,p),ho.set(g,n)}return c},lf=y.createContext(!1),Ry=()=>y.useContext(lf),cf=y.createContext(null),Sn=()=>{var e=y.useContext(cf);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function My(){var e=cn(),t=y.useRef(!1),n=y.useRef(0),r=y.useCallback(()=>{if(!t.current){t.current=!0;var a=ee.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return y.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var Iy=3,$y={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"},Ly={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"},zy={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},We=e=>{var t=$y[e],n=Ly[e],r=zy[e],a=t&&_i(t),i=n&&_i(n),s=r&&_i(r);return o=>!!(a&&a(o)||rl&&i&&i(o)||!rl&&s&&s(o))},Ve={isBold:We("bold"),isCompose:We("compose"),isMoveBackward:We("moveBackward"),isMoveForward:We("moveForward"),isDeleteBackward:We("deleteBackward"),isDeleteForward:We("deleteForward"),isDeleteLineBackward:We("deleteLineBackward"),isDeleteLineForward:We("deleteLineForward"),isDeleteWordBackward:We("deleteWordBackward"),isDeleteWordForward:We("deleteWordForward"),isExtendBackward:We("extendBackward"),isExtendForward:We("extendForward"),isExtendLineBackward:We("extendLineBackward"),isExtendLineForward:We("extendLineForward"),isItalic:We("italic"),isMoveLineBackward:We("moveLineBackward"),isMoveLineForward:We("moveLineForward"),isMoveWordBackward:We("moveWordBackward"),isMoveWordForward:We("moveWordForward"),isRedo:We("redo"),isSoftBreak:We("insertSoftBreak"),isSplitBlock:We("splitBlock"),isTransposeCharacter:We("transposeCharacter"),isUndo:We("undo")},qy=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>go(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}},Wy={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class df extends y.Component{constructor(){super(...arguments),Et(this,"context",null),Et(this,"manager",null),Et(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,Wy)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=qy(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}}Et(df,"contextType",co);var Hy=ot?df:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},Uy=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],Vy=["text"];function hl(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 jt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hl(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ky=e=>y.createElement(y.Fragment,null,uf(e)),Zy=e=>{var t=y.useCallback(A=>y.createElement(Yy,jt({},A)),[]),{autoFocus:n,decorate:r=Gy,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=Qy,style:h={},as:p="div",disableDefaultStyles:m=!1}=e,g=Qn(e,Uy),f=Sn(),[D,v]=y.useState(!1),E=y.useRef(null),B=y.useRef([]),[x,k]=y.useState(),{onUserInput:T,receivedUserInput:S}=My(),[,q]=y.useReducer(A=>A+1,0);Gd.set(f,q),xs.set(f,s);var N=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{E.current&&n&&E.current.focus()},[n]);var I=y.useRef(),z=y.useMemo(()=>ib(()=>{var A=I.current;if((ot||!ee.isComposing(f))&&(!N.isUpdatingSelection||A!=null&&A.isFlushing())&&!N.isDraggingInternally){var L=ee.findDocumentOrShadowRoot(f),{activeElement:$}=L,U=ee.toDOMNode(f,f),re=L.getSelection();if($===U?(N.latestElement=$,an.set(f,!0)):an.delete(f),!re)return X.deselect(f);var{anchorNode:te,focusNode:ne}=re,le=ee.hasEditableTarget(f,te)||ee.isTargetInsideNonReadonlyVoid(f,te),Q=ee.hasEditableTarget(f,ne)||ee.isTargetInsideNonReadonlyVoid(f,ne);if(le&&Q){var pe=ee.toSlateRange(f,re,{exactMatch:!1,suppressThrow:!0});pe&&(!ee.isComposing(f)&&!(A!=null&&A.hasPendingChanges())&&!(A!=null&&A.isFlushing())?X.select(f,pe):A==null||A.handleUserSelect(pe))}s&&(!le||!Q)&&X.deselect(f)}},100),[f,s,N]),w=y.useMemo(()=>X0(z,0),[z]);I.current=gy({node:E,onDOMSelectionChange:z,scheduleOnDOMSelectionChange:w}),Rr(()=>{var A,L,$;E.current&&($=po(E.current))?(Yd.set(f,$),va.set(f,E.current),Cn.set(f,E.current),Nr.set(E.current,f)):Cn.delete(f);var{selection:U}=f,re=ee.findDocumentOrShadowRoot(f),te=re.getSelection();if(!(!te||!ee.isFocused(f)||(A=I.current)!==null&&A!==void 0&&A.hasPendingAction())){var ne=he=>{var ye=te.type!=="None";if(!(!U&&!ye)){var Fe=te.focusNode,Ae;if(Wn&&te.rangeCount>1){var He=te.getRangeAt(0),Se=te.getRangeAt(te.rangeCount-1);He.startContainer===Fe?Ae=Se.endContainer:Ae=He.startContainer}else Ae=te.anchorNode;var Te=va.get(f),Ne=!1;if(Te.contains(Ae)&&Te.contains(Fe)&&(Ne=!0),ye&&Ne&&U&&!he){var ke=ee.toSlateRange(f,te,{exactMatch:!0,suppressThrow:!0});if(ke&&K.equals(ke,U)){var Ue;if(!N.hasMarkPlaceholder||(Ue=Ae)!==null&&Ue!==void 0&&(Ue=Ue.parentElement)!==null&&Ue!==void 0&&Ue.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!ee.hasRange(f,U)){f.selection=ee.toSlateRange(f,te,{exactMatch:!1,suppressThrow:!0});return}N.isUpdatingSelection=!0;var ge=U&&ee.toDOMRange(f,U);return ge?(ee.isComposing(f)&&!ot?te.collapseToEnd():K.isBackward(U)?te.setBaseAndExtent(ge.endContainer,ge.endOffset,ge.startContainer,ge.startOffset):te.setBaseAndExtent(ge.startContainer,ge.startOffset,ge.endContainer,ge.endOffset),c(f,ge)):te.removeAllRanges(),ge}};te.rangeCount<=1&&ne();var le=((L=I.current)===null||L===void 0?void 0:L.isFlushing())==="action";if(!ot||!le){setTimeout(()=>{N.isUpdatingSelection=!1});return}var Q=null,pe=requestAnimationFrame(()=>{if(le){var he=ye=>{try{var Fe=ee.toDOMNode(f,f);Fe.focus(),ne(ye)}catch{}};he(),Q=setTimeout(()=>{he(!0),N.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(pe),Q&&clearTimeout(Q)}}});var F=y.useCallback(A=>{if(T(),!s&&ee.hasEditableTarget(f,A.target)&&!Jy(A,a)){var L;if(I.current)return I.current.handleDOMBeforeInput(A);w.flush(),z.flush();var{selection:$}=f,{inputType:U}=A,re=A.dataTransfer||A.data||void 0,te=U==="insertCompositionText"||U==="deleteCompositionText";if(te&&ee.isComposing(f))return;var ne=!1;if(U==="insertText"&&$&&K.isCollapsed($)&&A.data&&A.data.length===1&&/[a-z ]/i.test(A.data)&&$.anchor.offset!==0){var le,Q;ne=!0,f.marks&&(ne=!1);var{anchor:pe}=$,[he,ye]=ee.toDOMPoint(f,pe),Fe=(le=he.parentElement)===null||le===void 0?void 0:le.closest("a"),Ae=ee.getWindow(f);if(ne&&Fe&&ee.hasDOMNode(f,Fe)){var He,Se=Ae==null?void 0:Ae.document.createTreeWalker(Fe,NodeFilter.SHOW_TEXT).lastChild();Se===he&&((He=Se.textContent)===null||He===void 0?void 0:He.length)===ye&&(ne=!1)}if(ne&&he.parentElement&&(Ae==null||(Q=Ae.getComputedStyle(he.parentElement))===null||Q===void 0?void 0:Q.whiteSpace)==="pre"){var Te=b.above(f,{at:pe.path,match:ie=>de.isElement(ie)&&b.isBlock(f,ie)});Te&&oe.string(Te[0]).includes(" ")&&(ne=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[Ne]=A.getTargetRanges();if(Ne){var ke=ee.toSlateRange(f,Ne,{exactMatch:!1,suppressThrow:!1});if(!$||!K.equals($,ke)){ne=!1;var Ue=!te&&f.selection&&b.rangeRef(f,f.selection);X.select(f,ke),Ue&&Cr.set(f,Ue)}}}if(te)return;if(ne||A.preventDefault(),$&&K.isExpanded($)&&U.startsWith("delete")){var ge=U.endsWith("Backward")?"backward":"forward";b.deleteFragment(f,{direction:ge});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"&&ee.isComposing(f)&&(v(!1),vn.set(f,!1)),(re==null?void 0:re.constructor.name)==="DataTransfer"?ee.insertData(f,re):typeof re=="string"&&(ne?B.current.push(()=>b.insertText(f,re)):b.insertText(f,re));break}}var H=(L=Cr.get(f))===null||L===void 0?void 0:L.unref();Cr.delete(f),H&&(!f.selection||!K.equals(f.selection,H))&&X.select(f,H)}},[f,z,T,a,s,w]),j=y.useCallback(A=>{A==null?(z.cancel(),w.cancel(),va.delete(f),Cn.delete(f),E.current&&Jt&&E.current.removeEventListener("beforeinput",F)):Jt&&A.addEventListener("beforeinput",F),E.current=A},[z,w,f,F]);Rr(()=>{var A=ee.getWindow(f);return A.document.addEventListener("selectionchange",w),()=>{A.document.removeEventListener("selectionchange",w)}},[w]);var M=r([f,[]]),V=i&&f.children.length===1&&Array.from(oe.texts(f)).length===1&&oe.string(f)===""&&!D,G=y.useCallback(A=>{if(A&&V){var L;k((L=A.getBoundingClientRect())===null||L===void 0?void 0:L.height)}else k(void 0)},[V]);if(V){var J=b.start(f,[]);M.push({[Jn]:!0,placeholder:i,onPlaceholderResize:G,anchor:J,focus:J})}var{marks:ae}=f;if(N.hasMarkPlaceholder=!1,f.selection&&K.isCollapsed(f.selection)&&ae){var{anchor:C}=f.selection,R=oe.leaf(f,C.path),W=Qn(R,Vy);if(!fe.equals(R,ae,{loose:!0})){N.hasMarkPlaceholder=!0;var _=Object.fromEntries(Object.keys(W).map(A=>[A,null]));M.push(jt(jt(jt({[Qd]:!0},_),ae),{},{anchor:C,focus:C}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:A}=f;if(A){var{anchor:L}=A,$=oe.leaf(f,L.path);if(ae&&!fe.equals($,ae,{loose:!0})){Ft.set(f,ae);return}}Ft.delete(f)})}),y.createElement(lf.Provider,{value:s},y.createElement(of.Provider,{value:r},y.createElement(Hy,{node:E,receivedUserInput:S},y.createElement(p,jt(jt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Jt||!ga?g.spellCheck:!1,autoCorrect:Jt||!ga?g.autoCorrect:"false",autoCapitalize:Jt||!ga?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:j,style:jt(jt({},m?{}:jt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},x?{minHeight:x}:{})),h),onBeforeInput:y.useCallback(A=>{if(!Jt&&!s&&!it(A,g.onBeforeInput)&&ee.hasSelectableTarget(f,A.target)&&(A.preventDefault(),!ee.isComposing(f))){var L=A.data;b.insertText(f,L)}},[g.onBeforeInput,f,s]),onInput:y.useCallback(A=>{if(!it(A,g.onInput)){if(I.current){I.current.handleInput();return}for(var L of B.current)L();B.current=[]}},[g.onInput]),onBlur:y.useCallback(A=>{if(!(s||N.isUpdatingSelection||!ee.hasSelectableTarget(f,A.target)||it(A,g.onBlur))){var L=ee.findDocumentOrShadowRoot(f);if(N.latestElement!==L.activeElement){var{relatedTarget:$}=A,U=ee.toDOMNode(f,f);if($!==U&&!(wt($)&&$.hasAttribute("data-slate-spacer"))){if($!=null&&sn($)&&ee.hasDOMNode(f,$)){var re=ee.toSlateNode(f,$);if(de.isElement(re)&&!f.isVoid(re))return}if(vr){var te=L.getSelection();te==null||te.removeAllRanges()}an.delete(f)}}}},[s,N.isUpdatingSelection,N.latestElement,f,g.onBlur]),onClick:y.useCallback(A=>{if(ee.hasTarget(f,A.target)&&!it(A,g.onClick)&&sn(A.target)){var L=ee.toSlateNode(f,A.target),$=ee.findPath(f,L);if(!b.hasPath(f,$)||oe.get(f,$)!==L)return;if(A.detail===Iy&&$.length>=1){var U=$;if(!(de.isElement(L)&&b.isBlock(f,L))){var re,te=b.above(f,{match:Fe=>de.isElement(Fe)&&b.isBlock(f,Fe),at:$});U=(re=te==null?void 0:te[1])!==null&&re!==void 0?re:$.slice(0,1)}var ne=b.range(f,U);X.select(f,ne);return}if(s)return;var le=b.start(f,$),Q=b.end(f,$),pe=b.void(f,{at:le}),he=b.void(f,{at:Q});if(pe&&he&&P.equals(pe[1],he[1])){var ye=b.range(f,le);X.select(f,ye)}}},[f,g.onClick,s]),onCompositionEnd:y.useCallback(A=>{if(ee.hasSelectableTarget(f,A.target)){var L;if(ee.isComposing(f)&&Promise.resolve().then(()=>{v(!1),vn.set(f,!1)}),(L=I.current)===null||L===void 0||L.handleCompositionEnd(A),it(A,g.onCompositionEnd)||ot)return;if(!vr&&!zb&&!Mb&&!Wb&&!qb&&A.data){var $=Ft.get(f);Ft.delete(f),$!==void 0&&(Vt.set(f,f.marks),f.marks=$),b.insertText(f,A.data);var U=Vt.get(f);Vt.delete(f),U!==void 0&&(f.marks=U)}}},[g.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(A=>{ee.hasSelectableTarget(f,A.target)&&!it(A,g.onCompositionUpdate)&&(ee.isComposing(f)||(v(!0),vn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:y.useCallback(A=>{if(ee.hasSelectableTarget(f,A.target)){var L;if((L=I.current)===null||L===void 0||L.handleCompositionStart(A),it(A,g.onCompositionStart)||ot)return;v(!0);var{selection:$}=f;if($&&K.isExpanded($)){b.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:y.useCallback(A=>{ee.hasSelectableTarget(f,A.target)&&!it(A,g.onCopy)&&!ml(A)&&(A.preventDefault(),ee.setFragmentData(f,A.clipboardData,"copy"))},[g.onCopy,f]),onCut:y.useCallback(A=>{if(!s&&ee.hasSelectableTarget(f,A.target)&&!it(A,g.onCut)&&!ml(A)){A.preventDefault(),ee.setFragmentData(f,A.clipboardData,"cut");var{selection:L}=f;if(L)if(K.isExpanded(L))b.deleteFragment(f);else{var $=oe.parent(f,L.anchor.path);b.isVoid(f,$)&&X.delete(f)}}},[s,f,g.onCut]),onDragOver:y.useCallback(A=>{if(ee.hasTarget(f,A.target)&&!it(A,g.onDragOver)){var L=ee.toSlateNode(f,A.target);de.isElement(L)&&b.isVoid(f,L)&&A.preventDefault()}},[g.onDragOver,f]),onDragStart:y.useCallback(A=>{if(!s&&ee.hasTarget(f,A.target)&&!it(A,g.onDragStart)){var L=ee.toSlateNode(f,A.target),$=ee.findPath(f,L),U=de.isElement(L)&&b.isVoid(f,L)||b.void(f,{at:$,voids:!0});if(U){var re=b.range(f,$);X.select(f,re)}N.isDraggingInternally=!0,ee.setFragmentData(f,A.dataTransfer,"drag")}},[s,f,g.onDragStart,N]),onDrop:y.useCallback(A=>{if(!s&&ee.hasTarget(f,A.target)&&!it(A,g.onDrop)){A.preventDefault();var L=f.selection,$=ee.findEventRange(f,A),U=A.dataTransfer;X.select(f,$),N.isDraggingInternally&&L&&!K.equals(L,$)&&!b.void(f,{at:$,voids:!0})&&X.delete(f,{at:L}),ee.insertData(f,U),ee.isFocused(f)||ee.focus(f)}N.isDraggingInternally=!1},[s,f,g.onDrop,N]),onDragEnd:y.useCallback(A=>{!s&&N.isDraggingInternally&&g.onDragEnd&&ee.hasTarget(f,A.target)&&g.onDragEnd(A),N.isDraggingInternally=!1},[s,N,g,f]),onFocus:y.useCallback(A=>{if(!s&&!N.isUpdatingSelection&&ee.hasEditableTarget(f,A.target)&&!it(A,g.onFocus)){var L=ee.toDOMNode(f,f),$=ee.findDocumentOrShadowRoot(f);if(N.latestElement=$.activeElement,Wn&&A.target!==L){L.focus();return}an.set(f,!0)}},[s,N,f,g.onFocus]),onKeyDown:y.useCallback(A=>{if(!s&&ee.hasEditableTarget(f,A.target)){var L;(L=I.current)===null||L===void 0||L.handleKeyDown(A);var{nativeEvent:$}=A;if(ee.isComposing(f)&&$.isComposing===!1&&(vn.set(f,!1),v(!1)),it(A,g.onKeyDown)||ee.isComposing(f))return;var{selection:U}=f,re=f.children[U!==null?U.focus.path[0]:0],te=jd(oe.string(re))==="rtl";if(Ve.isRedo($)){A.preventDefault();var ne=f;typeof ne.redo=="function"&&ne.redo();return}if(Ve.isUndo($)){A.preventDefault();var le=f;typeof le.undo=="function"&&le.undo();return}if(Ve.isMoveLineBackward($)){A.preventDefault(),X.move(f,{unit:"line",reverse:!0});return}if(Ve.isMoveLineForward($)){A.preventDefault(),X.move(f,{unit:"line"});return}if(Ve.isExtendLineBackward($)){A.preventDefault(),X.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Ve.isExtendLineForward($)){A.preventDefault(),X.move(f,{unit:"line",edge:"focus"});return}if(Ve.isMoveBackward($)){A.preventDefault(),U&&K.isCollapsed(U)?X.move(f,{reverse:!te}):X.collapse(f,{edge:te?"end":"start"});return}if(Ve.isMoveForward($)){A.preventDefault(),U&&K.isCollapsed(U)?X.move(f,{reverse:te}):X.collapse(f,{edge:te?"start":"end"});return}if(Ve.isMoveWordBackward($)){A.preventDefault(),U&&K.isExpanded(U)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:!te});return}if(Ve.isMoveWordForward($)){A.preventDefault(),U&&K.isExpanded(U)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:te});return}if(Jt){if((Zd||vr)&&U&&(Ve.isDeleteBackward($)||Ve.isDeleteForward($))&&K.isCollapsed(U)){var Q=oe.parent(f,U.anchor.path);if(de.isElement(Q)&&b.isVoid(f,Q)&&(b.isInline(f,Q)||b.isBlock(f,Q))){A.preventDefault(),b.deleteBackward(f,{unit:"block"});return}}}else{if(Ve.isBold($)||Ve.isItalic($)||Ve.isTransposeCharacter($)){A.preventDefault();return}if(Ve.isSoftBreak($)){A.preventDefault(),b.insertSoftBreak(f);return}if(Ve.isSplitBlock($)){A.preventDefault(),b.insertBreak(f);return}if(Ve.isDeleteBackward($)){A.preventDefault(),U&&K.isExpanded(U)?b.deleteFragment(f,{direction:"backward"}):b.deleteBackward(f);return}if(Ve.isDeleteForward($)){A.preventDefault(),U&&K.isExpanded(U)?b.deleteFragment(f,{direction:"forward"}):b.deleteForward(f);return}if(Ve.isDeleteLineBackward($)){A.preventDefault(),U&&K.isExpanded(U)?b.deleteFragment(f,{direction:"backward"}):b.deleteBackward(f,{unit:"line"});return}if(Ve.isDeleteLineForward($)){A.preventDefault(),U&&K.isExpanded(U)?b.deleteFragment(f,{direction:"forward"}):b.deleteForward(f,{unit:"line"});return}if(Ve.isDeleteWordBackward($)){A.preventDefault(),U&&K.isExpanded(U)?b.deleteFragment(f,{direction:"backward"}):b.deleteBackward(f,{unit:"word"});return}if(Ve.isDeleteWordForward($)){A.preventDefault(),U&&K.isExpanded(U)?b.deleteFragment(f,{direction:"forward"}):b.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:y.useCallback(A=>{!s&&ee.hasEditableTarget(f,A.target)&&!it(A,g.onPaste)&&(!Jt||Vb(A.nativeEvent)||vr)&&(A.preventDefault(),ee.insertData(f,A.clipboardData))},[s,f,g.onPaste])}),y.createElement(Ky,{decorations:M,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},Yy=e=>{var{attributes:t,children:n}=e;return y.createElement("span",jt({},t),n,ot&&y.createElement("br",null))},Gy=()=>[],Qy=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&K.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),ub(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},it=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},ml=e=>sn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),Jy=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},Xy=y.createContext(!1),e1=y.createContext({});function t1(e){var t=y.useRef([]).current,n=y.useRef({editor:e}).current,r=y.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=y.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var n1=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],r1=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Qn(e,n1),[l,u]=y.useState(()=>{if(!oe.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Xe.stringify(s)));if(!b.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Xe.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:c,onChange:h}=t1(t),p=y.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(v=>({v:v.v+1,editor:t})),h(t)},[t,h,r,a,i]);y.useEffect(()=>(ws.set(t,p),()=>{ws.set(t,()=>{})}),[t,p]);var[m,g]=y.useState(ee.isFocused(t));return y.useEffect(()=>{g(ee.isFocused(t))},[t]),Rr(()=>{var f=()=>g(ee.isFocused(t));return Kd>=17?(document.addEventListener("focusin",f),document.addEventListener("focusout",f),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",f)}):(document.addEventListener("focus",f,!0),document.addEventListener("blur",f,!0),()=>{document.removeEventListener("focus",f,!0),document.removeEventListener("blur",f,!0)})},[]),y.createElement(e1.Provider,{value:c},y.createElement(cf.Provider,{value:l},y.createElement(co.Provider,{value:l.editor},y.createElement(Xy.Provider,{value:m},n))))},pl=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},gl=(e,t,n)=>{var r=ee.toDOMRange(e,t).getBoundingClientRect(),a=ee.toDOMRange(e,n).getBoundingClientRect();return pl(r,a)&&pl(a,r)},a1=(e,t)=>{var n=b.range(e,K.end(t)),r=Array.from(b.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(gl(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;)gl(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 vl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function bl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vl(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var i1=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 ti.set(r,new WeakMap),r.addMark=(u,c)=>{var h,p;(h=mo.get(r))===null||h===void 0||h(),!Ft.get(r)&&(p=ct.get(r))!==null&&p!==void 0&&p.length&&Ft.set(r,null),Vt.delete(r),o(u,c)},r.removeMark=u=>{var c;!Ft.get(r)&&(c=ct.get(r))!==null&&c!==void 0&&c.length&&Ft.set(r,null),Vt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&K.isCollapsed(r.selection)){var c=b.above(r,{match:g=>de.isElement(g)&&b.isBlock(r,g),at:r.selection});if(c){var[,h]=c,p=b.range(r,h,r.selection.anchor),m=a1(r,p);K.isCollapsed(m)||X.delete(r,{at:m})}}},r.apply=u=>{var c=[],h=[],p=ct.get(r);if(p!=null&&p.length){var m=p.map(j=>iy(j,u)).filter(Boolean);ct.set(r,m)}var g=tn.get(r);g&&tn.set(r,il(r,g,u));var f=en.get(r);if(f!=null&&f.at){var D=Ee.isPoint(f==null?void 0:f.at)?_s(r,f.at,u):il(r,f.at,u);en.set(r,D?bl(bl({},f),{},{at:D}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...Rn(r,u.path));break}case"set_selection":{var v;(v=Cr.get(r))===null||v===void 0||v.unref(),Cr.delete(r);break}case"insert_node":case"remove_node":{c.push(...Rn(r,P.parent(u.path)));break}case"merge_node":{var E=P.previous(u.path);c.push(...Rn(r,E));break}case"move_node":{var B=P.common(P.parent(u.path),P.parent(u.newPath));c.push(...Rn(r,B));var x;P.isBefore(u.path,u.newPath)?(c.push(...Rn(r,P.parent(u.path))),x=u.newPath):(c.push(...Rn(r,P.parent(u.newPath))),x=u.path);var k=oe.get(t,P.parent(x)),T=ee.findKey(r,k),S=b.pathRef(r,P.parent(x));h.push([S,T]);break}}a(u);for(var[q,N]of c){var[I]=b.node(r,q);Aa.set(I,N)}for(var[z,w]of h)if(z.current){var[F]=b.node(r,z.current);Aa.set(F,w)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[h,p]=K.edges(c),m=b.void(r,{at:h.path}),g=b.void(r,{at:p.path});if(!(K.isCollapsed(c)&&!m)){var f=ee.toDOMRange(r,c),D=f.cloneContents(),v=D.childNodes[0];if(D.childNodes.forEach(I=>{I.textContent&&I.textContent.trim()!==""&&(v=I)}),g){var[E]=g,B=f.cloneRange(),x=ee.toDOMNode(r,E);B.setEndAfter(x),D=B.cloneContents()}if(m&&(v=D.querySelector("[data-slate-spacer]")),Array.from(D.querySelectorAll("[data-slate-zero-width]")).forEach(I=>{var z=I.getAttribute("data-slate-zero-width")==="n";I.textContent=z?`
114
+ `:""}),Jd(v)){var k=v.ownerDocument.createElement("span");k.style.whiteSpace="pre",k.appendChild(v),D.appendChild(k),v=k}var T=r.getFragment(),S=JSON.stringify(T),q=window.btoa(encodeURIComponent(S));v.setAttribute("data-slate-fragment",q),u.setData("application/".concat(n),q);var N=D.ownerDocument.createElement("div");return N.appendChild(D),N.setAttribute("hidden","true"),D.ownerDocument.body.appendChild(N),u.setData("text/html",N.innerHTML),u.setData("text/plain",ef(N)),D.ownerDocument.body.removeChild(N),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||Qb(u);if(c){var h=decodeURIComponent(window.atob(c)),p=JSON.parse(h);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var h=c.split(/\r\n|\r|\n/),p=!1;for(var m of h)p&&X.splitNodes(r,{always:!0}),r.insertText(m),p=!0;return!0}return!1},r.onChange=u=>{var c=Kd<18?xc.unstable_batchedUpdates:h=>h();c(()=>{var h=ws.get(r);h&&h(u),i(u)})},r},Rn=(e,t)=>{var n=[];for(var[r,a]of b.levels(e,{at:t})){var i=ee.findKey(e,r);n.push([a,i])}return n};const s1={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},onMention:()=>{},reportError:e=>{console.error(e)}},Qt=y.createContext(s1);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||{}),Nt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Nt||{});const o1=({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})}},u1=({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})},Fs="MENTION: ",ff={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},yl={"mention-popover":35,default:-52},Fi=16,hf=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:a,mentionPopover:i}=y.useContext(Qt),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var m,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=B=>{if(!b.hasPath(e,B.path))return!1;const x=oe.get(e,B.path);return b.isEditor(x)||de.isElement(x)?B.offset<=x.children.length:fe.isText(x)?B.offset<=x.text.length:!1};if(f&&(!D(f==null?void 0:f.anchor)||!D(f==null?void 0:f.focus)))return;u=ee.toDOMRange(e,f||ff).getBoundingClientRect();const E=(m=document.getElementById(n))==null?void 0:m.getBoundingClientRect();l.style.setProperty("--width",`${((E==null?void 0:E.width)||0)/Fi}rem`),c=(E==null?void 0:E.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=yl[t]||yl.default,p=((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=`${p/Fi}rem`,l.style.left=`${c/Fi}rem`},o),r},l1=e=>{const[t,n]=y.useState(null);return y.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=zc(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 Hn={[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"},[Nt.emphasis]:Z.italic,[Nt.strong]:Z.bold,[Nt.delete]:Z.strikethrough,[Nt.code]:Z.code,[Z.hr]:Z.hr,[Z.image]:Z.image};function Dl(e){if(e)throw e}var ba=Object.prototype.hasOwnProperty,mf=Object.prototype.toString,Cl=Object.defineProperty,xl=Object.getOwnPropertyDescriptor,wl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):mf.call(t)==="[object Array]"},El=function(t){if(!t||mf.call(t)!=="[object Object]")return!1;var n=ba.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&ba.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||ba.call(t,a)},kl=function(t,n){Cl&&n.name==="__proto__"?Cl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},_l=function(t,n){if(n==="__proto__")if(ba.call(t,n)){if(xl)return xl(t,n).value}else return;return t[n]},c1=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=_l(o,n),a=_l(t,n),o!==a&&(c&&a&&(El(a)||(i=wl(a)))?(i?(i=!1,s=r&&wl(r)?r:[]):s=r&&El(r)?r:{},kl(o,{name:n,newValue:e(c,s,a)})):typeof a<"u"&&kl(o,{name:n,newValue:a}));return o};const Ai=Fn(c1);function As(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 d1(){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?f1(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 f1(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 xr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Bl(e.position):"start"in e||"end"in e?Bl(e):"line"in e||"column"in e?Ts(e):""}function Ts(e){return Fl(e&&e.line)+":"+Fl(e&&e.column)}function Bl(e){return Ts(e&&e.start)+"-"+Ts(e&&e.end)}function Fl(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=xr(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 Ot={basename:h1,dirname:m1,extname:p1,join:g1,sep:"/"};function h1(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Lr(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 m1(e){if(Lr(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 p1(e){Lr(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 g1(...e){let t=-1,n;for(;++t<e.length;)Lr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":v1(n)}function v1(e){Lr(e);const t=e.codePointAt(0)===47;let n=b1(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function b1(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 Lr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const y1={cwd:D1};function D1(){return"/"}function Ss(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function C1(e){if(typeof e=="string")e=new URL(e);else if(!Ss(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 x1(e)}function x1(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 Ti=["history","path","basename","stem","extname","dirname"];class w1{constructor(t){let n;t?Ss(t)?n={path:t}:typeof t=="string"||E1(t)?n={value:t}:n=t:n={},this.cwd=y1.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ti.length;){const i=Ti[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)Ti.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ot.basename(this.path):void 0}set basename(t){ji(t,"basename"),Si(t,"basename"),this.path=Ot.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ot.dirname(this.path):void 0}set dirname(t){Al(this.basename,"dirname"),this.path=Ot.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ot.extname(this.path):void 0}set extname(t){if(Si(t,"extname"),Al(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=Ot.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ss(t)&&(t=C1(t)),ji(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ot.basename(this.path,this.extname):void 0}set stem(t){ji(t,"stem"),Si(t,"stem"),this.path=Ot.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 Si(e,t){if(e&&e.includes(Ot.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ot.sep+"`")}function ji(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Al(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 k1=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},_1={}.hasOwnProperty;class vo extends k1{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=d1()}copy(){const t=new vo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ai(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ni("data",this.frozen),this.namespace[t]=n,this):_1.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ni("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=ra(t),r=this.parser||this.Parser;return Oi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Oi("process",this.parser||this.Parser),Pi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=ra(t),l=r.parse(o);r.run(l,o,function(c,h,p){if(c||!h||!p)return u(c);const m=h,g=r.stringify(m,p);A1(g)?p.value=g:p.result=g,u(c,p)});function u(c,h){c||!h?s(c):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Oi("processSync",this.parser||this.Parser),Pi("processSync",this.compiler||this.Compiler),this.process(t,a),Sl("processSync","process",n),r;function a(i,s){n=!0,Dl(i),r=s}}run(t,n,r){Tl(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=ra(n);a.run(t,l,u);function u(c,h,p){const m=h||t;c?o(c):s?s(m):r(void 0,m,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),Sl("runSync","run",r),a;function i(s,o){Dl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=ra(n),a=this.compiler||this.Compiler;return Pi("stringify",a),Tl(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Ni("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=Ai(!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,p=-1;for(;++h<r.length;)if(r[h][0]===u){p=h;break}if(p===-1)r.push([u,...c]);else if(c.length>0){let[m,...g]=c;const f=r[p][1];As(f)&&As(m)&&(m=Ai(!0,f,m)),r[p]=[u,m,...g]}}}}const B1=new vo().freeze();function Oi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Pi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ni(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 Tl(e){if(!As(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Sl(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ra(e){return F1(e)?e:new w1(e)}function F1(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function A1(e){return typeof e=="string"||T1(e)}function T1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const S1={};function j1(e,t){const n=t||S1,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return pf(e,r,a)}function pf(e,t,n){if(O1(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 jl(e.children,t,n)}return Array.isArray(e)?jl(e,t,n):""}function jl(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=pf(e[a],t,n);return r.join("")}function O1(e){return!!(e&&typeof e=="object")}const Ol=document.createElement("i");function bo(e){const t="&"+e+";";Ol.innerHTML=t;const n=Ol.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function $t(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 xt(e,t){return e.length>0?($t(e,e.length,0,t),e):t}const Pl={}.hasOwnProperty;function P1(e){const t={};let n=-1;for(;++n<e.length;)N1(t,e[n]);return t}function N1(e,t){let n;for(n in t){const a=(Pl.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){Pl.call(a,s)||(a[s]=[]);const o=i[s];R1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function R1(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);$t(e,0,0,r)}function gf(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 Kn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Pt=dn(/[A-Za-z]/),At=dn(/[\dA-Za-z]/),M1=dn(/[#-'*+\--9=?A-Z^-~]/);function js(e){return e!==null&&(e<32||e===127)}const Os=dn(/\d/),I1=dn(/[\dA-Fa-f]/),$1=dn(/[!-/:-@[-`{-~]/);function De(e){return e!==null&&e<-2}function ft(e){return e!==null&&(e<0||e===32)}function Pe(e){return e===-2||e===-1||e===32}const L1=dn(/\p{P}|\p{S}/u),z1=dn(/\s/);function dn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ze(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Pe(l)?(e.enter(n),o(l)):t(l)}function o(l){return Pe(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const q1={tokenize:W1};function W1(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"),ze(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 De(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const H1={tokenize:U1},Nl={tokenize:V1};function U1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(B){if(r<n.length){const x=n[r];return t.containerState=x[1],e.attempt(x[0].continuation,l,u)(B)}return u(B)}function l(B){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&E();const x=t.events.length;let k=x,T;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){T=t.events[k][1].end;break}v(r);let S=x;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},T),S++;return $t(t.events,k+1,0,t.events.slice(x)),t.events.length=S,u(B)}return o(B)}function u(B){if(r===n.length){if(!a)return p(B);if(a.currentConstruct&&a.currentConstruct.concrete)return g(B);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Nl,c,h)(B)}function c(B){return a&&E(),v(r),p(B)}function h(B){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(B)}function p(B){return t.containerState={},e.attempt(Nl,m,g)(B)}function m(B){return r++,n.push([t.currentConstruct,t.containerState]),p(B)}function g(B){if(B===null){a&&E(),v(0),e.consume(B);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(B)}function f(B){if(B===null){D(e.exit("chunkFlow"),!0),v(0),e.consume(B);return}return De(B)?(e.consume(B),D(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(B),f)}function D(B,x){const k=t.sliceStream(B);if(x&&k.push(null),B.previous=i,i&&(i.next=B),i=B,a.defineSkip(B.start),a.write(k),t.parser.lazy[B.start.line]){let T=a.events.length;for(;T--;)if(a.events[T][1].start.offset<s&&(!a.events[T][1].end||a.events[T][1].end.offset>s))return;const S=t.events.length;let q=S,N,I;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){if(N){I=t.events[q][1].end;break}N=!0}for(v(r),T=S;T<t.events.length;)t.events[T][1].end=Object.assign({},I),T++;$t(t.events,q+1,0,t.events.slice(S)),t.events.length=T}}function v(B){let x=n.length;for(;x-- >B;){const k=n[x];t.containerState=k[1],k[0].exit.call(t,e)}n.length=B}function E(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function V1(e,t,n){return ze(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Rl(e){if(e===null||ft(e)||z1(e))return 1;if(L1(e))return 2}function yo(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 Ps={name:"attention",tokenize:Z1,resolveAll:K1};function K1(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),p=Object.assign({},e[n][1].start);Ml(h,-l),Ml(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:p},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=xt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=xt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=xt(u,yo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=xt(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=xt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,$t(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 Z1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Rl(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=Rl(l),h=!c||c===2&&a||n.includes(l),p=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?h:h&&(a||!p)),u._close=!!(i===42?p:p&&(c||!h)),t(l)}}function Ml(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Y1={name:"autolink",tokenize:G1};function G1(e,t,n){let r=0;return a;function a(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return Pt(m)?(e.consume(m),s):u(m)}function s(m){return m===43||m===45||m===46||At(m)?(r=1,o(m)):u(m)}function o(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||At(m))&&r++<32?(e.consume(m),o):(r=0,u(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||js(m)?n(m):(e.consume(m),l)}function u(m){return m===64?(e.consume(m),c):M1(m)?(e.consume(m),u):n(m)}function c(m){return At(m)?h(m):n(m)}function h(m){return m===46?(e.consume(m),r=0,c):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):p(m)}function p(m){if((m===45||At(m))&&r++<63){const g=m===45?p:h;return e.consume(m),g}return n(m)}}const ni={tokenize:Q1,partial:!0};function Q1(e,t,n){return r;function r(i){return Pe(i)?ze(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||De(i)?t(i):n(i)}}const vf={name:"blockQuote",tokenize:J1,continuation:{tokenize:X1},exit:eD};function J1(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 Pe(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function X1(e,t,n){const r=this;return a;function a(s){return Pe(s)?ze(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(vf,t,n)(s)}}function eD(e){e.exit("blockQuote")}const bf={name:"characterEscape",tokenize:tD};function tD(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 $1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const yf={name:"characterReference",tokenize:nD};function nD(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=At,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=I1,c):(e.enter("characterReferenceValue"),i=7,s=Os,c(h))}function c(h){if(h===59&&a){const p=e.exit("characterReferenceValue");return s===At&&!bo(r.sliceSerialize(p))?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 Il={tokenize:aD,partial:!0},$l={name:"codeFenced",tokenize:rD,concrete:!0};function rD(e,t,n){const r=this,a={tokenize:k,partial:!0};let i=0,s=0,o;return l;function l(T){return u(T)}function u(T){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(T)}function c(T){return T===o?(s++,e.consume(T),c):s<3?n(T):(e.exit("codeFencedFenceSequence"),Pe(T)?ze(e,h,"whitespace")(T):h(T))}function h(T){return T===null||De(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(Il,f,x)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(T))}function p(T){return T===null||De(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(T)):Pe(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ze(e,m,"whitespace")(T)):T===96&&T===o?n(T):(e.consume(T),p)}function m(T){return T===null||De(T)?h(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||De(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(T)):T===96&&T===o?n(T):(e.consume(T),g)}function f(T){return e.attempt(a,x,D)(T)}function D(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),v}function v(T){return i>0&&Pe(T)?ze(e,E,"linePrefix",i+1)(T):E(T)}function E(T){return T===null||De(T)?e.check(Il,f,x)(T):(e.enter("codeFlowValue"),B(T))}function B(T){return T===null||De(T)?(e.exit("codeFlowValue"),E(T)):(e.consume(T),B)}function x(T){return e.exit("codeFenced"),t(T)}function k(T,S,q){let N=0;return I;function I(M){return T.enter("lineEnding"),T.consume(M),T.exit("lineEnding"),z}function z(M){return T.enter("codeFencedFence"),Pe(M)?ze(T,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):w(M)}function w(M){return M===o?(T.enter("codeFencedFenceSequence"),F(M)):q(M)}function F(M){return M===o?(N++,T.consume(M),F):N>=s?(T.exit("codeFencedFenceSequence"),Pe(M)?ze(T,j,"whitespace")(M):j(M)):q(M)}function j(M){return M===null||De(M)?(T.exit("codeFencedFence"),S(M)):q(M)}}}function aD(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 Ri={name:"codeIndented",tokenize:sD},iD={tokenize:oD,partial:!0};function sD(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),ze(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):De(u)?e.attempt(iD,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||De(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function oD(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):De(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):ze(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):De(s)?a(s):n(s)}}const uD={name:"codeText",tokenize:dD,resolve:lD,previous:cD};function lD(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 cD(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function dD(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)):De(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||De(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 Df(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,fD(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),$t(e,a,n-a+1,o))}}return!u}function fD(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,p=-1,m=n,g=0,f=0;const D=[f];for(;m;){for(;e[++a][1]!==m;);i.push(a),m._tokenizer||(c=r.sliceStream(m),m.next||c.push(null),h&&s.defineSkip(m.start),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(f=p+1,D.push(f),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(s.events=[],m?(m._tokenizer=void 0,m.previous=void 0):D.pop(),p=D.length;p--;){const v=o.slice(D[p],D[p+1]),E=i.pop();l.unshift([E,E+v.length-1]),$t(e,E,2,v)}for(p=-1;++p<l.length;)u[g+l[p][0]]=g+l[p][1],g+=l[p][1]-l[p][0]-1;return u}const hD={tokenize:gD,resolve:pD},mD={tokenize:vD,partial:!0};function pD(e){return Df(e),e}function gD(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):De(o)?e.check(mD,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 vD(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ze(e,i,"linePrefix")}function i(s){if(s===null||De(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 Cf(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return h;function h(v){return v===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(v),e.exit(i),p):v===null||v===32||v===41||js(v)?n(v):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(v))}function p(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(v))}function m(v){return v===62?(e.exit("chunkString"),e.exit(o),p(v)):v===null||v===60||De(v)?n(v):(e.consume(v),v===92?g:m)}function g(v){return v===60||v===62||v===92?(e.consume(v),m):m(v)}function f(v){return!c&&(v===null||v===41||ft(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):c<u&&v===40?(e.consume(v),c++,f):v===41?(e.consume(v),c--,f):v===null||v===32||v===40||js(v)?n(v):(e.consume(v),v===92?D:f)}function D(v){return v===40||v===41||v===92?(e.consume(v),f):f(v)}}function xf(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(m){return e.enter(r),e.enter(a),e.consume(m),e.exit(a),e.enter(i),c}function c(m){return o>999||m===null||m===91||m===93&&!l||m===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(m):m===93?(e.exit(i),e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):De(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||De(m)||o++>999?(e.exit("chunkString"),c(m)):(e.consume(m),l||(l=!Pe(m)),m===92?p:h)}function p(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}}function wf(e,t,n,r,a,i){let s;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(a),e.consume(p),e.exit(a),s=p===40?41:p,l):n(p)}function l(p){return p===s?(e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===s?(e.exit(i),l(s)):p===null?n(p):De(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),ze(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===s||p===null||De(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:c)}function h(p){return p===s||p===92?(e.consume(p),c):c(p)}}function wr(e,t){let n;return r;function r(a){return De(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Pe(a)?ze(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const bD={name:"definition",tokenize:DD},yD={tokenize:CD,partial:!0};function DD(e,t,n){const r=this;let a;return i;function i(m){return e.enter("definition"),s(m)}function s(m){return xf.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return a=Kn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):n(m)}function l(m){return ft(m)?wr(e,u)(m):u(m)}function u(m){return Cf(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function c(m){return e.attempt(yD,h,h)(m)}function h(m){return Pe(m)?ze(e,p,"whitespace")(m):p(m)}function p(m){return m===null||De(m)?(e.exit("definition"),r.parser.defined.push(a),t(m)):n(m)}}function CD(e,t,n){return r;function r(o){return ft(o)?wr(e,a)(o):n(o)}function a(o){return wf(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Pe(o)?ze(e,s,"whitespace")(o):s(o)}function s(o){return o===null||De(o)?t(o):n(o)}}const xD={name:"hardBreakEscape",tokenize:wD};function wD(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return De(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const ED={name:"headingAtx",tokenize:_D,resolve:kD};function kD(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"},$t(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function _D(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||De(c)?(e.exit("atxHeading"),t(c)):Pe(c)?ze(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 BD=["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"],Ll=["pre","script","style","textarea"],FD={name:"htmlFlow",tokenize:jD,resolveTo:SD,concrete:!0},AD={tokenize:PD,partial:!0},TD={tokenize:OD,partial:!0};function SD(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 jD(e,t,n){const r=this;let a,i,s,o,l;return u;function u(_){return c(_)}function c(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),h}function h(_){return _===33?(e.consume(_),p):_===47?(e.consume(_),i=!0,f):_===63?(e.consume(_),a=3,r.interrupt?t:C):Pt(_)?(e.consume(_),s=String.fromCharCode(_),D):n(_)}function p(_){return _===45?(e.consume(_),a=2,m):_===91?(e.consume(_),a=5,o=0,g):Pt(_)?(e.consume(_),a=4,r.interrupt?t:C):n(_)}function m(_){return _===45?(e.consume(_),r.interrupt?t:C):n(_)}function g(_){const A="CDATA[";return _===A.charCodeAt(o++)?(e.consume(_),o===A.length?r.interrupt?t:w:g):n(_)}function f(_){return Pt(_)?(e.consume(_),s=String.fromCharCode(_),D):n(_)}function D(_){if(_===null||_===47||_===62||ft(_)){const A=_===47,L=s.toLowerCase();return!A&&!i&&Ll.includes(L)?(a=1,r.interrupt?t(_):w(_)):BD.includes(s.toLowerCase())?(a=6,A?(e.consume(_),v):r.interrupt?t(_):w(_)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?E(_):B(_))}return _===45||At(_)?(e.consume(_),s+=String.fromCharCode(_),D):n(_)}function v(_){return _===62?(e.consume(_),r.interrupt?t:w):n(_)}function E(_){return Pe(_)?(e.consume(_),E):I(_)}function B(_){return _===47?(e.consume(_),I):_===58||_===95||Pt(_)?(e.consume(_),x):Pe(_)?(e.consume(_),B):I(_)}function x(_){return _===45||_===46||_===58||_===95||At(_)?(e.consume(_),x):k(_)}function k(_){return _===61?(e.consume(_),T):Pe(_)?(e.consume(_),k):B(_)}function T(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,S):Pe(_)?(e.consume(_),T):q(_)}function S(_){return _===l?(e.consume(_),l=null,N):_===null||De(_)?n(_):(e.consume(_),S)}function q(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||ft(_)?k(_):(e.consume(_),q)}function N(_){return _===47||_===62||Pe(_)?B(_):n(_)}function I(_){return _===62?(e.consume(_),z):n(_)}function z(_){return _===null||De(_)?w(_):Pe(_)?(e.consume(_),z):n(_)}function w(_){return _===45&&a===2?(e.consume(_),V):_===60&&a===1?(e.consume(_),G):_===62&&a===4?(e.consume(_),R):_===63&&a===3?(e.consume(_),C):_===93&&a===5?(e.consume(_),ae):De(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(AD,W,F)(_)):_===null||De(_)?(e.exit("htmlFlowData"),F(_)):(e.consume(_),w)}function F(_){return e.check(TD,j,W)(_)}function j(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),M}function M(_){return _===null||De(_)?F(_):(e.enter("htmlFlowData"),w(_))}function V(_){return _===45?(e.consume(_),C):w(_)}function G(_){return _===47?(e.consume(_),s="",J):w(_)}function J(_){if(_===62){const A=s.toLowerCase();return Ll.includes(A)?(e.consume(_),R):w(_)}return Pt(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),J):w(_)}function ae(_){return _===93?(e.consume(_),C):w(_)}function C(_){return _===62?(e.consume(_),R):_===45&&a===2?(e.consume(_),C):w(_)}function R(_){return _===null||De(_)?(e.exit("htmlFlowData"),W(_)):(e.consume(_),R)}function W(_){return e.exit("htmlFlow"),t(_)}}function OD(e,t,n){const r=this;return a;function a(s){return De(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 PD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(ni,t,n)}}const ND={name:"htmlText",tokenize:RD};function RD(e,t,n){const r=this;let a,i,s;return o;function o(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),l}function l(C){return C===33?(e.consume(C),u):C===47?(e.consume(C),k):C===63?(e.consume(C),B):Pt(C)?(e.consume(C),q):n(C)}function u(C){return C===45?(e.consume(C),c):C===91?(e.consume(C),i=0,g):Pt(C)?(e.consume(C),E):n(C)}function c(C){return C===45?(e.consume(C),m):n(C)}function h(C){return C===null?n(C):C===45?(e.consume(C),p):De(C)?(s=h,G(C)):(e.consume(C),h)}function p(C){return C===45?(e.consume(C),m):h(C)}function m(C){return C===62?V(C):C===45?p(C):h(C)}function g(C){const R="CDATA[";return C===R.charCodeAt(i++)?(e.consume(C),i===R.length?f:g):n(C)}function f(C){return C===null?n(C):C===93?(e.consume(C),D):De(C)?(s=f,G(C)):(e.consume(C),f)}function D(C){return C===93?(e.consume(C),v):f(C)}function v(C){return C===62?V(C):C===93?(e.consume(C),v):f(C)}function E(C){return C===null||C===62?V(C):De(C)?(s=E,G(C)):(e.consume(C),E)}function B(C){return C===null?n(C):C===63?(e.consume(C),x):De(C)?(s=B,G(C)):(e.consume(C),B)}function x(C){return C===62?V(C):B(C)}function k(C){return Pt(C)?(e.consume(C),T):n(C)}function T(C){return C===45||At(C)?(e.consume(C),T):S(C)}function S(C){return De(C)?(s=S,G(C)):Pe(C)?(e.consume(C),S):V(C)}function q(C){return C===45||At(C)?(e.consume(C),q):C===47||C===62||ft(C)?N(C):n(C)}function N(C){return C===47?(e.consume(C),V):C===58||C===95||Pt(C)?(e.consume(C),I):De(C)?(s=N,G(C)):Pe(C)?(e.consume(C),N):V(C)}function I(C){return C===45||C===46||C===58||C===95||At(C)?(e.consume(C),I):z(C)}function z(C){return C===61?(e.consume(C),w):De(C)?(s=z,G(C)):Pe(C)?(e.consume(C),z):N(C)}function w(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),a=C,F):De(C)?(s=w,G(C)):Pe(C)?(e.consume(C),w):(e.consume(C),j)}function F(C){return C===a?(e.consume(C),a=void 0,M):C===null?n(C):De(C)?(s=F,G(C)):(e.consume(C),F)}function j(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||ft(C)?N(C):(e.consume(C),j)}function M(C){return C===47||C===62||ft(C)?N(C):n(C)}function V(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function G(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),J}function J(C){return Pe(C)?ze(e,ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):ae(C)}function ae(C){return e.enter("htmlTextData"),s(C)}}const Do={name:"labelEnd",tokenize:qD,resolveTo:zD,resolveAll:LD},MD={tokenize:WD},ID={tokenize:HD},$D={tokenize:UD};function LD(e){let t=-1;for(;++t<e.length;){const n=e[t][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(e.splice(t+1,n.type==="labelImage"?4:2),n.type="data",t++)}return e}function zD(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=xt(o,e.slice(i+1,i+r+3)),o=xt(o,[["enter",c,t]]),o=xt(o,yo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=xt(o,[["exit",c,t],e[s-2],e[s-1],["exit",u,t]]),o=xt(o,e.slice(s+1)),o=xt(o,[["exit",l,t]]),$t(e,i,e.length,o),e}function qD(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(p){return i?i._inactive?h(p):(s=r.parser.defined.includes(Kn(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(MD,c,s?c:h)(p):p===91?e.attempt(ID,c,s?u:h)(p):s?c(p):h(p)}function u(p){return e.attempt($D,c,h)(p)}function c(p){return t(p)}function h(p){return i._balanced=!0,n(p)}}function WD(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)?wr(e,i)(h):i(h)}function i(h){return h===41?c(h):Cf(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return ft(h)?wr(e,l)(h):c(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?wf(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):c(h)}function u(h){return ft(h)?wr(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 HD(e,t,n){const r=this;return a;function a(o){return xf.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Kn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function UD(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 VD={name:"labelStartImage",tokenize:KD,resolveAll:Do.resolveAll};function KD(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 ZD={name:"labelStartLink",tokenize:YD,resolveAll:Do.resolveAll};function YD(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 Mi={name:"lineEnding",tokenize:GD};function GD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ze(e,t,"linePrefix")}}const ya={name:"thematicBreak",tokenize:QD};function QD(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||De(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Pe(u)?ze(e,o,"whitespace")(u):o(u))}}const lt={name:"list",tokenize:eC,continuation:{tokenize:tC},exit:rC},JD={tokenize:aC,partial:!0},XD={tokenize:nC,partial:!0};function eC(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(m){const g=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Os(m)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(ya,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return Os(m)&&++s<10?(e.consume(m),l):(!r.interrupt||s<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(ni,r.interrupt?n:c,e.attempt(JD,p,h))}function c(m){return r.containerState.initialBlankLine=!0,i++,p(m)}function h(m){return Pe(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function tC(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ni,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ze(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Pe(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(XD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,ze(e,e.attempt(lt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function nC(e,t,n){const r=this;return ze(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 rC(e){e.exit(this.containerState.type)}function aC(e,t,n){const r=this;return ze(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!Pe(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const zl={name:"setextUnderline",tokenize:sC,resolveTo:iC};function iC(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 sC(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"),Pe(u)?ze(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||De(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const oC={tokenize:uC};function uC(e){const t=this,n=e.attempt(ni,r,e.attempt(this.parser.constructs.flowInitial,a,ze(e,e.attempt(this.parser.constructs.flow,a,e.attempt(hD,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 lC={resolveAll:kf()},cC=Ef("string"),dC=Ef("text");function Ef(e){return{tokenize:t,resolveAll:kf(e==="text"?fC: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 p=-1;if(h)for(;++p<h.length;){const m=h[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function kf(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 fC(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 hC(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:E,enter:B,exit:x,attempt:S(k),check:S(T),interrupt:S(T,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:m,sliceSerialize:p,now:g,defineSkip:f,write:h};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function h(z){return s=xt(s,z),D(),s[s.length-1]!==null?[]:(q(t,0),u.events=yo(i,u.events,u),u.events)}function p(z,w){return pC(m(z),w)}function m(z){return mC(s,z)}function g(){const{line:z,column:w,offset:F,_index:j,_bufferIndex:M}=r;return{line:z,column:w,offset:F,_index:j,_bufferIndex:M}}function f(z){a[z.line]=z.column,I()}function D(){let z;for(;r._index<s.length;){const w=s[r._index];if(typeof w=="string")for(z=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===z&&r._bufferIndex<w.length;)v(w.charCodeAt(r._bufferIndex));else v(w)}}function v(z){c=c(z)}function E(z){De(z)?(r.line++,r.column=1,r.offset+=z===-3?2:1,I()):z!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=z}function B(z,w){const F=w||{};return F.type=z,F.start=g(),u.events.push(["enter",F,u]),o.push(F),F}function x(z){const w=o.pop();return w.end=g(),u.events.push(["exit",w,u]),w}function k(z,w){q(z,w.from)}function T(z,w){w.restore()}function S(z,w){return F;function F(j,M,V){let G,J,ae,C;return Array.isArray(j)?W(j):"tokenize"in j?W([j]):R(j);function R($){return U;function U(re){const te=re!==null&&$[re],ne=re!==null&&$.null,le=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(ne)?ne:ne?[ne]:[]];return W(le)(re)}}function W($){return G=$,J=0,$.length===0?V:_($[J])}function _($){return U;function U(re){return C=N(),ae=$,$.partial||(u.currentConstruct=$),$.name&&u.parser.constructs.disable.null.includes($.name)?L():$.tokenize.call(w?Object.assign(Object.create(u),w):u,l,A,L)(re)}}function A($){return z(ae,C),M}function L($){return C.restore(),++J<G.length?_(G[J]):V}}}function q(z,w){z.resolveAll&&!i.includes(z)&&i.push(z),z.resolve&&$t(u.events,w,u.events.length-w,z.resolve(u.events.slice(w),u)),z.resolveTo&&(u.events=z.resolveTo(u.events,u))}function N(){const z=g(),w=u.previous,F=u.currentConstruct,j=u.events.length,M=Array.from(o);return{restore:V,from:j};function V(){r=z,u.previous=w,u.currentConstruct=F,u.events.length=j,o=M,I()}}function I(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function mC(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 pC(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=`
115
115
  `;break}case-3:{s=`\r
116
- `;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 bC={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:yf},yC={91:DD},DC={[-2]:Ii,[-1]:Ii,32:Ii},CC={35:_D,42:Ca,45:[Wl,Ca],60:TD,61:Wl,95:Ca,96:zl,126:zl},xC={38:Cf,92:Df},wC={[-5]:$i,[-4]:$i,[-3]:$i,33:ZD,38:Cf,42:Rs,60:[Q1,MD],91:GD,92:[ED,Df],93:xo,95:Rs,96:cD},EC={null:[Rs,dC]},kC={null:[42,95]},_C={null:[]},BC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:kC,contentInitial:yC,disable:_C,document:bC,flow:CC,flowInitial:DC,insideSpan:EC,string:xC,text:wC},Symbol.toStringTag,{value:"Module"}));function FC(e){const n=R1([BC,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(H1),document:a(V1),flow:a(lC),string:a(fC),text:a(hC)};return r;function a(i){return s;function s(o){return pC(r,i,o)}}}function AC(e){for(;!xf(e););return e}const Hl=/[\0\t\n\r]/g;function TC(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,f,p,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(Hl.lastIndex=f,u=Hl.exec(i),p=u&&u.index!==void 0?u.index:i.length,m=i.charCodeAt(p),!u){t=i.slice(f);break}if(m===10&&f===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<p&&(l.push(i.slice(f,p)),e+=p-f),m){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const SC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function jC(e){return e.replace(SC,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 bf(n.slice(i?2:1),i?16:10)}return Do(n)||e}const Ff={}.hasOwnProperty;function PC(e,t,n){return typeof t!="string"&&(n=t,t=void 0),NC(n)(AC(FC(n).document().write(TC()(e,t,!0))))}function NC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(He),autolinkProtocol:N,autolinkEmail:N,atxHeading:i(he),blockQuote:i(te),characterEscape:N,characterReference:N,codeFenced:i(ne),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ne,s),codeText:i(le,s),codeTextData:N,data:N,codeFlowValue:N,definition:i(Q),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(pe),hardBreakEscape:i(ye),hardBreakTrailing:i(ye),htmlFlow:i(Fe,s),htmlFlowData:N,htmlText:i(Fe,s),htmlTextData:N,image:i(Ae),label:s,link:i(He),listItem:i(Te),listItemValue:p,listOrdered:i(Se,f),listUnordered:i(Se),paragraph:i(Ne),reference:B,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(he),strong:i(ke),thematicBreak:i(ge)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:re,autolinkProtocol:U,blockQuote:l(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:L,characterReferenceMarkerNumeric:L,characterReferenceValue:$,codeFenced:l(y),codeFencedFence:h,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:I,codeIndented:l(v),codeText:l(M),codeTextData:I,data:I,definition:l(),definitionDestinationString:x,definitionLabelString:w,definitionTitleString:_,emphasis:l(),hardBreakEscape:l(E),hardBreakTrailing:l(E),htmlFlow:l(F),htmlFlowData:I,htmlText:l(j),htmlTextData:I,image:l(G),label:ae,labelText:J,lineEnding:z,link:l(V),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:A,resourceDestinationString:C,resourceTitleString:R,resource:W,setextHeading:l(q),setextHeadingLineSequence:S,setextHeadingText:T,strong:l(),thematicBreak:l()}};Af(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(H){let ie={type:"root",children:[]};const me={stack:[ie],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},ve=[];let we=-1;for(;++we<H.length;)if(H[we][1].type==="listOrdered"||H[we][1].type==="listUnordered")if(H[we][0]==="enter")ve.push(we);else{const Ke=ve.pop();we=a(H,Ke,we)}for(we=-1;++we<H.length;){const Ke=t[H[we][0]];Ff.call(Ke,H[we][1].type)&&Ke[H[we][1].type].call(Object.assign({sliceSerialize:H[we][2].sliceSerialize},me),H[we][1])}if(me.tokenStack.length>0){const Ke=me.tokenStack[me.tokenStack.length-1];(Ke[1]||Ul).call(me,void 0,Ke[0])}for(ie.position={start:Xt(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:Xt(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<t.transforms.length;)ie=t.transforms[we](ie)||ie;return ie}function a(H,ie,me){let ve=ie-1,we=-1,Ke=!1,Qe,mt,zt,_t;for(;++ve<=me;){const et=H[ve];switch(et[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{et[0]==="enter"?we++:we--,_t=void 0;break}case"lineEndingBlank":{et[0]==="enter"&&(Qe&&!_t&&!we&&!zt&&(zt=ve),_t=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:_t=void 0}if(!we&&et[0]==="enter"&&et[1].type==="listItemPrefix"||we===-1&&et[0]==="exit"&&(et[1].type==="listUnordered"||et[1].type==="listOrdered")){if(Qe){let Tt=ve;for(mt=void 0;Tt--;){const pt=H[Tt];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;mt&&(H[mt][1].type="lineEndingBlank",Ke=!0),pt[1].type="lineEnding",mt=Tt}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}zt&&(!mt||zt<mt)&&(Qe._spread=!0),Qe.end=Object.assign({},mt?H[mt][1].start:et[1].end),H.splice(mt||ve,0,["exit",Qe,et[2]]),ve++,me++}if(et[1].type==="listItemPrefix"){const Tt={type:"listItem",_spread:!1,start:Object.assign({},et[1].start),end:void 0};Qe=Tt,H.splice(ve,0,["enter",Tt,et[2]]),ve++,me++,zt=void 0,_t=!0}}}return H[ie][1]._spread=Ke,me}function i(H,ie){return me;function me(ve){o.call(this,H(ve),ve),ie&&ie.call(this,ve)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(H,ie,me){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([ie,me]),H.position={start:Xt(ie.start),end:void 0}}function l(H){return ie;function ie(me){H&&H.call(this,me),u.call(this,me)}}function u(H,ie){const me=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==H.type&&(ie?ie.call(this,H,ve[0]):(ve[1]||Ul).call(this,H,ve[0]));else throw new Error("Cannot close `"+H.type+"` ("+xr({start:H.start,end:H.end})+"): it’s not open");me.position.end=Xt(H.end)}function d(){return P1(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(H){if(this.data.expectingFirstListItemValue){const ie=this.stack[this.stack.length-2];ie.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function m(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.lang=H}function g(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.meta=H}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.value=H.replace(/(\r?\n|\r)$/g,"")}function w(H){const ie=this.resume(),me=this.stack[this.stack.length-1];me.label=ie,me.identifier=Zn(this.sliceSerialize(H)).toLowerCase()}function _(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.title=H}function x(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.url=H}function k(H){const ie=this.stack[this.stack.length-1];if(!ie.depth){const me=this.sliceSerialize(H).length;ie.depth=me}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function S(H){const ie=this.stack[this.stack.length-1];ie.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function N(H){const me=this.stack[this.stack.length-1].children;let ve=me[me.length-1];(!ve||ve.type!=="text")&&(ve=Ue(),ve.position={start:Xt(H.start),end:void 0},me.push(ve)),this.stack.push(ve)}function I(H){const ie=this.stack.pop();ie.value+=this.sliceSerialize(H),ie.position.end=Xt(H.end)}function z(H){const ie=this.stack[this.stack.length-1];if(this.data.atHardBreak){const me=ie.children[ie.children.length-1];me.position.end=Xt(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ie.type)&&(N.call(this,H),I.call(this,H))}function E(){this.data.atHardBreak=!0}function F(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.value=H}function j(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.value=H}function M(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.value=H}function V(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ie,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function G(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ie,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function J(H){const ie=this.sliceSerialize(H),me=this.stack[this.stack.length-2];me.label=jC(ie),me.identifier=Zn(ie).toLowerCase()}function ae(){const H=this.stack[this.stack.length-1],ie=this.resume(),me=this.stack[this.stack.length-1];if(this.data.inReference=!0,me.type==="link"){const ve=H.children;me.children=ve}else me.alt=ie}function C(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.url=H}function R(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.title=H}function W(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function A(H){const ie=this.resume(),me=this.stack[this.stack.length-1];me.label=ie,me.identifier=Zn(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function L(H){this.data.characterReferenceType=H.type}function $(H){const ie=this.sliceSerialize(H),me=this.data.characterReferenceType;let ve;me?(ve=bf(ie,me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=Do(ie);const we=this.stack.pop();we.value+=ve,we.position.end=Xt(H.end)}function U(H){I.call(this,H);const ie=this.stack[this.stack.length-1];ie.url=this.sliceSerialize(H)}function re(H){I.call(this,H);const ie=this.stack[this.stack.length-1];ie.url="mailto:"+this.sliceSerialize(H)}function te(){return{type:"blockquote",children:[]}}function ne(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function Q(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function he(){return{type:"heading",depth:0,children:[]}}function ye(){return{type:"break"}}function Fe(){return{type:"html",value:""}}function Ae(){return{type:"image",title:null,url:"",alt:null}}function He(){return{type:"link",title:null,url:"",children:[]}}function Se(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function Te(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function Ne(){return{type:"paragraph",children:[]}}function ke(){return{type:"strong",children:[]}}function Ue(){return{type:"text",value:""}}function ge(){return{type:"thematicBreak"}}}function Xt(e){return{line:e.line,column:e.column,offset:e.offset}}function Af(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Af(e,r):RC(e,r)}}function RC(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 Ul(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+xr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+xr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+xr({start:t.start,end:t.end})+") is still open")}function MC(e){const t=this;t.parser=n;function n(r){return PC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Tf(e,t){var l,u,d;const n={...Un,...t==null?void 0:t.nodeTypes,[Z.heading]:{...Un[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(f=>Tf({...f,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:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:Z.paragraph,children:[{text:e.value||""}]};case st.emphasis:return{[n[Nt.emphasis]]:!0,...Li(s),...ia(s)};case st.strong:return{[n[Nt.strong]]:!0,...Li(s),...ia(s)};case st.delete:return{[n[Nt.delete]]:!0,...Li(s),...ia(s)};case st.inlineCode:return{[n[Nt.code]]:!0,text:e.value,...ia(s)};case st.thematicBreak:return{type:n[Z.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Li=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function ia(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const IC=function(t){const n=r=>r.children.map(a=>Tf(a,t));this.Compiler=n},$C=(e,t=n=>{})=>{A1().use(MC).use(IC).process(e).then(n=>{const r=bn(n.result),a=s=>{const o=s;[Z.li,Z.blockquote].includes(o.type)&&o.children.map((l,u)=>{const d=l;d.type===Z.paragraph&&o.children.splice(u,1,...d.children)}),"children"in s&&s.children&&s.children.forEach(l=>a(l))};r.forEach(a);const i=s=>{for(let o=0;o<s.length;o++){const l=s[o],u=l;if(u.type===Z.link){const d=u.children&&u.children[0];if(d&&"text"in d&&d.text.includes(Ts)){const f=u,p=d.text.replace(Ts,""),m="link"in f&&f.link?f.link:"";f.type=Z.mention,f.id=m,f.name=p,f.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in l&&l.children&&i(l.children)}};i(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,l)=>{if("text"in o&&o.text){const u=o.text.match(/~~(.*?)~~/g);u&&u.map(d=>{const f=d.replace(/~~/g,""),p=o.text.indexOf(d),m=o.text.substring(0,p),g=o.text.substring(p+d.length),h=[{text:m},{text:f,[Z.strikethrough]:!0},{text:g}];s.children.splice(l,1,...h)})}})}),t(r)})},wo=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},LC=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=b.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=P.parent(a),r=oe.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},zC=e=>{const{selection:t}=e;return t?b.string(e,t):null},Vl=e=>{let t="";for(const n of oe.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},Kl={"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},qC=(e,t,n,r)=>{for(const a in Kl)if(Nb(a,e)){e.stopPropagation(),e.preventDefault();const i=Kl[a];if(i===Z.link){n([{type:"showLinkEditor",value:!0}]);return}if(XC(i)){If(t,i,r);return}Nf(t,i,r)}},Sf=(e,t,n,r)=>{var d;const{selectedUser:a,possibleUsers:i}=t,s=i[a];if(!s)return;const o=s.userId||"",l=(d=s.user)==null?void 0:d.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const u={type:Z.mention,id:o,name:l,children:[{text:""}]};X.select(e,(t==null?void 0:t.position)||mf),X.insertNodes(e,[u,{text:" "}]),X.move(e,{distance:1,unit:"offset"}),wo(r)},WC=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&K.isCollapsed(i)){const[s]=K.edges(i),o=b.start(e,s.path),l=b.range(e,o,s),d=b.string(e,l).match(Ic);if(d){const f=d.index||0,p={path:s.path,offset:f},m={path:s.path,offset:f+d[0].length},g=b.range(e,p,m),h=b.after(e,s),y=b.range(e,s,h);if(b.string(e,y).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const _=d[1];let x=[];r&&(x=await r({name:_})),a([{type:"mentionPopover",value:{show:x.length>0?!0:n!==null,selectedUser:0,possibleUsers:x,position:x.length>0?g:null,numberOfUsers:x.length>0?x.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},jf=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},In=e=>typeof e.text=="string",HC=[Z.hr,Z.image,Z.mention],Zl="<br>";function Of(e,t={nodeTypes:Un}){const{nodeTypes:n=Un,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Un,...n,heading:{...Un[Z.heading],...n[Z.heading]}},l=[o[Z.ul],o[Z.ol]];let u=i;if(!In(e)&&s!==Z.mention&&(u=e.children.map(d=>{const f=In(d)?!1:l.includes(d.type||""),p=l.includes(e.type||"");let m=!1;return!In(e)&&Array.isArray(e.children)&&(m=e.children.some(g=>!In(g)&&g.type===o.link)),Of({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||f||p||m)&&!d.break,listDepth:l.includes(d.type||"")?a+1:a,inBlockquote:s===o[Z.blockquote]||e.parentType===o[Z.blockquote]})}).join("")),!r&&(i===""||i===`
117
- `)&&e.parentType===o[Z.paragraph]&&s!==o[Z.mention]&&(s=o[Z.paragraph],u=Zl),!(u===""&&!HC.find(d=>o[d]===s)))switch(u!==Zl&&In(e)&&(e[Z.strikethrough]&&e[Z.bold]&&e[Z.italic]?u=$n(u,"~~***"):e[Z.bold]&&e[Z.italic]?u=$n(u,"***"):(e[Z.bold]&&(u=$n(u,"**")),e[Z.italic]&&(u=$n(u,"_")),e[Z.strikethrough]&&(u=$n(u,"~~")),e[Z.code]&&(u=$n(u,"`")))),s){case o[Z.heading][1]:return`# ${u}
116
+ `;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 gC={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:vf},vC={91:bD},bC={[-2]:Ri,[-1]:Ri,32:Ri},yC={35:ED,42:ya,45:[zl,ya],60:FD,61:zl,95:ya,96:$l,126:$l},DC={38:yf,92:bf},CC={[-5]:Mi,[-4]:Mi,[-3]:Mi,33:VD,38:yf,42:Ps,60:[Y1,ND],91:ZD,92:[xD,bf],93:Do,95:Ps,96:uD},xC={null:[Ps,lC]},wC={null:[42,95]},EC={null:[]},kC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:wC,contentInitial:vC,disable:EC,document:gC,flow:yC,flowInitial:bC,insideSpan:xC,string:DC,text:CC},Symbol.toStringTag,{value:"Module"}));function _C(e){const n=P1([kC,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(q1),document:a(H1),flow:a(oC),string:a(cC),text:a(dC)};return r;function a(i){return s;function s(o){return hC(r,i,o)}}}function BC(e){for(;!Df(e););return e}const ql=/[\0\t\n\r]/g;function FC(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,h,p,m;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(ql.lastIndex=h,u=ql.exec(i),p=u&&u.index!==void 0?u.index:i.length,m=i.charCodeAt(p),!u){t=i.slice(h);break}if(m===10&&h===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<p&&(l.push(i.slice(h,p)),e+=p-h),m){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=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const AC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function TC(e){return e.replace(AC,SC)}function SC(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return gf(n.slice(i?2:1),i?16:10)}return bo(n)||e}const _f={}.hasOwnProperty;function jC(e,t,n){return typeof t!="string"&&(n=t,t=void 0),OC(n)(BC(_C(n).document().write(FC()(e,t,!0))))}function OC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(He),autolinkProtocol:N,autolinkEmail:N,atxHeading:i(he),blockQuote:i(te),characterEscape:N,characterReference:N,codeFenced:i(ne),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ne,s),codeText:i(le,s),codeTextData:N,data:N,codeFlowValue:N,definition:i(Q),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(pe),hardBreakEscape:i(ye),hardBreakTrailing:i(ye),htmlFlow:i(Fe,s),htmlFlowData:N,htmlText:i(Fe,s),htmlTextData:N,image:i(Ae),label:s,link:i(He),listItem:i(Te),listItemValue:p,listOrdered:i(Se,h),listUnordered:i(Se),paragraph:i(Ne),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(he),strong:i(ke),thematicBreak:i(ge)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:re,autolinkProtocol:U,blockQuote:l(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:L,characterReferenceMarkerNumeric:L,characterReferenceValue:$,codeFenced:l(D),codeFencedFence:f,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:I,codeIndented:l(v),codeText:l(M),codeTextData:I,data:I,definition:l(),definitionDestinationString:x,definitionLabelString:E,definitionTitleString:B,emphasis:l(),hardBreakEscape:l(w),hardBreakTrailing:l(w),htmlFlow:l(F),htmlFlowData:I,htmlText:l(j),htmlTextData:I,image:l(G),label:ae,labelText:J,lineEnding:z,link:l(V),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:A,resourceDestinationString:C,resourceTitleString:R,resource:W,setextHeading:l(q),setextHeadingLineSequence:S,setextHeadingText:T,strong:l(),thematicBreak:l()}};Bf(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(H){let ie={type:"root",children:[]};const me={stack:[ie],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:c,data:n},ve=[];let we=-1;for(;++we<H.length;)if(H[we][1].type==="listOrdered"||H[we][1].type==="listUnordered")if(H[we][0]==="enter")ve.push(we);else{const Ke=ve.pop();we=a(H,Ke,we)}for(we=-1;++we<H.length;){const Ke=t[H[we][0]];_f.call(Ke,H[we][1].type)&&Ke[H[we][1].type].call(Object.assign({sliceSerialize:H[we][2].sliceSerialize},me),H[we][1])}if(me.tokenStack.length>0){const Ke=me.tokenStack[me.tokenStack.length-1];(Ke[1]||Wl).call(me,void 0,Ke[0])}for(ie.position={start:Xt(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:Xt(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<t.transforms.length;)ie=t.transforms[we](ie)||ie;return ie}function a(H,ie,me){let ve=ie-1,we=-1,Ke=!1,Qe,mt,zt,_t;for(;++ve<=me;){const et=H[ve];switch(et[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{et[0]==="enter"?we++:we--,_t=void 0;break}case"lineEndingBlank":{et[0]==="enter"&&(Qe&&!_t&&!we&&!zt&&(zt=ve),_t=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:_t=void 0}if(!we&&et[0]==="enter"&&et[1].type==="listItemPrefix"||we===-1&&et[0]==="exit"&&(et[1].type==="listUnordered"||et[1].type==="listOrdered")){if(Qe){let Tt=ve;for(mt=void 0;Tt--;){const pt=H[Tt];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;mt&&(H[mt][1].type="lineEndingBlank",Ke=!0),pt[1].type="lineEnding",mt=Tt}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}zt&&(!mt||zt<mt)&&(Qe._spread=!0),Qe.end=Object.assign({},mt?H[mt][1].start:et[1].end),H.splice(mt||ve,0,["exit",Qe,et[2]]),ve++,me++}if(et[1].type==="listItemPrefix"){const Tt={type:"listItem",_spread:!1,start:Object.assign({},et[1].start),end:void 0};Qe=Tt,H.splice(ve,0,["enter",Tt,et[2]]),ve++,me++,zt=void 0,_t=!0}}}return H[ie][1]._spread=Ke,me}function i(H,ie){return me;function me(ve){o.call(this,H(ve),ve),ie&&ie.call(this,ve)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(H,ie,me){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([ie,me]),H.position={start:Xt(ie.start),end:void 0}}function l(H){return ie;function ie(me){H&&H.call(this,me),u.call(this,me)}}function u(H,ie){const me=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==H.type&&(ie?ie.call(this,H,ve[0]):(ve[1]||Wl).call(this,H,ve[0]));else throw new Error("Cannot close `"+H.type+"` ("+xr({start:H.start,end:H.end})+"): it’s not open");me.position.end=Xt(H.end)}function c(){return j1(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(H){if(this.data.expectingFirstListItemValue){const ie=this.stack[this.stack.length-2];ie.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function m(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.lang=H}function g(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.meta=H}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function D(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.value=H.replace(/(\r?\n|\r)$/g,"")}function E(H){const ie=this.resume(),me=this.stack[this.stack.length-1];me.label=ie,me.identifier=Kn(this.sliceSerialize(H)).toLowerCase()}function B(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.title=H}function x(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.url=H}function k(H){const ie=this.stack[this.stack.length-1];if(!ie.depth){const me=this.sliceSerialize(H).length;ie.depth=me}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function S(H){const ie=this.stack[this.stack.length-1];ie.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function N(H){const me=this.stack[this.stack.length-1].children;let ve=me[me.length-1];(!ve||ve.type!=="text")&&(ve=Ue(),ve.position={start:Xt(H.start),end:void 0},me.push(ve)),this.stack.push(ve)}function I(H){const ie=this.stack.pop();ie.value+=this.sliceSerialize(H),ie.position.end=Xt(H.end)}function z(H){const ie=this.stack[this.stack.length-1];if(this.data.atHardBreak){const me=ie.children[ie.children.length-1];me.position.end=Xt(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ie.type)&&(N.call(this,H),I.call(this,H))}function w(){this.data.atHardBreak=!0}function F(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.value=H}function j(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.value=H}function M(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.value=H}function V(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ie,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function G(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ie,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function J(H){const ie=this.sliceSerialize(H),me=this.stack[this.stack.length-2];me.label=TC(ie),me.identifier=Kn(ie).toLowerCase()}function ae(){const H=this.stack[this.stack.length-1],ie=this.resume(),me=this.stack[this.stack.length-1];if(this.data.inReference=!0,me.type==="link"){const ve=H.children;me.children=ve}else me.alt=ie}function C(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.url=H}function R(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.title=H}function W(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function A(H){const ie=this.resume(),me=this.stack[this.stack.length-1];me.label=ie,me.identifier=Kn(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function L(H){this.data.characterReferenceType=H.type}function $(H){const ie=this.sliceSerialize(H),me=this.data.characterReferenceType;let ve;me?(ve=gf(ie,me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=bo(ie);const we=this.stack.pop();we.value+=ve,we.position.end=Xt(H.end)}function U(H){I.call(this,H);const ie=this.stack[this.stack.length-1];ie.url=this.sliceSerialize(H)}function re(H){I.call(this,H);const ie=this.stack[this.stack.length-1];ie.url="mailto:"+this.sliceSerialize(H)}function te(){return{type:"blockquote",children:[]}}function ne(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function Q(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function he(){return{type:"heading",depth:0,children:[]}}function ye(){return{type:"break"}}function Fe(){return{type:"html",value:""}}function Ae(){return{type:"image",title:null,url:"",alt:null}}function He(){return{type:"link",title:null,url:"",children:[]}}function Se(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function Te(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function Ne(){return{type:"paragraph",children:[]}}function ke(){return{type:"strong",children:[]}}function Ue(){return{type:"text",value:""}}function ge(){return{type:"thematicBreak"}}}function Xt(e){return{line:e.line,column:e.column,offset:e.offset}}function Bf(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Bf(e,r):PC(e,r)}}function PC(e,t){let n;for(n in t)if(_f.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 Wl(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+xr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+xr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+xr({start:t.start,end:t.end})+") is still open")}function NC(e){const t=this;t.parser=n;function n(r){return jC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Ff(e,t){var l,u,c;const n={...Hn,...t==null?void 0:t.nodeTypes,[Z.heading]:{...Hn[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=>Ff({...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[Nt.emphasis]]:!0,...Ii(s),...aa(s)};case st.strong:return{[n[Nt.strong]]:!0,...Ii(s),...aa(s)};case st.delete:return{[n[Nt.delete]]:!0,...Ii(s),...aa(s)};case st.inlineCode:return{[n[Nt.code]]:!0,text:e.value,...aa(s)};case st.thematicBreak:return{type:n[Z.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Ii=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function aa(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const RC=function(t){const n=r=>r.children.map(a=>Ff(a,t));this.Compiler=n},MC=(e,t=n=>{})=>{B1().use(NC).use(RC).process(e).then(n=>{const r=bn(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=>{for(let o=0;o<s.length;o++){const l=s[o],u=l;if(u.type===Z.link){const c=u.children&&u.children[0];if(c&&"text"in c&&c.text.includes(Fs)){const h=u,p=c.text.replace(Fs,""),m="link"in h&&h.link?h.link:"";h.type=Z.mention,h.id=m,h.name=p,h.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in l&&l.children&&i(l.children)}};i(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,l)=>{if("text"in o&&o.text){const u=o.text.match(/~~(.*?)~~/g);u&&u.map(c=>{const h=c.replace(/~~/g,""),p=o.text.indexOf(c),m=o.text.substring(0,p),g=o.text.substring(p+c.length),f=[{text:m},{text:h,[Z.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},Co=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},IC=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=b.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=P.parent(a),r=oe.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},$C=e=>{const{selection:t}=e;return t?b.string(e,t):null},Hl=e=>{let t="";for(const n of oe.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},Ul={"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},LC=(e,t,n,r)=>{for(const a in Ul)if(Ob(a,e)){e.stopPropagation(),e.preventDefault();const i=Ul[a];if(i===Z.link){n([{type:"showLinkEditor",value:!0}]);return}if(QC(i)){Rf(t,i,r);return}Of(t,i,r)}},Af=(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:""}]};X.select(e,(t==null?void 0:t.position)||ff),X.insertNodes(e,[u,{text:" "}]),X.move(e,{distance:1,unit:"offset"}),Co(r)},zC=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&K.isCollapsed(i)){const[s]=K.edges(i),o=b.start(e,s.path),l=b.range(e,o,s),c=b.string(e,l).match(Rc);if(c){const h=c.index||0,p={path:s.path,offset:h},m={path:s.path,offset:h+c[0].length},g=b.range(e,p,m),f=b.after(e,s),D=b.range(e,s,f);if(b.string(e,D).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const B=c[1];let x=[];r&&(x=await r({name:B})),a([{type:"mentionPopover",value:{show:x.length>0?!0:n!==null,selectedUser:0,possibleUsers:x,position:x.length>0?g:null,numberOfUsers:x.length>0?x.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},Tf=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},Mn=e=>typeof e.text=="string",qC=[Z.hr,Z.image,Z.mention],Vl="<br>";function Sf(e,t={nodeTypes:Hn}){const{nodeTypes:n=Hn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Hn,...n,heading:{...Hn[Z.heading],...n[Z.heading]}},l=[o[Z.ul],o[Z.ol]];let u=i;if(!Mn(e)&&s!==Z.mention&&(u=e.children.map(c=>{const h=Mn(c)?!1:l.includes(c.type||""),p=l.includes(e.type||"");let m=!1;return!Mn(e)&&Array.isArray(e.children)&&(m=e.children.some(g=>!Mn(g)&&g.type===o.link)),Sf({...c,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||h||p||m)&&!c.break,listDepth:l.includes(c.type||"")?a+1:a,inBlockquote:s===o[Z.blockquote]||e.parentType===o[Z.blockquote]})}).join("")),!r&&(i===""||i===`
117
+ `)&&e.parentType===o[Z.paragraph]&&s!==o[Z.mention]&&(s=o[Z.paragraph],u=Vl),!(u===""&&!qC.find(c=>o[c]===s)))switch(u!==Vl&&Mn(e)&&(e[Z.strikethrough]&&e[Z.bold]&&e[Z.italic]?u=In(u,"~~***"):e[Z.bold]&&e[Z.italic]?u=In(u,"***"):(e[Z.bold]&&(u=In(u,"**")),e[Z.italic]&&(u=In(u,"_")),e[Z.strikethrough]&&(u=In(u,"~~")),e[Z.code]&&(u=In(u,"`")))),s){case o[Z.heading][1]:return`# ${u}
118
118
  `;case o[Z.heading][2]:return`## ${u}
119
119
  `;case o[Z.heading][3]:return`### ${u}
120
120
  `;case o[Z.heading][4]:return`#### ${u}
@@ -125,41 +125,41 @@ ${dr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",
125
125
  `;case o[Z.codeblock]:return`\`\`\`${e.language||""}
126
126
  ${u}
127
127
  \`\`\`
128
- `;case o[Z.link]:return`[${u}](${e.link||""})`;case o.image:return`![${e.caption}](${e.link||""})`;case o[Z.mention]:const{id:d}=e;return e?`@{{${d}}}`:u;case o[Z.ul]:case o[Z.ol]:return`
128
+ `;case o[Z.link]:return`[${u}](${e.link||""})`;case o.image:return`![${e.caption}](${e.link||""})`;case o[Z.mention]:const{id:c}=e;return e?`@{{${c}}}`:u;case o[Z.ul]:case o[Z.ol]:return`
129
129
  ${u}
130
130
 
131
- `;case o[Z.li]:const f=e&&e.parentType===o[Z.ol],p=e.children.length===1&&In(e.children[0]);let m="";for(let g=0;a>g;g++)f?m+=" ":m+=" ";return t.inBlockquote&&(m="> "+m),`
132
- ${m}${f?"1.":"-"} ${u}${p?`
131
+ `;case o[Z.li]:const h=e&&e.parentType===o[Z.ol],p=e.children.length===1&&Mn(e.children[0]);let m="";for(let g=0;a>g;g++)h?m+=" ":m+=" ";return t.inBlockquote&&(m="> "+m),`
132
+ ${m}${h?"1.":"-"} ${u}${p?`
133
133
  `:""}`;case o[Z.paragraph]:return`${u}
134
134
 
135
135
  `;case o[Z.hr]:return`---
136
- `;default:return u}}function $n(e,t){const n=e.trim(),r=n,a=`${t}${r}${Yl(t)}`;if(r.length===e.length)return a;const i=t+r+Yl(t);return e.replace(n,i)}const Yl=e=>e.split("").reverse().join(""),UC=e=>e.map(t=>Of(t)).join("").trim();const VC=({onFallbackClick:e=()=>{}})=>{const t=ue.useIntl(),n=Sn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=D.useContext(Qt),{show:l,selectedUser:u,possibleUsers:d}=i,f=pf(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const p=jf(a);return c.jsx(Ka,{parent:p,children:c.jsx(Hc,{ref:f,className:"mention-popover",onKeyDown:m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:m,user:g},h)=>c.jsx(wn,{element:"li",className:Y({selected:h===u}),member:{id:m,...g,link:!1},functions:{onClick:y=>{y.preventDefault(),y.stopPropagation();const v={...i,selectedUser:h};r([{type:"mentionPopover",value:v}]),Sf(n,v,r,s),o&&o({id:m||"",name:g.name||""})}}},m)),c.jsx(wn,{element:"li",className:Y("fallback",{selected:d.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${It}icons/invite-user.svg`},link:!1},functions:{onClick:m=>{m.preventDefault(),m.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})},Eo=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=ue.useIntl(),l=Sn(),{id:u,tabbableOption:d,setFocus:f,openTooltip:p,dispatch:m}=D.useContext(Qt),g={};return e!==d&&(g.tabIndex=-1),c.jsxs("li",{id:`${u}-${e}`,className:Y(e,{"has-divider":n}),onMouseEnter:()=>{m([{type:"openTooltip",value:e}])},onMouseLeave:()=>{m([{type:"openTooltip",value:null}])},onFocus:()=>{m([{type:"openTooltip",value:e}])},onBlur:h=>{h.stopPropagation();const y=[{type:"openTooltip",value:null}];l.selection&&y.push({type:"lastAnchor",value:l.selection.anchor}),m(y)},contentEditable:!1,children:[c.jsxs("button",{...s,...g,className:Y(e,a,{active:t}),onClick:h=>{h.stopPropagation(),h.preventDefault()},onMouseDown:h=>{h.stopPropagation(),h.preventDefault(),r()},onKeyDown:h=>{var y,v,w,_;if(h.key!=="Tab")switch(h.key){case"Enter":h.stopPropagation(),h.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":h.stopPropagation(),h.preventDefault();const x=h.currentTarget.closest("li");let k=x==null?void 0:x.nextElementSibling;if(h.key==="ArrowLeft"){const q=x==null?void 0:x.previousElementSibling;q?k=q:k=(y=x==null?void 0:x.parentElement)==null?void 0:y.lastElementChild}else k||(k=(v=x==null?void 0:x.parentElement)==null?void 0:v.firstElementChild);const T=k==null?void 0:k.className.split(" ")[0];T&&(f(T),(w=k==null?void 0:k.querySelector("button"))==null||w.focus());break;default:const S=h.currentTarget.closest("fieldset");if(S){(_=S==null?void 0:S.previousElementSibling)==null||_.focus();break}}},children:[c.jsx(Ie,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(An,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Gl=[Z.ol,Z.ul],Pf=(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)&&de.isElement(a)&&i.type===t}}));return!!r},KC=e=>{const[t]=b.nodes(e,{match:n=>n.type===Z.blockquote});return!!t},Nf=(e,t,n)=>{try{const r=KC(e),a=Pf(e,t),i=Gl.includes(t);X.unwrapNodes(e,{match:l=>{const u=l;return!b.isEditor(u)&&de.isElement(u)&&Gl.includes(u.type)},split:!0});const o={type:a?Z.paragraph:i?Z.li:t};if(X.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=b.parent(e,l,{edge:"end"});Array.from(b.nodes(e,{at:d,match:p=>{const m=p;return!b.isEditor(p)&&de.isElement(p)&&m.type===Z.li}})).forEach(([p,m])=>{oe.string(p).trim()===""&&X.removeNodes(e,{at:m})})}else{if(r){const u={type:Z.blockquote,children:[]};X.wrapNodes(e,u)}const l={type:t,children:[]};X.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},ZC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=D.useContext(Qt),a=Sn(),i=Pf(a,e);return c.jsx(Eo,{id:e,active:i,hasDivider:t,callback:()=>{Nf(a,e,r),n(i?null:e)}})},Er=e=>{const[t]=b.nodes(e,{match:n=>{const r=n;return!b.isEditor(n)&&de.isElement(n)&&r.type===Z.link}});return!!t},YC=(e,t,n,r)=>{e.selection&&ko(e,t,n,r)},GC=(e,t,n,r)=>{const{selection:a}=e;if(a&&K.isCollapsed(a)){const[s]=b.nodes(e,{match:o=>{const l=o;return!b.isEditor(o)&&de.isElement(o)&&l.type===Z.link}});if(s){const[o,l]=s,u={link:t};X.setNodes(e,u,{at:l}),wo(n)}}else ko(e,t,n,r)},ko=(e,t,n,r=a=>{console.error(a)})=>{try{Er(e)&&Rf(e);const{selection:a}=e,i=a&&K.isCollapsed(a),s={type:Z.link,link:t,children:i?[{text:t}]:[]};i?(X.insertNodes(e,s),X.move(e,{distance:1,unit:"offset"})):(X.wrapNodes(e,s,{split:!0}),X.collapse(e,{edge:"end"}),X.insertNodes(e,{text:""}),X.move(e,{distance:1,unit:"offset"})),wo(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},Rf=e=>{X.unwrapNodes(e,{match:t=>{const n=t;return!b.isEditor(t)&&de.isElement(t)&&n.type===Z.link}})};let zi=null;const QC=()=>{const e=ue.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,dispatch:i,reportError:s}=D.useContext(Qt),o=Sn(),l=d1(o),u=(l==null?void 0:l.text)||zC(o),[d,f]=D.useState(Er(o)),p=pf(o,"link-editor",`${n}-link`),m=D.useRef(null);D.useEffect(()=>{var w;!d&&r&&((w=m.current)==null||w.focus())},[d]),D.useEffect(()=>{zi&&clearTimeout(zi),zi=setTimeout(()=>{f(Er(o))},500)},[o.selection]);const g=[],h=["open","edit","remove"].map(w=>{const _={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${w}`},{link:l==null?void 0:l.pretty})};switch(g.push({className:w}),w){case"open":_.href=(l==null?void 0:l.full)||"",_.onClick=x=>{x.preventDefault(),x.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),i([{type:"showLinkEditor",value:!1}])},_.children=c.jsxs(c.Fragment,{children:[_.children,c.jsx(Ie,{children:e.formatMessage({id:`${t}${w}_text`})})]});break;case"edit":_.onClick=()=>{f(!1)};break;case"remove":_.onClick=()=>{const x=[{type:"showLinkEditor",value:!1}];Er(o)&&(Rf(o),x.push({type:"lastAnchor",value:null})),i(x)};break}return _}),y=[{id:"url",type:"url",inputRef:m,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(l==null?void 0:l.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];u&&y.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",u]})});const v=jf(a);return c.jsx(Ka,{parent:v,children:c.jsx(An,{ref:p,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!d},functions:{onBlur:()=>{i([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var w;return(w=m.current)==null?void 0:w.focus()})}},children:d?c.jsx(ar,{wrappers:g,buttons:h}):c.jsx(ln,{element:"fieldset",id:`${n}-link-editor`,className:Y({"show-labels":u}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async w=>{setTimeout(()=>{const _=[{type:"showLinkEditor",value:!1}];if(w.url){const{full:x}=Wc(w.url);l!=null&&l.full?GC(o,x,n,s):YC(o,x,n,s),_.push({type:"lastAnchor",value:null})}i(_)})}},fields:y,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},JC=()=>{const e=Sn(),{setFocus:t,dispatch:n}=D.useContext(Qt),[r,a]=D.useState(!1);return D.useEffect(()=>{a(Er(e))},[e.selection]),c.jsx(Eo,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},XC=e=>[Z.bold,Z.italic,Z.strikethrough].includes(e),Mf=(e,t)=>{const n=b.marks(e);return n?n[t]===!0:!1},If=(e,t,n)=>{try{Mf(e,t)?b.removeMark(e,t):b.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},ex=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=D.useContext(Qt),a=Sn(),i=Mf(a,e);return c.jsx(Eo,{id:e,active:i,hasDivider:t,callback:()=>{If(a,e,r),n(i?null:e)}})},ja=[Z.bold,Z.italic,Z.strikethrough],tx=[Z.ol,Z.ul,Z.blockquote];const nx=({...e})=>{const t=ue.useIntl(),{id:n}=D.useContext(Qt);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[c.jsx(Ie,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[ja.map((r,a)=>c.jsx(ex,{format:r,hasDivider:a===ja.length-1},r)),c.jsx(JC,{}),tx.map((r,a)=>c.jsx(ZC,{format:r,hasDivider:a===1},r))]})]}),c.jsx(QC,{})]})};var rx=ox,ax=/^(?:\w+:)?\/\/(\S+)$/,ix=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,sx=/^[^\s\.]+\.\S{2,}$/;function ox(e){if(typeof e!="string")return!1;var t=e.match(ax);if(!t)return!1;var n=t[1];return n?!!(ix.test(n)||sx.test(n)):!1}const ux=Fn(rx),lx=(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&&ux(i)?ko(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},cx=(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},dx=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===Z.link&&oe.string(r).trim()===""){X.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const $f=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,...l})=>{const u=ue.useIntl(),d=Hh();typeof s>"u"&&(s=!0);const{isInOverlay:f=!1}=a||{},{listMembers:p,clickMentionFallback:m,onChange:g=()=>{},onMention:h=()=>{},reportError:y=R=>{console.error(R)}}=i||{},v=[{type:Z.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const w={editorKey:null,originalValue:t||"",initialValue:t?null:v,tabbableOption:ja[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[_,x]=D.useReducer(Ir,w),{editorKey:k,originalValue:T,initialValue:S,stringValue:q,lastAnchor:N,lastKey:I,hasInteracted:z,hasLoaded:E,mentionPopover:F}=_,j=R=>{const W=R||ja[0];R&&x([{type:"tabbableOption",value:W}])},M=`rte-${e}`,V=D.useCallback(R=>c.jsx(l1,{...R}),[]),G=D.useCallback(R=>c.jsx(c1,{...R}),[]),J=D.useMemo(()=>lx(cx(dx(Gv(o1(Zv())),y),y),M,y),[]);D.useEffect(()=>{if(!t)return;Br.lastIndex=0;const R=t.match(Br);!R||R.length>1||R[0].length!==t.length||z||x([{type:"originalValue",value:t}])},[t]);const ae=R=>{if(!J||R!==M)return;const W=b.end(J,[]);X.select(J,W),ee.focus(J)};D.useEffect(()=>{const R=W=>{var L;const B=W,A=((L=B==null?void 0:B.detail)==null?void 0:L.id)||null;A&&ae(A)};return window.addEventListener("focusEditor",R),()=>{window.removeEventListener("focusEditor",R)}},[]),D.useEffect(()=>{if(J.children.length>0&&!E){if(x([{type:"hasLoaded",value:!0}]),!s)return;ae(M)}},[J.children.length,S]),D.useEffect(()=>{T&&(async()=>{let W=bn(T);if(W.includes("<")){Ar.prototype.escape=A=>A;const B=new Ar;B.addRule("br",{filter:["br"],replacement:A=>A+`
136
+ `;default:return u}}function In(e,t){const n=e.trim(),r=n,a=`${t}${r}${Kl(t)}`;if(r.length===e.length)return a;const i=t+r+Kl(t);return e.replace(n,i)}const Kl=e=>e.split("").reverse().join(""),WC=e=>e.map(t=>Sf(t)).join("").trim();const HC=({onFallbackClick:e=()=>{}})=>{const t=ue.useIntl(),n=Sn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(Qt),{show:l,selectedUser:u,possibleUsers:c}=i,h=hf(n,"mention-popover",`toolbar-${s}`);if(!l)return d.jsx(d.Fragment,{});const p=Tf(a);return d.jsx(Ua,{parent:p,children:d.jsx(qc,{ref:h,className:"mention-popover",onKeyDown:m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:d.jsxs("ul",{children:[c.map(({userId:m,user:g},f)=>d.jsx(wn,{element:"li",className:Y({selected:f===u}),member:{id:m,...g,link:!1},functions:{onClick:D=>{D.preventDefault(),D.stopPropagation();const v={...i,selectedUser:f};r([{type:"mentionPopover",value:v}]),Af(n,v,r,s),o&&o({id:m||"",name:g.name||""})}}},m)),d.jsx(wn,{element:"li",className:Y("fallback",{selected:c.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${It}icons/invite-user.svg`},link:!1},functions:{onClick:m=>{m.preventDefault(),m.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})},xo=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=ue.useIntl(),l=Sn(),{id:u,tabbableOption:c,setFocus:h,openTooltip:p,dispatch:m}=y.useContext(Qt),g={};return e!==c&&(g.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:Y(e,{"has-divider":n}),onMouseEnter:()=>{m([{type:"openTooltip",value:e}])},onMouseLeave:()=>{m([{type:"openTooltip",value:null}])},onFocus:()=>{m([{type:"openTooltip",value:e}])},onBlur:f=>{f.stopPropagation();const D=[{type:"openTooltip",value:null}];l.selection&&D.push({type:"lastAnchor",value:l.selection.anchor}),m(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,v,E,B;if(f.key!=="Tab")switch(f.key){case"Enter":f.stopPropagation(),f.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":f.stopPropagation(),f.preventDefault();const x=f.currentTarget.closest("li");let k=x==null?void 0:x.nextElementSibling;if(f.key==="ArrowLeft"){const q=x==null?void 0:x.previousElementSibling;q?k=q:k=(D=x==null?void 0:x.parentElement)==null?void 0:D.lastElementChild}else k||(k=(v=x==null?void 0:x.parentElement)==null?void 0:v.firstElementChild);const T=k==null?void 0:k.className.split(" ")[0];T&&(h(T),(E=k==null?void 0:k.querySelector("button"))==null||E.focus());break;default:const S=f.currentTarget.closest("fieldset");if(S){(B=S==null?void 0:S.previousElementSibling)==null||B.focus();break}}},children:[d.jsx(Ie,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(An,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Zl=[Z.ol,Z.ul],jf=(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)&&de.isElement(a)&&i.type===t}}));return!!r},UC=e=>{const[t]=b.nodes(e,{match:n=>n.type===Z.blockquote});return!!t},Of=(e,t,n)=>{try{const r=UC(e),a=jf(e,t),i=Zl.includes(t);X.unwrapNodes(e,{match:l=>{const u=l;return!b.isEditor(u)&&de.isElement(u)&&Zl.includes(u.type)},split:!0});const o={type:a?Z.paragraph:i?Z.li:t};if(X.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:p=>{const m=p;return!b.isEditor(p)&&de.isElement(p)&&m.type===Z.li}})).forEach(([p,m])=>{oe.string(p).trim()===""&&X.removeNodes(e,{at:m})})}else{if(r){const u={type:Z.blockquote,children:[]};X.wrapNodes(e,u)}const l={type:t,children:[]};X.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},VC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(Qt),a=Sn(),i=jf(a,e);return d.jsx(xo,{id:e,active:i,hasDivider:t,callback:()=>{Of(a,e,r),n(i?null:e)}})},Er=e=>{const[t]=b.nodes(e,{match:n=>{const r=n;return!b.isEditor(n)&&de.isElement(n)&&r.type===Z.link}});return!!t},KC=(e,t,n,r)=>{e.selection&&wo(e,t,n,r)},ZC=(e,t,n,r)=>{const{selection:a}=e;if(a&&K.isCollapsed(a)){const[s]=b.nodes(e,{match:o=>{const l=o;return!b.isEditor(o)&&de.isElement(o)&&l.type===Z.link}});if(s){const[o,l]=s,u={link:t};X.setNodes(e,u,{at:l}),Co(n)}}else wo(e,t,n,r)},wo=(e,t,n,r=a=>{console.error(a)})=>{try{Er(e)&&Pf(e);const{selection:a}=e,i=a&&K.isCollapsed(a),s={type:Z.link,link:t,children:i?[{text:t}]:[]};i?(X.insertNodes(e,s),X.move(e,{distance:1,unit:"offset"})):(X.wrapNodes(e,s,{split:!0}),X.collapse(e,{edge:"end"}),X.insertNodes(e,{text:""}),X.move(e,{distance:1,unit:"offset"})),Co(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},Pf=e=>{X.unwrapNodes(e,{match:t=>{const n=t;return!b.isEditor(t)&&de.isElement(t)&&n.type===Z.link}})};let $i=null;const YC=()=>{const e=ue.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,dispatch:i,reportError:s}=y.useContext(Qt),o=Sn(),l=l1(o),u=(l==null?void 0:l.text)||$C(o),[c,h]=y.useState(Er(o)),p=hf(o,"link-editor",`${n}-link`),m=y.useRef(null);y.useEffect(()=>{var E;!c&&r&&((E=m.current)==null||E.focus())},[c]),y.useEffect(()=>{$i&&clearTimeout($i),$i=setTimeout(()=>{h(Er(o))},500)},[o.selection]);const g=[],f=["open","edit","remove"].map(E=>{const B={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${E}`},{link:l==null?void 0:l.pretty})};switch(g.push({className:E}),E){case"open":B.href=(l==null?void 0:l.full)||"",B.onClick=x=>{x.preventDefault(),x.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),i([{type:"showLinkEditor",value:!1}])},B.children=d.jsxs(d.Fragment,{children:[B.children,d.jsx(Ie,{children:e.formatMessage({id:`${t}${E}_text`})})]});break;case"edit":B.onClick=()=>{h(!1)};break;case"remove":B.onClick=()=>{const x=[{type:"showLinkEditor",value:!1}];Er(o)&&(Pf(o),x.push({type:"lastAnchor",value:null})),i(x)};break}return B}),D=[{id:"url",type:"url",inputRef:m,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(l==null?void 0:l.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];u&&D.unshift({component:()=>d.jsxs("p",{children:[d.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",u]})});const v=Tf(a);return d.jsx(Ua,{parent:v,children:d.jsx(An,{ref:p,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!c},functions:{onBlur:()=>{i([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var E;return(E=m.current)==null?void 0:E.focus()})}},children:c?d.jsx(rr,{wrappers:g,buttons:f}):d.jsx(ln,{element:"fieldset",id:`${n}-link-editor`,className:Y({"show-labels":u}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async E=>{setTimeout(()=>{const B=[{type:"showLinkEditor",value:!1}];if(E.url){const{full:x}=zc(E.url);l!=null&&l.full?ZC(o,x,n,s):KC(o,x,n,s),B.push({type:"lastAnchor",value:null})}i(B)})}},fields:D,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},GC=()=>{const e=Sn(),{setFocus:t,dispatch:n}=y.useContext(Qt),[r,a]=y.useState(!1);return y.useEffect(()=>{a(Er(e))},[e.selection]),d.jsx(xo,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},QC=e=>[Z.bold,Z.italic,Z.strikethrough].includes(e),Nf=(e,t)=>{const n=b.marks(e);return n?n[t]===!0:!1},Rf=(e,t,n)=>{try{Nf(e,t)?b.removeMark(e,t):b.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},JC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(Qt),a=Sn(),i=Nf(a,e);return d.jsx(xo,{id:e,active:i,hasDivider:t,callback:()=>{Rf(a,e,r),n(i?null:e)}})},Ta=[Z.bold,Z.italic,Z.strikethrough],XC=[Z.ol,Z.ul,Z.blockquote];const ex=({...e})=>{const t=ue.useIntl(),{id:n}=y.useContext(Qt);return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[d.jsx(Ie,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[Ta.map((r,a)=>d.jsx(JC,{format:r,hasDivider:a===Ta.length-1},r)),d.jsx(GC,{}),XC.map((r,a)=>d.jsx(VC,{format:r,hasDivider:a===1},r))]})]}),d.jsx(YC,{})]})};var tx=ix,nx=/^(?:\w+:)?\/\/(\S+)$/,rx=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,ax=/^[^\s\.]+\.\S{2,}$/;function ix(e){if(typeof e!="string")return!1;var t=e.match(nx);if(!t)return!1;var n=t[1];return n?!!(rx.test(n)||ax.test(n)):!1}const sx=Fn(tx),ox=(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&&sx(i)?wo(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},ux=(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},lx=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===Z.link&&oe.string(r).trim()===""){X.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const Mf=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,...l})=>{const u=ue.useIntl(),c=qh();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=a||{},{listMembers:p,clickMentionFallback:m,onChange:g=()=>{},onMention:f=()=>{},reportError:D=R=>{console.error(R)}}=i||{},v=[{type:Z.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const E={editorKey:null,originalValue:t||"",initialValue:t?null:v,tabbableOption:Ta[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[B,x]=y.useReducer(Ir,E),{editorKey:k,originalValue:T,initialValue:S,stringValue:q,lastAnchor:N,lastKey:I,hasInteracted:z,hasLoaded:w,mentionPopover:F}=B,j=R=>{const W=R||Ta[0];R&&x([{type:"tabbableOption",value:W}])},M=`rte-${e}`,V=y.useCallback(R=>d.jsx(o1,{...R}),[]),G=y.useCallback(R=>d.jsx(u1,{...R}),[]),J=y.useMemo(()=>ox(ux(lx(Zv(i1(Vv())),D),D),M,D),[]);y.useEffect(()=>{if(!t)return;Br.lastIndex=0;const R=t.match(Br);!R||R.length>1||R[0].length!==t.length||z||x([{type:"originalValue",value:t}])},[t]);const ae=R=>{if(!J||R!==M)return;const W=b.end(J,[]);X.select(J,W),ee.focus(J)};y.useEffect(()=>{const R=W=>{var L;const _=W,A=((L=_==null?void 0:_.detail)==null?void 0:L.id)||null;A&&ae(A)};return window.addEventListener("focusEditor",R),()=>{window.removeEventListener("focusEditor",R)}},[]),y.useEffect(()=>{if(J.children.length>0&&!w){if(x([{type:"hasLoaded",value:!0}]),!s)return;ae(M)}},[J.children.length,S]),y.useEffect(()=>{T&&(async()=>{let W=bn(T);if(W.includes("<")){Ar.prototype.escape=A=>A;const _=new Ar;_.addRule("br",{filter:["br"],replacement:A=>A+`
137
137
 
138
- `}),W=B.turndown(W)}o&&o.mentions&&(W=await qc({text:W,template:`[${Ts}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),$C(W,B=>{x([{type:"initialValue",value:B},{type:"editorKey",value:T.toString()}]),setTimeout(()=>{x([{type:"stringValue",value:Vl(J)}])},150)})})()},[T]),D.useEffect(()=>{t!==""||!J||os(T,t)&&!z||(b.withoutNormalizing(J,()=>{X.delete(J,{at:{anchor:b.start(J,[]),focus:b.end(J,[])}}),X.deselect(J),J.children.length!==0&&X.unwrapNodes(J,{at:[0]}),X.insertNodes(J,v,{at:[0]})}),x([{type:"initialValue",value:v},{type:"lastAnchor",value:null}]))},[t]);const C=Ac(()=>{WC({editor:J,isShowing:F.show,numberOfUsers:F.numberOfUsers,listMembers:p,dispatch:x})},100);return S?c.jsx("div",{id:M,className:"rich-text-editor",children:c.jsxs(Qt.Provider,{value:{..._,id:M,isInOverlay:f,setFocus:j,dispatch:x,onMention:h,reportError:y},children:[c.jsxs(i1,{editor:J,initialValue:S,onChange:R=>{if(J.operations.some(B=>B.type!=="set_selection")){const B=UC(R);g(B),x([{type:"stringValue",value:Vl(J)}]),z||x([{type:"hasInteracted",value:!0}]),C(),d&&console.log({serialized:B,json:R})}},...l,children:[c.jsx(Gy,{className:"input",renderElement:V,renderLeaf:G,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onKeyDown:R=>{if(R.key==="Enter"){F.show&&(R.preventDefault(),R.stopPropagation(),Sf(J,F,x,M));const{selection:W}=J;if(W){const B=K.isCollapsed(W),[A,L]=b.node(J,W,{depth:1});let $=A,U=$.type;const re=$.children[0];if(re&&[Z.ol,Z.ul].includes(re.type)&&($=re,U=re.type),$&&de.isElement($)&&U!==Z.paragraph){if(U===Z.blockquote&&!R.shiftKey){R.stopPropagation(),R.preventDefault(),X.insertNodes(J,v);return}if(B){const[te,ne]=b.parent(J,W,{edge:"end"}),Q=te.type;if([Z.ul,Z.ol].includes(U))if(R.stopPropagation(),R.preventDefault(),Q===Z.li&&I==="Enter"){te.children.length===1&&"text"in te.children[0]&&te.children[0].text===""&&X.removeNodes(J,{at:ne}),X.insertNodes(J,v,{at:P.next(L)}),X.select(J,b.end(J,P.next(L)));return}else{const[pe,he]=LC(J,Z.li),ye={type:Z.li,children:[{text:""}]};X.insertNodes(J,ye,{at:P.next(he)}),X.select(J,b.end(J,P.next(he)))}}}}}else if(R.key==="Escape"){if(F.show){R.preventDefault(),R.stopPropagation(),x([{type:"mentionPopover",value:{...F,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(R.key)&&F.show){R.preventDefault(),R.stopPropagation();const{selectedUser:W,possibleUsers:B}=F;let A=R.key==="ArrowUp"?W-1:W+1;A<0&&(A=B.length-1),A>=B.length+1&&(A=0),x([{type:"mentionPopover",value:{...F,selectedUser:A}}])}x([{type:"lastKey",value:R.key}]),qC(R,J,x,y)},onBlur:()=>{J.selection&&x([{type:"lastAnchor",value:J.selection.anchor}])},onFocus:()=>{if(N){if(!P.isPath(N.path)||!oe.has(J,N.path))return;const R=oe.get(J,N.path);let W=0;if(fe.isText(R)?W=R.text.length:R.children&&(W=R.children.length),N.offset>W)return;try{X.select(J,{anchor:N,focus:N})}catch(B){const A=B.message;y(`Error focusing editor: ${A}`)}}}}),c.jsx(nx,{}),p?c.jsx(VC,{onFallbackClick:m}):null]},k),c.jsx(Js,{id:`character-limit-${e}`,limit:r,valueLength:Qa(q)})]})}):c.jsx(c.Fragment,{})};const fx=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=D.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);D.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:Y("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:Y("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const f=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:f,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:f,children:d.label})]},f)})})]})};function hx({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=D.useState(!1),[l,u]=D.useState(!1),d=D.useRef(null),f=async p=>{o(!0),u(!1);try{const m=p.target.files&&p.target.files[0];if(!m||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:m,userId:t});a(h=>({...h,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return c.jsxs("div",{className:Y("profile-image-change-figure",e),children:[c.jsx(Yt,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&c.jsx("p",{className:"error text-small",children:c.jsx(ue.FormattedMessage,{id:"profile_image_change_error"})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:d,onChange:f,hidden:!0,"data-testid":"file-input"}),c.jsx(_e,{onClick:()=>d.current&&d.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:c.jsx(ue.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const Lf=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(ln,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const zf=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[d,f]=D.useState([]),[p,m]=D.useState(!0),[g,h]=D.useState(u),{formatMessage:y}=ue.useIntl(),v=async x=>{x.preventDefault();try{await l(d),f([]),h("SUCCESS")}catch(k){h("ERROR"),o(k)}},w=x=>{x.preventDefault(),h("NOT_SUBMITTED"),m(!0),f([])},_=x=>{x.preventDefault(),s(),h("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:g==="SUCCESS"?c.jsx("h2",{className:"success-title",children:y({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",y({id:"inviteForm_error"})]})}),c.jsx(Kt,{}),c.jsx("div",{className:"footer",children:g==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(_e,{variant:"secondary",onClick:w,children:y({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(_e,{onClick:_,children:y({id:"inviteForm_ctaDone"})})]}):c.jsx(_e,{onClick:w,children:y({id:"inviteForm_ctaTryAgain"})})})]}):c.jsx("div",{className:"invite-form-wrapper",children:c.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:Y("invite-form gtm-trackable"),children:[c.jsxs("fieldset",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:r},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),c.jsx(Sh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:y({id:"inviteForm_email_placeholder"}),emails:d,onChange:x=>{f(x),m(!x.length)},autoFocus:!1,getLabel:(x,k,T)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:x}),c.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{T(k),m(!d.length)},className:"remove-email-button",screenreaderText:y({id:"overlay_close"})})]},k)})]}),c.jsx(Kt,{}),c.jsx("fieldset",{className:"footer",children:c.jsx(_e,{className:"sendEmailsButton",disabled:p,children:n})})]})})},xa=e=>e.map(t=>({condition:t})),Dt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},mx=({functions:e,...t})=>{const{formatMessage:n}=ue.useIntl(),[r,a]=D.useState(null),[i,s]=D.useState(!1),[o,l]=D.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[Dt.NEW_PASSWORD]!==m[Dt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=m=>!ds(m[Dt.NEW_PASSWORD]).isValid,f=[{"data-testid":Dt.NEW_PASSWORD,id:Dt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:xa(["required",d]),functions:{onChange:m=>l(ds(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Dt.CONFIRMED_PASSWORD,id:Dt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:xa(["required",u])}];t.isPasswordChange&&f.unshift({"data-testid":Dt.CURRENT_PASSWORD,id:Dt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:xa(["required"])}),i&&f.push({component:md,props:{matchingRules:o}});const p={id:Dt.FORM_ID,fields:f,functions:{...e,onSuccess:async m=>(e.createPassword(m),e.onSuccess&&e.onSuccess(m)),onCatch:m=>a(m==null?void 0:m.statusCode),onFailure:(m,g)=>{(g.includes(Dt.NEW_PASSWORD)||g.includes(Dt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(ln,{...p}),r&&c.jsx(un,{variant:"error",text:r})]})};const qf=({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=D.useRef(null);Gn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=f=>{f.preventDefault(),f.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:Y("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Ie,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&d(f)}}),c.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Ie,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Ie,{children:l.formatMessage({id:"search_cta"})})})]})})})},Ql=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},px=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"]}},gx=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=px(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}])},vx=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,f=(m,g)=>{m.current&&s.validFields[g]!==m.current.validity.valid&&o([{type:`validFields.${g}`,value:m.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>f(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Ql({ref:i.email,validateEmail:r,dispatch:o})},onChange:(m,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:ld,props:{email:d.email,type:d.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>f(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:()=>{f(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:m=>c.jsx("small",{children:m})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:m=>c.jsx("small",{className:"notes text-small",children:m})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:m=>c.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:m}),privacy:m=>c.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:m})}),shownValue:"accepted",functions:{onChange:m=>{if(!m)return;const g=[];["name","email"].forEach(h=>{s.validFields[h]!==i[h].current.validity.valid&&(g.push({type:`validFields.${h}`,value:i[h].current.validity.valid}),h==="email"&&Ql({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const bx=({className:e=""})=>c.jsxs("div",{className:Y("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ue.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ue.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const yx={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},Dx=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ue.useIntl(),{title:u=!0,expectation:d=!1,url:f=!0,logInButton:p=!0,successMessage:m=!0}=a,g={title:u,expectation:d,url:f,logInButton:p,successMessage:m},[h,y]=D.useReducer(Ir,yx),{validFields:v,emailDetails:w,shouldManuallyApprove:_,shouldDisableButton:x,showSuccessMessage:k,showError:T}=h,[S,q]=Ls.useCookies(["signup-this-session","functional-cookie-consent"]),N={form:D.createRef(),name:D.createRef(),email:D.createRef(),jobTitle:D.createRef(),organisation:D.createRef(),tc:D.createRef(),hiddenValidation:D.createRef()};D.useEffect(()=>{_===!0&&N.jobTitle.current&&N.jobTitle.current.focus()},[_]),D.useEffect(()=>{S["signup-this-session"]&&y([{type:"showSuccessMessage",value:!0}])},[S]),D.useEffect(()=>{k&&S["functional-cookie-consent"]&&q("signup-this-session","true",{path:"/",maxAge:3600})},[k]);const I=D.useMemo(()=>vx({placeholders:n,labels:t,shouldShow:g,functions:r,refs:N,state:h,dispatch:y,dataToSubmit:s,intl:l}),[s,r,l,N,g,h]),z=x?!0:_?!Object.values(v).every(E=>E===!0):!v.name||!v.email||["exists","pending","verify"].includes(w.boxType);return g.successMessage&&k?c.jsx(bx,{className:e}):c.jsxs("fieldset",{className:Y("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ue.FormattedMessage,{id:"signup_title"})}),T&&c.jsx(un,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(ln,{className:"signup-form",formRef:N.form,id:"sign-up-form",fields:I,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:z?{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 gx({refs:N,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:y,state:h})},onCatch:E=>{r.handleError(E),y([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:N.hiddenValidation})]})};const fn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return c.jsx("section",{className:Y("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const Cx=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),c.jsx(fn,{className:Y("download-section",n),children:c.jsxs("div",{className:"content-default",children:[D.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(ar,{buttons:r})]})})};function Wf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const xx=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ue.useIntl();return c.jsxs("div",{className:Y("edit-section-placeholder",{"has-icon":!!e}),style:$c(e),children:[c.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&c.jsx(_e,{href:r,variant:"secondary",size:"small",onClick:()=>Wf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},wx=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=D.useState(!1),d=typeof r=="string"||!!n,f=()=>u(!1);return c.jsxs("section",{className:Y("edit-section",t),children:[n&&c.jsx(jn,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:f},className:Y("edit-section-modal"),children:c.jsx(ln,{...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 p=>{var m,g;(m=n==null?void 0:n.functions)!=null&&m.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(p)),u(!1)},onCancel:f}})}),c.jsxs("div",{className:"edit-section-header",children:[c.jsx("h2",{className:"edit-section-header-title",children:a}),d&&c.jsx(_e,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Wf({href:r,setShowModal:u}),children:"Edit"})]}),e||c.jsx(xx,{...s,href:r,setShowModal:u,showEditButton:d}),o&&c.jsx(Kt,{})]})};const Ex=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:Y("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&D.createElement(s.element,{className:Y("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:Y({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:d,nameOfBusiness:f,link:p=!1,description:m=!1},g)=>{if(!d||!d.url)return null;const h=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:f});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:p?c.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:h}):h}),m&&c.jsx("small",{children:m})]},window.btoa(`${d.url}_${g}`))})})]})};let qi;const Wi="contactFooter_",kx=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=D.useRef(null),[r,a]=D.useState(0),[i,s]=D.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(qi),qi=setTimeout(()=>{o(),s(!1)},500))};return D.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(qi),window.removeEventListener("resize",l)}),[]),c.jsx(fn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ue.FormattedMessage,{id:`${Wi}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(ue.FormattedMessage,{id:`${Wi}text`})}),c.jsx(Tn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ue.FormattedMessage,{id:`${Wi}email`})})]}),c.jsx(Lf,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},_x=({activeLink:e,...t})=>c.jsx(fn,{children:c.jsx(od,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(sd,{activeLink:e}),c.jsx(Yc,{...t})]})})});const Hi="cookieBanner_",Ui=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Vi=new Date(Date.now()+12*30*24*60*60*1e3),Hf=()=>{const e=ue.useIntl(),[t,n,r]=Ls.useCookies(Ui),[a,i]=D.useState(!t["apol-cookie-banner"]),s=()=>{Ui.forEach(d=>{n(d,!0,{path:"/",expires:Vi,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Vi}),Ui.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:Vi});return}r(d)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${Hi}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${Hi}title`})}),c.jsx("p",{children:e.formatMessage({id:`${Hi}text`})}),c.jsx(ar,{buttons:u})]})},Ut={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","insights","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},insights:{href:"/learning-hub/global-insights/",gtmType:"insights-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Ln["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Ln["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:Ln.support,gtmType:"concierge-email-click"},business:{email:Ln.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 Vn="footer_",Oa="SiteFooter",Jl=({group:e})=>{const t=Ut[e].order||[];let n=!1;return"text"in Ut[e]&&(n=Ut[e].text),c.jsxs(D.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ue.FormattedMessage,{id:`${Vn}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=Ut[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":i,...s,children:c.jsx(ue.FormattedMessage,{id:`${Vn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(D.Fragment,{children:[c.jsx("dt",{children:c.jsx(ue.FormattedMessage,{id:`${Vn}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ue.FormattedMessage,{id:`${Vn}${e}_${r}_address`,values:{br:c.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&c.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},_o=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(Ua,{element:"hr"}),c.jsx(Qs,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":"logo-homepage-link"}),c.jsx("footer",{children:["platform","community","company","contact"].map(e=>c.jsxs("div",{className:"group",children:[c.jsx(Jl,{group:e}),Object.keys(Ut[e]).includes("child")&&c.jsx(Jl,{group:Ut[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(Ut.social.order)&&Ut.social.order.map(e=>{const t=Ut.social[e];return c.jsx("li",{className:e,children:c.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ue.FormattedMessage,{id:`${Vn}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ue.FormattedMessage,{id:`${Vn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),$e={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===gt.ACCOUNT&&t===!1&&n[gt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&$e.handlerCalled[e]&&i-$e.handlerCalled[e]<500)return;$e.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 gt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case gt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case gt.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=kc(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?$e.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 gt.SITE:if(n){const u=$e.findFirstChild(t.current.children,"attributes.aria-controls",gt.SITE);s=$e.findFirstChild(u.children,"href")}else s=$e.findFirstChild(t.current.children,"href");break;case gt.ACCOUNT:if(o=$e.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=$e.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($e.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout($e.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout($e.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{$e.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Mr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},Pa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ue.useIntl(),o=kc(Mr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,d=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let _=o.gtmType||`${e}-click`;if(_.includes(".")){const x=_.split("."),k=x[x.length-2];_=`${k==="topics"?`${k}-`:""}${x[x.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":_,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const m=o.order&&o.order[0]&&o[o.order[0]],g=m&&o[o.order[0]].order,h=p&&window.location.pathname===o.href;let y={},v={},w={};if(h&&(y={...y,"aria-current":"page"}),m){const _=o.menuId||e,x={onClick:k=>$e.events.onClick(k,{id:_,callback:a,isOpen:r[_]}),onFocus:()=>$e.events.onFocus({id:_}),onBlur:()=>$e.events.onBlur({id:_,callback:a}),onMouseLeave:()=>$e.events.onBlur({id:_,callback:a}),onMouseEnter:()=>$e.events.onMouseEnter({id:_,callback:a})};v={...x,id:_===gt.SITE?gt.SITE:gt.ACCOUNT},n&&(g&&(w={...x,className:"navigation-button",onKeyPress:k=>{k.key==="Enter"&&$e.events.onClick(k,{id:_,callback:a,isOpen:r[_]})},"aria-haspopup":!0,"aria-expanded":r[_],"aria-controls":_}),v={...v,hidden:_ in r?!r[_]:!0}),g||(v={...v})}return c.jsxs("li",{className:Y({[o.className]:o.className,"has-submenu":m,parent:g,active:h}),...y,children:[p?D.createElement(d?_e:"a",p,s.formatMessage({id:f})):n&&o.order&&g?c.jsxs("button",{...w,children:[s.formatMessage({id:f}),c.jsx(Ie,{children:s.formatMessage({id:`header_menu_${r[gt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:f}),o.order&&c.jsx("ul",{...v,children:o.order.map(_=>{if(!o[_])return null;const x={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[_].order?c.jsxs("li",{className:Y({[o[_].className]:o[_].className}),children:[s.formatMessage({id:`${f}_${_}`}),c.jsx("ul",{children:o[_].order.map(k=>c.jsx(Pa,{id:`${e}.${_}.${k}`,...x},k))})]},_):c.jsx(Pa,{id:`${e}.${_}`,...x},_)})})]},e)};const Bx={height:67,height_desktop:83};var gt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(gt||{});const Bo=({showNavigation:e=!0})=>{const t=ue.useIntl(),n=D.useContext(Lt),r=nr(!0,!0),a=n&&typeof n.id=="string",i=D.useMemo(()=>$e.getIsDesktopVersion(a,r),[a,r]),[s,o]=D.useReducer(Ir,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,f=D.useRef(s);D.useEffect(()=>{f.current=s},[s]),Sc({scrollPosition:Bx[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const v=f.current.menus;!i&&v["site-navigation"]||$e.shouldChangeHeaderIsVisible(!0,v,o)},scrollDown:()=>{const v=f.current.menus;!i&&v["site-navigation"]||$e.shouldChangeHeaderIsVisible(!1,v,o)}}});const p=(v,w,_=!1)=>{$e.handleMenus({id:v,value:w,menus:f.current.menus,dispatch:o,forceHandle:_})},m=D.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(w=>{f.current.menus[w]&&p(w,!1,!0)})};D.useEffect(()=>{var v;return(v=document.getElementById("header"))==null||v.addEventListener("keydown",g),()=>{var w;(w=document.getElementById("header"))==null||w.removeEventListener("keydown",g)}},[]),Gn(()=>{u["site-navigation"]&&$e.autoFocus({menu:"site-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),Gn(()=>{u["account-navigation"]&&$e.autoFocus({menu:"account-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const h=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Ie,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(qf,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),y=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Ie,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:m,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Mr.order.map(v=>c.jsx(Pa,{id:v,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},v))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:Y({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(Ie,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(Qs,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[y,h]}):c.jsxs(c.Fragment,{children:[h,y]}),a?c.jsxs("button",{className:"account-button",onClick:v=>$e.events.onClick(v,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>$e.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>$e.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Ie,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(Yt,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:Mr.buttons.order.map(v=>c.jsx(Pa,{id:`buttons.${v}`},v))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:Y("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const Fx=()=>{const e=ue.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Bo,{}),c.jsx("div",{id:"content",children:c.jsx(un,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(_o,{})]})},Uf=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:d="default",variant:f="default",circle:p="default",modal:m="default"}=i,g=Fc(),[h,y]=D.useState(""),v=T=>{const{detail:{message:S}}=T;y(S)};D.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const w=ma(e,{locale:o}),_=ma(t,{locale:o}),x=ma(n,{locale:o}),k={};return d!=="default"&&(k[d]=!0),f!=="default"&&(k[f]=!0),p!=="default"&&(k[p]=!0),c.jsx(jh.ErrorBoundary,{onError:r,fallback:c.jsx(Fx,{}),children:c.jsxs(D.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:Y(s,k,{"has-footer":u}),children:[c.jsx(Bo,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[_&&c.jsx("div",{className:Y("additional-content prepended",{"large-modal":m==="large"}),children:_}),D.createElement(d==="bold"?Po:"div",{id:"content",children:w,className:Y({"large-modal":m==="large"})})]}),x&&c.jsx("div",{className:"additional-content appended",children:x}),u&&c.jsx(_o,{}),c.jsx(Hf,{})]}),h&&c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:h})]})})},Xl={default:"tags_",headerTopics:"header_topics_topics_"},Ki={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"},Ax={getTagDetails:e=>{if(e.includes("topic_")){if(e=Ki.topic[e.replace("topic_","")],e){const t=Mr.topics.topics[e].href;return t?{id:e,href:t,text:`${Xl.headerTopics}${e}`}:null}return null}return Ki[e]?(e=Ki[e],{id:e,text:`${Xl.default}${e}`}):null}};const Tx=({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 d=Ax.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:Y("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:d}):d},u.id)})})};const Sx=({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:c.jsxs("div",{className:Y("members-list",s),children:[c.jsxs("h1",{children:[o.formatMessage({id:"membersList"}),c.jsx("span",{className:"count",children:t})]}),c.jsx("ul",{children:e.map((l,u)=>c.jsxs("li",{children:[c.jsx(wn,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&c.jsx(gn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&c.jsx($r,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})},jx={showForm:!1},ii=D.createContext(jx),Vf=({children:e})=>{const[t,n]=D.useState({showForm:!1});return c.jsx(ii.Provider,{value:{...t,updateConversation:n},children:e})},ec=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Ox=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ue.useIntl();return t?c.jsx("small",{children:Bt(a.formatMessage,`${e}explainer`,n,"action",{a:i=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):c.jsx(c.Fragment,{})},Px=({formID:e,intlPath:t,showLabel:n,type:r})=>{const a=ue.useIntl();return n?c.jsx("label",{htmlFor:`${e}-input`,className:"text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:a.formatMessage({id:`${t}label`})}):c.jsx(Ie,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:Bt(a.formatMessage,`${t}label_action`,r,"action")})};let sa=null;const Je="discussion_form_",zr=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r,placeholder:a,maxLength:i=0,buttons:s,forceShow:o={cancel:!1,error:!1},isCommunity:l=!1,functions:u,data:d={},gtmContext:f="DiscussionForm"})=>{var Fe,Ae,He;const p=ue.useIntl(),m=D.useContext(Lt),[g,h]=D.useState(""),{isLoading:y=!1,isInWrapper:v=!1,isInOverlay:w=!1,isAutoFocused:_=!1,isEditing:x=!1,hasTitleField:k=!1,isPrepopulated:T=!1,showTitle:S=!1,showGuidelines:q=!0,showDivider:N=!1,showSuccessMessage:I=!0}=r||{},{onChange:z=()=>{},create:E=()=>{},handleSaveEdit:F=()=>{},handleCancel:j=()=>{},callback:M=()=>{},onMention:V=()=>{},listMembers:G=()=>Promise.resolve([]),clickMentionFallback:J=()=>{},props:ae={create:{projectNames:["questions-answers"]}}}=u,[C,R]=D.useState({title:k&&k.text||"",body:x&&x.text||T&&T.text||""}),[W,B]=D.useState(o.error||!1),[A,L]=D.useState(!1);if(D.useEffect(()=>{l&&!x&&T&&T!==C.body&&R({...C,body:T.text||""})},[T]),y)return c.jsx(kt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const $=Se=>{R({...C,body:Se}),z({body:Se});let Te;!m||!m.id?Te=Bt(p.formatMessage,`${Je}error_loggedOut`,t.type,"action"):n?i>0&&Se.length>=i&&(Te=`${Je}error_tooLong`):Te=Bt(p.formatMessage,`${Je}error_noPermission`,t.type,"action"),Te?B(Te):W&&B(!1)};let U=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const Se=((Fe=t.slugs)==null?void 0:Fe.reply)||((Ae=t.slugs)==null?void 0:Ae.answer)||((He=t.slugs)==null?void 0:He.question)||"";Se&&(U=`${U}-${Se.slice(-15)}`)}e&&(U=`${e}-${U}`);const re=async()=>{if(!m||!m.id||!n||Q)return;sa&&clearTimeout(sa),L("submitting");const Se=window.location.pathname;try{let Te;switch(t.type){case"post":Te=await E({title:C.title,content:C.body});break;case"question":Te=await E({title:C.body,authorId:m&&m.id,...ae==null?void 0:ae.create});break;case"response":Te=await E({questionSlug:t.slugs.question},{body:C.body,authorId:m&&m.id,contentPath:Se});break;case"reply":Te=await E({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:C.body,authorId:m&&m.id,contentPath:Se});break;default:break}await Wh(1e3),M&&await M(Te),sa=setTimeout(()=>{R({title:"",body:""}),L("submitted"),h(Bt(p.formatMessage,`${Je}success`,t.type,"action"));const Ne=new Event("discussionFormSubmitted");document.dispatchEvent(Ne),te()},500)}catch(Te){const Ne=Te;let ke=`${Je}error`;Ne!=null&&Ne.message.includes("entry already exists")&&(ke=Bt(p.formatMessage,`${Je}error_alreadyExists`,t.type,"action")),Ne!=null&&Ne.message.includes("429")?ke=Bt(p.formatMessage,`${Je}error_tooMany`,t.type,"action"):Ne!=null&&Ne.message.includes("400")&&(ke=`${Je}error`),B(ke),te()}},te=()=>{sa=setTimeout(()=>{B(!1),L(!1),h("")},5e3)},ne=!C.title||!Uo(C.title),le=!C.body||!Uo(C.body);let Q=le;k&&(Q=ne&&le);const pe=A==="submitting",he=[{component:Px,props:{formID:U,intlPath:Je,showLabel:k!==!1,type:t.type}},{component:$f,props:{id:`${U}-input`,value:A==="submitting"&&!W?"":C.body,placeholder:a||Bt(p.formatMessage,`${Je}placeholder`,t.type,"action"),maxLength:i,meta:{isInOverlay:w},functions:{onChange:$,onMention:V,listMembers:G,clickMentionFallback:J},data:d,autoFocus:x!==!1||_&&!k,"aria-invalid":!!W,"aria-errormessage":"error-message"}},{component:Ox,props:{intlPath:Je,showGuidelines:q,type:t.type,gtmContext:f}}];N&&he.push({component:Kt}),k&&he.unshift({id:"title",type:"text",value:k.text,limit:250,autoFocus:_,label:p.formatMessage({id:`${Je}titleField_label`}),placeholder:p.formatMessage({id:`${Je}titleField_placeholder`}),functions:{onChange:Se=>{R({...C,title:Se}),z({title:Se})}},validation:[{condition:()=>Q,error:p.formatMessage({id:`${Je}titleField_error`})}]});let ye=!m||!m.id||!n||Q||pe;return x&&(k?ye=ye||C.body===x.text&&C.title===k.text:ye=ye||C.body===x.text),c.jsxs(c.Fragment,{children:[c.jsxs(ln,{id:U,className:Y("discussion-card discussion-form",{"no-styling":v&&x}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:x&&!pe||o.cancel},functions:{onSuccess:async()=>{if(x){L("submitting"),F(C);return}await re()},onCancel:j},fields:he,intlPath:Je,button:{variant:"primary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":f,"data-gtm-event-type":`${x?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:ye,overwriteSubmittingText:!0,text:!pe&&!x&&(s!=null&&s.submit)?s==null?void 0:s.submit:p.formatMessage({id:`${Je}${pe?x?"saving":"posting":x?"save":"post"}`})},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":f,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!o.cancel&&(!m||!m.id||!C.body),text:s!=null&&s.cancel?s==null?void 0:s.cancel:p.formatMessage({id:`${Je}cancel`})},gtm:{context:f,event:`${t.type}-form`},"data-testid":`discussion-${t.type}-form`,children:[S&&!x&&["question"].includes(t.type)&&c.jsx("h2",{children:Bt(p.formatMessage,`${Je}title`,t.type,"action")}),c.jsx(wn,{member:m?{...m,link:!1}:"community",gtmContext:f,gtmType:"profile-click"})]}),A==="submitted"&&I&&c.jsx(Fr,{className:"success","data-testid":"success",children:Bt(p.formatMessage,`${Je}success`,t.type,"action")}),W&&c.jsx(Fr,{id:"error-message",className:"error","data-testid":"error",children:o.error?o.error:typeof W=="string"?W.includes(" ")?W:p.formatMessage({id:W},{action:p.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):W}),g&&c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:g})]})},Nx=Object.freeze(Object.defineProperty({__proto__:null,default:zr},Symbol.toStringTag,{value:"Module"})),Rx=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Mx=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Na=({icon:e,className:t="",...n})=>c.jsx(_e,{className:Y("discussion-button",t),variant:"tertiary",icon:e,...n});let kr=!1;const Zi=()=>{kr!==!1&&(clearTimeout(kr),kr=!1)},Yi=5;let Gi=null;const Kf=({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(),d={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[f,p]=D.useReducer(Ir,d),{numberOfLikes:m,userLikedContent:g,ignoreInteractions:h,showLikers:y,tabbableLink:v}=f;D.useEffect(()=>{p([{type:"userLikedContent",value:a}])},[a]);const w=D.useMemo(()=>Mx(n,Yi),[n]),_=S=>{if(S.preventDefault(),S.stopPropagation(),p([{type:"showLikers",value:!1}]),kr)return Zi(),!1;if(Zi(),h||!s)return!1;kr=setTimeout(x,350)},x=async()=>{if(Zi(),h||!s)return!1;let S=g?m-1:m+1;S<0&&(S=0),p([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const q=Rx(i.slugs);g?await l(q):await o({...q,payload:{contentPath:window.location.pathname}})}}catch{p([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{p([{type:"ignoreInteractions",value:!1}])}},k=()=>{Gi=setTimeout(()=>{p([{type:"showLikers",value:!1}])},500)},T=()=>{Gi&&clearTimeout(Gi)};return D.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&p([{type:"showLikers",value:!1}])},onMouseEnter:()=>{T(),p([{type:"showLikers",value:!0}])},onMouseLeave:()=>{k()}},c.jsxs(c.Fragment,{children:[c.jsx(Na,{className:Y("discussion-button text-medium action-button",{"show-spinner":h,"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:_,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:m})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Ie,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{T()},onBlur:()=>k,onClick:S=>{var N;S.preventDefault(),S.stopPropagation(),T(),p([{type:"showLikers",value:!0}]);const q=(N=S.currentTarget.nextSibling)==null?void 0:N.childNodes[0];if(q){const I=q.querySelector("li:first-child a");I&&(p([{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:c.jsx(Ie,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(An,{id:`likes-tooltip-${i.slug}`,isOpen:y,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[w.map((S,q)=>{if(typeof S=="string"||!S.name)return null;const N={};return v!==q&&(N.tabIndex=-1),c.jsx("li",{"data-index":q,children:c.jsx(Tn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:I=>I==null?void 0:I.stopPropagation(),onFocus:()=>T(),onKeyDown:I=>{var M,V,G,J;if(!I||!["ArrowUp","ArrowDown"].includes(I.key||""))return;I.stopPropagation(),I.preventDefault();const z=I.key==="ArrowUp"?"up":"down",E=(M=I.currentTarget)==null?void 0:M.parentElement;let F=E==null?void 0:E.nextElementSibling;if(z==="up"){const ae=E==null?void 0:E.previousElementSibling;ae?F=ae:(F=(V=E==null?void 0:E.parentElement)==null?void 0:V.lastElementChild,(F==null?void 0:F.getAttribute("data-index"))==="-1"&&(F=F==null?void 0:F.previousElementSibling))}else(!F||(F==null?void 0:F.getAttribute("data-index"))==="-1")&&(F=(G=E==null?void 0:E.parentElement)==null?void 0:G.firstElementChild);if(!F)return;const j=(F==null?void 0:F.getAttribute("data-index"))||"0";p([{type:"tabbableLink",value:j}]),(J=F==null?void 0:F.querySelector("a"))==null||J.focus()},...N,children:S.name})},S.id||window.btoa(S.name))}),t>Yi&&c.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Yi})})]})})]})]}))},Qi=({children:e,class:t,...n})=>{const r={...n,class:Y("subtle",t)};return c.jsx("blockquote",{...r,children:e})},Ix=280,Fo=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Yn(e,typeof t=="number"?t:Ix):e;a=a.trim();const i=`<br>
138
+ `}),W=_.turndown(W)}o&&o.mentions&&(W=await Lc({text:W,template:`[${Fs}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),MC(W,_=>{x([{type:"initialValue",value:_},{type:"editorKey",value:T.toString()}]),setTimeout(()=>{x([{type:"stringValue",value:Hl(J)}])},150)})})()},[T]),y.useEffect(()=>{t!==""||!J||is(T,t)&&!z||(b.withoutNormalizing(J,()=>{X.delete(J,{at:{anchor:b.start(J,[]),focus:b.end(J,[])}}),X.deselect(J),J.children.length!==0&&X.unwrapNodes(J,{at:[0]}),X.insertNodes(J,v,{at:[0]})}),x([{type:"initialValue",value:v},{type:"lastAnchor",value:null}]))},[t]);const C=Bc(()=>{zC({editor:J,isShowing:F.show,numberOfUsers:F.numberOfUsers,listMembers:p,dispatch:x})},100);return S?d.jsx("div",{id:M,className:"rich-text-editor",children:d.jsxs(Qt.Provider,{value:{...B,id:M,isInOverlay:h,setFocus:j,dispatch:x,onMention:f,reportError:D},children:[d.jsxs(r1,{editor:J,initialValue:S,onChange:R=>{if(J.operations.some(_=>_.type!=="set_selection")){const _=WC(R);g(_),x([{type:"stringValue",value:Hl(J)}]),z||x([{type:"hasInteracted",value:!0}]),C(),c&&console.log({serialized:_,json:R})}},...l,children:[d.jsx(Zy,{className:"input",renderElement:V,renderLeaf:G,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onKeyDown:R=>{if(R.key==="Enter"){F.show&&(R.preventDefault(),R.stopPropagation(),Af(J,F,x,M));const{selection:W}=J;if(W){const _=K.isCollapsed(W),[A,L]=b.node(J,W,{depth:1});let $=A,U=$.type;const re=$.children[0];if(re&&[Z.ol,Z.ul].includes(re.type)&&($=re,U=re.type),$&&de.isElement($)&&U!==Z.paragraph){if(U===Z.blockquote&&!R.shiftKey){R.stopPropagation(),R.preventDefault(),X.insertNodes(J,v);return}if(_){const[te,ne]=b.parent(J,W,{edge:"end"}),Q=te.type;if([Z.ul,Z.ol].includes(U))if(R.stopPropagation(),R.preventDefault(),Q===Z.li&&I==="Enter"){te.children.length===1&&"text"in te.children[0]&&te.children[0].text===""&&X.removeNodes(J,{at:ne}),X.insertNodes(J,v,{at:P.next(L)}),X.select(J,b.end(J,P.next(L)));return}else{const[pe,he]=IC(J,Z.li),ye={type:Z.li,children:[{text:""}]};X.insertNodes(J,ye,{at:P.next(he)}),X.select(J,b.end(J,P.next(he)))}}}}}else if(R.key==="Escape"){if(F.show){R.preventDefault(),R.stopPropagation(),x([{type:"mentionPopover",value:{...F,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(R.key)&&F.show){R.preventDefault(),R.stopPropagation();const{selectedUser:W,possibleUsers:_}=F;let A=R.key==="ArrowUp"?W-1:W+1;A<0&&(A=_.length-1),A>=_.length+1&&(A=0),x([{type:"mentionPopover",value:{...F,selectedUser:A}}])}x([{type:"lastKey",value:R.key}]),LC(R,J,x,D)},onBlur:()=>{J.selection&&x([{type:"lastAnchor",value:J.selection.anchor}])},onFocus:()=>{if(N){if(!P.isPath(N.path)||!oe.has(J,N.path))return;const R=oe.get(J,N.path);let W=0;if(fe.isText(R)?W=R.text.length:R.children&&(W=R.children.length),N.offset>W)return;try{X.select(J,{anchor:N,focus:N})}catch(_){const A=_.message;D(`Error focusing editor: ${A}`)}}}}),d.jsx(ex,{}),p?d.jsx(HC,{onFallbackClick:m}):null]},k),d.jsx(Gs,{id:`character-limit-${e}`,limit:r,valueLength:Ya(q)})]})}):d.jsx(d.Fragment,{})};const cx=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=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 dx({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=y.useState(!1),[l,u]=y.useState(!1),c=y.useRef(null),h=async p=>{o(!0),u(!1);try{const m=p.target.files&&p.target.files[0];if(!m||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:m,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(Yt,{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(_e,{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 If=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(ln,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const $f=({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]=y.useState([]),[p,m]=y.useState(!0),[g,f]=y.useState(u),{formatMessage:D}=ue.useIntl(),v=async x=>{x.preventDefault();try{await l(c),h([]),f("SUCCESS")}catch(k){f("ERROR"),o(k)}},E=x=>{x.preventDefault(),f("NOT_SUBMITTED"),m(!0),h([])},B=x=>{x.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(Kt,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(_e,{variant:"secondary",onClick:E,children:D({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(_e,{onClick:B,children:D({id:"inviteForm_ctaDone"})})]}):d.jsx(_e,{onClick:E,children:D({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:v,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(Ah.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:D({id:"inviteForm_email_placeholder"}),emails:c,onChange:x=>{h(x),m(!x.length)},autoFocus:!1,getLabel:(x,k,T)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:x}),d.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{T(k),m(!c.length)},className:"remove-email-button",screenreaderText:D({id:"overlay_close"})})]},k)})]}),d.jsx(Kt,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(_e,{className:"sendEmailsButton",disabled:p,children:n})})]})})},Da=e=>e.map(t=>({condition:t})),Dt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},fx=({functions:e,...t})=>{const{formatMessage:n}=ue.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[Dt.NEW_PASSWORD]!==m[Dt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=m=>!ls(m[Dt.NEW_PASSWORD]).isValid,h=[{"data-testid":Dt.NEW_PASSWORD,id:Dt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Da(["required",c]),functions:{onChange:m=>l(ls(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Dt.CONFIRMED_PASSWORD,id:Dt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Da(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":Dt.CURRENT_PASSWORD,id:Dt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Da(["required"])}),i&&h.push({component:fd,props:{matchingRules:o}});const p={id:Dt.FORM_ID,fields:h,functions:{...e,onSuccess:async m=>(e.createPassword(m),e.onSuccess&&e.onSuccess(m)),onCatch:m=>a(m==null?void 0:m.statusCode),onFailure:(m,g)=>{(g.includes(Dt.NEW_PASSWORD)||g.includes(Dt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(ln,{...p}),r&&d.jsx(un,{variant:"error",text:r})]})};const Lf=({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=y.useRef(null);Yn(()=>{!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(Ie,{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(Ie,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Ie,{children:l.formatMessage({id:"search_cta"})})})]})})})},Yl=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}])},hx=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"]}},mx=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=hx(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}])},px=({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=(m,g)=>{m.current&&s.validFields[g]!==m.current.validity.valid&&o([{type:`validFields.${g}`,value:m.current.validity.valid}])},p=[{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"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Yl({ref:i.email,validateEmail:r,dispatch:o})},onChange:(m,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:od,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>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"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:m=>d.jsx("small",{children:m})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:m=>d.jsx("small",{className:"notes text-small",children:m})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:m=>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:m}),privacy:m=>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:m})}),shownValue:"accepted",functions:{onChange:m=>{if(!m)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"&&Yl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const gx=({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 vx={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},bx=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ue.useIntl(),{title:u=!0,expectation:c=!1,url:h=!0,logInButton:p=!0,successMessage:m=!0}=a,g={title:u,expectation:c,url:h,logInButton:p,successMessage:m},[f,D]=y.useReducer(Ir,vx),{validFields:v,emailDetails:E,shouldManuallyApprove:B,shouldDisableButton:x,showSuccessMessage:k,showError:T}=f,[S,q]=Is.useCookies(["signup-this-session","functional-cookie-consent"]),N={form:y.createRef(),name:y.createRef(),email:y.createRef(),jobTitle:y.createRef(),organisation:y.createRef(),tc:y.createRef(),hiddenValidation:y.createRef()};y.useEffect(()=>{B===!0&&N.jobTitle.current&&N.jobTitle.current.focus()},[B]),y.useEffect(()=>{S["signup-this-session"]&&D([{type:"showSuccessMessage",value:!0}])},[S]),y.useEffect(()=>{k&&S["functional-cookie-consent"]&&q("signup-this-session","true",{path:"/",maxAge:3600})},[k]);const I=y.useMemo(()=>px({placeholders:n,labels:t,shouldShow:g,functions:r,refs:N,state:f,dispatch:D,dataToSubmit:s,intl:l}),[s,r,l,N,g,f]),z=x?!0:B?!Object.values(v).every(w=>w===!0):!v.name||!v.email||["exists","pending","verify"].includes(E.boxType);return g.successMessage&&k?d.jsx(gx,{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"})}),T&&d.jsx(un,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(ln,{className:"signup-form",formRef:N.form,id:"sign-up-form",fields:I,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:z?{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 mx({refs:N,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:D,state:f})},onCatch:w=>{r.handleError(w),D([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:N.hiddenValidation})]})};const fn=({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 yx=({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(fn,{className:Y("download-section",n),children:d.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),d.jsx(rr,{buttons:r})]})})};function zf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const Dx=({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:Mc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(_e,{href:r,variant:"secondary",size:"small",onClick:()=>zf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},Cx=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=y.useState(!1),c=typeof r=="string"||!!n,h=()=>u(!1);return d.jsxs("section",{className:Y("edit-section",t),children:[n&&d.jsx(sr,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:h},className:Y("edit-section-modal"),children:d.jsx(ln,{...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 p=>{var m,g;(m=n==null?void 0:n.functions)!=null&&m.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(p)),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(_e,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>zf({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(Dx,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(Kt,{})]})};const xx=({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&&y.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:p=!1,description:m=!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:p?d.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),m&&d.jsx("small",{children:m})]},window.btoa(`${c.url}_${g}`))})})]})};let Li;const zi="contactFooter_",wx=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=y.useRef(null),[r,a]=y.useState(0),[i,s]=y.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(Li),Li=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(Li),window.removeEventListener("resize",l)}),[]),d.jsx(fn,{id:"contactForm",className:"contact-footer",children:d.jsxs("div",{className:"inner-wrapper",children:[d.jsx("h2",{children:d.jsx(ue.FormattedMessage,{id:`${zi}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:`${zi}text`})}),d.jsx(Tn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(ue.FormattedMessage,{id:`${zi}email`})})]}),d.jsx(If,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Ex=({activeLink:e,...t})=>d.jsx(fn,{children:d.jsx(id,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(ad,{activeLink:e}),d.jsx(Kc,{...t})]})})});const qi="cookieBanner_",Wi=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Hi=new Date(Date.now()+12*30*24*60*60*1e3),qf=()=>{const e=ue.useIntl(),[t,n,r]=Is.useCookies(Wi),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{Wi.forEach(c=>{n(c,!0,{path:"/",expires:Hi,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Hi}),Wi.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:Hi});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:`${qi}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${qi}title`})}),d.jsx("p",{children:e.formatMessage({id:`${qi}text`})}),d.jsx(rr,{buttons:u})]})},Ut={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","insights","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},insights:{href:"/learning-hub/global-insights/",gtmType:"insights-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:$n["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:$n["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:$n.support,gtmType:"concierge-email-click"},business:{email:$n.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 Un="footer_",Sa="SiteFooter",Gl=({group:e})=>{const t=Ut[e].order||[];let n=!1;return"text"in Ut[e]&&(n=Ut[e].text),d.jsxs(y.Fragment,{children:[d.jsx("p",{className:"pre-title",children:d.jsx(ue.FormattedMessage,{id:`${Un}${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}=Ut[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":Sa,"data-gtm-event-type":i,...s,children:d.jsx(ue.FormattedMessage,{id:`${Un}${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(y.Fragment,{children:[d.jsx("dt",{children:d.jsx(ue.FormattedMessage,{id:`${Un}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(ue.FormattedMessage,{id:`${Un}${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":Sa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Eo=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx(Wa,{element:"hr"}),d.jsx(Ys,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Sa,"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(Gl,{group:e}),Object.keys(Ut[e]).includes("child")&&d.jsx(Gl,{group:Ut[e].child})]},e))}),d.jsx("hr",{}),d.jsxs("div",{className:"sub-footer",children:[d.jsx("ul",{children:Array.isArray(Ut.social.order)&&Ut.social.order.map(e=>{const t=Ut.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":Sa,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(ue.FormattedMessage,{id:`${Un}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(ue.FormattedMessage,{id:`${Un}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),$e={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===gt.ACCOUNT&&t===!1&&n[gt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&$e.handlerCalled[e]&&i-$e.handlerCalled[e]<500)return;$e.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 gt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case gt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case gt.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=wc(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?$e.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 gt.SITE:if(n){const u=$e.findFirstChild(t.current.children,"attributes.aria-controls",gt.SITE);s=$e.findFirstChild(u.children,"href")}else s=$e.findFirstChild(t.current.children,"href");break;case gt.ACCOUNT:if(o=$e.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=$e.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($e.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout($e.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout($e.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{$e.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Mr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},ja=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ue.useIntl(),o=wc(Mr,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 p=!1;if(o.href){let B=o.gtmType||`${e}-click`;if(B.includes(".")){const x=B.split("."),k=x[x.length-2];B=`${k==="topics"?`${k}-`:""}${x[x.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":B,"data-gtm-event-context":"HeaderButtons"}),c&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const m=o.order&&o.order[0]&&o[o.order[0]],g=m&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let D={},v={},E={};if(f&&(D={...D,"aria-current":"page"}),m){const B=o.menuId||e,x={onClick:k=>$e.events.onClick(k,{id:B,callback:a,isOpen:r[B]}),onFocus:()=>$e.events.onFocus({id:B}),onBlur:()=>$e.events.onBlur({id:B,callback:a}),onMouseLeave:()=>$e.events.onBlur({id:B,callback:a}),onMouseEnter:()=>$e.events.onMouseEnter({id:B,callback:a})};v={...x,id:B===gt.SITE?gt.SITE:gt.ACCOUNT},n&&(g&&(E={...x,className:"navigation-button",onKeyPress:k=>{k.key==="Enter"&&$e.events.onClick(k,{id:B,callback:a,isOpen:r[B]})},"aria-haspopup":!0,"aria-expanded":r[B],"aria-controls":B}),v={...v,hidden:B in r?!r[B]:!0}),g||(v={...v})}return d.jsxs("li",{className:Y({[o.className]:o.className,"has-submenu":m,parent:g,active:f}),...D,children:[p?y.createElement(c?_e:"a",p,s.formatMessage({id:h})):n&&o.order&&g?d.jsxs("button",{...E,children:[s.formatMessage({id:h}),d.jsx(Ie,{children:s.formatMessage({id:`header_menu_${r[gt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:h}),o.order&&d.jsx("ul",{...v,children:o.order.map(B=>{if(!o[B])return null;const x={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[B].order?d.jsxs("li",{className:Y({[o[B].className]:o[B].className}),children:[s.formatMessage({id:`${h}_${B}`}),d.jsx("ul",{children:o[B].order.map(k=>d.jsx(ja,{id:`${e}.${B}.${k}`,...x},k))})]},B):d.jsx(ja,{id:`${e}.${B}`,...x},B)})})]},e)};const kx={height:67,height_desktop:83};var gt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(gt||{});const ko=({showNavigation:e=!0})=>{const t=ue.useIntl(),n=y.useContext(Lt),r=tr(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>$e.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(Ir,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:c}=s,h=y.useRef(s);y.useEffect(()=>{h.current=s},[s]),Ac({scrollPosition:kx[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const v=h.current.menus;!i&&v["site-navigation"]||$e.shouldChangeHeaderIsVisible(!0,v,o)},scrollDown:()=>{const v=h.current.menus;!i&&v["site-navigation"]||$e.shouldChangeHeaderIsVisible(!1,v,o)}}});const p=(v,E,B=!1)=>{$e.handleMenus({id:v,value:E,menus:h.current.menus,dispatch:o,forceHandle:B})},m=y.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(E=>{h.current.menus[E]&&p(E,!1,!0)})};y.useEffect(()=>{var v;return(v=document.getElementById("header"))==null||v.addEventListener("keydown",g),()=>{var E;(E=document.getElementById("header"))==null||E.removeEventListener("keydown",g)}},[]),Yn(()=>{u["site-navigation"]&&$e.autoFocus({menu:"site-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u["site-navigation"]]),Yn(()=>{u["account-navigation"]&&$e.autoFocus({menu:"account-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u["account-navigation"]]);const f=d.jsxs(d.Fragment,{children:[!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:d.jsx(Ie,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),d.jsx(Lf,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),D=d.jsxs(d.Fragment,{children:[!i.navigation&&d.jsx("button",{className:"menu-button gtm-trackable",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:d.jsx(Ie,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),d.jsx("ul",{ref:m,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Mr.order.map(v=>d.jsx(ja,{id:v,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},v))})]});return n&&n.isLoading?null:d.jsxs(d.Fragment,{children:[d.jsxs("nav",{id:"header",className:Y({"logged-in":a,"logged-out":!a,visible:l}),children:[d.jsx(Ie,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),d.jsx(Ys,{variant:"monochrome"}),e&&d.jsxs(d.Fragment,{children:[i.navigation?d.jsxs(d.Fragment,{children:[D,f]}):d.jsxs(d.Fragment,{children:[f,D]}),a?d.jsxs("button",{className:"account-button",onClick:v=>$e.events.onClick(v,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>$e.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>$e.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[d.jsx(Ie,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),d.jsx(Yt,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):d.jsx("ul",{className:"sign-in-buttons",children:Mr.buttons.order.map(v=>d.jsx(ja,{id:`buttons.${v}`},v))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:Y("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const _x=()=>{const e=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(ko,{}),d.jsx("div",{id:"content",children:d.jsx(un,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(Eo,{})]})},Wf=({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:p="default",modal:m="default"}=i,g=_c(),[f,D]=y.useState(""),v=T=>{const{detail:{message:S}}=T;D(S)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const E=fa(e,{locale:o}),B=fa(t,{locale:o}),x=fa(n,{locale:o}),k={};return c!=="default"&&(k[c]=!0),h!=="default"&&(k[h]=!0),p!=="default"&&(k[p]=!0),d.jsx(Th.ErrorBoundary,{onError:r,fallback:d.jsx(_x,{}),children:d.jsxs(y.Suspense,{fallback:null,children:[d.jsxs("div",{id:"wrapper",className:Y(s,k,{"has-footer":u}),children:[d.jsx(ko,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[B&&d.jsx("div",{className:Y("additional-content prepended",{"large-modal":m==="large"}),children:B}),y.createElement(c==="bold"?jo:"div",{id:"content",children:E,className:Y({"large-modal":m==="large"})})]}),x&&d.jsx("div",{className:"additional-content appended",children:x}),u&&d.jsx(Eo,{}),d.jsx(qf,{})]}),f&&d.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Ql={default:"tags_",headerTopics:"header_topics_topics_"},Ui={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"},Bx={getTagDetails:e=>{if(e.includes("topic_")){if(e=Ui.topic[e.replace("topic_","")],e){const t=Mr.topics.topics[e].href;return t?{id:e,href:t,text:`${Ql.headerTopics}${e}`}:null}return null}return Ui[e]?(e=Ui[e],{id:e,text:`${Ql.default}${e}`}):null}};const Fx=({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=Bx.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 Ax=({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(wn,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(gn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx($r,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})},Tx={showForm:!1},ri=y.createContext(Tx),Hf=({children:e})=>{const[t,n]=y.useState({showForm:!1});return d.jsx(ri.Provider,{value:{...t,updateConversation:n},children:e})},Jl=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Sx=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ue.useIntl();return t?d.jsx("small",{children:Bt(a.formatMessage,`${e}explainer`,n,"action",{a:i=>d.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):d.jsx(d.Fragment,{})},jx=({formID:e,intlPath:t,showLabel:n,type:r})=>{const a=ue.useIntl();return n?d.jsx("label",{htmlFor:`${e}-input`,className:"text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:a.formatMessage({id:`${t}label`})}):d.jsx(Ie,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:Bt(a.formatMessage,`${t}label_action`,r,"action")})};let ia=null;const Je="discussion_form_",zr=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r,placeholder:a,maxLength:i=0,buttons:s,forceShow:o={cancel:!1,error:!1},isCommunity:l=!1,functions:u,data:c={},gtmContext:h="DiscussionForm"})=>{var Fe,Ae,He;const p=ue.useIntl(),m=y.useContext(Lt),[g,f]=y.useState(""),{isLoading:D=!1,isInWrapper:v=!1,isInOverlay:E=!1,isAutoFocused:B=!1,isEditing:x=!1,hasTitleField:k=!1,isPrepopulated:T=!1,showTitle:S=!1,showGuidelines:q=!0,showDivider:N=!1,showSuccessMessage:I=!0}=r||{},{onChange:z=()=>{},create:w=()=>{},handleSaveEdit:F=()=>{},handleCancel:j=()=>{},callback:M=()=>{},onMention:V=()=>{},listMembers:G=()=>Promise.resolve([]),clickMentionFallback:J=()=>{},props:ae={create:{projectNames:["questions-answers"]}}}=u,[C,R]=y.useState({title:k&&k.text||"",body:x&&x.text||T&&T.text||""}),[W,_]=y.useState(o.error||!1),[A,L]=y.useState(!1);if(y.useEffect(()=>{l&&!x&&T&&T!==C.body&&R({...C,body:T.text||""})},[T]),D)return d.jsx(kt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const $=Se=>{R({...C,body:Se}),z({body:Se});let Te;!m||!m.id?Te=Bt(p.formatMessage,`${Je}error_loggedOut`,t.type,"action"):n?i>0&&Se.length>=i&&(Te=`${Je}error_tooLong`):Te=Bt(p.formatMessage,`${Je}error_noPermission`,t.type,"action"),Te?_(Te):W&&_(!1)};let U=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const Se=((Fe=t.slugs)==null?void 0:Fe.reply)||((Ae=t.slugs)==null?void 0:Ae.answer)||((He=t.slugs)==null?void 0:He.question)||"";Se&&(U=`${U}-${Se.slice(-15)}`)}e&&(U=`${e}-${U}`);const re=async()=>{if(!m||!m.id||!n||Q)return;ia&&clearTimeout(ia),L("submitting");const Se=window.location.pathname;try{let Te;switch(t.type){case"post":Te=await w({title:C.title,content:C.body});break;case"question":Te=await w({title:C.body,authorId:m&&m.id,...ae==null?void 0:ae.create});break;case"response":Te=await w({questionSlug:t.slugs.question},{body:C.body,authorId:m&&m.id,contentPath:Se});break;case"reply":Te=await w({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:C.body,authorId:m&&m.id,contentPath:Se});break;default:break}await zh(1e3),M&&await M(Te),ia=setTimeout(()=>{R({title:"",body:""}),L("submitted"),f(Bt(p.formatMessage,`${Je}success`,t.type,"action"));const Ne=new Event("discussionFormSubmitted");document.dispatchEvent(Ne),te()},500)}catch(Te){const Ne=Te;let ke=`${Je}error`;Ne!=null&&Ne.message.includes("entry already exists")&&(ke=Bt(p.formatMessage,`${Je}error_alreadyExists`,t.type,"action")),Ne!=null&&Ne.message.includes("429")?ke=Bt(p.formatMessage,`${Je}error_tooMany`,t.type,"action"):Ne!=null&&Ne.message.includes("400")&&(ke=`${Je}error`),_(ke),te()}},te=()=>{ia=setTimeout(()=>{_(!1),L(!1),f("")},5e3)},ne=!C.title||!Wo(C.title),le=!C.body||!Wo(C.body);let Q=le;k&&(Q=ne&&le);const pe=A==="submitting",he=[{component:jx,props:{formID:U,intlPath:Je,showLabel:k!==!1,type:t.type}},{component:Mf,props:{id:`${U}-input`,value:A==="submitting"&&!W?"":C.body,placeholder:a||Bt(p.formatMessage,`${Je}placeholder`,t.type,"action"),maxLength:i,meta:{isInOverlay:E},functions:{onChange:$,onMention:V,listMembers:G,clickMentionFallback:J},data:c,autoFocus:x!==!1||B&&!k,"aria-invalid":!!W,"aria-errormessage":"error-message"}},{component:Sx,props:{intlPath:Je,showGuidelines:q,type:t.type,gtmContext:h}}];N&&he.push({component:Kt}),k&&he.unshift({id:"title",type:"text",value:k.text,limit:250,autoFocus:B,label:p.formatMessage({id:`${Je}titleField_label`}),placeholder:p.formatMessage({id:`${Je}titleField_placeholder`}),functions:{onChange:Se=>{R({...C,title:Se}),z({title:Se})}},validation:[{condition:()=>Q,error:p.formatMessage({id:`${Je}titleField_error`})}]});let ye=!m||!m.id||!n||Q||pe;return x&&(k?ye=ye||C.body===x.text&&C.title===k.text:ye=ye||C.body===x.text),d.jsxs(d.Fragment,{children:[d.jsxs(ln,{id:U,className:Y("discussion-card discussion-form",{"no-styling":v&&x}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:x&&!pe||o.cancel},functions:{onSuccess:async()=>{if(x){L("submitting"),F(C);return}await re()},onCancel:j},fields:he,intlPath:Je,button:{variant:"primary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`${x?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:ye,overwriteSubmittingText:!0,text:!pe&&!x&&(s!=null&&s.submit)?s==null?void 0:s.submit:p.formatMessage({id:`${Je}${pe?x?"saving":"posting":x?"save":"post"}`})},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!o.cancel&&(!m||!m.id||!C.body),text:s!=null&&s.cancel?s==null?void 0:s.cancel:p.formatMessage({id:`${Je}cancel`})},gtm:{context:h,event:`${t.type}-form`},"data-testid":`discussion-${t.type}-form`,children:[S&&!x&&["question"].includes(t.type)&&d.jsx("h2",{children:Bt(p.formatMessage,`${Je}title`,t.type,"action")}),d.jsx(wn,{member:m?{...m,link:!1}:"community",gtmContext:h,gtmType:"profile-click"})]}),A==="submitted"&&I&&d.jsx(Fr,{className:"success","data-testid":"success",children:Bt(p.formatMessage,`${Je}success`,t.type,"action")}),W&&d.jsx(Fr,{id:"error-message",className:"error","data-testid":"error",children:o.error?o.error:typeof W=="string"?W.includes(" ")?W:p.formatMessage({id:W},{action:p.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):W}),g&&d.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:g})]})},Ox=Object.freeze(Object.defineProperty({__proto__:null,default:zr},Symbol.toStringTag,{value:"Module"})),Px=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Nx=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Oa=({icon:e,className:t="",...n})=>d.jsx(_e,{className:Y("discussion-button",t),variant:"tertiary",icon:e,...n});let kr=!1;const Vi=()=>{kr!==!1&&(clearTimeout(kr),kr=!1)},Ki=5;let Zi=null;const Uf=({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,p]=y.useReducer(Ir,c),{numberOfLikes:m,userLikedContent:g,ignoreInteractions:f,showLikers:D,tabbableLink:v}=h;y.useEffect(()=>{p([{type:"userLikedContent",value:a}])},[a]);const E=y.useMemo(()=>Nx(n,Ki),[n]),B=S=>{if(S.preventDefault(),S.stopPropagation(),p([{type:"showLikers",value:!1}]),kr)return Vi(),!1;if(Vi(),f||!s)return!1;kr=setTimeout(x,350)},x=async()=>{if(Vi(),f||!s)return!1;let S=g?m-1:m+1;S<0&&(S=0),p([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const q=Px(i.slugs);g?await l(q):await o({...q,payload:{contentPath:window.location.pathname}})}}catch{p([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{p([{type:"ignoreInteractions",value:!1}])}},k=()=>{Zi=setTimeout(()=>{p([{type:"showLikers",value:!1}])},500)},T=()=>{Zi&&clearTimeout(Zi)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&p([{type:"showLikers",value:!1}])},onMouseEnter:()=>{T(),p([{type:"showLikers",value:!0}])},onMouseLeave:()=>{k()}},d.jsxs(d.Fragment,{children:[d.jsx(Oa,{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:B,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:m})})}),n&&d.jsxs(d.Fragment,{children:[d.jsx(Ie,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{T()},onBlur:()=>k,onClick:S=>{var N;S.preventDefault(),S.stopPropagation(),T(),p([{type:"showLikers",value:!0}]);const q=(N=S.currentTarget.nextSibling)==null?void 0:N.childNodes[0];if(q){const I=q.querySelector("li:first-child a");I&&(p([{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(Ie,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),d.jsx(An,{id:`likes-tooltip-${i.slug}`,isOpen:D,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[E.map((S,q)=>{if(typeof S=="string"||!S.name)return null;const N={};return v!==q&&(N.tabIndex=-1),d.jsx("li",{"data-index":q,children:d.jsx(Tn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:I=>I==null?void 0:I.stopPropagation(),onFocus:()=>T(),onKeyDown:I=>{var M,V,G,J;if(!I||!["ArrowUp","ArrowDown"].includes(I.key||""))return;I.stopPropagation(),I.preventDefault();const z=I.key==="ArrowUp"?"up":"down",w=(M=I.currentTarget)==null?void 0:M.parentElement;let F=w==null?void 0:w.nextElementSibling;if(z==="up"){const ae=w==null?void 0:w.previousElementSibling;ae?F=ae:(F=(V=w==null?void 0:w.parentElement)==null?void 0:V.lastElementChild,(F==null?void 0:F.getAttribute("data-index"))==="-1"&&(F=F==null?void 0:F.previousElementSibling))}else(!F||(F==null?void 0:F.getAttribute("data-index"))==="-1")&&(F=(G=w==null?void 0:w.parentElement)==null?void 0:G.firstElementChild);if(!F)return;const j=(F==null?void 0:F.getAttribute("data-index"))||"0";p([{type:"tabbableLink",value:j}]),(J=F==null?void 0:F.querySelector("a"))==null||J.focus()},...N,children:S.name})},S.id||window.btoa(S.name))}),t>Ki&&d.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Ki})})]})})]})]}))},Yi=({children:e,class:t,...n})=>{const r={...n,class:Y("subtle",t)};return d.jsx("blockquote",{...r,children:e})},Rx=280,_o=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Zn(e,typeof t=="number"?t:Rx):e;a=a.trim();const i=`<br>
139
139
 
140
- `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await qc({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const $x=3e3,Lx=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ue.useIntl(),[r,a]=D.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{children:[c.jsx(An,{className:Y("tooltip-share-link",{"tooltip-share-link-copied":r.isCopied}),isOpen:r.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:r.isCopied?n.formatMessage({id:"discussion_share_copy_link_success"}):n.formatMessage({id:"discussion_share_copy_link"})}),c.jsx(Na,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>a({...r,isOpen:!0}),onFocus:()=>a({...r,isOpen:!0}),onMouseOut:()=>a({isOpen:!1,isCopied:!1}),onBlur:()=>a({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{a({isOpen:!0,isCopied:!0}),setTimeout(()=>{a({isOpen:!1,isCopied:!1})},$x)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event})]})},Ht="discussion_",zx=195;let oa=null;const qr=({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:d,isTruncated:f=!1,styling:{showShareLinkButton:p=!1}={},setFocus:m=!1,isCommunity:g=!1})=>{var Fe,Ae,He,Se,Te,Ne,ke,Ue;const h=ue.useIntl(),y=D.useContext(Lt),v=D.useContext(ii),{createContent:w=async()=>{},deleteContent:_=async()=>{},updateContent:x=async()=>{}}=s.content||{},{createLike:k=()=>{},deleteLike:T=()=>{}}=s.likes||{},{openComments:S=()=>{}}=s.comments||{},{listMembers:q=()=>Promise.resolve([]),clickMentionFallback:N=()=>{}}=s.mentions||{},{author:I,canLike:z,createdAt:E,id:F,likes:j=0,userLiked:M,comments:V=0,mentions:G}=t,J=y&&y.id&&typeof I!="string"&&I.id&&I.id===y.id||!1,ae=typeof z=="boolean"?z:!0,C=J&&(!t.createdAt||zh(t.createdAt,10,"seconds")),R=D.useRef(null),[W,B]=D.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[A,L]=D.useState(!1),[$,U]=D.useState(C?"highlighted":"default"),[re,te]=D.useState("");D.useEffect(()=>{const ge=R.current;if(!(!ge||$==="default"))return document.addEventListener("discussionFormSubmitted",ne),ge.addEventListener("transitionend",le),()=>{document.removeEventListener("discussionFormSubmitted",ne),ge.removeEventListener("transitionend",le)}},[]),D.useEffect(()=>{B({...W,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),D.useEffect(()=>{(async()=>{const H=await Fo(W.body,f,G,q);B({...W,postBody:H})})()},[W.body,G]);const ne=()=>{setTimeout(()=>{U("fading")},1e3)},le=({propertyName:ge})=>{ge==="background-color"&&U(H=>(H==="default"&&(document.removeEventListener("discussionFormSubmitted",ne),R.current&&R.current.removeEventListener("transitionend",le)),H==="fading"?"default":H))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||W.postBody===""&&t.title==="")return c.jsx(kt,{className:"discussion-card"});const Q=async({title:ge,body:H})=>{ge||(ge=""),H||(H=""),te("");try{if(!os(ge,W.title)||!os(H,W.body)){const ie=t.type==="question"?{title:H}:{title:ge,body:H};await x(ec(t.slugs),ie)}B({...W,title:ge,body:H,isEditing:!1,didEdit:!0})}catch{te(`${Ht}form_error`)}},pe=()=>{if(v&&v.updateConversation){const ge={showForm:!0},H=t.author;H&&H.id&&(g&&(ge.prepopulateForm=`@{{${H.id}}}`),ge.mentionData={id:H.id,name:H.name}),v.updateConversation(ge)}setTimeout(()=>{var ve,we,Ke;const H=`reply-form-${(t.type==="answer"?t.slug:((ve=t.slugs)==null?void 0:ve.reply)||((we=t.slugs)==null?void 0:we.answer)||((Ke=t.slugs)==null?void 0:Ke.question)||"").toLowerCase().slice(-15)}`,ie=document.getElementById(H),me=document.getElementById(`${H}-input`);me&&me.focus(),ie&&ie.scrollIntoView({behavior:"smooth"})},0)},he=async()=>{L(!1);try{await _(ec(t.slugs))}catch{te("delete-error")}},ye=[{text:h.formatMessage({id:`${Ht}moreMenu_report`}),onClick:ge=>{ge.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(h.formatMessage({id:`${Ht}report_subject`}))}&body=${encodeURI(h.formatMessage({id:`${Ht}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&&J&&ye.push({text:h.formatMessage({id:`${Ht}moreMenu_edit`}),onClick:()=>B({...W,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`edit-${t.type}-click`},{text:h.formatMessage({id:`${Ht}moreMenu_delete`}),onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),L(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`delete-${t.type}-click`,...gh(`delete-${t.slug}-modal`,A)}),m&&((Fe=R==null?void 0:R.current)==null||Fe.focus(),(Ae=R==null?void 0:R.current)==null||Ae.scrollIntoView({behavior:"smooth"})),D.createElement(e,{className:Y("discussion-post",l,{[$]:!l||!l.includes("highlighted-text-box"),"has-link":o.post&&!W.isEditing}),ref:R,tabIndex:m?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${u}-post-click`,onClick:ge=>{if(!o.post||W.isEditing)return;ge.preventDefault(),ge.stopPropagation(),oa&&clearTimeout(oa),oa=setTimeout(()=>{window.location.href=o.post},150);const H=new CustomEvent("discussionPostClicked",{detail:{link:o.post,timeout:oa}});document.dispatchEvent(H)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:F||t.slug,className:Y("discussion-card",t.type,{editing:W.isEditing,"has-link":o.post&&!W.isEditing}),children:[!W.isEditing&&c.jsx(wn,{member:I,additionalContent:{createdAt:E,didEdit:W.didEdit},className:typeof I!="string"&&I.id===a?"highlighted":"",gtmContext:u,gtmType:"profile-click"}),W.isEditing?c.jsx(zr,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,hasTitleField:W.title!==""?{text:W.title}:!1,isEditing:{text:W.body},isPrepopulated:!1},isCommunity:g,maxLength:t.type==="question"?250:5e4,forceShow:{error:re!==""&&re!=="delete-error"?h.formatMessage({id:re},{action:h.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:w,handleSaveEdit:Q,handleCancel:()=>{te(""),B({...W,isEditing:!1})},listMembers:q,clickMentionFallback:N},gtmContext:`${u}Form`,data:{mentions:t.mentions}}):o.post?c.jsxs("a",{href:o.post,children:[(W==null?void 0:W.title)&&c.jsx("p",{className:"content-title",children:W==null?void 0:W.title}),W.postBody.length>zx?c.jsx(Zc,{text:W.postBody,markdownOptions:{overrides:{a:hs,blockquote:{component:Qi}}}}):c.jsx(xn,{options:{overrides:{a:hs,blockquote:{component:Qi}}},children:W.postBody})]}):c.jsxs(c.Fragment,{children:[(W==null?void 0:W.title)&&c.jsx("p",{className:"content-title",children:W==null?void 0:W.title}),c.jsx(xn,{options:{wrapper:t.type==="question"?"h1":D.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:Qi}}},children:W.postBody})]}),!W.isEditing&&!(i!=null&&i.actionBar)&&c.jsxs("ul",{className:Y("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!i.likes&&c.jsx(Kf,{element:"li",likes:j,isShort:!1,userLiked:M,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:ae,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:k,deleteLike:T}}),!i.comments&&(["question","post"].includes(t.type)||o.comments)&&c.jsx("li",{children:c.jsx(Na,{onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),o.comments&&(window.location.href=o.comments),typeof S=="function"&&S()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":u,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:h.formatMessage({id:`${Ht}comments_screenReader`},{count:V}),children:h.formatMessage({id:`${Ht}comments`},{count:V})})}),(t.type==="answer"||t.type==="reply")&&c.jsx("li",{children:c.jsx(Na,{styling:{muted:!0},onClick:pe,icon:{icon:"speech-bubble_square"},children:h.formatMessage({id:`${Ht}reply`})})}),p&&c.jsx(Lx,{url:(He=t.slugs)!=null&&He.reply?`${window.location.origin}${(Se=t.slugs)==null?void 0:Se.question}/${(Te=t.slugs)==null?void 0:Te.answer}#${(Ne=t.slugs)==null?void 0:Ne.reply}`:`${window.location.origin}${(ke=t.slugs)==null?void 0:ke.question}/${(Ue=t.slugs)==null?void 0:Ue.answer}`,gtm:{context:u,event:`copy-link-${t.type}-click`}}),c.jsx(id,{element:"li",id:`more-${t.slug}`,options:ye})]})]}),d,c.jsx(jn,{id:`delete-${t.slug}-modal`,isOpen:A,functions:{onOpen:()=>{},onClose:()=>L(!1)},forceShow:{error:re==="delete-error"?h.formatMessage({id:"discussion_delete_error"},{action:h.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:h.formatMessage({id:"discussion_delete_title"},{action:h.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>L(!1),children:h.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:he,children:h.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:c.jsx(ue.FormattedMessage,{id:"discussion_delete_text",values:{p:ge=>c.jsx("p",{children:ge}),action:h.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const qx=D.lazy(()=>Promise.resolve().then(()=>BE)),Wx=65,Zf=({forceShow:e,form:t,className:n})=>{const r=ue.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=D.useContext(Lt)||"community",l=Ya(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,f]=D.useState({form:u||Qh("showPost")==="true"||!1,warning:!1}),[p,m]=D.useState({showCachedText:!1});D.useEffect(()=>{if(!p.showCachedText)return;(async()=>{const w=await Fo(p.title||p.body||"",Wx,p.mentions);m(_=>({..._,prettifiedText:w}))})()},[p.showCachedText,p.title,p.body]);const g=v=>{if(!p.showCachedText||typeof d.warning=="string")return;let w;if("detail"in v&&v.detail.link)v.detail.timeout&&clearTimeout(v.detail.timeout),w=v.detail.link;else{const _=v;_.preventDefault(),_.stopPropagation();const k=_.target.closest("a");w=k&&k.getAttribute("href")}f(_=>({..._,warning:w||!1}))},h=v=>{p.showCachedText&&(v.preventDefault(),v.returnValue=!0)};D.useEffect(()=>{if(document.addEventListener("discussionPostClicked",g),document.addEventListener("memberClicked",g),window.addEventListener("beforeunload",h),!p.showCachedText){document.removeEventListener("click",g);return}return document.addEventListener("click",g),()=>{document.removeEventListener("discussionPostClicked",g),document.removeEventListener("memberClicked",g),window.removeEventListener("beforeunload",h),document.removeEventListener("click",g)}},[p.showCachedText]);let y=r.formatMessage({id:`${a}placeholder`});return p.showCachedText&&(p.title||p.body)&&(y=p.prettifiedText||y),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:Y("discussion-form-card",n),onClick:v=>{v.preventDefault(),v.stopPropagation(),f(w=>({...w,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(Yt,{name:l.name,src:l.image,alt:""}),c.jsx(xn,{className:Y("input",{placeholder:!p.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:Ct,blockquote:Ct,br:Ct,em:Ct,li:Ct,ol:Ct,p:Ct,s:Ct,span:Ct,strong:Ct,ul:Ct}},children:y})]}),c.jsxs(Ka,{children:[c.jsx(qx,{showModal:d.form,functions:{cacheText:m,onClose:()=>{f(v=>({...v,form:!1}))}},form:t,cachedText:p,className:"in-portal"}),c.jsx(jn,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{f(v=>({...v,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:v=>{if(v.preventDefault(),v.stopPropagation(),typeof d.warning=="string"){window.location.href=d.warning;return}f(w=>({...w,warning:!1}))},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{f(v=>({...v,warning:!1}))},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":i}],children:c.jsx("p",{children:r.formatMessage({id:`${a}overlay_text`})})})]})]})},Hx=D.lazy(()=>Promise.resolve().then(()=>Nx)),Ao=({isCard:e=!1,form:t,membershipRequiredToPost:{isMember:n,required:r,join:a,leave:i,notMemberStateText:s}})=>{if(r&&!n)return c.jsx(un,{text:s,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(Gs,{isShort:!0,functions:{join:a,leave:i}})}});const{content:o,functions:l,meta:u,...d}=t,f={content:{type:(o==null?void 0:o.type)||"reply",slugs:(o==null?void 0:o.slugs)||{}},functions:{...l,create:(l==null?void 0:l.create)||(()=>{})},meta:{...u,isEditing:(u==null?void 0:u.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1},...d,id:`add-post-${d.id||""}`};return e?c.jsx(Zf,{form:f}):c.jsx(Hx,{...f})};const Ji="discussion_responses_",Yf=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ue.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${Ji}title`},{action:r.formatMessage({id:`${Ji}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:Bt(r.formatMessage,`${Ji}empty`,e,e)})]})};const Gf=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ue.useIntl(),s=D.useContext(ii),o=ma(a,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:Y("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx($r,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx(zr,{...r})]})},Ux="post",Vx="reply",Qf="00000000-0000-0000-0000-000000000000";function To({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function So({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 Kx(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Zx(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Jf(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 Yx({title:e,content:t}){return{title:e,content:t,id:Qf,time:new Date().toISOString(),verb:Ux}}function tc({activity:e,user:t}){return{...e,actor:Jf(t),...Kx()}}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 Xf({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 Gx({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Qf,kind:Vx,parent:t||""}}function nc({reply:e,user:t}){const n=Jf(t);return{...e,user_id:n.id,user:n,...Zx()}}function rc({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 Qx({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}const eh=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let ac,Xi=0;const th=()=>{D.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(ac);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),Xi=0;return}Xi++,!(Xi>10)&&(ac=setTimeout(()=>{e(t)},50))}},er=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}),on=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}),nh=Object.freeze({actor:`SU:${er.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"}),Jx=Object.freeze({actor:`SU:${on.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"}),Xx=Object.freeze({actor:`SU:${er.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"}),ew=Object.freeze({actor:`SU:${on.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:nh.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:on.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:on.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:on.id,user:{id:on.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:nh.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:er.id,user:{id:er.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Jx.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:on.id,user:{id:on.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Xx.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:er.id,user:{id:er.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:ew.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function tw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ye.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=tc({activity:Yx(o),user:i});return ic(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=tc({activity:o,user:i});r.setQueryData(a,ic(d,u,!0)),setTimeout(()=>{eh(d.id)},0)}});return s}function nw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ye.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 rw({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s,rankingMethod:o}){const l=Ye.useQueryClient(),u=Ga(),d={queryClient:l,queryKey:s},f={mutationHandlers:{error:To(d),mutate:So(d)},user:u,...d},p=tw({...f,mutationFn:e}),m=nw({...f,mutationFn:t}),g=aw({...f,mutationFn:n}),h=sw({...f,mutationFn:a}),y=ow({...f,mutationFn:i}),{activities:v,...w}=iw({queryKey:s,queryFn:r,rankingMethod:o});return{activities:v,mutations:{create:p,edit:m,remove:h,like:g,unlike:y},user:u,...w}}function aw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ye.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 iw({queryFn:e,queryKey:t,rankingMethod:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=Ye.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`ranking=${n}`,getNextPageParam:l=>`${l==null?void 0:l.next}&ranking=${n}`||null});return{activities:lw(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function sw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ye.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>uw(a,i)),onError:n});return r}function ow({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ye.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Ma(i,s);return o&&Xf({activity:o,user:r}),s}),onError:n});return a}function ic(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 uw(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 lw(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const cw=({basePath:e,parentId:t,isMember:n,functions:{activities:r,mentions:a,join:i,leave:s}})=>{const o=xm(Ks.COMMUNITY_RANKING),l=ue.useIntl(),[u,d]=D.useState("recent"),[f,p]=D.useState([{id:"recent",label:"recent"},{id:"community_feed_live",label:"popular"}]),{activities:m,error:g,fetchNextPage:h,hasNextPage:y,isLoading:v,mutations:{create:w,edit:_,remove:x,like:k,unlike:T}}=rw({queryKey:[e,t,"activities",u],queryFns:r,rankingMethod:u});D.useEffect(()=>{o&&p(f.concat(o))},[o]);const[S,q]=D.useState(null),N=()=>{q(m.length),h()};return th(),g?c.jsx(un,{variant:"error",text:g.message}):c.jsxs("section",{children:[c.jsx(Ao,{isCard:!0,form:{content:{type:"post",slugs:{}},functions:{create:w,...a},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:i,leave:s,notMemberStateText:l.formatMessage({id:"community_joinToPost"})}}),c.jsx(ln,{className:"activities-feed-sorting-form",fields:[{id:"feed-sorting",label:l.formatMessage({id:"activitiesFeed_sorting_label"}),type:"select",options:f.map(({id:I,label:z})=>({id:I,label:l.formatMessage({id:`activitiesFeed_rankingMethod_${z}`})})),initialValue:u,functions:{onChange:I=>d(I)}}],button:{hideButton:!0},functions:{onCatch:()=>{},onFailure:()=>{},onSuccess:async()=>{},onCancel:()=>{}},id:"activities-feed-sorting-form"}),m==null?void 0:m.map((I,z)=>{var W,B,A,L,$,U,re,te;const{id:E,own_reactions:F,latest_reactions:j,reaction_counts:M,mentioned_users:V}=I,G=(((W=j==null?void 0:j.like)==null?void 0:W.length)||0)>0,J=(((B=F==null?void 0:F.like)==null?void 0:B.length)||0)>0,ae=J?F==null?void 0:F.like[0].id:"",C=G?(A=j==null?void 0:j.like)==null?void 0:A.map(ne=>{var le,Q,pe;return{id:(le=ne==null?void 0:ne.user)==null?void 0:le.id,name:(pe=(Q=ne==null?void 0:ne.user)==null?void 0:Q.data)==null?void 0:pe.name}}):!1,R=I==null?void 0:I.actor;return c.jsx(D.Fragment,{children:c.jsx(qr,{content:{type:"post",title:I==null?void 0:I.title,body:I==null?void 0:I.content,canLike:n,createdAt:(I==null?void 0:I.time)||"",slugs:{question:`${e}/${t}`,answer:E},slug:E,author:{id:R==null?void 0:R.id,name:(L=R==null?void 0:R.data)==null?void 0:L.name,organization:($=R==null?void 0:R.data)==null?void 0:$.organization,jobTitle:(U=R==null?void 0:R.data)==null?void 0:U.jobTitle,location:(re=R==null?void 0:R.data)==null?void 0:re.location,image:{thumbnail:((te=R==null?void 0:R.data)==null?void 0:te.thumbnail)||void 0}},userLiked:J,likes:(M==null?void 0:M.like)||0,comments:(M==null?void 0:M.reply)||0,peopleWhoLiked:C,mentions:V},links:{post:`${e}/${t}/${E}`,comments:`${e}/${t}/${E}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>x({activityId:E}),updateContent:(ne,{body:le})=>_({activityId:E,content:le})},likes:{createLike:()=>k({activityId:E}),deleteLike:()=>T({activityId:E,reactionId:ae})},comments:{openComments:()=>null},mentions:a},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:z===S})},E)}),!v&&c.jsx($r,{hasNextPage:y,loadNextPage:N,icon:{icon:"arrow-down",position:"right"},messages:{button:l.formatMessage({id:"loadMore_button"}),error:l.formatMessage({id:"loadMore_error"})}})]})},dw={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 fw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ye.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=nc({reply:Gx(o),user:i});return sc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=nc({reply:o,user:i});r.setQueryData(a,sc(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{eh(d.id)},0)}});return s}function hw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ye.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 rh({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ye.useQueryClient(),l=Ga(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:To(u),mutate:So(u)},user:l,...u},f=fw({...d,mutationFn:e}),p=hw({...d,mutationFn:t}),m=mw({...d,mutationFn:n}),g=gw({...d,mutationFn:a}),h=vw({...d,mutationFn:i}),{replies:y,...v}=pw({queryKey:s,queryFn:r});return{replies:y,mutations:{create:f,edit:p,remove:g,like:m,unlike:h},user:l,...v}}function mw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ye.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Ia(s,o);return l&&rc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ia(o,l);u&&rc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function pw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ye.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=xw(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function gw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ye.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Cw(a,i)),onError:n});return r}function vw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ye.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ia(i,s);return o&&Qx({reply:o,user:r}),s}),onError:n});return a}function bw(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function yw(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 Dw(e,t,n){return n!=null&&n.replace?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t}function sc(e,t,n){return t?n!=null&&n.append?yw(e,t,n):Dw(e,t,n):bw(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 Cw(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 xw(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 ww=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=ue.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:d,isLoading:f,mutations:{create:p,edit:m,like:g,remove:h,unlike:y},user:v}=rh({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:x=>i.list({...x,reactionId:r})}});zs([f]);const[w,_]=D.useState(!0);return c.jsxs(c.Fragment,{children:[(l==null?void 0:l.length)>=o&&c.jsx(_e,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${w?"up_left":"down_right"}`,position:"left"},onClick:()=>_(!w),children:s.formatMessage({id:`discussion_thread_${w?"hide":"show"}`},{count:l==null?void 0:l.length})}),w&&c.jsx(Gf,{loadMore:{isLoading:f,hasNextPage:d,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(x,{body:k})=>p({activityId:n,replyId:r,content:k}),listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(x=>{var J,ae,C,R,W,B,A,L,$,U,re,te;const{id:k,own_children:T,latest_children:S,children_counts:q,data:{mentioned_users:N}}=x,z=(((J=T==null?void 0:T.like)==null?void 0:J.length)||0)>0?(ae=T==null?void 0:T.like)==null?void 0:ae.find(ne=>{var le;return((le=ne==null?void 0:ne.user)==null?void 0:le.id)===(v==null?void 0:v.id)}):!1,E=z?z==null?void 0:z.id:"",F=!!z,M=(((C=S==null?void 0:S.like)==null?void 0:C.length)||0)>0?(R=S==null?void 0:S.like)==null?void 0:R.map(ne=>{var le,Q,pe;return{id:(le=ne==null?void 0:ne.user)==null?void 0:le.id,name:(pe=(Q=ne==null?void 0:ne.user)==null?void 0:Q.data)==null?void 0:pe.name}}):!1,V=x==null?void 0:x.user,G=typeof x.data.content=="string"?(W=x==null?void 0:x.data)==null?void 0:W.content:((A=(B=x==null?void 0:x.data)==null?void 0:B.content)==null?void 0:A.text)||"";return c.jsx(qr,{isCommunity:!0,content:{id:k,type:"reply",body:G,canLike:a,createdAt:x==null?void 0:x.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:x==null?void 0:x.parent},slug:"",author:{id:V==null?void 0:V.id,name:(L=V.data)==null?void 0:L.name,organization:($=V.data)==null?void 0:$.organization,jobTitle:(U=V.data)==null?void 0:U.jobTitle,location:(re=V.data)==null?void 0:re.location,image:{thumbnail:((te=V.data)==null?void 0:te.thumbnail)||void 0}},userLiked:F,likes:(q==null?void 0:q.like)||0,peopleWhoLiked:M,mentions:N},functions:{content:{createContent:()=>null,deleteContent:()=>h({replyId:k}),updateContent:(ne,{body:le})=>m({replyId:k,content:le})},likes:{createLike:()=>g({replyId:k}),deleteLike:()=>y({replyId:k,reactionId:E})},comments:{},mentions:{listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback}},styling:{showShareLinkButton:!0}},k)}):null})]})};const ah=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,mentions:i,join:s,leave:o}})=>{const l=ue.useIntl(),{replies:u,repliesCount:d,fetchNextPage:f,hasNextPage:p,isLoading:m,mutations:{create:g,edit:h,like:y,remove:v,unlike:w},user:_}=rh({queryKey:[e,t,n,"replies"],queryFns:a}),x=()=>{T(u.length),f()},[k,T]=D.useState(null);return zs([m]),th(),c.jsxs("section",{className:"replies-feed",children:[c.jsx(Yf,{type:"comment",responses:d,isLoading:m}),c.jsx(Ao,{form:{content:{type:"reply",slugs:{}},functions:{create:(S,{body:q})=>g({activityId:n,content:q}),...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!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,q)=>{var W,B,A,L,$,U,re,te,ne,le,Q,pe;const{id:N,own_children:I,latest_children:z,children_counts:E,data:{mentioned_users:F}}=S,M=(((W=I==null?void 0:I.like)==null?void 0:W.length)||0)>0?(B=I==null?void 0:I.like)==null?void 0:B.find(he=>{var ye;return((ye=he==null?void 0:he.user)==null?void 0:ye.id)===(_==null?void 0:_.id)}):!1,V=M?M==null?void 0:M.id:"",G=!!M,ae=(((A=z==null?void 0:z.like)==null?void 0:A.length)||0)>0?(L=z==null?void 0:z.like)==null?void 0:L.map(he=>{var ye,Fe,Ae;return{id:(ye=he==null?void 0:he.user)==null?void 0:ye.id,name:(Ae=(Fe=he==null?void 0:he.user)==null?void 0:Fe.data)==null?void 0:Ae.name}}):!1,C=S==null?void 0:S.user,R=typeof S.data.content=="string"?($=S==null?void 0:S.data)==null?void 0:$.content:((re=(U=S==null?void 0:S.data)==null?void 0:U.content)==null?void 0:re.text)||"";return c.jsx(Vf,{children:c.jsx(qr,{isCommunity:!0,content:{id:N,type:"reply",body:R,canLike:r,createdAt:S==null?void 0:S.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:N},slug:N,author:{id:C==null?void 0:C.id,name:(te=C.data)==null?void 0:te.name,organization:(ne=C.data)==null?void 0:ne.organization,jobTitle:(le=C.data)==null?void 0:le.jobTitle,location:(Q=C.data)==null?void 0:Q.location,image:{thumbnail:((pe=C.data)==null?void 0:pe.thumbnail)||void 0}},userLiked:G,likes:(E==null?void 0:E.like)||0,peopleWhoLiked:ae,mentions:F},functions:{content:{createContent:()=>null,deleteContent:()=>v({replyId:N}),updateContent:(he,{body:ye})=>h({replyId:N,content:ye})},likes:{createLike:()=>y({replyId:N}),deleteLike:()=>w({replyId:N,reactionId:V})},comments:{},mentions:i},children:c.jsx(ww,{basePath:e,parentId:t,activityId:n,replyId:N,isMember:r,functions:{...a,...i}}),styling:{showShareLinkButton:!0},setFocus:q===k},N)},N)}),!m&&c.jsx($r,{hasNextPage:p,loadNextPage:x,icon:{icon:"arrow-down",position:"right"},messages:{button:l.formatMessage({id:"loadMore_button"}),error:l.formatMessage({id:"loadMore_error"})}})]})};function Ew({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ye.useMutation({mutationFn:e,onMutate:({content:a,title:i})=>t(s=>(s&&(a!=null&&(s.content=a),i!=null&&(s.title=i)),s)),onError:n});return r}function kw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=Ye.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function _w({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=Ye.useQueryClient(),s=Ga(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:To(o),mutate:So(o)},user:s,...o},u=Ew({...l,mutationFn:t}),d=Bw({...l,mutationFn:n}),f=Fw({...l,mutationFn:r}),{activity:p,...m}=kw({queryKey:a,queryFn:e});return{activity:p,mutations:{edit:u,like:d,unlike:f},user:s,...m}}function Bw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ye.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 Fw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ye.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Xf({activity:s,user:r}),s)),onError:n});return a}const Aw=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,mentions:o,join:l,leave:u}})=>{var N,I,z,E,F,j,M,V,G,J;const d=ue.useIntl(),{activity:f,error:p,isLoading:m,mutations:{edit:g,like:h,unlike:y}}=_w({queryFns:i,queryKey:[e,t,n]});if(m)return c.jsx(kt,{style:{height:"400px"}});if(p||!f)return c.jsx(un,{variant:"error",text:d.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:v,latest_reactions:w,mentioned_users:_}=f,x=(((N=w==null?void 0:w.like)==null?void 0:N.length)||0)>0,k=(((I=v==null?void 0:v.like)==null?void 0:I.length)||0)>0,T=k?v==null?void 0:v.like[0].id:"",S=x?(z=w==null?void 0:w.like)==null?void 0:z.map(ae=>{var C,R,W;return{id:(C=ae==null?void 0:ae.user)==null?void 0:C.id,name:(W=(R=ae==null?void 0:ae.user)==null?void 0:R.data)==null?void 0:W.name}}):!1,q=f==null?void 0:f.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(qr,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:f==null?void 0:f.title,body:f==null?void 0:f.content,canLike:r,createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:{id:q.id,name:(E=q.data)==null?void 0:E.name,organization:(F=q.data)==null?void 0:F.organization,jobTitle:(j=q.data)==null?void 0:j.jobTitle,location:(M=q.data)==null?void 0:M.location,image:{thumbnail:((V=q.data)==null?void 0:V.thumbnail)||void 0}},userLiked:k,likes:((G=f==null?void 0:f.reaction_counts)==null?void 0:G.like)||0,comments:((J=f==null?void 0:f.reaction_counts)==null?void 0:J.reply)||0,peopleWhoLiked:S,mentions:_},originalAuthorId:q==null?void 0:q.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(ae,{title:C,body:R})=>g({title:C,content:R})},likes:{createLike:()=>h({activityId:n}),deleteLike:()=>y({activityId:n,reactionId:T})},comments:{openComments:()=>{}},mentions:o},styling:{showShareLinkButton:!0}},n),c.jsx(ah,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,mentions:o,join:l,leave:u}})]})};var Ms={exports:{}},ua={exports:{}},Re={};/** @license React v16.13.1
140
+ `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await Lc({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const Mx=3e3,Ix=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ue.useIntl(),[r,a]=y.useState({isOpen:!1,isCopied:!1});return d.jsxs("li",{children:[d.jsx(An,{className:Y("tooltip-share-link",{"tooltip-share-link-copied":r.isCopied}),isOpen:r.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:r.isCopied?n.formatMessage({id:"discussion_share_copy_link_success"}):n.formatMessage({id:"discussion_share_copy_link"})}),d.jsx(Oa,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>a({...r,isOpen:!0}),onFocus:()=>a({...r,isOpen:!0}),onMouseOut:()=>a({isOpen:!1,isCopied:!1}),onBlur:()=>a({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{a({isOpen:!0,isCopied:!0}),setTimeout(()=>{a({isOpen:!1,isCopied:!1})},Mx)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event})]})},Ht="discussion_",$x=195,qr=({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:p=!1}={},setFocus:m=!1,isCommunity:g=!1})=>{var Fe,Ae,He,Se,Te,Ne,ke,Ue;const f=ue.useIntl(),D=y.useContext(Lt),v=y.useContext(ri),{createContent:E=async()=>{},deleteContent:B=async()=>{},updateContent:x=async()=>{}}=s.content||{},{createLike:k=()=>{},deleteLike:T=()=>{}}=s.likes||{},{openComments:S=()=>{}}=s.comments||{},{listMembers:q=()=>Promise.resolve([]),clickMentionFallback:N=()=>{}}=s.mentions||{},{author:I,canLike:z,createdAt:w,id:F,likes:j=0,userLiked:M,comments:V=0,mentions:G}=t,J=D&&D.id&&typeof I!="string"&&I.id&&I.id===D.id||!1,ae=typeof z=="boolean"?z:!0,C=J&&(!t.createdAt||$h(t.createdAt,10,"seconds")),R=y.useRef(null),[W,_]=y.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[A,L]=y.useState(!1),[$,U]=y.useState(C?"highlighted":"default"),[re,te]=y.useState("");y.useEffect(()=>{const ge=R.current;if(!(!ge||$==="default"))return document.addEventListener("discussionFormSubmitted",ne),ge.addEventListener("transitionend",le),()=>{document.removeEventListener("discussionFormSubmitted",ne),ge.removeEventListener("transitionend",le)}},[]),y.useEffect(()=>{_({...W,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),y.useEffect(()=>{(async()=>{const H=await _o(W.body,h,G,q);_({...W,postBody:H})})()},[W.body,G]);const ne=()=>{setTimeout(()=>{U("fading")},1e3)},le=({propertyName:ge})=>{ge==="background-color"&&U(H=>(H==="default"&&(document.removeEventListener("discussionFormSubmitted",ne),R.current&&R.current.removeEventListener("transitionend",le)),H==="fading"?"default":H))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||W.postBody===""&&t.title==="")return d.jsx(kt,{className:"discussion-card"});const Q=async({title:ge,body:H})=>{ge||(ge=""),H||(H=""),te("");try{if(!is(ge,W.title)||!is(H,W.body)){const ie=t.type==="question"?{title:H}:{title:ge,body:H};await x(Jl(t.slugs),ie)}_({...W,title:ge,body:H,isEditing:!1,didEdit:!0})}catch{te(`${Ht}form_error`)}},pe=()=>{if(v&&v.updateConversation){const ge={showForm:!0},H=t.author;H&&H.id&&(g&&(ge.prepopulateForm=`@{{${H.id}}}`),ge.mentionData={id:H.id,name:H.name}),v.updateConversation(ge)}setTimeout(()=>{var ve,we,Ke;const H=`reply-form-${(t.type==="answer"?t.slug:((ve=t.slugs)==null?void 0:ve.reply)||((we=t.slugs)==null?void 0:we.answer)||((Ke=t.slugs)==null?void 0:Ke.question)||"").toLowerCase().slice(-15)}`,ie=document.getElementById(H),me=document.getElementById(`${H}-input`);me&&me.focus(),ie&&ie.scrollIntoView({behavior:"smooth"})},0)},he=async()=>{L(!1);try{await B(Jl(t.slugs))}catch{te("delete-error")}},ye=[{text:f.formatMessage({id:`${Ht}moreMenu_report`}),onClick:ge=>{ge.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(f.formatMessage({id:`${Ht}report_subject`}))}&body=${encodeURI(f.formatMessage({id:`${Ht}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&&J&&ye.push({text:f.formatMessage({id:`${Ht}moreMenu_edit`}),onClick:()=>_({...W,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`edit-${t.type}-click`},{text:f.formatMessage({id:`${Ht}moreMenu_delete`}),onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),L(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`delete-${t.type}-click`,...mh(`delete-${t.slug}-modal`,A)}),m&&((Fe=R==null?void 0:R.current)==null||Fe.focus(),(Ae=R==null?void 0:R.current)==null||Ae.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:Y("discussion-post",l,{[$]:!l||!l.includes("highlighted-text-box"),"has-link":o.post&&!W.isEditing}),ref:R,tabIndex:m?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${u}-post-click`,onClick:ge=>{!o.post||W.isEditing||(ge.preventDefault(),ge.stopPropagation(),window.location.href=o.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:F||t.slug,className:Y("discussion-card",t.type,{editing:W.isEditing,"has-link":o.post&&!W.isEditing}),children:[!W.isEditing&&d.jsx(wn,{member:I,additionalContent:{createdAt:w,didEdit:W.didEdit},className:typeof I!="string"&&I.id===a?"highlighted":"",gtmContext:u,gtmType:"profile-click"}),W.isEditing?d.jsx(zr,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,hasTitleField:W.title!==""?{text:W.title}:!1,isEditing:{text:W.body},isPrepopulated:!1},isCommunity:g,maxLength:t.type==="question"?250:5e4,forceShow:{error:re!==""&&re!=="delete-error"?f.formatMessage({id:re},{action:f.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:E,handleSaveEdit:Q,handleCancel:()=>{te(""),_({...W,isEditing:!1})},listMembers:q,clickMentionFallback:N},gtmContext:`${u}Form`,data:{mentions:t.mentions}}):o.post?d.jsxs("a",{href:o.post,children:[(W==null?void 0:W.title)&&d.jsx("p",{className:"content-title",children:W==null?void 0:W.title}),W.postBody.length>$x?d.jsx(Vc,{text:W.postBody,markdownOptions:{overrides:{a:ds,blockquote:{component:Yi}}}}):d.jsx(xn,{options:{overrides:{a:ds,blockquote:{component:Yi}}},children:W.postBody})]}):d.jsxs(d.Fragment,{children:[(W==null?void 0:W.title)&&d.jsx("p",{className:"content-title",children:W==null?void 0:W.title}),d.jsx(xn,{options:{wrapper:t.type==="question"?"h1":y.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:Yi}}},children:W.postBody})]}),!W.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(Uf,{element:"li",likes:j,isShort:!1,userLiked:M,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:ae,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:k,deleteLike:T}}),!i.comments&&(["question","post"].includes(t.type)||o.comments)&&d.jsx("li",{children:d.jsx(Oa,{onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),o.comments&&(window.location.href=o.comments),typeof S=="function"&&S()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":u,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:f.formatMessage({id:`${Ht}comments_screenReader`},{count:V}),children:f.formatMessage({id:`${Ht}comments`},{count:V})})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(Oa,{styling:{muted:!0},onClick:pe,icon:{icon:"speech-bubble_square"},children:f.formatMessage({id:`${Ht}reply`})})}),p&&d.jsx(Ix,{url:(He=t.slugs)!=null&&He.reply?`${window.location.origin}${(Se=t.slugs)==null?void 0:Se.question}/${(Te=t.slugs)==null?void 0:Te.answer}#${(Ne=t.slugs)==null?void 0:Ne.reply}`:`${window.location.origin}${(ke=t.slugs)==null?void 0:ke.question}/${(Ue=t.slugs)==null?void 0:Ue.answer}`,gtm:{context:u,event:`copy-link-${t.type}-click`}}),d.jsx(rd,{element:"li",id:`more-${t.slug}`,options:ye})]})]}),c,d.jsx(sr,{id:`delete-${t.slug}-modal`,isOpen:A,functions:{onOpen:()=>{},onClose:()=>L(!1)},forceShow:{error:re==="delete-error"?f.formatMessage({id:"discussion_delete_error"},{action:f.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:f.formatMessage({id:"discussion_delete_title"},{action:f.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>L(!1),children:f.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:he,children:f.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:ge=>d.jsx("p",{children:ge}),action:f.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Lx=y.lazy(()=>Promise.resolve().then(()=>kE)),zx=65,Vf=({forceShow:e,form:t,className:n})=>{const r=ue.useIntl(),i=y.useContext(Lt)||"community",s=Ka(i);s.name||(s.name=r.formatMessage({id:`member_${typeof i=="string"?i:"community"}`}));const{modal:o=!1}=e||{},[l,u]=y.useState(o||Yh("showPost")==="true"||!1),[c,h]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!c.showCachedText)return;(async()=>{const g=await _o(c.title||c.body||"",zx,c.mentions);h(f=>({...f,prettifiedText:g}))})()},[c.showCachedText,c.title,c.body]);let p=r.formatMessage({id:"discussionFormCard_placeholder"});return c.showCachedText&&(c.title||c.body)&&(p=c.prettifiedText||p),d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:Y("discussion-form-card",n),onClick:m=>{m.preventDefault(),m.stopPropagation(),u(!0)},"data-testid":"discussion-form-card",children:[d.jsx(Yt,{name:s.name,src:s.image,alt:""}),d.jsx(xn,{className:Y("input",{placeholder:!c.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:Ct,blockquote:Ct,br:Ct,em:Ct,li:Ct,ol:Ct,p:Ct,s:Ct,span:Ct,strong:Ct,ul:Ct}},children:p})]}),d.jsx(Ua,{children:d.jsx(Lx,{showModal:l,functions:{cacheText:h,onClose:()=>{u(!1)}},form:t,cachedText:c,className:"in-portal"})})]})},qx=y.lazy(()=>Promise.resolve().then(()=>Ox)),Bo=({isCard:e=!1,form:t,membershipRequiredToPost:{isMember:n,required:r,join:a,leave:i,notMemberStateText:s}})=>{if(r&&!n)return d.jsx(un,{text:s,button:{breakpoints:{mobile:!0,901:!1},component:d.jsx(Zs,{isShort:!0,functions:{join:a,leave:i}})}});const{content:o,functions:l,meta:u,...c}=t,h={content:{type:(o==null?void 0:o.type)||"reply",slugs:(o==null?void 0:o.slugs)||{}},functions:{...l,create:(l==null?void 0:l.create)||(()=>{})},meta:{...u,isEditing:(u==null?void 0:u.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1},...c,id:`add-post-${c.id||""}`};return e?d.jsx(Vf,{form:h}):d.jsx(qx,{...h})};const Gi="discussion_responses_",Kf=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ue.useIntl();return t=parseInt(t),d.jsxs("div",{className:"responses-heading",children:[d.jsx("h4",{children:r.formatMessage({id:`${Gi}title`},{action:r.formatMessage({id:`${Gi}${e}`}),count:t})}),!n&&t===0&&d.jsx("p",{children:Bt(r.formatMessage,`${Gi}empty`,e,e)})]})};const Zf=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ue.useIntl(),s=y.useContext(ri),o=fa(a,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return 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($r,{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(zr,{...r})]})},Wx="post",Hx="reply",Yf="00000000-0000-0000-0000-000000000000";function Fo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Ao({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 Ux(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Vx(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Gf(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 Kx({title:e,content:t}){return{title:e,content:t,id:Yf,time:new Date().toISOString(),verb:Wx}}function Xl({activity:e,user:t}){return{...e,actor:Gf(t),...Ux()}}function Pa({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 Qf({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 Zx({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Yf,kind:Hx,parent:t||""}}function ec({reply:e,user:t}){const n=Gf(t);return{...e,user_id:n.id,user:n,...Vx()}}function tc({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 Yx({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 Jf=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let nc,Qi=0;const Xf=()=>{y.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(nc);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),Qi=0;return}Qi++,!(Qi>10)&&(nc=setTimeout(()=>{e(t)},50))}},Xn=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}),on=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}),eh=Object.freeze({actor:`SU:${Xn.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"}),Gx=Object.freeze({actor:`SU:${on.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"}),Qx=Object.freeze({actor:`SU:${Xn.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"}),Jx=Object.freeze({actor:`SU:${on.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:eh.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:on.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:on.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:on.id,user:{id:on.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:eh.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:Xn.id,user:{id:Xn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Gx.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:on.id,user:{id:on.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Qx.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:Xn.id,user:{id:Xn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Jx.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function Xx({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ye.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Xl({activity:Kx(o),user:i});return rc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=Xl({activity:o,user:i});r.setQueryData(a,rc(c,u,!0)),setTimeout(()=>{Jf(c.id)},0)}});return s}function ew({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ye.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Na(a,s);return o&&(o.content=i),s}),onError:n});return r}function tw({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s,rankingMethod:o}){const l=Ye.useQueryClient(),u=Za(),c={queryClient:l,queryKey:s},h={mutationHandlers:{error:Fo(c),mutate:Ao(c)},user:u,...c},p=Xx({...h,mutationFn:e}),m=ew({...h,mutationFn:t}),g=nw({...h,mutationFn:n}),f=aw({...h,mutationFn:a}),D=iw({...h,mutationFn:i}),{activities:v,...E}=rw({queryKey:s,queryFn:r,rankingMethod:o});return{activities:v,mutations:{create:p,edit:m,remove:f,like:g,unlike:D},user:u,...E}}function nw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ye.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Na(s,o);return l&&Pa({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Na(o,l);u&&Pa({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function rw({queryFn:e,queryKey:t,rankingMethod:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=Ye.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:`ranking=${n}`,getNextPageParam:l=>l!=null&&l.next?`${l==null?void 0:l.next}&ranking=${n}`:null});return{activities:ow(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function aw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ye.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>sw(a,i)),onError:n});return r}function iw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ye.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Na(i,s);return o&&Qf({activity:o,user:r}),s}),onError:n});return a}function rc(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 Na(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function sw(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 ow(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const uw=({basePath:e,parentId:t,isMember:n,functions:{activities:r,mentions:a,join:i,leave:s}})=>{const o=Dm(Us.COMMUNITY_RANKING),l=ue.useIntl(),[u,c]=y.useState("recent"),[h,p]=y.useState([{id:"recent",label:"recent"},{id:"community_feed_live",label:"popular"}]),{activities:m,error:g,fetchNextPage:f,hasNextPage:D,isLoading:v,mutations:{create:E,edit:B,remove:x,like:k,unlike:T}}=tw({queryKey:[e,t,"activities",u],queryFns:r,rankingMethod:u});y.useEffect(()=>{o&&p(h.concat(o))},[o]);const[S,q]=y.useState(null),N=()=>{q(m.length),f()};return Xf(),g?d.jsx(un,{variant:"error",text:g.message}):d.jsxs("section",{children:[d.jsx(Bo,{isCard:!0,form:{content:{type:"post",slugs:{}},functions:{create:E,...a},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:i,leave:s,notMemberStateText:l.formatMessage({id:"community_joinToPost"})}}),d.jsx(ln,{className:"activities-feed-sorting-form",fields:[{id:"feed-sorting",label:l.formatMessage({id:"activitiesFeed_sorting_label"}),type:"select",options:h.map(({id:I,label:z})=>({id:I,label:l.formatMessage({id:`activitiesFeed_rankingMethod_${z}`})})),initialValue:u,functions:{onChange:I=>c(I)},gtm:{context:"Community Sorting",event:"community-sorting-click"}}],button:{hideButton:!0},functions:{onCatch:()=>{},onFailure:()=>{},onSuccess:async()=>{},onCancel:()=>{}},id:"activities-feed-sorting-form"}),m==null?void 0:m.map((I,z)=>{var W,_,A,L,$,U,re,te;const{id:w,own_reactions:F,latest_reactions:j,reaction_counts:M,mentioned_users:V}=I,G=(((W=j==null?void 0:j.like)==null?void 0:W.length)||0)>0,J=(((_=F==null?void 0:F.like)==null?void 0:_.length)||0)>0,ae=J?F==null?void 0:F.like[0].id:"",C=G?(A=j==null?void 0:j.like)==null?void 0:A.map(ne=>{var le,Q,pe;return{id:(le=ne==null?void 0:ne.user)==null?void 0:le.id,name:(pe=(Q=ne==null?void 0:ne.user)==null?void 0:Q.data)==null?void 0:pe.name}}):!1,R=I==null?void 0:I.actor;return d.jsx(y.Fragment,{children:d.jsx(qr,{content:{type:"post",title:I==null?void 0:I.title,body:I==null?void 0:I.content,canLike:n,createdAt:(I==null?void 0:I.time)||"",slugs:{question:`${e}/${t}`,answer:w},slug:w,author:{id:R==null?void 0:R.id,name:(L=R==null?void 0:R.data)==null?void 0:L.name,organization:($=R==null?void 0:R.data)==null?void 0:$.organization,jobTitle:(U=R==null?void 0:R.data)==null?void 0:U.jobTitle,location:(re=R==null?void 0:R.data)==null?void 0:re.location,image:{thumbnail:((te=R==null?void 0:R.data)==null?void 0:te.thumbnail)||void 0}},userLiked:J,likes:(M==null?void 0:M.like)||0,comments:(M==null?void 0:M.reply)||0,peopleWhoLiked:C,mentions:V},links:{post:`${e}/${t}/${w}`,comments:`${e}/${t}/${w}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>x({activityId:w}),updateContent:(ne,{body:le})=>B({activityId:w,content:le})},likes:{createLike:()=>k({activityId:w}),deleteLike:()=>T({activityId:w,reactionId:ae})},comments:{openComments:()=>null},mentions:a},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:z===S})},w)}),!v&&d.jsx($r,{hasNextPage:D,loadNextPage:N,icon:{icon:"arrow-down",position:"right"},messages:{button:l.formatMessage({id:"loadMore_button"}),error:l.formatMessage({id:"loadMore_error"})}})]})},lw={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 cw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ye.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=ec({reply:Zx(o),user:i});return ac(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=ec({reply:o,user:i});r.setQueryData(a,ac(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Jf(c.id)},0)}});return s}function dw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ye.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ra(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function th({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ye.useQueryClient(),l=Za(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:Fo(u),mutate:Ao(u)},user:l,...u},h=cw({...c,mutationFn:e}),p=dw({...c,mutationFn:t}),m=fw({...c,mutationFn:n}),g=mw({...c,mutationFn:a}),f=pw({...c,mutationFn:i}),{replies:D,...v}=hw({queryKey:s,queryFn:r});return{replies:D,mutations:{create:h,edit:p,remove:g,like:m,unlike:f},user:l,...v}}function fw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ye.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Ra(s,o);return l&&tc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ra(o,l);u&&tc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function hw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ye.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=Dw(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function mw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ye.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>yw(a,i)),onError:n});return r}function pw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ye.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ra(i,s);return o&&Yx({reply:o,user:r}),s}),onError:n});return a}function gw(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function vw(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 bw(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 ac(e,t,n){return t?n!=null&&n.append?vw(e,t,n):bw(e,t,n):gw(e)}function Ra(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function yw(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 Dw(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 Cw=({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:p,edit:m,like:g,remove:f,unlike:D},user:v}=th({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:x=>i.list({...x,reactionId:r})}});$s([h]);const[E,B]=y.useState(!0);return d.jsxs(d.Fragment,{children:[(l==null?void 0:l.length)>=o&&d.jsx(_e,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${E?"up_left":"down_right"}`,position:"left"},onClick:()=>B(!E),children:s.formatMessage({id:`discussion_thread_${E?"hide":"show"}`},{count:l==null?void 0:l.length})}),E&&d.jsx(Zf,{loadMore:{isLoading:h,hasNextPage:c,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(x,{body:k})=>p({activityId:n,replyId:r,content:k}),listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(x=>{var J,ae,C,R,W,_,A,L,$,U,re,te;const{id:k,own_children:T,latest_children:S,children_counts:q,data:{mentioned_users:N}}=x,z=(((J=T==null?void 0:T.like)==null?void 0:J.length)||0)>0?(ae=T==null?void 0:T.like)==null?void 0:ae.find(ne=>{var le;return((le=ne==null?void 0:ne.user)==null?void 0:le.id)===(v==null?void 0:v.id)}):!1,w=z?z==null?void 0:z.id:"",F=!!z,M=(((C=S==null?void 0:S.like)==null?void 0:C.length)||0)>0?(R=S==null?void 0:S.like)==null?void 0:R.map(ne=>{var le,Q,pe;return{id:(le=ne==null?void 0:ne.user)==null?void 0:le.id,name:(pe=(Q=ne==null?void 0:ne.user)==null?void 0:Q.data)==null?void 0:pe.name}}):!1,V=x==null?void 0:x.user,G=typeof x.data.content=="string"?(W=x==null?void 0:x.data)==null?void 0:W.content:((A=(_=x==null?void 0:x.data)==null?void 0:_.content)==null?void 0:A.text)||"";return d.jsx(qr,{isCommunity:!0,content:{id:k,type:"reply",body:G,canLike:a,createdAt:x==null?void 0:x.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:x==null?void 0:x.parent},slug:"",author:{id:V==null?void 0:V.id,name:(L=V.data)==null?void 0:L.name,organization:($=V.data)==null?void 0:$.organization,jobTitle:(U=V.data)==null?void 0:U.jobTitle,location:(re=V.data)==null?void 0:re.location,image:{thumbnail:((te=V.data)==null?void 0:te.thumbnail)||void 0}},userLiked:F,likes:(q==null?void 0:q.like)||0,peopleWhoLiked:M,mentions:N},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:k}),updateContent:(ne,{body:le})=>m({replyId:k,content:le})},likes:{createLike:()=>g({replyId:k}),deleteLike:()=>D({replyId:k,reactionId:w})},comments:{},mentions:{listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback}},styling:{showShareLinkButton:!0}},k)}):null})]})};const nh=({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:p,isLoading:m,mutations:{create:g,edit:f,like:D,remove:v,unlike:E},user:B}=th({queryKey:[e,t,n,"replies"],queryFns:a}),x=()=>{T(u.length),h()},[k,T]=y.useState(null);return $s([m]),Xf(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(Kf,{type:"comment",responses:c,isLoading:m}),d.jsx(Bo,{form:{content:{type:"reply",slugs:{}},functions:{create:(S,{body:q})=>g({activityId:n,content:q}),...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!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,q)=>{var W,_,A,L,$,U,re,te,ne,le,Q,pe;const{id:N,own_children:I,latest_children:z,children_counts:w,data:{mentioned_users:F}}=S,M=(((W=I==null?void 0:I.like)==null?void 0:W.length)||0)>0?(_=I==null?void 0:I.like)==null?void 0:_.find(he=>{var ye;return((ye=he==null?void 0:he.user)==null?void 0:ye.id)===(B==null?void 0:B.id)}):!1,V=M?M==null?void 0:M.id:"",G=!!M,ae=(((A=z==null?void 0:z.like)==null?void 0:A.length)||0)>0?(L=z==null?void 0:z.like)==null?void 0:L.map(he=>{var ye,Fe,Ae;return{id:(ye=he==null?void 0:he.user)==null?void 0:ye.id,name:(Ae=(Fe=he==null?void 0:he.user)==null?void 0:Fe.data)==null?void 0:Ae.name}}):!1,C=S==null?void 0:S.user,R=typeof S.data.content=="string"?($=S==null?void 0:S.data)==null?void 0:$.content:((re=(U=S==null?void 0:S.data)==null?void 0:U.content)==null?void 0:re.text)||"";return d.jsx(Hf,{children:d.jsx(qr,{isCommunity:!0,content:{id:N,type:"reply",body:R,canLike:r,createdAt:S==null?void 0:S.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:N},slug:N,author:{id:C==null?void 0:C.id,name:(te=C.data)==null?void 0:te.name,organization:(ne=C.data)==null?void 0:ne.organization,jobTitle:(le=C.data)==null?void 0:le.jobTitle,location:(Q=C.data)==null?void 0:Q.location,image:{thumbnail:((pe=C.data)==null?void 0:pe.thumbnail)||void 0}},userLiked:G,likes:(w==null?void 0:w.like)||0,peopleWhoLiked:ae,mentions:F},functions:{content:{createContent:()=>null,deleteContent:()=>v({replyId:N}),updateContent:(he,{body:ye})=>f({replyId:N,content:ye})},likes:{createLike:()=>D({replyId:N}),deleteLike:()=>E({replyId:N,reactionId:V})},comments:{},mentions:i},children:d.jsx(Cw,{basePath:e,parentId:t,activityId:n,replyId:N,isMember:r,functions:{...a,...i}}),styling:{showShareLinkButton:!0},setFocus:q===k},N)},N)}),!m&&d.jsx($r,{hasNextPage:p,loadNextPage:x,icon:{icon:"arrow-down",position:"right"},messages:{button:l.formatMessage({id:"loadMore_button"}),error:l.formatMessage({id:"loadMore_error"})}})]})};function xw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ye.useMutation({mutationFn:e,onMutate:({content:a,title:i})=>t(s=>(s&&(a!=null&&(s.content=a),i!=null&&(s.title=i)),s)),onError:n});return r}function ww({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=Ye.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function Ew({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=Ye.useQueryClient(),s=Za(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:Fo(o),mutate:Ao(o)},user:s,...o},u=xw({...l,mutationFn:t}),c=kw({...l,mutationFn:n}),h=_w({...l,mutationFn:r}),{activity:p,...m}=ww({queryKey:a,queryFn:e});return{activity:p,mutations:{edit:u,like:c,unlike:h},user:s,...m}}function kw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ye.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Pa({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Pa({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function _w({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ye.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Qf({activity:s,user:r}),s)),onError:n});return a}const Bw=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,mentions:o,join:l,leave:u}})=>{var N,I,z,w,F,j,M,V,G,J;const c=ue.useIntl(),{activity:h,error:p,isLoading:m,mutations:{edit:g,like:f,unlike:D}}=Ew({queryFns:i,queryKey:[e,t,n]});if(m)return d.jsx(kt,{style:{height:"400px"}});if(p||!h)return d.jsx(un,{variant:"error",text:c.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:v,latest_reactions:E,mentioned_users:B}=h,x=(((N=E==null?void 0:E.like)==null?void 0:N.length)||0)>0,k=(((I=v==null?void 0:v.like)==null?void 0:I.length)||0)>0,T=k?v==null?void 0:v.like[0].id:"",S=x?(z=E==null?void 0:E.like)==null?void 0:z.map(ae=>{var C,R,W;return{id:(C=ae==null?void 0:ae.user)==null?void 0:C.id,name:(W=(R=ae==null?void 0:ae.user)==null?void 0:R.data)==null?void 0:W.name}}):!1,q=h==null?void 0:h.actor;return d.jsxs("section",{className:"activity-section",children:[d.jsx(qr,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:h==null?void 0:h.title,body:h==null?void 0:h.content,canLike:r,createdAt:(h==null?void 0:h.time)||"",slugs:{question:`${e}/${t}`,answer:h==null?void 0:h.id},slug:n,author:{id:q.id,name:(w=q.data)==null?void 0:w.name,organization:(F=q.data)==null?void 0:F.organization,jobTitle:(j=q.data)==null?void 0:j.jobTitle,location:(M=q.data)==null?void 0:M.location,image:{thumbnail:((V=q.data)==null?void 0:V.thumbnail)||void 0}},userLiked:k,likes:((G=h==null?void 0:h.reaction_counts)==null?void 0:G.like)||0,comments:((J=h==null?void 0:h.reaction_counts)==null?void 0:J.reply)||0,peopleWhoLiked:S,mentions:B},originalAuthorId:q==null?void 0:q.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(ae,{title:C,body:R})=>g({title:C,content:R})},likes:{createLike:()=>f({activityId:n}),deleteLike:()=>D({activityId:n,reactionId:T})},comments:{openComments:()=>{}},mentions:o},styling:{showShareLinkButton:!0}},n),d.jsx(nh,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,mentions:o,join:l,leave:u}})]})};var Ns={exports:{}},sa={exports:{}},Re={};/** @license React v16.13.1
141
141
  * react-is.production.min.js
142
142
  *
143
143
  * Copyright (c) Facebook, Inc. and its affiliates.
144
144
  *
145
145
  * This source code is licensed under the MIT license found in the
146
146
  * LICENSE file in the root directory of this source tree.
147
- */var oc;function Tw(){if(oc)return Re;oc=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function _(k){if(typeof k=="object"&&k!==null){var T=k.$$typeof;switch(T){case t:switch(k=k.type,k){case l:case u:case r:case i:case a:case f:return k;default:switch(k=k&&k.$$typeof,k){case o:case d:case g:case m:case s:return k;default:return T}}case n:return T}}}function x(k){return _(k)===u}return Re.AsyncMode=l,Re.ConcurrentMode=u,Re.ContextConsumer=o,Re.ContextProvider=s,Re.Element=t,Re.ForwardRef=d,Re.Fragment=r,Re.Lazy=g,Re.Memo=m,Re.Portal=n,Re.Profiler=i,Re.StrictMode=a,Re.Suspense=f,Re.isAsyncMode=function(k){return x(k)||_(k)===l},Re.isConcurrentMode=x,Re.isContextConsumer=function(k){return _(k)===o},Re.isContextProvider=function(k){return _(k)===s},Re.isElement=function(k){return typeof k=="object"&&k!==null&&k.$$typeof===t},Re.isForwardRef=function(k){return _(k)===d},Re.isFragment=function(k){return _(k)===r},Re.isLazy=function(k){return _(k)===g},Re.isMemo=function(k){return _(k)===m},Re.isPortal=function(k){return _(k)===n},Re.isProfiler=function(k){return _(k)===i},Re.isStrictMode=function(k){return _(k)===a},Re.isSuspense=function(k){return _(k)===f},Re.isValidElementType=function(k){return typeof k=="string"||typeof k=="function"||k===r||k===u||k===i||k===a||k===f||k===p||typeof k=="object"&&k!==null&&(k.$$typeof===g||k.$$typeof===m||k.$$typeof===s||k.$$typeof===o||k.$$typeof===d||k.$$typeof===y||k.$$typeof===v||k.$$typeof===w||k.$$typeof===h)},Re.typeOf=_,Re}var Me={};/** @license React v16.13.1
147
+ */var ic;function Fw(){if(ic)return Re;ic=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,p=e?Symbol.for("react.suspense_list"):60120,m=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,v=e?Symbol.for("react.responder"):60118,E=e?Symbol.for("react.scope"):60119;function B(k){if(typeof k=="object"&&k!==null){var T=k.$$typeof;switch(T){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 m:case s:return k;default:return T}}case n:return T}}}function x(k){return B(k)===u}return Re.AsyncMode=l,Re.ConcurrentMode=u,Re.ContextConsumer=o,Re.ContextProvider=s,Re.Element=t,Re.ForwardRef=c,Re.Fragment=r,Re.Lazy=g,Re.Memo=m,Re.Portal=n,Re.Profiler=i,Re.StrictMode=a,Re.Suspense=h,Re.isAsyncMode=function(k){return x(k)||B(k)===l},Re.isConcurrentMode=x,Re.isContextConsumer=function(k){return B(k)===o},Re.isContextProvider=function(k){return B(k)===s},Re.isElement=function(k){return typeof k=="object"&&k!==null&&k.$$typeof===t},Re.isForwardRef=function(k){return B(k)===c},Re.isFragment=function(k){return B(k)===r},Re.isLazy=function(k){return B(k)===g},Re.isMemo=function(k){return B(k)===m},Re.isPortal=function(k){return B(k)===n},Re.isProfiler=function(k){return B(k)===i},Re.isStrictMode=function(k){return B(k)===a},Re.isSuspense=function(k){return B(k)===h},Re.isValidElementType=function(k){return typeof k=="string"||typeof k=="function"||k===r||k===u||k===i||k===a||k===h||k===p||typeof k=="object"&&k!==null&&(k.$$typeof===g||k.$$typeof===m||k.$$typeof===s||k.$$typeof===o||k.$$typeof===c||k.$$typeof===D||k.$$typeof===v||k.$$typeof===E||k.$$typeof===f)},Re.typeOf=B,Re}var Me={};/** @license React v16.13.1
148
148
  * react-is.development.js
149
149
  *
150
150
  * Copyright (c) Facebook, Inc. and its affiliates.
151
151
  *
152
152
  * This source code is licensed under the MIT license found in the
153
153
  * LICENSE file in the root directory of this source tree.
154
- */var uc;function Sw(){return uc||(uc=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function _(Q){return typeof Q=="string"||typeof Q=="function"||Q===r||Q===u||Q===i||Q===a||Q===f||Q===p||typeof Q=="object"&&Q!==null&&(Q.$$typeof===g||Q.$$typeof===m||Q.$$typeof===s||Q.$$typeof===o||Q.$$typeof===d||Q.$$typeof===y||Q.$$typeof===v||Q.$$typeof===w||Q.$$typeof===h)}function x(Q){if(typeof Q=="object"&&Q!==null){var pe=Q.$$typeof;switch(pe){case t:var he=Q.type;switch(he){case l:case u:case r:case i:case a:case f:return he;default:var ye=he&&he.$$typeof;switch(ye){case o:case d:case g:case m:case s:return ye;default:return pe}}case n:return pe}}}var k=l,T=u,S=o,q=s,N=t,I=d,z=r,E=g,F=m,j=n,M=i,V=a,G=f,J=!1;function ae(Q){return J||(J=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),C(Q)||x(Q)===l}function C(Q){return x(Q)===u}function R(Q){return x(Q)===o}function W(Q){return x(Q)===s}function B(Q){return typeof Q=="object"&&Q!==null&&Q.$$typeof===t}function A(Q){return x(Q)===d}function L(Q){return x(Q)===r}function $(Q){return x(Q)===g}function U(Q){return x(Q)===m}function re(Q){return x(Q)===n}function te(Q){return x(Q)===i}function ne(Q){return x(Q)===a}function le(Q){return x(Q)===f}Me.AsyncMode=k,Me.ConcurrentMode=T,Me.ContextConsumer=S,Me.ContextProvider=q,Me.Element=N,Me.ForwardRef=I,Me.Fragment=z,Me.Lazy=E,Me.Memo=F,Me.Portal=j,Me.Profiler=M,Me.StrictMode=V,Me.Suspense=G,Me.isAsyncMode=ae,Me.isConcurrentMode=C,Me.isContextConsumer=R,Me.isContextProvider=W,Me.isElement=B,Me.isForwardRef=A,Me.isFragment=L,Me.isLazy=$,Me.isMemo=U,Me.isPortal=re,Me.isProfiler=te,Me.isStrictMode=ne,Me.isSuspense=le,Me.isValidElementType=_,Me.typeOf=x}()),Me}var lc;function ih(){return lc||(lc=1,process.env.NODE_ENV==="production"?ua.exports=Tw():ua.exports=Sw()),ua.exports}/*
154
+ */var sc;function Aw(){return sc||(sc=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,p=e?Symbol.for("react.suspense_list"):60120,m=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,v=e?Symbol.for("react.responder"):60118,E=e?Symbol.for("react.scope"):60119;function B(Q){return typeof Q=="string"||typeof Q=="function"||Q===r||Q===u||Q===i||Q===a||Q===h||Q===p||typeof Q=="object"&&Q!==null&&(Q.$$typeof===g||Q.$$typeof===m||Q.$$typeof===s||Q.$$typeof===o||Q.$$typeof===c||Q.$$typeof===D||Q.$$typeof===v||Q.$$typeof===E||Q.$$typeof===f)}function x(Q){if(typeof Q=="object"&&Q!==null){var pe=Q.$$typeof;switch(pe){case t:var he=Q.type;switch(he){case l:case u:case r:case i:case a:case h:return he;default:var ye=he&&he.$$typeof;switch(ye){case o:case c:case g:case m:case s:return ye;default:return pe}}case n:return pe}}}var k=l,T=u,S=o,q=s,N=t,I=c,z=r,w=g,F=m,j=n,M=i,V=a,G=h,J=!1;function ae(Q){return J||(J=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),C(Q)||x(Q)===l}function C(Q){return x(Q)===u}function R(Q){return x(Q)===o}function W(Q){return x(Q)===s}function _(Q){return typeof Q=="object"&&Q!==null&&Q.$$typeof===t}function A(Q){return x(Q)===c}function L(Q){return x(Q)===r}function $(Q){return x(Q)===g}function U(Q){return x(Q)===m}function re(Q){return x(Q)===n}function te(Q){return x(Q)===i}function ne(Q){return x(Q)===a}function le(Q){return x(Q)===h}Me.AsyncMode=k,Me.ConcurrentMode=T,Me.ContextConsumer=S,Me.ContextProvider=q,Me.Element=N,Me.ForwardRef=I,Me.Fragment=z,Me.Lazy=w,Me.Memo=F,Me.Portal=j,Me.Profiler=M,Me.StrictMode=V,Me.Suspense=G,Me.isAsyncMode=ae,Me.isConcurrentMode=C,Me.isContextConsumer=R,Me.isContextProvider=W,Me.isElement=_,Me.isForwardRef=A,Me.isFragment=L,Me.isLazy=$,Me.isMemo=U,Me.isPortal=re,Me.isProfiler=te,Me.isStrictMode=ne,Me.isSuspense=le,Me.isValidElementType=B,Me.typeOf=x}()),Me}var oc;function rh(){return oc||(oc=1,process.env.NODE_ENV==="production"?sa.exports=Fw():sa.exports=Aw()),sa.exports}/*
155
155
  object-assign
156
156
  (c) Sindre Sorhus
157
157
  @license MIT
158
- */var es,cc;function jw(){if(cc)return es;cc=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return es=a()?Object.assign:function(i,s){for(var o,l=r(i),u,d=1;d<arguments.length;d++){o=Object(arguments[d]);for(var f in o)t.call(o,f)&&(l[f]=o[f]);if(e){u=e(o);for(var p=0;p<u.length;p++)n.call(o,u[p])&&(l[u[p]]=o[u[p]])}}return l},es}var ts,dc;function jo(){if(dc)return ts;dc=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ts=e,ts}var ns,fc;function sh(){return fc||(fc=1,ns=Function.call.bind(Object.prototype.hasOwnProperty)),ns}var rs,hc;function Ow(){if(hc)return rs;hc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=jo(),n={},r=sh();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var f;try{if(typeof i[d]!="function"){var p=Error((l||"React class")+": "+o+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}f=i[d](s,d,l,o,null,t)}catch(g){f=g}if(f&&!(f instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in n)){n[f.message]=!0;var m=u?u():"";e("Failed "+o+" type: "+f.message+(m??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},rs=a,rs}var as,mc;function Pw(){if(mc)return as;mc=1;var e=ih(),t=jw(),n=jo(),r=sh(),a=Ow(),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 as=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function f(C){var R=C&&(u&&C[u]||C[d]);if(typeof R=="function")return R}var p="<<anonymous>>",m={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:w(),arrayOf:_,element:x(),elementType:k(),instanceOf:T,node:I(),objectOf:q,oneOf:S,oneOfType:N,shape:E,exact:F};function g(C,R){return C===R?C!==0||1/C===1/R:C!==C&&R!==R}function h(C,R){this.message=C,this.data=R&&typeof R=="object"?R:{},this.stack=""}h.prototype=Error.prototype;function y(C){if(process.env.NODE_ENV!=="production")var R={},W=0;function B(L,$,U,re,te,ne,le){if(re=re||p,ne=ne||U,le!==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=re+":"+U;!R[pe]&&W<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ne+"` prop on `"+re+"`. 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."),R[pe]=!0,W++)}}return $[U]==null?L?$[U]===null?new h("The "+te+" `"+ne+"` is marked as required "+("in `"+re+"`, but its value is `null`.")):new h("The "+te+" `"+ne+"` is marked as required in "+("`"+re+"`, but its value is `undefined`.")):null:C($,U,re,te,ne)}var A=B.bind(null,!1);return A.isRequired=B.bind(null,!0),A}function v(C){function R(W,B,A,L,$,U){var re=W[B],te=V(re);if(te!==C){var ne=G(re);return new h("Invalid "+L+" `"+$+"` of type "+("`"+ne+"` supplied to `"+A+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return y(R)}function w(){return y(s)}function _(C){function R(W,B,A,L,$){if(typeof C!="function")return new h("Property `"+$+"` of component `"+A+"` has invalid PropType notation inside arrayOf.");var U=W[B];if(!Array.isArray(U)){var re=V(U);return new h("Invalid "+L+" `"+$+"` of type "+("`"+re+"` supplied to `"+A+"`, expected an array."))}for(var te=0;te<U.length;te++){var ne=C(U,te,A,L,$+"["+te+"]",n);if(ne instanceof Error)return ne}return null}return y(R)}function x(){function C(R,W,B,A,L){var $=R[W];if(!o($)){var U=V($);return new h("Invalid "+A+" `"+L+"` of type "+("`"+U+"` supplied to `"+B+"`, expected a single ReactElement."))}return null}return y(C)}function k(){function C(R,W,B,A,L){var $=R[W];if(!e.isValidElementType($)){var U=V($);return new h("Invalid "+A+" `"+L+"` of type "+("`"+U+"` supplied to `"+B+"`, expected a single ReactElement type."))}return null}return y(C)}function T(C){function R(W,B,A,L,$){if(!(W[B]instanceof C)){var U=C.name||p,re=ae(W[B]);return new h("Invalid "+L+" `"+$+"` of type "+("`"+re+"` supplied to `"+A+"`, expected ")+("instance of `"+U+"`."))}return null}return y(R)}function S(C){if(!Array.isArray(C))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 R(W,B,A,L,$){for(var U=W[B],re=0;re<C.length;re++)if(g(U,C[re]))return null;var te=JSON.stringify(C,function(le,Q){var pe=G(Q);return pe==="symbol"?String(Q):Q});return new h("Invalid "+L+" `"+$+"` of value `"+String(U)+"` "+("supplied to `"+A+"`, expected one of "+te+"."))}return y(R)}function q(C){function R(W,B,A,L,$){if(typeof C!="function")return new h("Property `"+$+"` of component `"+A+"` has invalid PropType notation inside objectOf.");var U=W[B],re=V(U);if(re!=="object")return new h("Invalid "+L+" `"+$+"` of type "+("`"+re+"` supplied to `"+A+"`, expected an object."));for(var te in U)if(r(U,te)){var ne=C(U,te,A,L,$+"."+te,n);if(ne instanceof Error)return ne}return null}return y(R)}function N(C){if(!Array.isArray(C))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var R=0;R<C.length;R++){var W=C[R];if(typeof W!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+J(W)+" at index "+R+"."),s}function B(A,L,$,U,re){for(var te=[],ne=0;ne<C.length;ne++){var le=C[ne],Q=le(A,L,$,U,re,n);if(Q==null)return null;Q.data&&r(Q.data,"expectedType")&&te.push(Q.data.expectedType)}var pe=te.length>0?", expected one of type ["+te.join(", ")+"]":"";return new h("Invalid "+U+" `"+re+"` supplied to "+("`"+$+"`"+pe+"."))}return y(B)}function I(){function C(R,W,B,A,L){return j(R[W])?null:new h("Invalid "+A+" `"+L+"` supplied to "+("`"+B+"`, expected a ReactNode."))}return y(C)}function z(C,R,W,B,A){return new h((C||"React class")+": "+R+" type `"+W+"."+B+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+A+"`.")}function E(C){function R(W,B,A,L,$){var U=W[B],re=V(U);if(re!=="object")return new h("Invalid "+L+" `"+$+"` of type `"+re+"` "+("supplied to `"+A+"`, expected `object`."));for(var te in C){var ne=C[te];if(typeof ne!="function")return z(A,L,$,te,G(ne));var le=ne(U,te,A,L,$+"."+te,n);if(le)return le}return null}return y(R)}function F(C){function R(W,B,A,L,$){var U=W[B],re=V(U);if(re!=="object")return new h("Invalid "+L+" `"+$+"` of type `"+re+"` "+("supplied to `"+A+"`, expected `object`."));var te=t({},W[B],C);for(var ne in te){var le=C[ne];if(r(C,ne)&&typeof le!="function")return z(A,L,$,ne,G(le));if(!le)return new h("Invalid "+L+" `"+$+"` key `"+ne+"` supplied to `"+A+"`.\nBad object: "+JSON.stringify(W[B],null," ")+`
159
- Valid keys: `+JSON.stringify(Object.keys(C),null," "));var Q=le(U,ne,A,L,$+"."+ne,n);if(Q)return Q}return null}return y(R)}function j(C){switch(typeof C){case"number":case"string":case"undefined":return!0;case"boolean":return!C;case"object":if(Array.isArray(C))return C.every(j);if(C===null||o(C))return!0;var R=f(C);if(R){var W=R.call(C),B;if(R!==C.entries){for(;!(B=W.next()).done;)if(!j(B.value))return!1}else for(;!(B=W.next()).done;){var A=B.value;if(A&&!j(A[1]))return!1}}else return!1;return!0;default:return!1}}function M(C,R){return C==="symbol"?!0:R?R["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&R instanceof Symbol:!1}function V(C){var R=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":M(R,C)?"symbol":R}function G(C){if(typeof C>"u"||C===null)return""+C;var R=V(C);if(R==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return R}function J(C){var R=G(C);switch(R){case"array":case"object":return"an "+R;case"boolean":case"date":case"regexp":return"a "+R;default:return R}}function ae(C){return!C.constructor||!C.constructor.name?p:C.constructor.name}return m.checkPropTypes=a,m.resetWarningCache=a.resetWarningCache,m.PropTypes=m,m},as}var is,pc;function Nw(){if(pc)return is;pc=1;var e=jo();function t(){}function n(){}return n.resetWarningCache=t,is=function(){function r(s,o,l,u,d,f){if(f!==e){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}r.isRequired=r;function 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},is}if(process.env.NODE_ENV!=="production"){var Rw=ih(),Mw=!0;Ms.exports=Pw()(Rw.isElement,Mw)}else Ms.exports=Nw()();var Iw=Ms.exports;/*!
158
+ */var Ji,uc;function Tw(){if(uc)return Ji;uc=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 Ji=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 p=0;p<u.length;p++)n.call(o,u[p])&&(l[u[p]]=o[u[p]])}}return l},Ji}var Xi,lc;function To(){if(lc)return Xi;lc=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Xi=e,Xi}var es,cc;function ah(){return cc||(cc=1,es=Function.call.bind(Object.prototype.hasOwnProperty)),es}var ts,dc;function Sw(){if(dc)return ts;dc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=To(),n={},r=ah();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 p=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 p.name="Invariant Violation",p}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 m=u?u():"";e("Failed "+o+" type: "+h.message+(m??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ts=a,ts}var ns,fc;function jw(){if(fc)return ns;fc=1;var e=rh(),t=Tw(),n=To(),r=ah(),a=Sw(),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 ns=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,c="@@iterator";function h(C){var R=C&&(u&&C[u]||C[c]);if(typeof R=="function")return R}var p="<<anonymous>>",m={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:E(),arrayOf:B,element:x(),elementType:k(),instanceOf:T,node:I(),objectOf:q,oneOf:S,oneOfType:N,shape:w,exact:F};function g(C,R){return C===R?C!==0||1/C===1/R:C!==C&&R!==R}function f(C,R){this.message=C,this.data=R&&typeof R=="object"?R:{},this.stack=""}f.prototype=Error.prototype;function D(C){if(process.env.NODE_ENV!=="production")var R={},W=0;function _(L,$,U,re,te,ne,le){if(re=re||p,ne=ne||U,le!==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=re+":"+U;!R[pe]&&W<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ne+"` prop on `"+re+"`. 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."),R[pe]=!0,W++)}}return $[U]==null?L?$[U]===null?new f("The "+te+" `"+ne+"` is marked as required "+("in `"+re+"`, but its value is `null`.")):new f("The "+te+" `"+ne+"` is marked as required in "+("`"+re+"`, but its value is `undefined`.")):null:C($,U,re,te,ne)}var A=_.bind(null,!1);return A.isRequired=_.bind(null,!0),A}function v(C){function R(W,_,A,L,$,U){var re=W[_],te=V(re);if(te!==C){var ne=G(re);return new f("Invalid "+L+" `"+$+"` of type "+("`"+ne+"` supplied to `"+A+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return D(R)}function E(){return D(s)}function B(C){function R(W,_,A,L,$){if(typeof C!="function")return new f("Property `"+$+"` of component `"+A+"` has invalid PropType notation inside arrayOf.");var U=W[_];if(!Array.isArray(U)){var re=V(U);return new f("Invalid "+L+" `"+$+"` of type "+("`"+re+"` supplied to `"+A+"`, expected an array."))}for(var te=0;te<U.length;te++){var ne=C(U,te,A,L,$+"["+te+"]",n);if(ne instanceof Error)return ne}return null}return D(R)}function x(){function C(R,W,_,A,L){var $=R[W];if(!o($)){var U=V($);return new f("Invalid "+A+" `"+L+"` of type "+("`"+U+"` supplied to `"+_+"`, expected a single ReactElement."))}return null}return D(C)}function k(){function C(R,W,_,A,L){var $=R[W];if(!e.isValidElementType($)){var U=V($);return new f("Invalid "+A+" `"+L+"` of type "+("`"+U+"` supplied to `"+_+"`, expected a single ReactElement type."))}return null}return D(C)}function T(C){function R(W,_,A,L,$){if(!(W[_]instanceof C)){var U=C.name||p,re=ae(W[_]);return new f("Invalid "+L+" `"+$+"` of type "+("`"+re+"` supplied to `"+A+"`, expected ")+("instance of `"+U+"`."))}return null}return D(R)}function S(C){if(!Array.isArray(C))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 R(W,_,A,L,$){for(var U=W[_],re=0;re<C.length;re++)if(g(U,C[re]))return null;var te=JSON.stringify(C,function(le,Q){var pe=G(Q);return pe==="symbol"?String(Q):Q});return new f("Invalid "+L+" `"+$+"` of value `"+String(U)+"` "+("supplied to `"+A+"`, expected one of "+te+"."))}return D(R)}function q(C){function R(W,_,A,L,$){if(typeof C!="function")return new f("Property `"+$+"` of component `"+A+"` has invalid PropType notation inside objectOf.");var U=W[_],re=V(U);if(re!=="object")return new f("Invalid "+L+" `"+$+"` of type "+("`"+re+"` supplied to `"+A+"`, expected an object."));for(var te in U)if(r(U,te)){var ne=C(U,te,A,L,$+"."+te,n);if(ne instanceof Error)return ne}return null}return D(R)}function N(C){if(!Array.isArray(C))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var R=0;R<C.length;R++){var W=C[R];if(typeof W!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+J(W)+" at index "+R+"."),s}function _(A,L,$,U,re){for(var te=[],ne=0;ne<C.length;ne++){var le=C[ne],Q=le(A,L,$,U,re,n);if(Q==null)return null;Q.data&&r(Q.data,"expectedType")&&te.push(Q.data.expectedType)}var pe=te.length>0?", expected one of type ["+te.join(", ")+"]":"";return new f("Invalid "+U+" `"+re+"` supplied to "+("`"+$+"`"+pe+"."))}return D(_)}function I(){function C(R,W,_,A,L){return j(R[W])?null:new f("Invalid "+A+" `"+L+"` supplied to "+("`"+_+"`, expected a ReactNode."))}return D(C)}function z(C,R,W,_,A){return new f((C||"React class")+": "+R+" type `"+W+"."+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+A+"`.")}function w(C){function R(W,_,A,L,$){var U=W[_],re=V(U);if(re!=="object")return new f("Invalid "+L+" `"+$+"` of type `"+re+"` "+("supplied to `"+A+"`, expected `object`."));for(var te in C){var ne=C[te];if(typeof ne!="function")return z(A,L,$,te,G(ne));var le=ne(U,te,A,L,$+"."+te,n);if(le)return le}return null}return D(R)}function F(C){function R(W,_,A,L,$){var U=W[_],re=V(U);if(re!=="object")return new f("Invalid "+L+" `"+$+"` of type `"+re+"` "+("supplied to `"+A+"`, expected `object`."));var te=t({},W[_],C);for(var ne in te){var le=C[ne];if(r(C,ne)&&typeof le!="function")return z(A,L,$,ne,G(le));if(!le)return new f("Invalid "+L+" `"+$+"` key `"+ne+"` supplied to `"+A+"`.\nBad object: "+JSON.stringify(W[_],null," ")+`
159
+ Valid keys: `+JSON.stringify(Object.keys(C),null," "));var Q=le(U,ne,A,L,$+"."+ne,n);if(Q)return Q}return null}return D(R)}function j(C){switch(typeof C){case"number":case"string":case"undefined":return!0;case"boolean":return!C;case"object":if(Array.isArray(C))return C.every(j);if(C===null||o(C))return!0;var R=h(C);if(R){var W=R.call(C),_;if(R!==C.entries){for(;!(_=W.next()).done;)if(!j(_.value))return!1}else for(;!(_=W.next()).done;){var A=_.value;if(A&&!j(A[1]))return!1}}else return!1;return!0;default:return!1}}function M(C,R){return C==="symbol"?!0:R?R["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&R instanceof Symbol:!1}function V(C){var R=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":M(R,C)?"symbol":R}function G(C){if(typeof C>"u"||C===null)return""+C;var R=V(C);if(R==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return R}function J(C){var R=G(C);switch(R){case"array":case"object":return"an "+R;case"boolean":case"date":case"regexp":return"a "+R;default:return R}}function ae(C){return!C.constructor||!C.constructor.name?p:C.constructor.name}return m.checkPropTypes=a,m.resetWarningCache=a.resetWarningCache,m.PropTypes=m,m},ns}var rs,hc;function Ow(){if(hc)return rs;hc=1;var e=To();function t(){}function n(){}return n.resetWarningCache=t,rs=function(){function r(s,o,l,u,c,h){if(h!==e){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}r.isRequired=r;function 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},rs}if(process.env.NODE_ENV!=="production"){var Pw=rh(),Nw=!0;Ns.exports=jw()(Pw.isElement,Nw)}else Ns.exports=Ow()();var Rw=Ns.exports;/*!
160
160
  * tabbable 6.2.0
161
161
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
162
- */var oh=["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])"],$a=oh.join(","),uh=typeof Element>"u",Bn=uh?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,La=!uh&&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},za=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},$w=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},lh=function(t,n,r){if(za(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll($a));return n&&Bn.call(t,$a)&&a.unshift(t),a=a.filter(r),a},ch=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!za(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var d=Bn.call(s,$a);d&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var f=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!za(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(f&&p){var m=e(f===!0?s.children:f.children,!0,r);r.flatten?a.push.apply(a,m):a.push({scopeParent:s,candidates:m})}else i.unshift.apply(i,s.children)}}return a},dh=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},nn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||$w(t))&&!dh(t)?0:t.tabIndex},Lw=function(t,n){var r=nn(t);return r<0&&n&&!dh(t)?0:r},zw=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},fh=function(t){return t.tagName==="INPUT"},qw=function(t){return fh(t)&&t.type==="hidden"},Ww=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Hw=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Uw=function(t){if(!t.name)return!0;var n=t.form||La(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=Hw(a,t.form);return!i||i===t},Vw=function(t){return fh(t)&&t.type==="radio"},Kw=function(t){return Vw(t)&&!Uw(t)},Zw=function(t){var n,r=t&&La(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,d,f;r=La(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((d=a)!==null&&d!==void 0&&(f=d.ownerDocument)!==null&&f!==void 0&&f.contains(a))}}return i},gc=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},Yw=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Bn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Bn.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=La(t);if(l&&!l.shadowRoot&&a(l)===!0)return gc(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(Zw(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return gc(t);return!1},Gw=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 Bn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},qa=function(t,n){return!(n.disabled||za(n)||qw(n)||Yw(n,t)||Ww(n)||Gw(n))},Is=function(t,n){return!(Kw(n)||nn(n)<0||!qa(t,n))},Qw=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Jw=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=Lw(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(zw).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},hh=function(t,n){n=n||{};var r;return n.getShadowRoot?r=ch([t],n.includeContainer,{filter:Is.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Qw}):r=lh(t,n.includeContainer,Is.bind(null,n)),Jw(r)},mh=function(t,n){n=n||{};var r;return n.getShadowRoot?r=ch([t],n.includeContainer,{filter:qa.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=lh(t,n.includeContainer,qa.bind(null,n)),r},mn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Bn.call(t,$a)===!1?!1:Is(n,t)},Xw=oh.concat("iframe").join(","),wa=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Bn.call(t,Xw)===!1?!1:qa(n,t)};const eE=Object.freeze(Object.defineProperty({__proto__:null,focusable:mh,getTabIndex:nn,isFocusable:wa,isTabbable:mn,tabbable:hh},Symbol.toStringTag,{value:"Module"}));/*!
162
+ */var ih=["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])"],Ma=ih.join(","),sh=typeof Element>"u",Bn=sh?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ia=!sh&&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},$a=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},Mw=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},oh=function(t,n,r){if($a(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(Ma));return n&&Bn.call(t,Ma)&&a.unshift(t),a=a.filter(r),a},uh=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!$a(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=Bn.call(s,Ma);c&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var h=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!$a(h,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(h&&p){var m=e(h===!0?s.children:h.children,!0,r);r.flatten?a.push.apply(a,m):a.push({scopeParent:s,candidates:m})}else i.unshift.apply(i,s.children)}}return a},lh=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},nn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Mw(t))&&!lh(t)?0:t.tabIndex},Iw=function(t,n){var r=nn(t);return r<0&&n&&!lh(t)?0:r},$w=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},ch=function(t){return t.tagName==="INPUT"},Lw=function(t){return ch(t)&&t.type==="hidden"},zw=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},qw=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Ww=function(t){if(!t.name)return!0;var n=t.form||Ia(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=qw(a,t.form);return!i||i===t},Hw=function(t){return ch(t)&&t.type==="radio"},Uw=function(t){return Hw(t)&&!Ww(t)},Vw=function(t){var n,r=t&&Ia(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=Ia(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},mc=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},Kw=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Bn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Bn.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=Ia(t);if(l&&!l.shadowRoot&&a(l)===!0)return mc(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(Vw(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return mc(t);return!1},Zw=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 Bn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},La=function(t,n){return!(n.disabled||$a(n)||Lw(n)||Kw(n,t)||zw(n)||Zw(n))},Rs=function(t,n){return!(Uw(n)||nn(n)<0||!La(t,n))},Yw=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Gw=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=Iw(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($w).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},dh=function(t,n){n=n||{};var r;return n.getShadowRoot?r=uh([t],n.includeContainer,{filter:Rs.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Yw}):r=oh(t,n.includeContainer,Rs.bind(null,n)),Gw(r)},fh=function(t,n){n=n||{};var r;return n.getShadowRoot?r=uh([t],n.includeContainer,{filter:La.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=oh(t,n.includeContainer,La.bind(null,n)),r},mn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Bn.call(t,Ma)===!1?!1:Rs(n,t)},Qw=ih.concat("iframe").join(","),Ca=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Bn.call(t,Qw)===!1?!1:La(n,t)};const Jw=Object.freeze(Object.defineProperty({__proto__:null,focusable:fh,getTabIndex:nn,isFocusable:Ca,isTabbable:mn,tabbable:dh},Symbol.toStringTag,{value:"Module"}));/*!
163
163
  * focus-trap 7.5.4
164
164
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
165
- */function vc(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 bc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vc(Object(n),!0).forEach(function(r){tE(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function tE(e,t,n){return t=rE(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nE(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 rE(e){var t=nE(e,"string");return typeof t=="symbol"?t:String(t)}var yc={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()}},aE=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},iE=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},_r=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},sE=function(t){return _r(t)&&!t.shiftKey},oE=function(t){return _r(t)&&t.shiftKey},Dc=function(t){return setTimeout(t,0)},Cc=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},mr=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},la=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},uE=[],lE=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||uE,i=bc({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:sE,isKeyBackward:oE},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(E,F,j){return E&&E[F]!==void 0?E[F]:i[j||F]},u=function(E,F){var j=typeof(F==null?void 0:F.composedPath)=="function"?F.composedPath():void 0;return s.containerGroups.findIndex(function(M){var V=M.container,G=M.tabbableNodes;return V.contains(E)||(j==null?void 0:j.includes(V))||G.find(function(J){return J===E})})},d=function(E){var F=i[E];if(typeof F=="function"){for(var j=arguments.length,M=new Array(j>1?j-1:0),V=1;V<j;V++)M[V-1]=arguments[V];F=F.apply(void 0,M)}if(F===!0&&(F=void 0),!F){if(F===void 0||F===!1)return F;throw new Error("`".concat(E,"` was specified but was not a node, or did not return a node"))}var G=F;if(typeof F=="string"&&(G=r.querySelector(F),!G))throw new Error("`".concat(E,"` as selector refers to no known node"));return G},f=function(){var E=d("initialFocus");if(E===!1)return!1;if(E===void 0||!wa(E,i.tabbableOptions))if(u(r.activeElement)>=0)E=r.activeElement;else{var F=s.tabbableGroups[0],j=F&&F.firstTabbableNode;E=j||d("fallbackFocus")}if(!E)throw new Error("Your focus-trap needs to have at least one focusable element");return E},p=function(){if(s.containerGroups=s.containers.map(function(E){var F=hh(E,i.tabbableOptions),j=mh(E,i.tabbableOptions),M=F.length>0?F[0]:void 0,V=F.length>0?F[F.length-1]:void 0,G=j.find(function(C){return mn(C)}),J=j.slice().reverse().find(function(C){return mn(C)}),ae=!!F.find(function(C){return nn(C)>0});return{container:E,tabbableNodes:F,focusableNodes:j,posTabIndexesFound:ae,firstTabbableNode:M,lastTabbableNode:V,firstDomTabbableNode:G,lastDomTabbableNode:J,nextTabbableNode:function(R){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,B=F.indexOf(R);return B<0?W?j.slice(j.indexOf(R)+1).find(function(A){return mn(A)}):j.slice(0,j.indexOf(R)).reverse().find(function(A){return mn(A)}):F[B+(W?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(E){return E.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(E){return E.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},m=function z(E){var F=E.activeElement;if(F)return F.shadowRoot&&F.shadowRoot.activeElement!==null?z(F.shadowRoot):F},g=function z(E){if(E!==!1&&E!==m(document)){if(!E||!E.focus){z(f());return}E.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=E,aE(E)&&E.select()}},h=function(E){var F=d("setReturnFocus",E);return F||(F===!1?!1:E)},y=function(E){var F=E.target,j=E.event,M=E.isBackward,V=M===void 0?!1:M;F=F||la(j),p();var G=null;if(s.tabbableGroups.length>0){var J=u(F,j),ae=J>=0?s.containerGroups[J]:void 0;if(J<0)V?G=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:G=s.tabbableGroups[0].firstTabbableNode;else if(V){var C=Cc(s.tabbableGroups,function($){var U=$.firstTabbableNode;return F===U});if(C<0&&(ae.container===F||wa(F,i.tabbableOptions)&&!mn(F,i.tabbableOptions)&&!ae.nextTabbableNode(F,!1))&&(C=J),C>=0){var R=C===0?s.tabbableGroups.length-1:C-1,W=s.tabbableGroups[R];G=nn(F)>=0?W.lastTabbableNode:W.lastDomTabbableNode}else _r(j)||(G=ae.nextTabbableNode(F,!1))}else{var B=Cc(s.tabbableGroups,function($){var U=$.lastTabbableNode;return F===U});if(B<0&&(ae.container===F||wa(F,i.tabbableOptions)&&!mn(F,i.tabbableOptions)&&!ae.nextTabbableNode(F))&&(B=J),B>=0){var A=B===s.tabbableGroups.length-1?0:B+1,L=s.tabbableGroups[A];G=nn(F)>=0?L.firstTabbableNode:L.firstDomTabbableNode}else _r(j)||(G=ae.nextTabbableNode(F))}}else G=d("fallbackFocus");return G},v=function(E){var F=la(E);if(!(u(F,E)>=0)){if(mr(i.clickOutsideDeactivates,E)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}mr(i.allowOutsideClick,E)||E.preventDefault()}},w=function(E){var F=la(E),j=u(F,E)>=0;if(j||F instanceof Document)j&&(s.mostRecentlyFocusedNode=F);else{E.stopImmediatePropagation();var M,V=!0;if(s.mostRecentlyFocusedNode)if(nn(s.mostRecentlyFocusedNode)>0){var G=u(s.mostRecentlyFocusedNode),J=s.containerGroups[G].tabbableNodes;if(J.length>0){var ae=J.findIndex(function(C){return C===s.mostRecentlyFocusedNode});ae>=0&&(i.isKeyForward(s.recentNavEvent)?ae+1<J.length&&(M=J[ae+1],V=!1):ae-1>=0&&(M=J[ae-1],V=!1))}}else s.containerGroups.some(function(C){return C.tabbableNodes.some(function(R){return nn(R)>0})})||(V=!1);else V=!1;V&&(M=y({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(M||s.mostRecentlyFocusedNode||f())}s.recentNavEvent=void 0},_=function(E){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=E;var j=y({event:E,isBackward:F});j&&(_r(E)&&E.preventDefault(),g(j))},x=function(E){if(iE(E)&&mr(i.escapeDeactivates,E)!==!1){E.preventDefault(),o.deactivate();return}(i.isKeyForward(E)||i.isKeyBackward(E))&&_(E,i.isKeyBackward(E))},k=function(E){var F=la(E);u(F,E)>=0||mr(i.clickOutsideDeactivates,E)||mr(i.allowOutsideClick,E)||(E.preventDefault(),E.stopImmediatePropagation())},T=function(){if(s.active)return yc.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Dc(function(){g(f())}):g(f()),r.addEventListener("focusin",w,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",k,{capture:!0,passive:!1}),r.addEventListener("keydown",x,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",w,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",k,!0),r.removeEventListener("keydown",x,!0),o},q=function(E){var F=E.some(function(j){var M=Array.from(j.removedNodes);return M.some(function(V){return V===s.mostRecentlyFocusedNode})});F&&g(f())},N=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(q):void 0,I=function(){N&&(N.disconnect(),s.active&&!s.paused&&s.containers.map(function(E){N.observe(E,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(E){if(s.active)return this;var F=l(E,"onActivate"),j=l(E,"onPostActivate"),M=l(E,"checkCanFocusTrap");M||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,F==null||F();var V=function(){M&&p(),T(),I(),j==null||j()};return M?(M(s.containers.concat()).then(V,V),this):(V(),this)},deactivate:function(E){if(!s.active)return this;var F=bc({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},E);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,I(),yc.deactivateTrap(a,o);var j=l(F,"onDeactivate"),M=l(F,"onPostDeactivate"),V=l(F,"checkCanReturnFocus"),G=l(F,"returnFocus","returnFocusOnDeactivate");j==null||j();var J=function(){Dc(function(){G&&g(h(s.nodeFocusedBeforeActivation)),M==null||M()})};return G&&V?(V(h(s.nodeFocusedBeforeActivation)).then(J,J),this):(J(),this)},pause:function(E){if(s.paused||!s.active)return this;var F=l(E,"onPause"),j=l(E,"onPostPause");return s.paused=!0,F==null||F(),S(),I(),j==null||j(),this},unpause:function(E){if(!s.paused||!s.active)return this;var F=l(E,"onUnpause"),j=l(E,"onPostUnpause");return s.paused=!1,F==null||F(),p(),T(),I(),j==null||j(),this},updateContainerElements:function(E){var F=[].concat(E).filter(Boolean);return s.containers=F.map(function(j){return typeof j=="string"?r.querySelector(j):j}),s.active&&p(),I(),this}},o.updateContainerElements(t),o};const cE=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:lE},Symbol.toStringTag,{value:"Module"})),dE=_c(cE),fE=_c(eE);function tr(e){"@babel/helpers - typeof";return tr=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},tr(e)}function hE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xc(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,ph(r.key),r)}}function mE(e,t,n){return t&&xc(e.prototype,t),n&&xc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function pE(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&&$s(e,t)}function $s(e,t){return $s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},$s(e,t)}function gE(e){var t=bE();return function(){var r=Wa(e),a;if(t){var i=Wa(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return vE(this,a)}}function vE(e,t){if(t&&(tr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return br(e)}function br(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bE(){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 Wa(e){return Wa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Wa(e)}function yE(e,t,n){return t=ph(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ph(e){var t=DE(e,"string");return tr(t)==="symbol"?t:String(t)}function DE(e,t){if(tr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(tr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ca=D,be=Iw,CE=dE,xE=CE.createFocusTrap,wE=fE,EE=wE.isFocusable,Oo=function(e){pE(n,e);var t=gE(n);function n(r){var a;hE(this,n),a=t.call(this,r),yE(br(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var d=arguments.length,f=new Array(d>1?d-1:0),p=1;p<d;p++)f[p-1]=arguments[p];u=u.apply(void 0,f)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var m=u;if(typeof u=="string"){var g;if(m=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!m)throw new Error("`".concat(o,"` as selector refers to no known node"))}return m}),a.handleDeactivate=a.handleDeactivate.bind(br(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(br(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(br(a)),a.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:a.handleDeactivate,onPostDeactivate:a.handlePostDeactivate,clickOutsideDeactivates:a.handleClickOutsideDeactivates},a.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){a.originalOptions[s]=i[s];continue}a.internalOptions[s]=i[s]}return a.outsideClick=null,a.focusTrapElements=r.containerElements||[],a.updatePreviousElement(),a}return mE(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&&!EE(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,d=u===void 0?!1:u;l&&o.focus({preventScroll:d}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?ca.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===ca.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var d=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=d||[u]},o=ca.cloneElement(i,{ref:s});return o}return null}}]),n}(ca.Component),pr=typeof Element>"u"?Function:Element;Oo.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(pr),be.string,be.bool,be.func]),fallbackFocus:be.oneOfType([be.instanceOf(pr),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(pr),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(pr)),children:be.oneOfType([be.element,be.instanceOf(pr)])};Oo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:xE};var kE=Oo;const _E=Fn(kE);const Po=({element:e="section",children:t,className:n,...r})=>D.createElement(e,{className:Y("modal",n),children:typeof t=="string"?c.jsx("p",{children:t}):t,...r});const jn=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:d="",gtmContext:f="Modal"})=>{const p=ue.useIntl(),{registerOverlay:m,unregisterOverlay:g}=rd(),[h,y]=D.useState(t),v=D.useRef(null),w=k=>{k.key==="Escape"&&_(!1)};D.useEffect(()=>(window.addEventListener("keyup",w),()=>{window.removeEventListener("keyup",w)}));const _=k=>{if(y(k),k)a(),m(e);else{if(h===k)return;i(),g(e)}};D.useEffect(()=>(_(t),()=>{h&&g(e)}),[t]);const x=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:v,className:Y("overlay",{open:h,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(Po,{id:e,className:Y("overlay-modal",d,{"has-max-width":r}),hidden:!h,style:x,children:t&&c.jsx(_E,{containerElements:[v.current],children:c.jsxs("div",{className:"overlay-content",children:[c.jsxs("div",{className:"top",children:[o&&c.jsx("h2",{className:"modal-title",children:o}),c.jsx(_e,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>_(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":f,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(Kt,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(Kt,{}),c.jsx(ar,{buttons:u})]}),s&&c.jsx(Fr,{className:"error",children:s})]})})})})},gh=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const vh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=ue.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:f}=n,{title:p="",body:m="",mentions:g}=r||{},h="discussion-form-modal";return c.jsx(jn,{id:h,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(p!==""||m!=="")&&l(y=>({...y,showCachedText:!0})),o()}},className:Y("discussion-form-modal",a),children:c.jsx(zr,{...n,data:{...u,mentions:g||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${h}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:m||(d==null?void 0:d.isPrepopulated)!==!1&&(d==null?void 0:d.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...f,onChange:y=>{l(v=>({...v,...y}))},onMention:({id:y,name:v}={})=>{if(!y||!v)return;const w=g||{};w[y]={created_at:"",updated_at:"",id:y,data:{name:v}},l(_=>({..._,mentions:w}))},create:async y=>{o(),f.create&&await f.create(y),l({showCachedText:!1})},handleSaveEdit:async y=>{o(),f.handleSaveEdit&&await f.handleSaveEdit(y),l({showCachedText:!1})}}})})},BE=Object.freeze(Object.defineProperty({__proto__:null,default:vh},Symbol.toStringTag,{value:"Module"}));const FE=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const d=ue.useIntl();return r||(r=d.formatMessage({id:"inviteModal_formTitle"})),a||(a=d.formatMessage({id:"inviteModal_formLabel"})),i||(i=d.formatMessage({id:"inviteModal_cta"})),c.jsx(jn,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:Y("invite-modal",e,{success:!!n}),children:c.jsx(zf,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const AE=({members:e})=>{const[t,n]=D.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return c.jsxs(c.Fragment,{children:[c.jsx(Yt,{name:i,src:l}),c.jsx("p",{children:i}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(a=>c.jsx("li",{children:c.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),c.jsx(jn,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(xn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const TE=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:Y("testimonial-block",a),children:[c.jsx(Rt,{className:"testimonial",children:n}),r?c.jsx(wn,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:Y("author",{"text-small":!a.includes("new")}),children:e}),t&&c.jsx("p",{className:Y("author-cite",{"text-small":!a.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),SE=D.memo(TE);const jE=({items:e=[],selector:t="",className:n=""})=>{const r=ue.useIntl(),[a,i]=D.useState(e);return D.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&c.jsxs(Mt,{variant:"subtle",className:Y("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:a.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const si=({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=d=>{const f=d/60,p=Math.floor(f),m=(f-p)*60,g=Math.round(m),h=`${i.formatMessage({id:`${s}hours`},{time:p})}${p>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${p>0?`${i.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:h}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:f}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:f})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:Y("time-to-complete",a),"aria-label":u,children:l})};const OE=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",c.jsx(ir,{...n,className:Y("banner",e),image:{...t,aspect:"banner"}})):null;const PE=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],NE=({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,h;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],f={eyebrow:"small",title:"h1",text:"p"},p={};d.forEach(y=>{if(!t[y]){p[y]=!1;return}if(!s[y]){if(typeof t[y]=="object"){p[y]=t[y];const{text:v,element:w}=t[y];if(w&&PE.includes(w.toLowerCase()))return;p[y]={text:v,element:f[y]};return}p[y]={text:t[y],element:f[y]}}});const m=o&&o.text&&o.link;return m&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=y=>{y.preventDefault(),y.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),c.jsx(fn,{className:Y("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":m,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(y=>{if(p[y]&&typeof p[y]=="object"){const{text:v,element:w=""}=p[y];return y==="text"?c.jsx(xn,{overrideType:"text-only",className:"text",children:v},y):D.createElement(w,{key:y,className:y},v)}return null}),l,m&&c.jsx(_e,{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]:(h=o.props)==null?void 0:h.className}),children:o.text})]}),n&&c.jsx(ir,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},RE=D.memo(NE);const ME=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(fn,{className:Y("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const IE=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(xn,{children:n}):n;return c.jsxs(fn,{className:Y("highlight-section",t),children:[r&&c.jsx("div",{className:Y("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(ir,{image:{...r,description:""}})}),c.jsx("div",{className:Y("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:Y("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:c.jsx("div",{className:"content-default",children:a})})})]})},$E=D.memo(IE);const LE=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:c.jsxs("aside",{className:Y("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(_e,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),zE=({type:e,data:t})=>{const n=ue.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const f=a&&cs(a);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):Ws(d)});if(o)return c.jsx(gn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const f=u&&cs(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})})]})}return null},Ha={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"}},qE=({data:e,cta:t,link:n,gtmContext:r})=>{var h,y;const a=ue.useIntl(),[i,s]=D.useState({loading:!1,registered:e.registered||!1});D.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:f}=e,p=e.contentType;let m="";if((h=Ha[p])!=null&&h.gtmEvent&&(m=Ha[p].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?c.jsx(_e,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(p)&&d!=="premium"){const v=i.loading||i.registered||((y=e==null?void 0:e.members)==null?void 0:y.isMember),w=async _=>{if(_.preventDefault(),_.stopPropagation(),!(v||!t||!t.onClick)){s(x=>({...x,loading:!0}));try{const x=await t.onClick(e);s(x==="success"?()=>({registered:!0,loading:!1}):k=>({...k,loading:!1}))}catch{s(k=>({...k,loading:!1}))}}};return c.jsx("p",{className:Y("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(_e,{onClick:w,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${p}: ${f}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${p}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const WE={title:66,text:3e3,secondaryText:1e3,partner:25},No=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s,setFocus:o=!1})=>{var z,E,F,j,M;const l=ue.useIntl(),u=D.useContext(Lt),d=u&&typeof u.id=="string",f=D.useRef(null),[p,m]=D.useState({data:null,isLoading:!0}),{data:g,isLoading:h}=p,y=D.useCallback(()=>{n(t,d).then(V=>{m(()=>({data:V,isLoading:!1}))}).catch(()=>m(V=>({...V,isLoading:!1})))},[e]);if(D.useEffect(()=>{y()},[]),h||!g)return c.jsx(kt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:l.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:v}=g;if(!v||!Ha[v])return c.jsx(kt,{element:"li",className:"card-wrapper"});const{basePath:w="",className:_,length:x,gtmEvent:k}=Ha[v];let T=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")&&(T=g.slug);const S=V=>{T&&(V.preventDefault(),V.stopPropagation(),window.location.href=T)},q={...WE,...x};let N={className:"card"},I={};return T&&(I={href:T,className:"gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${k}-click`,"data-testid":"link"},g.openInNewTab&&(I.target="_blank"),N={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${k}-click`}),o&&(N={...N,tabIndex:"0"},(z=f==null?void 0:f.current)==null||z.focus(),(E=f==null?void 0:f.current)==null||E.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:Y("card-wrapper text-medium",_,i,{"has-link":T,"no-link":!T,"has-image":g.banner}),"data-testid":`${v}-card`,children:c.jsxs("div",{...N,ref:f,children:[c.jsx(Uc,{className:"card-label",contentType:v,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),v==="communityPage"&&(g==null?void 0:g.createdAt)&&qh(g==null?void 0:g.createdAt,60)&&c.jsx(gn,{size:"small",variant:"information","data-testid":"new-community",children:l.formatMessage({id:"card_new"})}),g.startDate&&!g.isOngoingEvent&&c.jsx(gn,{size:"small",variant:g.dateHasPassed?"default":"information","data-testid":"date",children:g.dateHasPassed?l.formatMessage({id:"card_ended"}):Lc(g.startDate)}),g.banner?c.jsxs("p",{className:"img",children:[g.registered&&c.jsx(gn,{size:"small",variant:"registered",children:l.formatMessage({id:"card_registered"})}),c.jsx(ir,{image:{...g.banner,description:""}})]}):_==="people"?c.jsx(Yt,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&c.jsx(Vs,{contributors:{data:g.contributors},styling:{size:"small",showGap:_!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(v)?l.formatMessage({id:`card_contributors_${v}`}):void 0,"data-testid":"contributors"}),g.partner&&c.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}):Yn(g.partner[0],q.partner)}),["title","text","secondaryText"].map(V=>{const G=g[V];if(!G)return null;const J=Pc(V),ae={key:V,className:J,"data-testid":J},C={wrapper:"p",forceWrapper:!0,forceInline:!0},R=Yn(G,q[V]);return["title","text"].includes(V)&&T?(C.wrapper="a",c.jsx("p",{...ae,children:c.jsx(Rt,{options:C,...I,children:R})})):c.jsx(Rt,{options:C,...ae,children:R})}),(u==null?void 0:u.id)&&(g==null?void 0:g.members)&&c.jsxs("span",{className:"member-information",children:[((F=g==null?void 0:g.members)==null?void 0:F.isMember)&&c.jsx(gn,{size:"small",variant:"registered",icon:((j=g==null?void 0:g.members)==null?void 0:j.memberType)==="owner"?"user":"tick",children:l.formatMessage({id:`card_member_type_${(M=g==null?void 0:g.members)==null?void 0:M.memberType}`})}),c.jsx("br",{}),c.jsx("span",{className:"label member-count",children:l.formatMessage({id:"card_member_count"},{count:g==null?void 0:g.members.count})})]}),c.jsx(zE,{type:_||"",data:g}),c.jsx(qE,{data:g,cta:r,link:T||"",gtmContext:a})]})})};const bh=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:Y("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return c.jsx(No,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),HE=(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},UE=({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 D.createElement(a,{className:Y("title",i,s,{"highlighted-title":i==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const ss={fourCards:1024,threeCards:769,twoCards:480};let da=null;const VE=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ue.useIntl(),[u,d]=D.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:f,isLoading:p}=u,[m,g]=D.useState({currentPage:0,loadedPages:[0]}),{currentPage:h,loadedPages:y}=m,[v,w]=D.useState(""),_=t.length,x=Math.ceil(_/f),k=D.useRef(null),T=nr(!0,!0,k==null?void 0:k.current);D.useEffect(()=>{let E=1;T&&(T>=ss.fourCards?E=4:T>=ss.threeCards?E=3:T>=ss.twoCards&&(E=2),E>_&&(E=_)),d(F=>({...F,cardsPerPage:E,isLoading:!1}))},[T,_]);const S=(E="next")=>{let F=h;if(typeof E=="string")if(E==="next")if(h<x-1)F=h+1;else return;else if(h>0)F=h-1;else return;else F=E;g(M=>({...M,currentPage:F,loadedPages:[...new Set([...y,F])]}));const j=()=>{const M=F*u.cardsPerPage,V=M+u.cardsPerPage;return t.slice(M,V).length};w(l.formatMessage({id:"carousel_pagination_aria_live"},{direction:E,count:j()}))},q=E=>{da=E.touches[0].clientX},N=E=>{if(da===null)return;const F=E.touches[0].clientX,j=da-F;j>5?S("next"):j<-5&&S("previous"),da=null},I={"--width":`${T||0}px`,"--total-cards":_,"--cards-per-page":f,"--page":h};if(p)return c.jsx(Us,{layout:`carousel${a?"-with-title":""}`});const z=(E,F)=>{var M;let j=null;return(M=E==null?void 0:E.sys)!=null&&M.id?j=`card-${E.sys.id}`:E!=null&&E.slug?j=`card-${E.slug}`:[n[F],E.contentType].includes("customCard")&&(j=`card-${window.btoa(`${E.title} ${E.createdAt}`)}-${F}`),j};return c.jsxs("section",{ref:k,className:Y("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(UE,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:q,onTouchMove:N,style:I,"data-testid":"carousel-list",children:t.map((E,F)=>{let j=z(E,F);return j&&HE(F,f,h,y)?c.jsx(No,{id:j,card:{...E,contentType:n[F]},buildCardData:r,gtmContext:s,...o},j):(j=j||`${e}-card-${F}`,c.jsx(kt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},j))})}),x<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(_e,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:E=>{E.preventDefault(),E.stopPropagation(),S("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:h<=0})}),[...Array(x)].map((E,F)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:Y("page-indicator",{selected:F===h}),onClick:j=>{j.preventDefault(),j.stopPropagation(),S(F)},children:c.jsx(Ie,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:F+1,total:x})})})},`page-indicator-${F}`)),c.jsx("li",{className:"arrow next",children:c.jsx(_e,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:E=>{E.preventDefault(),E.stopPropagation(),S("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:h>=x-1})})]}),c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:v})]})]})},KE=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=i?window.btoa(i):`carousel-${u}`,f=u===e.length-1;return t?c.jsxs(D.Fragment,{children:[c.jsx(Us,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),f?null:c.jsx(Kt,{})]},`placeholder-${d}`):c.jsxs(D.Fragment,{children:[c.jsx(VE,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),f?null:c.jsx(Kt,{})]},`carousel-${d}`)});const ZE=({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:d=!1}=s;return D.createElement(e,{className:Y("course-progression",o,{"highlight-percentage":d,"has-circle-graph":i==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:f=>c.jsx("strong",{children:f}),number:u})}),u<100&&a&&c.jsx(si,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(Hs,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const yh=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>D.createElement(e,{className:Y("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Dh=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ue.useIntl(),o=Va(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Rc(a||"");return c.jsxs("small",{className:Y("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:Y("type",n),children:o})," ",t>0&&!r&&c.jsx(si,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const YE=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const f=ue.useIntl(),p="courseStructure_",m=u.toLowerCase().includes("course conclusion");return c.jsxs(Za,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[f.formatMessage({id:`${p}section${m?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?f.formatMessage({id:`${p}time_completed`}):c.jsx(si,{time:s,appendedText:a?f.formatMessage({id:`${p}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:h,contentType:y,icon:v,image:w,isIntroduction:_,optional:x,slug:k,subsectionId:T,title:S,type:q})=>{const N=a&&t||_,I={};return w&&(I.style={"--image":`url(${w})`}),c.jsx("li",{className:Y({article:y===gr.ARTICLE,discussion:y===gr.DISCUSSION,quiz:y===gr.QUIZ,completed:g&&y===gr.ARTICLE,locked:!N}),...I,children:c.jsx(Tn,{href:N?`/microcourses/en/${o}/${k}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Nc(S)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(yh,{sectionId:i,subsectionId:T,title:S,className:"course-title"})," ",c.jsx(Dh,{completionTime:h,icon:v,optional:x,type:q,children:d&&d[k]&&c.jsx("span",{className:"quiz-score",children:`${d[k]}%`})})]})})},k)})})]})};const GE=({isComplete:e=!1,onClick:t,...n})=>{const r=ue.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(_e,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className: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":""}`})})},QE=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),wc=[{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 fa="notFoundError_",JE=()=>{const e=ue.useIntl(),t=[];return wc.forEach((n,r)=>{n.title=e.formatMessage({id:`${fa}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(Uf,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(fn,{children:[c.jsx(bh,{cards:wc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(_e,{href:"/solution-articles/",children:e.formatMessage({id:`${fa}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${fa}title`})}),c.jsx("p",{children:e.formatMessage({id:`${fa}text`})})]})};exports.ASSETS_BUCKET=It;exports.ActivitiesFeed=cw;exports.ActivitySection=Aw;exports.AddPost=Ao;exports.Banner=OE;exports.BannerSection=RE;exports.Breadcrumbs=km;exports.Buckets=rm;exports.Button=_e;exports.ButtonWrapper=ar;exports.COURSE_CONTENT_TYPES=gr;exports.CacheProvider=Jc;exports.Card=No;exports.CardBlock=bh;exports.Carousel=KE;exports.CharacterLimit=Js;exports.CollapsibleSection=Za;exports.Columns=od;exports.CommunityDetails=Em;exports.ContactFooter=kx;exports.ContactForm=Lf;exports.ContentTypeLabel=Uc;exports.Contributors=Vs;exports.ConversationContext=ii;exports.CookieBanner=Hf;exports.CourseProgression=ZE;exports.CourseStructure=YE;exports.CustomContentBanner=ME;exports.Directory=AE;exports.DiscussionConversation=Vf;exports.DiscussionForm=zr;exports.DiscussionFormCard=Zf;exports.DiscussionFormModal=vh;exports.DiscussionLikes=Kf;exports.DiscussionPost=qr;exports.DiscussionThread=Gf;exports.Divider=Kt;exports.DownloadSection=Cx;exports.EMAILS=Ln;exports.EditSection=wx;exports.EmailHelperTextBox=ld;exports.EmptyStateBox=un;exports.FeatureFlags=Ks;exports.Filters=_m;exports.FlagsProvider=ed;exports.Footer=_o;exports.Form=ln;exports.Formatting=Z;exports.Fragment=Ct;exports.FullWidthSection=fn;exports.GET_STREAM_USER_PREFIX=ls;exports.GlobalProviders=wm;exports.Header=Bo;exports.HelperTextBox=Kc;exports.HiddenFromScreenReaders=Ua;exports.HideShowTextBox=Zc;exports.HighlightSection=$E;exports.HighlightedTextBox=Mt;exports.INVALID_TOKEN=Mc;exports.IconBulletedList=sm;exports.ImageContainer=em;exports.IntlProvider=td;exports.InviteForm=zf;exports.InviteModal=FE;exports.JoinButton=Gs;exports.LanguageContext=Zs;exports.LanguageSwitcher=Fm;exports.LessonName=yh;exports.LessonType=Dh;exports.Link=Tn;exports.LoadMore=$r;exports.LoadingBlock=vm;exports.LoadingPlaceholder=kt;exports.LoadingState=Us;exports.Logo=Qs;exports.LogoSection=Ex;exports.MENTION_REGEX=Ic;exports.MarkCompleteButton=GE;exports.MarkdownText=xn;exports.MarketingBlock=LE;exports.Marks=Nt;exports.Member=wn;exports.MembersList=Sx;exports.Modal=Po;exports.MoreMenu=id;exports.NUMBER_OF_COUNTRIES=Lh;exports.NUMBER_OF_USERS=$h;exports.NavigationMenu=sd;exports.NotFoundError=JE;exports.Overlay=jn;exports.OverlayContext=Ys;exports.OverlayProvider=ad;exports.PageHeading=Yc;exports.PageLayout=Uf;exports.PasswordForm=mx;exports.PasswordRules=md;exports.Pill=gn;exports.Popover=Hc;exports.Portal=Ka;exports.ProfileImageChange=hx;exports.ProfilePicture=Yt;exports.ProgressBar=Hs;exports.ProgressTracker=tm;exports.Rating=Vm;exports.RepliesFeed=ah;exports.ResponsesHeading=Yf;exports.ResponsiveImage=ir;exports.ReturnToNavButton=nm;exports.RichTextEditor=$f;exports.SearchForm=qf;exports.ShareLinks=Om;exports.SignupForm=Dx;exports.Span=hs;exports.StatusBanner=Fr;exports.TableOfContents=jE;exports.Tabs=Pm;exports.Tags=Tx;exports.TestimonialBlock=SE;exports.TimeToComplete=si;exports.Toggle=fx;exports.Tooltip=An;exports.TopLevelPage=_x;exports.UUID_V4_REGEX=Br;exports.UserContext=Lt;exports.UserProvider=nd;exports.VisuallyHidden=Ie;exports.addAriaProps=gh;exports.basicReducer=Ir;exports.camelCaseToDashCase=Pc;exports.checkIntlPathExists=Va;exports.generateConditions=xa;exports.generateCssIcon=$c;exports.getCharacterLimitProps=ud;exports.getLongDate=Ws;exports.getMember=Ya;exports.getPostBody=Fo;exports.getShortDate=Lc;exports.getValueLength=Qa;exports.headerData=Mr;exports.mapGetStreamData=QE;exports.pageReady=zc;exports.passwordValidator=ds;exports.repliesFeedMock=dw;exports.supportedLanguages=pa;exports.toCamelCase=Nc;exports.toCapitalisedCase=Ih;exports.toSentenceCase=Rc;exports.useCurrentPath=Fc;exports.useEffectAfterMount=Gn;exports.useElementWidth=nr;exports.useOverlay=rd;exports.useScrollListener=Sc;exports.useScrollToHash=zs;exports.useTooltips=qs;exports.useUser=Ga;
165
+ */function pc(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 gc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pc(Object(n),!0).forEach(function(r){Xw(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Xw(e,t,n){return t=tE(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eE(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 tE(e){var t=eE(e,"string");return typeof t=="symbol"?t:String(t)}var vc={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()}},nE=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},rE=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},_r=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},aE=function(t){return _r(t)&&!t.shiftKey},iE=function(t){return _r(t)&&t.shiftKey},bc=function(t){return setTimeout(t,0)},yc=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},mr=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return typeof t=="function"?t.apply(void 0,r):t},oa=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},sE=[],oE=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||sE,i=gc({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:aE,isKeyBackward:iE},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(w,F,j){return w&&w[F]!==void 0?w[F]:i[j||F]},u=function(w,F){var j=typeof(F==null?void 0:F.composedPath)=="function"?F.composedPath():void 0;return s.containerGroups.findIndex(function(M){var V=M.container,G=M.tabbableNodes;return V.contains(w)||(j==null?void 0:j.includes(V))||G.find(function(J){return J===w})})},c=function(w){var F=i[w];if(typeof F=="function"){for(var j=arguments.length,M=new Array(j>1?j-1:0),V=1;V<j;V++)M[V-1]=arguments[V];F=F.apply(void 0,M)}if(F===!0&&(F=void 0),!F){if(F===void 0||F===!1)return F;throw new Error("`".concat(w,"` was specified but was not a node, or did not return a node"))}var G=F;if(typeof F=="string"&&(G=r.querySelector(F),!G))throw new Error("`".concat(w,"` as selector refers to no known node"));return G},h=function(){var w=c("initialFocus");if(w===!1)return!1;if(w===void 0||!Ca(w,i.tabbableOptions))if(u(r.activeElement)>=0)w=r.activeElement;else{var F=s.tabbableGroups[0],j=F&&F.firstTabbableNode;w=j||c("fallbackFocus")}if(!w)throw new Error("Your focus-trap needs to have at least one focusable element");return w},p=function(){if(s.containerGroups=s.containers.map(function(w){var F=dh(w,i.tabbableOptions),j=fh(w,i.tabbableOptions),M=F.length>0?F[0]:void 0,V=F.length>0?F[F.length-1]:void 0,G=j.find(function(C){return mn(C)}),J=j.slice().reverse().find(function(C){return mn(C)}),ae=!!F.find(function(C){return nn(C)>0});return{container:w,tabbableNodes:F,focusableNodes:j,posTabIndexesFound:ae,firstTabbableNode:M,lastTabbableNode:V,firstDomTabbableNode:G,lastDomTabbableNode:J,nextTabbableNode:function(R){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=F.indexOf(R);return _<0?W?j.slice(j.indexOf(R)+1).find(function(A){return mn(A)}):j.slice(0,j.indexOf(R)).reverse().find(function(A){return mn(A)}):F[_+(W?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.")},m=function z(w){var F=w.activeElement;if(F)return F.shadowRoot&&F.shadowRoot.activeElement!==null?z(F.shadowRoot):F},g=function z(w){if(w!==!1&&w!==m(document)){if(!w||!w.focus){z(h());return}w.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=w,nE(w)&&w.select()}},f=function(w){var F=c("setReturnFocus",w);return F||(F===!1?!1:w)},D=function(w){var F=w.target,j=w.event,M=w.isBackward,V=M===void 0?!1:M;F=F||oa(j),p();var G=null;if(s.tabbableGroups.length>0){var J=u(F,j),ae=J>=0?s.containerGroups[J]:void 0;if(J<0)V?G=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:G=s.tabbableGroups[0].firstTabbableNode;else if(V){var C=yc(s.tabbableGroups,function($){var U=$.firstTabbableNode;return F===U});if(C<0&&(ae.container===F||Ca(F,i.tabbableOptions)&&!mn(F,i.tabbableOptions)&&!ae.nextTabbableNode(F,!1))&&(C=J),C>=0){var R=C===0?s.tabbableGroups.length-1:C-1,W=s.tabbableGroups[R];G=nn(F)>=0?W.lastTabbableNode:W.lastDomTabbableNode}else _r(j)||(G=ae.nextTabbableNode(F,!1))}else{var _=yc(s.tabbableGroups,function($){var U=$.lastTabbableNode;return F===U});if(_<0&&(ae.container===F||Ca(F,i.tabbableOptions)&&!mn(F,i.tabbableOptions)&&!ae.nextTabbableNode(F))&&(_=J),_>=0){var A=_===s.tabbableGroups.length-1?0:_+1,L=s.tabbableGroups[A];G=nn(F)>=0?L.firstTabbableNode:L.firstDomTabbableNode}else _r(j)||(G=ae.nextTabbableNode(F))}}else G=c("fallbackFocus");return G},v=function(w){var F=oa(w);if(!(u(F,w)>=0)){if(mr(i.clickOutsideDeactivates,w)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}mr(i.allowOutsideClick,w)||w.preventDefault()}},E=function(w){var F=oa(w),j=u(F,w)>=0;if(j||F instanceof Document)j&&(s.mostRecentlyFocusedNode=F);else{w.stopImmediatePropagation();var M,V=!0;if(s.mostRecentlyFocusedNode)if(nn(s.mostRecentlyFocusedNode)>0){var G=u(s.mostRecentlyFocusedNode),J=s.containerGroups[G].tabbableNodes;if(J.length>0){var ae=J.findIndex(function(C){return C===s.mostRecentlyFocusedNode});ae>=0&&(i.isKeyForward(s.recentNavEvent)?ae+1<J.length&&(M=J[ae+1],V=!1):ae-1>=0&&(M=J[ae-1],V=!1))}}else s.containerGroups.some(function(C){return C.tabbableNodes.some(function(R){return nn(R)>0})})||(V=!1);else V=!1;V&&(M=D({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(M||s.mostRecentlyFocusedNode||h())}s.recentNavEvent=void 0},B=function(w){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=w;var j=D({event:w,isBackward:F});j&&(_r(w)&&w.preventDefault(),g(j))},x=function(w){if(rE(w)&&mr(i.escapeDeactivates,w)!==!1){w.preventDefault(),o.deactivate();return}(i.isKeyForward(w)||i.isKeyBackward(w))&&B(w,i.isKeyBackward(w))},k=function(w){var F=oa(w);u(F,w)>=0||mr(i.clickOutsideDeactivates,w)||mr(i.allowOutsideClick,w)||(w.preventDefault(),w.stopImmediatePropagation())},T=function(){if(s.active)return vc.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?bc(function(){g(h())}):g(h()),r.addEventListener("focusin",E,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",k,{capture:!0,passive:!1}),r.addEventListener("keydown",x,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",E,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",k,!0),r.removeEventListener("keydown",x,!0),o},q=function(w){var F=w.some(function(j){var M=Array.from(j.removedNodes);return M.some(function(V){return V===s.mostRecentlyFocusedNode})});F&&g(h())},N=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(q):void 0,I=function(){N&&(N.disconnect(),s.active&&!s.paused&&s.containers.map(function(w){N.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 F=l(w,"onActivate"),j=l(w,"onPostActivate"),M=l(w,"checkCanFocusTrap");M||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,F==null||F();var V=function(){M&&p(),T(),I(),j==null||j()};return M?(M(s.containers.concat()).then(V,V),this):(V(),this)},deactivate:function(w){if(!s.active)return this;var F=gc({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(),vc.deactivateTrap(a,o);var j=l(F,"onDeactivate"),M=l(F,"onPostDeactivate"),V=l(F,"checkCanReturnFocus"),G=l(F,"returnFocus","returnFocusOnDeactivate");j==null||j();var J=function(){bc(function(){G&&g(f(s.nodeFocusedBeforeActivation)),M==null||M()})};return G&&V?(V(f(s.nodeFocusedBeforeActivation)).then(J,J),this):(J(),this)},pause:function(w){if(s.paused||!s.active)return this;var F=l(w,"onPause"),j=l(w,"onPostPause");return s.paused=!0,F==null||F(),S(),I(),j==null||j(),this},unpause:function(w){if(!s.paused||!s.active)return this;var F=l(w,"onUnpause"),j=l(w,"onPostUnpause");return s.paused=!1,F==null||F(),p(),T(),I(),j==null||j(),this},updateContainerElements:function(w){var F=[].concat(w).filter(Boolean);return s.containers=F.map(function(j){return typeof j=="string"?r.querySelector(j):j}),s.active&&p(),I(),this}},o.updateContainerElements(t),o};const uE=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:oE},Symbol.toStringTag,{value:"Module"})),lE=Ec(uE),cE=Ec(Jw);function er(e){"@babel/helpers - typeof";return er=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},er(e)}function dE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Dc(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,hh(r.key),r)}}function fE(e,t,n){return t&&Dc(e.prototype,t),n&&Dc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function hE(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ms(e,t)}function Ms(e,t){return Ms=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Ms(e,t)}function mE(e){var t=gE();return function(){var r=za(e),a;if(t){var i=za(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return pE(this,a)}}function pE(e,t){if(t&&(er(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return br(e)}function br(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gE(){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 za(e){return za=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},za(e)}function vE(e,t,n){return t=hh(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hh(e){var t=bE(e,"string");return er(t)==="symbol"?t:String(t)}function bE(e,t){if(er(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(er(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ua=y,be=Rw,yE=lE,DE=yE.createFocusTrap,CE=cE,xE=CE.isFocusable,So=function(e){hE(n,e);var t=mE(n);function n(r){var a;dE(this,n),a=t.call(this,r),vE(br(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var c=arguments.length,h=new Array(c>1?c-1:0),p=1;p<c;p++)h[p-1]=arguments[p];u=u.apply(void 0,h)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var m=u;if(typeof u=="string"){var g;if(m=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!m)throw new Error("`".concat(o,"` as selector refers to no known node"))}return m}),a.handleDeactivate=a.handleDeactivate.bind(br(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(br(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(br(a)),a.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:a.handleDeactivate,onPostDeactivate:a.handlePostDeactivate,clickOutsideDeactivates:a.handleClickOutsideDeactivates},a.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){a.originalOptions[s]=i[s];continue}a.internalOptions[s]=i[s]}return a.outsideClick=null,a.focusTrapElements=r.containerElements||[],a.updatePreviousElement(),a}return fE(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&&!xE(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?ua.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===ua.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var c=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=c||[u]},o=ua.cloneElement(i,{ref:s});return o}return null}}]),n}(ua.Component),pr=typeof Element>"u"?Function:Element;So.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(pr),be.string,be.bool,be.func]),fallbackFocus:be.oneOfType([be.instanceOf(pr),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(pr),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(pr)),children:be.oneOfType([be.element,be.instanceOf(pr)])};So.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:DE};var wE=So;const EE=Fn(wE);const jo=({element:e="section",children:t,className:n,...r})=>y.createElement(e,{className:Y("modal",n),children:typeof t=="string"?d.jsx("p",{children:t}):t,...r});const sr=({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 p=ue.useIntl(),{registerOverlay:m,unregisterOverlay:g}=td(),[f,D]=y.useState(t),v=y.useRef(null),E=k=>{k.key==="Escape"&&B(!1)};y.useEffect(()=>(window.addEventListener("keyup",E),()=>{window.removeEventListener("keyup",E)}));const B=k=>{if(D(k),k)a(),m(e);else{if(f===k)return;i(),g(e)}};y.useEffect(()=>(B(t),()=>{f&&g(e)}),[t]);const x=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{id:`${e}-overlay`,ref:v,className:Y("overlay",{open:f,"in-portal":c.includes("in-portal")}),role:"dialog",children:d.jsx(jo,{id:e,className:Y("overlay-modal",c,{"has-max-width":r}),hidden:!f,style:x,children:t&&d.jsx(EE,{containerElements:[v.current],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(_e,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>B(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":h,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&d.jsx(Kt,{}),l,u&&d.jsxs("div",{className:"bottom",children:[d.jsx(Kt,{}),d.jsx(rr,{buttons:u})]}),s&&d.jsx(Fr,{className:"error",children:s})]})})})})},mh=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const ph=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=ue.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:c,functions:h}=n,{title:p="",body:m="",mentions:g}=r||{},f="discussion-form-modal";return d.jsx(sr,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{l(D=>({...D,showCachedText:!0})),o()}},className:Y("discussion-form-modal",a),children:d.jsx(zr,{...n,data:{...u,mentions:g||(u==null?void 0:u.mentions)},meta:{...c,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:m||(c==null?void 0:c.isPrepopulated)!==!1&&(c==null?void 0:c.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...h,onChange:D=>{l(v=>({...v,...D}))},onMention:({id:D,name:v}={})=>{if(!D||!v)return;const E=g||{};E[D]={created_at:"",updated_at:"",id:D,data:{name:v}},l(B=>({...B,mentions:E}))},create:async D=>{o(),h.create&&await h.create(D),l({showCachedText:!1})},handleSaveEdit:async D=>{o(),h.handleSaveEdit&&await h.handleSaveEdit(D),l({showCachedText:!1})}}})})},kE=Object.freeze(Object.defineProperty({__proto__:null,default:ph},Symbol.toStringTag,{value:"Module"}));const _E=({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(sr,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:Y("invite-modal",e,{success:!!n}),children:d.jsx($f,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const BE=({members:e})=>{const[t,n]=y.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return d.jsxs(d.Fragment,{children:[d.jsx(Yt,{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(sr,{isOpen:t!==!1,children:t===!1?"":d.jsxs(d.Fragment,{children:[r(t),d.jsx(xn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const FE=({author:e,authorCite:t,content:n,member:r,className:a=""})=>d.jsxs("blockquote",{className:Y("testimonial-block",a),children:[d.jsx(Rt,{className:"testimonial",children:n}),r?d.jsx(wn,{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})})]})]}),AE=y.memo(FE);const TE=({items:e=[],selector:t="",className:n=""})=>{const r=ue.useIntl(),[a,i]=y.useState(e);return y.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(Mt,{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 ai=({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,p=Math.floor(h),m=(h-p)*60,g=Math.round(m),f=`${i.formatMessage({id:`${s}hours`},{time:p})}${p>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${p>0?`${i.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text: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 SE=({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(ar,{...n,className:Y("banner",e),image:{...t,aspect:"banner"}})):null;const jE=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],OE=({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"},p={};c.forEach(D=>{if(!t[D]){p[D]=!1;return}if(!s[D]){if(typeof t[D]=="object"){p[D]=t[D];const{text:v,element:E}=t[D];if(E&&jE.includes(E.toLowerCase()))return;p[D]={text:v,element:h[D]};return}p[D]={text:t[D],element:h[D]}}});const m=o&&o.text&&o.link;return m&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=D=>{D.preventDefault(),D.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),d.jsx(fn,{className:Y("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":m,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"content-wrapper",children:[c.map(D=>{if(p[D]&&typeof p[D]=="object"){const{text:v,element:E=""}=p[D];return D==="text"?d.jsx(xn,{overrideType:"text-only",className:"text",children:v},D):y.createElement(E,{key:D,className:D},v)}return null}),l,m&&d.jsx(_e,{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(ar,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},PE=y.memo(OE);const NE=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),d.jsx(fn,{className:Y("custom-content-banner",t,r,{"has-image":e}),style:a,children:d.jsx("div",{className:"content-slim",children:n})})};const RE=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx(xn,{children:n}):n;return d.jsxs(fn,{className:Y("highlight-section",t),children:[r&&d.jsx("div",{className:Y("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:d.jsx(ar,{image:{...r,description:""}})}),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})})})]})},ME=y.memo(RE);const IE=({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(_e,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),$E=({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&&us(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"}):zs(c)});if(o)return d.jsx(gn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&us(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},qa={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"}},LE=({data:e,cta:t,link:n,gtmContext:r})=>{var f,D;const a=ue.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:c,slug:h}=e,p=e.contentType;let m="";if((f=qa[p])!=null&&f.gtmEvent&&(m=qa[p].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":`${m}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?d.jsx(_e,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(p)&&c!=="premium"){const v=i.loading||i.registered||((D=e==null?void 0:e.members)==null?void 0:D.isMember),E=async B=>{if(B.preventDefault(),B.stopPropagation(),!(v||!t||!t.onClick)){s(x=>({...x,loading:!0}));try{const x=await t.onClick(e);s(x==="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(_e,{onClick:E,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${p}: ${h}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${p}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const zE={title:66,text:3e3,secondaryText:1e3,partner:25},Oo=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s,setFocus:o=!1})=>{var z,w,F,j,M;const l=ue.useIntl(),u=y.useContext(Lt),c=u&&typeof u.id=="string",h=y.useRef(null),[p,m]=y.useState({data:null,isLoading:!0}),{data:g,isLoading:f}=p,D=y.useCallback(()=>{n(t,c).then(V=>{m(()=>({data:V,isLoading:!1}))}).catch(()=>m(V=>({...V,isLoading:!1})))},[e]);if(y.useEffect(()=>{D()},[]),f||!g)return d.jsx(kt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:l.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:v}=g;if(!v||!qa[v])return d.jsx(kt,{element:"li",className:"card-wrapper"});const{basePath:E="",className:B,length:x,gtmEvent:k}=qa[v];let T=g.slug?`${E}${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")&&(T=g.slug);const S=V=>{T&&(V.preventDefault(),V.stopPropagation(),window.location.href=T)},q={...zE,...x};let N={className:"card"},I={};return T&&(I={href:T,className:"gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${k}-click`,"data-testid":"link"},g.openInNewTab&&(I.target="_blank"),N={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${k}-click`}),o&&(N={...N,tabIndex:"0"},(z=h==null?void 0:h.current)==null||z.focus(),(w=h==null?void 0:h.current)==null||w.scrollIntoView({behavior:"smooth"})),d.jsx("li",{className:Y("card-wrapper text-medium",B,i,{"has-link":T,"no-link":!T,"has-image":g.banner}),"data-testid":`${v}-card`,children:d.jsxs("div",{...N,ref:h,children:[d.jsx(Wc,{className:"card-label",contentType:v,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),v==="communityPage"&&(g==null?void 0:g.createdAt)&&Lh(g==null?void 0:g.createdAt,60)&&d.jsx(gn,{size:"small",variant:"information","data-testid":"new-community",children:l.formatMessage({id:"card_new"})}),g.startDate&&!g.isOngoingEvent&&d.jsx(gn,{size:"small",variant:g.dateHasPassed?"default":"information","data-testid":"date",children:g.dateHasPassed?l.formatMessage({id:"card_ended"}):Ic(g.startDate)}),g.banner?d.jsxs("p",{className:"img",children:[g.registered&&d.jsx(gn,{size:"small",variant:"registered",children:l.formatMessage({id:"card_registered"})}),d.jsx(ar,{image:{...g.banner,description:""}})]}):B==="people"?d.jsx(Yt,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&d.jsx(Hs,{contributors:{data:g.contributors},styling:{size:"small",showGap:B!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(v)?l.formatMessage({id:`card_contributors_${v}`}):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}):Zn(g.partner[0],q.partner)}),["title","text","secondaryText"].map(V=>{const G=g[V];if(!G)return null;const J=jc(V),ae={key:V,className:J,"data-testid":J},C={wrapper:"p",forceWrapper:!0,forceInline:!0},R=Zn(G,q[V]);return["title","text"].includes(V)&&T?(C.wrapper="a",d.jsx("p",{...ae,children:d.jsx(Rt,{options:C,...I,children:R})})):d.jsx(Rt,{options:C,...ae,children:R})}),(u==null?void 0:u.id)&&(g==null?void 0:g.members)&&d.jsxs("span",{className:"member-information",children:[((F=g==null?void 0:g.members)==null?void 0:F.isMember)&&d.jsx(gn,{size:"small",variant:"registered",icon:((j=g==null?void 0:g.members)==null?void 0:j.memberType)==="owner"?"user":"tick",children:l.formatMessage({id:`card_member_type_${(M=g==null?void 0:g.members)==null?void 0:M.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($E,{type:B||"",data:g}),d.jsx(LE,{data:g,cta:r,link:T||"",gtmContext:a})]})})};const gh=({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(Oo,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),qE=(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},WE=({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 y.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 as={fourCards:1024,threeCards:769,twoCards:480};let la=null;const HE=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ue.useIntl(),[u,c]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:h,isLoading:p}=u,[m,g]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:f,loadedPages:D}=m,[v,E]=y.useState(""),B=t.length,x=Math.ceil(B/h),k=y.useRef(null),T=tr(!0,!0,k==null?void 0:k.current);y.useEffect(()=>{let w=1;T&&(T>=as.fourCards?w=4:T>=as.threeCards?w=3:T>=as.twoCards&&(w=2),w>B&&(w=B)),c(F=>({...F,cardsPerPage:w,isLoading:!1}))},[T,B]);const S=(w="next")=>{let F=f;if(typeof w=="string")if(w==="next")if(f<x-1)F=f+1;else return;else if(f>0)F=f-1;else return;else F=w;g(M=>({...M,currentPage:F,loadedPages:[...new Set([...D,F])]}));const j=()=>{const M=F*u.cardsPerPage,V=M+u.cardsPerPage;return t.slice(M,V).length};E(l.formatMessage({id:"carousel_pagination_aria_live"},{direction:w,count:j()}))},q=w=>{la=w.touches[0].clientX},N=w=>{if(la===null)return;const F=w.touches[0].clientX,j=la-F;j>5?S("next"):j<-5&&S("previous"),la=null},I={"--width":`${T||0}px`,"--total-cards":B,"--cards-per-page":h,"--page":f};if(p)return d.jsx(Ws,{layout:`carousel${a?"-with-title":""}`});const z=(w,F)=>{var M;let j=null;return(M=w==null?void 0:w.sys)!=null&&M.id?j=`card-${w.sys.id}`:w!=null&&w.slug?j=`card-${w.slug}`:[n[F],w.contentType].includes("customCard")&&(j=`card-${window.btoa(`${w.title} ${w.createdAt}`)}-${F}`),j};return d.jsxs("section",{ref:k,className:Y("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx(WE,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:q,onTouchMove:N,style:I,"data-testid":"carousel-list",children:t.map((w,F)=>{let j=z(w,F);return j&&qE(F,h,f,D)?d.jsx(Oo,{id:j,card:{...w,contentType:n[F]},buildCardData:r,gtmContext:s,...o},j):(j=j||`${e}-card-${F}`,d.jsx(kt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},j))})}),x<=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(_e,{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(x)].map((w,F)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:Y("page-indicator",{selected:F===f}),onClick:j=>{j.preventDefault(),j.stopPropagation(),S(F)},children:d.jsx(Ie,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:F+1,total:x})})})},`page-indicator-${F}`)),d.jsx("li",{className:"arrow next",children:d.jsx(_e,{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>=x-1})})]}),d.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:v})]})]})},UE=({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(y.Fragment,{children:[d.jsx(Ws,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:d.jsx(Kt,{})]},`placeholder-${c}`):d.jsxs(y.Fragment,{children:[d.jsx(HE,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),h?null:d.jsx(Kt,{})]},`carousel-${c}`)});const VE=({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 y.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(ai,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx(qs,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const vh=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>y.createElement(e,{className:Y("lesson-name",a),"data-number":`${t}.${n}`,children:r});const bh=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ue.useIntl(),o=Ha(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Pc(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(ai,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const KE=({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(),p="courseStructure_",m=u.toLowerCase().includes("course conclusion");return d.jsxs(Va,{className:"course-structure",label:d.jsxs(d.Fragment,{children:[d.jsxs("small",{children:[h.formatMessage({id:`${p}section${m?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?h.formatMessage({id:`${p}time_completed`}):d.jsx(ai,{time:s,appendedText:a?h.formatMessage({id:`${p}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:v,image:E,isIntroduction:B,optional:x,slug:k,subsectionId:T,title:S,type:q})=>{const N=a&&t||B,I={};return E&&(I.style={"--image":`url(${E})`}),d.jsx("li",{className:Y({article:D===gr.ARTICLE,discussion:D===gr.DISCUSSION,quiz:D===gr.QUIZ,completed:g&&D===gr.ARTICLE,locked:!N}),...I,children:d.jsx(Tn,{href:N?`/microcourses/en/${o}/${k}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Oc(S)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(vh,{sectionId:i,subsectionId:T,title:S,className:"course-title"})," ",d.jsx(bh,{completionTime:f,icon:v,optional:x,type:q,children:c&&c[k]&&d.jsx("span",{className:"quiz-score",children:`${c[k]}%`})})]})})},k)})})]})};const ZE=({isComplete:e=!1,onClick:t,...n})=>{const r=ue.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),d.jsx(_e,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className: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":""}`})})},YE=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Cc=[{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 ca="notFoundError_",GE=()=>{const e=ue.useIntl(),t=[];return Cc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ca}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(Wf,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(fn,{children:[d.jsx(gh,{cards:Cc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(_e,{href:"/solution-articles/",children:e.formatMessage({id:`${ca}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ca}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ca}text`})})]})};exports.ASSETS_BUCKET=It;exports.ActivitiesFeed=uw;exports.ActivitySection=Bw;exports.AddPost=Bo;exports.Banner=SE;exports.BannerSection=PE;exports.Breadcrumbs=wm;exports.Buckets=tm;exports.Button=_e;exports.ButtonWrapper=rr;exports.COURSE_CONTENT_TYPES=gr;exports.CacheProvider=Gc;exports.Card=Oo;exports.CardBlock=gh;exports.Carousel=UE;exports.CharacterLimit=Gs;exports.CollapsibleSection=Va;exports.Columns=id;exports.CommunityDetails=xm;exports.ContactFooter=wx;exports.ContactForm=If;exports.ContentTypeLabel=Wc;exports.Contributors=Hs;exports.ConversationContext=ri;exports.CookieBanner=qf;exports.CourseProgression=VE;exports.CourseStructure=KE;exports.CustomContentBanner=NE;exports.Directory=BE;exports.DiscussionConversation=Hf;exports.DiscussionForm=zr;exports.DiscussionFormCard=Vf;exports.DiscussionFormModal=ph;exports.DiscussionLikes=Uf;exports.DiscussionPost=qr;exports.DiscussionThread=Zf;exports.Divider=Kt;exports.DownloadSection=yx;exports.EMAILS=$n;exports.EditSection=Cx;exports.EmailHelperTextBox=od;exports.EmptyStateBox=un;exports.FeatureFlags=Us;exports.Filters=Em;exports.FlagsProvider=Jc;exports.Footer=Eo;exports.Form=ln;exports.Formatting=Z;exports.Fragment=Ct;exports.FullWidthSection=fn;exports.GET_STREAM_USER_PREFIX=os;exports.GlobalProviders=Cm;exports.Header=ko;exports.HelperTextBox=Uc;exports.HiddenFromScreenReaders=Wa;exports.HideShowTextBox=Vc;exports.HighlightSection=ME;exports.HighlightedTextBox=Mt;exports.INVALID_TOKEN=Nc;exports.IconBulletedList=am;exports.ImageContainer=Jh;exports.IntlProvider=Xc;exports.InviteForm=$f;exports.InviteModal=_E;exports.JoinButton=Zs;exports.LanguageContext=Vs;exports.LanguageSwitcher=_m;exports.LessonName=vh;exports.LessonType=bh;exports.Link=Tn;exports.LoadMore=$r;exports.LoadingBlock=pm;exports.LoadingPlaceholder=kt;exports.LoadingState=Ws;exports.Logo=Ys;exports.LogoSection=xx;exports.MENTION_REGEX=Rc;exports.MarkCompleteButton=ZE;exports.MarkdownText=xn;exports.MarketingBlock=IE;exports.Marks=Nt;exports.Member=wn;exports.MembersList=Ax;exports.Modal=jo;exports.MoreMenu=rd;exports.NUMBER_OF_COUNTRIES=Ih;exports.NUMBER_OF_USERS=Mh;exports.NavigationMenu=ad;exports.NotFoundError=GE;exports.Overlay=sr;exports.OverlayContext=Ks;exports.OverlayProvider=nd;exports.PageHeading=Kc;exports.PageLayout=Wf;exports.PasswordForm=fx;exports.PasswordRules=fd;exports.Pill=gn;exports.Popover=qc;exports.Portal=Ua;exports.ProfileImageChange=dx;exports.ProfilePicture=Yt;exports.ProgressBar=qs;exports.ProgressTracker=Xh;exports.Rating=Hm;exports.RepliesFeed=nh;exports.ResponsesHeading=Kf;exports.ResponsiveImage=ar;exports.ReturnToNavButton=em;exports.RichTextEditor=Mf;exports.SearchForm=Lf;exports.ShareLinks=Sm;exports.SignupForm=bx;exports.Span=ds;exports.StatusBanner=Fr;exports.TableOfContents=TE;exports.Tabs=jm;exports.Tags=Fx;exports.TestimonialBlock=AE;exports.TimeToComplete=ai;exports.Toggle=cx;exports.Tooltip=An;exports.TopLevelPage=Ex;exports.UUID_V4_REGEX=Br;exports.UserContext=Lt;exports.UserProvider=ed;exports.VisuallyHidden=Ie;exports.addAriaProps=mh;exports.basicReducer=Ir;exports.camelCaseToDashCase=jc;exports.checkIntlPathExists=Ha;exports.generateConditions=Da;exports.generateCssIcon=Mc;exports.getCharacterLimitProps=sd;exports.getLongDate=zs;exports.getMember=Ka;exports.getPostBody=_o;exports.getShortDate=Ic;exports.getValueLength=Ya;exports.headerData=Mr;exports.mapGetStreamData=YE;exports.pageReady=$c;exports.passwordValidator=ls;exports.repliesFeedMock=lw;exports.supportedLanguages=ha;exports.toCamelCase=Oc;exports.toCapitalisedCase=Rh;exports.toSentenceCase=Pc;exports.useCurrentPath=_c;exports.useEffectAfterMount=Yn;exports.useElementWidth=tr;exports.useOverlay=td;exports.useScrollListener=Ac;exports.useScrollToHash=$s;exports.useTooltips=Ls;exports.useUser=Za;