@apolitical/component-library 4.1.4 → 4.1.6-SW.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cards/cards.types.d.ts +2 -0
- package/communities/community-details/community-details.d.ts +3 -1
- package/communities/join-button/join-button.d.ts +5 -1
- package/form/components/character-limit/character-limit.d.ts +8 -0
- package/form/components/character-limit/character-limit.helpers.d.ts +5 -0
- package/form/components/character-limit/index.d.ts +2 -0
- package/form/components/form/form.types.d.ts +23 -21
- package/form/components/index.d.ts +1 -0
- package/form/components/rich-text-editor/components/toolbar/toolbar.data.d.ts +1 -1
- package/form/components/rich-text-editor/helpers/ast-types/ast-types.d.ts +65 -47
- package/form/components/rich-text-editor/helpers/handle-text/handle-text.d.ts +3 -0
- package/form/components/rich-text-editor/helpers/handle-text/index.d.ts +1 -0
- package/form/components/rich-text-editor/helpers/hot-keys/hot-keys.config.d.ts +4 -0
- package/form/components/rich-text-editor/helpers/hot-keys/hot-keys.d.ts +3 -4
- package/form/components/rich-text-editor/helpers/hot-keys/index.d.ts +2 -1
- package/form/components/rich-text-editor/helpers/index.d.ts +1 -0
- package/form/components/rich-text-editor/helpers/transform/transform.d.ts +2 -1
- package/form/components/rich-text-editor/hooks/use-selected-link/use-selected-link.d.ts +1 -0
- package/form/components/rich-text-editor/rich-text-editor.d.ts +3 -1
- package/form/components/rich-text-editor/rich-text-editor.types.d.ts +29 -6
- package/general/buttons/button/button.d.ts +3 -4
- package/helpers/dates.d.ts +1 -0
- package/helpers/intl.d.ts +6 -0
- package/index.js +59 -59
- package/index.mjs +7073 -6955
- package/package.json +1 -1
- package/style.css +1 -1
- package/styles/variables/colors/theme/_discussion.scss +1 -0
- package/styles/variables/colors/theme/_text.scss +1 -0
- package/text/content-type-label/content-type-label.types.d.ts +1 -1
- package/text/pill/pill.d.ts +4 -2
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),ue=require("react-intl"),mn=require("lodash.clonedeep"),oh=require("lodash.set"),cc=require("react-dom"),Wt=require("markdown-to-jsx"),qn=require("truncate"),We=require("@tanstack/react-query"),uh=require("@tanstack/react-query-devtools"),sa=require("posthog-js"),Ts=require("react-cookie"),dc=require("lodash.isequal"),lh=require("react-multi-email"),fc=require("lodash.get"),ch=require("react-error-boundary");var Ir=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function hc(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:{}};/*!
|
|
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})()})(
|
|
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 dh=mc.exports;const Z=xn(dh),fh=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>C.createElement(e,{...a,className:Z("hidden",r,{"show-on-focus":t}),children:n}),$e=C.memo(fh),hh=({element:e="span",children:t=null,...n})=>C.createElement(e,{...n,"aria-hidden":!0},t),Ia=C.memo(hh);var Xi={exports:{}},ar={};/**
|
|
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
|
|
13
|
+
*/var Fo;function mh(){if(Fo)return ar;Fo=1;var e=C,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var c,f={},m=null,p=null;u!==void 0&&(m=""+u),l.key!==void 0&&(m=""+l.key),l.ref!==void 0&&(p=l.ref);for(c in l)r.call(l,c)&&!i.hasOwnProperty(c)&&(f[c]=l[c]);if(o&&o.defaultProps)for(c in l=o.defaultProps,l)f[c]===void 0&&(f[c]=l[c]);return{$$typeof:t,type:o,key:m,ref:p,props:f,_owner:a.current}}return ar.Fragment=n,ar.jsx=s,ar.jsxs=s,ar}var ir={};/**
|
|
14
14
|
* @license React
|
|
15
15
|
* react-jsx-runtime.development.js
|
|
16
16
|
*
|
|
@@ -18,71 +18,71 @@
|
|
|
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
|
|
22
|
-
`+U+
|
|
23
|
-
`),
|
|
24
|
-
`),
|
|
25
|
-
`+
|
|
21
|
+
*/var To;function ph(){return To||(To=1,process.env.NODE_ENV!=="production"&&function(){var e=C,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,h="@@iterator";function y(P){if(P===null||typeof P!="object")return null;var ae=g&&P[g]||P[h];return typeof ae=="function"?ae:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(P){{for(var ae=arguments.length,ce=new Array(ae>1?ae-1:0),ye=1;ye<ae;ye++)ce[ye-1]=arguments[ye];B("error",P,ce)}}function B(P,ae,ce){{var ye=v.ReactDebugCurrentFrame,Be=ye.getStackAddendum();Be!==""&&(ae+="%s",ce=ce.concat([Be]));var Pe=ce.map(function(ke){return String(ke)});Pe.unshift("Warning: "+ae),Function.prototype.apply.call(console[P],console,Pe)}}var k=!1,E=!1,A=!1,j=!1,L=!1,I;I=Symbol.for("react.module.reference");function T(P){return!!(typeof P=="string"||typeof P=="function"||P===r||P===i||L||P===a||P===u||P===c||j||P===p||k||E||A||typeof P=="object"&&P!==null&&(P.$$typeof===m||P.$$typeof===f||P.$$typeof===s||P.$$typeof===o||P.$$typeof===l||P.$$typeof===I||P.getModuleId!==void 0))}function O(P,ae,ce){var ye=P.displayName;if(ye)return ye;var Be=ae.displayName||ae.name||"";return Be!==""?ce+"("+Be+")":ce}function w(P){return P.displayName||"Context"}function F(P){if(P==null)return null;if(typeof P.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof P=="function")return P.displayName||P.name||null;if(typeof P=="string")return P;switch(P){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof P=="object")switch(P.$$typeof){case o:var ae=P;return w(ae)+".Consumer";case s:var ce=P;return w(ce._context)+".Provider";case l:return O(P,P.render,"ForwardRef");case f:var ye=P.displayName||null;return ye!==null?ye:F(P.type)||"Memo";case m:{var Be=P,Pe=Be._payload,ke=Be._init;try{return F(ke(Pe))}catch{return null}}}return null}var R=Object.assign,M=0,K,V,oe,ne,D,q,ee;function _(){}_.__reactDisabledLog=!0;function S(){{if(M===0){K=console.log,V=console.info,oe=console.warn,ne=console.error,D=console.group,q=console.groupCollapsed,ee=console.groupEnd;var P={configurable:!0,enumerable:!0,value:_,writable:!0};Object.defineProperties(console,{info:P,log:P,warn:P,error:P,group:P,groupCollapsed:P,groupEnd:P})}M++}}function z(){{if(M--,M===0){var P={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},P,{value:K}),info:R({},P,{value:V}),warn:R({},P,{value:oe}),error:R({},P,{value:ne}),group:R({},P,{value:D}),groupCollapsed:R({},P,{value:q}),groupEnd:R({},P,{value:ee})})}M<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var $=v.ReactCurrentDispatcher,U;function re(P,ae,ce){{if(U===void 0)try{throw Error()}catch(Be){var ye=Be.stack.trim().match(/\n( *(at )?)/);U=ye&&ye[1]||""}return`
|
|
22
|
+
`+U+P}}var te=!1,Y;{var le=typeof WeakMap=="function"?WeakMap:Map;Y=new le}function X(P,ae){if(!P||te)return"";{var ce=Y.get(P);if(ce!==void 0)return ce}var ye;te=!0;var Be=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Pe;Pe=$.current,$.current=null,S();try{if(ae){var ke=function(){throw Error()};if(Object.defineProperty(ke.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ke,[])}catch(Mt){ye=Mt}Reflect.construct(P,[],ke)}else{try{ke.call()}catch(Mt){ye=Mt}P.call(ke.prototype)}}else{try{throw Error()}catch(Mt){ye=Mt}P()}}catch(Mt){if(Mt&&ye&&typeof Mt.stack=="string"){for(var Ee=Mt.stack.split(`
|
|
23
|
+
`),rt=ye.stack.split(`
|
|
24
|
+
`),qe=Ee.length-1,Ue=rt.length-1;qe>=1&&Ue>=0&&Ee[qe]!==rt[Ue];)Ue--;for(;qe>=1&&Ue>=0;qe--,Ue--)if(Ee[qe]!==rt[Ue]){if(qe!==1||Ue!==1)do if(qe--,Ue--,Ue<0||Ee[qe]!==rt[Ue]){var bt=`
|
|
25
|
+
`+Ee[qe].replace(" at new "," at ");return P.displayName&&bt.includes("<anonymous>")&&(bt=bt.replace("<anonymous>",P.displayName)),typeof P=="function"&&Y.set(P,bt),bt}while(qe>=1&&Ue>=0);break}}}finally{te=!1,$.current=Pe,z(),Error.prepareStackTrace=Be}var Bn=P?P.displayName||P.name:"",Ao=Bn?re(Bn):"";return typeof P=="function"&&Y.set(P,Ao),Ao}function ve(P,ae,ce){return X(P,!1)}function pe(P){var ae=P.prototype;return!!(ae&&ae.isReactComponent)}function _e(P,ae,ce){if(P==null)return"";if(typeof P=="function")return X(P,pe(P));if(typeof P=="string")return re(P);switch(P){case u:return re("Suspense");case c:return re("SuspenseList")}if(typeof P=="object")switch(P.$$typeof){case l:return ve(P.render);case f:return _e(P.type,ae,ce);case m:{var ye=P,Be=ye._payload,Pe=ye._init;try{return _e(Pe(Be),ae,ce)}catch{}}}return""}var je=Object.prototype.hasOwnProperty,Ne={},Qe=v.ReactDebugCurrentFrame;function Ze(P){if(P){var ae=P._owner,ce=_e(P.type,P._source,ae?ae.type:null);Qe.setExtraStackFrame(ce)}else Qe.setExtraStackFrame(null)}function Ye(P,ae,ce,ye,Be){{var Pe=Function.call.bind(je);for(var ke in P)if(Pe(P,ke)){var Ee=void 0;try{if(typeof P[ke]!="function"){var rt=Error((ye||"React class")+": "+ce+" type `"+ke+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof P[ke]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw rt.name="Invariant Violation",rt}Ee=P[ke](ae,ke,ye,ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(qe){Ee=qe}Ee&&!(Ee instanceof Error)&&(Ze(Be),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ye||"React class",ce,ke,typeof Ee),Ze(null)),Ee instanceof Error&&!(Ee.message in Ne)&&(Ne[Ee.message]=!0,Ze(Be),x("Failed %s type: %s",ce,Ee.message),Ze(null))}}}var nt=Array.isArray;function Fe(P){return nt(P)}function He(P){{var ae=typeof Symbol=="function"&&Symbol.toStringTag,ce=ae&&P[Symbol.toStringTag]||P.constructor.name||"Object";return ce}}function ze(P){try{return H(P),!1}catch{return!0}}function H(P){return""+P}function ie(P){if(ze(P))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",He(P)),H(P)}var he=v.ReactCurrentOwner,ge={key:!0,ref:!0,__self:!0,__source:!0},Ce,Ve,Ke;Ke={};function mt(P){if(je.call(P,"ref")){var ae=Object.getOwnPropertyDescriptor(P,"ref").get;if(ae&&ae.isReactWarning)return!1}return P.ref!==void 0}function Rt(P){if(je.call(P,"key")){var ae=Object.getOwnPropertyDescriptor(P,"key").get;if(ae&&ae.isReactWarning)return!1}return P.key!==void 0}function Et(P,ae){if(typeof P.ref=="string"&&he.current&&ae&&he.current.stateNode!==ae){var ce=F(he.current.type);Ke[ce]||(x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',F(he.current.type),P.ref),Ke[ce]=!0)}}function Je(P,ae){{var ce=function(){Ce||(Ce=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ae))};ce.isReactWarning=!0,Object.defineProperty(P,"key",{get:ce,configurable:!0})}}function Bt(P,ae){{var ce=function(){Ve||(Ve=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ae))};ce.isReactWarning=!0,Object.defineProperty(P,"ref",{get:ce,configurable:!0})}}var pt=function(P,ae,ce,ye,Be,Pe,ke){var Ee={$$typeof:t,type:P,key:ae,ref:ce,props:ke,_owner:Pe};return Ee._store={},Object.defineProperty(Ee._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ee,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ye}),Object.defineProperty(Ee,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Be}),Object.freeze&&(Object.freeze(Ee.props),Object.freeze(Ee)),Ee};function ei(P,ae,ce,ye,Be){{var Pe,ke={},Ee=null,rt=null;ce!==void 0&&(ie(ce),Ee=""+ce),Rt(ae)&&(ie(ae.key),Ee=""+ae.key),mt(ae)&&(rt=ae.ref,Et(ae,Be));for(Pe in ae)je.call(ae,Pe)&&!ge.hasOwnProperty(Pe)&&(ke[Pe]=ae[Pe]);if(P&&P.defaultProps){var qe=P.defaultProps;for(Pe in qe)ke[Pe]===void 0&&(ke[Pe]=qe[Pe])}if(Ee||rt){var Ue=typeof P=="function"?P.displayName||P.name||"Unknown":P;Ee&&Je(ke,Ue),rt&&Bt(ke,Ue)}return pt(P,Ee,rt,Be,ye,he.current,ke)}}var rr=v.ReactCurrentOwner,Mr=v.ReactDebugCurrentFrame;function _n(P){if(P){var ae=P._owner,ce=_e(P.type,P._source,ae?ae.type:null);Mr.setExtraStackFrame(ce)}else Mr.setExtraStackFrame(null)}var ti;ti=!1;function ni(P){return typeof P=="object"&&P!==null&&P.$$typeof===t}function wo(){{if(rr.current){var P=F(rr.current.type);if(P)return`
|
|
26
26
|
|
|
27
|
-
Check the render method of \``+
|
|
27
|
+
Check the render method of \``+P+"`."}return""}}function Xf(P){{if(P!==void 0){var ae=P.fileName.replace(/^.*[\\\/]/,""),ce=P.lineNumber;return`
|
|
28
28
|
|
|
29
|
-
Check your code at `+
|
|
29
|
+
Check your code at `+ae+":"+ce+"."}return""}}var Eo={};function eh(P){{var ae=wo();if(!ae){var ce=typeof P=="string"?P:P.displayName||P.name;ce&&(ae=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+le+">.")}return re}}function Do(O,re){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var le=Kf(re);if(yo[le])return;yo[le]=!0;var be="";O&&O._owner&&O._owner!==Xn.current&&(be=" It was passed a child from "+F(O._owner.type)+"."),xn(O),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',le,be),xn(null)}}function Co(O,re){{if(typeof O!="object")return;if(Ae(O))for(var le=0;le<O.length;le++){var be=O[le];Qa(be)&&Do(be,re)}else if(Qa(O))O._store&&(O._store.validated=!0);else if(O){var ke=y(O);if(typeof ke=="function"&&ke!==O.entries)for(var Oe=ke.call(O),Ee;!(Ee=Oe.next()).done;)Qa(Ee.value)&&Do(Ee.value,re)}}}function Zf(O){{var re=O.type;if(re==null||typeof re=="string")return;var le;if(typeof re=="function")le=re.propTypes;else if(typeof re=="object"&&(re.$$typeof===l||re.$$typeof===f))le=re.propTypes;else return;if(le){var be=F(re);Ze(le,O.props,"prop",be,O)}else if(re.PropTypes!==void 0&&!Ga){Ga=!0;var ke=F(re);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ke||"Unknown")}typeof re.getDefaultProps=="function"&&!re.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Yf(O){{for(var re=Object.keys(O.props),le=0;le<re.length;le++){var be=re[le];if(be!=="children"&&be!=="key"){xn(O),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",be),xn(null);break}}O.ref!==null&&(xn(O),x("Invalid attribute `ref` supplied to `React.Fragment`."),xn(null))}}function xo(O,re,le,be,ke,Oe){{var Ee=j(O);if(!Ee){var we="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(we+=" 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 nt=Vf(ke);nt?we+=nt:we+=bo();var ze;O===null?ze="null":Ae(O)?ze="array":O!==void 0&&O.$$typeof===t?(ze="<"+(F(O.type)||"Unknown")+" />",we=" Did you accidentally export a JSX literal instead of a component?"):ze=typeof O,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ze,we)}var He=Ya(O,re,le,ke,Oe);if(He==null)return He;if(Ee){var gt=re.children;if(gt!==void 0)if(be)if(Ae(gt)){for(var wn=0;wn<gt.length;wn++)Co(gt[wn],O);Object.freeze&&Object.freeze(gt)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Co(gt,O)}return O===r?Yf(He):Zf(He),He}}function Gf(O,re,le){return xo(O,re,le,!0)}function Qf(O,re,le){return xo(O,re,le,!1)}var Jf=Qf,Xf=Gf;tr.Fragment=r,tr.jsx=Jf,tr.jsxs=Xf}()),tr}process.env.NODE_ENV==="production"?Yi.exports=oh():Yi.exports=uh();var d=Yi.exports;const lc=()=>{const[e,t]=C.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return C.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Ln=(e,t)=>{const n=C.useRef(!1);C.useEffect(()=>{n.current?e():n.current=!0},t)};function lh(e,t,n){var r=this,a=C.useRef(null),i=C.useRef(0),s=C.useRef(null),o=C.useRef([]),l=C.useRef(),u=C.useRef(),c=C.useRef(e),f=C.useRef(!0);c.current=e;var m=typeof window<"u",p=!t&&t!==0&&m;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,h=!("trailing"in n)||!!n.trailing,y="maxWait"in n,b="debounceOnServer"in n&&!!n.debounceOnServer,x=y?Math.max(+n.maxWait||0,t):null;C.useEffect(function(){return f.current=!0,function(){f.current=!1}},[]);var B=C.useMemo(function(){var E=function(j){var R=o.current,w=l.current;return o.current=l.current=null,i.current=j,u.current=c.current.apply(w,R)},_=function(j,R){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(j):setTimeout(j,R)},T=function(j){if(!f.current)return!1;var R=j-a.current;return!a.current||R>=t||R<0||y&&j-i.current>=x},A=function(j){return s.current=null,h&&o.current?E(j):(o.current=l.current=null,u.current)},$=function j(){var R=Date.now();if(T(R))return A(R);if(f.current){var w=t-(R-a.current),F=y?Math.min(w,x-(R-i.current)):w;_(j,F)}},I=function(){if(m||b){var j=Date.now(),R=T(j);if(o.current=[].slice.call(arguments),l.current=r,a.current=j,R){if(!s.current&&f.current)return i.current=a.current,_($,t),g?E(a.current):u.current;if(y)return _($,t),E(a.current)}return s.current||_($,t),u.current}};return I.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},I.isPending=function(){return!!s.current},I.flush=function(){return s.current?A(Date.now()):u.current},I},[g,y,t,x,h,p,m,b]);return B}function cc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return lh(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let Ja;const Kn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=C.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];C.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(Ja),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:c})=>{const{id:f}=c;n==="window"||!n.closest(`#${f}`)||s()===r||o()},u=cc(()=>{s()!==r&&(t&&(clearTimeout(Ja),document.body.classList.add("is-resizing"),Ja=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},dc=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=C.useState({current:0,past:0})||[!1,()=>{}],[s,o]=C.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];C.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const c=window.scrollY,f=a.current,m=c-f,p=m>0?"down":"up";if(i({current:c,past:f}),p==="down"){c>=e+t.down&&!s.scrollDown&&(!s.scrollUp||m>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(m)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=cc(()=>{l()},250);return a},Bs=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=C.useRef(!1);Ln(()=>{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)},Br=(e,t)=>{Array.isArray(t)||(t=[t]);const n=cn(e);return t.forEach(({type:r,value:a})=>{eh(n,r,a)}),n},fc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},hc=(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},mc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),pc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),gc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),zt="https://storage.googleapis.com/apolitical-assets/",Fn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},or={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},vc="Invalid token error: Logging user out...",ch="200,000+",dh="160+";function bc(e){return e?{"--icon":`url(${zt}icons/${e}.svg)`}:{}}const un={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},yc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),As=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Gi=e=>{let t;const n=fa(),r=fa(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/un.milliseconds.inHour,i=Math.floor(t/un.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<=un.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/un.year.days)}},fa=e=>{const n=(e||new Date).toUTCString();return new Date(n)},fh=(e,t,n)=>{let r;const a=fa(),i=fa(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/un.milliseconds.inSecond<=t;case"minutes":return r/un.milliseconds.inMinute<=t;case"hours":return r/un.milliseconds.inHour<=t}return!1},hh=e=>new Promise(t=>setTimeout(t,e)),mh=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},Zn={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_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}",activitySection_notFoundError:"Post not found",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
|
|
31
|
+
Check the top-level render call using <`+ce+">.")}return ae}}function ko(P,ae){{if(!P._store||P._store.validated||P.key!=null)return;P._store.validated=!0;var ce=eh(ae);if(Eo[ce])return;Eo[ce]=!0;var ye="";P&&P._owner&&P._owner!==rr.current&&(ye=" It was passed a child from "+F(P._owner.type)+"."),_n(P),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ce,ye),_n(null)}}function _o(P,ae){{if(typeof P!="object")return;if(Fe(P))for(var ce=0;ce<P.length;ce++){var ye=P[ce];ni(ye)&&ko(ye,ae)}else if(ni(P))P._store&&(P._store.validated=!0);else if(P){var Be=y(P);if(typeof Be=="function"&&Be!==P.entries)for(var Pe=Be.call(P),ke;!(ke=Pe.next()).done;)ni(ke.value)&&ko(ke.value,ae)}}}function th(P){{var ae=P.type;if(ae==null||typeof ae=="string")return;var ce;if(typeof ae=="function")ce=ae.propTypes;else if(typeof ae=="object"&&(ae.$$typeof===l||ae.$$typeof===f))ce=ae.propTypes;else return;if(ce){var ye=F(ae);Ye(ce,P.props,"prop",ye,P)}else if(ae.PropTypes!==void 0&&!ti){ti=!0;var Be=F(ae);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Be||"Unknown")}typeof ae.getDefaultProps=="function"&&!ae.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function nh(P){{for(var ae=Object.keys(P.props),ce=0;ce<ae.length;ce++){var ye=ae[ce];if(ye!=="children"&&ye!=="key"){_n(P),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ye),_n(null);break}}P.ref!==null&&(_n(P),x("Invalid attribute `ref` supplied to `React.Fragment`."),_n(null))}}function Bo(P,ae,ce,ye,Be,Pe){{var ke=T(P);if(!ke){var Ee="";(P===void 0||typeof P=="object"&&P!==null&&Object.keys(P).length===0)&&(Ee+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var rt=Xf(Be);rt?Ee+=rt:Ee+=wo();var qe;P===null?qe="null":Fe(P)?qe="array":P!==void 0&&P.$$typeof===t?(qe="<"+(F(P.type)||"Unknown")+" />",Ee=" Did you accidentally export a JSX literal instead of a component?"):qe=typeof P,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",qe,Ee)}var Ue=ei(P,ae,ce,Be,Pe);if(Ue==null)return Ue;if(ke){var bt=ae.children;if(bt!==void 0)if(ye)if(Fe(bt)){for(var Bn=0;Bn<bt.length;Bn++)_o(bt[Bn],P);Object.freeze&&Object.freeze(bt)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else _o(bt,P)}return P===r?nh(Ue):th(Ue),Ue}}function rh(P,ae,ce){return Bo(P,ae,ce,!0)}function ah(P,ae,ce){return Bo(P,ae,ce,!1)}var ih=ah,sh=rh;ir.Fragment=r,ir.jsx=ih,ir.jsxs=sh}()),ir}process.env.NODE_ENV==="production"?Xi.exports=mh():Xi.exports=ph();var d=Xi.exports;const pc=()=>{const[e,t]=C.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return C.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Wn=(e,t)=>{const n=C.useRef(!1);C.useEffect(()=>{n.current?e():n.current=!0},t)};function gh(e,t,n){var r=this,a=C.useRef(null),i=C.useRef(0),s=C.useRef(null),o=C.useRef([]),l=C.useRef(),u=C.useRef(),c=C.useRef(e),f=C.useRef(!0);c.current=e;var m=typeof window<"u",p=!t&&t!==0&&m;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,h=!("trailing"in n)||!!n.trailing,y="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,x=y?Math.max(+n.maxWait||0,t):null;C.useEffect(function(){return f.current=!0,function(){f.current=!1}},[]);var B=C.useMemo(function(){var k=function(T){var O=o.current,w=l.current;return o.current=l.current=null,i.current=T,u.current=c.current.apply(w,O)},E=function(T,O){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(T):setTimeout(T,O)},A=function(T){if(!f.current)return!1;var O=T-a.current;return!a.current||O>=t||O<0||y&&T-i.current>=x},j=function(T){return s.current=null,h&&o.current?k(T):(o.current=l.current=null,u.current)},L=function T(){var O=Date.now();if(A(O))return j(O);if(f.current){var w=t-(O-a.current),F=y?Math.min(w,x-(O-i.current)):w;E(T,F)}},I=function(){if(m||v){var T=Date.now(),O=A(T);if(o.current=[].slice.call(arguments),l.current=r,a.current=T,O){if(!s.current&&f.current)return i.current=a.current,E(L,t),g?k(a.current):u.current;if(y)return E(L,t),k(a.current)}return s.current||E(L,t),u.current}};return I.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},I.isPending=function(){return!!s.current},I.flush=function(){return s.current?j(Date.now()):u.current},I},[g,y,t,x,h,p,m,v]);return B}function gc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return gh(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let ri;const Gn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=C.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];C.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(ri),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:c})=>{const{id:f}=c;n==="window"||!n.closest(`#${f}`)||s()===r||o()},u=gc(()=>{s()!==r&&(t&&(clearTimeout(ri),document.body.classList.add("is-resizing"),ri=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},vc=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=C.useState({current:0,past:0})||[!1,()=>{}],[s,o]=C.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];C.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const c=window.scrollY,f=a.current,m=c-f,p=m>0?"down":"up";if(i({current:c,past:f}),p==="down"){c>=e+t.down&&!s.scrollDown&&(!s.scrollUp||m>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(m)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=gc(()=>{l()},250);return a},Ss=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=C.useRef(!1);Wn(()=>{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)};const So={},Qn=C.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},...l},u)=>{const c=ue.useIntl(),f=C.useRef(null),m=u||f,[p,g]=C.useState(n?"open":"hidden"),{extraPadding:h=!0,hasPointer:y=!1,hasForm:v=!1}=t,{onOpen:x=()=>{},onClose:B=()=>{}}=o;e||(e=Date.now().toString());const k=So[e];C.useEffect(()=>{const L=m==null?void 0:m.current;if(L)return L.addEventListener("transitionend",E),L.addEventListener("keydown",A),()=>{L.removeEventListener("transitionend",E),L.removeEventListener("keydown",A)}},[]);const E=({propertyName:L})=>{L==="opacity"&&(k!==!1&&clearTimeout(k),g(I=>(I==="open"?x():I==="closed"&&B(),I==="opening"?"open":I==="closing"?"closed":I==="closed"?"hidden":I)))},A=L=>{L.key==="Escape"&&(L.stopPropagation(),L.preventDefault(),g("closing"))};Wn(()=>{k!==!1&&clearTimeout(k);let L="open";n?g("opening"):(g("closing"),L="hidden"),So[e||""]=setTimeout(()=>{g(L)},300)},[n]);const j={...l};return s&&s.onBlur&&(j.onBlur=s.onBlur),d.jsx("aside",{ref:m,className:Z("tooltip text-medium",p,i,{loading:r,"extra-padding":h,"has-pointer":y,bottom:y==="bottom","has-form":v}),...j,children:d.jsx("div",{className:"content",hidden:p==="hidden",children:r?d.jsx("p",{children:c.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?d.jsx("p",{children:a}):a})})}),Sr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=mn(e);return t.forEach(({type:r,value:a})=>{oh(n,r,a)}),n},bc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},yc=(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},Dc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Cc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),xc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Ht="https://storage.googleapis.com/apolitical-assets/",On={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"},wc="Invalid token error: Logging user out...",vh="200,000+",bh="160+";function Ec(e){return e?{"--icon":`url(${Ht}icons/${e}.svg)`}:{}}const dn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},kc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),js=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),es=e=>{let t;const n=va(),r=va(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)}},va=e=>{const n=(e||new Date).toUTCString();return new Date(n)},yh=(e,t,n)=>{let r;const a=va(),i=va(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/dn.milliseconds.inSecond<=t;case"minutes":return r/dn.milliseconds.inMinute<=t;case"hours":return r/dn.milliseconds.inHour<=t}return!1},Dh=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)>t},Ch=e=>new Promise(t=>setTimeout(t,e)),xh=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},Jn={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_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}",activitySection_notFoundError:"Post not found",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",joinCommunityButton_closed_tooltip:"Please contact the admin of this closed community if you would like to join it.",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
|
|
32
32
|
|
|
33
33
|
Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
|
|
34
34
|
|
|
35
|
-
Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their emails below.",inviteModal_cta:"Send",overlay_close:"Close",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",navigationMenu_profile:"My profile",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},ph={...Zn,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>"},gh={...Zn,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"},vh={...Zn,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>"},bh=Object.freeze(Object.defineProperty({__proto__:null,en:Zn,es:ph,fr:gh,pt:vh},Symbol.toStringTag,{value:"Module"})),Pa=(e,t=Zn)=>e in t,Bt=(e,t,n,r,a={})=>{let i="";return Pa(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},yh=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let a=n.length-1;a>=0;a--){const i=Math.pow(10,(a+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&a<n.length-1&&(e=1,a++),r=`${e}${n[a]}`;break}}return r},na=(e,t)=>C.Children.map(e,n=>Object.is(n,null)?n:C.cloneElement(n,{...t})),Dc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Cc=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Dh=(e="")=>e.replace(/\s+/g,"").length>0,Qi=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}}},xe=({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,screenreaderText:u=!1,children:c=!1,...f})=>{const p=Kn(typeof t=="object");if(typeof t=="object"&&typeof p=="number"){const y=Object.assign({},t),b=fc(Object.keys(y));t=hc(p,b,y)}const g=[];typeof t=="string"&&g.push(t),r&&(g.push("icon"),typeof r=="object"?(g.push(r.icon),r.position?g.push(r.position):g.push("left"),r.hover&&g.push(`hover_${r.hover}`),r.animate&&(g.push("animate"),typeof r.animate=="string"&&g.push(r.animate))):(g.push(r),!r.includes("right")&&!r.includes("left")&&g.push("left"))),n.muted&&g.push("muted"),n.fullWidth&&g.push("full-width");const h={...f,className:V(e,o,g,{"no-text":!c,disabled:l,button:a}),onClick:y=>{(!a||a[0]==="#")&&s&&(y.preventDefault(),y.stopPropagation()),s&&s(y)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};return a&&(i="a",h.href=a),C.createElement(i,h,c||(u?d.jsx(Ie,{showOnFocus:!1,children:u}):null))},yn=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?d.jsx(xe,{...s},o):d.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:d.jsx(xe,{...s})},o)});return C.createElement(a,{className:V("button-wrapper",n),...r,children:i})};const Qt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return d.jsx("hr",{className:V(e,{"has-max-width":t}),style:n})},ko={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"}},Ch=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?ko[e]:ko.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},xh=({format:e,height:t,query:n,width:r})=>{let a=`w=${r}&h=${t}`;return a=e?`${a}&fm=${e}`:a,a=n?`${a}&${n}`:a,a},Xa=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${xh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const Yn=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:c,fetchPriority:f}=e,{range:m,sizes:p}=Ch(e),g=Xa({format:"avif",query:s,range:m,url:o}),h=Xa({format:"webp",query:s,range:m,url:o}),y=Xa({format:"",query:s,range:m,url:o});return i&&i.includes("svg")?d.jsx("picture",{className:t,children:d.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})}):d.jsxs("picture",{className:t,children:[i!=="image/gif"&&d.jsx("source",{type:"image/avif",srcSet:g,sizes:p,"data-testid":"source"}),d.jsx("source",{type:"image/webp",srcSet:h,sizes:p,"data-testid":"source"}),d.jsx("img",{srcSet:y,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})]})};const wh=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(Yn,{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),d.jsx("a",{href:e,className:V("gtm-trackable",r),...l,children:t})}return n?C.createElement(n,{children:t,className:r,...o}):d.jsx(d.Fragment,{children:t})},xc=({children:e})=>typeof document=="object"?ac.createPortal(e,document.body):null;const Eh=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx(Ie,{children:d.jsx(oe.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),d.jsx("div",{className:"progress-tracker",children:d.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return d.jsxs("div",{className:"dot-wrapper",children:[d.jsx("div",{className:V("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),d.jsx("div",{className:V("line",{active:a<e})})]},r)})})})]});const _h=({elementId:e,offset:t=20})=>{const n=oe.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return d.jsx(xe,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const kh=({items:e,className:t="",...n})=>d.jsx("ul",{className:V("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>d.jsx("li",{className:"bucket text-medium",children:d.jsxs("a",{href:i,...s,children:[d.jsx("p",{className:"title",children:r}),d.jsx("p",{children:a})]})},o))}),Bo=300,Ao="ease-in-out";class Bh{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:Bo,easing:Ao}),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:Bo,easing:Ao}),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 Na=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=oe.useIntl(),i=C.useRef(null);return C.useEffect(()=>{let s;return r&&(s=new Bh(i.current)),()=>{r&&s&&s.cleanUp()}},[]),d.jsxs("details",{ref:i,className:V("collapsible-section",t,{"should-animate":r}),children:[d.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),d.jsx("div",{className:"content",children:n})]})},Fo={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Ah=e=>{let t=e;return Object.keys(Fo).includes(e)&&(t=Fo[e]),`url(${zt}icons/${t}.svg)`};const To={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},wc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=oe.useIntl(),i=t?{"--custom-icon":Ah(t)}:{},s=Pa(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:V("content-type-label text-small",e in To?To[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const St=({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 d.jsx("div",{className:V("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const en=({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=Kn(i);if(i&&typeof n=="object"&&typeof s=="number"){const f=Object.assign({},n.breakpoints),m=fc(Object.keys(f));a=hc(s,m,f)}const{breakpoints:o,text:l="",component:u,...c}=n;return d.jsx(St,{variant:"subtle",className:V("empty-state-box",e,r),children:d.jsxs(d.Fragment,{children:[t&&typeof t=="string"?d.jsx(Lt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||d.jsx(xe,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const Ji=({children:e,...t})=>d.jsx("p",{...t,children:e}),Ec={q:Ji,blockquote:Ji};for(let e=1;e<=6;e++)Ec[`h${e}`]={component:Ji,props:{className:"title"}};const _c=({type:e="default",className:t="",heading:n=!1,children:r})=>d.jsxs("div",{className:V("helper-text-box text-small",e,t),children:[n&&d.jsx("p",{className:"title",children:n}),typeof r=="string"?d.jsx(Lt,{options:{wrapper:C.Fragment,forceBlock:!0,overrides:Ec},children:r}):d.jsx("p",{children:r})]});const kc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=oe.useIntl(),l=C.useRef(null);e||(e=Date.now().toString());const[u,c]=C.useState(""),[f,m]=C.useState("closed");C.useEffect(()=>{const h=l.current;if(h)return h.addEventListener("transitionend",p),()=>{h.removeEventListener("transitionend",p)}},[]),C.useEffect(()=>{if(!a||typeof a!="string")return;const h=a.split(`
|
|
35
|
+
Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"Link:",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their emails below.",inviteModal_cta:"Send",overlay_close:"Close",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",navigationMenu_profile:"My profile",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},wh={...Jn,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>"},Eh={...Jn,languageSwitcher_label:"Je voudrais lire cet article dans...",languageSwitcher_translation_original:"langue originale",languageSwitcher_translation_human:"traduit par un humain",languageSwitcher_translation_machine:"traduit par machine",languageSwitcher_disclaimer:"Ce contenu est traduit automatiquement et contiendra d’évantuelles erreurs de genre ou d’autres traductions directes. Nous essayons de résoudre ce problème, mais en attendant, si vous remarquez une erreur importante, faites-le nous savoir à <link>{email}</link>",collapsibleSection_summary:"En savoir plus"},kh={...Jn,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>"},_h=Object.freeze(Object.defineProperty({__proto__:null,en:Jn,es:wh,fr:Eh,pt:kh},Symbol.toStringTag,{value:"Module"})),$a=(e,t=Jn)=>e in t,Ft=(e,t,n,r,a={})=>{let i="";return $a(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},Bh=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let a=n.length-1;a>=0;a--){const i=Math.pow(10,(a+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&a<n.length-1&&(e=1,a++),r=`${e}${n[a]}`;break}}return r},oa=(e,t)=>C.Children.map(e,n=>Object.is(n,null)?n:C.cloneElement(n,{...t})),_c=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Bc=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Ah=(e="")=>e.replace(/\s+/g,"").length>0,ts=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 we=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:c=!1,children:f=!1,...m})=>{const g=Gn(typeof t=="object"),[h,y]=C.useState(!1);if(typeof t=="object"&&typeof g=="number"){const E=Object.assign({},t),A=bc(Object.keys(E));t=yc(g,A,E)}!l&&u&&(u="");const v=u?{onMouseOver:()=>y(!0),onMouseOut:()=>y(!1),onFocus:()=>y(!0),onBlur:()=>y(!1),tabIndex:0}:{},x=[];typeof t=="string"&&x.push(t),r&&(x.push("icon"),typeof r=="object"?(x.push(r.icon),r.position?x.push(r.position):x.push("left"),r.hover&&x.push(`hover_${r.hover}`),r.animate&&(x.push("animate"),typeof r.animate=="string"&&x.push(r.animate))):(x.push(r),!r.includes("right")&&!r.includes("left")&&x.push("left"))),n.muted&&x.push("muted"),n.fullWidth&&x.push("full-width");const B={...m,className:Z(e,o,x,{"no-text":!f,disabled:l,button:a}),onClick:E=>{(!a||a[0]==="#")&&s&&(E.preventDefault(),E.stopPropagation()),s&&s(E)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",B.href=a);const k=C.createElement(i,B,f||(c?d.jsx($e,{showOnFocus:!1,children:c}):null));return l&&u?d.jsxs("span",{className:"button-container",...v,children:[d.jsx(Qn,{isOpen:h,children:u}),k]}):k},wn=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?d.jsx(we,{...s},o):d.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:d.jsx(we,{...s})},o)});return C.createElement(a,{className:Z("button-wrapper",n),...r,children:i})};const en=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return d.jsx("hr",{className:Z(e,{"has-max-width":t}),style:n})},jo={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"}},Fh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?jo[e]:jo.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Th=({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},ai=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Th({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const Xn=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:c,fetchPriority:f}=e,{range:m,sizes:p}=Fh(e),g=ai({format:"avif",query:s,range:m,url:o}),h=ai({format:"webp",query:s,range:m,url:o}),y=ai({format:"",query:s,range:m,url:o});return i&&i.includes("svg")?d.jsx("picture",{className:t,children:d.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})}):d.jsxs("picture",{className:t,children:[i!=="image/gif"&&d.jsx("source",{type:"image/avif",srcSet:g,sizes:p,"data-testid":"source"}),d.jsx("source",{type:"image/webp",srcSet:h,sizes:p,"data-testid":"source"}),d.jsx("img",{srcSet:y,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Sh=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(Xn,{image:{...e},className:"image"})}),En=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),d.jsx("a",{href:e,className:Z("gtm-trackable",r),...l,children:t})}return n?C.createElement(n,{children:t,className:r,...o}):d.jsx(d.Fragment,{children:t})},Ac=({children:e})=>typeof document=="object"?cc.createPortal(e,document.body):null;const jh=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx($e,{children:d.jsx(ue.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),d.jsx("div",{className:"progress-tracker",children:d.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return d.jsxs("div",{className:"dot-wrapper",children:[d.jsx("div",{className:Z("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),d.jsx("div",{className:Z("line",{active:a<e})})]},r)})})})]});const Oh=({elementId:e,offset:t=20})=>{const n=ue.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return d.jsx(we,{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 Ph=({items:e,className:t="",...n})=>d.jsx("ul",{className:Z("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>d.jsx("li",{className:"bucket text-medium",children:d.jsxs("a",{href:i,...s,children:[d.jsx("p",{className:"title",children:r}),d.jsx("p",{children:a})]})},o))}),Oo=300,Po="ease-in-out";class Nh{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:Oo,easing:Po}),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:Oo,easing:Po}),this.animation.onfinish=()=>this.onAnimationFinish(!0),this.animation.oncancel=()=>this.isExpanding=!1}onAnimationFinish(t){this.el.open=t,this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.el.style.height=this.el.style.overflow=""}}const La=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ue.useIntl(),i=C.useRef(null);return C.useEffect(()=>{let s;return r&&(s=new Nh(i.current)),()=>{r&&s&&s.cleanUp()}},[]),d.jsxs("details",{ref:i,className:Z("collapsible-section",t,{"should-animate":r}),children:[d.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),d.jsx("div",{className:"content",children:n})]})},No={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Rh=e=>{let t=e;return Object.keys(No).includes(e)&&(t=No[e]),`url(${Ht}icons/${t}.svg)`};const Ro={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Fc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ue.useIntl(),i=t?{"--custom-icon":Rh(t)}:{},s=$a(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:Z("content-type-label text-small",e in Ro?Ro[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(${Ht}icons/${t}.svg)`}:{};return d.jsx("div",{className:Z("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const rn=({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=Gn(i);if(i&&typeof n=="object"&&typeof s=="number"){const f=Object.assign({},n.breakpoints),m=bc(Object.keys(f));a=yc(s,m,f)}const{breakpoints:o,text:l="",component:u,...c}=n;return d.jsx(Ot,{variant:"subtle",className:Z("empty-state-box",e,r),children:d.jsxs(d.Fragment,{children:[t&&typeof t=="string"?d.jsx(Wt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||d.jsx(we,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const ns=({children:e,...t})=>d.jsx("p",{...t,children:e}),Tc={q:ns,blockquote:ns};for(let e=1;e<=6;e++)Tc[`h${e}`]={component:ns,props:{className:"title"}};const Sc=({type:e="default",className:t="",heading:n=!1,children:r})=>d.jsxs("div",{className:Z("helper-text-box text-small",e,t),children:[n&&d.jsx("p",{className:"title",children:n}),typeof r=="string"?d.jsx(Wt,{options:{wrapper:C.Fragment,forceBlock:!0,overrides:Tc},children:r}):d.jsx("p",{children:r})]});const jc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=ue.useIntl(),l=C.useRef(null);e||(e=Date.now().toString());const[u,c]=C.useState(""),[f,m]=C.useState("closed");C.useEffect(()=>{const h=l.current;if(h)return h.addEventListener("transitionend",p),()=>{h.removeEventListener("transitionend",p)}},[]),C.useEffect(()=>{if(!a||typeof a!="string")return;const h=a.split(`
|
|
36
36
|
`);c(h.length<3?`${a.substring(0,400)}...`:h.slice(0,3).join(`
|
|
37
|
-
`))},[a]),C.useEffect(()=>{f==="ready-to-close"&&m("closing")},[f]);const p=({propertyName:h})=>{h==="max-height"&&m(y=>y==="opening"?"open":y==="closing"?"closed":y)};if(!a)return null;const g=["opening","open"].includes(f);return d.jsxs(St,{variant:"subtle",className:V("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:V("content",f),children:[d.jsx(Lt,{options:{forceBlock:!0,...i},children:f==="closed"?u:a}),f!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(xe,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:V({"rotate-180":g}),onClick:()=>{m(g?"ready-to-close":"opening")},"aria-expanded":g,"aria-controls":e,children:g?r||o.formatMessage({id:"hideShowTextBox_hide"}):n||o.formatMessage({id:"hideShowTextBox_show"})})})]})};const Fh=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return C.createElement(e,{className:V("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const c={wrapper:C.Fragment,forceInline:!0},f={"--icon":`url(${zt}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(C.Fragment,{children:[d.jsx("dt",{style:f,children:d.jsx(Lt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Lt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:f,children:typeof l.text=="string"?d.jsx(Lt,{options:c,children:l.text}):l.text},u)})})},Xe=()=>C.Fragment,Th=({children:e})=>d.jsx(St,{variant:"secondary",children:e}),Sh=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),jh=["span","strong","h1","h2","h3","h4","h5","h6","p"],Oh=({children:e})=>{const t=oe.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(C.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of C.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&C.isValidElement(s)){const o=s.type;if(jh.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return d.jsx(Na,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},Ph=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(St,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(St,{variant:"primary",children:e});case"pink-textbox":return d.jsx(St,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{children:e}):e;default:return d.jsx("div",{...t,children:e})}return d.jsx("div",{...t,children:e})},Nh=e=>{const t=oe.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),d.jsxs(d.Fragment,{children:[d.jsx(Ie,{element:"a",href:`#content-after-iframe-${n}`,onClick:i=>{var s;i.preventDefault(),i.stopPropagation(),(s=document.getElementById(`content-after-iframe-${n}`))==null||s.scrollIntoView({behavior:"smooth"})},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),d.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),d.jsx("span",{id:`content-after-iframe-${n}`})]})},So=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Rh=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&C.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||So(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!C.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&So(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(xe,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},Xi=({children:e,...t})=>d.jsx("span",{className:V({url:t==null?void 0:t.href}),children:e});const Mh={default:{a:Rh,CollapsibleSection:Na,TextBox:St,CaseStudy:Th,style:Xe,details:Oh,div:Ph,iframe:Nh,center:Sh},"text-only":{h1:Xe,h2:Xe,h3:Xe,h4:Xe,h5:Xe,h6:Xe,style:Xe,details:Xe,div:Xe,TextBox:Xe,CollapsibleSection:Xe,CaseStudy:Xe,blockquote:Xe,iframe:Xe,button:Xe}},zn=({className:e="",options:t={},children:n,overrideType:r="default",styling:a={}})=>{const{highlightTitles:i=!1}=a;n=n.replace(/^<br\/?>/,"");const s={wrapper:C.Fragment,forceBlock:!0};let o=Mh[r];return t.overrides&&(o={...o,...t.overrides}),d.jsx("div",{className:V("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Lt,{options:{...s,...t,overrides:o},children:n})})};const Bc=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return d.jsxs("section",{className:V("page-heading",a),children:[d.jsxs("div",{className:V("content",{"has-max-width":e}),style:i,children:[t&&t.text&&C.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&C.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const Rn=({size:e="medium",variant:t="default",className:n="",icon:r,children:a,...i})=>{const s={"--icon":`url(${zt}icons/${r}.svg)`};return d.jsx("span",{className:V("pill",e,t,n,{"has-icon":r}),style:s,...i,children:a})};const br=({element:e="p",children:t=null,className:n="",...r})=>C.createElement(e,{...r,className:V("status-banner text-small",n),"aria-live":"assertive"},t);const Ih=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=oe.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,c={"--progress":`${t}%`};return d.jsx("span",{className:V(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:c,children:C.createElement(i?"span":Ie,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},Fs=C.memo(Ih);const ei="loadingBlock_",$h=({progress:e=0,steps:t=!1,className:n=""})=>{const r=oe.useIntl();t||(t={0:{text:r.formatMessage({id:`${ei}loading`})},75:{text:r.formatMessage({id:`${ei}almostDone`})},100:{text:r.formatMessage({id:`${ei}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 d.jsxs(St,{className:V("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&d.jsx("span",{className:"step",children:t[a].text}),d.jsx(Fs,{progress:e})]})},Lh=C.memo($h);const Ct=({element:e="div",className:t="",...n})=>d.jsx(Oa,{element:e,className:V("loading-placeholder",t),...n});const es={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"]},Ac=(e,t)=>e in es?d.jsx("div",{className:e,children:es[e].map((n,r)=>Ac(n,r))},t):d.jsx(Ct,{className:e},t),Ts=({layout:e="overview-page",...t})=>d.jsx("div",{className:V("loading-state",e),...t,children:es[e].map((n,r)=>Ac(n,r))}),Fc=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):""},Nr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],zh=e=>{const t=Math.ceil(26/Nr.length),n=Fc(e).toLowerCase();if(n==="")return Nr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Nr.length;a++)if(r<=t*(a+1))return Nr[a]};const jo=256,tn=({className:e="",src:t="",name:n,alt:r,width:a=jo,height:i=jo,...s})=>{const[o,l]=C.useState(!1),u=C.useRef(null);C.useEffect(()=>{const f=u.current;if(!f)return;const m=f.getContext("2d");if(!m)return;const p=a,g=i;typeof window<"u"&&window.devicePixelRatio&&(f.width=p*window.devicePixelRatio,f.height=g*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=zh(n),m.fillRect(0,0,p,g),m.font=`${p/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Fc(n),p/2,g/1.6)},[n]);let c=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(c=!0),d.jsx("figure",{className:V("profile-picture",e,{error:o}),...s,children:c?d.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:a,height:i}):d.jsx("canvas",{ref:u})})},Ss=e=>e==="apolitical"?{image:`${zt}logos/member_apolitical.svg`}:e==="community"||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.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},qh=({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=$n(l,r)),l};const Ar=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=oe.useIntl(),{size:l="medium"}=r,u=Ss(t);u.name||(u.name=o.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:c,image:f}=u;let{url:m}=u;t.link!==void 0&&(t.link===!1?m=void 0:m=t.link);const p=qh(u),g=n&&n.createdAt?Gi(n.createdAt):!1,h=n&&n.createdAt?As(n.createdAt):"";return C.createElement(e,{className:V("member text-medium",l,s),children:d.jsxs(Dn,{href:m,gtmType:i,gtmContext:a,onClick:y=>{y==null||y.stopPropagation()},children:[d.jsx(tn,{name:c,src:f}),d.jsxs("p",{className:"details",children:[d.jsx("strong",{children:c}),n&&d.jsxs("span",{className:"additional-content",children:[n.createdAt&&g&&d.jsx("span",{className:"date",title:h,"aria-label":h,children:o.formatMessage({id:`dates_${g.path}`},{number:g.number})}),n.didEdit&&d.jsx("em",{children:o.formatMessage({id:"discussion_edited"})})]}),p&&d.jsx("small",{className:V({"text-medium":l==="large"}),children:p})]})]})})};const Oo={small:24,medium:48},js=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...c})=>{const f=oe.useIntl();return!n||n.length===0?null:C.createElement(e,{...c,className:V("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((m,p)=>{let g,h="";if(p<o){const{name:y="",image:b=""}=Ss(m);if(s)return d.jsx(Ct,{element:"li",className:"contributor"},p);g=d.jsx(tn,{name:y,src:b,width:Oo[a||"medium"],height:Oo[a||"medium"]})}else if(p===o){const y=(t||n.length)-o;g=d.jsxs("small",{className:V({"large-number":y>99}),children:["+",yh(y,0)]}),h="number-left"}return g?d.jsx("li",{className:V("contributor",h),children:g},p):null})}),r&&d.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?f.formatMessage({id:`member_${n[0]}`}):$n(n[0].name||"",20):l||null})]})})};const Rr="emailHelperTextBox_",Tc=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=oe.useIntl(),[i,s]=C.useState({path:`${Rr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=C.useState(!1),u=C.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=h=>{s({path:`${Rr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:y=>u(y),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:h})};if(typeof r!="function"){g(a.formatMessage({id:`${Rr}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(h=>{g(h.message)}).finally(()=>{l(!1)})},[t,n,r]);C.useEffect(()=>{let p=Rr,g="default",h={},y={};switch(e){case"gov":p+="autoApproved",g="success";break;case"nonGov":p+="unrecognisedEmail",g="error",h={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":p+="pendingApproval",g="error",y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",g="error",h={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:b=>u(b),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",g="error",h={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",h={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:p,type:g,link:h,mail:y})},[e]);const c={};return["link","mail"].forEach(p=>{c[p]=Object.keys(i[p]).length?g=>d.jsx("a",{...i[p],children:g}):g=>g}),d.jsx(_c,{type:i.type,heading:o?!1:a.formatMessage({id:`${i.path}_title`}),children:o?d.jsxs(d.Fragment,{children:[d.jsx(Ct,{element:"span"}),d.jsx(Ct,{element:"span"})]}):a.formatMessage({id:`${i.path}_text`},{...c,strong:p=>d.jsx("strong",{children:p}),em:p=>d.jsx("em",{children:p}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:i.error})})},Tn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,...u})=>{const c=C.useRef(),f=r||c;return C.createElement(t,{ref:f,...u,type:o,id:n,name:i,className:V(e,t,{"has-scrollbar":o==="textarea"&&f.current&&f.current.clientHeight<f.current.scrollHeight}),value:l,placeholder:s,...a,onChange:m=>{const p=m.target;a.onChange(p.value)}})};const En={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Wh=500,Hh=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:c},f]=C.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:m,activePredictionIndex:p,isPredictionSelected:g},h]=C.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:y}=oe.useIntl();r||(r=y({id:"inputAutocomplete_placeholder"})),C.useEffect(()=>{const E=setTimeout(()=>{g||f(_=>({..._,debouncedInput:l}))},Wh);return()=>{clearTimeout(E)}},[l,g]),C.useEffect(()=>{c&&!g?(async()=>{try{const _=await o(c)||[];h(T=>({...T,predictions:_}))}catch(_){console.error("Error fetching predictions:",_),h(T=>({...T,predictions:[]}))}})():h(E=>({...E,predictions:[]}))},[c,g]),C.useEffect(()=>{p>=0&&m[p]&&f(E=>({...E,displayInput:m[p].description}))},[p,m]);const b=E=>{[En.DOWN,En.UP,En.ENTER].includes(E.key)&&(E.preventDefault(),E.key===En.DOWN&&p<m.length-1?h(_=>({..._,activePredictionIndex:p+1})):E.key===En.UP&&p>0?h(_=>({..._,activePredictionIndex:p-1})):E.key===En.ENTER&&p>-1&&(s(m[p].description),f(_=>({..._,input:m[p].description})),h(_=>({..._,predictions:[],isPredictionSelected:!0}))))},x=E=>{s(E.target.value),f(_=>({..._,input:E.target.value,displayInput:E.target.value})),h(_=>({..._,activePredictionIndex:-1,isPredictionSelected:!1}))},B=E=>{s(E.description),f(_=>({..._,input:E.description,displayInput:E.description})),h(_=>({..._,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:x,onKeyDown:b,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:m.map((E,_)=>d.jsx("li",{onClick:()=>B(E),onMouseEnter:()=>h(T=>({...T,activePredictionIndex:_})),className:V("predictions-list-item",{active:_===p}),children:E.description},_))})]})};const Sc=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:c,...f})=>{const m=oe.useIntl(),{onChange:p,...g}=r,h=()=>{t||p(c?null:l)},y=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:b=>{(b.key==="Enter"||b.code==="Space")&&(b.preventDefault(),b.stopPropagation(),h())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||m.formatMessage({id:s?`${s}_${a}`:a})})]});return C.createElement(n,{onClick:b=>{const x=b.target;x.nodeName.toLowerCase()==="a"||x.parentNode&&x.parentNode.nodeName.toLowerCase()==="a"||(b.preventDefault(),b.stopPropagation(),h())},className:V("checkbox-wrapper",e),...f,...g},y)};const Uh=C.memo(function({direction:t="down"}){return d.jsx(Oa,{className:V("rotating-chevron",`direction-${t}`)})});const Vh=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const c=oe.useIntl(),[f,m]=C.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[h,y]=C.useState(g);let b;Array.isArray(h)&&h.length===1&&typeof h[0]=="string"?b=t&&h?t.find(A=>A.id===h[0]):t?t[0]:{id:"",label:""}:Array.isArray(h)&&h.length===1&&typeof h[0]!="string"?b=h[0]:b={id:"",label:""},C.useEffect(()=>{y(g)},[r,n]);const{onChange:x,onMultiSelectSubmit:B,...E}=a,_=A=>{if(o){let $=[];h!=null&&h.includes(A.id)?$=h.filter(I=>I!==A.id):$=[...h,A.id],y([...$]),x&&x([...$])}else y([A]),x&&x(A.id),m(!1)},T=A=>{if(A==="all"){const $=(t==null?void 0:t.map(I=>I.id))||[];y($),x&&x($)}else y([]),x&&x([])};return d.jsxs("div",{className:V("dropdown-wrapper",e),children:[d.jsxs("button",{className:"input","aria-expanded":f,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:A=>{A.preventDefault(),A.stopPropagation(),m(!f)},"data-testid":"dropdown-selector",...E,children:[o?`${s} · ${h.length}`:b.label,d.jsx(Uh,{direction:f?"up":"down"})]}),d.jsx("select",{defaultValue:b.id,onChange:A=>{A.preventDefault(),A.stopPropagation();const $=t&&t.find(I=>I.id===A.target.value);_($)},hidden:!f,...E,children:t==null?void 0:t.map(A=>d.jsx("option",{value:A.id,children:A.label},A.id))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!f,children:[d.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&d.jsxs("div",{className:"action-bar",children:[d.jsx("p",{children:`${h==null?void 0:h.length} selected`}),d.jsxs("ul",{children:[d.jsx("li",{children:d.jsx(xe,{variant:"tertiary",size:"small",onClick:()=>T("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(xe,{variant:"tertiary",size:"small",onClick:()=>T("none"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(A=>{const $=A.id===b.id||(h==null?void 0:h.includes(A))||(h==null?void 0:h.includes(A.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:V("gtm-trackable",{selected:$,"selected-single":$&&!o}),"data-gtm-event-type":`${A}-click`,"data-gtm-event-context":i,onClick:I=>{I.preventDefault(),I.stopPropagation(),_(A)},role:"menuitem","aria-current":$,"data-testid":$?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:V({"menu-option-label":o}),children:A.label})]})},A.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(xe,{variant:"secondary",onClick:()=>{B&&B(h),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:h}})),m(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const Kh=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:c,...f})=>{const m=oe.useIntl(),p=i?c:[],g=c;return d.jsx("ul",{...f,className:V("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:h,label:y=!1,value:b=h,disabled:x=!1})=>{const B=`${r}_${h}`,E=()=>{if(x)return;let _;if(i){const T=p==null?void 0:p.indexOf(b);Array.isArray(p)&&T>=0?(_=p,_.splice(T,1)):(!p||p.length===0?_=[]:_=p,_.push(b))}else _=g===b?void 0:b;t.onChange(_)};return d.jsx(Sc,{element:"li",id:B,type:u==="checkboxes"?"checkbox":"radio",shownValue:b,value:i?p==null?void 0:p.includes(b):g===b,functions:{...t,onChange:E},intlPath:n,label:y||m.formatMessage({id:n?`${n}_${h}`:h}),disabled:x},B)})})};const Zh=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},...r})=>{const a=oe.useIntl(),i=C.useRef(),s=e||i,[o,l]=C.useState(!1),[u,c]=C.useState(t),f=()=>{var m;l(!o),c(o?"password":"text"),(m=s.current)==null||m.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:V("show-password gtm-trackable",{"password-visible":o}),"data-gtm-event-context":n,"data-gtm-event-type":`${o?"hide":"show"}-password-click`,onClick:f,"aria-label":a.formatMessage({id:`showpassword_aria_${o?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${o?"hide":"show"}`})}),d.jsx(Tn,{inputRef:s,type:u,...r})]})};const _n={text:{component:Tn},email:{component:Tn},url:{component:Tn},textarea:{component:Tn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Sc},checkboxes:{component:Kh,props:{multiSelect:!0}},select:{component:Vh},password:{component:Zh},autocomplete:{component:Hh}},Yh=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:c,...f})=>{const m=oe.useIntl(),p=l&&l.some(({condition:_})=>_==="required"),g=(u==null?void 0:u.toString().length)||0,h=o&&_n[o]&&_n[o].component?_n[o].component:Tn,y={};o&&["checkboxes"].includes(o)?y.element="span":y.htmlFor=e;let b={...f,id:e,name:e,className:r?"error":"",type:o,required:p,"aria-required":p,functions:cn(a),value:u};i>0&&(b["data-character-limit"]=i,b.functions&&(b.functions.onChange=_=>{((_==null?void 0:_.toString().length)||0)>i&&(_=_==null?void 0:_.toString().slice(0,i)),a.onChange(_)})),o&&_n[o]&&_n[o].props&&(b={...b,..._n[o].props}),o&&["checkboxes"].includes(o)&&(b.intlPath=`${t}_${e}`),r&&(b["aria-invalid"]=!0,b["aria-describedby"]=`error-${e}`);const x=f.label||m.formatMessage({id:t?`${t}_${e}`:e}),B=({..._})=>r?C.createElement(_.as||"dd",{id:`error-${e}`,className:"error text-small",role:"alert","aria-live":"assertive",..._},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(h,{...b,label:x,className:V("field-wrapper",n)}),d.jsx(B,{as:"p"})]});const E=_=>C.createElement(_.element||"label",{..._,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsxs("dl",{className:V("field-wrapper text-medium",n),children:[d.jsx("dt",{children:d.jsxs(E,{...y,children:[x,p&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",m.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),d.jsxs("dd",{children:[d.jsx(h,{...b}),i>0?d.jsxs("small",{className:V("character-limit",{"near-limit":g>=.99*i,"approaching-limit":g>=.9*i&&g<.99*i}),children:[d.jsx("span",{className:"hidden",children:m.formatMessage({id:"form_fieldWrapper_characterLimit"})}),g," / ",i]}):null]}),d.jsx(B,{})]})},Gh=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?cn(e.errors):{},i=e.values?cn(e.values):{};switch(n){case"toggleSubmitting":return{...e,isSubmitting:!e.isSubmitting};case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:c}=r,f=cn(Object.keys(a));for(const m of s)if(m.validation)for(let p=0;p<m.validation.length;p++){const{condition:g="required",error:h=!1}=m.validation[p];let y=!1;if(typeof g=="function"){const b=g(i);b&&(y=h||b)}else{const b=i[m.id];switch(g){case"required":(!b||typeof b=="string"&&b.trim().length===0)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{b&&!/^([^0-9]*)$/.test(b)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{b&&!/^(([^<>()[\]\\.,;:\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(b)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{b&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(b)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(y){o({type:"addError",payload:{key:m.id,value:y}}),f.push(m.id);break}}return f.length===0?l(i):u(i,f),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let ti=null;const Gn=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,gtm:u={context:"Form",event:"form-submit-click"},functions:{onSuccess:c=async()=>{},onCancel:f=()=>{},onCatch:m=()=>{},onFailure:p=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...g})=>{const{customOnSubmit:h,hideButton:y,...b}=s,x=40,{shouldShowCancelButton:B=!1,shouldReset:E=!0,showRequiredLabels:_=!0,showSuccessMessage:T=!1}=l||{},A=oe.useIntl(),$={};t.length&&t.forEach(D=>{const q=D.id||D.name;q&&($[q]=D.value||"")});const[I,j]=C.useReducer(Gh,{isSubmitting:!1,formSubmitted:!1,errors:{},values:$}),{errors:R,isSubmitting:w,formSubmitted:F,values:N}=I;C.useEffect(()=>{E&&F&&(ti=setTimeout(()=>{j({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[F]),C.useEffect(()=>()=>{ti&&clearTimeout(ti)},[]),C.useEffect(()=>{const D=q=>{j({type:"updateValue",payload:{key:q.detail.id,value:q.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",D),()=>{document.removeEventListener("dropdownMultiSelectSubmit",D)}},[]);const M=C.useRef(null),Z=a||M;if(!t.length)return null;s.text||(s.text=A.formatMessage({id:"form_submit"}));const K=()=>{if(!w){if(j({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&j({type:"submitForm",payload:{fields:t,dispatch:j,intl:A}});return}j({type:"submitForm",payload:{fields:t,dispatch:j,onSuccess:async D=>{try{await c(D),j({type:E?"formSubmittedAndReset":"formSubmitted"})}catch(q){m(q),j({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(D,q)=>{p(D,q),j({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:A}})}},ne=[{...b,icon:F?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:D=>{var k;if(D.preventDefault(),D.stopPropagation(),w)return;let q=0;if((k=Z==null?void 0:Z.current)!=null&&k.id){const S=document.getElementById(Z.current.id);S&&(q=S.getBoundingClientRect().top+window.scrollY)}const X=document.getElementById("header");X&&(q=q-X.offsetHeight-x),q<0&&(q=0),window.scrollTo({top:q,behavior:"smooth"}),K()},disabled:w||F||s.disabled,"data-gtm-event-context":u.context,"data-gtm-event-type":u.event,children:w||F?A.formatMessage({id:`form_${w?"submitting":"submitted"}`}):s.text}];return B&&ne.unshift({...o,className:"gtm-trackable","data-gtm-event-context":u.context,"data-gtm-event-type":u.event,disabled:w||F,onClick:f,children:o.text||A.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[C.createElement(e,{...g,id:r,className:V("form",n),ref:Z},d.jsxs(d.Fragment,{children:[R!=null&&R.general?d.jsx(en,{variant:"error",text:A.formatMessage({id:"form_error_generalError"})}):null,(!E||!w&&!F||h)&&t.map((D,q)=>{const{id:X=D.name||q,component:k,functions:S={onChange:()=>{}},submitOnEnter:z=!1}=D;if(k)return d.jsx(k,{...D.props||{}},`component-${X}-${q}`);const L=N?N[X]:"",U={...S,onChange:te=>{j({type:"updateValue",payload:{key:X,value:te}}),S.onChange(te&&te.toString(),j)}};return z&&(U.onKeyDown=te=>{te.key==="Enter"&&(te.stopPropagation(),te.preventDefault(),K()),S.onKeyDown&&S.onKeyDown(te)}),d.jsx(Yh,{intlPath:i,...D,showRequiredLabels:_,value:L,error:R==null?void 0:R[X],functions:U},X)}),y?null:(w||F)&&h?h:d.jsx(yn,{className:V("cta",{center:w||F,submitted:F}),buttons:ne})]})),T&&F&&d.jsx(br,{className:"success",children:typeof T=="string"?T:A.formatMessage({id:"form_success"})})]})};const Mr="passwordRules_",jc="isMoreThanEightCharacters",Oc="includesNumberAndSymbol",Pc="includesLowerAndUppercase",Qh={[jc]:"8Characters",[Oc]:"numberSymbol",[Pc]:"lowercaseUppercase"},Jh=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=oe.useIntl();return d.jsxs("aside",{className:V("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${Mr}intro`})}),d.jsx("ul",{children:[jc,Oc,Pc].map(r=>d.jsxs("li",{className:V({matches:e[r]}),children:[d.jsxs(Ie,{children:[n.formatMessage({id:`${Mr}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${Mr}rule_${Qh[r]}`})}),!e[r]&&d.jsxs(Ie,{element:"strong",children:[" ",n.formatMessage({id:`${Mr}notMet`})]})]},`rule-${r}`))})]})},Nc=C.memo(Jh);const Xh=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=oe.useIntl(),[l,u]=C.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const b=await n();u(x=>({...x,setUp:!0,id:b&&b.id,disabled:!1}))}catch(b){u(x=>({...x,setUp:!0,disabled:!0})),a(b)}};if(C.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(Ct,{className:"rating-placeholder"});const{id:f,rating:m,disabled:p}=l,g="ratings_",h={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},y=async b=>{if(!(!f||p))try{u(x=>({...x,rating:b,disabled:!0})),await r({id:f,value:b})}catch(x){u(B=>({...B,rating:null})),a(x)}finally{u(x=>({...x,disabled:!1}))}};return d.jsxs("div",{className:V("rating",i),children:[d.jsx("span",{className:"label",children:h[m?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(b=>{const x=b+1;return d.jsx("li",{className:V({selected:m&&x<=m}),children:d.jsx(xe,{variant:"tertiary",size:"small",icon:{icon:`star${!m||x>m?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:x,total:t})}${x===1||x===t?` - ${h[x===1?"low":"high"]}`:""}`,onClick:B=>{B.preventDefault(),B.stopPropagation(),y(x)},disabled:p})},`rating-${x}`)})})]})};var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0});var em=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),ni={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Rc={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:em?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Os={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 Ir=1;Ir<20;Ir++)Os["f"+Ir]=111+Ir;function Ra(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Mc(s,t)}),a=function(o){return r.some(function(l){return Ic(l,o)})},i=n==null?a:a(n);return i}function tm(e,t){return Ra(e,t)}function nm(e,t){return Ra(e,{byKey:!0},t)}function Mc(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in ni)r[ni[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var c=a[Symbol.iterator](),f;!(o=(f=c.next()).done);o=!0){var m=f.value,p=m.endsWith("?")&&m.length>1;p&&(m=m.slice(0,-1));var g=Ps(m),h=ni[g];if(m.length>1&&!h&&!Rc[m]&&!Os[g])throw new TypeError('Unknown modifier: "'+m+'"');(i===1||!h)&&(n?r.key=g:r.which=$c(m)),h&&(r[h]=p?null:!0)}}catch(y){l=!0,u=y}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Ic(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 $c(e){e=Ps(e);var t=Os[e]||e.toUpperCase().charCodeAt(0);return t}function Ps(e){return e=e.toLowerCase(),e=Rc[e]||e,e}var rm=Wt.default=Ra,ri=Wt.isHotkey=Ra;Wt.isCodeHotkey=tm;Wt.isKeyHotkey=nm;Wt.parseHotkey=Mc;Wt.compareHotkey=Ic;Wt.toKeyCode=$c;Wt.toKeyName=Ps;function am(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 ts(e,t){return Array(t+1).join(e)}function im(e){return e.replace(/^\n*/,"")}function sm(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
38
|
-
`;)t--;return e.substring(0,t)}var
|
|
37
|
+
`))},[a]),C.useEffect(()=>{f==="ready-to-close"&&m("closing")},[f]);const p=({propertyName:h})=>{h==="max-height"&&m(y=>y==="opening"?"open":y==="closing"?"closed":y)};if(!a)return null;const g=["opening","open"].includes(f);return d.jsxs(Ot,{variant:"subtle",className:Z("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:Z("content",f),children:[d.jsx(Wt,{options:{forceBlock:!0,...i},children:f==="closed"?u:a}),f!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(we,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Z({"rotate-180":g}),onClick:()=>{m(g?"ready-to-close":"opening")},"aria-expanded":g,"aria-controls":e,children:g?r||o.formatMessage({id:"hideShowTextBox_hide"}):n||o.formatMessage({id:"hideShowTextBox_show"})})})]})};const Mh=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return C.createElement(e,{className:Z("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const c={wrapper:C.Fragment,forceInline:!0},f={"--icon":`url(${Ht}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(C.Fragment,{children:[d.jsx("dt",{style:f,children:d.jsx(Wt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Wt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:f,children:typeof l.text=="string"?d.jsx(Wt,{options:c,children:l.text}):l.text},u)})})},et=()=>C.Fragment,Ih=({children:e})=>d.jsx(Ot,{variant:"secondary",children:e}),$h=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),Lh=["span","strong","h1","h2","h3","h4","h5","h6","p"],zh=({children:e})=>{const t=ue.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(C.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of C.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&C.isValidElement(s)){const o=s.type;if(Lh.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return d.jsx(La,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},qh=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(Ot,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(Ot,{variant:"primary",children:e});case"pink-textbox":return d.jsx(Ot,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{children:e}):e;default:return d.jsx("div",{...t,children:e})}return d.jsx("div",{...t,children:e})},Wh=e=>{const t=ue.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),d.jsxs(d.Fragment,{children:[d.jsx($e,{element:"a",href:`#content-after-iframe-${n}`,onClick:i=>{var s;i.preventDefault(),i.stopPropagation(),(s=document.getElementById(`content-after-iframe-${n}`))==null||s.scrollIntoView({behavior:"smooth"})},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),d.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),d.jsx("span",{id:`content-after-iframe-${n}`})]})},Mo=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Hh=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&C.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||Mo(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!C.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Mo(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(we,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},rs=({children:e,...t})=>d.jsx("span",{className:Z({url:t==null?void 0:t.href}),children:e});const Uh={default:{a:Hh,CollapsibleSection:La,TextBox:Ot,CaseStudy:Ih,style:et,details:zh,div:qh,iframe:Wh,center:$h},"text-only":{h1:et,h2:et,h3:et,h4:et,h5:et,h6:et,style:et,details:et,div:et,TextBox:et,CollapsibleSection:et,CaseStudy:et,blockquote:et,iframe:et,button:et}},Hn=({className:e="",options:t={},children:n,overrideType:r="default",styling:a={}})=>{const{highlightTitles:i=!1}=a;n=n.replace(/^<br\/?>/,"");const s={wrapper:C.Fragment,forceBlock:!0};let o=Uh[r];return t.overrides&&(o={...o,...t.overrides}),d.jsx("div",{className:Z("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Wt,{options:{...s,...t,overrides:o},children:n})})};const Oc=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return d.jsxs("section",{className:Z("page-heading",a),children:[d.jsxs("div",{className:Z("content",{"has-max-width":e}),style:i,children:[t&&t.text&&C.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&C.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const fn=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${Ht}icons/${r}.svg)`},[l,u]=C.useState(!1),c=a?{onMouseOver:()=>u(!0),onMouseOut:()=>u(!1),onFocus:()=>u(!0),onBlur:()=>u(!1),tabIndex:0}:{},f=d.jsx("span",{...c,className:Z("pill",e,t,n,{"has-icon":r}),style:o,...s,children:i});return a?d.jsxs("span",{className:"pill-wrapper",children:[d.jsx(Qn,{isOpen:l,children:a}),f]}):f};const xr=({element:e="p",children:t=null,className:n="",...r})=>C.createElement(e,{...r,className:Z("status-banner text-small",n),"aria-live":"assertive"},t);const Vh=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ue.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,c={"--progress":`${t}%`};return d.jsx("span",{className:Z(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:c,children:C.createElement(i?"span":$e,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},Os=C.memo(Vh);const ii="loadingBlock_",Kh=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ue.useIntl();t||(t={0:{text:r.formatMessage({id:`${ii}loading`})},75:{text:r.formatMessage({id:`${ii}almostDone`})},100:{text:r.formatMessage({id:`${ii}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${Ht}icons/${t[a].icon}.svg)`}:{};return d.jsxs(Ot,{className:Z("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&d.jsx("span",{className:"step",children:t[a].text}),d.jsx(Os,{progress:e})]})},Zh=C.memo(Kh);const wt=({element:e="div",className:t="",...n})=>d.jsx(Ia,{element:e,className:Z("loading-placeholder",t),...n});const as={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"]},Pc=(e,t)=>e in as?d.jsx("div",{className:e,children:as[e].map((n,r)=>Pc(n,r))},t):d.jsx(wt,{className:e},t),Ps=({layout:e="overview-page",...t})=>d.jsx("div",{className:Z("loading-state",e),...t,children:as[e].map((n,r)=>Pc(n,r))}),Nc=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):""},$r=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Yh=e=>{const t=Math.ceil(26/$r.length),n=Nc(e).toLowerCase();if(n==="")return $r[0];const r=n.charCodeAt(0)-96;for(let a=0;a<$r.length;a++)if(r<=t*(a+1))return $r[a]};const Io=256,an=({className:e="",src:t="",name:n,alt:r,width:a=Io,height:i=Io,...s})=>{const[o,l]=C.useState(!1),u=C.useRef(null);C.useEffect(()=>{const f=u.current;if(!f)return;const m=f.getContext("2d");if(!m)return;const p=a,g=i;typeof window<"u"&&window.devicePixelRatio&&(f.width=p*window.devicePixelRatio,f.height=g*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=Yh(n),m.fillRect(0,0,p,g),m.font=`${p/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Nc(n),p/2,g/1.6)},[n]);let c=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(c=!0),d.jsx("figure",{className:Z("profile-picture",e,{error:o}),...s,children:c?d.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:a,height:i}):d.jsx("canvas",{ref:u})})},Ns=e=>e==="apolitical"?{image:`${Ht}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ht}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},Gh=({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=qn(l,r)),l};const jr=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=ue.useIntl(),{size:l="medium"}=r,u=Ns(t);u.name||(u.name=o.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:c,image:f}=u;let{url:m}=u;t.link!==void 0&&(t.link===!1?m=void 0:m=t.link);const p=Gh(u),g=n&&n.createdAt?es(n.createdAt):!1,h=n&&n.createdAt?js(n.createdAt):"";return C.createElement(e,{className:Z("member text-medium",l,s),children:d.jsxs(En,{href:m,gtmType:i,gtmContext:a,onClick:y=>{y==null||y.stopPropagation()},children:[d.jsx(an,{name:c,src:f}),d.jsxs("p",{className:"details",children:[d.jsx("strong",{children:c}),n&&d.jsxs("span",{className:"additional-content",children:[n.createdAt&&g&&d.jsx("span",{className:"date",title:h,"aria-label":h,children:o.formatMessage({id:`dates_${g.path}`},{number:g.number})}),n.didEdit&&d.jsx("em",{children:o.formatMessage({id:"discussion_edited"})})]}),p&&d.jsx("small",{className:Z({"text-medium":l==="large"}),children:p})]})]})})};const $o={small:24,medium:48},Rs=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...c})=>{const f=ue.useIntl();return!n||n.length===0?null:C.createElement(e,{...c,className:Z("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((m,p)=>{let g,h="";if(p<o){const{name:y="",image:v=""}=Ns(m);if(s)return d.jsx(wt,{element:"li",className:"contributor"},p);g=d.jsx(an,{name:y,src:v,width:$o[a||"medium"],height:$o[a||"medium"]})}else if(p===o){const y=(t||n.length)-o;g=d.jsxs("small",{className:Z({"large-number":y>99}),children:["+",Bh(y,0)]}),h="number-left"}return g?d.jsx("li",{className:Z("contributor",h),children:g},p):null})}),r&&d.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?f.formatMessage({id:`member_${n[0]}`}):qn(n[0].name||"",20):l||null})]})})};const Ms=({limit:e,valueLength:t})=>{const n=ue.useIntl(),r="form_fieldWrapper_characterLimit";if(e===0)return null;const a=e-t,i=Math.abs(t-e);return d.jsxs("small",{className:Z("character-limit",{"near-limit":t>=.99*e,"approaching-limit":t>=.9*e&&t<.99*e}),"aria-live":"polite","aria-label":n.formatMessage({id:`${r}_aria_${a<0?"over":"default"}`},{remaining:a,over:i,limit:e}),children:[d.jsx("span",{className:"hidden",children:n.formatMessage({id:r})}),t," / ",e]})},za=e=>(e==null?void 0:e.toString().length)||0,Rc=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{za(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const Lr="emailHelperTextBox_",Mc=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=ue.useIntl(),[i,s]=C.useState({path:`${Lr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=C.useState(!1),u=C.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=h=>{s({path:`${Lr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:y=>u(y),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:h})};if(typeof r!="function"){g(a.formatMessage({id:`${Lr}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(h=>{g(h.message)}).finally(()=>{l(!1)})},[t,n,r]);C.useEffect(()=>{let p=Lr,g="default",h={},y={};switch(e){case"gov":p+="autoApproved",g="success";break;case"nonGov":p+="unrecognisedEmail",g="error",h={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":p+="pendingApproval",g="error",y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",g="error",h={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>u(v),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",g="error",h={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",h={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:p,type:g,link:h,mail:y})},[e]);const c={};return["link","mail"].forEach(p=>{c[p]=Object.keys(i[p]).length?g=>d.jsx("a",{...i[p],children:g}):g=>g}),d.jsx(Sc,{type:i.type,heading:o?!1:a.formatMessage({id:`${i.path}_title`}),children:o?d.jsxs(d.Fragment,{children:[d.jsx(wt,{element:"span"}),d.jsx(wt,{element:"span"})]}):a.formatMessage({id:`${i.path}_text`},{...c,strong:p=>d.jsx("strong",{children:p}),em:p=>d.jsx("em",{children:p}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:i.error})})},Pn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,...u})=>{const c=C.useRef(),f=r||c;return C.createElement(t,{ref:f,...u,type:o,id:n,name:i,className:Z(e,t,{"has-scrollbar":o==="textarea"&&f.current&&f.current.clientHeight<f.current.scrollHeight}),value:l,placeholder:s,...a,onChange:m=>{const p=m.target;a.onChange(p.value)}})};const An={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Qh=500,Jh=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:c},f]=C.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:m,activePredictionIndex:p,isPredictionSelected:g},h]=C.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:y}=ue.useIntl();r||(r=y({id:"inputAutocomplete_placeholder"})),C.useEffect(()=>{const k=setTimeout(()=>{g||f(E=>({...E,debouncedInput:l}))},Qh);return()=>{clearTimeout(k)}},[l,g]),C.useEffect(()=>{c&&!g?(async()=>{try{const E=await o(c)||[];h(A=>({...A,predictions:E}))}catch(E){console.error("Error fetching predictions:",E),h(A=>({...A,predictions:[]}))}})():h(k=>({...k,predictions:[]}))},[c,g]),C.useEffect(()=>{p>=0&&m[p]&&f(k=>({...k,displayInput:m[p].description}))},[p,m]);const v=k=>{[An.DOWN,An.UP,An.ENTER].includes(k.key)&&(k.preventDefault(),k.key===An.DOWN&&p<m.length-1?h(E=>({...E,activePredictionIndex:p+1})):k.key===An.UP&&p>0?h(E=>({...E,activePredictionIndex:p-1})):k.key===An.ENTER&&p>-1&&(s(m[p].description),f(E=>({...E,input:m[p].description})),h(E=>({...E,predictions:[],isPredictionSelected:!0}))))},x=k=>{s(k.target.value),f(E=>({...E,input:k.target.value,displayInput:k.target.value})),h(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},B=k=>{s(k.description),f(E=>({...E,input:k.description,displayInput:k.description})),h(E=>({...E,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:x,onKeyDown:v,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:m.map((k,E)=>d.jsx("li",{onClick:()=>B(k),onMouseEnter:()=>h(A=>({...A,activePredictionIndex:E})),className:Z("predictions-list-item",{active:E===p}),children:k.description},E))})]})};const Ic=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:c,...f})=>{const m=ue.useIntl(),{onChange:p,...g}=r,h=()=>{t||p(c?null:l)},y=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),h())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||m.formatMessage({id:s?`${s}_${a}`:a})})]});return C.createElement(n,{onClick:v=>{const x=v.target;x.nodeName.toLowerCase()==="a"||x.parentNode&&x.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),h())},className:Z("checkbox-wrapper",e),...f,...g},y)};const Xh=C.memo(function({direction:t="down"}){return d.jsx(Ia,{className:Z("rotating-chevron",`direction-${t}`)})});const em=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const c=ue.useIntl(),[f,m]=C.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[h,y]=C.useState(g);let v;Array.isArray(h)&&h.length===1&&typeof h[0]=="string"?v=t&&h?t.find(j=>j.id===h[0]):t?t[0]:{id:"",label:""}:Array.isArray(h)&&h.length===1&&typeof h[0]!="string"?v=h[0]:v={id:"",label:""},C.useEffect(()=>{y(g)},[r,n]);const{onChange:x,onMultiSelectSubmit:B,...k}=a,E=j=>{if(o){let L=[];h!=null&&h.includes(j.id)?L=h.filter(I=>I!==j.id):L=[...h,j.id],y([...L]),x&&x([...L])}else y([j]),x&&x(j.id),m(!1)},A=j=>{if(j==="all"){const L=(t==null?void 0:t.map(I=>I.id))||[];y(L),x&&x(L)}else y([]),x&&x([])};return d.jsxs("div",{className:Z("dropdown-wrapper",e),children:[d.jsxs("button",{className:"input","aria-expanded":f,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:j=>{j.preventDefault(),j.stopPropagation(),m(!f)},"data-testid":"dropdown-selector",...k,children:[o?`${s} · ${h.length}`:v.label,d.jsx(Xh,{direction:f?"up":"down"})]}),d.jsx("select",{defaultValue:v.id,onChange:j=>{j.preventDefault(),j.stopPropagation();const L=t&&t.find(I=>I.id===j.target.value);E(L)},hidden:!f,...k,children:t==null?void 0:t.map(j=>d.jsx("option",{value:j.id,children:j.label},j.id))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!f,children:[d.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&d.jsxs("div",{className:"action-bar",children:[d.jsx("p",{children:`${h==null?void 0:h.length} selected`}),d.jsxs("ul",{children:[d.jsx("li",{children:d.jsx(we,{variant:"tertiary",size:"small",onClick:()=>A("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(we,{variant:"tertiary",size:"small",onClick:()=>A("none"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(j=>{const L=j.id===v.id||(h==null?void 0:h.includes(j))||(h==null?void 0:h.includes(j.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:Z("gtm-trackable",{selected:L,"selected-single":L&&!o}),"data-gtm-event-type":`${j}-click`,"data-gtm-event-context":i,onClick:I=>{I.preventDefault(),I.stopPropagation(),E(j)},role:"menuitem","aria-current":L,"data-testid":L?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:Z({"menu-option-label":o}),children:j.label})]})},j.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(we,{variant:"secondary",onClick:()=>{B&&B(h),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:h}})),m(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const tm=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:c,...f})=>{const m=ue.useIntl(),p=i?c:[],g=c;return d.jsx("ul",{...f,className:Z("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:h,label:y=!1,value:v=h,disabled:x=!1})=>{const B=`${r}_${h}`,k=()=>{if(x)return;let E;if(i){const A=p==null?void 0:p.indexOf(v);Array.isArray(p)&&A>=0?(E=p,E.splice(A,1)):(!p||p.length===0?E=[]:E=p,E.push(v))}else E=g===v?void 0:v;t.onChange(E)};return d.jsx(Ic,{element:"li",id:B,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?p==null?void 0:p.includes(v):g===v,functions:{...t,onChange:k},intlPath:n,label:y||m.formatMessage({id:n?`${n}_${h}`:h}),disabled:x},B)})})};const nm=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},...r})=>{const a=ue.useIntl(),i=C.useRef(),s=e||i,[o,l]=C.useState(!1),[u,c]=C.useState(t),f=()=>{var m;l(!o),c(o?"password":"text"),(m=s.current)==null||m.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:Z("show-password gtm-trackable",{"password-visible":o}),"data-gtm-event-context":n,"data-gtm-event-type":`${o?"hide":"show"}-password-click`,onClick:f,"aria-label":a.formatMessage({id:`showpassword_aria_${o?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${o?"hide":"show"}`})}),d.jsx(Pn,{inputRef:s,type:u,...r})]})};const Fn={text:{component:Pn},email:{component:Pn},url:{component:Pn},textarea:{component:Pn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Ic},checkboxes:{component:tm,props:{multiSelect:!0}},select:{component:em},password:{component:nm},autocomplete:{component:Jh}},rm=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:c,...f})=>{const m=ue.useIntl(),p=l&&l.some(({condition:E})=>E==="required"),g=za(u),h=o&&Fn[o]&&Fn[o].component?Fn[o].component:Pn,y={};o&&["checkboxes"].includes(o)?y.element="span":y.htmlFor=e;let v={...f,id:e,name:e,className:r?"error":"",type:o,required:p,"aria-required":p,functions:mn(a),value:u};if(i>0){const E=Rc(i,a.onChange);v={...v,...E},E.functions&&typeof E.functions=="object"&&(v.functions={...v.functions,...E.functions})}o&&Fn[o]&&Fn[o].props&&(v={...v,...Fn[o].props}),o&&["checkboxes"].includes(o)&&(v.intlPath=`${t}_${e}`),r&&(v["aria-invalid"]=!0,v["aria-describedby"]=`error-${e}`);const x=f.label||m.formatMessage({id:t?`${t}_${e}`:e}),B=({...E})=>r?C.createElement(E.as||"dd",{id:`error-${e}`,className:"error text-small",role:"alert","aria-live":"assertive",...E},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(h,{...v,label:x,className:Z("field-wrapper",n)}),d.jsx(B,{as:"p"})]});const k=E=>C.createElement(E.element||"label",{...E,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsxs("dl",{className:Z("field-wrapper text-medium",n),children:[d.jsx("dt",{children:d.jsxs(k,{...y,children:[x,p&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",m.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),d.jsxs("dd",{children:[d.jsx(h,{...v}),d.jsx(Ms,{limit:i,valueLength:g})]}),d.jsx(B,{})]})},am=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?mn(e.errors):{},i=e.values?mn(e.values):{};switch(n){case"toggleSubmitting":return{...e,isSubmitting:!e.isSubmitting};case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:c}=r,f=mn(Object.keys(a));for(const m of s)if(m.validation)for(let p=0;p<m.validation.length;p++){const{condition:g="required",error:h=!1}=m.validation[p];let y=!1;if(typeof g=="function"){const v=g(i);v&&(y=h||v)}else{const v=i[m.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(y){o({type:"addError",payload:{key:m.id,value:y}}),f.push(m.id);break}}return f.length===0?l(i):u(i,f),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let si=null;const er=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,gtm:u={context:"Form",event:"form-submit-click"},functions:{onSuccess:c=async()=>{},onCancel:f=()=>{},onCatch:m=()=>{},onFailure:p=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...g})=>{const{customOnSubmit:h,hideButton:y,...v}=s,x=40,{shouldShowCancelButton:B=!1,shouldReset:k=!0,showRequiredLabels:E=!0,showSuccessMessage:A=!1}=l||{},j=ue.useIntl(),L={};t.length&&t.forEach(D=>{const q=D.id||D.name;q&&(L[q]=D.value||"")});const[I,T]=C.useReducer(am,{isSubmitting:!1,formSubmitted:!1,errors:{},values:L}),{errors:O,isSubmitting:w,formSubmitted:F,values:R}=I;C.useEffect(()=>{k&&F&&(si=setTimeout(()=>{T({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[F]),C.useEffect(()=>()=>{si&&clearTimeout(si)},[]),C.useEffect(()=>{const D=q=>{T({type:"updateValue",payload:{key:q.detail.id,value:q.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",D),()=>{document.removeEventListener("dropdownMultiSelectSubmit",D)}},[]);const M=C.useRef(null),K=a||M;if(!t.length)return null;s.text||(s.text=j.formatMessage({id:"form_submit"}));const V=()=>{if(!w){if(T({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&T({type:"submitForm",payload:{fields:t,dispatch:T,intl:j}});return}T({type:"submitForm",payload:{fields:t,dispatch:T,onSuccess:async D=>{try{await c(D),T({type:k?"formSubmittedAndReset":"formSubmitted"})}catch(q){m(q),T({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(D,q)=>{p(D,q),T({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:j}})}},ne=[{...v,icon:F?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:D=>{var _;if(D.preventDefault(),D.stopPropagation(),w)return;let q=0;if((_=K==null?void 0:K.current)!=null&&_.id){const S=document.getElementById(K.current.id);S&&(q=S.getBoundingClientRect().top+window.scrollY)}const ee=document.getElementById("header");ee&&(q=q-ee.offsetHeight-x),q<0&&(q=0),window.scrollTo({top:q,behavior:"smooth"}),V()},disabled:w||F||s.disabled,"data-gtm-event-context":u.context,"data-gtm-event-type":u.event,children:w||F?j.formatMessage({id:`form_${w?"submitting":"submitted"}`}):s.text}];return B&&ne.unshift({...o,className:"gtm-trackable","data-gtm-event-context":u.context,"data-gtm-event-type":u.event,disabled:w||F,onClick:f,children:o.text||j.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[C.createElement(e,{...g,id:r,className:Z("form",n),ref:K},d.jsxs(d.Fragment,{children:[O!=null&&O.general?d.jsx(rn,{variant:"error",text:j.formatMessage({id:"form_error_generalError"})}):null,(!k||!w&&!F||h)&&t.map((D,q)=>{const{id:ee=D.name||q,component:_,functions:S={onChange:()=>{}},submitOnEnter:z=!1}=D;if(_)return d.jsx(_,{...D.props||{}},`component-${ee}-${q}`);const $=R?R[ee]:"",U={...S,onChange:re=>{T({type:"updateValue",payload:{key:ee,value:re}}),S.onChange(re&&re.toString(),T)}};return z&&(U.onKeyDown=re=>{re.key==="Enter"&&(re.stopPropagation(),re.preventDefault(),V()),S.onKeyDown&&S.onKeyDown(re)}),d.jsx(rm,{intlPath:i,...D,showRequiredLabels:E,value:$,error:O==null?void 0:O[ee],functions:U},ee)}),y?null:(w||F)&&h?h:d.jsx(wn,{className:Z("cta",{center:w||F,submitted:F}),buttons:ne})]})),A&&F&&d.jsx(xr,{className:"success",children:typeof A=="string"?A:j.formatMessage({id:"form_success"})})]})};const zr="passwordRules_",$c="isMoreThanEightCharacters",Lc="includesNumberAndSymbol",zc="includesLowerAndUppercase",im={[$c]:"8Characters",[Lc]:"numberSymbol",[zc]:"lowercaseUppercase"},sm=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ue.useIntl();return d.jsxs("aside",{className:Z("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${zr}intro`})}),d.jsx("ul",{children:[$c,Lc,zc].map(r=>d.jsxs("li",{className:Z({matches:e[r]}),children:[d.jsxs($e,{children:[n.formatMessage({id:`${zr}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${zr}rule_${im[r]}`})}),!e[r]&&d.jsxs($e,{element:"strong",children:[" ",n.formatMessage({id:`${zr}notMet`})]})]},`rule-${r}`))})]})},qc=C.memo(sm);const om=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ue.useIntl(),[l,u]=C.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const v=await n();u(x=>({...x,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(x=>({...x,setUp:!0,disabled:!0})),a(v)}};if(C.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(wt,{className:"rating-placeholder"});const{id:f,rating:m,disabled:p}=l,g="ratings_",h={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},y=async v=>{if(!(!f||p))try{u(x=>({...x,rating:v,disabled:!0})),await r({id:f,value:v})}catch(x){u(B=>({...B,rating:null})),a(x)}finally{u(x=>({...x,disabled:!1}))}};return d.jsxs("div",{className:Z("rating",i),children:[d.jsx("span",{className:"label",children:h[m?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const x=v+1;return d.jsx("li",{className:Z({selected:m&&x<=m}),children:d.jsx(we,{variant:"tertiary",size:"small",icon:{icon:`star${!m||x>m?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:x,total:t})}${x===1||x===t?` - ${h[x===1?"low":"high"]}`:""}`,onClick:B=>{B.preventDefault(),B.stopPropagation(),y(x)},disabled:p})},`rating-${x}`)})})]})};function um(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}function is(e,t){return Array(t+1).join(e)}function lm(e){return e.replace(/^\n*/,"")}function cm(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
38
|
+
`;)t--;return e.substring(0,t)}var dm=["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 Is(e){return $s(e,dm)}var Wc=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Hc(e){return $s(e,Wc)}function fm(e){return Vc(e,Wc)}var Uc=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function hm(e){return $s(e,Uc)}function mm(e){return Vc(e,Uc)}function $s(e,t){return t.indexOf(e.nodeName)>=0}function Vc(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var tt={};tt.paragraph={filter:"p",replacement:function(e){return`
|
|
39
39
|
|
|
40
40
|
`+e+`
|
|
41
41
|
|
|
42
|
-
`}};
|
|
43
|
-
`}};
|
|
42
|
+
`}};tt.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+`
|
|
43
|
+
`}};tt.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=is(r===1?"=":"-",e.length);return`
|
|
44
44
|
|
|
45
45
|
`+e+`
|
|
46
46
|
`+a+`
|
|
47
47
|
|
|
48
48
|
`}else return`
|
|
49
49
|
|
|
50
|
-
`+
|
|
50
|
+
`+is("#",r)+" "+e+`
|
|
51
51
|
|
|
52
|
-
`}};
|
|
52
|
+
`}};tt.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
|
|
53
53
|
|
|
54
54
|
`+e+`
|
|
55
55
|
|
|
56
|
-
`}};
|
|
56
|
+
`}};tt.list={filter:["ul","ol"],replacement:function(e,t){var n=t.parentNode;return n.nodeName==="LI"&&n.lastElementChild===t?`
|
|
57
57
|
`+e:`
|
|
58
58
|
|
|
59
59
|
`+e+`
|
|
60
60
|
|
|
61
|
-
`}};
|
|
61
|
+
`}};tt.listItem={filter:"li",replacement:function(e,t,n){e=e.replace(/^\n+/,"").replace(/\n+$/,`
|
|
62
62
|
`).replace(/\n/gm,`
|
|
63
63
|
`);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)?`
|
|
64
|
-
`:"")}};
|
|
64
|
+
`:"")}};tt.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){return`
|
|
65
65
|
|
|
66
66
|
`+t.firstChild.textContent.replace(/\n/g,`
|
|
67
67
|
`)+`
|
|
68
68
|
|
|
69
|
-
`}};
|
|
69
|
+
`}};tt.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",a=(r.match(/language-(\S+)/)||[null,""])[1],i=t.firstChild.textContent,s=n.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(i);)u[0].length>=o&&(o=u[0].length+1);var c=is(s,o);return`
|
|
70
70
|
|
|
71
71
|
`+c+a+`
|
|
72
72
|
`+i.replace(/\n$/,"")+`
|
|
73
73
|
`+c+`
|
|
74
74
|
|
|
75
|
-
`}};
|
|
75
|
+
`}};tt.horizontalRule={filter:"hr",replacement:function(e,t,n){return`
|
|
76
76
|
|
|
77
77
|
`+n.hr+`
|
|
78
78
|
|
|
79
|
-
`}};
|
|
79
|
+
`}};tt.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=ba(t.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+n+r+")"}};tt.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=ba(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=`
|
|
80
80
|
|
|
81
81
|
`+this.references.join(`
|
|
82
82
|
`)+`
|
|
83
83
|
|
|
84
|
-
`,this.references=[]),t}};
|
|
85
|
-
`):""}function
|
|
84
|
+
`,this.references=[]),t}};tt.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};tt.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};tt.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}};tt.image={filter:"img",replacement:function(e,t){var n=ba(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=ba(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"":""}};function ba(e){return e?e.replace(/(\n+\s*)+/g,`
|
|
85
|
+
`):""}function Kc(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])}Kc.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=oi(this.array,e,this.options))||(t=oi(this._keep,e,this.options))||(t=oi(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 oi(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(pm(a,t,n))return a}}function pm(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 gm(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(f){return f.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=Lo(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=ui(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=ui(l);continue}var c=Lo(o,l,a);o=l,l=c}i&&(i.data=i.data.replace(/ $/,""),i.data||ui(i))}}function ui(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Lo(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var Ls=typeof window<"u"?window:{};function vm(){var e=Ls.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function bm(){var e=function(){};return ym()?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 ym(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{Ls.ActiveXObject&&(e=!0)}return e}var Dm=vm()?Ls.DOMParser:bm();function Cm(e,t){var n;if(typeof e=="string"){var r=xm().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return gm({element:n,isBlock:Is,isVoid:Hc,isPre:t.preformattedCode?wm:null}),n}var li;function xm(){return li=li||new Dm,li}function wm(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function Em(e,t){return e.isBlock=Is(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=km(e),e.flankingWhitespace=_m(e,t),e}function km(e){return!Hc(e)&&!hm(e)&&/^\s*$/i.test(e.textContent)&&!fm(e)&&!mm(e)}function _m(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=Bm(e.textContent);return n.leadingAscii&&zo("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&zo("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function Bm(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 zo(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&&!Is(r)&&(i=a.test(r.textContent))),i}var Am=Array.prototype.reduce,Fm=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function ya(e){if(!(this instanceof ya))return new ya(e);var t={rules:tt,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
|
|
86
86
|
|
|
87
87
|
`:""},keepReplacement:function(n,r){return r.isBlock?`
|
|
88
88
|
|
|
@@ -92,68 +92,68 @@ Thank you for helping to protect the Apolitical community from abusive content.`
|
|
|
92
92
|
|
|
93
93
|
`+n+`
|
|
94
94
|
|
|
95
|
-
`:n}};this.options=
|
|
95
|
+
`:n}};this.options=um({},t,e),this.rules=new Kc(this.options)}ya.prototype={turndown:function(e){if(!jm(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=Zc.call(this,new Cm(e,this.options));return Tm.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 Fm.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function Zc(e){var t=this;return Am.call(e.childNodes,function(n,r){r=new Em(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=Sm.call(t,r)),Yc(n,a)},"")}function Tm(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=Yc(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function Sm(e){var t=this.rules.forNode(e),n=Zc.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 Yc(e,t){var n=cm(e),r=lm(t),a=Math.max(e.length-n.length,t.length-r.length),i=`
|
|
96
96
|
|
|
97
|
-
`.substring(0,a);return n+i+r}function
|
|
97
|
+
`.substring(0,a);return n+i+r}function jm(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}/*!
|
|
98
98
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
99
99
|
*
|
|
100
100
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
101
101
|
* Released under the MIT License.
|
|
102
|
-
*/function Ro(e){return Object.prototype.toString.call(e)==="[object Object]"}function Je(e){var t,n;return Ro(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Ro(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Kc=Symbol.for("immer-nothing"),Mo=Symbol.for("immer-draftable"),mt=Symbol.for("immer-state"),Fm=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 lt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Fm[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var qn=Object.getPrototypeOf;function mn(e){return!!e&&!!e[mt]}function pn(e){var t;return e?Zc(e)||Array.isArray(e)||!!e[Mo]||!!((t=e.constructor)!=null&&t[Mo])||Ia(e)||$a(e):!1}var Tm=Object.prototype.constructor.toString();function Zc(e){if(!e||typeof e!="object")return!1;const t=qn(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Tm}function pa(e,t){Ma(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Ma(e){const t=e[mt];return t?t.type_:Array.isArray(e)?1:Ia(e)?2:$a(e)?3:0}function ns(e,t){return Ma(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Yc(e,t,n){const r=Ma(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Sm(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ia(e){return e instanceof Map}function $a(e){return e instanceof Set}function sn(e){return e.copy_||e.base_}function rs(e,t){if(Ia(e))return new Map(e);if($a(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Zc(e))return qn(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[mt];let r=Reflect.ownKeys(n);for(let a=0;a<r.length;a++){const i=r[a],s=n[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(qn(e),n)}function Is(e,t=!1){return La(e)||mn(e)||!pn(e)||(Ma(e)>1&&(e.set=e.add=e.clear=e.delete=jm),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Is(r,!0))),e}function jm(){lt(2)}function La(e){return Object.isFrozen(e)}var Om={};function gn(e){const t=Om[e];return t||lt(0,e),t}var yr;function Gc(){return yr}function Pm(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Io(e,t){t&&(gn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function as(e){is(e),e.drafts_.forEach(Nm),e.drafts_=null}function is(e){e===yr&&(yr=e.parent_)}function $o(e){return yr=Pm(yr,e)}function Nm(e){const t=e[mt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Lo(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[mt].modified_&&(as(t),lt(4)),pn(e)&&(e=ga(t,e),t.parent_||va(t,e)),t.patches_&&gn("Patches").generateReplacementPatches_(n[mt].base_,e,t.patches_,t.inversePatches_)):e=ga(t,n,[]),as(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Kc?e:void 0}function ga(e,t,n){if(La(t))return t;const r=t[mt];if(!r)return pa(t,(a,i)=>zo(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return va(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),pa(i,(o,l)=>zo(e,r,a,o,l,n,s)),va(e,a,!1),n&&e.patches_&&gn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function zo(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&<(5),mn(a)){const o=i&&t&&t.type_!==3&&!ns(t.assigned_,r)?i.concat(r):void 0,l=ga(e,a,o);if(Yc(n,r,l),mn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(pn(a)&&!La(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ga(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&va(e,a)}}function va(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Is(t,n)}function Rm(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Gc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=$s;n&&(a=[r],i=Dr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var $s={get(e,t){if(t===mt)return e;const n=sn(e);if(!ns(n,t))return Mm(e,n,t);const r=n[t];return e.finalized_||!pn(r)?r:r===oi(e.base_,t)?(ui(e),e.copy_[t]=os(r,e)):r},has(e,t){return t in sn(e)},ownKeys(e){return Reflect.ownKeys(sn(e))},set(e,t,n){const r=Qc(sn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=oi(sn(e),t),i=a==null?void 0:a[mt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Sm(n,a)&&(n!==void 0||ns(e.base_,t)))return!0;ui(e),ss(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 oi(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,ui(e),ss(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=sn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){lt(11)},getPrototypeOf(e){return qn(e.base_)},setPrototypeOf(){lt(12)}},Dr={};pa($s,(e,t)=>{Dr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Dr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&<(13),Dr.set.call(this,e,t,void 0)};Dr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&<(14),$s.set.call(this,e[0],t,n,e[0])};function oi(e,t){const n=e[mt];return(n?sn(n):e)[t]}function Mm(e,t,n){var a;const r=Qc(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Qc(e,t){if(!(t in e))return;let n=qn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=qn(n)}}function ss(e){e.modified_||(e.modified_=!0,e.parent_&&ss(e.parent_))}function ui(e){e.copy_||(e.copy_=rs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Im=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,c=>n.call(this,c,...u))}}typeof n!="function"&<(6),r!==void 0&&typeof r!="function"&<(7);let a;if(pn(t)){const i=$o(this),s=os(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?as(i):is(i)}return Io(i,r),Lo(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===Kc&&(a=void 0),this.autoFreeze_&&Is(a,!0),r){const i=[],s=[];gn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else lt(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){pn(e)||lt(8),mn(e)&&(e=$m(e));const t=$o(this),n=os(e,void 0);return n[mt].isManual_=!0,is(t),n}finishDraft(e,t){const n=e&&e[mt];(!n||!n.isManual_)&<(9);const{scope_:r}=n;return Io(r,t),Lo(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=gn("Patches").applyPatches_;return mn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function os(e,t){const n=Ia(e)?gn("MapSet").proxyMap_(e,t):$a(e)?gn("MapSet").proxySet_(e,t):Rm(e,t);return(t?t.scope_:Gc()).drafts_.push(n),n}function $m(e){return mn(e)||lt(10,e),Jc(e)}function Jc(e){if(!pn(e)||La(e))return e;const t=e[mt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=rs(e,t.scope_.immer_.useStrictShallowCopy_)}else n=rs(e,!0);return pa(n,(r,a)=>{Yc(n,r,Jc(a))}),t&&(t.finalized_=!1),n}var pt=new Im,Ls=pt.produce;pt.produceWithPatches.bind(pt);pt.setAutoFreeze.bind(pt);pt.setUseStrictShallowCopy.bind(pt);pt.applyPatches.bind(pt);var qo=pt.createDraft.bind(pt),Wo=pt.finishDraft.bind(pt),Lm={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()}}},zm={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Ce.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},qm={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=W.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},ba=new WeakMap,ya=new WeakMap,cr=new WeakMap,Xc=new WeakMap,Ho=new WeakMap,Uo=new WeakMap,Vo=new WeakMap,P={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=P.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var a=e[r],i=t[r];if(a!==i)break;n.push(a)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return P.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return P.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&P.compare(e,t)===0},isBefore(e,t){return P.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&P.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&P.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&P.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&P.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),a=e[e.length-1],i=t[t.length-1];return a!==i&&P.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!P.isAncestor(t,e)&&!P.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(P.equals(i,r)||P.endsBefore(i,r)||P.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(P.equals(s,r)||P.isAncestor(s,r))return null;P.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;P.equals(o,r)||P.endsBefore(o,r)?r[o.length-1]-=1:P.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:c}=t;if(P.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else P.endsBefore(u,r)?r[u.length-1]+=1:P.isAncestor(u,r)&&e[u.length]>=c&&(r[u.length-1]+=1,r[u.length]-=c);break}case"move_node":{var{path:f,newPath:m}=t;if(P.equals(f,m))return r;if(P.isAncestor(f,r)||P.equals(f,r)){var p=m.slice();return P.endsBefore(f,m)&&f.length<m.length&&(p[f.length-1]-=1),p.concat(r.slice(f.length))}else P.isSibling(f,m)&&(P.isAncestor(m,r)||P.equals(m,r))?P.endsBefore(f,r)?r[f.length-1]-=1:r[f.length-1]+=1:P.endsBefore(m,r)||P.equals(m,r)||P.isAncestor(m,r)?(P.endsBefore(f,r)&&(r[f.length-1]-=1),r[m.length-1]+=1):P.endsBefore(f,r)&&(P.equals(m,r)&&(r[m.length-1]+=1),r[f.length-1]-=1);break}}return r}};function Cr(e){"@babel/helpers - typeof";return Cr=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},Cr(e)}function Wm(e,t){if(Cr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Cr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hm(e){var t=Wm(e,"string");return Cr(t)==="symbol"?t:String(t)}function it(e,t,n){return t=Hm(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ko(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 nr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ko(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ko(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Um=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=ie.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 W.points(t))t[l]=Ce.transform(o,n);break}case"insert_text":{var{path:u,offset:c,text:f}=n;if(f.length===0)break;var m=ie.leaf(e,u),p=m.text.slice(0,c),g=m.text.slice(c);if(m.text=p+f+g,t)for(var[h,y]of W.points(t))t[y]=Ce.transform(h,n);break}case"merge_node":{var{path:b}=n,x=ie.get(e,b),B=P.previous(b),E=ie.get(e,B),_=ie.parent(e,b),T=b[b.length-1];if(de.isText(x)&&de.isText(E))E.text+=x.text;else if(!de.isText(x)&&!de.isText(E))E.children.push(...x.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(b,"] to nodes of different interfaces: ").concat(Ye.stringify(x)," ").concat(Ye.stringify(E)));if(_.children.splice(T,1),t)for(var[A,$]of W.points(t))t[$]=Ce.transform(A,n);break}case"move_node":{var{path:I,newPath:j}=n;if(P.isAncestor(I,j))throw new Error("Cannot move a path [".concat(I,"] to new path [").concat(j,"] because the destination is inside itself."));var R=ie.get(e,I),w=ie.parent(e,I),F=I[I.length-1];w.children.splice(F,1);var N=P.transform(I,n),M=ie.get(e,P.parent(N)),Z=N[N.length-1];if(M.children.splice(Z,0,R),t)for(var[K,se]of W.points(t))t[se]=Ce.transform(K,n);break}case"remove_node":{var{path:ne}=n,D=ne[ne.length-1],q=ie.parent(e,ne);if(q.children.splice(D,1),t)for(var[X,k]of W.points(t)){var S=Ce.transform(X,n);if(t!=null&&S!=null)t[k]=S;else{var z=void 0,L=void 0;for(var[U,te]of ie.texts(e))if(P.compare(te,ne)===-1)z=[U,te];else{L=[U,te];break}var ee=!1;z&&L&&(P.equals(L[1],ne)?ee=!P.hasPrevious(L[1]):ee=P.common(z[1],ne).length<P.common(L[1],ne).length),z&&!ee?(X.path=z[1],X.offset=z[0].text.length):L?(X.path=L[1],X.offset=0):t=null}}break}case"remove_text":{var{path:Y,offset:ue,text:J}=n;if(J.length===0)break;var ge=ie.leaf(e,Y),me=ge.text.slice(0,ue),_e=ge.text.slice(ue+J.length);if(ge.text=me+_e,t)for(var[Se,Pe]of W.points(t))t[Pe]=Ce.transform(Se,n);break}case"set_node":{var{path:Ge,properties:Ke,newProperties:Ze}=n;if(Ge.length===0)throw new Error("Cannot set properties on the root node!");var tt=ie.get(e,Ge);for(var Ae in Ze){if(Ae==="children"||Ae==="text")throw new Error('Cannot set the "'.concat(Ae,'" property of nodes!'));var We=Ze[Ae];We==null?delete tt[Ae]:tt[Ae]=We}for(var Le in Ke)Ze.hasOwnProperty(Le)||delete tt[Le];break}case"set_selection":{var{newProperties:H}=n;if(H==null)t=H;else{if(t==null){if(!W.isRange(H))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Ye.stringify(H)," when there is no current selection."));t=nr({},H)}for(var ae in H){var fe=H[ae];if(fe==null){if(ae==="anchor"||ae==="focus")throw new Error('Cannot remove the "'.concat(ae,'" selection property'));delete t[ae]}else t[ae]=fe}}break}case"split_node":{var{path:pe,position:De,properties:Ue}=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 Ve=ie.get(e,pe),ft=ie.parent(e,pe),Pt=pe[pe.length-1],xt;if(de.isText(Ve)){var Qe=Ve.text.slice(0,De),_t=Ve.text.slice(De);Ve.text=Qe,xt=nr(nr({},Ue),{},{text:_t})}else{var ht=Ve.children.slice(0,De),Ya=Ve.children.slice(De);Ve.children=ht,xt=nr(nr({},Ue),{},{children:Ya})}if(ft.children.splice(Pt+1,0,xt),t)for(var[Xn,Or]of W.points(t))t[Or]=Ce.transform(Xn,n);break}}return t},Vm={transform(e,t){e.children=qo(e.children);var n=e.selection&&qo(e.selection);try{n=Um(e,n,t)}finally{e.children=Wo(e.children),n?e.selection=mn(n)?Wo(n):n:e.selection=null}}},Km={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)}},Zm={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)}},ed=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(Je(r)&&Je(a)){if(!ed(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 Ym(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 qt(e,t){if(e==null)return{};var n=Ym(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 Gm=["anchor","focus"];function Zo(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 Qm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var W={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return W.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=W.edges(e);return t},equals(e,t){return Ce.equals(e.anchor,t.anchor)&&Ce.equals(e.focus,t.focus)},includes(e,t){if(W.isRange(t)){if(W.includes(e,t.anchor)||W.includes(e,t.focus))return!0;var[n,r]=W.edges(e),[a,i]=W.edges(t);return Ce.isBefore(n,a)&&Ce.isAfter(r,i)}var[s,o]=W.edges(e),l=!1,u=!1;return Ce.isPoint(t)?(l=Ce.compare(t,s)>=0,u=Ce.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=qt(e,Gm),[r,a]=W.edges(e),[i,s]=W.edges(t),o=Ce.isBefore(r,i)?i:r,l=Ce.isBefore(a,s)?a:s;return Ce.isBefore(l,o)?null:Qm({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return Ce.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Ce.equals(t,n)},isExpanded(e){return!W.isCollapsed(e)},isForward(e){return!W.isBackward(e)},isRange(e){return Je(e)&&Ce.isPoint(e.anchor)&&Ce.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=W.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ls(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=W.isCollapsed(r);W.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?W.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=Ce.transform(r.anchor,t,{affinity:i}),u=Ce.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},Yo=e=>Je(e)&&ie.isNodeList(e.children)&&!v.isEditor(e),ce={isAncestor(e){return Je(e)&&ie.isNodeList(e.children)},isElement:Yo,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 Yo(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},Jm=["children"],Xm=["text"],Go=new WeakMap,ie={ancestor(e,t){var n=ie.get(e,t);if(de.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(Ye.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=ie.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(de.isText(e))throw new Error("Cannot get the child of a text node: ".concat(Ye.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Ye.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=ie.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=ie.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=ie.get(e,r);return[a,r]},descendant(e,t){var n=ie.get(e,t);if(v.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Ye.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ie.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 ie.nodes(e,t))ce.isElement(n)&&(yield[n,r])}()},extractProps(e){if(ce.isAncestor(e)){var t=qt(e,Jm);return t}else{var t=qt(e,Xm);return t}},first(e,t){for(var n=t.slice(),r=ie.get(e,n);r&&!(de.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(de.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(Ye.stringify(e)));var n=Ls({children:e.children},r=>{var[a,i]=W.edges(t),s=ie.nodes(r,{reverse:!0,pass:m=>{var[,p]=m;return!W.includes(t,p)}});for(var[,o]of s){if(!W.includes(t,o)){var l=ie.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(P.equals(o,i.path)){var c=ie.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(P.equals(o,a.path)){var f=ie.leaf(r,o);f.text=f.text.slice(a.offset)}}v.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(de.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Ye.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(de.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return de.isText(e)||ce.isElement(e)||v.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=Go.get(e);if(t!==void 0)return t;var n=e.every(r=>ie.isNode(r));return Go.set(e,n),n},last(e,t){for(var n=t.slice(),r=ie.get(e,n);r&&!(de.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=ie.get(e,t);if(!de.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(Ye.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=ie.get(e,r);yield[a,r]}}()},matches(e,t){return ce.isElement(e)&&ce.isElementProps(t)&&ce.matches(e,t)||de.isText(e)&&de.isTextProps(t)&&de.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?P.isBefore(o,i):P.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!de.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;P.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=ie.get(e,o);continue}if(o.length===0)break;if(!r){var c=P.next(o);if(ie.has(e,c)){o=c,l=ie.get(e,o);continue}}if(r&&o[o.length-1]!==0){var f=P.previous(o);o=f,l=ie.get(e,o);continue}o=P.parent(o),l=ie.get(e,o),s.add(l)}}()},parent(e,t){var n=P.parent(t),r=ie.get(e,n);if(de.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string(e){return de.isText(e)?e.text:e.children.map(ie.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ie.nodes(e,t))de.isText(n)&&(yield[n,r])}()}};function Qo(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 Re(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Qo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Yt={isNodeOperation(e){return Yt.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!Je(e))return!1;switch(e.type){case"insert_node":return P.isPath(e.path)&&ie.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)&&Je(e.properties);case"move_node":return P.isPath(e.path)&&P.isPath(e.newPath);case"remove_node":return P.isPath(e.path)&&ie.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)&&Je(e.properties)&&Je(e.newProperties);case"set_selection":return e.properties===null&&W.isRange(e.newProperties)||e.newProperties===null&&W.isRange(e.properties)||Je(e.properties)&&Je(e.newProperties);case"split_node":return P.isPath(e.path)&&typeof e.position=="number"&&Je(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>Yt.isOperation(t))},isSelectionOperation(e){return Yt.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return Yt.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Re(Re({},e),{},{type:"remove_node"});case"insert_text":return Re(Re({},e),{},{type:"remove_text"});case"merge_node":return Re(Re({},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 Re(Re({},e),{},{path:t,newPath:n});var r=P.transform(n,e),a=P.transform(P.next(n),e);return Re(Re({},e),{},{path:r,newPath:a})}case"remove_node":return Re(Re({},e),{},{type:"insert_node"});case"remove_text":return Re(Re({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Re(Re({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Re(Re({},e),{},{properties:l,newProperties:null}):l==null?Re(Re({},e),{},{properties:null,newProperties:o}):Re(Re({},e),{},{properties:l,newProperties:o})}case"split_node":return Re(Re({},e),{},{type:"merge_node",path:P.next(e.path)})}}},Jo=new WeakMap,ep=e=>{var t=Jo.get(e);if(t!==void 0)return t;if(!Je(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||Je(e.marks))&&(e.selection===null||W.isRange(e.selection))&&ie.isNodeList(e.children)&&Yt.isOperationList(e.operations);return Jo.set(e,n),n},v={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 ep(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)}},tp={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(P.isPath)}};function Xo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function eu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ce={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 Ce.compare(e,t)===1},isBefore(e,t){return Ce.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&P.equals(e.path,t.path)},isPoint(e){return Je(e)&&typeof e.offset=="number"&&P.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ls(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,eu(eu({},n),{},{affinity:"forward"})))}else r.path=P.transform(i,t,n);break}}})}},tu=void 0,Ye={setScrubber(e){tu=e},stringify(e){return JSON.stringify(e,tu)}},np=["text"],rp=["anchor","focus"];function nu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Rt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var de={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=qt(i,np);return s}return ed(r?a(e):e,r?a(t):t)},isText(e){return Je(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>de.isText(t))},isTextProps(e){return e.text!==void 0},matches(e,t){for(var n in t)if(n!=="text"&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[Rt({},e)];for(var r of t){var a=qt(r,rp),[i,s]=W.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var f of n){var{length:m}=f.text,p=l;if(l+=m,u<=p&&l<=c){Object.assign(f,a),o.push(f);continue}if(u!==c&&(u===l||c===p)||u>l||c<p||c===p&&p!==0){o.push(f);continue}var g=f,h=void 0,y=void 0;if(c<l){var b=c-p;y=Rt(Rt({},g),{},{text:g.text.slice(b)}),g=Rt(Rt({},g),{},{text:g.text.slice(0,b)})}if(u>p){var x=u-p;h=Rt(Rt({},g),{},{text:g.text.slice(0,x)}),g=Rt(Rt({},g),{},{text:g.text.slice(x)})}Object.assign(g,a),h&&o.push(h),o.push(g),y&&o.push(y)}n=o}return n}},zs=e=>e.selection?e.selection:e.children.length>0?v.end(e,[]):[0],Qn=(e,t)=>{var[n]=v.node(e,t);return r=>r===n},qs=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?lp(t):t,i=ye.None,s=ye.None,o=0,l=null,u=null;for(var c of a){var f=c.codePointAt(0);if(!f)break;var m=Cp(c,f);if([i,s]=r?[s,m]:[m,i],Sn(i,ye.ZWJ)&&Sn(s,ye.ExtPict)&&(r?l=ru(t.substring(0,o)):l=ru(t.substring(0,t.length-o)),!l)||Sn(i,ye.RI)&&Sn(s,ye.RI)&&(u!==null?u=!u:r?u=!0:u=kp(t.substring(0,t.length-o)),!u)||i!==ye.None&&s!==ye.None&&wp(i,s))break;o+=c.length}return o||1},ap=/\s/,ip=/[\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]/,sp=/['\u2018\u2019]/,op=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=qs(t,n),[s,o]=Ws(t,i,n);if(up(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Ws=(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)]},up=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(ap.test(t))return!1;if(sp.test(t)){var a=qs(n,r),[i,s]=Ws(n,a,r);if(e(i,s,r))return!0}return!ip.test(t)},lp=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(dp(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(cp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},cp=e=>e>=55296&&e<=56319,dp=e=>e>=56320&&e<=57343,ye;(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"})(ye||(ye={}));var fp=/^(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC01\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDE41\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4\uDF00\uDF01\uDF36-\uDF3A\uDF40\uDF42]|\uD80D[\uDC40\uDC47-\uDC55]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])$/,hp=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,mp=/^(?:[\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])$/,pp=/^[\u1100-\u115F\uA960-\uA97C]$/,gp=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,vp=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,bp=/^[\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]$/,yp=/^[\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]$/,Dp=/^(?:[\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])$/,Cp=(e,t)=>{var n=ye.Any;return e.search(fp)!==-1&&(n|=ye.Extend),t===8205&&(n|=ye.ZWJ),t>=127462&&t<=127487&&(n|=ye.RI),e.search(hp)!==-1&&(n|=ye.Prepend),e.search(mp)!==-1&&(n|=ye.SpacingMark),e.search(pp)!==-1&&(n|=ye.L),e.search(gp)!==-1&&(n|=ye.V),e.search(vp)!==-1&&(n|=ye.T),e.search(bp)!==-1&&(n|=ye.LV),e.search(yp)!==-1&&(n|=ye.LVT),e.search(Dp)!==-1&&(n|=ye.ExtPict),n};function Sn(e,t){return(e&t)!==0}var xp=[[ye.L,ye.L|ye.V|ye.LV|ye.LVT],[ye.LV|ye.V,ye.V|ye.T],[ye.LVT|ye.T,ye.T],[ye.Any,ye.Extend|ye.ZWJ],[ye.Any,ye.SpacingMark],[ye.Prepend,ye.Any],[ye.ZWJ,ye.ExtPict],[ye.RI,ye.RI]];function wp(e,t){return xp.findIndex(n=>Sn(e,n[0])&&Sn(t,n[1]))===-1}var Ep=/(?:[\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$/,ru=e=>e.search(Ep)!==-1,_p=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,kp=e=>{var t=e.match(_p);if(t===null)return!1;var n=t[0].length/2;return n%2===1},Bp={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]:{};v.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=zs(e)}=n;if(P.isPath(a)&&(a=v.range(e,a)),W.isRange(a))if(W.isCollapsed(a))a=a.anchor;else{var i=W.end(a);if(!r&&v.void(e,{at:i}))return;var s=W.start(a),o=v.pointRef(e,s),l=v.pointRef(e,i);G.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,G.setSelection(e,{anchor:a,focus:a})}if(!(!r&&v.void(e,{at:a})||v.elementReadOnly(e,{at:a}))){var{path:f,offset:m}=a;t.length>0&&e.apply({type:"insert_text",path:f,offset:m,text:t})}})}};function au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function $r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?au(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):au(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var G=$r($r($r($r({},Vm),Km),Zm),Bp),ra=new WeakMap,Ap=e=>ra.get(e)||!1,Fp=(e,t,n)=>{var r=ra.get(e)||!1;ra.set(e,!0);try{t(),n()}finally{ra.set(e,r)}};function td(e,t,n){var r=ba.get(e)||[],a=ya.get(e)||new Set,i,s,o=f=>{if(f){var m=f.join(",");s.has(m)||(s.add(m),i.push(f))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var c of t)o(c);ba.set(e,i),ya.set(e,s)}var Tp=(e,t)=>{for(var n of v.pathRefs(e))Lm.transform(n,t);for(var r of v.pointRefs(e))zm.transform(r,t);for(var a of v.rangeRefs(e))qm.transform(a,t);if(!Ap(e)){var i=P.operationCanTransformPath(t)?s=>P.transform(s,t):void 0;td(e,e.getDirtyPaths(t),i)}G.transform(e,t),e.operations.push(t),v.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),cr.get(e)||(cr.set(e,!0),Promise.resolve().then(()=>{cr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Sp=(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=de.isText(r)?[]:Array.from(ie.nodes(r),j=>{var[,R]=j;return a.concat(R)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=P.ancestors(o),u=P.previous(o);return[...l,u]}case"move_node":{var{path:c,newPath:f}=t;if(P.equals(c,f))return[];var m=[],p=[];for(var g of P.ancestors(c)){var h=P.transform(g,t);m.push(h)}for(var y of P.ancestors(f)){var b=P.transform(y,t);p.push(b)}var x=p[p.length-1],B=f[f.length-1],E=x.concat(B);return[...m,...p,E]}case"remove_node":{var{path:_}=t,T=P.ancestors(_);return[...T]}case"split_node":{var{path:A}=t,$=P.levels(A),I=P.next(A);return[...$,I]}default:return[]}},jp=e=>{var{selection:t}=e;return t?ie.fragment(e,t):[]},Op=(e,t)=>{var[n,r]=t;if(!de.isText(n)){if(ce.isElement(n)&&n.children.length===0){var a={text:""};G.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=v.isEditor(n)?!1:ce.isElement(n)&&(e.isInline(n)||n.children.length===0||de.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=ie.get(e,r);if(!de.isText(l)){var u=l.children[s],c=l.children[s-1],f=o===n.children.length-1,m=de.isText(u)||ce.isElement(u)&&e.isInline(u);if(m!==i)G.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(ce.isElement(u)){if(e.isInline(u)){if(c==null||!de.isText(c)){var p={text:""};G.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(f){var g={text:""};G.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&de.isText(c)&&(de.equals(u,c,{loose:!0})?(G.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(G.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(G.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Pp=(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},Np=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=v.path(t,i),l=a==="lowest";for(var[u,c]of v.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!de.isText(u)){if(W.isRange(i)){if(P.isAncestor(c,i.anchor.path)&&P.isAncestor(c,i.focus.path))return[u,c]}else if(!P.equals(o,c))return[u,c]}}};function iu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function su(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?iu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):iu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Rp=(e,t,n)=>{var{selection:r}=e;if(r){var a=(f,m)=>{if(!de.isText(f))return!1;var[p,g]=v.parent(e,m);return!e.isVoid(p)||e.markableVoid(p)},i=W.isExpanded(r),s=!1;if(!i){var[o,l]=v.node(e,r);if(o&&a(o,l)){var[u]=v.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)G.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=su(su({},v.marks(e)||{}),{},{[t]:n});e.marks=c,cr.get(e)||e.onChange()}}};function ou(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function uu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ou(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ou(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Mp=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.point(t,n,{edge:"end"}),i=v.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of v.positions(t,uu(uu({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};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 cu(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){it(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 Ip=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.start(t,[]),i=v.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of v.positions(t,cu(cu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},$p=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&G.delete(e,{unit:t,reverse:!0})},Lp=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&G.delete(e,{unit:t})},zp=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&W.isExpanded(r)&&G.delete(t,{reverse:n==="backward"})},qp=(e,t)=>[v.start(e,t),v.end(e,t)];function du(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function fu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?du(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):du(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Wp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return v.above(t,fu(fu({},n),{},{match:r=>ce.isElement(r)&&v.isElementReadOnly(t,r)}))},Hp=(e,t)=>v.point(e,t,{edge:"end"}),Up=(e,t)=>{var n=v.path(e,t,{edge:"start"});return v.node(e,n)},Vp=(e,t)=>{var n=v.range(e,t);return ie.fragment(e,n)};function hu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function mu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Kp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return v.above(t,mu(mu({},n),{},{match:r=>ce.isElement(r)&&v.isVoid(t,r)}))},Zp=(e,t)=>t.children.some(n=>ce.isElement(n)&&v.isBlock(e,n)),Yp=(e,t)=>t.children.some(n=>de.isText(n)||v.isInline(e,n)),Gp=(e,t)=>ie.has(e,t),Qp=(e,t)=>t.children.every(n=>de.isText(n)),Jp=e=>{G.splitNodes(e,{always:!0})},Xp=(e,t,n)=>{G.insertNodes(e,t,n)},eg=e=>{G.splitNodes(e,{always:!0})};function pu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function tg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ng=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=tg({text:n},i);G.insertNodes(t,s,{at:r.at,voids:r.voids})}else G.insertText(t,n,r);t.marks=null}},rg=(e,t)=>!e.isInline(t),ag=(e,t,n)=>v.isStart(e,t,n)||v.isEnd(e,t,n),ig=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&de.isText(r)&&r.text===""&&!e.isVoid(t)},sg=(e,t,n)=>{var r=v.end(e,n);return Ce.equals(t,r)},og=e=>{var t=Xc.get(e);return t===void 0?!0:t},ug=(e,t,n)=>{if(t.offset!==0)return!1;var r=v.start(e,n);return Ce.equals(t,r)},lg=(e,t)=>{var n=v.path(e,t,{edge:"end"});return v.node(e,n)},cg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.path(t,n,r),i=ie.leaf(t,a);return[i,a]};function dg(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=v.path(e,n);for(var[l,u]of ie.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&ce.isElement(l)&&v.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var fg=["text"],hg=["text"],mg=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(W.isExpanded(r)){var s=v.isEnd(t,a,a.path);if(s){var o=v.after(t,a);o&&(a=o)}var[l]=v.nodes(t,{match:de.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=qt(u,fg);return c}else return{}}var{path:f}=a,[m]=v.leaf(t,f);if(a.offset===0){var p=v.previous(t,{at:f,match:de.isText}),g=v.above(t,{match:E=>ce.isElement(E)&&v.isVoid(t,E)&&t.markableVoid(E)});if(!g){var h=v.above(t,{match:E=>ce.isElement(E)&&v.isBlock(t,E)});if(p&&h){var[y,b]=p,[,x]=h;P.isAncestor(x,b)&&(m=y)}}}var B=qt(m,hg);return B},pg=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=v.after(t,s,{voids:a});if(o){var[,l]=v.last(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(P.isPath(s)){var[c]=v.parent(t,s);i=m=>c.children.includes(m)}else i=()=>!0;var[f]=v.nodes(t,{at:u,match:i,mode:r,voids:a});return f}}},gg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.path(t,n,r),i=ie.get(t,a);return[i,a]};function vg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,c;if(tp.isSpan(n))u=n[0],c=n[1];else{var f=v.path(e,n,{edge:"start"}),m=v.path(e,n,{edge:"end"});u=i?m:f,c=i?f:m}var p=ie.nodes(e,{reverse:i,from:u,to:c,pass:E=>{var[_]=E;return ce.isElement(_)?!!(!s&&(v.isVoid(e,_)||v.isElementReadOnly(e,_))||o&&!v.isSelectable(e,_)):!1}}),g=[],h;for(var[y,b]of p)if(!(o&&ce.isElement(y)&&!v.isSelectable(e,y))){var x=h&&P.compare(b,h[1])===0;if(!(r==="highest"&&x)){if(!l(y,b)){if(a&&!x&&de.isText(y))return;continue}if(r==="lowest"&&x){h=[y,b];continue}var B=r==="lowest"?h:[y,b];B&&(a?g.push(B):yield B),h=[y,b]}}r==="lowest"&&h&&(a?g.push(h):yield h),a&&(yield*g)}}()}var bg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>ba.get(c)||[],s=c=>ya.get(c)||new Set,o=c=>{var f=i(c).pop(),m=f.join(",");return s(c).delete(m),f};if(v.isNormalizing(t)){if(r){var l=Array.from(ie.nodes(t),c=>{var[,f]=c;return f}),u=new Set(l.map(c=>c.join(",")));ba.set(t,l),ya.set(t,u)}i(t).length!==0&&v.withoutNormalizing(t,()=>{for(var c of i(t))if(ie.has(t,c)){var f=v.node(t,c),[m,p]=f;ce.isElement(m)&&m.children.length===0&&t.normalizeNode(f,{operation:a})}for(var g=i(t),h=g.length,y=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:y,initialDirtyPathsLength:h,operation:a}))return;var b=o(t);if(ie.has(t,b)){var x=v.node(t,b);t.normalizeNode(x,{operation:a})}y++,g=i(t)}})}},yg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.path(t,n,r),i=P.parent(a),s=v.node(t,i);return s},Dg=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=v.pathRefs(t);return l.delete(i),i.current=null,o}},s=v.pathRefs(t);return s.add(i),i},Cg=e=>{var t=Ho.get(e);return t||(t=new Set,Ho.set(e,t)),t},xg=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]=ie.first(t,n);n=s}else if(i==="end"){var[,o]=ie.last(t,n);n=o}}return W.isRange(n)&&(i==="start"?n=W.start(n):i==="end"?n=W.end(n):n=P.common(n.anchor.path,n.focus.path)),Ce.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},wg=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=v.pointRefs(t);return l.delete(i),i.current=null,o}},s=v.pointRefs(t);return s.add(i),i},Eg=e=>{var t=Uo.get(e);return t||(t=new Set,Uo.set(e,t)),t},_g=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]=ie.last(t,n);i=s}else{var[,o]=ie.first(t,n);i=o}var l=ie.get(t,i);if(!de.isText(l))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?l.text.length:0}}if(W.isRange(n)){var[u,c]=W.edges(n);return a==="start"?u:c}return n};function kg(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=v.range(e,n),[l,u]=W.edges(o),c=a?u:l,f=!1,m="",p=0,g=0,h=0;for(var[y,b]of v.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(ce.isElement(y)){if(!i&&(e.isVoid(y)||e.isElementReadOnly(y))){yield v.start(e,b);continue}if(e.isInline(y))continue;if(v.hasInlines(e,y)){var x=P.isAncestor(b,u.path)?u:v.end(e,b),B=P.isAncestor(b,l.path)?l:v.start(e,b);m=v.string(e,{anchor:B,focus:x},{voids:i}),f=!0}}if(de.isText(y)){var E=P.equals(b,c.path);for(E?(g=a?c.offset:y.text.length-c.offset,h=c.offset):(g=y.text.length,h=a?g:0),(E||f||r==="offset")&&(yield{path:b,offset:h},f=!1);;){if(p===0){if(m==="")break;p=_(m,r,a),m=Ws(m,p,a)[1]}if(h=a?h-p:h+p,g=g-p,g<0){p=-g;break}p=0,yield{path:b,offset:h}}}}function _(T,A,$){return A==="character"?qs(T,$):A==="word"?op(T,$):A==="line"||A==="block"?T.length:1}}()}var Bg=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=v.before(t,s,{voids:a});if(o){var[,l]=v.first(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(P.isPath(s)){var[c]=v.parent(t,s);i=m=>c.children.includes(m)}else i=()=>!0;var[f]=v.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return f}}},Ag=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=v.rangeRefs(t);return l.delete(i),i.current=null,o}},s=v.rangeRefs(t);return s.add(i),i},Fg=e=>{var t=Vo.get(e);return t||(t=new Set,Vo.set(e,t)),t},Tg=(e,t,n)=>{if(W.isRange(t)&&!n)return t;var r=v.start(e,t),a=v.end(e,n||t);return{anchor:r,focus:a}};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 Sg(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){it(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 jg=(e,t)=>{var{selection:n}=e;if(n){var r=(c,f)=>{if(!de.isText(c))return!1;var[m,p]=v.parent(e,f);return!e.isVoid(m)||e.markableVoid(m)},a=W.isExpanded(n),i=!1;if(!a){var[s,o]=v.node(e,n);if(s&&r(s,o)){var[l]=v.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)G.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Sg({},v.marks(e)||{});delete u[t],e.marks=u,cr.get(e)||e.onChange()}}},Og=(e,t)=>{Xc.set(e,t)},Pg=(e,t)=>v.point(e,t,{edge:"start"}),Ng=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=v.range(t,n),[s,o]=W.edges(i),l="";for(var[u,c]of v.nodes(t,{at:i,match:de.isText,voids:a})){var f=u.text;P.equals(c,o.path)&&(f=f.slice(0,o.offset)),P.equals(c,s.path)&&(f=f.slice(s.offset)),l+=f}return l},Rg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=W.edges(n);if(i.offset!==0||s.offset!==0||W.isCollapsed(n)||P.hasPrevious(s.path))return n;var o=v.above(t,{at:s,match:g=>ce.isElement(g)&&v.isBlock(t,g),voids:a}),l=o?o[1]:[],u=v.start(t,i),c={anchor:u,focus:s},f=!0;for(var[m,p]of v.nodes(t,{at:c,match:de.isText,reverse:!0,voids:a})){if(f){f=!1;continue}if(m.text!==""||P.isBefore(p,l)){s={path:p,offset:m.text.length};break}}return{anchor:i,focus:s}},Mg=(e,t)=>{var n=v.isNormalizing(e);v.setNormalizing(e,!1);try{t()}finally{v.setNormalizing(e,n)}v.normalize(e)},Ig=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:c=!1}=n;if(u){var f=!1;if(W.isRange(u)&&W.isCollapsed(u)&&(f=!0,u=u.anchor),Ce.isPoint(u)){var m=v.void(t,{at:u,mode:"highest"});if(!l&&m){var[,p]=m;u=p}else{var g={unit:s,distance:o},h=i?v.before(t,u,g)||v.start(t,[]):v.after(t,u,g)||v.end(t,[]);u={anchor:u,focus:h},c=!0}}if(P.isPath(u)){G.removeNodes(t,{at:u,voids:l});return}if(!W.isCollapsed(u)){if(!c){var[,y]=W.edges(u),b=v.end(t,[]);Ce.equals(y,b)||(u=v.unhangRange(t,u,{voids:l}))}var[x,B]=W.edges(u),E=v.above(t,{match:me=>ce.isElement(me)&&v.isBlock(t,me),at:x,voids:l}),_=v.above(t,{match:me=>ce.isElement(me)&&v.isBlock(t,me),at:B,voids:l}),T=E&&_&&!P.equals(E[1],_[1]),A=P.equals(x.path,B.path),$=l?null:(r=v.void(t,{at:x,mode:"highest"}))!==null&&r!==void 0?r:v.elementReadOnly(t,{at:x,mode:"highest"}),I=l?null:(a=v.void(t,{at:B,mode:"highest"}))!==null&&a!==void 0?a:v.elementReadOnly(t,{at:B,mode:"highest"});if($){var j=v.before(t,x);j&&E&&P.isAncestor(E[1],j.path)&&(x=j)}if(I){var R=v.after(t,B);R&&_&&P.isAncestor(_[1],R.path)&&(B=R)}var w=[],F;for(var N of v.nodes(t,{at:u,voids:l})){var[M,Z]=N;F&&P.compare(Z,F)===0||(!l&&ce.isElement(M)&&(v.isVoid(t,M)||v.isElementReadOnly(t,M))||!P.isCommon(Z,x.path)&&!P.isCommon(Z,B.path))&&(w.push(N),F=Z)}var K=Array.from(w,me=>{var[,_e]=me;return v.pathRef(t,_e)}),se=v.pointRef(t,x),ne=v.pointRef(t,B),D="";if(!A&&!$){var q=se.current,[X]=v.leaf(t,q),{path:k}=q,{offset:S}=x,z=X.text.slice(S);z.length>0&&(t.apply({type:"remove_text",path:k,offset:S,text:z}),D=z)}if(K.reverse().map(me=>me.unref()).filter(me=>me!==null).forEach(me=>G.removeNodes(t,{at:me,voids:l})),!I){var L=ne.current,[U]=v.leaf(t,L),{path:te}=L,ee=A?x.offset:0,Y=U.text.slice(ee,B.offset);Y.length>0&&(t.apply({type:"remove_text",path:te,offset:ee,text:Y}),D=Y)}!A&&T&&ne.current&&se.current&&G.mergeNodes(t,{at:ne.current,hanging:!0,voids:l}),f&&i&&s==="character"&&D.length>1&&D.match(/[\u0E00-\u0E7F]+/)&&G.insertText(t,D.slice(0,D.length-o));var ue=se.unref(),J=ne.unref(),ge=i?ue||J:J||ue;n.at==null&&ge&&G.select(t,ge)}}})},$g=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=zs(t),batchDirty:o=!0}=r;if(n.length){if(W.isRange(s))if(a||(s=v.unhangRange(t,s,{voids:i})),W.isCollapsed(s))s=s.anchor;else{var[,l]=W.edges(s);if(!i&&v.void(t,{at:l}))return;var u=v.pointRef(t,l);G.delete(t,{at:s}),s=u.unref()}else P.isPath(s)&&(s=v.start(t,s));if(!(!i&&v.void(t,{at:s}))){var c=v.above(t,{at:s,match:z=>ce.isElement(z)&&v.isInline(t,z),mode:"highest",voids:i});if(c){var[,f]=c;if(v.isEnd(t,s,f)){var m=v.after(t,f);s=m}else if(v.isStart(t,s,f)){var p=v.before(t,f);s=p}}var g=v.above(t,{match:z=>ce.isElement(z)&&v.isBlock(t,z),at:s,voids:i}),[,h]=g,y=v.isStart(t,s,h),b=v.isEnd(t,s,h),x=y&&b,B=!y||y&&b,E=!b,[,_]=ie.first({children:n},[]),[,T]=ie.last({children:n},[]),A=[],$=z=>{var[L,U]=z,te=U.length===0;return te?!1:x?!0:!(B&&P.isAncestor(U,_)&&ce.isElement(L)&&!t.isVoid(L)&&!t.isInline(L)||E&&P.isAncestor(U,T)&&ce.isElement(L)&&!t.isVoid(L)&&!t.isInline(L))};for(var I of ie.nodes({children:n},{pass:$}))$(I)&&A.push(I);var j=[],R=[],w=[],F=!0,N=!1;for(var[M]of A)ce.isElement(M)&&!t.isInline(M)?(F=!1,N=!0,R.push(M)):F?j.push(M):w.push(M);var[Z]=v.nodes(t,{at:s,match:z=>de.isText(z)||v.isInline(t,z),mode:"highest",voids:i}),[,K]=Z,se=v.isStart(t,s,K),ne=v.isEnd(t,s,K),D=v.pathRef(t,b&&!w.length?P.next(h):h),q=v.pathRef(t,ne?P.next(K):K);G.splitNodes(t,{at:s,match:z=>N?ce.isElement(z)&&v.isBlock(t,z):de.isText(z)||v.isInline(t,z),mode:N?"lowest":"highest",always:N&&(!y||j.length>0)&&(!b||w.length>0),voids:i});var X=v.pathRef(t,!se||se&&ne?P.next(K):K);if(G.insertNodes(t,j,{at:X.current,match:z=>de.isText(z)||v.isInline(t,z),mode:"highest",voids:i,batchDirty:o}),x&&!j.length&&R.length&&!w.length&&G.delete(t,{at:h,voids:i}),G.insertNodes(t,R,{at:D.current,match:z=>ce.isElement(z)&&v.isBlock(t,z),mode:"lowest",voids:i,batchDirty:o}),G.insertNodes(t,w,{at:q.current,match:z=>de.isText(z)||v.isInline(t,z),mode:"highest",voids:i,batchDirty:o}),!r.at){var k;if(w.length>0&&q.current?k=P.previous(q.current):R.length>0&&D.current?k=P.previous(D.current):X.current&&(k=P.previous(X.current)),k){var S=v.end(t,k);G.select(t,S)}}X.unref(),D.unref(),q.unref()}}})},Lg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")G.select(t,a.anchor);else if(r==="focus")G.select(t,a.focus);else if(r==="start"){var[i]=W.edges(a);G.select(t,i)}else if(r==="end"){var[,s]=W.edges(a);G.select(t,s)}}else return},zg=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},qg=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=W.isBackward(r)?"focus":"anchor"),o==="end"&&(o=W.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,c={distance:a,unit:i,ignoreNonSelectable:!0},f={};if(o==null||o==="anchor"){var m=s?v.before(t,l,c):v.after(t,l,c);m&&(f.anchor=m)}if(o==null||o==="focus"){var p=s?v.before(t,u,c):v.after(t,u,c);p&&(f.focus=p)}G.setSelection(t,f)}},Wg=(e,t)=>{var{selection:n}=e;if(t=v.range(e,t),n){G.setSelection(e,t);return}if(!W.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(Ye.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function vu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function bu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vu(Object(n),!0).forEach(function(r){it(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 Hg=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=W.isBackward(a)?"focus":"anchor"),i==="end"&&(i=W.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;G.setSelection(t,{[i==="anchor"?"anchor":"focus"]:bu(bu({},l),n)})}},Ug=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!Ce.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!Ce.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})}},Vg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:c}=r;if(ie.isNode(n)&&(n=[n]),n.length!==0){var[f]=n;if(l||(l=zs(t),c!==!1&&(c=!0)),c==null&&(c=!1),W.isRange(l))if(a||(l=v.unhangRange(t,l,{voids:i})),W.isCollapsed(l))l=l.anchor;else{var[,m]=W.edges(l),p=v.pointRef(t,m);G.delete(t,{at:l}),l=p.unref()}if(Ce.isPoint(l)){u==null&&(de.isText(f)?u=j=>de.isText(j):t.isInline(f)?u=j=>de.isText(j)||v.isInline(t,j):u=j=>ce.isElement(j)&&v.isBlock(t,j));var[g]=v.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,h]=g,y=v.pathRef(t,h),b=v.isEnd(t,l,h);G.splitNodes(t,{at:l,match:u,mode:s,voids:i});var x=y.unref();l=b?P.next(x):x}else return}var B=P.parent(l),E=l[l.length-1];if(!(!i&&v.void(t,{at:B}))){if(o){var _=[],T=P.levels(B);Fp(t,()=>{var j=function(){var F=B.concat(E);E++;var N={type:"insert_node",path:F,node:R};t.apply(N),l=P.next(l),_.push(N),de.isText?T.push(...Array.from(ie.nodes(R),M=>{var[,Z]=M;return F.concat(Z)})):T.push(F)};for(var R of n)j()},()=>{td(t,T,j=>{var R=j;for(var w of _)if(P.operationCanTransformPath(w)&&(R=P.transform(R,w),!R))return null;return R})})}else for(var A of n){var $=B.concat(E);E++,t.apply({type:"insert_node",path:$,node:A}),l=P.next(l)}if(l=P.previous(l),c){var I=v.end(t,l);I&&G.select(t,I)}}}})},Kg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=P.isPath(r)?Qn(t,r):E=>ce.isElement(E)&&v.isBlock(t,E)),!!r){var o=v.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,E=>{var[,_]=E;return v.pathRef(t,_)});for(var u of l){var c=u.unref();if(c.length<2)throw new Error("Cannot lift node at a path [".concat(c,"] because it has a depth of less than `2`."));var f=v.node(t,P.parent(c)),[m,p]=f,g=c[c.length-1],{length:h}=m.children;if(h===1){var y=P.next(p);G.moveNodes(t,{at:c,to:y,voids:i}),G.removeNodes(t,{at:p,voids:i})}else if(g===0)G.moveNodes(t,{at:c,to:p,voids:i});else if(g===h-1){var b=P.next(p);G.moveNodes(t,{at:c,to:b,voids:i})}else{var x=P.next(c),B=P.next(p);G.splitNodes(t,{at:x,voids:i}),G.moveNodes(t,{at:c,to:B,voids:i})}}}})},Zg=["text"],Yg=["children"],nd=(e,t)=>{if(ce.isElement(t)){var n=t;return v.isVoid(e,t)?!0:n.children.length===1?nd(e,n.children[0]):!1}else return!v.isEditor(t)},Gg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.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]=v.parent(t,a);r=j=>l.children.includes(j)}else r=j=>ce.isElement(j)&&v.isBlock(t,j);if(!i&&W.isRange(a)&&(a=v.unhangRange(t,a,{voids:s})),W.isRange(a))if(W.isCollapsed(a))a=a.anchor;else{var[,u]=W.edges(a),c=v.pointRef(t,u);G.delete(t,{at:a}),a=c.unref(),n.at==null&&G.select(t,a)}var[f]=v.nodes(t,{at:a,match:r,voids:s,mode:o}),m=v.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!f||!m)){var[p,g]=f,[h,y]=m;if(!(g.length===0||y.length===0)){var b=P.next(y),x=P.common(g,y),B=P.isSibling(g,y),E=Array.from(v.levels(t,{at:g}),j=>{var[R]=j;return R}).slice(x.length).slice(0,-1),_=v.above(t,{at:g,mode:"highest",match:j=>E.includes(j)&&nd(t,j)}),T=_&&v.pathRef(t,_[1]),A,$;if(de.isText(p)&&de.isText(h)){var I=qt(p,Zg);$=h.text.length,A=I}else if(ce.isElement(p)&&ce.isElement(h)){var I=qt(p,Yg);$=h.children.length,A=I}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(Ye.stringify(p)," ").concat(Ye.stringify(h)));B||G.moveNodes(t,{at:g,to:b,voids:s}),T&&G.removeNodes(t,{at:T.current,voids:s}),ce.isElement(h)&&v.isEmpty(t,h)||de.isText(h)&&h.text===""&&y[y.length-1]!==0?G.removeNodes(t,{at:y,voids:s}):t.apply({type:"merge_node",path:b,position:$,properties:A}),T&&T.unref()}}}})},Qg=(e,t)=>{v.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)?Qn(e,r):p=>ce.isElement(p)&&v.isBlock(e,p));var o=v.pathRef(e,n),l=v.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,p=>{var[,g]=p;return v.pathRef(e,g)});for(var c of u){var f=c.unref(),m=o.current;f.length!==0&&e.apply({type:"move_node",path:f,newPath:m}),o.current&&P.isSibling(m,f)&&P.isAfter(m,f)&&(o.current=P.next(o.current))}o.unref()}})},Jg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.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)?Qn(t,s):p=>ce.isElement(p)&&v.isBlock(t,p)),!r&&W.isRange(s)&&(s=v.unhangRange(t,s,{voids:a}));var l=v.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,p=>{var[,g]=p;return v.pathRef(t,g)});for(var c of u){var f=c.unref();if(f){var[m]=v.node(t,f);t.apply({type:"remove_node",path:f,node:m})}}}})},Xg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:c=!1,voids:f=!1}=r;if(i){if(a==null&&(a=P.isPath(i)?Qn(t,i):$=>ce.isElement($)&&v.isBlock(t,$)),!l&&W.isRange(i)&&(i=v.unhangRange(t,i,{voids:f})),c&&W.isRange(i)){if(W.isCollapsed(i)&&v.leaf(t,i.anchor)[0].text.length>0)return;var m=v.rangeRef(t,i,{affinity:"inward"}),[p,g]=W.edges(i),h=u==="lowest"?"lowest":"highest",y=v.isEnd(t,g,g.path);G.splitNodes(t,{at:g,match:a,mode:h,voids:f,always:!y});var b=v.isStart(t,p,p.path);G.splitNodes(t,{at:p,match:a,mode:h,voids:f,always:!b}),i=m.unref(),r.at==null&&G.select(t,i)}s||(s=($,I)=>$!==I);for(var[x,B]of v.nodes(t,{at:i,match:a,mode:u,voids:f})){var E={},_={};if(B.length!==0){var T=!1;for(var A in n)A==="children"||A==="text"||s(n[A],x[A])&&(T=!0,x.hasOwnProperty(A)&&(E[A]=x[A]),o?n[A]!=null&&(_[A]=o(x[A],n[A])):n[A]!=null&&(_[A]=n[A]));T&&t.apply({type:"set_node",path:B,properties:E,newProperties:_})}}}})},ev=(e,t)=>{if(W.isCollapsed(t))return t.anchor;var[,n]=W.edges(t),r=v.pointRef(e,n);return G.delete(e,{at:t}),r.unref()},tv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.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=ne=>ce.isElement(ne)&&v.isBlock(t,ne)),W.isRange(s)&&(s=ev(t,s)),P.isPath(s)){var u=s,c=v.point(t,u),[f]=v.parent(t,u);i=ne=>ne===f,o=c.path.length-u.length+1,s=c,l=!0}if(s){var m=v.pointRef(t,s,{affinity:"backward"}),p;try{var[g]=v.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var h=v.void(t,{at:s,mode:"highest"}),y=0;if(!a&&h){var[b,x]=h;if(ce.isElement(b)&&t.isInline(b)){var B=v.after(t,x);if(!B){var E={text:""},_=P.next(x);G.insertNodes(t,E,{at:_,voids:a}),B=v.point(t,_)}s=B,l=!0}var T=s.path.length-x.length;o=T+1,l=!0}p=v.pointRef(t,s);var A=s.path.length-o,[,$]=g,I=s.path.slice(0,A),j=o===0?s.offset:s.path[A]+y;for(var[R,w]of v.levels(t,{at:I,reverse:!0,voids:a})){var F=!1;if(w.length<$.length||w.length===0||!a&&ce.isElement(R)&&v.isVoid(t,R))break;var N=m.current,M=v.isEnd(t,N,w);if(l||!m||!v.isEdge(t,N,w)){F=!0;var Z=ie.extractProps(R);t.apply({type:"split_node",path:w,position:j,properties:Z})}j=w[w.length-1]+(F||M?1:0)}if(n.at==null){var K=p.current||v.end(t,[]);G.select(t,K)}}finally{var se;m.unref(),(se=p)===null||se===void 0||se.unref()}}})},nv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var a={};for(var i of n)a[i]=null;G.setNodes(t,a,r)},rv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.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)?Qn(t,s):p=>ce.isElement(p)&&v.isBlock(t,p)),P.isPath(s)&&(s=v.range(t,s));var l=W.isRange(s)?v.rangeRef(t,s):null,u=v.nodes(t,{at:s,match:o,mode:r,voids:i}),c=Array.from(u,p=>{var[,g]=p;return v.pathRef(t,g)}).reverse(),f=function(){var g=m.unref(),[h]=v.node(t,g),y=v.range(t,g);a&&l&&(y=W.intersection(l.current,y)),G.liftNodes(t,{at:y,match:b=>ce.isAncestor(h)&&h.children.includes(b),voids:i})};for(var m of c)f();l&&l.unref()}})};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){it(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 av=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.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=Qn(t,l):t.isInline(n)?o=y=>ce.isElement(y)&&v.isInline(t,y)||de.isText(y):o=y=>ce.isElement(y)&&v.isBlock(t,y)),i&&W.isRange(l)){var[u,c]=W.edges(l),f=v.rangeRef(t,l,{affinity:"inward"});G.splitNodes(t,{at:c,match:o,voids:s}),G.splitNodes(t,{at:u,match:o,voids:s}),l=f.unref(),r.at==null&&G.select(t,l)}var m=Array.from(v.nodes(t,{at:l,match:t.isInline(n)?y=>ce.isElement(y)&&v.isBlock(t,y):y=>v.isEditor(y),mode:"lowest",voids:s})),p=function(){var b=W.isRange(l)?W.intersection(l,v.range(t,h)):l;if(!b)return 0;var x=Array.from(v.nodes(t,{at:b,match:o,mode:a,voids:s}));if(x.length>0){var[B]=x,E=x[x.length-1],[,_]=B,[,T]=E;if(_.length===0&&T.length===0)return 0;var A=P.equals(_,T)?P.parent(_):P.common(_,T),$=v.range(t,_,T),I=v.node(t,A),[j]=I,R=A.length+1,w=P.next(T.slice(0,R)),F=Du(Du({},n),{},{children:[]});G.insertNodes(t,F,{at:w,voids:s}),G.moveNodes(t,{at:$,match:N=>ce.isAncestor(j)&&j.children.includes(N),to:w.concat(0),voids:s})}},g;for(var[,h]of m)g=p()}})},iv=()=>{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 Tp(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rp(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $p(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lp(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zp(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jp(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jp(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eg(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xp(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ng(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Op(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sp(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pp(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Np(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mp(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ip(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qp(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wp(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hp(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Up(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vp(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mg(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zp(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yp(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gp(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qp(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rg(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ag(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ig(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sg(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return og(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ug(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lg(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dg(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kg(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gg(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qg(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gg(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vg(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bg(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tg(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fg(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xg(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hg(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ug(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tv(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nv(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rv(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kp(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return av(e,...r)}};return e},sv={isHistory(e){return Je(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||Yt.isOperationList(e.redos[0].operations))&&(e.undos.length===0||Yt.isOperationList(e.undos[0].operations))}},li=new WeakMap,ci=new WeakMap,jn={isHistoryEditor(e){return sv.isHistory(e.history)&&v.isEditor(e)},isMerging(e){return ci.get(e)},isSaving(e){return li.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=jn.isMerging(e);ci.set(e,!1),t(),ci.set(e,n)},withoutSaving(e,t){var n=jn.isSaving(e);li.set(e,!1),t(),li.set(e,n)}},ov=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&G.setSelection(t,i.selectionBefore),jn.withoutSaving(t,()=>{v.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];jn.withoutSaving(t,()=>{v.withoutNormalizing(t,()=>{var s=i.operations.map(Yt.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&G.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=jn.isSaving(t),c=jn.isMerging(t);if(u==null&&(u=lv(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=uv(r,l)),o&&c)o.operations.push(r);else{var f={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",f)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},uv=(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)),lv=(e,t)=>e.type!=="set_selection",cv=hv,rd="֑-߿יִ-﷽ﹰ-ﻼ",ad="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",dv=new RegExp("^[^"+ad+"]*["+rd+"]"),fv=new RegExp("^[^"+rd+"]*["+ad+"]");function hv(e){return e=String(e||""),dv.test(e)?"rtl":fv.test(e)?"ltr":"neutral"}const id=bn(cv);function mv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Hs=mv,pv=typeof Pr=="object"&&Pr&&Pr.Object===Object&&Pr,gv=pv,vv=gv,bv=typeof self=="object"&&self&&self.Object===Object&&self,yv=vv||bv||Function("return this")(),sd=yv,Dv=sd,Cv=function(){return Dv.Date.now()},xv=Cv,wv=/\s/;function Ev(e){for(var t=e.length;t--&&wv.test(e.charAt(t)););return t}var _v=Ev,kv=_v,Bv=/^\s+/;function Av(e){return e&&e.slice(0,kv(e)+1).replace(Bv,"")}var Fv=Av,Tv=sd,Sv=Tv.Symbol,od=Sv,Cu=od,ud=Object.prototype,jv=ud.hasOwnProperty,Ov=ud.toString,rr=Cu?Cu.toStringTag:void 0;function Pv(e){var t=jv.call(e,rr),n=e[rr];try{e[rr]=void 0;var r=!0}catch{}var a=Ov.call(e);return r&&(t?e[rr]=n:delete e[rr]),a}var Nv=Pv,Rv=Object.prototype,Mv=Rv.toString;function Iv(e){return Mv.call(e)}var $v=Iv,xu=od,Lv=Nv,zv=$v,qv="[object Null]",Wv="[object Undefined]",wu=xu?xu.toStringTag:void 0;function Hv(e){return e==null?e===void 0?Wv:qv:wu&&wu in Object(e)?Lv(e):zv(e)}var Uv=Hv;function Vv(e){return e!=null&&typeof e=="object"}var Kv=Vv,Zv=Uv,Yv=Kv,Gv="[object Symbol]";function Qv(e){return typeof e=="symbol"||Yv(e)&&Zv(e)==Gv}var Jv=Qv,Xv=Fv,Eu=Hs,e0=Jv,_u=0/0,t0=/^[-+]0x[0-9a-f]+$/i,n0=/^0b[01]+$/i,r0=/^0o[0-7]+$/i,a0=parseInt;function i0(e){if(typeof e=="number")return e;if(e0(e))return _u;if(Eu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Eu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Xv(e);var n=n0.test(e);return n||r0.test(e)?a0(e.slice(2),n?2:8):t0.test(e)?_u:+e}var s0=i0,o0=Hs,di=xv,ku=s0,u0="Expected a function",l0=Math.max,c0=Math.min;function d0(e,t,n){var r,a,i,s,o,l,u=0,c=!1,f=!1,m=!0;if(typeof e!="function")throw new TypeError(u0);t=ku(t)||0,o0(n)&&(c=!!n.leading,f="maxWait"in n,i=f?l0(ku(n.maxWait)||0,t):i,m="trailing"in n?!!n.trailing:m);function p(T){var A=r,$=a;return r=a=void 0,u=T,s=e.apply($,A),s}function g(T){return u=T,o=setTimeout(b,t),c?p(T):s}function h(T){var A=T-l,$=T-u,I=t-A;return f?c0(I,i-$):I}function y(T){var A=T-l,$=T-u;return l===void 0||A>=t||A<0||f&&$>=i}function b(){var T=di();if(y(T))return x(T);o=setTimeout(b,h(T))}function x(T){return o=void 0,m&&r?p(T):(r=a=void 0,s)}function B(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function E(){return o===void 0?s:x(di())}function _(){var T=di(),A=y(T);if(r=arguments,a=this,l=T,A){if(o===void 0)return g(l);if(f)return clearTimeout(o),o=setTimeout(b,t),p(l)}return o===void 0&&(o=setTimeout(b,t)),s}return _.cancel=B,_.flush=E,_}var ld=d0;const f0=bn(ld);var h0=ld,m0=Hs,p0="Expected a function";function g0(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(p0);return m0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),h0(e,t,{leading:r,maxWait:t,trailing:a})}var v0=g0;const b0=bn(v0),Bu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Au=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",fi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Au(n.overflowY,t)||Au(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},Lr=(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,y0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Fu=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,f=typeof u=="function"?u:Z=>Z!==u;if(!Bu(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let g=e;for(;Bu(g)&&f(g);){if(g=y0(g),g===m){p.push(g);break}g!=null&&g===document.body&&fi(g)&&!fi(document.documentElement)||g!=null&&fi(g,c)&&p.push(g)}const h=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,y=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:b,scrollY:x}=window,{height:B,width:E,top:_,right:T,bottom:A,left:$}=e.getBoundingClientRect(),{top:I,right:j,bottom:R,left:w}=(Z=>{const K=window.getComputedStyle(Z);return{top:parseFloat(K.scrollMarginTop)||0,right:parseFloat(K.scrollMarginRight)||0,bottom:parseFloat(K.scrollMarginBottom)||0,left:parseFloat(K.scrollMarginLeft)||0}})(e);let F=o==="start"||o==="nearest"?_-I:o==="end"?A+R:_+B/2-I+R,N=l==="center"?$+E/2-w+j:l==="end"?T+j:$-w;const M=[];for(let Z=0;Z<p.length;Z++){const K=p[Z],{height:se,width:ne,top:D,right:q,bottom:X,left:k}=K.getBoundingClientRect();if(s==="if-needed"&&_>=0&&$>=0&&A<=y&&T<=h&&_>=D&&A<=X&&$>=k&&T<=q)return M;const S=getComputedStyle(K),z=parseInt(S.borderLeftWidth,10),L=parseInt(S.borderTopWidth,10),U=parseInt(S.borderRightWidth,10),te=parseInt(S.borderBottomWidth,10);let ee=0,Y=0;const ue="offsetWidth"in K?K.offsetWidth-K.clientWidth-z-U:0,J="offsetHeight"in K?K.offsetHeight-K.clientHeight-L-te:0,ge="offsetWidth"in K?K.offsetWidth===0?0:ne/K.offsetWidth:0,me="offsetHeight"in K?K.offsetHeight===0?0:se/K.offsetHeight:0;if(m===K)ee=o==="start"?F:o==="end"?F-y:o==="nearest"?Lr(x,x+y,y,L,te,x+F,x+F+B,B):F-y/2,Y=l==="start"?N:l==="center"?N-h/2:l==="end"?N-h:Lr(b,b+h,h,z,U,b+N,b+N+E,E),ee=Math.max(0,ee+x),Y=Math.max(0,Y+b);else{ee=o==="start"?F-D-L:o==="end"?F-X+te+J:o==="nearest"?Lr(D,X,se,L,te+J,F,F+B,B):F-(D+se/2)+J/2,Y=l==="start"?N-k-z:l==="center"?N-(k+ne/2)+ue/2:l==="end"?N-q+U+ue:Lr(k,q,ne,z,U+ue,N,N+E,E);const{scrollLeft:_e,scrollTop:Se}=K;ee=me===0?0:Math.max(0,Math.min(Se+ee/me,K.scrollHeight-se/me+J)),Y=ge===0?0:Math.max(0,Math.min(_e+Y/ge,K.scrollWidth-ne/ge+ue)),F+=Se-ee,N+=_e-Y}M.push({el:K,top:ee,left:Y})}return M},D0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function C0(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(Fu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Fu(e,D0(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var dn=[],x0=function(){return dn.some(function(e){return e.activeTargets.length>0})},w0=function(){return dn.some(function(e){return e.skippedTargets.length>0})},Tu="ResizeObserver loop completed with undelivered notifications.",E0=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Tu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Tu),window.dispatchEvent(e)},xr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(xr||(xr={}));var fn=function(e){return Object.freeze(e)},_0=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,fn(this)}return e}(),cd=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,fn(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}(),Us=function(e){return e instanceof SVGElement&&"getBBox"in e},dd=function(e){if(Us(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)},Su=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)},k0=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},dr=typeof window<"u"?window:{},zr=new WeakMap,ju=/auto|scroll/,B0=/^tb|vertical/,A0=/msie|trident/i.test(dr.navigator&&dr.navigator.userAgent),kt=function(e){return parseFloat(e||"0")},Mn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new _0((n?t:e)||0,(n?e:t)||0)},Ou=fn({devicePixelContentBoxSize:Mn(),borderBoxSize:Mn(),contentBoxSize:Mn(),contentRect:new cd(0,0,0,0)}),fd=function(e,t){if(t===void 0&&(t=!1),zr.has(e)&&!t)return zr.get(e);if(dd(e))return zr.set(e,Ou),Ou;var n=getComputedStyle(e),r=Us(e)&&e.ownerSVGElement&&e.getBBox(),a=!A0&&n.boxSizing==="border-box",i=B0.test(n.writingMode||""),s=!r&&ju.test(n.overflowY||""),o=!r&&ju.test(n.overflowX||""),l=r?0:kt(n.paddingTop),u=r?0:kt(n.paddingRight),c=r?0:kt(n.paddingBottom),f=r?0:kt(n.paddingLeft),m=r?0:kt(n.borderTopWidth),p=r?0:kt(n.borderRightWidth),g=r?0:kt(n.borderBottomWidth),h=r?0:kt(n.borderLeftWidth),y=f+u,b=l+c,x=h+p,B=m+g,E=o?e.offsetHeight-B-e.clientHeight:0,_=s?e.offsetWidth-x-e.clientWidth:0,T=a?y+x:0,A=a?b+B:0,$=r?r.width:kt(n.width)-T-_,I=r?r.height:kt(n.height)-A-E,j=$+y+_+x,R=I+b+E+B,w=fn({devicePixelContentBoxSize:Mn(Math.round($*devicePixelRatio),Math.round(I*devicePixelRatio),i),borderBoxSize:Mn(j,R,i),contentBoxSize:Mn($,I,i),contentRect:new cd(f,l,$,I)});return zr.set(e,w),w},hd=function(e,t,n){var r=fd(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case xr.DEVICE_PIXEL_CONTENT_BOX:return s;case xr.BORDER_BOX:return a;default:return i}},F0=function(){function e(t){var n=fd(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=fn([n.borderBoxSize]),this.contentBoxSize=fn([n.contentBoxSize]),this.devicePixelContentBoxSize=fn([n.devicePixelContentBoxSize])}return e}(),md=function(e){if(dd(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},T0=function(){var e=1/0,t=[];dn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var c=new F0(u.target),f=md(u.target);o.push(c),u.lastReportedSize=hd(u.target,u.observedBox),f<e&&(e=f)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},Pu=function(e){dn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(md(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},S0=function(){var e=0;for(Pu(e);x0();)e=T0(),Pu(e);return w0()&&E0(),e>0},hi,pd=[],j0=function(){return pd.splice(0).forEach(function(e){return e()})},O0=function(e){if(!hi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return j0()}).observe(n,r),hi=function(){n.textContent="".concat(t?t--:t++)}}pd.push(e),hi()},P0=function(e){O0(function(){requestAnimationFrame(e)})},aa=0,N0=function(){return!!aa},R0=250,M0={attributes:!0,characterData:!0,childList:!0,subtree:!0},Nu=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Ru=function(e){return e===void 0&&(e=0),Date.now()+e},mi=!1,I0=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=R0),!mi){mi=!0;var r=Ru(t);P0(function(){var a=!1;try{a=S0()}finally{if(mi=!1,t=r-Ru(),!N0())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,M0)};document.body?n():dr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Nu.forEach(function(n){return dr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Nu.forEach(function(n){return dr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),us=new I0,Mu=function(e){!aa&&e>0&&us.start(),aa+=e,!aa&&us.stop()},$0=function(e){return!Us(e)&&!k0(e)&&getComputedStyle(e).display==="inline"},L0=function(){function e(t,n){this.target=t,this.observedBox=n||xr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=hd(this.target,this.observedBox,!0);return $0(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),z0=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),qr=new WeakMap,Iu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Wr=function(){function e(){}return e.connect=function(t,n){var r=new z0(t,n);qr.set(t,r)},e.observe=function(t,n,r){var a=qr.get(t),i=a.observationTargets.length===0;Iu(a.observationTargets,n)<0&&(i&&dn.push(a),a.observationTargets.push(new L0(n,r&&r.box)),Mu(1),us.schedule())},e.unobserve=function(t,n){var r=qr.get(t),a=Iu(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&dn.splice(dn.indexOf(r),1),r.observationTargets.splice(a,1),Mu(-1))},e.disconnect=function(t){var n=this,r=qr.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),q0=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.");Wr.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(!Su(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Wr.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(!Su(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Wr.unobserve(this,t)},e.prototype.disconnect=function(){Wr.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();function W0(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 Wn(e,t){if(e==null)return{};var n=W0(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 wr(e){"@babel/helpers - typeof";return wr=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},wr(e)}function H0(e,t){if(wr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(wr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function U0(e){var t=H0(e,"string");return wr(t)==="symbol"?t:String(t)}function Dt(e,t,n){return t=U0(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Vs=C.createContext(null),nn=()=>{var e=C.useContext(Vs);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},gd=parseInt(C.version.split(".")[0],10),V0=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,$u=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),at=typeof navigator<"u"&&/Android/.test(navigator.userAgent),On=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),ur=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),K0=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),vd=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Z0=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Y0=at&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),G0=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),Q0=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),J0=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ia=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ht=(!Z0||!Y0)&&!K0&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Ks=new WeakMap,Zs=new WeakMap,bd=new WeakMap,sa=new WeakMap,ls=new WeakMap,Er=new WeakMap,hn=new WeakMap,Da=new WeakMap,za=new WeakMap,cs=new WeakMap,Gt=new WeakMap,ln=new WeakMap,fr=new WeakMap,ds=new WeakMap,Ys=new WeakMap,wt=new WeakMap,$t=new WeakMap,ut=new WeakMap,Vt=new WeakMap,Kt=new WeakMap,yd=new WeakMap,Hn=Symbol("placeholder"),Dd=Symbol("mark-placeholder"),X0=globalThis.Text,Gs=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,eb=e=>Jt(e)&&e.nodeType===8,yt=e=>Jt(e)&&e.nodeType===1,Jt=e=>{var t=Gs(e);return!!t&&e instanceof t.Node},fs=e=>{var t=e&&e.anchorNode&&Gs(e.anchorNode);return!!t&&e instanceof t.Selection},Cd=e=>Jt(e)&&e.nodeType===3,tb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,nb=e=>{var[t,n]=e;if(yt(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=xd(t,a,r?"backward":"forward"),r=a<n;yt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=ab(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},rb=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},xd=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(eb(a)||yt(a)&&a.childNodes.length===0||yt(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]},ab=(e,t,n)=>{var[r]=xd(e,t,n);return r},wd=e=>{var t="";if(Cd(e)&&e.nodeValue)return e.nodeValue;if(yt(e)){for(var n of Array.from(e.childNodes))t+=wd(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
|
|
103
|
-
`)}return t},
|
|
102
|
+
*/function qo(e){return Object.prototype.toString.call(e)==="[object Object]"}function Xe(e){var t,n;return qo(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(qo(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Gc=Symbol.for("immer-nothing"),Wo=Symbol.for("immer-draftable"),gt=Symbol.for("immer-state"),Om=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function dt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Om[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 Un=Object.getPrototypeOf;function bn(e){return!!e&&!!e[gt]}function yn(e){var t;return e?Qc(e)||Array.isArray(e)||!!e[Wo]||!!((t=e.constructor)!=null&&t[Wo])||Wa(e)||Ha(e):!1}var Pm=Object.prototype.constructor.toString();function Qc(e){if(!e||typeof e!="object")return!1;const t=Un(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)===Pm}function Da(e,t){qa(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function qa(e){const t=e[gt];return t?t.type_:Array.isArray(e)?1:Wa(e)?2:Ha(e)?3:0}function ss(e,t){return qa(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Jc(e,t,n){const r=qa(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Nm(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Wa(e){return e instanceof Map}function Ha(e){return e instanceof Set}function ln(e){return e.copy_||e.base_}function os(e,t){if(Wa(e))return new Map(e);if(Ha(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Qc(e))return Un(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[gt];let r=Reflect.ownKeys(n);for(let a=0;a<r.length;a++){const i=r[a],s=n[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Un(e),n)}function zs(e,t=!1){return Ua(e)||bn(e)||!yn(e)||(qa(e)>1&&(e.set=e.add=e.clear=e.delete=Rm),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>zs(r,!0))),e}function Rm(){dt(2)}function Ua(e){return Object.isFrozen(e)}var Mm={};function Dn(e){const t=Mm[e];return t||dt(0,e),t}var wr;function Xc(){return wr}function Im(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ho(e,t){t&&(Dn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function us(e){ls(e),e.drafts_.forEach($m),e.drafts_=null}function ls(e){e===wr&&(wr=e.parent_)}function Uo(e){return wr=Im(wr,e)}function $m(e){const t=e[gt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Vo(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[gt].modified_&&(us(t),dt(4)),yn(e)&&(e=Ca(t,e),t.parent_||xa(t,e)),t.patches_&&Dn("Patches").generateReplacementPatches_(n[gt].base_,e,t.patches_,t.inversePatches_)):e=Ca(t,n,[]),us(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Gc?e:void 0}function Ca(e,t,n){if(Ua(t))return t;const r=t[gt];if(!r)return Da(t,(a,i)=>Ko(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return xa(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const a=r.copy_;let i=a,s=!1;r.type_===3&&(i=new Set(a),a.clear(),s=!0),Da(i,(o,l)=>Ko(e,r,a,o,l,n,s)),xa(e,a,!1),n&&e.patches_&&Dn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Ko(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&dt(5),bn(a)){const o=i&&t&&t.type_!==3&&!ss(t.assigned_,r)?i.concat(r):void 0,l=Ca(e,a,o);if(Jc(n,r,l),bn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(yn(a)&&!Ua(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ca(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&xa(e,a)}}function xa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&zs(t,n)}function Lm(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Xc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=qs;n&&(a=[r],i=Er);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var qs={get(e,t){if(t===gt)return e;const n=ln(e);if(!ss(n,t))return zm(e,n,t);const r=n[t];return e.finalized_||!yn(r)?r:r===ci(e.base_,t)?(di(e),e.copy_[t]=ds(r,e)):r},has(e,t){return t in ln(e)},ownKeys(e){return Reflect.ownKeys(ln(e))},set(e,t,n){const r=ed(ln(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=ci(ln(e),t),i=a==null?void 0:a[gt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Nm(n,a)&&(n!==void 0||ss(e.base_,t)))return!0;di(e),cs(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 ci(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,di(e),cs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ln(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){dt(11)},getPrototypeOf(e){return Un(e.base_)},setPrototypeOf(){dt(12)}},Er={};Da(qs,(e,t)=>{Er[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Er.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&dt(13),Er.set.call(this,e,t,void 0)};Er.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&dt(14),qs.set.call(this,e[0],t,n,e[0])};function ci(e,t){const n=e[gt];return(n?ln(n):e)[t]}function zm(e,t,n){var a;const r=ed(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function ed(e,t){if(!(t in e))return;let n=Un(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Un(n)}}function cs(e){e.modified_||(e.modified_=!0,e.parent_&&cs(e.parent_))}function di(e){e.copy_||(e.copy_=os(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var qm=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,c=>n.call(this,c,...u))}}typeof n!="function"&&dt(6),r!==void 0&&typeof r!="function"&&dt(7);let a;if(yn(t)){const i=Uo(this),s=ds(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?us(i):ls(i)}return Ho(i,r),Vo(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===Gc&&(a=void 0),this.autoFreeze_&&zs(a,!0),r){const i=[],s=[];Dn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else dt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,l=>t(l,...o));let r,a;return[this.produce(t,n,(s,o)=>{r=s,a=o}),r,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){yn(e)||dt(8),bn(e)&&(e=Wm(e));const t=Uo(this),n=ds(e,void 0);return n[gt].isManual_=!0,ls(t),n}finishDraft(e,t){const n=e&&e[gt];(!n||!n.isManual_)&&dt(9);const{scope_:r}=n;return Ho(r,t),Vo(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=Dn("Patches").applyPatches_;return bn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function ds(e,t){const n=Wa(e)?Dn("MapSet").proxyMap_(e,t):Ha(e)?Dn("MapSet").proxySet_(e,t):Lm(e,t);return(t?t.scope_:Xc()).drafts_.push(n),n}function Wm(e){return bn(e)||dt(10,e),td(e)}function td(e){if(!yn(e)||Ua(e))return e;const t=e[gt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=os(e,t.scope_.immer_.useStrictShallowCopy_)}else n=os(e,!0);return Da(n,(r,a)=>{Jc(n,r,td(a))}),t&&(t.finalized_=!1),n}var vt=new qm,Ws=vt.produce;vt.produceWithPatches.bind(vt);vt.setAutoFreeze.bind(vt);vt.setUseStrictShallowCopy.bind(vt);vt.applyPatches.bind(vt);var Zo=vt.createDraft.bind(vt),Yo=vt.finishDraft.bind(vt),Hm={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=N.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Um={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=xe.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Vm={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=W.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},wa=new WeakMap,Ea=new WeakMap,mr=new WeakMap,nd=new WeakMap,Go=new WeakMap,Qo=new WeakMap,Jo=new WeakMap,N={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=N.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var a=e[r],i=t[r];if(a!==i)break;n.push(a)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return N.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return N.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return N.equals(r,a)&&i<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return N.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&N.compare(e,t)===0},isBefore(e,t){return N.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&N.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&N.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&N.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&N.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),a=e[e.length-1],i=t[t.length-1];return a!==i&&N.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!N.isAncestor(t,e)&&!N.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(N.equals(i,r)||N.endsBefore(i,r)||N.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(N.equals(s,r)||N.isAncestor(s,r))return null;N.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;N.equals(o,r)||N.endsBefore(o,r)?r[o.length-1]-=1:N.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:c}=t;if(N.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else N.endsBefore(u,r)?r[u.length-1]+=1:N.isAncestor(u,r)&&e[u.length]>=c&&(r[u.length-1]+=1,r[u.length]-=c);break}case"move_node":{var{path:f,newPath:m}=t;if(N.equals(f,m))return r;if(N.isAncestor(f,r)||N.equals(f,r)){var p=m.slice();return N.endsBefore(f,m)&&f.length<m.length&&(p[f.length-1]-=1),p.concat(r.slice(f.length))}else N.isSibling(f,m)&&(N.isAncestor(m,r)||N.equals(m,r))?N.endsBefore(f,r)?r[f.length-1]-=1:r[f.length-1]+=1:N.endsBefore(m,r)||N.equals(m,r)||N.isAncestor(m,r)?(N.endsBefore(f,r)&&(r[f.length-1]-=1),r[m.length-1]+=1):N.endsBefore(f,r)&&(N.equals(m,r)&&(r[m.length-1]+=1),r[f.length-1]-=1);break}}return r}};function kr(e){"@babel/helpers - typeof";return kr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kr(e)}function Km(e,t){if(kr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(kr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Zm(e){var t=Km(e,"string");return kr(t)==="symbol"?t:String(t)}function ot(e,t,n){return t=Zm(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xo(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 sr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xo(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ym=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=se.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 W.points(t))t[l]=xe.transform(o,n);break}case"insert_text":{var{path:u,offset:c,text:f}=n;if(f.length===0)break;var m=se.leaf(e,u),p=m.text.slice(0,c),g=m.text.slice(c);if(m.text=p+f+g,t)for(var[h,y]of W.points(t))t[y]=xe.transform(h,n);break}case"merge_node":{var{path:v}=n,x=se.get(e,v),B=N.previous(v),k=se.get(e,B),E=se.parent(e,v),A=v[v.length-1];if(fe.isText(x)&&fe.isText(k))k.text+=x.text;else if(!fe.isText(x)&&!fe.isText(k))k.children.push(...x.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(Ge.stringify(x)," ").concat(Ge.stringify(k)));if(E.children.splice(A,1),t)for(var[j,L]of W.points(t))t[L]=xe.transform(j,n);break}case"move_node":{var{path:I,newPath:T}=n;if(N.isAncestor(I,T))throw new Error("Cannot move a path [".concat(I,"] to new path [").concat(T,"] because the destination is inside itself."));var O=se.get(e,I),w=se.parent(e,I),F=I[I.length-1];w.children.splice(F,1);var R=N.transform(I,n),M=se.get(e,N.parent(R)),K=R[R.length-1];if(M.children.splice(K,0,O),t)for(var[V,oe]of W.points(t))t[oe]=xe.transform(V,n);break}case"remove_node":{var{path:ne}=n,D=ne[ne.length-1],q=se.parent(e,ne);if(q.children.splice(D,1),t)for(var[ee,_]of W.points(t)){var S=xe.transform(ee,n);if(t!=null&&S!=null)t[_]=S;else{var z=void 0,$=void 0;for(var[U,re]of se.texts(e))if(N.compare(re,ne)===-1)z=[U,re];else{$=[U,re];break}var te=!1;z&&$&&(N.equals($[1],ne)?te=!N.hasPrevious($[1]):te=N.common(z[1],ne).length<N.common($[1],ne).length),z&&!te?(ee.path=z[1],ee.offset=z[0].text.length):$?(ee.path=$[1],ee.offset=0):t=null}}break}case"remove_text":{var{path:Y,offset:le,text:X}=n;if(X.length===0)break;var ve=se.leaf(e,Y),pe=ve.text.slice(0,le),_e=ve.text.slice(le+X.length);if(ve.text=pe+_e,t)for(var[je,Ne]of W.points(t))t[Ne]=xe.transform(je,n);break}case"set_node":{var{path:Qe,properties:Ze,newProperties:Ye}=n;if(Qe.length===0)throw new Error("Cannot set properties on the root node!");var nt=se.get(e,Qe);for(var Fe in Ye){if(Fe==="children"||Fe==="text")throw new Error('Cannot set the "'.concat(Fe,'" property of nodes!'));var He=Ye[Fe];He==null?delete nt[Fe]:nt[Fe]=He}for(var ze in Ze)Ye.hasOwnProperty(ze)||delete nt[ze];break}case"set_selection":{var{newProperties:H}=n;if(H==null)t=H;else{if(t==null){if(!W.isRange(H))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Ge.stringify(H)," when there is no current selection."));t=sr({},H)}for(var ie in H){var he=H[ie];if(he==null){if(ie==="anchor"||ie==="focus")throw new Error('Cannot remove the "'.concat(ie,'" selection property'));delete t[ie]}else t[ie]=he}}break}case"split_node":{var{path:ge,position:Ce,properties:Ve}=n;if(ge.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ge,"] because the root node cannot be split."));var Ke=se.get(e,ge),mt=se.parent(e,ge),Rt=ge[ge.length-1],Et;if(fe.isText(Ke)){var Je=Ke.text.slice(0,Ce),Bt=Ke.text.slice(Ce);Ke.text=Je,Et=sr(sr({},Ve),{},{text:Bt})}else{var pt=Ke.children.slice(0,Ce),ei=Ke.children.slice(Ce);Ke.children=pt,Et=sr(sr({},Ve),{},{children:ei})}if(mt.children.splice(Rt+1,0,Et),t)for(var[rr,Mr]of W.points(t))t[Mr]=xe.transform(rr,n);break}}return t},Gm={transform(e,t){e.children=Zo(e.children);var n=e.selection&&Zo(e.selection);try{n=Ym(e,n,t)}finally{e.children=Yo(e.children),n?e.selection=bn(n)?Yo(n):n:e.selection=null}}},Qm={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)}},Jm={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)}},rd=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(Xe(r)&&Xe(a)){if(!rd(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 Xm(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Ut(e,t){if(e==null)return{};var n=Xm(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 ep=["anchor","focus"];function eu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function tp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?eu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var W={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return W.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=W.edges(e);return t},equals(e,t){return xe.equals(e.anchor,t.anchor)&&xe.equals(e.focus,t.focus)},includes(e,t){if(W.isRange(t)){if(W.includes(e,t.anchor)||W.includes(e,t.focus))return!0;var[n,r]=W.edges(e),[a,i]=W.edges(t);return xe.isBefore(n,a)&&xe.isAfter(r,i)}var[s,o]=W.edges(e),l=!1,u=!1;return xe.isPoint(t)?(l=xe.compare(t,s)>=0,u=xe.compare(t,o)<=0):(l=N.compare(t,s.path)>=0,u=N.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=Ut(e,ep),[r,a]=W.edges(e),[i,s]=W.edges(t),o=xe.isBefore(r,i)?i:r,l=xe.isBefore(a,s)?a:s;return xe.isBefore(l,o)?null:tp({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return xe.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return xe.equals(t,n)},isExpanded(e){return!W.isCollapsed(e)},isForward(e){return!W.isBackward(e)},isRange(e){return Xe(e)&&xe.isPoint(e.anchor)&&xe.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=W.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ws(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=W.isCollapsed(r);W.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?W.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=xe.transform(r.anchor,t,{affinity:i}),u=xe.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},tu=e=>Xe(e)&&se.isNodeList(e.children)&&!b.isEditor(e),de={isAncestor(e){return Xe(e)&&se.isNodeList(e.children)},isElement:tu,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 tu(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},np=["children"],rp=["text"],nu=new WeakMap,se={ancestor(e,t){var n=se.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(Ge.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of N.ancestors(t,n)){var a=se.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(Ge.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Ge.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=se.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=se.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=N.common(t,n),a=se.get(e,r);return[a,r]},descendant(e,t){var n=se.get(e,t);if(b.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Ge.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.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 se.nodes(e,t))de.isElement(n)&&(yield[n,r])}()},extractProps(e){if(de.isAncestor(e)){var t=Ut(e,np);return t}else{var t=Ut(e,rp);return t}},first(e,t){for(var n=t.slice(),r=se.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(Ge.stringify(e)));var n=Ws({children:e.children},r=>{var[a,i]=W.edges(t),s=se.nodes(r,{reverse:!0,pass:m=>{var[,p]=m;return!W.includes(t,p)}});for(var[,o]of s){if(!W.includes(t,o)){var l=se.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(N.equals(o,i.path)){var c=se.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(N.equals(o,a.path)){var f=se.leaf(r,o);f.text=f.text.slice(a.offset)}}b.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(fe.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Ge.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(fe.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return fe.isText(e)||de.isElement(e)||b.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=nu.get(e);if(t!==void 0)return t;var n=e.every(r=>se.isNode(r));return nu.set(e,n),n},last(e,t){for(var n=t.slice(),r=se.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=se.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(Ge.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of N.levels(t,n)){var a=se.get(e,r);yield[a,r]}}()},matches(e,t){return de.isElement(e)&&de.isElementProps(t)&&de.matches(e,t)||fe.isText(e)&&fe.isTextProps(t)&&fe.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?N.isBefore(o,i):N.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;N.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=se.get(e,o);continue}if(o.length===0)break;if(!r){var c=N.next(o);if(se.has(e,c)){o=c,l=se.get(e,o);continue}}if(r&&o[o.length-1]!==0){var f=N.previous(o);o=f,l=se.get(e,o);continue}o=N.parent(o),l=se.get(e,o),s.add(l)}}()},parent(e,t){var n=N.parent(t),r=se.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(se.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))fe.isText(n)&&(yield[n,r])}()}};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 Me(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){ot(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 Jt={isNodeOperation(e){return Jt.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!Xe(e))return!1;switch(e.type){case"insert_node":return N.isPath(e.path)&&se.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&N.isPath(e.path);case"merge_node":return typeof e.position=="number"&&N.isPath(e.path)&&Xe(e.properties);case"move_node":return N.isPath(e.path)&&N.isPath(e.newPath);case"remove_node":return N.isPath(e.path)&&se.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&N.isPath(e.path);case"set_node":return N.isPath(e.path)&&Xe(e.properties)&&Xe(e.newProperties);case"set_selection":return e.properties===null&&W.isRange(e.newProperties)||e.newProperties===null&&W.isRange(e.properties)||Xe(e.properties)&&Xe(e.newProperties);case"split_node":return N.isPath(e.path)&&typeof e.position=="number"&&Xe(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>Jt.isOperation(t))},isSelectionOperation(e){return Jt.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return Jt.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return Me(Me({},e),{},{type:"remove_node"});case"insert_text":return Me(Me({},e),{},{type:"remove_text"});case"merge_node":return Me(Me({},e),{},{type:"split_node",path:N.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(N.equals(t,n))return e;if(N.isSibling(n,t))return Me(Me({},e),{},{path:t,newPath:n});var r=N.transform(n,e),a=N.transform(N.next(n),e);return Me(Me({},e),{},{path:r,newPath:a})}case"remove_node":return Me(Me({},e),{},{type:"insert_node"});case"remove_text":return Me(Me({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return Me(Me({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?Me(Me({},e),{},{properties:l,newProperties:null}):l==null?Me(Me({},e),{},{properties:null,newProperties:o}):Me(Me({},e),{},{properties:l,newProperties:o})}case"split_node":return Me(Me({},e),{},{type:"merge_node",path:N.next(e.path)})}}},au=new WeakMap,ap=e=>{var t=au.get(e);if(t!==void 0)return t;if(!Xe(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||Xe(e.marks))&&(e.selection===null||W.isRange(e.selection))&&se.isNodeList(e.children)&&Jt.isOperationList(e.operations);return au.set(e,n),n},b={above(e,t){return e.above(t)},addMark(e,t,n){e.addMark(t,n)},after(e,t,n){return e.after(t,n)},before(e,t,n){return e.before(t,n)},deleteBackward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges(e,t){return e.edges(t)},elementReadOnly(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.elementReadOnly(t)},end(e,t){return e.end(t)},first(e,t){return e.first(t)},fragment(e,t){return e.fragment(t)},hasBlocks(e,t){return e.hasBlocks(t)},hasInlines(e,t){return e.hasInlines(t)},hasPath(e,t){return e.hasPath(t)},hasTexts(e,t){return e.hasTexts(t)},insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock(e,t){return e.isBlock(t)},isEdge(e,t,n){return e.isEdge(t,n)},isEditor(e){return ap(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)}},ip={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(N.isPath)}};function iu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function su(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?iu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):iu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var xe={compare(e,t){var n=N.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return xe.compare(e,t)===1},isBefore(e,t){return xe.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&N.equals(e.path,t.path)},isPoint(e){return Xe(e)&&typeof e.offset=="number"&&N.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ws(e,r=>{if(r===null)return null;var{affinity:a="forward"}=n,{path:i,offset:s}=r;switch(t.type){case"insert_node":case"move_node":{r.path=N.transform(i,t,n);break}case"insert_text":{N.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{N.equals(t.path,i)&&(r.offset+=t.position),r.path=N.transform(i,t,n);break}case"remove_text":{N.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(N.equals(t.path,i)||N.isAncestor(t.path,i))return null;r.path=N.transform(i,t,n);break}case"split_node":{if(N.equals(t.path,i)){if(t.position===s&&a==null)return null;(t.position<s||t.position===s&&a==="forward")&&(r.offset-=t.position,r.path=N.transform(i,t,su(su({},n),{},{affinity:"forward"})))}else r.path=N.transform(i,t,n);break}}})}},ou=void 0,Ge={setScrubber(e){ou=e},stringify(e){return JSON.stringify(e,ou)}},sp=["text"],op=["anchor","focus"];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 It(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){ot(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 fe={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Ut(i,sp);return s}return rd(r?a(e):e,r?a(t):t)},isText(e){return Xe(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=[It({},e)];for(var r of t){var a=Ut(r,op),[i,s]=W.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var f of n){var{length:m}=f.text,p=l;if(l+=m,u<=p&&l<=c){Object.assign(f,a),o.push(f);continue}if(u!==c&&(u===l||c===p)||u>l||c<p||c===p&&p!==0){o.push(f);continue}var g=f,h=void 0,y=void 0;if(c<l){var v=c-p;y=It(It({},g),{},{text:g.text.slice(v)}),g=It(It({},g),{},{text:g.text.slice(0,v)})}if(u>p){var x=u-p;h=It(It({},g),{},{text:g.text.slice(0,x)}),g=It(It({},g),{},{text:g.text.slice(x)})}Object.assign(g,a),h&&o.push(h),o.push(g),y&&o.push(y)}n=o}return n}},Hs=e=>e.selection?e.selection:e.children.length>0?b.end(e,[]):[0],tr=(e,t)=>{var[n]=b.node(e,t);return r=>r===n},Us=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?hp(t):t,i=De.None,s=De.None,o=0,l=null,u=null;for(var c of a){var f=c.codePointAt(0);if(!f)break;var m=kp(c,f);if([i,s]=r?[s,m]:[m,i],Nn(i,De.ZWJ)&&Nn(s,De.ExtPict)&&(r?l=lu(t.substring(0,o)):l=lu(t.substring(0,t.length-o)),!l)||Nn(i,De.RI)&&Nn(s,De.RI)&&(u!==null?u=!u:r?u=!0:u=Tp(t.substring(0,t.length-o)),!u)||i!==De.None&&s!==De.None&&Bp(i,s))break;o+=c.length}return o||1},up=/\s/,lp=/[\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]/,cp=/['\u2018\u2019]/,dp=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=Us(t,n),[s,o]=Vs(t,i,n);if(fp(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Vs=(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)]},fp=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(up.test(t))return!1;if(cp.test(t)){var a=Us(n,r),[i,s]=Vs(n,a,r);if(e(i,s,r))return!0}return!lp.test(t)},hp=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(pp(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(mp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},mp=e=>e>=55296&&e<=56319,pp=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 gp=/^(?:[\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])$/,vp=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,bp=/^(?:[\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])$/,yp=/^[\u1100-\u115F\uA960-\uA97C]$/,Dp=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,Cp=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,xp=/^[\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]$/,wp=/^[\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]$/,Ep=/^(?:[\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])$/,kp=(e,t)=>{var n=De.Any;return e.search(gp)!==-1&&(n|=De.Extend),t===8205&&(n|=De.ZWJ),t>=127462&&t<=127487&&(n|=De.RI),e.search(vp)!==-1&&(n|=De.Prepend),e.search(bp)!==-1&&(n|=De.SpacingMark),e.search(yp)!==-1&&(n|=De.L),e.search(Dp)!==-1&&(n|=De.V),e.search(Cp)!==-1&&(n|=De.T),e.search(xp)!==-1&&(n|=De.LV),e.search(wp)!==-1&&(n|=De.LVT),e.search(Ep)!==-1&&(n|=De.ExtPict),n};function Nn(e,t){return(e&t)!==0}var _p=[[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 Bp(e,t){return _p.findIndex(n=>Nn(e,n[0])&&Nn(t,n[1]))===-1}var Ap=/(?:[\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$/,lu=e=>e.search(Ap)!==-1,Fp=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Tp=e=>{var t=e.match(Fp);if(t===null)return!1;var n=t[0].length/2;return n%2===1},Sp={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=Hs(e)}=n;if(N.isPath(a)&&(a=b.range(e,a)),W.isRange(a))if(W.isCollapsed(a))a=a.anchor;else{var i=W.end(a);if(!r&&b.void(e,{at:i}))return;var s=W.start(a),o=b.pointRef(e,s),l=b.pointRef(e,i);Q.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,Q.setSelection(e,{anchor:a,focus:a})}if(!(!r&&b.void(e,{at:a})||b.elementReadOnly(e,{at:a}))){var{path:f,offset:m}=a;t.length>0&&e.apply({type:"insert_text",path:f,offset:m,text:t})}})}};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 qr(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){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Q=qr(qr(qr(qr({},Gm),Qm),Jm),Sp),ua=new WeakMap,jp=e=>ua.get(e)||!1,Op=(e,t,n)=>{var r=ua.get(e)||!1;ua.set(e,!0);try{t(),n()}finally{ua.set(e,r)}};function ad(e,t,n){var r=wa.get(e)||[],a=Ea.get(e)||new Set,i,s,o=f=>{if(f){var m=f.join(",");s.has(m)||(s.add(m),i.push(f))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var c of t)o(c);wa.set(e,i),Ea.set(e,s)}var Pp=(e,t)=>{for(var n of b.pathRefs(e))Hm.transform(n,t);for(var r of b.pointRefs(e))Um.transform(r,t);for(var a of b.rangeRefs(e))Vm.transform(a,t);if(!jp(e)){var i=N.operationCanTransformPath(t)?s=>N.transform(s,t):void 0;ad(e,e.getDirtyPaths(t),i)}Q.transform(e,t),e.operations.push(t),b.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),mr.get(e)||(mr.set(e,!0),Promise.resolve().then(()=>{mr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Np=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return N.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=N.levels(a),s=fe.isText(r)?[]:Array.from(se.nodes(r),T=>{var[,O]=T;return a.concat(O)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=N.ancestors(o),u=N.previous(o);return[...l,u]}case"move_node":{var{path:c,newPath:f}=t;if(N.equals(c,f))return[];var m=[],p=[];for(var g of N.ancestors(c)){var h=N.transform(g,t);m.push(h)}for(var y of N.ancestors(f)){var v=N.transform(y,t);p.push(v)}var x=p[p.length-1],B=f[f.length-1],k=x.concat(B);return[...m,...p,k]}case"remove_node":{var{path:E}=t,A=N.ancestors(E);return[...A]}case"split_node":{var{path:j}=t,L=N.levels(j),I=N.next(j);return[...L,I]}default:return[]}},Rp=e=>{var{selection:t}=e;return t?se.fragment(e,t):[]},Mp=(e,t)=>{var[n,r]=t;if(!fe.isText(n)){if(de.isElement(n)&&n.children.length===0){var a={text:""};Q.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=b.isEditor(n)?!1:de.isElement(n)&&(e.isInline(n)||n.children.length===0||fe.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=se.get(e,r);if(!fe.isText(l)){var u=l.children[s],c=l.children[s-1],f=o===n.children.length-1,m=fe.isText(u)||de.isElement(u)&&e.isInline(u);if(m!==i)Q.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(de.isElement(u)){if(e.isInline(u)){if(c==null||!fe.isText(c)){var p={text:""};Q.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(f){var g={text:""};Q.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&fe.isText(c)&&(fe.equals(u,c,{loose:!0})?(Q.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(Q.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(Q.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Ip=(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},$p=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:s}=n;if(i){var o=b.path(t,i),l=a==="lowest";for(var[u,c]of b.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!fe.isText(u)){if(W.isRange(i)){if(N.isAncestor(c,i.anchor.path)&&N.isAncestor(c,i.focus.path))return[u,c]}else if(!N.equals(o,c))return[u,c]}}};function du(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function fu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?du(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):du(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Lp=(e,t,n)=>{var{selection:r}=e;if(r){var a=(f,m)=>{if(!fe.isText(f))return!1;var[p,g]=b.parent(e,m);return!e.isVoid(p)||e.markableVoid(p)},i=W.isExpanded(r),s=!1;if(!i){var[o,l]=b.node(e,r);if(o&&a(o,l)){var[u]=b.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)Q.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=fu(fu({},b.marks(e)||{}),{},{[t]:n});e.marks=c,mr.get(e)||e.onChange()}}};function hu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function mu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?hu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var zp=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.point(t,n,{edge:"end"}),i=b.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of b.positions(t,mu(mu({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};function pu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function gu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var qp=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.start(t,[]),i=b.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of b.positions(t,gu(gu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},Wp=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&Q.delete(e,{unit:t,reverse:!0})},Hp=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&Q.delete(e,{unit:t})},Up=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&W.isExpanded(r)&&Q.delete(t,{reverse:n==="backward"})},Vp=(e,t)=>[b.start(e,t),b.end(e,t)];function vu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function bu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vu(Object(n),!0).forEach(function(r){ot(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 Kp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,bu(bu({},n),{},{match:r=>de.isElement(r)&&b.isElementReadOnly(t,r)}))},Zp=(e,t)=>b.point(e,t,{edge:"end"}),Yp=(e,t)=>{var n=b.path(e,t,{edge:"start"});return b.node(e,n)},Gp=(e,t)=>{var n=b.range(e,t);return se.fragment(e,n)};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){ot(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 Qp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,Du(Du({},n),{},{match:r=>de.isElement(r)&&b.isVoid(t,r)}))},Jp=(e,t)=>t.children.some(n=>de.isElement(n)&&b.isBlock(e,n)),Xp=(e,t)=>t.children.some(n=>fe.isText(n)||b.isInline(e,n)),eg=(e,t)=>se.has(e,t),tg=(e,t)=>t.children.every(n=>fe.isText(n)),ng=e=>{Q.splitNodes(e,{always:!0})},rg=(e,t,n)=>{Q.insertNodes(e,t,n)},ag=e=>{Q.splitNodes(e,{always:!0})};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 ig(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){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var sg=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=ig({text:n},i);Q.insertNodes(t,s,{at:r.at,voids:r.voids})}else Q.insertText(t,n,r);t.marks=null}},og=(e,t)=>!e.isInline(t),ug=(e,t,n)=>b.isStart(e,t,n)||b.isEnd(e,t,n),lg=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&fe.isText(r)&&r.text===""&&!e.isVoid(t)},cg=(e,t,n)=>{var r=b.end(e,n);return xe.equals(t,r)},dg=e=>{var t=nd.get(e);return t===void 0?!0:t},fg=(e,t,n)=>{if(t.offset!==0)return!1;var r=b.start(e,n);return xe.equals(t,r)},hg=(e,t)=>{var n=b.path(e,t,{edge:"end"});return b.node(e,n)},mg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=se.leaf(t,a);return[i,a]};function pg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var s=[],o=b.path(e,n);for(var[l,u]of se.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&de.isElement(l)&&b.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var gg=["text"],vg=["text"],bg=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(W.isExpanded(r)){var s=b.isEnd(t,a,a.path);if(s){var o=b.after(t,a);o&&(a=o)}var[l]=b.nodes(t,{match:fe.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=Ut(u,gg);return c}else return{}}var{path:f}=a,[m]=b.leaf(t,f);if(a.offset===0){var p=b.previous(t,{at:f,match:fe.isText}),g=b.above(t,{match:k=>de.isElement(k)&&b.isVoid(t,k)&&t.markableVoid(k)});if(!g){var h=b.above(t,{match:k=>de.isElement(k)&&b.isBlock(t,k)});if(p&&h){var[y,v]=p,[,x]=h;N.isAncestor(x,v)&&(m=y)}}}var B=Ut(m,vg);return B},yg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=b.after(t,s,{voids:a});if(o){var[,l]=b.last(t,[]),u=[o.path,l];if(N.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(N.isPath(s)){var[c]=b.parent(t,s);i=m=>c.children.includes(m)}else i=()=>!0;var[f]=b.nodes(t,{at:u,match:i,mode:r,voids:a});return f}}},Dg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=se.get(t,a);return[i,a]};function Cg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,c;if(ip.isSpan(n))u=n[0],c=n[1];else{var f=b.path(e,n,{edge:"start"}),m=b.path(e,n,{edge:"end"});u=i?m:f,c=i?f:m}var p=se.nodes(e,{reverse:i,from:u,to:c,pass:k=>{var[E]=k;return de.isElement(E)?!!(!s&&(b.isVoid(e,E)||b.isElementReadOnly(e,E))||o&&!b.isSelectable(e,E)):!1}}),g=[],h;for(var[y,v]of p)if(!(o&&de.isElement(y)&&!b.isSelectable(e,y))){var x=h&&N.compare(v,h[1])===0;if(!(r==="highest"&&x)){if(!l(y,v)){if(a&&!x&&fe.isText(y))return;continue}if(r==="lowest"&&x){h=[y,v];continue}var B=r==="lowest"?h:[y,v];B&&(a?g.push(B):yield B),h=[y,v]}}r==="lowest"&&h&&(a?g.push(h):yield h),a&&(yield*g)}}()}var xg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>wa.get(c)||[],s=c=>Ea.get(c)||new Set,o=c=>{var f=i(c).pop(),m=f.join(",");return s(c).delete(m),f};if(b.isNormalizing(t)){if(r){var l=Array.from(se.nodes(t),c=>{var[,f]=c;return f}),u=new Set(l.map(c=>c.join(",")));wa.set(t,l),Ea.set(t,u)}i(t).length!==0&&b.withoutNormalizing(t,()=>{for(var c of i(t))if(se.has(t,c)){var f=b.node(t,c),[m,p]=f;de.isElement(m)&&m.children.length===0&&t.normalizeNode(f,{operation:a})}for(var g=i(t),h=g.length,y=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:y,initialDirtyPathsLength:h,operation:a}))return;var v=o(t);if(se.has(t,v)){var x=b.node(t,v);t.normalizeNode(x,{operation:a})}y++,g=i(t)}})}},wg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=N.parent(a),s=b.node(t,i);return s},Eg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.pathRefs(t);return l.delete(i),i.current=null,o}},s=b.pathRefs(t);return s.add(i),i},kg=e=>{var t=Go.get(e);return t||(t=new Set,Go.set(e,t)),t},_g=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(N.isPath(n)){if(i==="start"){var[,s]=se.first(t,n);n=s}else if(i==="end"){var[,o]=se.last(t,n);n=o}}return W.isRange(n)&&(i==="start"?n=W.start(n):i==="end"?n=W.end(n):n=N.common(n.anchor.path,n.focus.path)),xe.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},Bg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.pointRefs(t);return l.delete(i),i.current=null,o}},s=b.pointRefs(t);return s.add(i),i},Ag=e=>{var t=Qo.get(e);return t||(t=new Set,Qo.set(e,t)),t},Fg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(N.isPath(n)){var i;if(a==="end"){var[,s]=se.last(t,n);i=s}else{var[,o]=se.first(t,n);i=o}var l=se.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(W.isRange(n)){var[u,c]=W.edges(n);return a==="start"?u:c}return n};function Tg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:a=!1,voids:i=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=b.range(e,n),[l,u]=W.edges(o),c=a?u:l,f=!1,m="",p=0,g=0,h=0;for(var[y,v]of b.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(y)){if(!i&&(e.isVoid(y)||e.isElementReadOnly(y))){yield b.start(e,v);continue}if(e.isInline(y))continue;if(b.hasInlines(e,y)){var x=N.isAncestor(v,u.path)?u:b.end(e,v),B=N.isAncestor(v,l.path)?l:b.start(e,v);m=b.string(e,{anchor:B,focus:x},{voids:i}),f=!0}}if(fe.isText(y)){var k=N.equals(v,c.path);for(k?(g=a?c.offset:y.text.length-c.offset,h=c.offset):(g=y.text.length,h=a?g:0),(k||f||r==="offset")&&(yield{path:v,offset:h},f=!1);;){if(p===0){if(m==="")break;p=E(m,r,a),m=Vs(m,p,a)[1]}if(h=a?h-p:h+p,g=g-p,g<0){p=-g;break}p=0,yield{path:v,offset:h}}}}function E(A,j,L){return j==="character"?Us(A,L):j==="word"?dp(A,L):j==="line"||j==="block"?A.length:1}}()}var Sg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=b.before(t,s,{voids:a});if(o){var[,l]=b.first(t,[]),u=[o.path,l];if(N.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(N.isPath(s)){var[c]=b.parent(t,s);i=m=>c.children.includes(m)}else i=()=>!0;var[f]=b.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return f}}},jg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.rangeRefs(t);return l.delete(i),i.current=null,o}},s=b.rangeRefs(t);return s.add(i),i},Og=e=>{var t=Jo.get(e);return t||(t=new Set,Jo.set(e,t)),t},Pg=(e,t,n)=>{if(W.isRange(t)&&!n)return t;var r=b.start(e,t),a=b.end(e,n||t);return{anchor:r,focus:a}};function xu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ng(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Rg=(e,t)=>{var{selection:n}=e;if(n){var r=(c,f)=>{if(!fe.isText(c))return!1;var[m,p]=b.parent(e,f);return!e.isVoid(m)||e.markableVoid(m)},a=W.isExpanded(n),i=!1;if(!a){var[s,o]=b.node(e,n);if(s&&r(s,o)){var[l]=b.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)Q.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Ng({},b.marks(e)||{});delete u[t],e.marks=u,mr.get(e)||e.onChange()}}},Mg=(e,t)=>{nd.set(e,t)},Ig=(e,t)=>b.point(e,t,{edge:"start"}),$g=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=b.range(t,n),[s,o]=W.edges(i),l="";for(var[u,c]of b.nodes(t,{at:i,match:fe.isText,voids:a})){var f=u.text;N.equals(c,o.path)&&(f=f.slice(0,o.offset)),N.equals(c,s.path)&&(f=f.slice(s.offset)),l+=f}return l},Lg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=W.edges(n);if(i.offset!==0||s.offset!==0||W.isCollapsed(n)||N.hasPrevious(s.path))return n;var o=b.above(t,{at:s,match:g=>de.isElement(g)&&b.isBlock(t,g),voids:a}),l=o?o[1]:[],u=b.start(t,i),c={anchor:u,focus:s},f=!0;for(var[m,p]of b.nodes(t,{at:c,match:fe.isText,reverse:!0,voids:a})){if(f){f=!1;continue}if(m.text!==""||N.isBefore(p,l)){s={path:p,offset:m.text.length};break}}return{anchor:i,focus:s}},zg=(e,t)=>{var n=b.isNormalizing(e);b.setNormalizing(e,!1);try{t()}finally{b.setNormalizing(e,n)}b.normalize(e)},qg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:c=!1}=n;if(u){var f=!1;if(W.isRange(u)&&W.isCollapsed(u)&&(f=!0,u=u.anchor),xe.isPoint(u)){var m=b.void(t,{at:u,mode:"highest"});if(!l&&m){var[,p]=m;u=p}else{var g={unit:s,distance:o},h=i?b.before(t,u,g)||b.start(t,[]):b.after(t,u,g)||b.end(t,[]);u={anchor:u,focus:h},c=!0}}if(N.isPath(u)){Q.removeNodes(t,{at:u,voids:l});return}if(!W.isCollapsed(u)){if(!c){var[,y]=W.edges(u),v=b.end(t,[]);xe.equals(y,v)||(u=b.unhangRange(t,u,{voids:l}))}var[x,B]=W.edges(u),k=b.above(t,{match:pe=>de.isElement(pe)&&b.isBlock(t,pe),at:x,voids:l}),E=b.above(t,{match:pe=>de.isElement(pe)&&b.isBlock(t,pe),at:B,voids:l}),A=k&&E&&!N.equals(k[1],E[1]),j=N.equals(x.path,B.path),L=l?null:(r=b.void(t,{at:x,mode:"highest"}))!==null&&r!==void 0?r:b.elementReadOnly(t,{at:x,mode:"highest"}),I=l?null:(a=b.void(t,{at:B,mode:"highest"}))!==null&&a!==void 0?a:b.elementReadOnly(t,{at:B,mode:"highest"});if(L){var T=b.before(t,x);T&&k&&N.isAncestor(k[1],T.path)&&(x=T)}if(I){var O=b.after(t,B);O&&E&&N.isAncestor(E[1],O.path)&&(B=O)}var w=[],F;for(var R of b.nodes(t,{at:u,voids:l})){var[M,K]=R;F&&N.compare(K,F)===0||(!l&&de.isElement(M)&&(b.isVoid(t,M)||b.isElementReadOnly(t,M))||!N.isCommon(K,x.path)&&!N.isCommon(K,B.path))&&(w.push(R),F=K)}var V=Array.from(w,pe=>{var[,_e]=pe;return b.pathRef(t,_e)}),oe=b.pointRef(t,x),ne=b.pointRef(t,B),D="";if(!j&&!L){var q=oe.current,[ee]=b.leaf(t,q),{path:_}=q,{offset:S}=x,z=ee.text.slice(S);z.length>0&&(t.apply({type:"remove_text",path:_,offset:S,text:z}),D=z)}if(V.reverse().map(pe=>pe.unref()).filter(pe=>pe!==null).forEach(pe=>Q.removeNodes(t,{at:pe,voids:l})),!I){var $=ne.current,[U]=b.leaf(t,$),{path:re}=$,te=j?x.offset:0,Y=U.text.slice(te,B.offset);Y.length>0&&(t.apply({type:"remove_text",path:re,offset:te,text:Y}),D=Y)}!j&&A&&ne.current&&oe.current&&Q.mergeNodes(t,{at:ne.current,hanging:!0,voids:l}),f&&i&&s==="character"&&D.length>1&&D.match(/[\u0E00-\u0E7F]+/)&&Q.insertText(t,D.slice(0,D.length-o));var le=oe.unref(),X=ne.unref(),ve=i?le||X:X||le;n.at==null&&ve&&Q.select(t,ve)}}})},Wg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=Hs(t),batchDirty:o=!0}=r;if(n.length){if(W.isRange(s))if(a||(s=b.unhangRange(t,s,{voids:i})),W.isCollapsed(s))s=s.anchor;else{var[,l]=W.edges(s);if(!i&&b.void(t,{at:l}))return;var u=b.pointRef(t,l);Q.delete(t,{at:s}),s=u.unref()}else N.isPath(s)&&(s=b.start(t,s));if(!(!i&&b.void(t,{at:s}))){var c=b.above(t,{at:s,match:z=>de.isElement(z)&&b.isInline(t,z),mode:"highest",voids:i});if(c){var[,f]=c;if(b.isEnd(t,s,f)){var m=b.after(t,f);s=m}else if(b.isStart(t,s,f)){var p=b.before(t,f);s=p}}var g=b.above(t,{match:z=>de.isElement(z)&&b.isBlock(t,z),at:s,voids:i}),[,h]=g,y=b.isStart(t,s,h),v=b.isEnd(t,s,h),x=y&&v,B=!y||y&&v,k=!v,[,E]=se.first({children:n},[]),[,A]=se.last({children:n},[]),j=[],L=z=>{var[$,U]=z,re=U.length===0;return re?!1:x?!0:!(B&&N.isAncestor(U,E)&&de.isElement($)&&!t.isVoid($)&&!t.isInline($)||k&&N.isAncestor(U,A)&&de.isElement($)&&!t.isVoid($)&&!t.isInline($))};for(var I of se.nodes({children:n},{pass:L}))L(I)&&j.push(I);var T=[],O=[],w=[],F=!0,R=!1;for(var[M]of j)de.isElement(M)&&!t.isInline(M)?(F=!1,R=!0,O.push(M)):F?T.push(M):w.push(M);var[K]=b.nodes(t,{at:s,match:z=>fe.isText(z)||b.isInline(t,z),mode:"highest",voids:i}),[,V]=K,oe=b.isStart(t,s,V),ne=b.isEnd(t,s,V),D=b.pathRef(t,v&&!w.length?N.next(h):h),q=b.pathRef(t,ne?N.next(V):V);Q.splitNodes(t,{at:s,match:z=>R?de.isElement(z)&&b.isBlock(t,z):fe.isText(z)||b.isInline(t,z),mode:R?"lowest":"highest",always:R&&(!y||T.length>0)&&(!v||w.length>0),voids:i});var ee=b.pathRef(t,!oe||oe&&ne?N.next(V):V);if(Q.insertNodes(t,T,{at:ee.current,match:z=>fe.isText(z)||b.isInline(t,z),mode:"highest",voids:i,batchDirty:o}),x&&!T.length&&O.length&&!w.length&&Q.delete(t,{at:h,voids:i}),Q.insertNodes(t,O,{at:D.current,match:z=>de.isElement(z)&&b.isBlock(t,z),mode:"lowest",voids:i,batchDirty:o}),Q.insertNodes(t,w,{at:q.current,match:z=>fe.isText(z)||b.isInline(t,z),mode:"highest",voids:i,batchDirty:o}),!r.at){var _;if(w.length>0&&q.current?_=N.previous(q.current):O.length>0&&D.current?_=N.previous(D.current):ee.current&&(_=N.previous(ee.current)),_){var S=b.end(t,_);Q.select(t,S)}}ee.unref(),D.unref(),q.unref()}}})},Hg=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")Q.select(t,a.anchor);else if(r==="focus")Q.select(t,a.focus);else if(r==="start"){var[i]=W.edges(a);Q.select(t,i)}else if(r==="end"){var[,s]=W.edges(a);Q.select(t,s)}}else return},Ug=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},Vg=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=W.isBackward(r)?"focus":"anchor"),o==="end"&&(o=W.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,c={distance:a,unit:i,ignoreNonSelectable:!0},f={};if(o==null||o==="anchor"){var m=s?b.before(t,l,c):b.after(t,l,c);m&&(f.anchor=m)}if(o==null||o==="focus"){var p=s?b.before(t,u,c):b.after(t,u,c);p&&(f.focus=p)}Q.setSelection(t,f)}},Kg=(e,t)=>{var{selection:n}=e;if(t=b.range(e,t),n){Q.setSelection(e,t);return}if(!W.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(Ge.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function wu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Eu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?wu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Zg=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=W.isBackward(a)?"focus":"anchor"),i==="end"&&(i=W.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;Q.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Eu(Eu({},l),n)})}},Yg=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!xe.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!xe.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})}},Gg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:c}=r;if(se.isNode(n)&&(n=[n]),n.length!==0){var[f]=n;if(l||(l=Hs(t),c!==!1&&(c=!0)),c==null&&(c=!1),W.isRange(l))if(a||(l=b.unhangRange(t,l,{voids:i})),W.isCollapsed(l))l=l.anchor;else{var[,m]=W.edges(l),p=b.pointRef(t,m);Q.delete(t,{at:l}),l=p.unref()}if(xe.isPoint(l)){u==null&&(fe.isText(f)?u=T=>fe.isText(T):t.isInline(f)?u=T=>fe.isText(T)||b.isInline(t,T):u=T=>de.isElement(T)&&b.isBlock(t,T));var[g]=b.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,h]=g,y=b.pathRef(t,h),v=b.isEnd(t,l,h);Q.splitNodes(t,{at:l,match:u,mode:s,voids:i});var x=y.unref();l=v?N.next(x):x}else return}var B=N.parent(l),k=l[l.length-1];if(!(!i&&b.void(t,{at:B}))){if(o){var E=[],A=N.levels(B);Op(t,()=>{var T=function(){var F=B.concat(k);k++;var R={type:"insert_node",path:F,node:O};t.apply(R),l=N.next(l),E.push(R),fe.isText?A.push(...Array.from(se.nodes(O),M=>{var[,K]=M;return F.concat(K)})):A.push(F)};for(var O of n)T()},()=>{ad(t,A,T=>{var O=T;for(var w of E)if(N.operationCanTransformPath(w)&&(O=N.transform(O,w),!O))return null;return O})})}else for(var j of n){var L=B.concat(k);k++,t.apply({type:"insert_node",path:L,node:j}),l=N.next(l)}if(l=N.previous(l),c){var I=b.end(t,l);I&&Q.select(t,I)}}}})},Qg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=N.isPath(r)?tr(t,r):k=>de.isElement(k)&&b.isBlock(t,k)),!!r){var o=b.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,k=>{var[,E]=k;return b.pathRef(t,E)});for(var u of l){var c=u.unref();if(c.length<2)throw new Error("Cannot lift node at a path [".concat(c,"] because it has a depth of less than `2`."));var f=b.node(t,N.parent(c)),[m,p]=f,g=c[c.length-1],{length:h}=m.children;if(h===1){var y=N.next(p);Q.moveNodes(t,{at:c,to:y,voids:i}),Q.removeNodes(t,{at:p,voids:i})}else if(g===0)Q.moveNodes(t,{at:c,to:p,voids:i});else if(g===h-1){var v=N.next(p);Q.moveNodes(t,{at:c,to:v,voids:i})}else{var x=N.next(c),B=N.next(p);Q.splitNodes(t,{at:x,voids:i}),Q.moveNodes(t,{at:c,to:B,voids:i})}}}})},Jg=["text"],Xg=["children"],id=(e,t)=>{if(de.isElement(t)){var n=t;return b.isVoid(e,t)?!0:n.children.length===1?id(e,n.children[0]):!1}else return!b.isEditor(t)},ev=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(N.isPath(a)){var[l]=b.parent(t,a);r=T=>l.children.includes(T)}else r=T=>de.isElement(T)&&b.isBlock(t,T);if(!i&&W.isRange(a)&&(a=b.unhangRange(t,a,{voids:s})),W.isRange(a))if(W.isCollapsed(a))a=a.anchor;else{var[,u]=W.edges(a),c=b.pointRef(t,u);Q.delete(t,{at:a}),a=c.unref(),n.at==null&&Q.select(t,a)}var[f]=b.nodes(t,{at:a,match:r,voids:s,mode:o}),m=b.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!f||!m)){var[p,g]=f,[h,y]=m;if(!(g.length===0||y.length===0)){var v=N.next(y),x=N.common(g,y),B=N.isSibling(g,y),k=Array.from(b.levels(t,{at:g}),T=>{var[O]=T;return O}).slice(x.length).slice(0,-1),E=b.above(t,{at:g,mode:"highest",match:T=>k.includes(T)&&id(t,T)}),A=E&&b.pathRef(t,E[1]),j,L;if(fe.isText(p)&&fe.isText(h)){var I=Ut(p,Jg);L=h.text.length,j=I}else if(de.isElement(p)&&de.isElement(h)){var I=Ut(p,Xg);L=h.children.length,j=I}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(Ge.stringify(p)," ").concat(Ge.stringify(h)));B||Q.moveNodes(t,{at:g,to:v,voids:s}),A&&Q.removeNodes(t,{at:A.current,voids:s}),de.isElement(h)&&b.isEmpty(t,h)||fe.isText(h)&&h.text===""&&y[y.length-1]!==0?Q.removeNodes(t,{at:y,voids:s}):t.apply({type:"merge_node",path:v,position:L,properties:j}),A&&A.unref()}}}})},tv=(e,t)=>{b.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=N.isPath(r)?tr(e,r):p=>de.isElement(p)&&b.isBlock(e,p));var o=b.pathRef(e,n),l=b.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,p=>{var[,g]=p;return b.pathRef(e,g)});for(var c of u){var f=c.unref(),m=o.current;f.length!==0&&e.apply({type:"move_node",path:f,newPath:m}),o.current&&N.isSibling(m,f)&&N.isAfter(m,f)&&(o.current=N.next(o.current))}o.unref()}})},nv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=N.isPath(s)?tr(t,s):p=>de.isElement(p)&&b.isBlock(t,p)),!r&&W.isRange(s)&&(s=b.unhangRange(t,s,{voids:a}));var l=b.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,p=>{var[,g]=p;return b.pathRef(t,g)});for(var c of u){var f=c.unref();if(f){var[m]=b.node(t,f);t.apply({type:"remove_node",path:f,node:m})}}}})},rv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:c=!1,voids:f=!1}=r;if(i){if(a==null&&(a=N.isPath(i)?tr(t,i):L=>de.isElement(L)&&b.isBlock(t,L)),!l&&W.isRange(i)&&(i=b.unhangRange(t,i,{voids:f})),c&&W.isRange(i)){if(W.isCollapsed(i)&&b.leaf(t,i.anchor)[0].text.length>0)return;var m=b.rangeRef(t,i,{affinity:"inward"}),[p,g]=W.edges(i),h=u==="lowest"?"lowest":"highest",y=b.isEnd(t,g,g.path);Q.splitNodes(t,{at:g,match:a,mode:h,voids:f,always:!y});var v=b.isStart(t,p,p.path);Q.splitNodes(t,{at:p,match:a,mode:h,voids:f,always:!v}),i=m.unref(),r.at==null&&Q.select(t,i)}s||(s=(L,I)=>L!==I);for(var[x,B]of b.nodes(t,{at:i,match:a,mode:u,voids:f})){var k={},E={};if(B.length!==0){var A=!1;for(var j in n)j==="children"||j==="text"||s(n[j],x[j])&&(A=!0,x.hasOwnProperty(j)&&(k[j]=x[j]),o?n[j]!=null&&(E[j]=o(x[j],n[j])):n[j]!=null&&(E[j]=n[j]));A&&t.apply({type:"set_node",path:B,properties:k,newProperties:E})}}}})},av=(e,t)=>{if(W.isCollapsed(t))return t.anchor;var[,n]=W.edges(t),r=b.pointRef(e,n);return Q.delete(e,{at:t}),r.unref()},iv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=ne=>de.isElement(ne)&&b.isBlock(t,ne)),W.isRange(s)&&(s=av(t,s)),N.isPath(s)){var u=s,c=b.point(t,u),[f]=b.parent(t,u);i=ne=>ne===f,o=c.path.length-u.length+1,s=c,l=!0}if(s){var m=b.pointRef(t,s,{affinity:"backward"}),p;try{var[g]=b.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var h=b.void(t,{at:s,mode:"highest"}),y=0;if(!a&&h){var[v,x]=h;if(de.isElement(v)&&t.isInline(v)){var B=b.after(t,x);if(!B){var k={text:""},E=N.next(x);Q.insertNodes(t,k,{at:E,voids:a}),B=b.point(t,E)}s=B,l=!0}var A=s.path.length-x.length;o=A+1,l=!0}p=b.pointRef(t,s);var j=s.path.length-o,[,L]=g,I=s.path.slice(0,j),T=o===0?s.offset:s.path[j]+y;for(var[O,w]of b.levels(t,{at:I,reverse:!0,voids:a})){var F=!1;if(w.length<L.length||w.length===0||!a&&de.isElement(O)&&b.isVoid(t,O))break;var R=m.current,M=b.isEnd(t,R,w);if(l||!m||!b.isEdge(t,R,w)){F=!0;var K=se.extractProps(O);t.apply({type:"split_node",path:w,position:T,properties:K})}T=w[w.length-1]+(F||M?1:0)}if(n.at==null){var V=p.current||b.end(t,[]);Q.select(t,V)}}finally{var oe;m.unref(),(oe=p)===null||oe===void 0||oe.unref()}}})},sv=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;Q.setNodes(t,a,r)},ov=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=N.isPath(s)?tr(t,s):p=>de.isElement(p)&&b.isBlock(t,p)),N.isPath(s)&&(s=b.range(t,s));var l=W.isRange(s)?b.rangeRef(t,s):null,u=b.nodes(t,{at:s,match:o,mode:r,voids:i}),c=Array.from(u,p=>{var[,g]=p;return b.pathRef(t,g)}).reverse(),f=function(){var g=m.unref(),[h]=b.node(t,g),y=b.range(t,g);a&&l&&(y=W.intersection(l.current,y)),Q.liftNodes(t,{at:y,match:v=>de.isAncestor(h)&&h.children.includes(v),voids:i})};for(var m of c)f();l&&l.unref()}})};function ku(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function _u(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ku(Object(n),!0).forEach(function(r){ot(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 uv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(N.isPath(l)?o=tr(t,l):t.isInline(n)?o=y=>de.isElement(y)&&b.isInline(t,y)||fe.isText(y):o=y=>de.isElement(y)&&b.isBlock(t,y)),i&&W.isRange(l)){var[u,c]=W.edges(l),f=b.rangeRef(t,l,{affinity:"inward"});Q.splitNodes(t,{at:c,match:o,voids:s}),Q.splitNodes(t,{at:u,match:o,voids:s}),l=f.unref(),r.at==null&&Q.select(t,l)}var m=Array.from(b.nodes(t,{at:l,match:t.isInline(n)?y=>de.isElement(y)&&b.isBlock(t,y):y=>b.isEditor(y),mode:"lowest",voids:s})),p=function(){var v=W.isRange(l)?W.intersection(l,b.range(t,h)):l;if(!v)return 0;var x=Array.from(b.nodes(t,{at:v,match:o,mode:a,voids:s}));if(x.length>0){var[B]=x,k=x[x.length-1],[,E]=B,[,A]=k;if(E.length===0&&A.length===0)return 0;var j=N.equals(E,A)?N.parent(E):N.common(E,A),L=b.range(t,E,A),I=b.node(t,j),[T]=I,O=j.length+1,w=N.next(A.slice(0,O)),F=_u(_u({},n),{},{children:[]});Q.insertNodes(t,F,{at:w,voids:s}),Q.moveNodes(t,{at:L,match:R=>de.isAncestor(T)&&T.children.includes(R),to:w.concat(0),voids:s})}},g;for(var[,h]of m)g=p()}})},lv=()=>{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 Pp(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lp(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wp(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hp(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Up(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rp(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ng(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ag(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rg(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sg(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mp(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Np(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ip(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $p(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zp(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qp(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hg(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ug(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vp(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kp(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zp(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yp(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gp(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bg(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jp(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xp(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eg(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tg(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gg(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return og(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ug(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lg(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cg(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dg(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fg(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hg(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pg(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qg(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ev(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tv(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fg(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tg(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sg(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nv(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kg(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rv(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zg(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yg(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iv(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sv(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ov(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qp(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uv(e,...r)}};return e},cv={isHistory(e){return Xe(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||Jt.isOperationList(e.redos[0].operations))&&(e.undos.length===0||Jt.isOperationList(e.undos[0].operations))}},fi=new WeakMap,hi=new WeakMap,Rn={isHistoryEditor(e){return cv.isHistory(e.history)&&b.isEditor(e)},isMerging(e){return hi.get(e)},isSaving(e){return fi.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Rn.isMerging(e);hi.set(e,!1),t(),hi.set(e,n)},withoutSaving(e,t){var n=Rn.isSaving(e);fi.set(e,!1),t(),fi.set(e,n)}},dv=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&&Q.setSelection(t,i.selectionBefore),Rn.withoutSaving(t,()=>{b.withoutNormalizing(t,()=>{for(var s of i.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:r}=t,{undos:a}=r;if(a.length>0){var i=a[a.length-1];Rn.withoutSaving(t,()=>{b.withoutNormalizing(t,()=>{var s=i.operations.map(Jt.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&Q.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=Rn.isSaving(t),c=Rn.isMerging(t);if(u==null&&(u=hv(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=fv(r,l)),o&&c)o.operations.push(r);else{var f={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",f)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},fv=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&N.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&N.equals(e.path,t.path)),hv=(e,t)=>e.type!=="set_selection",mv=vv,sd="֑-߿יִ-﷽ﹰ-ﻼ",od="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",pv=new RegExp("^[^"+od+"]*["+sd+"]"),gv=new RegExp("^[^"+sd+"]*["+od+"]");function vv(e){return e=String(e||""),pv.test(e)?"rtl":gv.test(e)?"ltr":"neutral"}const ud=xn(mv);function bv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ks=bv,yv=typeof Ir=="object"&&Ir&&Ir.Object===Object&&Ir,Dv=yv,Cv=Dv,xv=typeof self=="object"&&self&&self.Object===Object&&self,wv=Cv||xv||Function("return this")(),ld=wv,Ev=ld,kv=function(){return Ev.Date.now()},_v=kv,Bv=/\s/;function Av(e){for(var t=e.length;t--&&Bv.test(e.charAt(t)););return t}var Fv=Av,Tv=Fv,Sv=/^\s+/;function jv(e){return e&&e.slice(0,Tv(e)+1).replace(Sv,"")}var Ov=jv,Pv=ld,Nv=Pv.Symbol,cd=Nv,Bu=cd,dd=Object.prototype,Rv=dd.hasOwnProperty,Mv=dd.toString,or=Bu?Bu.toStringTag:void 0;function Iv(e){var t=Rv.call(e,or),n=e[or];try{e[or]=void 0;var r=!0}catch{}var a=Mv.call(e);return r&&(t?e[or]=n:delete e[or]),a}var $v=Iv,Lv=Object.prototype,zv=Lv.toString;function qv(e){return zv.call(e)}var Wv=qv,Au=cd,Hv=$v,Uv=Wv,Vv="[object Null]",Kv="[object Undefined]",Fu=Au?Au.toStringTag:void 0;function Zv(e){return e==null?e===void 0?Kv:Vv:Fu&&Fu in Object(e)?Hv(e):Uv(e)}var Yv=Zv;function Gv(e){return e!=null&&typeof e=="object"}var Qv=Gv,Jv=Yv,Xv=Qv,e0="[object Symbol]";function t0(e){return typeof e=="symbol"||Xv(e)&&Jv(e)==e0}var n0=t0,r0=Ov,Tu=Ks,a0=n0,Su=0/0,i0=/^[-+]0x[0-9a-f]+$/i,s0=/^0b[01]+$/i,o0=/^0o[0-7]+$/i,u0=parseInt;function l0(e){if(typeof e=="number")return e;if(a0(e))return Su;if(Tu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Tu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=r0(e);var n=s0.test(e);return n||o0.test(e)?u0(e.slice(2),n?2:8):i0.test(e)?Su:+e}var c0=l0,d0=Ks,mi=_v,ju=c0,f0="Expected a function",h0=Math.max,m0=Math.min;function p0(e,t,n){var r,a,i,s,o,l,u=0,c=!1,f=!1,m=!0;if(typeof e!="function")throw new TypeError(f0);t=ju(t)||0,d0(n)&&(c=!!n.leading,f="maxWait"in n,i=f?h0(ju(n.maxWait)||0,t):i,m="trailing"in n?!!n.trailing:m);function p(A){var j=r,L=a;return r=a=void 0,u=A,s=e.apply(L,j),s}function g(A){return u=A,o=setTimeout(v,t),c?p(A):s}function h(A){var j=A-l,L=A-u,I=t-j;return f?m0(I,i-L):I}function y(A){var j=A-l,L=A-u;return l===void 0||j>=t||j<0||f&&L>=i}function v(){var A=mi();if(y(A))return x(A);o=setTimeout(v,h(A))}function x(A){return o=void 0,m&&r?p(A):(r=a=void 0,s)}function B(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function k(){return o===void 0?s:x(mi())}function E(){var A=mi(),j=y(A);if(r=arguments,a=this,l=A,j){if(o===void 0)return g(l);if(f)return clearTimeout(o),o=setTimeout(v,t),p(l)}return o===void 0&&(o=setTimeout(v,t)),s}return E.cancel=B,E.flush=k,E}var fd=p0;const g0=xn(fd);var v0=fd,b0=Ks,y0="Expected a function";function D0(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(y0);return b0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),v0(e,t,{leading:r,maxWait:t,trailing:a})}var C0=D0;const x0=xn(C0),Ou=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Pu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",pi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Pu(n.overflowY,t)||Pu(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},Wr=(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,w0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Nu=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,f=typeof u=="function"?u:K=>K!==u;if(!Ou(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let g=e;for(;Ou(g)&&f(g);){if(g=w0(g),g===m){p.push(g);break}g!=null&&g===document.body&&pi(g)&&!pi(document.documentElement)||g!=null&&pi(g,c)&&p.push(g)}const h=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,y=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:v,scrollY:x}=window,{height:B,width:k,top:E,right:A,bottom:j,left:L}=e.getBoundingClientRect(),{top:I,right:T,bottom:O,left:w}=(K=>{const V=window.getComputedStyle(K);return{top:parseFloat(V.scrollMarginTop)||0,right:parseFloat(V.scrollMarginRight)||0,bottom:parseFloat(V.scrollMarginBottom)||0,left:parseFloat(V.scrollMarginLeft)||0}})(e);let F=o==="start"||o==="nearest"?E-I:o==="end"?j+O:E+B/2-I+O,R=l==="center"?L+k/2-w+T:l==="end"?A+T:L-w;const M=[];for(let K=0;K<p.length;K++){const V=p[K],{height:oe,width:ne,top:D,right:q,bottom:ee,left:_}=V.getBoundingClientRect();if(s==="if-needed"&&E>=0&&L>=0&&j<=y&&A<=h&&E>=D&&j<=ee&&L>=_&&A<=q)return M;const S=getComputedStyle(V),z=parseInt(S.borderLeftWidth,10),$=parseInt(S.borderTopWidth,10),U=parseInt(S.borderRightWidth,10),re=parseInt(S.borderBottomWidth,10);let te=0,Y=0;const le="offsetWidth"in V?V.offsetWidth-V.clientWidth-z-U:0,X="offsetHeight"in V?V.offsetHeight-V.clientHeight-$-re:0,ve="offsetWidth"in V?V.offsetWidth===0?0:ne/V.offsetWidth:0,pe="offsetHeight"in V?V.offsetHeight===0?0:oe/V.offsetHeight:0;if(m===V)te=o==="start"?F:o==="end"?F-y:o==="nearest"?Wr(x,x+y,y,$,re,x+F,x+F+B,B):F-y/2,Y=l==="start"?R:l==="center"?R-h/2:l==="end"?R-h:Wr(v,v+h,h,z,U,v+R,v+R+k,k),te=Math.max(0,te+x),Y=Math.max(0,Y+v);else{te=o==="start"?F-D-$:o==="end"?F-ee+re+X:o==="nearest"?Wr(D,ee,oe,$,re+X,F,F+B,B):F-(D+oe/2)+X/2,Y=l==="start"?R-_-z:l==="center"?R-(_+ne/2)+le/2:l==="end"?R-q+U+le:Wr(_,q,ne,z,U+le,R,R+k,k);const{scrollLeft:_e,scrollTop:je}=V;te=pe===0?0:Math.max(0,Math.min(je+te/pe,V.scrollHeight-oe/pe+X)),Y=ve===0?0:Math.max(0,Math.min(_e+Y/ve,V.scrollWidth-ne/ve+le)),F+=je-te,R+=_e-Y}M.push({el:V,top:te,left:Y})}return M},E0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function k0(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(Nu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Nu(e,E0(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var pn=[],_0=function(){return pn.some(function(e){return e.activeTargets.length>0})},B0=function(){return pn.some(function(e){return e.skippedTargets.length>0})},Ru="ResizeObserver loop completed with undelivered notifications.",A0=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Ru}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Ru),window.dispatchEvent(e)},_r;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(_r||(_r={}));var gn=function(e){return Object.freeze(e)},F0=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,gn(this)}return e}(),hd=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,gn(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}(),Zs=function(e){return e instanceof SVGElement&&"getBBox"in e},md=function(e){if(Zs(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)},Mu=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)},T0=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},pr=typeof window<"u"?window:{},Hr=new WeakMap,Iu=/auto|scroll/,S0=/^tb|vertical/,j0=/msie|trident/i.test(pr.navigator&&pr.navigator.userAgent),At=function(e){return parseFloat(e||"0")},Ln=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new F0((n?t:e)||0,(n?e:t)||0)},$u=gn({devicePixelContentBoxSize:Ln(),borderBoxSize:Ln(),contentBoxSize:Ln(),contentRect:new hd(0,0,0,0)}),pd=function(e,t){if(t===void 0&&(t=!1),Hr.has(e)&&!t)return Hr.get(e);if(md(e))return Hr.set(e,$u),$u;var n=getComputedStyle(e),r=Zs(e)&&e.ownerSVGElement&&e.getBBox(),a=!j0&&n.boxSizing==="border-box",i=S0.test(n.writingMode||""),s=!r&&Iu.test(n.overflowY||""),o=!r&&Iu.test(n.overflowX||""),l=r?0:At(n.paddingTop),u=r?0:At(n.paddingRight),c=r?0:At(n.paddingBottom),f=r?0:At(n.paddingLeft),m=r?0:At(n.borderTopWidth),p=r?0:At(n.borderRightWidth),g=r?0:At(n.borderBottomWidth),h=r?0:At(n.borderLeftWidth),y=f+u,v=l+c,x=h+p,B=m+g,k=o?e.offsetHeight-B-e.clientHeight:0,E=s?e.offsetWidth-x-e.clientWidth:0,A=a?y+x:0,j=a?v+B:0,L=r?r.width:At(n.width)-A-E,I=r?r.height:At(n.height)-j-k,T=L+y+E+x,O=I+v+k+B,w=gn({devicePixelContentBoxSize:Ln(Math.round(L*devicePixelRatio),Math.round(I*devicePixelRatio),i),borderBoxSize:Ln(T,O,i),contentBoxSize:Ln(L,I,i),contentRect:new hd(f,l,L,I)});return Hr.set(e,w),w},gd=function(e,t,n){var r=pd(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case _r.DEVICE_PIXEL_CONTENT_BOX:return s;case _r.BORDER_BOX:return a;default:return i}},O0=function(){function e(t){var n=pd(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=gn([n.borderBoxSize]),this.contentBoxSize=gn([n.contentBoxSize]),this.devicePixelContentBoxSize=gn([n.devicePixelContentBoxSize])}return e}(),vd=function(e){if(md(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},P0=function(){var e=1/0,t=[];pn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var c=new O0(u.target),f=vd(u.target);o.push(c),u.lastReportedSize=gd(u.target,u.observedBox),f<e&&(e=f)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},Lu=function(e){pn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(vd(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},N0=function(){var e=0;for(Lu(e);_0();)e=P0(),Lu(e);return B0()&&A0(),e>0},gi,bd=[],R0=function(){return bd.splice(0).forEach(function(e){return e()})},M0=function(e){if(!gi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return R0()}).observe(n,r),gi=function(){n.textContent="".concat(t?t--:t++)}}bd.push(e),gi()},I0=function(e){M0(function(){requestAnimationFrame(e)})},la=0,$0=function(){return!!la},L0=250,z0={attributes:!0,characterData:!0,childList:!0,subtree:!0},zu=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],qu=function(e){return e===void 0&&(e=0),Date.now()+e},vi=!1,q0=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=L0),!vi){vi=!0;var r=qu(t);I0(function(){var a=!1;try{a=N0()}finally{if(vi=!1,t=r-qu(),!$0())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,z0)};document.body?n():pr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),zu.forEach(function(n){return pr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),zu.forEach(function(n){return pr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),fs=new q0,Wu=function(e){!la&&e>0&&fs.start(),la+=e,!la&&fs.stop()},W0=function(e){return!Zs(e)&&!T0(e)&&getComputedStyle(e).display==="inline"},H0=function(){function e(t,n){this.target=t,this.observedBox=n||_r.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=gd(this.target,this.observedBox,!0);return W0(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),U0=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Ur=new WeakMap,Hu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Vr=function(){function e(){}return e.connect=function(t,n){var r=new U0(t,n);Ur.set(t,r)},e.observe=function(t,n,r){var a=Ur.get(t),i=a.observationTargets.length===0;Hu(a.observationTargets,n)<0&&(i&&pn.push(a),a.observationTargets.push(new H0(n,r&&r.box)),Wu(1),fs.schedule())},e.unobserve=function(t,n){var r=Ur.get(t),a=Hu(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&pn.splice(pn.indexOf(r),1),r.observationTargets.splice(a,1),Wu(-1))},e.disconnect=function(t){var n=this,r=Ur.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),V0=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.");Vr.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(!Mu(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Vr.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(!Mu(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Vr.unobserve(this,t)},e.prototype.disconnect=function(){Vr.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Vt={};Object.defineProperty(Vt,"__esModule",{value:!0});var K0=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),bi={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},yd={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:K0?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Ys={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 Kr=1;Kr<20;Kr++)Ys["f"+Kr]=111+Kr;function Va(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Dd(s,t)}),a=function(o){return r.some(function(l){return Cd(l,o)})},i=n==null?a:a(n);return i}function Z0(e,t){return Va(e,t)}function Y0(e,t){return Va(e,{byKey:!0},t)}function Dd(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in bi)r[bi[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var c=a[Symbol.iterator](),f;!(o=(f=c.next()).done);o=!0){var m=f.value,p=m.endsWith("?")&&m.length>1;p&&(m=m.slice(0,-1));var g=Gs(m),h=bi[g];if(m.length>1&&!h&&!yd[m]&&!Ys[g])throw new TypeError('Unknown modifier: "'+m+'"');(i===1||!h)&&(n?r.key=g:r.which=xd(m)),h&&(r[h]=p?null:!0)}}catch(y){l=!0,u=y}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Cd(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 xd(e){e=Gs(e);var t=Ys[e]||e.toUpperCase().charCodeAt(0);return t}function Gs(e){return e=e.toLowerCase(),e=yd[e]||e,e}var G0=Vt.default=Va,yi=Vt.isHotkey=Va;Vt.isCodeHotkey=Z0;Vt.isKeyHotkey=Y0;Vt.parseHotkey=Dd;Vt.compareHotkey=Cd;Vt.toKeyCode=xd;Vt.toKeyName=Gs;function Q0(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 Vn(e,t){if(e==null)return{};var n=Q0(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 Br(e){"@babel/helpers - typeof";return Br=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Br(e)}function J0(e,t){if(Br(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Br(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function X0(e){var t=J0(e,"string");return Br(t)==="symbol"?t:String(t)}function xt(e,t,n){return t=X0(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qs=C.createContext(null),sn=()=>{var e=C.useContext(Qs);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},wd=parseInt(C.version.split(".")[0],10),eb=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Uu=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),st=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Mn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),fr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),tb=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Ed=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),nb=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),rb=st&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),ab=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),ib=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),sb=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ca=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Kt=(!nb||!rb)&&!tb&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Js=new WeakMap,Xs=new WeakMap,kd=new WeakMap,da=new WeakMap,hs=new WeakMap,Ar=new WeakMap,vn=new WeakMap,ka=new WeakMap,Ka=new WeakMap,ms=new WeakMap,Xt=new WeakMap,hn=new WeakMap,gr=new WeakMap,ps=new WeakMap,eo=new WeakMap,kt=new WeakMap,zt=new WeakMap,ct=new WeakMap,Yt=new WeakMap,Gt=new WeakMap,_d=new WeakMap,Kn=Symbol("placeholder"),Bd=Symbol("mark-placeholder"),ob=globalThis.Text,to=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,ub=e=>tn(e)&&e.nodeType===8,Ct=e=>tn(e)&&e.nodeType===1,tn=e=>{var t=to(e);return!!t&&e instanceof t.Node},gs=e=>{var t=e&&e.anchorNode&&to(e.anchorNode);return!!t&&e instanceof t.Selection},Ad=e=>tn(e)&&e.nodeType===3,lb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,cb=e=>{var[t,n]=e;if(Ct(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=Fd(t,a,r?"backward":"forward"),r=a<n;Ct(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=fb(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},db=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Fd=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(ub(a)||Ct(a)&&a.childNodes.length===0||Ct(a)&&a.getAttribute("contenteditable")==="false")&&!(s&&o);){if(i>=r.length){s=!0,i=t-1,n="backward";continue}if(i<0){o=!0,i=t+1,n="forward";continue}a=r[i],t=i,i+=n==="forward"?1:-1}return[a,t]},fb=(e,t,n)=>{var[r]=Fd(e,t,n);return r},Td=e=>{var t="";if(Ad(e)&&e.nodeValue)return e.nodeValue;if(Ct(e)){for(var n of Array.from(e.childNodes))t+=Td(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
|
|
103
|
+
`)}return t},hb=/data-slate-fragment="(.+?)"/m,mb=e=>{var t=e.getData("text/html"),[,n]=t.match(hb)||[];return n},no=(e,t,n)=>{var{target:r}=t;if(Ct(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=J.getWindow(e);if(a.contains(r))return J.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var c of l)if(c===r||c.contains(r))return!0});return!i||i===t?!1:no(e,i,n)},pb=0;class gb{constructor(){xt(this,"id",void 0),this.id="".concat(pb++)}}var J={androidPendingDiffs:e=>ct.get(e),androidScheduleFlush:e=>{var t;(t=eo.get(e))===null||t===void 0||t()},blur:e=>{var t=J.toDOMNode(e,e),n=J.findDocumentOrShadowRoot(e);Xt.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=J.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&Q.deselect(e)},findDocumentOrShadowRoot:e=>{var t=J.toDOMNode(e,e),n=t.getRootNode();return(n instanceof Document||n instanceof ShadowRoot)&&n.getSelection!=null?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:a}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i=J.toSlateNode(e,t.target),s=J.findPath(e,i);if(de.isElement(i)&&b.isVoid(e,i)){var o=a.getBoundingClientRect(),l=e.isInline(i)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,u=b.point(e,s,{edge:l?"start":"end"}),c=l?b.before(e,u):b.after(e,u);if(c){var f=b.range(e,c);return f}}var m,{document:p}=J.getWindow(e);if(p.caretRangeFromPoint)m=p.caretRangeFromPoint(n,r);else{var g=p.caretPositionFromPoint(n,r);g&&(m=p.createRange(),m.setStart(g.offsetNode,g.offset),m.setEnd(g.offsetNode,g.offset))}if(!m)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var h=J.toSlateRange(e,m,{exactMatch:!1,suppressThrow:!1});return h},findKey:(e,t)=>{var n=ka.get(t);return n||(n=new gb,ka.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=Xs.get(r);if(a==null){if(b.isEditor(r))return n;break}var i=Js.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(Ge.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!Xt.get(t)){if(n.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(t.operations.length>0){setTimeout(()=>{J.focus(t,{retries:n.retries-1})},10);return}var r=J.toDOMNode(t,t),a=J.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=J.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(Q.select(t,b.start(t,[])),t.onChange()),Xt.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=kd.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{editable:a=!1}=r,i=J.toDOMNode(t,t),s;try{s=Ct(n)?n:n.parentElement}catch(o){if(o instanceof Error&&!o.message.includes('Permission denied to access property "nodeType"'))throw o}return s?s.closest("[data-slate-editor]")===i&&(!a||s.isContentEditable?!0:typeof s.isContentEditable=="boolean"&&s.closest('[contenteditable="false"]')===i||!!s.getAttribute("data-slate-zero-width")):!1},hasEditableTarget:(e,t)=>tn(t)&&J.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return b.hasPath(e,n.path)&&b.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>J.hasEditableTarget(e,t)||J.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>tn(t)&&J.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!hn.get(e),isFocused:e=>!!Xt.get(e),isReadOnly:e=>!!ms.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(ms.get(e))return!1;var n=J.hasTarget(e,t)&&J.toSlateNode(e,t);return de.isElement(n)&&b.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=Ka.get(e),r=b.isEditor(t)?da.get(e):n==null?void 0:n.get(J.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(Ge.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=b.node(e,t.path),r=J.toDOMNode(e,n),a;b.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],c=u.childNodes[0];if(!(c==null||c.textContent==null)){var{length:f}=c.textContent,m=u.getAttribute("data-slate-length"),p=m==null?f:parseInt(m,10),g=o+p,h=s[l+1];if(t.offset===g&&h!==null&&h!==void 0&&h.hasAttribute("data-slate-mark-placeholder")){var y,v=h.childNodes[0];a=[v instanceof ob?v:h,(y=h.textContent)!==null&&y!==void 0&&y.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var x=Math.min(f,Math.max(0,t.offset-o));a=[c,x];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(Ge.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=W.isBackward(t),i=J.toDOMPoint(e,n),s=W.isCollapsed(t)?i:J.toDOMPoint(e,r),o=J.getWindow(e),l=o.document.createRange(),[u,c]=a?s:i,[f,m]=a?i:s,p=Ct(u)?u:u.parentElement,g=!!p.getAttribute("data-slate-zero-width"),h=Ct(f)?f:f.parentElement,y=!!h.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:c),l.setEnd(f,y?1:m),l},toSlateNode:(e,t)=>{var n=Ct(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Ar.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:cb(t),o=i.parentNode,l=null,u=0;if(o){var c,f,m=J.toDOMNode(e,e),p=o.closest('[data-slate-void="true"]'),g=p&&m.contains(p)?p:null,h=o.closest("[data-slate-leaf]"),y=null;if(h){if(l=h.closest('[data-slate-node="text"]'),l){var v=J.getWindow(e),x=v.document.createRange();x.setStart(l,0),x.setEnd(i,s);var B=x.cloneContents(),k=[...Array.prototype.slice.call(B.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(B.querySelectorAll("[contenteditable=false]"))];k.forEach(R=>{if(st&&!r&&R.hasAttribute("data-slate-zero-width")&&R.textContent.length>0&&R.textContext!=="\uFEFF"){R.textContent.startsWith("\uFEFF")&&(R.textContent=R.textContent.slice(1));return}R.parentNode.removeChild(R)}),u=B.textContent.length,y=l}}else if(g){for(var E=g.querySelectorAll("[data-slate-leaf]"),A=0;A<E.length;A++){var j=E[A];if(J.hasDOMNode(e,j)){h=j;break}}h?(l=h.closest('[data-slate-node="text"]'),y=h,u=y.textContent.length,y.querySelectorAll("[data-slate-zero-width]").forEach(R=>{u-=R.textContent.length})):u=1}y&&u===y.textContent.length&&st&&y.getAttribute("data-slate-zero-width")==="z"&&(c=y.textContent)!==null&&c!==void 0&&c.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Mn&&(f=y.textContent)!==null&&f!==void 0&&f.endsWith(`
|
|
104
104
|
|
|
105
|
-
`))&&u--}if(
|
|
105
|
+
`))&&u--}if(st&&!l&&!r){var L=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(L&&J.hasDOMNode(e,L,{editable:!0})){var I=J.toSlateNode(e,L),{path:T,offset:O}=b.start(e,J.findPath(e,I));return L.querySelector("[data-slate-leaf]")||(O=s),{path:T,offset:O}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var w=J.toSlateNode(e,l),F=J.findPath(e,w);return{path:F,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=gs(t)?t.anchorNode:t.startContainer,o,l,u,c,f;if(s)if(gs(t)){if(Mn&&t.rangeCount>1){u=t.focusNode;var m=t.getRangeAt(0),p=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&m.startContainer instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement){let A=function(j){return j.childElementCount>0?A(j.children[0]):j};var g=m.startContainer,h=p.startContainer,y=A(g.children[m.startOffset]),v=A(h.children[p.startOffset]);c=0,v.childNodes.length>0?o=v.childNodes[0]:o=v,y.childNodes.length>0?u=y.childNodes[0]:u=y,v instanceof HTMLElement?l=v.innerHTML.length:l=0}else m.startContainer===u?(o=p.endContainer,l=p.endOffset,c=m.startOffset):(o=m.startContainer,l=m.endOffset,c=p.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,c=t.focusOffset;Ed&&db(o)||Mn?f=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:f=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,c=t.endOffset,f=t.collapsed;if(o==null||u==null||l==null||c==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(Mn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
|
|
106
106
|
|
|
107
|
-
`)&&c===u.textContent.length&&c--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var x;u=o,c=((x=o.textContent)===null||x===void 0?void 0:x.length)||0}var B=Q.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!B)return null;var E=f?B:Q.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!E)return null;var _={anchor:B,focus:E};return W.isExpanded(_)&&W.isForward(_)&&yt(u)&&v.void(e,{at:_.focus,mode:"highest"})&&(_=v.unhangRange(e,_,{voids:!0})),_}};function lb(e,t){var{path:n,diff:r}=t;if(!v.hasPath(e,n))return!1;var a=ie.get(e,n);if(!de.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=P.next(n);if(!v.hasPath(e,i))return!1;var s=ie.get(e,i);return de.isText(s)&&s.text.startsWith(r.text)}function Ed(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 cb(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 db(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 _d(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=cb(i,a),o=Math.min(i.length-s,a.length-s),l=db(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 fb(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=Ed(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 _d(e,{start:r,end:l,text:o})}function hb(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function hs(e,t){var{path:n,offset:r}=t;if(!v.hasPath(e,n))return null;var a=ie.get(e,n);if(!de.isText(a))return null;var i=v.above(e,{match:o=>ce.isElement(o)&&v.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=v.next(e,{at:n,match:de.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 Lu(e,t){var n=hs(e,t.anchor);if(!n)return null;if(W.isCollapsed(t))return{anchor:n,focus:n};var r=hs(e,t.focus);return r?{anchor:n,focus:r}:null}function ms(e,t,n){var r=ut.get(e),a=r==null?void 0:r.find(c=>{var{path:f}=c;return P.equals(f,t.path)});if(!a||t.offset<=a.diff.start)return Ce.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=Ce.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=Ce.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 zu(e,t,n){var r=ms(e,t.anchor,n);if(!r)return null;if(W.isCollapsed(t))return{anchor:r,focus:r};var a=ms(e,t.focus,n);return a?{anchor:r,focus:a}:null}function mb(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 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 Hr(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 pb=25,gb=200,vb=function(){},bb=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function yb(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,c=()=>{var w=Kt.get(t);if(Kt.delete(t),w){var{selection:F}=t,N=Lu(t,w);N&&(!F||!W.equals(N,F))&&G.select(t,N)}},f=()=>{var w=Vt.get(t);if(Vt.delete(t),!!w){if(w.at){var F=Ce.isPoint(w.at)?hs(t,w.at):Lu(t,w.at);if(!F)return;var N=v.range(t,F);(!t.selection||!W.equals(t.selection,N))&&G.select(t,F)}w.run()}},m=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!E()&&!B()){c();return}a||(a=!0,setTimeout(()=>a=!1)),B()&&(a="action");var w=t.selection&&v.rangeRef(t,t.selection,{affinity:"forward"});$t.set(t,t.marks),vb("flush",Vt.get(t),ut.get(t));for(var F=E(),N;N=(M=ut.get(t))===null||M===void 0?void 0:M[0];){var M,Z,K=wt.get(t);K!==void 0&&(wt.delete(t),t.marks=K),K&&u===!1&&(u=null);var se=hb(N);(!t.selection||!W.equals(t.selection,se))&&G.select(t,se),N.diff.text?v.insertText(t,N.diff.text):v.deleteFragment(t),ut.set(t,(Z=ut.get(t))===null||Z===void 0?void 0:Z.filter(q=>{var{id:X}=q;return X!==N.id})),lb(t,N)||(F=!1,Vt.delete(t),$t.delete(t),a="action",Kt.delete(t),n.cancel(),r.cancel(),w==null||w.unref())}var ne=w==null?void 0:w.unref();if(ne&&!Kt.get(t)&&(!t.selection||!W.equals(ne,t.selection))&&G.select(t,ne),B()){f();return}F&&n(),n.flush(),r.flush(),c();var D=$t.get(t);$t.delete(t),D!==void 0&&(t.marks=D,t.onChange())},p=w=>{i&&clearTimeout(i),i=setTimeout(()=>{ln.set(t,!1),m()},pb)},g=w=>{ln.set(t,!0),i&&(clearTimeout(i),i=null)},h=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,N=ls.get(t);if(N){if(E()||F){N.style.display="none";return}N.style.removeProperty("display")}},y=(w,F)=>{var N,M=(N=ut.get(t))!==null&&N!==void 0?N:[];ut.set(t,M);var Z=ie.leaf(t,w),K=M.findIndex(D=>P.equals(D.path,w));if(K<0){var se=_d(Z.text,F);se&&M.push({path:w,diff:F,id:l++}),h();return}var ne=fb(Z.text,M[K].diff,F);if(!ne){M.splice(K,1),h();return}M[K]=Hr(Hr({},M[K]),{},{diff:ne})},b=function(F){var{at:N}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,Kt.delete(t),n.cancel(),r.cancel(),B()&&m(),Vt.set(t,{at:N,run:F}),o=setTimeout(m)},x=w=>{var F;s&&(clearTimeout(s),s=null);var{inputType:N}=w,M=null,Z=w.dataTransfer||w.data||void 0;u!==!1&&N!=="insertText"&&N!=="insertCompositionText"&&(u=!1);var[K]=w.getTargetRanges();K&&(M=Q.toSlateRange(t,K,{exactMatch:!1,suppressThrow:!0}));var se=Q.getWindow(t),ne=se.getSelection();if(!M&&ne&&(K=ne,M=Q.toSlateRange(t,ne,{exactMatch:!1,suppressThrow:!0})),M=(F=M)!==null&&F!==void 0?F:t.selection,!!M){var D=!0;if(N.startsWith("delete")){if(W.isExpanded(M)){var[q,X]=W.edges(M),k=ie.leaf(t,q.path);if(k.text.length===q.offset&&X.offset===0){var S=v.next(t,{at:q.path,match:de.isText});S&&P.equals(S[1],X.path)&&(M={anchor:X,focus:X})}}var z=N.endsWith("Backward")?"backward":"forward",[L,U]=W.edges(M),[te,ee]=v.leaf(t,L.path),Y={text:"",start:L.offset,end:U.offset},ue=ut.get(t),J=ue==null?void 0:ue.find(pe=>P.equals(pe.path,ee)),ge=J?[J.diff,Y]:[Y],me=Ed(te.text,...ge);if(me.length===0&&(D=!1),W.isExpanded(M)){if(D&&P.equals(M.anchor.path,M.focus.path)){var _e={path:M.anchor.path,offset:L.offset},Se=v.range(t,_e,_e);return A(Se),y(M.anchor.path,{text:"",end:U.offset,start:L.offset})}return b(()=>v.deleteFragment(t,{direction:z}),{at:M})}}switch(N){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return b(()=>v.deleteFragment(t),{at:M});case"deleteContent":case"deleteContentForward":{var{anchor:Pe}=M;if(D&&W.isCollapsed(M)){var Ge=ie.leaf(t,Pe.path);if(Pe.offset<Ge.text.length)return y(Pe.path,{text:"",start:Pe.offset,end:Pe.offset+1})}return b(()=>v.deleteForward(t),{at:M})}case"deleteContentBackward":{var Ke,{anchor:Ze}=M,tt=fs(K)?K.isCollapsed:!!((Ke=K)!==null&&Ke!==void 0&&Ke.collapsed);return D&&tt&&W.isCollapsed(M)&&Ze.offset>0?y(Ze.path,{text:"",start:Ze.offset-1,end:Ze.offset}):b(()=>v.deleteBackward(t),{at:M})}case"deleteEntireSoftLine":return b(()=>{v.deleteBackward(t,{unit:"line"}),v.deleteForward(t,{unit:"line"})},{at:M});case"deleteHardLineBackward":return b(()=>v.deleteBackward(t,{unit:"block"}),{at:M});case"deleteSoftLineBackward":return b(()=>v.deleteBackward(t,{unit:"line"}),{at:M});case"deleteHardLineForward":return b(()=>v.deleteForward(t,{unit:"block"}),{at:M});case"deleteSoftLineForward":return b(()=>v.deleteForward(t,{unit:"line"}),{at:M});case"deleteWordBackward":return b(()=>v.deleteBackward(t,{unit:"word"}),{at:M});case"deleteWordForward":return b(()=>v.deleteForward(t,{unit:"word"}),{at:M});case"insertLineBreak":return b(()=>v.insertSoftBreak(t),{at:M});case"insertParagraph":return b(()=>v.insertBreak(t),{at:M});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(bb(Z))return b(()=>Q.insertData(t,Z),{at:M});var Ae=Z??"";if(wt.get(t)&&(Ae=Ae.replace("\uFEFF","")),N==="insertText"&&/.*\n.*\n$/.test(Ae)&&(Ae=Ae.slice(0,-1)),Ae.includes(`
|
|
108
|
-
`))return
|
|
109
|
-
`);
|
|
110
|
-
`?C.createElement(
|
|
111
|
-
`:""),[i]=C.useState(a);return _r(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),C.createElement(Ob,{ref:r},i)},Ob=C.memo(C.forwardRef((e,t)=>C.createElement("span",{"data-slate-string":!0,ref:t},e.children))),pi=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),C.createElement("span",Sb({},a),!at||!n?"\uFEFF":null,n?C.createElement("br",null):null)};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 Bd(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 Pb=at?300:0;function Nb(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function Ku(e){e.current&&(clearTimeout(e.current),e.current=null)}var Rb=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=x=>C.createElement(Ib,Bd({},x))}=e,o=nn(),l=C.useRef(null),u=C.useRef(null),[c,f]=C.useState(!1),m=C.useRef(null),p=C.useCallback(x=>{if(Nb(l,x==null),x==null){var B;ls.delete(o),(B=t.onPlaceholderResize)===null||B===void 0||B.call(t,null)}else{if(ls.set(o,x),!l.current){var E=window.ResizeObserver||q0;l.current=new E(()=>{var _;(_=t.onPlaceholderResize)===null||_===void 0||_.call(t,x)})}l.current.observe(x),u.current=x}},[u,t,o]),g=C.createElement(jb,{isLast:n,leaf:t,parent:a,text:r}),h=!!t[Hn];if(C.useEffect(()=>(h?m.current||(m.current=setTimeout(()=>{f(!0),m.current=null},Pb)):(Ku(m),f(!1)),()=>Ku(m)),[h,f]),h&&c){var y={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:ur?"inherit":void 0},contentEditable:!1,ref:p}};g=C.createElement(C.Fragment,null,i(y),g)}var b={"data-slate-leaf":!0};return s({attributes:b,children:g,leaf:t,text:r})},Mb=C.memo(Rb,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&de.equals(t.leaf,e.leaf)&&t.leaf[Hn]===e.leaf[Hn]),Ib=e=>{var{attributes:t,children:n}=e;return C.createElement("span",Bd({},t),n)},$b=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=nn(),l=C.useRef(null),u=de.decorations(s,t),c=Q.findKey(o,s),f=[],m=0;m<u.length;m++){var p=u[m];f.push(C.createElement(Mb,{isLast:n&&m===u.length-1,key:"".concat(c.id,"-").concat(m),renderPlaceholder:a,leaf:p,text:s,parent:r,renderLeaf:i}))}var g=C.useCallback(h=>{var y=za.get(o);h?(y==null||y.set(c,h),hn.set(s,h),Er.set(h,s)):(y==null||y.delete(c),hn.delete(s),l.current&&Er.delete(l.current)),l.current=h},[l,o,c,s]);return C.createElement("span",{"data-slate-node":"text",ref:g},f)},Ad=C.memo($b,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&Tb(t.decorations,e.decorations));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 ps(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 Lb=e=>{var{decorations:t,element:n,renderElement:r=x=>C.createElement(qb,ps({},x)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=nn(),l=Ub(),u=o.isInline(n),c=Q.findKey(o,n),f=C.useCallback(x=>{var B=za.get(o);x?(B==null||B.set(c,x),hn.set(n,x),Er.set(x,n)):(B==null||B.delete(c),hn.delete(n))},[o,c,n]),m=Td({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),p={"data-slate-node":"element",ref:f};if(u&&(p["data-slate-inline"]=!0),!u&&v.hasInlines(o,n)){var g=ie.string(n),h=id(g);h==="rtl"&&(p.dir=h)}if(v.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var y=u?"span":"div",[[b]]=ie.texts(n);m=C.createElement(y,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},C.createElement(Ad,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:b})),Ks.set(b,0),Zs.set(b,n)}return r({attributes:p,children:m,element:n})},zb=C.memo(Lb,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&Fb(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&W.equals(e.selection,t.selection))),qb=e=>{var{attributes:t,children:n,element:r}=e,a=nn(),i=a.isInline(r)?"span":"div";return C.createElement(i,ps(ps({},t),{},{style:{position:"relative"}}),n)},Fd=C.createContext(()=>[]),Wb=()=>C.useContext(Fd),Hb=C.createContext(!1),Td=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=Wb(),l=nn(),u=Q.findPath(l,n),c=[],f=ce.isElement(n)&&!l.isInline(n)&&v.hasInlines(l,n),m=0;m<n.children.length;m++){var p=u.concat(m),g=n.children[m],h=Q.findKey(l,g),y=v.range(l,p),b=s&&W.intersection(y,s),x=o([g,p]);for(var B of t){var E=W.intersection(B,y);E&&x.push(E)}ce.isElement(g)?c.push(C.createElement(Hb.Provider,{key:"provider-".concat(h.id),value:!!b},C.createElement(zb,{decorations:x,element:g,key:h.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:b}))):c.push(C.createElement(Ad,{decorations:x,key:h.id,isLast:f&&m===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),Ks.set(g,m),Zs.set(g,n)}return c},Sd=C.createContext(!1),Ub=()=>C.useContext(Sd),jd=C.createContext(null),Jn=()=>{var e=C.useContext(jd);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function Vb(){var e=nn(),t=C.useRef(!1),n=C.useRef(0),r=C.useCallback(()=>{if(!t.current){t.current=!0;var a=Q.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return C.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var Kb=3,Zb={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"},Yb={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"},Gb={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Me=e=>{var t=Zb[e],n=Yb[e],r=Gb[e],a=t&&ri(t),i=n&&ri(n),s=r&&ri(r);return o=>!!(a&&a(o)||$u&&i&&i(o)||!$u&&s&&s(o))},$e={isBold:Me("bold"),isCompose:Me("compose"),isMoveBackward:Me("moveBackward"),isMoveForward:Me("moveForward"),isDeleteBackward:Me("deleteBackward"),isDeleteForward:Me("deleteForward"),isDeleteLineBackward:Me("deleteLineBackward"),isDeleteLineForward:Me("deleteLineForward"),isDeleteWordBackward:Me("deleteWordBackward"),isDeleteWordForward:Me("deleteWordForward"),isExtendBackward:Me("extendBackward"),isExtendForward:Me("extendForward"),isExtendLineBackward:Me("extendLineBackward"),isExtendLineForward:Me("extendLineForward"),isItalic:Me("italic"),isMoveLineBackward:Me("moveLineBackward"),isMoveLineForward:Me("moveLineForward"),isMoveWordBackward:Me("moveWordBackward"),isMoveWordForward:Me("moveWordForward"),isRedo:Me("redo"),isSoftBreak:Me("insertSoftBreak"),isSplitBlock:Me("splitBlock"),isTransposeCharacter:Me("transposeCharacter"),isUndo:Me("undo")},Qb=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>Qs(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}},Jb={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Od extends C.Component{constructor(){super(...arguments),Dt(this,"context",null),Dt(this,"manager",null),Dt(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,Jb)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=Qb(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}}Dt(Od,"contextType",Vs);var Xb=at?Od:e=>{var{children:t}=e;return C.createElement(C.Fragment,null,t)},ey=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],ty=["text"];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 At(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 ny=e=>C.createElement(C.Fragment,null,Td(e)),ry=e=>{var t=C.useCallback(S=>C.createElement(ay,At({},S)),[]),{autoFocus:n,decorate:r=iy,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=sy,style:f={},as:m="div",disableDefaultStyles:p=!1}=e,g=Wn(e,ey),h=Jn(),[y,b]=C.useState(!1),x=C.useRef(null),B=C.useRef([]),[E,_]=C.useState(),{onUserInput:T,receivedUserInput:A}=Vb(),[,$]=C.useReducer(S=>S+1,0);yd.set(h,$),cs.set(h,s);var I=C.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);C.useEffect(()=>{x.current&&n&&x.current.focus()},[n]);var j=C.useRef(),R=C.useMemo(()=>b0(()=>{var S=j.current;if((at||!Q.isComposing(h))&&(!I.isUpdatingSelection||S!=null&&S.isFlushing())&&!I.isDraggingInternally){var z=Q.findDocumentOrShadowRoot(h),{activeElement:L}=z,U=Q.toDOMNode(h,h),te=z.getSelection();if(L===U?(I.latestElement=L,Gt.set(h,!0)):Gt.delete(h),!te)return G.deselect(h);var{anchorNode:ee,focusNode:Y}=te,ue=Q.hasEditableTarget(h,ee)||Q.isTargetInsideNonReadonlyVoid(h,ee),J=Q.hasEditableTarget(h,Y)||Q.isTargetInsideNonReadonlyVoid(h,Y);if(ue&&J){var ge=Q.toSlateRange(h,te,{exactMatch:!1,suppressThrow:!0});ge&&(!Q.isComposing(h)&&!(S!=null&&S.hasPendingChanges())&&!(S!=null&&S.isFlushing())?G.select(h,ge):S==null||S.handleUserSelect(ge))}s&&(!ue||!J)&&G.deselect(h)}},100),[h,s,I]),w=C.useMemo(()=>f0(R,0),[R]);j.current=_b({node:x,onDOMSelectionChange:R,scheduleOnDOMSelectionChange:w}),_r(()=>{var S,z,L;x.current&&(L=Gs(x.current))?(bd.set(h,L),sa.set(h,x.current),hn.set(h,x.current),Er.set(x.current,h)):hn.delete(h);var{selection:U}=h,te=Q.findDocumentOrShadowRoot(h),ee=te.getSelection();if(!(!ee||!Q.isFocused(h)||(S=j.current)!==null&&S!==void 0&&S.hasPendingAction())){var Y=me=>{var _e=ee.type!=="None";if(!(!U&&!_e)){var Se=ee.focusNode,Pe;if(On&&ee.rangeCount>1){var Ge=ee.getRangeAt(0),Ke=ee.getRangeAt(ee.rangeCount-1);Ge.startContainer===Se?Pe=Ke.endContainer:Pe=Ge.startContainer}else Pe=ee.anchorNode;var Ze=sa.get(h),tt=!1;if(Ze.contains(Pe)&&Ze.contains(Se)&&(tt=!0),_e&&tt&&U&&!me){var Ae=Q.toSlateRange(h,ee,{exactMatch:!0,suppressThrow:!0});if(Ae&&W.equals(Ae,U)){var We;if(!I.hasMarkPlaceholder||(We=Pe)!==null&&We!==void 0&&(We=We.parentElement)!==null&&We!==void 0&&We.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!Q.hasRange(h,U)){h.selection=Q.toSlateRange(h,ee,{exactMatch:!1,suppressThrow:!0});return}I.isUpdatingSelection=!0;var Le=U&&Q.toDOMRange(h,U);return Le?(Q.isComposing(h)&&!at?ee.collapseToEnd():W.isBackward(U)?ee.setBaseAndExtent(Le.endContainer,Le.endOffset,Le.startContainer,Le.startOffset):ee.setBaseAndExtent(Le.startContainer,Le.startOffset,Le.endContainer,Le.endOffset),c(h,Le)):ee.removeAllRanges(),Le}};ee.rangeCount<=1&&Y();var ue=((z=j.current)===null||z===void 0?void 0:z.isFlushing())==="action";if(!at||!ue){setTimeout(()=>{I.isUpdatingSelection=!1});return}var J=null,ge=requestAnimationFrame(()=>{if(ue){var me=_e=>{try{var Se=Q.toDOMNode(h,h);Se.focus(),Y(_e)}catch{}};me(),J=setTimeout(()=>{me(!0),I.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ge),J&&clearTimeout(J)}}});var F=C.useCallback(S=>{if(T(),!s&&Q.hasEditableTarget(h,S.target)&&!oy(S,a)){var z;if(j.current)return j.current.handleDOMBeforeInput(S);w.flush(),R.flush();var{selection:L}=h,{inputType:U}=S,te=S.dataTransfer||S.data||void 0,ee=U==="insertCompositionText"||U==="deleteCompositionText";if(ee&&Q.isComposing(h))return;var Y=!1;if(U==="insertText"&&L&&W.isCollapsed(L)&&S.data&&S.data.length===1&&/[a-z ]/i.test(S.data)&&L.anchor.offset!==0){var ue,J;Y=!0,h.marks&&(Y=!1);var{anchor:ge}=L,[me,_e]=Q.toDOMPoint(h,ge),Se=(ue=me.parentElement)===null||ue===void 0?void 0:ue.closest("a"),Pe=Q.getWindow(h);if(Y&&Se&&Q.hasDOMNode(h,Se)){var Ge,Ke=Pe==null?void 0:Pe.document.createTreeWalker(Se,NodeFilter.SHOW_TEXT).lastChild();Ke===me&&((Ge=Ke.textContent)===null||Ge===void 0?void 0:Ge.length)===_e&&(Y=!1)}if(Y&&me.parentElement&&(Pe==null||(J=Pe.getComputedStyle(me.parentElement))===null||J===void 0?void 0:J.whiteSpace)==="pre"){var Ze=v.above(h,{at:ge.path,match:ae=>ce.isElement(ae)&&v.isBlock(h,ae)});Ze&&ie.string(Ze[0]).includes(" ")&&(Y=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[tt]=S.getTargetRanges();if(tt){var Ae=Q.toSlateRange(h,tt,{exactMatch:!1,suppressThrow:!1});if(!L||!W.equals(L,Ae)){Y=!1;var We=!ee&&h.selection&&v.rangeRef(h,h.selection);G.select(h,Ae),We&&fr.set(h,We)}}}if(ee)return;if(Y||S.preventDefault(),L&&W.isExpanded(L)&&U.startsWith("delete")){var Le=U.endsWith("Backward")?"backward":"forward";v.deleteFragment(h,{direction:Le});return}switch(U){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{v.deleteFragment(h);break}case"deleteContent":case"deleteContentForward":{v.deleteForward(h);break}case"deleteContentBackward":{v.deleteBackward(h);break}case"deleteEntireSoftLine":{v.deleteBackward(h,{unit:"line"}),v.deleteForward(h,{unit:"line"});break}case"deleteHardLineBackward":{v.deleteBackward(h,{unit:"block"});break}case"deleteSoftLineBackward":{v.deleteBackward(h,{unit:"line"});break}case"deleteHardLineForward":{v.deleteForward(h,{unit:"block"});break}case"deleteSoftLineForward":{v.deleteForward(h,{unit:"line"});break}case"deleteWordBackward":{v.deleteBackward(h,{unit:"word"});break}case"deleteWordForward":{v.deleteForward(h,{unit:"word"});break}case"insertLineBreak":v.insertSoftBreak(h);break;case"insertParagraph":{v.insertBreak(h);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{U==="insertFromComposition"&&Q.isComposing(h)&&(b(!1),ln.set(h,!1)),(te==null?void 0:te.constructor.name)==="DataTransfer"?Q.insertData(h,te):typeof te=="string"&&(Y?B.current.push(()=>v.insertText(h,te)):v.insertText(h,te));break}}var H=(z=fr.get(h))===null||z===void 0?void 0:z.unref();fr.delete(h),H&&(!h.selection||!W.equals(h.selection,H))&&G.select(h,H)}},[h,R,T,a,s,w]),N=C.useCallback(S=>{S==null?(R.cancel(),w.cancel(),sa.delete(h),hn.delete(h),x.current&&Ht&&x.current.removeEventListener("beforeinput",F)):Ht&&S.addEventListener("beforeinput",F),x.current=S},[R,w,h,F]);_r(()=>{var S=Q.getWindow(h);return S.document.addEventListener("selectionchange",w),()=>{S.document.removeEventListener("selectionchange",w)}},[w]);var M=r([h,[]]),Z=i&&h.children.length===1&&Array.from(ie.texts(h)).length===1&&ie.string(h)===""&&!y,K=C.useCallback(S=>{if(S&&Z){var z;_((z=S.getBoundingClientRect())===null||z===void 0?void 0:z.height)}else _(void 0)},[Z]);if(Z){var se=v.start(h,[]);M.push({[Hn]:!0,placeholder:i,onPlaceholderResize:K,anchor:se,focus:se})}var{marks:ne}=h;if(I.hasMarkPlaceholder=!1,h.selection&&W.isCollapsed(h.selection)&&ne){var{anchor:D}=h.selection,q=ie.leaf(h,D.path),X=Wn(q,ty);if(!de.equals(q,ne,{loose:!0})){I.hasMarkPlaceholder=!0;var k=Object.fromEntries(Object.keys(X).map(S=>[S,null]));M.push(At(At(At({[Dd]:!0},k),ne),{},{anchor:D,focus:D}))}}return C.useEffect(()=>{setTimeout(()=>{var{selection:S}=h;if(S){var{anchor:z}=S,L=ie.leaf(h,z.path);if(ne&&!de.equals(L,ne,{loose:!0})){wt.set(h,ne);return}}wt.delete(h)})}),C.createElement(Sd.Provider,{value:s},C.createElement(Fd.Provider,{value:r},C.createElement(Xb,{node:x,receivedUserInput:A},C.createElement(m,At(At({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Ht||!ia?g.spellCheck:!1,autoCorrect:Ht||!ia?g.autoCorrect:"false",autoCapitalize:Ht||!ia?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:N,style:At(At({},p?{}:At({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},E?{minHeight:E}:{})),f),onBeforeInput:C.useCallback(S=>{if(!Ht&&!s&&!rt(S,g.onBeforeInput)&&Q.hasSelectableTarget(h,S.target)&&(S.preventDefault(),!Q.isComposing(h))){var z=S.data;v.insertText(h,z)}},[g.onBeforeInput,h,s]),onInput:C.useCallback(S=>{if(!rt(S,g.onInput)){if(j.current){j.current.handleInput();return}for(var z of B.current)z();B.current=[]}},[g.onInput]),onBlur:C.useCallback(S=>{if(!(s||I.isUpdatingSelection||!Q.hasSelectableTarget(h,S.target)||rt(S,g.onBlur))){var z=Q.findDocumentOrShadowRoot(h);if(I.latestElement!==z.activeElement){var{relatedTarget:L}=S,U=Q.toDOMNode(h,h);if(L!==U&&!(yt(L)&&L.hasAttribute("data-slate-spacer"))){if(L!=null&&Jt(L)&&Q.hasDOMNode(h,L)){var te=Q.toSlateNode(h,L);if(ce.isElement(te)&&!h.isVoid(te))return}if(ur){var ee=z.getSelection();ee==null||ee.removeAllRanges()}Gt.delete(h)}}}},[s,I.isUpdatingSelection,I.latestElement,h,g.onBlur]),onClick:C.useCallback(S=>{if(Q.hasTarget(h,S.target)&&!rt(S,g.onClick)&&Jt(S.target)){var z=Q.toSlateNode(h,S.target),L=Q.findPath(h,z);if(!v.hasPath(h,L)||ie.get(h,L)!==z)return;if(S.detail===Kb&&L.length>=1){var U=L;if(!(ce.isElement(z)&&v.isBlock(h,z))){var te,ee=v.above(h,{match:Se=>ce.isElement(Se)&&v.isBlock(h,Se),at:L});U=(te=ee==null?void 0:ee[1])!==null&&te!==void 0?te:L.slice(0,1)}var Y=v.range(h,U);G.select(h,Y);return}if(s)return;var ue=v.start(h,L),J=v.end(h,L),ge=v.void(h,{at:ue}),me=v.void(h,{at:J});if(ge&&me&&P.equals(ge[1],me[1])){var _e=v.range(h,ue);G.select(h,_e)}}},[h,g.onClick,s]),onCompositionEnd:C.useCallback(S=>{if(Q.hasSelectableTarget(h,S.target)){var z;if(Q.isComposing(h)&&Promise.resolve().then(()=>{b(!1),ln.set(h,!1)}),(z=j.current)===null||z===void 0||z.handleCompositionEnd(S),rt(S,g.onCompositionEnd)||at)return;if(!ur&&!G0&&!V0&&!J0&&!Q0&&S.data){var L=wt.get(h);wt.delete(h),L!==void 0&&($t.set(h,h.marks),h.marks=L),v.insertText(h,S.data);var U=$t.get(h);$t.delete(h),U!==void 0&&(h.marks=U)}}},[g.onCompositionEnd,h]),onCompositionUpdate:C.useCallback(S=>{Q.hasSelectableTarget(h,S.target)&&!rt(S,g.onCompositionUpdate)&&(Q.isComposing(h)||(b(!0),ln.set(h,!0)))},[g.onCompositionUpdate,h]),onCompositionStart:C.useCallback(S=>{if(Q.hasSelectableTarget(h,S.target)){var z;if((z=j.current)===null||z===void 0||z.handleCompositionStart(S),rt(S,g.onCompositionStart)||at)return;b(!0);var{selection:L}=h;if(L&&W.isExpanded(L)){v.deleteFragment(h);return}}},[g.onCompositionStart,h]),onCopy:C.useCallback(S=>{Q.hasSelectableTarget(h,S.target)&&!rt(S,g.onCopy)&&!Gu(S)&&(S.preventDefault(),Q.setFragmentData(h,S.clipboardData,"copy"))},[g.onCopy,h]),onCut:C.useCallback(S=>{if(!s&&Q.hasSelectableTarget(h,S.target)&&!rt(S,g.onCut)&&!Gu(S)){S.preventDefault(),Q.setFragmentData(h,S.clipboardData,"cut");var{selection:z}=h;if(z)if(W.isExpanded(z))v.deleteFragment(h);else{var L=ie.parent(h,z.anchor.path);v.isVoid(h,L)&&G.delete(h)}}},[s,h,g.onCut]),onDragOver:C.useCallback(S=>{if(Q.hasTarget(h,S.target)&&!rt(S,g.onDragOver)){var z=Q.toSlateNode(h,S.target);ce.isElement(z)&&v.isVoid(h,z)&&S.preventDefault()}},[g.onDragOver,h]),onDragStart:C.useCallback(S=>{if(!s&&Q.hasTarget(h,S.target)&&!rt(S,g.onDragStart)){var z=Q.toSlateNode(h,S.target),L=Q.findPath(h,z),U=ce.isElement(z)&&v.isVoid(h,z)||v.void(h,{at:L,voids:!0});if(U){var te=v.range(h,L);G.select(h,te)}I.isDraggingInternally=!0,Q.setFragmentData(h,S.dataTransfer,"drag")}},[s,h,g.onDragStart,I]),onDrop:C.useCallback(S=>{if(!s&&Q.hasTarget(h,S.target)&&!rt(S,g.onDrop)){S.preventDefault();var z=h.selection,L=Q.findEventRange(h,S),U=S.dataTransfer;G.select(h,L),I.isDraggingInternally&&z&&!W.equals(z,L)&&!v.void(h,{at:L,voids:!0})&&G.delete(h,{at:z}),Q.insertData(h,U),Q.isFocused(h)||Q.focus(h)}I.isDraggingInternally=!1},[s,h,g.onDrop,I]),onDragEnd:C.useCallback(S=>{!s&&I.isDraggingInternally&&g.onDragEnd&&Q.hasTarget(h,S.target)&&g.onDragEnd(S),I.isDraggingInternally=!1},[s,I,g,h]),onFocus:C.useCallback(S=>{if(!s&&!I.isUpdatingSelection&&Q.hasEditableTarget(h,S.target)&&!rt(S,g.onFocus)){var z=Q.toDOMNode(h,h),L=Q.findDocumentOrShadowRoot(h);if(I.latestElement=L.activeElement,On&&S.target!==z){z.focus();return}Gt.set(h,!0)}},[s,I,h,g.onFocus]),onKeyDown:C.useCallback(S=>{if(!s&&Q.hasEditableTarget(h,S.target)){var z;(z=j.current)===null||z===void 0||z.handleKeyDown(S);var{nativeEvent:L}=S;if(Q.isComposing(h)&&L.isComposing===!1&&(ln.set(h,!1),b(!1)),rt(S,g.onKeyDown)||Q.isComposing(h))return;var{selection:U}=h,te=h.children[U!==null?U.focus.path[0]:0],ee=id(ie.string(te))==="rtl";if($e.isRedo(L)){S.preventDefault();var Y=h;typeof Y.redo=="function"&&Y.redo();return}if($e.isUndo(L)){S.preventDefault();var ue=h;typeof ue.undo=="function"&&ue.undo();return}if($e.isMoveLineBackward(L)){S.preventDefault(),G.move(h,{unit:"line",reverse:!0});return}if($e.isMoveLineForward(L)){S.preventDefault(),G.move(h,{unit:"line"});return}if($e.isExtendLineBackward(L)){S.preventDefault(),G.move(h,{unit:"line",edge:"focus",reverse:!0});return}if($e.isExtendLineForward(L)){S.preventDefault(),G.move(h,{unit:"line",edge:"focus"});return}if($e.isMoveBackward(L)){S.preventDefault(),U&&W.isCollapsed(U)?G.move(h,{reverse:!ee}):G.collapse(h,{edge:ee?"end":"start"});return}if($e.isMoveForward(L)){S.preventDefault(),U&&W.isCollapsed(U)?G.move(h,{reverse:ee}):G.collapse(h,{edge:ee?"start":"end"});return}if($e.isMoveWordBackward(L)){S.preventDefault(),U&&W.isExpanded(U)&&G.collapse(h,{edge:"focus"}),G.move(h,{unit:"word",reverse:!ee});return}if($e.isMoveWordForward(L)){S.preventDefault(),U&&W.isExpanded(U)&&G.collapse(h,{edge:"focus"}),G.move(h,{unit:"word",reverse:ee});return}if(Ht){if((vd||ur)&&U&&($e.isDeleteBackward(L)||$e.isDeleteForward(L))&&W.isCollapsed(U)){var J=ie.parent(h,U.anchor.path);if(ce.isElement(J)&&v.isVoid(h,J)&&(v.isInline(h,J)||v.isBlock(h,J))){S.preventDefault(),v.deleteBackward(h,{unit:"block"});return}}}else{if($e.isBold(L)||$e.isItalic(L)||$e.isTransposeCharacter(L)){S.preventDefault();return}if($e.isSoftBreak(L)){S.preventDefault(),v.insertSoftBreak(h);return}if($e.isSplitBlock(L)){S.preventDefault(),v.insertBreak(h);return}if($e.isDeleteBackward(L)){S.preventDefault(),U&&W.isExpanded(U)?v.deleteFragment(h,{direction:"backward"}):v.deleteBackward(h);return}if($e.isDeleteForward(L)){S.preventDefault(),U&&W.isExpanded(U)?v.deleteFragment(h,{direction:"forward"}):v.deleteForward(h);return}if($e.isDeleteLineBackward(L)){S.preventDefault(),U&&W.isExpanded(U)?v.deleteFragment(h,{direction:"backward"}):v.deleteBackward(h,{unit:"line"});return}if($e.isDeleteLineForward(L)){S.preventDefault(),U&&W.isExpanded(U)?v.deleteFragment(h,{direction:"forward"}):v.deleteForward(h,{unit:"line"});return}if($e.isDeleteWordBackward(L)){S.preventDefault(),U&&W.isExpanded(U)?v.deleteFragment(h,{direction:"backward"}):v.deleteBackward(h,{unit:"word"});return}if($e.isDeleteWordForward(L)){S.preventDefault(),U&&W.isExpanded(U)?v.deleteFragment(h,{direction:"forward"}):v.deleteForward(h,{unit:"word"});return}}}},[s,h,g.onKeyDown]),onPaste:C.useCallback(S=>{!s&&Q.hasEditableTarget(h,S.target)&&!rt(S,g.onPaste)&&(!Ht||tb(S.nativeEvent)||ur)&&(S.preventDefault(),Q.insertData(h,S.clipboardData))},[s,h,g.onPaste])}),C.createElement(ny,{decorations:M,node:h,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:h.selection})))))},ay=e=>{var{attributes:t,children:n}=e;return C.createElement("span",At({},t),n,at&&C.createElement("br",null))},iy=()=>[],sy=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&W.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),C0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},rt=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},Gu=e=>Jt(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),oy=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},uy=C.createContext(!1),ly=C.createContext({});function cy(e){var t=C.useRef([]).current,n=C.useRef({editor:e}).current,r=C.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=C.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var dy=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],fy=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Wn(e,dy),[l,u]=C.useState(()=>{if(!ie.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Ye.stringify(s)));if(!v.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Ye.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:c,onChange:f}=cy(t),m=C.useCallback(h=>{var y;switch(r&&r(t.children),h==null||(y=h.operation)===null||y===void 0?void 0:y.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(b=>({v:b.v+1,editor:t})),f(t)},[t,f,r,a,i]);C.useEffect(()=>(ds.set(t,m),()=>{ds.set(t,()=>{})}),[t,m]);var[p,g]=C.useState(Q.isFocused(t));return C.useEffect(()=>{g(Q.isFocused(t))},[t]),_r(()=>{var h=()=>g(Q.isFocused(t));return gd>=17?(document.addEventListener("focusin",h),document.addEventListener("focusout",h),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",h)}):(document.addEventListener("focus",h,!0),document.addEventListener("blur",h,!0),()=>{document.removeEventListener("focus",h,!0),document.removeEventListener("blur",h,!0)})},[]),C.createElement(ly.Provider,{value:c},C.createElement(jd.Provider,{value:l},C.createElement(Vs.Provider,{value:l.editor},C.createElement(uy.Provider,{value:p},n))))},Qu=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Ju=(e,t,n)=>{var r=Q.toDOMRange(e,t).getBoundingClientRect(),a=Q.toDOMRange(e,n).getBoundingClientRect();return Qu(r,a)&&Qu(a,r)},hy=(e,t)=>{var n=v.range(e,W.end(t)),r=Array.from(v.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(Ju(e,v.range(e,r[a]),n))return v.range(e,r[a],n);if(r.length<2)return v.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)Ju(e,v.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return v.range(e,r[i],n)};function Xu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function el(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Xu(Object(n),!0).forEach(function(r){Dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var my=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",r=t,{apply:a,onChange:i,deleteBackward:s,addMark:o,removeMark:l}=r;return za.set(r,new WeakMap),r.addMark=(u,c)=>{var f,m;(f=Ys.get(r))===null||f===void 0||f(),!wt.get(r)&&(m=ut.get(r))!==null&&m!==void 0&&m.length&&wt.set(r,null),$t.delete(r),o(u,c)},r.removeMark=u=>{var c;!wt.get(r)&&(c=ut.get(r))!==null&&c!==void 0&&c.length&&wt.set(r,null),$t.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&W.isCollapsed(r.selection)){var c=v.above(r,{match:g=>ce.isElement(g)&&v.isBlock(r,g),at:r.selection});if(c){var[,f]=c,m=v.range(r,f,r.selection.anchor),p=hy(r,m);W.isCollapsed(p)||G.delete(r,{at:p})}}},r.apply=u=>{var c=[],f=[],m=ut.get(r);if(m!=null&&m.length){var p=m.map(N=>mb(N,u)).filter(Boolean);ut.set(r,p)}var g=Kt.get(r);g&&Kt.set(r,zu(r,g,u));var h=Vt.get(r);if(h!=null&&h.at){var y=Ce.isPoint(h==null?void 0:h.at)?ms(r,h.at,u):zu(r,h.at,u);Vt.set(r,y?el(el({},h),{},{at:y}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...kn(r,u.path));break}case"set_selection":{var b;(b=fr.get(r))===null||b===void 0||b.unref(),fr.delete(r);break}case"insert_node":case"remove_node":{c.push(...kn(r,P.parent(u.path)));break}case"merge_node":{var x=P.previous(u.path);c.push(...kn(r,x));break}case"move_node":{var B=P.common(P.parent(u.path),P.parent(u.newPath));c.push(...kn(r,B));var E;P.isBefore(u.path,u.newPath)?(c.push(...kn(r,P.parent(u.path))),E=u.newPath):(c.push(...kn(r,P.parent(u.newPath))),E=u.path);var _=ie.get(t,P.parent(E)),T=Q.findKey(r,_),A=v.pathRef(r,P.parent(E));f.push([A,T]);break}}a(u);for(var[$,I]of c){var[j]=v.node(r,$);Da.set(j,I)}for(var[R,w]of f)if(R.current){var[F]=v.node(r,R.current);Da.set(F,w)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[f,m]=W.edges(c),p=v.void(r,{at:f.path}),g=v.void(r,{at:m.path});if(!(W.isCollapsed(c)&&!p)){var h=Q.toDOMRange(r,c),y=h.cloneContents(),b=y.childNodes[0];if(y.childNodes.forEach(j=>{j.textContent&&j.textContent.trim()!==""&&(b=j)}),g){var[x]=g,B=h.cloneRange(),E=Q.toDOMNode(r,x);B.setEndAfter(E),y=B.cloneContents()}if(p&&(b=y.querySelector("[data-slate-spacer]")),Array.from(y.querySelectorAll("[data-slate-zero-width]")).forEach(j=>{var R=j.getAttribute("data-slate-zero-width")==="n";j.textContent=R?`
|
|
112
|
-
`:""}),Cd(b)){var _=b.ownerDocument.createElement("span");_.style.whiteSpace="pre",_.appendChild(b),y.appendChild(_),b=_}var T=r.getFragment(),A=JSON.stringify(T),$=window.btoa(encodeURIComponent(A));b.setAttribute("data-slate-fragment",$),u.setData("application/".concat(n),$);var I=y.ownerDocument.createElement("div");return I.appendChild(y),I.setAttribute("hidden","true"),y.ownerDocument.body.appendChild(I),u.setData("text/html",I.innerHTML),u.setData("text/plain",wd(I)),y.ownerDocument.body.removeChild(I),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||sb(u);if(c){var f=decodeURIComponent(window.atob(c)),m=JSON.parse(f);return r.insertFragment(m),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var f=c.split(/\r\n|\r|\n/),m=!1;for(var p of f)m&&G.splitNodes(r,{always:!0}),r.insertText(p),m=!0;return!0}return!1},r.onChange=u=>{var c=gd<18?ac.unstable_batchedUpdates:f=>f();c(()=>{var f=ds.get(r);f&&f(u),i(u)})},r},kn=(e,t)=>{var n=[];for(var[r,a]of v.levels(e,{at:t})){var i=Q.findKey(e,r);n.push([a,i])}return n};const py={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,lastAnchor:null,dispatch:()=>{},reportError:e=>{console.error(e)}},Cn=C.createContext(py),gy=({attributes:e,children:t,element:n})=>{switch(n.type){case"block_quote":return d.jsx("blockquote",{className:"subtle",...e,children:t});case"link":return d.jsx("a",{...e,children:t});case"list_item":return d.jsx("li",{...e,children:t});case"ol_list":return d.jsx("ol",{...e,children:t});case"ul_list":return d.jsx("ul",{...e,children:t});case"span":return d.jsx("span",{...e,children:t});case"paragraph":return d.jsx("p",{...e,children:t});default:return d.jsx("span",{...e,children:t})}},vy=({attributes:e,children:t,leaf:n})=>{const r=n;return r.bold&&(t=d.jsx("strong",{children:t})),r.italic&&(t=d.jsx("em",{children:t})),r.strikeThrough&&(t=d.jsx("s",{children:t})),d.jsx("span",{...e,children:t})},Js=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=oe.useIntl(),l=Jn(),{id:u,tabbableOption:c,setFocus:f,openTooltip:m,dispatch:p}=C.useContext(Cn),g={};return e!==c&&(g.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:V(e,{"has-divider":n}),onMouseEnter:()=>{p([{type:"openTooltip",value:e}])},onMouseLeave:()=>{p([{type:"openTooltip",value:null}])},onFocus:()=>{p([{type:"openTooltip",value:e}])},onBlur:h=>{h.stopPropagation();const y=[{type:"openTooltip",value:null}];l.selection&&y.push({type:"lastAnchor",value:l.selection.anchor}),p(y)},contentEditable:!1,children:[d.jsxs("button",{...s,...g,className:V(e,a,{active:t}),onClick:h=>{h.stopPropagation(),h.preventDefault()},onMouseDown:h=>{h.stopPropagation(),h.preventDefault(),r()},onKeyDown:h=>{var y,b,x,B;if(h.key!=="Tab")switch(h.key){case"Enter":h.stopPropagation(),h.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":h.stopPropagation(),h.preventDefault();const E=h.currentTarget.closest("li");let _=E==null?void 0:E.nextElementSibling;if(h.key==="ArrowLeft"){const $=E==null?void 0:E.previousElementSibling;$?_=$:_=(y=E==null?void 0:E.parentElement)==null?void 0:y.lastElementChild}else _||(_=(b=E==null?void 0:E.parentElement)==null?void 0:b.firstElementChild);const T=_==null?void 0:_.className.split(" ")[0];T&&(f(T),(x=_==null?void 0:_.querySelector("button"))==null||x.focus());break;default:const A=h.currentTarget.closest("fieldset");if(A){(B=A==null?void 0:A.previousElementSibling)==null||B.focus();break}}},children:[d.jsx(Ie,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(Ua,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:m===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},tl=["ol_list","ul_list"],Pd=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(v.nodes(e,{at:v.unhangRange(e,n),match:a=>{const i=a;return!v.isEditor(a)&&ce.isElement(a)&&i.type===t}}));return!!r},by=e=>{const[t]=v.nodes(e,{match:n=>n.type==="block_quote"});return!!t},Nd=(e,t,n)=>{try{const r=by(e),a=Pd(e,t),i=tl.includes(t);G.unwrapNodes(e,{match:l=>{const u=l;return!v.isEditor(u)&&ce.isElement(u)&&tl.includes(u.type)},split:!0});const o={type:a?"paragraph":i?"list_item":t};if(G.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,c]=v.parent(e,l,{edge:"end"});Array.from(v.nodes(e,{at:c,match:m=>{const p=m;return!v.isEditor(m)&&ce.isElement(m)&&p.type==="list_item"}})).forEach(([m,p])=>{ie.string(m).trim()===""&&G.removeNodes(e,{at:p})})}else{if(r){const u={type:"block_quote",children:[]};G.wrapNodes(e,u)}const l={type:t,children:[]};G.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},yy=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(Cn),a=Jn(),i=Pd(a,e);return d.jsx(Js,{id:e,active:i,hasDivider:t,callback:()=>{Nd(a,e,r),n(i?null:e)}})},Dy=52,nl=16,Cy=(e,t,n)=>{const r=C.useRef(null),{showLinkEditor:a}=C.useContext(Cn),i=t==="link-editor"?a:!1;return C.useEffect(()=>{var f;if(!(r!=null&&r.current)||!i)return;const s=r==null?void 0:r.current;if(!s)return;const o=document.getSelection();let l;o!=null&&o.toString().trim().length?l=o==null?void 0:o.getRangeAt(0).getBoundingClientRect():l=(f=document.getElementById(n))==null?void 0:f.getBoundingClientRect();const u=((l==null?void 0:l.top)||0)+window.scrollY-Dy,c=Math.max(((l==null?void 0:l.left)||0)-(s.offsetWidth-((l==null?void 0:l.width)||0)),0);s.style.top=`${u/nl}rem`,s.style.left=`${c/nl}rem`},[i,e.selection]),r},xy=e=>{const[t,n]=C.useState(null);return C.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=v.nodes(e,{at:r,match:i=>i.type==="link"});if(a){const i=a[0],s=Cc(i.link);n(s)}else n(null)},[e,e.selection]),t},hr=e=>{const[t]=v.nodes(e,{match:n=>{const r=n;return!v.isEditor(n)&&ce.isElement(n)&&r.type==="link"}});return!!t},wy=(e,t,n,r)=>{e.selection&&Xs(e,t,n,r)},Ey=(e,t,n,r)=>{const{selection:a}=e;if(a&&W.isCollapsed(a)){const[s]=v.nodes(e,{match:o=>{const l=o;return!v.isEditor(o)&&ce.isElement(o)&&l.type==="link"}});if(s){const[o,l]=s,u={link:t};G.setNodes(e,u,{at:l}),Rd(n)}}else Xs(e,t,n,r)},Xs=(e,t,n,r=a=>{console.error(a)})=>{try{hr(e)&&Md(e);const{selection:a}=e,i=a&&W.isCollapsed(a),s={type:"link",link:t,children:i?[{text:t}]:[]};i?(G.insertNodes(e,s),G.move(e,{distance:1,unit:"offset"})):(G.wrapNodes(e,s,{split:!0}),G.collapse(e,{edge:"end"}),G.insertNodes(e,{text:""}),G.move(e,{distance:1,unit:"offset"})),Rd(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},Rd=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},Md=e=>{G.unwrapNodes(e,{match:t=>{const n=t;return!v.isEditor(t)&&ce.isElement(t)&&n.type==="link"}})};let gi=null;const _y=()=>{const e=oe.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,dispatch:a,reportError:i}=C.useContext(Cn),s=Jn(),o=xy(s),[l,u]=C.useState(hr(s)),c=Cy(s,"link-editor",`${n}-link`),f=C.useRef(null);C.useEffect(()=>{var g;!l&&r&&((g=f.current)==null||g.focus())},[l]),C.useEffect(()=>{gi&&clearTimeout(gi),gi=setTimeout(()=>{u(hr(s))},500)},[s.selection]);const m=[],p=["open","edit","remove"].map(g=>{const h={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${g}`},{link:o==null?void 0:o.pretty})};switch(m.push({className:g}),g){case"open":h.href=(o==null?void 0:o.full)||"",h.onClick=y=>{y.preventDefault(),y.stopPropagation(),window.open((o==null?void 0:o.full)||"","_blank"),a([{type:"showLinkEditor",value:!1}])},h.children=d.jsxs(d.Fragment,{children:[h.children,d.jsx(Ie,{children:e.formatMessage({id:`${t}${g}_text`})})]});break;case"edit":h.onClick=()=>{u(!1)};break;case"remove":h.onClick=()=>{const y=[{type:"showLinkEditor",value:!1}];hr(s)&&(Md(s),y.push({type:"lastAnchor",value:null})),a(y)};break}return h});return d.jsx(xc,{children:d.jsx(Ua,{ref:c,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!l},functions:{onBlur:()=>{a([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var g;return(g=f.current)==null?void 0:g.focus()})}},children:l?d.jsx(yn,{wrappers:m,buttons:p}):d.jsx(Gn,{element:"fieldset",id:`${n}-link-editor`,meta:{shouldReset:!0},functions:{onSuccess:async g=>{setTimeout(()=>{const h=[{type:"showLinkEditor",value:!1}];if(g.url){const{full:y}=Cc(g.url);o!=null&&o.full?Ey(s,y,n,i):wy(s,y,n,i),h.push({type:"lastAnchor",value:null})}a(h)})}},fields:[{id:"url",type:"url",inputRef:f,label:e.formatMessage({id:`${t}placeholder`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(o==null?void 0:o.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}],button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},ky=()=>{const e=Jn(),{setFocus:t,dispatch:n}=C.useContext(Cn),[r,a]=C.useState(!1);return C.useEffect(()=>{a(hr(e))},[e.selection]),d.jsx(Js,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},By=e=>["bold","italic","strikeThrough"].includes(e),Id=(e,t)=>{const n=v.marks(e);return n?n[t]===!0:!1},$d=(e,t,n)=>{try{Id(e,t)?v.removeMark(e,t):v.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},Ay=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(Cn),a=Jn(),i=Id(a,e);return d.jsx(Js,{id:e,active:i,hasDivider:t,callback:()=>{$d(a,e,r),n(i?null:e)}})},Ca=["bold","italic","strikeThrough"],Fy=["ol_list","ul_list","block_quote"];const Ty=({...e})=>{const t=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{className:"toolbar",...e,children:[d.jsx(Ie,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[Ca.map((n,r)=>d.jsx(Ay,{format:n,hasDivider:r===Ca.length-1},n)),d.jsx(ky,{}),Fy.map((n,r)=>d.jsx(yy,{format:n,hasDivider:r===1},n))]})]}),d.jsx(_y,{})]})},Pn={paragraph:"paragraph",block_quote:"block_quote",code_block:"code_block",link:"link",ul_list:"ul_list",ol_list:"ol_list",listItem:"list_item",heading:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},emphasis_mark:"italic",strong_mark:"bold",delete_mark:"strikeThrough",inline_code_mark:"code",thematic_break:"thematic_break",image:"image"};function rl(e){if(e)throw e}var oa=Object.prototype.hasOwnProperty,Ld=Object.prototype.toString,al=Object.defineProperty,il=Object.getOwnPropertyDescriptor,sl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Ld.call(t)==="[object Array]"},ol=function(t){if(!t||Ld.call(t)!=="[object Object]")return!1;var n=oa.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&oa.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||oa.call(t,a)},ul=function(t,n){al&&n.name==="__proto__"?al(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},ll=function(t,n){if(n==="__proto__")if(oa.call(t,n)){if(il)return il(t,n).value}else return;return t[n]},Sy=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,c=!1;for(typeof o=="boolean"&&(c=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=ll(o,n),a=ll(t,n),o!==a&&(c&&a&&(ol(a)||(i=sl(a)))?(i?(i=!1,s=r&&sl(r)?r:[]):s=r&&ol(r)?r:{},ul(o,{name:n,newValue:e(c,s,a)})):typeof a<"u"&&ul(o,{name:n,newValue:a}));return o};const vi=bn(Sy);function gs(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function jy(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const c=e[++i];let f=-1;if(l){s(l);return}for(;++f<a.length;)(u[f]===null||u[f]===void 0)&&(u[f]=a[f]);a=u,c?Oy(c,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function Oy(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const c=u;if(o&&n)throw c;return a(c)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function mr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?cl(e.position):"start"in e||"end"in e?cl(e):"line"in e||"column"in e?vs(e):""}function vs(e){return dl(e&&e.line)+":"+dl(e&&e.column)}function cl(e){return vs(e&&e.start)+"-"+vs(e&&e.end)}function dl(e){return e&&typeof e=="number"?e:1}class dt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=o?o.line:void 0,this.name=mr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}dt.prototype.file="";dt.prototype.name="";dt.prototype.reason="";dt.prototype.message="";dt.prototype.stack="";dt.prototype.column=void 0;dt.prototype.line=void 0;dt.prototype.ancestors=void 0;dt.prototype.cause=void 0;dt.prototype.fatal=void 0;dt.prototype.place=void 0;dt.prototype.ruleId=void 0;dt.prototype.source=void 0;const Ft={basename:Py,dirname:Ny,extname:Ry,join:My,sep:"/"};function Py(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Fr(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 Ny(e){if(Fr(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 Ry(e){Fr(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 My(...e){let t=-1,n;for(;++t<e.length;)Fr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Iy(n)}function Iy(e){Fr(e);const t=e.codePointAt(0)===47;let n=$y(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function $y(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 Fr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Ly={cwd:zy};function zy(){return"/"}function bs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function qy(e){if(typeof e=="string")e=new URL(e);else if(!bs(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Wy(e)}function Wy(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 bi=["history","path","basename","stem","extname","dirname"];class Hy{constructor(t){let n;t?bs(t)?n={path:t}:typeof t=="string"||Uy(t)?n={value:t}:n=t:n={},this.cwd=Ly.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<bi.length;){const i=bi[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)bi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ft.basename(this.path):void 0}set basename(t){Di(t,"basename"),yi(t,"basename"),this.path=Ft.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ft.dirname(this.path):void 0}set dirname(t){fl(this.basename,"dirname"),this.path=Ft.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ft.extname(this.path):void 0}set extname(t){if(yi(t,"extname"),fl(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=Ft.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){bs(t)&&(t=qy(t)),Di(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ft.basename(this.path,this.extname):void 0}set stem(t){Di(t,"stem"),yi(t,"stem"),this.path=Ft.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new dt(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function yi(e,t){if(e&&e.includes(Ft.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ft.sep+"`")}function Di(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function fl(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Uy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Vy=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},Ky={}.hasOwnProperty;class eo extends Vy{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=jy()}copy(){const t=new eo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(vi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(wi("data",this.frozen),this.namespace[t]=n,this):Ky.call(this.namespace,t)&&this.namespace[t]||void 0:t?(wi("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=Ur(t),r=this.parser||this.Parser;return Ci("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ci("process",this.parser||this.Parser),xi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=Ur(t),l=r.parse(o);r.run(l,o,function(c,f,m){if(c||!f||!m)return u(c);const p=f,g=r.stringify(p,m);Gy(g)?m.value=g:m.result=g,u(c,m)});function u(c,f){c||!f?s(c):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),Ci("processSync",this.parser||this.Parser),xi("processSync",this.compiler||this.Compiler),this.process(t,a),ml("processSync","process",n),r;function a(i,s){n=!0,rl(i),r=s}}run(t,n,r){hl(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=Ur(n);a.run(t,l,u);function u(c,f,m){const p=f||t;c?o(c):s?s(p):r(void 0,p,m)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),ml("runSync","run",r),a;function i(s,o){rl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=Ur(n),a=this.compiler||this.Compiler;return xi("stringify",a),hl(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(wi("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...f]=u;l(c,f)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(a.settings=vi(!0,a.settings,u.settings))}function o(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const f=u[c];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let f=-1,m=-1;for(;++f<r.length;)if(r[f][0]===u){m=f;break}if(m===-1)r.push([u,...c]);else if(c.length>0){let[p,...g]=c;const h=r[m][1];gs(h)&&gs(p)&&(p=vi(!0,h,p)),r[m]=[u,p,...g]}}}}const Zy=new eo().freeze();function Ci(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function xi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function wi(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 hl(e){if(!gs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ml(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Ur(e){return Yy(e)?e:new Hy(e)}function Yy(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Gy(e){return typeof e=="string"||Qy(e)}function Qy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Jy={};function Xy(e,t){const n=t||Jy,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return zd(e,r,a)}function zd(e,t,n){if(e1(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return pl(e.children,t,n)}return Array.isArray(e)?pl(e,t,n):""}function pl(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=zd(e[a],t,n);return r.join("")}function e1(e){return!!(e&&typeof e=="object")}const gl=document.createElement("i");function to(e){const t="&"+e+";";gl.innerHTML=t;const n=gl.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function jt(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 bt(e,t){return e.length>0?(jt(e,e.length,0,t),e):t}const vl={}.hasOwnProperty;function t1(e){const t={};let n=-1;for(;++n<e.length;)n1(t,e[n]);return t}function n1(e,t){let n;for(n in t){const a=(vl.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){vl.call(a,s)||(a[s]=[]);const o=i[s];r1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function r1(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);jt(e,0,0,r)}function qd(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 In(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Tt=rn(/[A-Za-z]/),Et=rn(/[\dA-Za-z]/),a1=rn(/[#-'*+\--9=?A-Z^-~]/);function ys(e){return e!==null&&(e<32||e===127)}const Ds=rn(/\d/),i1=rn(/[\dA-Fa-f]/),s1=rn(/[!-/:-@[-`{-~]/);function ve(e){return e!==null&&e<-2}function ct(e){return e!==null&&(e<0||e===32)}function Be(e){return e===-2||e===-1||e===32}const o1=rn(/\p{P}|\p{S}/u),u1=rn(/\s/);function rn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ne(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Be(l)?(e.enter(n),o(l)):t(l)}function o(l){return Be(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const l1={tokenize:c1};function c1(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"),Ne(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 d1={tokenize:f1},bl={tokenize:h1};function f1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(B){if(r<n.length){const E=n[r];return t.containerState=E[1],e.attempt(E[0].continuation,l,u)(B)}return u(B)}function l(B){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&x();const E=t.events.length;let _=E,T;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){T=t.events[_][1].end;break}b(r);let A=E;for(;A<t.events.length;)t.events[A][1].end=Object.assign({},T),A++;return jt(t.events,_+1,0,t.events.slice(E)),t.events.length=A,u(B)}return o(B)}function u(B){if(r===n.length){if(!a)return m(B);if(a.currentConstruct&&a.currentConstruct.concrete)return g(B);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(bl,c,f)(B)}function c(B){return a&&x(),b(r),m(B)}function f(B){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(B)}function m(B){return t.containerState={},e.attempt(bl,p,g)(B)}function p(B){return r++,n.push([t.currentConstruct,t.containerState]),m(B)}function g(B){if(B===null){a&&x(),b(0),e.consume(B);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),h(B)}function h(B){if(B===null){y(e.exit("chunkFlow"),!0),b(0),e.consume(B);return}return ve(B)?(e.consume(B),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(B),h)}function y(B,E){const _=t.sliceStream(B);if(E&&_.push(null),B.previous=i,i&&(i.next=B),i=B,a.defineSkip(B.start),a.write(_),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 A=t.events.length;let $=A,I,j;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(I){j=t.events[$][1].end;break}I=!0}for(b(r),T=A;T<t.events.length;)t.events[T][1].end=Object.assign({},j),T++;jt(t.events,$+1,0,t.events.slice(A)),t.events.length=T}}function b(B){let E=n.length;for(;E-- >B;){const _=n[E];t.containerState=_[1],_[0].exit.call(t,e)}n.length=B}function x(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function h1(e,t,n){return Ne(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function yl(e){if(e===null||ct(e)||u1(e))return 1;if(o1(e))return 2}function no(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 Cs={name:"attention",tokenize:p1,resolveAll:m1};function m1(e,t){let n=-1,r,a,i,s,o,l,u,c;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f=Object.assign({},e[r][1].end),m=Object.assign({},e[n][1].start);Dl(f,-l),Dl(m,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:m},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=bt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=bt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=bt(u,no(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=bt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=bt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,jt(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function p1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=yl(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),c=yl(l),f=!c||c===2&&a||n.includes(l),m=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?f:f&&(a||!m)),u._close=!!(i===42?m:m&&(c||!f)),t(l)}}function Dl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const g1={name:"autolink",tokenize:v1};function v1(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return Tt(p)?(e.consume(p),s):u(p)}function s(p){return p===43||p===45||p===46||Et(p)?(r=1,o(p)):u(p)}function o(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||Et(p))&&r++<32?(e.consume(p),o):(r=0,u(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||ys(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),c):a1(p)?(e.consume(p),u):n(p)}function c(p){return Et(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,c):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):m(p)}function m(p){if((p===45||Et(p))&&r++<63){const g=p===45?m:f;return e.consume(p),g}return n(p)}}const qa={tokenize:b1,partial:!0};function b1(e,t,n){return r;function r(i){return Be(i)?Ne(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ve(i)?t(i):n(i)}}const Wd={name:"blockQuote",tokenize:y1,continuation:{tokenize:D1},exit:C1};function y1(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 Be(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function D1(e,t,n){const r=this;return a;function a(s){return Be(s)?Ne(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Wd,t,n)(s)}}function C1(e){e.exit("blockQuote")}const Hd={name:"characterEscape",tokenize:x1};function x1(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 s1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Ud={name:"characterReference",tokenize:w1};function w1(e,t,n){const r=this;let a=0,i,s;return o;function o(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=Et,c(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=i1,c):(e.enter("characterReferenceValue"),i=7,s=Ds,c(f))}function c(f){if(f===59&&a){const m=e.exit("characterReferenceValue");return s===Et&&!to(r.sliceSerialize(m))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(f)&&a++<i?(e.consume(f),c):n(f)}}const Cl={tokenize:_1,partial:!0},xl={name:"codeFenced",tokenize:E1,concrete:!0};function E1(e,t,n){const r=this,a={tokenize:_,partial:!0};let i=0,s=0,o;return l;function l(T){return u(T)}function u(T){const A=r.events[r.events.length-1];return i=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,o=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(T)}function c(T){return T===o?(s++,e.consume(T),c):s<3?n(T):(e.exit("codeFencedFenceSequence"),Be(T)?Ne(e,f,"whitespace")(T):f(T))}function f(T){return T===null||ve(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(Cl,h,E)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(T))}function m(T){return T===null||ve(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(T)):Be(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ne(e,p,"whitespace")(T)):T===96&&T===o?n(T):(e.consume(T),m)}function p(T){return T===null||ve(T)?f(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||ve(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(T)):T===96&&T===o?n(T):(e.consume(T),g)}function h(T){return e.attempt(a,E,y)(T)}function y(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),b}function b(T){return i>0&&Be(T)?Ne(e,x,"linePrefix",i+1)(T):x(T)}function x(T){return T===null||ve(T)?e.check(Cl,h,E)(T):(e.enter("codeFlowValue"),B(T))}function B(T){return T===null||ve(T)?(e.exit("codeFlowValue"),x(T)):(e.consume(T),B)}function E(T){return e.exit("codeFenced"),t(T)}function _(T,A,$){let I=0;return j;function j(M){return T.enter("lineEnding"),T.consume(M),T.exit("lineEnding"),R}function R(M){return T.enter("codeFencedFence"),Be(M)?Ne(T,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):w(M)}function w(M){return M===o?(T.enter("codeFencedFenceSequence"),F(M)):$(M)}function F(M){return M===o?(I++,T.consume(M),F):I>=s?(T.exit("codeFencedFenceSequence"),Be(M)?Ne(T,N,"whitespace")(M):N(M)):$(M)}function N(M){return M===null||ve(M)?(T.exit("codeFencedFence"),A(M)):$(M)}}}function _1(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 Ei={name:"codeIndented",tokenize:B1},k1={tokenize:A1,partial:!0};function B1(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Ne(e,i,"linePrefix",4+1)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):ve(u)?e.attempt(k1,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 A1(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):Ne(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 F1={name:"codeText",tokenize:j1,resolve:T1,previous:S1};function T1(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 S1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function j1(e,t,n){let r=0,a,i;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),o(f)}function o(f){return f===96?(e.consume(f),r++,o):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(i=e.enter("codeTextSequence"),a=0,c(f)):ve(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||ve(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),u)}function c(f){return f===96?(e.consume(f),a++,c):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}function Vd(e){const t={};let n=-1,r,a,i,s,o,l,u;for(;++n<e.length;){for(;n in t;)n=t[n];if(r=e[n],n&&r[1].type==="chunkFlow"&&e[n-1][1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,O1(e,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=e[i],s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(e[a][1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},e[a][1].start),o=e.slice(a,n),o.unshift(r),jt(e,a,n-a+1,o))}}return!u}function O1(e,t){const n=e[t][1],r=e[t][2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let c,f,m=-1,p=n,g=0,h=0;const y=[h];for(;p;){for(;e[++a][1]!==p;);i.push(a),p._tokenizer||(c=r.sliceStream(p),p.next||c.push(null),f&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++m<o.length;)o[m][0]==="exit"&&o[m-1][0]==="enter"&&o[m][1].type===o[m-1][1].type&&o[m][1].start.line!==o[m][1].end.line&&(h=m+1,y.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),m=y.length;m--;){const b=o.slice(y[m],y[m+1]),x=i.pop();l.unshift([x,x+b.length-1]),jt(e,x,2,b)}for(m=-1;++m<l.length;)u[g+l[m][0]]=g+l[m][1],g+=l[m][1]-l[m][0]-1;return u}const P1={tokenize:M1,resolve:R1},N1={tokenize:I1,partial:!0};function R1(e){return Vd(e),e}function M1(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(N1,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 I1(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ne(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 Kd(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(b){return b===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(b),e.exit(i),m):b===null||b===32||b===41||ys(b)?n(b):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),h(b))}function m(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===62?(e.exit("chunkString"),e.exit(o),m(b)):b===null||b===60||ve(b)?n(b):(e.consume(b),b===92?g:p)}function g(b){return b===60||b===62||b===92?(e.consume(b),p):p(b)}function h(b){return!c&&(b===null||b===41||ct(b))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(b)):c<u&&b===40?(e.consume(b),c++,h):b===41?(e.consume(b),c--,h):b===null||b===32||b===40||ys(b)?n(b):(e.consume(b),b===92?y:h)}function y(b){return b===40||b===41||b===92?(e.consume(b),h):h(b)}}function Zd(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),c}function c(p){return o>999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):ve(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||ve(p)||o++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!Be(p)),p===92?m:f)}function m(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}}function Yd(e,t,n,r,a,i){let s;return o;function o(m){return m===34||m===39||m===40?(e.enter(r),e.enter(a),e.consume(m),e.exit(a),s=m===40?41:m,l):n(m)}function l(m){return m===s?(e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):(e.enter(i),u(m))}function u(m){return m===s?(e.exit(i),l(s)):m===null?n(m):ve(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Ne(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(m))}function c(m){return m===s||m===null||ve(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?f:c)}function f(m){return m===s||m===92?(e.consume(m),c):c(m)}}function pr(e,t){let n;return r;function r(a){return ve(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Be(a)?Ne(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const $1={name:"definition",tokenize:z1},L1={tokenize:q1,partial:!0};function z1(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return Zd.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return a=In(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ct(p)?pr(e,u)(p):u(p)}function u(p){return Kd(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(L1,f,f)(p)}function f(p){return Be(p)?Ne(e,m,"whitespace")(p):m(p)}function m(p){return p===null||ve(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function q1(e,t,n){return r;function r(o){return ct(o)?pr(e,a)(o):n(o)}function a(o){return Yd(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Be(o)?Ne(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ve(o)?t(o):n(o)}}const W1={name:"hardBreakEscape",tokenize:H1};function H1(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 U1={name:"headingAtx",tokenize:K1,resolve:V1};function V1(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"},jt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function K1(e,t,n){let r=0;return a;function a(c){return e.enter("atxHeading"),i(c)}function i(c){return e.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(e.consume(c),s):c===null||ct(c)?(e.exit("atxHeadingSequence"),o(c)):n(c)}function o(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||ve(c)?(e.exit("atxHeading"),t(c)):Be(c)?Ne(e,o,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),o(c))}function u(c){return c===null||c===35||ct(c)?(e.exit("atxHeadingText"),o(c)):(e.consume(c),u)}}const Z1=["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"],wl=["pre","script","style","textarea"],Y1={name:"htmlFlow",tokenize:X1,resolveTo:J1,concrete:!0},G1={tokenize:tD,partial:!0},Q1={tokenize:eD,partial:!0};function J1(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 X1(e,t,n){const r=this;let a,i,s,o,l;return u;function u(k){return c(k)}function c(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),f}function f(k){return k===33?(e.consume(k),m):k===47?(e.consume(k),i=!0,h):k===63?(e.consume(k),a=3,r.interrupt?t:D):Tt(k)?(e.consume(k),s=String.fromCharCode(k),y):n(k)}function m(k){return k===45?(e.consume(k),a=2,p):k===91?(e.consume(k),a=5,o=0,g):Tt(k)?(e.consume(k),a=4,r.interrupt?t:D):n(k)}function p(k){return k===45?(e.consume(k),r.interrupt?t:D):n(k)}function g(k){const S="CDATA[";return k===S.charCodeAt(o++)?(e.consume(k),o===S.length?r.interrupt?t:w:g):n(k)}function h(k){return Tt(k)?(e.consume(k),s=String.fromCharCode(k),y):n(k)}function y(k){if(k===null||k===47||k===62||ct(k)){const S=k===47,z=s.toLowerCase();return!S&&!i&&wl.includes(z)?(a=1,r.interrupt?t(k):w(k)):Z1.includes(s.toLowerCase())?(a=6,S?(e.consume(k),b):r.interrupt?t(k):w(k)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(k):i?x(k):B(k))}return k===45||Et(k)?(e.consume(k),s+=String.fromCharCode(k),y):n(k)}function b(k){return k===62?(e.consume(k),r.interrupt?t:w):n(k)}function x(k){return Be(k)?(e.consume(k),x):j(k)}function B(k){return k===47?(e.consume(k),j):k===58||k===95||Tt(k)?(e.consume(k),E):Be(k)?(e.consume(k),B):j(k)}function E(k){return k===45||k===46||k===58||k===95||Et(k)?(e.consume(k),E):_(k)}function _(k){return k===61?(e.consume(k),T):Be(k)?(e.consume(k),_):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,A):Be(k)?(e.consume(k),T):$(k)}function A(k){return k===l?(e.consume(k),l=null,I):k===null||ve(k)?n(k):(e.consume(k),A)}function $(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||ct(k)?_(k):(e.consume(k),$)}function I(k){return k===47||k===62||Be(k)?B(k):n(k)}function j(k){return k===62?(e.consume(k),R):n(k)}function R(k){return k===null||ve(k)?w(k):Be(k)?(e.consume(k),R):n(k)}function w(k){return k===45&&a===2?(e.consume(k),Z):k===60&&a===1?(e.consume(k),K):k===62&&a===4?(e.consume(k),q):k===63&&a===3?(e.consume(k),D):k===93&&a===5?(e.consume(k),ne):ve(k)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(G1,X,F)(k)):k===null||ve(k)?(e.exit("htmlFlowData"),F(k)):(e.consume(k),w)}function F(k){return e.check(Q1,N,X)(k)}function N(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),M}function M(k){return k===null||ve(k)?F(k):(e.enter("htmlFlowData"),w(k))}function Z(k){return k===45?(e.consume(k),D):w(k)}function K(k){return k===47?(e.consume(k),s="",se):w(k)}function se(k){if(k===62){const S=s.toLowerCase();return wl.includes(S)?(e.consume(k),q):w(k)}return Tt(k)&&s.length<8?(e.consume(k),s+=String.fromCharCode(k),se):w(k)}function ne(k){return k===93?(e.consume(k),D):w(k)}function D(k){return k===62?(e.consume(k),q):k===45&&a===2?(e.consume(k),D):w(k)}function q(k){return k===null||ve(k)?(e.exit("htmlFlowData"),X(k)):(e.consume(k),q)}function X(k){return e.exit("htmlFlow"),t(k)}}function eD(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 tD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(qa,t,n)}}const nD={name:"htmlText",tokenize:rD};function rD(e,t,n){const r=this;let a,i,s;return o;function o(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),l}function l(D){return D===33?(e.consume(D),u):D===47?(e.consume(D),_):D===63?(e.consume(D),B):Tt(D)?(e.consume(D),$):n(D)}function u(D){return D===45?(e.consume(D),c):D===91?(e.consume(D),i=0,g):Tt(D)?(e.consume(D),x):n(D)}function c(D){return D===45?(e.consume(D),p):n(D)}function f(D){return D===null?n(D):D===45?(e.consume(D),m):ve(D)?(s=f,K(D)):(e.consume(D),f)}function m(D){return D===45?(e.consume(D),p):f(D)}function p(D){return D===62?Z(D):D===45?m(D):f(D)}function g(D){const q="CDATA[";return D===q.charCodeAt(i++)?(e.consume(D),i===q.length?h:g):n(D)}function h(D){return D===null?n(D):D===93?(e.consume(D),y):ve(D)?(s=h,K(D)):(e.consume(D),h)}function y(D){return D===93?(e.consume(D),b):h(D)}function b(D){return D===62?Z(D):D===93?(e.consume(D),b):h(D)}function x(D){return D===null||D===62?Z(D):ve(D)?(s=x,K(D)):(e.consume(D),x)}function B(D){return D===null?n(D):D===63?(e.consume(D),E):ve(D)?(s=B,K(D)):(e.consume(D),B)}function E(D){return D===62?Z(D):B(D)}function _(D){return Tt(D)?(e.consume(D),T):n(D)}function T(D){return D===45||Et(D)?(e.consume(D),T):A(D)}function A(D){return ve(D)?(s=A,K(D)):Be(D)?(e.consume(D),A):Z(D)}function $(D){return D===45||Et(D)?(e.consume(D),$):D===47||D===62||ct(D)?I(D):n(D)}function I(D){return D===47?(e.consume(D),Z):D===58||D===95||Tt(D)?(e.consume(D),j):ve(D)?(s=I,K(D)):Be(D)?(e.consume(D),I):Z(D)}function j(D){return D===45||D===46||D===58||D===95||Et(D)?(e.consume(D),j):R(D)}function R(D){return D===61?(e.consume(D),w):ve(D)?(s=R,K(D)):Be(D)?(e.consume(D),R):I(D)}function w(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),a=D,F):ve(D)?(s=w,K(D)):Be(D)?(e.consume(D),w):(e.consume(D),N)}function F(D){return D===a?(e.consume(D),a=void 0,M):D===null?n(D):ve(D)?(s=F,K(D)):(e.consume(D),F)}function N(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||ct(D)?I(D):(e.consume(D),N)}function M(D){return D===47||D===62||ct(D)?I(D):n(D)}function Z(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function K(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),se}function se(D){return Be(D)?Ne(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):ne(D)}function ne(D){return e.enter("htmlTextData"),s(D)}}const ro={name:"labelEnd",tokenize:lD,resolveTo:uD,resolveAll:oD},aD={tokenize:cD},iD={tokenize:dD},sD={tokenize:fD};function oD(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 uD(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},c={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=bt(o,e.slice(i+1,i+r+3)),o=bt(o,[["enter",c,t]]),o=bt(o,no(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=bt(o,[["exit",c,t],e[s-2],e[s-1],["exit",u,t]]),o=bt(o,e.slice(s+1)),o=bt(o,[["exit",l,t]]),jt(e,i,e.length,o),e}function lD(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(m){return i?i._inactive?f(m):(s=r.parser.defined.includes(In(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):n(m)}function l(m){return m===40?e.attempt(aD,c,s?c:f)(m):m===91?e.attempt(iD,c,s?u:f)(m):s?c(m):f(m)}function u(m){return e.attempt(sD,c,f)(m)}function c(m){return t(m)}function f(m){return i._balanced=!0,n(m)}}function cD(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),a}function a(f){return ct(f)?pr(e,i)(f):i(f)}function i(f){return f===41?c(f):Kd(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return ct(f)?pr(e,l)(f):c(f)}function o(f){return n(f)}function l(f){return f===34||f===39||f===40?Yd(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):c(f)}function u(f){return ct(f)?pr(e,c)(f):c(f)}function c(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function dD(e,t,n){const r=this;return a;function a(o){return Zd.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(In(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function fD(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 hD={name:"labelStartImage",tokenize:mD,resolveAll:ro.resolveAll};function mD(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 pD={name:"labelStartLink",tokenize:gD,resolveAll:ro.resolveAll};function gD(e,t,n){const r=this;return a;function a(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const _i={name:"lineEnding",tokenize:vD};function vD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ne(e,t,"linePrefix")}}const ua={name:"thematicBreak",tokenize:bD};function bD(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||ve(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Be(u)?Ne(e,o,"whitespace")(u):o(u))}}const ot={name:"list",tokenize:CD,continuation:{tokenize:xD},exit:ED},yD={tokenize:_D,partial:!0},DD={tokenize:wD,partial:!0};function CD(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Ds(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ua,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Ds(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(qa,r.interrupt?n:c,e.attempt(yD,m,f))}function c(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function f(p){return Be(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function xD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(qa,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ne(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Be(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(DD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ne(e,e.attempt(ot,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function wD(e,t,n){const r=this;return Ne(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 ED(e){e.exit(this.containerState.type)}function _D(e,t,n){const r=this;return Ne(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!Be(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const El={name:"setextUnderline",tokenize:BD,resolveTo:kD};function kD(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 BD(e,t,n){const r=this;let a;return i;function i(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Be(u)?Ne(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ve(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const AD={tokenize:FD};function FD(e){const t=this,n=e.attempt(qa,r,e.attempt(this.parser.constructs.flowInitial,a,Ne(e,e.attempt(this.parser.constructs.flow,a,e.attempt(P1,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 TD={resolveAll:Qd()},SD=Gd("string"),jD=Gd("text");function Gd(e){return{tokenize:t,resolveAll:Qd(e==="text"?OD:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(c){return u(c)?i(c):o(c)}function o(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const f=a[c];let m=-1;if(f)for(;++m<f.length;){const p=f[m];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function Qd(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 OD(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 PD(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:x,enter:B,exit:E,attempt:A(_),check:A(T),interrupt:A(T,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:m,now:g,defineSkip:h,write:f};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function f(R){return s=bt(s,R),y(),s[s.length-1]!==null?[]:($(t,0),u.events=no(i,u.events,u),u.events)}function m(R,w){return RD(p(R),w)}function p(R){return ND(s,R)}function g(){const{line:R,column:w,offset:F,_index:N,_bufferIndex:M}=r;return{line:R,column:w,offset:F,_index:N,_bufferIndex:M}}function h(R){a[R.line]=R.column,j()}function y(){let R;for(;r._index<s.length;){const w=s[r._index];if(typeof w=="string")for(R=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===R&&r._bufferIndex<w.length;)b(w.charCodeAt(r._bufferIndex));else b(w)}}function b(R){c=c(R)}function x(R){ve(R)?(r.line++,r.column=1,r.offset+=R===-3?2:1,j()):R!==-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=R}function B(R,w){const F=w||{};return F.type=R,F.start=g(),u.events.push(["enter",F,u]),o.push(F),F}function E(R){const w=o.pop();return w.end=g(),u.events.push(["exit",w,u]),w}function _(R,w){$(R,w.from)}function T(R,w){w.restore()}function A(R,w){return F;function F(N,M,Z){let K,se,ne,D;return Array.isArray(N)?X(N):"tokenize"in N?X([N]):q(N);function q(L){return U;function U(te){const ee=te!==null&&L[te],Y=te!==null&&L.null,ue=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(Y)?Y:Y?[Y]:[]];return X(ue)(te)}}function X(L){return K=L,se=0,L.length===0?Z:k(L[se])}function k(L){return U;function U(te){return D=I(),ne=L,L.partial||(u.currentConstruct=L),L.name&&u.parser.constructs.disable.null.includes(L.name)?z():L.tokenize.call(w?Object.assign(Object.create(u),w):u,l,S,z)(te)}}function S(L){return R(ne,D),M}function z(L){return D.restore(),++se<K.length?k(K[se]):Z}}}function $(R,w){R.resolveAll&&!i.includes(R)&&i.push(R),R.resolve&&jt(u.events,w,u.events.length-w,R.resolve(u.events.slice(w),u)),R.resolveTo&&(u.events=R.resolveTo(u.events,u))}function I(){const R=g(),w=u.previous,F=u.currentConstruct,N=u.events.length,M=Array.from(o);return{restore:Z,from:N};function Z(){r=R,u.previous=w,u.currentConstruct=F,u.events.length=N,o=M,j()}}function j(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function ND(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 RD(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=`
|
|
107
|
+
`)&&c===u.textContent.length&&c--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var x;u=o,c=((x=o.textContent)===null||x===void 0?void 0:x.length)||0}var B=J.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!B)return null;var k=f?B:J.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!k)return null;var E={anchor:B,focus:k};return W.isExpanded(E)&&W.isForward(E)&&Ct(u)&&b.void(e,{at:E.focus,mode:"highest"})&&(E=b.unhangRange(e,E,{voids:!0})),E}};function vb(e,t){var{path:n,diff:r}=t;if(!b.hasPath(e,n))return!1;var a=se.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=N.next(n);if(!b.hasPath(e,i))return!1;var s=se.get(e,i);return fe.isText(s)&&s.text.startsWith(r.text)}function Sd(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 bb(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 yb(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 jd(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=bb(i,a),o=Math.min(i.length-s,a.length-s),l=yb(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 Db(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=Sd(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 jd(e,{start:r,end:l,text:o})}function Cb(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function vs(e,t){var{path:n,offset:r}=t;if(!b.hasPath(e,n))return null;var a=se.get(e,n);if(!fe.isText(a))return null;var i=b.above(e,{match:o=>de.isElement(o)&&b.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=b.next(e,{at:n,match:fe.isText});if(!s||!N.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Vu(e,t){var n=vs(e,t.anchor);if(!n)return null;if(W.isCollapsed(t))return{anchor:n,focus:n};var r=vs(e,t.focus);return r?{anchor:n,focus:r}:null}function bs(e,t,n){var r=ct.get(e),a=r==null?void 0:r.find(c=>{var{path:f}=c;return N.equals(f,t.path)});if(!a||t.offset<=a.diff.start)return xe.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=xe.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=xe.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&N.equals(n.path,t.path)&&l.offset<n.position&&i.start<n.position?u:{path:u.path,offset:u.offset+i.text.length-i.end+i.start}:null}function Ku(e,t,n){var r=bs(e,t.anchor,n);if(!r)return null;if(W.isCollapsed(t))return{anchor:r,focus:r};var a=bs(e,t.focus,n);return a?{anchor:r,focus:a}:null}function xb(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!N.equals(t.path,n)||t.offset>=r.end?e:t.offset<=r.start?{diff:{start:t.text.length+r.start,end:t.text.length+r.end,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end+t.text.length,text:r.text},id:a,path:n};case"remove_text":return!N.equals(t.path,n)||t.offset>=r.end?e:t.offset+t.text.length<=r.start?{diff:{start:r.start-t.text.length,end:r.end-t.text.length,text:r.text},id:a,path:n}:{diff:{start:r.start,end:r.end-t.text.length,text:r.text},id:a,path:n};case"split_node":return!N.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:N.transform(n,t,{affinity:"backward"})}:t.position>r.start?{diff:{start:r.start,end:Math.min(t.position,r.end),text:r.text},id:a,path:n}:{diff:{start:r.start-t.position,end:r.end-t.position,text:r.text},id:a,path:N.transform(n,t,{affinity:"forward"})};case"merge_node":return N.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:N.transform(n,t)}:{diff:r,id:a,path:N.transform(n,t)}}var i=N.transform(n,t);return i?{diff:r,path:i,id:a}:null}function 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 Zr(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){xt(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 wb=25,Eb=200,kb=function(){},_b=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function Bb(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,c=()=>{var w=Gt.get(t);if(Gt.delete(t),w){var{selection:F}=t,R=Vu(t,w);R&&(!F||!W.equals(R,F))&&Q.select(t,R)}},f=()=>{var w=Yt.get(t);if(Yt.delete(t),!!w){if(w.at){var F=xe.isPoint(w.at)?vs(t,w.at):Vu(t,w.at);if(!F)return;var R=b.range(t,F);(!t.selection||!W.equals(t.selection,R))&&Q.select(t,F)}w.run()}},m=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!k()&&!B()){c();return}a||(a=!0,setTimeout(()=>a=!1)),B()&&(a="action");var w=t.selection&&b.rangeRef(t,t.selection,{affinity:"forward"});zt.set(t,t.marks),kb("flush",Yt.get(t),ct.get(t));for(var F=k(),R;R=(M=ct.get(t))===null||M===void 0?void 0:M[0];){var M,K,V=kt.get(t);V!==void 0&&(kt.delete(t),t.marks=V),V&&u===!1&&(u=null);var oe=Cb(R);(!t.selection||!W.equals(t.selection,oe))&&Q.select(t,oe),R.diff.text?b.insertText(t,R.diff.text):b.deleteFragment(t),ct.set(t,(K=ct.get(t))===null||K===void 0?void 0:K.filter(q=>{var{id:ee}=q;return ee!==R.id})),vb(t,R)||(F=!1,Yt.delete(t),zt.delete(t),a="action",Gt.delete(t),n.cancel(),r.cancel(),w==null||w.unref())}var ne=w==null?void 0:w.unref();if(ne&&!Gt.get(t)&&(!t.selection||!W.equals(ne,t.selection))&&Q.select(t,ne),B()){f();return}F&&n(),n.flush(),r.flush(),c();var D=zt.get(t);zt.delete(t),D!==void 0&&(t.marks=D,t.onChange())},p=w=>{i&&clearTimeout(i),i=setTimeout(()=>{hn.set(t,!1),m()},wb)},g=w=>{hn.set(t,!0),i&&(clearTimeout(i),i=null)},h=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,R=hs.get(t);if(R){if(k()||F){R.style.display="none";return}R.style.removeProperty("display")}},y=(w,F)=>{var R,M=(R=ct.get(t))!==null&&R!==void 0?R:[];ct.set(t,M);var K=se.leaf(t,w),V=M.findIndex(D=>N.equals(D.path,w));if(V<0){var oe=jd(K.text,F);oe&&M.push({path:w,diff:F,id:l++}),h();return}var ne=Db(K.text,M[V].diff,F);if(!ne){M.splice(V,1),h();return}M[V]=Zr(Zr({},M[V]),{},{diff:ne})},v=function(F){var{at:R}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,Gt.delete(t),n.cancel(),r.cancel(),B()&&m(),Yt.set(t,{at:R,run:F}),o=setTimeout(m)},x=w=>{var F;s&&(clearTimeout(s),s=null);var{inputType:R}=w,M=null,K=w.dataTransfer||w.data||void 0;u!==!1&&R!=="insertText"&&R!=="insertCompositionText"&&(u=!1);var[V]=w.getTargetRanges();V&&(M=J.toSlateRange(t,V,{exactMatch:!1,suppressThrow:!0}));var oe=J.getWindow(t),ne=oe.getSelection();if(!M&&ne&&(V=ne,M=J.toSlateRange(t,ne,{exactMatch:!1,suppressThrow:!0})),M=(F=M)!==null&&F!==void 0?F:t.selection,!!M){var D=!0;if(R.startsWith("delete")){if(W.isExpanded(M)){var[q,ee]=W.edges(M),_=se.leaf(t,q.path);if(_.text.length===q.offset&&ee.offset===0){var S=b.next(t,{at:q.path,match:fe.isText});S&&N.equals(S[1],ee.path)&&(M={anchor:ee,focus:ee})}}var z=R.endsWith("Backward")?"backward":"forward",[$,U]=W.edges(M),[re,te]=b.leaf(t,$.path),Y={text:"",start:$.offset,end:U.offset},le=ct.get(t),X=le==null?void 0:le.find(ge=>N.equals(ge.path,te)),ve=X?[X.diff,Y]:[Y],pe=Sd(re.text,...ve);if(pe.length===0&&(D=!1),W.isExpanded(M)){if(D&&N.equals(M.anchor.path,M.focus.path)){var _e={path:M.anchor.path,offset:$.offset},je=b.range(t,_e,_e);return j(je),y(M.anchor.path,{text:"",end:U.offset,start:$.offset})}return v(()=>b.deleteFragment(t,{direction:z}),{at:M})}}switch(R){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>b.deleteFragment(t),{at:M});case"deleteContent":case"deleteContentForward":{var{anchor:Ne}=M;if(D&&W.isCollapsed(M)){var Qe=se.leaf(t,Ne.path);if(Ne.offset<Qe.text.length)return y(Ne.path,{text:"",start:Ne.offset,end:Ne.offset+1})}return v(()=>b.deleteForward(t),{at:M})}case"deleteContentBackward":{var Ze,{anchor:Ye}=M,nt=gs(V)?V.isCollapsed:!!((Ze=V)!==null&&Ze!==void 0&&Ze.collapsed);return D&&nt&&W.isCollapsed(M)&&Ye.offset>0?y(Ye.path,{text:"",start:Ye.offset-1,end:Ye.offset}):v(()=>b.deleteBackward(t),{at:M})}case"deleteEntireSoftLine":return v(()=>{b.deleteBackward(t,{unit:"line"}),b.deleteForward(t,{unit:"line"})},{at:M});case"deleteHardLineBackward":return v(()=>b.deleteBackward(t,{unit:"block"}),{at:M});case"deleteSoftLineBackward":return v(()=>b.deleteBackward(t,{unit:"line"}),{at:M});case"deleteHardLineForward":return v(()=>b.deleteForward(t,{unit:"block"}),{at:M});case"deleteSoftLineForward":return v(()=>b.deleteForward(t,{unit:"line"}),{at:M});case"deleteWordBackward":return v(()=>b.deleteBackward(t,{unit:"word"}),{at:M});case"deleteWordForward":return v(()=>b.deleteForward(t,{unit:"word"}),{at:M});case"insertLineBreak":return v(()=>b.insertSoftBreak(t),{at:M});case"insertParagraph":return v(()=>b.insertBreak(t),{at:M});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(_b(K))return v(()=>J.insertData(t,K),{at:M});var Fe=K??"";if(kt.get(t)&&(Fe=Fe.replace("\uFEFF","")),R==="insertText"&&/.*\n.*\n$/.test(Fe)&&(Fe=Fe.slice(0,-1)),Fe.includes(`
|
|
108
|
+
`))return v(()=>{var ge=Fe.split(`
|
|
109
|
+
`);ge.forEach((Ce,Ve)=>{Ce&&b.insertText(t,Ce),Ve!==ge.length-1&&b.insertSoftBreak(t)})},{at:M});if(N.equals(M.anchor.path,M.focus.path)){var[He,ze]=W.edges(M),H={start:He.offset,end:ze.offset,text:Fe};if(Fe&&u&&R==="insertCompositionText"){var ie=u.start+u.text.search(/\S|$/),he=H.start+H.text.search(/\S|$/);he===ie+1&&H.end===u.start+u.text.length?(H.start-=1,u=null,T()):u=!1}else R==="insertText"?u===null?u=H:u&&W.isCollapsed(M)&&u.end+u.text.length===He.offset?u=Zr(Zr({},u),{},{text:u.text+Fe}):u=!1:u=!1;if(D){y(He.path,H);return}}return v(()=>b.insertText(t,Fe),{at:M})}}}},B=()=>!!Yt.get(t),k=()=>{var w;return!!((w=ct.get(t))!==null&&w!==void 0&&w.length)},E=()=>B()||k(),A=()=>a,j=w=>{Gt.set(t,w),s&&(clearTimeout(s),s=null);var{selection:F}=t;if(w){var R=!F||!N.equals(F.anchor.path,w.anchor.path),M=!F||!N.equals(F.anchor.path.slice(0,-1),w.anchor.path.slice(0,-1));(R&&u||M)&&(u=!1),(R||k())&&(s=setTimeout(m,Eb))}},L=()=>{(B()||!k())&&m()},I=w=>{k()||(h(!0),setTimeout(h))},T=()=>{B()||(o=setTimeout(m))},O=w=>{if(!(k()||B())&&w.some(R=>no(t,R,w))){var F;(F=_d.get(t))===null||F===void 0||F()}};return{flush:m,scheduleFlush:T,hasPendingDiffs:k,hasPendingAction:B,hasPendingChanges:E,isFlushing:A,handleUserSelect:j,handleCompositionEnd:p,handleCompositionStart:g,handleDOMBeforeInput:x,handleKeyDown:I,handleDomMutations:O,handleInput:L}}function Ab(){var e=C.useRef(!1);return C.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Fr=ca?C.useLayoutEffect:C.useEffect;function Fb(e,t,n){var[r]=C.useState(()=>new MutationObserver(t));Fr(()=>{r.takeRecords()}),C.useEffect(()=>{if(!e.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");return r.observe(e.current,n),()=>r.disconnect()},[r,e,n])}var Tb=["node"];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 Sb(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){xt(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 jb={subtree:!0,childList:!0,characterData:!0},Ob=st?e=>{var{node:t}=e,n=Vn(e,Tb);if(!st)return null;var r=sn(),a=Ab(),[i]=C.useState(()=>Bb(Sb({editor:r},n)));return Fb(t,i.handleDomMutations,jb),eo.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,Pb=["anchor","focus"],Nb=["anchor","focus"],Rb=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),Od=(e,t)=>{var n=Vn(e,Pb),r=Vn(t,Nb);return e[Kn]===t[Kn]&&Rb(n,r)},Mb=(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(!W.equals(r,a)||!Od(r,a))return!1}return!0},Ib=(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||!Od(r,a))return!1}return!0};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 $b(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){xt(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 Lb=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=sn(),s=J.findPath(i,a),o=N.parent(s),l=!!n[Bd];return i.isVoid(r)?C.createElement(Di,{length:se.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&b.string(i,o)===""?C.createElement(Di,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?C.createElement(Di,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
|
|
110
|
+
`?C.createElement(Qu,{isTrailing:!0,text:n.text}):C.createElement(Qu,{text:n.text})},Qu=e=>{var{text:t,isTrailing:n=!1}=e,r=C.useRef(null),a=()=>"".concat(t??"").concat(n?`
|
|
111
|
+
`:""),[i]=C.useState(a);return Fr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),C.createElement(zb,{ref:r},i)},zb=C.memo(C.forwardRef((e,t)=>C.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Di=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),C.createElement("span",$b({},a),!st||!n?"\uFEFF":null,n?C.createElement("br",null):null)};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 Pd(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){xt(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 qb=st?300:0;function Wb(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function Xu(e){e.current&&(clearTimeout(e.current),e.current=null)}var Hb=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=x=>C.createElement(Vb,Pd({},x))}=e,o=sn(),l=C.useRef(null),u=C.useRef(null),[c,f]=C.useState(!1),m=C.useRef(null),p=C.useCallback(x=>{if(Wb(l,x==null),x==null){var B;hs.delete(o),(B=t.onPlaceholderResize)===null||B===void 0||B.call(t,null)}else{if(hs.set(o,x),!l.current){var k=window.ResizeObserver||V0;l.current=new k(()=>{var E;(E=t.onPlaceholderResize)===null||E===void 0||E.call(t,x)})}l.current.observe(x),u.current=x}},[u,t,o]),g=C.createElement(Lb,{isLast:n,leaf:t,parent:a,text:r}),h=!!t[Kn];if(C.useEffect(()=>(h?m.current||(m.current=setTimeout(()=>{f(!0),m.current=null},qb)):(Xu(m),f(!1)),()=>Xu(m)),[h,f]),h&&c){var y={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:fr?"inherit":void 0},contentEditable:!1,ref:p}};g=C.createElement(C.Fragment,null,i(y),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},Ub=C.memo(Hb,(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[Kn]===e.leaf[Kn]),Vb=e=>{var{attributes:t,children:n}=e;return C.createElement("span",Pd({},t),n)},Kb=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=sn(),l=C.useRef(null),u=fe.decorations(s,t),c=J.findKey(o,s),f=[],m=0;m<u.length;m++){var p=u[m];f.push(C.createElement(Ub,{isLast:n&&m===u.length-1,key:"".concat(c.id,"-").concat(m),renderPlaceholder:a,leaf:p,text:s,parent:r,renderLeaf:i}))}var g=C.useCallback(h=>{var y=Ka.get(o);h?(y==null||y.set(c,h),vn.set(s,h),Ar.set(h,s)):(y==null||y.delete(c),vn.delete(s),l.current&&Ar.delete(l.current)),l.current=h},[l,o,c,s]);return C.createElement("span",{"data-slate-node":"text",ref:g},f)},Nd=C.memo(Kb,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&Ib(t.decorations,e.decorations));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 ys(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){xt(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 Zb=e=>{var{decorations:t,element:n,renderElement:r=x=>C.createElement(Gb,ys({},x)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=sn(),l=Xb(),u=o.isInline(n),c=J.findKey(o,n),f=C.useCallback(x=>{var B=Ka.get(o);x?(B==null||B.set(c,x),vn.set(n,x),Ar.set(x,n)):(B==null||B.delete(c),vn.delete(n))},[o,c,n]),m=Md({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),p={"data-slate-node":"element",ref:f};if(u&&(p["data-slate-inline"]=!0),!u&&b.hasInlines(o,n)){var g=se.string(n),h=ud(g);h==="rtl"&&(p.dir=h)}if(b.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var y=u?"span":"div",[[v]]=se.texts(n);m=C.createElement(y,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},C.createElement(Nd,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),Js.set(v,0),Xs.set(v,n)}return r({attributes:p,children:m,element:n})},Yb=C.memo(Zb,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&Mb(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&W.equals(e.selection,t.selection))),Gb=e=>{var{attributes:t,children:n,element:r}=e,a=sn(),i=a.isInline(r)?"span":"div";return C.createElement(i,ys(ys({},t),{},{style:{position:"relative"}}),n)},Rd=C.createContext(()=>[]),Qb=()=>C.useContext(Rd),Jb=C.createContext(!1),Md=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=Qb(),l=sn(),u=J.findPath(l,n),c=[],f=de.isElement(n)&&!l.isInline(n)&&b.hasInlines(l,n),m=0;m<n.children.length;m++){var p=u.concat(m),g=n.children[m],h=J.findKey(l,g),y=b.range(l,p),v=s&&W.intersection(y,s),x=o([g,p]);for(var B of t){var k=W.intersection(B,y);k&&x.push(k)}de.isElement(g)?c.push(C.createElement(Jb.Provider,{key:"provider-".concat(h.id),value:!!v},C.createElement(Yb,{decorations:x,element:g,key:h.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):c.push(C.createElement(Nd,{decorations:x,key:h.id,isLast:f&&m===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),Js.set(g,m),Xs.set(g,n)}return c},Id=C.createContext(!1),Xb=()=>C.useContext(Id),$d=C.createContext(null),nr=()=>{var e=C.useContext($d);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function ey(){var e=sn(),t=C.useRef(!1),n=C.useRef(0),r=C.useCallback(()=>{if(!t.current){t.current=!0;var a=J.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return C.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var ty=3,ny={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"},ry={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"},ay={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ie=e=>{var t=ny[e],n=ry[e],r=ay[e],a=t&&yi(t),i=n&&yi(n),s=r&&yi(r);return o=>!!(a&&a(o)||Uu&&i&&i(o)||!Uu&&s&&s(o))},Le={isBold:Ie("bold"),isCompose:Ie("compose"),isMoveBackward:Ie("moveBackward"),isMoveForward:Ie("moveForward"),isDeleteBackward:Ie("deleteBackward"),isDeleteForward:Ie("deleteForward"),isDeleteLineBackward:Ie("deleteLineBackward"),isDeleteLineForward:Ie("deleteLineForward"),isDeleteWordBackward:Ie("deleteWordBackward"),isDeleteWordForward:Ie("deleteWordForward"),isExtendBackward:Ie("extendBackward"),isExtendForward:Ie("extendForward"),isExtendLineBackward:Ie("extendLineBackward"),isExtendLineForward:Ie("extendLineForward"),isItalic:Ie("italic"),isMoveLineBackward:Ie("moveLineBackward"),isMoveLineForward:Ie("moveLineForward"),isMoveWordBackward:Ie("moveWordBackward"),isMoveWordForward:Ie("moveWordForward"),isRedo:Ie("redo"),isSoftBreak:Ie("insertSoftBreak"),isSplitBlock:Ie("splitBlock"),isTransposeCharacter:Ie("transposeCharacter"),isUndo:Ie("undo")},iy=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>no(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}},sy={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Ld extends C.Component{constructor(){super(...arguments),xt(this,"context",null),xt(this,"manager",null),xt(this,"mutationObserver",null)}observe(){var t,{node:n}=this.props;if(!n.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");(t=this.mutationObserver)===null||t===void 0||t.observe(n.current,sy)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=iy(n,t),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var t,n,r,a=(t=this.mutationObserver)===null||t===void 0?void 0:t.takeRecords();if(a!=null&&a.length){var i;(i=this.manager)===null||i===void 0||i.registerMutations(a)}return(n=this.mutationObserver)===null||n===void 0||n.disconnect(),(r=this.manager)===null||r===void 0||r.restoreDOM(),null}componentDidUpdate(){var t;(t=this.manager)===null||t===void 0||t.clear(),this.observe()}componentWillUnmount(){var t;(t=this.mutationObserver)===null||t===void 0||t.disconnect()}render(){return this.props.children}}xt(Ld,"contextType",Qs);var oy=st?Ld:e=>{var{children:t}=e;return C.createElement(C.Fragment,null,t)},uy=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],ly=["text"];function tl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Tt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tl(Object(n),!0).forEach(function(r){xt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var cy=e=>C.createElement(C.Fragment,null,Md(e)),dy=e=>{var t=C.useCallback(S=>C.createElement(fy,Tt({},S)),[]),{autoFocus:n,decorate:r=hy,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=my,style:f={},as:m="div",disableDefaultStyles:p=!1}=e,g=Vn(e,uy),h=nr(),[y,v]=C.useState(!1),x=C.useRef(null),B=C.useRef([]),[k,E]=C.useState(),{onUserInput:A,receivedUserInput:j}=ey(),[,L]=C.useReducer(S=>S+1,0);_d.set(h,L),ms.set(h,s);var I=C.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);C.useEffect(()=>{x.current&&n&&x.current.focus()},[n]);var T=C.useRef(),O=C.useMemo(()=>x0(()=>{var S=T.current;if((st||!J.isComposing(h))&&(!I.isUpdatingSelection||S!=null&&S.isFlushing())&&!I.isDraggingInternally){var z=J.findDocumentOrShadowRoot(h),{activeElement:$}=z,U=J.toDOMNode(h,h),re=z.getSelection();if($===U?(I.latestElement=$,Xt.set(h,!0)):Xt.delete(h),!re)return Q.deselect(h);var{anchorNode:te,focusNode:Y}=re,le=J.hasEditableTarget(h,te)||J.isTargetInsideNonReadonlyVoid(h,te),X=J.hasEditableTarget(h,Y)||J.isTargetInsideNonReadonlyVoid(h,Y);if(le&&X){var ve=J.toSlateRange(h,re,{exactMatch:!1,suppressThrow:!0});ve&&(!J.isComposing(h)&&!(S!=null&&S.hasPendingChanges())&&!(S!=null&&S.isFlushing())?Q.select(h,ve):S==null||S.handleUserSelect(ve))}s&&(!le||!X)&&Q.deselect(h)}},100),[h,s,I]),w=C.useMemo(()=>g0(O,0),[O]);T.current=Ob({node:x,onDOMSelectionChange:O,scheduleOnDOMSelectionChange:w}),Fr(()=>{var S,z,$;x.current&&($=to(x.current))?(kd.set(h,$),da.set(h,x.current),vn.set(h,x.current),Ar.set(x.current,h)):vn.delete(h);var{selection:U}=h,re=J.findDocumentOrShadowRoot(h),te=re.getSelection();if(!(!te||!J.isFocused(h)||(S=T.current)!==null&&S!==void 0&&S.hasPendingAction())){var Y=pe=>{var _e=te.type!=="None";if(!(!U&&!_e)){var je=te.focusNode,Ne;if(Mn&&te.rangeCount>1){var Qe=te.getRangeAt(0),Ze=te.getRangeAt(te.rangeCount-1);Qe.startContainer===je?Ne=Ze.endContainer:Ne=Qe.startContainer}else Ne=te.anchorNode;var Ye=da.get(h),nt=!1;if(Ye.contains(Ne)&&Ye.contains(je)&&(nt=!0),_e&&nt&&U&&!pe){var Fe=J.toSlateRange(h,te,{exactMatch:!0,suppressThrow:!0});if(Fe&&W.equals(Fe,U)){var He;if(!I.hasMarkPlaceholder||(He=Ne)!==null&&He!==void 0&&(He=He.parentElement)!==null&&He!==void 0&&He.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!J.hasRange(h,U)){h.selection=J.toSlateRange(h,te,{exactMatch:!1,suppressThrow:!0});return}I.isUpdatingSelection=!0;var ze=U&&J.toDOMRange(h,U);return ze?(J.isComposing(h)&&!st?te.collapseToEnd():W.isBackward(U)?te.setBaseAndExtent(ze.endContainer,ze.endOffset,ze.startContainer,ze.startOffset):te.setBaseAndExtent(ze.startContainer,ze.startOffset,ze.endContainer,ze.endOffset),c(h,ze)):te.removeAllRanges(),ze}};te.rangeCount<=1&&Y();var le=((z=T.current)===null||z===void 0?void 0:z.isFlushing())==="action";if(!st||!le){setTimeout(()=>{I.isUpdatingSelection=!1});return}var X=null,ve=requestAnimationFrame(()=>{if(le){var pe=_e=>{try{var je=J.toDOMNode(h,h);je.focus(),Y(_e)}catch{}};pe(),X=setTimeout(()=>{pe(!0),I.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ve),X&&clearTimeout(X)}}});var F=C.useCallback(S=>{if(A(),!s&&J.hasEditableTarget(h,S.target)&&!py(S,a)){var z;if(T.current)return T.current.handleDOMBeforeInput(S);w.flush(),O.flush();var{selection:$}=h,{inputType:U}=S,re=S.dataTransfer||S.data||void 0,te=U==="insertCompositionText"||U==="deleteCompositionText";if(te&&J.isComposing(h))return;var Y=!1;if(U==="insertText"&&$&&W.isCollapsed($)&&S.data&&S.data.length===1&&/[a-z ]/i.test(S.data)&&$.anchor.offset!==0){var le,X;Y=!0,h.marks&&(Y=!1);var{anchor:ve}=$,[pe,_e]=J.toDOMPoint(h,ve),je=(le=pe.parentElement)===null||le===void 0?void 0:le.closest("a"),Ne=J.getWindow(h);if(Y&&je&&J.hasDOMNode(h,je)){var Qe,Ze=Ne==null?void 0:Ne.document.createTreeWalker(je,NodeFilter.SHOW_TEXT).lastChild();Ze===pe&&((Qe=Ze.textContent)===null||Qe===void 0?void 0:Qe.length)===_e&&(Y=!1)}if(Y&&pe.parentElement&&(Ne==null||(X=Ne.getComputedStyle(pe.parentElement))===null||X===void 0?void 0:X.whiteSpace)==="pre"){var Ye=b.above(h,{at:ve.path,match:ie=>de.isElement(ie)&&b.isBlock(h,ie)});Ye&&se.string(Ye[0]).includes(" ")&&(Y=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[nt]=S.getTargetRanges();if(nt){var Fe=J.toSlateRange(h,nt,{exactMatch:!1,suppressThrow:!1});if(!$||!W.equals($,Fe)){Y=!1;var He=!te&&h.selection&&b.rangeRef(h,h.selection);Q.select(h,Fe),He&&gr.set(h,He)}}}if(te)return;if(Y||S.preventDefault(),$&&W.isExpanded($)&&U.startsWith("delete")){var ze=U.endsWith("Backward")?"backward":"forward";b.deleteFragment(h,{direction:ze});return}switch(U){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{b.deleteFragment(h);break}case"deleteContent":case"deleteContentForward":{b.deleteForward(h);break}case"deleteContentBackward":{b.deleteBackward(h);break}case"deleteEntireSoftLine":{b.deleteBackward(h,{unit:"line"}),b.deleteForward(h,{unit:"line"});break}case"deleteHardLineBackward":{b.deleteBackward(h,{unit:"block"});break}case"deleteSoftLineBackward":{b.deleteBackward(h,{unit:"line"});break}case"deleteHardLineForward":{b.deleteForward(h,{unit:"block"});break}case"deleteSoftLineForward":{b.deleteForward(h,{unit:"line"});break}case"deleteWordBackward":{b.deleteBackward(h,{unit:"word"});break}case"deleteWordForward":{b.deleteForward(h,{unit:"word"});break}case"insertLineBreak":b.insertSoftBreak(h);break;case"insertParagraph":{b.insertBreak(h);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{U==="insertFromComposition"&&J.isComposing(h)&&(v(!1),hn.set(h,!1)),(re==null?void 0:re.constructor.name)==="DataTransfer"?J.insertData(h,re):typeof re=="string"&&(Y?B.current.push(()=>b.insertText(h,re)):b.insertText(h,re));break}}var H=(z=gr.get(h))===null||z===void 0?void 0:z.unref();gr.delete(h),H&&(!h.selection||!W.equals(h.selection,H))&&Q.select(h,H)}},[h,O,A,a,s,w]),R=C.useCallback(S=>{S==null?(O.cancel(),w.cancel(),da.delete(h),vn.delete(h),x.current&&Kt&&x.current.removeEventListener("beforeinput",F)):Kt&&S.addEventListener("beforeinput",F),x.current=S},[O,w,h,F]);Fr(()=>{var S=J.getWindow(h);return S.document.addEventListener("selectionchange",w),()=>{S.document.removeEventListener("selectionchange",w)}},[w]);var M=r([h,[]]),K=i&&h.children.length===1&&Array.from(se.texts(h)).length===1&&se.string(h)===""&&!y,V=C.useCallback(S=>{if(S&&K){var z;E((z=S.getBoundingClientRect())===null||z===void 0?void 0:z.height)}else E(void 0)},[K]);if(K){var oe=b.start(h,[]);M.push({[Kn]:!0,placeholder:i,onPlaceholderResize:V,anchor:oe,focus:oe})}var{marks:ne}=h;if(I.hasMarkPlaceholder=!1,h.selection&&W.isCollapsed(h.selection)&&ne){var{anchor:D}=h.selection,q=se.leaf(h,D.path),ee=Vn(q,ly);if(!fe.equals(q,ne,{loose:!0})){I.hasMarkPlaceholder=!0;var _=Object.fromEntries(Object.keys(ee).map(S=>[S,null]));M.push(Tt(Tt(Tt({[Bd]:!0},_),ne),{},{anchor:D,focus:D}))}}return C.useEffect(()=>{setTimeout(()=>{var{selection:S}=h;if(S){var{anchor:z}=S,$=se.leaf(h,z.path);if(ne&&!fe.equals($,ne,{loose:!0})){kt.set(h,ne);return}}kt.delete(h)})}),C.createElement(Id.Provider,{value:s},C.createElement(Rd.Provider,{value:r},C.createElement(oy,{node:x,receivedUserInput:j},C.createElement(m,Tt(Tt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Kt||!ca?g.spellCheck:!1,autoCorrect:Kt||!ca?g.autoCorrect:"false",autoCapitalize:Kt||!ca?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:R,style:Tt(Tt({},p?{}:Tt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},k?{minHeight:k}:{})),f),onBeforeInput:C.useCallback(S=>{if(!Kt&&!s&&!at(S,g.onBeforeInput)&&J.hasSelectableTarget(h,S.target)&&(S.preventDefault(),!J.isComposing(h))){var z=S.data;b.insertText(h,z)}},[g.onBeforeInput,h,s]),onInput:C.useCallback(S=>{if(!at(S,g.onInput)){if(T.current){T.current.handleInput();return}for(var z of B.current)z();B.current=[]}},[g.onInput]),onBlur:C.useCallback(S=>{if(!(s||I.isUpdatingSelection||!J.hasSelectableTarget(h,S.target)||at(S,g.onBlur))){var z=J.findDocumentOrShadowRoot(h);if(I.latestElement!==z.activeElement){var{relatedTarget:$}=S,U=J.toDOMNode(h,h);if($!==U&&!(Ct($)&&$.hasAttribute("data-slate-spacer"))){if($!=null&&tn($)&&J.hasDOMNode(h,$)){var re=J.toSlateNode(h,$);if(de.isElement(re)&&!h.isVoid(re))return}if(fr){var te=z.getSelection();te==null||te.removeAllRanges()}Xt.delete(h)}}}},[s,I.isUpdatingSelection,I.latestElement,h,g.onBlur]),onClick:C.useCallback(S=>{if(J.hasTarget(h,S.target)&&!at(S,g.onClick)&&tn(S.target)){var z=J.toSlateNode(h,S.target),$=J.findPath(h,z);if(!b.hasPath(h,$)||se.get(h,$)!==z)return;if(S.detail===ty&&$.length>=1){var U=$;if(!(de.isElement(z)&&b.isBlock(h,z))){var re,te=b.above(h,{match:je=>de.isElement(je)&&b.isBlock(h,je),at:$});U=(re=te==null?void 0:te[1])!==null&&re!==void 0?re:$.slice(0,1)}var Y=b.range(h,U);Q.select(h,Y);return}if(s)return;var le=b.start(h,$),X=b.end(h,$),ve=b.void(h,{at:le}),pe=b.void(h,{at:X});if(ve&&pe&&N.equals(ve[1],pe[1])){var _e=b.range(h,le);Q.select(h,_e)}}},[h,g.onClick,s]),onCompositionEnd:C.useCallback(S=>{if(J.hasSelectableTarget(h,S.target)){var z;if(J.isComposing(h)&&Promise.resolve().then(()=>{v(!1),hn.set(h,!1)}),(z=T.current)===null||z===void 0||z.handleCompositionEnd(S),at(S,g.onCompositionEnd)||st)return;if(!fr&&!ab&&!eb&&!sb&&!ib&&S.data){var $=kt.get(h);kt.delete(h),$!==void 0&&(zt.set(h,h.marks),h.marks=$),b.insertText(h,S.data);var U=zt.get(h);zt.delete(h),U!==void 0&&(h.marks=U)}}},[g.onCompositionEnd,h]),onCompositionUpdate:C.useCallback(S=>{J.hasSelectableTarget(h,S.target)&&!at(S,g.onCompositionUpdate)&&(J.isComposing(h)||(v(!0),hn.set(h,!0)))},[g.onCompositionUpdate,h]),onCompositionStart:C.useCallback(S=>{if(J.hasSelectableTarget(h,S.target)){var z;if((z=T.current)===null||z===void 0||z.handleCompositionStart(S),at(S,g.onCompositionStart)||st)return;v(!0);var{selection:$}=h;if($&&W.isExpanded($)){b.deleteFragment(h);return}}},[g.onCompositionStart,h]),onCopy:C.useCallback(S=>{J.hasSelectableTarget(h,S.target)&&!at(S,g.onCopy)&&!nl(S)&&(S.preventDefault(),J.setFragmentData(h,S.clipboardData,"copy"))},[g.onCopy,h]),onCut:C.useCallback(S=>{if(!s&&J.hasSelectableTarget(h,S.target)&&!at(S,g.onCut)&&!nl(S)){S.preventDefault(),J.setFragmentData(h,S.clipboardData,"cut");var{selection:z}=h;if(z)if(W.isExpanded(z))b.deleteFragment(h);else{var $=se.parent(h,z.anchor.path);b.isVoid(h,$)&&Q.delete(h)}}},[s,h,g.onCut]),onDragOver:C.useCallback(S=>{if(J.hasTarget(h,S.target)&&!at(S,g.onDragOver)){var z=J.toSlateNode(h,S.target);de.isElement(z)&&b.isVoid(h,z)&&S.preventDefault()}},[g.onDragOver,h]),onDragStart:C.useCallback(S=>{if(!s&&J.hasTarget(h,S.target)&&!at(S,g.onDragStart)){var z=J.toSlateNode(h,S.target),$=J.findPath(h,z),U=de.isElement(z)&&b.isVoid(h,z)||b.void(h,{at:$,voids:!0});if(U){var re=b.range(h,$);Q.select(h,re)}I.isDraggingInternally=!0,J.setFragmentData(h,S.dataTransfer,"drag")}},[s,h,g.onDragStart,I]),onDrop:C.useCallback(S=>{if(!s&&J.hasTarget(h,S.target)&&!at(S,g.onDrop)){S.preventDefault();var z=h.selection,$=J.findEventRange(h,S),U=S.dataTransfer;Q.select(h,$),I.isDraggingInternally&&z&&!W.equals(z,$)&&!b.void(h,{at:$,voids:!0})&&Q.delete(h,{at:z}),J.insertData(h,U),J.isFocused(h)||J.focus(h)}I.isDraggingInternally=!1},[s,h,g.onDrop,I]),onDragEnd:C.useCallback(S=>{!s&&I.isDraggingInternally&&g.onDragEnd&&J.hasTarget(h,S.target)&&g.onDragEnd(S),I.isDraggingInternally=!1},[s,I,g,h]),onFocus:C.useCallback(S=>{if(!s&&!I.isUpdatingSelection&&J.hasEditableTarget(h,S.target)&&!at(S,g.onFocus)){var z=J.toDOMNode(h,h),$=J.findDocumentOrShadowRoot(h);if(I.latestElement=$.activeElement,Mn&&S.target!==z){z.focus();return}Xt.set(h,!0)}},[s,I,h,g.onFocus]),onKeyDown:C.useCallback(S=>{if(!s&&J.hasEditableTarget(h,S.target)){var z;(z=T.current)===null||z===void 0||z.handleKeyDown(S);var{nativeEvent:$}=S;if(J.isComposing(h)&&$.isComposing===!1&&(hn.set(h,!1),v(!1)),at(S,g.onKeyDown)||J.isComposing(h))return;var{selection:U}=h,re=h.children[U!==null?U.focus.path[0]:0],te=ud(se.string(re))==="rtl";if(Le.isRedo($)){S.preventDefault();var Y=h;typeof Y.redo=="function"&&Y.redo();return}if(Le.isUndo($)){S.preventDefault();var le=h;typeof le.undo=="function"&&le.undo();return}if(Le.isMoveLineBackward($)){S.preventDefault(),Q.move(h,{unit:"line",reverse:!0});return}if(Le.isMoveLineForward($)){S.preventDefault(),Q.move(h,{unit:"line"});return}if(Le.isExtendLineBackward($)){S.preventDefault(),Q.move(h,{unit:"line",edge:"focus",reverse:!0});return}if(Le.isExtendLineForward($)){S.preventDefault(),Q.move(h,{unit:"line",edge:"focus"});return}if(Le.isMoveBackward($)){S.preventDefault(),U&&W.isCollapsed(U)?Q.move(h,{reverse:!te}):Q.collapse(h,{edge:te?"end":"start"});return}if(Le.isMoveForward($)){S.preventDefault(),U&&W.isCollapsed(U)?Q.move(h,{reverse:te}):Q.collapse(h,{edge:te?"start":"end"});return}if(Le.isMoveWordBackward($)){S.preventDefault(),U&&W.isExpanded(U)&&Q.collapse(h,{edge:"focus"}),Q.move(h,{unit:"word",reverse:!te});return}if(Le.isMoveWordForward($)){S.preventDefault(),U&&W.isExpanded(U)&&Q.collapse(h,{edge:"focus"}),Q.move(h,{unit:"word",reverse:te});return}if(Kt){if((Ed||fr)&&U&&(Le.isDeleteBackward($)||Le.isDeleteForward($))&&W.isCollapsed(U)){var X=se.parent(h,U.anchor.path);if(de.isElement(X)&&b.isVoid(h,X)&&(b.isInline(h,X)||b.isBlock(h,X))){S.preventDefault(),b.deleteBackward(h,{unit:"block"});return}}}else{if(Le.isBold($)||Le.isItalic($)||Le.isTransposeCharacter($)){S.preventDefault();return}if(Le.isSoftBreak($)){S.preventDefault(),b.insertSoftBreak(h);return}if(Le.isSplitBlock($)){S.preventDefault(),b.insertBreak(h);return}if(Le.isDeleteBackward($)){S.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(h,{direction:"backward"}):b.deleteBackward(h);return}if(Le.isDeleteForward($)){S.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(h,{direction:"forward"}):b.deleteForward(h);return}if(Le.isDeleteLineBackward($)){S.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(h,{direction:"backward"}):b.deleteBackward(h,{unit:"line"});return}if(Le.isDeleteLineForward($)){S.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(h,{direction:"forward"}):b.deleteForward(h,{unit:"line"});return}if(Le.isDeleteWordBackward($)){S.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(h,{direction:"backward"}):b.deleteBackward(h,{unit:"word"});return}if(Le.isDeleteWordForward($)){S.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(h,{direction:"forward"}):b.deleteForward(h,{unit:"word"});return}}}},[s,h,g.onKeyDown]),onPaste:C.useCallback(S=>{!s&&J.hasEditableTarget(h,S.target)&&!at(S,g.onPaste)&&(!Kt||lb(S.nativeEvent)||fr)&&(S.preventDefault(),J.insertData(h,S.clipboardData))},[s,h,g.onPaste])}),C.createElement(cy,{decorations:M,node:h,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:h.selection})))))},fy=e=>{var{attributes:t,children:n}=e;return C.createElement("span",Tt({},t),n,st&&C.createElement("br",null))},hy=()=>[],my=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&W.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),k0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},at=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},nl=e=>tn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),py=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},gy=C.createContext(!1),vy=C.createContext({});function by(e){var t=C.useRef([]).current,n=C.useRef({editor:e}).current,r=C.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=C.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var yy=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],Dy=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Vn(e,yy),[l,u]=C.useState(()=>{if(!se.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Ge.stringify(s)));if(!b.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Ge.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:c,onChange:f}=by(t),m=C.useCallback(h=>{var y;switch(r&&r(t.children),h==null||(y=h.operation)===null||y===void 0?void 0:y.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(v=>({v:v.v+1,editor:t})),f(t)},[t,f,r,a,i]);C.useEffect(()=>(ps.set(t,m),()=>{ps.set(t,()=>{})}),[t,m]);var[p,g]=C.useState(J.isFocused(t));return C.useEffect(()=>{g(J.isFocused(t))},[t]),Fr(()=>{var h=()=>g(J.isFocused(t));return wd>=17?(document.addEventListener("focusin",h),document.addEventListener("focusout",h),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",h)}):(document.addEventListener("focus",h,!0),document.addEventListener("blur",h,!0),()=>{document.removeEventListener("focus",h,!0),document.removeEventListener("blur",h,!0)})},[]),C.createElement(vy.Provider,{value:c},C.createElement($d.Provider,{value:l},C.createElement(Qs.Provider,{value:l.editor},C.createElement(gy.Provider,{value:p},n))))},rl=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},al=(e,t,n)=>{var r=J.toDOMRange(e,t).getBoundingClientRect(),a=J.toDOMRange(e,n).getBoundingClientRect();return rl(r,a)&&rl(a,r)},Cy=(e,t)=>{var n=b.range(e,W.end(t)),r=Array.from(b.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(al(e,b.range(e,r[a]),n))return b.range(e,r[a],n);if(r.length<2)return b.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)al(e,b.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return b.range(e,r[i],n)};function 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 sl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?il(Object(n),!0).forEach(function(r){xt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):il(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var xy=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 Ka.set(r,new WeakMap),r.addMark=(u,c)=>{var f,m;(f=eo.get(r))===null||f===void 0||f(),!kt.get(r)&&(m=ct.get(r))!==null&&m!==void 0&&m.length&&kt.set(r,null),zt.delete(r),o(u,c)},r.removeMark=u=>{var c;!kt.get(r)&&(c=ct.get(r))!==null&&c!==void 0&&c.length&&kt.set(r,null),zt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&W.isCollapsed(r.selection)){var c=b.above(r,{match:g=>de.isElement(g)&&b.isBlock(r,g),at:r.selection});if(c){var[,f]=c,m=b.range(r,f,r.selection.anchor),p=Cy(r,m);W.isCollapsed(p)||Q.delete(r,{at:p})}}},r.apply=u=>{var c=[],f=[],m=ct.get(r);if(m!=null&&m.length){var p=m.map(R=>xb(R,u)).filter(Boolean);ct.set(r,p)}var g=Gt.get(r);g&&Gt.set(r,Ku(r,g,u));var h=Yt.get(r);if(h!=null&&h.at){var y=xe.isPoint(h==null?void 0:h.at)?bs(r,h.at,u):Ku(r,h.at,u);Yt.set(r,y?sl(sl({},h),{},{at:y}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...Tn(r,u.path));break}case"set_selection":{var v;(v=gr.get(r))===null||v===void 0||v.unref(),gr.delete(r);break}case"insert_node":case"remove_node":{c.push(...Tn(r,N.parent(u.path)));break}case"merge_node":{var x=N.previous(u.path);c.push(...Tn(r,x));break}case"move_node":{var B=N.common(N.parent(u.path),N.parent(u.newPath));c.push(...Tn(r,B));var k;N.isBefore(u.path,u.newPath)?(c.push(...Tn(r,N.parent(u.path))),k=u.newPath):(c.push(...Tn(r,N.parent(u.newPath))),k=u.path);var E=se.get(t,N.parent(k)),A=J.findKey(r,E),j=b.pathRef(r,N.parent(k));f.push([j,A]);break}}a(u);for(var[L,I]of c){var[T]=b.node(r,L);ka.set(T,I)}for(var[O,w]of f)if(O.current){var[F]=b.node(r,O.current);ka.set(F,w)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[f,m]=W.edges(c),p=b.void(r,{at:f.path}),g=b.void(r,{at:m.path});if(!(W.isCollapsed(c)&&!p)){var h=J.toDOMRange(r,c),y=h.cloneContents(),v=y.childNodes[0];if(y.childNodes.forEach(T=>{T.textContent&&T.textContent.trim()!==""&&(v=T)}),g){var[x]=g,B=h.cloneRange(),k=J.toDOMNode(r,x);B.setEndAfter(k),y=B.cloneContents()}if(p&&(v=y.querySelector("[data-slate-spacer]")),Array.from(y.querySelectorAll("[data-slate-zero-width]")).forEach(T=>{var O=T.getAttribute("data-slate-zero-width")==="n";T.textContent=O?`
|
|
112
|
+
`:""}),Ad(v)){var E=v.ownerDocument.createElement("span");E.style.whiteSpace="pre",E.appendChild(v),y.appendChild(E),v=E}var A=r.getFragment(),j=JSON.stringify(A),L=window.btoa(encodeURIComponent(j));v.setAttribute("data-slate-fragment",L),u.setData("application/".concat(n),L);var I=y.ownerDocument.createElement("div");return I.appendChild(y),I.setAttribute("hidden","true"),y.ownerDocument.body.appendChild(I),u.setData("text/html",I.innerHTML),u.setData("text/plain",Td(I)),y.ownerDocument.body.removeChild(I),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||mb(u);if(c){var f=decodeURIComponent(window.atob(c)),m=JSON.parse(f);return r.insertFragment(m),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var f=c.split(/\r\n|\r|\n/),m=!1;for(var p of f)m&&Q.splitNodes(r,{always:!0}),r.insertText(p),m=!0;return!0}return!1},r.onChange=u=>{var c=wd<18?cc.unstable_batchedUpdates:f=>f();c(()=>{var f=ps.get(r);f&&f(u),i(u)})},r},Tn=(e,t)=>{var n=[];for(var[r,a]of b.levels(e,{at:t})){var i=J.findKey(e,r);n.push([a,i])}return n};const wy={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,lastAnchor:null,dispatch:()=>{},reportError:e=>{console.error(e)}},kn=C.createContext(wy);var G=(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.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e))(G||{}),qt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(qt||{});const Ey=({attributes:e,children:t,element:n})=>{switch(n.type){case G.blockquote:return d.jsx("blockquote",{className:"subtle",...e,children:t});case G.link:return d.jsx("a",{...e,children:t});case G.li:return d.jsx("li",{...e,children:t});case G.ol:return d.jsx("ol",{...e,children:t});case G.ul:return d.jsx("ul",{...e,children:t});case G.span:return d.jsx("span",{...e,children:t});case G.paragraph:return d.jsx("p",{...e,children:t});default:return d.jsx("span",{...e,children:t})}},ky=({attributes:e,children:t,leaf:n})=>{const r=n;return r[G.bold]&&(t=d.jsx("strong",{children:t})),r[G.italic]&&(t=d.jsx("em",{children:t})),r[G.strikethrough]&&(t=d.jsx("s",{children:t})),d.jsx("span",{...e,children:t})},ro=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=ue.useIntl(),l=nr(),{id:u,tabbableOption:c,setFocus:f,openTooltip:m,dispatch:p}=C.useContext(kn),g={};return e!==c&&(g.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:Z(e,{"has-divider":n}),onMouseEnter:()=>{p([{type:"openTooltip",value:e}])},onMouseLeave:()=>{p([{type:"openTooltip",value:null}])},onFocus:()=>{p([{type:"openTooltip",value:e}])},onBlur:h=>{h.stopPropagation();const y=[{type:"openTooltip",value:null}];l.selection&&y.push({type:"lastAnchor",value:l.selection.anchor}),p(y)},contentEditable:!1,children:[d.jsxs("button",{...s,...g,className:Z(e,a,{active:t}),onClick:h=>{h.stopPropagation(),h.preventDefault()},onMouseDown:h=>{h.stopPropagation(),h.preventDefault(),r()},onKeyDown:h=>{var y,v,x,B;if(h.key!=="Tab")switch(h.key){case"Enter":h.stopPropagation(),h.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":h.stopPropagation(),h.preventDefault();const k=h.currentTarget.closest("li");let E=k==null?void 0:k.nextElementSibling;if(h.key==="ArrowLeft"){const L=k==null?void 0:k.previousElementSibling;L?E=L:E=(y=k==null?void 0:k.parentElement)==null?void 0:y.lastElementChild}else E||(E=(v=k==null?void 0:k.parentElement)==null?void 0:v.firstElementChild);const A=E==null?void 0:E.className.split(" ")[0];A&&(f(A),(x=E==null?void 0:E.querySelector("button"))==null||x.focus());break;default:const j=h.currentTarget.closest("fieldset");if(j){(B=j==null?void 0:j.previousElementSibling)==null||B.focus();break}}},children:[d.jsx($e,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(Qn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:m===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},ol=[G.ol,G.ul],zd=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(b.nodes(e,{at:b.unhangRange(e,n),match:a=>{const i=a;return!b.isEditor(a)&&de.isElement(a)&&i.type===t}}));return!!r},_y=e=>{const[t]=b.nodes(e,{match:n=>n.type===G.blockquote});return!!t},qd=(e,t,n)=>{try{const r=_y(e),a=zd(e,t),i=ol.includes(t);Q.unwrapNodes(e,{match:l=>{const u=l;return!b.isEditor(u)&&de.isElement(u)&&ol.includes(u.type)},split:!0});const o={type:a?G.paragraph:i?G.li:t};if(Q.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,c]=b.parent(e,l,{edge:"end"});Array.from(b.nodes(e,{at:c,match:m=>{const p=m;return!b.isEditor(m)&&de.isElement(m)&&p.type===G.li}})).forEach(([m,p])=>{se.string(m).trim()===""&&Q.removeNodes(e,{at:p})})}else{if(r){const u={type:G.blockquote,children:[]};Q.wrapNodes(e,u)}const l={type:t,children:[]};Q.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},By=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(kn),a=nr(),i=zd(a,e);return d.jsx(ro,{id:e,active:i,hasDivider:t,callback:()=>{qd(a,e,r),n(i?null:e)}})},Ay=52,ul=16,Fy=(e,t,n)=>{const r=C.useRef(null),{showLinkEditor:a}=C.useContext(kn),i=t==="link-editor"?a:!1;return C.useEffect(()=>{var f;if(!(r!=null&&r.current)||!i)return;const s=r==null?void 0:r.current;if(!s)return;const o=document.getSelection();let l;o!=null&&o.toString().trim().length?l=o==null?void 0:o.getRangeAt(0).getBoundingClientRect():l=(f=document.getElementById(n))==null?void 0:f.getBoundingClientRect();const u=((l==null?void 0:l.top)||0)+window.scrollY-Ay,c=Math.max(((l==null?void 0:l.left)||0)-(s.offsetWidth-((l==null?void 0:l.width)||0)),0);s.style.top=`${u/ul}rem`,s.style.left=`${c/ul}rem`},[i,e.selection]),r},Ty=e=>{const[t,n]=C.useState(null);return C.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=b.nodes(e,{at:r,match:i=>i.type===G.link});if(a){const i=a[0],s=Bc(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 it=(e=>(e.paragraph="paragraph",e.heading="heading",e.list="list",e.listItem="listItem",e.link="link",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))(it||{});const In={[G.paragraph]:G.paragraph,[G.blockquote]:G.blockquote,[G.codeblock]:G.codeblock,[G.link]:G.link,[G.ul]:G.ul,[G.ol]:G.ol,[G.li]:G.li,[G.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[qt.emphasis]:G.italic,[qt.strong]:G.bold,[qt.delete]:G.strikethrough,[qt.code]:G.code,[G.hr]:G.hr,[G.image]:G.image};function ll(e){if(e)throw e}var fa=Object.prototype.hasOwnProperty,Wd=Object.prototype.toString,cl=Object.defineProperty,dl=Object.getOwnPropertyDescriptor,fl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Wd.call(t)==="[object Array]"},hl=function(t){if(!t||Wd.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)},ml=function(t,n){cl&&n.name==="__proto__"?cl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},pl=function(t,n){if(n==="__proto__")if(fa.call(t,n)){if(dl)return dl(t,n).value}else return;return t[n]},Sy=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,c=!1;for(typeof o=="boolean"&&(c=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=pl(o,n),a=pl(t,n),o!==a&&(c&&a&&(hl(a)||(i=fl(a)))?(i?(i=!1,s=r&&fl(r)?r:[]):s=r&&hl(r)?r:{},ml(o,{name:n,newValue:e(c,s,a)})):typeof a<"u"&&ml(o,{name:n,newValue:a}));return o};const Ci=xn(Sy);function Ds(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 jy(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const c=e[++i];let f=-1;if(l){s(l);return}for(;++f<a.length;)(u[f]===null||u[f]===void 0)&&(u[f]=a[f]);a=u,c?Oy(c,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function Oy(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const c=u;if(o&&n)throw c;return a(c)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function vr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?gl(e.position):"start"in e||"end"in e?gl(e):"line"in e||"column"in e?Cs(e):""}function Cs(e){return vl(e&&e.line)+":"+vl(e&&e.column)}function gl(e){return Cs(e&&e.start)+"-"+Cs(e&&e.end)}function vl(e){return e&&typeof e=="number"?e:1}class ht extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=o?o.line:void 0,this.name=vr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}ht.prototype.file="";ht.prototype.name="";ht.prototype.reason="";ht.prototype.message="";ht.prototype.stack="";ht.prototype.column=void 0;ht.prototype.line=void 0;ht.prototype.ancestors=void 0;ht.prototype.cause=void 0;ht.prototype.fatal=void 0;ht.prototype.place=void 0;ht.prototype.ruleId=void 0;ht.prototype.source=void 0;const St={basename:Py,dirname:Ny,extname:Ry,join:My,sep:"/"};function Py(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Or(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 Ny(e){if(Or(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 Ry(e){Or(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 My(...e){let t=-1,n;for(;++t<e.length;)Or(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Iy(n)}function Iy(e){Or(e);const t=e.codePointAt(0)===47;let n=$y(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function $y(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 Or(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Ly={cwd:zy};function zy(){return"/"}function xs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function qy(e){if(typeof e=="string")e=new URL(e);else if(!xs(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 Wy(e)}function Wy(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 xi=["history","path","basename","stem","extname","dirname"];class Hy{constructor(t){let n;t?xs(t)?n={path:t}:typeof t=="string"||Uy(t)?n={value:t}:n=t:n={},this.cwd=Ly.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<xi.length;){const i=xi[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)xi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?St.basename(this.path):void 0}set basename(t){Ei(t,"basename"),wi(t,"basename"),this.path=St.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?St.dirname(this.path):void 0}set dirname(t){bl(this.basename,"dirname"),this.path=St.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?St.extname(this.path):void 0}set extname(t){if(wi(t,"extname"),bl(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=St.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){xs(t)&&(t=qy(t)),Ei(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?St.basename(this.path,this.extname):void 0}set stem(t){Ei(t,"stem"),wi(t,"stem"),this.path=St.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new ht(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function wi(e,t){if(e&&e.includes(St.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+St.sep+"`")}function Ei(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function bl(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Uy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Vy=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},Ky={}.hasOwnProperty;class ao extends Vy{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=jy()}copy(){const t=new ao;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ci(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Bi("data",this.frozen),this.namespace[t]=n,this):Ky.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Bi("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=Yr(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),_i("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=Yr(t),l=r.parse(o);r.run(l,o,function(c,f,m){if(c||!f||!m)return u(c);const p=f,g=r.stringify(p,m);Gy(g)?m.value=g:m.result=g,u(c,m)});function u(c,f){c||!f?s(c):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),ki("processSync",this.parser||this.Parser),_i("processSync",this.compiler||this.Compiler),this.process(t,a),Dl("processSync","process",n),r;function a(i,s){n=!0,ll(i),r=s}}run(t,n,r){yl(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=Yr(n);a.run(t,l,u);function u(c,f,m){const p=f||t;c?o(c):s?s(p):r(void 0,p,m)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),Dl("runSync","run",r),a;function i(s,o){ll(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=Yr(n),a=this.compiler||this.Compiler;return _i("stringify",a),yl(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Bi("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...f]=u;l(c,f)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(a.settings=Ci(!0,a.settings,u.settings))}function o(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const f=u[c];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let f=-1,m=-1;for(;++f<r.length;)if(r[f][0]===u){m=f;break}if(m===-1)r.push([u,...c]);else if(c.length>0){let[p,...g]=c;const h=r[m][1];Ds(h)&&Ds(p)&&(p=Ci(!0,h,p)),r[m]=[u,p,...g]}}}}const Zy=new ao().freeze();function ki(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function _i(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Bi(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 yl(e){if(!Ds(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Dl(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Yr(e){return Yy(e)?e:new Hy(e)}function Yy(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Gy(e){return typeof e=="string"||Qy(e)}function Qy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Jy={};function Xy(e,t){const n=t||Jy,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Hd(e,r,a)}function Hd(e,t,n){if(e1(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 Cl(e.children,t,n)}return Array.isArray(e)?Cl(e,t,n):""}function Cl(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Hd(e[a],t,n);return r.join("")}function e1(e){return!!(e&&typeof e=="object")}const xl=document.createElement("i");function io(e){const t="&"+e+";";xl.innerHTML=t;const n=xl.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Pt(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function Dt(e,t){return e.length>0?(Pt(e,e.length,0,t),e):t}const wl={}.hasOwnProperty;function t1(e){const t={};let n=-1;for(;++n<e.length;)n1(t,e[n]);return t}function n1(e,t){let n;for(n in t){const a=(wl.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){wl.call(a,s)||(a[s]=[]);const o=i[s];r1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function r1(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Pt(e,0,0,r)}function Ud(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function zn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const jt=on(/[A-Za-z]/),_t=on(/[\dA-Za-z]/),a1=on(/[#-'*+\--9=?A-Z^-~]/);function ws(e){return e!==null&&(e<32||e===127)}const Es=on(/\d/),i1=on(/[\dA-Fa-f]/),s1=on(/[!-/:-@[-`{-~]/);function be(e){return e!==null&&e<-2}function ft(e){return e!==null&&(e<0||e===32)}function Ae(e){return e===-2||e===-1||e===32}const o1=on(/\p{P}|\p{S}/u),u1=on(/\s/);function on(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Re(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Ae(l)?(e.enter(n),o(l)):t(l)}function o(l){return Ae(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const l1={tokenize:c1};function c1(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"),Re(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 d1={tokenize:f1},El={tokenize:h1};function f1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(B){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,l,u)(B)}return u(B)}function l(B){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&x();const k=t.events.length;let E=k,A;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){A=t.events[E][1].end;break}v(r);let j=k;for(;j<t.events.length;)t.events[j][1].end=Object.assign({},A),j++;return Pt(t.events,E+1,0,t.events.slice(k)),t.events.length=j,u(B)}return o(B)}function u(B){if(r===n.length){if(!a)return m(B);if(a.currentConstruct&&a.currentConstruct.concrete)return g(B);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(El,c,f)(B)}function c(B){return a&&x(),v(r),m(B)}function f(B){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(B)}function m(B){return t.containerState={},e.attempt(El,p,g)(B)}function p(B){return r++,n.push([t.currentConstruct,t.containerState]),m(B)}function g(B){if(B===null){a&&x(),v(0),e.consume(B);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),h(B)}function h(B){if(B===null){y(e.exit("chunkFlow"),!0),v(0),e.consume(B);return}return be(B)?(e.consume(B),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(B),h)}function y(B,k){const E=t.sliceStream(B);if(k&&E.push(null),B.previous=i,i&&(i.next=B),i=B,a.defineSkip(B.start),a.write(E),t.parser.lazy[B.start.line]){let A=a.events.length;for(;A--;)if(a.events[A][1].start.offset<s&&(!a.events[A][1].end||a.events[A][1].end.offset>s))return;const j=t.events.length;let L=j,I,T;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(I){T=t.events[L][1].end;break}I=!0}for(v(r),A=j;A<t.events.length;)t.events[A][1].end=Object.assign({},T),A++;Pt(t.events,L+1,0,t.events.slice(j)),t.events.length=A}}function v(B){let k=n.length;for(;k-- >B;){const E=n[k];t.containerState=E[1],E[0].exit.call(t,e)}n.length=B}function x(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function h1(e,t,n){return Re(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function kl(e){if(e===null||ft(e)||u1(e))return 1;if(o1(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 ks={name:"attention",tokenize:p1,resolveAll:m1};function m1(e,t){let n=-1,r,a,i,s,o,l,u,c;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f=Object.assign({},e[r][1].end),m=Object.assign({},e[n][1].start);_l(f,-l),_l(m,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:m},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Dt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Dt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Dt(u,so(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Dt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=Dt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Pt(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function p1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=kl(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),c=kl(l),f=!c||c===2&&a||n.includes(l),m=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?f:f&&(a||!m)),u._close=!!(i===42?m:m&&(c||!f)),t(l)}}function _l(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const g1={name:"autolink",tokenize:v1};function v1(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return jt(p)?(e.consume(p),s):u(p)}function s(p){return p===43||p===45||p===46||_t(p)?(r=1,o(p)):u(p)}function o(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||_t(p))&&r++<32?(e.consume(p),o):(r=0,u(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||ws(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),c):a1(p)?(e.consume(p),u):n(p)}function c(p){return _t(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,c):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):m(p)}function m(p){if((p===45||_t(p))&&r++<63){const g=p===45?m:f;return e.consume(p),g}return n(p)}}const Za={tokenize:b1,partial:!0};function b1(e,t,n){return r;function r(i){return Ae(i)?Re(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||be(i)?t(i):n(i)}}const Vd={name:"blockQuote",tokenize:y1,continuation:{tokenize:D1},exit:C1};function y1(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 Ae(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function D1(e,t,n){const r=this;return a;function a(s){return Ae(s)?Re(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Vd,t,n)(s)}}function C1(e){e.exit("blockQuote")}const Kd={name:"characterEscape",tokenize:x1};function x1(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 s1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Zd={name:"characterReference",tokenize:w1};function w1(e,t,n){const r=this;let a=0,i,s;return o;function o(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=_t,c(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=i1,c):(e.enter("characterReferenceValue"),i=7,s=Es,c(f))}function c(f){if(f===59&&a){const m=e.exit("characterReferenceValue");return s===_t&&!io(r.sliceSerialize(m))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(f)&&a++<i?(e.consume(f),c):n(f)}}const Bl={tokenize:k1,partial:!0},Al={name:"codeFenced",tokenize:E1,concrete:!0};function E1(e,t,n){const r=this,a={tokenize:E,partial:!0};let i=0,s=0,o;return l;function l(A){return u(A)}function u(A){const j=r.events[r.events.length-1];return i=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[1],!0).length:0,o=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(A)}function c(A){return A===o?(s++,e.consume(A),c):s<3?n(A):(e.exit("codeFencedFenceSequence"),Ae(A)?Re(e,f,"whitespace")(A):f(A))}function f(A){return A===null||be(A)?(e.exit("codeFencedFence"),r.interrupt?t(A):e.check(Bl,h,k)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(A))}function m(A){return A===null||be(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(A)):Ae(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Re(e,p,"whitespace")(A)):A===96&&A===o?n(A):(e.consume(A),m)}function p(A){return A===null||be(A)?f(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(A))}function g(A){return A===null||be(A)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(A)):A===96&&A===o?n(A):(e.consume(A),g)}function h(A){return e.attempt(a,k,y)(A)}function y(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),v}function v(A){return i>0&&Ae(A)?Re(e,x,"linePrefix",i+1)(A):x(A)}function x(A){return A===null||be(A)?e.check(Bl,h,k)(A):(e.enter("codeFlowValue"),B(A))}function B(A){return A===null||be(A)?(e.exit("codeFlowValue"),x(A)):(e.consume(A),B)}function k(A){return e.exit("codeFenced"),t(A)}function E(A,j,L){let I=0;return T;function T(M){return A.enter("lineEnding"),A.consume(M),A.exit("lineEnding"),O}function O(M){return A.enter("codeFencedFence"),Ae(M)?Re(A,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):w(M)}function w(M){return M===o?(A.enter("codeFencedFenceSequence"),F(M)):L(M)}function F(M){return M===o?(I++,A.consume(M),F):I>=s?(A.exit("codeFencedFenceSequence"),Ae(M)?Re(A,R,"whitespace")(M):R(M)):L(M)}function R(M){return M===null||be(M)?(A.exit("codeFencedFence"),j(M)):L(M)}}}function k1(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 Ai={name:"codeIndented",tokenize:B1},_1={tokenize:A1,partial:!0};function B1(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Re(e,i,"linePrefix",4+1)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):be(u)?e.attempt(_1,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 A1(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):Re(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 F1={name:"codeText",tokenize:j1,resolve:T1,previous:S1};function T1(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 S1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function j1(e,t,n){let r=0,a,i;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),o(f)}function o(f){return f===96?(e.consume(f),r++,o):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(i=e.enter("codeTextSequence"),a=0,c(f)):be(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||be(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),u)}function c(f){return f===96?(e.consume(f),a++,c):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}function Yd(e){const t={};let n=-1,r,a,i,s,o,l,u;for(;++n<e.length;){for(;n in t;)n=t[n];if(r=e[n],n&&r[1].type==="chunkFlow"&&e[n-1][1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,O1(e,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=e[i],s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(e[a][1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},e[a][1].start),o=e.slice(a,n),o.unshift(r),Pt(e,a,n-a+1,o))}}return!u}function O1(e,t){const n=e[t][1],r=e[t][2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let c,f,m=-1,p=n,g=0,h=0;const y=[h];for(;p;){for(;e[++a][1]!==p;);i.push(a),p._tokenizer||(c=r.sliceStream(p),p.next||c.push(null),f&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++m<o.length;)o[m][0]==="exit"&&o[m-1][0]==="enter"&&o[m][1].type===o[m-1][1].type&&o[m][1].start.line!==o[m][1].end.line&&(h=m+1,y.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),m=y.length;m--;){const v=o.slice(y[m],y[m+1]),x=i.pop();l.unshift([x,x+v.length-1]),Pt(e,x,2,v)}for(m=-1;++m<l.length;)u[g+l[m][0]]=g+l[m][1],g+=l[m][1]-l[m][0]-1;return u}const P1={tokenize:M1,resolve:R1},N1={tokenize:I1,partial:!0};function R1(e){return Yd(e),e}function M1(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(N1,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 I1(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Re(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 Gd(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(v){return v===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(v),e.exit(i),m):v===null||v===32||v===41||ws(v)?n(v):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),h(v))}function m(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===62?(e.exit("chunkString"),e.exit(o),m(v)):v===null||v===60||be(v)?n(v):(e.consume(v),v===92?g:p)}function g(v){return v===60||v===62||v===92?(e.consume(v),p):p(v)}function h(v){return!c&&(v===null||v===41||ft(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):c<u&&v===40?(e.consume(v),c++,h):v===41?(e.consume(v),c--,h):v===null||v===32||v===40||ws(v)?n(v):(e.consume(v),v===92?y:h)}function y(v){return v===40||v===41||v===92?(e.consume(v),h):h(v)}}function Qd(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),c}function c(p){return o>999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):be(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||be(p)||o++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!Ae(p)),p===92?m:f)}function m(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}}function Jd(e,t,n,r,a,i){let s;return o;function o(m){return m===34||m===39||m===40?(e.enter(r),e.enter(a),e.consume(m),e.exit(a),s=m===40?41:m,l):n(m)}function l(m){return m===s?(e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):(e.enter(i),u(m))}function u(m){return m===s?(e.exit(i),l(s)):m===null?n(m):be(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Re(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(m))}function c(m){return m===s||m===null||be(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?f:c)}function f(m){return m===s||m===92?(e.consume(m),c):c(m)}}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):Ae(a)?Re(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const $1={name:"definition",tokenize:z1},L1={tokenize:q1,partial:!0};function z1(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return Qd.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return a=zn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ft(p)?br(e,u)(p):u(p)}function u(p){return Gd(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(L1,f,f)(p)}function f(p){return Ae(p)?Re(e,m,"whitespace")(p):m(p)}function m(p){return p===null||be(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function q1(e,t,n){return r;function r(o){return ft(o)?br(e,a)(o):n(o)}function a(o){return Jd(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Ae(o)?Re(e,s,"whitespace")(o):s(o)}function s(o){return o===null||be(o)?t(o):n(o)}}const W1={name:"hardBreakEscape",tokenize:H1};function H1(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 U1={name:"headingAtx",tokenize:K1,resolve:V1};function V1(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"},Pt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function K1(e,t,n){let r=0;return a;function a(c){return e.enter("atxHeading"),i(c)}function i(c){return e.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(e.consume(c),s):c===null||ft(c)?(e.exit("atxHeadingSequence"),o(c)):n(c)}function o(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||be(c)?(e.exit("atxHeading"),t(c)):Ae(c)?Re(e,o,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),o(c))}function u(c){return c===null||c===35||ft(c)?(e.exit("atxHeadingText"),o(c)):(e.consume(c),u)}}const Z1=["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"],Fl=["pre","script","style","textarea"],Y1={name:"htmlFlow",tokenize:X1,resolveTo:J1,concrete:!0},G1={tokenize:tD,partial:!0},Q1={tokenize:eD,partial:!0};function J1(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 X1(e,t,n){const r=this;let a,i,s,o,l;return u;function u(_){return c(_)}function c(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),f}function f(_){return _===33?(e.consume(_),m):_===47?(e.consume(_),i=!0,h):_===63?(e.consume(_),a=3,r.interrupt?t:D):jt(_)?(e.consume(_),s=String.fromCharCode(_),y):n(_)}function m(_){return _===45?(e.consume(_),a=2,p):_===91?(e.consume(_),a=5,o=0,g):jt(_)?(e.consume(_),a=4,r.interrupt?t:D):n(_)}function p(_){return _===45?(e.consume(_),r.interrupt?t:D):n(_)}function g(_){const S="CDATA[";return _===S.charCodeAt(o++)?(e.consume(_),o===S.length?r.interrupt?t:w:g):n(_)}function h(_){return jt(_)?(e.consume(_),s=String.fromCharCode(_),y):n(_)}function y(_){if(_===null||_===47||_===62||ft(_)){const S=_===47,z=s.toLowerCase();return!S&&!i&&Fl.includes(z)?(a=1,r.interrupt?t(_):w(_)):Z1.includes(s.toLowerCase())?(a=6,S?(e.consume(_),v):r.interrupt?t(_):w(_)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?x(_):B(_))}return _===45||_t(_)?(e.consume(_),s+=String.fromCharCode(_),y):n(_)}function v(_){return _===62?(e.consume(_),r.interrupt?t:w):n(_)}function x(_){return Ae(_)?(e.consume(_),x):T(_)}function B(_){return _===47?(e.consume(_),T):_===58||_===95||jt(_)?(e.consume(_),k):Ae(_)?(e.consume(_),B):T(_)}function k(_){return _===45||_===46||_===58||_===95||_t(_)?(e.consume(_),k):E(_)}function E(_){return _===61?(e.consume(_),A):Ae(_)?(e.consume(_),E):B(_)}function A(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,j):Ae(_)?(e.consume(_),A):L(_)}function j(_){return _===l?(e.consume(_),l=null,I):_===null||be(_)?n(_):(e.consume(_),j)}function L(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||ft(_)?E(_):(e.consume(_),L)}function I(_){return _===47||_===62||Ae(_)?B(_):n(_)}function T(_){return _===62?(e.consume(_),O):n(_)}function O(_){return _===null||be(_)?w(_):Ae(_)?(e.consume(_),O):n(_)}function w(_){return _===45&&a===2?(e.consume(_),K):_===60&&a===1?(e.consume(_),V):_===62&&a===4?(e.consume(_),q):_===63&&a===3?(e.consume(_),D):_===93&&a===5?(e.consume(_),ne):be(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(G1,ee,F)(_)):_===null||be(_)?(e.exit("htmlFlowData"),F(_)):(e.consume(_),w)}function F(_){return e.check(Q1,R,ee)(_)}function R(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),M}function M(_){return _===null||be(_)?F(_):(e.enter("htmlFlowData"),w(_))}function K(_){return _===45?(e.consume(_),D):w(_)}function V(_){return _===47?(e.consume(_),s="",oe):w(_)}function oe(_){if(_===62){const S=s.toLowerCase();return Fl.includes(S)?(e.consume(_),q):w(_)}return jt(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),oe):w(_)}function ne(_){return _===93?(e.consume(_),D):w(_)}function D(_){return _===62?(e.consume(_),q):_===45&&a===2?(e.consume(_),D):w(_)}function q(_){return _===null||be(_)?(e.exit("htmlFlowData"),ee(_)):(e.consume(_),q)}function ee(_){return e.exit("htmlFlow"),t(_)}}function eD(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 tD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Za,t,n)}}const nD={name:"htmlText",tokenize:rD};function rD(e,t,n){const r=this;let a,i,s;return o;function o(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),l}function l(D){return D===33?(e.consume(D),u):D===47?(e.consume(D),E):D===63?(e.consume(D),B):jt(D)?(e.consume(D),L):n(D)}function u(D){return D===45?(e.consume(D),c):D===91?(e.consume(D),i=0,g):jt(D)?(e.consume(D),x):n(D)}function c(D){return D===45?(e.consume(D),p):n(D)}function f(D){return D===null?n(D):D===45?(e.consume(D),m):be(D)?(s=f,V(D)):(e.consume(D),f)}function m(D){return D===45?(e.consume(D),p):f(D)}function p(D){return D===62?K(D):D===45?m(D):f(D)}function g(D){const q="CDATA[";return D===q.charCodeAt(i++)?(e.consume(D),i===q.length?h:g):n(D)}function h(D){return D===null?n(D):D===93?(e.consume(D),y):be(D)?(s=h,V(D)):(e.consume(D),h)}function y(D){return D===93?(e.consume(D),v):h(D)}function v(D){return D===62?K(D):D===93?(e.consume(D),v):h(D)}function x(D){return D===null||D===62?K(D):be(D)?(s=x,V(D)):(e.consume(D),x)}function B(D){return D===null?n(D):D===63?(e.consume(D),k):be(D)?(s=B,V(D)):(e.consume(D),B)}function k(D){return D===62?K(D):B(D)}function E(D){return jt(D)?(e.consume(D),A):n(D)}function A(D){return D===45||_t(D)?(e.consume(D),A):j(D)}function j(D){return be(D)?(s=j,V(D)):Ae(D)?(e.consume(D),j):K(D)}function L(D){return D===45||_t(D)?(e.consume(D),L):D===47||D===62||ft(D)?I(D):n(D)}function I(D){return D===47?(e.consume(D),K):D===58||D===95||jt(D)?(e.consume(D),T):be(D)?(s=I,V(D)):Ae(D)?(e.consume(D),I):K(D)}function T(D){return D===45||D===46||D===58||D===95||_t(D)?(e.consume(D),T):O(D)}function O(D){return D===61?(e.consume(D),w):be(D)?(s=O,V(D)):Ae(D)?(e.consume(D),O):I(D)}function w(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),a=D,F):be(D)?(s=w,V(D)):Ae(D)?(e.consume(D),w):(e.consume(D),R)}function F(D){return D===a?(e.consume(D),a=void 0,M):D===null?n(D):be(D)?(s=F,V(D)):(e.consume(D),F)}function R(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||ft(D)?I(D):(e.consume(D),R)}function M(D){return D===47||D===62||ft(D)?I(D):n(D)}function K(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function V(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),oe}function oe(D){return Ae(D)?Re(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):ne(D)}function ne(D){return e.enter("htmlTextData"),s(D)}}const oo={name:"labelEnd",tokenize:lD,resolveTo:uD,resolveAll:oD},aD={tokenize:cD},iD={tokenize:dD},sD={tokenize:fD};function oD(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 uD(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},c={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=Dt(o,e.slice(i+1,i+r+3)),o=Dt(o,[["enter",c,t]]),o=Dt(o,so(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=Dt(o,[["exit",c,t],e[s-2],e[s-1],["exit",u,t]]),o=Dt(o,e.slice(s+1)),o=Dt(o,[["exit",l,t]]),Pt(e,i,e.length,o),e}function lD(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(m){return i?i._inactive?f(m):(s=r.parser.defined.includes(zn(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):n(m)}function l(m){return m===40?e.attempt(aD,c,s?c:f)(m):m===91?e.attempt(iD,c,s?u:f)(m):s?c(m):f(m)}function u(m){return e.attempt(sD,c,f)(m)}function c(m){return t(m)}function f(m){return i._balanced=!0,n(m)}}function cD(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),a}function a(f){return ft(f)?br(e,i)(f):i(f)}function i(f){return f===41?c(f):Gd(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return ft(f)?br(e,l)(f):c(f)}function o(f){return n(f)}function l(f){return f===34||f===39||f===40?Jd(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):c(f)}function u(f){return ft(f)?br(e,c)(f):c(f)}function c(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function dD(e,t,n){const r=this;return a;function a(o){return Qd.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(zn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function fD(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 hD={name:"labelStartImage",tokenize:mD,resolveAll:oo.resolveAll};function mD(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 pD={name:"labelStartLink",tokenize:gD,resolveAll:oo.resolveAll};function gD(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 Fi={name:"lineEnding",tokenize:vD};function vD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Re(e,t,"linePrefix")}}const ha={name:"thematicBreak",tokenize:bD};function bD(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||be(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Ae(u)?Re(e,o,"whitespace")(u):o(u))}}const lt={name:"list",tokenize:CD,continuation:{tokenize:xD},exit:ED},yD={tokenize:kD,partial:!0},DD={tokenize:wD,partial:!0};function CD(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Es(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ha,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Es(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Za,r.interrupt?n:c,e.attempt(yD,m,f))}function c(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function f(p){return Ae(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function xD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Za,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Re(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Ae(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(DD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Re(e,e.attempt(lt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function wD(e,t,n){const r=this;return Re(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 ED(e){e.exit(this.containerState.type)}function kD(e,t,n){const r=this;return Re(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!Ae(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Tl={name:"setextUnderline",tokenize:BD,resolveTo:_D};function _D(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 BD(e,t,n){const r=this;let a;return i;function i(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Ae(u)?Re(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||be(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const AD={tokenize:FD};function FD(e){const t=this,n=e.attempt(Za,r,e.attempt(this.parser.constructs.flowInitial,a,Re(e,e.attempt(this.parser.constructs.flow,a,e.attempt(P1,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 TD={resolveAll:ef()},SD=Xd("string"),jD=Xd("text");function Xd(e){return{tokenize:t,resolveAll:ef(e==="text"?OD:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(c){return u(c)?i(c):o(c)}function o(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const f=a[c];let m=-1;if(f)for(;++m<f.length;){const p=f[m];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function ef(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 OD(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 PD(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:x,enter:B,exit:k,attempt:j(E),check:j(A),interrupt:j(A,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:m,now:g,defineSkip:h,write:f};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function f(O){return s=Dt(s,O),y(),s[s.length-1]!==null?[]:(L(t,0),u.events=so(i,u.events,u),u.events)}function m(O,w){return RD(p(O),w)}function p(O){return ND(s,O)}function g(){const{line:O,column:w,offset:F,_index:R,_bufferIndex:M}=r;return{line:O,column:w,offset:F,_index:R,_bufferIndex:M}}function h(O){a[O.line]=O.column,T()}function y(){let O;for(;r._index<s.length;){const w=s[r._index];if(typeof w=="string")for(O=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===O&&r._bufferIndex<w.length;)v(w.charCodeAt(r._bufferIndex));else v(w)}}function v(O){c=c(O)}function x(O){be(O)?(r.line++,r.column=1,r.offset+=O===-3?2:1,T()):O!==-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=O}function B(O,w){const F=w||{};return F.type=O,F.start=g(),u.events.push(["enter",F,u]),o.push(F),F}function k(O){const w=o.pop();return w.end=g(),u.events.push(["exit",w,u]),w}function E(O,w){L(O,w.from)}function A(O,w){w.restore()}function j(O,w){return F;function F(R,M,K){let V,oe,ne,D;return Array.isArray(R)?ee(R):"tokenize"in R?ee([R]):q(R);function q($){return U;function U(re){const te=re!==null&&$[re],Y=re!==null&&$.null,le=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(Y)?Y:Y?[Y]:[]];return ee(le)(re)}}function ee($){return V=$,oe=0,$.length===0?K:_($[oe])}function _($){return U;function U(re){return D=I(),ne=$,$.partial||(u.currentConstruct=$),$.name&&u.parser.constructs.disable.null.includes($.name)?z():$.tokenize.call(w?Object.assign(Object.create(u),w):u,l,S,z)(re)}}function S($){return O(ne,D),M}function z($){return D.restore(),++oe<V.length?_(V[oe]):K}}}function L(O,w){O.resolveAll&&!i.includes(O)&&i.push(O),O.resolve&&Pt(u.events,w,u.events.length-w,O.resolve(u.events.slice(w),u)),O.resolveTo&&(u.events=O.resolveTo(u.events,u))}function I(){const O=g(),w=u.previous,F=u.currentConstruct,R=u.events.length,M=Array.from(o);return{restore:K,from:R};function K(){r=O,u.previous=w,u.currentConstruct=F,u.events.length=R,o=M,T()}}function T(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function ND(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 RD(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
|
|
113
113
|
`;break}case-3:{s=`\r
|
|
114
|
-
`;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const MD={42:ot,43:ot,45:ot,48:ot,49:ot,50:ot,51:ot,52:ot,53:ot,54:ot,55:ot,56:ot,57:ot,62:Wd},ID={91:$1},$D={[-2]:Ei,[-1]:Ei,32:Ei},LD={35:U1,42:ua,45:[El,ua],60:Y1,61:El,95:ua,96:xl,126:xl},zD={38:Ud,92:Hd},qD={[-5]:_i,[-4]:_i,[-3]:_i,33:hD,38:Ud,42:Cs,60:[g1,nD],91:pD,92:[W1,Hd],93:ro,95:Cs,96:F1},WD={null:[Cs,TD]},HD={null:[42,95]},UD={null:[]},VD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:HD,contentInitial:ID,disable:UD,document:MD,flow:LD,flowInitial:$D,insideSpan:WD,string:zD,text:qD},Symbol.toStringTag,{value:"Module"}));function KD(e){const n=t1([VD,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(l1),document:a(d1),flow:a(AD),string:a(SD),text:a(jD)};return r;function a(i){return s;function s(o){return PD(r,i,o)}}}function ZD(e){for(;!Vd(e););return e}const _l=/[\0\t\n\r]/g;function YD(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,f,m,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(_l.lastIndex=f,u=_l.exec(i),m=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(m),!u){t=i.slice(f);break}if(p===10&&f===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<m&&(l.push(i.slice(f,m)),e+=m-f),p){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=m+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const GD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function QD(e){return e.replace(GD,JD)}function JD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return qd(n.slice(i?2:1),i?16:10)}return to(n)||e}const Jd={}.hasOwnProperty;function XD(e,t,n){return typeof t!="string"&&(n=t,t=void 0),eC(n)(ZD(KD(n).document().write(YD()(e,t,!0))))}function eC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ge),autolinkProtocol:I,autolinkEmail:I,atxHeading:i(me),blockQuote:i(ee),characterEscape:I,characterReference:I,codeFenced:i(Y),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(Y,s),codeText:i(ue,s),codeTextData:I,data:I,codeFlowValue:I,definition:i(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ge),hardBreakEscape:i(_e),hardBreakTrailing:i(_e),htmlFlow:i(Se,s),htmlFlowData:I,htmlText:i(Se,s),htmlTextData:I,image:i(Pe),label:s,link:i(Ge),listItem:i(Ze),listItemValue:m,listOrdered:i(Ke,f),listUnordered:i(Ke),paragraph:i(tt),reference:k,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(me),strong:i(Ae),thematicBreak:i(Le)},exit:{atxHeading:l(),atxHeadingSequence:_,autolink:l(),autolinkEmail:te,autolinkProtocol:U,blockQuote:l(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:z,characterReferenceMarkerNumeric:z,characterReferenceValue:L,codeFenced:l(y),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:j,codeIndented:l(b),codeText:l(M),codeTextData:j,data:j,definition:l(),definitionDestinationString:E,definitionLabelString:x,definitionTitleString:B,emphasis:l(),hardBreakEscape:l(w),hardBreakTrailing:l(w),htmlFlow:l(F),htmlFlowData:j,htmlText:l(N),htmlTextData:j,image:l(K),label:ne,labelText:se,lineEnding:R,link:l(Z),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:S,resourceDestinationString:D,resourceTitleString:q,resource:X,setextHeading:l($),setextHeadingLineSequence:A,setextHeadingText:T,strong:l(),thematicBreak:l()}};Xd(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(H){let ae={type:"root",children:[]};const fe={stack:[ae],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:c,data:n},pe=[];let De=-1;for(;++De<H.length;)if(H[De][1].type==="listOrdered"||H[De][1].type==="listUnordered")if(H[De][0]==="enter")pe.push(De);else{const Ue=pe.pop();De=a(H,Ue,De)}for(De=-1;++De<H.length;){const Ue=t[H[De][0]];Jd.call(Ue,H[De][1].type)&&Ue[H[De][1].type].call(Object.assign({sliceSerialize:H[De][2].sliceSerialize},fe),H[De][1])}if(fe.tokenStack.length>0){const Ue=fe.tokenStack[fe.tokenStack.length-1];(Ue[1]||kl).call(fe,void 0,Ue[0])}for(ae.position={start:Ut(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:Ut(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},De=-1;++De<t.transforms.length;)ae=t.transforms[De](ae)||ae;return ae}function a(H,ae,fe){let pe=ae-1,De=-1,Ue=!1,Ve,ft,Pt,xt;for(;++pe<=fe;){const Qe=H[pe];switch(Qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Qe[0]==="enter"?De++:De--,xt=void 0;break}case"lineEndingBlank":{Qe[0]==="enter"&&(Ve&&!xt&&!De&&!Pt&&(Pt=pe),xt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:xt=void 0}if(!De&&Qe[0]==="enter"&&Qe[1].type==="listItemPrefix"||De===-1&&Qe[0]==="exit"&&(Qe[1].type==="listUnordered"||Qe[1].type==="listOrdered")){if(Ve){let _t=pe;for(ft=void 0;_t--;){const ht=H[_t];if(ht[1].type==="lineEnding"||ht[1].type==="lineEndingBlank"){if(ht[0]==="exit")continue;ft&&(H[ft][1].type="lineEndingBlank",Ue=!0),ht[1].type="lineEnding",ft=_t}else if(!(ht[1].type==="linePrefix"||ht[1].type==="blockQuotePrefix"||ht[1].type==="blockQuotePrefixWhitespace"||ht[1].type==="blockQuoteMarker"||ht[1].type==="listItemIndent"))break}Pt&&(!ft||Pt<ft)&&(Ve._spread=!0),Ve.end=Object.assign({},ft?H[ft][1].start:Qe[1].end),H.splice(ft||pe,0,["exit",Ve,Qe[2]]),pe++,fe++}if(Qe[1].type==="listItemPrefix"){const _t={type:"listItem",_spread:!1,start:Object.assign({},Qe[1].start),end:void 0};Ve=_t,H.splice(pe,0,["enter",_t,Qe[2]]),pe++,fe++,Pt=void 0,xt=!0}}}return H[ae][1]._spread=Ue,fe}function i(H,ae){return fe;function fe(pe){o.call(this,H(pe),pe),ae&&ae.call(this,pe)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(H,ae,fe){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([ae,fe]),H.position={start:Ut(ae.start),end:void 0}}function l(H){return ae;function ae(fe){H&&H.call(this,fe),u.call(this,fe)}}function u(H,ae){const fe=this.stack.pop(),pe=this.tokenStack.pop();if(pe)pe[0].type!==H.type&&(ae?ae.call(this,H,pe[0]):(pe[1]||kl).call(this,H,pe[0]));else throw new Error("Cannot close `"+H.type+"` ("+mr({start:H.start,end:H.end})+"): it’s not open");fe.position.end=Ut(H.end)}function c(){return Xy(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m(H){if(this.data.expectingFirstListItemValue){const ae=this.stack[this.stack.length-2];ae.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function p(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.lang=H}function g(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.meta=H}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H.replace(/(\r?\n|\r)$/g,"")}function x(H){const ae=this.resume(),fe=this.stack[this.stack.length-1];fe.label=ae,fe.identifier=In(this.sliceSerialize(H)).toLowerCase()}function B(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function E(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function _(H){const ae=this.stack[this.stack.length-1];if(!ae.depth){const fe=this.sliceSerialize(H).length;ae.depth=fe}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function A(H){const ae=this.stack[this.stack.length-1];ae.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function I(H){const fe=this.stack[this.stack.length-1].children;let pe=fe[fe.length-1];(!pe||pe.type!=="text")&&(pe=We(),pe.position={start:Ut(H.start),end:void 0},fe.push(pe)),this.stack.push(pe)}function j(H){const ae=this.stack.pop();ae.value+=this.sliceSerialize(H),ae.position.end=Ut(H.end)}function R(H){const ae=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=ae.children[ae.children.length-1];fe.position.end=Ut(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ae.type)&&(I.call(this,H),j.call(this,H))}function w(){this.data.atHardBreak=!0}function F(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function N(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function M(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function Z(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ae,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function K(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ae=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ae,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function se(H){const ae=this.sliceSerialize(H),fe=this.stack[this.stack.length-2];fe.label=QD(ae),fe.identifier=In(ae).toLowerCase()}function ne(){const H=this.stack[this.stack.length-1],ae=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){const pe=H.children;fe.children=pe}else fe.alt=ae}function D(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function q(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function X(){this.data.inReference=void 0}function k(){this.data.referenceType="collapsed"}function S(H){const ae=this.resume(),fe=this.stack[this.stack.length-1];fe.label=ae,fe.identifier=In(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function z(H){this.data.characterReferenceType=H.type}function L(H){const ae=this.sliceSerialize(H),fe=this.data.characterReferenceType;let pe;fe?(pe=qd(ae,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):pe=to(ae);const De=this.stack.pop();De.value+=pe,De.position.end=Ut(H.end)}function U(H){j.call(this,H);const ae=this.stack[this.stack.length-1];ae.url=this.sliceSerialize(H)}function te(H){j.call(this,H);const ae=this.stack[this.stack.length-1];ae.url="mailto:"+this.sliceSerialize(H)}function ee(){return{type:"blockquote",children:[]}}function Y(){return{type:"code",lang:null,meta:null,value:""}}function ue(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ge(){return{type:"emphasis",children:[]}}function me(){return{type:"heading",depth:0,children:[]}}function _e(){return{type:"break"}}function Se(){return{type:"html",value:""}}function Pe(){return{type:"image",title:null,url:"",alt:null}}function Ge(){return{type:"link",title:null,url:"",children:[]}}function Ke(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function Ze(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function tt(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function We(){return{type:"text",value:""}}function Le(){return{type:"thematicBreak"}}}function Ut(e){return{line:e.line,column:e.column,offset:e.offset}}function Xd(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Xd(e,r):tC(e,r)}}function tC(e,t){let n;for(n in t)if(Jd.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 kl(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+mr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+mr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+mr({start:t.start,end:t.end})+") is still open")}function nC(e){const t=this;t.parser=n;function n(r){return XD(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function ef(e,t){var l,u,c;const n={...Pn,...t==null?void 0:t.nodeTypes,heading:{...Pn.heading,...(l=t==null?void 0:t.nodeTypes)==null?void 0:l.heading}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(f=>ef({...f,ordered:e.ordered||!1},t))),e.type){case"heading":return{type:n.heading[e.depth||1],children:s};case"list":return{type:e.ordered?n.ol_list:n.ul_list,children:s};case"listItem":return{type:n.listItem,children:s};case"paragraph":return{type:n.paragraph,children:s};case"link":return{type:n.link,[r]:e.url,children:s};case"image":return{type:n.image,children:[{text:""}],[a]:e.url,[i]:e.alt};case"blockquote":return{type:n.block_quote,children:s};case"code":return{type:n.code_block,language:e.lang,children:[{text:e.value}]};case"html":return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n.paragraph,children:[{text:((c=e.value)==null?void 0:c.replace(/<br>/g,""))||""}]}:{type:"paragraph",children:[{text:e.value||""}]};case"emphasis":return{[n.emphasis_mark]:!0,...ki(s),...Vr(s)};case"strong":return{[n.strong_mark]:!0,...ki(s),...Vr(s)};case"delete":return{[n.delete_mark]:!0,...ki(s),...Vr(s)};case"inlineCode":return{[n.inline_code_mark]:!0,text:e.value,...Vr(s)};case"thematicBreak":return{type:n.thematic_break,children:[{text:""}]};case"text":default:return{text:e.value||""}}}const ki=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Vr(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const rC=function(t){const n=r=>r.children.map(a=>ef(a,t));this.Compiler=n},aC=(e,t=n=>{})=>{Zy().use(nC).use(rC).process(e).then(n=>{const r=cn(n.result),a=i=>{const s=i;["list_item","block_quote"].includes(s.type)&&s.children.map((o,l)=>{const u=o;u.type==="paragraph"&&s.children.splice(l,1,...u.children)}),"children"in i&&i.children&&i.children.forEach(o=>a(o))};r.forEach(a),r.map(i=>{"children"in i&&i.children&&i.children.map((s,o)=>{if("text"in s&&s.text){const l=s.text.match(/~~(.*?)~~/g);l&&l.map(u=>{const c=u.replace(/~~/g,""),f=s.text.indexOf(u),m=s.text.substring(0,f),p=s.text.substring(f+u.length),g=[{text:m},{text:c,strikeThrough:!0},{text:p}];i.children.splice(o,1,...g)})}})}),t(r)})},Bl={"mod+b":"bold","mod+i":"italic","mod+shift+x":"strikeThrough","mod+k":"link","mod+shift+7":"ol_list","mod+shift+8":"ul_list","mod+shift+9":"block_quote"},Bn=e=>typeof e.text=="string",iC=["thematic_break","image"],Al="<br>";function tf(e,t={nodeTypes:Pn}){const{nodeTypes:n=Pn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Pn,...n,heading:{...Pn.heading,...n.heading}},l=[o.ul_list,o.ol_list];let u=i;if(Bn(e)||(u=e.children.map(c=>{const f=Bn(c)?!1:l.includes(c.type||""),m=l.includes(e.type||"");let p=!1;return!Bn(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!Bn(g)&&g.type===o.link)),tf({...c,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||f||m||p)&&!c.break,listDepth:l.includes(c.type||"")?a+1:a,inBlockquote:s===o.block_quote||e.parentType===o.block_quote})}).join("")),!r&&(i===""||i===`
|
|
115
|
-
`)&&e.parentType===o.paragraph&&(s=o.paragraph,u=
|
|
116
|
-
`;case o.heading[2]:return`## ${u}
|
|
117
|
-
`;case o.heading[3]:return`### ${u}
|
|
118
|
-
`;case o.heading[4]:return`#### ${u}
|
|
119
|
-
`;case o.heading[5]:return`##### ${u}
|
|
120
|
-
`;case o.heading[6]:return`###### ${u}
|
|
121
|
-
`;case o.
|
|
122
|
-
|
|
123
|
-
`;case o.
|
|
114
|
+
`;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const MD={42:lt,43:lt,45:lt,48:lt,49:lt,50:lt,51:lt,52:lt,53:lt,54:lt,55:lt,56:lt,57:lt,62:Vd},ID={91:$1},$D={[-2]:Ai,[-1]:Ai,32:Ai},LD={35:U1,42:ha,45:[Tl,ha],60:Y1,61:Tl,95:ha,96:Al,126:Al},zD={38:Zd,92:Kd},qD={[-5]:Fi,[-4]:Fi,[-3]:Fi,33:hD,38:Zd,42:ks,60:[g1,nD],91:pD,92:[W1,Kd],93:oo,95:ks,96:F1},WD={null:[ks,TD]},HD={null:[42,95]},UD={null:[]},VD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:HD,contentInitial:ID,disable:UD,document:MD,flow:LD,flowInitial:$D,insideSpan:WD,string:zD,text:qD},Symbol.toStringTag,{value:"Module"}));function KD(e){const n=t1([VD,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(l1),document:a(d1),flow:a(AD),string:a(SD),text:a(jD)};return r;function a(i){return s;function s(o){return PD(r,i,o)}}}function ZD(e){for(;!Yd(e););return e}const Sl=/[\0\t\n\r]/g;function YD(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,f,m,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(Sl.lastIndex=f,u=Sl.exec(i),m=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(m),!u){t=i.slice(f);break}if(p===10&&f===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<m&&(l.push(i.slice(f,m)),e+=m-f),p){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=m+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const GD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function QD(e){return e.replace(GD,JD)}function JD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Ud(n.slice(i?2:1),i?16:10)}return io(n)||e}const tf={}.hasOwnProperty;function XD(e,t,n){return typeof t!="string"&&(n=t,t=void 0),eC(n)(ZD(KD(n).document().write(YD()(e,t,!0))))}function eC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Qe),autolinkProtocol:I,autolinkEmail:I,atxHeading:i(pe),blockQuote:i(te),characterEscape:I,characterReference:I,codeFenced:i(Y),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(Y,s),codeText:i(le,s),codeTextData:I,data:I,codeFlowValue:I,definition:i(X),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ve),hardBreakEscape:i(_e),hardBreakTrailing:i(_e),htmlFlow:i(je,s),htmlFlowData:I,htmlText:i(je,s),htmlTextData:I,image:i(Ne),label:s,link:i(Qe),listItem:i(Ye),listItemValue:m,listOrdered:i(Ze,f),listUnordered:i(Ze),paragraph:i(nt),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(pe),strong:i(Fe),thematicBreak:i(ze)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:re,autolinkProtocol:U,blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:z,characterReferenceMarkerNumeric:z,characterReferenceValue:$,codeFenced:l(y),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:T,codeIndented:l(v),codeText:l(M),codeTextData:T,data:T,definition:l(),definitionDestinationString:k,definitionLabelString:x,definitionTitleString:B,emphasis:l(),hardBreakEscape:l(w),hardBreakTrailing:l(w),htmlFlow:l(F),htmlFlowData:T,htmlText:l(R),htmlTextData:T,image:l(V),label:ne,labelText:oe,lineEnding:O,link:l(K),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:S,resourceDestinationString:D,resourceTitleString:q,resource:ee,setextHeading:l(L),setextHeadingLineSequence:j,setextHeadingText:A,strong:l(),thematicBreak:l()}};nf(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(H){let ie={type:"root",children:[]};const he={stack:[ie],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:c,data:n},ge=[];let Ce=-1;for(;++Ce<H.length;)if(H[Ce][1].type==="listOrdered"||H[Ce][1].type==="listUnordered")if(H[Ce][0]==="enter")ge.push(Ce);else{const Ve=ge.pop();Ce=a(H,Ve,Ce)}for(Ce=-1;++Ce<H.length;){const Ve=t[H[Ce][0]];tf.call(Ve,H[Ce][1].type)&&Ve[H[Ce][1].type].call(Object.assign({sliceSerialize:H[Ce][2].sliceSerialize},he),H[Ce][1])}if(he.tokenStack.length>0){const Ve=he.tokenStack[he.tokenStack.length-1];(Ve[1]||jl).call(he,void 0,Ve[0])}for(ie.position={start:Zt(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:Zt(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},Ce=-1;++Ce<t.transforms.length;)ie=t.transforms[Ce](ie)||ie;return ie}function a(H,ie,he){let ge=ie-1,Ce=-1,Ve=!1,Ke,mt,Rt,Et;for(;++ge<=he;){const Je=H[ge];switch(Je[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Je[0]==="enter"?Ce++:Ce--,Et=void 0;break}case"lineEndingBlank":{Je[0]==="enter"&&(Ke&&!Et&&!Ce&&!Rt&&(Rt=ge),Et=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Et=void 0}if(!Ce&&Je[0]==="enter"&&Je[1].type==="listItemPrefix"||Ce===-1&&Je[0]==="exit"&&(Je[1].type==="listUnordered"||Je[1].type==="listOrdered")){if(Ke){let Bt=ge;for(mt=void 0;Bt--;){const pt=H[Bt];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;mt&&(H[mt][1].type="lineEndingBlank",Ve=!0),pt[1].type="lineEnding",mt=Bt}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}Rt&&(!mt||Rt<mt)&&(Ke._spread=!0),Ke.end=Object.assign({},mt?H[mt][1].start:Je[1].end),H.splice(mt||ge,0,["exit",Ke,Je[2]]),ge++,he++}if(Je[1].type==="listItemPrefix"){const Bt={type:"listItem",_spread:!1,start:Object.assign({},Je[1].start),end:void 0};Ke=Bt,H.splice(ge,0,["enter",Bt,Je[2]]),ge++,he++,Rt=void 0,Et=!0}}}return H[ie][1]._spread=Ve,he}function i(H,ie){return he;function he(ge){o.call(this,H(ge),ge),ie&&ie.call(this,ge)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(H,ie,he){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([ie,he]),H.position={start:Zt(ie.start),end:void 0}}function l(H){return ie;function ie(he){H&&H.call(this,he),u.call(this,he)}}function u(H,ie){const he=this.stack.pop(),ge=this.tokenStack.pop();if(ge)ge[0].type!==H.type&&(ie?ie.call(this,H,ge[0]):(ge[1]||jl).call(this,H,ge[0]));else throw new Error("Cannot close `"+H.type+"` ("+vr({start:H.start,end:H.end})+"): it’s not open");he.position.end=Zt(H.end)}function c(){return Xy(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m(H){if(this.data.expectingFirstListItemValue){const ie=this.stack[this.stack.length-2];ie.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function p(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.lang=H}function g(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.meta=H}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.value=H.replace(/(\r?\n|\r)$/g,"")}function x(H){const ie=this.resume(),he=this.stack[this.stack.length-1];he.label=ie,he.identifier=zn(this.sliceSerialize(H)).toLowerCase()}function B(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.title=H}function k(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.url=H}function E(H){const ie=this.stack[this.stack.length-1];if(!ie.depth){const he=this.sliceSerialize(H).length;ie.depth=he}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function j(H){const ie=this.stack[this.stack.length-1];ie.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function I(H){const he=this.stack[this.stack.length-1].children;let ge=he[he.length-1];(!ge||ge.type!=="text")&&(ge=He(),ge.position={start:Zt(H.start),end:void 0},he.push(ge)),this.stack.push(ge)}function T(H){const ie=this.stack.pop();ie.value+=this.sliceSerialize(H),ie.position.end=Zt(H.end)}function O(H){const ie=this.stack[this.stack.length-1];if(this.data.atHardBreak){const he=ie.children[ie.children.length-1];he.position.end=Zt(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ie.type)&&(I.call(this,H),T.call(this,H))}function w(){this.data.atHardBreak=!0}function F(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.value=H}function R(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.value=H}function M(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.value=H}function K(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ie,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function V(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=ie,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function oe(H){const ie=this.sliceSerialize(H),he=this.stack[this.stack.length-2];he.label=QD(ie),he.identifier=zn(ie).toLowerCase()}function ne(){const H=this.stack[this.stack.length-1],ie=this.resume(),he=this.stack[this.stack.length-1];if(this.data.inReference=!0,he.type==="link"){const ge=H.children;he.children=ge}else he.alt=ie}function D(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.url=H}function q(){const H=this.resume(),ie=this.stack[this.stack.length-1];ie.title=H}function ee(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function S(H){const ie=this.resume(),he=this.stack[this.stack.length-1];he.label=ie,he.identifier=zn(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function z(H){this.data.characterReferenceType=H.type}function $(H){const ie=this.sliceSerialize(H),he=this.data.characterReferenceType;let ge;he?(ge=Ud(ie,he==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ge=io(ie);const Ce=this.stack.pop();Ce.value+=ge,Ce.position.end=Zt(H.end)}function U(H){T.call(this,H);const ie=this.stack[this.stack.length-1];ie.url=this.sliceSerialize(H)}function re(H){T.call(this,H);const ie=this.stack[this.stack.length-1];ie.url="mailto:"+this.sliceSerialize(H)}function te(){return{type:"blockquote",children:[]}}function Y(){return{type:"code",lang:null,meta:null,value:""}}function le(){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 je(){return{type:"html",value:""}}function Ne(){return{type:"image",title:null,url:"",alt:null}}function Qe(){return{type:"link",title:null,url:"",children:[]}}function Ze(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function Ye(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function nt(){return{type:"paragraph",children:[]}}function Fe(){return{type:"strong",children:[]}}function He(){return{type:"text",value:""}}function ze(){return{type:"thematicBreak"}}}function Zt(e){return{line:e.line,column:e.column,offset:e.offset}}function nf(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?nf(e,r):tC(e,r)}}function tC(e,t){let n;for(n in t)if(tf.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 jl(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+vr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+vr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+vr({start:t.start,end:t.end})+") is still open")}function nC(e){const t=this;t.parser=n;function n(r){return XD(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function rf(e,t){var l,u,c;const n={...In,...t==null?void 0:t.nodeTypes,[G.heading]:{...In[G.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[G.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(f=>rf({...f,ordered:e.ordered||!1},t))),e.type){case it.heading:return{type:n[G.heading][e.depth||1],children:s};case it.list:return{type:e.ordered?n[G.ol]:n[G.ul],children:s};case it.listItem:return{type:n[G.li],children:s};case it.paragraph:return{type:n[G.paragraph],children:s};case it.link:return{type:n[G.link],[r]:e.url,children:s};case it.image:return{type:n[G.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case it.blockquote:return{type:n[G.blockquote],children:s};case it.code:return{type:n[G.codeblock],language:e.lang,children:[{text:e.value}]};case it.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[G.paragraph],children:[{text:((c=e.value)==null?void 0:c.replace(/<br>/g,""))||""}]}:{type:G.paragraph,children:[{text:e.value||""}]};case it.emphasis:return{[n[qt.emphasis]]:!0,...Ti(s),...Gr(s)};case it.strong:return{[n[qt.strong]]:!0,...Ti(s),...Gr(s)};case it.delete:return{[n[qt.delete]]:!0,...Ti(s),...Gr(s)};case it.inlineCode:return{[n[qt.code]]:!0,text:e.value,...Gr(s)};case it.thematicBreak:return{type:n[G.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Ti=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Gr(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const rC=function(t){const n=r=>r.children.map(a=>rf(a,t));this.Compiler=n},aC=(e,t=n=>{})=>{Zy().use(nC).use(rC).process(e).then(n=>{const r=mn(n.result),a=i=>{const s=i;[G.li,G.blockquote].includes(s.type)&&s.children.map((o,l)=>{const u=o;u.type===G.paragraph&&s.children.splice(l,1,...u.children)}),"children"in i&&i.children&&i.children.forEach(o=>a(o))};r.forEach(a),r.map(i=>{"children"in i&&i.children&&i.children.map((s,o)=>{if("text"in s&&s.text){const l=s.text.match(/~~(.*?)~~/g);l&&l.map(u=>{const c=u.replace(/~~/g,""),f=s.text.indexOf(u),m=s.text.substring(0,f),p=s.text.substring(f+u.length),g=[{text:m},{text:c,[G.strikethrough]:!0},{text:p}];i.children.splice(o,1,...g)})}})}),t(r)})},iC=e=>{const{selection:t}=e;return t?b.string(e,t):null},Ol=e=>{let t="";for(const n of se.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},Pl={"mod+b":G.bold,"mod+i":G.italic,"mod+shift+x":G.strikethrough,"mod+k":G.link,"mod+shift+7":G.ol,"mod+shift+8":G.ul,"mod+shift+9":G.blockquote},sC=(e,t,n,r)=>{for(const a in Pl)if(G0(a,e)){e.stopPropagation(),e.preventDefault();const i=Pl[a];if(i===G.link){n([{type:"showLinkEditor",value:!0}]);return}if(hC(i)){lf(t,i,r);return}qd(t,i,r)}},Sn=e=>typeof e.text=="string",oC=[G.hr,G.image],Nl="<br>";function af(e,t={nodeTypes:In}){const{nodeTypes:n=In,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...In,...n,heading:{...In[G.heading],...n[G.heading]}},l=[o[G.ul],o[G.ol]];let u=i;if(Sn(e)||(u=e.children.map(c=>{const f=Sn(c)?!1:l.includes(c.type||""),m=l.includes(e.type||"");let p=!1;return!Sn(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!Sn(g)&&g.type===o.link)),af({...c,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||f||m||p)&&!c.break,listDepth:l.includes(c.type||"")?a+1:a,inBlockquote:s===o[G.blockquote]||e.parentType===o[G.blockquote]})}).join("")),!r&&(i===""||i===`
|
|
115
|
+
`)&&e.parentType===o[G.paragraph]&&(s=o[G.paragraph],u=Nl),!(u===""&&!oC.find(c=>o[c]===s)))switch(u!==Nl&&Sn(e)&&(e[G.strikethrough]&&e[G.bold]&&e[G.italic]?u=jn(u,"~~***"):e[G.bold]&&e[G.italic]?u=jn(u,"***"):(e[G.bold]&&(u=jn(u,"**")),e[G.italic]&&(u=jn(u,"_")),e[G.strikethrough]&&(u=jn(u,"~~")),e[G.code]&&(u=jn(u,"`")))),s){case o[G.heading][1]:return`# ${u}
|
|
116
|
+
`;case o[G.heading][2]:return`## ${u}
|
|
117
|
+
`;case o[G.heading][3]:return`### ${u}
|
|
118
|
+
`;case o[G.heading][4]:return`#### ${u}
|
|
119
|
+
`;case o[G.heading][5]:return`##### ${u}
|
|
120
|
+
`;case o[G.heading][6]:return`###### ${u}
|
|
121
|
+
`;case o[G.blockquote]:return`> ${u}
|
|
122
|
+
|
|
123
|
+
`;case o[G.codeblock]:return`\`\`\`${e.language||""}
|
|
124
124
|
${u}
|
|
125
125
|
\`\`\`
|
|
126
|
-
`;case o.link:return`[${u}](${e.link||""})`;case o.image:return``;case o.
|
|
126
|
+
`;case o[G.link]:return`[${u}](${e.link||""})`;case o.image:return``;case o[G.ul]:case o[G.ol]:return`
|
|
127
127
|
${u}
|
|
128
|
-
`;case o.
|
|
129
|
-
`:""}`;case o.paragraph:return`${u}
|
|
128
|
+
`;case o[G.li]:const c=e&&e.parentType===o[G.ol],f=e.children.length===1&&Sn(e.children[0]);let m="";for(let p=0;a>p;p++)c?m+=" ":m+=" ";return t.inBlockquote&&(m="> "+m),`${m}${c?"1.":"-"} ${u}${f?`
|
|
129
|
+
`:""}`;case o[G.paragraph]:return`${u}
|
|
130
130
|
|
|
131
|
-
`;case o.
|
|
132
|
-
`;default:return u}}function An(e,t){const n=e.trim(),r=n,a=`${t}${r}${Fl(t)}`;if(r.length===e.length)return a;const i=t+r+Fl(t);return e.replace(n,i)}const Fl=e=>e.split("").reverse().join(""),sC=e=>e.map(t=>tf(t)).join("").trim();var oC=dC,uC=/^(?:\w+:)?\/\/(\S+)$/,lC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,cC=/^[^\s\.]+\.\S{2,}$/;function dC(e){if(typeof e!="string")return!1;var t=e.match(uC);if(!t)return!1;var n=t[1];return n?!!(lC.test(n)||cC.test(n)):!1}const fC=bn(oC),hC=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return["link"].includes(s.type)||a(i)},e.insertText=i=>{i&&fC(i)?Xs(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},mC=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type==="link"&&ie.string(r).trim()===""){G.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const nf=({id:e="rich-text-editor",value:t,placeholder:n,functions:r,autoFocus:a=!0,...i})=>{const s=oe.useIntl(),o=mh(),{onChange:l=()=>{},reportError:u=$=>{console.error($)}}=r||{},c=[{type:"paragraph",children:[{text:""}]}],f={originalValue:t||"",initialValue:t?null:c,tabbableOption:Ca[0],openTooltip:null,showLinkEditor:!1,lastAnchor:null,lastKey:null,hasInteracted:!1},[m,p]=C.useReducer(Br,f),{originalValue:g,initialValue:h,lastAnchor:y,lastKey:b,hasInteracted:x}=m,B=$=>{const I=$||Ca[0];$&&p([{type:"tabbableOption",value:I}])};C.useEffect(()=>{if(t){let $=cn(t);$.includes("<")&&($=new ma().turndown($)),aC($,I=>{p([{type:"initialValue",value:I}])})}},[]),C.useEffect(()=>{t!==""||!A||ic(g,t)&&!x||(v.withoutNormalizing(A,()=>{G.delete(A,{at:{anchor:v.start(A,[]),focus:v.end(A,[])}}),G.deselect(A),A.children.length!==0&&G.unwrapNodes(A,{at:[0]}),G.insertNodes(A,c,{at:[0]})}),p([{type:"initialValue",value:c},{type:"lastAnchor",value:null}]))},[t]);const E=`rte-${e}`,_=C.useCallback($=>d.jsx(gy,{...$}),[]),T=C.useCallback($=>d.jsx(vy,{...$}),[]),A=C.useMemo(()=>hC(mC(ov(my(iv())),u),E,u),[]);return h?d.jsx("div",{id:E,className:"rich-text-editor",children:d.jsx(Cn.Provider,{value:{...m,id:E,setFocus:B,dispatch:p,reportError:u},children:d.jsxs(fy,{editor:A,initialValue:h,onChange:$=>{if(A.operations.some(j=>j.type!=="set_selection")){const j=sC($);l(j),x||p([{type:"hasInteracted",value:!0}]),o&&console.log({serialized:j,json:$})}},...i,children:[d.jsx(ry,{className:"input",renderElement:_,renderLeaf:T,placeholder:n||s.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:a,tabIndex:0,onKeyDown:$=>{if($.key==="Enter"){const{selection:I}=A;if(I){const j=W.isCollapsed(I),[R,w]=v.node(A,I,{depth:1});let F=R,N=F.type;const M=F.children[0];if(M&&["ol_list","ul_list"].includes(M.type)&&(F=M,N=M.type),F&&ce.isElement(F)&&N!=="paragraph"){if(N==="block_quote"&&!$.shiftKey){$.stopPropagation(),$.preventDefault(),G.insertNodes(A,c);return}if(j){const[Z]=v.parent(A,I,{edge:"end"}),se=Z.type;if(b==="Enter"&&se==="list_item"&&["ul_list","ol_list"].includes(N)){$.stopPropagation(),$.preventDefault(),G.insertNodes(A,c,{at:P.next(w)}),G.select(A,v.end(A,P.next(w)));return}}}}}p([{type:"lastKey",value:$.key}]);for(const I in Bl)if(rm(I,$)){$.stopPropagation(),$.preventDefault();const j=Bl[I];if(j==="link"){p([{type:"showLinkEditor",value:!0}]);return}if(By(j)){$d(A,j,u);return}Nd(A,j,u)}},onBlur:()=>{A.selection&&p([{type:"lastAnchor",value:A.selection.anchor}])},onFocus:()=>{if(y){if(!P.isPath(y.path)||!ie.has(A,y.path))return;const $=ie.get(A,y.path);let I=0;if(de.isText($)?I=$.text.length:$.children&&(I=$.children.length),y.offset>I)return;try{G.select(A,{anchor:y,focus:y})}catch(j){const R=j.message;u(`Error focusing editor: ${R}`)}}}}),d.jsx(Ty,{})]})})}):null};const pC=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=C.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);C.useEffect(()=>{r&&l(r)},[r]);const u=c=>{i||(l(c),a(c))};return d.jsxs("div",{className:V("toggle",s),onClick:c=>{c.preventDefault(),c.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[d.jsx("p",{children:t}),d.jsx("ul",{className:V("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(c=>{const f=`${e}-${c.value}`;return d.jsxs("li",{className:"hidden",children:[d.jsx("input",{type:"radio",id:f,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:i}),d.jsx("label",{htmlFor:f,children:c.label})]},f)})})]})};function gC({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=C.useState(!1),[l,u]=C.useState(!1),c=C.useRef(null),f=async m=>{o(!0),u(!1);try{const p=m.target.files&&m.target.files[0];if(!p||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:p,userId:t});a(h=>({...h,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return d.jsxs("div",{className:V("profile-image-change-figure",e),children:[d.jsx(tn,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&d.jsx("p",{className:"error text-small",children:d.jsx(oe.FormattedMessage,{id:"profile_image_change_error"})}),d.jsx("input",{id:"file",type:"file",accept:"image/*",ref:c,onChange:f,hidden:!0,"data-testid":"file-input"}),d.jsx(xe,{onClick:()=>c.current&&c.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:s,children:d.jsx(oe.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const rf=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(Gn,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const af=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[c,f]=C.useState([]),[m,p]=C.useState(!0),[g,h]=C.useState(u),{formatMessage:y}=oe.useIntl(),b=async E=>{E.preventDefault();try{await l(c),f([]),h("SUCCESS")}catch(_){h("ERROR"),o(_)}},x=E=>{E.preventDefault(),h("NOT_SUBMITTED"),p(!0),f([])},B=E=>{E.preventDefault(),s(),h("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?d.jsxs("div",{className:"invite-form-wrapper",children:[d.jsx("div",{className:"content centred",children:g==="SUCCESS"?d.jsx("h2",{className:"success-title",children:y({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",y({id:"inviteForm_error"})]})}),d.jsx(Qt,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(xe,{variant:"secondary",onClick:x,children:y({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(xe,{onClick:B,children:y({id:"inviteForm_ctaDone"})})]}):d.jsx(xe,{onClick:x,children:y({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:b,className:V("invite-form gtm-trackable"),children:[d.jsxs("fieldset",{className:"content",children:[d.jsx("h2",{className:"title",style:{color:r},children:e}),d.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),d.jsx(nh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:y({id:"inviteForm_email_placeholder"}),emails:c,onChange:E=>{f(E),p(!E.length)},autoFocus:!1,getLabel:(E,_,T)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:E}),d.jsx(xe,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{T(_),p(!c.length)},className:"remove-email-button",screenreaderText:y({id:"overlay_close"})})]},_)})]}),d.jsx(Qt,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(xe,{className:"sendEmailsButton",disabled:m,children:n})})]})})},la=e=>e.map(t=>({condition:t})),vt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},vC=({functions:e,...t})=>{const{formatMessage:n}=oe.useIntl(),[r,a]=C.useState(null),[i,s]=C.useState(!1),[o,l]=C.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[vt.NEW_PASSWORD]!==p[vt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=p=>!Qi(p[vt.NEW_PASSWORD]).isValid,f=[{"data-testid":vt.NEW_PASSWORD,id:vt.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:la(["required",c]),functions:{onChange:p=>l(Qi(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":vt.CONFIRMED_PASSWORD,id:vt.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:la(["required",u])}];t.isPasswordChange&&f.unshift({"data-testid":vt.CURRENT_PASSWORD,id:vt.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:la(["required"])}),i&&f.push({component:Nc,props:{matchingRules:o}});const m={id:vt.FORM_ID,fields:f,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>a(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(vt.NEW_PASSWORD)||g.includes(vt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(Gn,{...m}),r&&d.jsx(en,{variant:"error",text:r})]})};const sf=({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=oe.useIntl(),u=C.useRef(null);Ln(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=f=>{f.preventDefault(),f.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return d.jsx("form",{onSubmit:c,className:V("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:d.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:d.jsxs("p",{children:[d.jsx(Ie,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),d.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&c(f)}}),d.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:d.jsx(Ie,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Ie,{children:l.formatMessage({id:"search_cta"})})})]})})})},Tl=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let c="";return o?c=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?c=u.auth?"verify":"pending":c="exists":u.auth&&(c="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:c,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},bC=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"]}},yC=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=bC(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}])},DC=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,f=(p,g)=>{p.current&&s.validFields[g]!==p.current.validity.valid&&o([{type:`validFields.${g}`,value:p.current.validity.valid}])},m=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>f(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{Tl({ref:i.email,validateEmail:r,dispatch:o})},onChange:(p,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Tc,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(m.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>f(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{f(i.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),e.url&&m.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>d.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&m.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>d.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),m.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>d.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:p}),privacy:p=>d.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const g=[];["name","email"].forEach(h=>{s.validFields[h]!==i[h].current.validity.valid&&(g.push({type:`validFields.${h}`,value:i[h].current.validity.valid}),h==="email"&&Tl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),m};const CC=({className:e=""})=>d.jsxs("div",{className:V("success-message",e),"data-testid":"success-message",children:[d.jsx("p",{className:"success-title",children:d.jsx(oe.FormattedMessage,{id:"signup_success_title"})}),d.jsx(oe.FormattedMessage,{id:"signup_success_text",values:{p:t=>d.jsx("p",{children:t})}})]});const xC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},wC=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=oe.useIntl(),{title:u=!0,expectation:c=!1,url:f=!0,logInButton:m=!0,successMessage:p=!0}=a,g={title:u,expectation:c,url:f,logInButton:m,successMessage:p},[h,y]=C.useReducer(Br,xC),{validFields:b,emailDetails:x,shouldManuallyApprove:B,shouldDisableButton:E,showSuccessMessage:_,showError:T}=h,[A,$]=ks.useCookies(["signup-this-session","functional-cookie-consent"]),I={form:C.createRef(),name:C.createRef(),email:C.createRef(),jobTitle:C.createRef(),organisation:C.createRef(),tc:C.createRef(),hiddenValidation:C.createRef()};C.useEffect(()=>{B===!0&&I.jobTitle.current&&I.jobTitle.current.focus()},[B]),C.useEffect(()=>{A["signup-this-session"]&&y([{type:"showSuccessMessage",value:!0}])},[A]),C.useEffect(()=>{_&&A["functional-cookie-consent"]&&$("signup-this-session","true",{path:"/",maxAge:3600})},[_]);const j=C.useMemo(()=>DC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:I,state:h,dispatch:y,dataToSubmit:s,intl:l}),[s,r,l,I,g,h]),R=E?!0:B?!Object.values(b).every(w=>w===!0):!b.name||!b.email||["exists","pending","verify"].includes(x.boxType);return g.successMessage&&_?d.jsx(CC,{className:e}):d.jsxs("fieldset",{className:V("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&d.jsx("p",{className:"signup-title",children:d.jsx(oe.FormattedMessage,{id:"signup_title"})}),T&&d.jsx(en,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(Gn,{className:"signup-form",formRef:I.form,id:"sign-up-form",fields:j,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:R?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await yC({refs:I,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:y,state:h})},onCatch:w=>{r.handleError(w),y([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:I.hiddenValidation})]})};var xs={exports:{}},Kr={exports:{}},Fe={};/** @license React v16.13.1
|
|
131
|
+
`;case o[G.hr]:return`---
|
|
132
|
+
`;default:return u}}function jn(e,t){const n=e.trim(),r=n,a=`${t}${r}${Rl(t)}`;if(r.length===e.length)return a;const i=t+r+Rl(t);return e.replace(n,i)}const Rl=e=>e.split("").reverse().join(""),uC=e=>e.map(t=>af(t)).join("").trim(),yr=e=>{const[t]=b.nodes(e,{match:n=>{const r=n;return!b.isEditor(n)&&de.isElement(n)&&r.type===G.link}});return!!t},lC=(e,t,n,r)=>{e.selection&&uo(e,t,n,r)},cC=(e,t,n,r)=>{const{selection:a}=e;if(a&&W.isCollapsed(a)){const[s]=b.nodes(e,{match:o=>{const l=o;return!b.isEditor(o)&&de.isElement(o)&&l.type===G.link}});if(s){const[o,l]=s,u={link:t};Q.setNodes(e,u,{at:l}),sf(n)}}else uo(e,t,n,r)},uo=(e,t,n,r=a=>{console.error(a)})=>{try{yr(e)&&of(e);const{selection:a}=e,i=a&&W.isCollapsed(a),s={type:G.link,link:t,children:i?[{text:t}]:[]};i?(Q.insertNodes(e,s),Q.move(e,{distance:1,unit:"offset"})):(Q.wrapNodes(e,s,{split:!0}),Q.collapse(e,{edge:"end"}),Q.insertNodes(e,{text:""}),Q.move(e,{distance:1,unit:"offset"})),sf(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},sf=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},of=e=>{Q.unwrapNodes(e,{match:t=>{const n=t;return!b.isEditor(t)&&de.isElement(t)&&n.type===G.link}})};let Si=null;const dC=()=>{const e=ue.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,dispatch:a,reportError:i}=C.useContext(kn),s=nr(),o=Ty(s),l=(o==null?void 0:o.text)||iC(s),[u,c]=C.useState(yr(s)),f=Fy(s,"link-editor",`${n}-link`),m=C.useRef(null);C.useEffect(()=>{var y;!u&&r&&((y=m.current)==null||y.focus())},[u]),C.useEffect(()=>{Si&&clearTimeout(Si),Si=setTimeout(()=>{c(yr(s))},500)},[s.selection]);const p=[],g=["open","edit","remove"].map(y=>{const v={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${y}`},{link:o==null?void 0:o.pretty})};switch(p.push({className:y}),y){case"open":v.href=(o==null?void 0:o.full)||"",v.onClick=x=>{x.preventDefault(),x.stopPropagation(),window.open((o==null?void 0:o.full)||"","_blank"),a([{type:"showLinkEditor",value:!1}])},v.children=d.jsxs(d.Fragment,{children:[v.children,d.jsx($e,{children:e.formatMessage({id:`${t}${y}_text`})})]});break;case"edit":v.onClick=()=>{c(!1)};break;case"remove":v.onClick=()=>{const x=[{type:"showLinkEditor",value:!1}];yr(s)&&(of(s),x.push({type:"lastAnchor",value:null})),a(x)};break}return v}),h=[{id:"url",type:"url",inputRef:m,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(o==null?void 0:o.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];return l&&h.unshift({component:()=>d.jsxs("p",{children:[d.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",l]})}),d.jsx(Ac,{children:d.jsx(Qn,{ref:f,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!u},functions:{onBlur:()=>{a([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var y;return(y=m.current)==null?void 0:y.focus()})}},children:u?d.jsx(wn,{wrappers:p,buttons:g}):d.jsx(er,{element:"fieldset",id:`${n}-link-editor`,className:Z({"show-labels":l}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async y=>{setTimeout(()=>{const v=[{type:"showLinkEditor",value:!1}];if(y.url){const{full:x}=Bc(y.url);o!=null&&o.full?cC(s,x,n,i):lC(s,x,n,i),v.push({type:"lastAnchor",value:null})}a(v)})}},fields:h,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},fC=()=>{const e=nr(),{setFocus:t,dispatch:n}=C.useContext(kn),[r,a]=C.useState(!1);return C.useEffect(()=>{a(yr(e))},[e.selection]),d.jsx(ro,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},hC=e=>[G.bold,G.italic,G.strikethrough].includes(e),uf=(e,t)=>{const n=b.marks(e);return n?n[t]===!0:!1},lf=(e,t,n)=>{try{uf(e,t)?b.removeMark(e,t):b.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},mC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(kn),a=nr(),i=uf(a,e);return d.jsx(ro,{id:e,active:i,hasDivider:t,callback:()=>{lf(a,e,r),n(i?null:e)}})},_a=[G.bold,G.italic,G.strikethrough],pC=[G.ol,G.ul,G.blockquote];const gC=({...e})=>{const t=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{className:"toolbar",...e,children:[d.jsx($e,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[_a.map((n,r)=>d.jsx(mC,{format:n,hasDivider:r===_a.length-1},n)),d.jsx(fC,{}),pC.map((n,r)=>d.jsx(By,{format:n,hasDivider:r===1},n))]})]}),d.jsx(dC,{})]})};var vC=CC,bC=/^(?:\w+:)?\/\/(\S+)$/,yC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,DC=/^[^\s\.]+\.\S{2,}$/;function CC(e){if(typeof e!="string")return!1;var t=e.match(bC);if(!t)return!1;var n=t[1];return n?!!(yC.test(n)||DC.test(n)):!1}const xC=xn(vC),wC=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[G.link].includes(s.type)||a(i)},e.insertText=i=>{i&&xC(i)?uo(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},EC=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===G.link&&se.string(r).trim()===""){Q.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const cf=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,functions:a,autoFocus:i=!0,...s})=>{const o=ue.useIntl(),l=xh(),{onChange:u=()=>{},reportError:c=T=>{console.error(T)}}=a||{},f=[{type:G.paragraph,children:[{text:""}]}],m={originalValue:t||"",initialValue:t?null:f,tabbableOption:_a[0],openTooltip:null,showLinkEditor:!1,lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1},[p,g]=C.useReducer(Sr,m),{originalValue:h,initialValue:y,stringValue:v,lastAnchor:x,lastKey:B,hasInteracted:k}=p,E=T=>{const O=T||_a[0];T&&g([{type:"tabbableOption",value:O}])};C.useEffect(()=>{if(t){let T=mn(t);T.includes("<")&&(T=new ya().turndown(T)),aC(T,O=>{g([{type:"initialValue",value:O}]),setTimeout(()=>{g([{type:"stringValue",value:Ol(I)}])},150)})}},[]),C.useEffect(()=>{t!==""||!I||dc(h,t)&&!k||(b.withoutNormalizing(I,()=>{Q.delete(I,{at:{anchor:b.start(I,[]),focus:b.end(I,[])}}),Q.deselect(I),I.children.length!==0&&Q.unwrapNodes(I,{at:[0]}),Q.insertNodes(I,f,{at:[0]})}),g([{type:"initialValue",value:f},{type:"lastAnchor",value:null}]))},[t]);const A=`rte-${e}`,j=C.useCallback(T=>d.jsx(Ey,{...T}),[]),L=C.useCallback(T=>d.jsx(ky,{...T}),[]),I=C.useMemo(()=>wC(EC(dv(xy(lv())),c),A,c),[]);return y?d.jsx("div",{id:A,className:"rich-text-editor",children:d.jsxs(kn.Provider,{value:{...p,id:A,setFocus:E,dispatch:g,reportError:c},children:[d.jsxs(Dy,{editor:I,initialValue:y,onChange:T=>{if(I.operations.some(w=>w.type!=="set_selection")){const w=uC(T);u(w),g([{type:"stringValue",value:Ol(I)}]),k||g([{type:"hasInteracted",value:!0}]),l&&console.log({serialized:w,json:T})}},...s,children:[d.jsx(dy,{className:"input",renderElement:j,renderLeaf:L,placeholder:n||o.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:i,tabIndex:0,onKeyDown:T=>{if(T.key==="Enter"){const{selection:O}=I;if(O){const w=W.isCollapsed(O),[F,R]=b.node(I,O,{depth:1});let M=F,K=M.type;const V=M.children[0];if(V&&[G.ol,G.ul].includes(V.type)&&(M=V,K=V.type),M&&de.isElement(M)&&K!==G.paragraph){if(K===G.blockquote&&!T.shiftKey){T.stopPropagation(),T.preventDefault(),Q.insertNodes(I,f);return}if(w){const[oe]=b.parent(I,O,{edge:"end"}),D=oe.type;if(B==="Enter"&&D===G.li&&[G.ul,G.ol].includes(K)){T.stopPropagation(),T.preventDefault(),Q.insertNodes(I,f,{at:N.next(R)}),Q.select(I,b.end(I,N.next(R)));return}}}}}g([{type:"lastKey",value:T.key}]),sC(T,I,g,c)},onBlur:()=>{I.selection&&g([{type:"lastAnchor",value:I.selection.anchor}])},onFocus:()=>{if(x){if(!N.isPath(x.path)||!se.has(I,x.path))return;const T=se.get(I,x.path);let O=0;if(fe.isText(T)?O=T.text.length:T.children&&(O=T.children.length),x.offset>O)return;try{Q.select(I,{anchor:x,focus:x})}catch(w){const F=w.message;c(`Error focusing editor: ${F}`)}}}}),d.jsx(gC,{})]}),d.jsx(Ms,{limit:r,valueLength:za(v)})]})}):null};const kC=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=C.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);C.useEffect(()=>{r&&l(r)},[r]);const u=c=>{i||(l(c),a(c))};return d.jsxs("div",{className:Z("toggle",s),onClick:c=>{c.preventDefault(),c.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[d.jsx("p",{children:t}),d.jsx("ul",{className:Z("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(c=>{const f=`${e}-${c.value}`;return d.jsxs("li",{className:"hidden",children:[d.jsx("input",{type:"radio",id:f,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:i}),d.jsx("label",{htmlFor:f,children:c.label})]},f)})})]})};function _C({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=C.useState(!1),[l,u]=C.useState(!1),c=C.useRef(null),f=async m=>{o(!0),u(!1);try{const p=m.target.files&&m.target.files[0];if(!p||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:p,userId:t});a(h=>({...h,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return d.jsxs("div",{className:Z("profile-image-change-figure",e),children:[d.jsx(an,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&d.jsx("p",{className:"error text-small",children:d.jsx(ue.FormattedMessage,{id:"profile_image_change_error"})}),d.jsx("input",{id:"file",type:"file",accept:"image/*",ref:c,onChange:f,hidden:!0,"data-testid":"file-input"}),d.jsx(we,{onClick:()=>c.current&&c.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:s,children:d.jsx(ue.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const df=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(er,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const ff=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[c,f]=C.useState([]),[m,p]=C.useState(!0),[g,h]=C.useState(u),{formatMessage:y}=ue.useIntl(),v=async k=>{k.preventDefault();try{await l(c),f([]),h("SUCCESS")}catch(E){h("ERROR"),o(E)}},x=k=>{k.preventDefault(),h("NOT_SUBMITTED"),p(!0),f([])},B=k=>{k.preventDefault(),s(),h("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?d.jsxs("div",{className:"invite-form-wrapper",children:[d.jsx("div",{className:"content centred",children:g==="SUCCESS"?d.jsx("h2",{className:"success-title",children:y({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",y({id:"inviteForm_error"})]})}),d.jsx(en,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(we,{variant:"secondary",onClick:x,children:y({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(we,{onClick:B,children:y({id:"inviteForm_ctaDone"})})]}):d.jsx(we,{onClick:x,children:y({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:Z("invite-form gtm-trackable"),children:[d.jsxs("fieldset",{className:"content",children:[d.jsx("h2",{className:"title",style:{color:r},children:e}),d.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),d.jsx(lh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:y({id:"inviteForm_email_placeholder"}),emails:c,onChange:k=>{f(k),p(!k.length)},autoFocus:!1,getLabel:(k,E,A)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:k}),d.jsx(we,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{A(E),p(!c.length)},className:"remove-email-button",screenreaderText:y({id:"overlay_close"})})]},E)})]}),d.jsx(en,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(we,{className:"sendEmailsButton",disabled:m,children:n})})]})})},ma=e=>e.map(t=>({condition:t})),yt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},BC=({functions:e,...t})=>{const{formatMessage:n}=ue.useIntl(),[r,a]=C.useState(null),[i,s]=C.useState(!1),[o,l]=C.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[yt.NEW_PASSWORD]!==p[yt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=p=>!ts(p[yt.NEW_PASSWORD]).isValid,f=[{"data-testid":yt.NEW_PASSWORD,id:yt.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ma(["required",c]),functions:{onChange:p=>l(ts(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":yt.CONFIRMED_PASSWORD,id:yt.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ma(["required",u])}];t.isPasswordChange&&f.unshift({"data-testid":yt.CURRENT_PASSWORD,id:yt.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ma(["required"])}),i&&f.push({component:qc,props:{matchingRules:o}});const m={id:yt.FORM_ID,fields:f,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>a(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(yt.NEW_PASSWORD)||g.includes(yt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(er,{...m}),r&&d.jsx(rn,{variant:"error",text:r})]})};const hf=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=ue.useIntl(),u=C.useRef(null);Wn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=f=>{f.preventDefault(),f.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return d.jsx("form",{onSubmit:c,className:Z("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:d.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:d.jsxs("p",{children:[d.jsx($e,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),d.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&c(f)}}),d.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:d.jsx($e,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx($e,{children:l.formatMessage({id:"search_cta"})})})]})})})},Ml=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let c="";return o?c=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?c=u.auth?"verify":"pending":c="exists":u.auth&&(c="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:c,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},AC=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"]}},FC=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=AC(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}])},TC=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,f=(p,g)=>{p.current&&s.validFields[g]!==p.current.validity.valid&&o([{type:`validFields.${g}`,value:p.current.validity.valid}])},m=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>f(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{Ml({ref:i.email,validateEmail:r,dispatch:o})},onChange:(p,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Mc,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(m.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>f(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{f(i.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),e.url&&m.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>d.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&m.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>d.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),m.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>d.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:p}),privacy:p=>d.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const g=[];["name","email"].forEach(h=>{s.validFields[h]!==i[h].current.validity.valid&&(g.push({type:`validFields.${h}`,value:i[h].current.validity.valid}),h==="email"&&Ml({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),m};const SC=({className:e=""})=>d.jsxs("div",{className:Z("success-message",e),"data-testid":"success-message",children:[d.jsx("p",{className:"success-title",children:d.jsx(ue.FormattedMessage,{id:"signup_success_title"})}),d.jsx(ue.FormattedMessage,{id:"signup_success_text",values:{p:t=>d.jsx("p",{children:t})}})]});const jC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},OC=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ue.useIntl(),{title:u=!0,expectation:c=!1,url:f=!0,logInButton:m=!0,successMessage:p=!0}=a,g={title:u,expectation:c,url:f,logInButton:m,successMessage:p},[h,y]=C.useReducer(Sr,jC),{validFields:v,emailDetails:x,shouldManuallyApprove:B,shouldDisableButton:k,showSuccessMessage:E,showError:A}=h,[j,L]=Ts.useCookies(["signup-this-session","functional-cookie-consent"]),I={form:C.createRef(),name:C.createRef(),email:C.createRef(),jobTitle:C.createRef(),organisation:C.createRef(),tc:C.createRef(),hiddenValidation:C.createRef()};C.useEffect(()=>{B===!0&&I.jobTitle.current&&I.jobTitle.current.focus()},[B]),C.useEffect(()=>{j["signup-this-session"]&&y([{type:"showSuccessMessage",value:!0}])},[j]),C.useEffect(()=>{E&&j["functional-cookie-consent"]&&L("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const T=C.useMemo(()=>TC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:I,state:h,dispatch:y,dataToSubmit:s,intl:l}),[s,r,l,I,g,h]),O=k?!0:B?!Object.values(v).every(w=>w===!0):!v.name||!v.email||["exists","pending","verify"].includes(x.boxType);return g.successMessage&&E?d.jsx(SC,{className:e}):d.jsxs("fieldset",{className:Z("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&d.jsx("p",{className:"signup-title",children:d.jsx(ue.FormattedMessage,{id:"signup_title"})}),A&&d.jsx(rn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(er,{className:"signup-form",formRef:I.form,id:"sign-up-form",fields:T,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:O?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await FC({refs:I,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:y,state:h})},onCatch:w=>{r.handleError(w),y([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:I.hiddenValidation})]})};var _s={exports:{}},Qr={exports:{}},Te={};/** @license React v16.13.1
|
|
133
133
|
* react-is.production.min.js
|
|
134
134
|
*
|
|
135
135
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
136
136
|
*
|
|
137
137
|
* This source code is licensed under the MIT license found in the
|
|
138
138
|
* LICENSE file in the root directory of this source tree.
|
|
139
|
-
*/var
|
|
139
|
+
*/var Il;function PC(){if(Il)return Te;Il=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function B(E){if(typeof E=="object"&&E!==null){var A=E.$$typeof;switch(A){case t:switch(E=E.type,E){case l:case u:case r:case i:case a:case f:return E;default:switch(E=E&&E.$$typeof,E){case o:case c:case g:case p:case s:return E;default:return A}}case n:return A}}}function k(E){return B(E)===u}return Te.AsyncMode=l,Te.ConcurrentMode=u,Te.ContextConsumer=o,Te.ContextProvider=s,Te.Element=t,Te.ForwardRef=c,Te.Fragment=r,Te.Lazy=g,Te.Memo=p,Te.Portal=n,Te.Profiler=i,Te.StrictMode=a,Te.Suspense=f,Te.isAsyncMode=function(E){return k(E)||B(E)===l},Te.isConcurrentMode=k,Te.isContextConsumer=function(E){return B(E)===o},Te.isContextProvider=function(E){return B(E)===s},Te.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===t},Te.isForwardRef=function(E){return B(E)===c},Te.isFragment=function(E){return B(E)===r},Te.isLazy=function(E){return B(E)===g},Te.isMemo=function(E){return B(E)===p},Te.isPortal=function(E){return B(E)===n},Te.isProfiler=function(E){return B(E)===i},Te.isStrictMode=function(E){return B(E)===a},Te.isSuspense=function(E){return B(E)===f},Te.isValidElementType=function(E){return typeof E=="string"||typeof E=="function"||E===r||E===u||E===i||E===a||E===f||E===m||typeof E=="object"&&E!==null&&(E.$$typeof===g||E.$$typeof===p||E.$$typeof===s||E.$$typeof===o||E.$$typeof===c||E.$$typeof===y||E.$$typeof===v||E.$$typeof===x||E.$$typeof===h)},Te.typeOf=B,Te}var Se={};/** @license React v16.13.1
|
|
140
140
|
* react-is.development.js
|
|
141
141
|
*
|
|
142
142
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
143
143
|
*
|
|
144
144
|
* This source code is licensed under the MIT license found in the
|
|
145
145
|
* LICENSE file in the root directory of this source tree.
|
|
146
|
-
*/var
|
|
146
|
+
*/var $l;function NC(){return $l||($l=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,x=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===f||X===m||typeof X=="object"&&X!==null&&(X.$$typeof===g||X.$$typeof===p||X.$$typeof===s||X.$$typeof===o||X.$$typeof===c||X.$$typeof===y||X.$$typeof===v||X.$$typeof===x||X.$$typeof===h)}function k(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 f:return pe;default:var _e=pe&&pe.$$typeof;switch(_e){case o:case c:case g:case p:case s:return _e;default:return ve}}case n:return ve}}}var E=l,A=u,j=o,L=s,I=t,T=c,O=r,w=g,F=p,R=n,M=i,K=a,V=f,oe=!1;function ne(X){return oe||(oe=!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.")),D(X)||k(X)===l}function D(X){return k(X)===u}function q(X){return k(X)===o}function ee(X){return k(X)===s}function _(X){return typeof X=="object"&&X!==null&&X.$$typeof===t}function S(X){return k(X)===c}function z(X){return k(X)===r}function $(X){return k(X)===g}function U(X){return k(X)===p}function re(X){return k(X)===n}function te(X){return k(X)===i}function Y(X){return k(X)===a}function le(X){return k(X)===f}Se.AsyncMode=E,Se.ConcurrentMode=A,Se.ContextConsumer=j,Se.ContextProvider=L,Se.Element=I,Se.ForwardRef=T,Se.Fragment=O,Se.Lazy=w,Se.Memo=F,Se.Portal=R,Se.Profiler=M,Se.StrictMode=K,Se.Suspense=V,Se.isAsyncMode=ne,Se.isConcurrentMode=D,Se.isContextConsumer=q,Se.isContextProvider=ee,Se.isElement=_,Se.isForwardRef=S,Se.isFragment=z,Se.isLazy=$,Se.isMemo=U,Se.isPortal=re,Se.isProfiler=te,Se.isStrictMode=Y,Se.isSuspense=le,Se.isValidElementType=B,Se.typeOf=k}()),Se}var Ll;function mf(){return Ll||(Ll=1,process.env.NODE_ENV==="production"?Qr.exports=PC():Qr.exports=NC()),Qr.exports}/*
|
|
147
147
|
object-assign
|
|
148
148
|
(c) Sindre Sorhus
|
|
149
149
|
@license MIT
|
|
150
|
-
*/var
|
|
151
|
-
Valid keys: `+JSON.stringify(Object.keys(D),null," "));var
|
|
150
|
+
*/var ji,zl;function RC(){if(zl)return ji;zl=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(c){return s[c]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(c){u[c]=c}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return ji=a()?Object.assign:function(i,s){for(var o,l=r(i),u,c=1;c<arguments.length;c++){o=Object(arguments[c]);for(var f in o)t.call(o,f)&&(l[f]=o[f]);if(e){u=e(o);for(var m=0;m<u.length;m++)n.call(o,u[m])&&(l[u[m]]=o[u[m]])}}return l},ji}var Oi,ql;function lo(){if(ql)return Oi;ql=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Oi=e,Oi}var Pi,Wl;function pf(){return Wl||(Wl=1,Pi=Function.call.bind(Object.prototype.hasOwnProperty)),Pi}var Ni,Hl;function MC(){if(Hl)return Ni;Hl=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=lo(),n={},r=pf();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var c in i)if(r(i,c)){var f;try{if(typeof i[c]!="function"){var m=Error((l||"React class")+": "+o+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}f=i[c](s,c,l,o,null,t)}catch(g){f=g}if(f&&!(f instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in n)){n[f.message]=!0;var p=u?u():"";e("Failed "+o+" type: "+f.message+(p??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Ni=a,Ni}var Ri,Ul;function IC(){if(Ul)return Ri;Ul=1;var e=mf(),t=RC(),n=lo(),r=pf(),a=MC(),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 Ri=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,c="@@iterator";function f(D){var q=D&&(u&&D[u]||D[c]);if(typeof q=="function")return q}var m="<<anonymous>>",p={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:x(),arrayOf:B,element:k(),elementType:E(),instanceOf:A,node:T(),objectOf:L,oneOf:j,oneOfType:I,shape:w,exact:F};function g(D,q){return D===q?D!==0||1/D===1/q:D!==D&&q!==q}function h(D,q){this.message=D,this.data=q&&typeof q=="object"?q:{},this.stack=""}h.prototype=Error.prototype;function y(D){if(process.env.NODE_ENV!=="production")var q={},ee=0;function _(z,$,U,re,te,Y,le){if(re=re||m,Y=Y||U,le!==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+":"+U;!q[ve]&&ee<3&&(i("You are manually calling a React.PropTypes validation function for the `"+Y+"` 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."),q[ve]=!0,ee++)}}return $[U]==null?z?$[U]===null?new h("The "+te+" `"+Y+"` is marked as required "+("in `"+re+"`, but its value is `null`.")):new h("The "+te+" `"+Y+"` is marked as required in "+("`"+re+"`, but its value is `undefined`.")):null:D($,U,re,te,Y)}var S=_.bind(null,!1);return S.isRequired=_.bind(null,!0),S}function v(D){function q(ee,_,S,z,$,U){var re=ee[_],te=K(re);if(te!==D){var Y=V(re);return new h("Invalid "+z+" `"+$+"` of type "+("`"+Y+"` supplied to `"+S+"`, expected ")+("`"+D+"`."),{expectedType:D})}return null}return y(q)}function x(){return y(s)}function B(D){function q(ee,_,S,z,$){if(typeof D!="function")return new h("Property `"+$+"` of component `"+S+"` has invalid PropType notation inside arrayOf.");var U=ee[_];if(!Array.isArray(U)){var re=K(U);return new h("Invalid "+z+" `"+$+"` of type "+("`"+re+"` supplied to `"+S+"`, expected an array."))}for(var te=0;te<U.length;te++){var Y=D(U,te,S,z,$+"["+te+"]",n);if(Y instanceof Error)return Y}return null}return y(q)}function k(){function D(q,ee,_,S,z){var $=q[ee];if(!o($)){var U=K($);return new h("Invalid "+S+" `"+z+"` of type "+("`"+U+"` supplied to `"+_+"`, expected a single ReactElement."))}return null}return y(D)}function E(){function D(q,ee,_,S,z){var $=q[ee];if(!e.isValidElementType($)){var U=K($);return new h("Invalid "+S+" `"+z+"` of type "+("`"+U+"` supplied to `"+_+"`, expected a single ReactElement type."))}return null}return y(D)}function A(D){function q(ee,_,S,z,$){if(!(ee[_]instanceof D)){var U=D.name||m,re=ne(ee[_]);return new h("Invalid "+z+" `"+$+"` of type "+("`"+re+"` supplied to `"+S+"`, expected ")+("instance of `"+U+"`."))}return null}return y(q)}function j(D){if(!Array.isArray(D))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(ee,_,S,z,$){for(var U=ee[_],re=0;re<D.length;re++)if(g(U,D[re]))return null;var te=JSON.stringify(D,function(le,X){var ve=V(X);return ve==="symbol"?String(X):X});return new h("Invalid "+z+" `"+$+"` of value `"+String(U)+"` "+("supplied to `"+S+"`, expected one of "+te+"."))}return y(q)}function L(D){function q(ee,_,S,z,$){if(typeof D!="function")return new h("Property `"+$+"` of component `"+S+"` has invalid PropType notation inside objectOf.");var U=ee[_],re=K(U);if(re!=="object")return new h("Invalid "+z+" `"+$+"` of type "+("`"+re+"` supplied to `"+S+"`, expected an object."));for(var te in U)if(r(U,te)){var Y=D(U,te,S,z,$+"."+te,n);if(Y instanceof Error)return Y}return null}return y(q)}function I(D){if(!Array.isArray(D))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var q=0;q<D.length;q++){var ee=D[q];if(typeof ee!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+oe(ee)+" at index "+q+"."),s}function _(S,z,$,U,re){for(var te=[],Y=0;Y<D.length;Y++){var le=D[Y],X=le(S,z,$,U,re,n);if(X==null)return null;X.data&&r(X.data,"expectedType")&&te.push(X.data.expectedType)}var ve=te.length>0?", expected one of type ["+te.join(", ")+"]":"";return new h("Invalid "+U+" `"+re+"` supplied to "+("`"+$+"`"+ve+"."))}return y(_)}function T(){function D(q,ee,_,S,z){return R(q[ee])?null:new h("Invalid "+S+" `"+z+"` supplied to "+("`"+_+"`, expected a ReactNode."))}return y(D)}function O(D,q,ee,_,S){return new h((D||"React class")+": "+q+" type `"+ee+"."+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+S+"`.")}function w(D){function q(ee,_,S,z,$){var U=ee[_],re=K(U);if(re!=="object")return new h("Invalid "+z+" `"+$+"` of type `"+re+"` "+("supplied to `"+S+"`, expected `object`."));for(var te in D){var Y=D[te];if(typeof Y!="function")return O(S,z,$,te,V(Y));var le=Y(U,te,S,z,$+"."+te,n);if(le)return le}return null}return y(q)}function F(D){function q(ee,_,S,z,$){var U=ee[_],re=K(U);if(re!=="object")return new h("Invalid "+z+" `"+$+"` of type `"+re+"` "+("supplied to `"+S+"`, expected `object`."));var te=t({},ee[_],D);for(var Y in te){var le=D[Y];if(r(D,Y)&&typeof le!="function")return O(S,z,$,Y,V(le));if(!le)return new h("Invalid "+z+" `"+$+"` key `"+Y+"` supplied to `"+S+"`.\nBad object: "+JSON.stringify(ee[_],null," ")+`
|
|
151
|
+
Valid keys: `+JSON.stringify(Object.keys(D),null," "));var X=le(U,Y,S,z,$+"."+Y,n);if(X)return X}return null}return y(q)}function R(D){switch(typeof D){case"number":case"string":case"undefined":return!0;case"boolean":return!D;case"object":if(Array.isArray(D))return D.every(R);if(D===null||o(D))return!0;var q=f(D);if(q){var ee=q.call(D),_;if(q!==D.entries){for(;!(_=ee.next()).done;)if(!R(_.value))return!1}else for(;!(_=ee.next()).done;){var S=_.value;if(S&&!R(S[1]))return!1}}else return!1;return!0;default:return!1}}function M(D,q){return D==="symbol"?!0:q?q["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&q instanceof Symbol:!1}function K(D){var q=typeof D;return Array.isArray(D)?"array":D instanceof RegExp?"object":M(q,D)?"symbol":q}function V(D){if(typeof D>"u"||D===null)return""+D;var q=K(D);if(q==="object"){if(D instanceof Date)return"date";if(D instanceof RegExp)return"regexp"}return q}function oe(D){var q=V(D);switch(q){case"array":case"object":return"an "+q;case"boolean":case"date":case"regexp":return"a "+q;default:return q}}function ne(D){return!D.constructor||!D.constructor.name?m:D.constructor.name}return p.checkPropTypes=a,p.resetWarningCache=a.resetWarningCache,p.PropTypes=p,p},Ri}var Mi,Vl;function $C(){if(Vl)return Mi;Vl=1;var e=lo();function t(){}function n(){}return n.resetWarningCache=t,Mi=function(){function r(s,o,l,u,c,f){if(f!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Mi}if(process.env.NODE_ENV!=="production"){var LC=mf(),zC=!0;_s.exports=IC()(LC.isElement,zC)}else _s.exports=$C()();var qC=_s.exports;/*!
|
|
152
152
|
* tabbable 6.2.0
|
|
153
153
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
154
|
-
*/var
|
|
154
|
+
*/var gf=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Ba=gf.join(","),vf=typeof Element>"u",Cn=vf?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Aa=!vf&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},Fa=function e(t,n){var r;n===void 0&&(n=!0);var a=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=a===""||a==="true",s=i||n&&t&&e(t.parentNode);return s},WC=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},bf=function(t,n,r){if(Fa(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(Ba));return n&&Cn.call(t,Ba)&&a.unshift(t),a=a.filter(r),a},yf=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!Fa(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var c=Cn.call(s,Ba);c&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var f=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),m=!Fa(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(f&&m){var p=e(f===!0?s.children:f.children,!0,r);r.flatten?a.push.apply(a,p):a.push({scopeParent:s,candidates:p})}else i.unshift.apply(i,s.children)}}return a},Df=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Qt=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||WC(t))&&!Df(t)?0:t.tabIndex},HC=function(t,n){var r=Qt(t);return r<0&&n&&!Df(t)?0:r},UC=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Cf=function(t){return t.tagName==="INPUT"},VC=function(t){return Cf(t)&&t.type==="hidden"},KC=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},ZC=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},YC=function(t){if(!t.name)return!0;var n=t.form||Aa(t),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},a;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")a=r(window.CSS.escape(t.name));else try{a=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=ZC(a,t.form);return!i||i===t},GC=function(t){return Cf(t)&&t.type==="radio"},QC=function(t){return GC(t)&&!YC(t)},JC=function(t){var n,r=t&&Aa(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,c,f;r=Aa(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((c=a)!==null&&c!==void 0&&(f=c.ownerDocument)!==null&&f!==void 0&&f.contains(a))}}return i},Kl=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},XC=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=Cn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(Cn.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof a=="function"){for(var o=t;t;){var l=t.parentElement,u=Aa(t);if(l&&!l.shadowRoot&&a(l)===!0)return Kl(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(JC(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Kl(t);return!1},ex=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 Cn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},Ta=function(t,n){return!(n.disabled||Fa(n)||VC(n)||XC(n,t)||KC(n)||ex(n))},Bs=function(t,n){return!(QC(n)||Qt(n)<0||!Ta(t,n))},tx=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},nx=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=HC(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(UC).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},xf=function(t,n){n=n||{};var r;return n.getShadowRoot?r=yf([t],n.includeContainer,{filter:Bs.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:tx}):r=bf(t,n.includeContainer,Bs.bind(null,n)),nx(r)},wf=function(t,n){n=n||{};var r;return n.getShadowRoot?r=yf([t],n.includeContainer,{filter:Ta.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=bf(t,n.includeContainer,Ta.bind(null,n)),r},cn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Cn.call(t,Ba)===!1?!1:Bs(n,t)},rx=gf.concat("iframe").join(","),pa=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Cn.call(t,rx)===!1?!1:Ta(n,t)};const ax=Object.freeze(Object.defineProperty({__proto__:null,focusable:wf,getTabIndex:Qt,isFocusable:pa,isTabbable:cn,tabbable:xf},Symbol.toStringTag,{value:"Module"}));/*!
|
|
155
155
|
* focus-trap 7.5.4
|
|
156
156
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
157
|
-
*/function 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 ql(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){YC(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}function YC(e,t,n){return t=QC(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GC(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 QC(e){var t=GC(e,"string");return typeof t=="symbol"?t:String(t)}var Wl={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()}},JC=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},XC=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},gr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},ex=function(t){return gr(t)&&!t.shiftKey},tx=function(t){return gr(t)&&t.shiftKey},Hl=function(t){return setTimeout(t,0)},Ul=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},ar=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},Zr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},nx=[],rx=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||nx,i=ql({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:ex,isKeyBackward:tx},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(w,F,N){return w&&w[F]!==void 0?w[F]:i[N||F]},u=function(w,F){var N=typeof(F==null?void 0:F.composedPath)=="function"?F.composedPath():void 0;return s.containerGroups.findIndex(function(M){var Z=M.container,K=M.tabbableNodes;return Z.contains(w)||(N==null?void 0:N.includes(Z))||K.find(function(se){return se===w})})},c=function(w){var F=i[w];if(typeof F=="function"){for(var N=arguments.length,M=new Array(N>1?N-1:0),Z=1;Z<N;Z++)M[Z-1]=arguments[Z];F=F.apply(void 0,M)}if(F===!0&&(F=void 0),!F){if(F===void 0||F===!1)return F;throw new Error("`".concat(w,"` was specified but was not a node, or did not return a node"))}var K=F;if(typeof F=="string"&&(K=r.querySelector(F),!K))throw new Error("`".concat(w,"` as selector refers to no known node"));return K},f=function(){var w=c("initialFocus");if(w===!1)return!1;if(w===void 0||!ca(w,i.tabbableOptions))if(u(r.activeElement)>=0)w=r.activeElement;else{var F=s.tabbableGroups[0],N=F&&F.firstTabbableNode;w=N||c("fallbackFocus")}if(!w)throw new Error("Your focus-trap needs to have at least one focusable element");return w},m=function(){if(s.containerGroups=s.containers.map(function(w){var F=pf(w,i.tabbableOptions),N=gf(w,i.tabbableOptions),M=F.length>0?F[0]:void 0,Z=F.length>0?F[F.length-1]:void 0,K=N.find(function(D){return on(D)}),se=N.slice().reverse().find(function(D){return on(D)}),ne=!!F.find(function(D){return Zt(D)>0});return{container:w,tabbableNodes:F,focusableNodes:N,posTabIndexesFound:ne,firstTabbableNode:M,lastTabbableNode:Z,firstDomTabbableNode:K,lastDomTabbableNode:se,nextTabbableNode:function(q){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,k=F.indexOf(q);return k<0?X?N.slice(N.indexOf(q)+1).find(function(S){return on(S)}):N.slice(0,N.indexOf(q)).reverse().find(function(S){return on(S)}):F[k+(X?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(w){return w.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!c("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(w){return w.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function R(w){var F=w.activeElement;if(F)return F.shadowRoot&&F.shadowRoot.activeElement!==null?R(F.shadowRoot):F},g=function R(w){if(w!==!1&&w!==p(document)){if(!w||!w.focus){R(f());return}w.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=w,JC(w)&&w.select()}},h=function(w){var F=c("setReturnFocus",w);return F||(F===!1?!1:w)},y=function(w){var F=w.target,N=w.event,M=w.isBackward,Z=M===void 0?!1:M;F=F||Zr(N),m();var K=null;if(s.tabbableGroups.length>0){var se=u(F,N),ne=se>=0?s.containerGroups[se]:void 0;if(se<0)Z?K=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:K=s.tabbableGroups[0].firstTabbableNode;else if(Z){var D=Ul(s.tabbableGroups,function(L){var U=L.firstTabbableNode;return F===U});if(D<0&&(ne.container===F||ca(F,i.tabbableOptions)&&!on(F,i.tabbableOptions)&&!ne.nextTabbableNode(F,!1))&&(D=se),D>=0){var q=D===0?s.tabbableGroups.length-1:D-1,X=s.tabbableGroups[q];K=Zt(F)>=0?X.lastTabbableNode:X.lastDomTabbableNode}else gr(N)||(K=ne.nextTabbableNode(F,!1))}else{var k=Ul(s.tabbableGroups,function(L){var U=L.lastTabbableNode;return F===U});if(k<0&&(ne.container===F||ca(F,i.tabbableOptions)&&!on(F,i.tabbableOptions)&&!ne.nextTabbableNode(F))&&(k=se),k>=0){var S=k===s.tabbableGroups.length-1?0:k+1,z=s.tabbableGroups[S];K=Zt(F)>=0?z.firstTabbableNode:z.firstDomTabbableNode}else gr(N)||(K=ne.nextTabbableNode(F))}}else K=c("fallbackFocus");return K},b=function(w){var F=Zr(w);if(!(u(F,w)>=0)){if(ar(i.clickOutsideDeactivates,w)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}ar(i.allowOutsideClick,w)||w.preventDefault()}},x=function(w){var F=Zr(w),N=u(F,w)>=0;if(N||F instanceof Document)N&&(s.mostRecentlyFocusedNode=F);else{w.stopImmediatePropagation();var M,Z=!0;if(s.mostRecentlyFocusedNode)if(Zt(s.mostRecentlyFocusedNode)>0){var K=u(s.mostRecentlyFocusedNode),se=s.containerGroups[K].tabbableNodes;if(se.length>0){var ne=se.findIndex(function(D){return D===s.mostRecentlyFocusedNode});ne>=0&&(i.isKeyForward(s.recentNavEvent)?ne+1<se.length&&(M=se[ne+1],Z=!1):ne-1>=0&&(M=se[ne-1],Z=!1))}}else s.containerGroups.some(function(D){return D.tabbableNodes.some(function(q){return Zt(q)>0})})||(Z=!1);else Z=!1;Z&&(M=y({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(M||s.mostRecentlyFocusedNode||f())}s.recentNavEvent=void 0},B=function(w){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=w;var N=y({event:w,isBackward:F});N&&(gr(w)&&w.preventDefault(),g(N))},E=function(w){if(XC(w)&&ar(i.escapeDeactivates,w)!==!1){w.preventDefault(),o.deactivate();return}(i.isKeyForward(w)||i.isKeyBackward(w))&&B(w,i.isKeyBackward(w))},_=function(w){var F=Zr(w);u(F,w)>=0||ar(i.clickOutsideDeactivates,w)||ar(i.allowOutsideClick,w)||(w.preventDefault(),w.stopImmediatePropagation())},T=function(){if(s.active)return Wl.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Hl(function(){g(f())}):g(f()),r.addEventListener("focusin",x,!0),r.addEventListener("mousedown",b,{capture:!0,passive:!1}),r.addEventListener("touchstart",b,{capture:!0,passive:!1}),r.addEventListener("click",_,{capture:!0,passive:!1}),r.addEventListener("keydown",E,{capture:!0,passive:!1}),o},A=function(){if(s.active)return r.removeEventListener("focusin",x,!0),r.removeEventListener("mousedown",b,!0),r.removeEventListener("touchstart",b,!0),r.removeEventListener("click",_,!0),r.removeEventListener("keydown",E,!0),o},$=function(w){var F=w.some(function(N){var M=Array.from(N.removedNodes);return M.some(function(Z){return Z===s.mostRecentlyFocusedNode})});F&&g(f())},I=typeof window<"u"&&"MutationObserver"in window?new MutationObserver($):void 0,j=function(){I&&(I.disconnect(),s.active&&!s.paused&&s.containers.map(function(w){I.observe(w,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(w){if(s.active)return this;var F=l(w,"onActivate"),N=l(w,"onPostActivate"),M=l(w,"checkCanFocusTrap");M||m(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,F==null||F();var Z=function(){M&&m(),T(),j(),N==null||N()};return M?(M(s.containers.concat()).then(Z,Z),this):(Z(),this)},deactivate:function(w){if(!s.active)return this;var F=ql({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},w);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,A(),s.active=!1,s.paused=!1,j(),Wl.deactivateTrap(a,o);var N=l(F,"onDeactivate"),M=l(F,"onPostDeactivate"),Z=l(F,"checkCanReturnFocus"),K=l(F,"returnFocus","returnFocusOnDeactivate");N==null||N();var se=function(){Hl(function(){K&&g(h(s.nodeFocusedBeforeActivation)),M==null||M()})};return K&&Z?(Z(h(s.nodeFocusedBeforeActivation)).then(se,se),this):(se(),this)},pause:function(w){if(s.paused||!s.active)return this;var F=l(w,"onPause"),N=l(w,"onPostPause");return s.paused=!0,F==null||F(),A(),j(),N==null||N(),this},unpause:function(w){if(!s.paused||!s.active)return this;var F=l(w,"onUnpause"),N=l(w,"onPostUnpause");return s.paused=!1,F==null||F(),m(),T(),j(),N==null||N(),this},updateContainerElements:function(w){var F=[].concat(w).filter(Boolean);return s.containers=F.map(function(N){return typeof N=="string"?r.querySelector(N):N}),s.active&&m(),j(),this}},o.updateContainerElements(t),o};const ax=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:rx},Symbol.toStringTag,{value:"Module"})),ix=oc(ax),sx=oc(ZC);function Un(e){"@babel/helpers - typeof";return Un=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},Un(e)}function ox(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vl(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,vf(r.key),r)}}function ux(e,t,n){return t&&Vl(e.prototype,t),n&&Vl(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function lx(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 cx(e){var t=fx();return function(){var r=ka(e),a;if(t){var i=ka(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return dx(this,a)}}function dx(e,t){if(t&&(Un(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return lr(e)}function lr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function fx(){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 ka(e){return ka=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ka(e)}function hx(e,t,n){return t=vf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vf(e){var t=mx(e,"string");return Un(t)==="symbol"?t:String(t)}function mx(e,t){if(Un(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Un(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Yr=C,he=jC,px=ix,gx=px.createFocusTrap,vx=sx,bx=vx.isFocusable,io=function(e){lx(n,e);var t=cx(n);function n(r){var a;ox(this,n),a=t.call(this,r),hx(lr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var c=arguments.length,f=new Array(c>1?c-1:0),m=1;m<c;m++)f[m-1]=arguments[m];u=u.apply(void 0,f)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var p=u;if(typeof u=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),a.handleDeactivate=a.handleDeactivate.bind(lr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(lr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(lr(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 ux(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&&!bx(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,c=u===void 0?!1:u;l&&o.focus({preventScroll:c}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?Yr.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===Yr.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var c=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=c||[u]},o=Yr.cloneElement(i,{ref:s});return o}return null}}]),n}(Yr.Component),ir=typeof Element>"u"?Function:Element;io.propTypes={active:he.bool,paused:he.bool,focusTrapOptions:he.shape({document:he.object,onActivate:he.func,onPostActivate:he.func,checkCanFocusTrap:he.func,onPause:he.func,onPostPause:he.func,onUnpause:he.func,onPostUnpause:he.func,onDeactivate:he.func,onPostDeactivate:he.func,checkCanReturnFocus:he.func,initialFocus:he.oneOfType([he.instanceOf(ir),he.string,he.bool,he.func]),fallbackFocus:he.oneOfType([he.instanceOf(ir),he.string,he.func]),escapeDeactivates:he.oneOfType([he.bool,he.func]),clickOutsideDeactivates:he.oneOfType([he.bool,he.func]),returnFocusOnDeactivate:he.bool,setReturnFocus:he.oneOfType([he.instanceOf(ir),he.string,he.bool,he.func]),allowOutsideClick:he.oneOfType([he.bool,he.func]),preventScroll:he.bool,tabbableOptions:he.shape({displayCheck:he.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:he.oneOfType([he.bool,he.func])}),trapStack:he.array,isKeyForward:he.func,isKeyBackward:he.func}),containerElements:he.arrayOf(he.instanceOf(ir)),children:he.oneOfType([he.element,he.instanceOf(ir)])};io.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:gx};var yx=io;const Dx=bn(yx),bf=({showDevTools:e=!0,children:t})=>{const n=new qe.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return d.jsxs(qe.QueryClientProvider,{client:n,children:[t,e&&d.jsx(th.ReactQueryDevtools,{initialIsOpen:!1})]})};var Cx=C.createContext({client:ta});function xx(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=C.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(ta.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),ta.init(r,a)),ta)},[n,r]);return C.createElement(Cx.Provider,{value:{client:i}},t)}const yf=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(xx,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):d.jsx(d.Fragment,{children:e}),Df=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...bh[r],...n||{}};return d.jsx(oe.IntlProvider,{locale:r,messages:a,children:e})},so=C.createContext({}),da={en:"English",es:"Español",fr:"Français",pt:"Português"},Ot=C.createContext({isLoading:!0});function Wa(){return C.useContext(Ot)}const Cf=({children:e,user:t})=>d.jsx(Ot.Provider,{value:t,children:e}),oo=C.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),xf=()=>C.useContext(oo),wf=({children:e})=>{const[t,n]=C.useState([]);C.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=C.useCallback(i=>{n(s=>[...s,i])},[]),a=C.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return d.jsx(oo.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},wx=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=C.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=C.useState(s),u=c=>{localStorage.setItem("language",c),l(c)};return C.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),Dc(5e3)}).catch(c=>{c.message===vc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(so.Provider,{value:{language:o,updateLanguage:u},children:d.jsx(Df,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(ks.CookiesProvider,{children:d.jsx(Cf,{user:a,children:d.jsx(wf,{children:d.jsx(bf,{showDevTools:r,children:d.jsx(yf,{user:a,children:t})})})})})})})};const uo=({element:e="section",children:t,className:n,...r})=>C.createElement(e,{className:V("modal",n),children:typeof t=="string"?d.jsx("p",{children:t}):t,...r});const Tr=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:c="",gtmContext:f="Modal"})=>{const m=oe.useIntl(),{registerOverlay:p,unregisterOverlay:g}=xf(),[h,y]=C.useState(t),b=E=>{E.key==="Escape"&&x(!1)};C.useEffect(()=>(window.addEventListener("keyup",b),()=>{window.removeEventListener("keyup",b)}));const x=E=>{y(E),E?(a(),p(e)):(i(),g(e))};C.useEffect(()=>(x(t),()=>{h&&g(e)}),[t]);const B=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{className:V("overlay",{open:h}),role:"dialog",children:d.jsx(uo,{id:e,className:V("overlay-modal",c,{"has-max-width":r}),hidden:!h,style:B,children:t&&d.jsx(Dx,{children:d.jsxs("div",{className:"overlay-content",children:[d.jsxs("div",{className:"top",children:[o&&d.jsx("h2",{className:"modal-title",children:o}),d.jsx(xe,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>x(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":f,screenreaderText:m.formatMessage({id:"overlay_close"})})]}),n&&d.jsx(Qt,{}),l,u&&d.jsxs("div",{className:"bottom",children:[d.jsx(Qt,{}),d.jsx(yn,{buttons:u})]}),s&&d.jsx(br,{className:"error",children:s})]})})})})},Ef=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Ex=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const c=oe.useIntl();return r||(r=c.formatMessage({id:"inviteModal_formTitle"})),a||(a=c.formatMessage({id:"inviteModal_formLabel"})),i||(i=c.formatMessage({id:"inviteModal_cta"})),d.jsx(Tr,{title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:V("invite-modal",e,{success:!!n}),children:d.jsx(af,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const _x=({members:e})=>{const[t,n]=C.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return d.jsxs(d.Fragment,{children:[d.jsx(tn,{name:i,src:l}),d.jsx("p",{children:i}),d.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return d.jsxs("div",{className:"directory-wrapper",children:[d.jsx("ul",{className:"directory",children:e.map(a=>d.jsx("li",{children:d.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),d.jsx(Tr,{isOpen:t!==!1,children:t===!1?"":d.jsxs(d.Fragment,{children:[r(t),d.jsx(zn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const kx=({author:e,authorCite:t,content:n,member:r,className:a=""})=>d.jsxs("blockquote",{className:V("testimonial-block",a),children:[d.jsx(Lt,{className:"testimonial",children:n}),r?d.jsx(Ar,{member:r,styling:{size:"large"}}):d.jsxs(d.Fragment,{children:[e&&d.jsx("p",{className:V("author",{"text-small":!a.includes("new")}),children:e}),t&&d.jsx("p",{className:V("author-cite",{"text-small":!a.includes("new")}),children:d.jsx("cite",{children:t})})]})]}),Bx=C.memo(kx);const Ax=({items:e=[],selector:t="",className:n=""})=>{const r=oe.useIntl(),[a,i]=C.useState(e);return C.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,c)=>{s+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&d.jsxs(St,{variant:"subtle",className:V("table-of-contents",n),children:[d.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),d.jsx("nav",{children:d.jsx("ul",{children:a.map(({id:s,text:o})=>d.jsx("li",{children:d.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Ha=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=oe.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=c=>{const f=c/60,m=Math.floor(f),p=(f-m)*60,g=Math.round(p),h=`${i.formatMessage({id:`${s}hours`},{time:m})}${m>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${m>0?`${i.formatMessage({id:`${s}hours_short`},{time:m})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:h}};let{text:l,ariaText:u}=o(e);if(t){const{text:c,ariaText:f}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:c}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:f})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),d.jsx("span",{className:V("time-to-complete",a),"aria-label":u,children:l})};const Kl={},Ua=C.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},...l},u)=>{const c=oe.useIntl(),f=C.useRef(null),m=u||f,[p,g]=C.useState(n?"open":"hidden"),{extraPadding:h=!0,hasPointer:y=!1,hasForm:b=!1}=t,{onOpen:x=()=>{},onClose:B=()=>{}}=o;e||(e=Date.now().toString());const E=Kl[e];C.useEffect(()=>{const $=m==null?void 0:m.current;if($)return $.addEventListener("transitionend",_),$.addEventListener("keydown",T),()=>{$.removeEventListener("transitionend",_),$.removeEventListener("keydown",T)}},[]);const _=({propertyName:$})=>{$==="opacity"&&(E!==!1&&clearTimeout(E),g(I=>(I==="open"?x():I==="closed"&&B(),I==="opening"?"open":I==="closing"?"closed":I==="closed"?"hidden":I)))},T=$=>{$.key==="Escape"&&($.stopPropagation(),$.preventDefault(),g("closing"))};Ln(()=>{E!==!1&&clearTimeout(E);let $="open";n?g("opening"):(g("closing"),$="hidden"),Kl[e||""]=setTimeout(()=>{g($)},300)},[n]);const A={...l};return s&&s.onBlur&&(A.onBlur=s.onBlur),d.jsx("aside",{ref:m,className:V("tooltip text-medium",p,i,{loading:r,"extra-padding":h,"has-pointer":y,bottom:y==="bottom","has-form":b}),...A,children:d.jsx("div",{className:"content",hidden:p==="hidden",children:r?d.jsx("p",{children:c.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?d.jsx("p",{children:a}):a})})});const Fx=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",d.jsx(Yn,{...n,className:V("banner",e),image:{...t,aspect:"banner"}})):null;const an=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return d.jsx("section",{className:V("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const Tx=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),d.jsx(an,{className:V("download-section",n),children:d.jsxs("div",{className:"content-default",children:[C.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),d.jsx(yn,{buttons:r})]})})};function _f({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const Sx=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=oe.useIntl();return d.jsxs("div",{className:V("edit-section-placeholder",{"has-icon":!!e}),style:bc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(xe,{href:r,variant:"secondary",size:"small",onClick:()=>_f({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},jx=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=C.useState(!1),c=typeof r=="string"||!!n,f=()=>u(!1);return d.jsxs("section",{className:V("edit-section",t),children:[n&&d.jsx(Tr,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:f},className:V("edit-section-modal"),children:d.jsx(Gn,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async m=>{var p,g;(p=n==null?void 0:n.functions)!=null&&p.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(m)),u(!1)},onCancel:f}})}),d.jsxs("div",{className:"edit-section-header",children:[d.jsx("h2",{className:"edit-section-header-title",children:a}),c&&d.jsx(xe,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>_f({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(Sx,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(Qt,{})]})};const Ox=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return d.jsxs("div",{className:V("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&C.createElement(s.element,{className:V("title",s.className)},s.text),t&&d.jsx("p",{children:t}),d.jsx("ul",{className:V({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:c,nameOfBusiness:f,link:m=!1,description:p=!1},g)=>{if(!c||!c.url)return null;const h=d.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:f});return d.jsxs("li",{children:[d.jsx("p",{className:"img-wrapper",children:m?d.jsx("a",{href:m,target:"_blank",rel:"nofollow noreferrer noopener",children:h}):h}),p&&d.jsx("small",{children:p})]},window.btoa(`${c.url}_${g}`))})})]})};const Px=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Nx=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,h;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],f={eyebrow:"small",title:"h1",text:"p"},m={};c.forEach(y=>{if(!t[y]){m[y]=!1;return}if(!s[y]){if(typeof t[y]=="object"){m[y]=t[y];const{text:b,element:x}=t[y];if(x&&Px.includes(x.toLowerCase()))return;m[y]={text:b,element:f[y]};return}m[y]={text:t[y],element:f[y]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=y=>{y.preventDefault(),y.stopPropagation();const b=document.getElementById(o.link.substring(1));b&&b.scrollIntoView({behavior:"smooth"})}),d.jsx(an,{className:V("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&a==="normal"&&m.eyebrow&&m.title}),children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"content-wrapper",children:[c.map(y=>{if(m[y]&&typeof m[y]=="object"){const{text:b,element:x=""}=m[y];return y==="text"?d.jsx(zn,{overrideType:"text-only",className:"text",children:b},y):C.createElement(x,{key:y,className:y},b)}return null}),l,p&&d.jsx(xe,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:V({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(h=o.props)==null?void 0:h.className}),children:o.text})]}),n&&d.jsx(Yn,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},Rx=C.memo(Nx);const Mx=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),d.jsx(an,{className:V("custom-content-banner",t,r,{"has-image":e}),style:a,children:d.jsx("div",{className:"content-slim",children:n})})};const Ix=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx(zn,{children:n}):n;return d.jsxs(an,{className:V("highlight-section",t),children:[r&&d.jsx("div",{className:V("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:d.jsx(Yn,{image:r})}),d.jsx("div",{className:V("highlight-container highlight-content-wrapper",{"no-image":!r}),children:d.jsx("div",{className:V("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:d.jsx("div",{className:"content-default",children:a})})})]})},$x=C.memo(Ix);const Lx=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:d.jsxs("aside",{className:V("marketing-block",e),children:[n&&d.jsx("p",{className:"title",children:n}),r&&d.jsx("p",{children:r}),t&&d.jsx(xe,{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})]}),zx=({type:e,data:t})=>{const n=oe.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const f=a&&Gi(a);return d.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&d.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})]})]})}if(c&&!i||s)return d.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):As(c)});if(o)return d.jsx(Rn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const f=u&&Gi(u);return d.jsxs("ul",{className:"details",children:[l&&d.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&d.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})})]})}return null},Ba={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"}},qx=({data:e,cta:t,link:n,gtmContext:r})=>{var h,y;const a=oe.useIntl(),[i,s]=C.useState({loading:!1,registered:e.registered||!1});C.useEffect(()=>{e.registered&&s(b=>({...b,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:c,slug:f}=e,m=e.contentType;let p="";if((h=Ba[m])!=null&&h.gtmEvent&&(p=Ba[m].gtmEvent),l&&u)return n?d.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(m==="people")return n?d.jsx(xe,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(m)&&c!=="premium"){const b=i.loading||i.registered||((y=e==null?void 0:e.members)==null?void 0:y.isMember),x=async B=>{if(B.preventDefault(),B.stopPropagation(),!(b||!t||!t.onClick)){s(E=>({...E,loading:!0}));try{const E=await t.onClick(e);s(E==="success"?()=>({registered:!0,loading:!1}):_=>({..._,loading:!1}))}catch{s(_=>({..._,loading:!1}))}}};return d.jsx("p",{className:V("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:d.jsx(xe,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:b,"data-gtm-event-context":`${r}Page-${m}: ${f}`,"data-gtm-event-type":`${r}-${m}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${m}${b?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const Wx={title:66,text:3e3,secondaryText:1e3,partner:25},lo=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s})=>{var A,$,I;const o=oe.useIntl(),l=C.useContext(Ot),u=l&&typeof l.id=="string",[c,f]=C.useState({data:null,isLoading:!0}),{data:m,isLoading:p}=c,g=C.useCallback(()=>{n(t,u).then(j=>{f(()=>({data:j,isLoading:!1}))}).catch(()=>f(j=>({...j,isLoading:!1})))},[e]);if(C.useEffect(()=>{g()},[]),p||!m)return d.jsx(Ct,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:o.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:h}=m;if(!h||!Ba[h])return d.jsx(Ct,{element:"li",className:"card-wrapper"});const{basePath:y="",className:b,length:x,gtmEvent:B}=Ba[h];let E=m.slug?`${y}${m.slug}`:!1;m.slug&&(m.slug.slice(0,4)==="http"||m.slug.slice(0,2)==="//"||m.slug.slice(0,6)==="mailto"||m.slug.slice(0,3)==="tel")&&(E=m.slug);const _={...Wx,...x};let T={className:"card"};return E&&(T={href:E,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${B}-click`,"data-testid":"link"},m.openInNewTab&&(T.target="_blank")),d.jsx("li",{className:V("card-wrapper text-medium",b,i,{"has-link":E,"no-link":!E,"has-image":m.banner}),"data-testid":`${h}-card`,children:C.createElement(E?"a":"div",T,d.jsxs(d.Fragment,{children:[d.jsx(wc,{className:"card-label",contentType:h,customIcon:m.customIcon,customLabel:m.customLabel}),m.startDate&&!m.isOngoingEvent&&d.jsx(Rn,{size:"small",variant:m.dateHasPassed?"default":"information","data-testid":"date",children:m.dateHasPassed?o.formatMessage({id:"card_ended"}):yc(m.startDate)}),m.banner?d.jsxs("p",{className:"img",children:[m.registered&&d.jsx(Rn,{size:"small",variant:"registered",children:o.formatMessage({id:"card_registered"})}),d.jsx(Yn,{image:m.banner})]}):b==="people"?d.jsx(tn,{name:m.title||"",src:m.profile,"data-testid":"people-profile-picture"}):null,m.contributors&&d.jsx(js,{contributors:{data:m.contributors},styling:{size:"small",showGap:b!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(h)?o.formatMessage({id:`card_contributors_${h}`}):void 0,"data-testid":"contributors"}),m.partner&&d.jsx("p",{className:"partners","data-testid":"partners",children:m.partner.length>1?o.formatMessage({id:"card_partner"},{partner:m.partner[0],number:m.partner.length-1}):$n(m.partner[0],_.partner)}),["title","text","secondaryText"].map(j=>{const R=m[j];if(!R)return null;const w=mc(j);return d.jsx(Lt,{className:w,options:{wrapper:"p",forceWrapper:!0,forceInline:!0},"data-testid":w,children:$n(R,_[j])},j)}),(l==null?void 0:l.id)&&(m==null?void 0:m.members)&&d.jsxs("span",{className:"member-information",children:[((A=m==null?void 0:m.members)==null?void 0:A.isMember)&&d.jsx(Rn,{size:"small",variant:"registered",icon:(($=m==null?void 0:m.members)==null?void 0:$.memberType)==="owner"?"user":"tick",children:o.formatMessage({id:`card_member_type_${(I=m==null?void 0:m.members)==null?void 0:I.memberType}`})}),d.jsx("br",{}),d.jsx("span",{className:"label member-count",children:o.formatMessage({id:"card_member_count"},{count:m==null?void 0:m.members.count})})]}),d.jsx(zx,{type:b||"",data:m}),d.jsx(qx,{data:m,cta:r,link:E||"",gtmContext:a})]}))})};const kf=({cards:e,cardTypes:t,className:n="",...r})=>d.jsx("ul",{className:V("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return d.jsx(lo,{id:s,card:{...a,contentType:t[i]},...r},s)})}),Hx=(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},Ux=({id:e,title:t})=>{const n=oe.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return C.createElement(a,{className:V("title",i,s,{"highlighted-title":i==="highlighted"}),children:d.jsxs(d.Fragment,{children:[r,o&&d.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const Oi={fourCards:1024,threeCards:769,twoCards:480};let Gr=null;const Vx=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=oe.useIntl(),[u,c]=C.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:f,isLoading:m}=u,[p,g]=C.useState({currentPage:0,loadedPages:[0]}),{currentPage:h,loadedPages:y}=p,b=t.length,x=Math.ceil(b/f),B=C.useRef(null),E=Kn(!0,!0,B==null?void 0:B.current);C.useEffect(()=>{let j=1;E&&(E>=Oi.fourCards?j=4:E>=Oi.threeCards?j=3:E>=Oi.twoCards&&(j=2),j>b&&(j=b)),c(R=>({...R,cardsPerPage:j,isLoading:!1}))},[E,b]);const _=(j="next")=>{let R=h;if(typeof j=="string")if(j==="next")if(h<x-1)R=h+1;else return;else if(h>0)R=h-1;else return;else R=j;g(w=>({...w,currentPage:R,loadedPages:[...new Set([...y,R])]}))},T=j=>{Gr=j.touches[0].clientX},A=j=>{if(Gr===null)return;const R=j.touches[0].clientX,w=Gr-R;w>5?_("next"):w<-5&&_("previous"),Gr=null},$={"--width":`${E||0}px`,"--total-cards":b,"--cards-per-page":f,"--page":h};if(m)return d.jsx(Ts,{layout:`carousel${a?"-with-title":""}`});const I=(j,R)=>{var F;let w=null;return(F=j==null?void 0:j.sys)!=null&&F.id?w=`card-${j.sys.id}`:j!=null&&j.slug?w=`card-${j.slug}`:[n[R],j.contentType].includes("customCard")&&(w=`card-${window.btoa(`${j.title} ${j.createdAt}`)}-${R}`),w};return d.jsxs("section",{ref:B,className:V("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx(Ux,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:T,onTouchMove:A,style:$,"data-testid":"carousel-list",children:t.map((j,R)=>{let w=I(j,R);return w&&Hx(R,f,h,y)?d.jsx(lo,{id:w,card:{...j,contentType:n[R]},buildCardData:r,gtmContext:s,...o},w):(w=w||`${e}-card-${R}`,d.jsx(Ct,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},w))})}),x<=1?null:d.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[d.jsx("li",{className:"arrow previous",children:d.jsx(xe,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:j=>{j.preventDefault(),j.stopPropagation(),_("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:h<=0})}),[...Array(x)].map((j,R)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:V("page-indicator",{selected:R===h}),onClick:w=>{w.preventDefault(),w.stopPropagation(),_(R)},children:d.jsx(Ie,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:R+1,total:x})})})},`page-indicator-${R}`)),d.jsx("li",{className:"arrow next",children:d.jsx(xe,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:j=>{j.preventDefault(),j.stopPropagation(),_("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:h>=x-1})})]})]})},Kx=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const c=i?window.btoa(i):`carousel-${u}`,f=u===e.length-1;return t?d.jsxs(C.Fragment,{children:[d.jsx(Ts,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),f?null:d.jsx(Qt,{})]},`placeholder-${c}`):d.jsxs(C.Fragment,{children:[d.jsx(Vx,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),f?null:d.jsx(Qt,{})]},`carousel-${c}`)});const Pi="joinCommunityButton",co=({isMember:e=!1,isShort:t=!1,functions:{join:n,leave:r}={join:()=>{},leave:()=>{}}})=>{const a=oe.useIntl(),i=C.useContext(Ot),s=i&&typeof i.id=="string",[o,l]=C.useState(e),[u,c]=C.useState(e?"joined":"notJoined");C.useEffect(()=>{u==="joining"?c("joined"):u==="leaving"&&c("notJoined")},[o]);const f={},m={};return o&&u!=="leaving"&&(f["data-hover-text"]=a.formatMessage({id:`${Pi}_leave`}),f["aria-label"]=a.formatMessage({id:`${Pi}_member_aria`}),m["aria-hidden"]="true"),d.jsx(xe,{variant:o?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:o&&u!=="leaving"?{icon:"tick",position:"left"}:!1,onClick:async p=>{s&&(p.currentTarget.blur(),o?(c("leaving"),typeof r=="function"&&await r()):(c("joining"),typeof n=="function"&&await n()),l(!o))},className:V("join-community-button",u,{active:u==="joining"}),disabled:!s,...f,children:d.jsx("span",{className:"text",...m,children:a.formatMessage({id:`${Pi}${["joining","leaving"].includes(u)?`_${u}`:o?"_member":t?"_short":""}`})})})};const Ni="communityDetails_",Zx=({className:e="",isMember:t=!1,slug:n,members:{number:r=0,data:a=[]}={number:0,data:[]},functions:{invite:i,...s}})=>{const o=oe.useIntl(),l=5,u=r||a.length,c=a.length?a:Array(l).fill({}),f=`/communities/${n}/members`===window.location.pathname;return d.jsxs("div",{className:V("community-details",e),children:[d.jsxs("div",{className:"member-details",children:[d.jsxs("div",{className:"top",children:[d.jsxs("h4",{children:[o.formatMessage({id:`${Ni}members`}),d.jsx("span",{className:"count",children:u})]}),!f&&d.jsx("p",{className:"text-small",children:d.jsx("a",{href:`/communities/${n}/members`,children:o.formatMessage({id:`${Ni}viewAll`})})})]}),d.jsx(js,{contributors:{total:r,data:c},styling:{size:"medium",showGap:!0,showPlaceholders:u===0},cutoff:l})]}),d.jsx(co,{isMember:t,functions:{...s}}),t&&d.jsx(xe,{variant:"primary",onClick:i,icon:{icon:"plus"},styling:{fullWidth:!0},children:o.formatMessage({id:`${Ni}invite`})})]})};const Yx=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Ie,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),d.jsx("ul",{className:V("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),d.jsxs("li",{children:[s&&d.jsx(Ie,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),d.jsx(Dn,{href:s?void 0:i,...l,children:$n(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Gx=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=oe.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=C.useState(t?["all"]:[]),u=(c,f)=>{let m=[];o.includes(c)?m=o.filter(p=>p!==c):c==="all"?m=["all"]:n?m=[...o.filter(p=>p!=="all"),c]:m=[c],l(p=>(r&&typeof r=="function"&&r({current:m,previous:p}),m)),f&&typeof f=="function"&&f()};return d.jsx("ul",{className:V("filters",a),children:s.map(({id:c,text:f,disabled:m=!1,callback:p=()=>{}})=>{let g={};return m&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:f})}),d.jsx("li",{children:d.jsx("button",{className:V(c,{selected:o.includes(c)}),onClick:h=>{h.preventDefault(),h.stopPropagation(),u(c,p)},...g,children:f})},c)})})},Qx=(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 Qr="languageSwitcher_",Jx=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=oe.useIntl(),{updateLanguage:c=()=>{}}=C.useContext(so),[f,m]=C.useState(e);if(C.useEffect(()=>{e!==f&&m(e)},[e]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const g=Object.keys(r),h=f!==e;return d.jsxs("div",{className:V("language-switcher text-small",s,l),children:[d.jsxs("nav",{children:[s!=="short"&&d.jsx("p",{children:o||u.formatMessage({id:`${Qr}label`})}),d.jsx("ul",{children:g.map(y=>{var B;if(!da[y])return null;const b=(B=r[y])==null?void 0:B.post_name;let x={className:y};if(f===y)x["aria-label"]=u.formatMessage({id:`${Qr}selected`},{language:da[y]});else{const E=Qx(y,b,i);x={...x,href:typeof E=="string"?E:E.url,onClick:_=>{m(y),c(y),typeof a<"u"&&(_.preventDefault(),_.stopPropagation(),a(y,typeof E=="string"?E:E.urlForRouter))}}}return d.jsx("li",{children:d.jsx(Dn,{...x,fallbackElement:"span",children:da[y]})},y)})}),s!=="short"&&!h&&d.jsx("p",{children:u.formatMessage({id:`${Qr}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!h&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${Qr}disclaimer`},{email:Fn.support,link:y=>{const b=`mailto:${y}`;return d.jsx("a",{href:b,children:y})}})})]})};const Ri=oe.createIntl({locale:"en",messages:Zn}),Sr=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:a="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:Ri.formatMessage({id:"loadMore_button"}),endOfFeed:Ri.formatMessage({id:"loadMore_endOfFeed"}),error:Ri.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,f]=C.useState(""),m=async p=>{if(!n)try{await t(p)}catch(g){g instanceof Error?f(g.message):f("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:d.jsx("footer",{className:V("load-more",l),children:!c&&e?d.jsx(xe,{variant:r,size:a,styling:i,icon:s,onClick:m,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!c||c!=null&&c.includes("Cannot read items"))?d.jsx("p",{children:o.endOfFeed}):c&&d.jsx("p",{className:"error",children:o.error})})};const fo=({variant:e="default",version:t="default",className:n="",...r})=>d.jsx("p",{className:"logo-wrapper",children:d.jsx("a",{href:"/home/",className:V("logo",e,t,n),...r,children:d.jsx(Ie,{children:d.jsx(oe.FormattedMessage,{id:"apolitical"})})})});let Jr=!1;const Bf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=oe.useIntl(),i=C.useRef(null),[s,o]=C.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return C.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),C.createElement(e,{ref:i,className:V("more-menu text-medium",r),children:d.jsxs(d.Fragment,{children:[d.jsx(xe,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),d.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:c,text:f,icon:m,...p},g)=>{const h={...p,onClick:y=>{o(!1),typeof c=="function"&&c(y)},onFocus:()=>{Jr&&(clearTimeout(Jr),Jr=!1)},onBlur:()=>{Jr=setTimeout(()=>{o(!1)},100)}};return u&&(h.href=u),d.jsx("li",{className:"more-menu-list-item",children:d.jsx(xe,{variant:"tertiary",size:"medium",icon:m?{icon:m,position:"left"}:!1,...h,children:f})},`${window.btoa(f)}_${g}`)})})]})})},Xx=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const ew=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Af=({activeLink:e})=>{const t=oe.useIntl(),n=C.useContext(Ot),r=n&&typeof n.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[ew.map(({key:a,href:i})=>{const s=Xx(i,e),o={};return s&&(o["aria-current"]="page"),d.jsx("li",{className:V(a,{active:s}),children:d.jsx("a",{href:i,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...o,children:t.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),r&&d.jsx("li",{className:"profile","data-testid":"profile-link",children:d.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[d.jsx(tn,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),d.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},sr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,tw=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${sr(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(`${sr(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(`${sr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
|
|
157
|
+
*/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 Yl(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){ix(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}function ix(e,t,n){return t=ox(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sx(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 ox(e){var t=sx(e,"string");return typeof t=="symbol"?t:String(t)}var Gl={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()}},ux=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},lx=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},Dr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},cx=function(t){return Dr(t)&&!t.shiftKey},dx=function(t){return Dr(t)&&t.shiftKey},Ql=function(t){return setTimeout(t,0)},Jl=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},ur=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},Jr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},fx=[],hx=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||fx,i=Yl({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:cx,isKeyBackward:dx},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(w,F,R){return w&&w[F]!==void 0?w[F]:i[R||F]},u=function(w,F){var R=typeof(F==null?void 0:F.composedPath)=="function"?F.composedPath():void 0;return s.containerGroups.findIndex(function(M){var K=M.container,V=M.tabbableNodes;return K.contains(w)||(R==null?void 0:R.includes(K))||V.find(function(oe){return oe===w})})},c=function(w){var F=i[w];if(typeof F=="function"){for(var R=arguments.length,M=new Array(R>1?R-1:0),K=1;K<R;K++)M[K-1]=arguments[K];F=F.apply(void 0,M)}if(F===!0&&(F=void 0),!F){if(F===void 0||F===!1)return F;throw new Error("`".concat(w,"` was specified but was not a node, or did not return a node"))}var V=F;if(typeof F=="string"&&(V=r.querySelector(F),!V))throw new Error("`".concat(w,"` as selector refers to no known node"));return V},f=function(){var w=c("initialFocus");if(w===!1)return!1;if(w===void 0||!pa(w,i.tabbableOptions))if(u(r.activeElement)>=0)w=r.activeElement;else{var F=s.tabbableGroups[0],R=F&&F.firstTabbableNode;w=R||c("fallbackFocus")}if(!w)throw new Error("Your focus-trap needs to have at least one focusable element");return w},m=function(){if(s.containerGroups=s.containers.map(function(w){var F=xf(w,i.tabbableOptions),R=wf(w,i.tabbableOptions),M=F.length>0?F[0]:void 0,K=F.length>0?F[F.length-1]:void 0,V=R.find(function(D){return cn(D)}),oe=R.slice().reverse().find(function(D){return cn(D)}),ne=!!F.find(function(D){return Qt(D)>0});return{container:w,tabbableNodes:F,focusableNodes:R,posTabIndexesFound:ne,firstTabbableNode:M,lastTabbableNode:K,firstDomTabbableNode:V,lastDomTabbableNode:oe,nextTabbableNode:function(q){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=F.indexOf(q);return _<0?ee?R.slice(R.indexOf(q)+1).find(function(S){return cn(S)}):R.slice(0,R.indexOf(q)).reverse().find(function(S){return cn(S)}):F[_+(ee?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(w){return w.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!c("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(w){return w.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function O(w){var F=w.activeElement;if(F)return F.shadowRoot&&F.shadowRoot.activeElement!==null?O(F.shadowRoot):F},g=function O(w){if(w!==!1&&w!==p(document)){if(!w||!w.focus){O(f());return}w.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=w,ux(w)&&w.select()}},h=function(w){var F=c("setReturnFocus",w);return F||(F===!1?!1:w)},y=function(w){var F=w.target,R=w.event,M=w.isBackward,K=M===void 0?!1:M;F=F||Jr(R),m();var V=null;if(s.tabbableGroups.length>0){var oe=u(F,R),ne=oe>=0?s.containerGroups[oe]:void 0;if(oe<0)K?V=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:V=s.tabbableGroups[0].firstTabbableNode;else if(K){var D=Jl(s.tabbableGroups,function($){var U=$.firstTabbableNode;return F===U});if(D<0&&(ne.container===F||pa(F,i.tabbableOptions)&&!cn(F,i.tabbableOptions)&&!ne.nextTabbableNode(F,!1))&&(D=oe),D>=0){var q=D===0?s.tabbableGroups.length-1:D-1,ee=s.tabbableGroups[q];V=Qt(F)>=0?ee.lastTabbableNode:ee.lastDomTabbableNode}else Dr(R)||(V=ne.nextTabbableNode(F,!1))}else{var _=Jl(s.tabbableGroups,function($){var U=$.lastTabbableNode;return F===U});if(_<0&&(ne.container===F||pa(F,i.tabbableOptions)&&!cn(F,i.tabbableOptions)&&!ne.nextTabbableNode(F))&&(_=oe),_>=0){var S=_===s.tabbableGroups.length-1?0:_+1,z=s.tabbableGroups[S];V=Qt(F)>=0?z.firstTabbableNode:z.firstDomTabbableNode}else Dr(R)||(V=ne.nextTabbableNode(F))}}else V=c("fallbackFocus");return V},v=function(w){var F=Jr(w);if(!(u(F,w)>=0)){if(ur(i.clickOutsideDeactivates,w)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}ur(i.allowOutsideClick,w)||w.preventDefault()}},x=function(w){var F=Jr(w),R=u(F,w)>=0;if(R||F instanceof Document)R&&(s.mostRecentlyFocusedNode=F);else{w.stopImmediatePropagation();var M,K=!0;if(s.mostRecentlyFocusedNode)if(Qt(s.mostRecentlyFocusedNode)>0){var V=u(s.mostRecentlyFocusedNode),oe=s.containerGroups[V].tabbableNodes;if(oe.length>0){var ne=oe.findIndex(function(D){return D===s.mostRecentlyFocusedNode});ne>=0&&(i.isKeyForward(s.recentNavEvent)?ne+1<oe.length&&(M=oe[ne+1],K=!1):ne-1>=0&&(M=oe[ne-1],K=!1))}}else s.containerGroups.some(function(D){return D.tabbableNodes.some(function(q){return Qt(q)>0})})||(K=!1);else K=!1;K&&(M=y({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(M||s.mostRecentlyFocusedNode||f())}s.recentNavEvent=void 0},B=function(w){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=w;var R=y({event:w,isBackward:F});R&&(Dr(w)&&w.preventDefault(),g(R))},k=function(w){if(lx(w)&&ur(i.escapeDeactivates,w)!==!1){w.preventDefault(),o.deactivate();return}(i.isKeyForward(w)||i.isKeyBackward(w))&&B(w,i.isKeyBackward(w))},E=function(w){var F=Jr(w);u(F,w)>=0||ur(i.clickOutsideDeactivates,w)||ur(i.allowOutsideClick,w)||(w.preventDefault(),w.stopImmediatePropagation())},A=function(){if(s.active)return Gl.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Ql(function(){g(f())}):g(f()),r.addEventListener("focusin",x,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",E,{capture:!0,passive:!1}),r.addEventListener("keydown",k,{capture:!0,passive:!1}),o},j=function(){if(s.active)return r.removeEventListener("focusin",x,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",E,!0),r.removeEventListener("keydown",k,!0),o},L=function(w){var F=w.some(function(R){var M=Array.from(R.removedNodes);return M.some(function(K){return K===s.mostRecentlyFocusedNode})});F&&g(f())},I=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(L):void 0,T=function(){I&&(I.disconnect(),s.active&&!s.paused&&s.containers.map(function(w){I.observe(w,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(w){if(s.active)return this;var F=l(w,"onActivate"),R=l(w,"onPostActivate"),M=l(w,"checkCanFocusTrap");M||m(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,F==null||F();var K=function(){M&&m(),A(),T(),R==null||R()};return M?(M(s.containers.concat()).then(K,K),this):(K(),this)},deactivate:function(w){if(!s.active)return this;var F=Yl({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},w);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,j(),s.active=!1,s.paused=!1,T(),Gl.deactivateTrap(a,o);var R=l(F,"onDeactivate"),M=l(F,"onPostDeactivate"),K=l(F,"checkCanReturnFocus"),V=l(F,"returnFocus","returnFocusOnDeactivate");R==null||R();var oe=function(){Ql(function(){V&&g(h(s.nodeFocusedBeforeActivation)),M==null||M()})};return V&&K?(K(h(s.nodeFocusedBeforeActivation)).then(oe,oe),this):(oe(),this)},pause:function(w){if(s.paused||!s.active)return this;var F=l(w,"onPause"),R=l(w,"onPostPause");return s.paused=!0,F==null||F(),j(),T(),R==null||R(),this},unpause:function(w){if(!s.paused||!s.active)return this;var F=l(w,"onUnpause"),R=l(w,"onPostUnpause");return s.paused=!1,F==null||F(),m(),A(),T(),R==null||R(),this},updateContainerElements:function(w){var F=[].concat(w).filter(Boolean);return s.containers=F.map(function(R){return typeof R=="string"?r.querySelector(R):R}),s.active&&m(),T(),this}},o.updateContainerElements(t),o};const mx=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:hx},Symbol.toStringTag,{value:"Module"})),px=hc(mx),gx=hc(ax);function Zn(e){"@babel/helpers - typeof";return Zn=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},Zn(e)}function vx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xl(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,Ef(r.key),r)}}function bx(e,t,n){return t&&Xl(e.prototype,t),n&&Xl(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function yx(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&&As(e,t)}function As(e,t){return As=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},As(e,t)}function Dx(e){var t=xx();return function(){var r=Sa(e),a;if(t){var i=Sa(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return Cx(this,a)}}function Cx(e,t){if(t&&(Zn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hr(e)}function hr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xx(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Sa(e){return Sa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Sa(e)}function wx(e,t,n){return t=Ef(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ef(e){var t=Ex(e,"string");return Zn(t)==="symbol"?t:String(t)}function Ex(e,t){if(Zn(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Zn(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Xr=C,me=qC,kx=px,_x=kx.createFocusTrap,Bx=gx,Ax=Bx.isFocusable,co=function(e){yx(n,e);var t=Dx(n);function n(r){var a;vx(this,n),a=t.call(this,r),wx(hr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var c=arguments.length,f=new Array(c>1?c-1:0),m=1;m<c;m++)f[m-1]=arguments[m];u=u.apply(void 0,f)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var p=u;if(typeof u=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),a.handleDeactivate=a.handleDeactivate.bind(hr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(hr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(hr(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 bx(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&&!Ax(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,c=u===void 0?!1:u;l&&o.focus({preventScroll:c}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?Xr.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===Xr.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var c=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=c||[u]},o=Xr.cloneElement(i,{ref:s});return o}return null}}]),n}(Xr.Component),lr=typeof Element>"u"?Function:Element;co.propTypes={active:me.bool,paused:me.bool,focusTrapOptions:me.shape({document:me.object,onActivate:me.func,onPostActivate:me.func,checkCanFocusTrap:me.func,onPause:me.func,onPostPause:me.func,onUnpause:me.func,onPostUnpause:me.func,onDeactivate:me.func,onPostDeactivate:me.func,checkCanReturnFocus:me.func,initialFocus:me.oneOfType([me.instanceOf(lr),me.string,me.bool,me.func]),fallbackFocus:me.oneOfType([me.instanceOf(lr),me.string,me.func]),escapeDeactivates:me.oneOfType([me.bool,me.func]),clickOutsideDeactivates:me.oneOfType([me.bool,me.func]),returnFocusOnDeactivate:me.bool,setReturnFocus:me.oneOfType([me.instanceOf(lr),me.string,me.bool,me.func]),allowOutsideClick:me.oneOfType([me.bool,me.func]),preventScroll:me.bool,tabbableOptions:me.shape({displayCheck:me.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:me.oneOfType([me.bool,me.func])}),trapStack:me.array,isKeyForward:me.func,isKeyBackward:me.func}),containerElements:me.arrayOf(me.instanceOf(lr)),children:me.oneOfType([me.element,me.instanceOf(lr)])};co.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:_x};var Fx=co;const Tx=xn(Fx),kf=({showDevTools:e=!0,children:t})=>{const n=new We.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return d.jsxs(We.QueryClientProvider,{client:n,children:[t,e&&d.jsx(uh.ReactQueryDevtools,{initialIsOpen:!1})]})};var Sx=C.createContext({client:sa});function jx(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=C.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(sa.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),sa.init(r,a)),sa)},[n,r]);return C.createElement(Sx.Provider,{value:{client:i}},t)}const _f=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(jx,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):d.jsx(d.Fragment,{children:e}),Bf=({children:e,locale:t,messages:n})=>{const r=t||"en",a={..._h[r],...n||{}};return d.jsx(ue.IntlProvider,{locale:r,messages:a,children:e})},fo=C.createContext({}),ga={en:"English",es:"Español",fr:"Français",pt:"Português"},Nt=C.createContext({isLoading:!0});function Ya(){return C.useContext(Nt)}const Af=({children:e,user:t})=>d.jsx(Nt.Provider,{value:t,children:e}),ho=C.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Ff=()=>C.useContext(ho),Tf=({children:e})=>{const[t,n]=C.useState([]);C.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=C.useCallback(i=>{n(s=>[...s,i])},[]),a=C.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return d.jsx(ho.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Ox=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=C.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=C.useState(s),u=c=>{localStorage.setItem("language",c),l(c)};return C.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),_c(5e3)}).catch(c=>{c.message===wc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(fo.Provider,{value:{language:o,updateLanguage:u},children:d.jsx(Bf,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(Ts.CookiesProvider,{children:d.jsx(Af,{user:a,children:d.jsx(Tf,{children:d.jsx(kf,{showDevTools:r,children:d.jsx(_f,{user:a,children:t})})})})})})})};const mo=({element:e="section",children:t,className:n,...r})=>C.createElement(e,{className:Z("modal",n),children:typeof t=="string"?d.jsx("p",{children:t}):t,...r});const Pr=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:c="",gtmContext:f="Modal"})=>{const m=ue.useIntl(),{registerOverlay:p,unregisterOverlay:g}=Ff(),[h,y]=C.useState(t),v=k=>{k.key==="Escape"&&x(!1)};C.useEffect(()=>(window.addEventListener("keyup",v),()=>{window.removeEventListener("keyup",v)}));const x=k=>{y(k),k?(a(),p(e)):(i(),g(e))};C.useEffect(()=>(x(t),()=>{h&&g(e)}),[t]);const B=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{className:Z("overlay",{open:h}),role:"dialog",children:d.jsx(mo,{id:e,className:Z("overlay-modal",c,{"has-max-width":r}),hidden:!h,style:B,children:t&&d.jsx(Tx,{children:d.jsxs("div",{className:"overlay-content",children:[d.jsxs("div",{className:"top",children:[o&&d.jsx("h2",{className:"modal-title",children:o}),d.jsx(we,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>x(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":f,screenreaderText:m.formatMessage({id:"overlay_close"})})]}),n&&d.jsx(en,{}),l,u&&d.jsxs("div",{className:"bottom",children:[d.jsx(en,{}),d.jsx(wn,{buttons:u})]}),s&&d.jsx(xr,{className:"error",children:s})]})})})})},Sf=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Px=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const c=ue.useIntl();return r||(r=c.formatMessage({id:"inviteModal_formTitle"})),a||(a=c.formatMessage({id:"inviteModal_formLabel"})),i||(i=c.formatMessage({id:"inviteModal_cta"})),d.jsx(Pr,{title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:Z("invite-modal",e,{success:!!n}),children:d.jsx(ff,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const Nx=({members:e})=>{const[t,n]=C.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return d.jsxs(d.Fragment,{children:[d.jsx(an,{name:i,src:l}),d.jsx("p",{children:i}),d.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return d.jsxs("div",{className:"directory-wrapper",children:[d.jsx("ul",{className:"directory",children:e.map(a=>d.jsx("li",{children:d.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),d.jsx(Pr,{isOpen:t!==!1,children:t===!1?"":d.jsxs(d.Fragment,{children:[r(t),d.jsx(Hn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const Rx=({author:e,authorCite:t,content:n,member:r,className:a=""})=>d.jsxs("blockquote",{className:Z("testimonial-block",a),children:[d.jsx(Wt,{className:"testimonial",children:n}),r?d.jsx(jr,{member:r,styling:{size:"large"}}):d.jsxs(d.Fragment,{children:[e&&d.jsx("p",{className:Z("author",{"text-small":!a.includes("new")}),children:e}),t&&d.jsx("p",{className:Z("author-cite",{"text-small":!a.includes("new")}),children:d.jsx("cite",{children:t})})]})]}),Mx=C.memo(Rx);const Ix=({items:e=[],selector:t="",className:n=""})=>{const r=ue.useIntl(),[a,i]=C.useState(e);return C.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,c)=>{s+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&d.jsxs(Ot,{variant:"subtle",className:Z("table-of-contents",n),children:[d.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),d.jsx("nav",{children:d.jsx("ul",{children:a.map(({id:s,text:o})=>d.jsx("li",{children:d.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Ga=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ue.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=c=>{const f=c/60,m=Math.floor(f),p=(f-m)*60,g=Math.round(p),h=`${i.formatMessage({id:`${s}hours`},{time:m})}${m>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${m>0?`${i.formatMessage({id:`${s}hours_short`},{time:m})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:h}};let{text:l,ariaText:u}=o(e);if(t){const{text:c,ariaText:f}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:c}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:f})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),d.jsx("span",{className:Z("time-to-complete",a),"aria-label":u,children:l})};const $x=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",d.jsx(Xn,{...n,className:Z("banner",e),image:{...t,aspect:"banner"}})):null;const un=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return d.jsx("section",{className:Z("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const Lx=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),d.jsx(un,{className:Z("download-section",n),children:d.jsxs("div",{className:"content-default",children:[C.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),d.jsx(wn,{buttons:r})]})})};function jf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const zx=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ue.useIntl();return d.jsxs("div",{className:Z("edit-section-placeholder",{"has-icon":!!e}),style:Ec(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(we,{href:r,variant:"secondary",size:"small",onClick:()=>jf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},qx=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=C.useState(!1),c=typeof r=="string"||!!n,f=()=>u(!1);return d.jsxs("section",{className:Z("edit-section",t),children:[n&&d.jsx(Pr,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:f},className:Z("edit-section-modal"),children:d.jsx(er,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async m=>{var p,g;(p=n==null?void 0:n.functions)!=null&&p.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(m)),u(!1)},onCancel:f}})}),d.jsxs("div",{className:"edit-section-header",children:[d.jsx("h2",{className:"edit-section-header-title",children:a}),c&&d.jsx(we,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>jf({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(zx,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(en,{})]})};const Wx=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return d.jsxs("div",{className:Z("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&C.createElement(s.element,{className:Z("title",s.className)},s.text),t&&d.jsx("p",{children:t}),d.jsx("ul",{className:Z({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:c,nameOfBusiness:f,link:m=!1,description:p=!1},g)=>{if(!c||!c.url)return null;const h=d.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:f});return d.jsxs("li",{children:[d.jsx("p",{className:"img-wrapper",children:m?d.jsx("a",{href:m,target:"_blank",rel:"nofollow noreferrer noopener",children:h}):h}),p&&d.jsx("small",{children:p})]},window.btoa(`${c.url}_${g}`))})})]})};const Hx=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Ux=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,h;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],f={eyebrow:"small",title:"h1",text:"p"},m={};c.forEach(y=>{if(!t[y]){m[y]=!1;return}if(!s[y]){if(typeof t[y]=="object"){m[y]=t[y];const{text:v,element:x}=t[y];if(x&&Hx.includes(x.toLowerCase()))return;m[y]={text:v,element:f[y]};return}m[y]={text:t[y],element:f[y]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=y=>{y.preventDefault(),y.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),d.jsx(un,{className:Z("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&a==="normal"&&m.eyebrow&&m.title}),children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"content-wrapper",children:[c.map(y=>{if(m[y]&&typeof m[y]=="object"){const{text:v,element:x=""}=m[y];return y==="text"?d.jsx(Hn,{overrideType:"text-only",className:"text",children:v},y):C.createElement(x,{key:y,className:y},v)}return null}),l,p&&d.jsx(we,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:Z({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(h=o.props)==null?void 0:h.className}),children:o.text})]}),n&&d.jsx(Xn,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},Vx=C.memo(Ux);const Kx=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),d.jsx(un,{className:Z("custom-content-banner",t,r,{"has-image":e}),style:a,children:d.jsx("div",{className:"content-slim",children:n})})};const Zx=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx(Hn,{children:n}):n;return d.jsxs(un,{className:Z("highlight-section",t),children:[r&&d.jsx("div",{className:Z("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:d.jsx(Xn,{image:r})}),d.jsx("div",{className:Z("highlight-container highlight-content-wrapper",{"no-image":!r}),children:d.jsx("div",{className:Z("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:d.jsx("div",{className:"content-default",children:a})})})]})},Yx=C.memo(Zx);const Gx=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:d.jsxs("aside",{className:Z("marketing-block",e),children:[n&&d.jsx("p",{className:"title",children:n}),r&&d.jsx("p",{children:r}),t&&d.jsx(we,{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})]}),Qx=({type:e,data:t})=>{const n=ue.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const f=a&&es(a);return d.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&d.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})]})]})}if(c&&!i||s)return d.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):js(c)});if(o)return d.jsx(fn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const f=u&&es(u);return d.jsxs("ul",{className:"details",children:[l&&d.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&d.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})})]})}return null},ja={communityPage:{basePath:"/communities/",className:"communityPage",gtmEvent:"community"},customCard:{className:"custom",gtmEvent:"custom",length:{text:335,secondaryText:150}},event:{basePath:"/events/",className:"event",gtmEvent:"event"},microcourse:{basePath:"/microcourses/en/",className:"course",gtmEvent:"microcourse-overview"},solutionArticle:{basePath:"/solution-articles/en/",className:"article",length:{title:60},gtmEvent:"article"},qaQuestion:{basePath:"/questions-answers/",className:"question",length:{title:190},gtmEvent:"q-and-a-question"},listPage:{basePath:"/list/en/",className:"list",gtmEvent:"list"},people:{basePath:"/profiles/",className:"people",length:{people:1e3},gtmEvent:"person"},learningHub:{basePath:"/learning-hub/",className:"learning-hub",length:{title:190},gtmEvent:"learning-hub"}},Jx=({data:e,cta:t,link:n,gtmContext:r})=>{var h,y;const a=ue.useIntl(),[i,s]=C.useState({loading:!1,registered:e.registered||!1});C.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:c,slug:f}=e,m=e.contentType;let p="";if((h=ja[m])!=null&&h.gtmEvent&&(p=ja[m].gtmEvent),l&&u)return n?d.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(m==="people")return n?d.jsx(we,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(m)&&c!=="premium"){const v=i.loading||i.registered||((y=e==null?void 0:e.members)==null?void 0:y.isMember),x=async B=>{if(B.preventDefault(),B.stopPropagation(),!(v||!t||!t.onClick)){s(k=>({...k,loading:!0}));try{const k=await t.onClick(e);s(k==="success"?()=>({registered:!0,loading:!1}):E=>({...E,loading:!1}))}catch{s(E=>({...E,loading:!1}))}}};return d.jsx("p",{className:Z("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:d.jsx(we,{onClick:x,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${m}: ${f}`,"data-gtm-event-type":`${r}-${m}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${m}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const Xx={title:66,text:3e3,secondaryText:1e3,partner:25},po=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s})=>{var j,L,I;const o=ue.useIntl(),l=C.useContext(Nt),u=l&&typeof l.id=="string",[c,f]=C.useState({data:null,isLoading:!0}),{data:m,isLoading:p}=c,g=C.useCallback(()=>{n(t,u).then(T=>{f(()=>({data:T,isLoading:!1}))}).catch(()=>f(T=>({...T,isLoading:!1})))},[e]);if(C.useEffect(()=>{g()},[]),p||!m)return d.jsx(wt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:o.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:h}=m;if(!h||!ja[h])return d.jsx(wt,{element:"li",className:"card-wrapper"});const{basePath:y="",className:v,length:x,gtmEvent:B}=ja[h];let k=m.slug?`${y}${m.slug}`:!1;m.slug&&(m.slug.slice(0,4)==="http"||m.slug.slice(0,2)==="//"||m.slug.slice(0,6)==="mailto"||m.slug.slice(0,3)==="tel")&&(k=m.slug);const E={...Xx,...x};let A={className:"card"};return k&&(A={href:k,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${B}-click`,"data-testid":"link"},m.openInNewTab&&(A.target="_blank")),d.jsx("li",{className:Z("card-wrapper text-medium",v,i,{"has-link":k,"no-link":!k,"has-image":m.banner}),"data-testid":`${h}-card`,children:C.createElement(k?"a":"div",A,d.jsxs(d.Fragment,{children:[d.jsx(Fc,{className:"card-label",contentType:h,customIcon:m.isPrivate?"lock-locked":m.customIcon,customLabel:m.customLabel}),h==="communityPage"&&(m==null?void 0:m.createdAt)&&Dh(m==null?void 0:m.createdAt,60)&&d.jsx(fn,{size:"small",variant:"information","data-testid":"new-community",children:"New"}),m.startDate&&!m.isOngoingEvent&&d.jsx(fn,{size:"small",variant:m.dateHasPassed?"default":"information","data-testid":"date",children:m.dateHasPassed?o.formatMessage({id:"card_ended"}):kc(m.startDate)}),m.banner?d.jsxs("p",{className:"img",children:[m.registered&&d.jsx(fn,{size:"small",variant:"registered",children:o.formatMessage({id:"card_registered"})}),d.jsx(Xn,{image:m.banner})]}):v==="people"?d.jsx(an,{name:m.title||"",src:m.profile,"data-testid":"people-profile-picture"}):null,m.contributors&&d.jsx(Rs,{contributors:{data:m.contributors},styling:{size:"small",showGap:v!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(h)?o.formatMessage({id:`card_contributors_${h}`}):void 0,"data-testid":"contributors"}),m.partner&&d.jsx("p",{className:"partners","data-testid":"partners",children:m.partner.length>1?o.formatMessage({id:"card_partner"},{partner:m.partner[0],number:m.partner.length-1}):qn(m.partner[0],E.partner)}),["title","text","secondaryText"].map(T=>{const O=m[T];if(!O)return null;const w=Dc(T);return d.jsx(Wt,{className:w,options:{wrapper:"p",forceWrapper:!0,forceInline:!0},"data-testid":w,children:qn(O,E[T])},T)}),(l==null?void 0:l.id)&&(m==null?void 0:m.members)&&d.jsxs("span",{className:"member-information",children:[((j=m==null?void 0:m.members)==null?void 0:j.isMember)&&d.jsx(fn,{size:"small",variant:"registered",icon:((L=m==null?void 0:m.members)==null?void 0:L.memberType)==="owner"?"user":"tick",children:o.formatMessage({id:`card_member_type_${(I=m==null?void 0:m.members)==null?void 0:I.memberType}`})}),d.jsx("br",{}),d.jsx("span",{className:"label member-count",children:o.formatMessage({id:"card_member_count"},{count:m==null?void 0:m.members.count})})]}),d.jsx(Qx,{type:v||"",data:m}),d.jsx(Jx,{data:m,cta:r,link:k||"",gtmContext:a})]}))})};const Of=({cards:e,cardTypes:t,className:n="",...r})=>d.jsx("ul",{className:Z("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return d.jsx(po,{id:s,card:{...a,contentType:t[i]},...r},s)})}),ew=(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},tw=({id:e,title:t})=>{const n=ue.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return C.createElement(a,{className:Z("title",i,s,{"highlighted-title":i==="highlighted"}),children:d.jsxs(d.Fragment,{children:[r,o&&d.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const Ii={fourCards:1024,threeCards:769,twoCards:480};let ea=null;const nw=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ue.useIntl(),[u,c]=C.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:f,isLoading:m}=u,[p,g]=C.useState({currentPage:0,loadedPages:[0]}),{currentPage:h,loadedPages:y}=p,v=t.length,x=Math.ceil(v/f),B=C.useRef(null),k=Gn(!0,!0,B==null?void 0:B.current);C.useEffect(()=>{let T=1;k&&(k>=Ii.fourCards?T=4:k>=Ii.threeCards?T=3:k>=Ii.twoCards&&(T=2),T>v&&(T=v)),c(O=>({...O,cardsPerPage:T,isLoading:!1}))},[k,v]);const E=(T="next")=>{let O=h;if(typeof T=="string")if(T==="next")if(h<x-1)O=h+1;else return;else if(h>0)O=h-1;else return;else O=T;g(w=>({...w,currentPage:O,loadedPages:[...new Set([...y,O])]}))},A=T=>{ea=T.touches[0].clientX},j=T=>{if(ea===null)return;const O=T.touches[0].clientX,w=ea-O;w>5?E("next"):w<-5&&E("previous"),ea=null},L={"--width":`${k||0}px`,"--total-cards":v,"--cards-per-page":f,"--page":h};if(m)return d.jsx(Ps,{layout:`carousel${a?"-with-title":""}`});const I=(T,O)=>{var F;let w=null;return(F=T==null?void 0:T.sys)!=null&&F.id?w=`card-${T.sys.id}`:T!=null&&T.slug?w=`card-${T.slug}`:[n[O],T.contentType].includes("customCard")&&(w=`card-${window.btoa(`${T.title} ${T.createdAt}`)}-${O}`),w};return d.jsxs("section",{ref:B,className:Z("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx(tw,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:A,onTouchMove:j,style:L,"data-testid":"carousel-list",children:t.map((T,O)=>{let w=I(T,O);return w&&ew(O,f,h,y)?d.jsx(po,{id:w,card:{...T,contentType:n[O]},buildCardData:r,gtmContext:s,...o},w):(w=w||`${e}-card-${O}`,d.jsx(wt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},w))})}),x<=1?null:d.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[d.jsx("li",{className:"arrow previous",children:d.jsx(we,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:T=>{T.preventDefault(),T.stopPropagation(),E("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:h<=0})}),[...Array(x)].map((T,O)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:Z("page-indicator",{selected:O===h}),onClick:w=>{w.preventDefault(),w.stopPropagation(),E(O)},children:d.jsx($e,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:O+1,total:x})})})},`page-indicator-${O}`)),d.jsx("li",{className:"arrow next",children:d.jsx(we,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:T=>{T.preventDefault(),T.stopPropagation(),E("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:h>=x-1})})]})]})},rw=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const c=i?window.btoa(i):`carousel-${u}`,f=u===e.length-1;return t?d.jsxs(C.Fragment,{children:[d.jsx(Ps,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),f?null:d.jsx(en,{})]},`placeholder-${c}`):d.jsxs(C.Fragment,{children:[d.jsx(nw,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),f?null:d.jsx(en,{})]},`carousel-${c}`)});const ta="joinCommunityButton",go=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ue.useIntl(),o=C.useContext(Nt),l=o&&typeof o.id=="string",u=r||!l,[c,f]=C.useState(e),[m,p]=C.useState(e?"joined":"notJoined");C.useEffect(()=>{m==="joining"?p("joined"):m==="leaving"&&p("notJoined")},[c]);const g={},h={};return c&&m!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${ta}_leave`}),g["aria-label"]=s.formatMessage({id:`${ta}_member_aria`}),h["aria-hidden"]="true"),d.jsx(we,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&m!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!c?s.formatMessage({id:`${ta}_closed_tooltip`}):"",onClick:async y=>{u||(y.currentTarget.blur(),c?(p("leaving"),typeof i=="function"&&await i()):(p("joining"),typeof a=="function"&&await a()),f(!c))},className:Z("join-community-button",m,{active:m==="joining"}),disabled:u,...g,children:d.jsx("span",{className:"text",...h,children:s.formatMessage({id:`${ta}${["joining","leaving"].includes(m)?`_${m}`:c?"_member":n?"_short":""}`})})})};const $i="communityDetails_",aw=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=ue.useIntl(),u=5,c=a||i.length,f=i.length?i:Array(u).fill({}),m=`/communities/${r}/members`===window.location.pathname,p=!n&&!t;return d.jsxs("div",{className:Z("community-details",e),children:[d.jsxs("div",{className:"member-details",children:[d.jsxs("div",{className:"top",children:[d.jsxs("h4",{children:[l.formatMessage({id:`${$i}members`}),d.jsx("span",{className:"count",children:c})]}),!m&&d.jsx("p",{className:"text-small",children:d.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${$i}viewAll`})})})]}),d.jsx(Rs,{contributors:{total:a,data:f},styling:{size:"medium",showGap:!0,showPlaceholders:c===0},cutoff:u})]}),d.jsx(go,{isMember:t,isOpen:n,disabled:p,functions:{...o}}),t&&d.jsx(we,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${$i}invite`})})]})};const iw=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx($e,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),d.jsx("ul",{className:Z("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),d.jsxs("li",{children:[s&&d.jsx($e,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),d.jsx(En,{href:s?void 0:i,...l,children:qn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const sw=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=ue.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=C.useState(t?["all"]:[]),u=(c,f)=>{let m=[];o.includes(c)?m=o.filter(p=>p!==c):c==="all"?m=["all"]:n?m=[...o.filter(p=>p!=="all"),c]:m=[c],l(p=>(r&&typeof r=="function"&&r({current:m,previous:p}),m)),f&&typeof f=="function"&&f()};return d.jsx("ul",{className:Z("filters",a),children:s.map(({id:c,text:f,disabled:m=!1,callback:p=()=>{}})=>{let g={};return m&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:f})}),d.jsx("li",{children:d.jsx("button",{className:Z(c,{selected:o.includes(c)}),onClick:h=>{h.preventDefault(),h.stopPropagation(),u(c,p)},...g,children:f})},c)})})},ow=(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_",uw=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ue.useIntl(),{updateLanguage:c=()=>{}}=C.useContext(fo),[f,m]=C.useState(e);if(C.useEffect(()=>{e!==f&&m(e)},[e]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const g=Object.keys(r),h=f!==e;return d.jsxs("div",{className:Z("language-switcher text-small",s,l),children:[d.jsxs("nav",{children:[s!=="short"&&d.jsx("p",{children:o||u.formatMessage({id:`${na}label`})}),d.jsx("ul",{children:g.map(y=>{var B;if(!ga[y])return null;const v=(B=r[y])==null?void 0:B.post_name;let x={className:y};if(f===y)x["aria-label"]=u.formatMessage({id:`${na}selected`},{language:ga[y]});else{const k=ow(y,v,i);x={...x,href:typeof k=="string"?k:k.url,onClick:E=>{m(y),c(y),typeof a<"u"&&(E.preventDefault(),E.stopPropagation(),a(y,typeof k=="string"?k:k.urlForRouter))}}}return d.jsx("li",{children:d.jsx(En,{...x,fallbackElement:"span",children:ga[y]})},y)})}),s!=="short"&&!h&&d.jsx("p",{children:u.formatMessage({id:`${na}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!h&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${na}disclaimer`},{email:On.support,link:y=>{const v=`mailto:${y}`;return d.jsx("a",{href:v,children:y})}})})]})};const Li=ue.createIntl({locale:"en",messages:Jn}),Nr=({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:Li.formatMessage({id:"loadMore_button"}),endOfFeed:Li.formatMessage({id:"loadMore_endOfFeed"}),error:Li.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,f]=C.useState(""),m=async p=>{if(!n)try{await t(p)}catch(g){g instanceof Error?f(g.message):f("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:d.jsx("footer",{className:Z("load-more",l),children:!c&&e?d.jsx(we,{variant:r,size:a,styling:i,icon:s,onClick:m,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!c||c!=null&&c.includes("Cannot read items"))?d.jsx("p",{children:o.endOfFeed}):c&&d.jsx("p",{className:"error",children:o.error})})};const vo=({variant:e="default",version:t="default",className:n="",...r})=>d.jsx("p",{className:"logo-wrapper",children:d.jsx("a",{href:"/home/",className:Z("logo",e,t,n),...r,children:d.jsx($e,{children:d.jsx(ue.FormattedMessage,{id:"apolitical"})})})});let ra=!1;const Pf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ue.useIntl(),i=C.useRef(null),[s,o]=C.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return C.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),C.createElement(e,{ref:i,className:Z("more-menu text-medium",r),children:d.jsxs(d.Fragment,{children:[d.jsx(we,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),d.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:c,text:f,icon:m,...p},g)=>{const h={...p,onClick:y=>{o(!1),typeof c=="function"&&c(y)},onFocus:()=>{ra&&(clearTimeout(ra),ra=!1)},onBlur:()=>{ra=setTimeout(()=>{o(!1)},100)}};return u&&(h.href=u),d.jsx("li",{className:"more-menu-list-item",children:d.jsx(we,{variant:"tertiary",size:"medium",icon:m?{icon:m,position:"left"}:!1,...h,children:f})},`${window.btoa(f)}_${g}`)})})]})})},lw=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const cw=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Nf=({activeLink:e})=>{const t=ue.useIntl(),n=C.useContext(Nt),r=n&&typeof n.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[cw.map(({key:a,href:i})=>{const s=lw(i,e),o={};return s&&(o["aria-current"]="page"),d.jsx("li",{className:Z(a,{active:s}),children:d.jsx("a",{href:i,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...o,children:t.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),r&&d.jsx("li",{className:"profile","data-testid":"profile-link",children:d.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[d.jsx(an,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),d.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},cr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,dw=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${cr(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(`${cr(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(`${cr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
|
|
158
158
|
|
|
159
|
-
${sr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:sr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const nw="shareLinks_",rw=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=oe.useIntl(),l=tw({title:e,link:t,referrer:n});return d.jsxs("aside",{className:V("share-links",a,i,s),children:[d.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),d.jsx("ul",{children:l.map(({key:u,icon:c,url:f,shouldRender:m=!0,onClick:p})=>{if(typeof m=="function"&&!m())return null;const g={};return p&&(g.onClick=h=>p(h,f)),d.jsx("li",{children:d.jsx(xe,{size:a,variant:"tertiary",icon:{icon:c||u},href:f,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${nw}link_${u}`}),...g})},u)})})]})};const aw=({tabs:e,className:t="",preventLocationChange:n})=>{var u;const r=(c,f,m)=>(c||(c=`panel-${window.btoa(f)}-${m}`),c);let a=e.findIndex(c=>c.current===!0);if(a<0&&(a=0),window.location.hash){const c=window.location.hash.replace("#","");if(e.find(m=>m.id===c)){for(let m=0;m<e.length;m++)if(r(e[m].id,e[m].text,m)===c){a=m;break}}}const[i,s]=C.useState((u=e[a])!=null&&u.id?e[a].id:r(e[a].id,e[a].text,a));C.useEffect(()=>{if(e[a].hasCarousel){const c=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(c)}},[i]);const o=[],l=[];return e.forEach(({id:c,text:f,content:m,href:p,hasCarousel:g},h)=>{c=r(c,f,h);const y=i===c,b={};p||(b["aria-controls"]=c,b.onClick=x=>{x.preventDefault(),x.stopPropagation(),s(c),!n&&(window.location.hash=`#${c}`)},l.push(d.jsx("section",{id:c,hidden:!y,role:"tabpanel","aria-labelledby":`tab-${c}`,"aria-live":y?"assertive":"off",children:typeof m=="string"?d.jsx("p",{children:m}):m},`section-${c}`))),o.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:p||`#${c}`,id:`tab-${c}`,className:V({selected:y}),role:"tab","aria-selected":y,...b,children:f})},`tab-${c}`))}),d.jsxs("div",{className:V("tabs-wrapper",t),children:[d.jsx("ul",{className:"tabs",role:"tablist",children:o}),d.jsx("div",{className:"tab-content",children:l})]})};const iw={"2-1":901,"1-3":769,"1-1":769},Ff=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Kn(!0);let s=a;return C.Children.count(a)===1&&(s=C.Children.toArray(a)[0],s.props&&(s=s.props.children)),d.jsx("section",{className:V("columns",`layout-${e}`,r,{"has-containers":n}),children:C.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<iw[e]?null:o)})};let Mi;const Ii="contactFooter_",sw=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=C.useRef(null),[r,a]=C.useState(0),[i,s]=C.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(Mi),Mi=setTimeout(()=>{o(),s(!1)},500))};return C.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(Mi),window.removeEventListener("resize",l)}),[]),d.jsx(an,{id:"contactForm",className:"contact-footer",children:d.jsxs("div",{className:"inner-wrapper",children:[d.jsx("h2",{children:d.jsx(oe.FormattedMessage,{id:`${Ii}title`})}),d.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[d.jsxs("aside",{children:[d.jsx("p",{children:d.jsx(oe.FormattedMessage,{id:`${Ii}text`})}),d.jsx(Dn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(oe.FormattedMessage,{id:`${Ii}email`})})]}),d.jsx(rf,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},ow=({activeLink:e,...t})=>d.jsx(an,{children:d.jsx(Ff,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(Af,{activeLink:e}),d.jsx(Bc,{...t})]})})});const $i="cookieBanner_",Li=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],zi=new Date(Date.now()+12*30*24*60*60*1e3),Tf=()=>{const e=oe.useIntl(),[t,n,r]=ks.useCookies(Li),[a,i]=C.useState(!t["apol-cookie-banner"]),s=()=>{Li.forEach(c=>{n(c,!0,{path:"/",expires:zi,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:zi}),Li.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:zi});return}r(c)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(c=>{u.push({variant:c.href?"tertiary":"primary",href:c.href,onClick:c.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${c.gtmType}-click`,children:e.formatMessage({id:`${$i}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${$i}title`})}),d.jsx("p",{children:e.formatMessage({id:`${$i}text`})}),d.jsx(yn,{buttons:u})]})},It={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Fn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Fn["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:Fn.support,gtmType:"concierge-email-click"},business:{email:Fn.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 Nn="footer_",Aa="SiteFooter",Zl=({group:e})=>{const t=It[e].order||[];let n=!1;return"text"in It[e]&&(n=It[e].text),d.jsxs(C.Fragment,{children:[d.jsx("p",{className:"pre-title",children:d.jsx(oe.FormattedMessage,{id:`${Nn}${e}`})}),Array.isArray(t)&&t.length>0&&d.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=It[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),d.jsx("li",{children:d.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Aa,"data-gtm-event-type":i,...s,children:d.jsx(oe.FormattedMessage,{id:`${Nn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&d.jsx("dl",{className:"text-medium",children:n.order.map(r=>d.jsxs(C.Fragment,{children:[d.jsx("dt",{children:d.jsx(oe.FormattedMessage,{id:`${Nn}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(oe.FormattedMessage,{id:`${Nn}${e}_${r}_address`,values:{br:d.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&d.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Aa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},ho=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx(Oa,{element:"hr"}),d.jsx(fo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Aa,"data-gtm-event-type":"logo-homepage-link"}),d.jsx("footer",{children:["platform","community","company","contact"].map(e=>d.jsxs("div",{className:"group",children:[d.jsx(Zl,{group:e}),Object.keys(It[e]).includes("child")&&d.jsx(Zl,{group:It[e].child})]},e))}),d.jsx("hr",{}),d.jsxs("div",{className:"sub-footer",children:[d.jsx("ul",{children:Array.isArray(It.social.order)&&It.social.order.map(e=>{const t=It.social[e];return d.jsx("li",{className:e,children:d.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Aa,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(oe.FormattedMessage,{id:`${Nn}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(oe.FormattedMessage,{id:`${Nn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),je={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e==="account"&&t===!1&&n.navigation===!0)return;const i=Date.now();if(!a&&!t&&je.handlerCalled[e]&&i-je.handlerCalled[e]<500)return;je.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case"navigation":o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation > li.parent"));break;case"search":o=document.querySelector("#header .toggle-search-button");break;case"account":o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=sc(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?je.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case"navigation":if(n){const u=je.findFirstChild(t.current.children,"attributes.aria-controls","navigation");s=je.findFirstChild(u.children,"href")}else s=je.findFirstChild(t.current.children,"href");break;case"account":if(o=je.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=je.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(je.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(je.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(je.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{je.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},kr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},Fa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=oe.useIntl(),o=sc(kr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,c=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let m=!1;if(o.href){let x=o.gtmType||`${e}-click`;if(x.includes(".")){const B=x.split("."),E=B[B.length-2];x=`${E==="topics"?`${E}-`:""}${B[B.length-1]}`}m={href:o.href},u&&(m={...m,className:"gtm-trackable","data-gtm-event-type":x,"data-gtm-event-context":"HeaderButtons"}),c&&(m={...m,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],g=p&&o[o.order[0]].order,h=m&&window.location.pathname===o.href;let y={},b={};if(h&&(y={...y,"aria-current":"page"}),p){const x=o.menuId||e,B={onClick:E=>je.events.onClick(E,{id:x,callback:a,isOpen:r[x]}),onFocus:()=>je.events.onFocus({id:x}),onBlur:()=>je.events.onBlur({id:x,callback:a}),onMouseLeave:()=>je.events.onBlur({id:x,callback:a}),onMouseEnter:()=>je.events.onMouseEnter({id:x,callback:a})};n&&(g&&(y={...B,onKeyPress:E=>{E.key==="Enter"&&je.events.onClick(E,{id:x,callback:a,isOpen:r[x]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[x],"aria-controls":x}),b={hidden:x in r?!r[x]:!0}),g||(b={...b,...B})}return d.jsxs("li",{className:V({[o.className]:o.className,"has-submenu":p,parent:g,active:h}),...y,children:[m?C.createElement(c?xe:"a",m,s.formatMessage({id:f})):s.formatMessage({id:f}),o.order&&d.jsx("ul",{...b,children:o.order.map(x=>{if(!o[x])return null;const B={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[x].order?d.jsxs("li",{className:V({[o[x].className]:o[x].className}),children:[s.formatMessage({id:`${f}_${x}`}),d.jsx("ul",{children:o[x].order.map(E=>d.jsx(Fa,{id:`${e}.${x}.${E}`,...B},E))})]},x):d.jsx(Fa,{id:`${e}.${x}`,...B},x)})})]},e)};const uw={height:67,height_desktop:83},mo=({showNavigation:e=!0})=>{const t=oe.useIntl(),n=C.useContext(Ot),r=Kn(!0,!0),a=n&&typeof n.id=="string",i=C.useMemo(()=>je.getIsDesktopVersion(a,r),[a,r]),[s,o]=C.useReducer(Br,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:c}=s,f=C.useRef(s);C.useEffect(()=>{f.current=s},[s]),dc({scrollPosition:uw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const h=f.current.menus;!i&&h.navigation||je.shouldChangeHeaderIsVisible(!0,h,o)},scrollDown:()=>{const h=f.current.menus;!i&&h.navigation||je.shouldChangeHeaderIsVisible(!1,h,o)}}});const m=(h,y,b=!1)=>{je.handleMenus({id:h,value:y,menus:f.current.menus,dispatch:o,forceHandle:b})},p=C.useRef(null),g=h=>{h.key==="Escape"&&["navigation","search","account"].forEach(y=>{f.current.menus[y]&&m(y,!1,!0)})};return C.useEffect(()=>{var h;return(h=document.getElementById("header"))==null||h.addEventListener("keydown",g),()=>{var y;(y=document.getElementById("header"))==null||y.removeEventListener("keydown",g)}},[]),Ln(()=>{u.navigation&&je.autoFocus({menu:"navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.navigation]),Ln(()=>{u.account&&je.autoFocus({menu:"account",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.account]),n&&n.isLoading?null:d.jsxs(d.Fragment,{children:[d.jsxs("nav",{id:"header",className:V({"logged-in":a,"logged-out":!a,visible:l}),children:[d.jsx(Ie,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),d.jsx(fo,{variant:"monochrome"}),e&&d.jsxs(d.Fragment,{children:[!i.navigation&&d.jsx("button",{className:"menu-button gtm-trackable",onClick:h=>{h.preventDefault(),h.stopPropagation(),m("navigation",!u.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u.navigation,"aria-controls":"navigation",children:d.jsx(Ie,{children:t.formatMessage({id:`header_menu_${u.navigation?"hide":"show"}`})})}),d.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||u.account?!1:!u.navigation,"data-showing":!i.navigation&&u.account?"account":"default",children:kr.order.map(h=>d.jsx(Fa,{id:h,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{navigation:u.navigation,account:u.account},callback:m},h))}),!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:h=>{h.preventDefault(),h.stopPropagation(),m("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:d.jsx(Ie,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),d.jsx(sf,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),a?d.jsxs("button",{className:"account-button",onClick:h=>je.events.onClick(h,{id:"account",callback:m,isOpen:u.account}),onMouseEnter:()=>je.events.onMouseEnter({id:"account",callback:m}),onMouseLeave:()=>je.events.onBlur({id:"account",callback:m}),"aria-haspopup":"true","aria-expanded":u.account,"aria-controls":"navigation",children:[d.jsx(Ie,{children:t.formatMessage({id:`header_account_${u.account?"hide":"show"}`})}),d.jsx(tn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):d.jsx("ul",{className:"sign-in-buttons",children:kr.buttons.order.map(h=>d.jsx(Fa,{id:`buttons.${h}`},h))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:V("overlay",{open:u.navigation||u.account||!i.search&&u.search})})]})};const lw=()=>{const e=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(mo,{}),d.jsx("div",{id:"content",children:d.jsx(en,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(ho,{})]})},Sf=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:c="default",variant:f="default",circle:m="default",modal:p="default"}=i,g=lc();C.useEffect(()=>{window.scrollTo(0,0)},[g]);const h=na(e,{locale:o}),y=na(t,{locale:o}),b=na(n,{locale:o}),x={};return c!=="default"&&(x[c]=!0),f!=="default"&&(x[f]=!0),m!=="default"&&(x[m]=!0),d.jsx(rh.ErrorBoundary,{onError:r,fallback:d.jsx(lw,{}),children:d.jsx(C.Suspense,{fallback:null,children:d.jsxs("div",{id:"wrapper",className:V(s,x,{"has-footer":u}),children:[d.jsx(mo,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[y&&d.jsx("div",{className:V("additional-content prepended",{"large-modal":p==="large"}),children:y}),C.createElement(c==="bold"?uo:"div",{id:"content",children:h,className:V({"large-modal":p==="large"})})]}),b&&d.jsx("div",{className:"additional-content appended",children:b}),u&&d.jsx(ho,{}),d.jsx(Tf,{})]})})})},Yl={default:"tags_",headerTopics:"header_topics_topics_"},qi={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"},cw={getTagDetails:e=>{if(e.includes("topic_")){if(e=qi.topic[e.replace("topic_","")],e){const t=kr.topics.topics[e].href;return t?{id:e,href:t,text:`${Yl.headerTopics}${e}`}:null}return null}return qi[e]?(e=qi[e],{id:e,text:`${Yl.default}${e}`}):null}};const dw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=oe.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=cw.getTagDetails(u);c&&l.push(c)}),l.length<1?null:d.jsx("ul",{className:V("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const c=o.formatMessage({id:u.text});return d.jsx("li",{children:u.href&&r?d.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:c}):c},u.id)})})};const fw=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=oe.useIntl();return e.length===0?null:d.jsxs("div",{className:V("members-list",s),children:[d.jsxs("h1",{children:[o.formatMessage({id:"membersList"}),d.jsx("span",{className:"count",children:t})]}),d.jsx("ul",{children:e.map((l,u)=>d.jsxs("li",{children:[d.jsx(Ar,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(Rn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx(Sr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const hw=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=oe.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=s;return C.createElement(e,{className:V("course-progression",o,{"highlight-percentage":c,"has-circle-graph":i==="circle"}),children:d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:f=>d.jsx("strong",{children:f}),number:u})}),u<100&&a&&d.jsx(Ha,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx(Fs,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const jf=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>C.createElement(e,{className:V("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Of=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=oe.useIntl(),o=Pa(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):gc(a||"");return d.jsxs("small",{className:V("content-type",{[e]:e!=="default"}),children:[d.jsx("span",{className:V("type",n),children:o})," ",t>0&&!r&&d.jsx(Ha,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const mw=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const f=oe.useIntl(),m="courseStructure_",p=u.toLowerCase().includes("course conclusion");return d.jsxs(Na,{className:"course-structure",label:d.jsxs(d.Fragment,{children:[d.jsxs("small",{children:[f.formatMessage({id:`${m}section${p?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?f.formatMessage({id:`${m}time_completed`}):d.jsx(Ha,{time:s,appendedText:a?f.formatMessage({id:`${m}time_left`}):""})})]}),d.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[d.jsx("p",{children:n}),d.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:h,contentType:y,icon:b,image:x,isIntroduction:B,optional:E,slug:_,subsectionId:T,title:A,type:$})=>{const I=a&&t||B,j={};return x&&(j.style={"--image":`url(${x})`}),d.jsx("li",{className:V({article:y===or.ARTICLE,discussion:y===or.DISCUSSION,quiz:y===or.QUIZ,completed:g&&y===or.ARTICLE,locked:!I}),...j,children:d.jsx(Dn,{href:I?`/microcourses/en/${o}/${_}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${pc(A)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(jf,{sectionId:i,subsectionId:T,title:A,className:"course-title"})," ",d.jsx(Of,{completionTime:h,icon:b,optional:E,type:$,children:c&&c[_]&&d.jsx("span",{className:"quiz-score",children:`${c[_]}%`})})]})})},_)})})]})};const pw=({isComplete:e=!1,onClick:t,...n})=>{const r=oe.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),d.jsx(xe,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className:V("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})};let Xr=null;const st="discussion_form_",Va=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},placeholder:a,maxLength:i=1e11,forceShow:s={cancel:!1,error:!1},functions:o={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:l="DiscussionForm"})=>{var $,I,j;const u=oe.useIntl(),c=C.useContext(Ot),[f,m]=C.useState(r.isEditing&&r.isEditing.text||""),[p,g]=C.useState(s.error||!1),[h,y]=C.useState(!1);if(r.isLoading)return d.jsx(Ct,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const b=R=>{m(R);let w;!c||!c.id?w=Bt(u.formatMessage,`${st}error_loggedOut`,t.type,"action"):n?R.length>=i&&(w=`${st}error_tooLong`):w=Bt(u.formatMessage,`${st}error_noPermission`,t.type,"action"),w?g(w):p&&g(!1)};let x=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const R=(($=t.slugs)==null?void 0:$.reply)||((I=t.slugs)==null?void 0:I.answer)||((j=t.slugs)==null?void 0:j.question)||"";R&&(x=`${x}-${R.slice(-15)}`)}e&&(x=`${e}-${x}`);const B=async R=>{var F;if(R.preventDefault(),R.stopPropagation(),!c||!c.id||!n||_)return;Xr&&clearTimeout(Xr),y("submitting");const w=window.location.pathname;try{let N;switch(t.type){case"post":N=await o.create({content:f});break;case"question":N=await o.create({title:f,authorId:c&&c.id,...(F=o.props)==null?void 0:F.create});break;case"response":N=await o.create({questionSlug:t.slugs.question},{body:f,authorId:c&&c.id,contentPath:w});break;case"reply":N=await o.create({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:f,authorId:c&&c.id,contentPath:w});break;default:break}await hh(1e3),o.callback&&await o.callback(N),Xr=setTimeout(()=>{m(""),y("submitted");const M=new Event("discussionFormSubmitted");document.dispatchEvent(M),E()},500)}catch(N){const M=N;let Z=`${st}error`;M!=null&&M.message.includes("entry already exists")&&(Z=Bt(u.formatMessage,`${st}error_alreadyExists`,t.type,"action")),M!=null&&M.message.includes("429")?Z=Bt(u.formatMessage,`${st}error_tooMany`,t.type,"action"):M!=null&&M.message.includes("400")&&(Z=`${st}error`),g(Z),E()}},E=()=>{Xr=setTimeout(()=>{g(!1),y(!1)},5e3)},_=!f||!Dh(f),T=h==="submitting",A=[];return(r.isEditing&&!T||s.cancel)&&A.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!s.cancel&&(!c||!c.id||!f),children:u.formatMessage({id:`${st}cancel`})}),A.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:R=>{if(r.isEditing){y("submitting"),o.handleSaveEdit&&o.handleSaveEdit(f);return}B(R)},className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`${r.isEditing?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:!c||!c.id||!n||_||T||r.isEditing&&f===r.isEditing.text,children:u.formatMessage({id:`${st}${T?r.isEditing?"saving":"posting":r.isEditing?"save":"post"}`})}),d.jsxs("form",{id:x,className:V("discussion-card discussion-form",{"no-styling":r.isInWrapper&&r.isEditing}),"data-testid":`discussion-${t.type}-form`,children:[(r==null?void 0:r.showTitle)&&!r.isEditing&&["question"].includes(t.type)&&d.jsx("h2",{children:Bt(u.formatMessage,`${st}title`,t.type,"action")}),d.jsx(Ar,{member:c||"community",gtmContext:l,gtmType:"profile-click"}),d.jsx(Ie,{element:"label",showOnFocus:!1,htmlFor:`${x}-input`,children:Bt(u.formatMessage,`${st}label`,t.type,"action")}),d.jsx(nf,{id:`${x}-input`,value:h==="submitting"&&!p?"":f,placeholder:a||Bt(u.formatMessage,`${st}placeholder`,t.type,"action"),functions:{onChange:b},autoFocus:!!r.isEditing,"aria-invalid":!!p,"aria-errormessage":"error-message"}),d.jsx("small",{children:Bt(u.formatMessage,`${st}explainer`,t.type,"action",{a:R=>d.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:R})})}),d.jsx(yn,{buttons:A}),h==="submitted"&&r.showSuccessMessage&&d.jsx(br,{className:"success","data-testid":"success",children:Bt(u.formatMessage,`${st}success`,t.type,"action")}),p&&d.jsx(br,{id:"error-message",className:"error","data-testid":"error",children:s.error?s.error:typeof p=="string"?p.includes(" ")?p:u.formatMessage({id:p},{action:u.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):p})]})},po=({form:e,membershipRequiredToPost:{isMember:t,required:n,join:r,leave:a,notMemberStateText:i}})=>{if(n&&!t)return d.jsx(en,{text:i,button:{breakpoints:{mobile:!0,901:!1},component:d.jsx(co,{isShort:!0,functions:{join:r,leave:a}})}});const{content:s,functions:o,meta:l,...u}=e;return d.jsx(Va,{content:{type:(s==null?void 0:s.type)||"reply",slugs:(s==null?void 0:s.slugs)||{}},functions:{...o,create:(o==null?void 0:o.create)||(()=>{})},meta:{...l,isEditing:(l==null?void 0:l.isEditing)||!1,showSuccessMessage:!1},...u,id:`add-post-${u.id||""}`})},gw={showForm:!1},Ka=C.createContext(gw),Pf=({children:e})=>{const[t,n]=C.useState({showForm:!1});return d.jsx(Ka.Provider,{value:{...t,updateConversation:n},children:e})},vw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),bw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const _s=({icon:e,...t})=>d.jsx(xe,{className:"discussion-button",variant:"tertiary",icon:e,...t});let vr=!1;const Wi=()=>{vr!==!1&&(clearTimeout(vr),vr=!1)},Hi=5;let Ui=null;const Nf=({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=oe.useIntl(),c={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[f,m]=C.useReducer(Br,c),{numberOfLikes:p,userLikedContent:g,ignoreInteractions:h,showLikers:y,tabbableLink:b}=f;C.useEffect(()=>{m([{type:"userLikedContent",value:a}])},[a]);const x=C.useMemo(()=>bw(n,Hi),[n]),B=A=>{if(A.preventDefault(),A.stopPropagation(),m([{type:"showLikers",value:!1}]),vr)return Wi(),!1;if(Wi(),h||!s)return!1;vr=setTimeout(E,350)},E=async()=>{if(Wi(),h||!s)return!1;let A=g?p-1:p+1;A<0&&(A=0),m([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:A},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const $=vw(i.slugs);g?await l($):await o({...$,payload:{contentPath:window.location.pathname}})}}catch{m([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{m([{type:"ignoreInteractions",value:!1}])}},_=()=>{Ui=setTimeout(()=>{m([{type:"showLikers",value:!1}])},500)},T=()=>{Ui&&clearTimeout(Ui)};return C.createElement(e,{className:"likes-wrapper",onKeyDown:A=>{A.key==="Escape"&&m([{type:"showLikers",value:!1}])},onMouseEnter:()=>{T(),m([{type:"showLikers",value:!0}])},onMouseLeave:()=>{_()}},d.jsxs(d.Fragment,{children:[d.jsx(_s,{className:V("discussion-button text-medium action-button",{"show-spinner":h,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:B,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:p})})}),n&&d.jsxs(d.Fragment,{children:[d.jsx(Ie,{element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{T()},onBlur:()=>_,onClick:A=>{var I;A.preventDefault(),A.stopPropagation(),T(),m([{type:"showLikers",value:!0}]);const $=(I=A.currentTarget.nextSibling)==null?void 0:I.childNodes[0];if($){const j=$.querySelector("li:first-child a");j&&(m([{type:"tabbableLink",value:0}]),setTimeout(()=>{j.focus()},100))}},onKeyDown:A=>{A.key==="Escape"&&(A.preventDefault(),A.stopPropagation(),_())},"aria-expanded":y,"aria-controls":`likes-tooltip-${i.slug}`,children:d.jsx(Ie,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),d.jsx(Ua,{id:`likes-tooltip-${i.slug}`,isOpen:y,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[x.map((A,$)=>{if(typeof A=="string"||!A.name)return null;const I={};return b!==$&&(I.tabIndex=-1),d.jsx("li",{"data-index":$,children:d.jsx(Dn,{href:A.id?`/profiles/${A.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:j=>j==null?void 0:j.stopPropagation(),onFocus:()=>T(),onKeyDown:j=>{var M,Z,K,se;if(!j||!["ArrowUp","ArrowDown"].includes(j.key||""))return;j.stopPropagation(),j.preventDefault();const R=j.key==="ArrowUp"?"up":"down",w=(M=j.currentTarget)==null?void 0:M.parentElement;let F=w==null?void 0:w.nextElementSibling;if(R==="up"){const ne=w==null?void 0:w.previousElementSibling;ne?F=ne:(F=(Z=w==null?void 0:w.parentElement)==null?void 0:Z.lastElementChild,(F==null?void 0:F.getAttribute("data-index"))==="-1"&&(F=F==null?void 0:F.previousElementSibling))}else(!F||(F==null?void 0:F.getAttribute("data-index"))==="-1")&&(F=(K=w==null?void 0:w.parentElement)==null?void 0:K.firstElementChild);if(!F)return;const N=(F==null?void 0:F.getAttribute("data-index"))||"0";m([{type:"tabbableLink",value:N}]),(se=F==null?void 0:F.querySelector("a"))==null||se.focus()},...I,children:A.name})},A.id||window.btoa(A.name))}),t>Hi&&d.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Hi})})]})})]})]}))},Gl=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Za=(e,t)=>e&&!t,Vi=({children:e,class:t,...n})=>{const r={...n,class:V("subtle",t)};return d.jsx("blockquote",{...r,children:e})};const Mt="discussion_",yw=280,jr=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,forceHide:i={actionBar:!1,comments:!1,likes:!1},functions:{content:{createContent:s,deleteContent:o,updateContent:l}={createContent:async()=>{},deleteContent:async()=>{},updateContent:async()=>{}},likes:{createLike:u,deleteLike:c}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:f}={openComments:()=>{}}},links:m={},className:p,gtmContext:g="DiscussionAnswer",children:h,isTruncated:y=!1})=>{const b=oe.useIntl(),x=C.useContext(Ot),B=C.useContext(Ka),{author:E,canLike:_,createdAt:T,id:A,likes:$=0,userLiked:I,comments:j=0}=t,R=x&&x.id&&typeof E!="string"&&E.id&&E.id===x.id||!1,w=typeof _=="boolean"?_:n?!R:!1,F=R&&(!t.createdAt||fh(t.createdAt,10,"seconds")),N=C.useRef(null),[M,Z]=C.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[K,se]=C.useState(!1),[ne,D]=C.useState(F?"highlighted":"default"),[q,X]=C.useState("");C.useEffect(()=>{const Y=N.current;if(!(!Y||ne==="default"))return document.addEventListener("discussionFormSubmitted",k),Y.addEventListener("transitionend",S),()=>{document.removeEventListener("discussionFormSubmitted",k),Y.removeEventListener("transitionend",S)}},[]),C.useEffect(()=>{Z({...M,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]);const k=()=>{setTimeout(()=>{D("fading")},1e3)},S=({propertyName:Y})=>{Y==="background-color"&&D(ue=>(ue==="default"&&(document.removeEventListener("discussionFormSubmitted",k),N.current&&N.current.removeEventListener("transitionend",S)),ue==="fading"?"default":ue))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return d.jsx(Ct,{className:"discussion-card discussion-post"});const z=y?$n(M.body,yw):M.body,L=async Y=>{Y||(Y=""),X("");try{if(!ic(Y,M.body)){const ue=t.type==="question"?{title:Y}:{body:Y};await l(Gl(t.slugs),ue)}Z({body:Y,isEditing:!1,didEdit:!0})}catch{X(`${Mt}form_error`)}},U=()=>{B&&B.updateConversation&&B.updateConversation({showForm:!0}),setTimeout(()=>{var me,_e,Se;const ue=`reply-form-${(t.type==="answer"?t.slug:((me=t.slugs)==null?void 0:me.reply)||((_e=t.slugs)==null?void 0:_e.answer)||((Se=t.slugs)==null?void 0:Se.question)||"").toLowerCase().slice(-15)}`,J=document.getElementById(ue),ge=document.getElementById(`${ue}-input`);ge&&ge.focus(),J&&J.scrollIntoView({behavior:"smooth"})},0)},te=async()=>{se(!1);try{await o(Gl(t.slugs))}catch{X("delete-error")}},ee=[{text:b.formatMessage({id:`${Mt}moreMenu_report`}),onClick:Y=>{Y.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(b.formatMessage({id:`${Mt}report_subject`}))}&body=${encodeURI(b.formatMessage({id:`${Mt}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&&R&&ee.push({text:b.formatMessage({id:`${Mt}moreMenu_edit`}),onClick:()=>Z({...M,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`edit-${t.type}-click`},{text:b.formatMessage({id:`${Mt}moreMenu_delete`}),onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),se(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`delete-${t.type}-click`,...Ef(`delete-${t.slug}-modal`,K)}),C.createElement(e,{className:V("discussion-post",p,{[ne]:!p||!p.includes("highlighted-text-box"),"has-link":m.post&&!M.isEditing}),ref:N,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${g}-post-click`,onClick:Y=>{!m.post||M.isEditing||(Y.preventDefault(),Y.stopPropagation(),window.location.href=m.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:A||t.slug,className:V("discussion-card",t.type,{editing:M.isEditing,"has-link":m.post&&!M.isEditing}),children:[!M.isEditing&&d.jsx(Ar,{member:E,additionalContent:{createdAt:T,didEdit:M.didEdit},className:typeof E!="string"&&E.id===a?"highlighted":"",gtmContext:g,gtmType:"profile-click"}),M.isEditing?d.jsx(Va,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:M.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:q!==""&&q!=="delete-error"?b.formatMessage({id:q},{action:b.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:s,handleSaveEdit:L,handleCancel:()=>{X(""),Z({...M,isEditing:!1})}},gtmContext:`${g}Form`}):m.post?d.jsxs("a",{href:m.post,children:[(t==null?void 0:t.title)&&d.jsx("p",{className:"content-title",children:t.title}),t!=null&&t.body&&(t==null?void 0:t.body.length)>195?d.jsx(kc,{text:t==null?void 0:t.body.trim(),markdownOptions:{overrides:{a:Xi,blockquote:{component:Vi}}}}):d.jsx(zn,{options:{overrides:{a:Xi,blockquote:{component:Vi}}},children:z.trim()})]}):d.jsx(zn,{options:{wrapper:t.type==="question"?"h1":C.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:Vi}}},children:z.trim()}),!M.isEditing&&!(i!=null&&i.actionBar)&&d.jsxs("ul",{className:V("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!i.likes&&d.jsx(Nf,{element:"li",likes:$,isShort:!1,userLiked:I,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:w,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:u,deleteLike:c}}),!i.comments&&(["question","post"].includes(t.type)||m.comments||typeof f=="function")&&d.jsx("li",{children:d.jsx(_s,{onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),m.comments&&(window.location.href=m.comments),typeof f=="function"&&f()},icon:{icon:"speech-bubble_square_thick"},"data-gtm-event-context":g,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:b.formatMessage({id:`${Mt}comments_screenReader`},{count:j}),children:b.formatMessage({id:`${Mt}comments`},{count:j})})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(_s,{styling:{muted:!0},onClick:U,icon:{icon:"speech-bubble_square_thick"},children:b.formatMessage({id:`${Mt}reply`})})}),d.jsx(Bf,{element:"li",id:`more-${t.slug}`,options:ee})]})]}),h,d.jsx(Tr,{id:`delete-${t.slug}-modal`,isOpen:K,functions:{onOpen:()=>{},onClose:()=>se(!1)},forceShow:{error:q==="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:()=>se(!1),children:b.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:te,children:b.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:d.jsx(oe.FormattedMessage,{id:"discussion_delete_text",values:{p:Y=>d.jsx("p",{children:Y}),action:b.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Ki="discussion_responses_",Rf=({type:e="answer",responses:t=0})=>{const n=oe.useIntl();return t=parseInt(t),d.jsxs("div",{className:"responses-heading",children:[d.jsx("h4",{children:n.formatMessage({id:`${Ki}title`},{action:n.formatMessage({id:`${Ki}${e}`}),count:t})}),t===0&&d.jsx("p",{children:Bt(n.formatMessage,`${Ki}empty`,e,e)})]})};const Mf=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=oe.useIntl(),s=C.useContext(Ka),o=na(a,{element:"li"});return d.jsxs("div",{className:V("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&d.jsx("ul",{className:"thread",children:o}),!e&&d.jsx(Sr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&d.jsx(Va,{...r})]})},Dw="post",Cw="reply",If="00000000-0000-0000-0000-000000000000";function go({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function vo({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 xw(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function ww(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function $f(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 Ew({content:e}){return{content:e,id:If,time:new Date().toISOString(),verb:Dw}}function Ql({activity:e,user:t}){return{...e,actor:$f(t),...xw()}}function Ta({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 Lf({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 _w({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:If,kind:Cw,parent:t||""}}function Jl({reply:e,user:t}){const n=$f(t);return{...e,user_id:n.id,user:n,...ww()}}function Xl({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 kw({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 zf=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let ec,Zi=0;const qf=()=>{C.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(ec);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),Zi=0;return}Zi++,!(Zi>10)&&(ec=setTimeout(()=>{e(t)},50))}},Vn=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}),Xt=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}),Wf=Object.freeze({actor:`SU:${Vn.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"}),Bw=Object.freeze({actor:`SU:${Xt.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"}),Aw=Object.freeze({actor:`SU:${Vn.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"}),Fw=Object.freeze({actor:`SU:${Xt.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:Wf.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:Xt.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:Xt.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:Xt.id,user:{id:Xt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Wf.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:Vn.id,user:{id:Vn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Bw.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:Xt.id,user:{id:Xt.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Aw.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:Vn.id,user:{id:Vn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Fw.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function Tw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=qe.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Ql({activity:Ew(o),user:i});return tc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=Ql({activity:o,user:i});r.setQueryData(a,tc(c,u,!0)),setTimeout(()=>{zf(c.id)},0)}});return s}function Sw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Sa(a,s);return o&&(o.content=i),s}),onError:n});return r}function jw({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=Wa(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:go(u),mutate:vo(u)},user:l,...u},f=Tw({...c,mutationFn:e}),m=Sw({...c,mutationFn:t}),p=Ow({...c,mutationFn:n}),g=Nw({...c,mutationFn:a}),h=Rw({...c,mutationFn:i}),{activities:y,...b}=Pw({queryKey:s,queryFn:r});return{activities:y,mutations:{create:f,edit:m,remove:g,like:p,unlike:h},user:l,...b}}function Ow({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=Sa(s,o);return l&&Ta({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Sa(o,l);u&&Ta({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Pw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{activities:Iw(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Nw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Mw(a,i)),onError:n});return r}function Rw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Sa(i,s);return o&&Lf({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 Sa(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Mw(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 Iw(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const $w=({basePath:e,parentId:t,isMember:n,functions:{activities:r,join:a,leave:i}})=>{const s=oe.useIntl(),{activities:o,error:l,fetchNextPage:u,hasNextPage:c,isLoading:f,mutations:{create:m,edit:p,remove:g,like:h,unlike:y},user:b}=jw({queryKey:[e,t,"activities"],queryFns:r});return qf(),l?d.jsx(en,{variant:"error",text:l.message}):d.jsxs("section",{children:[d.jsx(po,{form:{content:{type:"post",slugs:{}},functions:{create:m},meta:{isEditing:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:a,leave:i,notMemberStateText:s.formatMessage({id:"community_joinToPost"})}}),o==null?void 0:o.map((x,B)=>{var N,M,Z,K,se,ne,D,q;const{id:E,own_reactions:_,latest_reactions:T,reaction_counts:A}=x,$=(((N=T==null?void 0:T.like)==null?void 0:N.length)||0)>0,I=(((M=_==null?void 0:_.like)==null?void 0:M.length)||0)>0,j=I?_==null?void 0:_.like[0].id:"",R=$?(Z=T==null?void 0:T.like)==null?void 0:Z.map(X=>{var k,S,z;return{id:(k=X==null?void 0:X.user)==null?void 0:k.id,name:(z=(S=X==null?void 0:X.user)==null?void 0:S.data)==null?void 0:z.name}}):!1,w=x==null?void 0:x.actor,F=(w==null?void 0:w.id)===(b==null?void 0:b.id);return d.jsx(C.Fragment,{children:d.jsx(jr,{content:{type:"post",title:x==null?void 0:x.title,body:x==null?void 0:x.content,canLike:Za(n,F),createdAt:(x==null?void 0:x.time)||"",slugs:{question:`${e}/${t}`,answer:E},slug:E,author:{id:w==null?void 0:w.id,name:(K=w==null?void 0:w.data)==null?void 0:K.name,organization:(se=w==null?void 0:w.data)==null?void 0:se.organization,jobTitle:(ne=w==null?void 0:w.data)==null?void 0:ne.jobTitle,location:(D=w==null?void 0:w.data)==null?void 0:D.location,image:{thumbnail:((q=w==null?void 0:w.data)==null?void 0:q.thumbnail)||void 0}},userLiked:I,likes:(A==null?void 0:A.like)||0,comments:(A==null?void 0:A.reply)||0,peopleWhoLiked:R},links:{post:`${e}/${t}/${E}`,comments:`${e}/${t}/${E}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>g({activityId:E}),updateContent:(X,{body:k})=>p({activityId:E,content:k})},likes:{createLike:()=>h({activityId:E}),deleteLike:()=>y({activityId:E,reactionId:j})},comments:{openComments:()=>null}},isTruncated:!0})},E)}),!f&&d.jsx(Sr,{hasNextPage:c,loadNextPage:()=>u(),icon:{icon:"arrow-down",position:"right"},messages:{button:s.formatMessage({id:"loadMore_button"}),error:s.formatMessage({id:"loadMore_error"})}})]})},Lw={next:"id_lt=67ef0342-6f6e-4807-beea-5a9184ec140c&limit=5",results:[{created_at:"2023-12-03T18:47:44.081716Z",updated_at:"2023-12-03T18:47:44.081716Z",id:"256b921e-ffe6-410d-b754-ac1aaee989ce",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 17..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:02.517688Z",updated_at:"2023-12-03T18:47:24.852582Z",id:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 16 (edited)..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T19:28:09.799652Z",updated_at:"2023-12-03T19:28:09.799652Z",id:"bf1ec451-e7c3-4ebe-a60e-248b0ec2a671",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 3..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:59.756761Z",updated_at:"2023-12-03T19:27:59.756761Z",id:"7887d921-e2ba-48ef-8089-db24536dbf70",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 2..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}},{created_at:"2023-12-03T19:27:46.534650Z",updated_at:"2023-12-03T19:27:46.534650Z",id:"73f5bdf3-7080-48ac-a8dc-185f71b38b42",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 1..."},parent:"ecb077fe-9f3d-4066-aca2-1ddbc9ac6de7",latest_children:{},children_counts:{}}]},children_counts:{reply:3}},{created_at:"2023-12-03T17:47:45.107092Z",updated_at:"2023-12-03T17:47:45.107092Z",id:"27a59e8f-f094-442f-88ec-1d5ec2f72790",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 14..."},parent:"",latest_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:34.103420Z",updated_at:"2023-12-03T17:56:34.103420Z",id:"ddc28de7-4e89-4572-8122-c95dceacc2fd",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 3..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:26.410145Z",updated_at:"2023-12-03T17:56:26.410145Z",id:"916ed4b6-ad87-47bc-9e00-7b0c46180276",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 2..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:19.921740Z",updated_at:"2023-12-03T17:56:19.921740Z",id:"92cddcb2-cbdc-4e69-9c8e-5afe3a607411",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 1..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},own_children:{reply:[{created_at:"2023-12-03T18:47:10.603929Z",updated_at:"2023-12-03T18:47:10.603929Z",id:"c32b83d5-c5fc-4253-8531-eb99dcb01f28",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 8..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:47:04.856649Z",updated_at:"2023-12-03T18:47:04.856649Z",id:"5efd80e3-cb11-4748-8c64-f46b71df69c4",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 7..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:22.687552Z",updated_at:"2023-12-03T18:36:22.687552Z",id:"a3a2ebae-6df2-4dc0-beee-2296188b67aa",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 6..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T18:36:16.129336Z",updated_at:"2023-12-03T18:36:16.129336Z",id:"72948da5-bf3c-4bd5-9a21-2cee36e0ce8a",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 5..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:56:40.850756Z",updated_at:"2023-12-03T17:56:40.850756Z",id:"81ebc855-d1f6-4a2c-a788-a251bae406b6",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Reply 4..."},parent:"27a59e8f-f094-442f-88ec-1d5ec2f72790",latest_children:{},children_counts:{}}]},children_counts:{reply:8}},{created_at:"2023-12-03T17:47:40.066170Z",updated_at:"2023-12-03T17:47:40.066170Z",id:"9ed6a1d0-00b5-4a03-94d7-ac01e188e2e2",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 13..."},parent:"",latest_children:{},children_counts:{}},{created_at:"2023-12-03T17:47:33.107894Z",updated_at:"2023-12-03T17:47:33.107894Z",id:"67ef0342-6f6e-4807-beea-5a9184ec140c",user_id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",user:{created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z",id:"3a1a02cf-b4d2-4425-b677-2818ec5d775c",data:{name:"Danu Tester"}},kind:"reply",activity_id:"c0ed39d0-8e0f-11ee-8080-8001137b7e08",data:{content:"Testing 12..."},parent:"",latest_children:{},children_counts:{}}],duration:"6.48ms"};function zw({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=Jl({reply:_w(o),user:i});return nc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=Jl({reply:o,user:i});r.setQueryData(a,nc(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{zf(c.id)},0)}});return s}function qw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=ja(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Hf({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=Wa(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:go(u),mutate:vo(u)},user:l,...u},f=zw({...c,mutationFn:e}),m=qw({...c,mutationFn:t}),p=Ww({...c,mutationFn:n}),g=Uw({...c,mutationFn:a}),h=Vw({...c,mutationFn:i}),{replies:y,...b}=Hw({queryKey:s,queryFn:r});return{replies:y,mutations:{create:f,edit:m,remove:g,like:p,unlike:h},user:l,...b}}function Ww({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=ja(s,o);return l&&Xl({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=ja(o,l);u&&Xl({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function Hw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=qe.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=Qw(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Uw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Gw(a,i)),onError:n});return r}function Vw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=ja(i,s);return o&&kw({reply:o,user:r}),s}),onError:n});return a}function Kw(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function Zw(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 Yw(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 nc(e,t,n){return t?n!=null&&n.append?Zw(e,t,n):Yw(e,t,n):Kw(e)}function ja(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Gw(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 Qw(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 Jw=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=oe.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:c,isLoading:f,mutations:{create:m,edit:p,like:g,remove:h,unlike:y},user:b}=Hf({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:E=>i.list({...E,reactionId:r})}});Bs([f]);const[x,B]=C.useState(!0);return d.jsxs(d.Fragment,{children:[(l==null?void 0:l.length)>=o&&d.jsx(xe,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${x?"up_left":"down_right"}`,position:"left"},onClick:()=>B(!x),children:s.formatMessage({id:`discussion_thread_${x?"hide":"show"}`},{count:l==null?void 0:l.length})}),x&&d.jsx(Mf,{loadMore:{isLoading:f,hasNextPage:c,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(E,{body:_})=>m({activityId:n,replyId:r,content:_})},meta:{isEditing:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(E=>{var ne,D,q,X,k,S,z,L,U,te,ee,Y;const{id:_,own_children:T,latest_children:A,children_counts:$}=E,j=(((ne=T==null?void 0:T.like)==null?void 0:ne.length)||0)>0?(D=T==null?void 0:T.like)==null?void 0:D.find(ue=>{var J;return((J=ue==null?void 0:ue.user)==null?void 0:J.id)===(b==null?void 0:b.id)}):!1,R=j?j==null?void 0:j.id:"",w=!!j,N=(((q=A==null?void 0:A.like)==null?void 0:q.length)||0)>0?(X=A==null?void 0:A.like)==null?void 0:X.map(ue=>{var J,ge,me;return{id:(J=ue==null?void 0:ue.user)==null?void 0:J.id,name:(me=(ge=ue==null?void 0:ue.user)==null?void 0:ge.data)==null?void 0:me.name}}):!1,M=E==null?void 0:E.user,Z=(M==null?void 0:M.id)===(b==null?void 0:b.id),K=Za(a,Z),se=typeof E.data.content=="string"?(k=E==null?void 0:E.data)==null?void 0:k.content:((z=(S=E==null?void 0:E.data)==null?void 0:S.content)==null?void 0:z.text)||"";return d.jsx(jr,{content:{id:_,type:"reply",body:se,canLike:K,createdAt:E==null?void 0:E.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:E==null?void 0:E.parent},slug:"",author:{id:M==null?void 0:M.id,name:(L=M.data)==null?void 0:L.name,organization:(U=M.data)==null?void 0:U.organization,jobTitle:(te=M.data)==null?void 0:te.jobTitle,location:(ee=M.data)==null?void 0:ee.location,image:{thumbnail:((Y=M.data)==null?void 0:Y.thumbnail)||void 0}},userLiked:w,likes:($==null?void 0:$.like)||0,peopleWhoLiked:N},functions:{content:{createContent:()=>null,deleteContent:()=>h({replyId:_}),updateContent:(ue,{body:J})=>p({replyId:_,content:J})},likes:{createLike:()=>g({replyId:_}),deleteLike:()=>y({replyId:_,reactionId:R})},comments:{}}},_)}):null})]})};const Uf=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,join:i,leave:s}})=>{const o=oe.useIntl(),{replies:l,repliesCount:u,fetchNextPage:c,hasNextPage:f,isLoading:m,mutations:{create:p,edit:g,like:h,remove:y,unlike:b},user:x}=Hf({queryKey:[e,t,n,"replies"],queryFns:a});return Bs([m]),qf(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(Rf,{type:"comment",responses:u}),d.jsx(po,{form:{content:{type:"reply",slugs:{}},functions:{create:(B,{body:E})=>p({activityId:n,content:E})},meta:{isEditing:!1,showSuccessMessage:!1},placeholder:o.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),l==null?void 0:l.map(B=>{var se,ne,D,q,X,k,S,z,L,U,te,ee;const{id:E,own_children:_,latest_children:T,children_counts:A}=B,I=(((se=_==null?void 0:_.like)==null?void 0:se.length)||0)>0?(ne=_==null?void 0:_.like)==null?void 0:ne.find(Y=>{var ue;return((ue=Y==null?void 0:Y.user)==null?void 0:ue.id)===(x==null?void 0:x.id)}):!1,j=I?I==null?void 0:I.id:"",R=!!I,F=(((D=T==null?void 0:T.like)==null?void 0:D.length)||0)>0?(q=T==null?void 0:T.like)==null?void 0:q.map(Y=>{var ue,J,ge;return{id:(ue=Y==null?void 0:Y.user)==null?void 0:ue.id,name:(ge=(J=Y==null?void 0:Y.user)==null?void 0:J.data)==null?void 0:ge.name}}):!1,N=B==null?void 0:B.user,M=(N==null?void 0:N.id)===(x==null?void 0:x.id),Z=Za(r,M),K=typeof B.data.content=="string"?(X=B==null?void 0:B.data)==null?void 0:X.content:((S=(k=B==null?void 0:B.data)==null?void 0:k.content)==null?void 0:S.text)||"";return d.jsx(Pf,{children:d.jsx(jr,{content:{id:E,type:"reply",body:K,canLike:Z,createdAt:B==null?void 0:B.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:E},slug:E,author:{id:N==null?void 0:N.id,name:(z=N.data)==null?void 0:z.name,organization:(L=N.data)==null?void 0:L.organization,jobTitle:(U=N.data)==null?void 0:U.jobTitle,location:(te=N.data)==null?void 0:te.location,image:{thumbnail:((ee=N.data)==null?void 0:ee.thumbnail)||void 0}},userLiked:R,likes:(A==null?void 0:A.like)||0,peopleWhoLiked:F},functions:{content:{createContent:()=>null,deleteContent:()=>y({replyId:E}),updateContent:(Y,{body:ue})=>g({replyId:E,content:ue})},likes:{createLike:()=>h({replyId:E}),deleteLike:()=>b({replyId:E,reactionId:j})},comments:{}},children:d.jsx(Jw,{basePath:e,parentId:t,activityId:n,replyId:E,isMember:r,functions:{...a}})},E)},E)}),!m&&d.jsx(Sr,{hasNextPage:f,loadNextPage:()=>c(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})};function Xw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({content:a})=>t(i=>(i&&(i.content=a),i)),onError:n});return r}function eE({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 tE({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=qe.useQueryClient(),s=Wa(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:go(o),mutate:vo(o)},user:s,...o},u=Xw({...l,mutationFn:t}),c=nE({...l,mutationFn:n}),f=rE({...l,mutationFn:r}),{activity:m,...p}=eE({queryKey:a,queryFn:e});return{activity:m,mutations:{edit:u,like:c,unlike:f},user:s,...p}}function nE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ta({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ta({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function rE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Lf({activity:s,user:r}),s)),onError:n});return a}const aE=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,join:o,leave:l}})=>{var I,j,R,w,F,N,M,Z,K,se;const u=oe.useIntl(),c=C.useContext(Ot),{activity:f,error:m,isLoading:p,mutations:{edit:g,like:h,unlike:y}}=tE({queryFns:i,queryKey:[e,t,n]});if(p)return d.jsx(Ct,{style:{height:"400px"}});if(m||!f)return d.jsx(en,{variant:"error",text:u.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:b,latest_reactions:x}=f,B=(((I=x==null?void 0:x.like)==null?void 0:I.length)||0)>0,E=(((j=b==null?void 0:b.like)==null?void 0:j.length)||0)>0,_=E?b==null?void 0:b.like[0].id:"",T=B?(R=x==null?void 0:x.like)==null?void 0:R.map(ne=>{var D,q,X;return{id:(D=ne==null?void 0:ne.user)==null?void 0:D.id,name:(X=(q=ne==null?void 0:ne.user)==null?void 0:q.data)==null?void 0:X.name}}):!1,A=f==null?void 0:f.actor,$=(A==null?void 0:A.id)===(c==null?void 0:c.id);return d.jsxs("section",{className:"activity-section",children:[d.jsx(jr,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:f==null?void 0:f.content,canLike:Za(r,$),createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:{id:A.id,name:(w=A.data)==null?void 0:w.name,organization:(F=A.data)==null?void 0:F.organization,jobTitle:(N=A.data)==null?void 0:N.jobTitle,location:(M=A.data)==null?void 0:M.location,image:{thumbnail:((Z=A.data)==null?void 0:Z.thumbnail)||void 0}},userLiked:E,likes:((K=f==null?void 0:f.reaction_counts)==null?void 0:K.like)||0,comments:((se=f==null?void 0:f.reaction_counts)==null?void 0:se.reply)||0,peopleWhoLiked:T},originalAuthorId:A==null?void 0:A.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(ne,{body:D})=>g({content:D})},likes:{createLike:()=>h({activityId:n}),deleteLike:()=>y({activityId:n,reactionId:_})},comments:{openComments:()=>{}}}},n),d.jsx(Uf,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,join:o,leave:l}})]})},iE=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),rc=[{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 ea="notFoundError_",sE=()=>{const e=oe.useIntl(),t=[];return rc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ea}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(Sf,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(an,{children:[d.jsx(kf,{cards:rc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(xe,{href:"/solution-articles/",children:e.formatMessage({id:`${ea}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ea}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ea}text`})})]})};exports.ASSETS_BUCKET=zt;exports.ActivitiesFeed=$w;exports.ActivitySection=aE;exports.AddPost=po;exports.Banner=Fx;exports.BannerSection=Rx;exports.Breadcrumbs=Yx;exports.Buckets=kh;exports.Button=xe;exports.ButtonWrapper=yn;exports.COURSE_CONTENT_TYPES=or;exports.CacheProvider=bf;exports.Card=lo;exports.CardBlock=kf;exports.Carousel=Kx;exports.CollapsibleSection=Na;exports.Columns=Ff;exports.CommunityDetails=Zx;exports.ContactFooter=sw;exports.ContactForm=rf;exports.ContentTypeLabel=wc;exports.Contributors=js;exports.ConversationContext=Ka;exports.CookieBanner=Tf;exports.CourseProgression=hw;exports.CourseStructure=mw;exports.CustomContentBanner=Mx;exports.Directory=_x;exports.DiscussionConversation=Pf;exports.DiscussionForm=Va;exports.DiscussionLikes=Nf;exports.DiscussionPost=jr;exports.DiscussionThread=Mf;exports.Divider=Qt;exports.DownloadSection=Tx;exports.EMAILS=Fn;exports.EditSection=jx;exports.EmailHelperTextBox=Tc;exports.EmptyStateBox=en;exports.Filters=Gx;exports.FlagsProvider=yf;exports.Footer=ho;exports.Form=Gn;exports.FullWidthSection=an;exports.GlobalProviders=wx;exports.Header=mo;exports.HelperTextBox=_c;exports.HiddenFromScreenReaders=Oa;exports.HideShowTextBox=kc;exports.HighlightSection=$x;exports.HighlightedTextBox=St;exports.INVALID_TOKEN=vc;exports.IconBulletedList=Fh;exports.ImageContainer=wh;exports.IntlProvider=Df;exports.InviteForm=af;exports.InviteModal=Ex;exports.JoinButton=co;exports.LanguageContext=so;exports.LanguageSwitcher=Jx;exports.LessonName=jf;exports.LessonType=Of;exports.Link=Dn;exports.LoadMore=Sr;exports.LoadingBlock=Lh;exports.LoadingPlaceholder=Ct;exports.LoadingState=Ts;exports.Logo=fo;exports.LogoSection=Ox;exports.MarkCompleteButton=pw;exports.MarkdownText=zn;exports.MarketingBlock=Lx;exports.Member=Ar;exports.MembersList=fw;exports.Modal=uo;exports.MoreMenu=Bf;exports.NUMBER_OF_COUNTRIES=dh;exports.NUMBER_OF_USERS=ch;exports.NavigationMenu=Af;exports.NotFoundError=sE;exports.Overlay=Tr;exports.OverlayContext=oo;exports.OverlayProvider=wf;exports.PageHeading=Bc;exports.PageLayout=Sf;exports.PasswordForm=vC;exports.PasswordRules=Nc;exports.Pill=Rn;exports.Portal=xc;exports.ProfileImageChange=gC;exports.ProfilePicture=tn;exports.ProgressBar=Fs;exports.ProgressTracker=Eh;exports.Rating=Xh;exports.RepliesFeed=Uf;exports.ResponsesHeading=Rf;exports.ResponsiveImage=Yn;exports.ReturnToNavButton=_h;exports.RichTextEditor=nf;exports.SearchForm=sf;exports.ShareLinks=rw;exports.SignupForm=wC;exports.Span=Xi;exports.StatusBanner=br;exports.TableOfContents=Ax;exports.Tabs=aw;exports.Tags=dw;exports.TestimonialBlock=Bx;exports.TimeToComplete=Ha;exports.Toggle=pC;exports.Tooltip=Ua;exports.TopLevelPage=ow;exports.UserContext=Ot;exports.UserProvider=Cf;exports.VisuallyHidden=Ie;exports.addAriaProps=Ef;exports.basicReducer=Br;exports.camelCaseToDashCase=mc;exports.checkIntlPathExists=Pa;exports.generateConditions=la;exports.generateCssIcon=bc;exports.getLongDate=As;exports.getMember=Ss;exports.getShortDate=yc;exports.headerData=kr;exports.mapGetStreamData=iE;exports.pageReady=Dc;exports.passwordValidator=Qi;exports.repliesFeedMock=Lw;exports.supportedLanguages=da;exports.toCamelCase=pc;exports.toSentenceCase=gc;exports.useCurrentPath=lc;exports.useEffectAfterMount=Ln;exports.useElementWidth=Kn;exports.useOverlay=xf;exports.useScrollListener=dc;exports.useScrollToHash=Bs;exports.useUser=Wa;
|
|
159
|
+
${cr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:cr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const fw="shareLinks_",hw=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ue.useIntl(),l=dw({title:e,link:t,referrer:n});return d.jsxs("aside",{className:Z("share-links",a,i,s),children:[d.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),d.jsx("ul",{children:l.map(({key:u,icon:c,url:f,shouldRender:m=!0,onClick:p})=>{if(typeof m=="function"&&!m())return null;const g={};return p&&(g.onClick=h=>p(h,f)),d.jsx("li",{children:d.jsx(we,{size:a,variant:"tertiary",icon:{icon:c||u},href:f,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${fw}link_${u}`}),...g})},u)})})]})};const mw=({tabs:e,className:t="",preventLocationChange:n})=>{var u;const r=(c,f,m)=>(c||(c=`panel-${window.btoa(f)}-${m}`),c);let a=e.findIndex(c=>c.current===!0);if(a<0&&(a=0),window.location.hash){const c=window.location.hash.replace("#","");if(e.find(m=>m.id===c)){for(let m=0;m<e.length;m++)if(r(e[m].id,e[m].text,m)===c){a=m;break}}}const[i,s]=C.useState((u=e[a])!=null&&u.id?e[a].id:r(e[a].id,e[a].text,a));C.useEffect(()=>{if(e[a].hasCarousel){const c=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(c)}},[i]);const o=[],l=[];return e.forEach(({id:c,text:f,content:m,href:p,hasCarousel:g},h)=>{c=r(c,f,h);const y=i===c,v={};p||(v["aria-controls"]=c,v.onClick=x=>{x.preventDefault(),x.stopPropagation(),s(c),!n&&(window.location.hash=`#${c}`)},l.push(d.jsx("section",{id:c,hidden:!y,role:"tabpanel","aria-labelledby":`tab-${c}`,"aria-live":y?"assertive":"off",children:typeof m=="string"?d.jsx("p",{children:m}):m},`section-${c}`))),o.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:p||`#${c}`,id:`tab-${c}`,className:Z({selected:y}),role:"tab","aria-selected":y,...v,children:f})},`tab-${c}`))}),d.jsxs("div",{className:Z("tabs-wrapper",t),children:[d.jsx("ul",{className:"tabs",role:"tablist",children:o}),d.jsx("div",{className:"tab-content",children:l})]})};const pw={"2-1":901,"1-3":769,"1-1":769},Rf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Gn(!0);let s=a;return C.Children.count(a)===1&&(s=C.Children.toArray(a)[0],s.props&&(s=s.props.children)),d.jsx("section",{className:Z("columns",`layout-${e}`,r,{"has-containers":n}),children:C.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<pw[e]?null:o)})};let zi;const qi="contactFooter_",gw=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=C.useRef(null),[r,a]=C.useState(0),[i,s]=C.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(zi),zi=setTimeout(()=>{o(),s(!1)},500))};return C.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(zi),window.removeEventListener("resize",l)}),[]),d.jsx(un,{id:"contactForm",className:"contact-footer",children:d.jsxs("div",{className:"inner-wrapper",children:[d.jsx("h2",{children:d.jsx(ue.FormattedMessage,{id:`${qi}title`})}),d.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[d.jsxs("aside",{children:[d.jsx("p",{children:d.jsx(ue.FormattedMessage,{id:`${qi}text`})}),d.jsx(En,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(ue.FormattedMessage,{id:`${qi}email`})})]}),d.jsx(df,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},vw=({activeLink:e,...t})=>d.jsx(un,{children:d.jsx(Rf,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(Nf,{activeLink:e}),d.jsx(Oc,{...t})]})})});const Wi="cookieBanner_",Hi=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Ui=new Date(Date.now()+12*30*24*60*60*1e3),Mf=()=>{const e=ue.useIntl(),[t,n,r]=Ts.useCookies(Hi),[a,i]=C.useState(!t["apol-cookie-banner"]),s=()=>{Hi.forEach(c=>{n(c,!0,{path:"/",expires:Ui,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Ui}),Hi.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:Ui});return}r(c)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(c=>{u.push({variant:c.href?"tertiary":"primary",href:c.href,onClick:c.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${c.gtmType}-click`,children:e.formatMessage({id:`${Wi}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${Wi}title`})}),d.jsx("p",{children:e.formatMessage({id:`${Wi}text`})}),d.jsx(wn,{buttons:u})]})},Lt={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:On["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:On["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:On.support,gtmType:"concierge-email-click"},business:{email:On.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 $n="footer_",Oa="SiteFooter",ec=({group:e})=>{const t=Lt[e].order||[];let n=!1;return"text"in Lt[e]&&(n=Lt[e].text),d.jsxs(C.Fragment,{children:[d.jsx("p",{className:"pre-title",children:d.jsx(ue.FormattedMessage,{id:`${$n}${e}`})}),Array.isArray(t)&&t.length>0&&d.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=Lt[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),d.jsx("li",{children:d.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":i,...s,children:d.jsx(ue.FormattedMessage,{id:`${$n}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&d.jsx("dl",{className:"text-medium",children:n.order.map(r=>d.jsxs(C.Fragment,{children:[d.jsx("dt",{children:d.jsx(ue.FormattedMessage,{id:`${$n}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(ue.FormattedMessage,{id:`${$n}${e}_${r}_address`,values:{br:d.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&d.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},bo=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx(Ia,{element:"hr"}),d.jsx(vo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":"logo-homepage-link"}),d.jsx("footer",{children:["platform","community","company","contact"].map(e=>d.jsxs("div",{className:"group",children:[d.jsx(ec,{group:e}),Object.keys(Lt[e]).includes("child")&&d.jsx(ec,{group:Lt[e].child})]},e))}),d.jsx("hr",{}),d.jsxs("div",{className:"sub-footer",children:[d.jsx("ul",{children:Array.isArray(Lt.social.order)&&Lt.social.order.map(e=>{const t=Lt.social[e];return d.jsx("li",{className:e,children:d.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(ue.FormattedMessage,{id:`${$n}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(ue.FormattedMessage,{id:`${$n}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Oe={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e==="account"&&t===!1&&n.navigation===!0)return;const i=Date.now();if(!a&&!t&&Oe.handlerCalled[e]&&i-Oe.handlerCalled[e]<500)return;Oe.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case"navigation":o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation > li.parent"));break;case"search":o=document.querySelector("#header .toggle-search-button");break;case"account":o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=fc(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?Oe.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case"navigation":if(n){const u=Oe.findFirstChild(t.current.children,"attributes.aria-controls","navigation");s=Oe.findFirstChild(u.children,"href")}else s=Oe.findFirstChild(t.current.children,"href");break;case"account":if(o=Oe.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Oe.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(Oe.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Oe.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Oe.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Oe.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Tr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},Pa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ue.useIntl(),o=fc(Tr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,c=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let m=!1;if(o.href){let x=o.gtmType||`${e}-click`;if(x.includes(".")){const B=x.split("."),k=B[B.length-2];x=`${k==="topics"?`${k}-`:""}${B[B.length-1]}`}m={href:o.href},u&&(m={...m,className:"gtm-trackable","data-gtm-event-type":x,"data-gtm-event-context":"HeaderButtons"}),c&&(m={...m,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],g=p&&o[o.order[0]].order,h=m&&window.location.pathname===o.href;let y={},v={};if(h&&(y={...y,"aria-current":"page"}),p){const x=o.menuId||e,B={onClick:k=>Oe.events.onClick(k,{id:x,callback:a,isOpen:r[x]}),onFocus:()=>Oe.events.onFocus({id:x}),onBlur:()=>Oe.events.onBlur({id:x,callback:a}),onMouseLeave:()=>Oe.events.onBlur({id:x,callback:a}),onMouseEnter:()=>Oe.events.onMouseEnter({id:x,callback:a})};n&&(g&&(y={...B,onKeyPress:k=>{k.key==="Enter"&&Oe.events.onClick(k,{id:x,callback:a,isOpen:r[x]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[x],"aria-controls":x}),v={hidden:x in r?!r[x]:!0}),g||(v={...v,...B})}return d.jsxs("li",{className:Z({[o.className]:o.className,"has-submenu":p,parent:g,active:h}),...y,children:[m?C.createElement(c?we:"a",m,s.formatMessage({id:f})):s.formatMessage({id:f}),o.order&&d.jsx("ul",{...v,children:o.order.map(x=>{if(!o[x])return null;const B={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[x].order?d.jsxs("li",{className:Z({[o[x].className]:o[x].className}),children:[s.formatMessage({id:`${f}_${x}`}),d.jsx("ul",{children:o[x].order.map(k=>d.jsx(Pa,{id:`${e}.${x}.${k}`,...B},k))})]},x):d.jsx(Pa,{id:`${e}.${x}`,...B},x)})})]},e)};const bw={height:67,height_desktop:83},yo=({showNavigation:e=!0})=>{const t=ue.useIntl(),n=C.useContext(Nt),r=Gn(!0,!0),a=n&&typeof n.id=="string",i=C.useMemo(()=>Oe.getIsDesktopVersion(a,r),[a,r]),[s,o]=C.useReducer(Sr,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:c}=s,f=C.useRef(s);C.useEffect(()=>{f.current=s},[s]),vc({scrollPosition:bw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const h=f.current.menus;!i&&h.navigation||Oe.shouldChangeHeaderIsVisible(!0,h,o)},scrollDown:()=>{const h=f.current.menus;!i&&h.navigation||Oe.shouldChangeHeaderIsVisible(!1,h,o)}}});const m=(h,y,v=!1)=>{Oe.handleMenus({id:h,value:y,menus:f.current.menus,dispatch:o,forceHandle:v})},p=C.useRef(null),g=h=>{h.key==="Escape"&&["navigation","search","account"].forEach(y=>{f.current.menus[y]&&m(y,!1,!0)})};return C.useEffect(()=>{var h;return(h=document.getElementById("header"))==null||h.addEventListener("keydown",g),()=>{var y;(y=document.getElementById("header"))==null||y.removeEventListener("keydown",g)}},[]),Wn(()=>{u.navigation&&Oe.autoFocus({menu:"navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.navigation]),Wn(()=>{u.account&&Oe.autoFocus({menu:"account",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.account]),n&&n.isLoading?null:d.jsxs(d.Fragment,{children:[d.jsxs("nav",{id:"header",className:Z({"logged-in":a,"logged-out":!a,visible:l}),children:[d.jsx($e,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),d.jsx(vo,{variant:"monochrome"}),e&&d.jsxs(d.Fragment,{children:[!i.navigation&&d.jsx("button",{className:"menu-button gtm-trackable",onClick:h=>{h.preventDefault(),h.stopPropagation(),m("navigation",!u.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u.navigation,"aria-controls":"navigation",children:d.jsx($e,{children:t.formatMessage({id:`header_menu_${u.navigation?"hide":"show"}`})})}),d.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||u.account?!1:!u.navigation,"data-showing":!i.navigation&&u.account?"account":"default",children:Tr.order.map(h=>d.jsx(Pa,{id:h,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{navigation:u.navigation,account:u.account},callback:m},h))}),!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:h=>{h.preventDefault(),h.stopPropagation(),m("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:d.jsx($e,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),d.jsx(hf,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),a?d.jsxs("button",{className:"account-button",onClick:h=>Oe.events.onClick(h,{id:"account",callback:m,isOpen:u.account}),onMouseEnter:()=>Oe.events.onMouseEnter({id:"account",callback:m}),onMouseLeave:()=>Oe.events.onBlur({id:"account",callback:m}),"aria-haspopup":"true","aria-expanded":u.account,"aria-controls":"navigation",children:[d.jsx($e,{children:t.formatMessage({id:`header_account_${u.account?"hide":"show"}`})}),d.jsx(an,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):d.jsx("ul",{className:"sign-in-buttons",children:Tr.buttons.order.map(h=>d.jsx(Pa,{id:`buttons.${h}`},h))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:Z("overlay",{open:u.navigation||u.account||!i.search&&u.search})})]})};const yw=()=>{const e=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(yo,{}),d.jsx("div",{id:"content",children:d.jsx(rn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(bo,{})]})},If=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:c="default",variant:f="default",circle:m="default",modal:p="default"}=i,g=pc();C.useEffect(()=>{window.scrollTo(0,0)},[g]);const h=oa(e,{locale:o}),y=oa(t,{locale:o}),v=oa(n,{locale:o}),x={};return c!=="default"&&(x[c]=!0),f!=="default"&&(x[f]=!0),m!=="default"&&(x[m]=!0),d.jsx(ch.ErrorBoundary,{onError:r,fallback:d.jsx(yw,{}),children:d.jsx(C.Suspense,{fallback:null,children:d.jsxs("div",{id:"wrapper",className:Z(s,x,{"has-footer":u}),children:[d.jsx(yo,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[y&&d.jsx("div",{className:Z("additional-content prepended",{"large-modal":p==="large"}),children:y}),C.createElement(c==="bold"?mo:"div",{id:"content",children:h,className:Z({"large-modal":p==="large"})})]}),v&&d.jsx("div",{className:"additional-content appended",children:v}),u&&d.jsx(bo,{}),d.jsx(Mf,{})]})})})},tc={default:"tags_",headerTopics:"header_topics_topics_"},Vi={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"},Dw={getTagDetails:e=>{if(e.includes("topic_")){if(e=Vi.topic[e.replace("topic_","")],e){const t=Tr.topics.topics[e].href;return t?{id:e,href:t,text:`${tc.headerTopics}${e}`}:null}return null}return Vi[e]?(e=Vi[e],{id:e,text:`${tc.default}${e}`}):null}};const Cw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ue.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=Dw.getTagDetails(u);c&&l.push(c)}),l.length<1?null:d.jsx("ul",{className:Z("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const c=o.formatMessage({id:u.text});return d.jsx("li",{children:u.href&&r?d.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:c}):c},u.id)})})};const xw=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=ue.useIntl();return e.length===0?null:d.jsxs("div",{className:Z("members-list",s),children:[d.jsxs("h1",{children:[o.formatMessage({id:"membersList"}),d.jsx("span",{className:"count",children:t})]}),d.jsx("ul",{children:e.map((l,u)=>d.jsxs("li",{children:[d.jsx(jr,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(fn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx(Nr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const ww=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ue.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=s;return C.createElement(e,{className:Z("course-progression",o,{"highlight-percentage":c,"has-circle-graph":i==="circle"}),children:d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:f=>d.jsx("strong",{children:f}),number:u})}),u<100&&a&&d.jsx(Ga,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx(Os,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const $f=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>C.createElement(e,{className:Z("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Lf=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ue.useIntl(),o=$a(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):xc(a||"");return d.jsxs("small",{className:Z("content-type",{[e]:e!=="default"}),children:[d.jsx("span",{className:Z("type",n),children:o})," ",t>0&&!r&&d.jsx(Ga,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const Ew=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const f=ue.useIntl(),m="courseStructure_",p=u.toLowerCase().includes("course conclusion");return d.jsxs(La,{className:"course-structure",label:d.jsxs(d.Fragment,{children:[d.jsxs("small",{children:[f.formatMessage({id:`${m}section${p?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?f.formatMessage({id:`${m}time_completed`}):d.jsx(Ga,{time:s,appendedText:a?f.formatMessage({id:`${m}time_left`}):""})})]}),d.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[d.jsx("p",{children:n}),d.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:h,contentType:y,icon:v,image:x,isIntroduction:B,optional:k,slug:E,subsectionId:A,title:j,type:L})=>{const I=a&&t||B,T={};return x&&(T.style={"--image":`url(${x})`}),d.jsx("li",{className:Z({article:y===dr.ARTICLE,discussion:y===dr.DISCUSSION,quiz:y===dr.QUIZ,completed:g&&y===dr.ARTICLE,locked:!I}),...T,children:d.jsx(En,{href:I?`/microcourses/en/${o}/${E}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Cc(j)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx($f,{sectionId:i,subsectionId:A,title:j,className:"course-title"})," ",d.jsx(Lf,{completionTime:h,icon:v,optional:k,type:L,children:c&&c[E]&&d.jsx("span",{className:"quiz-score",children:`${c[E]}%`})})]})})},E)})})]})};const kw=({isComplete:e=!1,onClick:t,...n})=>{const r=ue.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),d.jsx(we,{...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:Z("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})};let aa=null;const ut="discussion_form_",Qa=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},placeholder:a,maxLength:i=0,forceShow:s={cancel:!1,error:!1},functions:o={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:l="DiscussionForm"})=>{var L,I,T;const u=ue.useIntl(),c=C.useContext(Nt),[f,m]=C.useState(r.isEditing&&r.isEditing.text||""),[p,g]=C.useState(s.error||!1),[h,y]=C.useState(!1);if(r.isLoading)return d.jsx(wt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const v=O=>{m(O);let w;!c||!c.id?w=Ft(u.formatMessage,`${ut}error_loggedOut`,t.type,"action"):n?i>0&&O.length>=i&&(w=`${ut}error_tooLong`):w=Ft(u.formatMessage,`${ut}error_noPermission`,t.type,"action"),w?g(w):p&&g(!1)};let x=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const O=((L=t.slugs)==null?void 0:L.reply)||((I=t.slugs)==null?void 0:I.answer)||((T=t.slugs)==null?void 0:T.question)||"";O&&(x=`${x}-${O.slice(-15)}`)}e&&(x=`${e}-${x}`);const B=async O=>{var F;if(O.preventDefault(),O.stopPropagation(),!c||!c.id||!n||E)return;aa&&clearTimeout(aa),y("submitting");const w=window.location.pathname;try{let R;switch(t.type){case"post":R=await o.create({content:f});break;case"question":R=await o.create({title:f,authorId:c&&c.id,...(F=o.props)==null?void 0:F.create});break;case"response":R=await o.create({questionSlug:t.slugs.question},{body:f,authorId:c&&c.id,contentPath:w});break;case"reply":R=await o.create({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:f,authorId:c&&c.id,contentPath:w});break;default:break}await Ch(1e3),o.callback&&await o.callback(R),aa=setTimeout(()=>{m(""),y("submitted");const M=new Event("discussionFormSubmitted");document.dispatchEvent(M),k()},500)}catch(R){const M=R;let K=`${ut}error`;M!=null&&M.message.includes("entry already exists")&&(K=Ft(u.formatMessage,`${ut}error_alreadyExists`,t.type,"action")),M!=null&&M.message.includes("429")?K=Ft(u.formatMessage,`${ut}error_tooMany`,t.type,"action"):M!=null&&M.message.includes("400")&&(K=`${ut}error`),g(K),k()}},k=()=>{aa=setTimeout(()=>{g(!1),y(!1)},5e3)},E=!f||!Ah(f),A=h==="submitting",j=[];return(r.isEditing&&!A||s.cancel)&&j.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!s.cancel&&(!c||!c.id||!f),children:u.formatMessage({id:`${ut}cancel`})}),j.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:O=>{if(r.isEditing){y("submitting"),o.handleSaveEdit&&o.handleSaveEdit(f);return}B(O)},className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`${r.isEditing?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:!c||!c.id||!n||E||A||r.isEditing&&f===r.isEditing.text,children:u.formatMessage({id:`${ut}${A?r.isEditing?"saving":"posting":r.isEditing?"save":"post"}`})}),d.jsxs("form",{id:x,className:Z("discussion-card discussion-form",{"no-styling":r.isInWrapper&&r.isEditing}),"data-testid":`discussion-${t.type}-form`,children:[(r==null?void 0:r.showTitle)&&!r.isEditing&&["question"].includes(t.type)&&d.jsx("h2",{children:Ft(u.formatMessage,`${ut}title`,t.type,"action")}),d.jsx(jr,{member:c||"community",gtmContext:l,gtmType:"profile-click"}),d.jsx($e,{element:"label",showOnFocus:!1,htmlFor:`${x}-input`,children:Ft(u.formatMessage,`${ut}label`,t.type,"action")}),d.jsx(cf,{id:`${x}-input`,value:h==="submitting"&&!p?"":f,placeholder:a||Ft(u.formatMessage,`${ut}placeholder`,t.type,"action"),maxLength:i,functions:{onChange:v},autoFocus:!!r.isEditing,"aria-invalid":!!p,"aria-errormessage":"error-message"}),d.jsx("small",{children:Ft(u.formatMessage,`${ut}explainer`,t.type,"action",{a:O=>d.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:O})})}),d.jsx(wn,{buttons:j}),h==="submitted"&&r.showSuccessMessage&&d.jsx(xr,{className:"success","data-testid":"success",children:Ft(u.formatMessage,`${ut}success`,t.type,"action")}),p&&d.jsx(xr,{id:"error-message",className:"error","data-testid":"error",children:s.error?s.error:typeof p=="string"?p.includes(" ")?p:u.formatMessage({id:p},{action:u.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):p})]})},Do=({form:e,membershipRequiredToPost:{isMember:t,required:n,join:r,leave:a,notMemberStateText:i}})=>{if(n&&!t)return d.jsx(rn,{text:i,button:{breakpoints:{mobile:!0,901:!1},component:d.jsx(go,{isShort:!0,functions:{join:r,leave:a}})}});const{content:s,functions:o,meta:l,...u}=e;return d.jsx(Qa,{content:{type:(s==null?void 0:s.type)||"reply",slugs:(s==null?void 0:s.slugs)||{}},functions:{...o,create:(o==null?void 0:o.create)||(()=>{})},meta:{...l,isEditing:(l==null?void 0:l.isEditing)||!1,showSuccessMessage:!1},...u,id:`add-post-${u.id||""}`})},_w={showForm:!1},Ja=C.createContext(_w),zf=({children:e})=>{const[t,n]=C.useState({showForm:!1});return d.jsx(Ja.Provider,{value:{...t,updateConversation:n},children:e})},Bw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Aw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Fs=({icon:e,...t})=>d.jsx(we,{className:"discussion-button",variant:"tertiary",icon:e,...t});let Cr=!1;const Ki=()=>{Cr!==!1&&(clearTimeout(Cr),Cr=!1)},Zi=5;let Yi=null;const qf=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const u=ue.useIntl(),c={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[f,m]=C.useReducer(Sr,c),{numberOfLikes:p,userLikedContent:g,ignoreInteractions:h,showLikers:y,tabbableLink:v}=f;C.useEffect(()=>{m([{type:"userLikedContent",value:a}])},[a]);const x=C.useMemo(()=>Aw(n,Zi),[n]),B=j=>{if(j.preventDefault(),j.stopPropagation(),m([{type:"showLikers",value:!1}]),Cr)return Ki(),!1;if(Ki(),h||!s)return!1;Cr=setTimeout(k,350)},k=async()=>{if(Ki(),h||!s)return!1;let j=g?p-1:p+1;j<0&&(j=0),m([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:j},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const L=Bw(i.slugs);g?await l(L):await o({...L,payload:{contentPath:window.location.pathname}})}}catch{m([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{m([{type:"ignoreInteractions",value:!1}])}},E=()=>{Yi=setTimeout(()=>{m([{type:"showLikers",value:!1}])},500)},A=()=>{Yi&&clearTimeout(Yi)};return C.createElement(e,{className:"likes-wrapper",onKeyDown:j=>{j.key==="Escape"&&m([{type:"showLikers",value:!1}])},onMouseEnter:()=>{A(),m([{type:"showLikers",value:!0}])},onMouseLeave:()=>{E()}},d.jsxs(d.Fragment,{children:[d.jsx(Fs,{className:Z("discussion-button text-medium action-button",{"show-spinner":h,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:B,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:p})})}),n&&d.jsxs(d.Fragment,{children:[d.jsx($e,{element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{A()},onBlur:()=>E,onClick:j=>{var I;j.preventDefault(),j.stopPropagation(),A(),m([{type:"showLikers",value:!0}]);const L=(I=j.currentTarget.nextSibling)==null?void 0:I.childNodes[0];if(L){const T=L.querySelector("li:first-child a");T&&(m([{type:"tabbableLink",value:0}]),setTimeout(()=>{T.focus()},100))}},onKeyDown:j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),E())},"aria-expanded":y,"aria-controls":`likes-tooltip-${i.slug}`,children:d.jsx($e,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),d.jsx(Qn,{id:`likes-tooltip-${i.slug}`,isOpen:y,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[x.map((j,L)=>{if(typeof j=="string"||!j.name)return null;const I={};return v!==L&&(I.tabIndex=-1),d.jsx("li",{"data-index":L,children:d.jsx(En,{href:j.id?`/profiles/${j.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:T=>T==null?void 0:T.stopPropagation(),onFocus:()=>A(),onKeyDown:T=>{var M,K,V,oe;if(!T||!["ArrowUp","ArrowDown"].includes(T.key||""))return;T.stopPropagation(),T.preventDefault();const O=T.key==="ArrowUp"?"up":"down",w=(M=T.currentTarget)==null?void 0:M.parentElement;let F=w==null?void 0:w.nextElementSibling;if(O==="up"){const ne=w==null?void 0:w.previousElementSibling;ne?F=ne:(F=(K=w==null?void 0:w.parentElement)==null?void 0:K.lastElementChild,(F==null?void 0:F.getAttribute("data-index"))==="-1"&&(F=F==null?void 0:F.previousElementSibling))}else(!F||(F==null?void 0:F.getAttribute("data-index"))==="-1")&&(F=(V=w==null?void 0:w.parentElement)==null?void 0:V.firstElementChild);if(!F)return;const R=(F==null?void 0:F.getAttribute("data-index"))||"0";m([{type:"tabbableLink",value:R}]),(oe=F==null?void 0:F.querySelector("a"))==null||oe.focus()},...I,children:j.name})},j.id||window.btoa(j.name))}),t>Zi&&d.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Zi})})]})})]})]}))},nc=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Xa=(e,t)=>e&&!t,Gi=({children:e,class:t,...n})=>{const r={...n,class:Z("subtle",t)};return d.jsx("blockquote",{...r,children:e})};const $t="discussion_",Fw=280,Rr=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,forceHide:i={actionBar:!1,comments:!1,likes:!1},functions:{content:{createContent:s,deleteContent:o,updateContent:l}={createContent:async()=>{},deleteContent:async()=>{},updateContent:async()=>{}},likes:{createLike:u,deleteLike:c}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:f}={openComments:()=>{}}},links:m={},className:p,gtmContext:g="DiscussionAnswer",children:h,isTruncated:y=!1})=>{const v=ue.useIntl(),x=C.useContext(Nt),B=C.useContext(Ja),{author:k,canLike:E,createdAt:A,id:j,likes:L=0,userLiked:I,comments:T=0}=t,O=x&&x.id&&typeof k!="string"&&k.id&&k.id===x.id||!1,w=typeof E=="boolean"?E:n?!O:!1,F=O&&(!t.createdAt||yh(t.createdAt,10,"seconds")),R=C.useRef(null),[M,K]=C.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[V,oe]=C.useState(!1),[ne,D]=C.useState(F?"highlighted":"default"),[q,ee]=C.useState("");C.useEffect(()=>{const Y=R.current;if(!(!Y||ne==="default"))return document.addEventListener("discussionFormSubmitted",_),Y.addEventListener("transitionend",S),()=>{document.removeEventListener("discussionFormSubmitted",_),Y.removeEventListener("transitionend",S)}},[]),C.useEffect(()=>{K({...M,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]);const _=()=>{setTimeout(()=>{D("fading")},1e3)},S=({propertyName:Y})=>{Y==="background-color"&&D(le=>(le==="default"&&(document.removeEventListener("discussionFormSubmitted",_),R.current&&R.current.removeEventListener("transitionend",S)),le==="fading"?"default":le))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return d.jsx(wt,{className:"discussion-card discussion-post"});const z=y?qn(M.body,Fw):M.body,$=async Y=>{Y||(Y=""),ee("");try{if(!dc(Y,M.body)){const le=t.type==="question"?{title:Y}:{body:Y};await l(nc(t.slugs),le)}K({body:Y,isEditing:!1,didEdit:!0})}catch{ee(`${$t}form_error`)}},U=()=>{B&&B.updateConversation&&B.updateConversation({showForm:!0}),setTimeout(()=>{var pe,_e,je;const le=`reply-form-${(t.type==="answer"?t.slug:((pe=t.slugs)==null?void 0:pe.reply)||((_e=t.slugs)==null?void 0:_e.answer)||((je=t.slugs)==null?void 0:je.question)||"").toLowerCase().slice(-15)}`,X=document.getElementById(le),ve=document.getElementById(`${le}-input`);ve&&ve.focus(),X&&X.scrollIntoView({behavior:"smooth"})},0)},re=async()=>{oe(!1);try{await o(nc(t.slugs))}catch{ee("delete-error")}},te=[{text:v.formatMessage({id:`${$t}moreMenu_report`}),onClick:Y=>{Y.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(v.formatMessage({id:`${$t}report_subject`}))}&body=${encodeURI(v.formatMessage({id:`${$t}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&&O&&te.push({text:v.formatMessage({id:`${$t}moreMenu_edit`}),onClick:()=>K({...M,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`edit-${t.type}-click`},{text:v.formatMessage({id:`${$t}moreMenu_delete`}),onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),oe(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`delete-${t.type}-click`,...Sf(`delete-${t.slug}-modal`,V)}),C.createElement(e,{className:Z("discussion-post",p,{[ne]:!p||!p.includes("highlighted-text-box"),"has-link":m.post&&!M.isEditing}),ref:R,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${g}-post-click`,onClick:Y=>{!m.post||M.isEditing||(Y.preventDefault(),Y.stopPropagation(),window.location.href=m.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:j||t.slug,className:Z("discussion-card",t.type,{editing:M.isEditing,"has-link":m.post&&!M.isEditing}),children:[!M.isEditing&&d.jsx(jr,{member:k,additionalContent:{createdAt:A,didEdit:M.didEdit},className:typeof k!="string"&&k.id===a?"highlighted":"",gtmContext:g,gtmType:"profile-click"}),M.isEditing?d.jsx(Qa,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:M.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:q!==""&&q!=="delete-error"?v.formatMessage({id:q},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:s,handleSaveEdit:$,handleCancel:()=>{ee(""),K({...M,isEditing:!1})}},gtmContext:`${g}Form`}):m.post?d.jsxs("a",{href:m.post,children:[(t==null?void 0:t.title)&&d.jsx("p",{className:"content-title",children:t.title}),t!=null&&t.body&&(t==null?void 0:t.body.length)>195?d.jsx(jc,{text:t==null?void 0:t.body.trim(),markdownOptions:{overrides:{a:rs,blockquote:{component:Gi}}}}):d.jsx(Hn,{options:{overrides:{a:rs,blockquote:{component:Gi}}},children:z.trim()})]}):d.jsx(Hn,{options:{wrapper:t.type==="question"?"h1":C.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:Gi}}},children:z.trim()}),!M.isEditing&&!(i!=null&&i.actionBar)&&d.jsxs("ul",{className:Z("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!i.likes&&d.jsx(qf,{element:"li",likes:L,isShort:!1,userLiked:I,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:w,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:u,deleteLike:c}}),!i.comments&&(["question","post"].includes(t.type)||m.comments||typeof f=="function")&&d.jsx("li",{children:d.jsx(Fs,{onClick:Y=>{Y.preventDefault(),Y.stopPropagation(),m.comments&&(window.location.href=m.comments),typeof f=="function"&&f()},icon:{icon:"speech-bubble_square_thick"},"data-gtm-event-context":g,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:v.formatMessage({id:`${$t}comments_screenReader`},{count:T}),children:v.formatMessage({id:`${$t}comments`},{count:T})})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(Fs,{styling:{muted:!0},onClick:U,icon:{icon:"speech-bubble_square_thick"},children:v.formatMessage({id:`${$t}reply`})})}),d.jsx(Pf,{element:"li",id:`more-${t.slug}`,options:te})]})]}),h,d.jsx(Pr,{id:`delete-${t.slug}-modal`,isOpen:V,functions:{onOpen:()=>{},onClose:()=>oe(!1)},forceShow:{error:q==="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:()=>oe(!1),children:v.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:re,children:v.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:d.jsx(ue.FormattedMessage,{id:"discussion_delete_text",values:{p:Y=>d.jsx("p",{children:Y}),action:v.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Qi="discussion_responses_",Wf=({type:e="answer",responses:t=0})=>{const n=ue.useIntl();return t=parseInt(t),d.jsxs("div",{className:"responses-heading",children:[d.jsx("h4",{children:n.formatMessage({id:`${Qi}title`},{action:n.formatMessage({id:`${Qi}${e}`}),count:t})}),t===0&&d.jsx("p",{children:Ft(n.formatMessage,`${Qi}empty`,e,e)})]})};const Hf=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ue.useIntl(),s=C.useContext(Ja),o=oa(a,{element:"li"});return d.jsxs("div",{className:Z("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&d.jsx("ul",{className:"thread",children:o}),!e&&d.jsx(Nr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&d.jsx(Qa,{...r})]})},Tw="post",Sw="reply",Uf="00000000-0000-0000-0000-000000000000";function Co({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function xo({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return e.setQueryData(t,r),a}return n}function jw(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Ow(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Vf(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 Pw({content:e}){return{content:e,id:Uf,time:new Date().toISOString(),verb:Tw}}function rc({activity:e,user:t}){return{...e,actor:Vf(t),...jw()}}function Na({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 Kf({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 Nw({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Uf,kind:Sw,parent:t||""}}function ac({reply:e,user:t}){const n=Vf(t);return{...e,user_id:n.id,user:n,...Ow()}}function ic({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 Rw({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 Zf=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let sc,Ji=0;const Yf=()=>{C.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(sc);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),Ji=0;return}Ji++,!(Ji>10)&&(sc=setTimeout(()=>{e(t)},50))}},Yn=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}),nn=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}),Gf=Object.freeze({actor:`SU:${Yn.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"}),Mw=Object.freeze({actor:`SU:${nn.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"}),Iw=Object.freeze({actor:`SU:${Yn.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"}),$w=Object.freeze({actor:`SU:${nn.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:Gf.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:nn.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:nn.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:nn.id,user:{id:nn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Gf.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:Yn.id,user:{id:Yn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Mw.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:nn.id,user:{id:nn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Iw.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:Yn.id,user:{id:Yn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:$w.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function Lw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=We.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=rc({activity:Pw(o),user:i});return oc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=rc({activity:o,user:i});r.setQueryData(a,oc(c,u,!0)),setTimeout(()=>{Zf(c.id)},0)}});return s}function zw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Ra(a,s);return o&&(o.content=i),s}),onError:n});return r}function qw({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=We.useQueryClient(),l=Ya(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:Co(u),mutate:xo(u)},user:l,...u},f=Lw({...c,mutationFn:e}),m=zw({...c,mutationFn:t}),p=Ww({...c,mutationFn:n}),g=Uw({...c,mutationFn:a}),h=Vw({...c,mutationFn:i}),{activities:y,...v}=Hw({queryKey:s,queryFn:r});return{activities:y,mutations:{create:f,edit:m,remove:g,like:p,unlike:h},user:l,...v}}function Ww({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Ra(s,o);return l&&Na({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Ra(o,l);u&&Na({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Hw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=We.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{activities:Zw(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Uw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Kw(a,i)),onError:n});return r}function Vw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Ra(i,s);return o&&Kf({activity:o,user:r}),s}),onError:n});return a}function oc(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 Ra(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Kw(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 Zw(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const Yw=({basePath:e,parentId:t,isMember:n,functions:{activities:r,join:a,leave:i}})=>{const s=ue.useIntl(),{activities:o,error:l,fetchNextPage:u,hasNextPage:c,isLoading:f,mutations:{create:m,edit:p,remove:g,like:h,unlike:y},user:v}=qw({queryKey:[e,t,"activities"],queryFns:r});return Yf(),l?d.jsx(rn,{variant:"error",text:l.message}):d.jsxs("section",{children:[d.jsx(Do,{form:{content:{type:"post",slugs:{}},functions:{create:m},meta:{isEditing:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:a,leave:i,notMemberStateText:s.formatMessage({id:"community_joinToPost"})}}),o==null?void 0:o.map((x,B)=>{var R,M,K,V,oe,ne,D,q;const{id:k,own_reactions:E,latest_reactions:A,reaction_counts:j}=x,L=(((R=A==null?void 0:A.like)==null?void 0:R.length)||0)>0,I=(((M=E==null?void 0:E.like)==null?void 0:M.length)||0)>0,T=I?E==null?void 0:E.like[0].id:"",O=L?(K=A==null?void 0:A.like)==null?void 0:K.map(ee=>{var _,S,z;return{id:(_=ee==null?void 0:ee.user)==null?void 0:_.id,name:(z=(S=ee==null?void 0:ee.user)==null?void 0:S.data)==null?void 0:z.name}}):!1,w=x==null?void 0:x.actor,F=(w==null?void 0:w.id)===(v==null?void 0:v.id);return d.jsx(C.Fragment,{children:d.jsx(Rr,{content:{type:"post",title:x==null?void 0:x.title,body:x==null?void 0:x.content,canLike:Xa(n,F),createdAt:(x==null?void 0:x.time)||"",slugs:{question:`${e}/${t}`,answer:k},slug:k,author:{id:w==null?void 0:w.id,name:(V=w==null?void 0:w.data)==null?void 0:V.name,organization:(oe=w==null?void 0:w.data)==null?void 0:oe.organization,jobTitle:(ne=w==null?void 0:w.data)==null?void 0:ne.jobTitle,location:(D=w==null?void 0:w.data)==null?void 0:D.location,image:{thumbnail:((q=w==null?void 0:w.data)==null?void 0:q.thumbnail)||void 0}},userLiked:I,likes:(j==null?void 0:j.like)||0,comments:(j==null?void 0:j.reply)||0,peopleWhoLiked:O},links:{post:`${e}/${t}/${k}`,comments:`${e}/${t}/${k}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>g({activityId:k}),updateContent:(ee,{body:_})=>p({activityId:k,content:_})},likes:{createLike:()=>h({activityId:k}),deleteLike:()=>y({activityId:k,reactionId:T})},comments:{openComments:()=>null}},isTruncated:!0})},k)}),!f&&d.jsx(Nr,{hasNextPage:c,loadNextPage:()=>u(),icon:{icon:"arrow-down",position:"right"},messages:{button:s.formatMessage({id:"loadMore_button"}),error:s.formatMessage({id:"loadMore_error"})}})]})},Gw={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 Qw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=We.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=ac({reply:Nw(o),user:i});return uc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=ac({reply:o,user:i});r.setQueryData(a,uc(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Zf(c.id)},0)}});return s}function Jw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ma(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Qf({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=We.useQueryClient(),l=Ya(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:Co(u),mutate:xo(u)},user:l,...u},f=Qw({...c,mutationFn:e}),m=Jw({...c,mutationFn:t}),p=Xw({...c,mutationFn:n}),g=tE({...c,mutationFn:a}),h=nE({...c,mutationFn:i}),{replies:y,...v}=eE({queryKey:s,queryFn:r});return{replies:y,mutations:{create:f,edit:m,remove:g,like:p,unlike:h},user:l,...v}}function Xw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Ma(s,o);return l&&ic({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ma(o,l);u&&ic({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function eE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=We.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=oE(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function tE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>sE(a,i)),onError:n});return r}function nE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ma(i,s);return o&&Rw({reply:o,user:r}),s}),onError:n});return a}function rE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function aE(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 iE(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 uc(e,t,n){return t?n!=null&&n.append?aE(e,t,n):iE(e,t,n):rE(e)}function Ma(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function 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 oE(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 uE=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=ue.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:c,isLoading:f,mutations:{create:m,edit:p,like:g,remove:h,unlike:y},user:v}=Qf({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:k=>i.list({...k,reactionId:r})}});Ss([f]);const[x,B]=C.useState(!0);return d.jsxs(d.Fragment,{children:[(l==null?void 0:l.length)>=o&&d.jsx(we,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${x?"up_left":"down_right"}`,position:"left"},onClick:()=>B(!x),children:s.formatMessage({id:`discussion_thread_${x?"hide":"show"}`},{count:l==null?void 0:l.length})}),x&&d.jsx(Hf,{loadMore:{isLoading:f,hasNextPage:c,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(k,{body:E})=>m({activityId:n,replyId:r,content:E})},meta:{isEditing:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(k=>{var ne,D,q,ee,_,S,z,$,U,re,te,Y;const{id:E,own_children:A,latest_children:j,children_counts:L}=k,T=(((ne=A==null?void 0:A.like)==null?void 0:ne.length)||0)>0?(D=A==null?void 0:A.like)==null?void 0:D.find(le=>{var X;return((X=le==null?void 0:le.user)==null?void 0:X.id)===(v==null?void 0:v.id)}):!1,O=T?T==null?void 0:T.id:"",w=!!T,R=(((q=j==null?void 0:j.like)==null?void 0:q.length)||0)>0?(ee=j==null?void 0:j.like)==null?void 0:ee.map(le=>{var X,ve,pe;return{id:(X=le==null?void 0:le.user)==null?void 0:X.id,name:(pe=(ve=le==null?void 0:le.user)==null?void 0:ve.data)==null?void 0:pe.name}}):!1,M=k==null?void 0:k.user,K=(M==null?void 0:M.id)===(v==null?void 0:v.id),V=Xa(a,K),oe=typeof k.data.content=="string"?(_=k==null?void 0:k.data)==null?void 0:_.content:((z=(S=k==null?void 0:k.data)==null?void 0:S.content)==null?void 0:z.text)||"";return d.jsx(Rr,{content:{id:E,type:"reply",body:oe,canLike:V,createdAt:k==null?void 0:k.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:k==null?void 0:k.parent},slug:"",author:{id:M==null?void 0:M.id,name:($=M.data)==null?void 0:$.name,organization:(U=M.data)==null?void 0:U.organization,jobTitle:(re=M.data)==null?void 0:re.jobTitle,location:(te=M.data)==null?void 0:te.location,image:{thumbnail:((Y=M.data)==null?void 0:Y.thumbnail)||void 0}},userLiked:w,likes:(L==null?void 0:L.like)||0,peopleWhoLiked:R},functions:{content:{createContent:()=>null,deleteContent:()=>h({replyId:E}),updateContent:(le,{body:X})=>p({replyId:E,content:X})},likes:{createLike:()=>g({replyId:E}),deleteLike:()=>y({replyId:E,reactionId:O})},comments:{}}},E)}):null})]})};const Jf=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,join:i,leave:s}})=>{const o=ue.useIntl(),{replies:l,repliesCount:u,fetchNextPage:c,hasNextPage:f,isLoading:m,mutations:{create:p,edit:g,like:h,remove:y,unlike:v},user:x}=Qf({queryKey:[e,t,n,"replies"],queryFns:a});return Ss([m]),Yf(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(Wf,{type:"comment",responses:u}),d.jsx(Do,{form:{content:{type:"reply",slugs:{}},functions:{create:(B,{body:k})=>p({activityId:n,content:k})},meta:{isEditing:!1,showSuccessMessage:!1},placeholder:o.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),l==null?void 0:l.map(B=>{var oe,ne,D,q,ee,_,S,z,$,U,re,te;const{id:k,own_children:E,latest_children:A,children_counts:j}=B,I=(((oe=E==null?void 0:E.like)==null?void 0:oe.length)||0)>0?(ne=E==null?void 0:E.like)==null?void 0:ne.find(Y=>{var le;return((le=Y==null?void 0:Y.user)==null?void 0:le.id)===(x==null?void 0:x.id)}):!1,T=I?I==null?void 0:I.id:"",O=!!I,F=(((D=A==null?void 0:A.like)==null?void 0:D.length)||0)>0?(q=A==null?void 0:A.like)==null?void 0:q.map(Y=>{var le,X,ve;return{id:(le=Y==null?void 0:Y.user)==null?void 0:le.id,name:(ve=(X=Y==null?void 0:Y.user)==null?void 0:X.data)==null?void 0:ve.name}}):!1,R=B==null?void 0:B.user,M=(R==null?void 0:R.id)===(x==null?void 0:x.id),K=Xa(r,M),V=typeof B.data.content=="string"?(ee=B==null?void 0:B.data)==null?void 0:ee.content:((S=(_=B==null?void 0:B.data)==null?void 0:_.content)==null?void 0:S.text)||"";return d.jsx(zf,{children:d.jsx(Rr,{content:{id:k,type:"reply",body:V,canLike:K,createdAt:B==null?void 0:B.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:k},slug:k,author:{id:R==null?void 0:R.id,name:(z=R.data)==null?void 0:z.name,organization:($=R.data)==null?void 0:$.organization,jobTitle:(U=R.data)==null?void 0:U.jobTitle,location:(re=R.data)==null?void 0:re.location,image:{thumbnail:((te=R.data)==null?void 0:te.thumbnail)||void 0}},userLiked:O,likes:(j==null?void 0:j.like)||0,peopleWhoLiked:F},functions:{content:{createContent:()=>null,deleteContent:()=>y({replyId:k}),updateContent:(Y,{body:le})=>g({replyId:k,content:le})},likes:{createLike:()=>h({replyId:k}),deleteLike:()=>v({replyId:k,reactionId:T})},comments:{}},children:d.jsx(uE,{basePath:e,parentId:t,activityId:n,replyId:k,isMember:r,functions:{...a}})},k)},k)}),!m&&d.jsx(Nr,{hasNextPage:f,loadNextPage:()=>c(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})};function lE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=We.useMutation({mutationFn:e,onMutate:({content:a})=>t(i=>(i&&(i.content=a),i)),onError:n});return r}function cE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=We.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function dE({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=We.useQueryClient(),s=Ya(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:Co(o),mutate:xo(o)},user:s,...o},u=lE({...l,mutationFn:t}),c=fE({...l,mutationFn:n}),f=hE({...l,mutationFn:r}),{activity:m,...p}=cE({queryKey:a,queryFn:e});return{activity:m,mutations:{edit:u,like:c,unlike:f},user:s,...p}}function fE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=We.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Na({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Na({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function hE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=We.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Kf({activity:s,user:r}),s)),onError:n});return a}const mE=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,join:o,leave:l}})=>{var I,T,O,w,F,R,M,K,V,oe;const u=ue.useIntl(),c=C.useContext(Nt),{activity:f,error:m,isLoading:p,mutations:{edit:g,like:h,unlike:y}}=dE({queryFns:i,queryKey:[e,t,n]});if(p)return d.jsx(wt,{style:{height:"400px"}});if(m||!f)return d.jsx(rn,{variant:"error",text:u.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:v,latest_reactions:x}=f,B=(((I=x==null?void 0:x.like)==null?void 0:I.length)||0)>0,k=(((T=v==null?void 0:v.like)==null?void 0:T.length)||0)>0,E=k?v==null?void 0:v.like[0].id:"",A=B?(O=x==null?void 0:x.like)==null?void 0:O.map(ne=>{var D,q,ee;return{id:(D=ne==null?void 0:ne.user)==null?void 0:D.id,name:(ee=(q=ne==null?void 0:ne.user)==null?void 0:q.data)==null?void 0:ee.name}}):!1,j=f==null?void 0:f.actor,L=(j==null?void 0:j.id)===(c==null?void 0:c.id);return d.jsxs("section",{className:"activity-section",children:[d.jsx(Rr,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:f==null?void 0:f.content,canLike:Xa(r,L),createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:{id:j.id,name:(w=j.data)==null?void 0:w.name,organization:(F=j.data)==null?void 0:F.organization,jobTitle:(R=j.data)==null?void 0:R.jobTitle,location:(M=j.data)==null?void 0:M.location,image:{thumbnail:((K=j.data)==null?void 0:K.thumbnail)||void 0}},userLiked:k,likes:((V=f==null?void 0:f.reaction_counts)==null?void 0:V.like)||0,comments:((oe=f==null?void 0:f.reaction_counts)==null?void 0:oe.reply)||0,peopleWhoLiked:A},originalAuthorId:j==null?void 0:j.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(ne,{body:D})=>g({content:D})},likes:{createLike:()=>h({activityId:n}),deleteLike:()=>y({activityId:n,reactionId:E})},comments:{openComments:()=>{}}}},n),d.jsx(Jf,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,join:o,leave:l}})]})},pE=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),lc=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ia="notFoundError_",gE=()=>{const e=ue.useIntl(),t=[];return lc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ia}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(If,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(un,{children:[d.jsx(Of,{cards:lc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(we,{href:"/solution-articles/",children:e.formatMessage({id:`${ia}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ia}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ia}text`})})]})};exports.ASSETS_BUCKET=Ht;exports.ActivitiesFeed=Yw;exports.ActivitySection=mE;exports.AddPost=Do;exports.Banner=$x;exports.BannerSection=Vx;exports.Breadcrumbs=iw;exports.Buckets=Ph;exports.Button=we;exports.ButtonWrapper=wn;exports.COURSE_CONTENT_TYPES=dr;exports.CacheProvider=kf;exports.Card=po;exports.CardBlock=Of;exports.Carousel=rw;exports.CharacterLimit=Ms;exports.CollapsibleSection=La;exports.Columns=Rf;exports.CommunityDetails=aw;exports.ContactFooter=gw;exports.ContactForm=df;exports.ContentTypeLabel=Fc;exports.Contributors=Rs;exports.ConversationContext=Ja;exports.CookieBanner=Mf;exports.CourseProgression=ww;exports.CourseStructure=Ew;exports.CustomContentBanner=Kx;exports.Directory=Nx;exports.DiscussionConversation=zf;exports.DiscussionForm=Qa;exports.DiscussionLikes=qf;exports.DiscussionPost=Rr;exports.DiscussionThread=Hf;exports.Divider=en;exports.DownloadSection=Lx;exports.EMAILS=On;exports.EditSection=qx;exports.EmailHelperTextBox=Mc;exports.EmptyStateBox=rn;exports.Filters=sw;exports.FlagsProvider=_f;exports.Footer=bo;exports.Form=er;exports.FullWidthSection=un;exports.GlobalProviders=Ox;exports.Header=yo;exports.HelperTextBox=Sc;exports.HiddenFromScreenReaders=Ia;exports.HideShowTextBox=jc;exports.HighlightSection=Yx;exports.HighlightedTextBox=Ot;exports.INVALID_TOKEN=wc;exports.IconBulletedList=Mh;exports.ImageContainer=Sh;exports.IntlProvider=Bf;exports.InviteForm=ff;exports.InviteModal=Px;exports.JoinButton=go;exports.LanguageContext=fo;exports.LanguageSwitcher=uw;exports.LessonName=$f;exports.LessonType=Lf;exports.Link=En;exports.LoadMore=Nr;exports.LoadingBlock=Zh;exports.LoadingPlaceholder=wt;exports.LoadingState=Ps;exports.Logo=vo;exports.LogoSection=Wx;exports.MarkCompleteButton=kw;exports.MarkdownText=Hn;exports.MarketingBlock=Gx;exports.Member=jr;exports.MembersList=xw;exports.Modal=mo;exports.MoreMenu=Pf;exports.NUMBER_OF_COUNTRIES=bh;exports.NUMBER_OF_USERS=vh;exports.NavigationMenu=Nf;exports.NotFoundError=gE;exports.Overlay=Pr;exports.OverlayContext=ho;exports.OverlayProvider=Tf;exports.PageHeading=Oc;exports.PageLayout=If;exports.PasswordForm=BC;exports.PasswordRules=qc;exports.Pill=fn;exports.Portal=Ac;exports.ProfileImageChange=_C;exports.ProfilePicture=an;exports.ProgressBar=Os;exports.ProgressTracker=jh;exports.Rating=om;exports.RepliesFeed=Jf;exports.ResponsesHeading=Wf;exports.ResponsiveImage=Xn;exports.ReturnToNavButton=Oh;exports.RichTextEditor=cf;exports.SearchForm=hf;exports.ShareLinks=hw;exports.SignupForm=OC;exports.Span=rs;exports.StatusBanner=xr;exports.TableOfContents=Ix;exports.Tabs=mw;exports.Tags=Cw;exports.TestimonialBlock=Mx;exports.TimeToComplete=Ga;exports.Toggle=kC;exports.Tooltip=Qn;exports.TopLevelPage=vw;exports.UserContext=Nt;exports.UserProvider=Af;exports.VisuallyHidden=$e;exports.addAriaProps=Sf;exports.basicReducer=Sr;exports.camelCaseToDashCase=Dc;exports.checkIntlPathExists=$a;exports.generateConditions=ma;exports.generateCssIcon=Ec;exports.getCharacterLimitProps=Rc;exports.getLongDate=js;exports.getMember=Ns;exports.getShortDate=kc;exports.getValueLength=za;exports.headerData=Tr;exports.mapGetStreamData=pE;exports.pageReady=_c;exports.passwordValidator=ts;exports.repliesFeedMock=Gw;exports.supportedLanguages=ga;exports.toCamelCase=Cc;exports.toSentenceCase=xc;exports.useCurrentPath=pc;exports.useEffectAfterMount=Wn;exports.useElementWidth=Gn;exports.useOverlay=Ff;exports.useScrollListener=vc;exports.useScrollToHash=Ss;exports.useUser=Ya;
|