@apolitical/component-library 4.8.4-SW.0 → 4.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/cards/card-block/card-block.d.ts +2 -2
  2. package/cards/card-block/index.d.ts +0 -1
  3. package/communities/members-list/members-list.d.ts +2 -1
  4. package/communities/members-list/members-list.mock.d.ts +21 -0
  5. package/context/badges/badges.context.d.ts +13 -0
  6. package/context/badges/badges.hook.d.ts +1 -0
  7. package/context/badges/badges.provider.d.ts +8 -0
  8. package/context/badges/index.d.ts +4 -0
  9. package/context/global/global.providers.d.ts +1 -1
  10. package/context/index.d.ts +1 -0
  11. package/discussion/components/add-post/add-post.d.ts +2 -0
  12. package/discussion/components/form/form.d.ts +1 -1
  13. package/discussion/components/form/form.type.d.ts +2 -0
  14. package/discussion/components/post/post.d.ts +4 -1
  15. package/discussion/discussion.helpers.d.ts +1 -0
  16. package/discussion/feeds/activities-feed/mocks/activities-feed.mock.d.ts +42 -0
  17. package/discussion/feeds/replies-feed/mocks/replies-feed.mock.d.ts +33 -0
  18. package/discussion/feeds/replies-feed/nested-replies-feed/mocks/nested-replies-feed.mock.d.ts +29 -2
  19. package/discussion/sections/activity-section/activity-section.d.ts +2 -2
  20. package/discussion/sections/activity-section/index.d.ts +0 -1
  21. package/discussion/sections/activity-section/mocks/activity-section.mock.d.ts +5 -0
  22. package/discussion/shared/interfaces/user.interface.d.ts +2 -0
  23. package/form/components/form/index.d.ts +1 -1
  24. package/form/types/profile-form/profile-form.d.ts +3 -3
  25. package/index.js +61 -61
  26. package/index.mjs +7028 -6866
  27. package/layout/content-layout/columns/columns.d.ts +2 -2
  28. package/layout/content-layout/columns/index.d.ts +0 -1
  29. package/navigation/load-more/index.d.ts +1 -1
  30. package/navigation/load-more/load-more.d.ts +3 -3
  31. package/navigation/tabs/index.d.ts +0 -1
  32. package/navigation/tabs/tabs.d.ts +6 -6
  33. package/package.json +1 -1
  34. package/sections/edit-section/edit-section.d.ts +2 -2
  35. package/sections/edit-section/index.d.ts +0 -1
  36. package/style.css +1 -1
  37. package/styles/variables/colors/theme/_user.scss +6 -0
  38. package/text/empty-state-box/empty-state-box.d.ts +2 -2
  39. package/text/empty-state-box/index.d.ts +0 -1
  40. package/text/hide-show-text-box/hide-show-text-box.d.ts +2 -2
  41. package/text/hide-show-text-box/index.d.ts +0 -1
  42. package/text/highlighted-text-box/highlighted-text-box.d.ts +2 -2
  43. package/text/highlighted-text-box/index.d.ts +0 -1
  44. package/user/badge/badge.d.ts +7 -0
  45. package/user/badge/icon-mapping.d.ts +11 -0
  46. package/user/badge/index.d.ts +2 -0
  47. package/user/badge/interface/badge.interfaces.d.ts +9 -0
  48. package/user/badges/badges.d.ts +12 -0
  49. package/user/badges/badges.interface.d.ts +10 -0
  50. package/user/badges/index.d.ts +2 -0
  51. package/user/member/member.d.ts +7 -1
  52. package/user/member/member.helpers.d.ts +2 -0
  53. package/user/member/member.mock.d.ts +8 -0
  54. package/user/profile-picture/index.d.ts +0 -1
  55. package/user/profile-picture/profile-picture.d.ts +2 -2
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),se=require("react-intl"),xn=require("lodash.clonedeep"),Lh=require("lodash.set"),Oc=require("react-dom"),Lt=require("markdown-to-jsx"),Jn=require("truncate"),qe=require("@tanstack/react-query"),zh=require("@tanstack/react-query-devtools"),ba=require("posthog-js"),Ks=require("react-cookie"),hs=require("lodash.isequal"),qh=require("react-multi-email"),Pc=require("lodash.get"),Wh=require("react-error-boundary");var Yr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Nc(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 Mc={exports:{}};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),se=require("react-intl"),wn=require("lodash.clonedeep"),Uh=require("lodash.set"),Mc=require("react-dom"),zt=require("markdown-to-jsx"),Xn=require("truncate"),qe=require("@tanstack/react-query"),Hh=require("@tanstack/react-query-devtools"),ya=require("posthog-js"),Zs=require("react-cookie"),ms=require("lodash.isequal"),Vh=require("react-multi-email"),Nc=require("lodash.get"),Kh=require("react-error-boundary");var Gr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function On(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ic(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 Rc={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})()})(Mc);var Uh=Mc.exports;const G=jn(Uh),Hh=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>y.createElement(e,{...a,className:G("hidden",r,{"show-on-focus":t}),children:n}),Ie=y.memo(Hh),Vh=({element:e="span",children:t=null,...n})=>y.createElement(e,{...n,"aria-hidden":!0},t),Ga=y.memo(Vh);var ms={exports:{}},cr={};/**
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})()})(Rc);var Zh=Rc.exports;const Y=On(Zh),Yh=({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}),Ne=y.memo(Yh),Gh=({element:e="span",children:t=null,...n})=>y.createElement(e,{...n,"aria-hidden":!0},t),Qa=y.memo(Gh);var ps={exports:{}},dr={};/**
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 Kh(){if(Qo)return cr;Qo=1;var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var d,m={},p=null,h=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(h=l.ref);for(d in l)r.call(l,d)&&!i.hasOwnProperty(d)&&(m[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)m[d]===void 0&&(m[d]=l[d]);return{$$typeof:t,type:o,key:p,ref:h,props:m,_owner:a.current}}return cr.Fragment=n,cr.jsx=s,cr.jsxs=s,cr}var dr={};/**
13
+ */var Xo;function Qh(){if(Xo)return dr;Xo=1;var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var d,m={},p=null,h=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(h=l.ref);for(d in l)r.call(l,d)&&!i.hasOwnProperty(d)&&(m[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)m[d]===void 0&&(m[d]=l[d]);return{$$typeof:t,type:o,key:p,ref:h,props:m,_owner:a.current}}return dr.Fragment=n,dr.jsx=s,dr.jsxs=s,dr}var fr={};/**
14
14
  * @license React
15
15
  * react-jsx-runtime.development.js
16
16
  *
@@ -18,98 +18,98 @@
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 Jo;function Zh(){return Jo||(Jo=1,process.env.NODE_ENV!=="production"&&function(){var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function b(O){if(O===null||typeof O!="object")return null;var oe=g&&O[g]||O[f];return typeof oe=="function"?oe:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function _(O){{for(var oe=arguments.length,le=new Array(oe>1?oe-1:0),be=1;be<oe;be++)le[be-1]=arguments[be];F("error",O,le)}}function F(O,oe,le){{var be=v.ReactDebugCurrentFrame,je=be.getStackAddendum();je!==""&&(oe+="%s",le=le.concat([je]));var $e=le.map(function(Ae){return String(Ae)});$e.unshift("Warning: "+oe),Function.prototype.apply.call(console[O],console,$e)}}var x=!1,w=!1,B=!1,S=!1,z=!1,N;N=Symbol.for("react.module.reference");function I(O){return!!(typeof O=="string"||typeof O=="function"||O===r||O===i||z||O===a||O===u||O===d||S||O===h||x||w||B||typeof O=="object"&&O!==null&&(O.$$typeof===p||O.$$typeof===m||O.$$typeof===s||O.$$typeof===o||O.$$typeof===l||O.$$typeof===N||O.getModuleId!==void 0))}function M(O,oe,le){var be=O.displayName;if(be)return be;var je=oe.displayName||oe.name||"";return je!==""?le+"("+je+")":le}function k(O){return O.displayName||"Context"}function A(O){if(O==null)return null;if(typeof O.tag=="number"&&_("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 oe=O;return k(oe)+".Consumer";case s:var le=O;return k(le._context)+".Provider";case l:return M(O,O.render,"ForwardRef");case m:var be=O.displayName||null;return be!==null?be:A(O.type)||"Memo";case p:{var je=O,$e=je._payload,Ae=je._init;try{return A(Ae($e))}catch{return null}}}return null}var j=Object.assign,L=0,H,Y,Q,re,C,q,K;function E(){}E.__reactDisabledLog=!0;function T(){{if(L===0){H=console.log,Y=console.info,Q=console.warn,re=console.error,C=console.group,q=console.groupCollapsed,K=console.groupEnd;var O={configurable:!0,enumerable:!0,value:E,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}L++}}function $(){{if(L--,L===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},O,{value:H}),info:j({},O,{value:Y}),warn:j({},O,{value:Q}),error:j({},O,{value:re}),group:j({},O,{value:C}),groupCollapsed:j({},O,{value:q}),groupEnd:j({},O,{value:K})})}L<0&&_("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var R=v.ReactCurrentDispatcher,U;function ae(O,oe,le){{if(U===void 0)try{throw Error()}catch(je){var be=je.stack.trim().match(/\n( *(at )?)/);U=be&&be[1]||""}return`
22
- `+U+O}}var J=!1,ie;{var de=typeof WeakMap=="function"?WeakMap:Map;ie=new de}function X(O,oe){if(!O||J)return"";{var le=ie.get(O);if(le!==void 0)return le}var be;J=!0;var je=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var $e;$e=R.current,R.current=null,T();try{if(oe){var Ae=function(){throw Error()};if(Object.defineProperty(Ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ae,[])}catch(Ht){be=Ht}Reflect.construct(O,[],Ae)}else{try{Ae.call()}catch(Ht){be=Ht}O.call(Ae.prototype)}}else{try{throw Error()}catch(Ht){be=Ht}O()}}catch(Ht){if(Ht&&be&&typeof Ht.stack=="string"){for(var ke=Ht.stack.split(`
23
- `),it=be.stack.split(`
24
- `),Ge=ke.length-1,Qe=it.length-1;Ge>=1&&Qe>=0&&ke[Ge]!==it[Qe];)Qe--;for(;Ge>=1&&Qe>=0;Ge--,Qe--)if(ke[Ge]!==it[Qe]){if(Ge!==1||Qe!==1)do if(Ge--,Qe--,Qe<0||ke[Ge]!==it[Qe]){var Ct=`
25
- `+ke[Ge].replace(" at new "," at ");return O.displayName&&Ct.includes("<anonymous>")&&(Ct=Ct.replace("<anonymous>",O.displayName)),typeof O=="function"&&ie.set(O,Ct),Ct}while(Ge>=1&&Qe>=0);break}}}finally{J=!1,R.current=$e,$(),Error.prepareStackTrace=je}var In=O?O.displayName||O.name:"",Go=In?ae(In):"";return typeof O=="function"&&ie.set(O,Go),Go}function ye(O,oe,le){return X(O,!1)}function me(O){var oe=O.prototype;return!!(oe&&oe.isReactComponent)}function xe(O,oe,le){if(O==null)return"";if(typeof O=="function")return X(O,me(O));if(typeof O=="string")return ae(O);switch(O){case u:return ae("Suspense");case d:return ae("SuspenseList")}if(typeof O=="object")switch(O.$$typeof){case l:return ye(O.render);case m:return xe(O.type,oe,le);case p:{var be=O,je=be._payload,$e=be._init;try{return xe($e(je),oe,le)}catch{}}}return""}var Te=Object.prototype.hasOwnProperty,Se={},He=v.ReactDebugCurrentFrame;function Be(O){if(O){var oe=O._owner,le=xe(O.type,O._source,oe?oe.type:null);He.setExtraStackFrame(le)}else He.setExtraStackFrame(null)}function Fe(O,oe,le,be,je){{var $e=Function.call.bind(Te);for(var Ae in O)if($e(O,Ae)){var ke=void 0;try{if(typeof O[Ae]!="function"){var it=Error((be||"React class")+": "+le+" type `"+Ae+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[Ae]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw it.name="Invariant Violation",it}ke=O[Ae](oe,Ae,be,le,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ge){ke=Ge}ke&&!(ke instanceof Error)&&(Be(je),_("%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).",be||"React class",le,Ae,typeof ke),Be(null)),ke instanceof Error&&!(ke.message in Se)&&(Se[ke.message]=!0,Be(je),_("Failed %s type: %s",le,ke.message),Be(null))}}}var Pe=Array.isArray;function Ee(O){return Pe(O)}function Ve(O){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,le=oe&&O[Symbol.toStringTag]||O.constructor.name||"Object";return le}}function ze(O){try{return W(O),!1}catch{return!0}}function W(O){return""+O}function ne(O){if(ze(O))return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ve(O)),W(O)}var he=v.ReactCurrentOwner,pe={key:!0,ref:!0,__self:!0,__source:!0},Ce,Ze,Ye;Ye={};function gt(O){if(Te.call(O,"ref")){var oe=Object.getOwnPropertyDescriptor(O,"ref").get;if(oe&&oe.isReactWarning)return!1}return O.ref!==void 0}function Ut(O){if(Te.call(O,"key")){var oe=Object.getOwnPropertyDescriptor(O,"key").get;if(oe&&oe.isReactWarning)return!1}return O.key!==void 0}function Bt(O,oe){if(typeof O.ref=="string"&&he.current&&oe&&he.current.stateNode!==oe){var le=A(he.current.type);Ye[le]||(_('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',A(he.current.type),O.ref),Ye[le]=!0)}}function tt(O,oe){{var le=function(){Ce||(Ce=!0,_("%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)",oe))};le.isReactWarning=!0,Object.defineProperty(O,"key",{get:le,configurable:!0})}}function Ot(O,oe){{var le=function(){Ze||(Ze=!0,_("%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)",oe))};le.isReactWarning=!0,Object.defineProperty(O,"ref",{get:le,configurable:!0})}}var vt=function(O,oe,le,be,je,$e,Ae){var ke={$$typeof:t,type:O,key:oe,ref:le,props:Ae,_owner:$e};return ke._store={},Object.defineProperty(ke._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ke,"_self",{configurable:!1,enumerable:!1,writable:!1,value:be}),Object.defineProperty(ke,"_source",{configurable:!1,enumerable:!1,writable:!1,value:je}),Object.freeze&&(Object.freeze(ke.props),Object.freeze(ke)),ke};function hi(O,oe,le,be,je){{var $e,Ae={},ke=null,it=null;le!==void 0&&(ne(le),ke=""+le),Ut(oe)&&(ne(oe.key),ke=""+oe.key),gt(oe)&&(it=oe.ref,Bt(oe,je));for($e in oe)Te.call(oe,$e)&&!pe.hasOwnProperty($e)&&(Ae[$e]=oe[$e]);if(O&&O.defaultProps){var Ge=O.defaultProps;for($e in Ge)Ae[$e]===void 0&&(Ae[$e]=Ge[$e])}if(ke||it){var Qe=typeof O=="function"?O.displayName||O.name||"Unknown":O;ke&&tt(Ae,Qe),it&&Ot(Ae,Qe)}return vt(O,ke,it,je,be,he.current,Ae)}}var lr=v.ReactCurrentOwner,Zr=v.ReactDebugCurrentFrame;function Mn(O){if(O){var oe=O._owner,le=xe(O.type,O._source,oe?oe.type:null);Zr.setExtraStackFrame(le)}else Zr.setExtraStackFrame(null)}var mi;mi=!1;function pi(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function Ho(){{if(lr.current){var O=A(lr.current.type);if(O)return`
21
+ */var eu;function Jh(){return eu||(eu=1,process.env.NODE_ENV!=="production"&&function(){var e=y,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function b(O){if(O===null||typeof O!="object")return null;var oe=g&&O[g]||O[f];return typeof oe=="function"?oe:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(O){{for(var oe=arguments.length,ce=new Array(oe>1?oe-1:0),ye=1;ye<oe;ye++)ce[ye-1]=arguments[ye];B("error",O,ce)}}function B(O,oe,ce){{var ye=v.ReactDebugCurrentFrame,je=ye.getStackAddendum();je!==""&&(oe+="%s",ce=ce.concat([je]));var $e=ce.map(function(Ae){return String(Ae)});$e.unshift("Warning: "+oe),Function.prototype.apply.call(console[O],console,$e)}}var _=!1,x=!1,T=!1,S=!1,$=!1,M;M=Symbol.for("react.module.reference");function N(O){return!!(typeof O=="string"||typeof O=="function"||O===r||O===i||$||O===a||O===u||O===d||S||O===h||_||x||T||typeof O=="object"&&O!==null&&(O.$$typeof===p||O.$$typeof===m||O.$$typeof===s||O.$$typeof===o||O.$$typeof===l||O.$$typeof===M||O.getModuleId!==void 0))}function q(O,oe,ce){var ye=O.displayName;if(ye)return ye;var je=oe.displayName||oe.name||"";return je!==""?ce+"("+je+")":ce}function w(O){return O.displayName||"Context"}function A(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 d:return"SuspenseList"}if(typeof O=="object")switch(O.$$typeof){case o:var oe=O;return w(oe)+".Consumer";case s:var ce=O;return w(ce._context)+".Provider";case l:return q(O,O.render,"ForwardRef");case m:var ye=O.displayName||null;return ye!==null?ye:A(O.type)||"Memo";case p:{var je=O,$e=je._payload,Ae=je._init;try{return A(Ae($e))}catch{return null}}}return null}var j=Object.assign,L=0,U,Z,G,ae,C,z,Q;function k(){}k.__reactDisabledLog=!0;function F(){{if(L===0){U=console.log,Z=console.info,G=console.warn,ae=console.error,C=console.group,z=console.groupCollapsed,Q=console.groupEnd;var O={configurable:!0,enumerable:!0,value:k,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}L++}}function R(){{if(L--,L===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},O,{value:U}),info:j({},O,{value:Z}),warn:j({},O,{value:G}),error:j({},O,{value:ae}),group:j({},O,{value:C}),groupCollapsed:j({},O,{value:z}),groupEnd:j({},O,{value:Q})})}L<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var I=v.ReactCurrentDispatcher,W;function re(O,oe,ce){{if(W===void 0)try{throw Error()}catch(je){var ye=je.stack.trim().match(/\n( *(at )?)/);W=ye&&ye[1]||""}return`
22
+ `+W+O}}var ee=!1,ie;{var fe=typeof WeakMap=="function"?WeakMap:Map;ie=new fe}function X(O,oe){if(!O||ee)return"";{var ce=ie.get(O);if(ce!==void 0)return ce}var ye;ee=!0;var je=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var $e;$e=I.current,I.current=null,F();try{if(oe){var Ae=function(){throw Error()};if(Object.defineProperty(Ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ae,[])}catch(Vt){ye=Vt}Reflect.construct(O,[],Ae)}else{try{Ae.call()}catch(Vt){ye=Vt}O.call(Ae.prototype)}}else{try{throw Error()}catch(Vt){ye=Vt}O()}}catch(Vt){if(Vt&&ye&&typeof Vt.stack=="string"){for(var ke=Vt.stack.split(`
23
+ `),st=ye.stack.split(`
24
+ `),Ge=ke.length-1,Qe=st.length-1;Ge>=1&&Qe>=0&&ke[Ge]!==st[Qe];)Qe--;for(;Ge>=1&&Qe>=0;Ge--,Qe--)if(ke[Ge]!==st[Qe]){if(Ge!==1||Qe!==1)do if(Ge--,Qe--,Qe<0||ke[Ge]!==st[Qe]){var xt=`
25
+ `+ke[Ge].replace(" at new "," at ");return O.displayName&&xt.includes("<anonymous>")&&(xt=xt.replace("<anonymous>",O.displayName)),typeof O=="function"&&ie.set(O,xt),xt}while(Ge>=1&&Qe>=0);break}}}finally{ee=!1,I.current=$e,R(),Error.prepareStackTrace=je}var Rn=O?O.displayName||O.name:"",Jo=Rn?re(Rn):"";return typeof O=="function"&&ie.set(O,Jo),Jo}function ve(O,oe,ce){return X(O,!1)}function pe(O){var oe=O.prototype;return!!(oe&&oe.isReactComponent)}function _e(O,oe,ce){if(O==null)return"";if(typeof O=="function")return X(O,pe(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 ve(O.render);case m:return _e(O.type,oe,ce);case p:{var ye=O,je=ye._payload,$e=ye._init;try{return _e($e(je),oe,ce)}catch{}}}return""}var Fe=Object.prototype.hasOwnProperty,Te={},Ve=v.ReactDebugCurrentFrame;function We(O){if(O){var oe=O._owner,ce=_e(O.type,O._source,oe?oe.type:null);Ve.setExtraStackFrame(ce)}else Ve.setExtraStackFrame(null)}function Be(O,oe,ce,ye,je){{var $e=Function.call.bind(Fe);for(var Ae in O)if($e(O,Ae)){var ke=void 0;try{if(typeof O[Ae]!="function"){var st=Error((ye||"React class")+": "+ce+" type `"+Ae+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[Ae]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw st.name="Invariant Violation",st}ke=O[Ae](oe,Ae,ye,ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ge){ke=Ge}ke&&!(ke instanceof Error)&&(We(je),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).",ye||"React class",ce,Ae,typeof ke),We(null)),ke instanceof Error&&!(ke.message in Te)&&(Te[ke.message]=!0,We(je),E("Failed %s type: %s",ce,ke.message),We(null))}}}var Se=Array.isArray;function De(O){return Se(O)}function Ie(O){{var oe=typeof Symbol=="function"&&Symbol.toStringTag,ce=oe&&O[Symbol.toStringTag]||O.constructor.name||"Object";return ce}}function ze(O){try{return K(O),!1}catch{return!0}}function K(O){return""+O}function te(O){if(ze(O))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ie(O)),K(O)}var le=v.ReactCurrentOwner,me={key:!0,ref:!0,__self:!0,__source:!0},xe,Ze,Ye;Ye={};function rt(O){if(Fe.call(O,"ref")){var oe=Object.getOwnPropertyDescriptor(O,"ref").get;if(oe&&oe.isReactWarning)return!1}return O.ref!==void 0}function Ht(O){if(Fe.call(O,"key")){var oe=Object.getOwnPropertyDescriptor(O,"key").get;if(oe&&oe.isReactWarning)return!1}return O.key!==void 0}function At(O,oe){if(typeof O.ref=="string"&&le.current&&oe&&le.current.stateNode!==oe){var ce=A(le.current.type);Ye[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',A(le.current.type),O.ref),Ye[ce]=!0)}}function tt(O,oe){{var ce=function(){xe||(xe=!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)",oe))};ce.isReactWarning=!0,Object.defineProperty(O,"key",{get:ce,configurable:!0})}}function Pt(O,oe){{var ce=function(){Ze||(Ze=!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)",oe))};ce.isReactWarning=!0,Object.defineProperty(O,"ref",{get:ce,configurable:!0})}}var bt=function(O,oe,ce,ye,je,$e,Ae){var ke={$$typeof:t,type:O,key:oe,ref:ce,props:Ae,_owner:$e};return ke._store={},Object.defineProperty(ke._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ke,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ye}),Object.defineProperty(ke,"_source",{configurable:!1,enumerable:!1,writable:!1,value:je}),Object.freeze&&(Object.freeze(ke.props),Object.freeze(ke)),ke};function mi(O,oe,ce,ye,je){{var $e,Ae={},ke=null,st=null;ce!==void 0&&(te(ce),ke=""+ce),Ht(oe)&&(te(oe.key),ke=""+oe.key),rt(oe)&&(st=oe.ref,At(oe,je));for($e in oe)Fe.call(oe,$e)&&!me.hasOwnProperty($e)&&(Ae[$e]=oe[$e]);if(O&&O.defaultProps){var Ge=O.defaultProps;for($e in Ge)Ae[$e]===void 0&&(Ae[$e]=Ge[$e])}if(ke||st){var Qe=typeof O=="function"?O.displayName||O.name||"Unknown":O;ke&&tt(Ae,Qe),st&&Pt(Ae,Qe)}return bt(O,ke,st,je,ye,le.current,Ae)}}var cr=v.ReactCurrentOwner,Yr=v.ReactDebugCurrentFrame;function In(O){if(O){var oe=O._owner,ce=_e(O.type,O._source,oe?oe.type:null);Yr.setExtraStackFrame(ce)}else Yr.setExtraStackFrame(null)}var pi;pi=!1;function gi(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function Ko(){{if(cr.current){var O=A(cr.current.type);if(O)return`
26
26
 
27
- Check the render method of \``+O+"`."}return""}}function jh(O){{if(O!==void 0){var oe=O.fileName.replace(/^.*[\\\/]/,""),le=O.lineNumber;return`
27
+ Check the render method of \``+O+"`."}return""}}function Nh(O){{if(O!==void 0){var oe=O.fileName.replace(/^.*[\\\/]/,""),ce=O.lineNumber;return`
28
28
 
29
- Check your code at `+oe+":"+le+"."}return""}}var Vo={};function Oh(O){{var oe=Ho();if(!oe){var le=typeof O=="string"?O:O.displayName||O.name;le&&(oe=`
29
+ Check your code at `+oe+":"+ce+"."}return""}}var Zo={};function Ih(O){{var oe=Ko();if(!oe){var ce=typeof O=="string"?O:O.displayName||O.name;ce&&(oe=`
30
30
 
31
- Check the top-level render call using <`+le+">.")}return oe}}function Ko(O,oe){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var le=Oh(oe);if(Vo[le])return;Vo[le]=!0;var be="";O&&O._owner&&O._owner!==lr.current&&(be=" It was passed a child from "+A(O._owner.type)+"."),Mn(O),_('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',le,be),Mn(null)}}function Zo(O,oe){{if(typeof O!="object")return;if(Ee(O))for(var le=0;le<O.length;le++){var be=O[le];pi(be)&&Ko(be,oe)}else if(pi(O))O._store&&(O._store.validated=!0);else if(O){var je=b(O);if(typeof je=="function"&&je!==O.entries)for(var $e=je.call(O),Ae;!(Ae=$e.next()).done;)pi(Ae.value)&&Ko(Ae.value,oe)}}}function Ph(O){{var oe=O.type;if(oe==null||typeof oe=="string")return;var le;if(typeof oe=="function")le=oe.propTypes;else if(typeof oe=="object"&&(oe.$$typeof===l||oe.$$typeof===m))le=oe.propTypes;else return;if(le){var be=A(oe);Fe(le,O.props,"prop",be,O)}else if(oe.PropTypes!==void 0&&!mi){mi=!0;var je=A(oe);_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",je||"Unknown")}typeof oe.getDefaultProps=="function"&&!oe.getDefaultProps.isReactClassApproved&&_("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Nh(O){{for(var oe=Object.keys(O.props),le=0;le<oe.length;le++){var be=oe[le];if(be!=="children"&&be!=="key"){Mn(O),_("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",be),Mn(null);break}}O.ref!==null&&(Mn(O),_("Invalid attribute `ref` supplied to `React.Fragment`."),Mn(null))}}function Yo(O,oe,le,be,je,$e){{var Ae=I(O);if(!Ae){var ke="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(ke+=" 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 it=jh(je);it?ke+=it:ke+=Ho();var Ge;O===null?Ge="null":Ee(O)?Ge="array":O!==void 0&&O.$$typeof===t?(Ge="<"+(A(O.type)||"Unknown")+" />",ke=" Did you accidentally export a JSX literal instead of a component?"):Ge=typeof O,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ge,ke)}var Qe=hi(O,oe,le,je,$e);if(Qe==null)return Qe;if(Ae){var Ct=oe.children;if(Ct!==void 0)if(be)if(Ee(Ct)){for(var In=0;In<Ct.length;In++)Zo(Ct[In],O);Object.freeze&&Object.freeze(Ct)}else _("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 Zo(Ct,O)}return O===r?Nh(Qe):Ph(Qe),Qe}}function Mh(O,oe,le){return Yo(O,oe,le,!0)}function Ih(O,oe,le){return Yo(O,oe,le,!1)}var Rh=Ih,$h=Mh;dr.Fragment=r,dr.jsx=Rh,dr.jsxs=$h}()),dr}process.env.NODE_ENV==="production"?ms.exports=Kh():ms.exports=Zh();var c=ms.exports;const Ic=()=>{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},Xn=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function Rc(e,t,n){var r=this,a=y.useRef(null),i=y.useRef(0),s=y.useRef(null),o=y.useRef([]),l=y.useRef(),u=y.useRef(),d=y.useRef(e),m=y.useRef(!0);d.current=e;var p=typeof window<"u",h=!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,b="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,_=b?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var F=y.useMemo(function(){var x=function(I){var M=o.current,k=l.current;return o.current=l.current=null,i.current=I,u.current=d.current.apply(k,M)},w=function(I,M){h&&cancelAnimationFrame(s.current),s.current=h?requestAnimationFrame(I):setTimeout(I,M)},B=function(I){if(!m.current)return!1;var M=I-a.current;return!a.current||M>=t||M<0||b&&I-i.current>=_},S=function(I){return s.current=null,f&&o.current?x(I):(o.current=l.current=null,u.current)},z=function I(){var M=Date.now();if(B(M))return S(M);if(m.current){var k=t-(M-a.current),A=b?Math.min(k,_-(M-i.current)):k;w(I,A)}},N=function(){if(p||v){var I=Date.now(),M=B(I);if(o.current=[].slice.call(arguments),l.current=r,a.current=I,M){if(!s.current&&m.current)return i.current=a.current,w(z,t),g?x(a.current):u.current;if(b)return w(z,t),x(a.current)}return s.current||w(z,t),u.current}};return N.cancel=function(){s.current&&(h?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,b,t,_,f,h,p,v]);return F}function $c(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return Rc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let gi;const On=(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(gi),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:d})=>{const{id:m}=d;n==="window"||!n.closest(`#${m}`)||s()===r||o()},u=$c(()=>{s()!==r&&(t&&(clearTimeout(gi),document.body.classList.add("is-resizing"),gi=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Lc=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=y.useState({current:0,past:0})||[!1,()=>{}],[s,o]=y.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];y.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const d=window.scrollY,m=a.current,p=d-m,h=p>0?"down":"up";if(i({current:d,past:m}),h==="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=$c(()=>{l()},250);return a},Zs=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.useRef(!1);Xn(()=>{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)},Ys=(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 Xo={},Pn=y.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},...l},u)=>{const d=se.useIntl(),m=y.useRef(null),p=u||m,[h,g]=y.useState(n?"open":"hidden"),{extraPadding:f=!0,hasPointer:b=!1,hasForm:v=!1}=t,{onOpen:_=()=>{},onClose:F=()=>{}}=o;e||(e=Date.now().toString());const x=Xo[e];y.useEffect(()=>{const z=p==null?void 0:p.current;if(z)return z.addEventListener("transitionend",w),z.addEventListener("keydown",B),()=>{z.removeEventListener("transitionend",w),z.removeEventListener("keydown",B)}},[]);const w=({propertyName:z})=>{z==="opacity"&&(x!==!1&&clearTimeout(x),g(N=>(N==="open"?_():N==="closed"&&F(),N==="opening"?"open":N==="closing"?"closed":N==="closed"?"hidden":N)))},B=z=>{z.key==="Escape"&&(z.stopPropagation(),z.preventDefault(),g("closing"))};Xn(()=>{x!==!1&&clearTimeout(x);let z="open";n?g("opening"):(g("closing"),z="hidden"),Xo[e||""]=setTimeout(()=>{g(z)},300)},[n]);const S={...l};return s&&s.onBlur&&(S.onBlur=s.onBlur),c.jsx("aside",{ref:p,className:G("tooltip text-medium",h,i,{loading:r,"extra-padding":f,"has-pointer":b,bottom:b==="bottom","has-form":v}),...S,children:c.jsx("div",{className:"content",hidden:h==="hidden",children:r?c.jsx("p",{children:d.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?c.jsx("p",{children:a}):a})})}),qr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=xn(e);return t.forEach(({type:r,value:a})=>{Lh(n,r,a)}),n},zc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},qc=(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},Wc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Uc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Hc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Yh=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),zt="https://storage.googleapis.com/apolitical-assets/",Wn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},yr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},ps="SU:",Tr="DELETED",Vc="Invalid token error: Logging user out...",Gh="200,000+",Qh="160+",Sr=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Kc=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function Jh(e){return e?{"--icon":`url(${zt}icons/${e}.svg)`}:{}}const Dn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Zc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Gs=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),gs=e=>{let t;const n=Aa(),r=Aa(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/Dn.milliseconds.inHour,i=Math.floor(t/Dn.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<=Dn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/Dn.year.days)}},Aa=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Xh=(e,t,n)=>{let r;const a=Aa(),i=Aa(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/Dn.milliseconds.inSecond<=t;case"minutes":return r/Dn.milliseconds.inMinute<=t;case"hours":return r/Dn.milliseconds.inHour<=t}return!1},em=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},tm=e=>new Promise(t=>setTimeout(t,e)),nm=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},ir={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",member_deleted:"Deleted user",member_profile:"Update profile",membersList:"Members",membersList_admin:"Admin",membersList_profile:"Update profile",membersList_modal_title:"Update profile",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
31
+ Check the top-level render call using <`+ce+">.")}return oe}}function Yo(O,oe){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var ce=Ih(oe);if(Zo[ce])return;Zo[ce]=!0;var ye="";O&&O._owner&&O._owner!==cr.current&&(ye=" It was passed a child from "+A(O._owner.type)+"."),In(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,ye),In(null)}}function Go(O,oe){{if(typeof O!="object")return;if(De(O))for(var ce=0;ce<O.length;ce++){var ye=O[ce];gi(ye)&&Yo(ye,oe)}else if(gi(O))O._store&&(O._store.validated=!0);else if(O){var je=b(O);if(typeof je=="function"&&je!==O.entries)for(var $e=je.call(O),Ae;!(Ae=$e.next()).done;)gi(Ae.value)&&Yo(Ae.value,oe)}}}function Rh(O){{var oe=O.type;if(oe==null||typeof oe=="string")return;var ce;if(typeof oe=="function")ce=oe.propTypes;else if(typeof oe=="object"&&(oe.$$typeof===l||oe.$$typeof===m))ce=oe.propTypes;else return;if(ce){var ye=A(oe);Be(ce,O.props,"prop",ye,O)}else if(oe.PropTypes!==void 0&&!pi){pi=!0;var je=A(oe);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",je||"Unknown")}typeof oe.getDefaultProps=="function"&&!oe.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function $h(O){{for(var oe=Object.keys(O.props),ce=0;ce<oe.length;ce++){var ye=oe[ce];if(ye!=="children"&&ye!=="key"){In(O),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ye),In(null);break}}O.ref!==null&&(In(O),E("Invalid attribute `ref` supplied to `React.Fragment`."),In(null))}}function Qo(O,oe,ce,ye,je,$e){{var Ae=N(O);if(!Ae){var ke="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(ke+=" 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 st=Nh(je);st?ke+=st:ke+=Ko();var Ge;O===null?Ge="null":De(O)?Ge="array":O!==void 0&&O.$$typeof===t?(Ge="<"+(A(O.type)||"Unknown")+" />",ke=" Did you accidentally export a JSX literal instead of a component?"):Ge=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",Ge,ke)}var Qe=mi(O,oe,ce,je,$e);if(Qe==null)return Qe;if(Ae){var xt=oe.children;if(xt!==void 0)if(ye)if(De(xt)){for(var Rn=0;Rn<xt.length;Rn++)Go(xt[Rn],O);Object.freeze&&Object.freeze(xt)}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 Go(xt,O)}return O===r?$h(Qe):Rh(Qe),Qe}}function Lh(O,oe,ce){return Qo(O,oe,ce,!0)}function zh(O,oe,ce){return Qo(O,oe,ce,!1)}var qh=zh,Wh=Lh;fr.Fragment=r,fr.jsx=qh,fr.jsxs=Wh}()),fr}process.env.NODE_ENV==="production"?ps.exports=Qh():ps.exports=Jh();var c=ps.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},er=(e,t)=>{const n=y.useRef(!1);y.useEffect(()=>{n.current?e():n.current=!0},t)};function Lc(e,t,n){var r=this,a=y.useRef(null),i=y.useRef(0),s=y.useRef(null),o=y.useRef([]),l=y.useRef(),u=y.useRef(),d=y.useRef(e),m=y.useRef(!0);d.current=e;var p=typeof window<"u",h=!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,b="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,E=b?Math.max(+n.maxWait||0,t):null;y.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var B=y.useMemo(function(){var _=function(N){var q=o.current,w=l.current;return o.current=l.current=null,i.current=N,u.current=d.current.apply(w,q)},x=function(N,q){h&&cancelAnimationFrame(s.current),s.current=h?requestAnimationFrame(N):setTimeout(N,q)},T=function(N){if(!m.current)return!1;var q=N-a.current;return!a.current||q>=t||q<0||b&&N-i.current>=E},S=function(N){return s.current=null,f&&o.current?_(N):(o.current=l.current=null,u.current)},$=function N(){var q=Date.now();if(T(q))return S(q);if(m.current){var w=t-(q-a.current),A=b?Math.min(w,E-(q-i.current)):w;x(N,A)}},M=function(){if(p||v){var N=Date.now(),q=T(N);if(o.current=[].slice.call(arguments),l.current=r,a.current=N,q){if(!s.current&&m.current)return i.current=a.current,x($,t),g?_(a.current):u.current;if(b)return x($,t),_(a.current)}return s.current||x($,t),u.current}};return M.cancel=function(){s.current&&(h?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},M.isPending=function(){return!!s.current},M.flush=function(){return s.current?S(Date.now()):u.current},M},[g,b,t,E,f,h,p,v]);return B}function zc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return Lc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let vi;const Pn=(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(vi),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:d})=>{const{id:m}=d;n==="window"||!n.closest(`#${m}`)||s()===r||o()},u=zc(()=>{s()!==r&&(t&&(clearTimeout(vi),document.body.classList.add("is-resizing"),vi=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},qc=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=y.useState({current:0,past:0})||[!1,()=>{}],[s,o]=y.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];y.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const d=window.scrollY,m=a.current,p=d-m,h=p>0?"down":"up";if(i({current:d,past:m}),h==="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=zc(()=>{l()},250);return a},Ys=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=y.useRef(!1);er(()=>{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)},Gs=(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 tu={},Mn=y.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},...l},u)=>{const d=se.useIntl(),m=y.useRef(null),p=u||m,[h,g]=y.useState(n?"open":"hidden"),{extraPadding:f=!0,hasPointer:b=!1,hasForm:v=!1}=t,{onOpen:E=()=>{},onClose:B=()=>{}}=o;e||(e=Date.now().toString());const _=tu[e];y.useEffect(()=>{const $=p==null?void 0:p.current;if($)return $.addEventListener("transitionend",x),$.addEventListener("keydown",T),()=>{$.removeEventListener("transitionend",x),$.removeEventListener("keydown",T)}},[]);const x=({propertyName:$})=>{$==="opacity"&&(_!==!1&&clearTimeout(_),g(M=>(M==="open"?E():M==="closed"&&B(),M==="opening"?"open":M==="closing"?"closed":M==="closed"?"hidden":M)))},T=$=>{$.key==="Escape"&&($.stopPropagation(),$.preventDefault(),g("closing"))};er(()=>{_!==!1&&clearTimeout(_);let $="open";n?g("opening"):(g("closing"),$="hidden"),tu[e||""]=setTimeout(()=>{g($)},300)},[n]);const S={...l};return s&&s.onBlur&&(S.onBlur=s.onBlur),c.jsx("aside",{ref:p,className:Y("tooltip text-medium",h,i,{loading:r,"extra-padding":f,"has-pointer":b,bottom:b==="bottom","has-form":v}),...S,children:c.jsx("div",{className:"content",hidden:h==="hidden",children:r?c.jsx("p",{children:d.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?c.jsx("p",{children:a}):a})})}),Wr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=wn(e);return t.forEach(({type:r,value:a})=>{Uh(n,r,a)}),n},Wc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Uc=(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},Hc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Vc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Kc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Xh=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),qt="https://storage.googleapis.com/apolitical-assets/",Un={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},Dr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},gs="SU:",Sr="DELETED",Zc="Invalid token error: Logging user out...",em="200,000+",tm="160+",jr=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Yc=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function nm(e){return e?{"--icon":`url(${qt}icons/${e}.svg)`}:{}}const Cn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Gc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Qs=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),vs=e=>{let t;const n=Ta(),r=Ta(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/Cn.milliseconds.inHour,i=Math.floor(t/Cn.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<=Cn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/Cn.year.days)}},Ta=e=>{const n=(e||new Date).toUTCString();return new Date(n)},rm=(e,t,n)=>{let r;const a=Ta(),i=Ta(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/Cn.milliseconds.inSecond<=t;case"minutes":return r/Cn.milliseconds.inMinute<=t;case"hours":return r/Cn.milliseconds.inHour<=t}return!1},am=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},im=e=>new Promise(t=>setTimeout(t,e)),sm=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},sr={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",member_deleted:"Deleted user",member_profile:"Update profile",membersList:"Members",membersList_admin:"Admin",membersList_profile:"Update profile",membersList_modal_title:"Update profile",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
32
32
 
33
33
  Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
34
34
 
35
- Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussionFormCard_overlay_title:"Discard post",discussionFormCard_overlay_text:"Are you sure you want to leave without posting? Changes you have made will not be saved.",discussionFormCard_overlay_cta_discard:"Discard",discussionFormCard_overlay_cta_continue:"Continue editing",discussion_form_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_pin:"Pin post",discussion_moreMenu_unpin:"Unpin post",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_share_copy_link:"Copy link",discussion_share_copy_link_success:"Link copied to clipboard",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",profileModalLauncher_successMessage:"Your post has been created",profileModalLauncher_title:"Your profile is incomplete",profileModalLauncher_text:"A complete profile builds trust and amplifies your voice across the community. Ensure all your details are up to date including a photo and a bio.",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",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",profileForm_image:"Upload photo",profileForm_name:"Full name",profileForm_name_placeholder:"What's your name, so people can recognise you?",profileForm_jobTitle:"Job title",profileForm_jobTitle_placeholder:"What's your current job title?",profileForm_organization:"Organisation",profileForm_organization_placeholder:"Where do you work?",profileForm_location:"Location",profileForm_location_placeholder:"Add your city",profileForm_location_error:"Please choose a location from the list.",profileForm_bio:"Bio",profileForm_bio_placeholder:"Tell us more about yourself...",profileForm_cta:"Save",profileForm_cta_submitting:"Saving...",profileForm_cta_submitted:"Saved",profileImageChange_cta_uploading:"Uploading image...",profileImageChange_cta_change:"Change photo",profileImageChange_cta_upload:"+ Add profile photo",profileImageChange_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",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",profileModal_title:"Update your profile",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",editSection_placeholder_description:"Add some details",editSection_placeholder_cta:"add",editSection_edit:"Edit",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},rm={...ir,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>"},am={...ir,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"},im={...ir,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>"},sm=Object.freeze(Object.defineProperty({__proto__:null,en:ir,es:rm,fr:am,pt:im},Symbol.toStringTag,{value:"Module"})),Qa=(e,t=ir)=>e in t,At=(e,t,n,r,a={})=>{let i="";return Qa(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},om=(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},ya=(e,t)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),Yc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},um=e=>{var i,s,o;const n=["name","organization","jobTitle","biography"].every(l=>{const u=e[l];return u!=null&&u!==""}),r=((i=e.image)==null?void 0:i.thumbnail)!==void 0,a=((s=e.location)==null?void 0:s.en)!==void 0||((o=e.location)==null?void 0:o.country)!==void 0;return n&&r&&a},lm=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,Tr).replace(/{{id}}/g,Tr):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Gc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(Sr);if(!a)return e;for(const s of a){const o=s.replace(Sr,(d,m)=>m),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=l.error?l.error:((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"",u.error=l.error;else{const d=l;if(d.startsWith(ps))try{const m=d.replace(ps,"");u.id=m,await r({id:m}).then(p=>{const{name:h,error:g}=p;u.name=g||h||"",u.error=g})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?lm(e,u,t):s)}return e},Qc=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Jc=e=>new URLSearchParams(window.location.search).get(e),eu=(e="")=>e.replace(/\s+/g,"").length>0,vs=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:m=!1,...p})=>{const g=On(typeof t=="object"),{showTooltip:f,tooltipProps:b}=Ys(!!u);if(typeof t=="object"&&typeof g=="number"){const x=Object.assign({},t),w=zc(Object.keys(x));t=qc(g,w,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 _={...p,className:G(e,o,v,{"no-text":!m,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",_.href=a);const F=y.createElement(i,_,m||(d?c.jsx(Ie,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...b,children:[c.jsx(Pn,{isOpen:f,children:u}),F]}):F},sr=({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 y.createElement(a,{className:G("button-wrapper",n),...r,children:i})};const qt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:G(e,{"has-max-width":t}),style:n})},tu={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"}},cm=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?tu[e]:tu.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},dm=({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},vi=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${dm({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const or=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:m}=e,{range:p,sizes:h}=cm(e),g=vi({format:"avif",query:s,range:p,url:o}),f=vi({format:"webp",query:s,range:p,url:o}),b=vi({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:m||"auto",width:l,height:a,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[i!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:g,sizes:h,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:h,"data-testid":"source"}),c.jsx("img",{srcSet:b,sizes:h,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:m||"auto",width:l,height:a,"data-testid":n||"image"})]})};const fm=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(or,{image:{...e},className:"image"})}),dn=({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:G("gtm-trackable",r),...l,children:t})}return n?y.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const Xc=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:G("popover",e),"aria-live":"polite",children:t})}),Wr=({parent:e=document.body,children:t})=>typeof document=="object"?Oc.createPortal(t,e):null,hm=Object.freeze(Object.defineProperty({__proto__:null,default:Wr},Symbol.toStringTag,{value:"Module"}));const mm=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Ie,{children:c.jsx(se.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:G("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:G("line",{active:a<e})})]},r)})})})]});const pm=({elementId:e,offset:t=20})=>{const n=se.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 gm=({items:e,className:t="",...n})=>c.jsx("ul",{className:G("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))}),nu=300,ru="ease-in-out";class vm{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:nu,easing:ru}),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:nu,easing:ru}),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 Ja=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=se.useIntl(),i=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new vm(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:G("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},au={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},bm=e=>{let t=e;return Object.keys(au).includes(e)&&(t=au[e]),`url(${zt}icons/${t}.svg)`};const iu={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},ed=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=se.useIntl(),i=t?{"--custom-icon":bm(t)}:{},s=Qa(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:G("content-type-label text-small",e in iu?iu[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const jt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${zt}icons/${t}.svg)`}:{};return c.jsx("div",{className:G("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const fn=({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=On(i);if(i&&typeof n=="object"&&typeof s=="number"){const m=Object.assign({},n.breakpoints),p=zc(Object.keys(m));a=qc(s,p,m)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(jt,{variant:"subtle",className:G("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(Lt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(_e,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const bs=({children:e,...t})=>c.jsx("p",{...t,children:e}),td={q:bs,blockquote:bs};for(let e=1;e<=6;e++)td[`h${e}`]={component:bs,props:{className:"title"}};const nd=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:G("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(Lt,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:td},children:r}):c.jsx("p",{children:r})]});const rd=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,fadeStyle:s="default",children:o})=>{const l=se.useIntl(),u=y.useRef(null);e||(e=Date.now().toString());const[d,m]=y.useState(""),[p,h]=y.useState("closed");y.useEffect(()=>{const b=u.current;if(b)return b.addEventListener("transitionend",g),()=>{b.removeEventListener("transitionend",g)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const b=a.split(`
35
+ Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussionFormCard_overlay_title:"Discard post",discussionFormCard_overlay_text:"Are you sure you want to leave without posting? Changes you have made will not be saved.",discussionFormCard_overlay_cta_discard:"Discard",discussionFormCard_overlay_cta_continue:"Continue editing",discussion_form_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_pin:"Pin post",discussion_moreMenu_unpin:"Unpin post",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_share_copy_link:"Copy link",discussion_share_copy_link_success:"Link copied to clipboard",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",profileModalLauncher_successMessage:"Your post has been created",profileModalLauncher_title:"Your profile is incomplete",profileModalLauncher_text:"A complete profile builds trust and amplifies your voice across the community. Ensure all your details are up to date including a photo and a bio.",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",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",profileForm_image:"Upload photo",profileForm_name:"Full name",profileForm_name_placeholder:"What's your name, so people can recognise you?",profileForm_jobTitle:"Job title",profileForm_jobTitle_placeholder:"What's your current job title?",profileForm_organization:"Organisation",profileForm_organization_placeholder:"Where do you work?",profileForm_location:"Location",profileForm_location_placeholder:"Add your city",profileForm_location_error:"Please choose a location from the list.",profileForm_bio:"Bio",profileForm_bio_placeholder:"Tell us more about yourself...",profileForm_cta:"Save",profileForm_cta_submitting:"Saving...",profileForm_cta_submitted:"Saved",profileImageChange_cta_uploading:"Uploading image...",profileImageChange_cta_change:"Change photo",profileImageChange_cta_upload:"+ Add profile photo",profileImageChange_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",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",profileModal_title:"Update your profile",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",editSection_placeholder_description:"Add some details",editSection_placeholder_cta:"add",editSection_edit:"Edit",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},om={...sr,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>"},um={...sr,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"},lm={...sr,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>"},cm=Object.freeze(Object.defineProperty({__proto__:null,en:sr,es:om,fr:um,pt:lm},Symbol.toStringTag,{value:"Module"})),Ja=(e,t=sr)=>e in t,Tt=(e,t,n,r,a={})=>{let i="";return Ja(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},dm=(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},Da=(e,t)=>y.Children.map(e,n=>Object.is(n,null)?n:y.cloneElement(n,{...t})),Qc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},fm=e=>{var i,s,o;const n=["name","organization","jobTitle","biography"].every(l=>{const u=e[l];return u!=null&&u!==""}),r=((i=e.image)==null?void 0:i.thumbnail)!==void 0,a=((s=e.location)==null?void 0:s.en)!==void 0||((o=e.location)==null?void 0:o.country)!==void 0;return n&&r&&a},hm=(e,t,n)=>!t.id||!t.name?"":t.error?n.replace(/{{name}}/g,Sr).replace(/{{id}}/g,Sr):n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Jc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(jr);if(!a)return e;for(const s of a){const o=s.replace(jr,(d,m)=>m),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=l.error?l.error:((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"",u.error=l.error;else{const d=l;if(d.startsWith(gs))try{const m=d.replace(gs,"");u.id=m,await r({id:m}).then(p=>{const{name:h,error:g}=p;u.name=g||h||"",u.error=g})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?hm(e,u,t):s)}return e},Xc=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},ed=e=>new URLSearchParams(window.location.search).get(e),nu=(e="")=>e.replace(/\s+/g,"").length>0,bs=e=>{const t=e.length>8,n=/[0-9]/.test(e)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(e),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(e);return{isValid:t&&n&&r,matchingRules:{isMoreThanEightCharacters:t,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}};const Ee=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:d=!1,children:m=!1,...p})=>{const g=Pn(typeof t=="object"),{showTooltip:f,tooltipProps:b}=Gs(!!u);if(typeof t=="object"&&typeof g=="number"){const _=Object.assign({},t),x=Wc(Object.keys(_));t=Uc(g,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":!m,disabled:l,button:a}),onClick:_=>{(!a||a[0]==="#")&&s&&(_.preventDefault(),_.stopPropagation()),s&&s(_)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",E.href=a);const B=y.createElement(i,E,m||(d?c.jsx(Ne,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...b,children:[c.jsx(Mn,{isOpen:f,children:u}),B]}):B},or=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?c.jsx(Ee,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(Ee,{...s})},o)});return y.createElement(a,{className:Y("button-wrapper",n),...r,children:i})};const Wt=({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})},ru={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"}},mm=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?ru[e]:ru.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},pm=({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},bi=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${pm({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const ur=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:m}=e,{range:p,sizes:h}=mm(e),g=bi({format:"avif",query:s,range:p,url:o}),f=bi({format:"webp",query:s,range:p,url:o}),b=bi({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:m||"auto",width:l,height:a,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[i!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:g,sizes:h,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:h,"data-testid":"source"}),c.jsx("img",{srcSet:b,sizes:h,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:m||"auto",width:l,height:a,"data-testid":n||"image"})]})};const gm=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(ur,{image:{...e},className:"image"})}),fn=({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?y.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const td=y.forwardRef(({className:e="",children:t},n)=>{const r=y.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:Y("popover",e),"aria-live":"polite",children:t})}),Ur=({parent:e=document.body,children:t})=>typeof document=="object"?Mc.createPortal(t,e):null,vm=Object.freeze(Object.defineProperty({__proto__:null,default:Ur},Symbol.toStringTag,{value:"Module"}));const bm=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Ne,{children:c.jsx(se.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 ym=({elementId:e,offset:t=20})=>{const n=se.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return c.jsx(Ee,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const Dm=({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))}),au=300,iu="ease-in-out";class Cm{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:au,easing:iu}),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:au,easing:iu}),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 Xa=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=se.useIntl(),i=y.useRef(null);return y.useEffect(()=>{let s;return r&&(s=new Cm(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})]})},su={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},xm=e=>{let t=e;return Object.keys(su).includes(e)&&(t=su[e]),`url(${qt}icons/${t}.svg)`};const ou={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},nd=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=se.useIntl(),i=t?{"--custom-icon":xm(t)}:{},s=Ja(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:Y("content-type-label text-small",e in ou?ou[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Ot=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${qt}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 hn=({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=Pn(i);if(i&&typeof n=="object"&&typeof s=="number"){const m=Object.assign({},n.breakpoints),p=Wc(Object.keys(m));a=Uc(s,p,m)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(Ot,{variant:"subtle",className:Y("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(zt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(Ee,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const ys=({children:e,...t})=>c.jsx("p",{...t,children:e}),rd={q:ys,blockquote:ys};for(let e=1;e<=6;e++)rd[`h${e}`]={component:ys,props:{className:"title"}};const ad=({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(zt,{options:{wrapper:y.Fragment,forceBlock:!0,overrides:rd},children:r}):c.jsx("p",{children:r})]});const id=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,fadeStyle:s="default",children:o})=>{const l=se.useIntl(),u=y.useRef(null);e||(e=Date.now().toString());const[d,m]=y.useState(""),[p,h]=y.useState("closed");y.useEffect(()=>{const b=u.current;if(b)return b.addEventListener("transitionend",g),()=>{b.removeEventListener("transitionend",g)}},[]),y.useEffect(()=>{if(!a||typeof a!="string")return;const b=a.split(`
36
36
  `);m(b.length<3?`${a.substring(0,400)}...`:b.slice(0,3).join(`
37
- `))},[a]),y.useEffect(()=>{p==="ready-to-close"&&h("closing")},[p]);const g=({propertyName:b})=>{b==="max-height"&&h(v=>v==="opening"?"open":v==="closing"?"closed":v)},f=["opening","open"].includes(p);return c.jsxs(jt,{variant:"subtle",className:G("hide-show-text-box",t),children:[c.jsx("div",{ref:u,id:e,className:G("content",p,s),children:a?c.jsxs(c.Fragment,{children:[c.jsx(Lt,{options:{forceBlock:!0,...i},children:p==="closed"?d:a}),p!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(_e,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:G({"rotate-180":f}),onClick:()=>{h(f?"ready-to-close":"opening")},"aria-expanded":f,"aria-controls":e,children:f?r||l.formatMessage({id:"hideShowTextBox_hide"}):n||l.formatMessage({id:"hideShowTextBox_show"})})})]})};const ym=({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:G("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const d={wrapper:y.Fragment,forceInline:!0},m={"--icon":`url(${zt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(y.Fragment,{children:[c.jsx("dt",{style:m,children:c.jsx(Lt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(Lt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:m,children:typeof l.text=="string"?c.jsx(Lt,{options:d,children:l.text}):l.text},u)})})},rt=()=>y.Fragment,Dm=({children:e})=>c.jsx(jt,{variant:"secondary",children:e}),Cm=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),xm=["span","strong","h1","h2","h3","h4","h5","h6","p"],wm=({children:e})=>{const t=se.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(xm.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return c.jsx(Ja,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},Em=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(jt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(jt,{variant:"primary",children:e});case"pink-textbox":return c.jsx(jt,{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})},wt=({children:e})=>c.jsx(c.Fragment,{children:e}),_m=e=>{const t=se.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}`})]})},su=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},km=({children:e,...t})=>{const n=se.useIntl();let r={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(r.target="_blank");let a=e,i=!1;for(const o of y.Children.toArray(e))if(!(!o||typeof o=="string"||typeof o=="number")&&y.isValidElement(o)){const l=o.type;if(["button","center","span","strong"].includes(l)&&o.props&&o.props.children&&o.props.children[0])for((l==="button"||su(o.props.children[0])==="button")&&(i=!0),a=o.props.children[0];a&&typeof a!="string"&&!(typeof a=="boolean"||typeof a=="number"||!y.isValidElement(a));)if(a.props&&a.props.children&&a.props.children[0])a=a.props.children[0],a&&su(a)==="button"&&(i=!0);else break}const s=`@${Tr}`;return a===s||Array.isArray(a)&&a[0]===s?(delete r.href,delete r.target,c.jsxs("span",{...r,className:"mention deleted-user",children:["@",n.formatMessage({id:"member_deleted"})]})):i?(r={...r,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(_e,{variant:"primary",size:"medium",...r,children:a})})):c.jsx("a",{...r,children:a})},ys=({children:e,...t})=>c.jsx("span",{className:G({url:t==null?void 0:t.href}),children:e});const Fm={default:{a:km,CollapsibleSection:Ja,TextBox:jt,CaseStudy:Dm,style:rt,details:wm,div:Em,iframe:_m,center:Cm},"text-only":{h1:rt,h2:rt,h3:rt,h4:rt,h5:rt,h6:rt,style:rt,details:rt,div:rt,TextBox:rt,CollapsibleSection:rt,CaseStudy:rt,blockquote:rt,iframe:rt,button:rt}},kn=({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:G("markdown-text",t,{"highlight-titles":s}),children:c.jsx(Lt,{options:{...o,...n,overrides:l},children:r})})};const ad=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:G("page-heading",a),children:[c.jsxs("div",{className:G("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 ln=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${zt}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=Ys(!!a),d=c.jsx("span",{...u,className:G("pill",e,t,n,{"has-icon":r}),style:o,...s,children:i});return a?c.jsxs("span",{className:"pill-wrapper",children:[c.jsx(Pn,{isOpen:l,children:a}),d]}):d};const jr=({element:e="p",children:t=null,className:n="",...r})=>y.createElement(e,{...r,className:G("status-banner text-small",n),"aria-live":"assertive"},t);const Bm=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=se.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:G(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:y.createElement(i?"span":Ie,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},Qs=y.memo(Bm);const bi="loadingBlock_",Am=({progress:e=0,steps:t=!1,className:n=""})=>{const r=se.useIntl();t||(t={0:{text:r.formatMessage({id:`${bi}loading`})},75:{text:r.formatMessage({id:`${bi}almostDone`})},100:{text:r.formatMessage({id:`${bi}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(${zt}icons/${t[a].icon}.svg)`}:{};return c.jsxs(jt,{className:G("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(Qs,{progress:e})]})},Tm=y.memo(Am);const Ft=({element:e="div",className:t="",...n})=>c.jsx(Ga,{element:e,className:G("loading-placeholder",t),...n});const Ds={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"]},id=(e,t)=>e in Ds?c.jsx("div",{className:e,children:Ds[e].map((n,r)=>id(n,r))},t):c.jsx(Ft,{className:e},t),Js=({layout:e="overview-page",...t})=>c.jsx("div",{className:G("loading-state",e),...t,children:Ds[e].map((n,r)=>id(n,r))}),sd=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):""},Gr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Sm=e=>{const t=Math.ceil(26/Gr.length),n=sd(e).toLowerCase();if(n==="")return Gr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Gr.length;a++)if(r<=t*(a+1))return Gr[a]};const ou=256,hn=({className:e="",src:t="",name:n,alt:r,width:a=ou,height:i=ou,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),d=y.useRef(null),m=r??n;y.useEffect(()=>{const h=d.current;if(!h)return;const g=h.getContext("2d");if(!g)return;const f=a,b=i;typeof window<"u"&&window.devicePixelRatio&&(h.width=f*window.devicePixelRatio,h.height=b*window.devicePixelRatio,g.scale(window.devicePixelRatio,window.devicePixelRatio)),g.fillStyle=Sm(n),g.fillRect(0,0,f,b),g.font=`${f/3}px Arial`,g.textAlign="center",g.fillStyle="white",g.fillText(sd(n),f/2,b/1.6)},[n]);let p=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(p=!0),c.jsx("figure",{className:G("profile-picture",e,{error:l}),...o,children:p?c.jsx("img",{src:t,alt:m,onError:()=>{u(!0)},width:a,height:i}):s?c.jsx("canvas",{ref:d}):c.jsx("span",{className:"fallback"})})},od=({showDevTools:e=!0,children:t})=>{const n=new qe.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(qe.QueryClientProvider,{client:n,children:[t,e&&c.jsx(zh.ReactQueryDevtools,{initialIsOpen:!1})]})};var ud=y.createContext({client:ba});function jm(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&&(ba.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),ba.init(r,a)),ba)},[n,r]);return y.createElement(ud.Provider,{value:{client:i}},t)}var Om=function(){var e=y.useContext(ud).client;return e};function Pm(e){var t=Om(),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 ld=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(jm,{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 Xs=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(Xs||{});const cd=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...sm[r],...n||{}};return c.jsx(se.IntlProvider,{locale:r,messages:a,children:e})},eo=y.createContext({}),Da={en:"English",es:"Español",fr:"Français",pt:"Português"},mt=y.createContext({isLoading:!0});function Xa(){return y.useContext(mt)}const dd=({children:e,user:t,updateDetails:n})=>c.jsx(mt.Provider,{value:{...t,updateDetails:n},children:e}),to=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),fd=()=>y.useContext(to),hd=({children:e})=>{const[t,n]=y.useState([]);y.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=y.useCallback(i=>{n(s=>[...s,i])},[]),a=y.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return c.jsx(to.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Nm=({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=d=>{localStorage.setItem("language",d),l(d)};return y.useEffect(()=>{e().then(d=>{i({...d,isLoading:!1}),Yc(5e3)}).catch(d=>{d.message===Vc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),c.jsx(eo.Provider,{value:{language:o,updateLanguage:u},children:c.jsx(cd,{locale:o,messages:n==null?void 0:n.messages,children:c.jsx(Ks.CookiesProvider,{children:c.jsx(dd,{user:a,updateDetails:i,children:c.jsx(hd,{children:c.jsx(od,{showDevTools:r,children:c.jsx(ld,{user:a,children:t})})})})})})})};var Xe=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(Xe||{});const ei=e=>e==="apolitical"?{image:`${zt}logos/member_apolitical.svg`}:e==="community"||e==="deleted"||typeof e=="object"&&!e.name?{image:`${zt}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.en||e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},Mm=({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=Jn(l,r)),l};const Im=y.lazy(()=>Promise.resolve().then(()=>hm)),Rm=y.lazy(()=>Promise.resolve().then(()=>GE));let Qr=null;const Yt=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:a={},functions:i={},gtmContext:s="member",gtmType:o="member-click",className:l="",...u})=>{const d=se.useIntl(),{profile:m,...p}=i,{size:h="medium",variant:g="inline",isCondensed:f=!0}=a,b=y.useContext(mt),v=m&&b&&typeof b.id=="string",[_,F]=y.useState(!1),x=ei(t);x.name||(x.name=d.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:w,image:B}=x;let{url:S}=x;typeof t=="object"&&t.link!==void 0&&(t.link===!1?S=void 0:S=t.link);const z=Mm(x),N=r&&r.createdAt?gs(r.createdAt):!1,I=r&&r.createdAt?Gs(r.createdAt):"";return y.createElement(e,{...u,className:G("member text-medium",h,g,l,{"has-profile-link":v}),...p,children:c.jsxs(c.Fragment,{children:[c.jsxs(dn,{href:S,gtmType:o,gtmContext:s,onClick:M=>{if(M==null||M.preventDefault(),M==null||M.stopPropagation(),!S)return;Qr&&clearTimeout(Qr),Qr=setTimeout(()=>{window.location.href=S},150);const k=new CustomEvent(Xe.MEMBER_CLICKED,{detail:{link:S,timeout:Qr}});document.dispatchEvent(k)},children:[c.jsx(hn,{name:w,src:B,alt:n}),c.jsxs("p",{className:"details",children:[c.jsxs("strong",{"data-testid":"member-name",children:[w,r&&c.jsxs("span",{className:"additional-content",children:[r.createdAt&&N&&c.jsx("span",{className:"date",title:I,"aria-label":I,"data-testid":"date",children:d.formatMessage({id:`dates_${N.path}`},{number:N.number})}),r.didEdit&&c.jsx("em",{children:d.formatMessage({id:"discussion_edited"})})]})]}),z&&c.jsx("small",{className:G({"text-medium":h==="large"}),"data-testid":"member-details",children:f?z:c.jsxs(c.Fragment,{children:[x.role,x.organisation?` — ${x.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:x.country})]})})]})]}),z&&m&&v?c.jsxs(c.Fragment,{children:[c.jsx(_e,{variant:"tertiary",size:"small",onClick:M=>{M.preventDefault(),M.stopPropagation(),F(!0)},"data-testid":"profile-button",children:d.formatMessage({id:"member_profile"})}),c.jsx(Im,{children:c.jsx(Rm,{form:m,showModal:_,content:{title:d.formatMessage({id:"member_profile"})},functions:{onClose:()=>{F(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},$m=Object.freeze(Object.defineProperty({__proto__:null,default:Yt},Symbol.toStringTag,{value:"Module"}));const uu={small:24,medium:48},no=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...d})=>{const m=se.useIntl();return!n||n.length===0?null:y.createElement(e,{...d,className:G("contributors",u,a,{"has-gap":i}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((p,h)=>{let g,f="";if(h<o){const{name:b="",image:v=""}=ei(p);if(s)return c.jsx(Ft,{element:"li",className:"contributor"},h);g=c.jsx(hn,{name:b,src:v,width:uu[a||"medium"],height:uu[a||"medium"]})}else if(h===o){const b=(t||n.length)-o;g=c.jsxs("small",{className:G({"large-number":b>99}),children:["+",om(b,0)]}),f="number-left"}return g?c.jsx("li",{className:G("contributor",f),children:g},h):null})}),r&&c.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?m.formatMessage({id:`member_${n[0]}`}):Jn(n[0].name||"",20):l||null})]})})};const ro=({element:e="section",children:t,className:n,...r})=>y.createElement(e,{className:G("modal",n),children:typeof t=="string"?c.jsx("p",{children:t}):t,...r});var Cs={exports:{}},Jr={exports:{}},Ne={};/** @license React v16.13.1
37
+ `))},[a]),y.useEffect(()=>{p==="ready-to-close"&&h("closing")},[p]);const g=({propertyName:b})=>{b==="max-height"&&h(v=>v==="opening"?"open":v==="closing"?"closed":v)},f=["opening","open"].includes(p);return c.jsxs(Ot,{variant:"subtle",className:Y("hide-show-text-box",t),children:[c.jsx("div",{ref:u,id:e,className:Y("content",p,s),children:a?c.jsxs(c.Fragment,{children:[c.jsx(zt,{options:{forceBlock:!0,...i},children:p==="closed"?d:a}),p!=="closed"&&o]}):o}),c.jsx("p",{className:"cta",children:c.jsx(Ee,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Y({"rotate-180":f}),onClick:()=>{h(f?"ready-to-close":"opening")},"aria-expanded":f,"aria-controls":e,children:f?r||l.formatMessage({id:"hideShowTextBox_hide"}):n||l.formatMessage({id:"hideShowTextBox_show"})})})]})};const wm=({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 d={wrapper:y.Fragment,forceInline:!0},m={"--icon":`url(${qt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(y.Fragment,{children:[c.jsx("dt",{style:m,children:c.jsx(zt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(zt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:m,children:typeof l.text=="string"?c.jsx(zt,{options:d,children:l.text}):l.text},u)})})},at=()=>y.Fragment,Em=({children:e})=>c.jsx(Ot,{variant:"secondary",children:e}),_m=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),km=["span","strong","h1","h2","h3","h4","h5","h6","p"],Fm=({children:e})=>{const t=se.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(km.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(Xa,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},Bm=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(Ot,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(Ot,{variant:"primary",children:e});case"pink-textbox":return c.jsx(Ot,{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})},Et=({children:e})=>c.jsx(c.Fragment,{children:e}),Am=e=>{const t=se.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(Ne,{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}`})]})},uu=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Tm=({children:e,...t})=>{const n=se.useIntl();let r={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(r.target="_blank");let a=e,i=!1;for(const o of y.Children.toArray(e))if(!(!o||typeof o=="string"||typeof o=="number")&&y.isValidElement(o)){const l=o.type;if(["button","center","span","strong"].includes(l)&&o.props&&o.props.children&&o.props.children[0])for((l==="button"||uu(o.props.children[0])==="button")&&(i=!0),a=o.props.children[0];a&&typeof a!="string"&&!(typeof a=="boolean"||typeof a=="number"||!y.isValidElement(a));)if(a.props&&a.props.children&&a.props.children[0])a=a.props.children[0],a&&uu(a)==="button"&&(i=!0);else break}const s=`@${Sr}`;return a===s||Array.isArray(a)&&a[0]===s?(delete r.href,delete r.target,c.jsxs("span",{...r,className:"mention deleted-user",children:["@",n.formatMessage({id:"member_deleted"})]})):i?(r={...r,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(Ee,{variant:"primary",size:"medium",...r,children:a})})):c.jsx("a",{...r,children:a})},Ds=({children:e,...t})=>c.jsx("span",{className:Y({url:t==null?void 0:t.href}),children:e});const Sm={default:{a:Tm,CollapsibleSection:Xa,TextBox:Ot,CaseStudy:Em,style:at,details:Fm,div:Bm,iframe:Am,center:_m},"text-only":{h1:at,h2:at,h3:at,h4:at,h5:at,h6:at,style:at,details:at,div:at,TextBox:at,CollapsibleSection:at,CaseStudy:at,blockquote:at,iframe:at,button:at}},Fn=({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=Sm[a];return n.overrides&&(l={...l,...n.overrides}),y.createElement(e,{className:Y("markdown-text",t,{"highlight-titles":s}),children:c.jsx(zt,{options:{...o,...n,overrides:l},children:r})})};const sd=({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&&y.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&y.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Gt=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${qt}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=Gs(!!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(Mn,{isOpen:l,children:a}),d]}):d};const Or=({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 jm=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=se.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:y.createElement(i?"span":Ne,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},Js=y.memo(jm);const yi="loadingBlock_",Om=({progress:e=0,steps:t=!1,className:n=""})=>{const r=se.useIntl();t||(t={0:{text:r.formatMessage({id:`${yi}loading`})},75:{text:r.formatMessage({id:`${yi}almostDone`})},100:{text:r.formatMessage({id:`${yi}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(${qt}icons/${t[a].icon}.svg)`}:{};return c.jsxs(Ot,{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(Js,{progress:e})]})},Pm=y.memo(Om);const Bt=({element:e="div",className:t="",...n})=>c.jsx(Qa,{element:e,className:Y("loading-placeholder",t),...n});const Cs={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"]},od=(e,t)=>e in Cs?c.jsx("div",{className:e,children:Cs[e].map((n,r)=>od(n,r))},t):c.jsx(Bt,{className:e},t),Xs=({layout:e="overview-page",...t})=>c.jsx("div",{className:Y("loading-state",e),...t,children:Cs[e].map((n,r)=>od(n,r))}),ud=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):""},Qr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Mm=e=>{const t=Math.ceil(26/Qr.length),n=ud(e).toLowerCase();if(n==="")return Qr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Qr.length;a++)if(r<=t*(a+1))return Qr[a]};const lu=256,mn=({className:e="",src:t="",name:n,alt:r,width:a=lu,height:i=lu,showInitials:s=!0,...o})=>{const[l,u]=y.useState(!1),d=y.useRef(null),m=r??n;y.useEffect(()=>{const h=d.current;if(!h)return;const g=h.getContext("2d");if(!g)return;const f=a,b=i;typeof window<"u"&&window.devicePixelRatio&&(h.width=f*window.devicePixelRatio,h.height=b*window.devicePixelRatio,g.scale(window.devicePixelRatio,window.devicePixelRatio)),g.fillStyle=Mm(n),g.fillRect(0,0,f,b),g.font=`${f/3}px Arial`,g.textAlign="center",g.fillStyle="white",g.fillText(ud(n),f/2,b/1.6)},[n]);let p=!1;return t&&t!==""&&!l&&(t.includes("http")||t.includes("//"))&&(p=!0),c.jsx("figure",{className:Y("profile-picture",e,{error:l}),...o,children:p?c.jsx("img",{src:t,alt:m,onError:()=>{u(!0)},width:a,height:i}):s?c.jsx("canvas",{ref:d}):c.jsx("span",{className:"fallback"})})},eo=y.createContext({badges:[],isLoading:!0});function ld(){return y.useContext(eo)}const cd=({children:e,badges:t})=>c.jsx(eo.Provider,{value:t,children:e}),dd=({showDevTools:e=!0,children:t})=>{const n=new qe.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(qe.QueryClientProvider,{client:n,children:[t,e&&c.jsx(Hh.ReactQueryDevtools,{initialIsOpen:!1})]})};var fd=y.createContext({client:ya});function Nm(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&&(ya.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),ya.init(r,a)),ya)},[n,r]);return y.createElement(fd.Provider,{value:{client:i}},t)}var Im=function(){var e=y.useContext(fd).client;return e};function Rm(e){var t=Im(),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 hd=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(Nm,{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 to=(e=>(e.COMMUNITY_RANKING="community-ranking",e))(to||{});const md=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...cm[r],...n||{}};return c.jsx(se.IntlProvider,{locale:r,messages:a,children:e})},no=y.createContext({}),Ca={en:"English",es:"Español",fr:"Français",pt:"Português"},gt=y.createContext({isLoading:!0});function ei(){return y.useContext(gt)}const pd=({children:e,user:t,updateDetails:n})=>c.jsx(gt.Provider,{value:{...t,updateDetails:n},children:e}),ro=y.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),gd=()=>y.useContext(ro),vd=({children:e})=>{const[t,n]=y.useState([]);y.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=y.useCallback(i=>{n(s=>[...s,i])},[]),a=y.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return c.jsx(ro.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},$m=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=y.useState({isLoading:!0}),[s,o]=y.useState({badges:[],isLoading:!0}),l=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[u,d]=y.useState(l),m=p=>{localStorage.setItem("language",p),d(p)};return y.useEffect(()=>{e().then(p=>{Array.isArray(p)?(i({...p[0],isLoading:!1}),o({badges:p[1],isLoading:!1})):i({...p,isLoading:!1}),Qc(5e3)}).catch(p=>{p.message===Zc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1}),o({badges:[],isLoading:!1})})},[]),c.jsx(no.Provider,{value:{language:u,updateLanguage:m},children:c.jsx(md,{locale:u,messages:n==null?void 0:n.messages,children:c.jsx(Zs.CookiesProvider,{children:c.jsx(pd,{user:a,updateDetails:i,children:c.jsx(cd,{badges:s,children:c.jsx(vd,{children:c.jsx(dd,{showDevTools:r,children:c.jsx(hd,{user:a,children:t})})})})})})})})};var Xe=(e=>(e.DISCUSSION_FORM_SUBMITTED="discussionFormSubmitted",e.DISCUSSION_POST_ADDED="discussionPostAdded",e.DISCUSSION_POST_CLICKED="discussionPostClicked",e.MEMBER_CLICKED="memberClicked",e))(Xe||{});const ti=e=>e==="apolitical"?{image:`${qt}logos/member_apolitical.svg`}:e==="community"||e==="deleted"||typeof e=="object"&&!e.name?{image:`${qt}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.en||e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail,badges:e.badges},Lm=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const a=e!=="",i=t!=="",s=n!=="";if(!a&&!i&&!s)return"";const o=`${e}${a&&i?` — ${t}`:t}`;let l=`${o}${(a||i)&&s?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=Xn(l,r)),l};const zm={globe:"globe",heart:"heart_empty_thick",pencil:"pencil",star:"star_empty","speech-bubble":"speech-bubble_round"};const qm=({slug:e})=>{const{badges:t}=ld(),n=t==null?void 0:t.find(s=>s.slug===e);if(!n)return null;const{name:r,icon:a,colour:i}=n;return c.jsx(Gt,{className:Y("user-badge",i==null?void 0:i.toLowerCase()),icon:a&&zm[a],children:r})};const Wm=({element:e="ul",userBadges:t,badgeOptions:n})=>{var r,a;if(Object.keys(t).length!==0)return y.createElement(e,{className:"badges-list",children:n.scope&&n.area&&((a=(r=t==null?void 0:t[n.scope])==null?void 0:r[n.area])==null?void 0:a.map((i,s)=>c.jsx("li",{children:c.jsx(qm,{slug:i})},s)))})},Um=y.lazy(()=>Promise.resolve().then(()=>vm)),Hm=y.lazy(()=>Promise.resolve().then(()=>r_));let Jr=null;const Qt=({element:e="div",member:t="community",alt:n="",additionalContent:r=!1,styling:a={},functions:i={},gtmContext:s="member",gtmType:o="member-click",className:l="",badges:u,...d})=>{const m=se.useIntl(),{profile:p,...h}=i,{size:g="medium",variant:f="inline",isCondensed:b=!0}=a,v=y.useContext(gt),E=p&&v&&typeof v.id=="string",[B,_]=y.useState(!1),x=ti(t);x.name||(x.name=m.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:T,image:S}=x;let{url:$}=x;typeof t=="object"&&t.link!==void 0&&(t.link===!1?$=void 0:$=t.link);const M=Lm(x),N=r&&r.createdAt?vs(r.createdAt):!1,q=r&&r.createdAt?Qs(r.createdAt):"";return y.createElement(e,{...d,className:Y("member text-medium",g,f,l,{"has-profile-link":E}),...h,children:c.jsxs(c.Fragment,{children:[c.jsxs(fn,{href:$,gtmType:o,gtmContext:s,onClick:w=>{if(w==null||w.preventDefault(),w==null||w.stopPropagation(),!$)return;Jr&&clearTimeout(Jr),Jr=setTimeout(()=>{window.location.href=$},150);const A=new CustomEvent(Xe.MEMBER_CLICKED,{detail:{link:$,timeout:Jr}});document.dispatchEvent(A)},children:[c.jsx(mn,{name:T,src:S,alt:n}),c.jsxs("p",{className:"details",children:[c.jsxs("strong",{"data-testid":"member-name",children:[T,(u==null?void 0:u.showBadges)&&(x==null?void 0:x.badges)&&c.jsx(Wm,{userBadges:x.badges,badgeOptions:u}),r&&c.jsxs("span",{className:"additional-content",children:[r.createdAt&&N&&c.jsx("span",{className:"date",title:q,"aria-label":q,"data-testid":"date",children:m.formatMessage({id:`dates_${N.path}`},{number:N.number})}),r.didEdit&&c.jsx("em",{children:m.formatMessage({id:"discussion_edited"})})]})]}),M&&c.jsx("small",{className:Y({"text-medium":g==="large"}),"data-testid":"member-details",children:b?M:c.jsxs(c.Fragment,{children:[x.role,x.organisation?` — ${x.organisation}`:c.jsx(c.Fragment,{}),c.jsx("span",{className:"location",children:x.country})]})})]})]}),M&&p&&E?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"tertiary",size:"small",onClick:w=>{w.preventDefault(),w.stopPropagation(),_(!0)},"data-testid":"profile-button",children:m.formatMessage({id:"member_profile"})}),c.jsx(Um,{children:c.jsx(Hm,{form:p,showModal:B,content:{title:m.formatMessage({id:"member_profile"})},functions:{onClose:()=>{_(!1)}},className:"in-portal"})})]}):c.jsx(c.Fragment,{})]})})},Vm=Object.freeze(Object.defineProperty({__proto__:null,default:Qt},Symbol.toStringTag,{value:"Module"}));const cu={small:24,medium:48},ao=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...d})=>{const m=se.useIntl();return!n||n.length===0?null:y.createElement(e,{...d,className:Y("contributors",u,a,{"has-gap":i}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((p,h)=>{let g,f="";if(h<o){const{name:b="",image:v=""}=ti(p);if(s)return c.jsx(Bt,{element:"li",className:"contributor"},h);g=c.jsx(mn,{name:b,src:v,width:cu[a||"medium"],height:cu[a||"medium"]})}else if(h===o){const b=(t||n.length)-o;g=c.jsxs("small",{className:Y({"large-number":b>99}),children:["+",dm(b,0)]}),f="number-left"}return g?c.jsx("li",{className:Y("contributor",f),children:g},h):null})}),r&&c.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?m.formatMessage({id:`member_${n[0]}`}):Xn(n[0].name||"",20):l||null})]})})};const io=({element:e="section",children:t,className:n,...r})=>y.createElement(e,{className:Y("modal",n),children:typeof t=="string"?c.jsx("p",{children:t}):t,...r});var xs={exports:{}},Xr={exports:{}},Pe={};/** @license React v16.13.1
38
38
  * react-is.production.min.js
39
39
  *
40
40
  * Copyright (c) Facebook, Inc. and its affiliates.
41
41
  *
42
42
  * This source code is licensed under the MIT license found in the
43
43
  * LICENSE file in the root directory of this source tree.
44
- */var lu;function Lm(){if(lu)return Ne;lu=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,m=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,_=e?Symbol.for("react.scope"):60119;function F(w){if(typeof w=="object"&&w!==null){var B=w.$$typeof;switch(B){case t:switch(w=w.type,w){case l:case u:case r:case i:case a:case m:return w;default:switch(w=w&&w.$$typeof,w){case o:case d:case g:case h:case s:return w;default:return B}}case n:return B}}}function x(w){return F(w)===u}return Ne.AsyncMode=l,Ne.ConcurrentMode=u,Ne.ContextConsumer=o,Ne.ContextProvider=s,Ne.Element=t,Ne.ForwardRef=d,Ne.Fragment=r,Ne.Lazy=g,Ne.Memo=h,Ne.Portal=n,Ne.Profiler=i,Ne.StrictMode=a,Ne.Suspense=m,Ne.isAsyncMode=function(w){return x(w)||F(w)===l},Ne.isConcurrentMode=x,Ne.isContextConsumer=function(w){return F(w)===o},Ne.isContextProvider=function(w){return F(w)===s},Ne.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===t},Ne.isForwardRef=function(w){return F(w)===d},Ne.isFragment=function(w){return F(w)===r},Ne.isLazy=function(w){return F(w)===g},Ne.isMemo=function(w){return F(w)===h},Ne.isPortal=function(w){return F(w)===n},Ne.isProfiler=function(w){return F(w)===i},Ne.isStrictMode=function(w){return F(w)===a},Ne.isSuspense=function(w){return F(w)===m},Ne.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===r||w===u||w===i||w===a||w===m||w===p||typeof w=="object"&&w!==null&&(w.$$typeof===g||w.$$typeof===h||w.$$typeof===s||w.$$typeof===o||w.$$typeof===d||w.$$typeof===b||w.$$typeof===v||w.$$typeof===_||w.$$typeof===f)},Ne.typeOf=F,Ne}var Me={};/** @license React v16.13.1
44
+ */var du;function Km(){if(du)return Pe;du=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,m=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,E=e?Symbol.for("react.scope"):60119;function B(x){if(typeof x=="object"&&x!==null){var T=x.$$typeof;switch(T){case t:switch(x=x.type,x){case l:case u:case r:case i:case a:case m:return x;default:switch(x=x&&x.$$typeof,x){case o:case d:case g:case h:case s:return x;default:return T}}case n:return T}}}function _(x){return B(x)===u}return Pe.AsyncMode=l,Pe.ConcurrentMode=u,Pe.ContextConsumer=o,Pe.ContextProvider=s,Pe.Element=t,Pe.ForwardRef=d,Pe.Fragment=r,Pe.Lazy=g,Pe.Memo=h,Pe.Portal=n,Pe.Profiler=i,Pe.StrictMode=a,Pe.Suspense=m,Pe.isAsyncMode=function(x){return _(x)||B(x)===l},Pe.isConcurrentMode=_,Pe.isContextConsumer=function(x){return B(x)===o},Pe.isContextProvider=function(x){return B(x)===s},Pe.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===t},Pe.isForwardRef=function(x){return B(x)===d},Pe.isFragment=function(x){return B(x)===r},Pe.isLazy=function(x){return B(x)===g},Pe.isMemo=function(x){return B(x)===h},Pe.isPortal=function(x){return B(x)===n},Pe.isProfiler=function(x){return B(x)===i},Pe.isStrictMode=function(x){return B(x)===a},Pe.isSuspense=function(x){return B(x)===m},Pe.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===r||x===u||x===i||x===a||x===m||x===p||typeof x=="object"&&x!==null&&(x.$$typeof===g||x.$$typeof===h||x.$$typeof===s||x.$$typeof===o||x.$$typeof===d||x.$$typeof===b||x.$$typeof===v||x.$$typeof===E||x.$$typeof===f)},Pe.typeOf=B,Pe}var Me={};/** @license React v16.13.1
45
45
  * react-is.development.js
46
46
  *
47
47
  * Copyright (c) Facebook, Inc. and its affiliates.
48
48
  *
49
49
  * This source code is licensed under the MIT license found in the
50
50
  * LICENSE file in the root directory of this source tree.
51
- */var cu;function zm(){return cu||(cu=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,m=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,_=e?Symbol.for("react.scope"):60119;function F(X){return typeof X=="string"||typeof X=="function"||X===r||X===u||X===i||X===a||X===m||X===p||typeof X=="object"&&X!==null&&(X.$$typeof===g||X.$$typeof===h||X.$$typeof===s||X.$$typeof===o||X.$$typeof===d||X.$$typeof===b||X.$$typeof===v||X.$$typeof===_||X.$$typeof===f)}function x(X){if(typeof X=="object"&&X!==null){var ye=X.$$typeof;switch(ye){case t:var me=X.type;switch(me){case l:case u:case r:case i:case a:case m:return me;default:var xe=me&&me.$$typeof;switch(xe){case o:case d:case g:case h:case s:return xe;default:return ye}}case n:return ye}}}var w=l,B=u,S=o,z=s,N=t,I=d,M=r,k=g,A=h,j=n,L=i,H=a,Y=m,Q=!1;function re(X){return Q||(Q=!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(X)||x(X)===l}function C(X){return x(X)===u}function q(X){return x(X)===o}function K(X){return x(X)===s}function E(X){return typeof X=="object"&&X!==null&&X.$$typeof===t}function T(X){return x(X)===d}function $(X){return x(X)===r}function R(X){return x(X)===g}function U(X){return x(X)===h}function ae(X){return x(X)===n}function J(X){return x(X)===i}function ie(X){return x(X)===a}function de(X){return x(X)===m}Me.AsyncMode=w,Me.ConcurrentMode=B,Me.ContextConsumer=S,Me.ContextProvider=z,Me.Element=N,Me.ForwardRef=I,Me.Fragment=M,Me.Lazy=k,Me.Memo=A,Me.Portal=j,Me.Profiler=L,Me.StrictMode=H,Me.Suspense=Y,Me.isAsyncMode=re,Me.isConcurrentMode=C,Me.isContextConsumer=q,Me.isContextProvider=K,Me.isElement=E,Me.isForwardRef=T,Me.isFragment=$,Me.isLazy=R,Me.isMemo=U,Me.isPortal=ae,Me.isProfiler=J,Me.isStrictMode=ie,Me.isSuspense=de,Me.isValidElementType=F,Me.typeOf=x}()),Me}var du;function md(){return du||(du=1,process.env.NODE_ENV==="production"?Jr.exports=Lm():Jr.exports=zm()),Jr.exports}/*
51
+ */var fu;function Zm(){return fu||(fu=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,m=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,E=e?Symbol.for("react.scope"):60119;function B(X){return typeof X=="string"||typeof X=="function"||X===r||X===u||X===i||X===a||X===m||X===p||typeof X=="object"&&X!==null&&(X.$$typeof===g||X.$$typeof===h||X.$$typeof===s||X.$$typeof===o||X.$$typeof===d||X.$$typeof===b||X.$$typeof===v||X.$$typeof===E||X.$$typeof===f)}function _(X){if(typeof X=="object"&&X!==null){var ve=X.$$typeof;switch(ve){case t:var pe=X.type;switch(pe){case l:case u:case r:case i:case a:case m:return pe;default:var _e=pe&&pe.$$typeof;switch(_e){case o:case d:case g:case h:case s:return _e;default:return ve}}case n:return ve}}}var x=l,T=u,S=o,$=s,M=t,N=d,q=r,w=g,A=h,j=n,L=i,U=a,Z=m,G=!1;function ae(X){return G||(G=!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(X)||_(X)===l}function C(X){return _(X)===u}function z(X){return _(X)===o}function Q(X){return _(X)===s}function k(X){return typeof X=="object"&&X!==null&&X.$$typeof===t}function F(X){return _(X)===d}function R(X){return _(X)===r}function I(X){return _(X)===g}function W(X){return _(X)===h}function re(X){return _(X)===n}function ee(X){return _(X)===i}function ie(X){return _(X)===a}function fe(X){return _(X)===m}Me.AsyncMode=x,Me.ConcurrentMode=T,Me.ContextConsumer=S,Me.ContextProvider=$,Me.Element=M,Me.ForwardRef=N,Me.Fragment=q,Me.Lazy=w,Me.Memo=A,Me.Portal=j,Me.Profiler=L,Me.StrictMode=U,Me.Suspense=Z,Me.isAsyncMode=ae,Me.isConcurrentMode=C,Me.isContextConsumer=z,Me.isContextProvider=Q,Me.isElement=k,Me.isForwardRef=F,Me.isFragment=R,Me.isLazy=I,Me.isMemo=W,Me.isPortal=re,Me.isProfiler=ee,Me.isStrictMode=ie,Me.isSuspense=fe,Me.isValidElementType=B,Me.typeOf=_}()),Me}var hu;function bd(){return hu||(hu=1,process.env.NODE_ENV==="production"?Xr.exports=Km():Xr.exports=Zm()),Xr.exports}/*
52
52
  object-assign
53
53
  (c) Sindre Sorhus
54
54
  @license MIT
55
- */var yi,fu;function qm(){if(fu)return yi;fu=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return yi=a()?Object.assign:function(i,s){for(var o,l=r(i),u,d=1;d<arguments.length;d++){o=Object(arguments[d]);for(var m in o)t.call(o,m)&&(l[m]=o[m]);if(e){u=e(o);for(var p=0;p<u.length;p++)n.call(o,u[p])&&(l[u[p]]=o[u[p]])}}return l},yi}var Di,hu;function ao(){if(hu)return Di;hu=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Di=e,Di}var Ci,mu;function pd(){return mu||(mu=1,Ci=Function.call.bind(Object.prototype.hasOwnProperty)),Ci}var xi,pu;function Wm(){if(pu)return xi;pu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=ao(),n={},r=pd();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var m;try{if(typeof i[d]!="function"){var 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}m=i[d](s,d,l,o,null,t)}catch(g){m=g}if(m&&!(m instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof m+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),m instanceof Error&&!(m.message in n)){n[m.message]=!0;var h=u?u():"";e("Failed "+o+" type: "+m.message+(h??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},xi=a,xi}var wi,gu;function Um(){if(gu)return wi;gu=1;var e=md(),t=qm(),n=ao(),r=pd(),a=Wm(),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 wi=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function m(C){var q=C&&(u&&C[u]||C[d]);if(typeof q=="function")return q}var p="<<anonymous>>",h={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:_(),arrayOf:F,element:x(),elementType:w(),instanceOf:B,node:I(),objectOf:z,oneOf:S,oneOfType:N,shape:k,exact:A};function g(C,q){return C===q?C!==0||1/C===1/q:C!==C&&q!==q}function f(C,q){this.message=C,this.data=q&&typeof q=="object"?q:{},this.stack=""}f.prototype=Error.prototype;function b(C){if(process.env.NODE_ENV!=="production")var q={},K=0;function E($,R,U,ae,J,ie,de){if(ae=ae||p,ie=ie||U,de!==n){if(l){var X=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw X.name="Invariant Violation",X}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ye=ae+":"+U;!q[ye]&&K<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ie+"` prop on `"+ae+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),q[ye]=!0,K++)}}return R[U]==null?$?R[U]===null?new f("The "+J+" `"+ie+"` is marked as required "+("in `"+ae+"`, but its value is `null`.")):new f("The "+J+" `"+ie+"` is marked as required in "+("`"+ae+"`, but its value is `undefined`.")):null:C(R,U,ae,J,ie)}var T=E.bind(null,!1);return T.isRequired=E.bind(null,!0),T}function v(C){function q(K,E,T,$,R,U){var ae=K[E],J=H(ae);if(J!==C){var ie=Y(ae);return new f("Invalid "+$+" `"+R+"` of type "+("`"+ie+"` supplied to `"+T+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return b(q)}function _(){return b(s)}function F(C){function q(K,E,T,$,R){if(typeof C!="function")return new f("Property `"+R+"` of component `"+T+"` has invalid PropType notation inside arrayOf.");var U=K[E];if(!Array.isArray(U)){var ae=H(U);return new f("Invalid "+$+" `"+R+"` of type "+("`"+ae+"` supplied to `"+T+"`, expected an array."))}for(var J=0;J<U.length;J++){var ie=C(U,J,T,$,R+"["+J+"]",n);if(ie instanceof Error)return ie}return null}return b(q)}function x(){function C(q,K,E,T,$){var R=q[K];if(!o(R)){var U=H(R);return new f("Invalid "+T+" `"+$+"` of type "+("`"+U+"` supplied to `"+E+"`, expected a single ReactElement."))}return null}return b(C)}function w(){function C(q,K,E,T,$){var R=q[K];if(!e.isValidElementType(R)){var U=H(R);return new f("Invalid "+T+" `"+$+"` of type "+("`"+U+"` supplied to `"+E+"`, expected a single ReactElement type."))}return null}return b(C)}function B(C){function q(K,E,T,$,R){if(!(K[E]instanceof C)){var U=C.name||p,ae=re(K[E]);return new f("Invalid "+$+" `"+R+"` of type "+("`"+ae+"` supplied to `"+T+"`, expected ")+("instance of `"+U+"`."))}return null}return b(q)}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 q(K,E,T,$,R){for(var U=K[E],ae=0;ae<C.length;ae++)if(g(U,C[ae]))return null;var J=JSON.stringify(C,function(de,X){var ye=Y(X);return ye==="symbol"?String(X):X});return new f("Invalid "+$+" `"+R+"` of value `"+String(U)+"` "+("supplied to `"+T+"`, expected one of "+J+"."))}return b(q)}function z(C){function q(K,E,T,$,R){if(typeof C!="function")return new f("Property `"+R+"` of component `"+T+"` has invalid PropType notation inside objectOf.");var U=K[E],ae=H(U);if(ae!=="object")return new f("Invalid "+$+" `"+R+"` of type "+("`"+ae+"` supplied to `"+T+"`, expected an object."));for(var J in U)if(r(U,J)){var ie=C(U,J,T,$,R+"."+J,n);if(ie instanceof Error)return ie}return null}return b(q)}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 q=0;q<C.length;q++){var K=C[q];if(typeof K!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Q(K)+" at index "+q+"."),s}function E(T,$,R,U,ae){for(var J=[],ie=0;ie<C.length;ie++){var de=C[ie],X=de(T,$,R,U,ae,n);if(X==null)return null;X.data&&r(X.data,"expectedType")&&J.push(X.data.expectedType)}var ye=J.length>0?", expected one of type ["+J.join(", ")+"]":"";return new f("Invalid "+U+" `"+ae+"` supplied to "+("`"+R+"`"+ye+"."))}return b(E)}function I(){function C(q,K,E,T,$){return j(q[K])?null:new f("Invalid "+T+" `"+$+"` supplied to "+("`"+E+"`, expected a ReactNode."))}return b(C)}function M(C,q,K,E,T){return new f((C||"React class")+": "+q+" type `"+K+"."+E+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+T+"`.")}function k(C){function q(K,E,T,$,R){var U=K[E],ae=H(U);if(ae!=="object")return new f("Invalid "+$+" `"+R+"` of type `"+ae+"` "+("supplied to `"+T+"`, expected `object`."));for(var J in C){var ie=C[J];if(typeof ie!="function")return M(T,$,R,J,Y(ie));var de=ie(U,J,T,$,R+"."+J,n);if(de)return de}return null}return b(q)}function A(C){function q(K,E,T,$,R){var U=K[E],ae=H(U);if(ae!=="object")return new f("Invalid "+$+" `"+R+"` of type `"+ae+"` "+("supplied to `"+T+"`, expected `object`."));var J=t({},K[E],C);for(var ie in J){var de=C[ie];if(r(C,ie)&&typeof de!="function")return M(T,$,R,ie,Y(de));if(!de)return new f("Invalid "+$+" `"+R+"` key `"+ie+"` supplied to `"+T+"`.\nBad object: "+JSON.stringify(K[E],null," ")+`
56
- Valid keys: `+JSON.stringify(Object.keys(C),null," "));var X=de(U,ie,T,$,R+"."+ie,n);if(X)return X}return null}return b(q)}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 q=m(C);if(q){var K=q.call(C),E;if(q!==C.entries){for(;!(E=K.next()).done;)if(!j(E.value))return!1}else for(;!(E=K.next()).done;){var T=E.value;if(T&&!j(T[1]))return!1}}else return!1;return!0;default:return!1}}function L(C,q){return C==="symbol"?!0:q?q["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&q instanceof Symbol:!1}function H(C){var q=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":L(q,C)?"symbol":q}function Y(C){if(typeof C>"u"||C===null)return""+C;var q=H(C);if(q==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return q}function Q(C){var q=Y(C);switch(q){case"array":case"object":return"an "+q;case"boolean":case"date":case"regexp":return"a "+q;default:return q}}function re(C){return!C.constructor||!C.constructor.name?p:C.constructor.name}return h.checkPropTypes=a,h.resetWarningCache=a.resetWarningCache,h.PropTypes=h,h},wi}var Ei,vu;function Hm(){if(vu)return Ei;vu=1;var e=ao();function t(){}function n(){}return n.resetWarningCache=t,Ei=function(){function r(s,o,l,u,d,m){if(m!==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},Ei}if(process.env.NODE_ENV!=="production"){var Vm=md(),Km=!0;Cs.exports=Um()(Vm.isElement,Km)}else Cs.exports=Hm()();var Zm=Cs.exports;/*!
55
+ */var Di,mu;function Ym(){if(mu)return Di;mu=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 Di=a()?Object.assign:function(i,s){for(var o,l=r(i),u,d=1;d<arguments.length;d++){o=Object(arguments[d]);for(var m in o)t.call(o,m)&&(l[m]=o[m]);if(e){u=e(o);for(var p=0;p<u.length;p++)n.call(o,u[p])&&(l[u[p]]=o[u[p]])}}return l},Di}var Ci,pu;function so(){if(pu)return Ci;pu=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ci=e,Ci}var xi,gu;function yd(){return gu||(gu=1,xi=Function.call.bind(Object.prototype.hasOwnProperty)),xi}var wi,vu;function Gm(){if(vu)return wi;vu=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=so(),n={},r=yd();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var m;try{if(typeof i[d]!="function"){var 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}m=i[d](s,d,l,o,null,t)}catch(g){m=g}if(m&&!(m instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof m+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),m instanceof Error&&!(m.message in n)){n[m.message]=!0;var h=u?u():"";e("Failed "+o+" type: "+m.message+(h??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},wi=a,wi}var Ei,bu;function Qm(){if(bu)return Ei;bu=1;var e=bd(),t=Ym(),n=so(),r=yd(),a=Gm(),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 Ei=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function m(C){var z=C&&(u&&C[u]||C[d]);if(typeof z=="function")return z}var p="<<anonymous>>",h={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:_(),elementType:x(),instanceOf:T,node:N(),objectOf:$,oneOf:S,oneOfType:M,shape:w,exact:A};function g(C,z){return C===z?C!==0||1/C===1/z:C!==C&&z!==z}function f(C,z){this.message=C,this.data=z&&typeof z=="object"?z:{},this.stack=""}f.prototype=Error.prototype;function b(C){if(process.env.NODE_ENV!=="production")var z={},Q=0;function k(R,I,W,re,ee,ie,fe){if(re=re||p,ie=ie||W,fe!==n){if(l){var X=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw X.name="Invariant Violation",X}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ve=re+":"+W;!z[ve]&&Q<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ie+"` 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."),z[ve]=!0,Q++)}}return I[W]==null?R?I[W]===null?new f("The "+ee+" `"+ie+"` is marked as required "+("in `"+re+"`, but its value is `null`.")):new f("The "+ee+" `"+ie+"` is marked as required in "+("`"+re+"`, but its value is `undefined`.")):null:C(I,W,re,ee,ie)}var F=k.bind(null,!1);return F.isRequired=k.bind(null,!0),F}function v(C){function z(Q,k,F,R,I,W){var re=Q[k],ee=U(re);if(ee!==C){var ie=Z(re);return new f("Invalid "+R+" `"+I+"` of type "+("`"+ie+"` supplied to `"+F+"`, expected ")+("`"+C+"`."),{expectedType:C})}return null}return b(z)}function E(){return b(s)}function B(C){function z(Q,k,F,R,I){if(typeof C!="function")return new f("Property `"+I+"` of component `"+F+"` has invalid PropType notation inside arrayOf.");var W=Q[k];if(!Array.isArray(W)){var re=U(W);return new f("Invalid "+R+" `"+I+"` of type "+("`"+re+"` supplied to `"+F+"`, expected an array."))}for(var ee=0;ee<W.length;ee++){var ie=C(W,ee,F,R,I+"["+ee+"]",n);if(ie instanceof Error)return ie}return null}return b(z)}function _(){function C(z,Q,k,F,R){var I=z[Q];if(!o(I)){var W=U(I);return new f("Invalid "+F+" `"+R+"` of type "+("`"+W+"` supplied to `"+k+"`, expected a single ReactElement."))}return null}return b(C)}function x(){function C(z,Q,k,F,R){var I=z[Q];if(!e.isValidElementType(I)){var W=U(I);return new f("Invalid "+F+" `"+R+"` of type "+("`"+W+"` supplied to `"+k+"`, expected a single ReactElement type."))}return null}return b(C)}function T(C){function z(Q,k,F,R,I){if(!(Q[k]instanceof C)){var W=C.name||p,re=ae(Q[k]);return new f("Invalid "+R+" `"+I+"` of type "+("`"+re+"` supplied to `"+F+"`, expected ")+("instance of `"+W+"`."))}return null}return b(z)}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 z(Q,k,F,R,I){for(var W=Q[k],re=0;re<C.length;re++)if(g(W,C[re]))return null;var ee=JSON.stringify(C,function(fe,X){var ve=Z(X);return ve==="symbol"?String(X):X});return new f("Invalid "+R+" `"+I+"` of value `"+String(W)+"` "+("supplied to `"+F+"`, expected one of "+ee+"."))}return b(z)}function $(C){function z(Q,k,F,R,I){if(typeof C!="function")return new f("Property `"+I+"` of component `"+F+"` has invalid PropType notation inside objectOf.");var W=Q[k],re=U(W);if(re!=="object")return new f("Invalid "+R+" `"+I+"` of type "+("`"+re+"` supplied to `"+F+"`, expected an object."));for(var ee in W)if(r(W,ee)){var ie=C(W,ee,F,R,I+"."+ee,n);if(ie instanceof Error)return ie}return null}return b(z)}function M(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 z=0;z<C.length;z++){var Q=C[z];if(typeof Q!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+G(Q)+" at index "+z+"."),s}function k(F,R,I,W,re){for(var ee=[],ie=0;ie<C.length;ie++){var fe=C[ie],X=fe(F,R,I,W,re,n);if(X==null)return null;X.data&&r(X.data,"expectedType")&&ee.push(X.data.expectedType)}var ve=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new f("Invalid "+W+" `"+re+"` supplied to "+("`"+I+"`"+ve+"."))}return b(k)}function N(){function C(z,Q,k,F,R){return j(z[Q])?null:new f("Invalid "+F+" `"+R+"` supplied to "+("`"+k+"`, expected a ReactNode."))}return b(C)}function q(C,z,Q,k,F){return new f((C||"React class")+": "+z+" type `"+Q+"."+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+F+"`.")}function w(C){function z(Q,k,F,R,I){var W=Q[k],re=U(W);if(re!=="object")return new f("Invalid "+R+" `"+I+"` of type `"+re+"` "+("supplied to `"+F+"`, expected `object`."));for(var ee in C){var ie=C[ee];if(typeof ie!="function")return q(F,R,I,ee,Z(ie));var fe=ie(W,ee,F,R,I+"."+ee,n);if(fe)return fe}return null}return b(z)}function A(C){function z(Q,k,F,R,I){var W=Q[k],re=U(W);if(re!=="object")return new f("Invalid "+R+" `"+I+"` of type `"+re+"` "+("supplied to `"+F+"`, expected `object`."));var ee=t({},Q[k],C);for(var ie in ee){var fe=C[ie];if(r(C,ie)&&typeof fe!="function")return q(F,R,I,ie,Z(fe));if(!fe)return new f("Invalid "+R+" `"+I+"` key `"+ie+"` supplied to `"+F+"`.\nBad object: "+JSON.stringify(Q[k],null," ")+`
56
+ Valid keys: `+JSON.stringify(Object.keys(C),null," "));var X=fe(W,ie,F,R,I+"."+ie,n);if(X)return X}return null}return b(z)}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 z=m(C);if(z){var Q=z.call(C),k;if(z!==C.entries){for(;!(k=Q.next()).done;)if(!j(k.value))return!1}else for(;!(k=Q.next()).done;){var F=k.value;if(F&&!j(F[1]))return!1}}else return!1;return!0;default:return!1}}function L(C,z){return C==="symbol"?!0:z?z["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&z instanceof Symbol:!1}function U(C){var z=typeof C;return Array.isArray(C)?"array":C instanceof RegExp?"object":L(z,C)?"symbol":z}function Z(C){if(typeof C>"u"||C===null)return""+C;var z=U(C);if(z==="object"){if(C instanceof Date)return"date";if(C instanceof RegExp)return"regexp"}return z}function G(C){var z=Z(C);switch(z){case"array":case"object":return"an "+z;case"boolean":case"date":case"regexp":return"a "+z;default:return z}}function ae(C){return!C.constructor||!C.constructor.name?p:C.constructor.name}return h.checkPropTypes=a,h.resetWarningCache=a.resetWarningCache,h.PropTypes=h,h},Ei}var _i,yu;function Jm(){if(yu)return _i;yu=1;var e=so();function t(){}function n(){}return n.resetWarningCache=t,_i=function(){function r(s,o,l,u,d,m){if(m!==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},_i}if(process.env.NODE_ENV!=="production"){var Xm=bd(),ep=!0;xs.exports=Qm()(Xm.isElement,ep)}else xs.exports=Jm()();var tp=xs.exports;/*!
57
57
  * tabbable 6.2.0
58
58
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
59
- */var gd=["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])"],Ta=gd.join(","),vd=typeof Element>"u",Fn=vd?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Sa=!vd&&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},ja=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},Ym=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},bd=function(t,n,r){if(ja(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(Ta));return n&&Fn.call(t,Ta)&&a.unshift(t),a=a.filter(r),a},yd=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!ja(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=Fn.call(s,Ta);d&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var m=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!ja(m,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(m&&p){var h=e(m===!0?s.children:m.children,!0,r);r.flatten?a.push.apply(a,h):a.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return a},Dd=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},sn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Ym(t))&&!Dd(t)?0:t.tabIndex},Gm=function(t,n){var r=sn(t);return r<0&&n&&!Dd(t)?0:r},Qm=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Cd=function(t){return t.tagName==="INPUT"},Jm=function(t){return Cd(t)&&t.type==="hidden"},Xm=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},ep=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},tp=function(t){if(!t.name)return!0;var n=t.form||Sa(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=ep(a,t.form);return!i||i===t},np=function(t){return Cd(t)&&t.type==="radio"},rp=function(t){return np(t)&&!tp(t)},ap=function(t){var n,r=t&&Sa(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,d,m;r=Sa(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((d=a)!==null&&d!==void 0&&(m=d.ownerDocument)!==null&&m!==void 0&&m.contains(a))}}return i},bu=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},ip=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Fn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Fn.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=Sa(t);if(l&&!l.shadowRoot&&a(l)===!0)return bu(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(ap(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return bu(t);return!1},sp=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 Fn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},Oa=function(t,n){return!(n.disabled||ja(n)||Jm(n)||ip(n,t)||Xm(n)||sp(n))},xs=function(t,n){return!(rp(n)||sn(n)<0||!Oa(t,n))},op=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},up=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=Gm(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(Qm).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},xd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=yd([t],n.includeContainer,{filter:xs.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:op}):r=bd(t,n.includeContainer,xs.bind(null,n)),up(r)},wd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=yd([t],n.includeContainer,{filter:Oa.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=bd(t,n.includeContainer,Oa.bind(null,n)),r},bn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Fn.call(t,Ta)===!1?!1:xs(n,t)},lp=gd.concat("iframe").join(","),Ca=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Fn.call(t,lp)===!1?!1:Oa(n,t)};const cp=Object.freeze(Object.defineProperty({__proto__:null,focusable:wd,getTabIndex:sn,isFocusable:Ca,isTabbable:bn,tabbable:xd},Symbol.toStringTag,{value:"Module"}));/*!
59
+ */var Dd=["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])"],Sa=Dd.join(","),Cd=typeof Element>"u",Bn=Cd?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ja=!Cd&&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},Oa=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},np=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},xd=function(t,n,r){if(Oa(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(Sa));return n&&Bn.call(t,Sa)&&a.unshift(t),a=a.filter(r),a},wd=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!Oa(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,Sa);d&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var m=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!Oa(m,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(m&&p){var h=e(m===!0?s.children:m.children,!0,r);r.flatten?a.push.apply(a,h):a.push({scopeParent:s,candidates:h})}else i.unshift.apply(i,s.children)}}return a},Ed=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},un=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||np(t))&&!Ed(t)?0:t.tabIndex},rp=function(t,n){var r=un(t);return r<0&&n&&!Ed(t)?0:r},ap=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},_d=function(t){return t.tagName==="INPUT"},ip=function(t){return _d(t)&&t.type==="hidden"},sp=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},op=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},up=function(t){if(!t.name)return!0;var n=t.form||ja(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=op(a,t.form);return!i||i===t},lp=function(t){return _d(t)&&t.type==="radio"},cp=function(t){return lp(t)&&!up(t)},dp=function(t){var n,r=t&&ja(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,d,m;r=ja(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((d=a)!==null&&d!==void 0&&(m=d.ownerDocument)!==null&&m!==void 0&&m.contains(a))}}return i},Du=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},fp=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=ja(t);if(l&&!l.shadowRoot&&a(l)===!0)return Du(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(dp(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Du(t);return!1},hp=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},Pa=function(t,n){return!(n.disabled||Oa(n)||ip(n)||fp(n,t)||sp(n)||hp(n))},ws=function(t,n){return!(cp(n)||un(n)<0||!Pa(t,n))},mp=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},pp=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=rp(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(ap).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},kd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=wd([t],n.includeContainer,{filter:ws.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:mp}):r=xd(t,n.includeContainer,ws.bind(null,n)),pp(r)},Fd=function(t,n){n=n||{};var r;return n.getShadowRoot?r=wd([t],n.includeContainer,{filter:Pa.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=xd(t,n.includeContainer,Pa.bind(null,n)),r},yn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Bn.call(t,Sa)===!1?!1:ws(n,t)},gp=Dd.concat("iframe").join(","),xa=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Bn.call(t,gp)===!1?!1:Pa(n,t)};const vp=Object.freeze(Object.defineProperty({__proto__:null,focusable:Fd,getTabIndex:un,isFocusable:xa,isTabbable:yn,tabbable:kd},Symbol.toStringTag,{value:"Module"}));/*!
60
60
  * focus-trap 7.5.4
61
61
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
62
- */function 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){dp(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}function dp(e,t,n){return t=hp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fp(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 hp(e){var t=fp(e,"string");return typeof t=="symbol"?t:String(t)}var Cu={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()}},mp=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},pp=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},xr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},gp=function(t){return xr(t)&&!t.shiftKey},vp=function(t){return xr(t)&&t.shiftKey},xu=function(t){return setTimeout(t,0)},wu=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},fr=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return typeof t=="function"?t.apply(void 0,r):t},Xr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},bp=[],yp=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||bp,i=Du({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:gp,isKeyBackward:vp},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(k,A,j){return k&&k[A]!==void 0?k[A]:i[j||A]},u=function(k,A){var j=typeof(A==null?void 0:A.composedPath)=="function"?A.composedPath():void 0;return s.containerGroups.findIndex(function(L){var H=L.container,Y=L.tabbableNodes;return H.contains(k)||(j==null?void 0:j.includes(H))||Y.find(function(Q){return Q===k})})},d=function(k){var A=i[k];if(typeof A=="function"){for(var j=arguments.length,L=new Array(j>1?j-1:0),H=1;H<j;H++)L[H-1]=arguments[H];A=A.apply(void 0,L)}if(A===!0&&(A=void 0),!A){if(A===void 0||A===!1)return A;throw new Error("`".concat(k,"` was specified but was not a node, or did not return a node"))}var Y=A;if(typeof A=="string"&&(Y=r.querySelector(A),!Y))throw new Error("`".concat(k,"` as selector refers to no known node"));return Y},m=function(){var k=d("initialFocus");if(k===!1)return!1;if(k===void 0||!Ca(k,i.tabbableOptions))if(u(r.activeElement)>=0)k=r.activeElement;else{var A=s.tabbableGroups[0],j=A&&A.firstTabbableNode;k=j||d("fallbackFocus")}if(!k)throw new Error("Your focus-trap needs to have at least one focusable element");return k},p=function(){if(s.containerGroups=s.containers.map(function(k){var A=xd(k,i.tabbableOptions),j=wd(k,i.tabbableOptions),L=A.length>0?A[0]:void 0,H=A.length>0?A[A.length-1]:void 0,Y=j.find(function(C){return bn(C)}),Q=j.slice().reverse().find(function(C){return bn(C)}),re=!!A.find(function(C){return sn(C)>0});return{container:k,tabbableNodes:A,focusableNodes:j,posTabIndexesFound:re,firstTabbableNode:L,lastTabbableNode:H,firstDomTabbableNode:Y,lastDomTabbableNode:Q,nextTabbableNode:function(q){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,E=A.indexOf(q);return E<0?K?j.slice(j.indexOf(q)+1).find(function(T){return bn(T)}):j.slice(0,j.indexOf(q)).reverse().find(function(T){return bn(T)}):A[E+(K?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(k){return k.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(k){return k.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.")},h=function M(k){var A=k.activeElement;if(A)return A.shadowRoot&&A.shadowRoot.activeElement!==null?M(A.shadowRoot):A},g=function M(k){if(k!==!1&&k!==h(document)){if(!k||!k.focus){M(m());return}k.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=k,mp(k)&&k.select()}},f=function(k){var A=d("setReturnFocus",k);return A||(A===!1?!1:k)},b=function(k){var A=k.target,j=k.event,L=k.isBackward,H=L===void 0?!1:L;A=A||Xr(j),p();var Y=null;if(s.tabbableGroups.length>0){var Q=u(A,j),re=Q>=0?s.containerGroups[Q]:void 0;if(Q<0)H?Y=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:Y=s.tabbableGroups[0].firstTabbableNode;else if(H){var C=wu(s.tabbableGroups,function(R){var U=R.firstTabbableNode;return A===U});if(C<0&&(re.container===A||Ca(A,i.tabbableOptions)&&!bn(A,i.tabbableOptions)&&!re.nextTabbableNode(A,!1))&&(C=Q),C>=0){var q=C===0?s.tabbableGroups.length-1:C-1,K=s.tabbableGroups[q];Y=sn(A)>=0?K.lastTabbableNode:K.lastDomTabbableNode}else xr(j)||(Y=re.nextTabbableNode(A,!1))}else{var E=wu(s.tabbableGroups,function(R){var U=R.lastTabbableNode;return A===U});if(E<0&&(re.container===A||Ca(A,i.tabbableOptions)&&!bn(A,i.tabbableOptions)&&!re.nextTabbableNode(A))&&(E=Q),E>=0){var T=E===s.tabbableGroups.length-1?0:E+1,$=s.tabbableGroups[T];Y=sn(A)>=0?$.firstTabbableNode:$.firstDomTabbableNode}else xr(j)||(Y=re.nextTabbableNode(A))}}else Y=d("fallbackFocus");return Y},v=function(k){var A=Xr(k);if(!(u(A,k)>=0)){if(fr(i.clickOutsideDeactivates,k)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}fr(i.allowOutsideClick,k)||k.preventDefault()}},_=function(k){var A=Xr(k),j=u(A,k)>=0;if(j||A instanceof Document)j&&(s.mostRecentlyFocusedNode=A);else{k.stopImmediatePropagation();var L,H=!0;if(s.mostRecentlyFocusedNode)if(sn(s.mostRecentlyFocusedNode)>0){var Y=u(s.mostRecentlyFocusedNode),Q=s.containerGroups[Y].tabbableNodes;if(Q.length>0){var re=Q.findIndex(function(C){return C===s.mostRecentlyFocusedNode});re>=0&&(i.isKeyForward(s.recentNavEvent)?re+1<Q.length&&(L=Q[re+1],H=!1):re-1>=0&&(L=Q[re-1],H=!1))}}else s.containerGroups.some(function(C){return C.tabbableNodes.some(function(q){return sn(q)>0})})||(H=!1);else H=!1;H&&(L=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(L||s.mostRecentlyFocusedNode||m())}s.recentNavEvent=void 0},F=function(k){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=k;var j=b({event:k,isBackward:A});j&&(xr(k)&&k.preventDefault(),g(j))},x=function(k){if(pp(k)&&fr(i.escapeDeactivates,k)!==!1){k.preventDefault(),o.deactivate();return}(i.isKeyForward(k)||i.isKeyBackward(k))&&F(k,i.isKeyBackward(k))},w=function(k){var A=Xr(k);u(A,k)>=0||fr(i.clickOutsideDeactivates,k)||fr(i.allowOutsideClick,k)||(k.preventDefault(),k.stopImmediatePropagation())},B=function(){if(s.active)return Cu.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?xu(function(){g(m())}):g(m()),r.addEventListener("focusin",_,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",w,{capture:!0,passive:!1}),r.addEventListener("keydown",x,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",_,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",w,!0),r.removeEventListener("keydown",x,!0),o},z=function(k){var A=k.some(function(j){var L=Array.from(j.removedNodes);return L.some(function(H){return H===s.mostRecentlyFocusedNode})});A&&g(m())},N=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(z):void 0,I=function(){N&&(N.disconnect(),s.active&&!s.paused&&s.containers.map(function(k){N.observe(k,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(k){if(s.active)return this;var A=l(k,"onActivate"),j=l(k,"onPostActivate"),L=l(k,"checkCanFocusTrap");L||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,A==null||A();var H=function(){L&&p(),B(),I(),j==null||j()};return L?(L(s.containers.concat()).then(H,H),this):(H(),this)},deactivate:function(k){if(!s.active)return this;var A=Du({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},k);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,I(),Cu.deactivateTrap(a,o);var j=l(A,"onDeactivate"),L=l(A,"onPostDeactivate"),H=l(A,"checkCanReturnFocus"),Y=l(A,"returnFocus","returnFocusOnDeactivate");j==null||j();var Q=function(){xu(function(){Y&&g(f(s.nodeFocusedBeforeActivation)),L==null||L()})};return Y&&H?(H(f(s.nodeFocusedBeforeActivation)).then(Q,Q),this):(Q(),this)},pause:function(k){if(s.paused||!s.active)return this;var A=l(k,"onPause"),j=l(k,"onPostPause");return s.paused=!0,A==null||A(),S(),I(),j==null||j(),this},unpause:function(k){if(!s.paused||!s.active)return this;var A=l(k,"onUnpause"),j=l(k,"onPostUnpause");return s.paused=!1,A==null||A(),p(),B(),I(),j==null||j(),this},updateContainerElements:function(k){var A=[].concat(k).filter(Boolean);return s.containers=A.map(function(j){return typeof j=="string"?r.querySelector(j):j}),s.active&&p(),I(),this}},o.updateContainerElements(t),o};const Dp=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:yp},Symbol.toStringTag,{value:"Module"})),Cp=Nc(Dp),xp=Nc(cp);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 wp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Eu(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,Ed(r.key),r)}}function Ep(e,t,n){return t&&Eu(e.prototype,t),n&&Eu(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _p(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&&ws(e,t)}function ws(e,t){return ws=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},ws(e,t)}function kp(e){var t=Bp();return function(){var r=Pa(e),a;if(t){var i=Pa(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return Fp(this,a)}}function Fp(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 Dr(e)}function Dr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Bp(){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 Pa(e){return Pa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Pa(e)}function Ap(e,t,n){return t=Ed(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ed(e){var t=Tp(e,"string");return er(t)==="symbol"?t:String(t)}function Tp(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 ea=y,ge=Zm,Sp=Cp,jp=Sp.createFocusTrap,Op=xp,Pp=Op.isFocusable,io=function(e){_p(n,e);var t=kp(n);function n(r){var a;wp(this,n),a=t.call(this,r),Ap(Dr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var d=arguments.length,m=new Array(d>1?d-1:0),p=1;p<d;p++)m[p-1]=arguments[p];u=u.apply(void 0,m)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var h=u;if(typeof u=="string"){var g;if(h=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!h)throw new Error("`".concat(o,"` as selector refers to no known node"))}return h}),a.handleDeactivate=a.handleDeactivate.bind(Dr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(Dr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(Dr(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 Ep(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&&!Pp(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?ea.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===ea.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var d=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=d||[u]},o=ea.cloneElement(i,{ref:s});return o}return null}}]),n}(ea.Component),hr=typeof Element>"u"?Function:Element;io.propTypes={active:ge.bool,paused:ge.bool,focusTrapOptions:ge.shape({document:ge.object,onActivate:ge.func,onPostActivate:ge.func,checkCanFocusTrap:ge.func,onPause:ge.func,onPostPause:ge.func,onUnpause:ge.func,onPostUnpause:ge.func,onDeactivate:ge.func,onPostDeactivate:ge.func,checkCanReturnFocus:ge.func,initialFocus:ge.oneOfType([ge.instanceOf(hr),ge.string,ge.bool,ge.func]),fallbackFocus:ge.oneOfType([ge.instanceOf(hr),ge.string,ge.func]),escapeDeactivates:ge.oneOfType([ge.bool,ge.func]),clickOutsideDeactivates:ge.oneOfType([ge.bool,ge.func]),returnFocusOnDeactivate:ge.bool,setReturnFocus:ge.oneOfType([ge.instanceOf(hr),ge.string,ge.bool,ge.func]),allowOutsideClick:ge.oneOfType([ge.bool,ge.func]),preventScroll:ge.bool,tabbableOptions:ge.shape({displayCheck:ge.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:ge.oneOfType([ge.bool,ge.func])}),trapStack:ge.array,isKeyForward:ge.func,isKeyBackward:ge.func}),containerElements:ge.arrayOf(ge.instanceOf(hr)),children:ge.oneOfType([ge.element,ge.instanceOf(hr)])};io.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:jp};var Np=io;const Mp=jn(Np);const mn=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:d="",gtmContext:m="Modal"})=>{const p=se.useIntl(),{registerOverlay:h,unregisterOverlay:g}=fd(),[f,b]=y.useState(t),[v,_]=y.useState(null),F=y.useRef(null),x=N=>{N.key==="Escape"&&S(!1)},w=N=>{_(N.target)},B=N=>{v===F.current&&N.target===F.current&&S(!1),_(null)};y.useEffect(()=>(window.addEventListener("keyup",x),()=>{window.removeEventListener("keyup",x)})),y.useEffect(()=>{const N=F.current;return N&&(N.addEventListener("mousedown",w),N.addEventListener("mouseup",B)),()=>{N&&(N.removeEventListener("mousedown",w),N.removeEventListener("mouseup",B))}},[v]);const S=N=>{if(b(N),N)a(),h(e);else{if(f===N)return;i(),g(e)}};y.useEffect(()=>(S(t),()=>{f&&g(e)}),[t]);const z=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:F,className:G("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(ro,{id:e,className:G("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:z,children:t&&c.jsx(Mp,{containerElements:[F.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:()=>S(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":m,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(qt,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(qt,{}),c.jsx(sr,{buttons:u})]}),s&&c.jsx(jr,{className:"error",children:s})]})})})})},_d=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const mr="joinCommunityButton",so=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=se.useIntl(),o=y.useContext(mt),l=o&&typeof o.id=="string",u=r||!l,[d,m]=y.useState(e),[p,h]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{p==="joining"?h("joined"):p==="leaving"&&h("notJoined")},[d]);const g={},f={};return d&&p!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${mr}_leave`}),g["aria-label"]=s.formatMessage({id:`${mr}_member_aria`}),f["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:`${mr}_closed_tooltip`}):"",onClick:async b=>{if(u)return;b.currentTarget.blur(),h(d?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${mr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(v);const _=d?i:a;typeof _=="function"&&setTimeout(async()=>{await _()},500),m(!d)},className:G("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...g,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${mr}${["joining","leaving"].includes(p)?`_${p}`:d?"_member":n?"_short":""}`})})})};const _i="communityDetails_",Ip=({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=se.useIntl(),u=5,d=a||i.length,m=i.length?i:Array(u).fill({}),p=`/communities/${r}/members`===window.location.pathname,h=t||n,g=!n&&!t;return c.jsxs("div",{className:G("community-details",e),children:[h&&c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[l.formatMessage({id:`${_i}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:`${_i}viewAll`})})})]}),c.jsx(no,{contributors:{total:a,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:d===0},cutoff:u})]}),c.jsx(so,{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:`${_i}invite`})})]})};const Rp=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=se.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Ie,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:G("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(dn,{href:s?void 0:i,...l,children:Jn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const $p=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=se.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=(d,m)=>{let p=[];o.includes(d)?p=o.filter(h=>h!==d):d==="all"?p=["all"]:n?p=[...o.filter(h=>h!=="all"),d]:p=[d],l(h=>(r&&typeof r=="function"&&r({current:p,previous:h}),p)),m&&typeof m=="function"&&m()};return c.jsx("ul",{className:G("filters",a),children:s.map(({id:d,text:m,disabled:p=!1,callback:h=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:m})}),c.jsx("li",{children:c.jsx("button",{className:G(d,{selected:o.includes(d)}),onClick:f=>{f.preventDefault(),f.stopPropagation(),u(d,h)},...g,children:m})},d)})})},Lp=(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 ta="languageSwitcher_",zp=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=se.useIntl(),{updateLanguage:d=()=>{}}=y.useContext(eo),[m,p]=y.useState(e);if(y.useEffect(()=>{e!==m&&p(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const g=Object.keys(r),f=m!==e;return c.jsxs("div",{className:G("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${ta}label`})}),c.jsx("ul",{children:g.map(b=>{var F;if(!Da[b])return null;const v=(F=r[b])==null?void 0:F.post_name;let _={className:b};if(m===b)_["aria-label"]=u.formatMessage({id:`${ta}selected`},{language:Da[b]});else{const x=Lp(b,v,i);_={..._,href:typeof x=="string"?x:x.url,onClick:w=>{p(b),d(b),typeof a<"u"&&(w.preventDefault(),w.stopPropagation(),a(b,typeof x=="string"?x:x.urlForRouter))}}}return c.jsx("li",{children:c.jsx(dn,{..._,fallbackElement:"span",children:Da[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${ta}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${ta}disclaimer`},{email:Wn.support,link:b=>{const v=`mailto:${b}`;return c.jsx("a",{href:v,children:b})}})})]})};const ki=se.createIntl({locale:"en",messages:ir}),Ur=({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:ki.formatMessage({id:"loadMore_button"}),endOfFeed:ki.formatMessage({id:"loadMore_endOfFeed"}),error:ki.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,m]=y.useState(""),p=async h=>{if(!n)try{await t(h)}catch(g){g instanceof Error?m(g.message):m("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:G("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 oo=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:G("logo",e,t,n),...r,children:c.jsx(Ie,{children:c.jsx(se.FormattedMessage,{id:"apolitical"})})})});let na=!1;const kd=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=se.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:G("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:m,icon:p,...h},g)=>{const f={...h,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{na&&(clearTimeout(na),na=!1)},onBlur:()=>{na=setTimeout(()=>{o(!1)},100)}};return u&&(f.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,...f,children:m})},`${window.btoa(m)}_${g}`)})})]})})},qp=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Wp=y.lazy(()=>Promise.resolve().then(()=>$m)),Up=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Fd=({activeLink:e,profile:t})=>{const n=se.useIntl(),r=y.useContext(mt),a=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Up.map(({key:i,href:s})=>{const o=qp(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:G(i,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${i}`})})},i)}),a&&t&&c.jsx(Wp,{element:"li",member:r,styling:{variant:"card",isCondensed:!1},functions:{profile:t},className:"profile gtm-trackable","data-testid":"profile-link",alt:"",gtmContext:"NavigationMenu",gtmType:"profile-click"})]})},pr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Hp=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${pr(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(`${pr(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(`${pr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
62
+ */function Cu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function xu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cu(Object(n),!0).forEach(function(r){bp(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function bp(e,t,n){return t=Dp(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yp(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 Dp(e){var t=yp(e,"string");return typeof t=="symbol"?t:String(t)}var wu={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()}},Cp=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},xp=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},wr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},wp=function(t){return wr(t)&&!t.shiftKey},Ep=function(t){return wr(t)&&t.shiftKey},Eu=function(t){return setTimeout(t,0)},_u=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},hr=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},ea=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},_p=[],kp=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||_p,i=xu({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:wp,isKeyBackward:Ep},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(w,A,j){return w&&w[A]!==void 0?w[A]:i[j||A]},u=function(w,A){var j=typeof(A==null?void 0:A.composedPath)=="function"?A.composedPath():void 0;return s.containerGroups.findIndex(function(L){var U=L.container,Z=L.tabbableNodes;return U.contains(w)||(j==null?void 0:j.includes(U))||Z.find(function(G){return G===w})})},d=function(w){var A=i[w];if(typeof A=="function"){for(var j=arguments.length,L=new Array(j>1?j-1:0),U=1;U<j;U++)L[U-1]=arguments[U];A=A.apply(void 0,L)}if(A===!0&&(A=void 0),!A){if(A===void 0||A===!1)return A;throw new Error("`".concat(w,"` was specified but was not a node, or did not return a node"))}var Z=A;if(typeof A=="string"&&(Z=r.querySelector(A),!Z))throw new Error("`".concat(w,"` as selector refers to no known node"));return Z},m=function(){var w=d("initialFocus");if(w===!1)return!1;if(w===void 0||!xa(w,i.tabbableOptions))if(u(r.activeElement)>=0)w=r.activeElement;else{var A=s.tabbableGroups[0],j=A&&A.firstTabbableNode;w=j||d("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 A=kd(w,i.tabbableOptions),j=Fd(w,i.tabbableOptions),L=A.length>0?A[0]:void 0,U=A.length>0?A[A.length-1]:void 0,Z=j.find(function(C){return yn(C)}),G=j.slice().reverse().find(function(C){return yn(C)}),ae=!!A.find(function(C){return un(C)>0});return{container:w,tabbableNodes:A,focusableNodes:j,posTabIndexesFound:ae,firstTabbableNode:L,lastTabbableNode:U,firstDomTabbableNode:Z,lastDomTabbableNode:G,nextTabbableNode:function(z){var Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,k=A.indexOf(z);return k<0?Q?j.slice(j.indexOf(z)+1).find(function(F){return yn(F)}):j.slice(0,j.indexOf(z)).reverse().find(function(F){return yn(F)}):A[k+(Q?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(w){return w.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(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.")},h=function q(w){var A=w.activeElement;if(A)return A.shadowRoot&&A.shadowRoot.activeElement!==null?q(A.shadowRoot):A},g=function q(w){if(w!==!1&&w!==h(document)){if(!w||!w.focus){q(m());return}w.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=w,Cp(w)&&w.select()}},f=function(w){var A=d("setReturnFocus",w);return A||(A===!1?!1:w)},b=function(w){var A=w.target,j=w.event,L=w.isBackward,U=L===void 0?!1:L;A=A||ea(j),p();var Z=null;if(s.tabbableGroups.length>0){var G=u(A,j),ae=G>=0?s.containerGroups[G]:void 0;if(G<0)U?Z=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:Z=s.tabbableGroups[0].firstTabbableNode;else if(U){var C=_u(s.tabbableGroups,function(I){var W=I.firstTabbableNode;return A===W});if(C<0&&(ae.container===A||xa(A,i.tabbableOptions)&&!yn(A,i.tabbableOptions)&&!ae.nextTabbableNode(A,!1))&&(C=G),C>=0){var z=C===0?s.tabbableGroups.length-1:C-1,Q=s.tabbableGroups[z];Z=un(A)>=0?Q.lastTabbableNode:Q.lastDomTabbableNode}else wr(j)||(Z=ae.nextTabbableNode(A,!1))}else{var k=_u(s.tabbableGroups,function(I){var W=I.lastTabbableNode;return A===W});if(k<0&&(ae.container===A||xa(A,i.tabbableOptions)&&!yn(A,i.tabbableOptions)&&!ae.nextTabbableNode(A))&&(k=G),k>=0){var F=k===s.tabbableGroups.length-1?0:k+1,R=s.tabbableGroups[F];Z=un(A)>=0?R.firstTabbableNode:R.firstDomTabbableNode}else wr(j)||(Z=ae.nextTabbableNode(A))}}else Z=d("fallbackFocus");return Z},v=function(w){var A=ea(w);if(!(u(A,w)>=0)){if(hr(i.clickOutsideDeactivates,w)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}hr(i.allowOutsideClick,w)||w.preventDefault()}},E=function(w){var A=ea(w),j=u(A,w)>=0;if(j||A instanceof Document)j&&(s.mostRecentlyFocusedNode=A);else{w.stopImmediatePropagation();var L,U=!0;if(s.mostRecentlyFocusedNode)if(un(s.mostRecentlyFocusedNode)>0){var Z=u(s.mostRecentlyFocusedNode),G=s.containerGroups[Z].tabbableNodes;if(G.length>0){var ae=G.findIndex(function(C){return C===s.mostRecentlyFocusedNode});ae>=0&&(i.isKeyForward(s.recentNavEvent)?ae+1<G.length&&(L=G[ae+1],U=!1):ae-1>=0&&(L=G[ae-1],U=!1))}}else s.containerGroups.some(function(C){return C.tabbableNodes.some(function(z){return un(z)>0})})||(U=!1);else U=!1;U&&(L=b({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(L||s.mostRecentlyFocusedNode||m())}s.recentNavEvent=void 0},B=function(w){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=w;var j=b({event:w,isBackward:A});j&&(wr(w)&&w.preventDefault(),g(j))},_=function(w){if(xp(w)&&hr(i.escapeDeactivates,w)!==!1){w.preventDefault(),o.deactivate();return}(i.isKeyForward(w)||i.isKeyBackward(w))&&B(w,i.isKeyBackward(w))},x=function(w){var A=ea(w);u(A,w)>=0||hr(i.clickOutsideDeactivates,w)||hr(i.allowOutsideClick,w)||(w.preventDefault(),w.stopImmediatePropagation())},T=function(){if(s.active)return wu.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Eu(function(){g(m())}):g(m()),r.addEventListener("focusin",E,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",x,{capture:!0,passive:!1}),r.addEventListener("keydown",_,{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",x,!0),r.removeEventListener("keydown",_,!0),o},$=function(w){var A=w.some(function(j){var L=Array.from(j.removedNodes);return L.some(function(U){return U===s.mostRecentlyFocusedNode})});A&&g(m())},M=typeof window<"u"&&"MutationObserver"in window?new MutationObserver($):void 0,N=function(){M&&(M.disconnect(),s.active&&!s.paused&&s.containers.map(function(w){M.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 A=l(w,"onActivate"),j=l(w,"onPostActivate"),L=l(w,"checkCanFocusTrap");L||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,A==null||A();var U=function(){L&&p(),T(),N(),j==null||j()};return L?(L(s.containers.concat()).then(U,U),this):(U(),this)},deactivate:function(w){if(!s.active)return this;var A=xu({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},w);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,N(),wu.deactivateTrap(a,o);var j=l(A,"onDeactivate"),L=l(A,"onPostDeactivate"),U=l(A,"checkCanReturnFocus"),Z=l(A,"returnFocus","returnFocusOnDeactivate");j==null||j();var G=function(){Eu(function(){Z&&g(f(s.nodeFocusedBeforeActivation)),L==null||L()})};return Z&&U?(U(f(s.nodeFocusedBeforeActivation)).then(G,G),this):(G(),this)},pause:function(w){if(s.paused||!s.active)return this;var A=l(w,"onPause"),j=l(w,"onPostPause");return s.paused=!0,A==null||A(),S(),N(),j==null||j(),this},unpause:function(w){if(!s.paused||!s.active)return this;var A=l(w,"onUnpause"),j=l(w,"onPostUnpause");return s.paused=!1,A==null||A(),p(),T(),N(),j==null||j(),this},updateContainerElements:function(w){var A=[].concat(w).filter(Boolean);return s.containers=A.map(function(j){return typeof j=="string"?r.querySelector(j):j}),s.active&&p(),N(),this}},o.updateContainerElements(t),o};const Fp=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:kp},Symbol.toStringTag,{value:"Module"})),Bp=Ic(Fp),Ap=Ic(vp);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 Tp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ku(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,Bd(r.key),r)}}function Sp(e,t,n){return t&&ku(e.prototype,t),n&&ku(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function jp(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&&Es(e,t)}function Es(e,t){return Es=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Es(e,t)}function Op(e){var t=Mp();return function(){var r=Ma(e),a;if(t){var i=Ma(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return Pp(this,a)}}function Pp(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 Cr(e)}function Cr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mp(){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 Ma(e){return Ma=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ma(e)}function Np(e,t,n){return t=Bd(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bd(e){var t=Ip(e,"string");return tr(t)==="symbol"?t:String(t)}function Ip(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 ta=y,ge=tp,Rp=Bp,$p=Rp.createFocusTrap,Lp=Ap,zp=Lp.isFocusable,oo=function(e){jp(n,e);var t=Op(n);function n(r){var a;Tp(this,n),a=t.call(this,r),Np(Cr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var d=arguments.length,m=new Array(d>1?d-1:0),p=1;p<d;p++)m[p-1]=arguments[p];u=u.apply(void 0,m)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var h=u;if(typeof u=="string"){var g;if(h=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!h)throw new Error("`".concat(o,"` as selector refers to no known node"))}return h}),a.handleDeactivate=a.handleDeactivate.bind(Cr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(Cr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(Cr(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 Sp(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&&!zp(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?ta.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===ta.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=ta.cloneElement(i,{ref:s});return o}return null}}]),n}(ta.Component),mr=typeof Element>"u"?Function:Element;oo.propTypes={active:ge.bool,paused:ge.bool,focusTrapOptions:ge.shape({document:ge.object,onActivate:ge.func,onPostActivate:ge.func,checkCanFocusTrap:ge.func,onPause:ge.func,onPostPause:ge.func,onUnpause:ge.func,onPostUnpause:ge.func,onDeactivate:ge.func,onPostDeactivate:ge.func,checkCanReturnFocus:ge.func,initialFocus:ge.oneOfType([ge.instanceOf(mr),ge.string,ge.bool,ge.func]),fallbackFocus:ge.oneOfType([ge.instanceOf(mr),ge.string,ge.func]),escapeDeactivates:ge.oneOfType([ge.bool,ge.func]),clickOutsideDeactivates:ge.oneOfType([ge.bool,ge.func]),returnFocusOnDeactivate:ge.bool,setReturnFocus:ge.oneOfType([ge.instanceOf(mr),ge.string,ge.bool,ge.func]),allowOutsideClick:ge.oneOfType([ge.bool,ge.func]),preventScroll:ge.bool,tabbableOptions:ge.shape({displayCheck:ge.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:ge.oneOfType([ge.bool,ge.func])}),trapStack:ge.array,isKeyForward:ge.func,isKeyBackward:ge.func}),containerElements:ge.arrayOf(ge.instanceOf(mr)),children:ge.oneOfType([ge.element,ge.instanceOf(mr)])};oo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:$p};var qp=oo;const Wp=On(qp);const pn=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:d="",gtmContext:m="Modal"})=>{const p=se.useIntl(),{registerOverlay:h,unregisterOverlay:g}=gd(),[f,b]=y.useState(t),[v,E]=y.useState(null),B=y.useRef(null),_=M=>{M.key==="Escape"&&S(!1)},x=M=>{E(M.target)},T=M=>{v===B.current&&M.target===B.current&&S(!1),E(null)};y.useEffect(()=>(window.addEventListener("keyup",_),()=>{window.removeEventListener("keyup",_)})),y.useEffect(()=>{const M=B.current;return M&&(M.addEventListener("mousedown",x),M.addEventListener("mouseup",T)),()=>{M&&(M.removeEventListener("mousedown",x),M.removeEventListener("mouseup",T))}},[v]);const S=M=>{if(b(M),M)a(),h(e);else{if(f===M)return;i(),g(e)}};y.useEffect(()=>(S(t),()=>{f&&g(e)}),[t]);const $=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:B,className:Y("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(io,{id:e,className:Y("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:$,children:t&&c.jsx(Wp,{containerElements:[B.current],children:c.jsxs("div",{className:"overlay-content",children:[c.jsxs("div",{className:"top",children:[o&&c.jsx("h2",{className:"modal-title",children:o}),c.jsx(Ee,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>S(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":m,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(Wt,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(Wt,{}),c.jsx(or,{buttons:u})]}),s&&c.jsx(Or,{className:"error",children:s})]})})})})},Ad=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const pr="joinCommunityButton",uo=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=se.useIntl(),o=y.useContext(gt),l=o&&typeof o.id=="string",u=r||!l,[d,m]=y.useState(e),[p,h]=y.useState(e?"joined":"notJoined");y.useEffect(()=>{p==="joining"?h("joined"):p==="leaving"&&h("notJoined")},[d]);const g={},f={};return d&&p!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${pr}_leave`}),g["aria-label"]=s.formatMessage({id:`${pr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(Ee,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&p!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${pr}_closed_tooltip`}):"",onClick:async b=>{if(u)return;b.currentTarget.blur(),h(d?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${pr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(v);const E=d?i:a;typeof E=="function"&&setTimeout(async()=>{await E()},500),m(!d)},className:Y("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...g,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${pr}${["joining","leaving"].includes(p)?`_${p}`:d?"_member":n?"_short":""}`})})})};const ki="communityDetails_",Up=({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=se.useIntl(),u=5,d=a||i.length,m=i.length?i:Array(u).fill({}),p=`/communities/${r}/members`===window.location.pathname,h=t||n,g=!n&&!t;return c.jsxs("div",{className:Y("community-details",e),children:[h&&c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[l.formatMessage({id:`${ki}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:`${ki}viewAll`})})})]}),c.jsx(ao,{contributors:{total:a,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:d===0},cutoff:u})]}),c.jsx(uo,{isMember:t,isOpen:n,disabled:g,functions:{...o}}),t&&c.jsx(Ee,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${ki}invite`})})]})};const Hp=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=se.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Ne,{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(Ne,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(fn,{href:s?void 0:i,...l,children:Xn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Vp=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=se.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=(d,m)=>{let p=[];o.includes(d)?p=o.filter(h=>h!==d):d==="all"?p=["all"]:n?p=[...o.filter(h=>h!=="all"),d]:p=[d],l(h=>(r&&typeof r=="function"&&r({current:p,previous:h}),p)),m&&typeof m=="function"&&m()};return c.jsx("ul",{className:Y("filters",a),children:s.map(({id:d,text:m,disabled:p=!1,callback:h=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:m})}),c.jsx("li",{children:c.jsx("button",{className:Y(d,{selected:o.includes(d)}),onClick:f=>{f.preventDefault(),f.stopPropagation(),u(d,h)},...g,children:m})},d)})})},Kp=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let a="",i=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(a+=`/${s}`,i=!0):(a.includes(`/${r}/`)||(a+=`/${r}`),a+=`/${s}`)}),a.includes(`/${r}/`)||(a+=`/${r}`),t&&(a+=`/${t}`),i?{url:a,urlForRouter:`/${a.split("/").slice(2).join("/")}`}:a};const na="languageSwitcher_",Zp=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=se.useIntl(),{updateLanguage:d=()=>{}}=y.useContext(no),[m,p]=y.useState(e);if(y.useEffect(()=>{e!==m&&p(e)},[e]),!r||!Object.values(r).some(b=>b&&b.post_name))return null;const g=Object.keys(r),f=m!==e;return c.jsxs("div",{className:Y("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${na}label`})}),c.jsx("ul",{children:g.map(b=>{var B;if(!Ca[b])return null;const v=(B=r[b])==null?void 0:B.post_name;let E={className:b};if(m===b)E["aria-label"]=u.formatMessage({id:`${na}selected`},{language:Ca[b]});else{const _=Kp(b,v,i);E={...E,href:typeof _=="string"?_:_.url,onClick:x=>{p(b),d(b),typeof a<"u"&&(x.preventDefault(),x.stopPropagation(),a(b,typeof _=="string"?_:_.urlForRouter))}}}return c.jsx("li",{children:c.jsx(fn,{...E,fallbackElement:"span",children:Ca[b]})},b)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${na}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${na}disclaimer`},{email:Un.support,link:b=>{const v=`mailto:${b}`;return c.jsx("a",{href:v,children:b})}})})]})};const Fi=se.createIntl({locale:"en",messages:sr}),Hr=({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[d,m]=y.useState(""),p=async h=>{if(!n)try{await t(h)}catch(g){g instanceof Error?m(g.message):m("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:Y("load-more",l),children:!d&&e?c.jsx(Ee,{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 lo=({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(Ne,{children:c.jsx(se.FormattedMessage,{id:"apolitical"})})})});let ra=!1;const Td=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=se.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:c.jsxs(c.Fragment,{children:[c.jsx(Ee,{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:m,icon:p,...h},g)=>{const f={...h,onClick:b=>{o(!1),typeof d=="function"&&d(b)},onFocus:()=>{ra&&(clearTimeout(ra),ra=!1)},onBlur:()=>{ra=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(Ee,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...f,children:m})},`${window.btoa(m)}_${g}`)})})]})})},Yp=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Gp=y.lazy(()=>Promise.resolve().then(()=>Vm)),Qp=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Sd=({activeLink:e,profile:t})=>{const n=se.useIntl(),r=y.useContext(gt),a=r&&typeof r.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Qp.map(({key:i,href:s})=>{const o=Yp(s,e),l={};return o&&(l["aria-current"]="page"),c.jsx("li",{className:Y(i,{active:o}),children:c.jsx("a",{href:s,"data-gtm-event-type":`${i}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...l,children:n.formatMessage({id:`navigationMenu_links_${i}`})})},i)}),a&&t&&c.jsx(Gp,{element:"li",member:r,styling:{variant:"card",isCondensed:!1},functions:{profile:t},className:"profile gtm-trackable","data-testid":"profile-link",alt:"",gtmContext:"NavigationMenu",gtmType:"profile-click"})]})},gr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Jp=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${gr(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(`${gr(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(`${gr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
63
63
 
64
- ${pr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:pr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const Vp="shareLinks_",Kp=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=se.useIntl(),l=Hp({title:e,link:t,referrer:n});return c.jsxs("aside",{className:G("share-links",a,i,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:l.map(({key:u,icon:d,url:m,shouldRender:p=!0,onClick:h})=>{if(typeof p=="function"&&!p())return null;const g={};return h&&(g.onClick=f=>h(f,m)),c.jsx("li",{children:c.jsx(_e,{size:a,variant:"tertiary",icon:{icon:d||u},href:m,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${Vp}link_${u}`}),...g})},u)})})]})};const Zp=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(f,b,v)=>(f||(f=`panel-${window.btoa(b)}-${v}`),f),a=On(!0)||0;let i=e.findIndex(f=>f.current===!0);if(i<0&&(i=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(v=>v.id===f)){for(let v=0;v<e.length;v++)if(r(e[v].id,e[v].text,v)===f){i=v;break}}}const[s,o]=y.useState((g=e[i])!=null&&g.id?e[i].id:r(e[i].id,e[i].text,i)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let v=b;f.key==="ArrowLeft"?b>0?v=b-1:v=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?v=b+1:v=0);const _=r(e[v].id,e[v].text,v),F=document.getElementById(`tab-${_}`);F==null||F.focus(),u(_);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},m=f=>{let b=!1;return f.target==="min-width"&&a>=f.value&&(b=!0),f.target==="max-width"&&a<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const p=[],h=[];return e.forEach(({id:f,text:b,content:v,href:_,hasCarousel:F,breakpoint:x},w)=>{if(x&&!m(x))return;f=r(f,b,w);const B=s===f,S={};_||(S["aria-controls"]=f,S.onClick=z=>{z.preventDefault(),z.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},h.push(c.jsx("section",{id:f,hidden:!B,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":B?"assertive":"off",children:typeof v=="string"?c.jsx("p",{children:v}):v},`section-${f}`))),p.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:_||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:G({selected:B}),role:"tab",tabIndex:B?0:-1,"aria-selected":B,onKeyDown:z=>d(z,w),...S,children:b})},`tab-${f}`))}),c.jsxs("div",{className:G("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:p}),c.jsx("div",{className:"tab-content",children:h})]})};const Yp={"2-1":901,"1-3":769,"1-1":769},Bd=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=On(!0);let s=a;return y.Children.count(a)===1&&(s=y.Children.toArray(a)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:G("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Yp[e]?null:o)})};const uo=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=se.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:G("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})})]})},ti=e=>(e==null?void 0:e.toString().length)||0,Ad=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{ti(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const ra="emailHelperTextBox_",Td=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=se.useIntl(),[s,o]=y.useState({path:`${ra}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=b=>{o({path:`${ra}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>d(v),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof a!="function"){f(i.formatMessage({id:`${ra}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let g=ra,f="default",b={},v={};switch(t){case"gov":g+="autoApproved",f="success";break;case"nonGov":g+="unrecognisedEmail",f="error",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":g+="pendingApproval",f="error",v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":g+="emailUnverified",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:_=>d(_),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",b={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:g,type:f,link:b,mail:v})},[t]);const m={};return["link","mail"].forEach(g=>{m[g]=Object.keys(s[g]).length?f=>c.jsx("a",{...s[g],children:f}):f=>f}),c.jsx(nd,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),children:l?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{element:"span"}),c.jsx(Ft,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...m,strong:g=>c.jsx("strong",{children:g}),em:g=>c.jsx("em",{children:g}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Un=({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 m=y.useRef(),p=r||m;return y.useEffect(()=>{var h;u&&((h=p.current)==null||h.focus())},[]),!(d!=null&&d.autoComplete)&&["email"].includes(o)&&(d.autoComplete="email"),y.createElement(t,{ref:p,...d,type:o,id:n,name:i,className:G(e,t,{"has-scrollbar":o==="textarea"&&p.current&&p.current.clientHeight<p.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:h=>{const g=h.target;a.onChange(g.value)}})};const Rn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Gp=500,Qp=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:d},m]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:h,isPredictionSelected:g},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=se.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const x=setTimeout(()=>{g||m(w=>({...w,debouncedInput:l}))},Gp);return()=>{clearTimeout(x)}},[l,g]),y.useEffect(()=>{d&&!g?(async()=>{try{const w=await o(d)||[];f(B=>({...B,predictions:w}))}catch(w){console.error("Error fetching predictions:",w),f(B=>({...B,predictions:[]}))}})():f(x=>({...x,predictions:[]}))},[d,g]),y.useEffect(()=>{h>=0&&p[h]&&m(x=>({...x,displayInput:p[h].description}))},[h,p]);const v=x=>{[Rn.DOWN,Rn.UP,Rn.ENTER].includes(x.key)&&(x.preventDefault(),x.key===Rn.DOWN&&h<p.length-1?f(w=>({...w,activePredictionIndex:h+1})):x.key===Rn.UP&&h>0?f(w=>({...w,activePredictionIndex:h-1})):x.key===Rn.ENTER&&h>-1&&(s(p[h].description),m(w=>({...w,input:p[h].description})),f(w=>({...w,predictions:[],isPredictionSelected:!0}))))},_=x=>{s(x.target.value),m(w=>({...w,input:x.target.value,displayInput:x.target.value})),f(w=>({...w,activePredictionIndex:-1,isPredictionSelected:!1}))},F=x=>{s(x.description),m(w=>({...w,input:x.description,displayInput:x.description})),f(w=>({...w,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:_,onKeyDown:v,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:p.map((x,w)=>c.jsx("li",{onClick:()=>F(x),onMouseEnter:()=>f(B=>({...B,activePredictionIndex:w})),className:G("predictions-list-item",{active:w===h}),children:x.description},w))})]})};const Sd=({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,...m})=>{const p=se.useIntl(),{onChange:h,...g}=r,f=()=>{t||h(d?null:l)},b=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(),f())},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 y.createElement(n,{onClick:v=>{const _=v.target;_.nodeName.toLowerCase()==="a"||_.parentNode&&_.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),f())},className:G("checkbox-wrapper",e),...m,...g},b)};const Jp=y.memo(function({direction:t="down"}){return c.jsx(Ga,{className:G("rotating-chevron",`direction-${t}`)})});const Xp=({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=se.useIntl(),[m,p]=y.useState(!1),h=r||n,g=Array.isArray(h)?[...h]:h?[h]:[],[f,b]=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(()=>{b(g)},[r,n]);const{onChange:_,onMultiSelectSubmit:F,...x}=a,w=S=>{if(o){let z=[];f!=null&&f.includes(S.id)?z=f.filter(N=>N!==S.id):z=[...f,S.id],b([...z]),_&&_([...z])}else b([S]),_&&_(S.id),p(!1)},B=S=>{if(S==="all"){const z=(t==null?void 0:t.map(N=>N.id))||[];b(z),_&&_(z)}else b([]),_&&_([])};return c.jsxs("div",{className:G("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":m,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),p(!m)},"data-testid":"dropdown-selector",...x,children:[o?`${s} · ${f.length}`:v.label,c.jsx(Jp,{direction:m?"up":"down"})]}),c.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const z=t&&t.find(N=>N.id===S.target.value);w(z)},hidden:!m,...x,children:t==null?void 0:t.map(S=>c.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))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!m,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${f==null?void 0:f.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>B("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>B("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(S=>{const z=S.id===v.id||(f==null?void 0:f.includes(S))||(f==null?void 0:f.includes(S.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:G("gtm-trackable",{selected:z,"selected-single":z&&!o}),"data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,onClick:N=>{N.preventDefault(),N.stopPropagation(),w(S)},role:"menuitem","aria-current":z,"data-testid":z?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:G({"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:()=>{F&&F(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),p(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})};const eg=({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,...m})=>{const p=se.useIntl(),h=i?d:[],g=d;return c.jsx("ul",{...m,className:G("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:f,label:b=!1,value:v=f,disabled:_=!1})=>{const F=`${r}_${f}`,x=()=>{if(_)return;let w;if(i){const B=h==null?void 0:h.indexOf(v);Array.isArray(h)&&B>=0?(w=h,w.splice(B,1)):(!h||h.length===0?w=[]:w=h,w.push(v))}else w=g===v?void 0:v;t.onChange(w)};return c.jsx(Sd,{element:"li",id:F,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?h==null?void 0:h.includes(v):g===v,functions:{...t,onChange:x},intlPath:n,label:b||p.formatMessage({id:n?`${n}_${f}`:f}),disabled:_},F)})})};const tg=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=se.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,m]=y.useState(t),p=()=>{var h;u(!l),m(l?"password":"text"),(h=o.current)==null||h.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:G("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(Un,{inputRef:o,type:d,autoComplete:r,...a})]})};const $n={text:{component:Un},email:{component:Un},url:{component:Un},textarea:{component:Un,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Sd},checkboxes:{component:eg,props:{multiSelect:!0}},select:{component:Xp},password:{component:tg},autocomplete:{component:Qp}},ng=({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,...m})=>{const p=se.useIntl(),h=l&&l.some(({condition:I})=>I==="required"),g=ti(u),f=o&&$n[o]&&$n[o].component?$n[o].component:Un,b=o&&["checkboxes"].includes(o),v=o&&["autocomplete"].includes(o),_=r&&`error-${e}`,F=`character-limit-${e}`,x={};b?x.element="legend":x.htmlFor=e;let w={...m,id:e,name:e,className:r?"error":"",type:o,required:h,"aria-required":h,functions:xn(a),value:u};const B=I=>{w["aria-describedby"]?w["aria-describedby"]+=` ${I}`:w["aria-describedby"]=I};if(i>0){const I=Ad(i,a.onChange);B(`${F}-info`),w={...w,...I},I.functions&&typeof I.functions=="object"&&(w.functions={...w.functions,...I.functions})}o&&$n[o]&&$n[o].props&&(w={...w,...$n[o].props}),b&&(w.intlPath=`${t}_${e}`),r&&(w["aria-invalid"]=!0,w["aria-errormessage"]=_,B(_));const S=m.label||p.formatMessage({id:t?`${t}_${e}`:e}),z=({...I})=>r?y.createElement(I.as||"p",{id:_,className:"error text-small",...I},r):null;if(o&&["checkbox"].includes(o))return c.jsxs(c.Fragment,{children:[c.jsx(f,{...w,label:S,className:G("field-wrapper",n)}),c.jsx(z,{as:"p"})]});const N=I=>y.createElement(I.element||"label",{...I,className:"checkboxes-label text-small","data-testid":`label-${e}`});return c.jsx(c.Fragment,{children:y.createElement(b?"fieldset":"div",{className:G("field-wrapper text-medium",n)},c.jsxs(c.Fragment,{children:[y.createElement(b?"div":"p",{className:"field-label"},c.jsx(c.Fragment,{children:c.jsxs(N,{...x,children:[S,h&&s&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})})),y.createElement(b||v?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(f,{...w}),c.jsx(uo,{id:F,limit:i,valueLength:g})]})),c.jsx(z,{})]}))})},rg=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?xn(e.errors):{},i=e.values?xn(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:d}=r,m=xn(Object.keys(a));for(const p of s)if(p.validation)for(let h=0;h<p.validation.length;h++){const{condition:g="required",error:f=!1}=p.validation[h];let b=!1;if(typeof g=="function"){const v=g(i);v&&(b=f||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(b=f||(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)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:p.id,value:b}}),m.push(p.id);break}}return m.length===0?l(i):u(i,m),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Fi=null;const Jt=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:m,...p})=>{const{customOnSubmit:h,hideButton:g,...f}=s,b=40,{shouldShowCancelButton:v=!1,shouldReset:_=!0,shouldHide:F=!0,showRequiredLabels:x=!0,showSuccessMessage:w=!1}=l||{},{onSuccess:B=async()=>{},onCancel:S=()=>{},onCatch:z=()=>{},onFailure:N=()=>{}}=m||{},I=se.useIntl(),M={};t.length&&t.forEach(T=>{const $=T.id||T.name;$&&(M[$]=T.value||"")});const[k,A]=y.useReducer(rg,{isSubmitting:!1,formSubmitted:!1,errors:{},values:M}),{errors:j,isSubmitting:L,formSubmitted:H,values:Y}=k;y.useEffect(()=>{_&&H&&(Fi=setTimeout(()=>{A({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[H]),y.useEffect(()=>()=>{Fi&&clearTimeout(Fi)},[]),y.useEffect(()=>{const T=$=>{A({type:"updateValue",payload:{key:$.detail.id,value:$.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",T),()=>{document.removeEventListener("dropdownMultiSelectSubmit",T)}},[]);const Q=y.useRef(null),re=a||Q;if(!t.length)return null;const C={};s.children&&(C.default=s.children),f.text&&typeof f.text=="string"&&(C.default=f.text),["default","submitting","submitted"].forEach(T=>{f.text&&typeof f.text!="string"&&T in f.text?C[T]=f.text[T]:C[T]||(C[T]=I.formatMessage({id:`form_${T==="default"?"submit":T}`}))}),delete f.text;const q=()=>{if(!L){if(A({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&A({type:"submitForm",payload:{fields:t,dispatch:A,intl:I}});return}A({type:"submitForm",payload:{fields:t,dispatch:A,onSuccess:async T=>{try{await B(T),A({type:_?"formSubmittedAndReset":"formSubmitted"})}catch($){z($),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(T,$)=>{N(T,$),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:I}})}},E=[{...f,icon:H?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:T=>{var U;if(T.preventDefault(),T.stopPropagation(),L)return;let $=0;if((U=re==null?void 0:re.current)!=null&&U.id){const ae=document.getElementById(re.current.id);ae&&($=ae.getBoundingClientRect().top+window.scrollY)}const R=document.getElementById("header");R&&($=$-R.offsetHeight-b),$<0&&($=0),window.scrollTo({top:$,behavior:"smooth"}),q()},disabled:L||H||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:C[L?"submitting":H?"submitted":"default"]}];return v&&E.unshift({...o,className:"gtm-trackable","data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:L||H,onClick:S,children:o.text||I.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...p,id:r,className:G("form",n),ref:re},c.jsxs(c.Fragment,{children:[j!=null&&j.general?c.jsx(fn,{variant:"error",text:I.formatMessage({id:"form_error_generalError"})}):null,u,(!F||!L&&!H||h)&&t.map((T,$)=>{const{id:R=T.name||$,component:U,functions:ae={onChange:()=>{}},submitOnEnter:J=!1}=T;if(U)return c.jsx(U,{...T.props||{}},`component-${R}-${$}`);const ie=(Y==null?void 0:Y[R])||"",de={...ae,onChange:X=>{A({type:"updateValue",payload:{key:R,value:X}}),ae.onChange(X&&X.toString(),A)}};return J&&(de.onKeyDown=X=>{X.key==="Enter"&&(X.stopPropagation(),X.preventDefault(),q()),ae.onKeyDown&&ae.onKeyDown(X)}),c.jsx(ng,{intlPath:i,...T,showRequiredLabels:x,value:ie,error:j==null?void 0:j[R],functions:de},R)}),g?null:(L||H)&&h?h:c.jsx(sr,{className:G("cta",{center:L||H,submitted:H}),buttons:E})]})),w&&H&&c.jsx(jr,{className:"success",children:typeof w=="string"?w:I.formatMessage({id:"form_success"})})]})};const aa="passwordRules_",jd="isMoreThanEightCharacters",Od="includesNumberAndSymbol",Pd="includesLowerAndUppercase",ag={[jd]:"8Characters",[Od]:"numberSymbol",[Pd]:"lowercaseUppercase"},ig=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=se.useIntl();return c.jsxs("aside",{className:G("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${aa}intro`})}),c.jsx("ul",{children:[jd,Od,Pd].map(r=>c.jsxs("li",{className:G({matches:e[r]}),children:[c.jsxs(Ie,{children:[n.formatMessage({id:`${aa}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${aa}rule_${ag[r]}`})}),!e[r]&&c.jsxs(Ie,{element:"strong",children:[" ",n.formatMessage({id:`${aa}notMet`})]})]},`rule-${r}`))})]})},Nd=y.memo(ig);const sg=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=se.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const v=await n();u(_=>({..._,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(_=>({..._,setUp:!0,disabled:!0})),a(v)}};if(y.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Ft,{className:"rating-placeholder"});const{id:m,rating:p,disabled:h}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},b=async v=>{if(!(!m||h))try{u(_=>({..._,rating:v,disabled:!0})),await r({id:m,value:v})}catch(_){u(F=>({...F,rating:null})),a(_)}finally{u(_=>({..._,disabled:!1}))}};return c.jsxs("div",{className:G("rating",i),children:[c.jsx("span",{className:"label",children:f[p?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const _=v+1;return c.jsx("li",{className:G({selected:p&&_<=p}),children:c.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:`star${!p||_>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:_,total:t})}${_===1||_===t?` - ${f[_===1?"low":"high"]}`:""}`,onClick:F=>{F.preventDefault(),F.stopPropagation(),b(_)},disabled:h})},`rating-${_}`)})})]})};function og(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 Es(e,t){return Array(t+1).join(e)}function ug(e){return e.replace(/^\n*/,"")}function lg(e){for(var t=e.length;t>0&&e[t-1]===`
65
- `;)t--;return e.substring(0,t)}var cg=["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 lo(e){return co(e,cg)}var Md=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Id(e){return co(e,Md)}function dg(e){return $d(e,Md)}var Rd=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function fg(e){return co(e,Rd)}function hg(e){return $d(e,Rd)}function co(e,t){return t.indexOf(e.nodeName)>=0}function $d(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var at={};at.paragraph={filter:"p",replacement:function(e){return`
64
+ ${gr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:gr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const Xp="shareLinks_",eg=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=se.useIntl(),l=Jp({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:m,shouldRender:p=!0,onClick:h})=>{if(typeof p=="function"&&!p())return null;const g={};return h&&(g.onClick=f=>h(f,m)),c.jsx("li",{children:c.jsx(Ee,{size:a,variant:"tertiary",icon:{icon:d||u},href:m,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${Xp}link_${u}`}),...g})},u)})})]})};const tg=({tabs:e,className:t="",preventLocationChange:n})=>{var g;const r=(f,b,v)=>(f||(f=`panel-${window.btoa(b)}-${v}`),f),a=Pn(!0)||0;let i=e.findIndex(f=>f.current===!0);if(i<0&&(i=0),window.location.hash){const f=window.location.hash.replace("#","");if(e.find(v=>v.id===f)){for(let v=0;v<e.length;v++)if(r(e[v].id,e[v].text,v)===f){i=v;break}}}const[s,o]=y.useState((g=e[i])!=null&&g.id?e[i].id:r(e[i].id,e[i].text,i)),[l,u]=y.useState(""),d=(f,b)=>{switch(f.key){case"ArrowLeft":case"ArrowRight":{f.preventDefault();let v=b;f.key==="ArrowLeft"?b>0?v=b-1:v=e.length-1:f.key==="ArrowRight"&&(b<e.length-1?v=b+1:v=0);const E=r(e[v].id,e[v].text,v),B=document.getElementById(`tab-${E}`);B==null||B.focus(),u(E);break}case"Enter":o(l),window.location.hash=`#${l}`;break}},m=f=>{let b=!1;return f.target==="min-width"&&a>=f.value&&(b=!0),f.target==="max-width"&&a<=f.value&&(b=!0),b};y.useEffect(()=>{if(e[i].hasCarousel){const f=new CustomEvent("hiddenSectionVisible",{detail:{id:s}});window.dispatchEvent(f)}},[s]);const p=[],h=[];return e.forEach(({id:f,text:b,content:v,href:E,hasCarousel:B,breakpoint:_},x)=>{if(_&&!m(_))return;f=r(f,b,x);const T=s===f,S={};E||(S["aria-controls"]=f,S.onClick=$=>{$.preventDefault(),$.stopPropagation(),o(f),!n&&(window.location.hash=`#${f}`)},h.push(c.jsx("section",{id:f,hidden:!T,role:"tabpanel","aria-labelledby":`tab-${f}`,"aria-live":T?"assertive":"off",children:typeof v=="string"?c.jsx("p",{children:v}):v},`section-${f}`))),p.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:E||`#${f}`,id:`tab-${f}`,"aria-controls":f,className:Y({selected:T}),role:"tab",tabIndex:T?0:-1,"aria-selected":T,onKeyDown:$=>d($,x),...S,children:b})},`tab-${f}`))}),c.jsxs("div",{className:Y("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:p}),c.jsx("div",{className:"tab-content",children:h})]})};const ng={"2-1":901,"1-3":769,"1-1":769},jd=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Pn(!0);let s=a;return y.Children.count(a)===1&&(s=y.Children.toArray(a)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:Y("columns",`layout-${e}`,r,{"has-containers":n}),children:y.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<ng[e]?null:o)})};const co=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=se.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(Ne,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},ni=e=>(e==null?void 0:e.toString().length)||0,Od=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{ni(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const aa="emailHelperTextBox_",Pd=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=se.useIntl(),[s,o]=y.useState({path:`${aa}default`,type:"default",link:{},mail:{},error:""}),[l,u]=y.useState(!1),d=y.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=b=>{o({path:`${aa}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>d(v),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:b})};if(typeof a!="function"){f(i.formatMessage({id:`${aa}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(b=>{f(b.message)}).finally(()=>{u(!1)})},[n,r,a]);y.useEffect(()=>{let g=aa,f="default",b={},v={};switch(t){case"gov":g+="autoApproved",f="success";break;case"nonGov":g+="unrecognisedEmail",f="error",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":g+="pendingApproval",f="error",v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":g+="emailUnverified",f="error",b={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:E=>d(E),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",b={href:"/api/next-ui/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",b={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:g,type:f,link:b,mail:v})},[t]);const m={};return["link","mail"].forEach(g=>{m[g]=Object.keys(s[g]).length?f=>c.jsx("a",{...s[g],children:f}):f=>f}),c.jsx(ad,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),children:l?c.jsxs(c.Fragment,{children:[c.jsx(Bt,{element:"span"}),c.jsx(Bt,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...m,strong:g=>c.jsx("strong",{children:g}),em:g=>c.jsx("em",{children:g}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},Hn=({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 m=y.useRef(),p=r||m;return y.useEffect(()=>{var h;u&&((h=p.current)==null||h.focus())},[]),!(d!=null&&d.autoComplete)&&["email"].includes(o)&&(d.autoComplete="email"),y.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:h=>{const g=h.target;a.onChange(g.value)}})};const $n={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},rg=500,ag=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:d},m]=y.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:h,isPredictionSelected:g},f]=y.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:b}=se.useIntl();r||(r=b({id:"inputAutocomplete_placeholder"})),y.useEffect(()=>{const _=setTimeout(()=>{g||m(x=>({...x,debouncedInput:l}))},rg);return()=>{clearTimeout(_)}},[l,g]),y.useEffect(()=>{d&&!g?(async()=>{try{const x=await o(d)||[];f(T=>({...T,predictions:x}))}catch(x){console.error("Error fetching predictions:",x),f(T=>({...T,predictions:[]}))}})():f(_=>({..._,predictions:[]}))},[d,g]),y.useEffect(()=>{h>=0&&p[h]&&m(_=>({..._,displayInput:p[h].description}))},[h,p]);const v=_=>{[$n.DOWN,$n.UP,$n.ENTER].includes(_.key)&&(_.preventDefault(),_.key===$n.DOWN&&h<p.length-1?f(x=>({...x,activePredictionIndex:h+1})):_.key===$n.UP&&h>0?f(x=>({...x,activePredictionIndex:h-1})):_.key===$n.ENTER&&h>-1&&(s(p[h].description),m(x=>({...x,input:p[h].description})),f(x=>({...x,predictions:[],isPredictionSelected:!0}))))},E=_=>{s(_.target.value),m(x=>({...x,input:_.target.value,displayInput:_.target.value})),f(x=>({...x,activePredictionIndex:-1,isPredictionSelected:!1}))},B=_=>{s(_.description),m(x=>({...x,input:_.description,displayInput:_.description})),f(x=>({...x,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:E,onKeyDown:v,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:p.map((_,x)=>c.jsx("li",{onClick:()=>B(_),onMouseEnter:()=>f(T=>({...T,activePredictionIndex:x})),className:Y("predictions-list-item",{active:x===h}),children:_.description},x))})]})};const Md=({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,...m})=>{const p=se.useIntl(),{onChange:h,...g}=r,f=()=>{t||h(d?null:l)},b=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(),f())},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 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),...m,...g},b)};const ig=y.memo(function({direction:t="down"}){return c.jsx(Qa,{className:Y("rotating-chevron",`direction-${t}`)})});const sg=({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=se.useIntl(),[m,p]=y.useState(!1),h=r||n,g=Array.isArray(h)?[...h]:h?[h]:[],[f,b]=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(()=>{b(g)},[r,n]);const{onChange:E,onMultiSelectSubmit:B,..._}=a,x=S=>{if(o){let $=[];f!=null&&f.includes(S.id)?$=f.filter(M=>M!==S.id):$=[...f,S.id],b([...$]),E&&E([...$])}else b([S]),E&&E(S.id),p(!1)},T=S=>{if(S==="all"){const $=(t==null?void 0:t.map(M=>M.id))||[];b($),E&&E($)}else b([]),E&&E([])};return c.jsxs("div",{className:Y("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":m,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),p(!m)},"data-testid":"dropdown-selector",..._,children:[o?`${s} · ${f.length}`:v.label,c.jsx(ig,{direction:m?"up":"down"})]}),c.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const $=t&&t.find(M=>M.id===S.target.value);x($)},hidden:!m,..._,children:t==null?void 0:t.map(S=>c.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))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!m,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${f==null?void 0:f.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>T("all"),className:"gtm-trackable","data-gtm-event-type":"all-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>T("none"),className:"gtm-trackable","data-gtm-event-type":"none-click","data-gtm-event-context":i,children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(S=>{const $=S.id===v.id||(f==null?void 0:f.includes(S))||(f==null?void 0:f.includes(S.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:Y("gtm-trackable",{selected:$,"selected-single":$&&!o}),"data-gtm-event-type":`${S.id}-click`,"data-gtm-event-context":i,onClick:M=>{M.preventDefault(),M.stopPropagation(),x(S)},role:"menuitem","aria-current":$,"data-testid":$?"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(Ee,{variant:"secondary",onClick:()=>{B&&B(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),p(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})};const og=({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,...m})=>{const p=se.useIntl(),h=i?d:[],g=d;return c.jsx("ul",{...m,className:Y("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:f,label:b=!1,value:v=f,disabled:E=!1})=>{const B=`${r}_${f}`,_=()=>{if(E)return;let x;if(i){const T=h==null?void 0:h.indexOf(v);Array.isArray(h)&&T>=0?(x=h,x.splice(T,1)):(!h||h.length===0?x=[]:x=h,x.push(v))}else x=g===v?void 0:v;t.onChange(x)};return c.jsx(Md,{element:"li",id:B,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?h==null?void 0:h.includes(v):g===v,functions:{...t,onChange:_},intlPath:n,label:b||p.formatMessage({id:n?`${n}_${f}`:f}),disabled:E},B)})})};const ug=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=se.useIntl(),s=y.useRef(),o=e||s,[l,u]=y.useState(!1),[d,m]=y.useState(t),p=()=>{var h;u(!l),m(l?"password":"text"),(h=o.current)==null||h.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(Hn,{inputRef:o,type:d,autoComplete:r,...a})]})};const Ln={text:{component:Hn},email:{component:Hn},url:{component:Hn},textarea:{component:Hn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Md},checkboxes:{component:og,props:{multiSelect:!0}},select:{component:sg},password:{component:ug},autocomplete:{component:ag}},lg=({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,...m})=>{const p=se.useIntl(),h=l&&l.some(({condition:N})=>N==="required"),g=ni(u),f=o&&Ln[o]&&Ln[o].component?Ln[o].component:Hn,b=o&&["checkboxes"].includes(o),v=o&&["autocomplete"].includes(o),E=r&&`error-${e}`,B=`character-limit-${e}`,_={};b?_.element="legend":_.htmlFor=e;let x={...m,id:e,name:e,className:r?"error":"",type:o,required:h,"aria-required":h,functions:wn(a),value:u};const T=N=>{x["aria-describedby"]?x["aria-describedby"]+=` ${N}`:x["aria-describedby"]=N};if(i>0){const N=Od(i,a.onChange);T(`${B}-info`),x={...x,...N},N.functions&&typeof N.functions=="object"&&(x.functions={...x.functions,...N.functions})}o&&Ln[o]&&Ln[o].props&&(x={...x,...Ln[o].props}),b&&(x.intlPath=`${t}_${e}`),r&&(x["aria-invalid"]=!0,x["aria-errormessage"]=E,T(E));const S=m.label||p.formatMessage({id:t?`${t}_${e}`:e}),$=({...N})=>r?y.createElement(N.as||"p",{id:E,className:"error text-small",...N},r):null;if(o&&["checkbox"].includes(o))return c.jsxs(c.Fragment,{children:[c.jsx(f,{...x,label:S,className:Y("field-wrapper",n)}),c.jsx($,{as:"p"})]});const M=N=>y.createElement(N.element||"label",{...N,className:"checkboxes-label text-small","data-testid":`label-${e}`});return c.jsx(c.Fragment,{children:y.createElement(b?"fieldset":"div",{className:Y("field-wrapper text-medium",n)},c.jsxs(c.Fragment,{children:[y.createElement(b?"div":"p",{className:"field-label"},c.jsxs(M,{..._,children:[S,h&&s&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})),y.createElement(b||v?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(f,{...x}),c.jsx(co,{id:B,limit:i,valueLength:g})]})),c.jsx($,{})]}))})},cg=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?wn(e.errors):{},i=e.values?wn(e.values):{};switch(n){case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:d}=r,m=wn(Object.keys(a));for(const p of s)if(p.validation)for(let h=0;h<p.validation.length;h++){const{condition:g="required",error:f=!1}=p.validation[h];let b=!1;if(typeof g=="function"){const v=g(i);v&&(b=f||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(b=f||(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)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(b=f||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(b){o({type:"addError",payload:{key:p.id,value:b}}),m.push(p.id);break}}return m.length===0?l(i):u(i,m),e}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let Bi=null;const en=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:m,...p})=>{const{customOnSubmit:h,hideButton:g,...f}=s,b=40,{shouldShowCancelButton:v=!1,shouldReset:E=!0,shouldHide:B=!0,showRequiredLabels:_=!0,showSuccessMessage:x=!1}=l||{},{onSuccess:T=async()=>{},onCancel:S=()=>{},onCatch:$=()=>{},onFailure:M=()=>{}}=m||{},N=se.useIntl(),q={};t.length&&t.forEach(F=>{const R=F.id||F.name;R&&(q[R]=F.value||"")});const[w,A]=y.useReducer(cg,{isSubmitting:!1,formSubmitted:!1,errors:{},values:q}),{errors:j,isSubmitting:L,formSubmitted:U,values:Z}=w;y.useEffect(()=>{E&&U&&(Bi=setTimeout(()=>{A({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[U]),y.useEffect(()=>()=>{Bi&&clearTimeout(Bi)},[]),y.useEffect(()=>{const F=R=>{A({type:"updateValue",payload:{key:R.detail.id,value:R.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",F),()=>{document.removeEventListener("dropdownMultiSelectSubmit",F)}},[]);const G=y.useRef(null),ae=a||G;if(!t.length)return null;const C={};s.children&&(C.default=s.children),f.text&&typeof f.text=="string"&&(C.default=f.text),["default","submitting","submitted"].forEach(F=>{f.text&&typeof f.text!="string"&&F in f.text?C[F]=f.text[F]:C[F]||(C[F]=N.formatMessage({id:`form_${F==="default"?"submit":F}`}))}),delete f.text;const z=()=>{if(!L){if(A({type:"updateValue",payload:{key:"isSubmitting",value:!0}}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&A({type:"submitForm",payload:{fields:t,dispatch:A,intl:N}});return}A({type:"submitForm",payload:{fields:t,dispatch:A,onSuccess:async F=>{try{await T(F),A({type:E?"formSubmittedAndReset":"formSubmitted"})}catch(R){$(R),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(F,R)=>{M(F,R),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:N}})}},k=[{...f,icon:U?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:F=>{var W;if(F.preventDefault(),F.stopPropagation(),L)return;let R=0;if((W=ae==null?void 0:ae.current)!=null&&W.id){const re=document.getElementById(ae.current.id);re&&(R=re.getBoundingClientRect().top+window.scrollY)}const I=document.getElementById("header");I&&(R=R-I.offsetHeight-b),R<0&&(R=0),window.scrollTo({top:R,behavior:"smooth"}),z()},disabled:L||U||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:C[L?"submitting":U?"submitted":"default"]}];return v&&k.unshift({...o,className:"gtm-trackable","data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:L||U,onClick:S,children:o.text||N.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[y.createElement(e,{...p,id:r,className:Y("form",n),ref:ae},c.jsxs(c.Fragment,{children:[j!=null&&j.general?c.jsx(hn,{variant:"error",text:N.formatMessage({id:"form_error_generalError"})}):null,u,(!B||!L&&!U||h)&&t.map((F,R)=>{const{id:I=F.name||R,component:W,functions:re={onChange:()=>{}},submitOnEnter:ee=!1}=F;if(W)return c.jsx(W,{...F.props||{}},`component-${I}-${R}`);const ie=(Z==null?void 0:Z[I])||"",fe={...re,onChange:X=>{A({type:"updateValue",payload:{key:I,value:X}}),re.onChange(X&&X.toString(),A)}};return ee&&(fe.onKeyDown=X=>{X.key==="Enter"&&(X.stopPropagation(),X.preventDefault(),z()),re.onKeyDown&&re.onKeyDown(X)}),c.jsx(lg,{intlPath:i,...F,showRequiredLabels:_,value:ie,error:j==null?void 0:j[I],functions:fe},I)}),g?null:(L||U)&&h?h:c.jsx(or,{className:Y("cta",{center:L||U,submitted:U}),buttons:k})]})),x&&U&&c.jsx(Or,{className:"success",children:typeof x=="string"?x:N.formatMessage({id:"form_success"})})]})};const ia="passwordRules_",Nd="isMoreThanEightCharacters",Id="includesNumberAndSymbol",Rd="includesLowerAndUppercase",dg={[Nd]:"8Characters",[Id]:"numberSymbol",[Rd]:"lowercaseUppercase"},fg=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=se.useIntl();return c.jsxs("aside",{className:Y("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${ia}intro`})}),c.jsx("ul",{children:[Nd,Id,Rd].map(r=>c.jsxs("li",{className:Y({matches:e[r]}),children:[c.jsxs(Ne,{children:[n.formatMessage({id:`${ia}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${ia}rule_${dg[r]}`})}),!e[r]&&c.jsxs(Ne,{element:"strong",children:[" ",n.formatMessage({id:`${ia}notMet`})]})]},`rule-${r}`))})]})},$d=y.memo(fg);const hg=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=se.useIntl(),[l,u]=y.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=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&&d()},[s]),!s)return c.jsx(Bt,{className:"rating-placeholder"});const{id:m,rating:p,disabled:h}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},b=async v=>{if(!(!m||h))try{u(E=>({...E,rating:v,disabled:!0})),await r({id:m,value:v})}catch(E){u(B=>({...B,rating:null})),a(E)}finally{u(E=>({...E,disabled:!1}))}};return c.jsxs("div",{className:Y("rating",i),children:[c.jsx("span",{className:"label",children:f[p?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const E=v+1;return c.jsx("li",{className:Y({selected:p&&E<=p}),children:c.jsx(Ee,{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(),b(E)},disabled:h})},`rating-${E}`)})})]})};function mg(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 _s(e,t){return Array(t+1).join(e)}function pg(e){return e.replace(/^\n*/,"")}function gg(e){for(var t=e.length;t>0&&e[t-1]===`
65
+ `;)t--;return e.substring(0,t)}var vg=["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 fo(e){return ho(e,vg)}var Ld=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function zd(e){return ho(e,Ld)}function bg(e){return Wd(e,Ld)}var qd=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function yg(e){return ho(e,qd)}function Dg(e){return Wd(e,qd)}function ho(e,t){return t.indexOf(e.nodeName)>=0}function Wd(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var it={};it.paragraph={filter:"p",replacement:function(e){return`
66
66
 
67
67
  `+e+`
68
68
 
69
- `}};at.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+`
70
- `}};at.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=Es(r===1?"=":"-",e.length);return`
69
+ `}};it.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+`
70
+ `}};it.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=_s(r===1?"=":"-",e.length);return`
71
71
 
72
72
  `+e+`
73
73
  `+a+`
74
74
 
75
75
  `}else return`
76
76
 
77
- `+Es("#",r)+" "+e+`
77
+ `+_s("#",r)+" "+e+`
78
78
 
79
- `}};at.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
79
+ `}};it.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
80
80
 
81
81
  `+e+`
82
82
 
83
- `}};at.list={filter:["ul","ol"],replacement:function(e,t){var n=t.parentNode;return n.nodeName==="LI"&&n.lastElementChild===t?`
83
+ `}};it.list={filter:["ul","ol"],replacement:function(e,t){var n=t.parentNode;return n.nodeName==="LI"&&n.lastElementChild===t?`
84
84
  `+e:`
85
85
 
86
86
  `+e+`
87
87
 
88
- `}};at.listItem={filter:"li",replacement:function(e,t,n){e=e.replace(/^\n+/,"").replace(/\n+$/,`
88
+ `}};it.listItem={filter:"li",replacement:function(e,t,n){e=e.replace(/^\n+/,"").replace(/\n+$/,`
89
89
  `).replace(/\n/gm,`
90
90
  `);var r=n.bulletListMarker+" ",a=t.parentNode;if(a.nodeName==="OL"){var i=a.getAttribute("start"),s=Array.prototype.indexOf.call(a.children,t);r=(i?Number(i)+s:s+1)+". "}return r+e+(t.nextSibling&&!/\n$/.test(e)?`
91
- `:"")}};at.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){return`
91
+ `:"")}};it.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){return`
92
92
 
93
93
  `+t.firstChild.textContent.replace(/\n/g,`
94
94
  `)+`
95
95
 
96
- `}};at.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=Es(s,o);return`
96
+ `}};it.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=_s(s,o);return`
97
97
 
98
98
  `+d+a+`
99
99
  `+i.replace(/\n$/,"")+`
100
100
  `+d+`
101
101
 
102
- `}};at.horizontalRule={filter:"hr",replacement:function(e,t,n){return`
102
+ `}};it.horizontalRule={filter:"hr",replacement:function(e,t,n){return`
103
103
 
104
104
  `+n.hr+`
105
105
 
106
- `}};at.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var n=t.getAttribute("href"),r=Na(t.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+n+r+")"}};at.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=Na(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=`
106
+ `}};it.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var n=t.getAttribute("href"),r=Na(t.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+n+r+")"}};it.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=Na(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=`
107
107
 
108
108
  `+this.references.join(`
109
109
  `)+`
110
110
 
111
- `,this.references=[]),t}};at.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};at.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};at.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}};at.image={filter:"img",replacement:function(e,t){var n=Na(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=Na(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"!["+n+"]("+r+i+")":""}};function Na(e){return e?e.replace(/(\n+\s*)+/g,`
112
- `):""}function Ld(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])}Ld.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=Bi(this.array,e,this.options))||(t=Bi(this._keep,e,this.options))||(t=Bi(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 Bi(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(mg(a,t,n))return a}}function mg(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 pg(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(m){return m.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=_u(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=Ai(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=Ai(l);continue}var d=_u(o,l,a);o=l,l=d}i&&(i.data=i.data.replace(/ $/,""),i.data||Ai(i))}}function Ai(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function _u(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var fo=typeof window<"u"?window:{};function gg(){var e=fo.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function vg(){var e=function(){};return bg()?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 bg(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{fo.ActiveXObject&&(e=!0)}return e}var yg=gg()?fo.DOMParser:vg();function Dg(e,t){var n;if(typeof e=="string"){var r=Cg().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return pg({element:n,isBlock:lo,isVoid:Id,isPre:t.preformattedCode?xg:null}),n}var Ti;function Cg(){return Ti=Ti||new yg,Ti}function xg(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function wg(e,t){return e.isBlock=lo(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=Eg(e),e.flankingWhitespace=_g(e,t),e}function Eg(e){return!Id(e)&&!fg(e)&&/^\s*$/i.test(e.textContent)&&!dg(e)&&!hg(e)}function _g(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=kg(e.textContent);return n.leadingAscii&&ku("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&ku("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function kg(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 ku(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&&!lo(r)&&(i=a.test(r.textContent))),i}var Fg=Array.prototype.reduce,Bg=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Or(e){if(!(this instanceof Or))return new Or(e);var t={rules:at,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
111
+ `,this.references=[]),t}};it.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};it.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};it.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}};it.image={filter:"img",replacement:function(e,t){var n=Na(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=Na(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"!["+n+"]("+r+i+")":""}};function Na(e){return e?e.replace(/(\n+\s*)+/g,`
112
+ `):""}function Ud(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])}Ud.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=Ai(this.array,e,this.options))||(t=Ai(this._keep,e,this.options))||(t=Ai(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 Ai(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(Cg(a,t,n))return a}}function Cg(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 xg(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(m){return m.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=Fu(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=Ti(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=Ti(l);continue}var d=Fu(o,l,a);o=l,l=d}i&&(i.data=i.data.replace(/ $/,""),i.data||Ti(i))}}function Ti(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Fu(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var mo=typeof window<"u"?window:{};function wg(){var e=mo.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function Eg(){var e=function(){};return _g()?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 _g(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{mo.ActiveXObject&&(e=!0)}return e}var kg=wg()?mo.DOMParser:Eg();function Fg(e,t){var n;if(typeof e=="string"){var r=Bg().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return xg({element:n,isBlock:fo,isVoid:zd,isPre:t.preformattedCode?Ag:null}),n}var Si;function Bg(){return Si=Si||new kg,Si}function Ag(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function Tg(e,t){return e.isBlock=fo(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=Sg(e),e.flankingWhitespace=jg(e,t),e}function Sg(e){return!zd(e)&&!yg(e)&&/^\s*$/i.test(e.textContent)&&!bg(e)&&!Dg(e)}function jg(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=Og(e.textContent);return n.leadingAscii&&Bu("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Bu("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function Og(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 Bu(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&&!fo(r)&&(i=a.test(r.textContent))),i}var Pg=Array.prototype.reduce,Mg=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Pr(e){if(!(this instanceof Pr))return new Pr(e);var t={rules:it,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
113
113
 
114
114
  `:""},keepReplacement:function(n,r){return r.isBlock?`
115
115
 
@@ -119,47 +119,47 @@ ${pr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",
119
119
 
120
120
  `+n+`
121
121
 
122
- `:n}};this.options=og({},t,e),this.rules=new Ld(this.options)}Or.prototype={turndown:function(e){if(!Sg(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=zd.call(this,new Dg(e,this.options));return Ag.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 Bg.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function zd(e){var t=this;return Fg.call(e.childNodes,function(n,r){r=new wg(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=Tg.call(t,r)),qd(n,a)},"")}function Ag(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=qd(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function Tg(e){var t=this.rules.forNode(e),n=zd.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 qd(e,t){var n=lg(e),r=ug(t),a=Math.max(e.length-n.length,t.length-r.length),i=`
122
+ `:n}};this.options=mg({},t,e),this.rules=new Ud(this.options)}Pr.prototype={turndown:function(e){if(!Rg(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=Hd.call(this,new Fg(e,this.options));return Ng.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 Mg.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function Hd(e){var t=this;return Pg.call(e.childNodes,function(n,r){r=new Tg(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=Ig.call(t,r)),Vd(n,a)},"")}function Ng(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=Vd(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function Ig(e){var t=this.rules.forNode(e),n=Hd.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 Vd(e,t){var n=gg(e),r=pg(t),a=Math.max(e.length-n.length,t.length-r.length),i=`
123
123
 
124
- `.substring(0,a);return n+i+r}function Sg(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}/*!
124
+ `.substring(0,a);return n+i+r}function Rg(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}/*!
125
125
  * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
126
126
  *
127
127
  * Copyright (c) 2014-2017, Jon Schlinkert.
128
128
  * Released under the MIT License.
129
- */function Fu(e){return Object.prototype.toString.call(e)==="[object Object]"}function nt(e){var t,n;return Fu(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Fu(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Wd=Symbol.for("immer-nothing"),Bu=Symbol.for("immer-draftable"),yt=Symbol.for("immer-state"),jg=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 ft(e,...t){if(process.env.NODE_ENV!=="production"){const n=jg[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 tr=Object.getPrototypeOf;function Bn(e){return!!e&&!!e[yt]}function An(e){var t;return e?Ud(e)||Array.isArray(e)||!!e[Bu]||!!((t=e.constructor)!=null&&t[Bu])||ri(e)||ai(e):!1}var Og=Object.prototype.constructor.toString();function Ud(e){if(!e||typeof e!="object")return!1;const t=tr(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)===Og}function Ma(e,t){ni(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ni(e){const t=e[yt];return t?t.type_:Array.isArray(e)?1:ri(e)?2:ai(e)?3:0}function _s(e,t){return ni(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Hd(e,t,n){const r=ni(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Pg(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ri(e){return e instanceof Map}function ai(e){return e instanceof Set}function yn(e){return e.copy_||e.base_}function ks(e,t){if(ri(e))return new Map(e);if(ai(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ud(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[yt];let a=Reflect.ownKeys(r);for(let i=0;i<a.length;i++){const s=a[i],o=r[s];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[s]})}return Object.create(tr(e),r)}else{const r=tr(e);if(r!==null&&n)return{...e};const a=Object.create(r);return Object.assign(a,e)}}function ho(e,t=!1){return ii(e)||Bn(e)||!An(e)||(ni(e)>1&&(e.set=e.add=e.clear=e.delete=Ng),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>ho(r,!0))),e}function Ng(){ft(2)}function ii(e){return Object.isFrozen(e)}var Mg={};function Tn(e){const t=Mg[e];return t||ft(0,e),t}var Pr;function Vd(){return Pr}function Ig(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Au(e,t){t&&(Tn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Fs(e){Bs(e),e.drafts_.forEach(Rg),e.drafts_=null}function Bs(e){e===Pr&&(Pr=e.parent_)}function Tu(e){return Pr=Ig(Pr,e)}function Rg(e){const t=e[yt];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[yt].modified_&&(Fs(t),ft(4)),An(e)&&(e=Ia(t,e),t.parent_||Ra(t,e)),t.patches_&&Tn("Patches").generateReplacementPatches_(n[yt].base_,e,t.patches_,t.inversePatches_)):e=Ia(t,n,[]),Fs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Wd?e:void 0}function Ia(e,t,n){if(ii(t))return t;const r=t[yt];if(!r)return Ma(t,(a,i)=>ju(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Ra(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),Ma(i,(o,l)=>ju(e,r,a,o,l,n,s)),Ra(e,a,!1),n&&e.patches_&&Tn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function ju(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&ft(5),Bn(a)){const o=i&&t&&t.type_!==3&&!_s(t.assigned_,r)?i.concat(r):void 0,l=Ia(e,a,o);if(Hd(n,r,l),Bn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(An(a)&&!ii(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ia(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Ra(e,a)}}function Ra(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ho(t,n)}function $g(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Vd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=mo;n&&(a=[r],i=Nr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var mo={get(e,t){if(t===yt)return e;const n=yn(e);if(!_s(n,t))return Lg(e,n,t);const r=n[t];return e.finalized_||!An(r)?r:r===Si(e.base_,t)?(ji(e),e.copy_[t]=Ts(r,e)):r},has(e,t){return t in yn(e)},ownKeys(e){return Reflect.ownKeys(yn(e))},set(e,t,n){const r=Kd(yn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=Si(yn(e),t),i=a==null?void 0:a[yt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Pg(n,a)&&(n!==void 0||_s(e.base_,t)))return!0;ji(e),As(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 Si(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ji(e),As(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=yn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){ft(11)},getPrototypeOf(e){return tr(e.base_)},setPrototypeOf(){ft(12)}},Nr={};Ma(mo,(e,t)=>{Nr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Nr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&ft(13),Nr.set.call(this,e,t,void 0)};Nr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&ft(14),mo.set.call(this,e[0],t,n,e[0])};function Si(e,t){const n=e[yt];return(n?yn(n):e)[t]}function Lg(e,t,n){var a;const r=Kd(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Kd(e,t){if(!(t in e))return;let n=tr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=tr(n)}}function As(e){e.modified_||(e.modified_=!0,e.parent_&&As(e.parent_))}function ji(e){e.copy_||(e.copy_=ks(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var zg=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"&&ft(6),r!==void 0&&typeof r!="function"&&ft(7);let a;if(An(t)){const i=Tu(this),s=Ts(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?Fs(i):Bs(i)}return Au(i,r),Su(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===Wd&&(a=void 0),this.autoFreeze_&&ho(a,!0),r){const i=[],s=[];Tn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else ft(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){An(e)||ft(8),Bn(e)&&(e=qg(e));const t=Tu(this),n=Ts(e,void 0);return n[yt].isManual_=!0,Bs(t),n}finishDraft(e,t){const n=e&&e[yt];(!n||!n.isManual_)&&ft(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=Tn("Patches").applyPatches_;return Bn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function Ts(e,t){const n=ri(e)?Tn("MapSet").proxyMap_(e,t):ai(e)?Tn("MapSet").proxySet_(e,t):$g(e,t);return(t?t.scope_:Vd()).drafts_.push(n),n}function qg(e){return Bn(e)||ft(10,e),Zd(e)}function Zd(e){if(!An(e)||ii(e))return e;const t=e[yt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ks(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ks(e,!0);return Ma(n,(r,a)=>{Hd(n,r,Zd(a))}),t&&(t.finalized_=!1),n}var Dt=new zg,po=Dt.produce;Dt.produceWithPatches.bind(Dt);Dt.setAutoFreeze.bind(Dt);Dt.setUseStrictShallowCopy.bind(Dt);Dt.applyPatches.bind(Dt);var Ou=Dt.createDraft.bind(Dt),Pu=Dt.finishDraft.bind(Dt),Wg={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()}}},Ug={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=we.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Hg={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=V.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},$a=new WeakMap,La=new WeakMap,wr=new WeakMap,Yd=new WeakMap,Nu=new WeakMap,Mu=new WeakMap,Iu=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:m,newPath:p}=t;if(P.equals(m,p))return r;if(P.isAncestor(m,r)||P.equals(m,r)){var h=p.slice();return P.endsBefore(m,p)&&m.length<p.length&&(h[m.length-1]-=1),h.concat(r.slice(m.length))}else P.isSibling(m,p)&&(P.isAncestor(p,r)||P.equals(p,r))?P.endsBefore(m,r)?r[m.length-1]-=1:r[m.length-1]+=1:P.endsBefore(p,r)||P.equals(p,r)||P.isAncestor(p,r)?(P.endsBefore(m,r)&&(r[m.length-1]-=1),r[p.length-1]+=1):P.endsBefore(m,r)&&(P.equals(p,r)&&(r[p.length-1]+=1),r[m.length-1]-=1);break}}return r}};function Mr(e){"@babel/helpers - typeof";return Mr=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},Mr(e)}function Vg(e,t){if(Mr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Mr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Kg(e){var t=Vg(e,"string");return Mr(t)==="symbol"?t:String(t)}function lt(e,t,n){return t=Kg(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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 gr(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){lt(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 Zg=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=ue.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of V.points(t))t[l]=we.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:m}=n;if(m.length===0)break;var p=ue.leaf(e,u),h=p.text.slice(0,d),g=p.text.slice(d);if(p.text=h+m+g,t)for(var[f,b]of V.points(t))t[b]=we.transform(f,n);break}case"merge_node":{var{path:v}=n,_=ue.get(e,v),F=P.previous(v),x=ue.get(e,F),w=ue.parent(e,v),B=v[v.length-1];if(fe.isText(_)&&fe.isText(x))x.text+=_.text;else if(!fe.isText(_)&&!fe.isText(x))x.children.push(..._.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(et.stringify(_)," ").concat(et.stringify(x)));if(w.children.splice(B,1),t)for(var[S,z]of V.points(t))t[z]=we.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 M=ue.get(e,N),k=ue.parent(e,N),A=N[N.length-1];k.children.splice(A,1);var j=P.transform(N,n),L=ue.get(e,P.parent(j)),H=j[j.length-1];if(L.children.splice(H,0,M),t)for(var[Y,Q]of V.points(t))t[Q]=we.transform(Y,n);break}case"remove_node":{var{path:re}=n,C=re[re.length-1],q=ue.parent(e,re);if(q.children.splice(C,1),t)for(var[K,E]of V.points(t)){var T=we.transform(K,n);if(t!=null&&T!=null)t[E]=T;else{var $=void 0,R=void 0;for(var[U,ae]of ue.texts(e))if(P.compare(ae,re)===-1)$=[U,ae];else{R=[U,ae];break}var J=!1;$&&R&&(P.equals(R[1],re)?J=!P.hasPrevious(R[1]):J=P.common($[1],re).length<P.common(R[1],re).length),$&&!J?(K.path=$[1],K.offset=$[0].text.length):R?(K.path=R[1],K.offset=0):t=null}}break}case"remove_text":{var{path:ie,offset:de,text:X}=n;if(X.length===0)break;var ye=ue.leaf(e,ie),me=ye.text.slice(0,de),xe=ye.text.slice(de+X.length);if(ye.text=me+xe,t)for(var[Te,Se]of V.points(t))t[Se]=we.transform(Te,n);break}case"set_node":{var{path:He,properties:Be,newProperties:Fe}=n;if(He.length===0)throw new Error("Cannot set properties on the root node!");var Pe=ue.get(e,He);for(var Ee in Fe){if(Ee==="children"||Ee==="text")throw new Error('Cannot set the "'.concat(Ee,'" property of nodes!'));var Ve=Fe[Ee];Ve==null?delete Pe[Ee]:Pe[Ee]=Ve}for(var ze in Be)Fe.hasOwnProperty(ze)||delete Pe[ze];break}case"set_selection":{var{newProperties:W}=n;if(W==null)t=W;else{if(t==null){if(!V.isRange(W))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(et.stringify(W)," when there is no current selection."));t=gr({},W)}for(var ne in W){var he=W[ne];if(he==null){if(ne==="anchor"||ne==="focus")throw new Error('Cannot remove the "'.concat(ne,'" selection property'));delete t[ne]}else t[ne]=he}}break}case"split_node":{var{path:pe,position:Ce,properties:Ze}=n;if(pe.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(pe,"] because the root node cannot be split."));var Ye=ue.get(e,pe),gt=ue.parent(e,pe),Ut=pe[pe.length-1],Bt;if(fe.isText(Ye)){var tt=Ye.text.slice(0,Ce),Ot=Ye.text.slice(Ce);Ye.text=tt,Bt=gr(gr({},Ze),{},{text:Ot})}else{var vt=Ye.children.slice(0,Ce),hi=Ye.children.slice(Ce);Ye.children=vt,Bt=gr(gr({},Ze),{},{children:hi})}if(gt.children.splice(Ut+1,0,Bt),t)for(var[lr,Zr]of V.points(t))t[Zr]=we.transform(lr,n);break}}return t},Yg={transform(e,t){e.children=Ou(e.children);var n=e.selection&&Ou(e.selection);try{n=Zg(e,n,t)}finally{e.children=Pu(e.children),n?e.selection=Bn(n)?Pu(n):n:e.selection=null}}},Gg={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)}},Qg={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)}},Gd=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(nt(r)&&nt(a)){if(!Gd(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 Jg(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 Gt(e,t){if(e==null)return{};var n=Jg(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 Xg=["anchor","focus"];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 ev(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){lt(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 V={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return V.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=V.edges(e);return t},equals(e,t){return we.equals(e.anchor,t.anchor)&&we.equals(e.focus,t.focus)},includes(e,t){if(V.isRange(t)){if(V.includes(e,t.anchor)||V.includes(e,t.focus))return!0;var[n,r]=V.edges(e),[a,i]=V.edges(t);return we.isBefore(n,a)&&we.isAfter(r,i)}var[s,o]=V.edges(e),l=!1,u=!1;return we.isPoint(t)?(l=we.compare(t,s)>=0,u=we.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=Gt(e,Xg),[r,a]=V.edges(e),[i,s]=V.edges(t),o=we.isBefore(r,i)?i:r,l=we.isBefore(a,s)?a:s;return we.isBefore(l,o)?null:ev({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return we.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return we.equals(t,n)},isExpanded(e){return!V.isCollapsed(e)},isForward(e){return!V.isBackward(e)},isRange(e){return nt(e)&&we.isPoint(e.anchor)&&we.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=V.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return po(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=V.isCollapsed(r);V.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?V.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=we.transform(r.anchor,t,{affinity:i}),u=we.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},Lu=e=>nt(e)&&ue.isNodeList(e.children)&&!D.isEditor(e),ce={isAncestor(e){return nt(e)&&ue.isNodeList(e.children)},isElement:Lu,isElementList(e){return Array.isArray(e)&&e.every(t=>ce.isElement(t))},isElementProps(e){return e.children!==void 0},isElementType:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"type";return Lu(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},tv=["children"],nv=["text"],zu=new WeakMap,ue={ancestor(e,t){var n=ue.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(et.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=ue.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(et.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(et.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=ue.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=ue.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=ue.get(e,r);return[a,r]},descendant(e,t){var n=ue.get(e,t);if(D.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(et.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.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 ue.nodes(e,t))ce.isElement(n)&&(yield[n,r])}()},extractProps(e){if(ce.isAncestor(e)){var t=Gt(e,tv);return t}else{var t=Gt(e,nv);return t}},first(e,t){for(var n=t.slice(),r=ue.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(et.stringify(e)));var n=po({children:e.children},r=>{var[a,i]=V.edges(t),s=ue.nodes(r,{reverse:!0,pass:p=>{var[,h]=p;return!V.includes(t,h)}});for(var[,o]of s){if(!V.includes(t,o)){var l=ue.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(P.equals(o,i.path)){var d=ue.leaf(r,o);d.text=d.text.slice(0,i.offset)}if(P.equals(o,a.path)){var m=ue.leaf(r,o);m.text=m.text.slice(a.offset)}}D.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(et.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)||ce.isElement(e)||D.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=zu.get(e);if(t!==void 0)return t;var n=e.every(r=>ue.isNode(r));return zu.set(e,n),n},last(e,t){for(var n=t.slice(),r=ue.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=ue.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(et.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=ue.get(e,r);yield[a,r]}}()},matches(e,t){return ce.isElement(e)&&ce.isElementProps(t)&&ce.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=ue.get(e,o);continue}if(o.length===0)break;if(!r){var d=P.next(o);if(ue.has(e,d)){o=d,l=ue.get(e,o);continue}}if(r&&o[o.length-1]!==0){var m=P.previous(o);o=m,l=ue.get(e,o);continue}o=P.parent(o),l=ue.get(e,o),s.add(l)}}()},parent(e,t){var n=P.parent(t),r=ue.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(ue.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.nodes(e,t))fe.isText(n)&&(yield[n,r])}()}};function qu(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 We(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var on={isNodeOperation(e){return on.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!nt(e))return!1;switch(e.type){case"insert_node":return P.isPath(e.path)&&ue.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)&&nt(e.properties);case"move_node":return P.isPath(e.path)&&P.isPath(e.newPath);case"remove_node":return P.isPath(e.path)&&ue.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)&&nt(e.properties)&&nt(e.newProperties);case"set_selection":return e.properties===null&&V.isRange(e.newProperties)||e.newProperties===null&&V.isRange(e.properties)||nt(e.properties)&&nt(e.newProperties);case"split_node":return P.isPath(e.path)&&typeof e.position=="number"&&nt(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>on.isOperation(t))},isSelectionOperation(e){return on.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return on.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return We(We({},e),{},{type:"remove_node"});case"insert_text":return We(We({},e),{},{type:"remove_text"});case"merge_node":return We(We({},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 We(We({},e),{},{path:t,newPath:n});var r=P.transform(n,e),a=P.transform(P.next(n),e);return We(We({},e),{},{path:r,newPath:a})}case"remove_node":return We(We({},e),{},{type:"insert_node"});case"remove_text":return We(We({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return We(We({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?We(We({},e),{},{properties:l,newProperties:null}):l==null?We(We({},e),{},{properties:null,newProperties:o}):We(We({},e),{},{properties:l,newProperties:o})}case"split_node":return We(We({},e),{},{type:"merge_node",path:P.next(e.path)})}}},Wu=new WeakMap,rv=e=>{var t=Wu.get(e);if(t!==void 0)return t;if(!nt(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||nt(e.marks))&&(e.selection===null||V.isRange(e.selection))&&ue.isNodeList(e.children)&&on.isOperationList(e.operations);return Wu.set(e,n),n},D={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 rv(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)}},av={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(P.isPath)}};function Uu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Hu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Uu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Uu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var we={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 we.compare(e,t)===1},isBefore(e,t){return we.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&P.equals(e.path,t.path)},isPoint(e){return nt(e)&&typeof e.offset=="number"&&P.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return po(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,Hu(Hu({},n),{},{affinity:"forward"})))}else r.path=P.transform(i,t,n);break}}})}},Vu=void 0,et={setScrubber(e){Vu=e},stringify(e){return JSON.stringify(e,Vu)}},iv=["text"],sv=["anchor","focus"];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 Vt(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){lt(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 fe={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Gt(i,iv);return s}return Gd(r?a(e):e,r?a(t):t)},isText(e){return nt(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=[Vt({},e)];for(var r of t){var a=Gt(r,sv),[i,s]=V.edges(r),o=[],l=0,u=i.offset,d=s.offset;for(var m of n){var{length:p}=m.text,h=l;if(l+=p,u<=h&&l<=d){Object.assign(m,a),o.push(m);continue}if(u!==d&&(u===l||d===h)||u>l||d<h||d===h&&h!==0){o.push(m);continue}var g=m,f=void 0,b=void 0;if(d<l){var v=d-h;b=Vt(Vt({},g),{},{text:g.text.slice(v)}),g=Vt(Vt({},g),{},{text:g.text.slice(0,v)})}if(u>h){var _=u-h;f=Vt(Vt({},g),{},{text:g.text.slice(0,_)}),g=Vt(Vt({},g),{},{text:g.text.slice(_)})}Object.assign(g,a),f&&o.push(f),o.push(g),b&&o.push(b)}n=o}return n}},go=e=>e.selection?e.selection:e.children.length>0?D.end(e,[]):[0],ur=(e,t)=>{var[n]=D.node(e,t);return r=>r===n},vo=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?fv(t):t,i=De.None,s=De.None,o=0,l=null,u=null;for(var d of a){var m=d.codePointAt(0);if(!m)break;var p=Ev(d,m);if([i,s]=r?[s,p]:[p,i],Hn(i,De.ZWJ)&&Hn(s,De.ExtPict)&&(r?l=Zu(t.substring(0,o)):l=Zu(t.substring(0,t.length-o)),!l)||Hn(i,De.RI)&&Hn(s,De.RI)&&(u!==null?u=!u:r?u=!0:u=Av(t.substring(0,t.length-o)),!u)||i!==De.None&&s!==De.None&&kv(i,s))break;o+=d.length}return o||1},ov=/\s/,uv=/[\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]/,lv=/['\u2018\u2019]/,cv=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=vo(t,n),[s,o]=bo(t,i,n);if(dv(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},bo=(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)]},dv=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(ov.test(t))return!1;if(lv.test(t)){var a=vo(n,r),[i,s]=bo(n,a,r);if(e(i,s,r))return!0}return!uv.test(t)},fv=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(mv(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(hv(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},hv=e=>e>=55296&&e<=56319,mv=e=>e>=56320&&e<=57343,De;(function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"})(De||(De={}));var pv=/^(?:[\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])$/,gv=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,vv=/^(?:[\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])$/,bv=/^[\u1100-\u115F\uA960-\uA97C]$/,yv=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,Dv=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,Cv=/^[\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]$/,xv=/^[\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]$/,wv=/^(?:[\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])$/,Ev=(e,t)=>{var n=De.Any;return e.search(pv)!==-1&&(n|=De.Extend),t===8205&&(n|=De.ZWJ),t>=127462&&t<=127487&&(n|=De.RI),e.search(gv)!==-1&&(n|=De.Prepend),e.search(vv)!==-1&&(n|=De.SpacingMark),e.search(bv)!==-1&&(n|=De.L),e.search(yv)!==-1&&(n|=De.V),e.search(Dv)!==-1&&(n|=De.T),e.search(Cv)!==-1&&(n|=De.LV),e.search(xv)!==-1&&(n|=De.LVT),e.search(wv)!==-1&&(n|=De.ExtPict),n};function Hn(e,t){return(e&t)!==0}var _v=[[De.L,De.L|De.V|De.LV|De.LVT],[De.LV|De.V,De.V|De.T],[De.LVT|De.T,De.T],[De.Any,De.Extend|De.ZWJ],[De.Any,De.SpacingMark],[De.Prepend,De.Any],[De.ZWJ,De.ExtPict],[De.RI,De.RI]];function kv(e,t){return _v.findIndex(n=>Hn(e,n[0])&&Hn(t,n[1]))===-1}var Fv=/(?:[\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$/,Zu=e=>e.search(Fv)!==-1,Bv=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Av=e=>{var t=e.match(Bv);if(t===null)return!1;var n=t[0].length/2;return n%2===1},Tv={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]:{};D.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=go(e)}=n;if(P.isPath(a)&&(a=D.range(e,a)),V.isRange(a))if(V.isCollapsed(a))a=a.anchor;else{var i=V.end(a);if(!r&&D.void(e,{at:i}))return;var s=V.start(a),o=D.pointRef(e,s),l=D.pointRef(e,i);ee.delete(e,{at:a,voids:r});var u=o.unref(),d=l.unref();a=u||d,ee.setSelection(e,{anchor:a,focus:a})}if(!(!r&&D.void(e,{at:a})||D.elementReadOnly(e,{at:a}))){var{path:m,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:m,offset:p,text:t})}})}};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 ia(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){lt(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=ia(ia(ia(ia({},Yg),Gg),Qg),Tv),xa=new WeakMap,Sv=e=>xa.get(e)||!1,jv=(e,t,n)=>{var r=xa.get(e)||!1;xa.set(e,!0);try{t(),n()}finally{xa.set(e,r)}};function Qd(e,t,n){var r=$a.get(e)||[],a=La.get(e)||new Set,i,s,o=m=>{if(m){var p=m.join(",");s.has(p)||(s.add(p),i.push(m))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var d of t)o(d);$a.set(e,i),La.set(e,s)}var Ov=(e,t)=>{for(var n of D.pathRefs(e))Wg.transform(n,t);for(var r of D.pointRefs(e))Ug.transform(r,t);for(var a of D.rangeRefs(e))Hg.transform(a,t);if(!Sv(e)){var i=P.operationCanTransformPath(t)?s=>P.transform(s,t):void 0;Qd(e,e.getDirtyPaths(t),i)}ee.transform(e,t),e.operations.push(t),D.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),wr.get(e)||(wr.set(e,!0),Promise.resolve().then(()=>{wr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Pv=(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(ue.nodes(r),I=>{var[,M]=I;return a.concat(M)});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:m}=t;if(P.equals(d,m))return[];var p=[],h=[];for(var g of P.ancestors(d)){var f=P.transform(g,t);p.push(f)}for(var b of P.ancestors(m)){var v=P.transform(b,t);h.push(v)}var _=h[h.length-1],F=m[m.length-1],x=_.concat(F);return[...p,...h,x]}case"remove_node":{var{path:w}=t,B=P.ancestors(w);return[...B]}case"split_node":{var{path:S}=t,z=P.levels(S),N=P.next(S);return[...z,N]}default:return[]}},Nv=e=>{var{selection:t}=e;return t?ue.fragment(e,t):[]},Mv=(e,t)=>{var[n,r]=t;if(!fe.isText(n)){if(ce.isElement(n)&&n.children.length===0){var a={text:""};ee.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=D.isEditor(n)?!1:ce.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=ue.get(e,r);if(!fe.isText(l)){var u=l.children[s],d=l.children[s-1],m=o===n.children.length-1,p=fe.isText(u)||ce.isElement(u)&&e.isInline(u);if(p!==i)ee.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(ce.isElement(u)){if(e.isInline(u)){if(d==null||!fe.isText(d)){var h={text:""};ee.insertNodes(e,h,{at:r.concat(s),voids:!0}),s++}else if(m){var g={text:""};ee.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&fe.isText(d)&&(fe.equals(u,d,{loose:!0})?(ee.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(ee.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(ee.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Iv=(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},Rv=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=D.path(t,i),l=a==="lowest";for(var[u,d]of D.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!fe.isText(u)){if(V.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 Gu(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 Qu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gu(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var $v=(e,t,n)=>{var{selection:r}=e;if(r){var a=(m,p)=>{if(!fe.isText(m))return!1;var[h,g]=D.parent(e,p);return!e.isVoid(h)||e.markableVoid(h)},i=V.isExpanded(r),s=!1;if(!i){var[o,l]=D.node(e,r);if(o&&a(o,l)){var[u]=D.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)ee.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var d=Qu(Qu({},D.marks(e)||{}),{},{[t]:n});e.marks=d,wr.get(e)||e.onChange()}}};function Ju(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Xu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ju(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ju(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Lv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.point(t,n,{edge:"end"}),i=D.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of D.positions(t,Xu(Xu({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};function el(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function tl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?el(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):el(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var zv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.start(t,[]),i=D.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of D.positions(t,tl(tl({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},qv=(e,t)=>{var{selection:n}=e;n&&V.isCollapsed(n)&&ee.delete(e,{unit:t,reverse:!0})},Wv=(e,t)=>{var{selection:n}=e;n&&V.isCollapsed(n)&&ee.delete(e,{unit:t})},Uv=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&V.isExpanded(r)&&ee.delete(t,{reverse:n==="backward"})},Hv=(e,t)=>[D.start(e,t),D.end(e,t)];function nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function rl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nl(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Vv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.above(t,rl(rl({},n),{},{match:r=>ce.isElement(r)&&D.isElementReadOnly(t,r)}))},Kv=(e,t)=>D.point(e,t,{edge:"end"}),Zv=(e,t)=>{var n=D.path(e,t,{edge:"start"});return D.node(e,n)},Yv=(e,t)=>{var n=D.range(e,t);return ue.fragment(e,n)};function al(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 il(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?al(Object(n),!0).forEach(function(r){lt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):al(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Gv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.above(t,il(il({},n),{},{match:r=>ce.isElement(r)&&D.isVoid(t,r)}))},Qv=(e,t)=>t.children.some(n=>ce.isElement(n)&&D.isBlock(e,n)),Jv=(e,t)=>t.children.some(n=>fe.isText(n)||D.isInline(e,n)),Xv=(e,t)=>ue.has(e,t),e0=(e,t)=>t.children.every(n=>fe.isText(n)),t0=e=>{ee.splitNodes(e,{always:!0})},n0=(e,t,n)=>{ee.insertNodes(e,t,n)},r0=e=>{ee.splitNodes(e,{always:!0})};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 a0(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){lt(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 i0=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=a0({text:n},i);ee.insertNodes(t,s,{at:r.at,voids:r.voids})}else ee.insertText(t,n,r);t.marks=null}},s0=(e,t)=>!e.isInline(t),o0=(e,t,n)=>D.isStart(e,t,n)||D.isEnd(e,t,n),u0=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&fe.isText(r)&&r.text===""&&!e.isVoid(t)},l0=(e,t,n)=>{var r=D.end(e,n);return we.equals(t,r)},c0=e=>{var t=Yd.get(e);return t===void 0?!0:t},d0=(e,t,n)=>{if(t.offset!==0)return!1;var r=D.start(e,n);return we.equals(t,r)},f0=(e,t)=>{var n=D.path(e,t,{edge:"end"});return D.node(e,n)},h0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=ue.leaf(t,a);return[i,a]};function m0(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=D.path(e,n);for(var[l,u]of ue.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&ce.isElement(l)&&D.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var p0=["text"],g0=["text"],v0=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(V.isExpanded(r)){var s=D.isEnd(t,a,a.path);if(s){var o=D.after(t,a);o&&(a=o)}var[l]=D.nodes(t,{match:fe.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,d=Gt(u,p0);return d}else return{}}var{path:m}=a,[p]=D.leaf(t,m);if(a.offset===0){var h=D.previous(t,{at:m,match:fe.isText}),g=D.above(t,{match:x=>ce.isElement(x)&&D.isVoid(t,x)&&t.markableVoid(x)});if(!g){var f=D.above(t,{match:x=>ce.isElement(x)&&D.isBlock(t,x)});if(h&&f){var[b,v]=h,[,_]=f;P.isAncestor(_,v)&&(p=b)}}}var F=Gt(p,g0);return F},b0=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=D.after(t,s,{voids:a});if(o){var[,l]=D.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]=D.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[m]=D.nodes(t,{at:u,match:i,mode:r,voids:a});return m}}},y0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=ue.get(t,a);return[i,a]};function D0(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(av.isSpan(n))u=n[0],d=n[1];else{var m=D.path(e,n,{edge:"start"}),p=D.path(e,n,{edge:"end"});u=i?p:m,d=i?m:p}var h=ue.nodes(e,{reverse:i,from:u,to:d,pass:x=>{var[w]=x;return ce.isElement(w)?!!(!s&&(D.isVoid(e,w)||D.isElementReadOnly(e,w))||o&&!D.isSelectable(e,w)):!1}}),g=[],f;for(var[b,v]of h)if(!(o&&ce.isElement(b)&&!D.isSelectable(e,b))){var _=f&&P.compare(v,f[1])===0;if(!(r==="highest"&&_)){if(!l(b,v)){if(a&&!_&&fe.isText(b))return;continue}if(r==="lowest"&&_){f=[b,v];continue}var F=r==="lowest"?f:[b,v];F&&(a?g.push(F):yield F),f=[b,v]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var C0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=d=>$a.get(d)||[],s=d=>La.get(d)||new Set,o=d=>{var m=i(d).pop(),p=m.join(",");return s(d).delete(p),m};if(D.isNormalizing(t)){if(r){var l=Array.from(ue.nodes(t),d=>{var[,m]=d;return m}),u=new Set(l.map(d=>d.join(",")));$a.set(t,l),La.set(t,u)}i(t).length!==0&&D.withoutNormalizing(t,()=>{for(var d of i(t))if(ue.has(t,d)){var m=D.node(t,d),[p,h]=m;ce.isElement(p)&&p.children.length===0&&t.normalizeNode(m,{operation:a})}for(var g=i(t),f=g.length,b=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:b,initialDirtyPathsLength:f,operation:a}))return;var v=o(t);if(ue.has(t,v)){var _=D.node(t,v);t.normalizeNode(_,{operation:a})}b++,g=i(t)}})}},x0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=P.parent(a),s=D.node(t,i);return s},w0=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=D.pathRefs(t);return l.delete(i),i.current=null,o}},s=D.pathRefs(t);return s.add(i),i},E0=e=>{var t=Nu.get(e);return t||(t=new Set,Nu.set(e,t)),t},_0=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]=ue.first(t,n);n=s}else if(i==="end"){var[,o]=ue.last(t,n);n=o}}return V.isRange(n)&&(i==="start"?n=V.start(n):i==="end"?n=V.end(n):n=P.common(n.anchor.path,n.focus.path)),we.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},k0=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=D.pointRefs(t);return l.delete(i),i.current=null,o}},s=D.pointRefs(t);return s.add(i),i},F0=e=>{var t=Mu.get(e);return t||(t=new Set,Mu.set(e,t)),t},B0=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]=ue.last(t,n);i=s}else{var[,o]=ue.first(t,n);i=o}var l=ue.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(V.isRange(n)){var[u,d]=V.edges(n);return a==="start"?u:d}return n};function A0(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=D.range(e,n),[l,u]=V.edges(o),d=a?u:l,m=!1,p="",h=0,g=0,f=0;for(var[b,v]of D.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(ce.isElement(b)){if(!i&&(e.isVoid(b)||e.isElementReadOnly(b))){yield D.start(e,v);continue}if(e.isInline(b))continue;if(D.hasInlines(e,b)){var _=P.isAncestor(v,u.path)?u:D.end(e,v),F=P.isAncestor(v,l.path)?l:D.start(e,v);p=D.string(e,{anchor:F,focus:_},{voids:i}),m=!0}}if(fe.isText(b)){var x=P.equals(v,d.path);for(x?(g=a?d.offset:b.text.length-d.offset,f=d.offset):(g=b.text.length,f=a?g:0),(x||m||r==="offset")&&(yield{path:v,offset:f},m=!1);;){if(h===0){if(p==="")break;h=w(p,r,a),p=bo(p,h,a)[1]}if(f=a?f-h:f+h,g=g-h,g<0){h=-g;break}h=0,yield{path:v,offset:f}}}}function w(B,S,z){return S==="character"?vo(B,z):S==="word"?cv(B,z):S==="line"||S==="block"?B.length:1}}()}var T0=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=D.before(t,s,{voids:a});if(o){var[,l]=D.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]=D.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[m]=D.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return m}}},S0=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=D.rangeRefs(t);return l.delete(i),i.current=null,o}},s=D.rangeRefs(t);return s.add(i),i},j0=e=>{var t=Iu.get(e);return t||(t=new Set,Iu.set(e,t)),t},O0=(e,t,n)=>{if(V.isRange(t)&&!n)return t;var r=D.start(e,t),a=D.end(e,n||t);return{anchor:r,focus:a}};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 P0(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){lt(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 N0=(e,t)=>{var{selection:n}=e;if(n){var r=(d,m)=>{if(!fe.isText(d))return!1;var[p,h]=D.parent(e,m);return!e.isVoid(p)||e.markableVoid(p)},a=V.isExpanded(n),i=!1;if(!a){var[s,o]=D.node(e,n);if(s&&r(s,o)){var[l]=D.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)ee.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=P0({},D.marks(e)||{});delete u[t],e.marks=u,wr.get(e)||e.onChange()}}},M0=(e,t)=>{Yd.set(e,t)},I0=(e,t)=>D.point(e,t,{edge:"start"}),R0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=D.range(t,n),[s,o]=V.edges(i),l="";for(var[u,d]of D.nodes(t,{at:i,match:fe.isText,voids:a})){var m=u.text;P.equals(d,o.path)&&(m=m.slice(0,o.offset)),P.equals(d,s.path)&&(m=m.slice(s.offset)),l+=m}return l},$0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=V.edges(n);if(i.offset!==0||s.offset!==0||V.isCollapsed(n)||P.hasPrevious(s.path))return n;var o=D.above(t,{at:s,match:g=>ce.isElement(g)&&D.isBlock(t,g),voids:a}),l=o?o[1]:[],u=D.start(t,i),d={anchor:u,focus:s},m=!0;for(var[p,h]of D.nodes(t,{at:d,match:fe.isText,reverse:!0,voids:a})){if(m){m=!1;continue}if(p.text!==""||P.isBefore(h,l)){s={path:h,offset:p.text.length};break}}return{anchor:i,focus:s}},L0=(e,t)=>{var n=D.isNormalizing(e);D.setNormalizing(e,!1);try{t()}finally{D.setNormalizing(e,n)}D.normalize(e)},z0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:d=!1}=n;if(u){var m=!1;if(V.isRange(u)&&V.isCollapsed(u)&&(m=!0,u=u.anchor),we.isPoint(u)){var p=D.void(t,{at:u,mode:"highest"});if(!l&&p){var[,h]=p;u=h}else{var g={unit:s,distance:o},f=i?D.before(t,u,g)||D.start(t,[]):D.after(t,u,g)||D.end(t,[]);u={anchor:u,focus:f},d=!0}}if(P.isPath(u)){ee.removeNodes(t,{at:u,voids:l});return}if(!V.isCollapsed(u)){if(!d){var[,b]=V.edges(u),v=D.end(t,[]);we.equals(b,v)||(u=D.unhangRange(t,u,{voids:l}))}var[_,F]=V.edges(u),x=D.above(t,{match:me=>ce.isElement(me)&&D.isBlock(t,me),at:_,voids:l}),w=D.above(t,{match:me=>ce.isElement(me)&&D.isBlock(t,me),at:F,voids:l}),B=x&&w&&!P.equals(x[1],w[1]),S=P.equals(_.path,F.path),z=l?null:(r=D.void(t,{at:_,mode:"highest"}))!==null&&r!==void 0?r:D.elementReadOnly(t,{at:_,mode:"highest"}),N=l?null:(a=D.void(t,{at:F,mode:"highest"}))!==null&&a!==void 0?a:D.elementReadOnly(t,{at:F,mode:"highest"});if(z){var I=D.before(t,_);I&&x&&P.isAncestor(x[1],I.path)&&(_=I)}if(N){var M=D.after(t,F);M&&w&&P.isAncestor(w[1],M.path)&&(F=M)}var k=[],A;for(var j of D.nodes(t,{at:u,voids:l})){var[L,H]=j;A&&P.compare(H,A)===0||(!l&&ce.isElement(L)&&(D.isVoid(t,L)||D.isElementReadOnly(t,L))||!P.isCommon(H,_.path)&&!P.isCommon(H,F.path))&&(k.push(j),A=H)}var Y=Array.from(k,me=>{var[,xe]=me;return D.pathRef(t,xe)}),Q=D.pointRef(t,_),re=D.pointRef(t,F),C="";if(!S&&!z){var q=Q.current,[K]=D.leaf(t,q),{path:E}=q,{offset:T}=_,$=K.text.slice(T);$.length>0&&(t.apply({type:"remove_text",path:E,offset:T,text:$}),C=$)}if(Y.reverse().map(me=>me.unref()).filter(me=>me!==null).forEach(me=>ee.removeNodes(t,{at:me,voids:l})),!N){var R=re.current,[U]=D.leaf(t,R),{path:ae}=R,J=S?_.offset:0,ie=U.text.slice(J,F.offset);ie.length>0&&(t.apply({type:"remove_text",path:ae,offset:J,text:ie}),C=ie)}!S&&B&&re.current&&Q.current&&ee.mergeNodes(t,{at:re.current,hanging:!0,voids:l}),m&&i&&s==="character"&&C.length>1&&C.match(/[\u0E00-\u0E7F]+/)&&ee.insertText(t,C.slice(0,C.length-o));var de=Q.unref(),X=re.unref(),ye=i?de||X:X||de;n.at==null&&ye&&ee.select(t,ye)}}})},q0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=go(t),batchDirty:o=!0}=r;if(n.length){if(V.isRange(s))if(a||(s=D.unhangRange(t,s,{voids:i})),V.isCollapsed(s))s=s.anchor;else{var[,l]=V.edges(s);if(!i&&D.void(t,{at:l}))return;var u=D.pointRef(t,l);ee.delete(t,{at:s}),s=u.unref()}else P.isPath(s)&&(s=D.start(t,s));if(!(!i&&D.void(t,{at:s}))){var d=D.above(t,{at:s,match:$=>ce.isElement($)&&D.isInline(t,$),mode:"highest",voids:i});if(d){var[,m]=d;if(D.isEnd(t,s,m)){var p=D.after(t,m);s=p}else if(D.isStart(t,s,m)){var h=D.before(t,m);s=h}}var g=D.above(t,{match:$=>ce.isElement($)&&D.isBlock(t,$),at:s,voids:i}),[,f]=g,b=D.isStart(t,s,f),v=D.isEnd(t,s,f),_=b&&v,F=!b||b&&v,x=!v,[,w]=ue.first({children:n},[]),[,B]=ue.last({children:n},[]),S=[],z=$=>{var[R,U]=$,ae=U.length===0;return ae?!1:_?!0:!(F&&P.isAncestor(U,w)&&ce.isElement(R)&&!t.isVoid(R)&&!t.isInline(R)||x&&P.isAncestor(U,B)&&ce.isElement(R)&&!t.isVoid(R)&&!t.isInline(R))};for(var N of ue.nodes({children:n},{pass:z}))z(N)&&S.push(N);var I=[],M=[],k=[],A=!0,j=!1;for(var[L]of S)ce.isElement(L)&&!t.isInline(L)?(A=!1,j=!0,M.push(L)):A?I.push(L):k.push(L);var[H]=D.nodes(t,{at:s,match:$=>fe.isText($)||D.isInline(t,$),mode:"highest",voids:i}),[,Y]=H,Q=D.isStart(t,s,Y),re=D.isEnd(t,s,Y),C=D.pathRef(t,v&&!k.length?P.next(f):f),q=D.pathRef(t,re?P.next(Y):Y);ee.splitNodes(t,{at:s,match:$=>j?ce.isElement($)&&D.isBlock(t,$):fe.isText($)||D.isInline(t,$),mode:j?"lowest":"highest",always:j&&(!b||I.length>0)&&(!v||k.length>0),voids:i});var K=D.pathRef(t,!Q||Q&&re?P.next(Y):Y);if(ee.insertNodes(t,I,{at:K.current,match:$=>fe.isText($)||D.isInline(t,$),mode:"highest",voids:i,batchDirty:o}),_&&!I.length&&M.length&&!k.length&&ee.delete(t,{at:f,voids:i}),ee.insertNodes(t,M,{at:C.current,match:$=>ce.isElement($)&&D.isBlock(t,$),mode:"lowest",voids:i,batchDirty:o}),ee.insertNodes(t,k,{at:q.current,match:$=>fe.isText($)||D.isInline(t,$),mode:"highest",voids:i,batchDirty:o}),!r.at){var E;if(k.length>0&&q.current?E=P.previous(q.current):M.length>0&&C.current?E=P.previous(C.current):K.current&&(E=P.previous(K.current)),E){var T=D.end(t,E);ee.select(t,T)}}K.unref(),C.unref(),q.unref()}}})},W0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")ee.select(t,a.anchor);else if(r==="focus")ee.select(t,a.focus);else if(r==="start"){var[i]=V.edges(a);ee.select(t,i)}else if(r==="end"){var[,s]=V.edges(a);ee.select(t,s)}}else return},U0=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},H0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:a=1,unit:i="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=V.isBackward(r)?"focus":"anchor"),o==="end"&&(o=V.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:a,unit:i,ignoreNonSelectable:!0},m={};if(o==null||o==="anchor"){var p=s?D.before(t,l,d):D.after(t,l,d);p&&(m.anchor=p)}if(o==null||o==="focus"){var h=s?D.before(t,u,d):D.after(t,u,d);h&&(m.focus=h)}ee.setSelection(t,m)}},V0=(e,t)=>{var{selection:n}=e;if(t=D.range(e,t),n){ee.setSelection(e,t);return}if(!V.isRange(t))throw new Error("When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: ".concat(et.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function ul(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ll(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ul(Object(n),!0).forEach(function(r){lt(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 K0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a}=t,{edge:i="both"}=r;if(a){i==="start"&&(i=V.isBackward(a)?"focus":"anchor"),i==="end"&&(i=V.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;ee.setSelection(t,{[i==="anchor"?"anchor":"focus"]:ll(ll({},l),n)})}},Z0=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!we.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!we.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})}},Y0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:d}=r;if(ue.isNode(n)&&(n=[n]),n.length!==0){var[m]=n;if(l||(l=go(t),d!==!1&&(d=!0)),d==null&&(d=!1),V.isRange(l))if(a||(l=D.unhangRange(t,l,{voids:i})),V.isCollapsed(l))l=l.anchor;else{var[,p]=V.edges(l),h=D.pointRef(t,p);ee.delete(t,{at:l}),l=h.unref()}if(we.isPoint(l)){u==null&&(fe.isText(m)?u=I=>fe.isText(I):t.isInline(m)?u=I=>fe.isText(I)||D.isInline(t,I):u=I=>ce.isElement(I)&&D.isBlock(t,I));var[g]=D.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,b=D.pathRef(t,f),v=D.isEnd(t,l,f);ee.splitNodes(t,{at:l,match:u,mode:s,voids:i});var _=b.unref();l=v?P.next(_):_}else return}var F=P.parent(l),x=l[l.length-1];if(!(!i&&D.void(t,{at:F}))){if(o){var w=[],B=P.levels(F);jv(t,()=>{var I=function(){var A=F.concat(x);x++;var j={type:"insert_node",path:A,node:M};t.apply(j),l=P.next(l),w.push(j),fe.isText?B.push(...Array.from(ue.nodes(M),L=>{var[,H]=L;return A.concat(H)})):B.push(A)};for(var M of n)I()},()=>{Qd(t,B,I=>{var M=I;for(var k of w)if(P.operationCanTransformPath(k)&&(M=P.transform(M,k),!M))return null;return M})})}else for(var S of n){var z=F.concat(x);x++,t.apply({type:"insert_node",path:z,node:S}),l=P.next(l)}if(l=P.previous(l),d){var N=D.end(t,l);N&&ee.select(t,N)}}}})},G0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=P.isPath(r)?ur(t,r):x=>ce.isElement(x)&&D.isBlock(t,x)),!!r){var o=D.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,x=>{var[,w]=x;return D.pathRef(t,w)});for(var u of l){var d=u.unref();if(d.length<2)throw new Error("Cannot lift node at a path [".concat(d,"] because it has a depth of less than `2`."));var m=D.node(t,P.parent(d)),[p,h]=m,g=d[d.length-1],{length:f}=p.children;if(f===1){var b=P.next(h);ee.moveNodes(t,{at:d,to:b,voids:i}),ee.removeNodes(t,{at:h,voids:i})}else if(g===0)ee.moveNodes(t,{at:d,to:h,voids:i});else if(g===f-1){var v=P.next(h);ee.moveNodes(t,{at:d,to:v,voids:i})}else{var _=P.next(d),F=P.next(h);ee.splitNodes(t,{at:_,voids:i}),ee.moveNodes(t,{at:d,to:F,voids:i})}}}})},Q0=["text"],J0=["children"],Jd=(e,t)=>{if(ce.isElement(t)){var n=t;return D.isVoid(e,t)?!0:n.children.length===1?Jd(e,n.children[0]):!1}else return!D.isEditor(t)},X0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.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]=D.parent(t,a);r=I=>l.children.includes(I)}else r=I=>ce.isElement(I)&&D.isBlock(t,I);if(!i&&V.isRange(a)&&(a=D.unhangRange(t,a,{voids:s})),V.isRange(a))if(V.isCollapsed(a))a=a.anchor;else{var[,u]=V.edges(a),d=D.pointRef(t,u);ee.delete(t,{at:a}),a=d.unref(),n.at==null&&ee.select(t,a)}var[m]=D.nodes(t,{at:a,match:r,voids:s,mode:o}),p=D.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!m||!p)){var[h,g]=m,[f,b]=p;if(!(g.length===0||b.length===0)){var v=P.next(b),_=P.common(g,b),F=P.isSibling(g,b),x=Array.from(D.levels(t,{at:g}),I=>{var[M]=I;return M}).slice(_.length).slice(0,-1),w=D.above(t,{at:g,mode:"highest",match:I=>x.includes(I)&&Jd(t,I)}),B=w&&D.pathRef(t,w[1]),S,z;if(fe.isText(h)&&fe.isText(f)){var N=Gt(h,Q0);z=f.text.length,S=N}else if(ce.isElement(h)&&ce.isElement(f)){var N=Gt(h,J0);z=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(et.stringify(h)," ").concat(et.stringify(f)));F||ee.moveNodes(t,{at:g,to:v,voids:s}),B&&ee.removeNodes(t,{at:B.current,voids:s}),ce.isElement(f)&&D.isEmpty(t,f)||fe.isText(f)&&f.text===""&&b[b.length-1]!==0?ee.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:v,position:z,properties:S}),B&&B.unref()}}}})},eb=(e,t)=>{D.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)?ur(e,r):h=>ce.isElement(h)&&D.isBlock(e,h));var o=D.pathRef(e,n),l=D.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,h=>{var[,g]=h;return D.pathRef(e,g)});for(var d of u){var m=d.unref(),p=o.current;m.length!==0&&e.apply({type:"move_node",path:m,newPath:p}),o.current&&P.isSibling(p,m)&&P.isAfter(p,m)&&(o.current=P.next(o.current))}o.unref()}})},tb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.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)?ur(t,s):h=>ce.isElement(h)&&D.isBlock(t,h)),!r&&V.isRange(s)&&(s=D.unhangRange(t,s,{voids:a}));var l=D.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,h=>{var[,g]=h;return D.pathRef(t,g)});for(var d of u){var m=d.unref();if(m){var[p]=D.node(t,m);t.apply({type:"remove_node",path:m,node:p})}}}})},nb=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:d=!1,voids:m=!1}=r;if(i){if(a==null&&(a=P.isPath(i)?ur(t,i):z=>ce.isElement(z)&&D.isBlock(t,z)),!l&&V.isRange(i)&&(i=D.unhangRange(t,i,{voids:m})),d&&V.isRange(i)){if(V.isCollapsed(i)&&D.leaf(t,i.anchor)[0].text.length>0)return;var p=D.rangeRef(t,i,{affinity:"inward"}),[h,g]=V.edges(i),f=u==="lowest"?"lowest":"highest",b=D.isEnd(t,g,g.path);ee.splitNodes(t,{at:g,match:a,mode:f,voids:m,always:!b});var v=D.isStart(t,h,h.path);ee.splitNodes(t,{at:h,match:a,mode:f,voids:m,always:!v}),i=p.unref(),r.at==null&&ee.select(t,i)}s||(s=(z,N)=>z!==N);for(var[_,F]of D.nodes(t,{at:i,match:a,mode:u,voids:m})){var x={},w={};if(F.length!==0){var B=!1;for(var S in n)S==="children"||S==="text"||s(n[S],_[S])&&(B=!0,_.hasOwnProperty(S)&&(x[S]=_[S]),o?n[S]!=null&&(w[S]=o(_[S],n[S])):n[S]!=null&&(w[S]=n[S]));B&&t.apply({type:"set_node",path:F,properties:x,newProperties:w})}}}})},rb=(e,t)=>{if(V.isCollapsed(t))return t.anchor;var[,n]=V.edges(t),r=D.pointRef(e,n);return ee.delete(e,{at:t}),r.unref()},ab=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.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=re=>ce.isElement(re)&&D.isBlock(t,re)),V.isRange(s)&&(s=rb(t,s)),P.isPath(s)){var u=s,d=D.point(t,u),[m]=D.parent(t,u);i=re=>re===m,o=d.path.length-u.length+1,s=d,l=!0}if(s){var p=D.pointRef(t,s,{affinity:"backward"}),h;try{var[g]=D.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=D.void(t,{at:s,mode:"highest"}),b=0;if(!a&&f){var[v,_]=f;if(ce.isElement(v)&&t.isInline(v)){var F=D.after(t,_);if(!F){var x={text:""},w=P.next(_);ee.insertNodes(t,x,{at:w,voids:a}),F=D.point(t,w)}s=F,l=!0}var B=s.path.length-_.length;o=B+1,l=!0}h=D.pointRef(t,s);var S=s.path.length-o,[,z]=g,N=s.path.slice(0,S),I=o===0?s.offset:s.path[S]+b;for(var[M,k]of D.levels(t,{at:N,reverse:!0,voids:a})){var A=!1;if(k.length<z.length||k.length===0||!a&&ce.isElement(M)&&D.isVoid(t,M))break;var j=p.current,L=D.isEnd(t,j,k);if(l||!p||!D.isEdge(t,j,k)){A=!0;var H=ue.extractProps(M);t.apply({type:"split_node",path:k,position:I,properties:H})}I=k[k.length-1]+(A||L?1:0)}if(n.at==null){var Y=h.current||D.end(t,[]);ee.select(t,Y)}}finally{var Q;p.unref(),(Q=h)===null||Q===void 0||Q.unref()}}})},ib=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var a={};for(var i of n)a[i]=null;ee.setNodes(t,a,r)},sb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.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)?ur(t,s):h=>ce.isElement(h)&&D.isBlock(t,h)),P.isPath(s)&&(s=D.range(t,s));var l=V.isRange(s)?D.rangeRef(t,s):null,u=D.nodes(t,{at:s,match:o,mode:r,voids:i}),d=Array.from(u,h=>{var[,g]=h;return D.pathRef(t,g)}).reverse(),m=function(){var g=p.unref(),[f]=D.node(t,g),b=D.range(t,g);a&&l&&(b=V.intersection(l.current,b)),ee.liftNodes(t,{at:b,match:v=>ce.isAncestor(f)&&f.children.includes(v),voids:i})};for(var p of d)m();l&&l.unref()}})};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 dl(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){lt(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 ob=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.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=ur(t,l):t.isInline(n)?o=b=>ce.isElement(b)&&D.isInline(t,b)||fe.isText(b):o=b=>ce.isElement(b)&&D.isBlock(t,b)),i&&V.isRange(l)){var[u,d]=V.edges(l),m=D.rangeRef(t,l,{affinity:"inward"});ee.splitNodes(t,{at:d,match:o,voids:s}),ee.splitNodes(t,{at:u,match:o,voids:s}),l=m.unref(),r.at==null&&ee.select(t,l)}var p=Array.from(D.nodes(t,{at:l,match:t.isInline(n)?b=>ce.isElement(b)&&D.isBlock(t,b):b=>D.isEditor(b),mode:"lowest",voids:s})),h=function(){var v=V.isRange(l)?V.intersection(l,D.range(t,f)):l;if(!v)return 0;var _=Array.from(D.nodes(t,{at:v,match:o,mode:a,voids:s}));if(_.length>0){var[F]=_,x=_[_.length-1],[,w]=F,[,B]=x;if(w.length===0&&B.length===0)return 0;var S=P.equals(w,B)?P.parent(w):P.common(w,B),z=D.range(t,w,B),N=D.node(t,S),[I]=N,M=S.length+1,k=P.next(B.slice(0,M)),A=dl(dl({},n),{},{children:[]});ee.insertNodes(t,A,{at:k,voids:s}),ee.moveNodes(t,{at:z,match:j=>ce.isAncestor(I)&&I.children.includes(j),to:k.concat(0),voids:s})}},g;for(var[,f]of p)g=h()}})},ub=()=>{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 Ov(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $v(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qv(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wv(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Uv(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Nv(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t0(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return r0(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return q0(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return n0(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return i0(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mv(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return N0(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pv(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Iv(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rv(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lv(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zv(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return W0(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return z0(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return U0(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hv(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vv(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kv(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zv(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yv(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return v0(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qv(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jv(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xv(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return e0(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Y0(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return s0(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return o0(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return u0(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return l0(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return c0(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return d0(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return f0(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return h0(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return m0(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return G0(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return X0(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return H0(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eb(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return b0(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return y0(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return D0(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return C0(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return x0(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _0(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return w0(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return E0(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return B0(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return k0(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return F0(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return A0(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return T0(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return O0(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return S0(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return j0(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tb(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return V0(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nb(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return M0(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return K0(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Z0(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ab(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return I0(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return R0(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $0(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ib(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sb(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gv(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return L0(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ob(e,...r)}};return e},lb={isHistory(e){return nt(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||on.isOperationList(e.redos[0].operations))&&(e.undos.length===0||on.isOperationList(e.undos[0].operations))}},Oi=new WeakMap,Pi=new WeakMap,Vn={isHistoryEditor(e){return lb.isHistory(e.history)&&D.isEditor(e)},isMerging(e){return Pi.get(e)},isSaving(e){return Oi.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Vn.isMerging(e);Pi.set(e,!1),t(),Pi.set(e,n)},withoutSaving(e,t){var n=Vn.isSaving(e);Oi.set(e,!1),t(),Oi.set(e,n)}},cb=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&ee.setSelection(t,i.selectionBefore),Vn.withoutSaving(t,()=>{D.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];Vn.withoutSaving(t,()=>{D.withoutNormalizing(t,()=>{var s=i.operations.map(on.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&ee.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=Vn.isSaving(t),d=Vn.isMerging(t);if(u==null&&(u=fb(r)),u){if(d==null&&(o==null?d=!1:a.length!==0?d=!0:d=db(r,l)),o&&d)o.operations.push(r);else{var m={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",m)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},db=(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)),fb=(e,t)=>e.type!=="set_selection",hb=gb,Xd="֑-߿יִ-﷽ﹰ-ﻼ",ef="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",mb=new RegExp("^[^"+ef+"]*["+Xd+"]"),pb=new RegExp("^[^"+Xd+"]*["+ef+"]");function gb(e){return e=String(e||""),mb.test(e)?"rtl":pb.test(e)?"ltr":"neutral"}const tf=jn(hb);function vb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var yo=vb,bb=typeof Yr=="object"&&Yr&&Yr.Object===Object&&Yr,yb=bb,Db=yb,Cb=typeof self=="object"&&self&&self.Object===Object&&self,xb=Db||Cb||Function("return this")(),nf=xb,wb=nf,Eb=function(){return wb.Date.now()},_b=Eb,kb=/\s/;function Fb(e){for(var t=e.length;t--&&kb.test(e.charAt(t)););return t}var Bb=Fb,Ab=Bb,Tb=/^\s+/;function Sb(e){return e&&e.slice(0,Ab(e)+1).replace(Tb,"")}var jb=Sb,Ob=nf,Pb=Ob.Symbol,rf=Pb,fl=rf,af=Object.prototype,Nb=af.hasOwnProperty,Mb=af.toString,vr=fl?fl.toStringTag:void 0;function Ib(e){var t=Nb.call(e,vr),n=e[vr];try{e[vr]=void 0;var r=!0}catch{}var a=Mb.call(e);return r&&(t?e[vr]=n:delete e[vr]),a}var Rb=Ib,$b=Object.prototype,Lb=$b.toString;function zb(e){return Lb.call(e)}var qb=zb,hl=rf,Wb=Rb,Ub=qb,Hb="[object Null]",Vb="[object Undefined]",ml=hl?hl.toStringTag:void 0;function Kb(e){return e==null?e===void 0?Vb:Hb:ml&&ml in Object(e)?Wb(e):Ub(e)}var Zb=Kb;function Yb(e){return e!=null&&typeof e=="object"}var Gb=Yb,Qb=Zb,Jb=Gb,Xb="[object Symbol]";function ey(e){return typeof e=="symbol"||Jb(e)&&Qb(e)==Xb}var ty=ey,ny=jb,pl=yo,ry=ty,gl=0/0,ay=/^[-+]0x[0-9a-f]+$/i,iy=/^0b[01]+$/i,sy=/^0o[0-7]+$/i,oy=parseInt;function uy(e){if(typeof e=="number")return e;if(ry(e))return gl;if(pl(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=pl(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=ny(e);var n=iy.test(e);return n||sy.test(e)?oy(e.slice(2),n?2:8):ay.test(e)?gl:+e}var ly=uy,cy=yo,Ni=_b,vl=ly,dy="Expected a function",fy=Math.max,hy=Math.min;function my(e,t,n){var r,a,i,s,o,l,u=0,d=!1,m=!1,p=!0;if(typeof e!="function")throw new TypeError(dy);t=vl(t)||0,cy(n)&&(d=!!n.leading,m="maxWait"in n,i=m?fy(vl(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function h(B){var S=r,z=a;return r=a=void 0,u=B,s=e.apply(z,S),s}function g(B){return u=B,o=setTimeout(v,t),d?h(B):s}function f(B){var S=B-l,z=B-u,N=t-S;return m?hy(N,i-z):N}function b(B){var S=B-l,z=B-u;return l===void 0||S>=t||S<0||m&&z>=i}function v(){var B=Ni();if(b(B))return _(B);o=setTimeout(v,f(B))}function _(B){return o=void 0,p&&r?h(B):(r=a=void 0,s)}function F(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function x(){return o===void 0?s:_(Ni())}function w(){var B=Ni(),S=b(B);if(r=arguments,a=this,l=B,S){if(o===void 0)return g(l);if(m)return clearTimeout(o),o=setTimeout(v,t),h(l)}return o===void 0&&(o=setTimeout(v,t)),s}return w.cancel=F,w.flush=x,w}var sf=my;const py=jn(sf);var gy=sf,vy=yo,by="Expected a function";function yy(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(by);return vy(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),gy(e,t,{leading:r,maxWait:t,trailing:a})}var Dy=yy;const Cy=jn(Dy),bl=e=>typeof e=="object"&&e!=null&&e.nodeType===1,yl=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Mi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return yl(n.overflowY,t)||yl(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},sa=(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,xy=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Dl=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,m=typeof u=="function"?u:H=>H!==u;if(!bl(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,h=[];let g=e;for(;bl(g)&&m(g);){if(g=xy(g),g===p){h.push(g);break}g!=null&&g===document.body&&Mi(g)&&!Mi(document.documentElement)||g!=null&&Mi(g,d)&&h.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:v,scrollY:_}=window,{height:F,width:x,top:w,right:B,bottom:S,left:z}=e.getBoundingClientRect(),{top:N,right:I,bottom:M,left:k}=(H=>{const Y=window.getComputedStyle(H);return{top:parseFloat(Y.scrollMarginTop)||0,right:parseFloat(Y.scrollMarginRight)||0,bottom:parseFloat(Y.scrollMarginBottom)||0,left:parseFloat(Y.scrollMarginLeft)||0}})(e);let A=o==="start"||o==="nearest"?w-N:o==="end"?S+M:w+F/2-N+M,j=l==="center"?z+x/2-k+I:l==="end"?B+I:z-k;const L=[];for(let H=0;H<h.length;H++){const Y=h[H],{height:Q,width:re,top:C,right:q,bottom:K,left:E}=Y.getBoundingClientRect();if(s==="if-needed"&&w>=0&&z>=0&&S<=b&&B<=f&&w>=C&&S<=K&&z>=E&&B<=q)return L;const T=getComputedStyle(Y),$=parseInt(T.borderLeftWidth,10),R=parseInt(T.borderTopWidth,10),U=parseInt(T.borderRightWidth,10),ae=parseInt(T.borderBottomWidth,10);let J=0,ie=0;const de="offsetWidth"in Y?Y.offsetWidth-Y.clientWidth-$-U:0,X="offsetHeight"in Y?Y.offsetHeight-Y.clientHeight-R-ae:0,ye="offsetWidth"in Y?Y.offsetWidth===0?0:re/Y.offsetWidth:0,me="offsetHeight"in Y?Y.offsetHeight===0?0:Q/Y.offsetHeight:0;if(p===Y)J=o==="start"?A:o==="end"?A-b:o==="nearest"?sa(_,_+b,b,R,ae,_+A,_+A+F,F):A-b/2,ie=l==="start"?j:l==="center"?j-f/2:l==="end"?j-f:sa(v,v+f,f,$,U,v+j,v+j+x,x),J=Math.max(0,J+_),ie=Math.max(0,ie+v);else{J=o==="start"?A-C-R:o==="end"?A-K+ae+X:o==="nearest"?sa(C,K,Q,R,ae+X,A,A+F,F):A-(C+Q/2)+X/2,ie=l==="start"?j-E-$:l==="center"?j-(E+re/2)+de/2:l==="end"?j-q+U+de:sa(E,q,re,$,U+de,j,j+x,x);const{scrollLeft:xe,scrollTop:Te}=Y;J=me===0?0:Math.max(0,Math.min(Te+J/me,Y.scrollHeight-Q/me+X)),ie=ye===0?0:Math.max(0,Math.min(xe+ie/ye,Y.scrollWidth-re/ye+de)),A+=Te-J,j+=xe-ie}L.push({el:Y,top:J,left:ie})}return L},wy=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function Ey(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(Dl(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Dl(e,wy(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var wn=[],_y=function(){return wn.some(function(e){return e.activeTargets.length>0})},ky=function(){return wn.some(function(e){return e.skippedTargets.length>0})},Cl="ResizeObserver loop completed with undelivered notifications.",Fy=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Cl}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Cl),window.dispatchEvent(e)},Ir;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Ir||(Ir={}));var En=function(e){return Object.freeze(e)},By=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,En(this)}return e}(),of=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,En(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}(),Do=function(e){return e instanceof SVGElement&&"getBBox"in e},uf=function(e){if(Do(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)},xl=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)},Ay=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},Er=typeof window<"u"?window:{},oa=new WeakMap,wl=/auto|scroll/,Ty=/^tb|vertical/,Sy=/msie|trident/i.test(Er.navigator&&Er.navigator.userAgent),Pt=function(e){return parseFloat(e||"0")},Gn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new By((n?t:e)||0,(n?e:t)||0)},El=En({devicePixelContentBoxSize:Gn(),borderBoxSize:Gn(),contentBoxSize:Gn(),contentRect:new of(0,0,0,0)}),lf=function(e,t){if(t===void 0&&(t=!1),oa.has(e)&&!t)return oa.get(e);if(uf(e))return oa.set(e,El),El;var n=getComputedStyle(e),r=Do(e)&&e.ownerSVGElement&&e.getBBox(),a=!Sy&&n.boxSizing==="border-box",i=Ty.test(n.writingMode||""),s=!r&&wl.test(n.overflowY||""),o=!r&&wl.test(n.overflowX||""),l=r?0:Pt(n.paddingTop),u=r?0:Pt(n.paddingRight),d=r?0:Pt(n.paddingBottom),m=r?0:Pt(n.paddingLeft),p=r?0:Pt(n.borderTopWidth),h=r?0:Pt(n.borderRightWidth),g=r?0:Pt(n.borderBottomWidth),f=r?0:Pt(n.borderLeftWidth),b=m+u,v=l+d,_=f+h,F=p+g,x=o?e.offsetHeight-F-e.clientHeight:0,w=s?e.offsetWidth-_-e.clientWidth:0,B=a?b+_:0,S=a?v+F:0,z=r?r.width:Pt(n.width)-B-w,N=r?r.height:Pt(n.height)-S-x,I=z+b+w+_,M=N+v+x+F,k=En({devicePixelContentBoxSize:Gn(Math.round(z*devicePixelRatio),Math.round(N*devicePixelRatio),i),borderBoxSize:Gn(I,M,i),contentBoxSize:Gn(z,N,i),contentRect:new of(m,l,z,N)});return oa.set(e,k),k},cf=function(e,t,n){var r=lf(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Ir.DEVICE_PIXEL_CONTENT_BOX:return s;case Ir.BORDER_BOX:return a;default:return i}},jy=function(){function e(t){var n=lf(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=En([n.borderBoxSize]),this.contentBoxSize=En([n.contentBoxSize]),this.devicePixelContentBoxSize=En([n.devicePixelContentBoxSize])}return e}(),df=function(e){if(uf(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},Oy=function(){var e=1/0,t=[];wn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new jy(u.target),m=df(u.target);o.push(d),u.lastReportedSize=cf(u.target,u.observedBox),m<e&&(e=m)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},_l=function(e){wn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(df(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},Py=function(){var e=0;for(_l(e);_y();)e=Oy(),_l(e);return ky()&&Fy(),e>0},Ii,ff=[],Ny=function(){return ff.splice(0).forEach(function(e){return e()})},My=function(e){if(!Ii){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Ny()}).observe(n,r),Ii=function(){n.textContent="".concat(t?t--:t++)}}ff.push(e),Ii()},Iy=function(e){My(function(){requestAnimationFrame(e)})},wa=0,Ry=function(){return!!wa},$y=250,Ly={attributes:!0,characterData:!0,childList:!0,subtree:!0},kl=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Fl=function(e){return e===void 0&&(e=0),Date.now()+e},Ri=!1,zy=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=$y),!Ri){Ri=!0;var r=Fl(t);Iy(function(){var a=!1;try{a=Py()}finally{if(Ri=!1,t=r-Fl(),!Ry())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,Ly)};document.body?n():Er.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),kl.forEach(function(n){return Er.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),kl.forEach(function(n){return Er.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),Ss=new zy,Bl=function(e){!wa&&e>0&&Ss.start(),wa+=e,!wa&&Ss.stop()},qy=function(e){return!Do(e)&&!Ay(e)&&getComputedStyle(e).display==="inline"},Wy=function(){function e(t,n){this.target=t,this.observedBox=n||Ir.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=cf(this.target,this.observedBox,!0);return qy(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Uy=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),ua=new WeakMap,Al=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},la=function(){function e(){}return e.connect=function(t,n){var r=new Uy(t,n);ua.set(t,r)},e.observe=function(t,n,r){var a=ua.get(t),i=a.observationTargets.length===0;Al(a.observationTargets,n)<0&&(i&&wn.push(a),a.observationTargets.push(new Wy(n,r&&r.box)),Bl(1),Ss.schedule())},e.unobserve=function(t,n){var r=ua.get(t),a=Al(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&wn.splice(wn.indexOf(r),1),r.observationTargets.splice(a,1),Bl(-1))},e.disconnect=function(t){var n=this,r=ua.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Hy=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.");la.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(!xl(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");la.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(!xl(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");la.unobserve(this,t)},e.prototype.disconnect=function(){la.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Xt={};Object.defineProperty(Xt,"__esModule",{value:!0});var Vy=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),$i={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},hf={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Vy?"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 ca=1;ca<20;ca++)Co["f"+ca]=111+ca;function si(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return mf(s,t)}),a=function(o){return r.some(function(l){return pf(l,o)})},i=n==null?a:a(n);return i}function Ky(e,t){return si(e,t)}function Zy(e,t){return si(e,{byKey:!0},t)}function mf(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in $i)r[$i[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var d=a[Symbol.iterator](),m;!(o=(m=d.next()).done);o=!0){var p=m.value,h=p.endsWith("?")&&p.length>1;h&&(p=p.slice(0,-1));var g=xo(p),f=$i[g];if(p.length>1&&!f&&!hf[p]&&!Co[g])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!f)&&(n?r.key=g:r.which=gf(p)),f&&(r[f]=h?null:!0)}}catch(b){l=!0,u=b}finally{try{!o&&d.return&&d.return()}finally{if(l)throw u}}return r}function pf(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 gf(e){e=xo(e);var t=Co[e]||e.toUpperCase().charCodeAt(0);return t}function xo(e){return e=e.toLowerCase(),e=hf[e]||e,e}var Yy=Xt.default=si,Li=Xt.isHotkey=si;Xt.isCodeHotkey=Ky;Xt.isKeyHotkey=Zy;Xt.parseHotkey=mf;Xt.compareHotkey=pf;Xt.toKeyCode=gf;Xt.toKeyName=xo;function Gy(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 nr(e,t){if(e==null)return{};var n=Gy(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 Rr(e){"@babel/helpers - typeof";return Rr=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},Rr(e)}function Qy(e,t){if(Rr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Rr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Jy(e){var t=Qy(e,"string");return Rr(t)==="symbol"?t:String(t)}function kt(e,t,n){return t=Jy(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var wo=y.createContext(null),pn=()=>{var e=y.useContext(wo);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},vf=parseInt(y.version.split(".")[0],10),Xy=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Tl=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),ut=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Kn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Cr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),e1=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),bf=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),t1=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),n1=ut&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),r1=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),a1=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),i1=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),Ea=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",tn=(!t1||!n1)&&!e1&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Eo=new WeakMap,_o=new WeakMap,yf=new WeakMap,_a=new WeakMap,js=new WeakMap,$r=new WeakMap,_n=new WeakMap,za=new WeakMap,oi=new WeakMap,Os=new WeakMap,un=new WeakMap,Cn=new WeakMap,_r=new WeakMap,Ps=new WeakMap,ko=new WeakMap,Tt=new WeakMap,Zt=new WeakMap,dt=new WeakMap,rn=new WeakMap,an=new WeakMap,Df=new WeakMap,rr=Symbol("placeholder"),Cf=Symbol("mark-placeholder"),s1=globalThis.Text,Fo=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,o1=e=>cn(e)&&e.nodeType===8,_t=e=>cn(e)&&e.nodeType===1,cn=e=>{var t=Fo(e);return!!t&&e instanceof t.Node},Ns=e=>{var t=e&&e.anchorNode&&Fo(e.anchorNode);return!!t&&e instanceof t.Selection},xf=e=>cn(e)&&e.nodeType===3,u1=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,l1=e=>{var[t,n]=e;if(_t(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=wf(t,a,r?"backward":"forward"),r=a<n;_t(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=d1(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},c1=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},wf=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(o1(a)||_t(a)&&a.childNodes.length===0||_t(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]},d1=(e,t,n)=>{var[r]=wf(e,t,n);return r},Ef=e=>{var t="";if(xf(e)&&e.nodeValue)return e.nodeValue;if(_t(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+=`
130
- `)}return t},f1=/data-slate-fragment="(.+?)"/m,h1=e=>{var t=e.getData("text/html"),[,n]=t.match(f1)||[];return n},Bo=(e,t,n)=>{var{target:r}=t;if(_t(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=te.getWindow(e);if(a.contains(r))return te.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var d of l)if(d===r||d.contains(r))return!0});return!i||i===t?!1:Bo(e,i,n)},m1=0;class p1{constructor(){kt(this,"id",void 0),this.id="".concat(m1++)}}var te={androidPendingDiffs:e=>dt.get(e),androidScheduleFlush:e=>{var t;(t=ko.get(e))===null||t===void 0||t()},blur:e=>{var t=te.toDOMNode(e,e),n=te.findDocumentOrShadowRoot(e);un.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=te.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&ee.deselect(e)},findDocumentOrShadowRoot:e=>{var t=te.toDOMNode(e,e),n=t.getRootNode();return(n instanceof Document||n instanceof ShadowRoot)&&n.getSelection!=null?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:a}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i=te.toSlateNode(e,t.target),s=te.findPath(e,i);if(ce.isElement(i)&&D.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=D.point(e,s,{edge:l?"start":"end"}),d=l?D.before(e,u):D.after(e,u);if(d){var m=D.range(e,d);return m}}var p,{document:h}=te.getWindow(e);if(h.caretRangeFromPoint)p=h.caretRangeFromPoint(n,r);else{var g=h.caretPositionFromPoint(n,r);g&&(p=h.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=te.toSlateRange(e,p,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=za.get(t);return n||(n=new p1,za.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=_o.get(r);if(a==null){if(D.isEditor(r))return n;break}var i=Eo.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(et.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!un.get(t)){if(n.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(t.operations.length>0){setTimeout(()=>{te.focus(t,{retries:n.retries-1})},10);return}var r=te.toDOMNode(t,t),a=te.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=te.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(ee.select(t,D.start(t,[])),t.onChange()),un.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=yf.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{editable:a=!1}=r,i=te.toDOMNode(t,t),s;try{s=_t(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)=>cn(t)&&te.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return D.hasPath(e,n.path)&&D.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>te.hasEditableTarget(e,t)||te.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>cn(t)&&te.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!Cn.get(e),isFocused:e=>!!un.get(e),isReadOnly:e=>!!Os.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Os.get(e))return!1;var n=te.hasTarget(e,t)&&te.toSlateNode(e,t);return ce.isElement(n)&&D.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=oi.get(e),r=D.isEditor(t)?_a.get(e):n==null?void 0:n.get(te.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(et.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=D.node(e,t.path),r=te.toDOMNode(e,n),a;D.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],d=u.childNodes[0];if(!(d==null||d.textContent==null)){var{length:m}=d.textContent,p=u.getAttribute("data-slate-length"),h=p==null?m:parseInt(p,10),g=o+h,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var b,v=f.childNodes[0];a=[v instanceof s1?v:f,(b=f.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var _=Math.min(m,Math.max(0,t.offset-o));a=[d,_];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(et.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=V.isBackward(t),i=te.toDOMPoint(e,n),s=V.isCollapsed(t)?i:te.toDOMPoint(e,r),o=te.getWindow(e),l=o.document.createRange(),[u,d]=a?s:i,[m,p]=a?i:s,h=_t(u)?u:u.parentElement,g=!!h.getAttribute("data-slate-zero-width"),f=_t(m)?m:m.parentElement,b=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:d),l.setEnd(m,b?1:p),l},toSlateNode:(e,t)=>{var n=_t(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?$r.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:l1(t),o=i.parentNode,l=null,u=0;if(o){var d,m,p=te.toDOMNode(e,e),h=o.closest('[data-slate-void="true"]'),g=h&&p.contains(h)?h:null,f=o.closest("[data-slate-leaf]"),b=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var v=te.getWindow(e),_=v.document.createRange();_.setStart(l,0),_.setEnd(i,s);var F=_.cloneContents(),x=[...Array.prototype.slice.call(F.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(F.querySelectorAll("[contenteditable=false]"))];x.forEach(j=>{if(ut&&!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=F.textContent.length,b=l}}else if(g){for(var w=g.querySelectorAll("[data-slate-leaf]"),B=0;B<w.length;B++){var S=w[B];if(te.hasDOMNode(e,S)){f=S;break}}f?(l=f.closest('[data-slate-node="text"]'),b=f,u=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(j=>{u-=j.textContent.length})):u=1}b&&u===b.textContent.length&&ut&&b.getAttribute("data-slate-zero-width")==="z"&&(d=b.textContent)!==null&&d!==void 0&&d.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Kn&&(m=b.textContent)!==null&&m!==void 0&&m.endsWith(`
129
+ */function Au(e){return Object.prototype.toString.call(e)==="[object Object]"}function nt(e){var t,n;return Au(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Au(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Kd=Symbol.for("immer-nothing"),Tu=Symbol.for("immer-draftable"),Dt=Symbol.for("immer-state"),$g=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 mt(e,...t){if(process.env.NODE_ENV!=="production"){const n=$g[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 nr=Object.getPrototypeOf;function An(e){return!!e&&!!e[Dt]}function Tn(e){var t;return e?Zd(e)||Array.isArray(e)||!!e[Tu]||!!((t=e.constructor)!=null&&t[Tu])||ai(e)||ii(e):!1}var Lg=Object.prototype.constructor.toString();function Zd(e){if(!e||typeof e!="object")return!1;const t=nr(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)===Lg}function Ia(e,t){ri(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function ri(e){const t=e[Dt];return t?t.type_:Array.isArray(e)?1:ai(e)?2:ii(e)?3:0}function ks(e,t){return ri(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Yd(e,t,n){const r=ri(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function zg(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ai(e){return e instanceof Map}function ii(e){return e instanceof Set}function Dn(e){return e.copy_||e.base_}function Fs(e,t){if(ai(e))return new Map(e);if(ii(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Zd(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[Dt];let a=Reflect.ownKeys(r);for(let i=0;i<a.length;i++){const s=a[i],o=r[s];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[s]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[s]})}return Object.create(nr(e),r)}else{const r=nr(e);if(r!==null&&n)return{...e};const a=Object.create(r);return Object.assign(a,e)}}function po(e,t=!1){return si(e)||An(e)||!Tn(e)||(ri(e)>1&&(e.set=e.add=e.clear=e.delete=qg),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>po(r,!0))),e}function qg(){mt(2)}function si(e){return Object.isFrozen(e)}var Wg={};function Sn(e){const t=Wg[e];return t||mt(0,e),t}var Mr;function Gd(){return Mr}function Ug(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Su(e,t){t&&(Sn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Bs(e){As(e),e.drafts_.forEach(Hg),e.drafts_=null}function As(e){e===Mr&&(Mr=e.parent_)}function ju(e){return Mr=Ug(Mr,e)}function Hg(e){const t=e[Dt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ou(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[Dt].modified_&&(Bs(t),mt(4)),Tn(e)&&(e=Ra(t,e),t.parent_||$a(t,e)),t.patches_&&Sn("Patches").generateReplacementPatches_(n[Dt].base_,e,t.patches_,t.inversePatches_)):e=Ra(t,n,[]),Bs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Kd?e:void 0}function Ra(e,t,n){if(si(t))return t;const r=t[Dt];if(!r)return Ia(t,(a,i)=>Pu(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),Ia(i,(o,l)=>Pu(e,r,a,o,l,n,s)),$a(e,a,!1),n&&e.patches_&&Sn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Pu(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&mt(5),An(a)){const o=i&&t&&t.type_!==3&&!ks(t.assigned_,r)?i.concat(r):void 0,l=Ra(e,a,o);if(Yd(n,r,l),An(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Tn(a)&&!si(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ra(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_&&po(t,n)}function Vg(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Gd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=go;n&&(a=[r],i=Nr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var go={get(e,t){if(t===Dt)return e;const n=Dn(e);if(!ks(n,t))return Kg(e,n,t);const r=n[t];return e.finalized_||!Tn(r)?r:r===ji(e.base_,t)?(Oi(e),e.copy_[t]=Ss(r,e)):r},has(e,t){return t in Dn(e)},ownKeys(e){return Reflect.ownKeys(Dn(e))},set(e,t,n){const r=Qd(Dn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=ji(Dn(e),t),i=a==null?void 0:a[Dt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(zg(n,a)&&(n!==void 0||ks(e.base_,t)))return!0;Oi(e),Ts(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 ji(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Oi(e),Ts(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=Dn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){mt(11)},getPrototypeOf(e){return nr(e.base_)},setPrototypeOf(){mt(12)}},Nr={};Ia(go,(e,t)=>{Nr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Nr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&mt(13),Nr.set.call(this,e,t,void 0)};Nr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&mt(14),go.set.call(this,e[0],t,n,e[0])};function ji(e,t){const n=e[Dt];return(n?Dn(n):e)[t]}function Kg(e,t,n){var a;const r=Qd(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Qd(e,t){if(!(t in e))return;let n=nr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=nr(n)}}function Ts(e){e.modified_||(e.modified_=!0,e.parent_&&Ts(e.parent_))}function Oi(e){e.copy_||(e.copy_=Fs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Zg=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"&&mt(6),r!==void 0&&typeof r!="function"&&mt(7);let a;if(Tn(t)){const i=ju(this),s=Ss(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?Bs(i):As(i)}return Su(i,r),Ou(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===Kd&&(a=void 0),this.autoFreeze_&&po(a,!0),r){const i=[],s=[];Sn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else mt(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){Tn(e)||mt(8),An(e)&&(e=Yg(e));const t=ju(this),n=Ss(e,void 0);return n[Dt].isManual_=!0,As(t),n}finishDraft(e,t){const n=e&&e[Dt];(!n||!n.isManual_)&&mt(9);const{scope_:r}=n;return Su(r,t),Ou(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=Sn("Patches").applyPatches_;return An(e)?r(e,t):this.produce(e,a=>r(a,t))}};function Ss(e,t){const n=ai(e)?Sn("MapSet").proxyMap_(e,t):ii(e)?Sn("MapSet").proxySet_(e,t):Vg(e,t);return(t?t.scope_:Gd()).drafts_.push(n),n}function Yg(e){return An(e)||mt(10,e),Jd(e)}function Jd(e){if(!Tn(e)||si(e))return e;const t=e[Dt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Fs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Fs(e,!0);return Ia(n,(r,a)=>{Yd(n,r,Jd(a))}),t&&(t.finalized_=!1),n}var Ct=new Zg,vo=Ct.produce;Ct.produceWithPatches.bind(Ct);Ct.setAutoFreeze.bind(Ct);Ct.setUseStrictShallowCopy.bind(Ct);Ct.applyPatches.bind(Ct);var Mu=Ct.createDraft.bind(Ct),Nu=Ct.finishDraft.bind(Ct),Gg={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()}}},Qg={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=we.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Jg={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=H.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},La=new WeakMap,za=new WeakMap,Er=new WeakMap,Xd=new WeakMap,Iu=new WeakMap,Ru=new WeakMap,$u=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:m,newPath:p}=t;if(P.equals(m,p))return r;if(P.isAncestor(m,r)||P.equals(m,r)){var h=p.slice();return P.endsBefore(m,p)&&m.length<p.length&&(h[m.length-1]-=1),h.concat(r.slice(m.length))}else P.isSibling(m,p)&&(P.isAncestor(p,r)||P.equals(p,r))?P.endsBefore(m,r)?r[m.length-1]-=1:r[m.length-1]+=1:P.endsBefore(p,r)||P.equals(p,r)||P.isAncestor(p,r)?(P.endsBefore(m,r)&&(r[m.length-1]-=1),r[p.length-1]+=1):P.endsBefore(m,r)&&(P.equals(p,r)&&(r[p.length-1]+=1),r[m.length-1]-=1);break}}return r}};function Ir(e){"@babel/helpers - typeof";return Ir=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},Ir(e)}function Xg(e,t){if(Ir(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Ir(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ev(e){var t=Xg(e,"string");return Ir(t)==="symbol"?t:String(t)}function dt(e,t,n){return t=ev(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Lu(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 vr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Lu(Object(n),!0).forEach(function(r){dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var tv=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=ue.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 H.points(t))t[l]=we.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:m}=n;if(m.length===0)break;var p=ue.leaf(e,u),h=p.text.slice(0,d),g=p.text.slice(d);if(p.text=h+m+g,t)for(var[f,b]of H.points(t))t[b]=we.transform(f,n);break}case"merge_node":{var{path:v}=n,E=ue.get(e,v),B=P.previous(v),_=ue.get(e,B),x=ue.parent(e,v),T=v[v.length-1];if(he.isText(E)&&he.isText(_))_.text+=E.text;else if(!he.isText(E)&&!he.isText(_))_.children.push(...E.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(et.stringify(E)," ").concat(et.stringify(_)));if(x.children.splice(T,1),t)for(var[S,$]of H.points(t))t[$]=we.transform(S,n);break}case"move_node":{var{path:M,newPath:N}=n;if(P.isAncestor(M,N))throw new Error("Cannot move a path [".concat(M,"] to new path [").concat(N,"] because the destination is inside itself."));var q=ue.get(e,M),w=ue.parent(e,M),A=M[M.length-1];w.children.splice(A,1);var j=P.transform(M,n),L=ue.get(e,P.parent(j)),U=j[j.length-1];if(L.children.splice(U,0,q),t)for(var[Z,G]of H.points(t))t[G]=we.transform(Z,n);break}case"remove_node":{var{path:ae}=n,C=ae[ae.length-1],z=ue.parent(e,ae);if(z.children.splice(C,1),t)for(var[Q,k]of H.points(t)){var F=we.transform(Q,n);if(t!=null&&F!=null)t[k]=F;else{var R=void 0,I=void 0;for(var[W,re]of ue.texts(e))if(P.compare(re,ae)===-1)R=[W,re];else{I=[W,re];break}var ee=!1;R&&I&&(P.equals(I[1],ae)?ee=!P.hasPrevious(I[1]):ee=P.common(R[1],ae).length<P.common(I[1],ae).length),R&&!ee?(Q.path=R[1],Q.offset=R[0].text.length):I?(Q.path=I[1],Q.offset=0):t=null}}break}case"remove_text":{var{path:ie,offset:fe,text:X}=n;if(X.length===0)break;var ve=ue.leaf(e,ie),pe=ve.text.slice(0,fe),_e=ve.text.slice(fe+X.length);if(ve.text=pe+_e,t)for(var[Fe,Te]of H.points(t))t[Te]=we.transform(Fe,n);break}case"set_node":{var{path:Ve,properties:We,newProperties:Be}=n;if(Ve.length===0)throw new Error("Cannot set properties on the root node!");var Se=ue.get(e,Ve);for(var De in Be){if(De==="children"||De==="text")throw new Error('Cannot set the "'.concat(De,'" property of nodes!'));var Ie=Be[De];Ie==null?delete Se[De]:Se[De]=Ie}for(var ze in We)Be.hasOwnProperty(ze)||delete Se[ze];break}case"set_selection":{var{newProperties:K}=n;if(K==null)t=K;else{if(t==null){if(!H.isRange(K))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(et.stringify(K)," when there is no current selection."));t=vr({},K)}for(var te in K){var le=K[te];if(le==null){if(te==="anchor"||te==="focus")throw new Error('Cannot remove the "'.concat(te,'" selection property'));delete t[te]}else t[te]=le}}break}case"split_node":{var{path:me,position:xe,properties:Ze}=n;if(me.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(me,"] because the root node cannot be split."));var Ye=ue.get(e,me),rt=ue.parent(e,me),Ht=me[me.length-1],At;if(he.isText(Ye)){var tt=Ye.text.slice(0,xe),Pt=Ye.text.slice(xe);Ye.text=tt,At=vr(vr({},Ze),{},{text:Pt})}else{var bt=Ye.children.slice(0,xe),mi=Ye.children.slice(xe);Ye.children=bt,At=vr(vr({},Ze),{},{children:mi})}if(rt.children.splice(Ht+1,0,At),t)for(var[cr,Yr]of H.points(t))t[Yr]=we.transform(cr,n);break}}return t},nv={transform(e,t){e.children=Mu(e.children);var n=e.selection&&Mu(e.selection);try{n=tv(e,n,t)}finally{e.children=Nu(e.children),n?e.selection=An(n)?Nu(n):n:e.selection=null}}},rv={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)}},av={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)}},ef=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(nt(r)&&nt(a)){if(!ef(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 iv(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 Jt(e,t){if(e==null)return{};var n=iv(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 sv=["anchor","focus"];function zu(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 ov(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zu(Object(n),!0).forEach(function(r){dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var H={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return H.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=H.edges(e);return t},equals(e,t){return we.equals(e.anchor,t.anchor)&&we.equals(e.focus,t.focus)},includes(e,t){if(H.isRange(t)){if(H.includes(e,t.anchor)||H.includes(e,t.focus))return!0;var[n,r]=H.edges(e),[a,i]=H.edges(t);return we.isBefore(n,a)&&we.isAfter(r,i)}var[s,o]=H.edges(e),l=!1,u=!1;return we.isPoint(t)?(l=we.compare(t,s)>=0,u=we.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=Jt(e,sv),[r,a]=H.edges(e),[i,s]=H.edges(t),o=we.isBefore(r,i)?i:r,l=we.isBefore(a,s)?a:s;return we.isBefore(l,o)?null:ov({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return we.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return we.equals(t,n)},isExpanded(e){return!H.isCollapsed(e)},isForward(e){return!H.isBackward(e)},isRange(e){return nt(e)&&we.isPoint(e.anchor)&&we.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=H.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return vo(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=H.isCollapsed(r);H.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?H.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=we.transform(r.anchor,t,{affinity:i}),u=we.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},qu=e=>nt(e)&&ue.isNodeList(e.children)&&!D.isEditor(e),de={isAncestor(e){return nt(e)&&ue.isNodeList(e.children)},isElement:qu,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 qu(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},uv=["children"],lv=["text"],Wu=new WeakMap,ue={ancestor(e,t){var n=ue.get(e,t);if(he.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(et.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=ue.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(he.isText(e))throw new Error("Cannot get the child of a text node: ".concat(et.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(et.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=ue.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=ue.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=ue.get(e,r);return[a,r]},descendant(e,t){var n=ue.get(e,t);if(D.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(et.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.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 ue.nodes(e,t))de.isElement(n)&&(yield[n,r])}()},extractProps(e){if(de.isAncestor(e)){var t=Jt(e,uv);return t}else{var t=Jt(e,lv);return t}},first(e,t){for(var n=t.slice(),r=ue.get(e,n);r&&!(he.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(he.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(et.stringify(e)));var n=vo({children:e.children},r=>{var[a,i]=H.edges(t),s=ue.nodes(r,{reverse:!0,pass:p=>{var[,h]=p;return!H.includes(t,h)}});for(var[,o]of s){if(!H.includes(t,o)){var l=ue.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(P.equals(o,i.path)){var d=ue.leaf(r,o);d.text=d.text.slice(0,i.offset)}if(P.equals(o,a.path)){var m=ue.leaf(r,o);m.text=m.text.slice(a.offset)}}D.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(he.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(et.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(he.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return he.isText(e)||de.isElement(e)||D.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=Wu.get(e);if(t!==void 0)return t;var n=e.every(r=>ue.isNode(r));return Wu.set(e,n),n},last(e,t){for(var n=t.slice(),r=ue.get(e,n);r&&!(he.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=ue.get(e,t);if(!he.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(et.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=ue.get(e,r);yield[a,r]}}()},matches(e,t){return de.isElement(e)&&de.isElementProps(t)&&de.matches(e,t)||he.isText(e)&&he.isTextProps(t)&&he.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?P.isBefore(o,i):P.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!he.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;P.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=ue.get(e,o);continue}if(o.length===0)break;if(!r){var d=P.next(o);if(ue.has(e,d)){o=d,l=ue.get(e,o);continue}}if(r&&o[o.length-1]!==0){var m=P.previous(o);o=m,l=ue.get(e,o);continue}o=P.parent(o),l=ue.get(e,o),s.add(l)}}()},parent(e,t){var n=P.parent(t),r=ue.get(e,n);if(he.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string(e){return he.isText(e)?e.text:e.children.map(ue.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ue.nodes(e,t))he.isText(n)&&(yield[n,r])}()}};function Uu(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 Ue(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Uu(Object(n),!0).forEach(function(r){dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Uu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ln={isNodeOperation(e){return ln.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!nt(e))return!1;switch(e.type){case"insert_node":return P.isPath(e.path)&&ue.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)&&nt(e.properties);case"move_node":return P.isPath(e.path)&&P.isPath(e.newPath);case"remove_node":return P.isPath(e.path)&&ue.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)&&nt(e.properties)&&nt(e.newProperties);case"set_selection":return e.properties===null&&H.isRange(e.newProperties)||e.newProperties===null&&H.isRange(e.properties)||nt(e.properties)&&nt(e.newProperties);case"split_node":return P.isPath(e.path)&&typeof e.position=="number"&&nt(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>ln.isOperation(t))},isSelectionOperation(e){return ln.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return ln.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Ue(Ue({},e),{},{type:"remove_node"});case"insert_text":return Ue(Ue({},e),{},{type:"remove_text"});case"merge_node":return Ue(Ue({},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 Ue(Ue({},e),{},{path:t,newPath:n});var r=P.transform(n,e),a=P.transform(P.next(n),e);return Ue(Ue({},e),{},{path:r,newPath:a})}case"remove_node":return Ue(Ue({},e),{},{type:"insert_node"});case"remove_text":return Ue(Ue({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Ue(Ue({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Ue(Ue({},e),{},{properties:l,newProperties:null}):l==null?Ue(Ue({},e),{},{properties:null,newProperties:o}):Ue(Ue({},e),{},{properties:l,newProperties:o})}case"split_node":return Ue(Ue({},e),{},{type:"merge_node",path:P.next(e.path)})}}},Hu=new WeakMap,cv=e=>{var t=Hu.get(e);if(t!==void 0)return t;if(!nt(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||nt(e.marks))&&(e.selection===null||H.isRange(e.selection))&&ue.isNodeList(e.children)&&ln.isOperationList(e.operations);return Hu.set(e,n),n},D={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 cv(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)}},dv={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 Ku(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){dt(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 we={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 we.compare(e,t)===1},isBefore(e,t){return we.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&P.equals(e.path,t.path)},isPoint(e){return nt(e)&&typeof e.offset=="number"&&P.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return vo(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,Ku(Ku({},n),{},{affinity:"forward"})))}else r.path=P.transform(i,t,n);break}}})}},Zu=void 0,et={setScrubber(e){Zu=e},stringify(e){return JSON.stringify(e,Zu)}},fv=["text"],hv=["anchor","focus"];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 Kt(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){dt(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 he={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Jt(i,fv);return s}return ef(r?a(e):e,r?a(t):t)},isText(e){return nt(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>he.isText(t))},isTextProps(e){return e.text!==void 0},matches(e,t){for(var n in t)if(n!=="text"&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[Kt({},e)];for(var r of t){var a=Jt(r,hv),[i,s]=H.edges(r),o=[],l=0,u=i.offset,d=s.offset;for(var m of n){var{length:p}=m.text,h=l;if(l+=p,u<=h&&l<=d){Object.assign(m,a),o.push(m);continue}if(u!==d&&(u===l||d===h)||u>l||d<h||d===h&&h!==0){o.push(m);continue}var g=m,f=void 0,b=void 0;if(d<l){var v=d-h;b=Kt(Kt({},g),{},{text:g.text.slice(v)}),g=Kt(Kt({},g),{},{text:g.text.slice(0,v)})}if(u>h){var E=u-h;f=Kt(Kt({},g),{},{text:g.text.slice(0,E)}),g=Kt(Kt({},g),{},{text:g.text.slice(E)})}Object.assign(g,a),f&&o.push(f),o.push(g),b&&o.push(b)}n=o}return n}},bo=e=>e.selection?e.selection:e.children.length>0?D.end(e,[]):[0],lr=(e,t)=>{var[n]=D.node(e,t);return r=>r===n},yo=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?yv(t):t,i=Ce.None,s=Ce.None,o=0,l=null,u=null;for(var d of a){var m=d.codePointAt(0);if(!m)break;var p=Sv(d,m);if([i,s]=r?[s,p]:[p,i],Vn(i,Ce.ZWJ)&&Vn(s,Ce.ExtPict)&&(r?l=Gu(t.substring(0,o)):l=Gu(t.substring(0,t.length-o)),!l)||Vn(i,Ce.RI)&&Vn(s,Ce.RI)&&(u!==null?u=!u:r?u=!0:u=Nv(t.substring(0,t.length-o)),!u)||i!==Ce.None&&s!==Ce.None&&Ov(i,s))break;o+=d.length}return o||1},mv=/\s/,pv=/[\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]/,gv=/['\u2018\u2019]/,vv=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=yo(t,n),[s,o]=Do(t,i,n);if(bv(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Do=(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)]},bv=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(mv.test(t))return!1;if(gv.test(t)){var a=yo(n,r),[i,s]=Do(n,a,r);if(e(i,s,r))return!0}return!pv.test(t)},yv=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(Cv(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(Dv(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},Dv=e=>e>=55296&&e<=56319,Cv=e=>e>=56320&&e<=57343,Ce;(function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"})(Ce||(Ce={}));var xv=/^(?:[\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])$/,wv=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,Ev=/^(?:[\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])$/,_v=/^[\u1100-\u115F\uA960-\uA97C]$/,kv=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,Fv=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,Bv=/^[\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]$/,Av=/^[\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]$/,Tv=/^(?:[\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])$/,Sv=(e,t)=>{var n=Ce.Any;return e.search(xv)!==-1&&(n|=Ce.Extend),t===8205&&(n|=Ce.ZWJ),t>=127462&&t<=127487&&(n|=Ce.RI),e.search(wv)!==-1&&(n|=Ce.Prepend),e.search(Ev)!==-1&&(n|=Ce.SpacingMark),e.search(_v)!==-1&&(n|=Ce.L),e.search(kv)!==-1&&(n|=Ce.V),e.search(Fv)!==-1&&(n|=Ce.T),e.search(Bv)!==-1&&(n|=Ce.LV),e.search(Av)!==-1&&(n|=Ce.LVT),e.search(Tv)!==-1&&(n|=Ce.ExtPict),n};function Vn(e,t){return(e&t)!==0}var jv=[[Ce.L,Ce.L|Ce.V|Ce.LV|Ce.LVT],[Ce.LV|Ce.V,Ce.V|Ce.T],[Ce.LVT|Ce.T,Ce.T],[Ce.Any,Ce.Extend|Ce.ZWJ],[Ce.Any,Ce.SpacingMark],[Ce.Prepend,Ce.Any],[Ce.ZWJ,Ce.ExtPict],[Ce.RI,Ce.RI]];function Ov(e,t){return jv.findIndex(n=>Vn(e,n[0])&&Vn(t,n[1]))===-1}var Pv=/(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC01\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDE41\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4\uDF00\uDF01\uDF36-\uDF3A\uDF40\uDF42]|\uD80D[\uDC40\uDC47-\uDC55]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])*\u200D$/,Gu=e=>e.search(Pv)!==-1,Mv=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Nv=e=>{var t=e.match(Mv);if(t===null)return!1;var n=t[0].length/2;return n%2===1},Iv={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]:{};D.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=bo(e)}=n;if(P.isPath(a)&&(a=D.range(e,a)),H.isRange(a))if(H.isCollapsed(a))a=a.anchor;else{var i=H.end(a);if(!r&&D.void(e,{at:i}))return;var s=H.start(a),o=D.pointRef(e,s),l=D.pointRef(e,i);J.delete(e,{at:a,voids:r});var u=o.unref(),d=l.unref();a=u||d,J.setSelection(e,{anchor:a,focus:a})}if(!(!r&&D.void(e,{at:a})||D.elementReadOnly(e,{at:a}))){var{path:m,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:m,offset:p,text:t})}})}};function Qu(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 sa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Qu(Object(n),!0).forEach(function(r){dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var J=sa(sa(sa(sa({},nv),rv),av),Iv),wa=new WeakMap,Rv=e=>wa.get(e)||!1,$v=(e,t,n)=>{var r=wa.get(e)||!1;wa.set(e,!0);try{t(),n()}finally{wa.set(e,r)}};function tf(e,t,n){var r=La.get(e)||[],a=za.get(e)||new Set,i,s,o=m=>{if(m){var p=m.join(",");s.has(p)||(s.add(p),i.push(m))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var d of t)o(d);La.set(e,i),za.set(e,s)}var Lv=(e,t)=>{for(var n of D.pathRefs(e))Gg.transform(n,t);for(var r of D.pointRefs(e))Qg.transform(r,t);for(var a of D.rangeRefs(e))Jg.transform(a,t);if(!Rv(e)){var i=P.operationCanTransformPath(t)?s=>P.transform(s,t):void 0;tf(e,e.getDirtyPaths(t),i)}J.transform(e,t),e.operations.push(t),D.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),Er.get(e)||(Er.set(e,!0),Promise.resolve().then(()=>{Er.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},zv=(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=he.isText(r)?[]:Array.from(ue.nodes(r),N=>{var[,q]=N;return a.concat(q)});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:m}=t;if(P.equals(d,m))return[];var p=[],h=[];for(var g of P.ancestors(d)){var f=P.transform(g,t);p.push(f)}for(var b of P.ancestors(m)){var v=P.transform(b,t);h.push(v)}var E=h[h.length-1],B=m[m.length-1],_=E.concat(B);return[...p,...h,_]}case"remove_node":{var{path:x}=t,T=P.ancestors(x);return[...T]}case"split_node":{var{path:S}=t,$=P.levels(S),M=P.next(S);return[...$,M]}default:return[]}},qv=e=>{var{selection:t}=e;return t?ue.fragment(e,t):[]},Wv=(e,t)=>{var[n,r]=t;if(!he.isText(n)){if(de.isElement(n)&&n.children.length===0){var a={text:""};J.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=D.isEditor(n)?!1:de.isElement(n)&&(e.isInline(n)||n.children.length===0||he.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=ue.get(e,r);if(!he.isText(l)){var u=l.children[s],d=l.children[s-1],m=o===n.children.length-1,p=he.isText(u)||de.isElement(u)&&e.isInline(u);if(p!==i)J.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(de.isElement(u)){if(e.isInline(u)){if(d==null||!he.isText(d)){var h={text:""};J.insertNodes(e,h,{at:r.concat(s),voids:!0}),s++}else if(m){var g={text:""};J.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&he.isText(d)&&(he.equals(u,d,{loose:!0})?(J.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(J.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(J.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Uv=(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},Hv=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=D.path(t,i),l=a==="lowest";for(var[u,d]of D.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!he.isText(u)){if(H.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 Ju(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Xu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ju(Object(n),!0).forEach(function(r){dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ju(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Vv=(e,t,n)=>{var{selection:r}=e;if(r){var a=(m,p)=>{if(!he.isText(m))return!1;var[h,g]=D.parent(e,p);return!e.isVoid(h)||e.markableVoid(h)},i=H.isExpanded(r),s=!1;if(!i){var[o,l]=D.node(e,r);if(o&&a(o,l)){var[u]=D.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)J.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var d=Xu(Xu({},D.marks(e)||{}),{},{[t]:n});e.marks=d,Er.get(e)||e.onChange()}}};function el(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function tl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?el(Object(n),!0).forEach(function(r){dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):el(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Kv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.point(t,n,{edge:"end"}),i=D.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of D.positions(t,tl(tl({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};function nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function rl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nl(Object(n),!0).forEach(function(r){dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Zv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.start(t,[]),i=D.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of D.positions(t,rl(rl({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},Yv=(e,t)=>{var{selection:n}=e;n&&H.isCollapsed(n)&&J.delete(e,{unit:t,reverse:!0})},Gv=(e,t)=>{var{selection:n}=e;n&&H.isCollapsed(n)&&J.delete(e,{unit:t})},Qv=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&H.isExpanded(r)&&J.delete(t,{reverse:n==="backward"})},Jv=(e,t)=>[D.start(e,t),D.end(e,t)];function al(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 il(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?al(Object(n),!0).forEach(function(r){dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):al(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Xv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.above(t,il(il({},n),{},{match:r=>de.isElement(r)&&D.isElementReadOnly(t,r)}))},e0=(e,t)=>D.point(e,t,{edge:"end"}),t0=(e,t)=>{var n=D.path(e,t,{edge:"start"});return D.node(e,n)},n0=(e,t)=>{var n=D.range(e,t);return ue.fragment(e,n)};function sl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ol(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){dt(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 r0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return D.above(t,ol(ol({},n),{},{match:r=>de.isElement(r)&&D.isVoid(t,r)}))},a0=(e,t)=>t.children.some(n=>de.isElement(n)&&D.isBlock(e,n)),i0=(e,t)=>t.children.some(n=>he.isText(n)||D.isInline(e,n)),s0=(e,t)=>ue.has(e,t),o0=(e,t)=>t.children.every(n=>he.isText(n)),u0=e=>{J.splitNodes(e,{always:!0})},l0=(e,t,n)=>{J.insertNodes(e,t,n)},c0=e=>{J.splitNodes(e,{always:!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 d0(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){dt(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 f0=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=d0({text:n},i);J.insertNodes(t,s,{at:r.at,voids:r.voids})}else J.insertText(t,n,r);t.marks=null}},h0=(e,t)=>!e.isInline(t),m0=(e,t,n)=>D.isStart(e,t,n)||D.isEnd(e,t,n),p0=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&he.isText(r)&&r.text===""&&!e.isVoid(t)},g0=(e,t,n)=>{var r=D.end(e,n);return we.equals(t,r)},v0=e=>{var t=Xd.get(e);return t===void 0?!0:t},b0=(e,t,n)=>{if(t.offset!==0)return!1;var r=D.start(e,n);return we.equals(t,r)},y0=(e,t)=>{var n=D.path(e,t,{edge:"end"});return D.node(e,n)},D0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=ue.leaf(t,a);return[i,a]};function C0(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=D.path(e,n);for(var[l,u]of ue.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&de.isElement(l)&&D.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var x0=["text"],w0=["text"],E0=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(H.isExpanded(r)){var s=D.isEnd(t,a,a.path);if(s){var o=D.after(t,a);o&&(a=o)}var[l]=D.nodes(t,{match:he.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,d=Jt(u,x0);return d}else return{}}var{path:m}=a,[p]=D.leaf(t,m);if(a.offset===0){var h=D.previous(t,{at:m,match:he.isText}),g=D.above(t,{match:_=>de.isElement(_)&&D.isVoid(t,_)&&t.markableVoid(_)});if(!g){var f=D.above(t,{match:_=>de.isElement(_)&&D.isBlock(t,_)});if(h&&f){var[b,v]=h,[,E]=f;P.isAncestor(E,v)&&(p=b)}}}var B=Jt(p,w0);return B},_0=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=D.after(t,s,{voids:a});if(o){var[,l]=D.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]=D.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[m]=D.nodes(t,{at:u,match:i,mode:r,voids:a});return m}}},k0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=ue.get(t,a);return[i,a]};function F0(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(dv.isSpan(n))u=n[0],d=n[1];else{var m=D.path(e,n,{edge:"start"}),p=D.path(e,n,{edge:"end"});u=i?p:m,d=i?m:p}var h=ue.nodes(e,{reverse:i,from:u,to:d,pass:_=>{var[x]=_;return de.isElement(x)?!!(!s&&(D.isVoid(e,x)||D.isElementReadOnly(e,x))||o&&!D.isSelectable(e,x)):!1}}),g=[],f;for(var[b,v]of h)if(!(o&&de.isElement(b)&&!D.isSelectable(e,b))){var E=f&&P.compare(v,f[1])===0;if(!(r==="highest"&&E)){if(!l(b,v)){if(a&&!E&&he.isText(b))return;continue}if(r==="lowest"&&E){f=[b,v];continue}var B=r==="lowest"?f:[b,v];B&&(a?g.push(B):yield B),f=[b,v]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var B0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=d=>La.get(d)||[],s=d=>za.get(d)||new Set,o=d=>{var m=i(d).pop(),p=m.join(",");return s(d).delete(p),m};if(D.isNormalizing(t)){if(r){var l=Array.from(ue.nodes(t),d=>{var[,m]=d;return m}),u=new Set(l.map(d=>d.join(",")));La.set(t,l),za.set(t,u)}i(t).length!==0&&D.withoutNormalizing(t,()=>{for(var d of i(t))if(ue.has(t,d)){var m=D.node(t,d),[p,h]=m;de.isElement(p)&&p.children.length===0&&t.normalizeNode(m,{operation:a})}for(var g=i(t),f=g.length,b=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:b,initialDirtyPathsLength:f,operation:a}))return;var v=o(t);if(ue.has(t,v)){var E=D.node(t,v);t.normalizeNode(E,{operation:a})}b++,g=i(t)}})}},A0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=D.path(t,n,r),i=P.parent(a),s=D.node(t,i);return s},T0=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=D.pathRefs(t);return l.delete(i),i.current=null,o}},s=D.pathRefs(t);return s.add(i),i},S0=e=>{var t=Iu.get(e);return t||(t=new Set,Iu.set(e,t)),t},j0=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]=ue.first(t,n);n=s}else if(i==="end"){var[,o]=ue.last(t,n);n=o}}return H.isRange(n)&&(i==="start"?n=H.start(n):i==="end"?n=H.end(n):n=P.common(n.anchor.path,n.focus.path)),we.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},O0=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=D.pointRefs(t);return l.delete(i),i.current=null,o}},s=D.pointRefs(t);return s.add(i),i},P0=e=>{var t=Ru.get(e);return t||(t=new Set,Ru.set(e,t)),t},M0=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]=ue.last(t,n);i=s}else{var[,o]=ue.first(t,n);i=o}var l=ue.get(t,i);if(!he.isText(l))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?l.text.length:0}}if(H.isRange(n)){var[u,d]=H.edges(n);return a==="start"?u:d}return n};function N0(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=D.range(e,n),[l,u]=H.edges(o),d=a?u:l,m=!1,p="",h=0,g=0,f=0;for(var[b,v]of D.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(b)){if(!i&&(e.isVoid(b)||e.isElementReadOnly(b))){yield D.start(e,v);continue}if(e.isInline(b))continue;if(D.hasInlines(e,b)){var E=P.isAncestor(v,u.path)?u:D.end(e,v),B=P.isAncestor(v,l.path)?l:D.start(e,v);p=D.string(e,{anchor:B,focus:E},{voids:i}),m=!0}}if(he.isText(b)){var _=P.equals(v,d.path);for(_?(g=a?d.offset:b.text.length-d.offset,f=d.offset):(g=b.text.length,f=a?g:0),(_||m||r==="offset")&&(yield{path:v,offset:f},m=!1);;){if(h===0){if(p==="")break;h=x(p,r,a),p=Do(p,h,a)[1]}if(f=a?f-h:f+h,g=g-h,g<0){h=-g;break}h=0,yield{path:v,offset:f}}}}function x(T,S,$){return S==="character"?yo(T,$):S==="word"?vv(T,$):S==="line"||S==="block"?T.length:1}}()}var I0=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=D.before(t,s,{voids:a});if(o){var[,l]=D.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]=D.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[m]=D.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return m}}},R0=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=D.rangeRefs(t);return l.delete(i),i.current=null,o}},s=D.rangeRefs(t);return s.add(i),i},$0=e=>{var t=$u.get(e);return t||(t=new Set,$u.set(e,t)),t},L0=(e,t,n)=>{if(H.isRange(t)&&!n)return t;var r=D.start(e,t),a=D.end(e,n||t);return{anchor:r,focus:a}};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 z0(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){dt(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 q0=(e,t)=>{var{selection:n}=e;if(n){var r=(d,m)=>{if(!he.isText(d))return!1;var[p,h]=D.parent(e,m);return!e.isVoid(p)||e.markableVoid(p)},a=H.isExpanded(n),i=!1;if(!a){var[s,o]=D.node(e,n);if(s&&r(s,o)){var[l]=D.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)J.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=z0({},D.marks(e)||{});delete u[t],e.marks=u,Er.get(e)||e.onChange()}}},W0=(e,t)=>{Xd.set(e,t)},U0=(e,t)=>D.point(e,t,{edge:"start"}),H0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=D.range(t,n),[s,o]=H.edges(i),l="";for(var[u,d]of D.nodes(t,{at:i,match:he.isText,voids:a})){var m=u.text;P.equals(d,o.path)&&(m=m.slice(0,o.offset)),P.equals(d,s.path)&&(m=m.slice(s.offset)),l+=m}return l},V0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=H.edges(n);if(i.offset!==0||s.offset!==0||H.isCollapsed(n)||P.hasPrevious(s.path))return n;var o=D.above(t,{at:s,match:g=>de.isElement(g)&&D.isBlock(t,g),voids:a}),l=o?o[1]:[],u=D.start(t,i),d={anchor:u,focus:s},m=!0;for(var[p,h]of D.nodes(t,{at:d,match:he.isText,reverse:!0,voids:a})){if(m){m=!1;continue}if(p.text!==""||P.isBefore(h,l)){s={path:h,offset:p.text.length};break}}return{anchor:i,focus:s}},K0=(e,t)=>{var n=D.isNormalizing(e);D.setNormalizing(e,!1);try{t()}finally{D.setNormalizing(e,n)}D.normalize(e)},Z0=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:d=!1}=n;if(u){var m=!1;if(H.isRange(u)&&H.isCollapsed(u)&&(m=!0,u=u.anchor),we.isPoint(u)){var p=D.void(t,{at:u,mode:"highest"});if(!l&&p){var[,h]=p;u=h}else{var g={unit:s,distance:o},f=i?D.before(t,u,g)||D.start(t,[]):D.after(t,u,g)||D.end(t,[]);u={anchor:u,focus:f},d=!0}}if(P.isPath(u)){J.removeNodes(t,{at:u,voids:l});return}if(!H.isCollapsed(u)){if(!d){var[,b]=H.edges(u),v=D.end(t,[]);we.equals(b,v)||(u=D.unhangRange(t,u,{voids:l}))}var[E,B]=H.edges(u),_=D.above(t,{match:pe=>de.isElement(pe)&&D.isBlock(t,pe),at:E,voids:l}),x=D.above(t,{match:pe=>de.isElement(pe)&&D.isBlock(t,pe),at:B,voids:l}),T=_&&x&&!P.equals(_[1],x[1]),S=P.equals(E.path,B.path),$=l?null:(r=D.void(t,{at:E,mode:"highest"}))!==null&&r!==void 0?r:D.elementReadOnly(t,{at:E,mode:"highest"}),M=l?null:(a=D.void(t,{at:B,mode:"highest"}))!==null&&a!==void 0?a:D.elementReadOnly(t,{at:B,mode:"highest"});if($){var N=D.before(t,E);N&&_&&P.isAncestor(_[1],N.path)&&(E=N)}if(M){var q=D.after(t,B);q&&x&&P.isAncestor(x[1],q.path)&&(B=q)}var w=[],A;for(var j of D.nodes(t,{at:u,voids:l})){var[L,U]=j;A&&P.compare(U,A)===0||(!l&&de.isElement(L)&&(D.isVoid(t,L)||D.isElementReadOnly(t,L))||!P.isCommon(U,E.path)&&!P.isCommon(U,B.path))&&(w.push(j),A=U)}var Z=Array.from(w,pe=>{var[,_e]=pe;return D.pathRef(t,_e)}),G=D.pointRef(t,E),ae=D.pointRef(t,B),C="";if(!S&&!$){var z=G.current,[Q]=D.leaf(t,z),{path:k}=z,{offset:F}=E,R=Q.text.slice(F);R.length>0&&(t.apply({type:"remove_text",path:k,offset:F,text:R}),C=R)}if(Z.reverse().map(pe=>pe.unref()).filter(pe=>pe!==null).forEach(pe=>J.removeNodes(t,{at:pe,voids:l})),!M){var I=ae.current,[W]=D.leaf(t,I),{path:re}=I,ee=S?E.offset:0,ie=W.text.slice(ee,B.offset);ie.length>0&&(t.apply({type:"remove_text",path:re,offset:ee,text:ie}),C=ie)}!S&&T&&ae.current&&G.current&&J.mergeNodes(t,{at:ae.current,hanging:!0,voids:l}),m&&i&&s==="character"&&C.length>1&&C.match(/[\u0E00-\u0E7F]+/)&&J.insertText(t,C.slice(0,C.length-o));var fe=G.unref(),X=ae.unref(),ve=i?fe||X:X||fe;n.at==null&&ve&&J.select(t,ve)}}})},Y0=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=bo(t),batchDirty:o=!0}=r;if(n.length){if(H.isRange(s))if(a||(s=D.unhangRange(t,s,{voids:i})),H.isCollapsed(s))s=s.anchor;else{var[,l]=H.edges(s);if(!i&&D.void(t,{at:l}))return;var u=D.pointRef(t,l);J.delete(t,{at:s}),s=u.unref()}else P.isPath(s)&&(s=D.start(t,s));if(!(!i&&D.void(t,{at:s}))){var d=D.above(t,{at:s,match:R=>de.isElement(R)&&D.isInline(t,R),mode:"highest",voids:i});if(d){var[,m]=d;if(D.isEnd(t,s,m)){var p=D.after(t,m);s=p}else if(D.isStart(t,s,m)){var h=D.before(t,m);s=h}}var g=D.above(t,{match:R=>de.isElement(R)&&D.isBlock(t,R),at:s,voids:i}),[,f]=g,b=D.isStart(t,s,f),v=D.isEnd(t,s,f),E=b&&v,B=!b||b&&v,_=!v,[,x]=ue.first({children:n},[]),[,T]=ue.last({children:n},[]),S=[],$=R=>{var[I,W]=R,re=W.length===0;return re?!1:E?!0:!(B&&P.isAncestor(W,x)&&de.isElement(I)&&!t.isVoid(I)&&!t.isInline(I)||_&&P.isAncestor(W,T)&&de.isElement(I)&&!t.isVoid(I)&&!t.isInline(I))};for(var M of ue.nodes({children:n},{pass:$}))$(M)&&S.push(M);var N=[],q=[],w=[],A=!0,j=!1;for(var[L]of S)de.isElement(L)&&!t.isInline(L)?(A=!1,j=!0,q.push(L)):A?N.push(L):w.push(L);var[U]=D.nodes(t,{at:s,match:R=>he.isText(R)||D.isInline(t,R),mode:"highest",voids:i}),[,Z]=U,G=D.isStart(t,s,Z),ae=D.isEnd(t,s,Z),C=D.pathRef(t,v&&!w.length?P.next(f):f),z=D.pathRef(t,ae?P.next(Z):Z);J.splitNodes(t,{at:s,match:R=>j?de.isElement(R)&&D.isBlock(t,R):he.isText(R)||D.isInline(t,R),mode:j?"lowest":"highest",always:j&&(!b||N.length>0)&&(!v||w.length>0),voids:i});var Q=D.pathRef(t,!G||G&&ae?P.next(Z):Z);if(J.insertNodes(t,N,{at:Q.current,match:R=>he.isText(R)||D.isInline(t,R),mode:"highest",voids:i,batchDirty:o}),E&&!N.length&&q.length&&!w.length&&J.delete(t,{at:f,voids:i}),J.insertNodes(t,q,{at:C.current,match:R=>de.isElement(R)&&D.isBlock(t,R),mode:"lowest",voids:i,batchDirty:o}),J.insertNodes(t,w,{at:z.current,match:R=>he.isText(R)||D.isInline(t,R),mode:"highest",voids:i,batchDirty:o}),!r.at){var k;if(w.length>0&&z.current?k=P.previous(z.current):q.length>0&&C.current?k=P.previous(C.current):Q.current&&(k=P.previous(Q.current)),k){var F=D.end(t,k);J.select(t,F)}}Q.unref(),C.unref(),z.unref()}}})},G0=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")J.select(t,a.anchor);else if(r==="focus")J.select(t,a.focus);else if(r==="start"){var[i]=H.edges(a);J.select(t,i)}else if(r==="end"){var[,s]=H.edges(a);J.select(t,s)}}else return},Q0=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},J0=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=H.isBackward(r)?"focus":"anchor"),o==="end"&&(o=H.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:a,unit:i,ignoreNonSelectable:!0},m={};if(o==null||o==="anchor"){var p=s?D.before(t,l,d):D.after(t,l,d);p&&(m.anchor=p)}if(o==null||o==="focus"){var h=s?D.before(t,u,d):D.after(t,u,d);h&&(m.focus=h)}J.setSelection(t,m)}},X0=(e,t)=>{var{selection:n}=e;if(t=D.range(e,t),n){J.setSelection(e,t);return}if(!H.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(et.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};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 dl(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){dt(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 eb=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=H.isBackward(a)?"focus":"anchor"),i==="end"&&(i=H.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;J.setSelection(t,{[i==="anchor"?"anchor":"focus"]:dl(dl({},l),n)})}},tb=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!we.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!we.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})}},nb=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:d}=r;if(ue.isNode(n)&&(n=[n]),n.length!==0){var[m]=n;if(l||(l=bo(t),d!==!1&&(d=!0)),d==null&&(d=!1),H.isRange(l))if(a||(l=D.unhangRange(t,l,{voids:i})),H.isCollapsed(l))l=l.anchor;else{var[,p]=H.edges(l),h=D.pointRef(t,p);J.delete(t,{at:l}),l=h.unref()}if(we.isPoint(l)){u==null&&(he.isText(m)?u=N=>he.isText(N):t.isInline(m)?u=N=>he.isText(N)||D.isInline(t,N):u=N=>de.isElement(N)&&D.isBlock(t,N));var[g]=D.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,b=D.pathRef(t,f),v=D.isEnd(t,l,f);J.splitNodes(t,{at:l,match:u,mode:s,voids:i});var E=b.unref();l=v?P.next(E):E}else return}var B=P.parent(l),_=l[l.length-1];if(!(!i&&D.void(t,{at:B}))){if(o){var x=[],T=P.levels(B);$v(t,()=>{var N=function(){var A=B.concat(_);_++;var j={type:"insert_node",path:A,node:q};t.apply(j),l=P.next(l),x.push(j),he.isText?T.push(...Array.from(ue.nodes(q),L=>{var[,U]=L;return A.concat(U)})):T.push(A)};for(var q of n)N()},()=>{tf(t,T,N=>{var q=N;for(var w of x)if(P.operationCanTransformPath(w)&&(q=P.transform(q,w),!q))return null;return q})})}else for(var S of n){var $=B.concat(_);_++,t.apply({type:"insert_node",path:$,node:S}),l=P.next(l)}if(l=P.previous(l),d){var M=D.end(t,l);M&&J.select(t,M)}}}})},rb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=P.isPath(r)?lr(t,r):_=>de.isElement(_)&&D.isBlock(t,_)),!!r){var o=D.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,_=>{var[,x]=_;return D.pathRef(t,x)});for(var u of l){var d=u.unref();if(d.length<2)throw new Error("Cannot lift node at a path [".concat(d,"] because it has a depth of less than `2`."));var m=D.node(t,P.parent(d)),[p,h]=m,g=d[d.length-1],{length:f}=p.children;if(f===1){var b=P.next(h);J.moveNodes(t,{at:d,to:b,voids:i}),J.removeNodes(t,{at:h,voids:i})}else if(g===0)J.moveNodes(t,{at:d,to:h,voids:i});else if(g===f-1){var v=P.next(h);J.moveNodes(t,{at:d,to:v,voids:i})}else{var E=P.next(d),B=P.next(h);J.splitNodes(t,{at:E,voids:i}),J.moveNodes(t,{at:d,to:B,voids:i})}}}})},ab=["text"],ib=["children"],nf=(e,t)=>{if(de.isElement(t)){var n=t;return D.isVoid(e,t)?!0:n.children.length===1?nf(e,n.children[0]):!1}else return!D.isEditor(t)},sb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.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]=D.parent(t,a);r=N=>l.children.includes(N)}else r=N=>de.isElement(N)&&D.isBlock(t,N);if(!i&&H.isRange(a)&&(a=D.unhangRange(t,a,{voids:s})),H.isRange(a))if(H.isCollapsed(a))a=a.anchor;else{var[,u]=H.edges(a),d=D.pointRef(t,u);J.delete(t,{at:a}),a=d.unref(),n.at==null&&J.select(t,a)}var[m]=D.nodes(t,{at:a,match:r,voids:s,mode:o}),p=D.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!m||!p)){var[h,g]=m,[f,b]=p;if(!(g.length===0||b.length===0)){var v=P.next(b),E=P.common(g,b),B=P.isSibling(g,b),_=Array.from(D.levels(t,{at:g}),N=>{var[q]=N;return q}).slice(E.length).slice(0,-1),x=D.above(t,{at:g,mode:"highest",match:N=>_.includes(N)&&nf(t,N)}),T=x&&D.pathRef(t,x[1]),S,$;if(he.isText(h)&&he.isText(f)){var M=Jt(h,ab);$=f.text.length,S=M}else if(de.isElement(h)&&de.isElement(f)){var M=Jt(h,ib);$=f.children.length,S=M}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(et.stringify(h)," ").concat(et.stringify(f)));B||J.moveNodes(t,{at:g,to:v,voids:s}),T&&J.removeNodes(t,{at:T.current,voids:s}),de.isElement(f)&&D.isEmpty(t,f)||he.isText(f)&&f.text===""&&b[b.length-1]!==0?J.removeNodes(t,{at:b,voids:s}):t.apply({type:"merge_node",path:v,position:$,properties:S}),T&&T.unref()}}}})},ob=(e,t)=>{D.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)?lr(e,r):h=>de.isElement(h)&&D.isBlock(e,h));var o=D.pathRef(e,n),l=D.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,h=>{var[,g]=h;return D.pathRef(e,g)});for(var d of u){var m=d.unref(),p=o.current;m.length!==0&&e.apply({type:"move_node",path:m,newPath:p}),o.current&&P.isSibling(p,m)&&P.isAfter(p,m)&&(o.current=P.next(o.current))}o.unref()}})},ub=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.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)?lr(t,s):h=>de.isElement(h)&&D.isBlock(t,h)),!r&&H.isRange(s)&&(s=D.unhangRange(t,s,{voids:a}));var l=D.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,h=>{var[,g]=h;return D.pathRef(t,g)});for(var d of u){var m=d.unref();if(m){var[p]=D.node(t,m);t.apply({type:"remove_node",path:m,node:p})}}}})},lb=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:d=!1,voids:m=!1}=r;if(i){if(a==null&&(a=P.isPath(i)?lr(t,i):$=>de.isElement($)&&D.isBlock(t,$)),!l&&H.isRange(i)&&(i=D.unhangRange(t,i,{voids:m})),d&&H.isRange(i)){if(H.isCollapsed(i)&&D.leaf(t,i.anchor)[0].text.length>0)return;var p=D.rangeRef(t,i,{affinity:"inward"}),[h,g]=H.edges(i),f=u==="lowest"?"lowest":"highest",b=D.isEnd(t,g,g.path);J.splitNodes(t,{at:g,match:a,mode:f,voids:m,always:!b});var v=D.isStart(t,h,h.path);J.splitNodes(t,{at:h,match:a,mode:f,voids:m,always:!v}),i=p.unref(),r.at==null&&J.select(t,i)}s||(s=($,M)=>$!==M);for(var[E,B]of D.nodes(t,{at:i,match:a,mode:u,voids:m})){var _={},x={};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)&&(_[S]=E[S]),o?n[S]!=null&&(x[S]=o(E[S],n[S])):n[S]!=null&&(x[S]=n[S]));T&&t.apply({type:"set_node",path:B,properties:_,newProperties:x})}}}})},cb=(e,t)=>{if(H.isCollapsed(t))return t.anchor;var[,n]=H.edges(t),r=D.pointRef(e,n);return J.delete(e,{at:t}),r.unref()},db=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.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)&&D.isBlock(t,ae)),H.isRange(s)&&(s=cb(t,s)),P.isPath(s)){var u=s,d=D.point(t,u),[m]=D.parent(t,u);i=ae=>ae===m,o=d.path.length-u.length+1,s=d,l=!0}if(s){var p=D.pointRef(t,s,{affinity:"backward"}),h;try{var[g]=D.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=D.void(t,{at:s,mode:"highest"}),b=0;if(!a&&f){var[v,E]=f;if(de.isElement(v)&&t.isInline(v)){var B=D.after(t,E);if(!B){var _={text:""},x=P.next(E);J.insertNodes(t,_,{at:x,voids:a}),B=D.point(t,x)}s=B,l=!0}var T=s.path.length-E.length;o=T+1,l=!0}h=D.pointRef(t,s);var S=s.path.length-o,[,$]=g,M=s.path.slice(0,S),N=o===0?s.offset:s.path[S]+b;for(var[q,w]of D.levels(t,{at:M,reverse:!0,voids:a})){var A=!1;if(w.length<$.length||w.length===0||!a&&de.isElement(q)&&D.isVoid(t,q))break;var j=p.current,L=D.isEnd(t,j,w);if(l||!p||!D.isEdge(t,j,w)){A=!0;var U=ue.extractProps(q);t.apply({type:"split_node",path:w,position:N,properties:U})}N=w[w.length-1]+(A||L?1:0)}if(n.at==null){var Z=h.current||D.end(t,[]);J.select(t,Z)}}finally{var G;p.unref(),(G=h)===null||G===void 0||G.unref()}}})},fb=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;J.setNodes(t,a,r)},hb=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};D.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)?lr(t,s):h=>de.isElement(h)&&D.isBlock(t,h)),P.isPath(s)&&(s=D.range(t,s));var l=H.isRange(s)?D.rangeRef(t,s):null,u=D.nodes(t,{at:s,match:o,mode:r,voids:i}),d=Array.from(u,h=>{var[,g]=h;return D.pathRef(t,g)}).reverse(),m=function(){var g=p.unref(),[f]=D.node(t,g),b=D.range(t,g);a&&l&&(b=H.intersection(l.current,b)),J.liftNodes(t,{at:b,match:v=>de.isAncestor(f)&&f.children.includes(v),voids:i})};for(var p of d)m();l&&l.unref()}})};function fl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function hl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fl(Object(n),!0).forEach(function(r){dt(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 mb=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D.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=lr(t,l):t.isInline(n)?o=b=>de.isElement(b)&&D.isInline(t,b)||he.isText(b):o=b=>de.isElement(b)&&D.isBlock(t,b)),i&&H.isRange(l)){var[u,d]=H.edges(l),m=D.rangeRef(t,l,{affinity:"inward"});J.splitNodes(t,{at:d,match:o,voids:s}),J.splitNodes(t,{at:u,match:o,voids:s}),l=m.unref(),r.at==null&&J.select(t,l)}var p=Array.from(D.nodes(t,{at:l,match:t.isInline(n)?b=>de.isElement(b)&&D.isBlock(t,b):b=>D.isEditor(b),mode:"lowest",voids:s})),h=function(){var v=H.isRange(l)?H.intersection(l,D.range(t,f)):l;if(!v)return 0;var E=Array.from(D.nodes(t,{at:v,match:o,mode:a,voids:s}));if(E.length>0){var[B]=E,_=E[E.length-1],[,x]=B,[,T]=_;if(x.length===0&&T.length===0)return 0;var S=P.equals(x,T)?P.parent(x):P.common(x,T),$=D.range(t,x,T),M=D.node(t,S),[N]=M,q=S.length+1,w=P.next(T.slice(0,q)),A=hl(hl({},n),{},{children:[]});J.insertNodes(t,A,{at:w,voids:s}),J.moveNodes(t,{at:$,match:j=>de.isAncestor(N)&&N.children.includes(j),to:w.concat(0),voids:s})}},g;for(var[,f]of p)g=h()}})},pb=()=>{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 Lv(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vv(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yv(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gv(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qv(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qv(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return u0(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return c0(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Y0(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return l0(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return f0(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wv(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return q0(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zv(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Uv(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hv(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kv(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zv(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return G0(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Z0(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Q0(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jv(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xv(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return e0(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t0(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return n0(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return E0(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return a0(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return i0(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return s0(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return o0(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nb(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return h0(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return m0(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return p0(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return g0(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return v0(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return b0(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return y0(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return D0(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return C0(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rb(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sb(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return J0(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ob(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _0(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return k0(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return F0(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return B0(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return A0(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return j0(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return T0(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return S0(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return M0(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return O0(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return P0(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return N0(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return I0(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return L0(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return R0(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $0(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ub(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return X0(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lb(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return W0(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eb(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tb(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return db(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return U0(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return H0(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return V0(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fb(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hb(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return r0(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return K0(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mb(e,...r)}};return e},gb={isHistory(e){return nt(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||ln.isOperationList(e.redos[0].operations))&&(e.undos.length===0||ln.isOperationList(e.undos[0].operations))}},Pi=new WeakMap,Mi=new WeakMap,Kn={isHistoryEditor(e){return gb.isHistory(e.history)&&D.isEditor(e)},isMerging(e){return Mi.get(e)},isSaving(e){return Pi.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Kn.isMerging(e);Mi.set(e,!1),t(),Mi.set(e,n)},withoutSaving(e,t){var n=Kn.isSaving(e);Pi.set(e,!1),t(),Pi.set(e,n)}},vb=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&&J.setSelection(t,i.selectionBefore),Kn.withoutSaving(t,()=>{D.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];Kn.withoutSaving(t,()=>{D.withoutNormalizing(t,()=>{var s=i.operations.map(ln.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&J.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=Kn.isSaving(t),d=Kn.isMerging(t);if(u==null&&(u=yb(r)),u){if(d==null&&(o==null?d=!1:a.length!==0?d=!0:d=bb(r,l)),o&&d)o.operations.push(r);else{var m={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",m)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},bb=(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)),yb=(e,t)=>e.type!=="set_selection",Db=wb,rf="֑-߿יִ-﷽ﹰ-ﻼ",af="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",Cb=new RegExp("^[^"+af+"]*["+rf+"]"),xb=new RegExp("^[^"+rf+"]*["+af+"]");function wb(e){return e=String(e||""),Cb.test(e)?"rtl":xb.test(e)?"ltr":"neutral"}const sf=On(Db);function Eb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Co=Eb,_b=typeof Gr=="object"&&Gr&&Gr.Object===Object&&Gr,kb=_b,Fb=kb,Bb=typeof self=="object"&&self&&self.Object===Object&&self,Ab=Fb||Bb||Function("return this")(),of=Ab,Tb=of,Sb=function(){return Tb.Date.now()},jb=Sb,Ob=/\s/;function Pb(e){for(var t=e.length;t--&&Ob.test(e.charAt(t)););return t}var Mb=Pb,Nb=Mb,Ib=/^\s+/;function Rb(e){return e&&e.slice(0,Nb(e)+1).replace(Ib,"")}var $b=Rb,Lb=of,zb=Lb.Symbol,uf=zb,ml=uf,lf=Object.prototype,qb=lf.hasOwnProperty,Wb=lf.toString,br=ml?ml.toStringTag:void 0;function Ub(e){var t=qb.call(e,br),n=e[br];try{e[br]=void 0;var r=!0}catch{}var a=Wb.call(e);return r&&(t?e[br]=n:delete e[br]),a}var Hb=Ub,Vb=Object.prototype,Kb=Vb.toString;function Zb(e){return Kb.call(e)}var Yb=Zb,pl=uf,Gb=Hb,Qb=Yb,Jb="[object Null]",Xb="[object Undefined]",gl=pl?pl.toStringTag:void 0;function ey(e){return e==null?e===void 0?Xb:Jb:gl&&gl in Object(e)?Gb(e):Qb(e)}var ty=ey;function ny(e){return e!=null&&typeof e=="object"}var ry=ny,ay=ty,iy=ry,sy="[object Symbol]";function oy(e){return typeof e=="symbol"||iy(e)&&ay(e)==sy}var uy=oy,ly=$b,vl=Co,cy=uy,bl=0/0,dy=/^[-+]0x[0-9a-f]+$/i,fy=/^0b[01]+$/i,hy=/^0o[0-7]+$/i,my=parseInt;function py(e){if(typeof e=="number")return e;if(cy(e))return bl;if(vl(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=vl(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=ly(e);var n=fy.test(e);return n||hy.test(e)?my(e.slice(2),n?2:8):dy.test(e)?bl:+e}var gy=py,vy=Co,Ni=jb,yl=gy,by="Expected a function",yy=Math.max,Dy=Math.min;function Cy(e,t,n){var r,a,i,s,o,l,u=0,d=!1,m=!1,p=!0;if(typeof e!="function")throw new TypeError(by);t=yl(t)||0,vy(n)&&(d=!!n.leading,m="maxWait"in n,i=m?yy(yl(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function h(T){var S=r,$=a;return r=a=void 0,u=T,s=e.apply($,S),s}function g(T){return u=T,o=setTimeout(v,t),d?h(T):s}function f(T){var S=T-l,$=T-u,M=t-S;return m?Dy(M,i-$):M}function b(T){var S=T-l,$=T-u;return l===void 0||S>=t||S<0||m&&$>=i}function v(){var T=Ni();if(b(T))return E(T);o=setTimeout(v,f(T))}function E(T){return o=void 0,p&&r?h(T):(r=a=void 0,s)}function B(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function _(){return o===void 0?s:E(Ni())}function x(){var T=Ni(),S=b(T);if(r=arguments,a=this,l=T,S){if(o===void 0)return g(l);if(m)return clearTimeout(o),o=setTimeout(v,t),h(l)}return o===void 0&&(o=setTimeout(v,t)),s}return x.cancel=B,x.flush=_,x}var cf=Cy;const xy=On(cf);var wy=cf,Ey=Co,_y="Expected a function";function ky(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(_y);return Ey(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),wy(e,t,{leading:r,maxWait:t,trailing:a})}var Fy=ky;const By=On(Fy),Dl=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Cl=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Ii=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Cl(n.overflowY,t)||Cl(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},oa=(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,Ay=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},xl=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,m=typeof u=="function"?u:U=>U!==u;if(!Dl(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,h=[];let g=e;for(;Dl(g)&&m(g);){if(g=Ay(g),g===p){h.push(g);break}g!=null&&g===document.body&&Ii(g)&&!Ii(document.documentElement)||g!=null&&Ii(g,d)&&h.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,b=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:v,scrollY:E}=window,{height:B,width:_,top:x,right:T,bottom:S,left:$}=e.getBoundingClientRect(),{top:M,right:N,bottom:q,left:w}=(U=>{const Z=window.getComputedStyle(U);return{top:parseFloat(Z.scrollMarginTop)||0,right:parseFloat(Z.scrollMarginRight)||0,bottom:parseFloat(Z.scrollMarginBottom)||0,left:parseFloat(Z.scrollMarginLeft)||0}})(e);let A=o==="start"||o==="nearest"?x-M:o==="end"?S+q:x+B/2-M+q,j=l==="center"?$+_/2-w+N:l==="end"?T+N:$-w;const L=[];for(let U=0;U<h.length;U++){const Z=h[U],{height:G,width:ae,top:C,right:z,bottom:Q,left:k}=Z.getBoundingClientRect();if(s==="if-needed"&&x>=0&&$>=0&&S<=b&&T<=f&&x>=C&&S<=Q&&$>=k&&T<=z)return L;const F=getComputedStyle(Z),R=parseInt(F.borderLeftWidth,10),I=parseInt(F.borderTopWidth,10),W=parseInt(F.borderRightWidth,10),re=parseInt(F.borderBottomWidth,10);let ee=0,ie=0;const fe="offsetWidth"in Z?Z.offsetWidth-Z.clientWidth-R-W:0,X="offsetHeight"in Z?Z.offsetHeight-Z.clientHeight-I-re:0,ve="offsetWidth"in Z?Z.offsetWidth===0?0:ae/Z.offsetWidth:0,pe="offsetHeight"in Z?Z.offsetHeight===0?0:G/Z.offsetHeight:0;if(p===Z)ee=o==="start"?A:o==="end"?A-b:o==="nearest"?oa(E,E+b,b,I,re,E+A,E+A+B,B):A-b/2,ie=l==="start"?j:l==="center"?j-f/2:l==="end"?j-f:oa(v,v+f,f,R,W,v+j,v+j+_,_),ee=Math.max(0,ee+E),ie=Math.max(0,ie+v);else{ee=o==="start"?A-C-I:o==="end"?A-Q+re+X:o==="nearest"?oa(C,Q,G,I,re+X,A,A+B,B):A-(C+G/2)+X/2,ie=l==="start"?j-k-R:l==="center"?j-(k+ae/2)+fe/2:l==="end"?j-z+W+fe:oa(k,z,ae,R,W+fe,j,j+_,_);const{scrollLeft:_e,scrollTop:Fe}=Z;ee=pe===0?0:Math.max(0,Math.min(Fe+ee/pe,Z.scrollHeight-G/pe+X)),ie=ve===0?0:Math.max(0,Math.min(_e+ie/ve,Z.scrollWidth-ae/ve+fe)),A+=Fe-ee,j+=_e-ie}L.push({el:Z,top:ee,left:ie})}return L},Ty=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function Sy(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(xl(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of xl(e,Ty(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var En=[],jy=function(){return En.some(function(e){return e.activeTargets.length>0})},Oy=function(){return En.some(function(e){return e.skippedTargets.length>0})},wl="ResizeObserver loop completed with undelivered notifications.",Py=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:wl}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=wl),window.dispatchEvent(e)},Rr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Rr||(Rr={}));var _n=function(e){return Object.freeze(e)},My=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,_n(this)}return e}(),df=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,_n(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}(),xo=function(e){return e instanceof SVGElement&&"getBBox"in e},ff=function(e){if(xo(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)},El=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)},Ny=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},_r=typeof window<"u"?window:{},ua=new WeakMap,_l=/auto|scroll/,Iy=/^tb|vertical/,Ry=/msie|trident/i.test(_r.navigator&&_r.navigator.userAgent),Mt=function(e){return parseFloat(e||"0")},Qn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new My((n?t:e)||0,(n?e:t)||0)},kl=_n({devicePixelContentBoxSize:Qn(),borderBoxSize:Qn(),contentBoxSize:Qn(),contentRect:new df(0,0,0,0)}),hf=function(e,t){if(t===void 0&&(t=!1),ua.has(e)&&!t)return ua.get(e);if(ff(e))return ua.set(e,kl),kl;var n=getComputedStyle(e),r=xo(e)&&e.ownerSVGElement&&e.getBBox(),a=!Ry&&n.boxSizing==="border-box",i=Iy.test(n.writingMode||""),s=!r&&_l.test(n.overflowY||""),o=!r&&_l.test(n.overflowX||""),l=r?0:Mt(n.paddingTop),u=r?0:Mt(n.paddingRight),d=r?0:Mt(n.paddingBottom),m=r?0:Mt(n.paddingLeft),p=r?0:Mt(n.borderTopWidth),h=r?0:Mt(n.borderRightWidth),g=r?0:Mt(n.borderBottomWidth),f=r?0:Mt(n.borderLeftWidth),b=m+u,v=l+d,E=f+h,B=p+g,_=o?e.offsetHeight-B-e.clientHeight:0,x=s?e.offsetWidth-E-e.clientWidth:0,T=a?b+E:0,S=a?v+B:0,$=r?r.width:Mt(n.width)-T-x,M=r?r.height:Mt(n.height)-S-_,N=$+b+x+E,q=M+v+_+B,w=_n({devicePixelContentBoxSize:Qn(Math.round($*devicePixelRatio),Math.round(M*devicePixelRatio),i),borderBoxSize:Qn(N,q,i),contentBoxSize:Qn($,M,i),contentRect:new df(m,l,$,M)});return ua.set(e,w),w},mf=function(e,t,n){var r=hf(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Rr.DEVICE_PIXEL_CONTENT_BOX:return s;case Rr.BORDER_BOX:return a;default:return i}},$y=function(){function e(t){var n=hf(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=_n([n.borderBoxSize]),this.contentBoxSize=_n([n.contentBoxSize]),this.devicePixelContentBoxSize=_n([n.devicePixelContentBoxSize])}return e}(),pf=function(e){if(ff(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},Ly=function(){var e=1/0,t=[];En.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new $y(u.target),m=pf(u.target);o.push(d),u.lastReportedSize=mf(u.target,u.observedBox),m<e&&(e=m)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},Fl=function(e){En.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(pf(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},zy=function(){var e=0;for(Fl(e);jy();)e=Ly(),Fl(e);return Oy()&&Py(),e>0},Ri,gf=[],qy=function(){return gf.splice(0).forEach(function(e){return e()})},Wy=function(e){if(!Ri){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return qy()}).observe(n,r),Ri=function(){n.textContent="".concat(t?t--:t++)}}gf.push(e),Ri()},Uy=function(e){Wy(function(){requestAnimationFrame(e)})},Ea=0,Hy=function(){return!!Ea},Vy=250,Ky={attributes:!0,characterData:!0,childList:!0,subtree:!0},Bl=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Al=function(e){return e===void 0&&(e=0),Date.now()+e},$i=!1,Zy=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=Vy),!$i){$i=!0;var r=Al(t);Uy(function(){var a=!1;try{a=zy()}finally{if($i=!1,t=r-Al(),!Hy())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,Ky)};document.body?n():_r.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Bl.forEach(function(n){return _r.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Bl.forEach(function(n){return _r.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),js=new Zy,Tl=function(e){!Ea&&e>0&&js.start(),Ea+=e,!Ea&&js.stop()},Yy=function(e){return!xo(e)&&!Ny(e)&&getComputedStyle(e).display==="inline"},Gy=function(){function e(t,n){this.target=t,this.observedBox=n||Rr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=mf(this.target,this.observedBox,!0);return Yy(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),Qy=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),la=new WeakMap,Sl=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},ca=function(){function e(){}return e.connect=function(t,n){var r=new Qy(t,n);la.set(t,r)},e.observe=function(t,n,r){var a=la.get(t),i=a.observationTargets.length===0;Sl(a.observationTargets,n)<0&&(i&&En.push(a),a.observationTargets.push(new Gy(n,r&&r.box)),Tl(1),js.schedule())},e.unobserve=function(t,n){var r=la.get(t),a=Sl(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&En.splice(En.indexOf(r),1),r.observationTargets.splice(a,1),Tl(-1))},e.disconnect=function(t){var n=this,r=la.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Jy=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.");ca.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(!El(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ca.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(!El(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ca.unobserve(this,t)},e.prototype.disconnect=function(){ca.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),tn={};Object.defineProperty(tn,"__esModule",{value:!0});var Xy=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Li={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},vf={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Xy?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},wo={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 da=1;da<20;da++)wo["f"+da]=111+da;function oi(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return bf(s,t)}),a=function(o){return r.some(function(l){return yf(l,o)})},i=n==null?a:a(n);return i}function e1(e,t){return oi(e,t)}function t1(e,t){return oi(e,{byKey:!0},t)}function bf(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in Li)r[Li[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var d=a[Symbol.iterator](),m;!(o=(m=d.next()).done);o=!0){var p=m.value,h=p.endsWith("?")&&p.length>1;h&&(p=p.slice(0,-1));var g=Eo(p),f=Li[g];if(p.length>1&&!f&&!vf[p]&&!wo[g])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!f)&&(n?r.key=g:r.which=Df(p)),f&&(r[f]=h?null:!0)}}catch(b){l=!0,u=b}finally{try{!o&&d.return&&d.return()}finally{if(l)throw u}}return r}function yf(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 Df(e){e=Eo(e);var t=wo[e]||e.toUpperCase().charCodeAt(0);return t}function Eo(e){return e=e.toLowerCase(),e=vf[e]||e,e}var n1=tn.default=oi,zi=tn.isHotkey=oi;tn.isCodeHotkey=e1;tn.isKeyHotkey=t1;tn.parseHotkey=bf;tn.compareHotkey=yf;tn.toKeyCode=Df;tn.toKeyName=Eo;function r1(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 rr(e,t){if(e==null)return{};var n=r1(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 $r(e){"@babel/helpers - typeof";return $r=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},$r(e)}function a1(e,t){if($r(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if($r(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function i1(e){var t=a1(e,"string");return $r(t)==="symbol"?t:String(t)}function Ft(e,t,n){return t=i1(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _o=y.createContext(null),gn=()=>{var e=y.useContext(_o);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Cf=parseInt(y.version.split(".")[0],10),s1=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,jl=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),lt=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Zn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),xr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),o1=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),xf=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),u1=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),l1=lt&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),c1=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),d1=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),f1=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),_a=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",rn=(!u1||!l1)&&!o1&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",ko=new WeakMap,Fo=new WeakMap,wf=new WeakMap,ka=new WeakMap,Os=new WeakMap,Lr=new WeakMap,kn=new WeakMap,qa=new WeakMap,ui=new WeakMap,Ps=new WeakMap,cn=new WeakMap,xn=new WeakMap,kr=new WeakMap,Ms=new WeakMap,Bo=new WeakMap,St=new WeakMap,Yt=new WeakMap,ht=new WeakMap,sn=new WeakMap,on=new WeakMap,Ef=new WeakMap,ar=Symbol("placeholder"),_f=Symbol("mark-placeholder"),h1=globalThis.Text,Ao=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,m1=e=>dn(e)&&e.nodeType===8,kt=e=>dn(e)&&e.nodeType===1,dn=e=>{var t=Ao(e);return!!t&&e instanceof t.Node},Ns=e=>{var t=e&&e.anchorNode&&Ao(e.anchorNode);return!!t&&e instanceof t.Selection},kf=e=>dn(e)&&e.nodeType===3,p1=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,g1=e=>{var[t,n]=e;if(kt(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=Ff(t,a,r?"backward":"forward"),r=a<n;kt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=b1(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},v1=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Ff=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(m1(a)||kt(a)&&a.childNodes.length===0||kt(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]},b1=(e,t,n)=>{var[r]=Ff(e,t,n);return r},Bf=e=>{var t="";if(kf(e)&&e.nodeValue)return e.nodeValue;if(kt(e)){for(var n of Array.from(e.childNodes))t+=Bf(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
130
+ `)}return t},y1=/data-slate-fragment="(.+?)"/m,D1=e=>{var t=e.getData("text/html"),[,n]=t.match(y1)||[];return n},To=(e,t,n)=>{var{target:r}=t;if(kt(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=ne.getWindow(e);if(a.contains(r))return ne.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:To(e,i,n)},C1=0;class x1{constructor(){Ft(this,"id",void 0),this.id="".concat(C1++)}}var ne={androidPendingDiffs:e=>ht.get(e),androidScheduleFlush:e=>{var t;(t=Bo.get(e))===null||t===void 0||t()},blur:e=>{var t=ne.toDOMNode(e,e),n=ne.findDocumentOrShadowRoot(e);cn.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=ne.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&J.deselect(e)},findDocumentOrShadowRoot:e=>{var t=ne.toDOMNode(e,e),n=t.getRootNode();return(n instanceof Document||n instanceof ShadowRoot)&&n.getSelection!=null?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:a}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i=ne.toSlateNode(e,t.target),s=ne.findPath(e,i);if(de.isElement(i)&&D.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=D.point(e,s,{edge:l?"start":"end"}),d=l?D.before(e,u):D.after(e,u);if(d){var m=D.range(e,d);return m}}var p,{document:h}=ne.getWindow(e);if(h.caretRangeFromPoint)p=h.caretRangeFromPoint(n,r);else{var g=h.caretPositionFromPoint(n,r);g&&(p=h.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=ne.toSlateRange(e,p,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=qa.get(t);return n||(n=new x1,qa.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=Fo.get(r);if(a==null){if(D.isEditor(r))return n;break}var i=ko.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(et.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!cn.get(t)){if(n.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(t.operations.length>0){setTimeout(()=>{ne.focus(t,{retries:n.retries-1})},10);return}var r=ne.toDOMNode(t,t),a=ne.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=ne.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(J.select(t,D.start(t,[])),t.onChange()),cn.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=wf.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=ne.toDOMNode(t,t),s;try{s=kt(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)=>dn(t)&&ne.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return D.hasPath(e,n.path)&&D.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>ne.hasEditableTarget(e,t)||ne.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>dn(t)&&ne.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!xn.get(e),isFocused:e=>!!cn.get(e),isReadOnly:e=>!!Ps.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Ps.get(e))return!1;var n=ne.hasTarget(e,t)&&ne.toSlateNode(e,t);return de.isElement(n)&&D.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=ui.get(e),r=D.isEditor(t)?ka.get(e):n==null?void 0:n.get(ne.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(et.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=D.node(e,t.path),r=ne.toDOMNode(e,n),a;D.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],d=u.childNodes[0];if(!(d==null||d.textContent==null)){var{length:m}=d.textContent,p=u.getAttribute("data-slate-length"),h=p==null?m:parseInt(p,10),g=o+h,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var b,v=f.childNodes[0];a=[v instanceof h1?v:f,(b=f.textContent)!==null&&b!==void 0&&b.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var E=Math.min(m,Math.max(0,t.offset-o));a=[d,E];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(et.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=H.isBackward(t),i=ne.toDOMPoint(e,n),s=H.isCollapsed(t)?i:ne.toDOMPoint(e,r),o=ne.getWindow(e),l=o.document.createRange(),[u,d]=a?s:i,[m,p]=a?i:s,h=kt(u)?u:u.parentElement,g=!!h.getAttribute("data-slate-zero-width"),f=kt(m)?m:m.parentElement,b=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:d),l.setEnd(m,b?1:p),l},toSlateNode:(e,t)=>{var n=kt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Lr.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:g1(t),o=i.parentNode,l=null,u=0;if(o){var d,m,p=ne.toDOMNode(e,e),h=o.closest('[data-slate-void="true"]'),g=h&&p.contains(h)?h:null,f=o.closest("[data-slate-leaf]"),b=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var v=ne.getWindow(e),E=v.document.createRange();E.setStart(l,0),E.setEnd(i,s);var B=E.cloneContents(),_=[...Array.prototype.slice.call(B.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(B.querySelectorAll("[contenteditable=false]"))];_.forEach(j=>{if(lt&&!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,b=l}}else if(g){for(var x=g.querySelectorAll("[data-slate-leaf]"),T=0;T<x.length;T++){var S=x[T];if(ne.hasDOMNode(e,S)){f=S;break}}f?(l=f.closest('[data-slate-node="text"]'),b=f,u=b.textContent.length,b.querySelectorAll("[data-slate-zero-width]").forEach(j=>{u-=j.textContent.length})):u=1}b&&u===b.textContent.length&&lt&&b.getAttribute("data-slate-zero-width")==="z"&&(d=b.textContent)!==null&&d!==void 0&&d.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Zn&&(m=b.textContent)!==null&&m!==void 0&&m.endsWith(`
131
131
 
132
- `))&&u--}if(ut&&!l&&!r){var z=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(z&&te.hasDOMNode(e,z,{editable:!0})){var N=te.toSlateNode(e,z),{path:I,offset:M}=D.start(e,te.findPath(e,N));return z.querySelector("[data-slate-leaf]")||(M=s),{path:I,offset:M}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var k=te.toSlateNode(e,l),A=te.findPath(e,k);return{path:A,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=Ns(t)?t.anchorNode:t.startContainer,o,l,u,d,m;if(s)if(Ns(t)){if(Kn&&t.rangeCount>1){u=t.focusNode;var p=t.getRangeAt(0),h=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement&&h.startContainer instanceof HTMLTableRowElement){let B=function(S){return S.childElementCount>0?B(S.children[0]):S};var g=p.startContainer,f=h.startContainer,b=B(g.children[p.startOffset]),v=B(f.children[h.startOffset]);d=0,v.childNodes.length>0?o=v.childNodes[0]:o=v,b.childNodes.length>0?u=b.childNodes[0]:u=b,v instanceof HTMLElement?l=v.innerHTML.length:l=0}else p.startContainer===u?(o=h.endContainer,l=h.endOffset,d=p.startOffset):(o=p.startContainer,l=p.endOffset,d=h.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,d=t.focusOffset;bf&&c1(o)||Kn?m=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:m=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,d=t.endOffset,m=t.collapsed;if(o==null||u==null||l==null||d==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(Kn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
132
+ `))&&u--}if(lt&&!l&&!r){var $=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if($&&ne.hasDOMNode(e,$,{editable:!0})){var M=ne.toSlateNode(e,$),{path:N,offset:q}=D.start(e,ne.findPath(e,M));return $.querySelector("[data-slate-leaf]")||(q=s),{path:N,offset:q}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var w=ne.toSlateNode(e,l),A=ne.findPath(e,w);return{path:A,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=Ns(t)?t.anchorNode:t.startContainer,o,l,u,d,m;if(s)if(Ns(t)){if(Zn&&t.rangeCount>1){u=t.focusNode;var p=t.getRangeAt(0),h=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement&&h.startContainer instanceof HTMLTableRowElement){let T=function(S){return S.childElementCount>0?T(S.children[0]):S};var g=p.startContainer,f=h.startContainer,b=T(g.children[p.startOffset]),v=T(f.children[h.startOffset]);d=0,v.childNodes.length>0?o=v.childNodes[0]:o=v,b.childNodes.length>0?u=b.childNodes[0]:u=b,v instanceof HTMLElement?l=v.innerHTML.length:l=0}else p.startContainer===u?(o=h.endContainer,l=h.endOffset,d=p.startOffset):(o=p.startContainer,l=p.endOffset,d=h.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,d=t.focusOffset;xf&&v1(o)||Zn?m=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:m=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,d=t.endOffset,m=t.collapsed;if(o==null||u==null||l==null||d==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(Zn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
133
133
 
134
- `)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var _;u=o,d=((_=o.textContent)===null||_===void 0?void 0:_.length)||0}var F=te.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!F)return null;var x=m?F:te.toSlatePoint(e,[u,d],{exactMatch:a,suppressThrow:i});if(!x)return null;var w={anchor:F,focus:x};return V.isExpanded(w)&&V.isForward(w)&&_t(u)&&D.void(e,{at:w.focus,mode:"highest"})&&(w=D.unhangRange(e,w,{voids:!0})),w}};function g1(e,t){var{path:n,diff:r}=t;if(!D.hasPath(e,n))return!1;var a=ue.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(!D.hasPath(e,i))return!1;var s=ue.get(e,i);return fe.isText(s)&&s.text.startsWith(r.text)}function _f(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 v1(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++)if(e.charAt(r)!==t.charAt(r))return r;return n}function b1(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 kf(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=v1(i,a),o=Math.min(i.length-s,a.length-s),l=b1(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 y1(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=_f(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 kf(e,{start:r,end:l,text:o})}function D1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Ms(e,t){var{path:n,offset:r}=t;if(!D.hasPath(e,n))return null;var a=ue.get(e,n);if(!fe.isText(a))return null;var i=D.above(e,{match:o=>ce.isElement(o)&&D.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=D.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=Ms(e,t.anchor);if(!n)return null;if(V.isCollapsed(t))return{anchor:n,focus:n};var r=Ms(e,t.focus);return r?{anchor:n,focus:r}:null}function Is(e,t,n){var r=dt.get(e),a=r==null?void 0:r.find(d=>{var{path:m}=d;return P.equals(m,t.path)});if(!a||t.offset<=a.diff.start)return we.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=we.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=we.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 jl(e,t,n){var r=Is(e,t.anchor,n);if(!r)return null;if(V.isCollapsed(t))return{anchor:r,focus:r};var a=Is(e,t.focus,n);return a?{anchor:r,focus:a}:null}function C1(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 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 da(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){kt(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 x1=25,w1=200,E1=function(){},_1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function k1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,d=()=>{var k=an.get(t);if(an.delete(t),k){var{selection:A}=t,j=Sl(t,k);j&&(!A||!V.equals(j,A))&&ee.select(t,j)}},m=()=>{var k=rn.get(t);if(rn.delete(t),!!k){if(k.at){var A=we.isPoint(k.at)?Ms(t,k.at):Sl(t,k.at);if(!A)return;var j=D.range(t,A);(!t.selection||!V.equals(t.selection,j))&&ee.select(t,A)}k.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!x()&&!F()){d();return}a||(a=!0,setTimeout(()=>a=!1)),F()&&(a="action");var k=t.selection&&D.rangeRef(t,t.selection,{affinity:"forward"});Zt.set(t,t.marks),E1("flush",rn.get(t),dt.get(t));for(var A=x(),j;j=(L=dt.get(t))===null||L===void 0?void 0:L[0];){var L,H,Y=Tt.get(t);Y!==void 0&&(Tt.delete(t),t.marks=Y),Y&&u===!1&&(u=null);var Q=D1(j);(!t.selection||!V.equals(t.selection,Q))&&ee.select(t,Q),j.diff.text?D.insertText(t,j.diff.text):D.deleteFragment(t),dt.set(t,(H=dt.get(t))===null||H===void 0?void 0:H.filter(q=>{var{id:K}=q;return K!==j.id})),g1(t,j)||(A=!1,rn.delete(t),Zt.delete(t),a="action",an.delete(t),n.cancel(),r.cancel(),k==null||k.unref())}var re=k==null?void 0:k.unref();if(re&&!an.get(t)&&(!t.selection||!V.equals(re,t.selection))&&ee.select(t,re),F()){m();return}A&&n(),n.flush(),r.flush(),d();var C=Zt.get(t);Zt.delete(t),C!==void 0&&(t.marks=C,t.onChange())},h=k=>{i&&clearTimeout(i),i=setTimeout(()=>{Cn.set(t,!1),p()},x1)},g=k=>{Cn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=js.get(t);if(j){if(x()||A){j.style.display="none";return}j.style.removeProperty("display")}},b=(k,A)=>{var j,L=(j=dt.get(t))!==null&&j!==void 0?j:[];dt.set(t,L);var H=ue.leaf(t,k),Y=L.findIndex(C=>P.equals(C.path,k));if(Y<0){var Q=kf(H.text,A);Q&&L.push({path:k,diff:A,id:l++}),f();return}var re=y1(H.text,L[Y].diff,A);if(!re){L.splice(Y,1),f();return}L[Y]=da(da({},L[Y]),{},{diff:re})},v=function(A){var{at:j}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,an.delete(t),n.cancel(),r.cancel(),F()&&p(),rn.set(t,{at:j,run:A}),o=setTimeout(p)},_=k=>{var A;s&&(clearTimeout(s),s=null);var{inputType:j}=k,L=null,H=k.dataTransfer||k.data||void 0;u!==!1&&j!=="insertText"&&j!=="insertCompositionText"&&(u=!1);var[Y]=k.getTargetRanges();Y&&(L=te.toSlateRange(t,Y,{exactMatch:!1,suppressThrow:!0}));var Q=te.getWindow(t),re=Q.getSelection();if(!L&&re&&(Y=re,L=te.toSlateRange(t,re,{exactMatch:!1,suppressThrow:!0})),L=(A=L)!==null&&A!==void 0?A:t.selection,!!L){var C=!0;if(j.startsWith("delete")){if(V.isExpanded(L)){var[q,K]=V.edges(L),E=ue.leaf(t,q.path);if(E.text.length===q.offset&&K.offset===0){var T=D.next(t,{at:q.path,match:fe.isText});T&&P.equals(T[1],K.path)&&(L={anchor:K,focus:K})}}var $=j.endsWith("Backward")?"backward":"forward",[R,U]=V.edges(L),[ae,J]=D.leaf(t,R.path),ie={text:"",start:R.offset,end:U.offset},de=dt.get(t),X=de==null?void 0:de.find(pe=>P.equals(pe.path,J)),ye=X?[X.diff,ie]:[ie],me=_f(ae.text,...ye);if(me.length===0&&(C=!1),V.isExpanded(L)){if(C&&P.equals(L.anchor.path,L.focus.path)){var xe={path:L.anchor.path,offset:R.offset},Te=D.range(t,xe,xe);return S(Te),b(L.anchor.path,{text:"",end:U.offset,start:R.offset})}return v(()=>D.deleteFragment(t,{direction:$}),{at:L})}}switch(j){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>D.deleteFragment(t),{at:L});case"deleteContent":case"deleteContentForward":{var{anchor:Se}=L;if(C&&V.isCollapsed(L)){var He=ue.leaf(t,Se.path);if(Se.offset<He.text.length)return b(Se.path,{text:"",start:Se.offset,end:Se.offset+1})}return v(()=>D.deleteForward(t),{at:L})}case"deleteContentBackward":{var Be,{anchor:Fe}=L,Pe=Ns(Y)?Y.isCollapsed:!!((Be=Y)!==null&&Be!==void 0&&Be.collapsed);return C&&Pe&&V.isCollapsed(L)&&Fe.offset>0?b(Fe.path,{text:"",start:Fe.offset-1,end:Fe.offset}):v(()=>D.deleteBackward(t),{at:L})}case"deleteEntireSoftLine":return v(()=>{D.deleteBackward(t,{unit:"line"}),D.deleteForward(t,{unit:"line"})},{at:L});case"deleteHardLineBackward":return v(()=>D.deleteBackward(t,{unit:"block"}),{at:L});case"deleteSoftLineBackward":return v(()=>D.deleteBackward(t,{unit:"line"}),{at:L});case"deleteHardLineForward":return v(()=>D.deleteForward(t,{unit:"block"}),{at:L});case"deleteSoftLineForward":return v(()=>D.deleteForward(t,{unit:"line"}),{at:L});case"deleteWordBackward":return v(()=>D.deleteBackward(t,{unit:"word"}),{at:L});case"deleteWordForward":return v(()=>D.deleteForward(t,{unit:"word"}),{at:L});case"insertLineBreak":return v(()=>D.insertSoftBreak(t),{at:L});case"insertParagraph":return v(()=>D.insertBreak(t),{at:L});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(_1(H))return v(()=>te.insertData(t,H),{at:L});var Ee=H??"";if(Tt.get(t)&&(Ee=Ee.replace("\uFEFF","")),j==="insertText"&&/.*\n.*\n$/.test(Ee)&&(Ee=Ee.slice(0,-1)),Ee.includes(`
135
- `))return v(()=>{var pe=Ee.split(`
136
- `);pe.forEach((Ce,Ze)=>{Ce&&D.insertText(t,Ce),Ze!==pe.length-1&&D.insertSoftBreak(t)})},{at:L});if(P.equals(L.anchor.path,L.focus.path)){var[Ve,ze]=V.edges(L),W={start:Ve.offset,end:ze.offset,text:Ee};if(Ee&&u&&j==="insertCompositionText"){var ne=u.start+u.text.search(/\S|$/),he=W.start+W.text.search(/\S|$/);he===ne+1&&W.end===u.start+u.text.length?(W.start-=1,u=null,I()):u=!1}else j==="insertText"?u===null?u=W:u&&V.isCollapsed(L)&&u.end+u.text.length===Ve.offset?u=da(da({},u),{},{text:u.text+Ee}):u=!1:u=!1;if(C){b(Ve.path,W);return}}return v(()=>D.insertText(t,Ee),{at:L})}}}},F=()=>!!rn.get(t),x=()=>{var k;return!!((k=dt.get(t))!==null&&k!==void 0&&k.length)},w=()=>F()||x(),B=()=>a,S=k=>{an.set(t,k),s&&(clearTimeout(s),s=null);var{selection:A}=t;if(k){var j=!A||!P.equals(A.anchor.path,k.anchor.path),L=!A||!P.equals(A.anchor.path.slice(0,-1),k.anchor.path.slice(0,-1));(j&&u||L)&&(u=!1),(j||x())&&(s=setTimeout(p,w1))}},z=()=>{(F()||!x())&&p()},N=k=>{x()||(f(!0),setTimeout(f))},I=()=>{F()||(o=setTimeout(p))},M=k=>{if(!(x()||F())&&k.some(j=>Bo(t,j,k))){var A;(A=Df.get(t))===null||A===void 0||A()}};return{flush:p,scheduleFlush:I,hasPendingDiffs:x,hasPendingAction:F,hasPendingChanges:w,isFlushing:B,handleUserSelect:S,handleCompositionEnd:h,handleCompositionStart:g,handleDOMBeforeInput:_,handleKeyDown:N,handleDomMutations:M,handleInput:z}}function F1(){var e=y.useRef(!1);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Lr=Ea?y.useLayoutEffect:y.useEffect;function B1(e,t,n){var[r]=y.useState(()=>new MutationObserver(t));Lr(()=>{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 A1=["node"];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 T1(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){kt(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 S1={subtree:!0,childList:!0,characterData:!0},j1=ut?e=>{var{node:t}=e,n=nr(e,A1);if(!ut)return null;var r=pn(),a=F1(),[i]=y.useState(()=>k1(T1({editor:r},n)));return B1(t,i.handleDomMutations,S1),ko.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,O1=["anchor","focus"],P1=["anchor","focus"],N1=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),Ff=(e,t)=>{var n=nr(e,O1),r=nr(t,P1);return e[rr]===t[rr]&&N1(n,r)},M1=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(!V.equals(r,a)||!Ff(r,a))return!1}return!0},I1=(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||!Ff(r,a))return!1}return!0};function Nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function R1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nl(Object(n),!0).forEach(function(r){kt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var $1=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=pn(),s=te.findPath(i,a),o=P.parent(s),l=!!n[Cf];return i.isVoid(r)?y.createElement(zi,{length:ue.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&D.string(i,o)===""?y.createElement(zi,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?y.createElement(zi,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
137
- `?y.createElement(Ml,{isTrailing:!0,text:n.text}):y.createElement(Ml,{text:n.text})},Ml=e=>{var{text:t,isTrailing:n=!1}=e,r=y.useRef(null),a=()=>"".concat(t??"").concat(n?`
138
- `:""),[i]=y.useState(a);return Lr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(L1,{ref:r},i)},L1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),zi=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",R1({},a),!ut||!n?"\uFEFF":null,n?y.createElement("br",null):null)};function Il(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Bf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Il(Object(n),!0).forEach(function(r){kt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Il(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var z1=ut?300:0;function q1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function Rl(e){e.current&&(clearTimeout(e.current),e.current=null)}var W1=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=_=>y.createElement(H1,Bf({},_))}=e,o=pn(),l=y.useRef(null),u=y.useRef(null),[d,m]=y.useState(!1),p=y.useRef(null),h=y.useCallback(_=>{if(q1(l,_==null),_==null){var F;js.delete(o),(F=t.onPlaceholderResize)===null||F===void 0||F.call(t,null)}else{if(js.set(o,_),!l.current){var x=window.ResizeObserver||Hy;l.current=new x(()=>{var w;(w=t.onPlaceholderResize)===null||w===void 0||w.call(t,_)})}l.current.observe(_),u.current=_}},[u,t,o]),g=y.createElement($1,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[rr];if(y.useEffect(()=>(f?p.current||(p.current=setTimeout(()=>{m(!0),p.current=null},z1)):(Rl(p),m(!1)),()=>Rl(p)),[f,m]),f&&d){var b={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:Cr?"inherit":void 0},contentEditable:!1,ref:h}};g=y.createElement(y.Fragment,null,i(b),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},U1=y.memo(W1,(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[rr]===e.leaf[rr]),H1=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Bf({},t),n)},V1=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=pn(),l=y.useRef(null),u=fe.decorations(s,t),d=te.findKey(o,s),m=[],p=0;p<u.length;p++){var h=u[p];m.push(y.createElement(U1,{isLast:n&&p===u.length-1,key:"".concat(d.id,"-").concat(p),renderPlaceholder:a,leaf:h,text:s,parent:r,renderLeaf:i}))}var g=y.useCallback(f=>{var b=oi.get(o);f?(b==null||b.set(d,f),_n.set(s,f),$r.set(f,s)):(b==null||b.delete(d),_n.delete(s),l.current&&$r.delete(l.current)),l.current=f},[l,o,d,s]);return y.createElement("span",{"data-slate-node":"text",ref:g},m)},Af=y.memo(V1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&I1(t.decorations,e.decorations));function $l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Rs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$l(Object(n),!0).forEach(function(r){kt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$l(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var K1=e=>{var{decorations:t,element:n,renderElement:r=_=>y.createElement(Y1,Rs({},_)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=pn(),l=J1(),u=o.isInline(n),d=te.findKey(o,n),m=y.useCallback(_=>{var F=oi.get(o);_?(F==null||F.set(d,_),_n.set(n,_),$r.set(_,n)):(F==null||F.delete(d),_n.delete(n))},[o,d,n]),p=Sf({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),h={"data-slate-node":"element",ref:m};if(u&&(h["data-slate-inline"]=!0),!u&&D.hasInlines(o,n)){var g=ue.string(n),f=tf(g);f==="rtl"&&(h.dir=f)}if(D.isVoid(o,n)){h["data-slate-void"]=!0,!l&&u&&(h.contentEditable=!1);var b=u?"span":"div",[[v]]=ue.texts(n);p=y.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(Af,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),Eo.set(v,0),_o.set(v,n)}return r({attributes:h,children:p,element:n})},Z1=y.memo(K1,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&M1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&V.equals(e.selection,t.selection))),Y1=e=>{var{attributes:t,children:n,element:r}=e,a=pn(),i=a.isInline(r)?"span":"div";return y.createElement(i,Rs(Rs({},t),{},{style:{position:"relative"}}),n)},Tf=y.createContext(()=>[]),G1=()=>y.useContext(Tf),Q1=y.createContext(!1),Sf=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=G1(),l=pn(),u=te.findPath(l,n),d=[],m=ce.isElement(n)&&!l.isInline(n)&&D.hasInlines(l,n),p=0;p<n.children.length;p++){var h=u.concat(p),g=n.children[p],f=te.findKey(l,g),b=D.range(l,h),v=s&&V.intersection(b,s),_=o([g,h]);for(var F of t){var x=V.intersection(F,b);x&&_.push(x)}ce.isElement(g)?d.push(y.createElement(Q1.Provider,{key:"provider-".concat(f.id),value:!!v},y.createElement(Z1,{decorations:_,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):d.push(y.createElement(Af,{decorations:_,key:f.id,isLast:m&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),Eo.set(g,p),_o.set(g,n)}return d},jf=y.createContext(!1),J1=()=>y.useContext(jf),Of=y.createContext(null),Nn=()=>{var e=y.useContext(Of);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function X1(){var e=pn(),t=y.useRef(!1),n=y.useRef(0),r=y.useCallback(()=>{if(!t.current){t.current=!0;var a=te.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return y.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var eD=3,tD={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"},nD={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"},rD={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ue=e=>{var t=tD[e],n=nD[e],r=rD[e],a=t&&Li(t),i=n&&Li(n),s=r&&Li(r);return o=>!!(a&&a(o)||Tl&&i&&i(o)||!Tl&&s&&s(o))},Ke={isBold:Ue("bold"),isCompose:Ue("compose"),isMoveBackward:Ue("moveBackward"),isMoveForward:Ue("moveForward"),isDeleteBackward:Ue("deleteBackward"),isDeleteForward:Ue("deleteForward"),isDeleteLineBackward:Ue("deleteLineBackward"),isDeleteLineForward:Ue("deleteLineForward"),isDeleteWordBackward:Ue("deleteWordBackward"),isDeleteWordForward:Ue("deleteWordForward"),isExtendBackward:Ue("extendBackward"),isExtendForward:Ue("extendForward"),isExtendLineBackward:Ue("extendLineBackward"),isExtendLineForward:Ue("extendLineForward"),isItalic:Ue("italic"),isMoveLineBackward:Ue("moveLineBackward"),isMoveLineForward:Ue("moveLineForward"),isMoveWordBackward:Ue("moveWordBackward"),isMoveWordForward:Ue("moveWordForward"),isRedo:Ue("redo"),isSoftBreak:Ue("insertSoftBreak"),isSplitBlock:Ue("splitBlock"),isTransposeCharacter:Ue("transposeCharacter"),isUndo:Ue("undo")},aD=(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}},iD={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Pf extends y.Component{constructor(){super(...arguments),kt(this,"context",null),kt(this,"manager",null),kt(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,iD)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=aD(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}}kt(Pf,"contextType",wo);var sD=ut?Pf:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},oD=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],uD=["text"];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 Mt(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){kt(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 lD=e=>y.createElement(y.Fragment,null,Sf(e)),cD=e=>{var t=y.useCallback(T=>y.createElement(dD,Mt({},T)),[]),{autoFocus:n,decorate:r=fD,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=hD,style:m={},as:p="div",disableDefaultStyles:h=!1}=e,g=nr(e,oD),f=Nn(),[b,v]=y.useState(!1),_=y.useRef(null),F=y.useRef([]),[x,w]=y.useState(),{onUserInput:B,receivedUserInput:S}=X1(),[,z]=y.useReducer(T=>T+1,0);Df.set(f,z),Os.set(f,s);var N=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{_.current&&n&&_.current.focus()},[n]);var I=y.useRef(),M=y.useMemo(()=>Cy(()=>{var T=I.current;if((ut||!te.isComposing(f))&&(!N.isUpdatingSelection||T!=null&&T.isFlushing())&&!N.isDraggingInternally){var $=te.findDocumentOrShadowRoot(f),{activeElement:R}=$,U=te.toDOMNode(f,f),ae=$.getSelection();if(R===U?(N.latestElement=R,un.set(f,!0)):un.delete(f),!ae)return ee.deselect(f);var{anchorNode:J,focusNode:ie}=ae,de=te.hasEditableTarget(f,J)||te.isTargetInsideNonReadonlyVoid(f,J),X=te.hasEditableTarget(f,ie)||te.isTargetInsideNonReadonlyVoid(f,ie);if(de&&X){var ye=te.toSlateRange(f,ae,{exactMatch:!1,suppressThrow:!0});ye&&(!te.isComposing(f)&&!(T!=null&&T.hasPendingChanges())&&!(T!=null&&T.isFlushing())?ee.select(f,ye):T==null||T.handleUserSelect(ye))}s&&(!de||!X)&&ee.deselect(f)}},100),[f,s,N]),k=y.useMemo(()=>py(M,0),[M]);I.current=j1({node:_,onDOMSelectionChange:M,scheduleOnDOMSelectionChange:k}),Lr(()=>{var T,$,R;_.current&&(R=Fo(_.current))?(yf.set(f,R),_a.set(f,_.current),_n.set(f,_.current),$r.set(_.current,f)):_n.delete(f);var{selection:U}=f,ae=te.findDocumentOrShadowRoot(f),J=ae.getSelection();if(!(!J||!te.isFocused(f)||(T=I.current)!==null&&T!==void 0&&T.hasPendingAction())){var ie=me=>{var xe=J.type!=="None";if(!(!U&&!xe)){var Te=J.focusNode,Se;if(Kn&&J.rangeCount>1){var He=J.getRangeAt(0),Be=J.getRangeAt(J.rangeCount-1);He.startContainer===Te?Se=Be.endContainer:Se=He.startContainer}else Se=J.anchorNode;var Fe=_a.get(f),Pe=!1;if(Fe.contains(Se)&&Fe.contains(Te)&&(Pe=!0),xe&&Pe&&U&&!me){var Ee=te.toSlateRange(f,J,{exactMatch:!0,suppressThrow:!0});if(Ee&&V.equals(Ee,U)){var Ve;if(!N.hasMarkPlaceholder||(Ve=Se)!==null&&Ve!==void 0&&(Ve=Ve.parentElement)!==null&&Ve!==void 0&&Ve.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!te.hasRange(f,U)){f.selection=te.toSlateRange(f,J,{exactMatch:!1,suppressThrow:!0});return}N.isUpdatingSelection=!0;var ze=U&&te.toDOMRange(f,U);return ze?(te.isComposing(f)&&!ut?J.collapseToEnd():V.isBackward(U)?J.setBaseAndExtent(ze.endContainer,ze.endOffset,ze.startContainer,ze.startOffset):J.setBaseAndExtent(ze.startContainer,ze.startOffset,ze.endContainer,ze.endOffset),d(f,ze)):J.removeAllRanges(),ze}};J.rangeCount<=1&&ie();var de=(($=I.current)===null||$===void 0?void 0:$.isFlushing())==="action";if(!ut||!de){setTimeout(()=>{N.isUpdatingSelection=!1});return}var X=null,ye=requestAnimationFrame(()=>{if(de){var me=xe=>{try{var Te=te.toDOMNode(f,f);Te.focus(),ie(xe)}catch{}};me(),X=setTimeout(()=>{me(!0),N.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ye),X&&clearTimeout(X)}}});var A=y.useCallback(T=>{if(B(),!s&&te.hasEditableTarget(f,T.target)&&!mD(T,a)){var $;if(I.current)return I.current.handleDOMBeforeInput(T);k.flush(),M.flush();var{selection:R}=f,{inputType:U}=T,ae=T.dataTransfer||T.data||void 0,J=U==="insertCompositionText"||U==="deleteCompositionText";if(J&&te.isComposing(f))return;var ie=!1;if(U==="insertText"&&R&&V.isCollapsed(R)&&T.data&&T.data.length===1&&/[a-z ]/i.test(T.data)&&R.anchor.offset!==0){var de,X;ie=!0,f.marks&&(ie=!1);var{anchor:ye}=R,[me,xe]=te.toDOMPoint(f,ye),Te=(de=me.parentElement)===null||de===void 0?void 0:de.closest("a"),Se=te.getWindow(f);if(ie&&Te&&te.hasDOMNode(f,Te)){var He,Be=Se==null?void 0:Se.document.createTreeWalker(Te,NodeFilter.SHOW_TEXT).lastChild();Be===me&&((He=Be.textContent)===null||He===void 0?void 0:He.length)===xe&&(ie=!1)}if(ie&&me.parentElement&&(Se==null||(X=Se.getComputedStyle(me.parentElement))===null||X===void 0?void 0:X.whiteSpace)==="pre"){var Fe=D.above(f,{at:ye.path,match:ne=>ce.isElement(ne)&&D.isBlock(f,ne)});Fe&&ue.string(Fe[0]).includes(" ")&&(ie=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[Pe]=T.getTargetRanges();if(Pe){var Ee=te.toSlateRange(f,Pe,{exactMatch:!1,suppressThrow:!1});if(!R||!V.equals(R,Ee)){ie=!1;var Ve=!J&&f.selection&&D.rangeRef(f,f.selection);ee.select(f,Ee),Ve&&_r.set(f,Ve)}}}if(J)return;if(ie||T.preventDefault(),R&&V.isExpanded(R)&&U.startsWith("delete")){var ze=U.endsWith("Backward")?"backward":"forward";D.deleteFragment(f,{direction:ze});return}switch(U){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{D.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{D.deleteForward(f);break}case"deleteContentBackward":{D.deleteBackward(f);break}case"deleteEntireSoftLine":{D.deleteBackward(f,{unit:"line"}),D.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{D.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{D.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{D.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{D.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{D.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{D.deleteForward(f,{unit:"word"});break}case"insertLineBreak":D.insertSoftBreak(f);break;case"insertParagraph":{D.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{U==="insertFromComposition"&&te.isComposing(f)&&(v(!1),Cn.set(f,!1)),(ae==null?void 0:ae.constructor.name)==="DataTransfer"?te.insertData(f,ae):typeof ae=="string"&&(ie?F.current.push(()=>D.insertText(f,ae)):D.insertText(f,ae));break}}var W=($=_r.get(f))===null||$===void 0?void 0:$.unref();_r.delete(f),W&&(!f.selection||!V.equals(f.selection,W))&&ee.select(f,W)}},[f,M,B,a,s,k]),j=y.useCallback(T=>{T==null?(M.cancel(),k.cancel(),_a.delete(f),_n.delete(f),_.current&&tn&&_.current.removeEventListener("beforeinput",A)):tn&&T.addEventListener("beforeinput",A),_.current=T},[M,k,f,A]);Lr(()=>{var T=te.getWindow(f);return T.document.addEventListener("selectionchange",k),()=>{T.document.removeEventListener("selectionchange",k)}},[k]);var L=r([f,[]]),H=i&&f.children.length===1&&Array.from(ue.texts(f)).length===1&&ue.string(f)===""&&!b,Y=y.useCallback(T=>{if(T&&H){var $;w(($=T.getBoundingClientRect())===null||$===void 0?void 0:$.height)}else w(void 0)},[H]);if(H){var Q=D.start(f,[]);L.push({[rr]:!0,placeholder:i,onPlaceholderResize:Y,anchor:Q,focus:Q})}var{marks:re}=f;if(N.hasMarkPlaceholder=!1,f.selection&&V.isCollapsed(f.selection)&&re){var{anchor:C}=f.selection,q=ue.leaf(f,C.path),K=nr(q,uD);if(!fe.equals(q,re,{loose:!0})){N.hasMarkPlaceholder=!0;var E=Object.fromEntries(Object.keys(K).map(T=>[T,null]));L.push(Mt(Mt(Mt({[Cf]:!0},E),re),{},{anchor:C,focus:C}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:T}=f;if(T){var{anchor:$}=T,R=ue.leaf(f,$.path);if(re&&!fe.equals(R,re,{loose:!0})){Tt.set(f,re);return}}Tt.delete(f)})}),y.createElement(jf.Provider,{value:s},y.createElement(Tf.Provider,{value:r},y.createElement(sD,{node:_,receivedUserInput:S},y.createElement(p,Mt(Mt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:tn||!Ea?g.spellCheck:!1,autoCorrect:tn||!Ea?g.autoCorrect:"false",autoCapitalize:tn||!Ea?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:j,style:Mt(Mt({},h?{}:Mt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},x?{minHeight:x}:{})),m),onBeforeInput:y.useCallback(T=>{if(!tn&&!s&&!st(T,g.onBeforeInput)&&te.hasSelectableTarget(f,T.target)&&(T.preventDefault(),!te.isComposing(f))){var $=T.data;D.insertText(f,$)}},[g.onBeforeInput,f,s]),onInput:y.useCallback(T=>{if(!st(T,g.onInput)){if(I.current){I.current.handleInput();return}for(var $ of F.current)$();F.current=[]}},[g.onInput]),onBlur:y.useCallback(T=>{if(!(s||N.isUpdatingSelection||!te.hasSelectableTarget(f,T.target)||st(T,g.onBlur))){var $=te.findDocumentOrShadowRoot(f);if(N.latestElement!==$.activeElement){var{relatedTarget:R}=T,U=te.toDOMNode(f,f);if(R!==U&&!(_t(R)&&R.hasAttribute("data-slate-spacer"))){if(R!=null&&cn(R)&&te.hasDOMNode(f,R)){var ae=te.toSlateNode(f,R);if(ce.isElement(ae)&&!f.isVoid(ae))return}if(Cr){var J=$.getSelection();J==null||J.removeAllRanges()}un.delete(f)}}}},[s,N.isUpdatingSelection,N.latestElement,f,g.onBlur]),onClick:y.useCallback(T=>{if(te.hasTarget(f,T.target)&&!st(T,g.onClick)&&cn(T.target)){var $=te.toSlateNode(f,T.target),R=te.findPath(f,$);if(!D.hasPath(f,R)||ue.get(f,R)!==$)return;if(T.detail===eD&&R.length>=1){var U=R;if(!(ce.isElement($)&&D.isBlock(f,$))){var ae,J=D.above(f,{match:Te=>ce.isElement(Te)&&D.isBlock(f,Te),at:R});U=(ae=J==null?void 0:J[1])!==null&&ae!==void 0?ae:R.slice(0,1)}var ie=D.range(f,U);ee.select(f,ie);return}if(s)return;var de=D.start(f,R),X=D.end(f,R),ye=D.void(f,{at:de}),me=D.void(f,{at:X});if(ye&&me&&P.equals(ye[1],me[1])){var xe=D.range(f,de);ee.select(f,xe)}}},[f,g.onClick,s]),onCompositionEnd:y.useCallback(T=>{if(te.hasSelectableTarget(f,T.target)){var $;if(te.isComposing(f)&&Promise.resolve().then(()=>{v(!1),Cn.set(f,!1)}),($=I.current)===null||$===void 0||$.handleCompositionEnd(T),st(T,g.onCompositionEnd)||ut)return;if(!Cr&&!r1&&!Xy&&!i1&&!a1&&T.data){var R=Tt.get(f);Tt.delete(f),R!==void 0&&(Zt.set(f,f.marks),f.marks=R),D.insertText(f,T.data);var U=Zt.get(f);Zt.delete(f),U!==void 0&&(f.marks=U)}}},[g.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(T=>{te.hasSelectableTarget(f,T.target)&&!st(T,g.onCompositionUpdate)&&(te.isComposing(f)||(v(!0),Cn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:y.useCallback(T=>{if(te.hasSelectableTarget(f,T.target)){var $;if(($=I.current)===null||$===void 0||$.handleCompositionStart(T),st(T,g.onCompositionStart)||ut)return;v(!0);var{selection:R}=f;if(R&&V.isExpanded(R)){D.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:y.useCallback(T=>{te.hasSelectableTarget(f,T.target)&&!st(T,g.onCopy)&&!zl(T)&&(T.preventDefault(),te.setFragmentData(f,T.clipboardData,"copy"))},[g.onCopy,f]),onCut:y.useCallback(T=>{if(!s&&te.hasSelectableTarget(f,T.target)&&!st(T,g.onCut)&&!zl(T)){T.preventDefault(),te.setFragmentData(f,T.clipboardData,"cut");var{selection:$}=f;if($)if(V.isExpanded($))D.deleteFragment(f);else{var R=ue.parent(f,$.anchor.path);D.isVoid(f,R)&&ee.delete(f)}}},[s,f,g.onCut]),onDragOver:y.useCallback(T=>{if(te.hasTarget(f,T.target)&&!st(T,g.onDragOver)){var $=te.toSlateNode(f,T.target);ce.isElement($)&&D.isVoid(f,$)&&T.preventDefault()}},[g.onDragOver,f]),onDragStart:y.useCallback(T=>{if(!s&&te.hasTarget(f,T.target)&&!st(T,g.onDragStart)){var $=te.toSlateNode(f,T.target),R=te.findPath(f,$),U=ce.isElement($)&&D.isVoid(f,$)||D.void(f,{at:R,voids:!0});if(U){var ae=D.range(f,R);ee.select(f,ae)}N.isDraggingInternally=!0,te.setFragmentData(f,T.dataTransfer,"drag")}},[s,f,g.onDragStart,N]),onDrop:y.useCallback(T=>{if(!s&&te.hasTarget(f,T.target)&&!st(T,g.onDrop)){T.preventDefault();var $=f.selection,R=te.findEventRange(f,T),U=T.dataTransfer;ee.select(f,R),N.isDraggingInternally&&$&&!V.equals($,R)&&!D.void(f,{at:R,voids:!0})&&ee.delete(f,{at:$}),te.insertData(f,U),te.isFocused(f)||te.focus(f)}N.isDraggingInternally=!1},[s,f,g.onDrop,N]),onDragEnd:y.useCallback(T=>{!s&&N.isDraggingInternally&&g.onDragEnd&&te.hasTarget(f,T.target)&&g.onDragEnd(T),N.isDraggingInternally=!1},[s,N,g,f]),onFocus:y.useCallback(T=>{if(!s&&!N.isUpdatingSelection&&te.hasEditableTarget(f,T.target)&&!st(T,g.onFocus)){var $=te.toDOMNode(f,f),R=te.findDocumentOrShadowRoot(f);if(N.latestElement=R.activeElement,Kn&&T.target!==$){$.focus();return}un.set(f,!0)}},[s,N,f,g.onFocus]),onKeyDown:y.useCallback(T=>{if(!s&&te.hasEditableTarget(f,T.target)){var $;($=I.current)===null||$===void 0||$.handleKeyDown(T);var{nativeEvent:R}=T;if(te.isComposing(f)&&R.isComposing===!1&&(Cn.set(f,!1),v(!1)),st(T,g.onKeyDown)||te.isComposing(f))return;var{selection:U}=f,ae=f.children[U!==null?U.focus.path[0]:0],J=tf(ue.string(ae))==="rtl";if(Ke.isRedo(R)){T.preventDefault();var ie=f;typeof ie.redo=="function"&&ie.redo();return}if(Ke.isUndo(R)){T.preventDefault();var de=f;typeof de.undo=="function"&&de.undo();return}if(Ke.isMoveLineBackward(R)){T.preventDefault(),ee.move(f,{unit:"line",reverse:!0});return}if(Ke.isMoveLineForward(R)){T.preventDefault(),ee.move(f,{unit:"line"});return}if(Ke.isExtendLineBackward(R)){T.preventDefault(),ee.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Ke.isExtendLineForward(R)){T.preventDefault(),ee.move(f,{unit:"line",edge:"focus"});return}if(Ke.isMoveBackward(R)){T.preventDefault(),U&&V.isCollapsed(U)?ee.move(f,{reverse:!J}):ee.collapse(f,{edge:J?"end":"start"});return}if(Ke.isMoveForward(R)){T.preventDefault(),U&&V.isCollapsed(U)?ee.move(f,{reverse:J}):ee.collapse(f,{edge:J?"start":"end"});return}if(Ke.isMoveWordBackward(R)){T.preventDefault(),U&&V.isExpanded(U)&&ee.collapse(f,{edge:"focus"}),ee.move(f,{unit:"word",reverse:!J});return}if(Ke.isMoveWordForward(R)){T.preventDefault(),U&&V.isExpanded(U)&&ee.collapse(f,{edge:"focus"}),ee.move(f,{unit:"word",reverse:J});return}if(tn){if((bf||Cr)&&U&&(Ke.isDeleteBackward(R)||Ke.isDeleteForward(R))&&V.isCollapsed(U)){var X=ue.parent(f,U.anchor.path);if(ce.isElement(X)&&D.isVoid(f,X)&&(D.isInline(f,X)||D.isBlock(f,X))){T.preventDefault(),D.deleteBackward(f,{unit:"block"});return}}}else{if(Ke.isBold(R)||Ke.isItalic(R)||Ke.isTransposeCharacter(R)){T.preventDefault();return}if(Ke.isSoftBreak(R)){T.preventDefault(),D.insertSoftBreak(f);return}if(Ke.isSplitBlock(R)){T.preventDefault(),D.insertBreak(f);return}if(Ke.isDeleteBackward(R)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f);return}if(Ke.isDeleteForward(R)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f);return}if(Ke.isDeleteLineBackward(R)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f,{unit:"line"});return}if(Ke.isDeleteLineForward(R)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f,{unit:"line"});return}if(Ke.isDeleteWordBackward(R)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f,{unit:"word"});return}if(Ke.isDeleteWordForward(R)){T.preventDefault(),U&&V.isExpanded(U)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:y.useCallback(T=>{!s&&te.hasEditableTarget(f,T.target)&&!st(T,g.onPaste)&&(!tn||u1(T.nativeEvent)||Cr)&&(T.preventDefault(),te.insertData(f,T.clipboardData))},[s,f,g.onPaste])}),y.createElement(lD,{decorations:L,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},dD=e=>{var{attributes:t,children:n}=e;return y.createElement("span",Mt({},t),n,ut&&y.createElement("br",null))},fD=()=>[],hD=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&V.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),Ey(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},st=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},zl=e=>cn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),mD=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},pD=y.createContext(!1),gD=y.createContext({});function vD(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 bD=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],yD=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=nr(e,bD),[l,u]=y.useState(()=>{if(!ue.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(et.stringify(s)));if(!D.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(et.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:m}=vD(t),p=y.useCallback(f=>{var b;switch(r&&r(t.children),f==null||(b=f.operation)===null||b===void 0?void 0:b.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(v=>({v:v.v+1,editor:t})),m(t)},[t,m,r,a,i]);y.useEffect(()=>(Ps.set(t,p),()=>{Ps.set(t,()=>{})}),[t,p]);var[h,g]=y.useState(te.isFocused(t));return y.useEffect(()=>{g(te.isFocused(t))},[t]),Lr(()=>{var f=()=>g(te.isFocused(t));return vf>=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(gD.Provider,{value:d},y.createElement(Of.Provider,{value:l},y.createElement(wo.Provider,{value:l.editor},y.createElement(pD.Provider,{value:h},n))))},ql=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Wl=(e,t,n)=>{var r=te.toDOMRange(e,t).getBoundingClientRect(),a=te.toDOMRange(e,n).getBoundingClientRect();return ql(r,a)&&ql(a,r)},DD=(e,t)=>{var n=D.range(e,V.end(t)),r=Array.from(D.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(Wl(e,D.range(e,r[a]),n))return D.range(e,r[a],n);if(r.length<2)return D.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)Wl(e,D.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return D.range(e,r[i],n)};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 Hl(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){kt(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 CD=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 oi.set(r,new WeakMap),r.addMark=(u,d)=>{var m,p;(m=ko.get(r))===null||m===void 0||m(),!Tt.get(r)&&(p=dt.get(r))!==null&&p!==void 0&&p.length&&Tt.set(r,null),Zt.delete(r),o(u,d)},r.removeMark=u=>{var d;!Tt.get(r)&&(d=dt.get(r))!==null&&d!==void 0&&d.length&&Tt.set(r,null),Zt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&V.isCollapsed(r.selection)){var d=D.above(r,{match:g=>ce.isElement(g)&&D.isBlock(r,g),at:r.selection});if(d){var[,m]=d,p=D.range(r,m,r.selection.anchor),h=DD(r,p);V.isCollapsed(h)||ee.delete(r,{at:h})}}},r.apply=u=>{var d=[],m=[],p=dt.get(r);if(p!=null&&p.length){var h=p.map(j=>C1(j,u)).filter(Boolean);dt.set(r,h)}var g=an.get(r);g&&an.set(r,jl(r,g,u));var f=rn.get(r);if(f!=null&&f.at){var b=we.isPoint(f==null?void 0:f.at)?Is(r,f.at,u):jl(r,f.at,u);rn.set(r,b?Hl(Hl({},f),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Ln(r,u.path));break}case"set_selection":{var v;(v=_r.get(r))===null||v===void 0||v.unref(),_r.delete(r);break}case"insert_node":case"remove_node":{d.push(...Ln(r,P.parent(u.path)));break}case"merge_node":{var _=P.previous(u.path);d.push(...Ln(r,_));break}case"move_node":{var F=P.common(P.parent(u.path),P.parent(u.newPath));d.push(...Ln(r,F));var x;P.isBefore(u.path,u.newPath)?(d.push(...Ln(r,P.parent(u.path))),x=u.newPath):(d.push(...Ln(r,P.parent(u.newPath))),x=u.path);var w=ue.get(t,P.parent(x)),B=te.findKey(r,w),S=D.pathRef(r,P.parent(x));m.push([S,B]);break}}a(u);for(var[z,N]of d){var[I]=D.node(r,z);za.set(I,N)}for(var[M,k]of m)if(M.current){var[A]=D.node(r,M.current);za.set(A,k)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[m,p]=V.edges(d),h=D.void(r,{at:m.path}),g=D.void(r,{at:p.path});if(!(V.isCollapsed(d)&&!h)){var f=te.toDOMRange(r,d),b=f.cloneContents(),v=b.childNodes[0];if(b.childNodes.forEach(I=>{I.textContent&&I.textContent.trim()!==""&&(v=I)}),g){var[_]=g,F=f.cloneRange(),x=te.toDOMNode(r,_);F.setEndAfter(x),b=F.cloneContents()}if(h&&(v=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(I=>{var M=I.getAttribute("data-slate-zero-width")==="n";I.textContent=M?`
139
- `:""}),xf(v)){var w=v.ownerDocument.createElement("span");w.style.whiteSpace="pre",w.appendChild(v),b.appendChild(w),v=w}var B=r.getFragment(),S=JSON.stringify(B),z=window.btoa(encodeURIComponent(S));v.setAttribute("data-slate-fragment",z),u.setData("application/".concat(n),z);var N=b.ownerDocument.createElement("div");return N.appendChild(b),N.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(N),u.setData("text/html",N.innerHTML),u.setData("text/plain",Ef(N)),b.ownerDocument.body.removeChild(N),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||h1(u);if(d){var m=decodeURIComponent(window.atob(d)),p=JSON.parse(m);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var d=u.getData("text/plain");if(d){var m=d.split(/\r\n|\r|\n/),p=!1;for(var h of m)p&&ee.splitNodes(r,{always:!0}),r.insertText(h),p=!0;return!0}return!1},r.onChange=u=>{var d=vf<18?Oc.unstable_batchedUpdates:m=>m();d(()=>{var m=Ps.get(r);m&&m(u),i(u)})},r},Ln=(e,t)=>{var n=[];for(var[r,a]of D.levels(e,{at:t})){var i=te.findKey(e,r);n.push([a,i])}return n};const xD={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)}},en=y.createContext(xD);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||{}),$t=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))($t||{});const wD=({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 a!=null&&a.name&&a.name===Tr?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(se.FormattedMessage,{id:"member_deleted"}),t]}):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})}},ED=({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})},$s="MENTION: ",Nf={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},Vl={"mention-popover":35,default:-52},qi=16,Mf=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:a,mentionPopover:i}=y.useContext(en),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var h,g;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,d=0;if(t==="mention-popover"){const{position:f}=i,b=F=>{if(!D.hasPath(e,F.path))return!1;const x=ue.get(e,F.path);return D.isEditor(x)||ce.isElement(x)?F.offset<=x.children.length:fe.isText(x)?F.offset<=x.text.length:!1};if(f&&(!b(f==null?void 0:f.anchor)||!b(f==null?void 0:f.focus)))return;u=te.toDOMRange(e,f||Nf).getBoundingClientRect();const _=(h=document.getElementById(n))==null?void 0:h.getBoundingClientRect();l.style.setProperty("--width",`${((_==null?void 0:_.width)||0)/qi}rem`),d=(_==null?void 0:_.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(u=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}u||(u=(g=document.getElementById(n))==null?void 0:g.getBoundingClientRect());const m=Vl[t]||Vl.default,p=((u==null?void 0:u.top)||0)+window.scrollY+m;d===0&&(d=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${p/qi}rem`,l.style.left=`${d/qi}rem`},o),r},_D=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=D.nodes(e,{at:r,match:i=>i.type===Z.link});if(a){const i=a[0],s=Qc(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 ot=(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))(ot||{});const Zn={[Z.paragraph]:Z.paragraph,[Z.blockquote]:Z.blockquote,[Z.codeblock]:Z.codeblock,[Z.link]:Z.link,[Z.ul]:Z.ul,[Z.ol]:Z.ol,[Z.li]:Z.li,[Z.mention]:Z.mention,[Z.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[$t.emphasis]:Z.italic,[$t.strong]:Z.bold,[$t.delete]:Z.strikethrough,[$t.code]:Z.code,[Z.hr]:Z.hr,[Z.image]:Z.image};function Kl(e){if(e)throw e}var ka=Object.prototype.hasOwnProperty,If=Object.prototype.toString,Zl=Object.defineProperty,Yl=Object.getOwnPropertyDescriptor,Gl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):If.call(t)==="[object Array]"},Ql=function(t){if(!t||If.call(t)!=="[object Object]")return!1;var n=ka.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&ka.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||ka.call(t,a)},Jl=function(t,n){Zl&&n.name==="__proto__"?Zl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Xl=function(t,n){if(n==="__proto__")if(ka.call(t,n)){if(Yl)return Yl(t,n).value}else return;return t[n]},kD=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=Xl(o,n),a=Xl(t,n),o!==a&&(d&&a&&(Ql(a)||(i=Gl(a)))?(i?(i=!1,s=r&&Gl(r)?r:[]):s=r&&Ql(r)?r:{},Jl(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&Jl(o,{name:n,newValue:a}));return o};const Wi=jn(kD);function Ls(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 FD(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const d=e[++i];let m=-1;if(l){s(l);return}for(;++m<a.length;)(u[m]===null||u[m]===void 0)&&(u[m]=a[m]);a=u,d?BD(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 BD(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 kr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ec(e.position):"start"in e||"end"in e?ec(e):"line"in e||"column"in e?zs(e):""}function zs(e){return tc(e&&e.line)+":"+tc(e&&e.column)}function ec(e){return zs(e&&e.start)+"-"+zs(e&&e.end)}function tc(e){return e&&typeof e=="number"?e:1}class pt 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=kr(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}}pt.prototype.file="";pt.prototype.name="";pt.prototype.reason="";pt.prototype.message="";pt.prototype.stack="";pt.prototype.column=void 0;pt.prototype.line=void 0;pt.prototype.ancestors=void 0;pt.prototype.cause=void 0;pt.prototype.fatal=void 0;pt.prototype.place=void 0;pt.prototype.ruleId=void 0;pt.prototype.source=void 0;const It={basename:AD,dirname:TD,extname:SD,join:jD,sep:"/"};function AD(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Hr(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 TD(e){if(Hr(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 SD(e){Hr(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 jD(...e){let t=-1,n;for(;++t<e.length;)Hr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":OD(n)}function OD(e){Hr(e);const t=e.codePointAt(0)===47;let n=PD(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function PD(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 Hr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const ND={cwd:MD};function MD(){return"/"}function qs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ID(e){if(typeof e=="string")e=new URL(e);else if(!qs(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 RD(e)}function RD(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 Ui=["history","path","basename","stem","extname","dirname"];class $D{constructor(t){let n;t?qs(t)?n={path:t}:typeof t=="string"||LD(t)?n={value:t}:n=t:n={},this.cwd=ND.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ui.length;){const i=Ui[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)Ui.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?It.basename(this.path):void 0}set basename(t){Vi(t,"basename"),Hi(t,"basename"),this.path=It.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?It.dirname(this.path):void 0}set dirname(t){nc(this.basename,"dirname"),this.path=It.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?It.extname(this.path):void 0}set extname(t){if(Hi(t,"extname"),nc(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=It.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){qs(t)&&(t=ID(t)),Vi(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?It.basename(this.path,this.extname):void 0}set stem(t){Vi(t,"stem"),Hi(t,"stem"),this.path=It.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 pt(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 Hi(e,t){if(e&&e.includes(It.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+It.sep+"`")}function Vi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function nc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function LD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const zD=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},qD={}.hasOwnProperty;class Ao extends zD{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=FD()}copy(){const t=new Ao;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Wi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Yi("data",this.frozen),this.namespace[t]=n,this):qD.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Yi("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=fa(t),r=this.parser||this.Parser;return Ki("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ki("process",this.parser||this.Parser),Zi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=fa(t),l=r.parse(o);r.run(l,o,function(d,m,p){if(d||!m||!p)return u(d);const h=m,g=r.stringify(h,p);HD(g)?p.value=g:p.result=g,u(d,p)});function u(d,m){d||!m?s(d):i?i(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),Ki("processSync",this.parser||this.Parser),Zi("processSync",this.compiler||this.Compiler),this.process(t,a),ac("processSync","process",n),r;function a(i,s){n=!0,Kl(i),r=s}}run(t,n,r){rc(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=fa(n);a.run(t,l,u);function u(d,m,p){const h=m||t;d?o(d):s?s(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),ac("runSync","run",r),a;function i(s,o){Kl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=fa(n),a=this.compiler||this.Compiler;return Zi("stringify",a),rc(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Yi("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...m]=u;l(d,m)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(a.settings=Wi(!0,a.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const m=u[d];i(m)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let m=-1,p=-1;for(;++m<r.length;)if(r[m][0]===u){p=m;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[h,...g]=d;const f=r[p][1];Ls(f)&&Ls(h)&&(h=Wi(!0,f,h)),r[p]=[u,h,...g]}}}}const WD=new Ao().freeze();function Ki(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Zi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Yi(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 rc(e){if(!Ls(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ac(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function fa(e){return UD(e)?e:new $D(e)}function UD(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function HD(e){return typeof e=="string"||VD(e)}function VD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const KD={};function ZD(e,t){const n=t||KD,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Rf(e,r,a)}function Rf(e,t,n){if(YD(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 ic(e.children,t,n)}return Array.isArray(e)?ic(e,t,n):""}function ic(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Rf(e[a],t,n);return r.join("")}function YD(e){return!!(e&&typeof e=="object")}const sc=document.createElement("i");function To(e){const t="&"+e+";";sc.innerHTML=t;const n=sc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Qt(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 Et(e,t){return e.length>0?(Qt(e,e.length,0,t),e):t}const oc={}.hasOwnProperty;function GD(e){const t={};let n=-1;for(;++n<e.length;)QD(t,e[n]);return t}function QD(e,t){let n;for(n in t){const a=(oc.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){oc.call(a,s)||(a[s]=[]);const o=i[s];JD(a[s],Array.isArray(o)?o:o?[o]:[])}}}function JD(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Qt(e,0,0,r)}function $f(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 Qn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Rt=gn(/[A-Za-z]/),St=gn(/[\dA-Za-z]/),XD=gn(/[#-'*+\--9=?A-Z^-~]/);function Ws(e){return e!==null&&(e<32||e===127)}const Us=gn(/\d/),eC=gn(/[\dA-Fa-f]/),tC=gn(/[!-/:-@[-`{-~]/);function ve(e){return e!==null&&e<-2}function ht(e){return e!==null&&(e<0||e===32)}function Oe(e){return e===-2||e===-1||e===32}const nC=gn(/\p{P}|\p{S}/u),rC=gn(/\s/);function gn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Le(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Oe(l)?(e.enter(n),o(l)):t(l)}function o(l){return Oe(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const aC={tokenize:iC};function iC(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"),Le(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 ve(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const sC={tokenize:oC},uc={tokenize:uC};function oC(e){const t=this,n=[];let r=0,a,i,s;return o;function o(F){if(r<n.length){const x=n[r];return t.containerState=x[1],e.attempt(x[0].continuation,l,u)(F)}return u(F)}function l(F){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&_();const x=t.events.length;let w=x,B;for(;w--;)if(t.events[w][0]==="exit"&&t.events[w][1].type==="chunkFlow"){B=t.events[w][1].end;break}v(r);let S=x;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},B),S++;return Qt(t.events,w+1,0,t.events.slice(x)),t.events.length=S,u(F)}return o(F)}function u(F){if(r===n.length){if(!a)return p(F);if(a.currentConstruct&&a.currentConstruct.concrete)return g(F);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(uc,d,m)(F)}function d(F){return a&&_(),v(r),p(F)}function m(F){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(F)}function p(F){return t.containerState={},e.attempt(uc,h,g)(F)}function h(F){return r++,n.push([t.currentConstruct,t.containerState]),p(F)}function g(F){if(F===null){a&&_(),v(0),e.consume(F);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(F)}function f(F){if(F===null){b(e.exit("chunkFlow"),!0),v(0),e.consume(F);return}return ve(F)?(e.consume(F),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(F),f)}function b(F,x){const w=t.sliceStream(F);if(x&&w.push(null),F.previous=i,i&&(i.next=F),i=F,a.defineSkip(F.start),a.write(w),t.parser.lazy[F.start.line]){let B=a.events.length;for(;B--;)if(a.events[B][1].start.offset<s&&(!a.events[B][1].end||a.events[B][1].end.offset>s))return;const S=t.events.length;let z=S,N,I;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(N){I=t.events[z][1].end;break}N=!0}for(v(r),B=S;B<t.events.length;)t.events[B][1].end=Object.assign({},I),B++;Qt(t.events,z+1,0,t.events.slice(S)),t.events.length=B}}function v(F){let x=n.length;for(;x-- >F;){const w=n[x];t.containerState=w[1],w[0].exit.call(t,e)}n.length=F}function _(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function uC(e,t,n){return Le(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function lc(e){if(e===null||ht(e)||rC(e))return 1;if(nC(e))return 2}function So(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 Hs={name:"attention",tokenize:cC,resolveAll:lC};function lC(e,t){let n=-1,r,a,i,s,o,l,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);cc(m,-l),cc(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:m,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end: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=Et(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Et(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Et(u,So(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Et(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=Et(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Qt(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 cC(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=lc(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=lc(l),m=!d||d===2&&a||n.includes(l),p=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?m:m&&(a||!p)),u._close=!!(i===42?p:p&&(d||!m)),t(l)}}function cc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const dC={name:"autolink",tokenize:fC};function fC(e,t,n){let r=0;return a;function a(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return Rt(h)?(e.consume(h),s):h===64?n(h):u(h)}function s(h){return h===43||h===45||h===46||St(h)?(r=1,o(h)):u(h)}function o(h){return h===58?(e.consume(h),r=0,l):(h===43||h===45||h===46||St(h))&&r++<32?(e.consume(h),o):(r=0,u(h))}function l(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||Ws(h)?n(h):(e.consume(h),l)}function u(h){return h===64?(e.consume(h),d):XD(h)?(e.consume(h),u):n(h)}function d(h){return St(h)?m(h):n(h)}function m(h){return h===46?(e.consume(h),r=0,d):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||St(h))&&r++<63){const g=h===45?p:m;return e.consume(h),g}return n(h)}}const ui={tokenize:hC,partial:!0};function hC(e,t,n){return r;function r(i){return Oe(i)?Le(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ve(i)?t(i):n(i)}}const Lf={name:"blockQuote",tokenize:mC,continuation:{tokenize:pC},exit:gC};function mC(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 Oe(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function pC(e,t,n){const r=this;return a;function a(s){return Oe(s)?Le(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Lf,t,n)(s)}}function gC(e){e.exit("blockQuote")}const zf={name:"characterEscape",tokenize:vC};function vC(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 tC(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const qf={name:"characterReference",tokenize:bC};function bC(e,t,n){const r=this;let a=0,i,s;return o;function o(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),l}function l(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=St,d(m))}function u(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=eC,d):(e.enter("characterReferenceValue"),i=7,s=Us,d(m))}function d(m){if(m===59&&a){const p=e.exit("characterReferenceValue");return s===St&&!To(r.sliceSerialize(p))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(m)&&a++<i?(e.consume(m),d):n(m)}}const dc={tokenize:DC,partial:!0},fc={name:"codeFenced",tokenize:yC,concrete:!0};function yC(e,t,n){const r=this,a={tokenize:w,partial:!0};let i=0,s=0,o;return l;function l(B){return u(B)}function u(B){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=B,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(B)}function d(B){return B===o?(s++,e.consume(B),d):s<3?n(B):(e.exit("codeFencedFenceSequence"),Oe(B)?Le(e,m,"whitespace")(B):m(B))}function m(B){return B===null||ve(B)?(e.exit("codeFencedFence"),r.interrupt?t(B):e.check(dc,f,x)(B)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(B))}function p(B){return B===null||ve(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(B)):Oe(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Le(e,h,"whitespace")(B)):B===96&&B===o?n(B):(e.consume(B),p)}function h(B){return B===null||ve(B)?m(B):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(B))}function g(B){return B===null||ve(B)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(B)):B===96&&B===o?n(B):(e.consume(B),g)}function f(B){return e.attempt(a,x,b)(B)}function b(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),v}function v(B){return i>0&&Oe(B)?Le(e,_,"linePrefix",i+1)(B):_(B)}function _(B){return B===null||ve(B)?e.check(dc,f,x)(B):(e.enter("codeFlowValue"),F(B))}function F(B){return B===null||ve(B)?(e.exit("codeFlowValue"),_(B)):(e.consume(B),F)}function x(B){return e.exit("codeFenced"),t(B)}function w(B,S,z){let N=0;return I;function I(L){return B.enter("lineEnding"),B.consume(L),B.exit("lineEnding"),M}function M(L){return B.enter("codeFencedFence"),Oe(L)?Le(B,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):k(L)}function k(L){return L===o?(B.enter("codeFencedFenceSequence"),A(L)):z(L)}function A(L){return L===o?(N++,B.consume(L),A):N>=s?(B.exit("codeFencedFenceSequence"),Oe(L)?Le(B,j,"whitespace")(L):j(L)):z(L)}function j(L){return L===null||ve(L)?(B.exit("codeFencedFence"),S(L)):z(L)}}}function DC(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 Gi={name:"codeIndented",tokenize:xC},CC={tokenize:wC,partial:!0};function xC(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Le(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):ve(u)?e.attempt(CC,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||ve(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function wC(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):ve(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Le(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):ve(s)?a(s):n(s)}}const EC={name:"codeText",tokenize:FC,resolve:_C,previous:kC};function _C(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 kC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function FC(e,t,n){let r=0,a,i;return s;function s(m){return e.enter("codeText"),e.enter("codeTextSequence"),o(m)}function o(m){return m===96?(e.consume(m),r++,o):(e.exit("codeTextSequence"),l(m))}function l(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),l):m===96?(i=e.enter("codeTextSequence"),a=0,d(m)):ve(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||ve(m)?(e.exit("codeTextData"),l(m)):(e.consume(m),u)}function d(m){return m===96?(e.consume(m),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(i.type="codeTextData",u(m))}}class BC{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&br(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),br(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),br(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);br(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);br(this.left,n.reverse())}}}function br(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Wf(e){const t={};let n=-1,r,a,i,s,o,l,u;const d=new BC(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,AC(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=d.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},d.get(a)[1].start),o=d.slice(a,n),o.unshift(r),d.splice(a,n-a+1,o))}}return Qt(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function AC(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let d,m,p=-1,h=n,g=0,f=0;const b=[f];for(;h;){for(;e.get(++a)[1]!==h;);i.push(a),h._tokenizer||(d=r.sliceStream(h),h.next||d.push(null),m&&s.defineSkip(h.start),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),m=h,h=h.next}for(h=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(f=p+1,b.push(f),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(s.events=[],h?(h._tokenizer=void 0,h.previous=void 0):b.pop(),p=b.length;p--;){const v=o.slice(b[p],b[p+1]),_=i.pop();l.push([_,_+v.length-1]),e.splice(_,2,v)}for(l.reverse(),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 TC={tokenize:OC,resolve:jC},SC={tokenize:PC,partial:!0};function jC(e){return Wf(e),e}function OC(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):ve(o)?e.check(SC,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 PC(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Le(e,i,"linePrefix")}function i(s){if(s===null||ve(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 Uf(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return m;function m(v){return v===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(v),e.exit(i),p):v===null||v===32||v===41||Ws(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"}),h(v))}function h(v){return v===62?(e.exit("chunkString"),e.exit(o),p(v)):v===null||v===60||ve(v)?n(v):(e.consume(v),v===92?g:h)}function g(v){return v===60||v===62||v===92?(e.consume(v),h):h(v)}function f(v){return!d&&(v===null||v===41||ht(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):d<u&&v===40?(e.consume(v),d++,f):v===41?(e.consume(v),d--,f):v===null||v===32||v===40||Ws(v)?n(v):(e.consume(v),v===92?b:f)}function b(v){return v===40||v===41||v===92?(e.consume(v),f):f(v)}}function Hf(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(h){return e.enter(r),e.enter(a),e.consume(h),e.exit(a),e.enter(i),d}function d(h){return o>999||h===null||h===91||h===93&&!l||h===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(h):h===93?(e.exit(i),e.enter(a),e.consume(h),e.exit(a),e.exit(r),t):ve(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),m(h))}function m(h){return h===null||h===91||h===93||ve(h)||o++>999?(e.exit("chunkString"),d(h)):(e.consume(h),l||(l=!Oe(h)),h===92?p:m)}function p(h){return h===91||h===92||h===93?(e.consume(h),o++,m):m(h)}}function Vf(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):ve(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Le(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===s||p===null||ve(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?m:d)}function m(p){return p===s||p===92?(e.consume(p),d):d(p)}}function Fr(e,t){let n;return r;function r(a){return ve(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Oe(a)?Le(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const NC={name:"definition",tokenize:IC},MC={tokenize:RC,partial:!0};function IC(e,t,n){const r=this;let a;return i;function i(h){return e.enter("definition"),s(h)}function s(h){return Hf.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function o(h){return a=Qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return ht(h)?Fr(e,u)(h):u(h)}function u(h){return Uf(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return e.attempt(MC,m,m)(h)}function m(h){return Oe(h)?Le(e,p,"whitespace")(h):p(h)}function p(h){return h===null||ve(h)?(e.exit("definition"),r.parser.defined.push(a),t(h)):n(h)}}function RC(e,t,n){return r;function r(o){return ht(o)?Fr(e,a)(o):n(o)}function a(o){return Vf(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Oe(o)?Le(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ve(o)?t(o):n(o)}}const $C={name:"hardBreakEscape",tokenize:LC};function LC(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return ve(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const zC={name:"headingAtx",tokenize:WC,resolve:qC};function qC(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"},Qt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function WC(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||ht(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||ve(d)?(e.exit("atxHeading"),t(d)):Oe(d)?Le(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||ht(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const UC=["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"],hc=["pre","script","style","textarea"],HC={name:"htmlFlow",tokenize:YC,resolveTo:ZC,concrete:!0},VC={tokenize:QC,partial:!0},KC={tokenize:GC,partial:!0};function ZC(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 YC(e,t,n){const r=this;let a,i,s,o,l;return u;function u(E){return d(E)}function d(E){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(E),m}function m(E){return E===33?(e.consume(E),p):E===47?(e.consume(E),i=!0,f):E===63?(e.consume(E),a=3,r.interrupt?t:C):Rt(E)?(e.consume(E),s=String.fromCharCode(E),b):n(E)}function p(E){return E===45?(e.consume(E),a=2,h):E===91?(e.consume(E),a=5,o=0,g):Rt(E)?(e.consume(E),a=4,r.interrupt?t:C):n(E)}function h(E){return E===45?(e.consume(E),r.interrupt?t:C):n(E)}function g(E){const T="CDATA[";return E===T.charCodeAt(o++)?(e.consume(E),o===T.length?r.interrupt?t:k:g):n(E)}function f(E){return Rt(E)?(e.consume(E),s=String.fromCharCode(E),b):n(E)}function b(E){if(E===null||E===47||E===62||ht(E)){const T=E===47,$=s.toLowerCase();return!T&&!i&&hc.includes($)?(a=1,r.interrupt?t(E):k(E)):UC.includes(s.toLowerCase())?(a=6,T?(e.consume(E),v):r.interrupt?t(E):k(E)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(E):i?_(E):F(E))}return E===45||St(E)?(e.consume(E),s+=String.fromCharCode(E),b):n(E)}function v(E){return E===62?(e.consume(E),r.interrupt?t:k):n(E)}function _(E){return Oe(E)?(e.consume(E),_):I(E)}function F(E){return E===47?(e.consume(E),I):E===58||E===95||Rt(E)?(e.consume(E),x):Oe(E)?(e.consume(E),F):I(E)}function x(E){return E===45||E===46||E===58||E===95||St(E)?(e.consume(E),x):w(E)}function w(E){return E===61?(e.consume(E),B):Oe(E)?(e.consume(E),w):F(E)}function B(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),l=E,S):Oe(E)?(e.consume(E),B):z(E)}function S(E){return E===l?(e.consume(E),l=null,N):E===null||ve(E)?n(E):(e.consume(E),S)}function z(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||ht(E)?w(E):(e.consume(E),z)}function N(E){return E===47||E===62||Oe(E)?F(E):n(E)}function I(E){return E===62?(e.consume(E),M):n(E)}function M(E){return E===null||ve(E)?k(E):Oe(E)?(e.consume(E),M):n(E)}function k(E){return E===45&&a===2?(e.consume(E),H):E===60&&a===1?(e.consume(E),Y):E===62&&a===4?(e.consume(E),q):E===63&&a===3?(e.consume(E),C):E===93&&a===5?(e.consume(E),re):ve(E)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(VC,K,A)(E)):E===null||ve(E)?(e.exit("htmlFlowData"),A(E)):(e.consume(E),k)}function A(E){return e.check(KC,j,K)(E)}function j(E){return e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),L}function L(E){return E===null||ve(E)?A(E):(e.enter("htmlFlowData"),k(E))}function H(E){return E===45?(e.consume(E),C):k(E)}function Y(E){return E===47?(e.consume(E),s="",Q):k(E)}function Q(E){if(E===62){const T=s.toLowerCase();return hc.includes(T)?(e.consume(E),q):k(E)}return Rt(E)&&s.length<8?(e.consume(E),s+=String.fromCharCode(E),Q):k(E)}function re(E){return E===93?(e.consume(E),C):k(E)}function C(E){return E===62?(e.consume(E),q):E===45&&a===2?(e.consume(E),C):k(E)}function q(E){return E===null||ve(E)?(e.exit("htmlFlowData"),K(E)):(e.consume(E),q)}function K(E){return e.exit("htmlFlow"),t(E)}}function GC(e,t,n){const r=this;return a;function a(s){return ve(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 QC(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(ui,t,n)}}const JC={name:"htmlText",tokenize:XC};function XC(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),w):C===63?(e.consume(C),F):Rt(C)?(e.consume(C),z):n(C)}function u(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),i=0,g):Rt(C)?(e.consume(C),_):n(C)}function d(C){return C===45?(e.consume(C),h):n(C)}function m(C){return C===null?n(C):C===45?(e.consume(C),p):ve(C)?(s=m,Y(C)):(e.consume(C),m)}function p(C){return C===45?(e.consume(C),h):m(C)}function h(C){return C===62?H(C):C===45?p(C):m(C)}function g(C){const q="CDATA[";return C===q.charCodeAt(i++)?(e.consume(C),i===q.length?f:g):n(C)}function f(C){return C===null?n(C):C===93?(e.consume(C),b):ve(C)?(s=f,Y(C)):(e.consume(C),f)}function b(C){return C===93?(e.consume(C),v):f(C)}function v(C){return C===62?H(C):C===93?(e.consume(C),v):f(C)}function _(C){return C===null||C===62?H(C):ve(C)?(s=_,Y(C)):(e.consume(C),_)}function F(C){return C===null?n(C):C===63?(e.consume(C),x):ve(C)?(s=F,Y(C)):(e.consume(C),F)}function x(C){return C===62?H(C):F(C)}function w(C){return Rt(C)?(e.consume(C),B):n(C)}function B(C){return C===45||St(C)?(e.consume(C),B):S(C)}function S(C){return ve(C)?(s=S,Y(C)):Oe(C)?(e.consume(C),S):H(C)}function z(C){return C===45||St(C)?(e.consume(C),z):C===47||C===62||ht(C)?N(C):n(C)}function N(C){return C===47?(e.consume(C),H):C===58||C===95||Rt(C)?(e.consume(C),I):ve(C)?(s=N,Y(C)):Oe(C)?(e.consume(C),N):H(C)}function I(C){return C===45||C===46||C===58||C===95||St(C)?(e.consume(C),I):M(C)}function M(C){return C===61?(e.consume(C),k):ve(C)?(s=M,Y(C)):Oe(C)?(e.consume(C),M):N(C)}function k(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),a=C,A):ve(C)?(s=k,Y(C)):Oe(C)?(e.consume(C),k):(e.consume(C),j)}function A(C){return C===a?(e.consume(C),a=void 0,L):C===null?n(C):ve(C)?(s=A,Y(C)):(e.consume(C),A)}function j(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||ht(C)?N(C):(e.consume(C),j)}function L(C){return C===47||C===62||ht(C)?N(C):n(C)}function H(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function Y(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),Q}function Q(C){return Oe(C)?Le(e,re,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):re(C)}function re(C){return e.enter("htmlTextData"),s(C)}}const jo={name:"labelEnd",tokenize:ix,resolveTo:ax,resolveAll:rx},ex={tokenize:sx},tx={tokenize:ox},nx={tokenize:ux};function rx(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 ax(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=Et(o,e.slice(i+1,i+r+3)),o=Et(o,[["enter",d,t]]),o=Et(o,So(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=Et(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=Et(o,e.slice(s+1)),o=Et(o,[["exit",l,t]]),Qt(e,i,e.length,o),e}function ix(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?m(p):(s=r.parser.defined.includes(Qn(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(ex,d,s?d:m)(p):p===91?e.attempt(tx,d,s?u:m)(p):s?d(p):m(p)}function u(p){return e.attempt(nx,d,m)(p)}function d(p){return t(p)}function m(p){return i._balanced=!0,n(p)}}function sx(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return ht(m)?Fr(e,i)(m):i(m)}function i(m){return m===41?d(m):Uf(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function s(m){return ht(m)?Fr(e,l)(m):d(m)}function o(m){return n(m)}function l(m){return m===34||m===39||m===40?Vf(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):d(m)}function u(m){return ht(m)?Fr(e,d)(m):d(m)}function d(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function ox(e,t,n){const r=this;return a;function a(o){return Hf.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function ux(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 lx={name:"labelStartImage",tokenize:cx,resolveAll:jo.resolveAll};function cx(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 dx={name:"labelStartLink",tokenize:fx,resolveAll:jo.resolveAll};function fx(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 Qi={name:"lineEnding",tokenize:hx};function hx(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Le(e,t,"linePrefix")}}const Fa={name:"thematicBreak",tokenize:mx};function mx(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||ve(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Oe(u)?Le(e,o,"whitespace")(u):o(u))}}const ct={name:"list",tokenize:vx,continuation:{tokenize:bx},exit:Dx},px={tokenize:Cx,partial:!0},gx={tokenize:yx,partial:!0};function vx(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(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:Us(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Fa,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return Us(h)&&++s<10?(e.consume(h),l):(!r.interrupt||s<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(ui,r.interrupt?n:d,e.attempt(px,p,m))}function d(h){return r.containerState.initialBlankLine=!0,i++,p(h)}function m(h){return Oe(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function bx(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ui,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Le(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Oe(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(gx,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Le(e,e.attempt(ct,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function yx(e,t,n){const r=this;return Le(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 Dx(e){e.exit(this.containerState.type)}function Cx(e,t,n){const r=this;return Le(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!Oe(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const mc={name:"setextUnderline",tokenize:wx,resolveTo:xx};function xx(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 wx(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,m;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){m=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Oe(u)?Le(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ve(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Ex={tokenize:_x};function _x(e){const t=this,n=e.attempt(ui,r,e.attempt(this.parser.constructs.flowInitial,a,Le(e,e.attempt(this.parser.constructs.flow,a,e.attempt(TC,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 kx={resolveAll:Zf()},Fx=Kf("string"),Bx=Kf("text");function Kf(e){return{tokenize:t,resolveAll:Zf(e==="text"?Ax:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const m=a[d];let p=-1;if(m)for(;++p<m.length;){const h=m[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function Zf(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 Ax(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 Tx(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:_,enter:F,exit:x,attempt:S(w),check:S(B),interrupt:S(B,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:h,sliceSerialize:p,now:g,defineSkip:f,write:m};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function m(M){return s=Et(s,M),b(),s[s.length-1]!==null?[]:(z(t,0),u.events=So(i,u.events,u),u.events)}function p(M,k){return jx(h(M),k)}function h(M){return Sx(s,M)}function g(){const{line:M,column:k,offset:A,_index:j,_bufferIndex:L}=r;return{line:M,column:k,offset:A,_index:j,_bufferIndex:L}}function f(M){a[M.line]=M.column,I()}function b(){let M;for(;r._index<s.length;){const k=s[r._index];if(typeof k=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<k.length;)v(k.charCodeAt(r._bufferIndex));else v(k)}}function v(M){d=d(M)}function _(M){ve(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,I()):M!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=M}function F(M,k){const A=k||{};return A.type=M,A.start=g(),u.events.push(["enter",A,u]),o.push(A),A}function x(M){const k=o.pop();return k.end=g(),u.events.push(["exit",k,u]),k}function w(M,k){z(M,k.from)}function B(M,k){k.restore()}function S(M,k){return A;function A(j,L,H){let Y,Q,re,C;return Array.isArray(j)?K(j):"tokenize"in j?K([j]):q(j);function q(R){return U;function U(ae){const J=ae!==null&&R[ae],ie=ae!==null&&R.null,de=[...Array.isArray(J)?J:J?[J]:[],...Array.isArray(ie)?ie:ie?[ie]:[]];return K(de)(ae)}}function K(R){return Y=R,Q=0,R.length===0?H:E(R[Q])}function E(R){return U;function U(ae){return C=N(),re=R,R.partial||(u.currentConstruct=R),R.name&&u.parser.constructs.disable.null.includes(R.name)?$():R.tokenize.call(k?Object.assign(Object.create(u),k):u,l,T,$)(ae)}}function T(R){return M(re,C),L}function $(R){return C.restore(),++Q<Y.length?E(Y[Q]):H}}}function z(M,k){M.resolveAll&&!i.includes(M)&&i.push(M),M.resolve&&Qt(u.events,k,u.events.length-k,M.resolve(u.events.slice(k),u)),M.resolveTo&&(u.events=M.resolveTo(u.events,u))}function N(){const M=g(),k=u.previous,A=u.currentConstruct,j=u.events.length,L=Array.from(o);return{restore:H,from:j};function H(){r=M,u.previous=k,u.currentConstruct=A,u.events.length=j,o=L,I()}}function I(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function Sx(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 jx(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=`
134
+ `)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var E;u=o,d=((E=o.textContent)===null||E===void 0?void 0:E.length)||0}var B=ne.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!B)return null;var _=m?B:ne.toSlatePoint(e,[u,d],{exactMatch:a,suppressThrow:i});if(!_)return null;var x={anchor:B,focus:_};return H.isExpanded(x)&&H.isForward(x)&&kt(u)&&D.void(e,{at:x.focus,mode:"highest"})&&(x=D.unhangRange(e,x,{voids:!0})),x}};function w1(e,t){var{path:n,diff:r}=t;if(!D.hasPath(e,n))return!1;var a=ue.get(e,n);if(!he.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=P.next(n);if(!D.hasPath(e,i))return!1;var s=ue.get(e,i);return he.isText(s)&&s.text.startsWith(r.text)}function Af(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 E1(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 _1(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 Tf(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=E1(i,a),o=Math.min(i.length-s,a.length-s),l=_1(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 k1(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=Af(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 Tf(e,{start:r,end:l,text:o})}function F1(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Is(e,t){var{path:n,offset:r}=t;if(!D.hasPath(e,n))return null;var a=ue.get(e,n);if(!he.isText(a))return null;var i=D.above(e,{match:o=>de.isElement(o)&&D.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=D.next(e,{at:n,match:he.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 Ol(e,t){var n=Is(e,t.anchor);if(!n)return null;if(H.isCollapsed(t))return{anchor:n,focus:n};var r=Is(e,t.focus);return r?{anchor:n,focus:r}:null}function Rs(e,t,n){var r=ht.get(e),a=r==null?void 0:r.find(d=>{var{path:m}=d;return P.equals(m,t.path)});if(!a||t.offset<=a.diff.start)return we.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=we.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=we.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 Pl(e,t,n){var r=Rs(e,t.anchor,n);if(!r)return null;if(H.isCollapsed(t))return{anchor:r,focus:r};var a=Rs(e,t.focus,n);return a?{anchor:r,focus:a}:null}function B1(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 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 fa(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){Ft(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 A1=25,T1=200,S1=function(){},j1=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function O1(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,d=()=>{var w=on.get(t);if(on.delete(t),w){var{selection:A}=t,j=Ol(t,w);j&&(!A||!H.equals(j,A))&&J.select(t,j)}},m=()=>{var w=sn.get(t);if(sn.delete(t),!!w){if(w.at){var A=we.isPoint(w.at)?Is(t,w.at):Ol(t,w.at);if(!A)return;var j=D.range(t,A);(!t.selection||!H.equals(t.selection,j))&&J.select(t,A)}w.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!_()&&!B()){d();return}a||(a=!0,setTimeout(()=>a=!1)),B()&&(a="action");var w=t.selection&&D.rangeRef(t,t.selection,{affinity:"forward"});Yt.set(t,t.marks),S1("flush",sn.get(t),ht.get(t));for(var A=_(),j;j=(L=ht.get(t))===null||L===void 0?void 0:L[0];){var L,U,Z=St.get(t);Z!==void 0&&(St.delete(t),t.marks=Z),Z&&u===!1&&(u=null);var G=F1(j);(!t.selection||!H.equals(t.selection,G))&&J.select(t,G),j.diff.text?D.insertText(t,j.diff.text):D.deleteFragment(t),ht.set(t,(U=ht.get(t))===null||U===void 0?void 0:U.filter(z=>{var{id:Q}=z;return Q!==j.id})),w1(t,j)||(A=!1,sn.delete(t),Yt.delete(t),a="action",on.delete(t),n.cancel(),r.cancel(),w==null||w.unref())}var ae=w==null?void 0:w.unref();if(ae&&!on.get(t)&&(!t.selection||!H.equals(ae,t.selection))&&J.select(t,ae),B()){m();return}A&&n(),n.flush(),r.flush(),d();var C=Yt.get(t);Yt.delete(t),C!==void 0&&(t.marks=C,t.onChange())},h=w=>{i&&clearTimeout(i),i=setTimeout(()=>{xn.set(t,!1),p()},A1)},g=w=>{xn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=Os.get(t);if(j){if(_()||A){j.style.display="none";return}j.style.removeProperty("display")}},b=(w,A)=>{var j,L=(j=ht.get(t))!==null&&j!==void 0?j:[];ht.set(t,L);var U=ue.leaf(t,w),Z=L.findIndex(C=>P.equals(C.path,w));if(Z<0){var G=Tf(U.text,A);G&&L.push({path:w,diff:A,id:l++}),f();return}var ae=k1(U.text,L[Z].diff,A);if(!ae){L.splice(Z,1),f();return}L[Z]=fa(fa({},L[Z]),{},{diff:ae})},v=function(A){var{at:j}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,on.delete(t),n.cancel(),r.cancel(),B()&&p(),sn.set(t,{at:j,run:A}),o=setTimeout(p)},E=w=>{var A;s&&(clearTimeout(s),s=null);var{inputType:j}=w,L=null,U=w.dataTransfer||w.data||void 0;u!==!1&&j!=="insertText"&&j!=="insertCompositionText"&&(u=!1);var[Z]=w.getTargetRanges();Z&&(L=ne.toSlateRange(t,Z,{exactMatch:!1,suppressThrow:!0}));var G=ne.getWindow(t),ae=G.getSelection();if(!L&&ae&&(Z=ae,L=ne.toSlateRange(t,ae,{exactMatch:!1,suppressThrow:!0})),L=(A=L)!==null&&A!==void 0?A:t.selection,!!L){var C=!0;if(j.startsWith("delete")){if(H.isExpanded(L)){var[z,Q]=H.edges(L),k=ue.leaf(t,z.path);if(k.text.length===z.offset&&Q.offset===0){var F=D.next(t,{at:z.path,match:he.isText});F&&P.equals(F[1],Q.path)&&(L={anchor:Q,focus:Q})}}var R=j.endsWith("Backward")?"backward":"forward",[I,W]=H.edges(L),[re,ee]=D.leaf(t,I.path),ie={text:"",start:I.offset,end:W.offset},fe=ht.get(t),X=fe==null?void 0:fe.find(me=>P.equals(me.path,ee)),ve=X?[X.diff,ie]:[ie],pe=Af(re.text,...ve);if(pe.length===0&&(C=!1),H.isExpanded(L)){if(C&&P.equals(L.anchor.path,L.focus.path)){var _e={path:L.anchor.path,offset:I.offset},Fe=D.range(t,_e,_e);return S(Fe),b(L.anchor.path,{text:"",end:W.offset,start:I.offset})}return v(()=>D.deleteFragment(t,{direction:R}),{at:L})}}switch(j){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>D.deleteFragment(t),{at:L});case"deleteContent":case"deleteContentForward":{var{anchor:Te}=L;if(C&&H.isCollapsed(L)){var Ve=ue.leaf(t,Te.path);if(Te.offset<Ve.text.length)return b(Te.path,{text:"",start:Te.offset,end:Te.offset+1})}return v(()=>D.deleteForward(t),{at:L})}case"deleteContentBackward":{var We,{anchor:Be}=L,Se=Ns(Z)?Z.isCollapsed:!!((We=Z)!==null&&We!==void 0&&We.collapsed);return C&&Se&&H.isCollapsed(L)&&Be.offset>0?b(Be.path,{text:"",start:Be.offset-1,end:Be.offset}):v(()=>D.deleteBackward(t),{at:L})}case"deleteEntireSoftLine":return v(()=>{D.deleteBackward(t,{unit:"line"}),D.deleteForward(t,{unit:"line"})},{at:L});case"deleteHardLineBackward":return v(()=>D.deleteBackward(t,{unit:"block"}),{at:L});case"deleteSoftLineBackward":return v(()=>D.deleteBackward(t,{unit:"line"}),{at:L});case"deleteHardLineForward":return v(()=>D.deleteForward(t,{unit:"block"}),{at:L});case"deleteSoftLineForward":return v(()=>D.deleteForward(t,{unit:"line"}),{at:L});case"deleteWordBackward":return v(()=>D.deleteBackward(t,{unit:"word"}),{at:L});case"deleteWordForward":return v(()=>D.deleteForward(t,{unit:"word"}),{at:L});case"insertLineBreak":return v(()=>D.insertSoftBreak(t),{at:L});case"insertParagraph":return v(()=>D.insertBreak(t),{at:L});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(j1(U))return v(()=>ne.insertData(t,U),{at:L});var De=U??"";if(St.get(t)&&(De=De.replace("\uFEFF","")),j==="insertText"&&/.*\n.*\n$/.test(De)&&(De=De.slice(0,-1)),De.includes(`
135
+ `))return v(()=>{var me=De.split(`
136
+ `);me.forEach((xe,Ze)=>{xe&&D.insertText(t,xe),Ze!==me.length-1&&D.insertSoftBreak(t)})},{at:L});if(P.equals(L.anchor.path,L.focus.path)){var[Ie,ze]=H.edges(L),K={start:Ie.offset,end:ze.offset,text:De};if(De&&u&&j==="insertCompositionText"){var te=u.start+u.text.search(/\S|$/),le=K.start+K.text.search(/\S|$/);le===te+1&&K.end===u.start+u.text.length?(K.start-=1,u=null,N()):u=!1}else j==="insertText"?u===null?u=K:u&&H.isCollapsed(L)&&u.end+u.text.length===Ie.offset?u=fa(fa({},u),{},{text:u.text+De}):u=!1:u=!1;if(C){b(Ie.path,K);return}}return v(()=>D.insertText(t,De),{at:L})}}}},B=()=>!!sn.get(t),_=()=>{var w;return!!((w=ht.get(t))!==null&&w!==void 0&&w.length)},x=()=>B()||_(),T=()=>a,S=w=>{on.set(t,w),s&&(clearTimeout(s),s=null);var{selection:A}=t;if(w){var j=!A||!P.equals(A.anchor.path,w.anchor.path),L=!A||!P.equals(A.anchor.path.slice(0,-1),w.anchor.path.slice(0,-1));(j&&u||L)&&(u=!1),(j||_())&&(s=setTimeout(p,T1))}},$=()=>{(B()||!_())&&p()},M=w=>{_()||(f(!0),setTimeout(f))},N=()=>{B()||(o=setTimeout(p))},q=w=>{if(!(_()||B())&&w.some(j=>To(t,j,w))){var A;(A=Ef.get(t))===null||A===void 0||A()}};return{flush:p,scheduleFlush:N,hasPendingDiffs:_,hasPendingAction:B,hasPendingChanges:x,isFlushing:T,handleUserSelect:S,handleCompositionEnd:h,handleCompositionStart:g,handleDOMBeforeInput:E,handleKeyDown:M,handleDomMutations:q,handleInput:$}}function P1(){var e=y.useRef(!1);return y.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var zr=_a?y.useLayoutEffect:y.useEffect;function M1(e,t,n){var[r]=y.useState(()=>new MutationObserver(t));zr(()=>{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 N1=["node"];function Nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function I1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nl(Object(n),!0).forEach(function(r){Ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var R1={subtree:!0,childList:!0,characterData:!0},$1=lt?e=>{var{node:t}=e,n=rr(e,N1);if(!lt)return null;var r=gn(),a=P1(),[i]=y.useState(()=>O1(I1({editor:r},n)));return M1(t,i.handleDomMutations,R1),Bo.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,L1=["anchor","focus"],z1=["anchor","focus"],q1=(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=rr(e,L1),r=rr(t,z1);return e[ar]===t[ar]&&q1(n,r)},W1=(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(!H.equals(r,a)||!Sf(r,a))return!1}return!0},U1=(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 Il(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function H1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Il(Object(n),!0).forEach(function(r){Ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Il(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var V1=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=gn(),s=ne.findPath(i,a),o=P.parent(s),l=!!n[_f];return i.isVoid(r)?y.createElement(qi,{length:ue.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&D.string(i,o)===""?y.createElement(qi,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?y.createElement(qi,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
137
+ `?y.createElement(Rl,{isTrailing:!0,text:n.text}):y.createElement(Rl,{text:n.text})},Rl=e=>{var{text:t,isTrailing:n=!1}=e,r=y.useRef(null),a=()=>"".concat(t??"").concat(n?`
138
+ `:""),[i]=y.useState(a);return zr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),y.createElement(K1,{ref:r},i)},K1=y.memo(y.forwardRef((e,t)=>y.createElement("span",{"data-slate-string":!0,ref:t},e.children))),qi=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",H1({},a),!lt||!n?"\uFEFF":null,n?y.createElement("br",null):null)};function $l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function jf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$l(Object(n),!0).forEach(function(r){Ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$l(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Z1=lt?300:0;function Y1(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function Ll(e){e.current&&(clearTimeout(e.current),e.current=null)}var G1=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=E=>y.createElement(J1,jf({},E))}=e,o=gn(),l=y.useRef(null),u=y.useRef(null),[d,m]=y.useState(!1),p=y.useRef(null),h=y.useCallback(E=>{if(Y1(l,E==null),E==null){var B;Os.delete(o),(B=t.onPlaceholderResize)===null||B===void 0||B.call(t,null)}else{if(Os.set(o,E),!l.current){var _=window.ResizeObserver||Jy;l.current=new _(()=>{var x;(x=t.onPlaceholderResize)===null||x===void 0||x.call(t,E)})}l.current.observe(E),u.current=E}},[u,t,o]),g=y.createElement(V1,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[ar];if(y.useEffect(()=>(f?p.current||(p.current=setTimeout(()=>{m(!0),p.current=null},Z1)):(Ll(p),m(!1)),()=>Ll(p)),[f,m]),f&&d){var b={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:xr?"inherit":void 0},contentEditable:!1,ref:h}};g=y.createElement(y.Fragment,null,i(b),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},Q1=y.memo(G1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&he.equals(t.leaf,e.leaf)&&t.leaf[ar]===e.leaf[ar]),J1=e=>{var{attributes:t,children:n}=e;return y.createElement("span",jf({},t),n)},X1=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=gn(),l=y.useRef(null),u=he.decorations(s,t),d=ne.findKey(o,s),m=[],p=0;p<u.length;p++){var h=u[p];m.push(y.createElement(Q1,{isLast:n&&p===u.length-1,key:"".concat(d.id,"-").concat(p),renderPlaceholder:a,leaf:h,text:s,parent:r,renderLeaf:i}))}var g=y.useCallback(f=>{var b=ui.get(o);f?(b==null||b.set(d,f),kn.set(s,f),Lr.set(f,s)):(b==null||b.delete(d),kn.delete(s),l.current&&Lr.delete(l.current)),l.current=f},[l,o,d,s]);return y.createElement("span",{"data-slate-node":"text",ref:g},m)},Of=y.memo(X1,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&U1(t.decorations,e.decorations));function zl(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 $s(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zl(Object(n),!0).forEach(function(r){Ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var eD=e=>{var{decorations:t,element:n,renderElement:r=E=>y.createElement(nD,$s({},E)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=gn(),l=iD(),u=o.isInline(n),d=ne.findKey(o,n),m=y.useCallback(E=>{var B=ui.get(o);E?(B==null||B.set(d,E),kn.set(n,E),Lr.set(E,n)):(B==null||B.delete(d),kn.delete(n))},[o,d,n]),p=Mf({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),h={"data-slate-node":"element",ref:m};if(u&&(h["data-slate-inline"]=!0),!u&&D.hasInlines(o,n)){var g=ue.string(n),f=sf(g);f==="rtl"&&(h.dir=f)}if(D.isVoid(o,n)){h["data-slate-void"]=!0,!l&&u&&(h.contentEditable=!1);var b=u?"span":"div",[[v]]=ue.texts(n);p=y.createElement(b,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},y.createElement(Of,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),ko.set(v,0),Fo.set(v,n)}return r({attributes:h,children:p,element:n})},tD=y.memo(eD,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&W1(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&H.equals(e.selection,t.selection))),nD=e=>{var{attributes:t,children:n,element:r}=e,a=gn(),i=a.isInline(r)?"span":"div";return y.createElement(i,$s($s({},t),{},{style:{position:"relative"}}),n)},Pf=y.createContext(()=>[]),rD=()=>y.useContext(Pf),aD=y.createContext(!1),Mf=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=rD(),l=gn(),u=ne.findPath(l,n),d=[],m=de.isElement(n)&&!l.isInline(n)&&D.hasInlines(l,n),p=0;p<n.children.length;p++){var h=u.concat(p),g=n.children[p],f=ne.findKey(l,g),b=D.range(l,h),v=s&&H.intersection(b,s),E=o([g,h]);for(var B of t){var _=H.intersection(B,b);_&&E.push(_)}de.isElement(g)?d.push(y.createElement(aD.Provider,{key:"provider-".concat(f.id),value:!!v},y.createElement(tD,{decorations:E,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):d.push(y.createElement(Of,{decorations:E,key:f.id,isLast:m&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),ko.set(g,p),Fo.set(g,n)}return d},Nf=y.createContext(!1),iD=()=>y.useContext(Nf),If=y.createContext(null),Nn=()=>{var e=y.useContext(If);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function sD(){var e=gn(),t=y.useRef(!1),n=y.useRef(0),r=y.useCallback(()=>{if(!t.current){t.current=!0;var a=ne.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 oD=3,uD={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"},lD={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"},cD={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},He=e=>{var t=uD[e],n=lD[e],r=cD[e],a=t&&zi(t),i=n&&zi(n),s=r&&zi(r);return o=>!!(a&&a(o)||jl&&i&&i(o)||!jl&&s&&s(o))},Ke={isBold:He("bold"),isCompose:He("compose"),isMoveBackward:He("moveBackward"),isMoveForward:He("moveForward"),isDeleteBackward:He("deleteBackward"),isDeleteForward:He("deleteForward"),isDeleteLineBackward:He("deleteLineBackward"),isDeleteLineForward:He("deleteLineForward"),isDeleteWordBackward:He("deleteWordBackward"),isDeleteWordForward:He("deleteWordForward"),isExtendBackward:He("extendBackward"),isExtendForward:He("extendForward"),isExtendLineBackward:He("extendLineBackward"),isExtendLineForward:He("extendLineForward"),isItalic:He("italic"),isMoveLineBackward:He("moveLineBackward"),isMoveLineForward:He("moveLineForward"),isMoveWordBackward:He("moveWordBackward"),isMoveWordForward:He("moveWordForward"),isRedo:He("redo"),isSoftBreak:He("insertSoftBreak"),isSplitBlock:He("splitBlock"),isTransposeCharacter:He("transposeCharacter"),isUndo:He("undo")},dD=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>To(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}},fD={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Rf extends y.Component{constructor(){super(...arguments),Ft(this,"context",null),Ft(this,"manager",null),Ft(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,fD)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=dD(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}}Ft(Rf,"contextType",_o);var hD=lt?Rf:e=>{var{children:t}=e;return y.createElement(y.Fragment,null,t)},mD=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],pD=["text"];function ql(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function It(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ql(Object(n),!0).forEach(function(r){Ft(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ql(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var gD=e=>y.createElement(y.Fragment,null,Mf(e)),vD=e=>{var t=y.useCallback(F=>y.createElement(bD,It({},F)),[]),{autoFocus:n,decorate:r=yD,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=DD,style:m={},as:p="div",disableDefaultStyles:h=!1}=e,g=rr(e,mD),f=Nn(),[b,v]=y.useState(!1),E=y.useRef(null),B=y.useRef([]),[_,x]=y.useState(),{onUserInput:T,receivedUserInput:S}=sD(),[,$]=y.useReducer(F=>F+1,0);Ef.set(f,$),Ps.set(f,s);var M=y.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);y.useEffect(()=>{E.current&&n&&E.current.focus()},[n]);var N=y.useRef(),q=y.useMemo(()=>By(()=>{var F=N.current;if((lt||!ne.isComposing(f))&&(!M.isUpdatingSelection||F!=null&&F.isFlushing())&&!M.isDraggingInternally){var R=ne.findDocumentOrShadowRoot(f),{activeElement:I}=R,W=ne.toDOMNode(f,f),re=R.getSelection();if(I===W?(M.latestElement=I,cn.set(f,!0)):cn.delete(f),!re)return J.deselect(f);var{anchorNode:ee,focusNode:ie}=re,fe=ne.hasEditableTarget(f,ee)||ne.isTargetInsideNonReadonlyVoid(f,ee),X=ne.hasEditableTarget(f,ie)||ne.isTargetInsideNonReadonlyVoid(f,ie);if(fe&&X){var ve=ne.toSlateRange(f,re,{exactMatch:!1,suppressThrow:!0});ve&&(!ne.isComposing(f)&&!(F!=null&&F.hasPendingChanges())&&!(F!=null&&F.isFlushing())?J.select(f,ve):F==null||F.handleUserSelect(ve))}s&&(!fe||!X)&&J.deselect(f)}},100),[f,s,M]),w=y.useMemo(()=>xy(q,0),[q]);N.current=$1({node:E,onDOMSelectionChange:q,scheduleOnDOMSelectionChange:w}),zr(()=>{var F,R,I;E.current&&(I=Ao(E.current))?(wf.set(f,I),ka.set(f,E.current),kn.set(f,E.current),Lr.set(E.current,f)):kn.delete(f);var{selection:W}=f,re=ne.findDocumentOrShadowRoot(f),ee=re.getSelection();if(!(!ee||!ne.isFocused(f)||(F=N.current)!==null&&F!==void 0&&F.hasPendingAction())){var ie=pe=>{var _e=ee.type!=="None";if(!(!W&&!_e)){var Fe=ee.focusNode,Te;if(Zn&&ee.rangeCount>1){var Ve=ee.getRangeAt(0),We=ee.getRangeAt(ee.rangeCount-1);Ve.startContainer===Fe?Te=We.endContainer:Te=Ve.startContainer}else Te=ee.anchorNode;var Be=ka.get(f),Se=!1;if(Be.contains(Te)&&Be.contains(Fe)&&(Se=!0),_e&&Se&&W&&!pe){var De=ne.toSlateRange(f,ee,{exactMatch:!0,suppressThrow:!0});if(De&&H.equals(De,W)){var Ie;if(!M.hasMarkPlaceholder||(Ie=Te)!==null&&Ie!==void 0&&(Ie=Ie.parentElement)!==null&&Ie!==void 0&&Ie.hasAttribute("data-slate-mark-placeholder"))return}}if(W&&!ne.hasRange(f,W)){f.selection=ne.toSlateRange(f,ee,{exactMatch:!1,suppressThrow:!0});return}M.isUpdatingSelection=!0;var ze=W&&ne.toDOMRange(f,W);return ze?(ne.isComposing(f)&&!lt?ee.collapseToEnd():H.isBackward(W)?ee.setBaseAndExtent(ze.endContainer,ze.endOffset,ze.startContainer,ze.startOffset):ee.setBaseAndExtent(ze.startContainer,ze.startOffset,ze.endContainer,ze.endOffset),d(f,ze)):ee.removeAllRanges(),ze}};ee.rangeCount<=1&&ie();var fe=((R=N.current)===null||R===void 0?void 0:R.isFlushing())==="action";if(!lt||!fe){setTimeout(()=>{M.isUpdatingSelection=!1});return}var X=null,ve=requestAnimationFrame(()=>{if(fe){var pe=_e=>{try{var Fe=ne.toDOMNode(f,f);Fe.focus(),ie(_e)}catch{}};pe(),X=setTimeout(()=>{pe(!0),M.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ve),X&&clearTimeout(X)}}});var A=y.useCallback(F=>{if(T(),!s&&ne.hasEditableTarget(f,F.target)&&!CD(F,a)){var R;if(N.current)return N.current.handleDOMBeforeInput(F);w.flush(),q.flush();var{selection:I}=f,{inputType:W}=F,re=F.dataTransfer||F.data||void 0,ee=W==="insertCompositionText"||W==="deleteCompositionText";if(ee&&ne.isComposing(f))return;var ie=!1;if(W==="insertText"&&I&&H.isCollapsed(I)&&F.data&&F.data.length===1&&/[a-z ]/i.test(F.data)&&I.anchor.offset!==0){var fe,X;ie=!0,f.marks&&(ie=!1);var{anchor:ve}=I,[pe,_e]=ne.toDOMPoint(f,ve),Fe=(fe=pe.parentElement)===null||fe===void 0?void 0:fe.closest("a"),Te=ne.getWindow(f);if(ie&&Fe&&ne.hasDOMNode(f,Fe)){var Ve,We=Te==null?void 0:Te.document.createTreeWalker(Fe,NodeFilter.SHOW_TEXT).lastChild();We===pe&&((Ve=We.textContent)===null||Ve===void 0?void 0:Ve.length)===_e&&(ie=!1)}if(ie&&pe.parentElement&&(Te==null||(X=Te.getComputedStyle(pe.parentElement))===null||X===void 0?void 0:X.whiteSpace)==="pre"){var Be=D.above(f,{at:ve.path,match:te=>de.isElement(te)&&D.isBlock(f,te)});Be&&ue.string(Be[0]).includes(" ")&&(ie=!1)}}if(!W.startsWith("delete")||W.startsWith("deleteBy")){var[Se]=F.getTargetRanges();if(Se){var De=ne.toSlateRange(f,Se,{exactMatch:!1,suppressThrow:!1});if(!I||!H.equals(I,De)){ie=!1;var Ie=!ee&&f.selection&&D.rangeRef(f,f.selection);J.select(f,De),Ie&&kr.set(f,Ie)}}}if(ee)return;if(ie||F.preventDefault(),I&&H.isExpanded(I)&&W.startsWith("delete")){var ze=W.endsWith("Backward")?"backward":"forward";D.deleteFragment(f,{direction:ze});return}switch(W){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{D.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{D.deleteForward(f);break}case"deleteContentBackward":{D.deleteBackward(f);break}case"deleteEntireSoftLine":{D.deleteBackward(f,{unit:"line"}),D.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{D.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{D.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{D.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{D.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{D.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{D.deleteForward(f,{unit:"word"});break}case"insertLineBreak":D.insertSoftBreak(f);break;case"insertParagraph":{D.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{W==="insertFromComposition"&&ne.isComposing(f)&&(v(!1),xn.set(f,!1)),(re==null?void 0:re.constructor.name)==="DataTransfer"?ne.insertData(f,re):typeof re=="string"&&(ie?B.current.push(()=>D.insertText(f,re)):D.insertText(f,re));break}}var K=(R=kr.get(f))===null||R===void 0?void 0:R.unref();kr.delete(f),K&&(!f.selection||!H.equals(f.selection,K))&&J.select(f,K)}},[f,q,T,a,s,w]),j=y.useCallback(F=>{F==null?(q.cancel(),w.cancel(),ka.delete(f),kn.delete(f),E.current&&rn&&E.current.removeEventListener("beforeinput",A)):rn&&F.addEventListener("beforeinput",A),E.current=F},[q,w,f,A]);zr(()=>{var F=ne.getWindow(f);return F.document.addEventListener("selectionchange",w),()=>{F.document.removeEventListener("selectionchange",w)}},[w]);var L=r([f,[]]),U=i&&f.children.length===1&&Array.from(ue.texts(f)).length===1&&ue.string(f)===""&&!b,Z=y.useCallback(F=>{if(F&&U){var R;x((R=F.getBoundingClientRect())===null||R===void 0?void 0:R.height)}else x(void 0)},[U]);if(U){var G=D.start(f,[]);L.push({[ar]:!0,placeholder:i,onPlaceholderResize:Z,anchor:G,focus:G})}var{marks:ae}=f;if(M.hasMarkPlaceholder=!1,f.selection&&H.isCollapsed(f.selection)&&ae){var{anchor:C}=f.selection,z=ue.leaf(f,C.path),Q=rr(z,pD);if(!he.equals(z,ae,{loose:!0})){M.hasMarkPlaceholder=!0;var k=Object.fromEntries(Object.keys(Q).map(F=>[F,null]));L.push(It(It(It({[_f]:!0},k),ae),{},{anchor:C,focus:C}))}}return y.useEffect(()=>{setTimeout(()=>{var{selection:F}=f;if(F){var{anchor:R}=F,I=ue.leaf(f,R.path);if(ae&&!he.equals(I,ae,{loose:!0})){St.set(f,ae);return}}St.delete(f)})}),y.createElement(Nf.Provider,{value:s},y.createElement(Pf.Provider,{value:r},y.createElement(hD,{node:E,receivedUserInput:S},y.createElement(p,It(It({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:rn||!_a?g.spellCheck:!1,autoCorrect:rn||!_a?g.autoCorrect:"false",autoCapitalize:rn||!_a?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:j,style:It(It({},h?{}:It({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},_?{minHeight:_}:{})),m),onBeforeInput:y.useCallback(F=>{if(!rn&&!s&&!ot(F,g.onBeforeInput)&&ne.hasSelectableTarget(f,F.target)&&(F.preventDefault(),!ne.isComposing(f))){var R=F.data;D.insertText(f,R)}},[g.onBeforeInput,f,s]),onInput:y.useCallback(F=>{if(!ot(F,g.onInput)){if(N.current){N.current.handleInput();return}for(var R of B.current)R();B.current=[]}},[g.onInput]),onBlur:y.useCallback(F=>{if(!(s||M.isUpdatingSelection||!ne.hasSelectableTarget(f,F.target)||ot(F,g.onBlur))){var R=ne.findDocumentOrShadowRoot(f);if(M.latestElement!==R.activeElement){var{relatedTarget:I}=F,W=ne.toDOMNode(f,f);if(I!==W&&!(kt(I)&&I.hasAttribute("data-slate-spacer"))){if(I!=null&&dn(I)&&ne.hasDOMNode(f,I)){var re=ne.toSlateNode(f,I);if(de.isElement(re)&&!f.isVoid(re))return}if(xr){var ee=R.getSelection();ee==null||ee.removeAllRanges()}cn.delete(f)}}}},[s,M.isUpdatingSelection,M.latestElement,f,g.onBlur]),onClick:y.useCallback(F=>{if(ne.hasTarget(f,F.target)&&!ot(F,g.onClick)&&dn(F.target)){var R=ne.toSlateNode(f,F.target),I=ne.findPath(f,R);if(!D.hasPath(f,I)||ue.get(f,I)!==R)return;if(F.detail===oD&&I.length>=1){var W=I;if(!(de.isElement(R)&&D.isBlock(f,R))){var re,ee=D.above(f,{match:Fe=>de.isElement(Fe)&&D.isBlock(f,Fe),at:I});W=(re=ee==null?void 0:ee[1])!==null&&re!==void 0?re:I.slice(0,1)}var ie=D.range(f,W);J.select(f,ie);return}if(s)return;var fe=D.start(f,I),X=D.end(f,I),ve=D.void(f,{at:fe}),pe=D.void(f,{at:X});if(ve&&pe&&P.equals(ve[1],pe[1])){var _e=D.range(f,fe);J.select(f,_e)}}},[f,g.onClick,s]),onCompositionEnd:y.useCallback(F=>{if(ne.hasSelectableTarget(f,F.target)){var R;if(ne.isComposing(f)&&Promise.resolve().then(()=>{v(!1),xn.set(f,!1)}),(R=N.current)===null||R===void 0||R.handleCompositionEnd(F),ot(F,g.onCompositionEnd)||lt)return;if(!xr&&!c1&&!s1&&!f1&&!d1&&F.data){var I=St.get(f);St.delete(f),I!==void 0&&(Yt.set(f,f.marks),f.marks=I),D.insertText(f,F.data);var W=Yt.get(f);Yt.delete(f),W!==void 0&&(f.marks=W)}}},[g.onCompositionEnd,f]),onCompositionUpdate:y.useCallback(F=>{ne.hasSelectableTarget(f,F.target)&&!ot(F,g.onCompositionUpdate)&&(ne.isComposing(f)||(v(!0),xn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:y.useCallback(F=>{if(ne.hasSelectableTarget(f,F.target)){var R;if((R=N.current)===null||R===void 0||R.handleCompositionStart(F),ot(F,g.onCompositionStart)||lt)return;v(!0);var{selection:I}=f;if(I&&H.isExpanded(I)){D.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:y.useCallback(F=>{ne.hasSelectableTarget(f,F.target)&&!ot(F,g.onCopy)&&!Wl(F)&&(F.preventDefault(),ne.setFragmentData(f,F.clipboardData,"copy"))},[g.onCopy,f]),onCut:y.useCallback(F=>{if(!s&&ne.hasSelectableTarget(f,F.target)&&!ot(F,g.onCut)&&!Wl(F)){F.preventDefault(),ne.setFragmentData(f,F.clipboardData,"cut");var{selection:R}=f;if(R)if(H.isExpanded(R))D.deleteFragment(f);else{var I=ue.parent(f,R.anchor.path);D.isVoid(f,I)&&J.delete(f)}}},[s,f,g.onCut]),onDragOver:y.useCallback(F=>{if(ne.hasTarget(f,F.target)&&!ot(F,g.onDragOver)){var R=ne.toSlateNode(f,F.target);de.isElement(R)&&D.isVoid(f,R)&&F.preventDefault()}},[g.onDragOver,f]),onDragStart:y.useCallback(F=>{if(!s&&ne.hasTarget(f,F.target)&&!ot(F,g.onDragStart)){var R=ne.toSlateNode(f,F.target),I=ne.findPath(f,R),W=de.isElement(R)&&D.isVoid(f,R)||D.void(f,{at:I,voids:!0});if(W){var re=D.range(f,I);J.select(f,re)}M.isDraggingInternally=!0,ne.setFragmentData(f,F.dataTransfer,"drag")}},[s,f,g.onDragStart,M]),onDrop:y.useCallback(F=>{if(!s&&ne.hasTarget(f,F.target)&&!ot(F,g.onDrop)){F.preventDefault();var R=f.selection,I=ne.findEventRange(f,F),W=F.dataTransfer;J.select(f,I),M.isDraggingInternally&&R&&!H.equals(R,I)&&!D.void(f,{at:I,voids:!0})&&J.delete(f,{at:R}),ne.insertData(f,W),ne.isFocused(f)||ne.focus(f)}M.isDraggingInternally=!1},[s,f,g.onDrop,M]),onDragEnd:y.useCallback(F=>{!s&&M.isDraggingInternally&&g.onDragEnd&&ne.hasTarget(f,F.target)&&g.onDragEnd(F),M.isDraggingInternally=!1},[s,M,g,f]),onFocus:y.useCallback(F=>{if(!s&&!M.isUpdatingSelection&&ne.hasEditableTarget(f,F.target)&&!ot(F,g.onFocus)){var R=ne.toDOMNode(f,f),I=ne.findDocumentOrShadowRoot(f);if(M.latestElement=I.activeElement,Zn&&F.target!==R){R.focus();return}cn.set(f,!0)}},[s,M,f,g.onFocus]),onKeyDown:y.useCallback(F=>{if(!s&&ne.hasEditableTarget(f,F.target)){var R;(R=N.current)===null||R===void 0||R.handleKeyDown(F);var{nativeEvent:I}=F;if(ne.isComposing(f)&&I.isComposing===!1&&(xn.set(f,!1),v(!1)),ot(F,g.onKeyDown)||ne.isComposing(f))return;var{selection:W}=f,re=f.children[W!==null?W.focus.path[0]:0],ee=sf(ue.string(re))==="rtl";if(Ke.isRedo(I)){F.preventDefault();var ie=f;typeof ie.redo=="function"&&ie.redo();return}if(Ke.isUndo(I)){F.preventDefault();var fe=f;typeof fe.undo=="function"&&fe.undo();return}if(Ke.isMoveLineBackward(I)){F.preventDefault(),J.move(f,{unit:"line",reverse:!0});return}if(Ke.isMoveLineForward(I)){F.preventDefault(),J.move(f,{unit:"line"});return}if(Ke.isExtendLineBackward(I)){F.preventDefault(),J.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Ke.isExtendLineForward(I)){F.preventDefault(),J.move(f,{unit:"line",edge:"focus"});return}if(Ke.isMoveBackward(I)){F.preventDefault(),W&&H.isCollapsed(W)?J.move(f,{reverse:!ee}):J.collapse(f,{edge:ee?"end":"start"});return}if(Ke.isMoveForward(I)){F.preventDefault(),W&&H.isCollapsed(W)?J.move(f,{reverse:ee}):J.collapse(f,{edge:ee?"start":"end"});return}if(Ke.isMoveWordBackward(I)){F.preventDefault(),W&&H.isExpanded(W)&&J.collapse(f,{edge:"focus"}),J.move(f,{unit:"word",reverse:!ee});return}if(Ke.isMoveWordForward(I)){F.preventDefault(),W&&H.isExpanded(W)&&J.collapse(f,{edge:"focus"}),J.move(f,{unit:"word",reverse:ee});return}if(rn){if((xf||xr)&&W&&(Ke.isDeleteBackward(I)||Ke.isDeleteForward(I))&&H.isCollapsed(W)){var X=ue.parent(f,W.anchor.path);if(de.isElement(X)&&D.isVoid(f,X)&&(D.isInline(f,X)||D.isBlock(f,X))){F.preventDefault(),D.deleteBackward(f,{unit:"block"});return}}}else{if(Ke.isBold(I)||Ke.isItalic(I)||Ke.isTransposeCharacter(I)){F.preventDefault();return}if(Ke.isSoftBreak(I)){F.preventDefault(),D.insertSoftBreak(f);return}if(Ke.isSplitBlock(I)){F.preventDefault(),D.insertBreak(f);return}if(Ke.isDeleteBackward(I)){F.preventDefault(),W&&H.isExpanded(W)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f);return}if(Ke.isDeleteForward(I)){F.preventDefault(),W&&H.isExpanded(W)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f);return}if(Ke.isDeleteLineBackward(I)){F.preventDefault(),W&&H.isExpanded(W)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f,{unit:"line"});return}if(Ke.isDeleteLineForward(I)){F.preventDefault(),W&&H.isExpanded(W)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f,{unit:"line"});return}if(Ke.isDeleteWordBackward(I)){F.preventDefault(),W&&H.isExpanded(W)?D.deleteFragment(f,{direction:"backward"}):D.deleteBackward(f,{unit:"word"});return}if(Ke.isDeleteWordForward(I)){F.preventDefault(),W&&H.isExpanded(W)?D.deleteFragment(f,{direction:"forward"}):D.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:y.useCallback(F=>{!s&&ne.hasEditableTarget(f,F.target)&&!ot(F,g.onPaste)&&(!rn||p1(F.nativeEvent)||xr)&&(F.preventDefault(),ne.insertData(f,F.clipboardData))},[s,f,g.onPaste])}),y.createElement(gD,{decorations:L,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},bD=e=>{var{attributes:t,children:n}=e;return y.createElement("span",It({},t),n,lt&&y.createElement("br",null))},yD=()=>[],DD=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&H.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),Sy(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},ot=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},Wl=e=>dn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),CD=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},xD=y.createContext(!1),wD=y.createContext({});function ED(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 _D=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],kD=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=rr(e,_D),[l,u]=y.useState(()=>{if(!ue.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(et.stringify(s)));if(!D.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(et.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:m}=ED(t),p=y.useCallback(f=>{var b;switch(r&&r(t.children),f==null||(b=f.operation)===null||b===void 0?void 0:b.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(v=>({v:v.v+1,editor:t})),m(t)},[t,m,r,a,i]);y.useEffect(()=>(Ms.set(t,p),()=>{Ms.set(t,()=>{})}),[t,p]);var[h,g]=y.useState(ne.isFocused(t));return y.useEffect(()=>{g(ne.isFocused(t))},[t]),zr(()=>{var f=()=>g(ne.isFocused(t));return Cf>=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(wD.Provider,{value:d},y.createElement(If.Provider,{value:l},y.createElement(_o.Provider,{value:l.editor},y.createElement(xD.Provider,{value:h},n))))},Ul=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Hl=(e,t,n)=>{var r=ne.toDOMRange(e,t).getBoundingClientRect(),a=ne.toDOMRange(e,n).getBoundingClientRect();return Ul(r,a)&&Ul(a,r)},FD=(e,t)=>{var n=D.range(e,H.end(t)),r=Array.from(D.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(Hl(e,D.range(e,r[a]),n))return D.range(e,r[a],n);if(r.length<2)return D.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)Hl(e,D.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return D.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 Kl(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){Ft(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 BD=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 ui.set(r,new WeakMap),r.addMark=(u,d)=>{var m,p;(m=Bo.get(r))===null||m===void 0||m(),!St.get(r)&&(p=ht.get(r))!==null&&p!==void 0&&p.length&&St.set(r,null),Yt.delete(r),o(u,d)},r.removeMark=u=>{var d;!St.get(r)&&(d=ht.get(r))!==null&&d!==void 0&&d.length&&St.set(r,null),Yt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&H.isCollapsed(r.selection)){var d=D.above(r,{match:g=>de.isElement(g)&&D.isBlock(r,g),at:r.selection});if(d){var[,m]=d,p=D.range(r,m,r.selection.anchor),h=FD(r,p);H.isCollapsed(h)||J.delete(r,{at:h})}}},r.apply=u=>{var d=[],m=[],p=ht.get(r);if(p!=null&&p.length){var h=p.map(j=>B1(j,u)).filter(Boolean);ht.set(r,h)}var g=on.get(r);g&&on.set(r,Pl(r,g,u));var f=sn.get(r);if(f!=null&&f.at){var b=we.isPoint(f==null?void 0:f.at)?Rs(r,f.at,u):Pl(r,f.at,u);sn.set(r,b?Kl(Kl({},f),{},{at:b}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...zn(r,u.path));break}case"set_selection":{var v;(v=kr.get(r))===null||v===void 0||v.unref(),kr.delete(r);break}case"insert_node":case"remove_node":{d.push(...zn(r,P.parent(u.path)));break}case"merge_node":{var E=P.previous(u.path);d.push(...zn(r,E));break}case"move_node":{var B=P.common(P.parent(u.path),P.parent(u.newPath));d.push(...zn(r,B));var _;P.isBefore(u.path,u.newPath)?(d.push(...zn(r,P.parent(u.path))),_=u.newPath):(d.push(...zn(r,P.parent(u.newPath))),_=u.path);var x=ue.get(t,P.parent(_)),T=ne.findKey(r,x),S=D.pathRef(r,P.parent(_));m.push([S,T]);break}}a(u);for(var[$,M]of d){var[N]=D.node(r,$);qa.set(N,M)}for(var[q,w]of m)if(q.current){var[A]=D.node(r,q.current);qa.set(A,w)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[m,p]=H.edges(d),h=D.void(r,{at:m.path}),g=D.void(r,{at:p.path});if(!(H.isCollapsed(d)&&!h)){var f=ne.toDOMRange(r,d),b=f.cloneContents(),v=b.childNodes[0];if(b.childNodes.forEach(N=>{N.textContent&&N.textContent.trim()!==""&&(v=N)}),g){var[E]=g,B=f.cloneRange(),_=ne.toDOMNode(r,E);B.setEndAfter(_),b=B.cloneContents()}if(h&&(v=b.querySelector("[data-slate-spacer]")),Array.from(b.querySelectorAll("[data-slate-zero-width]")).forEach(N=>{var q=N.getAttribute("data-slate-zero-width")==="n";N.textContent=q?`
139
+ `:""}),kf(v)){var x=v.ownerDocument.createElement("span");x.style.whiteSpace="pre",x.appendChild(v),b.appendChild(x),v=x}var T=r.getFragment(),S=JSON.stringify(T),$=window.btoa(encodeURIComponent(S));v.setAttribute("data-slate-fragment",$),u.setData("application/".concat(n),$);var M=b.ownerDocument.createElement("div");return M.appendChild(b),M.setAttribute("hidden","true"),b.ownerDocument.body.appendChild(M),u.setData("text/html",M.innerHTML),u.setData("text/plain",Bf(M)),b.ownerDocument.body.removeChild(M),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||D1(u);if(d){var m=decodeURIComponent(window.atob(d)),p=JSON.parse(m);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var d=u.getData("text/plain");if(d){var m=d.split(/\r\n|\r|\n/),p=!1;for(var h of m)p&&J.splitNodes(r,{always:!0}),r.insertText(h),p=!0;return!0}return!1},r.onChange=u=>{var d=Cf<18?Mc.unstable_batchedUpdates:m=>m();d(()=>{var m=Ms.get(r);m&&m(u),i(u)})},r},zn=(e,t)=>{var n=[];for(var[r,a]of D.levels(e,{at:t})){var i=ne.findKey(e,r);n.push([a,i])}return n};const AD={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)}},nn=y.createContext(AD);var V=(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))(V||{}),Lt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Lt||{});const TD=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case V.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case V.link:return c.jsx("a",{...e,children:t});case V.li:return c.jsx("li",{...e,children:t});case V.mention:const a=r;return a!=null&&a.name&&a.name===Sr?c.jsxs("span",{...e,className:"mention deleted-user",children:["@",c.jsx(se.FormattedMessage,{id:"member_deleted"}),t]}):c.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case V.ol:return c.jsx("ol",{...e,children:t});case V.ul:return c.jsx("ul",{...e,children:t});case V.span:return c.jsx("span",{...e,children:t});case V.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},SD=({attributes:e,children:t,leaf:n})=>{const r=n;return r[V.bold]&&(t=c.jsx("strong",{children:t})),r[V.italic]&&(t=c.jsx("em",{children:t})),r[V.strikethrough]&&(t=c.jsx("s",{children:t})),c.jsx("span",{...e,children:t})},Ls="MENTION: ",$f={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},Zl={"mention-popover":35,default:-52},Wi=16,Lf=(e,t,n)=>{const r=y.useRef(null),{showLinkEditor:a,mentionPopover:i}=y.useContext(nn),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),y.useEffect(()=>{var h,g;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,d=0;if(t==="mention-popover"){const{position:f}=i,b=B=>{if(!D.hasPath(e,B.path))return!1;const _=ue.get(e,B.path);return D.isEditor(_)||de.isElement(_)?B.offset<=_.children.length:he.isText(_)?B.offset<=_.text.length:!1};if(f&&(!b(f==null?void 0:f.anchor)||!b(f==null?void 0:f.focus)))return;u=ne.toDOMRange(e,f||$f).getBoundingClientRect();const E=(h=document.getElementById(n))==null?void 0:h.getBoundingClientRect();l.style.setProperty("--width",`${((E==null?void 0:E.width)||0)/Wi}rem`),d=(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 m=Zl[t]||Zl.default,p=((u==null?void 0:u.top)||0)+window.scrollY+m;d===0&&(d=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${p/Wi}rem`,l.style.left=`${d/Wi}rem`},o),r},jD=e=>{const[t,n]=y.useState(null);return y.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=D.nodes(e,{at:r,match:i=>i.type===V.link});if(a){const i=a[0],s=Xc(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 ut=(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))(ut||{});const Yn={[V.paragraph]:V.paragraph,[V.blockquote]:V.blockquote,[V.codeblock]:V.codeblock,[V.link]:V.link,[V.ul]:V.ul,[V.ol]:V.ol,[V.li]:V.li,[V.mention]:V.mention,[V.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Lt.emphasis]:V.italic,[Lt.strong]:V.bold,[Lt.delete]:V.strikethrough,[Lt.code]:V.code,[V.hr]:V.hr,[V.image]:V.image};function Yl(e){if(e)throw e}var Fa=Object.prototype.hasOwnProperty,zf=Object.prototype.toString,Gl=Object.defineProperty,Ql=Object.getOwnPropertyDescriptor,Jl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):zf.call(t)==="[object Array]"},Xl=function(t){if(!t||zf.call(t)!=="[object Object]")return!1;var n=Fa.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Fa.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||Fa.call(t,a)},ec=function(t,n){Gl&&n.name==="__proto__"?Gl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},tc=function(t,n){if(n==="__proto__")if(Fa.call(t,n)){if(Ql)return Ql(t,n).value}else return;return t[n]},OD=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=tc(o,n),a=tc(t,n),o!==a&&(d&&a&&(Xl(a)||(i=Jl(a)))?(i?(i=!1,s=r&&Jl(r)?r:[]):s=r&&Xl(r)?r:{},ec(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&ec(o,{name:n,newValue:a}));return o};const Ui=On(OD);function zs(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 PD(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const d=e[++i];let m=-1;if(l){s(l);return}for(;++m<a.length;)(u[m]===null||u[m]===void 0)&&(u[m]=a[m]);a=u,d?MD(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 MD(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 Fr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?nc(e.position):"start"in e||"end"in e?nc(e):"line"in e||"column"in e?qs(e):""}function qs(e){return rc(e&&e.line)+":"+rc(e&&e.column)}function nc(e){return qs(e&&e.start)+"-"+qs(e&&e.end)}function rc(e){return e&&typeof e=="number"?e:1}class vt 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=Fr(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}}vt.prototype.file="";vt.prototype.name="";vt.prototype.reason="";vt.prototype.message="";vt.prototype.stack="";vt.prototype.column=void 0;vt.prototype.line=void 0;vt.prototype.ancestors=void 0;vt.prototype.cause=void 0;vt.prototype.fatal=void 0;vt.prototype.place=void 0;vt.prototype.ruleId=void 0;vt.prototype.source=void 0;const Rt={basename:ND,dirname:ID,extname:RD,join:$D,sep:"/"};function ND(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Vr(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 ID(e){if(Vr(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 RD(e){Vr(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 $D(...e){let t=-1,n;for(;++t<e.length;)Vr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":LD(n)}function LD(e){Vr(e);const t=e.codePointAt(0)===47;let n=zD(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function zD(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 Vr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const qD={cwd:WD};function WD(){return"/"}function Ws(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function UD(e){if(typeof e=="string")e=new URL(e);else if(!Ws(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 HD(e)}function HD(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 Hi=["history","path","basename","stem","extname","dirname"];class VD{constructor(t){let n;t?Ws(t)?n={path:t}:typeof t=="string"||KD(t)?n={value:t}:n=t:n={},this.cwd=qD.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Hi.length;){const i=Hi[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)Hi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Rt.basename(this.path):void 0}set basename(t){Ki(t,"basename"),Vi(t,"basename"),this.path=Rt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Rt.dirname(this.path):void 0}set dirname(t){ac(this.basename,"dirname"),this.path=Rt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Rt.extname(this.path):void 0}set extname(t){if(Vi(t,"extname"),ac(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Rt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ws(t)&&(t=UD(t)),Ki(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Rt.basename(this.path,this.extname):void 0}set stem(t){Ki(t,"stem"),Vi(t,"stem"),this.path=Rt.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 vt(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 Vi(e,t){if(e&&e.includes(Rt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Rt.sep+"`")}function Ki(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ac(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function KD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ZD=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},YD={}.hasOwnProperty;class So extends ZD{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=PD()}copy(){const t=new So;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ui(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Gi("data",this.frozen),this.namespace[t]=n,this):YD.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Gi("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=ha(t),r=this.parser||this.Parser;return Zi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Zi("process",this.parser||this.Parser),Yi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=ha(t),l=r.parse(o);r.run(l,o,function(d,m,p){if(d||!m||!p)return u(d);const h=m,g=r.stringify(h,p);JD(g)?p.value=g:p.result=g,u(d,p)});function u(d,m){d||!m?s(d):i?i(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),Zi("processSync",this.parser||this.Parser),Yi("processSync",this.compiler||this.Compiler),this.process(t,a),sc("processSync","process",n),r;function a(i,s){n=!0,Yl(i),r=s}}run(t,n,r){ic(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=ha(n);a.run(t,l,u);function u(d,m,p){const h=m||t;d?o(d):s?s(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),sc("runSync","run",r),a;function i(s,o){Yl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=ha(n),a=this.compiler||this.Compiler;return Yi("stringify",a),ic(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Gi("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...m]=u;l(d,m)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(a.settings=Ui(!0,a.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const m=u[d];i(m)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let m=-1,p=-1;for(;++m<r.length;)if(r[m][0]===u){p=m;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[h,...g]=d;const f=r[p][1];zs(f)&&zs(h)&&(h=Ui(!0,f,h)),r[p]=[u,h,...g]}}}}const GD=new So().freeze();function Zi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Yi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Gi(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 ic(e){if(!zs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function sc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ha(e){return QD(e)?e:new VD(e)}function QD(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function JD(e){return typeof e=="string"||XD(e)}function XD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const eC={};function tC(e,t){const n=t||eC,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return qf(e,r,a)}function qf(e,t,n){if(nC(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 oc(e.children,t,n)}return Array.isArray(e)?oc(e,t,n):""}function oc(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=qf(e[a],t,n);return r.join("")}function nC(e){return!!(e&&typeof e=="object")}const uc=document.createElement("i");function jo(e){const t="&"+e+";";uc.innerHTML=t;const n=uc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Xt(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 _t(e,t){return e.length>0?(Xt(e,e.length,0,t),e):t}const lc={}.hasOwnProperty;function rC(e){const t={};let n=-1;for(;++n<e.length;)aC(t,e[n]);return t}function aC(e,t){let n;for(n in t){const a=(lc.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){lc.call(a,s)||(a[s]=[]);const o=i[s];iC(a[s],Array.isArray(o)?o:o?[o]:[])}}}function iC(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Xt(e,0,0,r)}function Wf(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 Jn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $t=vn(/[A-Za-z]/),jt=vn(/[\dA-Za-z]/),sC=vn(/[#-'*+\--9=?A-Z^-~]/);function Us(e){return e!==null&&(e<32||e===127)}const Hs=vn(/\d/),oC=vn(/[\dA-Fa-f]/),uC=vn(/[!-/:-@[-`{-~]/);function be(e){return e!==null&&e<-2}function pt(e){return e!==null&&(e<0||e===32)}function Oe(e){return e===-2||e===-1||e===32}const lC=vn(/\p{P}|\p{S}/u),cC=vn(/\s/);function vn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Le(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Oe(l)?(e.enter(n),o(l)):t(l)}function o(l){return Oe(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const dC={tokenize:fC};function fC(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"),Le(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 be(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const hC={tokenize:mC},cc={tokenize:pC};function mC(e){const t=this,n=[];let r=0,a,i,s;return o;function o(B){if(r<n.length){const _=n[r];return t.containerState=_[1],e.attempt(_[0].continuation,l,u)(B)}return u(B)}function l(B){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&E();const _=t.events.length;let x=_,T;for(;x--;)if(t.events[x][0]==="exit"&&t.events[x][1].type==="chunkFlow"){T=t.events[x][1].end;break}v(r);let S=_;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},T),S++;return Xt(t.events,x+1,0,t.events.slice(_)),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(cc,d,m)(B)}function d(B){return a&&E(),v(r),p(B)}function m(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(cc,h,g)(B)}function h(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){b(e.exit("chunkFlow"),!0),v(0),e.consume(B);return}return be(B)?(e.consume(B),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(B),f)}function b(B,_){const x=t.sliceStream(B);if(_&&x.push(null),B.previous=i,i&&(i.next=B),i=B,a.defineSkip(B.start),a.write(x),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 $=S,M,N;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(M){N=t.events[$][1].end;break}M=!0}for(v(r),T=S;T<t.events.length;)t.events[T][1].end=Object.assign({},N),T++;Xt(t.events,$+1,0,t.events.slice(S)),t.events.length=T}}function v(B){let _=n.length;for(;_-- >B;){const x=n[_];t.containerState=x[1],x[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 pC(e,t,n){return Le(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function dc(e){if(e===null||pt(e)||cC(e))return 1;if(lC(e))return 2}function Oo(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 Vs={name:"attention",tokenize:vC,resolveAll:gC};function gC(e,t){let n=-1,r,a,i,s,o,l,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);fc(m,-l),fc(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:m,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end: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=_t(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=_t(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=_t(u,Oo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=_t(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=_t(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Xt(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 vC(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=dc(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=dc(l),m=!d||d===2&&a||n.includes(l),p=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?m:m&&(a||!p)),u._close=!!(i===42?p:p&&(d||!m)),t(l)}}function fc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const bC={name:"autolink",tokenize:yC};function yC(e,t,n){let r=0;return a;function a(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return $t(h)?(e.consume(h),s):h===64?n(h):u(h)}function s(h){return h===43||h===45||h===46||jt(h)?(r=1,o(h)):u(h)}function o(h){return h===58?(e.consume(h),r=0,l):(h===43||h===45||h===46||jt(h))&&r++<32?(e.consume(h),o):(r=0,u(h))}function l(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||Us(h)?n(h):(e.consume(h),l)}function u(h){return h===64?(e.consume(h),d):sC(h)?(e.consume(h),u):n(h)}function d(h){return jt(h)?m(h):n(h)}function m(h){return h===46?(e.consume(h),r=0,d):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):p(h)}function p(h){if((h===45||jt(h))&&r++<63){const g=h===45?p:m;return e.consume(h),g}return n(h)}}const li={tokenize:DC,partial:!0};function DC(e,t,n){return r;function r(i){return Oe(i)?Le(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||be(i)?t(i):n(i)}}const Uf={name:"blockQuote",tokenize:CC,continuation:{tokenize:xC},exit:wC};function CC(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 Oe(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function xC(e,t,n){const r=this;return a;function a(s){return Oe(s)?Le(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Uf,t,n)(s)}}function wC(e){e.exit("blockQuote")}const Hf={name:"characterEscape",tokenize:EC};function EC(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 uC(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Vf={name:"characterReference",tokenize:_C};function _C(e,t,n){const r=this;let a=0,i,s;return o;function o(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),l}function l(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=jt,d(m))}function u(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=oC,d):(e.enter("characterReferenceValue"),i=7,s=Hs,d(m))}function d(m){if(m===59&&a){const p=e.exit("characterReferenceValue");return s===jt&&!jo(r.sliceSerialize(p))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(m)&&a++<i?(e.consume(m),d):n(m)}}const hc={tokenize:FC,partial:!0},mc={name:"codeFenced",tokenize:kC,concrete:!0};function kC(e,t,n){const r=this,a={tokenize:x,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"),Oe(T)?Le(e,m,"whitespace")(T):m(T))}function m(T){return T===null||be(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(hc,f,_)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(T))}function p(T){return T===null||be(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(T)):Oe(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Le(e,h,"whitespace")(T)):T===96&&T===o?n(T):(e.consume(T),p)}function h(T){return T===null||be(T)?m(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||be(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(T)):T===96&&T===o?n(T):(e.consume(T),g)}function f(T){return e.attempt(a,_,b)(T)}function b(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),v}function v(T){return i>0&&Oe(T)?Le(e,E,"linePrefix",i+1)(T):E(T)}function E(T){return T===null||be(T)?e.check(hc,f,_)(T):(e.enter("codeFlowValue"),B(T))}function B(T){return T===null||be(T)?(e.exit("codeFlowValue"),E(T)):(e.consume(T),B)}function _(T){return e.exit("codeFenced"),t(T)}function x(T,S,$){let M=0;return N;function N(L){return T.enter("lineEnding"),T.consume(L),T.exit("lineEnding"),q}function q(L){return T.enter("codeFencedFence"),Oe(L)?Le(T,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):w(L)}function w(L){return L===o?(T.enter("codeFencedFenceSequence"),A(L)):$(L)}function A(L){return L===o?(M++,T.consume(L),A):M>=s?(T.exit("codeFencedFenceSequence"),Oe(L)?Le(T,j,"whitespace")(L):j(L)):$(L)}function j(L){return L===null||be(L)?(T.exit("codeFencedFence"),S(L)):$(L)}}}function FC(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 Qi={name:"codeIndented",tokenize:AC},BC={tokenize:TC,partial:!0};function AC(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Le(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):be(u)?e.attempt(BC,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||be(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function TC(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):be(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):Le(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):be(s)?a(s):n(s)}}const SC={name:"codeText",tokenize:PC,resolve:jC,previous:OC};function jC(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 OC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function PC(e,t,n){let r=0,a,i;return s;function s(m){return e.enter("codeText"),e.enter("codeTextSequence"),o(m)}function o(m){return m===96?(e.consume(m),r++,o):(e.exit("codeTextSequence"),l(m))}function l(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),l):m===96?(i=e.enter("codeTextSequence"),a=0,d(m)):be(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||be(m)?(e.exit("codeTextData"),l(m)):(e.consume(m),u)}function d(m){return m===96?(e.consume(m),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(i.type="codeTextData",u(m))}}class MC{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&yr(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),yr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),yr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);yr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);yr(this.left,n.reverse())}}}function yr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Kf(e){const t={};let n=-1,r,a,i,s,o,l,u;const d=new MC(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,NC(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=d.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(d.get(a)[1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},d.get(a)[1].start),o=d.slice(a,n),o.unshift(r),d.splice(a,n-a+1,o))}}return Xt(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function NC(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let d,m,p=-1,h=n,g=0,f=0;const b=[f];for(;h;){for(;e.get(++a)[1]!==h;);i.push(a),h._tokenizer||(d=r.sliceStream(h),h.next||d.push(null),m&&s.defineSkip(h.start),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),h._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),m=h,h=h.next}for(h=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(f=p+1,b.push(f),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(s.events=[],h?(h._tokenizer=void 0,h.previous=void 0):b.pop(),p=b.length;p--;){const v=o.slice(b[p],b[p+1]),E=i.pop();l.push([E,E+v.length-1]),e.splice(E,2,v)}for(l.reverse(),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 IC={tokenize:LC,resolve:$C},RC={tokenize:zC,partial:!0};function $C(e){return Kf(e),e}function LC(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):be(o)?e.check(RC,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 zC(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Le(e,i,"linePrefix")}function i(s){if(s===null||be(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 Zf(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return m;function m(v){return v===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(v),e.exit(i),p):v===null||v===32||v===41||Us(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"}),h(v))}function h(v){return v===62?(e.exit("chunkString"),e.exit(o),p(v)):v===null||v===60||be(v)?n(v):(e.consume(v),v===92?g:h)}function g(v){return v===60||v===62||v===92?(e.consume(v),h):h(v)}function f(v){return!d&&(v===null||v===41||pt(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):d<u&&v===40?(e.consume(v),d++,f):v===41?(e.consume(v),d--,f):v===null||v===32||v===40||Us(v)?n(v):(e.consume(v),v===92?b:f)}function b(v){return v===40||v===41||v===92?(e.consume(v),f):f(v)}}function Yf(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(h){return e.enter(r),e.enter(a),e.consume(h),e.exit(a),e.enter(i),d}function d(h){return o>999||h===null||h===91||h===93&&!l||h===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(h):h===93?(e.exit(i),e.enter(a),e.consume(h),e.exit(a),e.exit(r),t):be(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),m(h))}function m(h){return h===null||h===91||h===93||be(h)||o++>999?(e.exit("chunkString"),d(h)):(e.consume(h),l||(l=!Oe(h)),h===92?p:m)}function p(h){return h===91||h===92||h===93?(e.consume(h),o++,m):m(h)}}function Gf(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):be(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Le(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===s||p===null||be(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?m:d)}function m(p){return p===s||p===92?(e.consume(p),d):d(p)}}function Br(e,t){let n;return r;function r(a){return be(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Oe(a)?Le(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const qC={name:"definition",tokenize:UC},WC={tokenize:HC,partial:!0};function UC(e,t,n){const r=this;let a;return i;function i(h){return e.enter("definition"),s(h)}function s(h){return Yf.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function o(h){return a=Jn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return pt(h)?Br(e,u)(h):u(h)}function u(h){return Zf(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return e.attempt(WC,m,m)(h)}function m(h){return Oe(h)?Le(e,p,"whitespace")(h):p(h)}function p(h){return h===null||be(h)?(e.exit("definition"),r.parser.defined.push(a),t(h)):n(h)}}function HC(e,t,n){return r;function r(o){return pt(o)?Br(e,a)(o):n(o)}function a(o){return Gf(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Oe(o)?Le(e,s,"whitespace")(o):s(o)}function s(o){return o===null||be(o)?t(o):n(o)}}const VC={name:"hardBreakEscape",tokenize:KC};function KC(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return be(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const ZC={name:"headingAtx",tokenize:GC,resolve:YC};function YC(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"},Xt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function GC(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||pt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||be(d)?(e.exit("atxHeading"),t(d)):Oe(d)?Le(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||pt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const QC=["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"],pc=["pre","script","style","textarea"],JC={name:"htmlFlow",tokenize:nx,resolveTo:tx,concrete:!0},XC={tokenize:ax,partial:!0},ex={tokenize:rx,partial:!0};function tx(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 nx(e,t,n){const r=this;let a,i,s,o,l;return u;function u(k){return d(k)}function d(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),m}function m(k){return k===33?(e.consume(k),p):k===47?(e.consume(k),i=!0,f):k===63?(e.consume(k),a=3,r.interrupt?t:C):$t(k)?(e.consume(k),s=String.fromCharCode(k),b):n(k)}function p(k){return k===45?(e.consume(k),a=2,h):k===91?(e.consume(k),a=5,o=0,g):$t(k)?(e.consume(k),a=4,r.interrupt?t:C):n(k)}function h(k){return k===45?(e.consume(k),r.interrupt?t:C):n(k)}function g(k){const F="CDATA[";return k===F.charCodeAt(o++)?(e.consume(k),o===F.length?r.interrupt?t:w:g):n(k)}function f(k){return $t(k)?(e.consume(k),s=String.fromCharCode(k),b):n(k)}function b(k){if(k===null||k===47||k===62||pt(k)){const F=k===47,R=s.toLowerCase();return!F&&!i&&pc.includes(R)?(a=1,r.interrupt?t(k):w(k)):QC.includes(s.toLowerCase())?(a=6,F?(e.consume(k),v):r.interrupt?t(k):w(k)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(k):i?E(k):B(k))}return k===45||jt(k)?(e.consume(k),s+=String.fromCharCode(k),b):n(k)}function v(k){return k===62?(e.consume(k),r.interrupt?t:w):n(k)}function E(k){return Oe(k)?(e.consume(k),E):N(k)}function B(k){return k===47?(e.consume(k),N):k===58||k===95||$t(k)?(e.consume(k),_):Oe(k)?(e.consume(k),B):N(k)}function _(k){return k===45||k===46||k===58||k===95||jt(k)?(e.consume(k),_):x(k)}function x(k){return k===61?(e.consume(k),T):Oe(k)?(e.consume(k),x):B(k)}function T(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),l=k,S):Oe(k)?(e.consume(k),T):$(k)}function S(k){return k===l?(e.consume(k),l=null,M):k===null||be(k)?n(k):(e.consume(k),S)}function $(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||pt(k)?x(k):(e.consume(k),$)}function M(k){return k===47||k===62||Oe(k)?B(k):n(k)}function N(k){return k===62?(e.consume(k),q):n(k)}function q(k){return k===null||be(k)?w(k):Oe(k)?(e.consume(k),q):n(k)}function w(k){return k===45&&a===2?(e.consume(k),U):k===60&&a===1?(e.consume(k),Z):k===62&&a===4?(e.consume(k),z):k===63&&a===3?(e.consume(k),C):k===93&&a===5?(e.consume(k),ae):be(k)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(XC,Q,A)(k)):k===null||be(k)?(e.exit("htmlFlowData"),A(k)):(e.consume(k),w)}function A(k){return e.check(ex,j,Q)(k)}function j(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),L}function L(k){return k===null||be(k)?A(k):(e.enter("htmlFlowData"),w(k))}function U(k){return k===45?(e.consume(k),C):w(k)}function Z(k){return k===47?(e.consume(k),s="",G):w(k)}function G(k){if(k===62){const F=s.toLowerCase();return pc.includes(F)?(e.consume(k),z):w(k)}return $t(k)&&s.length<8?(e.consume(k),s+=String.fromCharCode(k),G):w(k)}function ae(k){return k===93?(e.consume(k),C):w(k)}function C(k){return k===62?(e.consume(k),z):k===45&&a===2?(e.consume(k),C):w(k)}function z(k){return k===null||be(k)?(e.exit("htmlFlowData"),Q(k)):(e.consume(k),z)}function Q(k){return e.exit("htmlFlow"),t(k)}}function rx(e,t,n){const r=this;return a;function a(s){return be(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 ax(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(li,t,n)}}const ix={name:"htmlText",tokenize:sx};function sx(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),x):C===63?(e.consume(C),B):$t(C)?(e.consume(C),$):n(C)}function u(C){return C===45?(e.consume(C),d):C===91?(e.consume(C),i=0,g):$t(C)?(e.consume(C),E):n(C)}function d(C){return C===45?(e.consume(C),h):n(C)}function m(C){return C===null?n(C):C===45?(e.consume(C),p):be(C)?(s=m,Z(C)):(e.consume(C),m)}function p(C){return C===45?(e.consume(C),h):m(C)}function h(C){return C===62?U(C):C===45?p(C):m(C)}function g(C){const z="CDATA[";return C===z.charCodeAt(i++)?(e.consume(C),i===z.length?f:g):n(C)}function f(C){return C===null?n(C):C===93?(e.consume(C),b):be(C)?(s=f,Z(C)):(e.consume(C),f)}function b(C){return C===93?(e.consume(C),v):f(C)}function v(C){return C===62?U(C):C===93?(e.consume(C),v):f(C)}function E(C){return C===null||C===62?U(C):be(C)?(s=E,Z(C)):(e.consume(C),E)}function B(C){return C===null?n(C):C===63?(e.consume(C),_):be(C)?(s=B,Z(C)):(e.consume(C),B)}function _(C){return C===62?U(C):B(C)}function x(C){return $t(C)?(e.consume(C),T):n(C)}function T(C){return C===45||jt(C)?(e.consume(C),T):S(C)}function S(C){return be(C)?(s=S,Z(C)):Oe(C)?(e.consume(C),S):U(C)}function $(C){return C===45||jt(C)?(e.consume(C),$):C===47||C===62||pt(C)?M(C):n(C)}function M(C){return C===47?(e.consume(C),U):C===58||C===95||$t(C)?(e.consume(C),N):be(C)?(s=M,Z(C)):Oe(C)?(e.consume(C),M):U(C)}function N(C){return C===45||C===46||C===58||C===95||jt(C)?(e.consume(C),N):q(C)}function q(C){return C===61?(e.consume(C),w):be(C)?(s=q,Z(C)):Oe(C)?(e.consume(C),q):M(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,A):be(C)?(s=w,Z(C)):Oe(C)?(e.consume(C),w):(e.consume(C),j)}function A(C){return C===a?(e.consume(C),a=void 0,L):C===null?n(C):be(C)?(s=A,Z(C)):(e.consume(C),A)}function j(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||pt(C)?M(C):(e.consume(C),j)}function L(C){return C===47||C===62||pt(C)?M(C):n(C)}function U(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function Z(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),G}function G(C){return Oe(C)?Le(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 Po={name:"labelEnd",tokenize:fx,resolveTo:dx,resolveAll:cx},ox={tokenize:hx},ux={tokenize:mx},lx={tokenize:px};function cx(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 dx(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=_t(o,e.slice(i+1,i+r+3)),o=_t(o,[["enter",d,t]]),o=_t(o,Oo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=_t(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=_t(o,e.slice(s+1)),o=_t(o,[["exit",l,t]]),Xt(e,i,e.length,o),e}function fx(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?m(p):(s=r.parser.defined.includes(Jn(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(ox,d,s?d:m)(p):p===91?e.attempt(ux,d,s?u:m)(p):s?d(p):m(p)}function u(p){return e.attempt(lx,d,m)(p)}function d(p){return t(p)}function m(p){return i._balanced=!0,n(p)}}function hx(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return pt(m)?Br(e,i)(m):i(m)}function i(m){return m===41?d(m):Zf(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function s(m){return pt(m)?Br(e,l)(m):d(m)}function o(m){return n(m)}function l(m){return m===34||m===39||m===40?Gf(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):d(m)}function u(m){return pt(m)?Br(e,d)(m):d(m)}function d(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function mx(e,t,n){const r=this;return a;function a(o){return Yf.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Jn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function px(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 gx={name:"labelStartImage",tokenize:vx,resolveAll:Po.resolveAll};function vx(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 bx={name:"labelStartLink",tokenize:yx,resolveAll:Po.resolveAll};function yx(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 Ji={name:"lineEnding",tokenize:Dx};function Dx(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Le(e,t,"linePrefix")}}const Ba={name:"thematicBreak",tokenize:Cx};function Cx(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||be(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Oe(u)?Le(e,o,"whitespace")(u):o(u))}}const ft={name:"list",tokenize:Ex,continuation:{tokenize:_x},exit:Fx},xx={tokenize:Bx,partial:!0},wx={tokenize:kx,partial:!0};function Ex(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(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:Hs(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Ba,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return Hs(h)&&++s<10?(e.consume(h),l):(!r.interrupt||s<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(li,r.interrupt?n:d,e.attempt(xx,p,m))}function d(h){return r.containerState.initialBlankLine=!0,i++,p(h)}function m(h){return Oe(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function _x(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(li,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Le(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Oe(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(wx,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Le(e,e.attempt(ft,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function kx(e,t,n){const r=this;return Le(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 Fx(e){e.exit(this.containerState.type)}function Bx(e,t,n){const r=this;return Le(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!Oe(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const gc={name:"setextUnderline",tokenize:Tx,resolveTo:Ax};function Ax(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 Tx(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,m;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){m=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Oe(u)?Le(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||be(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Sx={tokenize:jx};function jx(e){const t=this,n=e.attempt(li,r,e.attempt(this.parser.constructs.flowInitial,a,Le(e,e.attempt(this.parser.constructs.flow,a,e.attempt(IC,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 Ox={resolveAll:Jf()},Px=Qf("string"),Mx=Qf("text");function Qf(e){return{tokenize:t,resolveAll:Jf(e==="text"?Nx:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const m=a[d];let p=-1;if(m)for(;++p<m.length;){const h=m[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function Jf(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 Nx(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 Ix(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:_,attempt:S(x),check:S(T),interrupt:S(T,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:h,sliceSerialize:p,now:g,defineSkip:f,write:m};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function m(q){return s=_t(s,q),b(),s[s.length-1]!==null?[]:($(t,0),u.events=Oo(i,u.events,u),u.events)}function p(q,w){return $x(h(q),w)}function h(q){return Rx(s,q)}function g(){const{line:q,column:w,offset:A,_index:j,_bufferIndex:L}=r;return{line:q,column:w,offset:A,_index:j,_bufferIndex:L}}function f(q){a[q.line]=q.column,N()}function b(){let q;for(;r._index<s.length;){const w=s[r._index];if(typeof w=="string")for(q=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===q&&r._bufferIndex<w.length;)v(w.charCodeAt(r._bufferIndex));else v(w)}}function v(q){d=d(q)}function E(q){be(q)?(r.line++,r.column=1,r.offset+=q===-3?2:1,N()):q!==-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=q}function B(q,w){const A=w||{};return A.type=q,A.start=g(),u.events.push(["enter",A,u]),o.push(A),A}function _(q){const w=o.pop();return w.end=g(),u.events.push(["exit",w,u]),w}function x(q,w){$(q,w.from)}function T(q,w){w.restore()}function S(q,w){return A;function A(j,L,U){let Z,G,ae,C;return Array.isArray(j)?Q(j):"tokenize"in j?Q([j]):z(j);function z(I){return W;function W(re){const ee=re!==null&&I[re],ie=re!==null&&I.null,fe=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(ie)?ie:ie?[ie]:[]];return Q(fe)(re)}}function Q(I){return Z=I,G=0,I.length===0?U:k(I[G])}function k(I){return W;function W(re){return C=M(),ae=I,I.partial||(u.currentConstruct=I),I.name&&u.parser.constructs.disable.null.includes(I.name)?R():I.tokenize.call(w?Object.assign(Object.create(u),w):u,l,F,R)(re)}}function F(I){return q(ae,C),L}function R(I){return C.restore(),++G<Z.length?k(Z[G]):U}}}function $(q,w){q.resolveAll&&!i.includes(q)&&i.push(q),q.resolve&&Xt(u.events,w,u.events.length-w,q.resolve(u.events.slice(w),u)),q.resolveTo&&(u.events=q.resolveTo(u.events,u))}function M(){const q=g(),w=u.previous,A=u.currentConstruct,j=u.events.length,L=Array.from(o);return{restore:U,from:j};function U(){r=q,u.previous=w,u.currentConstruct=A,u.events.length=j,o=L,N()}}function N(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function Rx(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 $x(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=`
140
140
  `;break}case-3:{s=`\r
141
- `;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 Ox={42:ct,43:ct,45:ct,48:ct,49:ct,50:ct,51:ct,52:ct,53:ct,54:ct,55:ct,56:ct,57:ct,62:Lf},Px={91:NC},Nx={[-2]:Gi,[-1]:Gi,32:Gi},Mx={35:zC,42:Fa,45:[mc,Fa],60:HC,61:mc,95:Fa,96:fc,126:fc},Ix={38:qf,92:zf},Rx={[-5]:Qi,[-4]:Qi,[-3]:Qi,33:lx,38:qf,42:Hs,60:[dC,JC],91:dx,92:[$C,zf],93:jo,95:Hs,96:EC},$x={null:[Hs,kx]},Lx={null:[42,95]},zx={null:[]},qx=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Lx,contentInitial:Px,disable:zx,document:Ox,flow:Mx,flowInitial:Nx,insideSpan:$x,string:Ix,text:Rx},Symbol.toStringTag,{value:"Module"}));function Wx(e){const n=GD([qx,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(aC),document:a(sC),flow:a(Ex),string:a(Fx),text:a(Bx)};return r;function a(i){return s;function s(o){return Tx(r,i,o)}}}function Ux(e){for(;!Wf(e););return e}const pc=/[\0\t\n\r]/g;function Hx(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,m,p,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),m=0,t="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(pc.lastIndex=m,u=pc.exec(i),p=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(p),!u){t=i.slice(m);break}if(h===10&&m===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),m<p&&(l.push(i.slice(m,p)),e+=p-m),h){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}m=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Vx=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Kx(e){return e.replace(Vx,Zx)}function Zx(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return $f(n.slice(i?2:1),i?16:10)}return To(n)||e}const Yf={}.hasOwnProperty;function Yx(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Gx(n)(Ux(Wx(n).document().write(Hx()(e,t,!0))))}function Gx(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(He),autolinkProtocol:N,autolinkEmail:N,atxHeading:i(me),blockQuote:i(J),characterEscape:N,characterReference:N,codeFenced:i(ie),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ie,s),codeText:i(de,s),codeTextData:N,data:N,codeFlowValue:N,definition:i(X),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ye),hardBreakEscape:i(xe),hardBreakTrailing:i(xe),htmlFlow:i(Te,s),htmlFlowData:N,htmlText:i(Te,s),htmlTextData:N,image:i(Se),label:s,link:i(He),listItem:i(Fe),listItemValue:p,listOrdered:i(Be,m),listUnordered:i(Be),paragraph:i(Pe),reference:E,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(me),strong:i(Ee),thematicBreak:i(ze)},exit:{atxHeading:l(),atxHeadingSequence:w,autolink:l(),autolinkEmail:ae,autolinkProtocol:U,blockQuote:l(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:$,characterReferenceMarkerNumeric:$,characterReferenceValue:R,codeFenced:l(b),codeFencedFence:f,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:I,codeIndented:l(v),codeText:l(L),codeTextData:I,data:I,definition:l(),definitionDestinationString:x,definitionLabelString:_,definitionTitleString:F,emphasis:l(),hardBreakEscape:l(k),hardBreakTrailing:l(k),htmlFlow:l(A),htmlFlowData:I,htmlText:l(j),htmlTextData:I,image:l(Y),label:re,labelText:Q,lineEnding:M,link:l(H),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:T,resourceDestinationString:C,resourceTitleString:q,resource:K,setextHeading:l(z),setextHeadingLineSequence:S,setextHeadingText:B,strong:l(),thematicBreak:l()}};Gf(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(W){let ne={type:"root",children:[]};const he={stack:[ne],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},pe=[];let Ce=-1;for(;++Ce<W.length;)if(W[Ce][1].type==="listOrdered"||W[Ce][1].type==="listUnordered")if(W[Ce][0]==="enter")pe.push(Ce);else{const Ze=pe.pop();Ce=a(W,Ze,Ce)}for(Ce=-1;++Ce<W.length;){const Ze=t[W[Ce][0]];Yf.call(Ze,W[Ce][1].type)&&Ze[W[Ce][1].type].call(Object.assign({sliceSerialize:W[Ce][2].sliceSerialize},he),W[Ce][1])}if(he.tokenStack.length>0){const Ze=he.tokenStack[he.tokenStack.length-1];(Ze[1]||gc).call(he,void 0,Ze[0])}for(ne.position={start:nn(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:nn(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},Ce=-1;++Ce<t.transforms.length;)ne=t.transforms[Ce](ne)||ne;return ne}function a(W,ne,he){let pe=ne-1,Ce=-1,Ze=!1,Ye,gt,Ut,Bt;for(;++pe<=he;){const tt=W[pe];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?Ce++:Ce--,Bt=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(Ye&&!Bt&&!Ce&&!Ut&&(Ut=pe),Bt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Bt=void 0}if(!Ce&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||Ce===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(Ye){let Ot=pe;for(gt=void 0;Ot--;){const vt=W[Ot];if(vt[1].type==="lineEnding"||vt[1].type==="lineEndingBlank"){if(vt[0]==="exit")continue;gt&&(W[gt][1].type="lineEndingBlank",Ze=!0),vt[1].type="lineEnding",gt=Ot}else if(!(vt[1].type==="linePrefix"||vt[1].type==="blockQuotePrefix"||vt[1].type==="blockQuotePrefixWhitespace"||vt[1].type==="blockQuoteMarker"||vt[1].type==="listItemIndent"))break}Ut&&(!gt||Ut<gt)&&(Ye._spread=!0),Ye.end=Object.assign({},gt?W[gt][1].start:tt[1].end),W.splice(gt||pe,0,["exit",Ye,tt[2]]),pe++,he++}if(tt[1].type==="listItemPrefix"){const Ot={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};Ye=Ot,W.splice(pe,0,["enter",Ot,tt[2]]),pe++,he++,Ut=void 0,Bt=!0}}}return W[ne][1]._spread=Ze,he}function i(W,ne){return he;function he(pe){o.call(this,W(pe),pe),ne&&ne.call(this,pe)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(W,ne,he){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([ne,he]),W.position={start:nn(ne.start),end:void 0}}function l(W){return ne;function ne(he){W&&W.call(this,he),u.call(this,he)}}function u(W,ne){const he=this.stack.pop(),pe=this.tokenStack.pop();if(pe)pe[0].type!==W.type&&(ne?ne.call(this,W,pe[0]):(pe[1]||gc).call(this,W,pe[0]));else throw new Error("Cannot close `"+W.type+"` ("+kr({start:W.start,end:W.end})+"): it’s not open");he.position.end=nn(W.end)}function d(){return ZD(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function p(W){if(this.data.expectingFirstListItemValue){const ne=this.stack[this.stack.length-2];ne.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function h(){const W=this.resume(),ne=this.stack[this.stack.length-1];ne.lang=W}function g(){const W=this.resume(),ne=this.stack[this.stack.length-1];ne.meta=W}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const W=this.resume(),ne=this.stack[this.stack.length-1];ne.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const W=this.resume(),ne=this.stack[this.stack.length-1];ne.value=W.replace(/(\r?\n|\r)$/g,"")}function _(W){const ne=this.resume(),he=this.stack[this.stack.length-1];he.label=ne,he.identifier=Qn(this.sliceSerialize(W)).toLowerCase()}function F(){const W=this.resume(),ne=this.stack[this.stack.length-1];ne.title=W}function x(){const W=this.resume(),ne=this.stack[this.stack.length-1];ne.url=W}function w(W){const ne=this.stack[this.stack.length-1];if(!ne.depth){const he=this.sliceSerialize(W).length;ne.depth=he}}function B(){this.data.setextHeadingSlurpLineEnding=!0}function S(W){const ne=this.stack[this.stack.length-1];ne.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function N(W){const he=this.stack[this.stack.length-1].children;let pe=he[he.length-1];(!pe||pe.type!=="text")&&(pe=Ve(),pe.position={start:nn(W.start),end:void 0},he.push(pe)),this.stack.push(pe)}function I(W){const ne=this.stack.pop();ne.value+=this.sliceSerialize(W),ne.position.end=nn(W.end)}function M(W){const ne=this.stack[this.stack.length-1];if(this.data.atHardBreak){const he=ne.children[ne.children.length-1];he.position.end=nn(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ne.type)&&(N.call(this,W),I.call(this,W))}function k(){this.data.atHardBreak=!0}function A(){const W=this.resume(),ne=this.stack[this.stack.length-1];ne.value=W}function j(){const W=this.resume(),ne=this.stack[this.stack.length-1];ne.value=W}function L(){const W=this.resume(),ne=this.stack[this.stack.length-1];ne.value=W}function H(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ne=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ne,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function Y(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const ne=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=ne,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function Q(W){const ne=this.sliceSerialize(W),he=this.stack[this.stack.length-2];he.label=Kx(ne),he.identifier=Qn(ne).toLowerCase()}function re(){const W=this.stack[this.stack.length-1],ne=this.resume(),he=this.stack[this.stack.length-1];if(this.data.inReference=!0,he.type==="link"){const pe=W.children;he.children=pe}else he.alt=ne}function C(){const W=this.resume(),ne=this.stack[this.stack.length-1];ne.url=W}function q(){const W=this.resume(),ne=this.stack[this.stack.length-1];ne.title=W}function K(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function T(W){const ne=this.resume(),he=this.stack[this.stack.length-1];he.label=ne,he.identifier=Qn(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function $(W){this.data.characterReferenceType=W.type}function R(W){const ne=this.sliceSerialize(W),he=this.data.characterReferenceType;let pe;he?(pe=$f(ne,he==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):pe=To(ne);const Ce=this.stack.pop();Ce.value+=pe,Ce.position.end=nn(W.end)}function U(W){I.call(this,W);const ne=this.stack[this.stack.length-1];ne.url=this.sliceSerialize(W)}function ae(W){I.call(this,W);const ne=this.stack[this.stack.length-1];ne.url="mailto:"+this.sliceSerialize(W)}function J(){return{type:"blockquote",children:[]}}function ie(){return{type:"code",lang:null,meta:null,value:""}}function de(){return{type:"inlineCode",value:""}}function X(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ye(){return{type:"emphasis",children:[]}}function me(){return{type:"heading",depth:0,children:[]}}function xe(){return{type:"break"}}function Te(){return{type:"html",value:""}}function Se(){return{type:"image",title:null,url:"",alt:null}}function He(){return{type:"link",title:null,url:"",children:[]}}function Be(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function Fe(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function Pe(){return{type:"paragraph",children:[]}}function Ee(){return{type:"strong",children:[]}}function Ve(){return{type:"text",value:""}}function ze(){return{type:"thematicBreak"}}}function nn(e){return{line:e.line,column:e.column,offset:e.offset}}function Gf(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Gf(e,r):Qx(e,r)}}function Qx(e,t){let n;for(n in t)if(Yf.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 gc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+kr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+kr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+kr({start:t.start,end:t.end})+") is still open")}function Jx(e){const t=this;t.parser=n;function n(r){return Yx(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Qf(e,t){var l,u,d;const n={...Zn,...t==null?void 0:t.nodeTypes,[Z.heading]:{...Zn[Z.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[Z.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(m=>Qf({...m,ordered:e.ordered||!1},t))),e.type){case ot.heading:return{type:n[Z.heading][e.depth||1],children:s};case ot.list:return{type:e.ordered?n[Z.ol]:n[Z.ul],children:s};case ot.listItem:return{type:n[Z.li],children:s};case ot.paragraph:return{type:n[Z.paragraph],children:s};case ot.link:return{type:n[Z.link],[r]:e.url,children:s};case ot.image:return{type:n[Z.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case ot.blockquote:return{type:n[Z.blockquote],children:s};case ot.code:return{type:n[Z.codeblock],language:e.lang,children:[{text:e.value}]};case ot.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 ot.emphasis:return{[n[$t.emphasis]]:!0,...Ji(s),...ha(s)};case ot.strong:return{[n[$t.strong]]:!0,...Ji(s),...ha(s)};case ot.delete:return{[n[$t.delete]]:!0,...Ji(s),...ha(s)};case ot.inlineCode:return{[n[$t.code]]:!0,text:e.value,...ha(s)};case ot.thematicBreak:return{type:n[Z.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Ji=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function ha(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const Xx=function(t){const n=r=>r.children.map(a=>Qf(a,t));this.Compiler=n},ew=(e,t=n=>{})=>{WD().use(Jx).use(Xx).process(e).then(n=>{const r=xn(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($s)){const m=u,p=d.text.replace($s,""),h="link"in m&&m.link?m.link:"";m.type=Z.mention,m.id=h,m.name=p,m.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in l&&l.children&&i(l.children)}};i(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,l)=>{if("text"in o&&o.text){const u=o.text.match(/~~(.*?)~~/g);u&&u.map(d=>{const m=d.replace(/~~/g,""),p=o.text.indexOf(d),h=o.text.substring(0,p),g=o.text.substring(p+d.length),f=[{text:h},{text:m,[Z.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},Oo=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},tw=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=D.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=P.parent(a),r=ue.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},nw=e=>{const{selection:t}=e;return t?D.string(e,t):null},vc=e=>{let t="";for(const n of ue.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},bc={"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},rw=(e,t,n,r)=>{for(const a in bc)if(Yy(a,e)){e.stopPropagation(),e.preventDefault();const i=bc[a];if(i===Z.link){n([{type:"showLinkEditor",value:!0}]);return}if(mw(i)){ih(t,i,r);return}nh(t,i,r)}},Jf=(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:""}]};ee.select(e,(t==null?void 0:t.position)||Nf),ee.insertNodes(e,[u,{text:" "}]),ee.move(e,{distance:1,unit:"offset"}),Oo(r)},aw=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&V.isCollapsed(i)){const[s]=V.edges(i),o=D.start(e,s.path),l=D.range(e,o,s),d=D.string(e,l).match(Kc);if(d){const m=d.index||0,p={path:s.path,offset:m},h={path:s.path,offset:m+d[0].length},g=D.range(e,p,h),f=D.after(e,s),b=D.range(e,s,f);if(D.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const F=d[1];let x=[];r&&(x=await r({name:F})),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}}])},Xf=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},zn=e=>typeof e.text=="string",iw=[Z.hr,Z.image,Z.mention],yc="<br>";function eh(e,t={nodeTypes:Zn}){const{nodeTypes:n=Zn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Zn,...n,heading:{...Zn[Z.heading],...n[Z.heading]}},l=[o[Z.ul],o[Z.ol]];let u=i;if(!zn(e)&&s!==Z.mention&&(u=e.children.map(d=>{const m=zn(d)?!1:l.includes(d.type||""),p=l.includes(e.type||"");let h=!1;return!zn(e)&&Array.isArray(e.children)&&(h=e.children.some(g=>!zn(g)&&g.type===o.link)),eh({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||m||p||h)&&!d.break,listDepth:l.includes(d.type||"")?a+1:a,inBlockquote:s===o[Z.blockquote]||e.parentType===o[Z.blockquote]})}).join("")),!r&&(i===""||i===`
142
- `)&&e.parentType===o[Z.paragraph]&&s!==o[Z.mention]&&(s=o[Z.paragraph],u=yc),!(u===""&&!iw.find(d=>o[d]===s)))switch(u!==yc&&zn(e)&&(e[Z.strikethrough]&&e[Z.bold]&&e[Z.italic]?u=qn(u,"~~***"):e[Z.bold]&&e[Z.italic]?u=qn(u,"***"):(e[Z.bold]&&(u=qn(u,"**")),e[Z.italic]&&(u=qn(u,"_")),e[Z.strikethrough]&&(u=qn(u,"~~")),e[Z.code]&&(u=qn(u,"`")))),s){case o[Z.heading][1]:return`# ${u}
143
- `;case o[Z.heading][2]:return`## ${u}
144
- `;case o[Z.heading][3]:return`### ${u}
145
- `;case o[Z.heading][4]:return`#### ${u}
146
- `;case o[Z.heading][5]:return`##### ${u}
147
- `;case o[Z.heading][6]:return`###### ${u}
148
- `;case o[Z.blockquote]:return`> ${u}
149
-
150
- `;case o[Z.codeblock]:return`\`\`\`${e.language||""}
141
+ `;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 Lx={42:ft,43:ft,45:ft,48:ft,49:ft,50:ft,51:ft,52:ft,53:ft,54:ft,55:ft,56:ft,57:ft,62:Uf},zx={91:qC},qx={[-2]:Qi,[-1]:Qi,32:Qi},Wx={35:ZC,42:Ba,45:[gc,Ba],60:JC,61:gc,95:Ba,96:mc,126:mc},Ux={38:Vf,92:Hf},Hx={[-5]:Ji,[-4]:Ji,[-3]:Ji,33:gx,38:Vf,42:Vs,60:[bC,ix],91:bx,92:[VC,Hf],93:Po,95:Vs,96:SC},Vx={null:[Vs,Ox]},Kx={null:[42,95]},Zx={null:[]},Yx=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Kx,contentInitial:zx,disable:Zx,document:Lx,flow:Wx,flowInitial:qx,insideSpan:Vx,string:Ux,text:Hx},Symbol.toStringTag,{value:"Module"}));function Gx(e){const n=rC([Yx,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(dC),document:a(hC),flow:a(Sx),string:a(Px),text:a(Mx)};return r;function a(i){return s;function s(o){return Ix(r,i,o)}}}function Qx(e){for(;!Kf(e););return e}const vc=/[\0\t\n\r]/g;function Jx(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,m,p,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),m=0,t="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(vc.lastIndex=m,u=vc.exec(i),p=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(p),!u){t=i.slice(m);break}if(h===10&&m===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),m<p&&(l.push(i.slice(m,p)),e+=p-m),h){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}m=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Xx=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ew(e){return e.replace(Xx,tw)}function tw(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Wf(n.slice(i?2:1),i?16:10)}return jo(n)||e}const Xf={}.hasOwnProperty;function nw(e,t,n){return typeof t!="string"&&(n=t,t=void 0),rw(n)(Qx(Gx(n).document().write(Jx()(e,t,!0))))}function rw(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ve),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(pe),blockQuote:i(ee),characterEscape:M,characterReference:M,codeFenced:i(ie),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ie,s),codeText:i(fe,s),codeTextData:M,data:M,codeFlowValue:M,definition:i(X),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ve),hardBreakEscape:i(_e),hardBreakTrailing:i(_e),htmlFlow:i(Fe,s),htmlFlowData:M,htmlText:i(Fe,s),htmlTextData:M,image:i(Te),label:s,link:i(Ve),listItem:i(Be),listItemValue:p,listOrdered:i(We,m),listUnordered:i(We),paragraph:i(Se),reference:k,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(pe),strong:i(De),thematicBreak:i(ze)},exit:{atxHeading:l(),atxHeadingSequence:x,autolink:l(),autolinkEmail:re,autolinkProtocol:W,blockQuote:l(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:R,characterReferenceMarkerNumeric:R,characterReferenceValue:I,codeFenced:l(b),codeFencedFence:f,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:N,codeIndented:l(v),codeText:l(L),codeTextData:N,data:N,definition:l(),definitionDestinationString:_,definitionLabelString:E,definitionTitleString:B,emphasis:l(),hardBreakEscape:l(w),hardBreakTrailing:l(w),htmlFlow:l(A),htmlFlowData:N,htmlText:l(j),htmlTextData:N,image:l(Z),label:ae,labelText:G,lineEnding:q,link:l(U),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:F,resourceDestinationString:C,resourceTitleString:z,resource:Q,setextHeading:l($),setextHeadingLineSequence:S,setextHeadingText:T,strong:l(),thematicBreak:l()}};eh(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(K){let te={type:"root",children:[]};const le={stack:[te],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},me=[];let xe=-1;for(;++xe<K.length;)if(K[xe][1].type==="listOrdered"||K[xe][1].type==="listUnordered")if(K[xe][0]==="enter")me.push(xe);else{const Ze=me.pop();xe=a(K,Ze,xe)}for(xe=-1;++xe<K.length;){const Ze=t[K[xe][0]];Xf.call(Ze,K[xe][1].type)&&Ze[K[xe][1].type].call(Object.assign({sliceSerialize:K[xe][2].sliceSerialize},le),K[xe][1])}if(le.tokenStack.length>0){const Ze=le.tokenStack[le.tokenStack.length-1];(Ze[1]||bc).call(le,void 0,Ze[0])}for(te.position={start:an(K.length>0?K[0][1].start:{line:1,column:1,offset:0}),end:an(K.length>0?K[K.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<t.transforms.length;)te=t.transforms[xe](te)||te;return te}function a(K,te,le){let me=te-1,xe=-1,Ze=!1,Ye,rt,Ht,At;for(;++me<=le;){const tt=K[me];switch(tt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tt[0]==="enter"?xe++:xe--,At=void 0;break}case"lineEndingBlank":{tt[0]==="enter"&&(Ye&&!At&&!xe&&!Ht&&(Ht=me),At=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:At=void 0}if(!xe&&tt[0]==="enter"&&tt[1].type==="listItemPrefix"||xe===-1&&tt[0]==="exit"&&(tt[1].type==="listUnordered"||tt[1].type==="listOrdered")){if(Ye){let Pt=me;for(rt=void 0;Pt--;){const bt=K[Pt];if(bt[1].type==="lineEnding"||bt[1].type==="lineEndingBlank"){if(bt[0]==="exit")continue;rt&&(K[rt][1].type="lineEndingBlank",Ze=!0),bt[1].type="lineEnding",rt=Pt}else if(!(bt[1].type==="linePrefix"||bt[1].type==="blockQuotePrefix"||bt[1].type==="blockQuotePrefixWhitespace"||bt[1].type==="blockQuoteMarker"||bt[1].type==="listItemIndent"))break}Ht&&(!rt||Ht<rt)&&(Ye._spread=!0),Ye.end=Object.assign({},rt?K[rt][1].start:tt[1].end),K.splice(rt||me,0,["exit",Ye,tt[2]]),me++,le++}if(tt[1].type==="listItemPrefix"){const Pt={type:"listItem",_spread:!1,start:Object.assign({},tt[1].start),end:void 0};Ye=Pt,K.splice(me,0,["enter",Pt,tt[2]]),me++,le++,Ht=void 0,At=!0}}}return K[te][1]._spread=Ze,le}function i(K,te){return le;function le(me){o.call(this,K(me),me),te&&te.call(this,me)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(K,te,le){this.stack[this.stack.length-1].children.push(K),this.stack.push(K),this.tokenStack.push([te,le]),K.position={start:an(te.start),end:void 0}}function l(K){return te;function te(le){K&&K.call(this,le),u.call(this,le)}}function u(K,te){const le=this.stack.pop(),me=this.tokenStack.pop();if(me)me[0].type!==K.type&&(te?te.call(this,K,me[0]):(me[1]||bc).call(this,K,me[0]));else throw new Error("Cannot close `"+K.type+"` ("+Fr({start:K.start,end:K.end})+"): it’s not open");le.position.end=an(K.end)}function d(){return tC(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function p(K){if(this.data.expectingFirstListItemValue){const te=this.stack[this.stack.length-2];te.start=Number.parseInt(this.sliceSerialize(K),10),this.data.expectingFirstListItemValue=void 0}}function h(){const K=this.resume(),te=this.stack[this.stack.length-1];te.lang=K}function g(){const K=this.resume(),te=this.stack[this.stack.length-1];te.meta=K}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const K=this.resume(),te=this.stack[this.stack.length-1];te.value=K.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const K=this.resume(),te=this.stack[this.stack.length-1];te.value=K.replace(/(\r?\n|\r)$/g,"")}function E(K){const te=this.resume(),le=this.stack[this.stack.length-1];le.label=te,le.identifier=Jn(this.sliceSerialize(K)).toLowerCase()}function B(){const K=this.resume(),te=this.stack[this.stack.length-1];te.title=K}function _(){const K=this.resume(),te=this.stack[this.stack.length-1];te.url=K}function x(K){const te=this.stack[this.stack.length-1];if(!te.depth){const le=this.sliceSerialize(K).length;te.depth=le}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function S(K){const te=this.stack[this.stack.length-1];te.depth=this.sliceSerialize(K).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function M(K){const le=this.stack[this.stack.length-1].children;let me=le[le.length-1];(!me||me.type!=="text")&&(me=Ie(),me.position={start:an(K.start),end:void 0},le.push(me)),this.stack.push(me)}function N(K){const te=this.stack.pop();te.value+=this.sliceSerialize(K),te.position.end=an(K.end)}function q(K){const te=this.stack[this.stack.length-1];if(this.data.atHardBreak){const le=te.children[te.children.length-1];le.position.end=an(K.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(te.type)&&(M.call(this,K),N.call(this,K))}function w(){this.data.atHardBreak=!0}function A(){const K=this.resume(),te=this.stack[this.stack.length-1];te.value=K}function j(){const K=this.resume(),te=this.stack[this.stack.length-1];te.value=K}function L(){const K=this.resume(),te=this.stack[this.stack.length-1];te.value=K}function U(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const te=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=te,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function Z(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const te=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=te,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function G(K){const te=this.sliceSerialize(K),le=this.stack[this.stack.length-2];le.label=ew(te),le.identifier=Jn(te).toLowerCase()}function ae(){const K=this.stack[this.stack.length-1],te=this.resume(),le=this.stack[this.stack.length-1];if(this.data.inReference=!0,le.type==="link"){const me=K.children;le.children=me}else le.alt=te}function C(){const K=this.resume(),te=this.stack[this.stack.length-1];te.url=K}function z(){const K=this.resume(),te=this.stack[this.stack.length-1];te.title=K}function Q(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function F(K){const te=this.resume(),le=this.stack[this.stack.length-1];le.label=te,le.identifier=Jn(this.sliceSerialize(K)).toLowerCase(),this.data.referenceType="full"}function R(K){this.data.characterReferenceType=K.type}function I(K){const te=this.sliceSerialize(K),le=this.data.characterReferenceType;let me;le?(me=Wf(te,le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):me=jo(te);const xe=this.stack.pop();xe.value+=me,xe.position.end=an(K.end)}function W(K){N.call(this,K);const te=this.stack[this.stack.length-1];te.url=this.sliceSerialize(K)}function re(K){N.call(this,K);const te=this.stack[this.stack.length-1];te.url="mailto:"+this.sliceSerialize(K)}function ee(){return{type:"blockquote",children:[]}}function ie(){return{type:"code",lang:null,meta:null,value:""}}function fe(){return{type:"inlineCode",value:""}}function X(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ve(){return{type:"emphasis",children:[]}}function pe(){return{type:"heading",depth:0,children:[]}}function _e(){return{type:"break"}}function Fe(){return{type:"html",value:""}}function Te(){return{type:"image",title:null,url:"",alt:null}}function Ve(){return{type:"link",title:null,url:"",children:[]}}function We(K){return{type:"list",ordered:K.type==="listOrdered",start:null,spread:K._spread,children:[]}}function Be(K){return{type:"listItem",spread:K._spread,checked:null,children:[]}}function Se(){return{type:"paragraph",children:[]}}function De(){return{type:"strong",children:[]}}function Ie(){return{type:"text",value:""}}function ze(){return{type:"thematicBreak"}}}function an(e){return{line:e.line,column:e.column,offset:e.offset}}function eh(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?eh(e,r):aw(e,r)}}function aw(e,t){let n;for(n in t)if(Xf.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 bc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Fr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Fr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Fr({start:t.start,end:t.end})+") is still open")}function iw(e){const t=this;t.parser=n;function n(r){return nw(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function th(e,t){var l,u,d;const n={...Yn,...t==null?void 0:t.nodeTypes,[V.heading]:{...Yn[V.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[V.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(m=>th({...m,ordered:e.ordered||!1},t))),e.type){case ut.heading:return{type:n[V.heading][e.depth||1],children:s};case ut.list:return{type:e.ordered?n[V.ol]:n[V.ul],children:s};case ut.listItem:return{type:n[V.li],children:s};case ut.paragraph:return{type:n[V.paragraph],children:s};case ut.link:return{type:n[V.link],[r]:e.url,children:s};case ut.image:return{type:n[V.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case ut.blockquote:return{type:n[V.blockquote],children:s};case ut.code:return{type:n[V.codeblock],language:e.lang,children:[{text:e.value}]};case ut.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[V.paragraph],children:[{text:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:V.paragraph,children:[{text:e.value||""}]};case ut.emphasis:return{[n[Lt.emphasis]]:!0,...Xi(s),...ma(s)};case ut.strong:return{[n[Lt.strong]]:!0,...Xi(s),...ma(s)};case ut.delete:return{[n[Lt.delete]]:!0,...Xi(s),...ma(s)};case ut.inlineCode:return{[n[Lt.code]]:!0,text:e.value,...ma(s)};case ut.thematicBreak:return{type:n[V.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Xi=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function ma(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const sw=function(t){const n=r=>r.children.map(a=>th(a,t));this.Compiler=n},ow=(e,t=n=>{})=>{GD().use(iw).use(sw).process(e).then(n=>{const r=wn(n.result),a=s=>{const o=s;[V.li,V.blockquote].includes(o.type)&&o.children.map((l,u)=>{const d=l;d.type===V.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===V.link){const d=u.children&&u.children[0];if(d&&"text"in d&&d.text.includes(Ls)){const m=u,p=d.text.replace(Ls,""),h="link"in m&&m.link?m.link:"";m.type=V.mention,m.id=h,m.name=p,m.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in l&&l.children&&i(l.children)}};i(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,l)=>{if("text"in o&&o.text){const u=o.text.match(/~~(.*?)~~/g);u&&u.map(d=>{const m=d.replace(/~~/g,""),p=o.text.indexOf(d),h=o.text.substring(0,p),g=o.text.substring(p+d.length),f=[{text:h},{text:m,[V.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},Mo=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},uw=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=D.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=P.parent(a),r=ue.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},lw=e=>{const{selection:t}=e;return t?D.string(e,t):null},yc=e=>{let t="";for(const n of ue.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},Dc={"mod+b":V.bold,"mod+i":V.italic,"mod+shift+x":V.strikethrough,"mod+k":V.link,"mod+shift+7":V.ol,"mod+shift+8":V.ul,"mod+shift+9":V.blockquote},cw=(e,t,n,r)=>{for(const a in Dc)if(n1(a,e)){e.stopPropagation(),e.preventDefault();const i=Dc[a];if(i===V.link){n([{type:"showLinkEditor",value:!0}]);return}if(Cw(i)){lh(t,i,r);return}sh(t,i,r)}},nh=(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:V.mention,id:o,name:l,children:[{text:""}]};J.select(e,(t==null?void 0:t.position)||$f),J.insertNodes(e,[u,{text:" "}]),J.move(e,{distance:1,unit:"offset"}),Mo(r)},dw=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&H.isCollapsed(i)){const[s]=H.edges(i),o=D.start(e,s.path),l=D.range(e,o,s),d=D.string(e,l).match(Yc);if(d){const m=d.index||0,p={path:s.path,offset:m},h={path:s.path,offset:m+d[0].length},g=D.range(e,p,h),f=D.after(e,s),b=D.range(e,s,f);if(D.string(e,b).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const B=d[1];let _=[];r&&(_=await r({name:B})),a([{type:"mentionPopover",value:{show:_.length>0?!0:n!==null,selectedUser:0,possibleUsers:_,position:_.length>0?g:null,numberOfUsers:_.length>0?_.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},rh=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},qn=e=>typeof e.text=="string",fw=[V.hr,V.image,V.mention],Cc="<br>";function ah(e,t={nodeTypes:Yn}){const{nodeTypes:n=Yn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Yn,...n,heading:{...Yn[V.heading],...n[V.heading]}},l=[o[V.ul],o[V.ol]];let u=i;if(!qn(e)&&s!==V.mention&&(u=e.children.map(d=>{const m=qn(d)?!1:l.includes(d.type||""),p=l.includes(e.type||"");let h=!1;return!qn(e)&&Array.isArray(e.children)&&(h=e.children.some(g=>!qn(g)&&g.type===o.link)),ah({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||m||p||h)&&!d.break,listDepth:l.includes(d.type||"")?a+1:a,inBlockquote:s===o[V.blockquote]||e.parentType===o[V.blockquote]})}).join("")),!r&&(i===""||i===`
142
+ `)&&e.parentType===o[V.paragraph]&&s!==o[V.mention]&&(s=o[V.paragraph],u=Cc),!(u===""&&!fw.find(d=>o[d]===s)))switch(u!==Cc&&qn(e)&&(e[V.strikethrough]&&e[V.bold]&&e[V.italic]?u=Wn(u,"~~***"):e[V.bold]&&e[V.italic]?u=Wn(u,"***"):(e[V.bold]&&(u=Wn(u,"**")),e[V.italic]&&(u=Wn(u,"_")),e[V.strikethrough]&&(u=Wn(u,"~~")),e[V.code]&&(u=Wn(u,"`")))),s){case o[V.heading][1]:return`# ${u}
143
+ `;case o[V.heading][2]:return`## ${u}
144
+ `;case o[V.heading][3]:return`### ${u}
145
+ `;case o[V.heading][4]:return`#### ${u}
146
+ `;case o[V.heading][5]:return`##### ${u}
147
+ `;case o[V.heading][6]:return`###### ${u}
148
+ `;case o[V.blockquote]:return`> ${u}
149
+
150
+ `;case o[V.codeblock]:return`\`\`\`${e.language||""}
151
151
  ${u}
152
152
  \`\`\`
153
- `;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`
153
+ `;case o[V.link]:return`[${u}](${e.link||""})`;case o.image:return`![${e.caption}](${e.link||""})`;case o[V.mention]:const{id:d}=e;return e?`@{{${d}}}`:u;case o[V.ul]:case o[V.ol]:return`
154
154
  ${u}
155
155
 
156
- `;case o[Z.li]:const m=e&&e.parentType===o[Z.ol],p=e.children.length===1&&zn(e.children[0]);let h="";for(let g=0;a>g;g++)m?h+=" ":h+=" ";return t.inBlockquote&&(h="> "+h),`
156
+ `;case o[V.li]:const m=e&&e.parentType===o[V.ol],p=e.children.length===1&&qn(e.children[0]);let h="";for(let g=0;a>g;g++)m?h+=" ":h+=" ";return t.inBlockquote&&(h="> "+h),`
157
157
  ${h}${m?"1.":"-"} ${u}${p?`
158
- `:""}`;case o[Z.paragraph]:return`${u}
158
+ `:""}`;case o[V.paragraph]:return`${u}
159
159
 
160
- `;case o[Z.hr]:return`---
161
- `;default:return u}}function qn(e,t){const n=e.trim(),r=n,a=`${t}${r}${Dc(t)}`;if(r.length===e.length)return a;const i=t+r+Dc(t);return e.replace(n,i)}const Dc=e=>e.split("").reverse().join(""),sw=e=>e.map(t=>eh(t)).join("").trim();const ow=({onFallbackClick:e=()=>{}})=>{const t=se.useIntl(),n=Nn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(en),{show:l,selectedUser:u,possibleUsers:d}=i,m=Mf(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const p=Xf(a);return c.jsx(Wr,{parent:p,children:c.jsx(Xc,{ref:m,className:"mention-popover",onKeyDown:h=>{h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:h,user:g},f)=>c.jsx(Yt,{element:"li",className:G({selected:f===u}),member:{id:h,...g,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const v={...i,selectedUser:f};r([{type:"mentionPopover",value:v}]),Jf(n,v,r,s),o&&o({id:h||"",name:g.name||""})}}},h)),c.jsx(Yt,{element:"li",className:G("fallback",{selected:d.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${zt}icons/invite-user.svg`},link:!1},functions:{onClick:h=>{h.preventDefault(),h.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})},Po=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=se.useIntl(),l=Nn(),{id:u,tabbableOption:d,setFocus:m,openTooltip:p,dispatch:h}=y.useContext(en),g={};return e!==d&&(g.tabIndex=-1),c.jsxs("li",{id:`${u}-${e}`,className:G(e,{"has-divider":n}),onMouseEnter:()=>{h([{type:"openTooltip",value:e}])},onMouseLeave:()=>{h([{type:"openTooltip",value:null}])},onFocus:()=>{h([{type:"openTooltip",value:e}])},onBlur:f=>{f.stopPropagation();const b=[{type:"openTooltip",value:null}];l.selection&&b.push({type:"lastAnchor",value:l.selection.anchor}),h(b)},contentEditable:!1,children:[c.jsxs("button",{...s,...g,className:G(e,a,{active:t}),onClick:f=>{f.stopPropagation(),f.preventDefault()},onMouseDown:f=>{f.stopPropagation(),f.preventDefault(),r()},onKeyDown:f=>{var b,v,_,F;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 w=x==null?void 0:x.nextElementSibling;if(f.key==="ArrowLeft"){const z=x==null?void 0:x.previousElementSibling;z?w=z:w=(b=x==null?void 0:x.parentElement)==null?void 0:b.lastElementChild}else w||(w=(v=x==null?void 0:x.parentElement)==null?void 0:v.firstElementChild);const B=w==null?void 0:w.className.split(" ")[0];B&&(m(B),(_=w==null?void 0:w.querySelector("button"))==null||_.focus());break;default:const S=f.currentTarget.closest("fieldset");if(S){(F=S==null?void 0:S.previousElementSibling)==null||F.focus();break}}},children:[c.jsx(Ie,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(Pn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Cc=[Z.ol,Z.ul],th=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(D.nodes(e,{at:D.unhangRange(e,n),match:a=>{const i=a;return!D.isEditor(a)&&ce.isElement(a)&&i.type===t}}));return!!r},uw=e=>{const[t]=D.nodes(e,{match:n=>n.type===Z.blockquote});return!!t},nh=(e,t,n)=>{try{const r=uw(e),a=th(e,t),i=Cc.includes(t);ee.unwrapNodes(e,{match:l=>{const u=l;return!D.isEditor(u)&&ce.isElement(u)&&Cc.includes(u.type)},split:!0});const o={type:a?Z.paragraph:i?Z.li:t};if(ee.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=D.parent(e,l,{edge:"end"});Array.from(D.nodes(e,{at:d,match:p=>{const h=p;return!D.isEditor(p)&&ce.isElement(p)&&h.type===Z.li}})).forEach(([p,h])=>{ue.string(p).trim()===""&&ee.removeNodes(e,{at:h})})}else{if(r){const u={type:Z.blockquote,children:[]};ee.wrapNodes(e,u)}const l={type:t,children:[]};ee.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},lw=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(en),a=Nn(),i=th(a,e);return c.jsx(Po,{id:e,active:i,hasDivider:t,callback:()=>{nh(a,e,r),n(i?null:e)}})},Br=e=>{const[t]=D.nodes(e,{match:n=>{const r=n;return!D.isEditor(n)&&ce.isElement(n)&&r.type===Z.link}});return!!t},cw=(e,t,n,r)=>{e.selection&&No(e,t,n,r)},dw=(e,t,n,r)=>{const{selection:a}=e;if(a&&V.isCollapsed(a)){const[s]=D.nodes(e,{match:o=>{const l=o;return!D.isEditor(o)&&ce.isElement(o)&&l.type===Z.link}});if(s){const[o,l]=s,u={link:t};ee.setNodes(e,u,{at:l}),Oo(n)}}else No(e,t,n,r)},No=(e,t,n,r=a=>{console.error(a)})=>{try{Br(e)&&rh(e);const{selection:a}=e,i=a&&V.isCollapsed(a),s={type:Z.link,link:t,children:i?[{text:t}]:[]};i?(ee.insertNodes(e,s),ee.move(e,{distance:1,unit:"offset"})):(ee.wrapNodes(e,s,{split:!0}),ee.collapse(e,{edge:"end"}),ee.insertNodes(e,{text:""}),ee.move(e,{distance:1,unit:"offset"})),Oo(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},rh=e=>{ee.unwrapNodes(e,{match:t=>{const n=t;return!D.isEditor(t)&&ce.isElement(t)&&n.type===Z.link}})};let Xi=null;const fw=()=>{const e=se.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,dispatch:i,reportError:s}=y.useContext(en),o=Nn(),l=_D(o),u=(l==null?void 0:l.text)||nw(o),[d,m]=y.useState(Br(o)),p=Mf(o,"link-editor",`${n}-link`),h=y.useRef(null);y.useEffect(()=>{var _;!d&&r&&((_=h.current)==null||_.focus())},[d]),y.useEffect(()=>{Xi&&clearTimeout(Xi),Xi=setTimeout(()=>{m(Br(o))},500)},[o.selection]);const g=[],f=["open","edit","remove"].map(_=>{const F={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${_}`},{link:l==null?void 0:l.pretty})};switch(g.push({className:_}),_){case"open":F.href=(l==null?void 0:l.full)||"",F.onClick=x=>{x.preventDefault(),x.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),i([{type:"showLinkEditor",value:!1}])},F.children=c.jsxs(c.Fragment,{children:[F.children,c.jsx(Ie,{children:e.formatMessage({id:`${t}${_}_text`})})]});break;case"edit":F.onClick=()=>{m(!1)};break;case"remove":F.onClick=()=>{const x=[{type:"showLinkEditor",value:!1}];Br(o)&&(rh(o),x.push({type:"lastAnchor",value:null})),i(x)};break}return F}),b=[{id:"url",type:"url",inputRef:h,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&&b.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=Xf(a);return c.jsx(Wr,{parent:v,children:c.jsx(Pn,{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 _;return(_=h.current)==null?void 0:_.focus()})}},children:d?c.jsx(sr,{wrappers:g,buttons:f}):c.jsx(Jt,{element:"fieldset",id:`${n}-link-editor`,className:G({"show-labels":u}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async _=>{setTimeout(()=>{const F=[{type:"showLinkEditor",value:!1}];if(_.url){const{full:x}=Qc(_.url);l!=null&&l.full?dw(o,x,n,s):cw(o,x,n,s),F.push({type:"lastAnchor",value:null})}i(F)})}},fields:b,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},hw=()=>{const e=Nn(),{setFocus:t,dispatch:n}=y.useContext(en),[r,a]=y.useState(!1);return y.useEffect(()=>{a(Br(e))},[e.selection]),c.jsx(Po,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},mw=e=>[Z.bold,Z.italic,Z.strikethrough].includes(e),ah=(e,t)=>{const n=D.marks(e);return n?n[t]===!0:!1},ih=(e,t,n)=>{try{ah(e,t)?D.removeMark(e,t):D.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},pw=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(en),a=Nn(),i=ah(a,e);return c.jsx(Po,{id:e,active:i,hasDivider:t,callback:()=>{ih(a,e,r),n(i?null:e)}})},qa=[Z.bold,Z.italic,Z.strikethrough],gw=[Z.ol,Z.ul,Z.blockquote];const vw=({...e})=>{const t=se.useIntl(),{id:n}=y.useContext(en);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:[qa.map((r,a)=>c.jsx(pw,{format:r,hasDivider:a===qa.length-1},r)),c.jsx(hw,{}),gw.map((r,a)=>c.jsx(lw,{format:r,hasDivider:a===1},r))]})]}),c.jsx(fw,{})]})};var bw=xw,yw=/^(?:\w+:)?\/\/(\S+)$/,Dw=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,Cw=/^[^\s\.]+\.\S{2,}$/;function xw(e){if(typeof e!="string")return!1;var t=e.match(yw);if(!t)return!1;var n=t[1];return n?!!(Dw.test(n)||Cw.test(n)):!1}const ww=jn(bw),Ew=(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&&ww(i)?No(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},_w=(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},kw=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===Z.link&&ue.string(r).trim()===""){ee.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const sh=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,...l})=>{const u=se.useIntl(),d=nm();typeof s>"u"&&(s=!0);const{isInOverlay:m=!1}=a||{},{listMembers:p,clickMentionFallback:h,onChange:g=()=>{},onMention:f=()=>{},reportError:b=q=>{console.error(q)}}=i||{},v=[{type:Z.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const _={editorKey:null,originalValue:t||"",initialValue:t?null:v,tabbableOption:qa[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[F,x]=y.useReducer(qr,_),{editorKey:w,originalValue:B,initialValue:S,stringValue:z,lastAnchor:N,lastKey:I,hasInteracted:M,hasLoaded:k,mentionPopover:A}=F,j=q=>{const K=q||qa[0];q&&x([{type:"tabbableOption",value:K}])},L=`rte-${e}`,H=y.useCallback(q=>c.jsx(wD,{...q}),[]),Y=y.useCallback(q=>c.jsx(ED,{...q}),[]),Q=y.useMemo(()=>Ew(_w(kw(cb(CD(ub())),b),b),L,b),[]);y.useEffect(()=>{if(!t)return;Sr.lastIndex=0;const q=t.match(Sr);!q||q.length>1||q[0].length!==t.length||M||x([{type:"originalValue",value:t}])},[t]);const re=q=>{if(!Q||q!==L)return;const K=D.end(Q,[]);ee.select(Q,K),te.focus(Q)};y.useEffect(()=>{const q=K=>{var $;const E=K,T=(($=E==null?void 0:E.detail)==null?void 0:$.id)||null;T&&re(T)};return window.addEventListener("focusEditor",q),()=>{window.removeEventListener("focusEditor",q)}},[]),y.useEffect(()=>{if(Q.children.length>0&&!k){if(x([{type:"hasLoaded",value:!0}]),!s)return;re(L)}},[Q.children.length,S]),y.useEffect(()=>{B&&(async()=>{let K=xn(B);if(K.includes("<")){Or.prototype.escape=T=>T;const E=new Or;E.addRule("br",{filter:["br"],replacement:T=>T+`
160
+ `;case o[V.hr]:return`---
161
+ `;default:return u}}function Wn(e,t){const n=e.trim(),r=n,a=`${t}${r}${xc(t)}`;if(r.length===e.length)return a;const i=t+r+xc(t);return e.replace(n,i)}const xc=e=>e.split("").reverse().join(""),hw=e=>e.map(t=>ah(t)).join("").trim();const mw=({onFallbackClick:e=()=>{}})=>{const t=se.useIntl(),n=Nn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=y.useContext(nn),{show:l,selectedUser:u,possibleUsers:d}=i,m=Lf(n,"mention-popover",`toolbar-${s}`);if(!l)return c.jsx(c.Fragment,{});const p=rh(a);return c.jsx(Ur,{parent:p,children:c.jsx(td,{ref:m,className:"mention-popover",onKeyDown:h=>{h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[d.map(({userId:h,user:g},f)=>c.jsx(Qt,{element:"li",className:Y({selected:f===u}),member:{id:h,...g,link:!1},functions:{onClick:b=>{b.preventDefault(),b.stopPropagation();const v={...i,selectedUser:f};r([{type:"mentionPopover",value:v}]),nh(n,v,r,s),o&&o({id:h||"",name:g.name||""})}}},h)),c.jsx(Qt,{element:"li",className:Y("fallback",{selected:d.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${qt}icons/invite-user.svg`},link:!1},functions:{onClick:h=>{h.preventDefault(),h.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})},No=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=se.useIntl(),l=Nn(),{id:u,tabbableOption:d,setFocus:m,openTooltip:p,dispatch:h}=y.useContext(nn),g={};return e!==d&&(g.tabIndex=-1),c.jsxs("li",{id:`${u}-${e}`,className:Y(e,{"has-divider":n}),onMouseEnter:()=>{h([{type:"openTooltip",value:e}])},onMouseLeave:()=>{h([{type:"openTooltip",value:null}])},onFocus:()=>{h([{type:"openTooltip",value:e}])},onBlur:f=>{f.stopPropagation();const b=[{type:"openTooltip",value:null}];l.selection&&b.push({type:"lastAnchor",value:l.selection.anchor}),h(b)},contentEditable:!1,children:[c.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 b,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 _=f.currentTarget.closest("li");let x=_==null?void 0:_.nextElementSibling;if(f.key==="ArrowLeft"){const $=_==null?void 0:_.previousElementSibling;$?x=$:x=(b=_==null?void 0:_.parentElement)==null?void 0:b.lastElementChild}else x||(x=(v=_==null?void 0:_.parentElement)==null?void 0:v.firstElementChild);const T=x==null?void 0:x.className.split(" ")[0];T&&(m(T),(E=x==null?void 0:x.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:[c.jsx(Ne,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(Mn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},wc=[V.ol,V.ul],ih=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(D.nodes(e,{at:D.unhangRange(e,n),match:a=>{const i=a;return!D.isEditor(a)&&de.isElement(a)&&i.type===t}}));return!!r},pw=e=>{const[t]=D.nodes(e,{match:n=>n.type===V.blockquote});return!!t},sh=(e,t,n)=>{try{const r=pw(e),a=ih(e,t),i=wc.includes(t);J.unwrapNodes(e,{match:l=>{const u=l;return!D.isEditor(u)&&de.isElement(u)&&wc.includes(u.type)},split:!0});const o={type:a?V.paragraph:i?V.li:t};if(J.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=D.parent(e,l,{edge:"end"});Array.from(D.nodes(e,{at:d,match:p=>{const h=p;return!D.isEditor(p)&&de.isElement(p)&&h.type===V.li}})).forEach(([p,h])=>{ue.string(p).trim()===""&&J.removeNodes(e,{at:h})})}else{if(r){const u={type:V.blockquote,children:[]};J.wrapNodes(e,u)}const l={type:t,children:[]};J.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},gw=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(nn),a=Nn(),i=ih(a,e);return c.jsx(No,{id:e,active:i,hasDivider:t,callback:()=>{sh(a,e,r),n(i?null:e)}})},Ar=e=>{const[t]=D.nodes(e,{match:n=>{const r=n;return!D.isEditor(n)&&de.isElement(n)&&r.type===V.link}});return!!t},vw=(e,t,n,r)=>{e.selection&&Io(e,t,n,r)},bw=(e,t,n,r)=>{const{selection:a}=e;if(a&&H.isCollapsed(a)){const[s]=D.nodes(e,{match:o=>{const l=o;return!D.isEditor(o)&&de.isElement(o)&&l.type===V.link}});if(s){const[o,l]=s,u={link:t};J.setNodes(e,u,{at:l}),Mo(n)}}else Io(e,t,n,r)},Io=(e,t,n,r=a=>{console.error(a)})=>{try{Ar(e)&&oh(e);const{selection:a}=e,i=a&&H.isCollapsed(a),s={type:V.link,link:t,children:i?[{text:t}]:[]};i?(J.insertNodes(e,s),J.move(e,{distance:1,unit:"offset"})):(J.wrapNodes(e,s,{split:!0}),J.collapse(e,{edge:"end"}),J.insertNodes(e,{text:""}),J.move(e,{distance:1,unit:"offset"})),Mo(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},oh=e=>{J.unwrapNodes(e,{match:t=>{const n=t;return!D.isEditor(t)&&de.isElement(t)&&n.type===V.link}})};let es=null;const yw=()=>{const e=se.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,dispatch:i,reportError:s}=y.useContext(nn),o=Nn(),l=jD(o),u=(l==null?void 0:l.text)||lw(o),[d,m]=y.useState(Ar(o)),p=Lf(o,"link-editor",`${n}-link`),h=y.useRef(null);y.useEffect(()=>{var E;!d&&r&&((E=h.current)==null||E.focus())},[d]),y.useEffect(()=>{es&&clearTimeout(es),es=setTimeout(()=>{m(Ar(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=_=>{_.preventDefault(),_.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),i([{type:"showLinkEditor",value:!1}])},B.children=c.jsxs(c.Fragment,{children:[B.children,c.jsx(Ne,{children:e.formatMessage({id:`${t}${E}_text`})})]});break;case"edit":B.onClick=()=>{m(!1)};break;case"remove":B.onClick=()=>{const _=[{type:"showLinkEditor",value:!1}];Ar(o)&&(oh(o),_.push({type:"lastAnchor",value:null})),i(_)};break}return B}),b=[{id:"url",type:"url",inputRef:h,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&&b.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=rh(a);return c.jsx(Ur,{parent:v,children:c.jsx(Mn,{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 E;return(E=h.current)==null?void 0:E.focus()})}},children:d?c.jsx(or,{wrappers:g,buttons:f}):c.jsx(en,{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:_}=Xc(E.url);l!=null&&l.full?bw(o,_,n,s):vw(o,_,n,s),B.push({type:"lastAnchor",value:null})}i(B)})}},fields:b,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},Dw=()=>{const e=Nn(),{setFocus:t,dispatch:n}=y.useContext(nn),[r,a]=y.useState(!1);return y.useEffect(()=>{a(Ar(e))},[e.selection]),c.jsx(No,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},Cw=e=>[V.bold,V.italic,V.strikethrough].includes(e),uh=(e,t)=>{const n=D.marks(e);return n?n[t]===!0:!1},lh=(e,t,n)=>{try{uh(e,t)?D.removeMark(e,t):D.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},xw=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=y.useContext(nn),a=Nn(),i=uh(a,e);return c.jsx(No,{id:e,active:i,hasDivider:t,callback:()=>{lh(a,e,r),n(i?null:e)}})},Wa=[V.bold,V.italic,V.strikethrough],ww=[V.ol,V.ul,V.blockquote];const Ew=({...e})=>{const t=se.useIntl(),{id:n}=y.useContext(nn);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[c.jsx(Ne,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[Wa.map((r,a)=>c.jsx(xw,{format:r,hasDivider:a===Wa.length-1},r)),c.jsx(Dw,{}),ww.map((r,a)=>c.jsx(gw,{format:r,hasDivider:a===1},r))]})]}),c.jsx(yw,{})]})};var _w=Aw,kw=/^(?:\w+:)?\/\/(\S+)$/,Fw=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,Bw=/^[^\s\.]+\.\S{2,}$/;function Aw(e){if(typeof e!="string")return!1;var t=e.match(kw);if(!t)return!1;var n=t[1];return n?!!(Fw.test(n)||Bw.test(n)):!1}const Tw=On(_w),Sw=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[V.link].includes(s.type)||a(i)},e.insertText=i=>{i&&Tw(i)?Io(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},jw=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===V.mention?!0:n(i),e.isVoid=i=>i.type===V.mention?!0:r(i),e.markableVoid=i=>i.type===V.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},Ow=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===V.link&&ue.string(r).trim()===""){J.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const ch=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,...l})=>{const u=se.useIntl(),d=sm();typeof s>"u"&&(s=!0);const{isInOverlay:m=!1}=a||{},{listMembers:p,clickMentionFallback:h,onChange:g=()=>{},onMention:f=()=>{},reportError:b=z=>{console.error(z)}}=i||{},v=[{type:V.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const E={editorKey:null,originalValue:t||"",initialValue:t?null:v,tabbableOption:Wa[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,_]=y.useReducer(Wr,E),{editorKey:x,originalValue:T,initialValue:S,stringValue:$,lastAnchor:M,lastKey:N,hasInteracted:q,hasLoaded:w,mentionPopover:A}=B,j=z=>{const Q=z||Wa[0];z&&_([{type:"tabbableOption",value:Q}])},L=`rte-${e}`,U=y.useCallback(z=>c.jsx(TD,{...z}),[]),Z=y.useCallback(z=>c.jsx(SD,{...z}),[]),G=y.useMemo(()=>Sw(jw(Ow(vb(BD(pb())),b),b),L,b),[]);y.useEffect(()=>{if(!t)return;jr.lastIndex=0;const z=t.match(jr);!z||z.length>1||z[0].length!==t.length||q||_([{type:"originalValue",value:t}])},[t]);const ae=z=>{if(!G||z!==L)return;const Q=D.end(G,[]);J.select(G,Q),ne.focus(G)};y.useEffect(()=>{const z=Q=>{var R;const k=Q,F=((R=k==null?void 0:k.detail)==null?void 0:R.id)||null;F&&ae(F)};return window.addEventListener("focusEditor",z),()=>{window.removeEventListener("focusEditor",z)}},[]),y.useEffect(()=>{if(G.children.length>0&&!w){if(_([{type:"hasLoaded",value:!0}]),!s)return;ae(L)}},[G.children.length,S]),y.useEffect(()=>{T&&(async()=>{let Q=wn(T);if(Q.includes("<")){Pr.prototype.escape=F=>F;const k=new Pr;k.addRule("br",{filter:["br"],replacement:F=>F+`
162
162
 
163
- `}),K=E.turndown(K)}o&&o.mentions&&(K=await Gc({text:K,template:`[${$s}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),ew(K,E=>{x([{type:"initialValue",value:E},{type:"editorKey",value:B.toString()}]),setTimeout(()=>{x([{type:"stringValue",value:vc(Q)}])},150)})})()},[B]),y.useEffect(()=>{t!==""||!Q||hs(B,t)&&!M||(D.withoutNormalizing(Q,()=>{ee.delete(Q,{at:{anchor:D.start(Q,[]),focus:D.end(Q,[])}}),ee.deselect(Q),Q.children.length!==0&&ee.unwrapNodes(Q,{at:[0]}),ee.insertNodes(Q,v,{at:[0]})}),x([{type:"initialValue",value:v},{type:"lastAnchor",value:null}]))},[t]);const C=Rc(()=>{aw({editor:Q,isShowing:A.show,numberOfUsers:A.numberOfUsers,listMembers:p,dispatch:x})},100);return S?c.jsx("div",{id:L,className:"rich-text-editor",children:c.jsxs(en.Provider,{value:{...F,id:L,isInOverlay:m,setFocus:j,dispatch:x,onMention:f,reportError:b},children:[c.jsxs(yD,{editor:Q,initialValue:S,onChange:q=>{if(Q.operations.some(E=>E.type!=="set_selection")){const E=sw(q);g(E),x([{type:"stringValue",value:vc(Q)}]),M||x([{type:"hasInteracted",value:!0}]),C(),d&&console.log({serialized:E,json:q})}},...l,children:[c.jsx(cD,{className:"input",renderElement:H,renderLeaf:Y,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onKeyDown:q=>{if(q.key==="Enter"){A.show&&(q.preventDefault(),q.stopPropagation(),Jf(Q,A,x,L));const{selection:K}=Q;if(K){const E=V.isCollapsed(K),[T,$]=D.node(Q,K,{depth:1});let R=T,U=R.type;const ae=R.children[0];if(ae&&[Z.ol,Z.ul].includes(ae.type)&&(R=ae,U=ae.type),R&&ce.isElement(R)&&U!==Z.paragraph){if(U===Z.blockquote&&!q.shiftKey){q.stopPropagation(),q.preventDefault(),ee.insertNodes(Q,v);return}if(E){const[J,ie]=D.parent(Q,K,{edge:"end"}),X=J.type;if([Z.ul,Z.ol].includes(U))if(q.stopPropagation(),q.preventDefault(),X===Z.li&&I==="Enter"){J.children.length===1&&"text"in J.children[0]&&J.children[0].text===""&&ee.removeNodes(Q,{at:ie}),ee.insertNodes(Q,v,{at:P.next($)}),ee.select(Q,D.end(Q,P.next($)));return}else{const[ye,me]=tw(Q,Z.li),xe={type:Z.li,children:[{text:""}]};ee.insertNodes(Q,xe,{at:P.next(me)}),ee.select(Q,D.end(Q,P.next(me)))}}}}}else if(q.key==="Escape"){if(A.show){q.preventDefault(),q.stopPropagation(),x([{type:"mentionPopover",value:{...A,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(q.key)&&A.show){q.preventDefault(),q.stopPropagation();const{selectedUser:K,possibleUsers:E}=A;let T=q.key==="ArrowUp"?K-1:K+1;T<0&&(T=E.length-1),T>=E.length+1&&(T=0),x([{type:"mentionPopover",value:{...A,selectedUser:T}}])}x([{type:"lastKey",value:q.key}]),rw(q,Q,x,b)},onBlur:()=>{Q.selection&&x([{type:"lastAnchor",value:Q.selection.anchor}])},onFocus:()=>{if(N){if(!P.isPath(N.path)||!ue.has(Q,N.path))return;const q=ue.get(Q,N.path);let K=0;if(fe.isText(q)?K=q.text.length:q.children&&(K=q.children.length),N.offset>K)return;try{ee.select(Q,{anchor:N,focus:N})}catch(E){const T=E.message;b(`Error focusing editor: ${T}`)}}}}),c.jsx(vw,{}),p?c.jsx(ow,{onFallbackClick:h}):null]},w),c.jsx(uo,{id:`character-limit-${e}`,limit:r,valueLength:ti(z)})]})}):c.jsx(c.Fragment,{})};const Fw=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:G("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:G("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const m=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:m,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:m,children:d.label})]},m)})})]})};function oh({className:e="",userId:t,userName:n,src:r,uploadImage:a,button:i,callback:s}){const o=se.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[m,p]=y.useState(!1),[h,g]=y.useState(!1),f=y.useRef(null),b=async x=>{p(!0),g(!1);try{const w=x.target.files&&x.target.files[0];if(!w||!t)throw p(!1),new Error("Image file or userID is missing");const B=await a({fileObject:w,userId:t}),S={thumbnail:B.thumbnailURL,full:B.originalURL};d(S),s(S)}catch{g(!0)}finally{p(!1)}p(!1)},{upload:v=o.formatMessage({id:`${l}cta_upload`}),change:_=o.formatMessage({id:`${l}cta_change`}),uploading:F=o.formatMessage({id:`${l}cta_uploading`})}=(i==null?void 0:i.text)||{};return c.jsxs("div",{className:G("profile-image-change-figure",e),children:[c.jsx(hn,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),h&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(_e,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:m,children:m?F:u?_:v})]})}const uh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(Jt,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const lh=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[d,m]=y.useState([]),[p,h]=y.useState(!0),[g,f]=y.useState(u),{formatMessage:b}=se.useIntl(),v=async x=>{x.preventDefault();try{await l(d),m([]),f("SUCCESS")}catch(w){f("ERROR"),o(w)}},_=x=>{x.preventDefault(),f("NOT_SUBMITTED"),h(!0),m([])},F=x=>{x.preventDefault(),s(),f("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:b({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",b({id:"inviteForm_error"})]})}),c.jsx(qt,{}),c.jsx("div",{className:"footer",children:g==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(_e,{variant:"secondary",onClick:_,children:b({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(_e,{onClick:F,children:b({id:"inviteForm_ctaDone"})})]}):c.jsx(_e,{onClick:_,children:b({id:"inviteForm_ctaTryAgain"})})})]}):c.jsx("div",{className:"invite-form-wrapper",children:c.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:G("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(qh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:b({id:"inviteForm_email_placeholder"}),emails:d,onChange:x=>{m(x),h(!x.length)},autoFocus:!1,getLabel:(x,w,B)=>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:()=>{B(w),h(!d.length)},className:"remove-email-button",screenreaderText:b({id:"overlay_close"})})]},w)})]}),c.jsx(qt,{}),c.jsx("fieldset",{className:"footer",children:c.jsx(_e,{className:"sendEmailsButton",disabled:p,children:n})})]})})},Ba=e=>e.map(t=>({condition:t})),xt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},Bw=({functions:e,...t})=>{const{formatMessage:n}=se.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=h=>h[xt.NEW_PASSWORD]!==h[xt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=h=>!vs(h[xt.NEW_PASSWORD]).isValid,m=[{"data-testid":xt.NEW_PASSWORD,id:xt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Ba(["required",d]),functions:{onChange:h=>l(vs(h).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":xt.CONFIRMED_PASSWORD,id:xt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Ba(["required",u])}];t.isPasswordChange&&m.unshift({"data-testid":xt.CURRENT_PASSWORD,id:xt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Ba(["required"])}),i&&m.push({component:Nd,props:{matchingRules:o}});const p={id:xt.FORM_ID,fields:m,functions:{...e,onSuccess:async h=>(e.createPassword(h),e.onSuccess&&e.onSuccess(h)),onCatch:h=>a(h==null?void 0:h.statusCode),onFailure:(h,g)=>{(g.includes(xt.NEW_PASSWORD)||g.includes(xt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(Jt,{...p}),r&&c.jsx(fn,{variant:"error",text:r})]})};const ch=({hooks:e,functions:t,meta:n={},gtm:r})=>{var x,w;const a=se.useIntl(),i="profileForm_",s=y.useContext(mt),[o,l]=y.useState(s.image),[u,d]=y.useState(!1),{uploadImage:m,onSuccess:p=async B=>{},onCancel:h=()=>{},onFailure:g=()=>{}}=t,{buildLocation:f,isValidPlace:b,predictPlaces:v}=e.useMaps(),{context:_="ProfileForm",event:F="profile-form-submit-click"}=r||{};return c.jsx(Jt,{id:"profile-details-form",fields:[{component:oh,props:{userName:s.name,userId:s.id,src:o,uploadImage:m,callback:l,button:{text:{upload:a.formatMessage({id:`${i}image`})}}}},{id:"name",type:"text",label:a.formatMessage({id:`${i}name`}),placeholder:a.formatMessage({id:`${i}name_placeholder`}),value:s.name,autoComplete:"name",validation:[{condition:"required"}]},{id:"jobTitle",type:"text",label:a.formatMessage({id:`${i}jobTitle`}),placeholder:a.formatMessage({id:`${i}jobTitle_placeholder`}),value:s.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:a.formatMessage({id:`${i}organization`}),placeholder:a.formatMessage({id:`${i}organization_placeholder`}),value:s.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:a.formatMessage({id:`${i}location`}),placeholder:a.formatMessage({id:`${i}location_placeholder`}),value:((x=s.location)==null?void 0:x.en)||((w=s.location)==null?void 0:w.country),validation:[{condition:"required"},{condition:({location:B})=>B&&!u?!1:!b(B),error:a.formatMessage({id:`${i}location_error`})}],functions:{onChange:()=>{u||d(!0)},onKeyInput:v}},{id:"biography",type:"textarea",label:a.formatMessage({id:`${i}bio`}),placeholder:a.formatMessage({id:`${i}bio_placeholder`}),limit:1e3,value:s.biography},{component:qt}],meta:{shouldShowCancelButton:!0,shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,...n},intlPath:i,gtm:{context:_,event:F},functions:{onSuccess:async B=>{try{const S={...B,image:o||null,location:u?await f(B==null?void 0:B.location):s.location};s.updateDetails&&s.updateDetails(z=>({...z,...S})),await p(S)}catch{g()}},onCancel:h,onFailure:g},button:{size:"large",text:{default:a.formatMessage({id:`${i}cta`}),submitting:a.formatMessage({id:`${i}cta_submitting`}),submitted:a.formatMessage({id:`${i}cta_submitted`})}}})};const dh=({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=se.useIntl(),u=y.useRef(null);Xn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=m=>{m.preventDefault(),m.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:G("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:m=>{m.key==="Enter"&&d(m)}}),c.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Ie,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Ie,{children:l.formatMessage({id:"search_cta"})})})]})})})},xc=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const 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}])},Aw=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"]}},Tw=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=Aw(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}])},Sw=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,m=(h,g)=>{h.current&&s.validFields[g]!==h.current.validity.valid&&o([{type:`validFields.${g}`,value:h.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>m(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{xc({ref:i.email,validateEmail:r,dispatch:o})},onChange:(h,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:Td,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:()=>m(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{m(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:h=>c.jsx("small",{children:h})}),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:h=>c.jsx("small",{className:"notes text-small",children:h})}),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:h=>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:h}),privacy:h=>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:h})}),shownValue:"accepted",functions:{onChange:h=>{if(!h)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"&&xc({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const jw=({className:e=""})=>c.jsxs("div",{className:G("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(se.FormattedMessage,{id:"signup_success_title"})}),c.jsx(se.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const Ow={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},Pw=({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=se.useIntl(),{title:u=!0,expectation:d=!1,url:m=!0,logInButton:p=!0,successMessage:h=!0}=a,g={title:u,expectation:d,url:m,logInButton:p,successMessage:h},[f,b]=y.useReducer(qr,Ow),{validFields:v,emailDetails:_,shouldManuallyApprove:F,shouldDisableButton:x,showSuccessMessage:w,showError:B}=f,[S,z]=Ks.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(()=>{F===!0&&N.jobTitle.current&&N.jobTitle.current.focus()},[F]),y.useEffect(()=>{S["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[S]),y.useEffect(()=>{w&&S["functional-cookie-consent"]&&z("signup-this-session","true",{path:"/",maxAge:3600})},[w]);const I=y.useMemo(()=>Sw({placeholders:n,labels:t,shouldShow:g,functions:r,refs:N,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,N,g,f]),M=x?!0:F?!Object.values(v).every(k=>k===!0):!v.name||!v.email||["exists","pending","verify"].includes(_.boxType);return g.successMessage&&w?c.jsx(jw,{className:e}):c.jsxs("fieldset",{className:G("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&c.jsx("p",{className:"signup-title",children:c.jsx(se.FormattedMessage,{id:"signup_title"})}),B&&c.jsx(fn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(Jt,{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:M?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/api/next-ui/login","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 Tw({refs:N,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:k=>{r.handleError(k),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:N.hiddenValidation})]})};const vn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return c.jsx("section",{className:G("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const Nw=({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(vn,{className:G("download-section",n),children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(sr,{buttons:r})]})})};const Vs="editSection_";function fh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const Mw=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=se.useIntl();return c.jsxs(jt,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${Vs}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(_e,{href:r,variant:"secondary",size:"small",onClick:()=>fh({href:r,setShowModal:i}),children:n||s({id:`${Vs}placeholder_cta`})})})]})},Iw=({children:e,className:t="",formProps:n,formComponent:r,href:a,title:i,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=se.useIntl(),[m,p]=y.useState(!1),h=()=>p(!1),g=!!n||!!r,f=typeof a=="string"||g;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{h()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),h()}}})),c.jsxs("section",{className:G("edit-section",t),children:[g&&c.jsx(mn,{title:o||`Edit ${i}`,isOpen:m,showDivider:!1,showIcon:!1,functions:{onClose:h},className:G("edit-section-modal"),children:b||(n?c.jsx(Jt,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async v=>{var _,F;(_=n==null?void 0:n.functions)!=null&&_.onSuccess&&await((F=n==null?void 0:n.functions)==null?void 0:F.onSuccess(v)),p(!1)},onCancel:h}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:G("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:i}),f&&c.jsx(_e,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>fh({href:a,setShowModal:p}),children:d({id:`${Vs}edit`})})]}),e||c.jsx(Mw,{...l,href:a,setShowModal:p,showEditButton:f}),u&&c.jsx(qt,{})]})};const Rw=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:G("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&y.createElement(s.element,{className:G("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:G({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:d,nameOfBusiness:m,link:p=!1,description:h=!1},g)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:m});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:p?c.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),h&&c.jsx("small",{children:h})]},window.btoa(`${d.url}_${g}`))})})]})};let es;const ts="contactFooter_",$w=({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(es),es=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(es),window.removeEventListener("resize",l)}),[]),c.jsx(vn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(se.FormattedMessage,{id:`${ts}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(se.FormattedMessage,{id:`${ts}text`})}),c.jsx(dn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(se.FormattedMessage,{id:`${ts}email`})})]}),c.jsx(uh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Lw=({activeLink:e,profile:t,...n})=>c.jsx(vn,{children:c.jsx(Bd,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(Fd,{activeLink:e,profile:t}),c.jsx(ad,{...n})]})})});const ns="cookieBanner_",rs=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],as=new Date(Date.now()+12*30*24*60*60*1e3),hh=()=>{const e=se.useIntl(),[t,n,r]=Ks.useCookies(rs),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{rs.forEach(d=>{n(d,!0,{path:"/",expires:as,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:as}),rs.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:as});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:`${ns}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${ns}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ns}text`})}),c.jsx(sr,{buttons:u})]})},Kt={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:Wn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Wn["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:Wn.support,gtmType:"concierge-email-click"},business:{email:Wn.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 Yn="footer_",Wa="SiteFooter",wc=({group:e})=>{const t=Kt[e].order||[];let n=!1;return"text"in Kt[e]&&(n=Kt[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(se.FormattedMessage,{id:`${Yn}${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}=Kt[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":Wa,"data-gtm-event-type":i,...s,children:c.jsx(se.FormattedMessage,{id:`${Yn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(se.FormattedMessage,{id:`${Yn}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(se.FormattedMessage,{id:`${Yn}${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":Wa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Mo=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(Ga,{element:"hr"}),c.jsx(oo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Wa,"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(wc,{group:e}),Object.keys(Kt[e]).includes("child")&&c.jsx(wc,{group:Kt[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(Kt.social.order)&&Kt.social.order.map(e=>{const t=Kt.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":Wa,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(se.FormattedMessage,{id:`${Yn}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(se.FormattedMessage,{id:`${Yn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Re={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===bt.ACCOUNT&&t===!1&&n[bt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&Re.handlerCalled[e]&&i-Re.handlerCalled[e]<500)return;Re.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 bt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case bt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case bt.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=Pc(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?Re.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 bt.SITE:if(n){const u=Re.findFirstChild(t.current.children,"attributes.aria-controls",bt.SITE);s=Re.findFirstChild(u.children,"href")}else s=Re.findFirstChild(t.current.children,"href");break;case bt.ACCOUNT:if(o=Re.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Re.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(Re.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Re.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Re.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Re.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},zr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/api/next-ui/login"},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},Ua=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=se.useIntl(),o=Pc(zr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,d=e.includes("buttons.");let m=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(m+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let F=o.gtmType||`${e}-click`;if(F.includes(".")){const x=F.split("."),w=x[x.length-2];F=`${w==="topics"?`${w}-`:""}${x[x.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":F,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const h=o.order&&o.order[0]&&o[o.order[0]],g=h&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let b={},v={},_={};if(f&&(b={...b,"aria-current":"page"}),h){const F=o.menuId||e,x={onClick:w=>Re.events.onClick(w,{id:F,callback:a,isOpen:r[F]}),onFocus:()=>Re.events.onFocus({id:F}),onBlur:()=>Re.events.onBlur({id:F,callback:a}),onMouseLeave:()=>Re.events.onBlur({id:F,callback:a}),onMouseEnter:()=>Re.events.onMouseEnter({id:F,callback:a})};v={...x,id:F===bt.SITE?bt.SITE:bt.ACCOUNT},n&&(g&&(_={...x,className:"navigation-button",onKeyPress:w=>{w.key==="Enter"&&Re.events.onClick(w,{id:F,callback:a,isOpen:r[F]})},"aria-haspopup":!0,"aria-expanded":r[F],"aria-controls":F}),v={...v,hidden:F in r?!r[F]:!0}),g||(v={...v})}return c.jsxs("li",{className:G({[o.className]:o.className,"has-submenu":h,parent:g,active:f}),...b,children:[p?y.createElement(d?_e:"a",p,s.formatMessage({id:m})):n&&o.order&&g?c.jsxs("button",{..._,children:[s.formatMessage({id:m}),c.jsx(Ie,{children:s.formatMessage({id:`header_menu_${r[bt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:m}),o.order&&c.jsx("ul",{...v,children:o.order.map(F=>{if(!o[F])return null;const x={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[F].order?c.jsxs("li",{className:G({[o[F].className]:o[F].className}),children:[s.formatMessage({id:`${m}_${F}`}),c.jsx("ul",{children:o[F].order.map(w=>c.jsx(Ua,{id:`${e}.${F}.${w}`,...x},w))})]},F):c.jsx(Ua,{id:`${e}.${F}`,...x},F)})})]},e)};const zw={height:67,height_desktop:83};var bt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(bt||{});const Io=({showNavigation:e=!0})=>{const t=se.useIntl(),n=y.useContext(mt),r=On(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>Re.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(qr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,m=y.useRef(s);y.useEffect(()=>{m.current=s},[s]),Lc({scrollPosition:zw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const v=m.current.menus;!i&&v["site-navigation"]||Re.shouldChangeHeaderIsVisible(!0,v,o)},scrollDown:()=>{const v=m.current.menus;!i&&v["site-navigation"]||Re.shouldChangeHeaderIsVisible(!1,v,o)}}});const p=(v,_,F=!1)=>{Re.handleMenus({id:v,value:_,menus:m.current.menus,dispatch:o,forceHandle:F})},h=y.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(_=>{m.current.menus[_]&&p(_,!1,!0)})};y.useEffect(()=>{var v;return(v=document.getElementById("header"))==null||v.addEventListener("keydown",g),()=>{var _;(_=document.getElementById("header"))==null||_.removeEventListener("keydown",g)}},[]),Xn(()=>{u["site-navigation"]&&Re.autoFocus({menu:"site-navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),Xn(()=>{u["account-navigation"]&&Re.autoFocus({menu:"account-navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),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(dh,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:v=>{v.preventDefault(),v.stopPropagation(),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:h,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:zr.order.map(v=>c.jsx(Ua,{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:G({"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(oo,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),a?c.jsxs("button",{className:"account-button",onClick:v=>Re.events.onClick(v,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>Re.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>Re.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(hn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:zr.buttons.order.map(v=>c.jsx(Ua,{id:`buttons.${v}`},v))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:G("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const qw=()=>{const e=se.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Io,{}),c.jsx("div",{id:"content",children:c.jsx(fn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(Mo,{})]})},mh=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:d="default",variant:m="default",circle:p="default",modal:h="default"}=i,g=Ic(),[f,b]=y.useState(""),v=B=>{const{detail:{message:S}}=B;b(S)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const _=ya(e,{locale:o}),F=ya(t,{locale:o}),x=ya(n,{locale:o}),w={};return d!=="default"&&(w[d]=!0),m!=="default"&&(w[m]=!0),p!=="default"&&(w[p]=!0),c.jsx(Wh.ErrorBoundary,{onError:r,fallback:c.jsx(qw,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:G(s,w,{"has-footer":u}),children:[c.jsx(Io,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[F&&c.jsx("div",{className:G("additional-content prepended",{"large-modal":h==="large"}),children:F}),y.createElement(d==="bold"?ro:"div",{id:"content",children:_,className:G({"large-modal":h==="large"})})]}),x&&c.jsx("div",{className:"additional-content appended",children:x}),u&&c.jsx(Mo,{}),c.jsx(hh,{})]}),f&&c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Ec={default:"tags_",headerTopics:"header_topics_topics_"},is={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"},Ww={getTagDetails:e=>{if(e.includes("topic_")){if(e=is.topic[e.replace("topic_","")],e){const t=zr.topics.topics[e].href;return t?{id:e,href:t,text:`${Ec.headerTopics}${e}`}:null}return null}return is[e]?(e=is[e],{id:e,text:`${Ec.default}${e}`}):null}};const Uw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=se.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=Ww.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:G("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 Hw=({members:{data:e=[],total:t=e.length},isMember:n=!1,hasNextPage:r=!1,loadNextPage:a=()=>{},profile:i,gtmContext:s="member",gtmType:o="member-click",className:l=""})=>{const u=se.useIntl(),d="membersList",m=y.useContext(mt),[p,h]=y.useState(!1);return e.length===0?null:c.jsxs("div",{className:G("members-list",l),children:[c.jsxs("h1",{children:[u.formatMessage({id:d}),c.jsx("span",{className:"count",children:t})]}),c.jsxs("ul",{children:[n?c.jsxs("li",{children:[c.jsx(Yt,{member:m,gtmContext:s,gtmType:o}),c.jsx(dn,{href:"/profiles/me",className:"text-small",onClick:g=>{g==null||g.preventDefault(),g==null||g.stopPropagation(),h(!0)},children:u.formatMessage({id:`${d}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((g,f)=>c.jsxs("li",{children:[c.jsx(Yt,{member:g,gtmContext:s,gtmType:o}),g.isAdmin&&c.jsx(ln,{children:u.formatMessage({id:`${d}_admin`})})]},f))]}),r&&c.jsx(Ur,{hasNextPage:r,loadNextPage:a,icon:{icon:"arrow-down",position:"right"},gtmContext:s}),i?c.jsx(di,{form:i,showModal:p,content:{title:u.formatMessage({id:`${d}_modal_title`})},functions:{onClose:()=>{h(!1)}}}):c.jsx(c.Fragment,{})]})},Vw={showForm:!1},li=y.createContext(Vw),ph=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(li.Provider,{value:{...t,updateConversation:n},children:e})},_c=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},ci=e=>{var t,n,r,a,i;return e&&!e.error?{id:e==null?void 0:e.id,name:(t=e==null?void 0:e.data)==null?void 0:t.name,organization:(n=e==null?void 0:e.data)==null?void 0:n.organization,jobTitle:(r=e==null?void 0:e.data)==null?void 0:r.jobTitle,location:(a=e==null?void 0:e.data)==null?void 0:a.location,image:{thumbnail:((i=e==null?void 0:e.data)==null?void 0:i.thumbnail)||void 0}}:"deleted"},Kw=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=se.useIntl();return t?c.jsx("small",{children:At(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,{})},Zw=({formID:e,intlPath:t,showLabel:n,type:r})=>{const a=se.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:At(a.formatMessage,`${t}label_action`,r,"action")})};let ma=null;const Je="discussion_form_",Vr=({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:m="DiscussionForm"})=>{var Te,Se,He;const p=se.useIntl(),h=y.useContext(mt),[g,f]=y.useState(""),{isLoading:b=!1,isInWrapper:v=!1,isInOverlay:_=!1,isAutoFocused:F=!1,isEditing:x=!1,hasTitleField:w=!1,isPrepopulated:B=!1,showTitle:S=!1,showGuidelines:z=!0,showDivider:N=!1,showSuccessMessage:I=!0}=r||{},{onChange:M=()=>{},create:k=()=>{},handleSaveEdit:A=()=>{},handleCancel:j=()=>{},callback:L=()=>{},onMention:H=()=>{},listMembers:Y=()=>Promise.resolve([]),clickMentionFallback:Q=()=>{},props:re={create:{projectNames:["questions-answers"]}}}=u,[C,q]=y.useState({title:w&&w.text||"",body:x&&x.text||B&&B.text||""}),[K,E]=y.useState(o.error||!1),[T,$]=y.useState(!1);if(y.useEffect(()=>{l&&!x&&B&&B!==C.body&&q({...C,body:B.text||""})},[B]),b)return c.jsx(Ft,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const R=Be=>{q({...C,body:Be}),M({body:Be});let Fe;!h||!h.id?Fe=At(p.formatMessage,`${Je}error_loggedOut`,t.type,"action"):n?i>0&&Be.length>=i&&(Fe=`${Je}error_tooLong`):Fe=At(p.formatMessage,`${Je}error_noPermission`,t.type,"action"),Fe?E(Fe):K&&E(!1)};let U=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const Be=((Te=t.slugs)==null?void 0:Te.reply)||((Se=t.slugs)==null?void 0:Se.answer)||((He=t.slugs)==null?void 0:He.question)||"";Be&&(U=`${U}-${Be.slice(-15)}`)}e&&(U=`${e}-${U}`);const ae=async()=>{if(!h||!h.id||!n||X)return;ma&&clearTimeout(ma),$("submitting");const Be=window.location.pathname;try{let Fe;switch(t.type){case"post":Fe=await k({title:C.title,content:C.body});break;case"question":Fe=await k({title:C.body,authorId:h&&h.id,...re==null?void 0:re.create});break;case"response":Fe=await k({questionSlug:t.slugs.question},{body:C.body,authorId:h&&h.id,contentPath:Be});break;case"reply":Fe=await k({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:C.body,authorId:h&&h.id,contentPath:Be});break;default:break}await tm(1e3),L&&await L(Fe),ma=setTimeout(()=>{q({title:"",body:""}),$("submitted"),f(At(p.formatMessage,`${Je}success`,t.type,"action"));const Pe=new Event(Xe.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(Pe),J()},500)}catch(Fe){const Pe=Fe;let Ee=`${Je}error`;Pe!=null&&Pe.message.includes("entry already exists")&&(Ee=At(p.formatMessage,`${Je}error_alreadyExists`,t.type,"action")),Pe!=null&&Pe.message.includes("429")?Ee=At(p.formatMessage,`${Je}error_tooMany`,t.type,"action"):Pe!=null&&Pe.message.includes("400")&&(Ee=`${Je}error`),E(Ee),J()}},J=()=>{ma=setTimeout(()=>{E(!1),$(!1),f("")},5e3)},ie=!C.title||!eu(C.title),de=!C.body||!eu(C.body);let X=de;w&&(X=ie&&de);const ye=T==="submitting",me=[{component:Zw,props:{formID:U,intlPath:Je,showLabel:w!==!1,type:t.type}},{component:sh,props:{id:`${U}-input`,value:T==="submitting"&&!K?"":C.body,placeholder:a||At(p.formatMessage,`${Je}placeholder`,t.type,"action"),maxLength:i,meta:{isInOverlay:_},functions:{onChange:R,onMention:H,listMembers:Y,clickMentionFallback:Q},data:d,autoFocus:x!==!1||F&&!w,"aria-invalid":!!K,"aria-errormessage":"error-message"}},{component:Kw,props:{intlPath:Je,showGuidelines:z,type:t.type,gtmContext:m}}];N&&me.push({component:qt}),w&&me.unshift({id:"title",type:"text",value:w.text,limit:250,autoFocus:F,label:p.formatMessage({id:`${Je}titleField_label`}),placeholder:p.formatMessage({id:`${Je}titleField_placeholder`}),functions:{onChange:Be=>{q({...C,title:Be}),M({title:Be})}},validation:[{condition:()=>X,error:p.formatMessage({id:`${Je}titleField_error`})}]});let xe=!h||!h.id||!n||X||ye;return x&&(w?xe=xe||C.body===x.text&&C.title===w.text:xe=xe||C.body===x.text),c.jsxs(c.Fragment,{children:[c.jsxs(Jt,{id:U,className:G("discussion-card discussion-form",{"no-styling":v&&x}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:x&&!ye||o.cancel},functions:{onSuccess:async()=>{if(x){$("submitting"),A(C);return}await ae()},onCancel:j},fields:me,intlPath:Je,button:{variant:"primary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":`${x?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:xe,text:{default:!x&&(s!=null&&s.submit)?s==null?void 0:s.submit:p.formatMessage({id:`${Je}${x?"save":"post"}`}),submitting:p.formatMessage({id:`${Je}${x?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":m,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!o.cancel&&(!h||!h.id||!C.body),text:s!=null&&s.cancel?s==null?void 0:s.cancel:p.formatMessage({id:`${Je}cancel`})},gtm:{context:m,event:`${t.type}-form`},"data-testid":`discussion-${t.type}-form`,children:[S&&!x&&["question"].includes(t.type)&&c.jsx("h2",{children:At(p.formatMessage,`${Je}title`,t.type,"action")}),c.jsx(Yt,{member:h?{...h,link:!1}:"community",gtmContext:m,gtmType:"profile-click"})]}),T==="submitted"&&I&&c.jsx(jr,{className:"success","data-testid":"success",children:At(p.formatMessage,`${Je}success`,t.type,"action")}),K&&c.jsx(jr,{id:"error-message",className:"error","data-testid":"error",children:o.error?o.error:typeof K=="string"?K.includes(" ")?K:p.formatMessage({id:K},{action:p.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):K}),g&&c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:g})]})},Yw=Object.freeze(Object.defineProperty({__proto__:null,default:Vr},Symbol.toStringTag,{value:"Module"})),Gw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Qw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Ha=({icon:e,className:t="",...n})=>c.jsx(_e,{className:G("discussion-button",t),variant:"tertiary",icon:e,...n});let Ar=!1;const ss=()=>{Ar!==!1&&(clearTimeout(Ar),Ar=!1)},os=5;let us=null;const gh=({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=se.useIntl(),d={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[m,p]=y.useReducer(qr,d),{numberOfLikes:h,userLikedContent:g,ignoreInteractions:f,showLikers:b,tabbableLink:v}=m;y.useEffect(()=>{p([{type:"userLikedContent",value:a}])},[a]);const _=y.useMemo(()=>Qw(n,os),[n]),F=S=>{if(S.preventDefault(),S.stopPropagation(),p([{type:"showLikers",value:!1}]),Ar)return ss(),!1;if(ss(),f||!s)return!1;Ar=setTimeout(x,350)},x=async()=>{if(ss(),f||!s)return!1;let S=g?h-1:h+1;S<0&&(S=0),p([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const z=Gw(i.slugs);g?await l(z):await o({...z,payload:{contentPath:window.location.pathname}})}}catch{p([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{p([{type:"ignoreInteractions",value:!1}])}},w=()=>{us=setTimeout(()=>{p([{type:"showLikers",value:!1}])},500)},B=()=>{us&&clearTimeout(us)};return y.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&p([{type:"showLikers",value:!1}])},onMouseEnter:()=>{B(),p([{type:"showLikers",value:!0}])},onMouseLeave:()=>{w()}},c.jsxs(c.Fragment,{children:[c.jsx(Ha,{className:G("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:F,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:h})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Ie,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{B()},onBlur:()=>w,onClick:S=>{var N;S.preventDefault(),S.stopPropagation(),B(),p([{type:"showLikers",value:!0}]);const z=(N=S.currentTarget.nextSibling)==null?void 0:N.childNodes[0];if(z){const I=z.querySelector("li:first-child a");I&&(p([{type:"tabbableLink",value:0}]),setTimeout(()=>{I.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),w())},"aria-expanded":b,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Ie,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(Pn,{id:`likes-tooltip-${i.slug}`,isOpen:b,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[_.map((S,z)=>{if(typeof S=="string")return null;const N={};return v!==z&&(N.tabIndex=-1),c.jsx("li",{"data-index":z,children:c.jsx(dn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:I=>I==null?void 0:I.stopPropagation(),onFocus:()=>B(),onKeyDown:I=>{var L,H,Y,Q;if(!I||!["ArrowUp","ArrowDown"].includes(I.key||""))return;I.stopPropagation(),I.preventDefault();const M=I.key==="ArrowUp"?"up":"down",k=(L=I.currentTarget)==null?void 0:L.parentElement;let A=k==null?void 0:k.nextElementSibling;if(M==="up"){const re=k==null?void 0:k.previousElementSibling;re?A=re:(A=(H=k==null?void 0:k.parentElement)==null?void 0:H.lastElementChild,(A==null?void 0:A.getAttribute("data-index"))==="-1"&&(A=A==null?void 0:A.previousElementSibling))}else(!A||(A==null?void 0:A.getAttribute("data-index"))==="-1")&&(A=(Y=k==null?void 0:k.parentElement)==null?void 0:Y.firstElementChild);if(!A)return;const j=(A==null?void 0:A.getAttribute("data-index"))||"0";p([{type:"tabbableLink",value:j}]),(Q=A==null?void 0:A.querySelector("a"))==null||Q.focus()},...N,children:S.name?S.name:c.jsx("span",{className:"deleted-user",children:u.formatMessage({id:"member_deleted"})})})},S.id||window.btoa(S.name||""))}),t>os&&c.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-os})})]})})]})]}))},ls=({children:e,class:t,...n})=>{const r={...n,class:G("subtle",t)};return c.jsx("blockquote",{...r,children:e})},Jw=280,Ro=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Jn(e,typeof t=="number"?t:Jw):e;a=a.trim();const i=`<br>
163
+ `}),Q=k.turndown(Q)}o&&o.mentions&&(Q=await Jc({text:Q,template:`[${Ls}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),ow(Q,k=>{_([{type:"initialValue",value:k},{type:"editorKey",value:T.toString()}]),setTimeout(()=>{_([{type:"stringValue",value:yc(G)}])},150)})})()},[T]),y.useEffect(()=>{t!==""||!G||ms(T,t)&&!q||(D.withoutNormalizing(G,()=>{J.delete(G,{at:{anchor:D.start(G,[]),focus:D.end(G,[])}}),J.deselect(G),G.children.length!==0&&J.unwrapNodes(G,{at:[0]}),J.insertNodes(G,v,{at:[0]})}),_([{type:"initialValue",value:v},{type:"lastAnchor",value:null}]))},[t]);const C=Lc(()=>{dw({editor:G,isShowing:A.show,numberOfUsers:A.numberOfUsers,listMembers:p,dispatch:_})},100);return S?c.jsx("div",{id:L,className:"rich-text-editor",children:c.jsxs(nn.Provider,{value:{...B,id:L,isInOverlay:m,setFocus:j,dispatch:_,onMention:f,reportError:b},children:[c.jsxs(kD,{editor:G,initialValue:S,onChange:z=>{if(G.operations.some(k=>k.type!=="set_selection")){const k=hw(z);g(k),_([{type:"stringValue",value:yc(G)}]),q||_([{type:"hasInteracted",value:!0}]),C(),d&&console.log({serialized:k,json:z})}},...l,children:[c.jsx(vD,{className:"input",renderElement:U,renderLeaf:Z,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onKeyDown:z=>{if(z.key==="Enter"){A.show&&(z.preventDefault(),z.stopPropagation(),nh(G,A,_,L));const{selection:Q}=G;if(Q){const k=H.isCollapsed(Q),[F,R]=D.node(G,Q,{depth:1});let I=F,W=I.type;const re=I.children[0];if(re&&[V.ol,V.ul].includes(re.type)&&(I=re,W=re.type),I&&de.isElement(I)&&W!==V.paragraph){if(W===V.blockquote&&!z.shiftKey){z.stopPropagation(),z.preventDefault(),J.insertNodes(G,v);return}if(k){const[ee,ie]=D.parent(G,Q,{edge:"end"}),X=ee.type;if([V.ul,V.ol].includes(W))if(z.stopPropagation(),z.preventDefault(),X===V.li&&N==="Enter"){ee.children.length===1&&"text"in ee.children[0]&&ee.children[0].text===""&&J.removeNodes(G,{at:ie}),J.insertNodes(G,v,{at:P.next(R)}),J.select(G,D.end(G,P.next(R)));return}else{const[ve,pe]=uw(G,V.li),_e={type:V.li,children:[{text:""}]};J.insertNodes(G,_e,{at:P.next(pe)}),J.select(G,D.end(G,P.next(pe)))}}}}}else if(z.key==="Escape"){if(A.show){z.preventDefault(),z.stopPropagation(),_([{type:"mentionPopover",value:{...A,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(z.key)&&A.show){z.preventDefault(),z.stopPropagation();const{selectedUser:Q,possibleUsers:k}=A;let F=z.key==="ArrowUp"?Q-1:Q+1;F<0&&(F=k.length-1),F>=k.length+1&&(F=0),_([{type:"mentionPopover",value:{...A,selectedUser:F}}])}_([{type:"lastKey",value:z.key}]),cw(z,G,_,b)},onBlur:()=>{G.selection&&_([{type:"lastAnchor",value:G.selection.anchor}])},onFocus:()=>{if(M){if(!P.isPath(M.path)||!ue.has(G,M.path))return;const z=ue.get(G,M.path);let Q=0;if(he.isText(z)?Q=z.text.length:z.children&&(Q=z.children.length),M.offset>Q)return;try{J.select(G,{anchor:M,focus:M})}catch(k){const F=k.message;b(`Error focusing editor: ${F}`)}}}}),c.jsx(Ew,{}),p?c.jsx(mw,{onFallbackClick:h}):null]},x),c.jsx(co,{id:`character-limit-${e}`,limit:r,valueLength:ni($)})]})}):c.jsx(c.Fragment,{})};const Pw=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=y.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);y.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className: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 m=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:m,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:m,children:d.label})]},m)})})]})};function dh({className:e="",userId:t,userName:n,src:r,uploadImage:a,button:i,callback:s}){const o=se.useIntl(),l="profileImageChange_",[u,d]=y.useState(r),[m,p]=y.useState(!1),[h,g]=y.useState(!1),f=y.useRef(null),b=async _=>{p(!0),g(!1);try{const x=_.target.files&&_.target.files[0];if(!x||!t)throw p(!1),new Error("Image file or userID is missing");const T=await a({fileObject:x,userId:t}),S={thumbnail:T.thumbnailURL,full:T.originalURL};d(S),s(S)}catch{g(!0)}finally{p(!1)}p(!1)},{upload:v=o.formatMessage({id:`${l}cta_upload`}),change:E=o.formatMessage({id:`${l}cta_change`}),uploading:B=o.formatMessage({id:`${l}cta_uploading`})}=(i==null?void 0:i.text)||{};return c.jsxs("div",{className:Y("profile-image-change-figure",e),children:[c.jsx(mn,{className:"profile-image-change-picture",name:n,src:u==null?void 0:u.thumbnail,showInitials:!1,alt:"","data-testid":"profile-picture"}),h&&c.jsx("p",{className:"error text-small",children:o.formatMessage({id:`${l}error`})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:f,onChange:b,hidden:!0,"data-testid":"file-input"}),c.jsx(Ee,{onClick:()=>f.current&&f.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${u?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:m,children:m?B:u?E:v})]})}const fh=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(en,{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 hh=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[d,m]=y.useState([]),[p,h]=y.useState(!0),[g,f]=y.useState(u),{formatMessage:b}=se.useIntl(),v=async _=>{_.preventDefault();try{await l(d),m([]),f("SUCCESS")}catch(x){f("ERROR"),o(x)}},E=_=>{_.preventDefault(),f("NOT_SUBMITTED"),h(!0),m([])},B=_=>{_.preventDefault(),s(),f("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:b({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",b({id:"inviteForm_error"})]})}),c.jsx(Wt,{}),c.jsx("div",{className:"footer",children:g==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(Ee,{variant:"secondary",onClick:E,children:b({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(Ee,{onClick:B,children:b({id:"inviteForm_ctaDone"})})]}):c.jsx(Ee,{onClick:E,children:b({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(Vh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:b({id:"inviteForm_email_placeholder"}),emails:d,onChange:_=>{m(_),h(!_.length)},autoFocus:!1,getLabel:(_,x,T)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:_}),c.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{T(x),h(!d.length)},className:"remove-email-button",screenreaderText:b({id:"overlay_close"})})]},x)})]}),c.jsx(Wt,{}),c.jsx("fieldset",{className:"footer",children:c.jsx(Ee,{className:"sendEmailsButton",disabled:p,children:n})})]})})},Aa=e=>e.map(t=>({condition:t})),wt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},Mw=({functions:e,...t})=>{const{formatMessage:n}=se.useIntl(),[r,a]=y.useState(null),[i,s]=y.useState(!1),[o,l]=y.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=h=>h[wt.NEW_PASSWORD]!==h[wt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=h=>!bs(h[wt.NEW_PASSWORD]).isValid,m=[{"data-testid":wt.NEW_PASSWORD,id:wt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Aa(["required",d]),functions:{onChange:h=>l(bs(h).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":wt.CONFIRMED_PASSWORD,id:wt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Aa(["required",u])}];t.isPasswordChange&&m.unshift({"data-testid":wt.CURRENT_PASSWORD,id:wt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Aa(["required"])}),i&&m.push({component:$d,props:{matchingRules:o}});const p={id:wt.FORM_ID,fields:m,functions:{...e,onSuccess:async h=>(e.createPassword(h),e.onSuccess&&e.onSuccess(h)),onCatch:h=>a(h==null?void 0:h.statusCode),onFailure:(h,g)=>{(g.includes(wt.NEW_PASSWORD)||g.includes(wt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(en,{...p}),r&&c.jsx(hn,{variant:"error",text:r})]})};const mh=({hooks:e,functions:t,meta:n={},gtm:r})=>{var _,x;const a=se.useIntl(),i="profileForm_",s=y.useContext(gt),[o,l]=y.useState(s.image),[u,d]=y.useState(!1),{uploadImage:m,onSuccess:p=async T=>{},onCancel:h=()=>{},onFailure:g=()=>{}}=t,{buildLocation:f,isValidPlace:b,predictPlaces:v}=e.useMaps(),{context:E="ProfileForm",event:B="profile-form-submit-click"}=r||{};return c.jsx(en,{id:"profile-details-form",fields:[{component:dh,props:{userName:s.name,userId:s.id,src:o,uploadImage:m,callback:l,button:{text:{upload:a.formatMessage({id:`${i}image`})}}}},{id:"name",type:"text",label:a.formatMessage({id:`${i}name`}),placeholder:a.formatMessage({id:`${i}name_placeholder`}),value:s.name,autoComplete:"name",validation:[{condition:"required"}]},{id:"jobTitle",type:"text",label:a.formatMessage({id:`${i}jobTitle`}),placeholder:a.formatMessage({id:`${i}jobTitle_placeholder`}),value:s.jobTitle,validation:[{condition:"required"}]},{id:"organization",type:"text",label:a.formatMessage({id:`${i}organization`}),placeholder:a.formatMessage({id:`${i}organization_placeholder`}),value:s.organization,validation:[{condition:"required"}]},{id:"location",type:"autocomplete",label:a.formatMessage({id:`${i}location`}),placeholder:a.formatMessage({id:`${i}location_placeholder`}),value:((_=s.location)==null?void 0:_.en)||((x=s.location)==null?void 0:x.country),validation:[{condition:"required"},{condition:({location:T})=>T&&!u?!1:!b(T),error:a.formatMessage({id:`${i}location_error`})}],functions:{onChange:()=>{u||d(!0)},onKeyInput:v}},{id:"biography",type:"textarea",label:a.formatMessage({id:`${i}bio`}),placeholder:a.formatMessage({id:`${i}bio_placeholder`}),limit:1e3,value:s.biography},{component:Wt}],meta:{shouldShowCancelButton:!0,shouldReset:!1,shouldHide:!1,showRequiredLabels:!1,...n},intlPath:i,gtm:{context:E,event:B},functions:{onSuccess:async T=>{try{const S={...T,image:o||null,location:u?await f(T==null?void 0:T.location):s.location};s.updateDetails&&s.updateDetails($=>({...$,...S})),await p(S)}catch{g()}},onCancel:h,onFailure:g},button:{size:"large",text:{default:a.formatMessage({id:`${i}cta`}),submitting:a.formatMessage({id:`${i}cta_submitting`}),submitted:a.formatMessage({id:`${i}cta_submitted`})}}})};const ph=({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=se.useIntl(),u=y.useRef(null);er(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=m=>{m.preventDefault(),m.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className: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(Ne,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:m=>{m.key==="Enter"&&d(m)}}),c.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Ne,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Ne,{children:l.formatMessage({id:"search_cta"})})})]})})})},Ec=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}])},Nw=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"]}},Iw=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=Nw(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}])},Rw=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,m=(h,g)=>{h.current&&s.validFields[g]!==h.current.validity.valid&&o([{type:`validFields.${g}`,value:h.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>m(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Ec({ref:i.email,validateEmail:r,dispatch:o})},onChange:(h,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:Pd,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:()=>m(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{m(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:h=>c.jsx("small",{children:h})}),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:h=>c.jsx("small",{className:"notes text-small",children:h})}),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:h=>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:h}),privacy:h=>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:h})}),shownValue:"accepted",functions:{onChange:h=>{if(!h)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"&&Ec({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const $w=({className:e=""})=>c.jsxs("div",{className:Y("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(se.FormattedMessage,{id:"signup_success_title"})}),c.jsx(se.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const Lw={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},zw=({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=se.useIntl(),{title:u=!0,expectation:d=!1,url:m=!0,logInButton:p=!0,successMessage:h=!0}=a,g={title:u,expectation:d,url:m,logInButton:p,successMessage:h},[f,b]=y.useReducer(Wr,Lw),{validFields:v,emailDetails:E,shouldManuallyApprove:B,shouldDisableButton:_,showSuccessMessage:x,showError:T}=f,[S,$]=Zs.useCookies(["signup-this-session","functional-cookie-consent"]),M={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&&M.jobTitle.current&&M.jobTitle.current.focus()},[B]),y.useEffect(()=>{S["signup-this-session"]&&b([{type:"showSuccessMessage",value:!0}])},[S]),y.useEffect(()=>{x&&S["functional-cookie-consent"]&&$("signup-this-session","true",{path:"/",maxAge:3600})},[x]);const N=y.useMemo(()=>Rw({placeholders:n,labels:t,shouldShow:g,functions:r,refs:M,state:f,dispatch:b,dataToSubmit:s,intl:l}),[s,r,l,M,g,f]),q=_?!0:B?!Object.values(v).every(w=>w===!0):!v.name||!v.email||["exists","pending","verify"].includes(E.boxType);return g.successMessage&&x?c.jsx($w,{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(se.FormattedMessage,{id:"signup_title"})}),T&&c.jsx(hn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(en,{className:"signup-form",formRef:M.form,id:"sign-up-form",fields:N,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:q?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/api/next-ui/login","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 Iw({refs:M,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:b,state:f})},onCatch:w=>{r.handleError(w),b([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:M.hiddenValidation})]})};const bn=({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 qw=({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(bn,{className:Y("download-section",n),children:c.jsxs("div",{className:"content-default",children:[y.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(or,{buttons:r})]})})};const Ks="editSection_";function gh({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const Ww=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=se.useIntl();return c.jsxs(Ot,{variant:"muted",icon:e,children:[c.jsx("p",{children:t||s({id:`${Ks}placeholder_description`})}),a&&c.jsx("p",{children:c.jsx(Ee,{href:r,variant:"secondary",size:"small",onClick:()=>gh({href:r,setShowModal:i}),children:n||s({id:`${Ks}placeholder_cta`})})})]})},Uw=({children:e,className:t="",formProps:n,formComponent:r,href:a,title:i,showTitle:s=!0,modalTitle:o,placeholder:l,showDivider:u=!0})=>{const{formatMessage:d}=se.useIntl(),[m,p]=y.useState(!1),h=()=>p(!1),g=!!n||!!r,f=typeof a=="string"||g;let b;return r&&(b=y.cloneElement(r,{functions:{...r.props.functions,onSuccess:async v=>{try{r.props.functions.onSuccess&&await r.props.functions.onSuccess(v)}finally{h()}},onCancel:()=>{r.props.functions.onCancel&&r.props.functions.onCancel(),h()}}})),c.jsxs("section",{className:Y("edit-section",t),children:[g&&c.jsx(pn,{title:o||`Edit ${i}`,isOpen:m,showDivider:!1,showIcon:!1,functions:{onClose:h},className:Y("edit-section-modal"),children:b||(n?c.jsx(en,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async v=>{var E,B;(E=n==null?void 0:n.functions)!=null&&E.onSuccess&&await((B=n==null?void 0:n.functions)==null?void 0:B.onSuccess(v)),p(!1)},onCancel:h}}):c.jsx(c.Fragment,{}))}),c.jsxs("div",{className:Y("edit-section-header",{"no-title":!s}),children:[s&&c.jsx("h2",{className:"edit-section-header-title",children:i}),f&&c.jsx(Ee,{href:a,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>gh({href:a,setShowModal:p}),children:d({id:`${Ks}edit`})})]}),e||c.jsx(Ww,{...l,href:a,setShowModal:p,showEditButton:f}),u&&c.jsx(Wt,{})]})};const Hw=({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&&y.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:m,link:p=!1,description:h=!1},g)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:m});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:p?c.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),h&&c.jsx("small",{children:h})]},window.btoa(`${d.url}_${g}`))})})]})};let ts;const ns="contactFooter_",Vw=({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(ts),ts=setTimeout(()=>{o(),s(!1)},500))};return y.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(ts),window.removeEventListener("resize",l)}),[]),c.jsx(bn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(se.FormattedMessage,{id:`${ns}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(se.FormattedMessage,{id:`${ns}text`})}),c.jsx(fn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(se.FormattedMessage,{id:`${ns}email`})})]}),c.jsx(fh,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Kw=({activeLink:e,profile:t,...n})=>c.jsx(bn,{children:c.jsx(jd,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(Sd,{activeLink:e,profile:t}),c.jsx(sd,{...n})]})})});const rs="cookieBanner_",as=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],is=new Date(Date.now()+12*30*24*60*60*1e3),vh=()=>{const e=se.useIntl(),[t,n,r]=Zs.useCookies(as),[a,i]=y.useState(!t["apol-cookie-banner"]),s=()=>{as.forEach(d=>{n(d,!0,{path:"/",expires:is,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:is}),as.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:is});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:`${rs}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${rs}title`})}),c.jsx("p",{children:e.formatMessage({id:`${rs}text`})}),c.jsx(or,{buttons:u})]})},Zt={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:Un["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Un["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:Un.support,gtmType:"concierge-email-click"},business:{email:Un.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 Gn="footer_",Ua="SiteFooter",_c=({group:e})=>{const t=Zt[e].order||[];let n=!1;return"text"in Zt[e]&&(n=Zt[e].text),c.jsxs(y.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(se.FormattedMessage,{id:`${Gn}${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}=Zt[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":Ua,"data-gtm-event-type":i,...s,children:c.jsx(se.FormattedMessage,{id:`${Gn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(y.Fragment,{children:[c.jsx("dt",{children:c.jsx(se.FormattedMessage,{id:`${Gn}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(se.FormattedMessage,{id:`${Gn}${e}_${r}_address`,values:{br:c.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&c.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Ua,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Ro=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(Qa,{element:"hr"}),c.jsx(lo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Ua,"data-gtm-event-type":"logo-homepage-link"}),c.jsx("footer",{children:["platform","community","company","contact"].map(e=>c.jsxs("div",{className:"group",children:[c.jsx(_c,{group:e}),Object.keys(Zt[e]).includes("child")&&c.jsx(_c,{group:Zt[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(Zt.social.order)&&Zt.social.order.map(e=>{const t=Zt.social[e];return c.jsx("li",{className:e,children:c.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Ua,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(se.FormattedMessage,{id:`${Gn}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(se.FormattedMessage,{id:`${Gn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Re={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===yt.ACCOUNT&&t===!1&&n[yt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&Re.handlerCalled[e]&&i-Re.handlerCalled[e]<500)return;Re.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 yt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case yt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case yt.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=Nc(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?Re.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 yt.SITE:if(n){const u=Re.findFirstChild(t.current.children,"attributes.aria-controls",yt.SITE);s=Re.findFirstChild(u.children,"href")}else s=Re.findFirstChild(t.current.children,"href");break;case yt.ACCOUNT:if(o=Re.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Re.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(Re.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Re.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Re.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Re.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},qr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/api/next-ui/login"},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},Ha=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=se.useIntl(),o=Nc(qr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,d=e.includes("buttons.");let m=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(m+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let B=o.gtmType||`${e}-click`;if(B.includes(".")){const _=B.split("."),x=_[_.length-2];B=`${x==="topics"?`${x}-`:""}${_[_.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":B,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const h=o.order&&o.order[0]&&o[o.order[0]],g=h&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let b={},v={},E={};if(f&&(b={...b,"aria-current":"page"}),h){const B=o.menuId||e,_={onClick:x=>Re.events.onClick(x,{id:B,callback:a,isOpen:r[B]}),onFocus:()=>Re.events.onFocus({id:B}),onBlur:()=>Re.events.onBlur({id:B,callback:a}),onMouseLeave:()=>Re.events.onBlur({id:B,callback:a}),onMouseEnter:()=>Re.events.onMouseEnter({id:B,callback:a})};v={..._,id:B===yt.SITE?yt.SITE:yt.ACCOUNT},n&&(g&&(E={..._,className:"navigation-button",onKeyPress:x=>{x.key==="Enter"&&Re.events.onClick(x,{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 c.jsxs("li",{className:Y({[o.className]:o.className,"has-submenu":h,parent:g,active:f}),...b,children:[p?y.createElement(d?Ee:"a",p,s.formatMessage({id:m})):n&&o.order&&g?c.jsxs("button",{...E,children:[s.formatMessage({id:m}),c.jsx(Ne,{children:s.formatMessage({id:`header_menu_${r[yt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:m}),o.order&&c.jsx("ul",{...v,children:o.order.map(B=>{if(!o[B])return null;const _={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[B].order?c.jsxs("li",{className:Y({[o[B].className]:o[B].className}),children:[s.formatMessage({id:`${m}_${B}`}),c.jsx("ul",{children:o[B].order.map(x=>c.jsx(Ha,{id:`${e}.${B}.${x}`,..._},x))})]},B):c.jsx(Ha,{id:`${e}.${B}`,..._},B)})})]},e)};const Zw={height:67,height_desktop:83};var yt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(yt||{});const $o=({showNavigation:e=!0})=>{const t=se.useIntl(),n=y.useContext(gt),r=Pn(!0,!0),a=n&&typeof n.id=="string",i=y.useMemo(()=>Re.getIsDesktopVersion(a,r),[a,r]),[s,o]=y.useReducer(Wr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,m=y.useRef(s);y.useEffect(()=>{m.current=s},[s]),qc({scrollPosition:Zw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const v=m.current.menus;!i&&v["site-navigation"]||Re.shouldChangeHeaderIsVisible(!0,v,o)},scrollDown:()=>{const v=m.current.menus;!i&&v["site-navigation"]||Re.shouldChangeHeaderIsVisible(!1,v,o)}}});const p=(v,E,B=!1)=>{Re.handleMenus({id:v,value:E,menus:m.current.menus,dispatch:o,forceHandle:B})},h=y.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(E=>{m.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)}},[]),er(()=>{u["site-navigation"]&&Re.autoFocus({menu:"site-navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),er(()=>{u["account-navigation"]&&Re.autoFocus({menu:"account-navigation",navigationRef:h,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Ne,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(ph,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),b=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:v=>{v.preventDefault(),v.stopPropagation(),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(Ne,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:h,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:qr.order.map(v=>c.jsx(Ha,{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(Ne,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(lo,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[b,f]}):c.jsxs(c.Fragment,{children:[f,b]}),a?c.jsxs("button",{className:"account-button",onClick:v=>Re.events.onClick(v,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>Re.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>Re.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Ne,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(mn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:qr.buttons.order.map(v=>c.jsx(Ha,{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 Yw=()=>{const e=se.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx($o,{}),c.jsx("div",{id:"content",children:c.jsx(hn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(Ro,{})]})},bh=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:d="default",variant:m="default",circle:p="default",modal:h="default"}=i,g=$c(),[f,b]=y.useState(""),v=T=>{const{detail:{message:S}}=T;b(S)};y.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const E=Da(e,{locale:o}),B=Da(t,{locale:o}),_=Da(n,{locale:o}),x={};return d!=="default"&&(x[d]=!0),m!=="default"&&(x[m]=!0),p!=="default"&&(x[p]=!0),c.jsx(Kh.ErrorBoundary,{onError:r,fallback:c.jsx(Yw,{}),children:c.jsxs(y.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:Y(s,x,{"has-footer":u}),children:[c.jsx($o,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[B&&c.jsx("div",{className:Y("additional-content prepended",{"large-modal":h==="large"}),children:B}),y.createElement(d==="bold"?io:"div",{id:"content",children:E,className:Y({"large-modal":h==="large"})})]}),_&&c.jsx("div",{className:"additional-content appended",children:_}),u&&c.jsx(Ro,{}),c.jsx(vh,{})]}),f&&c.jsx(Ne,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},kc={default:"tags_",headerTopics:"header_topics_topics_"},ss={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"},Gw={getTagDetails:e=>{if(e.includes("topic_")){if(e=ss.topic[e.replace("topic_","")],e){const t=qr.topics.topics[e].href;return t?{id:e,href:t,text:`${kc.headerTopics}${e}`}:null}return null}return ss[e]?(e=ss[e],{id:e,text:`${kc.default}${e}`}):null}};const Qw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=se.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=Gw.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)})})};var ct=(e=>(e.COMMUNITIES="communities",e.PLATFORM="platform",e))(ct||{});const Jw=({members:{data:e=[],total:t=e.length},communitySlug:n,isMember:r=!1,hasNextPage:a=!1,loadNextPage:i=()=>{},profile:s,gtmContext:o="member",gtmType:l="member-click",className:u=""})=>{const d=se.useIntl(),m="membersList",p=y.useContext(gt),[h,g]=y.useState(!1);return e.length===0?null:c.jsxs("div",{className:Y("members-list",u),children:[c.jsxs("h1",{children:[d.formatMessage({id:m}),c.jsx("span",{className:"count",children:t})]}),c.jsxs("ul",{children:[r?c.jsxs("li",{children:[c.jsx(Qt,{member:p,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:n||""},{scope:ct.PLATFORM,area:"all"}]}}),c.jsx(fn,{href:"/profiles/me",className:"text-small",onClick:f=>{f==null||f.preventDefault(),f==null||f.stopPropagation(),g(!0)},children:d.formatMessage({id:`${m}_profile`})})]}):c.jsx(c.Fragment,{}),e.map((f,b)=>c.jsxs("li",{children:[c.jsx(Qt,{member:f,gtmContext:o,gtmType:l,badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:n||""},{scope:ct.PLATFORM,area:"all"}]}}),f.isAdmin&&c.jsx(Gt,{children:d.formatMessage({id:`${m}_admin`})})]},b))]}),a&&c.jsx(Hr,{hasNextPage:a,loadNextPage:i,icon:{icon:"arrow-down",position:"right"},gtmContext:o}),s?c.jsx(fi,{form:s,showModal:h,content:{title:d.formatMessage({id:`${m}_modal_title`})},functions:{onClose:()=>{g(!1)}}}):c.jsx(c.Fragment,{})]})},Xw={showForm:!1},ci=y.createContext(Xw),yh=({children:e})=>{const[t,n]=y.useState({showForm:!1});return c.jsx(ci.Provider,{value:{...t,updateConversation:n},children:e})},Fc=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},di=e=>{var t,n,r,a,i,s;return e&&!e.error?{id:e==null?void 0:e.id,name:(t=e==null?void 0:e.data)==null?void 0:t.name,organization:(n=e==null?void 0:e.data)==null?void 0:n.organization,jobTitle:(r=e==null?void 0:e.data)==null?void 0:r.jobTitle,location:(a=e==null?void 0:e.data)==null?void 0:a.location,image:{thumbnail:((i=e==null?void 0:e.data)==null?void 0:i.thumbnail)||void 0},badges:(s=e==null?void 0:e.data)==null?void 0:s.badges}:"deleted"},eE=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=se.useIntl();return t?c.jsx("small",{children:Tt(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,{})},tE=({formID:e,intlPath:t,showLabel:n,type:r})=>{const a=se.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(Ne,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:Tt(a.formatMessage,`${t}label_action`,r,"action")})};let pa=null;const Je="discussion_form_",Kr=({id:e,parentId:t,content:n={type:"response",slugs:{}},userHasPermissions:r=!0,meta:a,placeholder:i,maxLength:s=0,buttons:o,forceShow:l={cancel:!1,error:!1},isCommunity:u=!1,functions:d,data:m={},gtmContext:p="DiscussionForm"})=>{var Te,Ve,We;const h=se.useIntl(),g=y.useContext(gt),[f,b]=y.useState(""),{isLoading:v=!1,isInWrapper:E=!1,isInOverlay:B=!1,isAutoFocused:_=!1,isEditing:x=!1,hasTitleField:T=!1,isPrepopulated:S=!1,showTitle:$=!1,showGuidelines:M=!0,showDivider:N=!1,showSuccessMessage:q=!0}=a||{},{onChange:w=()=>{},create:A=()=>{},handleSaveEdit:j=()=>{},handleCancel:L=()=>{},callback:U=()=>{},onMention:Z=()=>{},listMembers:G=()=>Promise.resolve([]),clickMentionFallback:ae=()=>{},props:C={create:{projectNames:["questions-answers"]}}}=d,[z,Q]=y.useState({title:T&&T.text||"",body:x&&x.text||S&&S.text||""}),[k,F]=y.useState(l.error||!1),[R,I]=y.useState(!1);if(y.useEffect(()=>{u&&!x&&S&&S!==z.body&&Q({...z,body:S.text||""})},[S]),v)return c.jsx(Bt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const W=Be=>{Q({...z,body:Be}),w({body:Be});let Se;!g||!g.id?Se=Tt(h.formatMessage,`${Je}error_loggedOut`,n.type,"action"):r?s>0&&Be.length>=s&&(Se=`${Je}error_tooLong`):Se=Tt(h.formatMessage,`${Je}error_noPermission`,n.type,"action"),Se?F(Se):k&&F(!1)};let re=`${n.type}-form`;if(n.type==="response"||n.type==="reply"){const Be=((Te=n.slugs)==null?void 0:Te.reply)||((Ve=n.slugs)==null?void 0:Ve.answer)||((We=n.slugs)==null?void 0:We.question)||"";Be&&(re=`${re}-${Be.slice(-15)}`)}e&&(re=`${e}-${re}`);const ee=async()=>{if(!g||!g.id||!r||ve)return;pa&&clearTimeout(pa),I("submitting");const Be=window.location.pathname;try{let Se;switch(n.type){case"post":Se=await A({title:z.title,content:z.body});break;case"question":Se=await A({title:z.body,authorId:g&&g.id,...C==null?void 0:C.create});break;case"response":Se=await A({questionSlug:n.slugs.question},{body:z.body,authorId:g&&g.id,contentPath:Be});break;case"reply":Se=await A({questionSlug:n.slugs.question,answerSlug:n.slugs.answer},{body:z.body,authorId:g&&g.id,contentPath:Be});break;default:break}await im(1e3),U&&await U(Se),pa=setTimeout(()=>{Q({title:"",body:""}),I("submitted"),b(Tt(h.formatMessage,`${Je}success`,n.type,"action"));const De=new Event(Xe.DISCUSSION_FORM_SUBMITTED);document.dispatchEvent(De),ie()},500)}catch(Se){const De=Se;let Ie=`${Je}error`;De!=null&&De.message.includes("entry already exists")&&(Ie=Tt(h.formatMessage,`${Je}error_alreadyExists`,n.type,"action")),De!=null&&De.message.includes("429")?Ie=Tt(h.formatMessage,`${Je}error_tooMany`,n.type,"action"):De!=null&&De.message.includes("400")&&(Ie=`${Je}error`),F(Ie),ie()}},ie=()=>{pa=setTimeout(()=>{F(!1),I(!1),b("")},5e3)},fe=!z.title||!nu(z.title),X=!z.body||!nu(z.body);let ve=X;T&&(ve=fe&&X);const pe=R==="submitting",_e=[{component:tE,props:{formID:re,intlPath:Je,showLabel:T!==!1,type:n.type}},{component:ch,props:{id:`${re}-input`,value:R==="submitting"&&!k?"":z.body,placeholder:i||Tt(h.formatMessage,`${Je}placeholder`,n.type,"action"),maxLength:s,meta:{isInOverlay:B},functions:{onChange:W,onMention:Z,listMembers:G,clickMentionFallback:ae},data:m,autoFocus:x!==!1||_&&!T,"aria-invalid":!!k,"aria-errormessage":"error-message"}},{component:eE,props:{intlPath:Je,showGuidelines:M,type:n.type,gtmContext:p}}];N&&_e.push({component:Wt}),T&&_e.unshift({id:"title",type:"text",value:T.text,limit:250,autoFocus:_,label:h.formatMessage({id:`${Je}titleField_label`}),placeholder:h.formatMessage({id:`${Je}titleField_placeholder`}),functions:{onChange:Be=>{Q({...z,title:Be}),w({title:Be})}},validation:[{condition:()=>ve,error:h.formatMessage({id:`${Je}titleField_error`})}]});let Fe=!g||!g.id||!r||ve||pe;return x&&(T?Fe=Fe||z.body===x.text&&z.title===T.text:Fe=Fe||z.body===x.text),c.jsxs(c.Fragment,{children:[c.jsxs(en,{id:re,className:Y("discussion-card discussion-form",{"no-styling":E&&x}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:x&&!pe||l.cancel},functions:{onSuccess:async()=>{if(x){I("submitting"),j(z);return}await ee()},onCancel:L},fields:_e,intlPath:Je,button:{variant:"primary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`${x?"save":"submit"}-${n.type}-click`,"data-testid":"save-button",disabled:Fe,text:{default:!x&&(o!=null&&o.submit)?o==null?void 0:o.submit:h.formatMessage({id:`${Je}${x?"save":"post"}`}),submitting:h.formatMessage({id:`${Je}${x?"saving":"posting"}`})}},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":p,"data-gtm-event-type":`cancel-${n.type}-click`,disabled:!l.cancel&&(!g||!g.id||!z.body),text:o!=null&&o.cancel?o==null?void 0:o.cancel:h.formatMessage({id:`${Je}cancel`})},gtm:{context:p,event:`${n.type}-form`},"data-testid":`discussion-${n.type}-form`,children:[$&&!x&&["question"].includes(n.type)&&c.jsx("h2",{children:Tt(h.formatMessage,`${Je}title`,n.type,"action")}),c.jsx(Qt,{member:g?{...g,link:!1}:"community",gtmContext:p,gtmType:"profile-click",badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:t||""},{scope:ct.PLATFORM,area:"all"}]}})]}),R==="submitted"&&q&&c.jsx(Or,{className:"success","data-testid":"success",children:Tt(h.formatMessage,`${Je}success`,n.type,"action")}),k&&c.jsx(Or,{id:"error-message",className:"error","data-testid":"error",children:l.error?l.error:typeof k=="string"?k.includes(" ")?k:h.formatMessage({id:k},{action:h.formatMessage({id:`discussion_action_${n.type}`}),maxLength:s}):k}),f&&c.jsx(Ne,{"aria-live":"polite",showOnFocus:!1,children:f})]})},nE=Object.freeze(Object.defineProperty({__proto__:null,default:Kr},Symbol.toStringTag,{value:"Module"})),rE=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),aE=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Va=({icon:e,className:t="",...n})=>c.jsx(Ee,{className:Y("discussion-button",t),variant:"tertiary",icon:e,...n});let Tr=!1;const os=()=>{Tr!==!1&&(clearTimeout(Tr),Tr=!1)},us=5;let ls=null;const Dh=({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=se.useIntl(),d={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[m,p]=y.useReducer(Wr,d),{numberOfLikes:h,userLikedContent:g,ignoreInteractions:f,showLikers:b,tabbableLink:v}=m;y.useEffect(()=>{p([{type:"userLikedContent",value:a}])},[a]);const E=y.useMemo(()=>aE(n,us),[n]),B=S=>{if(S.preventDefault(),S.stopPropagation(),p([{type:"showLikers",value:!1}]),Tr)return os(),!1;if(os(),f||!s)return!1;Tr=setTimeout(_,350)},_=async()=>{if(os(),f||!s)return!1;let S=g?h-1:h+1;S<0&&(S=0),p([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const $=rE(i.slugs);g?await l($):await o({...$,payload:{contentPath:window.location.pathname}})}}catch{p([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{p([{type:"ignoreInteractions",value:!1}])}},x=()=>{ls=setTimeout(()=>{p([{type:"showLikers",value:!1}])},500)},T=()=>{ls&&clearTimeout(ls)};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:()=>{x()}},c.jsxs(c.Fragment,{children:[c.jsx(Va,{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:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:h})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Ne,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{T()},onBlur:()=>x,onClick:S=>{var M;S.preventDefault(),S.stopPropagation(),T(),p([{type:"showLikers",value:!0}]);const $=(M=S.currentTarget.nextSibling)==null?void 0:M.childNodes[0];if($){const N=$.querySelector("li:first-child a");N&&(p([{type:"tabbableLink",value:0}]),setTimeout(()=>{N.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),x())},"aria-expanded":b,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Ne,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(Mn,{id:`likes-tooltip-${i.slug}`,isOpen:b,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[E.map((S,$)=>{if(typeof S=="string")return null;const M={};return v!==$&&(M.tabIndex=-1),c.jsx("li",{"data-index":$,children:c.jsx(fn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:N=>N==null?void 0:N.stopPropagation(),onFocus:()=>T(),onKeyDown:N=>{var L,U,Z,G;if(!N||!["ArrowUp","ArrowDown"].includes(N.key||""))return;N.stopPropagation(),N.preventDefault();const q=N.key==="ArrowUp"?"up":"down",w=(L=N.currentTarget)==null?void 0:L.parentElement;let A=w==null?void 0:w.nextElementSibling;if(q==="up"){const ae=w==null?void 0:w.previousElementSibling;ae?A=ae:(A=(U=w==null?void 0:w.parentElement)==null?void 0:U.lastElementChild,(A==null?void 0:A.getAttribute("data-index"))==="-1"&&(A=A==null?void 0:A.previousElementSibling))}else(!A||(A==null?void 0:A.getAttribute("data-index"))==="-1")&&(A=(Z=w==null?void 0:w.parentElement)==null?void 0:Z.firstElementChild);if(!A)return;const j=(A==null?void 0:A.getAttribute("data-index"))||"0";p([{type:"tabbableLink",value:j}]),(G=A==null?void 0:A.querySelector("a"))==null||G.focus()},...M,children:S.name?S.name:c.jsx("span",{className:"deleted-user",children:u.formatMessage({id:"member_deleted"})})})},S.id||window.btoa(S.name||""))}),t>us&&c.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-us})})]})})]})]}))},cs=({children:e,class:t,...n})=>{const r={...n,class:Y("subtle",t)};return c.jsx("blockquote",{...r,children:e})},iE=280,Lo=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Xn(e,typeof t=="number"?t:iE):e;a=a.trim();const i=`<br>
164
164
 
165
- `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await Gc({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const Xw=3e3,eE=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=se.useIntl(),[r,a]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{children:[c.jsx(Pn,{className:G("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(Ha,{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})},Xw)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event})]})},Nt="discussion_",tE=195;let pa=null;const Kr=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:a=!1,originalAuthorId:i,forceHide:s={actionBar:!1,comments:!1,likes:!1},functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:m,isTruncated:p=!1,styling:{showShareLinkButton:h=!1}={},setFocus:g=!1,isCommunity:f=!1})=>{var Se,He,Be,Fe,Pe,Ee,Ve,ze;const b=se.useIntl(),v=y.useContext(mt),_=y.useContext(li),{createContent:F=async()=>{},deleteContent:x=async()=>{},updateContent:w=async()=>{}}=o.content||{},{createLike:B=()=>{},deleteLike:S=()=>{}}=o.likes||{},{openComments:z=()=>{}}=o.comments||{},{listMembers:N=()=>Promise.resolve([]),clickMentionFallback:I=()=>{}}=o.mentions||{},{author:M,canLike:k,createdAt:A,id:j,likes:L=0,userLiked:H,comments:Y=0,mentions:Q}=t,re=v&&v.id&&typeof M!="string"&&M.id&&M.id===v.id||!1,C=typeof k=="boolean"?k:!0,q=re&&(!t.createdAt||Xh(t.createdAt,10,"seconds")),K=y.useRef(null),[E,T]=y.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[$,R]=y.useState(!1),[U,ae]=y.useState(q?"highlighted":"default"),[J,ie]=y.useState("");y.useEffect(()=>{const W=K.current;if(!(!W||U==="default"))return document.addEventListener(Xe.DISCUSSION_FORM_SUBMITTED,de),W.addEventListener("transitionend",X),()=>{document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,de),W.removeEventListener("transitionend",X)}},[]),y.useEffect(()=>{T({...E,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),y.useEffect(()=>{(async()=>{const ne=await Ro(E.body,p,Q,N);T({...E,postBody:ne})})()},[E.body,Q]);const de=()=>{setTimeout(()=>{ae("fading")},1e3)},X=({propertyName:W})=>{W==="background-color"&&ae(ne=>(ne==="default"&&(document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,de),K.current&&K.current.removeEventListener("transitionend",X)),ne==="fading"?"default":ne))};if(a||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||E.postBody===""&&t.title==="")return c.jsx(Ft,{className:"discussion-card"});const ye=async({title:W,body:ne})=>{W||(W=""),ne||(ne=""),ie("");try{if(!hs(W,E.title)||!hs(ne,E.body)){const he=t.type==="question"?{title:ne}:{title:W,body:ne};await w(_c(t.slugs),he)}T({...E,title:W,body:ne,isEditing:!1,didEdit:!0})}catch{ie(`${Nt}form_error`)}},me=()=>{if(_&&_.updateConversation){const W={showForm:!0},ne=t.author;ne&&ne.id&&(f&&(W.prepopulateForm=`@{{${ne.id}}}`),W.mentionData={id:ne.id,name:ne.name}),_.updateConversation(W)}setTimeout(()=>{var Ce,Ze,Ye;const ne=`reply-form-${(t.type==="answer"?t.slug:((Ce=t.slugs)==null?void 0:Ce.reply)||((Ze=t.slugs)==null?void 0:Ze.answer)||((Ye=t.slugs)==null?void 0:Ye.question)||"").toLowerCase().slice(-15)}`,he=document.getElementById(ne),pe=document.getElementById(`${ne}-input`);pe&&pe.focus(),he&&he.scrollIntoView({behavior:"smooth"})},0)},xe=async()=>{R(!1);try{await x(_c(t.slugs))}catch{ie("delete-error")}},Te=[{text:b.formatMessage({id:`${Nt}moreMenu_report`}),onClick:W=>{W.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(b.formatMessage({id:`${Nt}report_subject`}))}&body=${encodeURI(b.formatMessage({id:`${Nt}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&&re&&Te.push({text:b.formatMessage({id:`${Nt}moreMenu_edit`}),onClick:()=>T({...E,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`},{text:b.formatMessage({id:`${Nt}moreMenu_delete`}),onClick:W=>{W.preventDefault(),W.stopPropagation(),R(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,..._d(`delete-${t.slug}-modal`,$)}),r&&o.pins&&Te.push({text:b.formatMessage({id:`${Nt}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),g&&((Se=K==null?void 0:K.current)==null||Se.focus(),(He=K==null?void 0:K.current)==null||He.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:G("discussion-post",u,{[U]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!E.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:K,tabIndex:g?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:W=>{if(!l.post||E.isEditing)return;W.preventDefault(),W.stopPropagation(),pa&&clearTimeout(pa),pa=setTimeout(()=>{window.location.href=l.post},150);const ne=new CustomEvent(Xe.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:pa}});document.dispatchEvent(ne)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:j||t.slug,className:G("discussion-card",t.type,{editing:E.isEditing,"has-link":l.post&&!E.isEditing}),children:[!E.isEditing&&c.jsxs("div",{className:"author-section",children:[c.jsx(Yt,{member:M,additionalContent:{createdAt:A,didEdit:E.didEdit},className:typeof M!="string"&&M.id===i?"highlighted":"",gtmContext:d,gtmType:"profile-click"}),t.pinned&&c.jsx(ln,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Ie,{children:"Pinned Post"})})]}),E.isEditing?c.jsx(Vr,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:E.title!==""?{text:E.title}:!1,isEditing:{text:E.body},isPrepopulated:!1},isCommunity:f,maxLength:t.type==="question"?250:5e4,forceShow:{error:J!==""&&J!=="delete-error"?b.formatMessage({id:J},{action:b.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:F,handleSaveEdit:ye,handleCancel:()=>{ie(""),T({...E,isEditing:!1})},listMembers:N,clickMentionFallback:I},gtmContext:`${d}Form`,data:{mentions:t.mentions}}):l.post?c.jsxs("a",{href:l.post,children:[(E==null?void 0:E.title)&&c.jsx("p",{className:"content-title",children:E==null?void 0:E.title}),E.postBody.length>tE?c.jsx(rd,{text:E.postBody,markdownOptions:{overrides:{a:ys,blockquote:{component:ls}}}}):c.jsx(kn,{options:{overrides:{a:ys,blockquote:{component:ls}}},children:E.postBody})]}):c.jsxs(c.Fragment,{children:[(E==null?void 0:E.title)&&c.jsx("p",{className:"content-title",children:E==null?void 0:E.title}),c.jsx(kn,{options:{wrapper:t.type==="question"?"h1":y.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:ls}}},children:E.postBody})]}),!E.isEditing&&!(s!=null&&s.actionBar)&&c.jsxs("ul",{className:G("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!s.likes&&c.jsx(gh,{element:"li",likes:L,isShort:!1,userLiked:H,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:C,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:B,deleteLike:S}}),!s.comments&&(["question","post"].includes(t.type)||l.comments)&&c.jsx("li",{children:c.jsx(Ha,{onClick:W=>{W.preventDefault(),W.stopPropagation(),l.comments&&(window.location.href=l.comments),typeof z=="function"&&z()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":d,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:b.formatMessage({id:`${Nt}comments_screenReader`},{count:Y}),children:b.formatMessage({id:`${Nt}comments`},{count:Y})})}),(t.type==="answer"||t.type==="reply")&&c.jsx("li",{children:c.jsx(Ha,{styling:{muted:!0},onClick:me,icon:{icon:"speech-bubble_square"},children:b.formatMessage({id:`${Nt}reply`})})}),h&&c.jsx(eE,{url:(Be=t.slugs)!=null&&Be.reply?`${window.location.origin}${(Fe=t.slugs)==null?void 0:Fe.question}/${(Pe=t.slugs)==null?void 0:Pe.answer}#${(Ee=t.slugs)==null?void 0:Ee.reply}`:`${window.location.origin}${(Ve=t.slugs)==null?void 0:Ve.question}/${(ze=t.slugs)==null?void 0:ze.answer}`,gtm:{context:d,event:`copy-link-${t.type}-click`}}),c.jsx(kd,{element:"li",id:`more-${t.slug}`,options:Te})]})]}),m,c.jsx(mn,{id:`delete-${t.slug}-modal`,isOpen:$,functions:{onOpen:()=>{},onClose:()=>R(!1)},forceShow:{error:J==="delete-error"?b.formatMessage({id:"discussion_delete_error"},{action:b.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:b.formatMessage({id:"discussion_delete_title"},{action:b.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>R(!1),children:b.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:xe,children:b.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:c.jsx(se.FormattedMessage,{id:"discussion_delete_text",values:{p:W=>c.jsx("p",{children:W}),action:b.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const nE=y.lazy(()=>Promise.resolve().then(()=>ZE)),rE=65,vh=({forceShow:e,form:t,className:n})=>{const r=se.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(mt)||"community",l=ei(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,m]=y.useState({form:u||Jc("showPost")==="true"||!1,warning:!1}),[p,h]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!p.showCachedText)return;(async()=>{const v=await Ro(p.title||p.body||"",rE,p.mentions);h(_=>({..._,prettifiedText:v}))})()},[p.showCachedText,p.title,p.body]);const g=b=>{if(!p.showCachedText||typeof d.warning=="string")return;let v;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),v=b.detail.link;else{const _=b;_.preventDefault(),_.stopPropagation();const x=_.target.closest("a");v=x&&x.getAttribute("href")}m(_=>({..._,warning:v||!1}))};y.useEffect(()=>{if(!p.showCachedText){document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g);return}return document.addEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.addEventListener(Xe.MEMBER_CLICKED,g),document.addEventListener("click",g),()=>{document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g)}},[p.showCachedText]),y.useEffect(()=>{const b=v=>{if(!(!p.showCachedText||d.warning!==!1))return v.preventDefault(),v.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[p.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return p.showCachedText&&(p.title||p.body)&&(f=p.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:G("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),m(v=>({...v,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(hn,{name:l.name,src:l.image,alt:""}),c.jsx(kn,{className:G("input",{placeholder:!p.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:wt,blockquote:wt,br:wt,em:wt,li:wt,ol:wt,p:wt,s:wt,span:wt,strong:wt,ul:wt}},children:f})]}),c.jsxs(Wr,{children:[c.jsx(nE,{showModal:d.form,functions:{cacheText:h,onClose:()=>{m(b=>({...b,form:!1}))}},form:t,cachedText:p,className:"in-portal"}),c.jsx(mn,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{m(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{m({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":i}],children:c.jsx("p",{children:r.formatMessage({id:`${a}overlay_text`})})})]})]})},aE=y.lazy(()=>Promise.resolve().then(()=>Yw)),$o=({isCard:e=!1,form:t,membershipRequiredToPost:{isMember:n,required:r,join:a,leave:i,notMemberStateText:s}})=>{if(r&&!n)return c.jsx(fn,{text:s,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(so,{isShort:!0,functions:{join:a,leave:i}})}});const{content:o,functions:l,meta:u,...d}=t,m={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(vh,{form:m}):c.jsx(aE,{...m})},Lo=({form:e})=>{const t=y.useContext(mt),n=se.useIntl(),[r,a]=y.useState(!1),i=()=>{um(t)||a(!0)};y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(di,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const cs="discussion_responses_",bh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=se.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${cs}title`},{action:r.formatMessage({id:`${cs}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:At(r.formatMessage,`${cs}empty`,e,e)})]})};const yh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=se.useIntl(),s=y.useContext(li),o=ya(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:G("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(Ur,{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(Vr,{...r})]})},iE="post",sE="reply",Dh="00000000-0000-0000-0000-000000000000";function zo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function qo({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 oE(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function uE(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Ch(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 lE({title:e,content:t}){return{title:e,content:t,id:Dh,time:new Date().toISOString(),verb:iE}}function kc({activity:e,user:t}){return{...e,actor:Ch(t),...oE()}}function Va({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 xh({activity:e,user:t}){var n,r,a;e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like-1:0},t!=null&&t.id&&(e.latest_reactions={...e.latest_reactions||{},like:(((r=e.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((a=e.own_reactions)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function Ka({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},pin:[...((r=e.latest_reactions)==null?void 0:r.pin)||[],t]},e.own_reactions={...e.own_reactions||{},pin:[...((a=e.own_reactions)==null?void 0:a.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function wh({activity:e}){var t;e.reaction_counts={...e.reaction_counts||{},pin:(t=e.reaction_counts)!=null&&t.pin?e.reaction_counts.pin-1:0},e.latest_reactions={...e.latest_reactions||{},pin:[]},e.own_reactions={...e.own_reactions||{},pin:[]}}function cE({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Dh,kind:sE,parent:t||""}}function Fc({reply:e,user:t}){const n=Ch(t);return{...e,user_id:n.id,user:n,...uE()}}function Bc({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 dE({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,t)=>{const n=new CustomEvent(Xe.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let Ac,ds=0;const _h=()=>{y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(Ac);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),ds=0;return}ds++,!(ds>10)&&(Ac=setTimeout(()=>{e(t)},50))}},ar=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}),Wt=Object.freeze({id:"some-user-id-2",name:"some user name 2",organization:"some user organization 2",jobTitle:"some user job title 2",image:{thumbnail:"https://some-user-thumbnail.com/avatar2.png"},isLoading:!1}),Wo=Object.freeze({actor:`SU:${ar.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"}),fE=Object.freeze({actor:`SU:${Wt.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"}),hE=Object.freeze({actor:`SU:${ar.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"}),mE=Object.freeze({actor:`SU:${Wt.id}`,content:"some content 4",duration:"5.53ms",feed_id:"some-feed-id-4",foreign_id:"post:some-foriegn-id-4",id:"some-activity-id-4",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"});Object.freeze({id:"some-reaction-id-1",activity_id:Wo.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Wt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Wt.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({id:"some-reaction-id-1",activity_id:Wo.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Wt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Wt.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:Wt.id,user:{id:Wt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Wo.id,data:{content:"Some content 1..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-2",user_id:ar.id,user:{id:ar.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:fE.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:Wt.id,user:{id:Wt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:hE.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:ar.id,user:{id:ar.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:mE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function pE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=kc({activity:lE(o),user:i});return Tc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=kc({activity:o,user:i});r.setQueryData(a,Tc(d,u,!0)),setTimeout(()=>{Eh(d.id,"activity")},0)}});return s}function gE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Sn(a,s);return o&&(o.content=i),s}),onError:n});return r}function vE({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i,pin:s,unpin:o},queryKey:l,rankingMethod:u}){const d=qe.useQueryClient(),m=Xa(),p={queryClient:d,queryKey:l},h={mutationHandlers:{error:zo(p),mutate:qo(p)},user:m,...p},g=pE({...h,mutationFn:e}),f=gE({...h,mutationFn:t}),b=bE({...h,mutationFn:n}),v=CE({...h,mutationFn:a}),_=xE({...h,mutationFn:i}),F=DE({...h,mutationFn:s}),x=wE({...h,mutationFn:o}),{activities:w,...B}=yE({queryKey:l,queryFn:r,rankingMethod:u});return{activities:w,mutations:{create:g,edit:f,remove:v,like:b,unlike:_,pin:F,unpin:x},user:m,...B}}function bE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Sn(s,o);return l&&Va({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Sn(o,l);u&&Va({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function yE({queryFn:e,queryKey:t,rankingMethod:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=qe.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:_E(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function DE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Sn(s,o);return l&&Ka({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Sn(o,l);u&&Ka({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function CE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>EE(a,i)),onError:n});return r}function xE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Sn(i,s);return o&&xh({activity:o,user:r}),s}),onError:n});return a}function wE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Sn(i,s);return o&&wh({activity:o,user:r}),s}),onError:n});return a}function Tc(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 Sn(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function EE(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function _E(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const kE=({basePath:e,parentId:t,isMember:n,isOwner:r,functions:{activities:a,mentions:i,join:s,leave:o},profile:l})=>{const u=Pm(Xs.COMMUNITY_RANKING),d=se.useIntl(),[m,p]=y.useState("community_feed_live"),[h,g]=y.useState([{id:"recent_with_pin",label:"recent"},{id:"community_feed_live",label:"popular"}]),{activities:f,error:b,fetchNextPage:v,hasNextPage:_,isLoading:F,mutations:{create:x,edit:w,remove:B,like:S,unlike:z,pin:N,unpin:I}}=vE({queryKey:[e,t,"activities",m],queryFns:a,rankingMethod:m});y.useEffect(()=>{u&&g(h.concat(u))},[u]);const[M,k]=y.useState(null),A=()=>{k(f.length),v()};return _h(),b?c.jsx(fn,{variant:"error",text:b.message}):c.jsxs("section",{children:[c.jsx($o,{isCard:!0,form:{content:{type:"post",slugs:{}},functions:{create:x,...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:s,leave:o,notMemberStateText:d.formatMessage({id:"community_joinToPost"})}}),c.jsx(Jt,{className:"activities-feed-sorting-form",fields:[{id:"feed-sorting",label:d.formatMessage({id:"activitiesFeed_sorting_label"}),type:"select",options:h.map(({id:j,label:L})=>({id:j,label:d.formatMessage({id:`activitiesFeed_rankingMethod_${L}`})})),initialValue:m,functions:{onChange:j=>p(j)},gtm:{context:"Community Sorting",event:"community-sorting-click"}}],button:{hideButton:!0},functions:{onCatch:()=>{},onFailure:()=>{},onSuccess:async()=>{},onCancel:()=>{}},id:"activities-feed-sorting-form"}),f==null?void 0:f.map((j,L)=>{var $,R,U;const{id:H,own_reactions:Y,latest_reactions:Q,reaction_counts:re,mentioned_users:C}=j,q=((($=Q==null?void 0:Q.like)==null?void 0:$.length)||0)>0,K=(((R=Y==null?void 0:Y.like)==null?void 0:R.length)||0)>0,E=K?Y==null?void 0:Y.like[0].id:"",T=q?(U=Q==null?void 0:Q.like)==null?void 0:U.map(ae=>{var J,ie,de;return{id:(J=ae==null?void 0:ae.user)==null?void 0:J.id,name:(de=(ie=ae==null?void 0:ae.user)==null?void 0:ie.data)==null?void 0:de.name}}):!1;return c.jsx(y.Fragment,{children:c.jsx(Kr,{content:{type:"post",title:j==null?void 0:j.title,body:j==null?void 0:j.content,canLike:n,createdAt:(j==null?void 0:j.time)||"",slugs:{question:`${e}/${t}`,answer:H},slug:H,author:ci(j==null?void 0:j.actor),userLiked:K,likes:(re==null?void 0:re.like)||0,comments:(re==null?void 0:re.reply)||0,peopleWhoLiked:T,mentions:C,pinned:(re==null?void 0:re.pin)&&(re==null?void 0:re.pin)>0||!1},links:{post:`${e}/${t}/${H}`,comments:`${e}/${t}/${H}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>B({activityId:H}),updateContent:(ae,{body:J})=>w({activityId:H,content:J})},likes:{createLike:()=>S({activityId:H}),deleteLike:()=>z({activityId:H,reactionId:E})},comments:{openComments:()=>null},pins:{createPin:()=>N({activityId:H}),deletePin:()=>I({activityId:H,reactionId:Q==null?void 0:Q.pin[0].id})},mentions:i},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:L===M,userHasOwnerPermissions:r})},H)}),!F&&c.jsx(Ur,{hasNextPage:_,loadNextPage:A,icon:{icon:"arrow-down",position:"right"},messages:{button:d.formatMessage({id:"loadMore_button"}),error:d.formatMessage({id:"loadMore_error"})}}),c.jsx(Lo,{form:l})]})},FE={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 BE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Fc({reply:cE(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=Fc({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,"reply")},0)}});return s}function AE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Za(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function kh({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=Xa(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:zo(u),mutate:qo(u)},user:l,...u},m=BE({...d,mutationFn:e}),p=AE({...d,mutationFn:t}),h=TE({...d,mutationFn:n}),g=jE({...d,mutationFn:a}),f=OE({...d,mutationFn:i}),{replies:b,...v}=SE({queryKey:s,queryFn:r});return{replies:b,mutations:{create:m,edit:p,remove:g,like:h,unlike:f},user:l,...v}}function TE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Za(s,o);return l&&Bc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Za(o,l);u&&Bc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function SE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=RE(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function jE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>IE(a,i)),onError:n});return r}function OE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Za(i,s);return o&&dE({reply:o,user:r}),s}),onError:n});return a}function PE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function NE(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 ME(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?NE(e,t,n):ME(e,t,n):PE(e)}function Za(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function IE(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 RE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const $E=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=se.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:d,isLoading:m,mutations:{create:p,edit:h,like:g,remove:f,unlike:b},user:v}=kh({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:x=>i.list({...x,reactionId:r})}});Zs([m]);const[_,F]=y.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-${_?"up_left":"down_right"}`,position:"left"},onClick:()=>F(!_),children:s.formatMessage({id:`discussion_thread_${_?"hide":"show"}`},{count:l==null?void 0:l.length})}),_&&c.jsx(yh,{loadMore:{isLoading:m,hasNextPage:d,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(x,{body:w})=>p({activityId:n,replyId:r,content:w}),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 Y,Q,re,C,q,K,E;const{id:w,own_children:B,latest_children:S,children_counts:z,data:{mentioned_users:N}}=x,M=(((Y=B==null?void 0:B.like)==null?void 0:Y.length)||0)>0?(Q=B==null?void 0:B.like)==null?void 0:Q.find(T=>{var $;return(($=T==null?void 0:T.user)==null?void 0:$.id)===(v==null?void 0:v.id)}):!1,k=M?M==null?void 0:M.id:"",A=!!M,L=(((re=S==null?void 0:S.like)==null?void 0:re.length)||0)>0?(C=S==null?void 0:S.like)==null?void 0:C.map(T=>{var $,R,U;return{id:($=T==null?void 0:T.user)==null?void 0:$.id,name:(U=(R=T==null?void 0:T.user)==null?void 0:R.data)==null?void 0:U.name}}):!1,H=typeof x.data.content=="string"?(q=x==null?void 0:x.data)==null?void 0:q.content:((E=(K=x==null?void 0:x.data)==null?void 0:K.content)==null?void 0:E.text)||"";return c.jsx(Kr,{isCommunity:!0,content:{id:w,type:"reply",body:H,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:ci(x==null?void 0:x.user),userLiked:A,likes:(z==null?void 0:z.like)||0,peopleWhoLiked:L,mentions:N},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:w}),updateContent:(T,{body:$})=>h({replyId:w,content:$})},likes:{createLike:()=>g({replyId:w}),deleteLike:()=>b({replyId:w,reactionId:k})},comments:{},mentions:{listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback}},styling:{showShareLinkButton:!0}},w)}):null})]})};const Fh=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,mentions:i,join:s,leave:o},profile:l})=>{const u=se.useIntl(),{replies:d,repliesCount:m,fetchNextPage:p,hasNextPage:h,isLoading:g,mutations:{create:f,edit:b,like:v,remove:_,unlike:F},user:x}=kh({queryKey:[e,t,n,"replies"],queryFns:a}),w=()=>{S(d.length),p()},[B,S]=y.useState(null);return Zs([g]),_h(),c.jsxs("section",{className:"replies-feed",children:[c.jsx(bh,{type:"comment",responses:m,isLoading:g}),c.jsx($o,{form:{content:{type:"reply",slugs:{}},functions:{create:(z,{body:N})=>f({activityId:n,content:N}),...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:u.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:s,leave:o,notMemberStateText:u.formatMessage({id:"community_joinToPost"})}}),d==null?void 0:d.map((z,N)=>{var K,E,T,$,R,U,ae;const{id:I,own_children:M,latest_children:k,children_counts:A,data:{mentioned_users:j}}=z,H=(((K=M==null?void 0:M.like)==null?void 0:K.length)||0)>0?(E=M==null?void 0:M.like)==null?void 0:E.find(J=>{var ie;return((ie=J==null?void 0:J.user)==null?void 0:ie.id)===(x==null?void 0:x.id)}):!1,Y=H?H==null?void 0:H.id:"",Q=!!H,C=(((T=k==null?void 0:k.like)==null?void 0:T.length)||0)>0?($=k==null?void 0:k.like)==null?void 0:$.map(J=>{var ie,de,X;return{id:(ie=J==null?void 0:J.user)==null?void 0:ie.id,name:(X=(de=J==null?void 0:J.user)==null?void 0:de.data)==null?void 0:X.name}}):!1,q=typeof z.data.content=="string"?(R=z==null?void 0:z.data)==null?void 0:R.content:((ae=(U=z==null?void 0:z.data)==null?void 0:U.content)==null?void 0:ae.text)||"";return c.jsx(ph,{children:c.jsx(Kr,{isCommunity:!0,content:{id:I,type:"reply",body:q,canLike:r,createdAt:z==null?void 0:z.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:I},slug:I,author:ci(z==null?void 0:z.user),userLiked:Q,likes:(A==null?void 0:A.like)||0,peopleWhoLiked:C,mentions:j},functions:{content:{createContent:()=>null,deleteContent:()=>_({replyId:I}),updateContent:(J,{body:ie})=>b({replyId:I,content:ie})},likes:{createLike:()=>v({replyId:I}),deleteLike:()=>F({replyId:I,reactionId:Y})},comments:{},mentions:i},children:c.jsx($E,{basePath:e,parentId:t,activityId:n,replyId:I,isMember:r,functions:{...a,...i}}),styling:{showShareLinkButton:!0},setFocus:N===B},I)},I)}),!g&&c.jsx(Ur,{hasNextPage:h,loadNextPage:w,icon:{icon:"arrow-down",position:"right"},messages:{button:u.formatMessage({id:"loadMore_button"}),error:u.formatMessage({id:"loadMore_error"})}}),c.jsx(Lo,{form:l})]})};function LE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.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 zE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=qe.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function qE({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=qe.useQueryClient(),l=Xa(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:zo(u),mutate:qo(u)},user:l,...u},m=LE({...d,mutationFn:t}),p=WE({...d,mutationFn:n}),h=UE({...d,mutationFn:r}),g=HE({...d,mutationFn:a}),f=VE({...d,mutationFn:i}),{activity:b,...v}=zE({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:m,like:p,unlike:h,pin:g,unpin:f},user:l,...v}}function WE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Va({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Va({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function UE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&xh({activity:s,user:r}),s)),onError:n});return a}function HE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ka({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ka({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function VE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&wh({activity:s,user:r}),s))),onError:n});return a}const KE=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},reactions:o,mentions:l,join:u,leave:d},profile:m})=>{var A,j,L,H,Y,Q,re;const p=se.useIntl(),{activity:h,error:g,isLoading:f,mutations:{edit:b,like:v,unlike:_,pin:F,unpin:x}}=qE({queryFns:s,queryKey:[e,t,n]});if(f)return c.jsx(Ft,{style:{height:"400px"}});if(g||!h)return c.jsx(fn,{variant:"error",text:p.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:w,latest_reactions:B,mentioned_users:S}=h,z=(((A=B==null?void 0:B.like)==null?void 0:A.length)||0)>0,N=(((j=w==null?void 0:w.like)==null?void 0:j.length)||0)>0,I=N?w==null?void 0:w.like[0].id:"",M=z?(L=B==null?void 0:B.like)==null?void 0:L.map(C=>{var q,K,E;return{id:(q=C==null?void 0:C.user)==null?void 0:q.id,name:(E=(K=C==null?void 0:C.user)==null?void 0:K.data)==null?void 0:E.name}}):!1,k=h==null?void 0:h.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(Kr,{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:ci(k),userLiked:N,likes:((H=h==null?void 0:h.reaction_counts)==null?void 0:H.like)||0,comments:((Y=h==null?void 0:h.reaction_counts)==null?void 0:Y.reply)||0,peopleWhoLiked:M,mentions:S,pinned:((Q=h==null?void 0:h.reaction_counts)==null?void 0:Q.pin)&&((re=h==null?void 0:h.reaction_counts)==null?void 0:re.pin)>0||!1},originalAuthorId:k==null?void 0:k.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(C,{title:q,body:K})=>b({title:q,content:K})},likes:{createLike:()=>v({activityId:n}),deleteLike:()=>_({activityId:n,reactionId:I})},comments:{openComments:()=>{}},pins:{createPin:()=>F({activityId:n}),deletePin:()=>{var C;return x({activityId:n,reactionId:(C=B==null?void 0:B.pin)==null?void 0:C[0].id})}},mentions:l},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a},n),c.jsx(Fh,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:o,mentions:l,join:u,leave:d},profile:m})]})};const Bh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=se.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:m}=n,{title:p="",body:h="",mentions:g}=r||{},f="discussion-form-modal";return c.jsx(mn,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(p!==""||h!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:G("discussion-form-modal",a),children:c.jsx(Vr,{...n,data:{...u,mentions:g||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:h||(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:{...m,onChange:b=>{l(v=>({...v,...b}))},onMention:({id:b,name:v}={})=>{if(!b||!v)return;const _=g||{};_[b]={created_at:"",updated_at:"",id:b,data:{name:v}},l(F=>({...F,mentions:_}))},create:async b=>{o(),m.create&&await m.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),m.handleSaveEdit&&await m.handleSaveEdit(b),l({showCachedText:!1})}}})})},ZE=Object.freeze(Object.defineProperty({__proto__:null,default:Bh},Symbol.toStringTag,{value:"Module"}));const YE=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const d=se.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(mn,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:G("invite-modal",e,{success:!!n}),children:c.jsx(lh,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const di=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=se.useIntl(),[l,u]=y.useState(Jc("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(mn,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:G("profile-modal",s,{success:!!t}),maxWidth:700,children:c.jsxs(c.Fragment,{children:[t&&n||r?c.jsxs("div",{className:"intro",children:[t&&n?c.jsx("h3",{children:n}):"",r?c.jsx("p",{children:r}):""]}):null,c.jsx(ch,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async m=>{var p;try{(p=i==null?void 0:i.functions)!=null&&p.onSuccess&&await i.functions.onSuccess(m)}finally{d()}}}})]})})},GE=Object.freeze(Object.defineProperty({__proto__:null,default:di},Symbol.toStringTag,{value:"Module"}));const QE=({members:e})=>{const[t,n]=y.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return c.jsxs(c.Fragment,{children:[c.jsx(hn,{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(mn,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(kn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const JE=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:G("testimonial-block",a),children:[c.jsx(Lt,{className:"testimonial",children:n}),r?c.jsx(Yt,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:G("author",{"text-small":!a.includes("new")}),children:e}),t&&c.jsx("p",{className:G("author-cite",{"text-small":!a.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),XE=y.memo(JE);const e_=({items:e=[],selector:t="",className:n=""})=>{const r=se.useIntl(),[a,i]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&c.jsxs(jt,{variant:"subtle",className:G("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 fi=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=se.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const m=d/60,p=Math.floor(m),h=(m-p)*60,g=Math.round(h),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:d,ariaText:m}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:m})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:G("time-to-complete",a),"aria-label":u,children:l})};const t_=({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(or,{...n,className:G("banner",e),image:{...t,aspect:"banner"}})):null;const n_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],r_=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],m={eyebrow:"small",title:"h1",text:"p"},p={};d.forEach(b=>{if(!t[b]){p[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){p[b]=t[b];const{text:v,element:_}=t[b];if(_&&n_.includes(_.toLowerCase()))return;p[b]={text:v,element:m[b]};return}p[b]={text:t[b],element:m[b]}}});const h=o&&o.text&&o.link;return h&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),c.jsx(vn,{className:G("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":h,"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(b=>{if(p[b]&&typeof p[b]=="object"){const{text:v,element:_=""}=p[b];return b==="text"?c.jsx(kn,{overrideType:"text-only",className:"text",children:v},b):y.createElement(_,{key:b,className:b},v)}return null}),l,h&&c.jsx(_e,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:G({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&c.jsx(or,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},a_=y.memo(r_);const i_=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(vn,{className:G("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const s_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(kn,{children:n}):n;return c.jsxs(vn,{className:G("highlight-section",t),children:[r&&c.jsx("div",{className:G("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(or,{image:{...r,description:""}})}),c.jsx("div",{className:G("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:G("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:c.jsx("div",{className:"content-default",children:a})})})]})},o_=y.memo(s_);const u_=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:c.jsxs("aside",{className:G("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})]}),l_=({type:e,data:t})=>{const n=se.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const m=a&&gs(a);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):Gs(d)});if(o)return c.jsx(ln,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const m=u&&gs(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})})]})}return null},c_={title:66,text:3e3,secondaryText:1e3,partner:34},Ya={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"}},d_=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const a=se.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:m}=e,p=e.contentType;let h="";if((f=Ya[p])!=null&&f.gtmEvent&&(h=Ya[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":`${h}-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":`${h}-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||((b=e==null?void 0:e.members)==null?void 0:b.isMember),_=async F=>{if(F.preventDefault(),F.stopPropagation(),!(v||!t||!t.onClick)){s(x=>({...x,loading:!0}));try{const x=await t.onClick(e);s(x==="success"?()=>({registered:!0,loading:!1}):w=>({...w,loading:!1}))}catch{s(w=>({...w,loading:!1}))}}};return c.jsx("p",{className:G("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(_e,{onClick:_,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${p}: ${m}`,"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};function f_({buildMemberData:e,communitySlug:t}){const n=se.useIntl(),[r,a]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t).then(i=>{if(!i)return;const{membersCount:s,role:o=""}=i;a({count:s==null?void 0:s.toString(),isMember:!!o,memberType:o})})},[t,e]),c.jsxs("span",{className:"member-information",children:[r.isMember&&c.jsx(ln,{size:"small",variant:"registered",icon:(r==null?void 0:r.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${r.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:r.count})})]})}const Uo=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,setFocus:l=!1})=>{var M,k;const u=se.useIntl(),d=y.useContext(mt),m=!!(d!=null&&d.id),p=y.useRef(null),[h,g]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,m).then(A=>{g({data:A,isLoading:!1})}).catch(()=>g(A=>({...A,isLoading:!1})))},[a,m,n]);const{data:f,isLoading:b}=h;if(b||!f)return c.jsx(Ft,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:v}=f;if(!v||!Ya[v])return c.jsx(Ft,{element:"li",className:"card-wrapper"});const{basePath:_="",className:F,length:x,gtmEvent:w}=Ya[v];let B=f.slug?`${_}${f.slug}`:!1;f.slug&&(f.slug.slice(0,4)==="http"||f.slug.slice(0,2)==="//"||f.slug.slice(0,6)==="mailto"||f.slug.slice(0,3)==="tel")&&(B=f.slug);const S=A=>{B&&(A.preventDefault(),A.stopPropagation(),window.location.href=B)},z={...c_,...x};let N={className:"card"},I={};return B&&(I={href:B,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${w}-click`,"data-testid":"link"},f.openInNewTab&&(I.target="_blank"),N={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${w}-click`}),l&&(N={...N,tabIndex:"0"},(M=p==null?void 0:p.current)==null||M.focus(),(k=p==null?void 0:p.current)==null||k.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:G("card-wrapper text-medium",F,t,{"has-link":B,"no-link":!B,"has-image":f.banner}),"data-testid":`${v}-card`,children:c.jsxs("div",{...N,ref:p,children:[c.jsx(ed,{className:"card-label",contentType:v,customIcon:f.isPrivate?"lock-locked":f.customIcon,customLabel:f.customLabel}),v==="communityPage"&&(f==null?void 0:f.createdAt)&&em(f==null?void 0:f.createdAt,60)&&c.jsx(ln,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),f.startDate&&!f.isOngoingEvent&&c.jsx(ln,{size:"small",variant:f.dateHasPassed?"default":"information","data-testid":"date",children:f.dateHasPassed?u.formatMessage({id:"card_ended"}):Zc(f.startDate)}),f.banner?c.jsxs("p",{className:"img",children:[f.registered&&c.jsx(ln,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(or,{image:{...f.banner,description:""}})]}):F==="people"?c.jsx(hn,{name:f.title||"",src:f.profile,"data-testid":"people-profile-picture"}):null,f.contributors&&c.jsx(no,{contributors:{data:f.contributors},styling:{size:"small",showGap:F!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(v)?u.formatMessage({id:`card_contributors_${v}`}):void 0,"data-testid":"contributors"}),f.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:f.partner.length>1?u.formatMessage({id:"card_partner"},{partner:f.partner[0],number:f.partner.length-1}):Jn(f.partner[0],z.partner)}),["title","text","secondaryText"].map(A=>{const j=f[A];if(!j)return null;const L=Wc(A),H={key:A,className:L,"data-testid":L},Y={wrapper:"p",forceWrapper:!0,forceInline:!0},Q=Jn(j,z[A]);return["title","text"].includes(A)&&B?(Y.wrapper="a",c.jsx("p",{...H,children:c.jsx(Lt,{options:Y,...I,children:Q})})):c.jsx(Lt,{options:Y,...H,children:Q})}),a.contentType==="communityPage"&&(a.slug||f.slug)&&r&&c.jsx(f_,{communitySlug:a.slug||f.slug,buildMemberData:r}),c.jsx(l_,{type:F||"",data:f}),c.jsx(d_,{data:f,cta:i,link:B||"",gtmContext:s})]})})};const Ah=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:G("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return c.jsx(Uo,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),h_=(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},m_=({id:e,title:t})=>{const n=se.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:G("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 fs={fourCards:1024,threeCards:769,twoCards:480};let ga=null;const p_=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=se.useIntl(),[u,d]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:m,isLoading:p}=u,[h,g]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:f,loadedPages:b}=h,[v,_]=y.useState(""),F=t.length,x=Math.ceil(F/m),w=y.useRef(null),B=On(!0,!0,w==null?void 0:w.current);y.useEffect(()=>{let k=1;B&&(B>=fs.fourCards?k=4:B>=fs.threeCards?k=3:B>=fs.twoCards&&(k=2),k>F&&(k=F)),d(A=>({...A,cardsPerPage:k,isLoading:!1}))},[B,F]);const S=(k="next")=>{let A=f;if(typeof k=="string")if(k==="next")if(f<x-1)A=f+1;else return;else if(f>0)A=f-1;else return;else A=k;g(L=>({...L,currentPage:A,loadedPages:[...new Set([...b,A])]}));const j=()=>{const L=A*u.cardsPerPage,H=L+u.cardsPerPage;return t.slice(L,H).length};_(l.formatMessage({id:"carousel_pagination_aria_live"},{direction:k,count:j()}))},z=k=>{ga=k.touches[0].clientX},N=k=>{if(ga===null)return;const A=k.touches[0].clientX,j=ga-A;j>5?S("next"):j<-5&&S("previous"),ga=null},I={"--width":`${B||0}px`,"--total-cards":F,"--cards-per-page":m,"--page":f};if(p)return c.jsx(Js,{layout:`carousel${a?"-with-title":""}`});const M=(k,A)=>{var L;let j=null;return(L=k==null?void 0:k.sys)!=null&&L.id?j=`card-${k.sys.id}`:k!=null&&k.slug?j=`card-${k.slug}`:[n[A],k.contentType].includes("customCard")&&(j=`card-${window.btoa(`${k.title} ${k.createdAt}`)}-${A}`),j};return c.jsxs("section",{ref:w,className:G("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(m_,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:z,onTouchMove:N,style:I,"data-testid":"carousel-list",children:t.map((k,A)=>{let j=M(k,A);return j&&h_(A,m,f,b)?c.jsx(Uo,{id:j,card:{...k,contentType:n[A]},buildCardData:r,gtmContext:s,...o},j):(j=j||`${e}-card-${A}`,c.jsx(Ft,{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:k=>{k.preventDefault(),k.stopPropagation(),S("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:f<=0})}),[...Array(x)].map((k,A)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:G("page-indicator",{selected:A===f}),onClick:j=>{j.preventDefault(),j.stopPropagation(),S(A)},children:c.jsx(Ie,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:A+1,total:x})})})},`page-indicator-${A}`)),c.jsx("li",{className:"arrow next",children:c.jsx(_e,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:k=>{k.preventDefault(),k.stopPropagation(),S("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:f>=x-1})})]}),c.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:v})]})]})},g_=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=i?window.btoa(i):`carousel-${u}`,m=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(Js,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:c.jsx(qt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(p_,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),m?null:c.jsx(qt,{})]},`carousel-${d}`)});const v_=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=se.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return y.createElement(e,{className:G("course-progression",o,{"highlight-percentage":d,"has-circle-graph":i==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:m=>c.jsx("strong",{children:m}),number:u})}),u<100&&a&&c.jsx(fi,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(Qs,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Th=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>y.createElement(e,{className:G("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Sh=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=se.useIntl(),o=Qa(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Hc(a||"");return c.jsxs("small",{className:G("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:G("type",n),children:o})," ",t>0&&!r&&c.jsx(fi,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const b_=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const m=se.useIntl(),p="courseStructure_",h=u.toLowerCase().includes("course conclusion");return c.jsxs(Ja,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[m.formatMessage({id:`${p}section${h?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?m.formatMessage({id:`${p}time_completed`}):c.jsx(fi,{time:s,appendedText:a?m.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:f,contentType:b,icon:v,image:_,isIntroduction:F,optional:x,slug:w,subsectionId:B,title:S,type:z})=>{const N=a&&t||F,I={};return _&&(I.style={"--image":`url(${_})`}),c.jsx("li",{className:G({article:b===yr.ARTICLE,discussion:b===yr.DISCUSSION,quiz:b===yr.QUIZ,completed:g&&b===yr.ARTICLE,locked:!N}),...I,children:c.jsx(dn,{href:N?`/microcourses/en/${o}/${w}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Uc(S)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(Th,{sectionId:i,subsectionId:B,title:S,className:"course-title"})," ",c.jsx(Sh,{completionTime:f,icon:v,optional:x,type:z,children:d&&d[w]&&c.jsx("span",{className:"quiz-score",children:`${d[w]}%`})})]})})},w)})})]})};const y_=({isComplete:e=!1,onClick:t,...n})=>{const r=se.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:G("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},D_=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),jc=[{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 va="notFoundError_",C_=()=>{const e=se.useIntl(),t=[];return jc.forEach((n,r)=>{n.title=e.formatMessage({id:`${va}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(mh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(vn,{children:[c.jsx(Ah,{cards:jc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(_e,{href:"/solution-articles/",children:e.formatMessage({id:`${va}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${va}title`})}),c.jsx("p",{children:e.formatMessage({id:`${va}text`})})]})};exports.ASSETS_BUCKET=zt;exports.ActivitiesFeed=kE;exports.ActivitySection=KE;exports.AddPost=$o;exports.Banner=t_;exports.BannerSection=a_;exports.Breadcrumbs=Rp;exports.Buckets=gm;exports.Button=_e;exports.ButtonWrapper=sr;exports.COURSE_CONTENT_TYPES=yr;exports.CacheProvider=od;exports.Card=Uo;exports.CardBlock=Ah;exports.Carousel=g_;exports.CharacterLimit=uo;exports.CollapsibleSection=Ja;exports.Columns=Bd;exports.CommunityDetails=Ip;exports.ContactFooter=$w;exports.ContactForm=uh;exports.ContentTypeLabel=ed;exports.Contributors=no;exports.ConversationContext=li;exports.CookieBanner=hh;exports.CourseProgression=v_;exports.CourseStructure=b_;exports.CustomContentBanner=i_;exports.CustomEvents=Xe;exports.DELETED_USER_ID=Tr;exports.Directory=QE;exports.DiscussionConversation=ph;exports.DiscussionForm=Vr;exports.DiscussionFormCard=vh;exports.DiscussionFormModal=Bh;exports.DiscussionLikes=gh;exports.DiscussionPost=Kr;exports.DiscussionThread=yh;exports.Divider=qt;exports.DownloadSection=Nw;exports.EMAILS=Wn;exports.EditSection=Iw;exports.EmailHelperTextBox=Td;exports.EmptyStateBox=fn;exports.FeatureFlags=Xs;exports.Filters=$p;exports.FlagsProvider=ld;exports.Footer=Mo;exports.Form=Jt;exports.Formatting=Z;exports.Fragment=wt;exports.FullWidthSection=vn;exports.GET_STREAM_USER_PREFIX=ps;exports.GlobalProviders=Nm;exports.Header=Io;exports.HelperTextBox=nd;exports.HiddenFromScreenReaders=Ga;exports.HideShowTextBox=rd;exports.HighlightSection=o_;exports.HighlightedTextBox=jt;exports.INVALID_TOKEN=Vc;exports.IconBulletedList=ym;exports.ImageContainer=fm;exports.IntlProvider=cd;exports.InviteForm=lh;exports.InviteModal=YE;exports.JoinButton=so;exports.LanguageContext=eo;exports.LanguageSwitcher=zp;exports.LessonName=Th;exports.LessonType=Sh;exports.Link=dn;exports.LoadMore=Ur;exports.LoadingBlock=Tm;exports.LoadingPlaceholder=Ft;exports.LoadingState=Js;exports.Logo=oo;exports.LogoSection=Rw;exports.MENTION_REGEX=Kc;exports.MarkCompleteButton=y_;exports.MarkdownText=kn;exports.MarketingBlock=u_;exports.Marks=$t;exports.Member=Yt;exports.MembersList=Hw;exports.Modal=ro;exports.MoreMenu=kd;exports.NUMBER_OF_COUNTRIES=Qh;exports.NUMBER_OF_USERS=Gh;exports.NavigationMenu=Fd;exports.NotFoundError=C_;exports.Overlay=mn;exports.OverlayContext=to;exports.OverlayProvider=hd;exports.PageHeading=ad;exports.PageLayout=mh;exports.PasswordForm=Bw;exports.PasswordRules=Nd;exports.Pill=ln;exports.Popover=Xc;exports.Portal=Wr;exports.ProfileForm=ch;exports.ProfileImageChange=oh;exports.ProfileModal=di;exports.ProfileModalLauncher=Lo;exports.ProfilePicture=hn;exports.ProgressBar=Qs;exports.ProgressTracker=mm;exports.Rating=sg;exports.RepliesFeed=Fh;exports.ResponsesHeading=bh;exports.ResponsiveImage=or;exports.ReturnToNavButton=pm;exports.RichTextEditor=sh;exports.SearchForm=dh;exports.ShareLinks=Kp;exports.SignupForm=Pw;exports.Span=ys;exports.StatusBanner=jr;exports.TableOfContents=e_;exports.Tabs=Zp;exports.Tags=Uw;exports.TestimonialBlock=XE;exports.TimeToComplete=fi;exports.Toggle=Fw;exports.Tooltip=Pn;exports.TopLevelPage=Lw;exports.UUID_V4_REGEX=Sr;exports.UserContext=mt;exports.UserProvider=dd;exports.VisuallyHidden=Ie;exports.addAriaProps=_d;exports.basicReducer=qr;exports.camelCaseToDashCase=Wc;exports.checkIntlPathExists=Qa;exports.generateConditions=Ba;exports.generateCssIcon=Jh;exports.getCharacterLimitProps=Ad;exports.getLongDate=Gs;exports.getMember=ei;exports.getPostBody=Ro;exports.getShortDate=Zc;exports.getValueLength=ti;exports.headerData=zr;exports.mapGetStreamData=D_;exports.pageReady=Yc;exports.passwordValidator=vs;exports.repliesFeedMock=FE;exports.supportedLanguages=Da;exports.toCamelCase=Uc;exports.toCapitalisedCase=Yh;exports.toSentenceCase=Hc;exports.useCurrentPath=Ic;exports.useEffectAfterMount=Xn;exports.useElementWidth=On;exports.useOverlay=fd;exports.useScrollListener=Lc;exports.useScrollToHash=Zs;exports.useTooltips=Ys;exports.useUser=Xa;
165
+ `;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await Jc({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const sE=3e3,oE=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=se.useIntl(),[r,a]=y.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{children:[c.jsx(Mn,{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(Va,{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})},sE)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event})]})},Nt="discussion_",uE=195;let ga=null;const Zr=({element:e="div",content:t,userHasPermissions:n=!0,userHasOwnerPermissions:r=!1,isLoading:a=!1,originalAuthorId:i,forceHide:s={actionBar:!1,comments:!1,likes:!1},functions:o,links:l={},className:u,gtmContext:d="DiscussionAnswer",children:m,isTruncated:p=!1,styling:{showShareLinkButton:h=!1}={},setFocus:g=!1,isCommunity:f=!1,badges:b})=>{var Ve,We,Be,Se,De,Ie,ze,K;const v=se.useIntl(),E=y.useContext(gt),B=y.useContext(ci),{createContent:_=async()=>{},deleteContent:x=async()=>{},updateContent:T=async()=>{}}=o.content||{},{createLike:S=()=>{},deleteLike:$=()=>{}}=o.likes||{},{openComments:M=()=>{}}=o.comments||{},{listMembers:N=()=>Promise.resolve([]),clickMentionFallback:q=()=>{}}=o.mentions||{},{author:w,canLike:A,createdAt:j,id:L,likes:U=0,userLiked:Z,comments:G=0,mentions:ae}=t,C=E&&E.id&&typeof w!="string"&&w.id&&w.id===E.id||!1,z=typeof A=="boolean"?A:!0,Q=C&&(!t.createdAt||rm(t.createdAt,10,"seconds")),k=y.useRef(null),[F,R]=y.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[I,W]=y.useState(!1),[re,ee]=y.useState(Q?"highlighted":"default"),[ie,fe]=y.useState("");y.useEffect(()=>{const te=k.current;if(!(!te||re==="default"))return document.addEventListener(Xe.DISCUSSION_FORM_SUBMITTED,X),te.addEventListener("transitionend",ve),()=>{document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,X),te.removeEventListener("transitionend",ve)}},[]),y.useEffect(()=>{R({...F,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),y.useEffect(()=>{(async()=>{const le=await Lo(F.body,p,ae,N);R({...F,postBody:le})})()},[F.body,ae]);const X=()=>{setTimeout(()=>{ee("fading")},1e3)},ve=({propertyName:te})=>{te==="background-color"&&ee(le=>(le==="default"&&(document.removeEventListener(Xe.DISCUSSION_FORM_SUBMITTED,X),k.current&&k.current.removeEventListener("transitionend",ve)),le==="fading"?"default":le))};if(a||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||F.postBody===""&&t.title==="")return c.jsx(Bt,{className:"discussion-card"});const pe=async({title:te,body:le})=>{te||(te=""),le||(le=""),fe("");try{if(!ms(te,F.title)||!ms(le,F.body)){const me=t.type==="question"?{title:le}:{title:te,body:le};await T(Fc(t.slugs),me)}R({...F,title:te,body:le,isEditing:!1,didEdit:!0})}catch{fe(`${Nt}form_error`)}},_e=()=>{if(B&&B.updateConversation){const te={showForm:!0},le=t.author;le&&le.id&&(f&&(te.prepopulateForm=`@{{${le.id}}}`),te.mentionData={id:le.id,name:le.name}),B.updateConversation(te)}setTimeout(()=>{var Ze,Ye,rt;const le=`reply-form-${(t.type==="answer"?t.slug:((Ze=t.slugs)==null?void 0:Ze.reply)||((Ye=t.slugs)==null?void 0:Ye.answer)||((rt=t.slugs)==null?void 0:rt.question)||"").toLowerCase().slice(-15)}`,me=document.getElementById(le),xe=document.getElementById(`${le}-input`);xe&&xe.focus(),me&&me.scrollIntoView({behavior:"smooth"})},0)},Fe=async()=>{W(!1);try{await x(Fc(t.slugs))}catch{fe("delete-error")}},Te=[{text:v.formatMessage({id:`${Nt}moreMenu_report`}),onClick:te=>{te.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(v.formatMessage({id:`${Nt}report_subject`}))}&body=${encodeURI(v.formatMessage({id:`${Nt}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&&C&&Te.push({text:v.formatMessage({id:`${Nt}moreMenu_edit`}),onClick:()=>R({...F,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`},{text:v.formatMessage({id:`${Nt}moreMenu_delete`}),onClick:te=>{te.preventDefault(),te.stopPropagation(),W(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`delete-${t.type}-click`,...Ad(`delete-${t.slug}-modal`,I)}),r&&o.pins&&Te.push({text:v.formatMessage({id:`${Nt}moreMenu_${t.pinned?"unpin":"pin"}`}),onClick:t.pinned?o.pins.deletePin:o.pins.createPin,icon:t.pinned?"unpin":"pin",className:"gtm-trackable","data-gtm-event-context":d,"data-gtm-event-type":`edit-${t.type}-click`}),g&&((Ve=k==null?void 0:k.current)==null||Ve.focus(),(We=k==null?void 0:k.current)==null||We.scrollIntoView({behavior:"smooth"})),y.createElement(e,{className:Y("discussion-post",u,{[re]:!u||!u.includes("highlighted-text-box"),"has-link":l.post&&!F.isEditing,"is-pinned":(t==null?void 0:t.pinned)||!1}),ref:k,tabIndex:g?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${d}-post-click`,onClick:te=>{if(!l.post||F.isEditing)return;te.preventDefault(),te.stopPropagation(),ga&&clearTimeout(ga),ga=setTimeout(()=>{window.location.href=l.post},150);const le=new CustomEvent(Xe.DISCUSSION_POST_CLICKED,{detail:{link:l.post,timeout:ga}});document.dispatchEvent(le)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:L||t.slug,className:Y("discussion-card",t.type,{editing:F.isEditing,"has-link":l.post&&!F.isEditing}),children:[!F.isEditing&&c.jsxs("div",{className:"author-section",children:[c.jsx(Qt,{member:w,additionalContent:{createdAt:j,didEdit:F.didEdit},className:typeof w!="string"&&w.id===i?"highlighted":"",gtmContext:d,gtmType:"profile-click",badges:b}),t.pinned&&c.jsx(Gt,{variant:"naked",size:"xlarge",icon:"pin",children:c.jsx(Ne,{children:"Pinned Post"})})]}),F.isEditing?c.jsx(Kr,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:a,isInWrapper:!0,hasTitleField:F.title!==""?{text:F.title}:!1,isEditing:{text:F.body},isPrepopulated:!1},isCommunity:f,maxLength:t.type==="question"?250:5e4,forceShow:{error:ie!==""&&ie!=="delete-error"?v.formatMessage({id:ie},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:_,handleSaveEdit:pe,handleCancel:()=>{fe(""),R({...F,isEditing:!1})},listMembers:N,clickMentionFallback:q},gtmContext:`${d}Form`,data:{mentions:t.mentions}}):l.post?c.jsxs("a",{href:l.post,children:[(F==null?void 0:F.title)&&c.jsx("p",{className:"content-title",children:F==null?void 0:F.title}),F.postBody.length>uE?c.jsx(id,{text:F.postBody,markdownOptions:{overrides:{a:Ds,blockquote:{component:cs}}}}):c.jsx(Fn,{options:{overrides:{a:Ds,blockquote:{component:cs}}},children:F.postBody})]}):c.jsxs(c.Fragment,{children:[(F==null?void 0:F.title)&&c.jsx("p",{className:"content-title",children:F==null?void 0:F.title}),c.jsx(Fn,{options:{wrapper:t.type==="question"?"h1":y.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:cs}}},children:F.postBody})]}),!F.isEditing&&!(s!=null&&s.actionBar)&&c.jsxs("ul",{className:Y("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!s.likes&&c.jsx(Dh,{element:"li",likes:U,isShort:!1,userLiked:Z,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:z,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:S,deleteLike:$}}),!s.comments&&(["question","post"].includes(t.type)||l.comments)&&c.jsx("li",{children:c.jsx(Va,{onClick:te=>{te.preventDefault(),te.stopPropagation(),l.comments&&(window.location.href=l.comments),typeof M=="function"&&M()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":d,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:v.formatMessage({id:`${Nt}comments_screenReader`},{count:G}),children:v.formatMessage({id:`${Nt}comments`},{count:G})})}),(t.type==="answer"||t.type==="reply")&&c.jsx("li",{children:c.jsx(Va,{styling:{muted:!0},onClick:_e,icon:{icon:"speech-bubble_square"},children:v.formatMessage({id:`${Nt}reply`})})}),h&&c.jsx(oE,{url:(Be=t.slugs)!=null&&Be.reply?`${window.location.origin}${(Se=t.slugs)==null?void 0:Se.question}/${(De=t.slugs)==null?void 0:De.answer}#${(Ie=t.slugs)==null?void 0:Ie.reply}`:`${window.location.origin}${(ze=t.slugs)==null?void 0:ze.question}/${(K=t.slugs)==null?void 0:K.answer}`,gtm:{context:d,event:`copy-link-${t.type}-click`}}),c.jsx(Td,{element:"li",id:`more-${t.slug}`,options:Te})]})]}),m,c.jsx(pn,{id:`delete-${t.slug}-modal`,isOpen:I,functions:{onOpen:()=>{},onClose:()=>W(!1)},forceShow:{error:ie==="delete-error"?v.formatMessage({id:"discussion_delete_error"},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:v.formatMessage({id:"discussion_delete_title"},{action:v.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>W(!1),children:v.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:Fe,children:v.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:c.jsx(se.FormattedMessage,{id:"discussion_delete_text",values:{p:te=>c.jsx("p",{children:te}),action:v.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const lE=y.lazy(()=>Promise.resolve().then(()=>t_)),cE=65,Ch=({forceShow:e,form:t,className:n})=>{const r=se.useIntl(),a="discussionFormCard_",i="DiscardDraftModal",o=y.useContext(gt)||"community",l=ti(o);l.name||(l.name=r.formatMessage({id:`member_${typeof o=="string"?o:"community"}`}));const{modal:u=!1}=e||{},[d,m]=y.useState({form:u||ed("showPost")==="true"||!1,warning:!1}),[p,h]=y.useState({showCachedText:!1});y.useEffect(()=>{if(!p.showCachedText)return;(async()=>{const v=await Lo(p.title||p.body||"",cE,p.mentions);h(E=>({...E,prettifiedText:v}))})()},[p.showCachedText,p.title,p.body]);const g=b=>{if(!p.showCachedText||typeof d.warning=="string")return;let v;if("detail"in b&&b.detail.link)b.detail.timeout&&clearTimeout(b.detail.timeout),v=b.detail.link;else{const E=b;E.preventDefault(),E.stopPropagation();const _=E.target.closest("a");v=_&&_.getAttribute("href")}m(E=>({...E,warning:v||!1}))};y.useEffect(()=>{if(!p.showCachedText){document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g);return}return document.addEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.addEventListener(Xe.MEMBER_CLICKED,g),document.addEventListener("click",g),()=>{document.removeEventListener(Xe.DISCUSSION_POST_CLICKED,g),document.removeEventListener(Xe.MEMBER_CLICKED,g),document.removeEventListener("click",g)}},[p.showCachedText]),y.useEffect(()=>{const b=v=>{if(!(!p.showCachedText||d.warning!==!1))return v.preventDefault(),v.returnValue=""};return window.addEventListener("beforeunload",b,{capture:!0}),()=>{window.removeEventListener("beforeunload",b,{capture:!0})}},[p.showCachedText,d.warning]);let f=r.formatMessage({id:`${a}placeholder`});return p.showCachedText&&(p.title||p.body)&&(f=p.prettifiedText||f),c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:Y("discussion-form-card",n),onClick:b=>{b.preventDefault(),b.stopPropagation(),m(v=>({...v,form:!0}))},"data-testid":"discussion-form-card",children:[c.jsx(mn,{name:l.name,src:l.image,alt:""}),c.jsx(Fn,{className:Y("input",{placeholder:!p.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:Et,blockquote:Et,br:Et,em:Et,li:Et,ol:Et,p:Et,s:Et,span:Et,strong:Et,ul:Et}},children:f})]}),c.jsxs(Ur,{children:[c.jsx(lE,{showModal:d.form,functions:{cacheText:h,onClose:()=>{m(b=>({...b,form:!1}))}},form:t,cachedText:p,className:"in-portal"}),c.jsx(pn,{id:t.id?`${t.id}-warning`:"discussion-form-card-warning",className:"in-portal",isOpen:d.warning!==!1,functions:{onClose:()=>{m(b=>({...b,warning:!1}))}},title:r.formatMessage({id:`${a}overlay_title`}),buttons:[{variant:"secondary",children:r.formatMessage({id:`${a}overlay_cta_discard`}),onClick:b=>{b.preventDefault(),b.stopPropagation(),typeof d.warning=="string"&&(window.location.href=d.warning)},"data-gtm-event-type":"discard-click","data-gtm-event-context":i},{variant:"primary",children:r.formatMessage({id:`${a}overlay_cta_continue`}),onClick:()=>{m({form:!0,warning:!1})},"data-gtm-event-type":"continue-editing-click","data-gtm-event-context":i}],children:c.jsx("p",{children:r.formatMessage({id:`${a}overlay_text`})})})]})]})},dE=y.lazy(()=>Promise.resolve().then(()=>nE)),zo=({isCard:e=!1,form:t,parentId:n,membershipRequiredToPost:{isMember:r,required:a,join:i,leave:s,notMemberStateText:o}})=>{if(a&&!r)return c.jsx(hn,{text:o,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(uo,{isShort:!0,functions:{join:i,leave:s}})}});const{content:l,functions:u,meta:d,...m}=t,p={content:{type:(l==null?void 0:l.type)||"reply",slugs:(l==null?void 0:l.slugs)||{}},functions:{...u,create:(u==null?void 0:u.create)||(()=>{})},parentId:n,meta:{...d,isEditing:(d==null?void 0:d.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1},...m,id:`add-post-${m.id||""}`};return e?c.jsx(Ch,{form:p}):c.jsx(dE,{...p})},qo=({form:e})=>{const t=y.useContext(gt),n=se.useIntl(),[r,a]=y.useState(!1),i=()=>{fm(t)||a(!0)};y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,i),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,i)}));const s={};return["successMessage","title","text"].forEach(o=>{s[o]=n.formatMessage({id:`profileModalLauncher_${o}`})}),c.jsx(fi,{form:e,showModal:r,functions:{onClose:()=>{a(!1)}},content:s})};const ds="discussion_responses_",xh=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=se.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${ds}title`},{action:r.formatMessage({id:`${ds}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:Tt(r.formatMessage,`${ds}empty`,e,e)})]})};const wh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=se.useIntl(),s=y.useContext(ci),o=Da(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(Hr,{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(Kr,{...r})]})},fE="post",hE="reply",Eh="00000000-0000-0000-0000-000000000000";function Wo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Uo({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 mE(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function pE(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function _h(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 gE({title:e,content:t}){return{title:e,content:t,id:Eh,time:new Date().toISOString(),verb:fE}}function Bc({activity:e,user:t}){return{...e,actor:_h(t),...mE()}}function Ka({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 kh({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 Za({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},pin:[...((r=e.latest_reactions)==null?void 0:r.pin)||[],t]},e.own_reactions={...e.own_reactions||{},pin:[...((a=e.own_reactions)==null?void 0:a.pin)||[],t]}):e.reaction_counts={...e.reaction_counts||{},pin:(n=e.reaction_counts)!=null&&n.pin?e.reaction_counts.pin+1:1}}function Fh({activity:e}){var t;e.reaction_counts={...e.reaction_counts||{},pin:(t=e.reaction_counts)!=null&&t.pin?e.reaction_counts.pin-1:0},e.latest_reactions={...e.latest_reactions||{},pin:[]},e.own_reactions={...e.own_reactions||{},pin:[]}}function vE({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Eh,kind:hE,parent:t||""}}function Ac({reply:e,user:t}){const n=_h(t);return{...e,user_id:n.id,user:n,...pE()}}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 bE({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 Bh=(e,t)=>{const n=new CustomEvent(Xe.DISCUSSION_POST_ADDED,{detail:{id:e,type:t}});document.dispatchEvent(n)};let Sc,fs=0;const Ah=()=>{y.useEffect(()=>(document.addEventListener(Xe.DISCUSSION_POST_ADDED,e),()=>{document.removeEventListener(Xe.DISCUSSION_POST_ADDED,e)}),[]);const e=t=>{const{id:n,type:r}=t.detail;if(!n||!r||r==="activity")return;clearTimeout(Sc);const a=document.getElementById(n);if(a){a.scrollIntoView({behavior:"smooth",block:"start"}),fs=0;return}fs++,!(fs>10)&&(Sc=setTimeout(()=>{e(t)},50))}},ir=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}),Ut=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}),Ho=Object.freeze({actor:`SU:${ir.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"}),yE=Object.freeze({actor:`SU:${Ut.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"}),DE=Object.freeze({actor:`SU:${ir.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"}),CE=Object.freeze({actor:`SU:${Ut.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:Ho.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Ut.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Ut.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({id:"some-reaction-id-1",activity_id:Ho.id,kind:"pin",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Ut.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Ut.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:Ut.id,user:{id:Ut.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Ho.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:ir.id,user:{id:ir.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:yE.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:Ut.id,user:{id:Ut.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:DE.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:ir.id,user:{id:ir.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:CE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function xE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Bc({activity:gE(o),user:i});return jc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=Bc({activity:o,user:i});r.setQueryData(a,jc(d,u,!0)),setTimeout(()=>{Bh(d.id,"activity")},0)}});return s}function wE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=jn(a,s);return o&&(o.content=i),s}),onError:n});return r}function EE({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i,pin:s,unpin:o},queryKey:l,rankingMethod:u}){const d=qe.useQueryClient(),m=ei(),p={queryClient:d,queryKey:l},h={mutationHandlers:{error:Wo(p),mutate:Uo(p)},user:m,...p},g=xE({...h,mutationFn:e}),f=wE({...h,mutationFn:t}),b=_E({...h,mutationFn:n}),v=BE({...h,mutationFn:a}),E=AE({...h,mutationFn:i}),B=FE({...h,mutationFn:s}),_=TE({...h,mutationFn:o}),{activities:x,...T}=kE({queryKey:l,queryFn:r,rankingMethod:u});return{activities:x,mutations:{create:g,edit:f,remove:v,like:b,unlike:E,pin:B,unpin:_},user:m,...T}}function _E({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=jn(s,o);return l&&Ka({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=jn(o,l);u&&Ka({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function kE({queryFn:e,queryKey:t,rankingMethod:n}){const{data:r,error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}=qe.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:jE(r),error:a,isLoading:i,hasNextPage:s,fetchNextPage:o}}function FE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=jn(s,o);return l&&Za({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=jn(o,l);u&&Za({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function BE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>SE(a,i)),onError:n});return r}function AE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=jn(i,s);return o&&kh({activity:o,user:r}),s}),onError:n});return a}function TE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=jn(i,s);return o&&Fh({activity:o,user:r}),s}),onError:n});return a}function jc(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 jn(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function SE(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 jE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const OE=({basePath:e,parentId:t,isMember:n,isOwner:r,functions:{activities:a,mentions:i,join:s,leave:o},profile:l})=>{const u=Rm(to.COMMUNITY_RANKING),d=se.useIntl(),[m,p]=y.useState("community_feed_live"),[h,g]=y.useState([{id:"recent_with_pin",label:"recent"},{id:"community_feed_live",label:"popular"}]),{activities:f,error:b,fetchNextPage:v,hasNextPage:E,isLoading:B,mutations:{create:_,edit:x,remove:T,like:S,unlike:$,pin:M,unpin:N}}=EE({queryKey:[e,t,"activities",m],queryFns:a,rankingMethod:m});y.useEffect(()=>{u&&g(h.concat(u))},[u]);const[q,w]=y.useState(null),A=()=>{w(f.length),v()};return Ah(),b?c.jsx(hn,{variant:"error",text:b.message}):c.jsxs("section",{children:[c.jsx(zo,{isCard:!0,parentId:t,form:{content:{type:"post",slugs:{}},functions:{create:_,...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:s,leave:o,notMemberStateText:d.formatMessage({id:"community_joinToPost"})}}),c.jsx(en,{className:"activities-feed-sorting-form",fields:[{id:"feed-sorting",label:d.formatMessage({id:"activitiesFeed_sorting_label"}),type:"select",options:h.map(({id:j,label:L})=>({id:j,label:d.formatMessage({id:`activitiesFeed_rankingMethod_${L}`})})),initialValue:m,functions:{onChange:j=>p(j)},gtm:{context:"Community Sorting",event:"community-sorting-click"}}],button:{hideButton:!0},functions:{onCatch:()=>{},onFailure:()=>{},onSuccess:async()=>{},onCancel:()=>{}},id:"activities-feed-sorting-form"}),f==null?void 0:f.map((j,L)=>{var R,I,W;const{id:U,own_reactions:Z,latest_reactions:G,reaction_counts:ae,mentioned_users:C}=j,z=(((R=G==null?void 0:G.like)==null?void 0:R.length)||0)>0,Q=(((I=Z==null?void 0:Z.like)==null?void 0:I.length)||0)>0,k=Q?Z==null?void 0:Z.like[0].id:"",F=z?(W=G==null?void 0:G.like)==null?void 0:W.map(re=>{var ee,ie,fe;return{id:(ee=re==null?void 0:re.user)==null?void 0:ee.id,name:(fe=(ie=re==null?void 0:re.user)==null?void 0:ie.data)==null?void 0:fe.name}}):!1;return c.jsx(y.Fragment,{children:c.jsx(Zr,{content:{type:"post",title:j==null?void 0:j.title,body:j==null?void 0:j.content,canLike:n,createdAt:(j==null?void 0:j.time)||"",slugs:{question:`${e}/${t}`,answer:U},slug:U,author:di(j==null?void 0:j.actor),userLiked:Q,likes:(ae==null?void 0:ae.like)||0,comments:(ae==null?void 0:ae.reply)||0,peopleWhoLiked:F,mentions:C,pinned:(ae==null?void 0:ae.pin)&&(ae==null?void 0:ae.pin)>0||!1},links:{post:`${e}/${t}/${U}`,comments:`${e}/${t}/${U}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>T({activityId:U}),updateContent:(re,{body:ee})=>x({activityId:U,content:ee})},likes:{createLike:()=>S({activityId:U}),deleteLike:()=>$({activityId:U,reactionId:k})},comments:{openComments:()=>null},pins:{createPin:()=>M({activityId:U}),deletePin:()=>N({activityId:U,reactionId:G==null?void 0:G.pin[0].id})},mentions:i},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:L===q,userHasOwnerPermissions:r,badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:t||""},{scope:ct.PLATFORM,area:"all"}]}})},U)}),!B&&c.jsx(Hr,{hasNextPage:E,loadNextPage:A,icon:{icon:"arrow-down",position:"right"},messages:{button:d.formatMessage({id:"loadMore_button"}),error:d.formatMessage({id:"loadMore_error"})}}),c.jsx(qo,{form:l})]})},PE={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester",badges:{communities:{"community-slug":["orange-badge","badge-with-heart"]}}}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function ME({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Ac({reply:vE(o),user:i});return Oc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const d=Ac({reply:o,user:i});r.setQueryData(a,Oc(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Bh(d.id,"reply")},0)}});return s}function NE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ya(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=qe.useQueryClient(),l=ei(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Wo(u),mutate:Uo(u)},user:l,...u},m=ME({...d,mutationFn:e}),p=NE({...d,mutationFn:t}),h=IE({...d,mutationFn:n}),g=$E({...d,mutationFn:a}),f=LE({...d,mutationFn:i}),{replies:b,...v}=RE({queryKey:s,queryFn:r});return{replies:b,mutations:{create:m,edit:p,remove:g,like:h,unlike:f},user:l,...v}}function IE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Ya(s,o);return l&&Tc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ya(o,l);u&&Tc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function RE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=HE(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function $E({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>UE(a,i)),onError:n});return r}function LE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ya(i,s);return o&&bE({reply:o,user:r}),s}),onError:n});return a}function zE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function qE(e,t,n){const r=t.pages.length-1,a=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[a]=e:t.pages[r].results.push(e),t}function WE(e,t,n){return n!=null&&n.replace?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t}function Oc(e,t,n){return t?n!=null&&n.append?qE(e,t,n):WE(e,t,n):zE(e)}function Ya(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function UE(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 HE(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 VE=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=se.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:d,isLoading:m,mutations:{create:p,edit:h,like:g,remove:f,unlike:b},user:v}=Th({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:_=>i.list({..._,reactionId:r})}});Ys([m]);const[E,B]=y.useState(!0);return c.jsxs(c.Fragment,{children:[(l==null?void 0:l.length)>=o&&c.jsx(Ee,{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&&c.jsx(wh,{loadMore:{isLoading:m,hasNextPage:d,loadNextPage:()=>u()},form:{parentId:t,content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(_,{body:x})=>p({activityId:n,replyId:r,content:x}),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(_=>{var Z,G,ae,C,z,Q,k;const{id:x,own_children:T,latest_children:S,children_counts:$,data:{mentioned_users:M}}=_,q=(((Z=T==null?void 0:T.like)==null?void 0:Z.length)||0)>0?(G=T==null?void 0:T.like)==null?void 0:G.find(F=>{var R;return((R=F==null?void 0:F.user)==null?void 0:R.id)===(v==null?void 0:v.id)}):!1,w=q?q==null?void 0:q.id:"",A=!!q,L=(((ae=S==null?void 0:S.like)==null?void 0:ae.length)||0)>0?(C=S==null?void 0:S.like)==null?void 0:C.map(F=>{var R,I,W;return{id:(R=F==null?void 0:F.user)==null?void 0:R.id,name:(W=(I=F==null?void 0:F.user)==null?void 0:I.data)==null?void 0:W.name}}):!1,U=typeof _.data.content=="string"?(z=_==null?void 0:_.data)==null?void 0:z.content:((k=(Q=_==null?void 0:_.data)==null?void 0:Q.content)==null?void 0:k.text)||"";return c.jsx(Zr,{isCommunity:!0,content:{id:x,type:"reply",body:U,canLike:a,createdAt:_==null?void 0:_.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:_==null?void 0:_.parent},slug:"",author:di(_==null?void 0:_.user),userLiked:A,likes:($==null?void 0:$.like)||0,peopleWhoLiked:L,mentions:M},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:x}),updateContent:(F,{body:R})=>h({replyId:x,content:R})},likes:{createLike:()=>g({replyId:x}),deleteLike:()=>b({replyId:x,reactionId:w})},comments:{},mentions:{listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback}},styling:{showShareLinkButton:!0},badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:t||""},{scope:ct.PLATFORM,area:"all"}]}},x)}):null})]})};const Sh=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,mentions:i,join:s,leave:o},profile:l})=>{const u=se.useIntl(),{replies:d,repliesCount:m,fetchNextPage:p,hasNextPage:h,isLoading:g,mutations:{create:f,edit:b,like:v,remove:E,unlike:B},user:_}=Th({queryKey:[e,t,n,"replies"],queryFns:a}),x=()=>{S(d.length),p()},[T,S]=y.useState(null);return Ys([g]),Ah(),c.jsxs("section",{className:"replies-feed",children:[c.jsx(xh,{type:"comment",responses:m,isLoading:g}),c.jsx(zo,{form:{content:{type:"reply",slugs:{}},functions:{create:($,{body:M})=>f({activityId:n,content:M}),...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:u.formatMessage({id:"discussion_responses_placeholder"})},parentId:t,membershipRequiredToPost:{isMember:r,required:!0,join:s,leave:o,notMemberStateText:u.formatMessage({id:"community_joinToPost"})}}),d==null?void 0:d.map(($,M)=>{var Q,k,F,R,I,W,re;const{id:N,own_children:q,latest_children:w,children_counts:A,data:{mentioned_users:j}}=$,U=(((Q=q==null?void 0:q.like)==null?void 0:Q.length)||0)>0?(k=q==null?void 0:q.like)==null?void 0:k.find(ee=>{var ie;return((ie=ee==null?void 0:ee.user)==null?void 0:ie.id)===(_==null?void 0:_.id)}):!1,Z=U?U==null?void 0:U.id:"",G=!!U,C=(((F=w==null?void 0:w.like)==null?void 0:F.length)||0)>0?(R=w==null?void 0:w.like)==null?void 0:R.map(ee=>{var ie,fe,X;return{id:(ie=ee==null?void 0:ee.user)==null?void 0:ie.id,name:(X=(fe=ee==null?void 0:ee.user)==null?void 0:fe.data)==null?void 0:X.name}}):!1,z=typeof $.data.content=="string"?(I=$==null?void 0:$.data)==null?void 0:I.content:((re=(W=$==null?void 0:$.data)==null?void 0:W.content)==null?void 0:re.text)||"";return c.jsx(yh,{children:c.jsx(Zr,{isCommunity:!0,content:{id:N,type:"reply",body:z,canLike:r,createdAt:$==null?void 0:$.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:N},slug:N,author:di($==null?void 0:$.user),userLiked:G,likes:(A==null?void 0:A.like)||0,peopleWhoLiked:C,mentions:j},functions:{content:{createContent:()=>null,deleteContent:()=>E({replyId:N}),updateContent:(ee,{body:ie})=>b({replyId:N,content:ie})},likes:{createLike:()=>v({replyId:N}),deleteLike:()=>B({replyId:N,reactionId:Z})},comments:{},mentions:i},badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:t||""},{scope:ct.PLATFORM,area:"all"}]},children:c.jsx(VE,{basePath:e,parentId:t,activityId:n,replyId:N,isMember:r,functions:{...a,...i}}),styling:{showShareLinkButton:!0},setFocus:M===T},N)},N)}),!g&&c.jsx(Hr,{hasNextPage:h,loadNextPage:x,icon:{icon:"arrow-down",position:"right"},messages:{button:u.formatMessage({id:"loadMore_button"}),error:u.formatMessage({id:"loadMore_error"})}}),c.jsx(qo,{form:l})]})};function KE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.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 ZE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=qe.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function YE({queryFns:{read:e,edit:t,like:n,unlike:r,pin:a,unpin:i},queryKey:s}){const o=qe.useQueryClient(),l=ei(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:Wo(u),mutate:Uo(u)},user:l,...u},m=KE({...d,mutationFn:t}),p=GE({...d,mutationFn:n}),h=QE({...d,mutationFn:r}),g=JE({...d,mutationFn:a}),f=XE({...d,mutationFn:i}),{activity:b,...v}=ZE({queryKey:s,queryFn:e});return{activity:b,mutations:{edit:m,like:p,unlike:h,pin:g,unpin:f},user:l,...v}}function GE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ka({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ka({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function QE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&kh({activity:s,user:r}),s)),onError:n});return a}function JE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Za({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Za({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function XE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>(console.log("unpin"),t(s=>(s&&Fh({activity:s,user:r}),s))),onError:n});return a}const e_=({basePath:e,parentId:t,activityId:n,isMember:r,isOwner:a,functions:{activities:{remove:i,...s},reactions:o,mentions:l,join:u,leave:d},profile:m})=>{var A,j,L,U,Z,G,ae;const p=se.useIntl(),{activity:h,error:g,isLoading:f,mutations:{edit:b,like:v,unlike:E,pin:B,unpin:_}}=YE({queryFns:s,queryKey:[e,t,n]});if(f)return c.jsx(Bt,{style:{height:"400px"}});if(g||!h)return c.jsx(hn,{variant:"error",text:p.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:x,latest_reactions:T,mentioned_users:S}=h,$=(((A=T==null?void 0:T.like)==null?void 0:A.length)||0)>0,M=(((j=x==null?void 0:x.like)==null?void 0:j.length)||0)>0,N=M?x==null?void 0:x.like[0].id:"",q=$?(L=T==null?void 0:T.like)==null?void 0:L.map(C=>{var z,Q,k;return{id:(z=C==null?void 0:C.user)==null?void 0:z.id,name:(k=(Q=C==null?void 0:C.user)==null?void 0:Q.data)==null?void 0:k.name}}):!1,w=h==null?void 0:h.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(Zr,{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:di(w),userLiked:M,likes:((U=h==null?void 0:h.reaction_counts)==null?void 0:U.like)||0,comments:((Z=h==null?void 0:h.reaction_counts)==null?void 0:Z.reply)||0,peopleWhoLiked:q,mentions:S,pinned:((G=h==null?void 0:h.reaction_counts)==null?void 0:G.pin)&&((ae=h==null?void 0:h.reaction_counts)==null?void 0:ae.pin)>0||!1},originalAuthorId:w==null?void 0:w.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:i,updateContent:(C,{title:z,body:Q})=>b({title:z,content:Q})},likes:{createLike:()=>v({activityId:n}),deleteLike:()=>E({activityId:n,reactionId:N})},comments:{openComments:()=>{}},pins:{createPin:()=>B({activityId:n}),deletePin:()=>{var C;return _({activityId:n,reactionId:(C=T==null?void 0:T.pin)==null?void 0:C[0].id})}},mentions:l},styling:{showShareLinkButton:!0},userHasOwnerPermissions:a,badges:{showBadges:!0,scopes:[{scope:ct.COMMUNITIES,area:t||""},{scope:ct.PLATFORM,area:"all"}]}},n),c.jsx(Sh,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:o,mentions:l,join:u,leave:d},profile:m})]})};const jh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=se.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:d,functions:m}=n,{title:p="",body:h="",mentions:g}=r||{},f="discussion-form-modal";return c.jsx(pn,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{(p!==""||h!=="")&&l(b=>({...b,showCachedText:!0})),o()}},className:Y("discussion-form-modal",a),children:c.jsx(Kr,{...n,data:{...u,mentions:g||(u==null?void 0:u.mentions)},meta:{...d,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:h||(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:{...m,onChange:b=>{l(v=>({...v,...b}))},onMention:({id:b,name:v}={})=>{if(!b||!v)return;const E=g||{};E[b]={created_at:"",updated_at:"",id:b,data:{name:v}},l(B=>({...B,mentions:E}))},create:async b=>{o(),m.create&&await m.create(b),l({showCachedText:!1})},handleSaveEdit:async b=>{o(),m.handleSaveEdit&&await m.handleSaveEdit(b),l({showCachedText:!1})}}})})},t_=Object.freeze(Object.defineProperty({__proto__:null,default:jh},Symbol.toStringTag,{value:"Module"}));const n_=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const d=se.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(pn,{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(hh,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const fi=({showModal:e=!0,content:{successMessage:t,title:n,text:r}={},functions:a,form:i,className:s})=>{const o=se.useIntl(),[l,u]=y.useState(ed("showProfile")==="true"||e);y.useEffect(()=>{u(e)},[e]);const{onClose:d=()=>{}}=a;return c.jsx(pn,{id:"profile-form-modal",title:t||n||o.formatMessage({id:"profileModal_title"}),isOpen:l,showDivider:!t,functions:{onClose:d},className:Y("profile-modal",s,{success:!!t}),maxWidth:700,children:c.jsxs(c.Fragment,{children:[t&&n||r?c.jsxs("div",{className:"intro",children:[t&&n?c.jsx("h3",{children:n}):"",r?c.jsx("p",{children:r}):""]}):null,c.jsx(mh,{...i,meta:{shouldShowCancelButton:!1},functions:{...(i==null?void 0:i.functions)||{},onSuccess:async m=>{var p;try{(p=i==null?void 0:i.functions)!=null&&p.onSuccess&&await i.functions.onSuccess(m)}finally{d()}}}})]})})},r_=Object.freeze(Object.defineProperty({__proto__:null,default:fi},Symbol.toStringTag,{value:"Module"}));const a_=({members:e})=>{const[t,n]=y.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return c.jsxs(c.Fragment,{children:[c.jsx(mn,{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(pn,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(Fn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const i_=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:Y("testimonial-block",a),children:[c.jsx(zt,{className:"testimonial",children:n}),r?c.jsx(Qt,{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})})]})]}),s_=y.memo(i_);const o_=({items:e=[],selector:t="",className:n=""})=>{const r=se.useIntl(),[a,i]=y.useState(e);return y.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&c.jsxs(Ot,{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 hi=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=se.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const m=d/60,p=Math.floor(m),h=(m-p)*60,g=Math.round(h),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:d,ariaText:m}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:m})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:Y("time-to-complete",a),"aria-label":u,children:l})};const u_=({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(ur,{...n,className:Y("banner",e),image:{...t,aspect:"banner"}})):null;const l_=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],c_=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],m={eyebrow:"small",title:"h1",text:"p"},p={};d.forEach(b=>{if(!t[b]){p[b]=!1;return}if(!s[b]){if(typeof t[b]=="object"){p[b]=t[b];const{text:v,element:E}=t[b];if(E&&l_.includes(E.toLowerCase()))return;p[b]={text:v,element:m[b]};return}p[b]={text:t[b],element:m[b]}}});const h=o&&o.text&&o.link;return h&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=b=>{b.preventDefault(),b.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),c.jsx(bn,{className:Y("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":h,"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(b=>{if(p[b]&&typeof p[b]=="object"){const{text:v,element:E=""}=p[b];return b==="text"?c.jsx(Fn,{overrideType:"text-only",className:"text",children:v},b):y.createElement(E,{key:b,className:b},v)}return null}),l,h&&c.jsx(Ee,{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&&c.jsx(ur,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},d_=y.memo(c_);const f_=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(bn,{className:Y("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const h_=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(Fn,{children:n}):n;return c.jsxs(bn,{className:Y("highlight-section",t),children:[r&&c.jsx("div",{className:Y("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(ur,{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})})})]})},m_=y.memo(h_);const p_=({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(Ee,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),g_=({type:e,data:t})=>{const n=se.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const m=a&&vs(a);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):Qs(d)});if(o)return c.jsx(Gt,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const m=u&&vs(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})})]})}return null},v_={title:66,text:3e3,secondaryText:1e3,partner:34},Ga={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"}},b_=({data:e,cta:t,link:n,gtmContext:r})=>{var f,b;const a=se.useIntl(),[i,s]=y.useState({loading:!1,registered:e.registered||!1});y.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:m}=e,p=e.contentType;let h="";if((f=Ga[p])!=null&&f.gtmEvent&&(h=Ga[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":`${h}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?c.jsx(Ee,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${h}-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||((b=e==null?void 0:e.members)==null?void 0:b.isMember),E=async B=>{if(B.preventDefault(),B.stopPropagation(),!(v||!t||!t.onClick)){s(_=>({..._,loading:!0}));try{const _=await t.onClick(e);s(_==="success"?()=>({registered:!0,loading:!1}):x=>({...x,loading:!1}))}catch{s(x=>({...x,loading:!1}))}}};return c.jsx("p",{className:Y("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(Ee,{onClick:E,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${p}: ${m}`,"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};function y_({buildMemberData:e,communitySlug:t}){const n=se.useIntl(),[r,a]=y.useState({count:"...",isMember:!1,memberType:""});return y.useEffect(()=>{e(t).then(i=>{if(!i)return;const{membersCount:s,role:o=""}=i;a({count:s==null?void 0:s.toString(),isMember:!!o,memberType:o})})},[t,e]),c.jsxs("span",{className:"member-information",children:[r.isMember&&c.jsx(Gt,{size:"small",variant:"registered",icon:(r==null?void 0:r.memberType)==="owner"?"user":"tick",children:n.formatMessage({id:`card_member_type_${r.memberType}`})}),c.jsx("span",{className:"label member-count",children:n.formatMessage({id:"card_member_count"},{count:r.count})})]})}const Vo=({id:e="",className:t="",buildCardData:n,buildMemberData:r,card:a,cta:i,gtmContext:s="Carousel",handleCardClick:o,setFocus:l=!1})=>{var q,w;const u=se.useIntl(),d=y.useContext(gt),m=!!(d!=null&&d.id),p=y.useRef(null),[h,g]=y.useState({data:null,isLoading:!0});y.useEffect(()=>{n(a,m).then(A=>{g({data:A,isLoading:!1})}).catch(()=>g(A=>({...A,isLoading:!1})))},[a,m,n]);const{data:f,isLoading:b}=h;if(b||!f)return c.jsx(Bt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});o&&!i&&(i={text:u.formatMessage({id:`card_cta_${a.contentType}`}),onClick:o});const{contentType:v}=f;if(!v||!Ga[v])return c.jsx(Bt,{element:"li",className:"card-wrapper"});const{basePath:E="",className:B,length:_,gtmEvent:x}=Ga[v];let T=f.slug?`${E}${f.slug}`:!1;f.slug&&(f.slug.slice(0,4)==="http"||f.slug.slice(0,2)==="//"||f.slug.slice(0,6)==="mailto"||f.slug.slice(0,3)==="tel")&&(T=f.slug);const S=A=>{T&&(A.preventDefault(),A.stopPropagation(),window.location.href=T)},$={...v_,..._};let M={className:"card"},N={};return T&&(N={href:T,className:"gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${x}-click`,"data-testid":"link"},f.openInNewTab&&(N.target="_blank"),M={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${s}-CarouselCard`,"data-gtm-event-type":`${x}-click`}),l&&(M={...M,tabIndex:"0"},(q=p==null?void 0:p.current)==null||q.focus(),(w=p==null?void 0:p.current)==null||w.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:Y("card-wrapper text-medium",B,t,{"has-link":T,"no-link":!T,"has-image":f.banner}),"data-testid":`${v}-card`,children:c.jsxs("div",{...M,ref:p,children:[c.jsx(nd,{className:"card-label",contentType:v,customIcon:f.isPrivate?"lock-locked":f.customIcon,customLabel:f.customLabel}),v==="communityPage"&&(f==null?void 0:f.createdAt)&&am(f==null?void 0:f.createdAt,60)&&c.jsx(Gt,{size:"small",variant:"information","data-testid":"new-community",children:u.formatMessage({id:"card_new"})}),f.startDate&&!f.isOngoingEvent&&c.jsx(Gt,{size:"small",variant:f.dateHasPassed?"default":"information","data-testid":"date",children:f.dateHasPassed?u.formatMessage({id:"card_ended"}):Gc(f.startDate)}),f.banner?c.jsxs("p",{className:"img",children:[f.registered&&c.jsx(Gt,{size:"small",variant:"registered",children:u.formatMessage({id:"card_registered"})}),c.jsx(ur,{image:{...f.banner,description:""}})]}):B==="people"?c.jsx(mn,{name:f.title||"",src:f.profile,"data-testid":"people-profile-picture"}):null,f.contributors&&c.jsx(ao,{contributors:{data:f.contributors},styling:{size:"small",showGap:B!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(v)?u.formatMessage({id:`card_contributors_${v}`}):void 0,"data-testid":"contributors"}),f.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:f.partner.length>1?u.formatMessage({id:"card_partner"},{partner:f.partner[0],number:f.partner.length-1}):Xn(f.partner[0],$.partner)}),["title","text","secondaryText"].map(A=>{const j=f[A];if(!j)return null;const L=Hc(A),U={key:A,className:L,"data-testid":L},Z={wrapper:"p",forceWrapper:!0,forceInline:!0},G=Xn(j,$[A]);return["title","text"].includes(A)&&T?(Z.wrapper="a",c.jsx("p",{...U,children:c.jsx(zt,{options:Z,...N,children:G})})):c.jsx(zt,{options:Z,...U,children:G})}),a.contentType==="communityPage"&&(a.slug||f.slug)&&r&&c.jsx(y_,{communitySlug:a.slug||f.slug,buildMemberData:r}),c.jsx(g_,{type:B||"",data:f}),c.jsx(b_,{data:f,cta:i,link:T||"",gtmContext:s})]})})};const Oh=({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(Vo,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),D_=(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},C_=({id:e,title:t})=>{const n=se.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: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 hs={fourCards:1024,threeCards:769,twoCards:480};let va=null;const x_=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=se.useIntl(),[u,d]=y.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:m,isLoading:p}=u,[h,g]=y.useState({currentPage:0,loadedPages:[0]}),{currentPage:f,loadedPages:b}=h,[v,E]=y.useState(""),B=t.length,_=Math.ceil(B/m),x=y.useRef(null),T=Pn(!0,!0,x==null?void 0:x.current);y.useEffect(()=>{let w=1;T&&(T>=hs.fourCards?w=4:T>=hs.threeCards?w=3:T>=hs.twoCards&&(w=2),w>B&&(w=B)),d(A=>({...A,cardsPerPage:w,isLoading:!1}))},[T,B]);const S=(w="next")=>{let A=f;if(typeof w=="string")if(w==="next")if(f<_-1)A=f+1;else return;else if(f>0)A=f-1;else return;else A=w;g(L=>({...L,currentPage:A,loadedPages:[...new Set([...b,A])]}));const j=()=>{const L=A*u.cardsPerPage,U=L+u.cardsPerPage;return t.slice(L,U).length};E(l.formatMessage({id:"carousel_pagination_aria_live"},{direction:w,count:j()}))},$=w=>{va=w.touches[0].clientX},M=w=>{if(va===null)return;const A=w.touches[0].clientX,j=va-A;j>5?S("next"):j<-5&&S("previous"),va=null},N={"--width":`${T||0}px`,"--total-cards":B,"--cards-per-page":m,"--page":f};if(p)return c.jsx(Xs,{layout:`carousel${a?"-with-title":""}`});const q=(w,A)=>{var L;let j=null;return(L=w==null?void 0:w.sys)!=null&&L.id?j=`card-${w.sys.id}`:w!=null&&w.slug?j=`card-${w.slug}`:[n[A],w.contentType].includes("customCard")&&(j=`card-${window.btoa(`${w.title} ${w.createdAt}`)}-${A}`),j};return c.jsxs("section",{ref:x,className:Y("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(C_,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:$,onTouchMove:M,style:N,"data-testid":"carousel-list",children:t.map((w,A)=>{let j=q(w,A);return j&&D_(A,m,f,b)?c.jsx(Vo,{id:j,card:{...w,contentType:n[A]},buildCardData:r,gtmContext:s,...o},j):(j=j||`${e}-card-${A}`,c.jsx(Bt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},j))})}),_<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:w=>{w.preventDefault(),w.stopPropagation(),S("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:f<=0})}),[...Array(_)].map((w,A)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:Y("page-indicator",{selected:A===f}),onClick:j=>{j.preventDefault(),j.stopPropagation(),S(A)},children:c.jsx(Ne,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:A+1,total:_})})})},`page-indicator-${A}`)),c.jsx("li",{className:"arrow next",children:c.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:w=>{w.preventDefault(),w.stopPropagation(),S("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:f>=_-1})})]}),c.jsx(Ne,{"aria-live":"polite",showOnFocus:!1,children:v})]})]})},w_=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=i?window.btoa(i):`carousel-${u}`,m=u===e.length-1;return t?c.jsxs(y.Fragment,{children:[c.jsx(Xs,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:c.jsx(Wt,{})]},`placeholder-${d}`):c.jsxs(y.Fragment,{children:[c.jsx(x_,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),m?null:c.jsx(Wt,{})]},`carousel-${d}`)});const E_=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=se.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return y.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:m=>c.jsx("strong",{children:m}),number:u})}),u<100&&a&&c.jsx(hi,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(Js,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Ph=({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 Mh=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=se.useIntl(),o=Ja(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Kc(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(hi,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const __=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const m=se.useIntl(),p="courseStructure_",h=u.toLowerCase().includes("course conclusion");return c.jsxs(Xa,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[m.formatMessage({id:`${p}section${h?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?m.formatMessage({id:`${p}time_completed`}):c.jsx(hi,{time:s,appendedText:a?m.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:f,contentType:b,icon:v,image:E,isIntroduction:B,optional:_,slug:x,subsectionId:T,title:S,type:$})=>{const M=a&&t||B,N={};return E&&(N.style={"--image":`url(${E})`}),c.jsx("li",{className:Y({article:b===Dr.ARTICLE,discussion:b===Dr.DISCUSSION,quiz:b===Dr.QUIZ,completed:g&&b===Dr.ARTICLE,locked:!M}),...N,children:c.jsx(fn,{href:M?`/microcourses/en/${o}/${x}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Vc(S)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(Ph,{sectionId:i,subsectionId:T,title:S,className:"course-title"})," ",c.jsx(Mh,{completionTime:f,icon:v,optional:_,type:$,children:d&&d[x]&&c.jsx("span",{className:"quiz-score",children:`${d[x]}%`})})]})})},x)})})]})};const k_=({isComplete:e=!1,onClick:t,...n})=>{const r=se.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(Ee,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className: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":""}`})})},F_=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Pc=[{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 ba="notFoundError_",B_=()=>{const e=se.useIntl(),t=[];return Pc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ba}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs(bh,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(bn,{children:[c.jsx(Oh,{cards:Pc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(Ee,{href:"/solution-articles/",children:e.formatMessage({id:`${ba}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${ba}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ba}text`})})]})};exports.ASSETS_BUCKET=qt;exports.ActivitiesFeed=OE;exports.ActivitySection=e_;exports.AddPost=zo;exports.BadgesContext=eo;exports.BadgesProvider=cd;exports.Banner=u_;exports.BannerSection=d_;exports.Breadcrumbs=Hp;exports.Buckets=Dm;exports.Button=Ee;exports.ButtonWrapper=or;exports.COURSE_CONTENT_TYPES=Dr;exports.CacheProvider=dd;exports.Card=Vo;exports.CardBlock=Oh;exports.Carousel=w_;exports.CharacterLimit=co;exports.CollapsibleSection=Xa;exports.Columns=jd;exports.CommunityDetails=Up;exports.ContactFooter=Vw;exports.ContactForm=fh;exports.ContentTypeLabel=nd;exports.Contributors=ao;exports.ConversationContext=ci;exports.CookieBanner=vh;exports.CourseProgression=E_;exports.CourseStructure=__;exports.CustomContentBanner=f_;exports.CustomEvents=Xe;exports.DELETED_USER_ID=Sr;exports.Directory=a_;exports.DiscussionConversation=yh;exports.DiscussionForm=Kr;exports.DiscussionFormCard=Ch;exports.DiscussionFormModal=jh;exports.DiscussionLikes=Dh;exports.DiscussionPost=Zr;exports.DiscussionThread=wh;exports.Divider=Wt;exports.DownloadSection=qw;exports.EMAILS=Un;exports.EditSection=Uw;exports.EmailHelperTextBox=Pd;exports.EmptyStateBox=hn;exports.FeatureFlags=to;exports.Filters=Vp;exports.FlagsProvider=hd;exports.Footer=Ro;exports.Form=en;exports.Formatting=V;exports.Fragment=Et;exports.FullWidthSection=bn;exports.GET_STREAM_USER_PREFIX=gs;exports.GlobalProviders=$m;exports.Header=$o;exports.HelperTextBox=ad;exports.HiddenFromScreenReaders=Qa;exports.HideShowTextBox=id;exports.HighlightSection=m_;exports.HighlightedTextBox=Ot;exports.INVALID_TOKEN=Zc;exports.IconBulletedList=wm;exports.ImageContainer=gm;exports.IntlProvider=md;exports.InviteForm=hh;exports.InviteModal=n_;exports.JoinButton=uo;exports.LanguageContext=no;exports.LanguageSwitcher=Zp;exports.LessonName=Ph;exports.LessonType=Mh;exports.Link=fn;exports.LoadMore=Hr;exports.LoadingBlock=Pm;exports.LoadingPlaceholder=Bt;exports.LoadingState=Xs;exports.Logo=lo;exports.LogoSection=Hw;exports.MENTION_REGEX=Yc;exports.MarkCompleteButton=k_;exports.MarkdownText=Fn;exports.MarketingBlock=p_;exports.Marks=Lt;exports.Member=Qt;exports.MembersList=Jw;exports.Modal=io;exports.MoreMenu=Td;exports.NUMBER_OF_COUNTRIES=tm;exports.NUMBER_OF_USERS=em;exports.NavigationMenu=Sd;exports.NotFoundError=B_;exports.Overlay=pn;exports.OverlayContext=ro;exports.OverlayProvider=vd;exports.PageHeading=sd;exports.PageLayout=bh;exports.PasswordForm=Mw;exports.PasswordRules=$d;exports.Pill=Gt;exports.Popover=td;exports.Portal=Ur;exports.ProfileForm=mh;exports.ProfileImageChange=dh;exports.ProfileModal=fi;exports.ProfileModalLauncher=qo;exports.ProfilePicture=mn;exports.ProgressBar=Js;exports.ProgressTracker=bm;exports.Rating=hg;exports.RepliesFeed=Sh;exports.ResponsesHeading=xh;exports.ResponsiveImage=ur;exports.ReturnToNavButton=ym;exports.RichTextEditor=ch;exports.SearchForm=ph;exports.ShareLinks=eg;exports.SignupForm=zw;exports.Span=Ds;exports.StatusBanner=Or;exports.TableOfContents=o_;exports.Tabs=tg;exports.Tags=Qw;exports.TestimonialBlock=s_;exports.TimeToComplete=hi;exports.Toggle=Pw;exports.Tooltip=Mn;exports.TopLevelPage=Kw;exports.UUID_V4_REGEX=jr;exports.UserContext=gt;exports.UserProvider=pd;exports.VisuallyHidden=Ne;exports.addAriaProps=Ad;exports.basicReducer=Wr;exports.camelCaseToDashCase=Hc;exports.checkIntlPathExists=Ja;exports.generateConditions=Aa;exports.generateCssIcon=nm;exports.getCharacterLimitProps=Od;exports.getLongDate=Qs;exports.getMember=ti;exports.getPostBody=Lo;exports.getShortDate=Gc;exports.getValueLength=ni;exports.headerData=qr;exports.mapGetStreamData=F_;exports.pageReady=Qc;exports.passwordValidator=bs;exports.repliesFeedMock=PE;exports.supportedLanguages=Ca;exports.toCamelCase=Vc;exports.toCapitalisedCase=Xh;exports.toSentenceCase=Kc;exports.useBadges=ld;exports.useCurrentPath=$c;exports.useEffectAfterMount=er;exports.useElementWidth=Pn;exports.useOverlay=gd;exports.useScrollListener=qc;exports.useScrollToHash=Ys;exports.useTooltips=Gs;exports.useUser=ei;