@apolitical/component-library 4.1.1 → 4.1.3-beta.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/form/components/rich-text-editor/components/toolbar/components/link-editor/link-editor.helpers.d.ts +1 -0
- package/form/components/rich-text-editor/plugins/index.d.ts +1 -0
- package/form/components/rich-text-editor/plugins/without-empty-links/index.d.ts +1 -0
- package/form/components/rich-text-editor/plugins/without-empty-links/without-empty-links.d.ts +5 -0
- package/helpers/index.d.ts +1 -0
- package/helpers/urls.d.ts +4 -0
- package/index.js +40 -40
- package/index.mjs +5106 -4860
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),cn=require("lodash.clonedeep"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),cn=require("lodash.clonedeep"),Xf=require("lodash.set"),rc=require("react-dom"),oe=require("react-intl"),Lt=require("markdown-to-jsx"),$n=require("truncate"),qe=require("@tanstack/react-query"),eh=require("@tanstack/react-query-devtools"),na=require("posthog-js"),ks=require("react-cookie"),ac=require("lodash.isequal"),th=require("react-multi-email"),ic=require("lodash.get"),nh=require("react-error-boundary");var Nr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function sc(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 oc={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})()})(oc);var rh=oc.exports;const V=bn(rh),ah=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>C.createElement(e,{...a,className:V("hidden",r,{"show-on-focus":t}),children:n}),Ie=C.memo(ah),ih=({element:e="span",children:t=null,...n})=>C.createElement(e,{...n,"aria-hidden":!0},t),Pa=C.memo(ih);var Yi={exports:{}},er={};/**
|
|
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 Eo;function sh(){if(Eo)return er;Eo=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 er.Fragment=n,er.jsx=s,er.jsxs=s,er}var tr={};/**
|
|
14
14
|
* @license React
|
|
15
15
|
* react-jsx-runtime.development.js
|
|
16
16
|
*
|
|
@@ -18,36 +18,36 @@
|
|
|
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+O}}var ee=!1,Z;{var ue=typeof WeakMap=="function"?WeakMap:Map;Z=new ue}function
|
|
21
|
+
*/var _o;function oh(){return _o||(_o=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 D(O){if(O===null||typeof O!="object")return null;var re=g&&O[g]||O[h];return typeof re=="function"?re:null}var b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(O){{for(var re=arguments.length,le=new Array(re>1?re-1:0),be=1;be<re;be++)le[be-1]=arguments[be];A("error",O,le)}}function A(O,re,le){{var be=b.ReactDebugCurrentFrame,ke=be.getStackAddendum();ke!==""&&(re+="%s",le=le.concat([ke]));var Oe=le.map(function(Ee){return String(Ee)});Oe.unshift("Warning: "+re),Function.prototype.apply.call(console[O],console,Oe)}}var _=!1,E=!1,k=!1,F=!1,z=!1,$;$=Symbol.for("react.module.reference");function j(O){return!!(typeof O=="string"||typeof O=="function"||O===r||O===i||z||O===a||O===u||O===c||F||O===p||_||E||k||typeof O=="object"&&O!==null&&(O.$$typeof===m||O.$$typeof===f||O.$$typeof===s||O.$$typeof===o||O.$$typeof===l||O.$$typeof===$||O.getModuleId!==void 0))}function N(O,re,le){var be=O.displayName;if(be)return be;var ke=re.displayName||re.name||"";return ke!==""?le+"("+ke+")":le}function w(O){return O.displayName||"Context"}function T(O){if(O==null)return null;if(typeof O.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof O=="function")return O.displayName||O.name||null;if(typeof O=="string")return O;switch(O){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof O=="object")switch(O.$$typeof){case o:var re=O;return w(re)+".Consumer";case s:var le=O;return w(le._context)+".Provider";case l:return N(O,O.render,"ForwardRef");case f:var be=O.displayName||null;return be!==null?be:T(O.type)||"Memo";case m:{var ke=O,Oe=ke._payload,Ee=ke._init;try{return T(Ee(Oe))}catch{return null}}}return null}var R=Object.assign,M=0,Y,K,se,ne,y,q,X;function B(){}B.__reactDisabledLog=!0;function S(){{if(M===0){Y=console.log,K=console.info,se=console.warn,ne=console.error,y=console.group,q=console.groupCollapsed,X=console.groupEnd;var O={configurable:!0,enumerable:!0,value:B,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}M++}}function L(){{if(M--,M===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},O,{value:Y}),info:R({},O,{value:K}),warn:R({},O,{value:se}),error:R({},O,{value:ne}),group:R({},O,{value:y}),groupCollapsed:R({},O,{value:q}),groupEnd:R({},O,{value:X})})}M<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var I=b.ReactCurrentDispatcher,U;function te(O,re,le){{if(U===void 0)try{throw Error()}catch(ke){var be=ke.stack.trim().match(/\n( *(at )?)/);U=be&&be[1]||""}return`
|
|
22
|
+
`+U+O}}var ee=!1,Z;{var ue=typeof WeakMap=="function"?WeakMap:Map;Z=new ue}function J(O,re){if(!O||ee)return"";{var le=Z.get(O);if(le!==void 0)return le}var be;ee=!0;var ke=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Oe;Oe=I.current,I.current=null,S();try{if(re){var Ee=function(){throw Error()};if(Object.defineProperty(Ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ee,[])}catch(Nt){be=Nt}Reflect.construct(O,[],Ee)}else{try{Ee.call()}catch(Nt){be=Nt}O.call(Ee.prototype)}}else{try{throw Error()}catch(Nt){be=Nt}O()}}catch(Nt){if(Nt&&be&&typeof Nt.stack=="string"){for(var we=Nt.stack.split(`
|
|
23
23
|
`),nt=be.stack.split(`
|
|
24
24
|
`),ze=we.length-1,He=nt.length-1;ze>=1&&He>=0&&we[ze]!==nt[He];)He--;for(;ze>=1&&He>=0;ze--,He--)if(we[ze]!==nt[He]){if(ze!==1||He!==1)do if(ze--,He--,He<0||we[ze]!==nt[He]){var gt=`
|
|
25
|
-
`+we[ze].replace(" at new "," at ");return O.displayName&>.includes("<anonymous>")&&(gt=gt.replace("<anonymous>",O.displayName)),typeof O=="function"&&Z.set(O,gt),gt}while(ze>=1&&He>=0);break}}}finally{ee=!1,I.current=Oe,L(),Error.prepareStackTrace=
|
|
25
|
+
`+we[ze].replace(" at new "," at ");return O.displayName&>.includes("<anonymous>")&&(gt=gt.replace("<anonymous>",O.displayName)),typeof O=="function"&&Z.set(O,gt),gt}while(ze>=1&&He>=0);break}}}finally{ee=!1,I.current=Oe,L(),Error.prepareStackTrace=ke}var wn=O?O.displayName||O.name:"",wo=wn?te(wn):"";return typeof O=="function"&&Z.set(O,wo),wo}function ge(O,re,le){return J(O,!1)}function me(O){var re=O.prototype;return!!(re&&re.isReactComponent)}function _e(O,re,le){if(O==null)return"";if(typeof O=="function")return J(O,me(O));if(typeof O=="string")return te(O);switch(O){case u:return te("Suspense");case c:return te("SuspenseList")}if(typeof O=="object")switch(O.$$typeof){case l:return ge(O.render);case f:return _e(O.type,re,le);case m:{var be=O,ke=be._payload,Oe=be._init;try{return _e(Oe(ke),re,le)}catch{}}}return""}var Se=Object.prototype.hasOwnProperty,Pe={},Ge=b.ReactDebugCurrentFrame;function Ke(O){if(O){var re=O._owner,le=_e(O.type,O._source,re?re.type:null);Ge.setExtraStackFrame(le)}else Ge.setExtraStackFrame(null)}function Ze(O,re,le,be,ke){{var Oe=Function.call.bind(Se);for(var Ee in O)if(Oe(O,Ee)){var we=void 0;try{if(typeof O[Ee]!="function"){var nt=Error((be||"React class")+": "+le+" type `"+Ee+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[Ee]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw nt.name="Invariant Violation",nt}we=O[Ee](re,Ee,be,le,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ze){we=ze}we&&!(we instanceof Error)&&(Ke(ke),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).",be||"React class",le,Ee,typeof we),Ke(null)),we instanceof Error&&!(we.message in Pe)&&(Pe[we.message]=!0,Ke(ke),x("Failed %s type: %s",le,we.message),Ke(null))}}}var tt=Array.isArray;function Ae(O){return tt(O)}function We(O){{var re=typeof Symbol=="function"&&Symbol.toStringTag,le=re&&O[Symbol.toStringTag]||O.constructor.name||"Object";return le}}function Le(O){try{return H(O),!1}catch{return!0}}function H(O){return""+O}function ae(O){if(Le(O))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",We(O)),H(O)}var fe=b.ReactCurrentOwner,pe={key:!0,ref:!0,__self:!0,__source:!0},De,Ue,Ve;Ve={};function ft(O){if(Se.call(O,"ref")){var re=Object.getOwnPropertyDescriptor(O,"ref").get;if(re&&re.isReactWarning)return!1}return O.ref!==void 0}function Pt(O){if(Se.call(O,"key")){var re=Object.getOwnPropertyDescriptor(O,"key").get;if(re&&re.isReactWarning)return!1}return O.key!==void 0}function xt(O,re){if(typeof O.ref=="string"&&fe.current&&re&&fe.current.stateNode!==re){var le=T(fe.current.type);Ve[le]||(x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',T(fe.current.type),O.ref),Ve[le]=!0)}}function Qe(O,re){{var le=function(){De||(De=!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)",re))};le.isReactWarning=!0,Object.defineProperty(O,"key",{get:le,configurable:!0})}}function _t(O,re){{var le=function(){Ue||(Ue=!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)",re))};le.isReactWarning=!0,Object.defineProperty(O,"ref",{get:le,configurable:!0})}}var ht=function(O,re,le,be,ke,Oe,Ee){var we={$$typeof:t,type:O,key:re,ref:le,props:Ee,_owner:Oe};return we._store={},Object.defineProperty(we._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(we,"_self",{configurable:!1,enumerable:!1,writable:!1,value:be}),Object.defineProperty(we,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ke}),Object.freeze&&(Object.freeze(we.props),Object.freeze(we)),we};function Ga(O,re,le,be,ke){{var Oe,Ee={},we=null,nt=null;le!==void 0&&(ae(le),we=""+le),Pt(re)&&(ae(re.key),we=""+re.key),ft(re)&&(nt=re.ref,xt(re,ke));for(Oe in re)Se.call(re,Oe)&&!pe.hasOwnProperty(Oe)&&(Ee[Oe]=re[Oe]);if(O&&O.defaultProps){var ze=O.defaultProps;for(Oe in ze)Ee[Oe]===void 0&&(Ee[Oe]=ze[Oe])}if(we||nt){var He=typeof O=="function"?O.displayName||O.name||"Unknown":O;we&&Qe(Ee,He),nt&&_t(Ee,He)}return ht(O,we,nt,ke,be,fe.current,Ee)}}var Xn=b.ReactCurrentOwner,Pr=b.ReactDebugCurrentFrame;function xn(O){if(O){var re=O._owner,le=_e(O.type,O._source,re?re.type:null);Pr.setExtraStackFrame(le)}else Pr.setExtraStackFrame(null)}var Qa;Qa=!1;function Ja(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function bo(){{if(Xn.current){var O=T(Xn.current.type);if(O)return`
|
|
26
26
|
|
|
27
|
-
Check the render method of \``+O+"`."}return""}}function
|
|
27
|
+
Check the render method of \``+O+"`."}return""}}function Uf(O){{if(O!==void 0){var re=O.fileName.replace(/^.*[\\\/]/,""),le=O.lineNumber;return`
|
|
28
28
|
|
|
29
|
-
Check your code at `+re+":"+le+"."}return""}}var
|
|
29
|
+
Check your code at `+re+":"+le+"."}return""}}var yo={};function Vf(O){{var re=bo();if(!re){var le=typeof O=="string"?O:O.displayName||O.name;le&&(re=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+le+">.")}return re}}function go(O,re){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var le=If(re);if(po[le])return;po[le]=!0;var be="";O&&O._owner&&O._owner!==Gn.current&&(be=" It was passed a child from "+F(O._owner.type)+"."),Dn(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),Dn(null)}}function vo(O,re){{if(typeof O!="object")return;if(Ae(O))for(var le=0;le<O.length;le++){var be=O[le];Ga(be)&&go(be,re)}else if(Ga(O))O._store&&(O._store.validated=!0);else if(O){var Be=D(O);if(typeof Be=="function"&&Be!==O.entries)for(var Oe=Be.call(O),Ee;!(Ee=Oe.next()).done;)Ga(Ee.value)&&go(Ee.value,re)}}}function $f(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&&!Ya){Ya=!0;var Be=F(re);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Be||"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 Lf(O){{for(var re=Object.keys(O.props),le=0;le<re.length;le++){var be=re[le];if(be!=="children"&&be!=="key"){Dn(O),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",be),Dn(null);break}}O.ref!==null&&(Dn(O),x("Invalid attribute `ref` supplied to `React.Fragment`."),Dn(null))}}function bo(O,re,le,be,Be,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=Mf(Be);nt?we+=nt:we+=mo();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=Za(O,re,le,Be,Oe);if(He==null)return He;if(Ee){var gt=re.children;if(gt!==void 0)if(be)if(Ae(gt)){for(var Cn=0;Cn<gt.length;Cn++)vo(gt[Cn],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 vo(gt,O)}return O===r?Lf(He):$f(He),He}}function zf(O,re,le){return bo(O,re,le,!0)}function qf(O,re,le){return bo(O,re,le,!1)}var Wf=qf,Hf=zf;Jn.Fragment=r,Jn.jsx=Wf,Jn.jsxs=Hf}()),Jn}process.env.NODE_ENV==="production"?Vi.exports=Jf():Vi.exports=Xf();var d=Vi.exports;const rc=()=>{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},In=(e,t)=>{const n=C.useRef(!1);C.useEffect(()=>{n.current?e():n.current=!0},t)};function eh(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,D="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,x=D?Math.max(+n.maxWait||0,t):null;C.useEffect(function(){return f.current=!0,function(){f.current=!1}},[]);var k=C.useMemo(function(){var E=function(j){var N=o.current,w=l.current;return o.current=l.current=null,i.current=j,u.current=c.current.apply(w,N)},_=function(j,N){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(j):setTimeout(j,N)},A=function(j){if(!f.current)return!1;var N=j-a.current;return!a.current||N>=t||N<0||D&&j-i.current>=x},S=function(j){return s.current=null,h&&o.current?E(j):(o.current=l.current=null,u.current)},q=function j(){var N=Date.now();if(A(N))return S(N);if(f.current){var w=t-(N-a.current),F=D?Math.min(w,x-(N-i.current)):w;_(j,F)}},$=function(){if(m||v){var j=Date.now(),N=A(j);if(o.current=[].slice.call(arguments),l.current=r,a.current=j,N){if(!s.current&&f.current)return i.current=a.current,_(q,t),g?E(a.current):u.current;if(D)return _(q,t),E(a.current)}return s.current||_(q,t),u.current}};return $.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},$.isPending=function(){return!!s.current},$.flush=function(){return s.current?S(Date.now()):u.current},$},[g,D,t,x,h,p,m,v]);return k}function ac(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return eh(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let Qa;const Un=(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(Qa),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=ac(()=>{s()!==r&&(t&&(clearTimeout(Qa),document.body.classList.add("is-resizing"),Qa=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},ic=({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=ac(()=>{l()},250);return a},Es=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=C.useRef(!1);In(()=>{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)},Er=(e,t)=>{Array.isArray(t)||(t=[t]);const n=cn(e);return t.forEach(({type:r,value:a})=>{Uf(n,r,a)}),n},sc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},oc=(e,t,n)=>{let r=n.mobile;for(const a in t){const i=parseInt(String(t[a]));if(e>=i)r=n[i];else if(e<i)break}return r},uc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),lc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),cc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),zt="https://storage.googleapis.com/apolitical-assets/",kn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},ir={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},dc="Invalid token error: Logging user out...",th="200,000+",nh="160+";function fc(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}},hc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),_s=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),Ki=e=>{let t;const n=ca(),r=ca(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)}},ca=e=>{const n=(e||new Date).toUTCString();return new Date(n)},rh=(e,t,n)=>{let r;const a=ca(),i=ca(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},ah=e=>new Promise(t=>setTimeout(t,e)),Vn={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 <`+le+">.")}return re}}function Do(O,re){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var le=Vf(re);if(yo[le])return;yo[le]=!0;var be="";O&&O._owner&&O._owner!==Xn.current&&(be=" It was passed a child from "+T(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];Ja(be)&&Do(be,re)}else if(Ja(O))O._store&&(O._store.validated=!0);else if(O){var ke=D(O);if(typeof ke=="function"&&ke!==O.entries)for(var Oe=ke.call(O),Ee;!(Ee=Oe.next()).done;)Ja(Ee.value)&&Do(Ee.value,re)}}}function Kf(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=T(re);Ze(le,O.props,"prop",be,O)}else if(re.PropTypes!==void 0&&!Qa){Qa=!0;var ke=T(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 Zf(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=Uf(ke);nt?we+=nt:we+=bo();var ze;O===null?ze="null":Ae(O)?ze="array":O!==void 0&&O.$$typeof===t?(ze="<"+(T(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=Ga(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?Zf(He):Kf(He),He}}function Yf(O,re,le){return xo(O,re,le,!0)}function Gf(O,re,le){return xo(O,re,le,!1)}var Qf=Gf,Jf=Yf;tr.Fragment=r,tr.jsx=Qf,tr.jsxs=Jf}()),tr}process.env.NODE_ENV==="production"?Yi.exports=sh():Yi.exports=oh();var d=Yi.exports;const uc=()=>{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 uh(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,D="maxWait"in n,b="debounceOnServer"in n&&!!n.debounceOnServer,x=D?Math.max(+n.maxWait||0,t):null;C.useEffect(function(){return f.current=!0,function(){f.current=!1}},[]);var A=C.useMemo(function(){var _=function(j){var N=o.current,w=l.current;return o.current=l.current=null,i.current=j,u.current=c.current.apply(w,N)},E=function(j,N){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(j):setTimeout(j,N)},k=function(j){if(!f.current)return!1;var N=j-a.current;return!a.current||N>=t||N<0||D&&j-i.current>=x},F=function(j){return s.current=null,h&&o.current?_(j):(o.current=l.current=null,u.current)},z=function j(){var N=Date.now();if(k(N))return F(N);if(f.current){var w=t-(N-a.current),T=D?Math.min(w,x-(N-i.current)):w;E(j,T)}},$=function(){if(m||b){var j=Date.now(),N=k(j);if(o.current=[].slice.call(arguments),l.current=r,a.current=j,N){if(!s.current&&f.current)return i.current=a.current,E(z,t),g?_(a.current):u.current;if(D)return E(z,t),_(a.current)}return s.current||E(z,t),u.current}};return $.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},$.isPending=function(){return!!s.current},$.flush=function(){return s.current?F(Date.now()):u.current},$},[g,D,t,x,h,p,m,b]);return A}function lc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return uh(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let Xa;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(Xa),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=lc(()=>{s()!==r&&(t&&(clearTimeout(Xa),document.body.classList.add("is-resizing"),Xa=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},cc=({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=lc(()=>{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)},Ar=(e,t)=>{Array.isArray(t)||(t=[t]);const n=cn(e);return t.forEach(({type:r,value:a})=>{Xf(n,r,a)}),n},dc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},fc=(e,t,n)=>{let r=n.mobile;for(const a in t){const i=parseInt(String(t[a]));if(e>=i)r=n[i];else if(e<i)break}return r},hc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),mc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),pc=(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"}},ur={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},gc="Invalid token error: Logging user out...",lh="200,000+",ch="160+";function vc(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}},bc=(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=ha(),r=ha(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)}},ha=e=>{const n=(e||new Date).toUTCString();return new Date(n)},dh=(e,t,n)=>{let r;const a=ha(),i=ha(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},fh=e=>new Promise(t=>setTimeout(t,e)),hh=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},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}.
|
|
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"},ih={...Vn,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>"},sh={...Vn,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"},oh={...Vn,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>"},uh=Object.freeze(Object.defineProperty({__proto__:null,en:Vn,es:ih,fr:sh,pt:oh},Symbol.toStringTag,{value:"Module"})),ja=(e,t=Vn)=>e in t,kt=(e,t,n,r,a={})=>{let i="";return ja(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},lh=(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},ea=(e,t)=>C.Children.map(e,n=>Object.is(n,null)?n:C.cloneElement(n,{...t})),mc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},ch=(e="")=>e.replace(/\s+/g,"").length>0,Zi=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=Un(typeof t=="object");if(typeof t=="object"&&typeof p=="number"){const D=Object.assign({},t),v=sc(Object.keys(D));t=oc(p,v,D)}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:D=>{(!a||a[0]==="#")&&s&&(D.preventDefault(),D.stopPropagation()),s&&s(D)},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($e,{showOnFocus:!1,children:u}):null))},Kn=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?d.jsx(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})},xo={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"}},dh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?xo[e]:xo.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},fh=({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},Ja=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${fh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const Zn=({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}=dh(e),g=Ja({format:"avif",query:s,range:m,url:o}),h=Ja({format:"webp",query:s,range:m,url:o}),D=Ja({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:D,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})]})};const hh=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(Zn,{image:{...e},className:"image"})}),yn=({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})},mh=({children:e})=>typeof document=="object"?Jl.createPortal(e,document.body):null;const ph=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx($e,{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 gh=({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 vh=({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))}),wo=300,Eo="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:wo,easing:Eo}),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:wo,easing:Eo}),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 Oa=({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})]})},_o={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},yh=e=>{let t=e;return Object.keys(_o).includes(e)&&(t=_o[e]),`url(${zt}icons/${t}.svg)`};const Bo={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},pc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=oe.useIntl(),i=t?{"--custom-icon":yh(t)}:{},s=ja(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:V("content-type-label text-small",e in Bo?Bo[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=Un(i);if(i&&typeof n=="object"&&typeof s=="number"){const f=Object.assign({},n.breakpoints),m=sc(Object.keys(f));a=oc(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 Yi=({children:e,...t})=>d.jsx("p",{...t,children:e}),gc={q:Yi,blockquote:Yi};for(let e=1;e<=6;e++)gc[`h${e}`]={component:Yi,props:{className:"title"}};const vc=({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:gc},children:r}):d.jsx("p",{children:r})]});const bc=({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_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"},mh={...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>"},ph={...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"},gh={...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>"},vh=Object.freeze(Object.defineProperty({__proto__:null,en:Zn,es:mh,fr:ph,pt:gh},Symbol.toStringTag,{value:"Module"})),Na=(e,t=Zn)=>e in t,Bt=(e,t,n,r,a={})=>{let i="";return Na(`${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},ra=(e,t)=>C.Children.map(e,n=>Object.is(n,null)?n:C.cloneElement(n,{...t})),yc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Dc=e=>{let t=e,n=t;return t.includes("//")?n=t.split("//")[1]:t=`https://${t}`,n.includes("/")&&(n=n.split("/")[0]),{full:t,pretty:n}},yh=(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 D=Object.assign({},t),b=dc(Object.keys(D));t=fc(p,b,D)}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:D=>{(!a||a[0]==="#")&&s&&(D.preventDefault(),D.stopPropagation()),s&&s(D)},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"}},Dh=({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}},Ch=({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},ei=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Ch({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}=Dh(e),g=ei({format:"avif",query:s,range:m,url:o}),h=ei({format:"webp",query:s,range:m,url:o}),D=ei({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:D,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})]})};const xh=({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})},Cc=({children:e})=>typeof document=="object"?rc.createPortal(e,document.body):null;const wh=({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 Eh=({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 _h=({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 kh{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 Ra=({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 kh(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"},Bh=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"},xc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=oe.useIntl(),i=t?{"--custom-icon":Bh(t)}:{},s=Na(`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=dc(Object.keys(f));a=fc(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}),wc={q:Ji,blockquote:Ji};for(let e=1;e<=6;e++)wc[`h${e}`]={component:Ji,props:{className:"title"}};const Ec=({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:wc},children:r}):d.jsx("p",{children:r})]});const _c=({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(`
|
|
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(D=>D==="opening"?"open":D==="closing"?"closed":D)};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 Dh=({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,Ch=({children:e})=>d.jsx(St,{variant:"secondary",children:e}),xh=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),wh=["span","strong","h1","h2","h3","h4","h5","h6","p"],Eh=({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(wh.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(Oa,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},_h=({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})},Bh=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($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}`})]})},ko=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},kh=({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"||ko(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&&ko(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})},Gi=({children:e,...t})=>d.jsx("span",{className:V({url:t==null?void 0:t.href}),children:e});const Ah={default:{a:kh,CollapsibleSection:Oa,TextBox:St,CaseStudy:Ch,style:Xe,details:Eh,div:_h,iframe:Bh,center:xh},"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}},$n=({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,overrides:Ah[r]};return d.jsx("div",{className:V("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Lt,{options:{...s,...t},children:n})})};const yc=({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 Pn=({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 pr=({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 Fh=({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":$e,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},Bs=C.memo(Fh);const Xa="loadingBlock_",Th=({progress:e=0,steps:t=!1,className:n=""})=>{const r=oe.useIntl();t||(t={0:{text:r.formatMessage({id:`${Xa}loading`})},75:{text:r.formatMessage({id:`${Xa}almostDone`})},100:{text:r.formatMessage({id:`${Xa}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(Bs,{progress:e})]})},Sh=C.memo(Th);const Ct=({element:e="div",className:t="",...n})=>d.jsx(Sa,{element:e,className:V("loading-placeholder",t),...n});const Qi={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"]},Dc=(e,t)=>e in Qi?d.jsx("div",{className:e,children:Qi[e].map((n,r)=>Dc(n,r))},t):d.jsx(Ct,{className:e},t),ks=({layout:e="overview-page",...t})=>d.jsx("div",{className:V("loading-state",e),...t,children:Qi[e].map((n,r)=>Dc(n,r))}),Cc=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):""},Or=["#5AB6A3","#A2D7AF","#806056","#3962B3"],jh=e=>{const t=Math.ceil(26/Or.length),n=Cc(e).toLowerCase();if(n==="")return Or[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Or.length;a++)if(r<=t*(a+1))return Or[a]};const Ao=256,tn=({className:e="",src:t="",name:n,alt:r,width:a=Ao,height:i=Ao,...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=jh(n),m.fillRect(0,0,p,g),m.font=`${p/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Cc(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})})},As=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},Oh=({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=Mn(l,r)),l};const _r=({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=As(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=Oh(u),g=n&&n.createdAt?Ki(n.createdAt):!1,h=n&&n.createdAt?_s(n.createdAt):"";return C.createElement(e,{className:V("member text-medium",l,s),children:d.jsxs(yn,{href:m,gtmType:i,gtmContext:a,onClick:D=>{D==null||D.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 Fo={small:24,medium:48},Fs=({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:D="",image:v=""}=As(m);if(s)return d.jsx(Ct,{element:"li",className:"contributor"},p);g=d.jsx(tn,{name:D,src:v,width:Fo[a||"medium"],height:Fo[a||"medium"]})}else if(p===o){const D=(t||n.length)-o;g=d.jsxs("small",{className:V({"large-number":D>99}),children:["+",lh(D,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]}`}):Mn(n[0].name||"",20):l||null})]})})};const Pr="emailHelperTextBox_",xc=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=oe.useIntl(),[i,s]=C.useState({path:`${Pr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=C.useState(!1),u=C.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=h=>{s({path:`${Pr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:D=>u(D),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:h})};if(typeof r!="function"){g(a.formatMessage({id:`${Pr}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=Pr,g="default",h={},D={};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",D={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",g="error",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"},D={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",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:D})},[e]);const c={};return["link","mail"].forEach(p=>{c[p]=Object.keys(i[p]).length?g=>d.jsx("a",{...i[p],children:g}):g=>g}),d.jsx(vc,{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})})},An=({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 xn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Ph=500,Nh=({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:D}=oe.useIntl();r||(r=D({id:"inputAutocomplete_placeholder"})),C.useEffect(()=>{const E=setTimeout(()=>{g||f(_=>({..._,debouncedInput:l}))},Ph);return()=>{clearTimeout(E)}},[l,g]),C.useEffect(()=>{c&&!g?(async()=>{try{const _=await o(c)||[];h(A=>({...A,predictions:_}))}catch(_){console.error("Error fetching predictions:",_),h(A=>({...A,predictions:[]}))}})():h(E=>({...E,predictions:[]}))},[c,g]),C.useEffect(()=>{p>=0&&m[p]&&f(E=>({...E,displayInput:m[p].description}))},[p,m]);const v=E=>{[xn.DOWN,xn.UP,xn.ENTER].includes(E.key)&&(E.preventDefault(),E.key===xn.DOWN&&p<m.length-1?h(_=>({..._,activePredictionIndex:p+1})):E.key===xn.UP&&p>0?h(_=>({..._,activePredictionIndex:p-1})):E.key===xn.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}))},k=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:v,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:m.map((E,_)=>d.jsx("li",{onClick:()=>k(E),onMouseEnter:()=>h(A=>({...A,activePredictionIndex:_})),className:V("predictions-list-item",{active:_===p}),children:E.description},_))})]})};const wc=({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)},D=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),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:V("checkbox-wrapper",e),...f,...g},D)};const Rh=C.memo(function({direction:t="down"}){return d.jsx(Sa,{className:V("rotating-chevron",`direction-${t}`)})});const Mh=({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,D]=C.useState(g);let v;Array.isArray(h)&&h.length===1&&typeof h[0]=="string"?v=t&&h?t.find(S=>S.id===h[0]):t?t[0]:{id:"",label:""}:Array.isArray(h)&&h.length===1&&typeof h[0]!="string"?v=h[0]:v={id:"",label:""},C.useEffect(()=>{D(g)},[r,n]);const{onChange:x,onMultiSelectSubmit:k,...E}=a,_=S=>{if(o){let q=[];h!=null&&h.includes(S.id)?q=h.filter($=>$!==S.id):q=[...h,S.id],D([...q]),x&&x([...q])}else D([S]),x&&x(S.id),m(!1)},A=S=>{if(S==="all"){const q=(t==null?void 0:t.map($=>$.id))||[];D(q),x&&x(q)}else D([]),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:S=>{S.preventDefault(),S.stopPropagation(),m(!f)},"data-testid":"dropdown-selector",...E,children:[o?`${s} · ${h.length}`:v.label,d.jsx(Rh,{direction:f?"up":"down"})]}),d.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const q=t&&t.find($=>$.id===S.target.value);_(q)},hidden:!f,...E,children:t==null?void 0:t.map(S=>d.jsx("option",{value:S.id,children:S.label},S.id))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!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:()=>A("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(xe,{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(S=>{const q=S.id===v.id||(h==null?void 0:h.includes(S))||(h==null?void 0:h.includes(S.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:V("gtm-trackable",{selected:q,"selected-single":q&&!o}),"data-gtm-event-type":`${S}-click`,"data-gtm-event-context":i,onClick:$=>{$.preventDefault(),$.stopPropagation(),_(S)},role:"menuitem","aria-current":q,"data-testid":q?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:V({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(xe,{variant:"secondary",onClick:()=>{k&&k(h),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:h}})),m(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const Ih=({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:D=!1,value:v=h,disabled:x=!1})=>{const k=`${r}_${h}`,E=()=>{if(x)return;let _;if(i){const A=p==null?void 0:p.indexOf(v);Array.isArray(p)&&A>=0?(_=p,_.splice(A,1)):(!p||p.length===0?_=[]:_=p,_.push(v))}else _=g===v?void 0:v;t.onChange(_)};return d.jsx(wc,{element:"li",id:k,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?p==null?void 0:p.includes(v):g===v,functions:{...t,onChange:E},intlPath:n,label:D||m.formatMessage({id:n?`${n}_${h}`:h}),disabled:x},k)})})};const $h=({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(An,{inputRef:s,type:u,...r})]})};const wn={text:{component:An},email:{component:An},url:{component:An},textarea:{component:An,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:wc},checkboxes:{component:Ih,props:{multiSelect:!0}},select:{component:Mh},password:{component:$h},autocomplete:{component:Nh}},Lh=({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&&wn[o]&&wn[o].component?wn[o].component:An,D={};o&&["checkboxes"].includes(o)?D.element="span":D.htmlFor=e;let v={...f,id:e,name:e,className:r?"error":"",type:o,required:p,"aria-required":p,functions:cn(a),value:u};i>0&&(v["data-character-limit"]=i,v.functions&&(v.functions.onChange=_=>{((_==null?void 0:_.toString().length)||0)>i&&(_=_==null?void 0:_.toString().slice(0,i)),a.onChange(_)})),o&&wn[o]&&wn[o].props&&(v={...v,...wn[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}),k=({..._})=>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,{...v,label:x,className:V("field-wrapper",n)}),d.jsx(k,{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,{...D,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}),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(k,{})]})},zh=(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 D=!1;if(typeof g=="function"){const v=g(i);v&&(D=h||v)}else{const v=i[m.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(D=h||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(D=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)&&(D=h||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(D=h||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(D){o({type:"addError",payload:{key:m.id,value:D}}),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 ei=null;const Br=({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:D,...v}=s,x=40,{shouldShowCancelButton:k=!1,shouldReset:E=!0,showRequiredLabels:_=!0,showSuccessMessage:A=!1}=l||{},S=oe.useIntl(),q={};t.length&&t.forEach(y=>{const z=y.id||y.name;z&&(q[z]=y.value||"")});const[$,j]=C.useReducer(zh,{isSubmitting:!1,formSubmitted:!1,errors:{},values:q}),{errors:N,isSubmitting:w,formSubmitted:F,values:R}=$;C.useEffect(()=>{E&&F&&(ei=setTimeout(()=>{j({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[F]),C.useEffect(()=>()=>{ei&&clearTimeout(ei)},[]),C.useEffect(()=>{const y=z=>{j({type:"updateValue",payload:{key:z.detail.id,value:z.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",y),()=>{document.removeEventListener("dropdownMultiSelectSubmit",y)}},[]);const M=C.useRef(null),Y=a||M;if(!t.length)return null;s.text||(s.text=S.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:S}});return}j({type:"submitForm",payload:{fields:t,dispatch:j,onSuccess:async y=>{try{await c(y),j({type:E?"formSubmittedAndReset":"formSubmitted"})}catch(z){m(z),j({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(y,z)=>{p(y,z),j({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:S}})}},ne=[{...v,icon:F?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:y=>{var B;if(y.preventDefault(),y.stopPropagation(),w)return;let z=0;if((B=Y==null?void 0:Y.current)!=null&&B.id){const T=document.getElementById(Y.current.id);T&&(z=T.getBoundingClientRect().top+window.scrollY)}const J=document.getElementById("header");J&&(z=z-J.offsetHeight-x),z<0&&(z=0),window.scrollTo({top:z,behavior:"smooth"}),K()},disabled:w||F||s.disabled,"data-gtm-event-context":u.context,"data-gtm-event-type":u.event,children:w||F?S.formatMessage({id:`form_${w?"submitting":"submitted"}`}):s.text}];return k&&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||S.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[C.createElement(e,{...g,id:r,className:V("form",n),ref:Y},d.jsxs(d.Fragment,{children:[N!=null&&N.general?d.jsx(en,{variant:"error",text:S.formatMessage({id:"form_error_generalError"})}):null,(!E||!w&&!F||h)&&t.map((y,z)=>{const{id:J=y.name||z,component:B,functions:T={onChange:()=>{}},submitOnEnter:L=!1}=y;if(B)return d.jsx(B,{...y.props||{}},`component-${J}-${z}`);const I=R?R[J]:"",U={...T,onChange:te=>{j({type:"updateValue",payload:{key:J,value:te}}),T.onChange(te&&te.toString(),j)}};return L&&(U.onKeyDown=te=>{te.key==="Enter"&&(te.stopPropagation(),te.preventDefault(),K()),T.onKeyDown&&T.onKeyDown(te)}),d.jsx(Lh,{intlPath:i,...y,showRequiredLabels:_,value:I,error:N==null?void 0:N[J],functions:U},J)}),D?null:(w||F)&&h?h:d.jsx(Kn,{className:V("cta",{center:w||F,submitted:F}),buttons:ne})]})),A&&F&&d.jsx(pr,{className:"success",children:typeof A=="string"?A:S.formatMessage({id:"form_success"})})]})};const Nr="passwordRules_",Ec="isMoreThanEightCharacters",_c="includesNumberAndSymbol",Bc="includesLowerAndUppercase",qh={[Ec]:"8Characters",[_c]:"numberSymbol",[Bc]:"lowercaseUppercase"},Wh=({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:`${Nr}intro`})}),d.jsx("ul",{children:[Ec,_c,Bc].map(r=>d.jsxs("li",{className:V({matches:e[r]}),children:[d.jsxs($e,{children:[n.formatMessage({id:`${Nr}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${Nr}rule_${qh[r]}`})}),!e[r]&&d.jsxs($e,{element:"strong",children:[" ",n.formatMessage({id:`${Nr}notMet`})]})]},`rule-${r}`))})]})},kc=C.memo(Wh);const Hh=({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 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(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},D=async v=>{if(!(!f||p))try{u(x=>({...x,rating:v,disabled:!0})),await r({id:f,value:v})}catch(x){u(k=>({...k,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(v=>{const x=v+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:k=>{k.preventDefault(),k.stopPropagation(),D(x)},disabled:p})},`rating-${x}`)})})]})};var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0});var Uh=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),ti={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Ac={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Uh?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Ts={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 Rr=1;Rr<20;Rr++)Ts["f"+Rr]=111+Rr;function Pa(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Fc(s,t)}),a=function(o){return r.some(function(l){return Tc(l,o)})},i=n==null?a:a(n);return i}function Vh(e,t){return Pa(e,t)}function Kh(e,t){return Pa(e,{byKey:!0},t)}function Fc(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in ti)r[ti[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=Ss(m),h=ti[g];if(m.length>1&&!h&&!Ac[m]&&!Ts[g])throw new TypeError('Unknown modifier: "'+m+'"');(i===1||!h)&&(n?r.key=g:r.which=Sc(m)),h&&(r[h]=p?null:!0)}}catch(D){l=!0,u=D}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Tc(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 Sc(e){e=Ss(e);var t=Ts[e]||e.toUpperCase().charCodeAt(0);return t}function Ss(e){return e=e.toLowerCase(),e=Ac[e]||e,e}var Zh=Wt.default=Pa,ni=Wt.isHotkey=Pa;Wt.isCodeHotkey=Vh;Wt.isKeyHotkey=Kh;Wt.parseHotkey=Fc;Wt.compareHotkey=Tc;Wt.toKeyCode=Sc;Wt.toKeyName=Ss;function Yh(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 Ji(e,t){return Array(t+1).join(e)}function Gh(e){return e.replace(/^\n*/,"")}function Qh(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(D=>D==="opening"?"open":D==="closing"?"closed":D)};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 Ah=({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,Fh=({children:e})=>d.jsx(St,{variant:"secondary",children:e}),Th=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),Sh=["span","strong","h1","h2","h3","h4","h5","h6","p"],jh=({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(Sh.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(Ra,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},Oh=({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})},Ph=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},Nh=({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 Rh={default:{a:Nh,CollapsibleSection:Ra,TextBox:St,CaseStudy:Fh,style:Xe,details:jh,div:Oh,iframe:Ph,center:Th},"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,overrides:Rh[r]};return d.jsx("div",{className:V("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Lt,{options:{...s,...t},children:n})})};const kc=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return d.jsxs("section",{className: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 yr=({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 Mh=({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(Mh);const ti="loadingBlock_",Ih=({progress:e=0,steps:t=!1,className:n=""})=>{const r=oe.useIntl();t||(t={0:{text:r.formatMessage({id:`${ti}loading`})},75:{text:r.formatMessage({id:`${ti}almostDone`})},100:{text:r.formatMessage({id:`${ti}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})]})},$h=C.memo(Ih);const Ct=({element:e="div",className:t="",...n})=>d.jsx(Pa,{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"]},Bc=(e,t)=>e in es?d.jsx("div",{className:e,children:es[e].map((n,r)=>Bc(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)=>Bc(n,r))}),Ac=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):""},Rr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Lh=e=>{const t=Math.ceil(26/Rr.length),n=Ac(e).toLowerCase();if(n==="")return Rr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Rr.length;a++)if(r<=t*(a+1))return Rr[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=Lh(n),m.fillRect(0,0,p,g),m.font=`${p/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Ac(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},zh=({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 Fr=({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=zh(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:D=>{D==null||D.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:D="",image:b=""}=Ss(m);if(s)return d.jsx(Ct,{element:"li",className:"contributor"},p);g=d.jsx(tn,{name:D,src:b,width:Oo[a||"medium"],height:Oo[a||"medium"]})}else if(p===o){const D=(t||n.length)-o;g=d.jsxs("small",{className:V({"large-number":D>99}),children:["+",bh(D,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 Mr="emailHelperTextBox_",Fc=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=oe.useIntl(),[i,s]=C.useState({path:`${Mr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=C.useState(!1),u=C.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=h=>{s({path:`${Mr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:D=>u(D),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:h})};if(typeof r!="function"){g(a.formatMessage({id:`${Mr}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=Mr,g="default",h={},D={};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",D={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",g="error",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"},D={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",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:D})},[e]);const c={};return["link","mail"].forEach(p=>{c[p]=Object.keys(i[p]).length?g=>d.jsx("a",{...i[p],children:g}):g=>g}),d.jsx(Ec,{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"},qh=500,Wh=({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:D}=oe.useIntl();r||(r=D({id:"inputAutocomplete_placeholder"})),C.useEffect(()=>{const _=setTimeout(()=>{g||f(E=>({...E,debouncedInput:l}))},qh);return()=>{clearTimeout(_)}},[l,g]),C.useEffect(()=>{c&&!g?(async()=>{try{const E=await o(c)||[];h(k=>({...k,predictions:E}))}catch(E){console.error("Error fetching predictions:",E),h(k=>({...k,predictions:[]}))}})():h(_=>({..._,predictions:[]}))},[c,g]),C.useEffect(()=>{p>=0&&m[p]&&f(_=>({..._,displayInput:m[p].description}))},[p,m]);const b=_=>{[En.DOWN,En.UP,En.ENTER].includes(_.key)&&(_.preventDefault(),_.key===En.DOWN&&p<m.length-1?h(E=>({...E,activePredictionIndex:p+1})):_.key===En.UP&&p>0?h(E=>({...E,activePredictionIndex:p-1})):_.key===En.ENTER&&p>-1&&(s(m[p].description),f(E=>({...E,input:m[p].description})),h(E=>({...E,predictions:[],isPredictionSelected:!0}))))},x=_=>{s(_.target.value),f(E=>({...E,input:_.target.value,displayInput:_.target.value})),h(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},A=_=>{s(_.description),f(E=>({...E,input:_.description,displayInput:_.description})),h(E=>({...E,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:()=>A(_),onMouseEnter:()=>h(k=>({...k,activePredictionIndex:E})),className:V("predictions-list-item",{active:E===p}),children:_.description},E))})]})};const Tc=({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)},D=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},D)};const Hh=C.memo(function({direction:t="down"}){return d.jsx(Pa,{className:V("rotating-chevron",`direction-${t}`)})});const Uh=({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,D]=C.useState(g);let b;Array.isArray(h)&&h.length===1&&typeof h[0]=="string"?b=t&&h?t.find(F=>F.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(()=>{D(g)},[r,n]);const{onChange:x,onMultiSelectSubmit:A,..._}=a,E=F=>{if(o){let z=[];h!=null&&h.includes(F.id)?z=h.filter($=>$!==F.id):z=[...h,F.id],D([...z]),x&&x([...z])}else D([F]),x&&x(F.id),m(!1)},k=F=>{if(F==="all"){const z=(t==null?void 0:t.map($=>$.id))||[];D(z),x&&x(z)}else D([]),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:F=>{F.preventDefault(),F.stopPropagation(),m(!f)},"data-testid":"dropdown-selector",..._,children:[o?`${s} · ${h.length}`:b.label,d.jsx(Hh,{direction:f?"up":"down"})]}),d.jsx("select",{defaultValue:b.id,onChange:F=>{F.preventDefault(),F.stopPropagation();const z=t&&t.find($=>$.id===F.target.value);E(z)},hidden:!f,..._,children:t==null?void 0:t.map(F=>d.jsx("option",{value:F.id,children:F.label},F.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:()=>k("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(xe,{variant:"tertiary",size:"small",onClick:()=>k("none"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(F=>{const z=F.id===b.id||(h==null?void 0:h.includes(F))||(h==null?void 0:h.includes(F.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:V("gtm-trackable",{selected:z,"selected-single":z&&!o}),"data-gtm-event-type":`${F}-click`,"data-gtm-event-context":i,onClick:$=>{$.preventDefault(),$.stopPropagation(),E(F)},role:"menuitem","aria-current":z,"data-testid":z?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:V({"menu-option-label":o}),children:F.label})]})},F.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(xe,{variant:"secondary",onClick:()=>{A&&A(h),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:h}})),m(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const Vh=({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:D=!1,value:b=h,disabled:x=!1})=>{const A=`${r}_${h}`,_=()=>{if(x)return;let E;if(i){const k=p==null?void 0:p.indexOf(b);Array.isArray(p)&&k>=0?(E=p,E.splice(k,1)):(!p||p.length===0?E=[]:E=p,E.push(b))}else E=g===b?void 0:b;t.onChange(E)};return d.jsx(Tc,{element:"li",id:A,type:u==="checkboxes"?"checkbox":"radio",shownValue:b,value:i?p==null?void 0:p.includes(b):g===b,functions:{...t,onChange:_},intlPath:n,label:D||m.formatMessage({id:n?`${n}_${h}`:h}),disabled:x},A)})})};const Kh=({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:Tc},checkboxes:{component:Vh,props:{multiSelect:!0}},select:{component:Uh},password:{component:Kh},autocomplete:{component:Wh}},Zh=({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:E})=>E==="required"),g=(u==null?void 0:u.toString().length)||0,h=o&&_n[o]&&_n[o].component?_n[o].component:Tn,D={};o&&["checkboxes"].includes(o)?D.element="span":D.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=E=>{((E==null?void 0:E.toString().length)||0)>i&&(E=E==null?void 0:E.toString().slice(0,i)),a.onChange(E)})),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}),A=({...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,{...b,label:x,className:V("field-wrapper",n)}),d.jsx(A,{as:"p"})]});const _=E=>C.createElement(E.element||"label",{...E,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(_,{...D,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(A,{})]})},Yh=(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 D=!1;if(typeof g=="function"){const b=g(i);b&&(D=h||b)}else{const b=i[m.id];switch(g){case"required":(!b||typeof b=="string"&&b.trim().length===0)&&(D=h||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{b&&!/^([^0-9]*)$/.test(b)&&(D=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)&&(D=h||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{b&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(b)&&(D=h||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(D){o({type:"addError",payload:{key:m.id,value:D}}),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 ni=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:D,...b}=s,x=40,{shouldShowCancelButton:A=!1,shouldReset:_=!0,showRequiredLabels:E=!0,showSuccessMessage:k=!1}=l||{},F=oe.useIntl(),z={};t.length&&t.forEach(y=>{const q=y.id||y.name;q&&(z[q]=y.value||"")});const[$,j]=C.useReducer(Yh,{isSubmitting:!1,formSubmitted:!1,errors:{},values:z}),{errors:N,isSubmitting:w,formSubmitted:T,values:R}=$;C.useEffect(()=>{_&&T&&(ni=setTimeout(()=>{j({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[T]),C.useEffect(()=>()=>{ni&&clearTimeout(ni)},[]),C.useEffect(()=>{const y=q=>{j({type:"updateValue",payload:{key:q.detail.id,value:q.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",y),()=>{document.removeEventListener("dropdownMultiSelectSubmit",y)}},[]);const M=C.useRef(null),Y=a||M;if(!t.length)return null;s.text||(s.text=F.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:F}});return}j({type:"submitForm",payload:{fields:t,dispatch:j,onSuccess:async y=>{try{await c(y),j({type:_?"formSubmittedAndReset":"formSubmitted"})}catch(q){m(q),j({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(y,q)=>{p(y,q),j({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:F}})}},ne=[{...b,icon:T?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:y=>{var B;if(y.preventDefault(),y.stopPropagation(),w)return;let q=0;if((B=Y==null?void 0:Y.current)!=null&&B.id){const S=document.getElementById(Y.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||T||s.disabled,"data-gtm-event-context":u.context,"data-gtm-event-type":u.event,children:w||T?F.formatMessage({id:`form_${w?"submitting":"submitted"}`}):s.text}];return A&&ne.unshift({...o,className:"gtm-trackable","data-gtm-event-context":u.context,"data-gtm-event-type":u.event,disabled:w||T,onClick:f,children:o.text||F.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[C.createElement(e,{...g,id:r,className:V("form",n),ref:Y},d.jsxs(d.Fragment,{children:[N!=null&&N.general?d.jsx(en,{variant:"error",text:F.formatMessage({id:"form_error_generalError"})}):null,(!_||!w&&!T||h)&&t.map((y,q)=>{const{id:X=y.name||q,component:B,functions:S={onChange:()=>{}},submitOnEnter:L=!1}=y;if(B)return d.jsx(B,{...y.props||{}},`component-${X}-${q}`);const I=R?R[X]:"",U={...S,onChange:te=>{j({type:"updateValue",payload:{key:X,value:te}}),S.onChange(te&&te.toString(),j)}};return L&&(U.onKeyDown=te=>{te.key==="Enter"&&(te.stopPropagation(),te.preventDefault(),K()),S.onKeyDown&&S.onKeyDown(te)}),d.jsx(Zh,{intlPath:i,...y,showRequiredLabels:E,value:I,error:N==null?void 0:N[X],functions:U},X)}),D?null:(w||T)&&h?h:d.jsx(yn,{className:V("cta",{center:w||T,submitted:T}),buttons:ne})]})),k&&T&&d.jsx(yr,{className:"success",children:typeof k=="string"?k:F.formatMessage({id:"form_success"})})]})};const Ir="passwordRules_",Sc="isMoreThanEightCharacters",jc="includesNumberAndSymbol",Oc="includesLowerAndUppercase",Gh={[Sc]:"8Characters",[jc]:"numberSymbol",[Oc]:"lowercaseUppercase"},Qh=({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:`${Ir}intro`})}),d.jsx("ul",{children:[Sc,jc,Oc].map(r=>d.jsxs("li",{className:V({matches:e[r]}),children:[d.jsxs(Ie,{children:[n.formatMessage({id:`${Ir}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${Ir}rule_${Gh[r]}`})}),!e[r]&&d.jsxs(Ie,{element:"strong",children:[" ",n.formatMessage({id:`${Ir}notMet`})]})]},`rule-${r}`))})]})},Pc=C.memo(Qh);const Jh=({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},D=async b=>{if(!(!f||p))try{u(x=>({...x,rating:b,disabled:!0})),await r({id:f,value:b})}catch(x){u(A=>({...A,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:A=>{A.preventDefault(),A.stopPropagation(),D(x)},disabled:p})},`rating-${x}`)})})]})};var Wt={};Object.defineProperty(Wt,"__esModule",{value:!0});var Xh=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),ri={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Nc={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Xh?"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 $r=1;$r<20;$r++)Os["f"+$r]=111+$r;function Ma(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Rc(s,t)}),a=function(o){return r.some(function(l){return Mc(l,o)})},i=n==null?a:a(n);return i}function em(e,t){return Ma(e,t)}function tm(e,t){return Ma(e,{byKey:!0},t)}function Rc(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in ri)r[ri[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=ri[g];if(m.length>1&&!h&&!Nc[m]&&!Os[g])throw new TypeError('Unknown modifier: "'+m+'"');(i===1||!h)&&(n?r.key=g:r.which=Ic(m)),h&&(r[h]=p?null:!0)}}catch(D){l=!0,u=D}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Mc(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 Ic(e){e=Ps(e);var t=Os[e]||e.toUpperCase().charCodeAt(0);return t}function Ps(e){return e=e.toLowerCase(),e=Nc[e]||e,e}var nm=Wt.default=Ma,ai=Wt.isHotkey=Ma;Wt.isCodeHotkey=em;Wt.isKeyHotkey=tm;Wt.parseHotkey=Rc;Wt.compareHotkey=Mc;Wt.toKeyCode=Ic;Wt.toKeyName=Ps;function rm(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 am(e){return e.replace(/^\n*/,"")}function im(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
38
|
+
`;)t--;return e.substring(0,t)}var sm=["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 Ns(e){return Rs(e,sm)}var $c=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Lc(e){return Rs(e,$c)}function om(e){return qc(e,$c)}var zc=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function um(e){return Rs(e,zc)}function lm(e){return qc(e,zc)}function Rs(e,t){return t.indexOf(e.nodeName)>=0}function qc(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var et={};et.paragraph={filter:"p",replacement:function(e){return`
|
|
39
39
|
|
|
40
40
|
`+e+`
|
|
41
41
|
|
|
42
42
|
`}};et.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+`
|
|
43
|
-
`}};et.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=
|
|
43
|
+
`}};et.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=ts(r===1?"=":"-",e.length);return`
|
|
44
44
|
|
|
45
45
|
`+e+`
|
|
46
46
|
`+a+`
|
|
47
47
|
|
|
48
48
|
`}else return`
|
|
49
49
|
|
|
50
|
-
`+
|
|
50
|
+
`+ts("#",r)+" "+e+`
|
|
51
51
|
|
|
52
52
|
`}};et.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
|
|
53
53
|
|
|
@@ -66,7 +66,7 @@ Thank you for helping to protect the Apolitical community from abusive content.`
|
|
|
66
66
|
`+t.firstChild.textContent.replace(/\n/g,`
|
|
67
67
|
`)+`
|
|
68
68
|
|
|
69
|
-
`}};et.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=
|
|
69
|
+
`}};et.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=ts(s,o);return`
|
|
70
70
|
|
|
71
71
|
`+c+a+`
|
|
72
72
|
`+i.replace(/\n$/,"")+`
|
|
@@ -76,13 +76,13 @@ Thank you for helping to protect the Apolitical community from abusive content.`
|
|
|
76
76
|
|
|
77
77
|
`+n.hr+`
|
|
78
78
|
|
|
79
|
-
`}};et.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=
|
|
79
|
+
`}};et.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=ma(t.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+n+r+")"}};et.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=ma(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}};et.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};et.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};et.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}};et.image={filter:"img",replacement:function(e,t){var n=
|
|
85
|
-
`):""}function
|
|
84
|
+
`,this.references=[]),t}};et.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};et.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};et.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}};et.image={filter:"img",replacement:function(e,t){var n=ma(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=ma(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"":""}};function ma(e){return e?e.replace(/(\n+\s*)+/g,`
|
|
85
|
+
`):""}function Wc(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])}Wc.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=ii(this.array,e,this.options))||(t=ii(this._keep,e,this.options))||(t=ii(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 ii(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(cm(a,t,n))return a}}function cm(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 dm(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=Po(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=si(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=si(l);continue}var c=Po(o,l,a);o=l,l=c}i&&(i.data=i.data.replace(/ $/,""),i.data||si(i))}}function si(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Po(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var Ms=typeof window<"u"?window:{};function fm(){var e=Ms.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function hm(){var e=function(){};return mm()?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 mm(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{Ms.ActiveXObject&&(e=!0)}return e}var pm=fm()?Ms.DOMParser:hm();function gm(e,t){var n;if(typeof e=="string"){var r=vm().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return dm({element:n,isBlock:Ns,isVoid:Lc,isPre:t.preformattedCode?bm:null}),n}var oi;function vm(){return oi=oi||new pm,oi}function bm(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function ym(e,t){return e.isBlock=Ns(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=Dm(e),e.flankingWhitespace=Cm(e,t),e}function Dm(e){return!Lc(e)&&!um(e)&&/^\s*$/i.test(e.textContent)&&!om(e)&&!lm(e)}function Cm(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=xm(e.textContent);return n.leadingAscii&&No("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&No("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function xm(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 No(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&&!Ns(r)&&(i=a.test(r.textContent))),i}var wm=Array.prototype.reduce,Em=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function pa(e){if(!(this instanceof pa))return new pa(e);var t={rules:et,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,27 +92,27 @@ 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=rm({},t,e),this.rules=new Wc(this.options)}pa.prototype={turndown:function(e){if(!Bm(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=Hc.call(this,new gm(e,this.options));return _m.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 Em.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function Hc(e){var t=this;return wm.call(e.childNodes,function(n,r){r=new ym(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=km.call(t,r)),Uc(n,a)},"")}function _m(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=Uc(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function km(e){var t=this.rules.forNode(e),n=Hc.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 Uc(e,t){var n=im(e),r=am(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 Bm(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 jo(e){return Object.prototype.toString.call(e)==="[object Object]"}function Je(e){var t,n;return jo(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(jo(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var $c=Symbol.for("immer-nothing"),Oo=Symbol.for("immer-draftable"),mt=Symbol.for("immer-state"),Dm=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=Dm[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 Ln=Object.getPrototypeOf;function mn(e){return!!e&&!!e[mt]}function pn(e){var t;return e?Lc(e)||Array.isArray(e)||!!e[Oo]||!!((t=e.constructor)!=null&&t[Oo])||Ra(e)||Ma(e):!1}var Cm=Object.prototype.constructor.toString();function Lc(e){if(!e||typeof e!="object")return!1;const t=Ln(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)===Cm}function ha(e,t){Na(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Na(e){const t=e[mt];return t?t.type_:Array.isArray(e)?1:Ra(e)?2:Ma(e)?3:0}function Xi(e,t){return Na(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function zc(e,t,n){const r=Na(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function xm(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ra(e){return e instanceof Map}function Ma(e){return e instanceof Set}function sn(e){return e.copy_||e.base_}function es(e,t){if(Ra(e))return new Map(e);if(Ma(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Lc(e))return Ln(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(Ln(e),n)}function Ns(e,t=!1){return Ia(e)||mn(e)||!pn(e)||(Na(e)>1&&(e.set=e.add=e.clear=e.delete=wm),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ns(r,!0))),e}function wm(){lt(2)}function Ia(e){return Object.isFrozen(e)}var Em={};function gn(e){const t=Em[e];return t||lt(0,e),t}var gr;function qc(){return gr}function _m(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Po(e,t){t&&(gn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ts(e){ns(e),e.drafts_.forEach(Bm),e.drafts_=null}function ns(e){e===gr&&(gr=e.parent_)}function No(e){return gr=_m(gr,e)}function Bm(e){const t=e[mt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ro(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[mt].modified_&&(ts(t),lt(4)),pn(e)&&(e=ma(t,e),t.parent_||pa(t,e)),t.patches_&&gn("Patches").generateReplacementPatches_(n[mt].base_,e,t.patches_,t.inversePatches_)):e=ma(t,n,[]),ts(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==$c?e:void 0}function ma(e,t,n){if(Ia(t))return t;const r=t[mt];if(!r)return ha(t,(a,i)=>Mo(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return pa(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),ha(i,(o,l)=>Mo(e,r,a,o,l,n,s)),pa(e,a,!1),n&&e.patches_&&gn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Mo(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&&!Xi(t.assigned_,r)?i.concat(r):void 0,l=ma(e,a,o);if(zc(n,r,l),mn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(pn(a)&&!Ia(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ma(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&pa(e,a)}}function pa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ns(t,n)}function km(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:qc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=Rs;n&&(a=[r],i=vr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var Rs={get(e,t){if(t===mt)return e;const n=sn(e);if(!Xi(n,t))return Am(e,n,t);const r=n[t];return e.finalized_||!pn(r)?r:r===si(e.base_,t)?(oi(e),e.copy_[t]=as(r,e)):r},has(e,t){return t in sn(e)},ownKeys(e){return Reflect.ownKeys(sn(e))},set(e,t,n){const r=Wc(sn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=si(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(xm(n,a)&&(n!==void 0||Xi(e.base_,t)))return!0;oi(e),rs(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return si(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,oi(e),rs(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 Ln(e.base_)},setPrototypeOf(){lt(12)}},vr={};ha(Rs,(e,t)=>{vr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});vr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&<(13),vr.set.call(this,e,t,void 0)};vr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&<(14),Rs.set.call(this,e[0],t,n,e[0])};function si(e,t){const n=e[mt];return(n?sn(n):e)[t]}function Am(e,t,n){var a;const r=Wc(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Wc(e,t){if(!(t in e))return;let n=Ln(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Ln(n)}}function rs(e){e.modified_||(e.modified_=!0,e.parent_&&rs(e.parent_))}function oi(e){e.copy_||(e.copy_=es(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Fm=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=No(this),s=as(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?ts(i):ns(i)}return Po(i,r),Ro(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===$c&&(a=void 0),this.autoFreeze_&&Ns(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=Tm(e));const t=No(this),n=as(e,void 0);return n[mt].isManual_=!0,ns(t),n}finishDraft(e,t){const n=e&&e[mt];(!n||!n.isManual_)&<(9);const{scope_:r}=n;return Po(r,t),Ro(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 as(e,t){const n=Ra(e)?gn("MapSet").proxyMap_(e,t):Ma(e)?gn("MapSet").proxySet_(e,t):km(e,t);return(t?t.scope_:qc()).drafts_.push(n),n}function Tm(e){return mn(e)||lt(10,e),Hc(e)}function Hc(e){if(!pn(e)||Ia(e))return e;const t=e[mt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=es(e,t.scope_.immer_.useStrictShallowCopy_)}else n=es(e,!0);return ha(n,(r,a)=>{zc(n,r,Hc(a))}),t&&(t.finalized_=!1),n}var pt=new Fm,Ms=pt.produce;pt.produceWithPatches.bind(pt);pt.setAutoFreeze.bind(pt);pt.setUseStrictShallowCopy.bind(pt);pt.applyPatches.bind(pt);var Io=pt.createDraft.bind(pt),$o=pt.finishDraft.bind(pt),Sm={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()}}},jm={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()}}},Om={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()}}},ga=new WeakMap,va=new WeakMap,ur=new WeakMap,Uc=new WeakMap,Lo=new WeakMap,zo=new WeakMap,qo=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 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 Pm(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 Nm(e){var t=Pm(e,"string");return br(t)==="symbol"?t:String(t)}function it(e,t,n){return t=Nm(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wo(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 Xn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Wo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Rm=(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,D]of W.points(t))t[D]=Ce.transform(h,n);break}case"merge_node":{var{path:v}=n,x=ie.get(e,v),k=P.previous(v),E=ie.get(e,k),_=ie.parent(e,v),A=v[v.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(v,"] to nodes of different interfaces: ").concat(Ye.stringify(x)," ").concat(Ye.stringify(E)));if(_.children.splice(A,1),t)for(var[S,q]of W.points(t))t[q]=Ce.transform(S,n);break}case"move_node":{var{path:$,newPath:j}=n;if(P.isAncestor($,j))throw new Error("Cannot move a path [".concat($,"] to new path [").concat(j,"] because the destination is inside itself."));var N=ie.get(e,$),w=ie.parent(e,$),F=$[$.length-1];w.children.splice(F,1);var R=P.transform($,n),M=ie.get(e,P.parent(R)),Y=R[R.length-1];if(M.children.splice(Y,0,N),t)for(var[K,se]of W.points(t))t[se]=Ce.transform(K,n);break}case"remove_node":{var{path:ne}=n,y=ne[ne.length-1],z=ie.parent(e,ne);if(z.children.splice(y,1),t)for(var[J,B]of W.points(t)){var T=Ce.transform(J,n);if(t!=null&&T!=null)t[B]=T;else{var L=void 0,I=void 0;for(var[U,te]of ie.texts(e))if(P.compare(te,ne)===-1)L=[U,te];else{I=[U,te];break}var ee=!1;L&&I&&(P.equals(I[1],ne)?ee=!P.hasPrevious(I[1]):ee=P.common(L[1],ne).length<P.common(I[1],ne).length),L&&!ee?(J.path=L[1],J.offset=L[0].text.length):I?(J.path=I[1],J.offset=0):t=null}}break}case"remove_text":{var{path:Z,offset:ue,text:Q}=n;if(Q.length===0)break;var ge=ie.leaf(e,Z),me=ge.text.slice(0,ue),_e=ge.text.slice(ue+Q.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=Xn({},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=Xn(Xn({},Ue),{},{text:_t})}else{var ht=Ve.children.slice(0,De),Za=Ve.children.slice(De);Ve.children=ht,xt=Xn(Xn({},Ue),{},{children:Za})}if(ft.children.splice(Pt+1,0,xt),t)for(var[Gn,Sr]of W.points(t))t[Sr]=Ce.transform(Gn,n);break}}return t},Mm={transform(e,t){e.children=Io(e.children);var n=e.selection&&Io(e.selection);try{n=Rm(e,n,t)}finally{e.children=$o(e.children),n?e.selection=mn(n)?$o(n):n:e.selection=null}}},Im={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)}},$m={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)}},Vc=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(Je(r)&&Je(a)){if(!Vc(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 Lm(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=Lm(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 zm=["anchor","focus"];function Ho(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?Ho(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ho(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,zm),[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 Ms(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})}},Uo=e=>Je(e)&&ie.isNodeList(e.children)&&!b.isEditor(e),ce={isAncestor(e){return Je(e)&&ie.isNodeList(e.children)},isElement:Uo,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 Uo(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},Wm=["children"],Hm=["text"],Vo=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(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(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,Wm);return t}else{var t=qt(e,Hm);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=Ms({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)}}b.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(de.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(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)||b.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=Vo.get(e);if(t!==void 0)return t;var n=e.every(r=>ie.isNode(r));return Vo.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 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 Re(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 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)})}}},Zo=new WeakMap,Um=e=>{var t=Zo.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 Zo.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 Um(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)}},Vm={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(P.isPath)}};function Yo(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 Go(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Yo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yo(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 Ms(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,Go(Go({},n),{},{affinity:"forward"})))}else r.path=P.transform(i,t,n);break}}})}},Qo=void 0,Ye={setScrubber(e){Qo=e},stringify(e){return JSON.stringify(e,Qo)}},Km=["text"],Zm=["anchor","focus"];function Jo(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?Jo(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jo(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,Km);return s}return Vc(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,Zm),[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,D=void 0;if(c<l){var v=c-p;D=Rt(Rt({},g),{},{text:g.text.slice(v)}),g=Rt(Rt({},g),{},{text:g.text.slice(0,v)})}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),D&&o.push(D)}n=o}return n}},Is=e=>e.selection?e.selection:e.children.length>0?b.end(e,[]):[0],Yn=(e,t)=>{var[n]=b.node(e,t);return r=>r===n},$s=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?ep(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=fp(c,f);if([i,s]=r?[s,m]:[m,i],Fn(i,ye.ZWJ)&&Fn(s,ye.ExtPict)&&(r?l=Xo(t.substring(0,o)):l=Xo(t.substring(0,t.length-o)),!l)||Fn(i,ye.RI)&&Fn(s,ye.RI)&&(u!==null?u=!u:r?u=!0:u=vp(t.substring(0,t.length-o)),!u)||i!==ye.None&&s!==ye.None&&mp(i,s))break;o+=c.length}return o||1},Ym=/\s/,Gm=/[\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]/,Qm=/['\u2018\u2019]/,Jm=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=$s(t,n),[s,o]=Ls(t,i,n);if(Xm(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Ls=(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)]},Xm=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(Ym.test(t))return!1;if(Qm.test(t)){var a=$s(n,r),[i,s]=Ls(n,a,r);if(e(i,s,r))return!0}return!Gm.test(t)},ep=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(np(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(tp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},tp=e=>e>=55296&&e<=56319,np=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 rp=/^(?:[\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])$/,ap=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,ip=/^(?:[\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])$/,sp=/^[\u1100-\u115F\uA960-\uA97C]$/,op=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,up=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,lp=/^[\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]$/,cp=/^[\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])$/,fp=(e,t)=>{var n=ye.Any;return e.search(rp)!==-1&&(n|=ye.Extend),t===8205&&(n|=ye.ZWJ),t>=127462&&t<=127487&&(n|=ye.RI),e.search(ap)!==-1&&(n|=ye.Prepend),e.search(ip)!==-1&&(n|=ye.SpacingMark),e.search(sp)!==-1&&(n|=ye.L),e.search(op)!==-1&&(n|=ye.V),e.search(up)!==-1&&(n|=ye.T),e.search(lp)!==-1&&(n|=ye.LV),e.search(cp)!==-1&&(n|=ye.LVT),e.search(dp)!==-1&&(n|=ye.ExtPict),n};function Fn(e,t){return(e&t)!==0}var hp=[[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 mp(e,t){return hp.findIndex(n=>Fn(e,n[0])&&Fn(t,n[1]))===-1}var pp=/(?:[\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$/,Xo=e=>e.search(pp)!==-1,gp=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,vp=e=>{var t=e.match(gp);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]:{};b.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=Is(e)}=n;if(P.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);X.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,X.setSelection(e,{anchor:a,focus:a})}if(!(!r&&b.void(e,{at:a})||b.elementReadOnly(e,{at:a}))){var{path:f,offset:m}=a;t.length>0&&e.apply({type:"insert_text",path:f,offset:m,text:t})}})}};function eu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Mr(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){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var X=Mr(Mr(Mr(Mr({},Mm),Im),$m),bp),ta=new WeakMap,yp=e=>ta.get(e)||!1,Dp=(e,t,n)=>{var r=ta.get(e)||!1;ta.set(e,!0);try{t(),n()}finally{ta.set(e,r)}};function Kc(e,t,n){var r=ga.get(e)||[],a=va.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);ga.set(e,i),va.set(e,s)}var Cp=(e,t)=>{for(var n of b.pathRefs(e))Sm.transform(n,t);for(var r of b.pointRefs(e))jm.transform(r,t);for(var a of b.rangeRefs(e))Om.transform(a,t);if(!yp(e)){var i=P.operationCanTransformPath(t)?s=>P.transform(s,t):void 0;Kc(e,e.getDirtyPaths(t),i)}X.transform(e,t),e.operations.push(t),b.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),ur.get(e)||(ur.set(e,!0),Promise.resolve().then(()=>{ur.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},xp=(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[,N]=j;return a.concat(N)});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 D of P.ancestors(f)){var v=P.transform(D,t);p.push(v)}var x=p[p.length-1],k=f[f.length-1],E=x.concat(k);return[...m,...p,E]}case"remove_node":{var{path:_}=t,A=P.ancestors(_);return[...A]}case"split_node":{var{path:S}=t,q=P.levels(S),$=P.next(S);return[...q,$]}default:return[]}},wp=e=>{var{selection:t}=e;return t?ie.fragment(e,t):[]},Ep=(e,t)=>{var[n,r]=t;if(!de.isText(n)){if(ce.isElement(n)&&n.children.length===0){var a={text:""};X.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=b.isEditor(n)?!1: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)X.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:""};X.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(f){var g={text:""};X.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&de.isText(c)&&(de.equals(u,c,{loose:!0})?(X.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(X.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(X.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},_p=(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},Bp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:s}=n;if(i){var o=b.path(t,i),l=a==="lowest";for(var[u,c]of b.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!de.isText(u)){if(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 tu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function nu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var kp=(e,t,n)=>{var{selection:r}=e;if(r){var a=(f,m)=>{if(!de.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)X.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=nu(nu({},b.marks(e)||{}),{},{[t]:n});e.marks=c,ur.get(e)||e.onChange()}}};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 au(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){it(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 Ap=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,au(au({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};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 Fp=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,su(su({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},Tp=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&X.delete(e,{unit:t,reverse:!0})},Sp=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&X.delete(e,{unit:t})},jp=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&W.isExpanded(r)&&X.delete(t,{reverse:n==="backward"})},Op=(e,t)=>[b.start(e,t),b.end(e,t)];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 Pp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,uu(uu({},n),{},{match:r=>ce.isElement(r)&&b.isElementReadOnly(t,r)}))},Np=(e,t)=>b.point(e,t,{edge:"end"}),Rp=(e,t)=>{var n=b.path(e,t,{edge:"start"});return b.node(e,n)},Mp=(e,t)=>{var n=b.range(e,t);return ie.fragment(e,n)};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){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,cu(cu({},n),{},{match:r=>ce.isElement(r)&&b.isVoid(t,r)}))},$p=(e,t)=>t.children.some(n=>ce.isElement(n)&&b.isBlock(e,n)),Lp=(e,t)=>t.children.some(n=>de.isText(n)||b.isInline(e,n)),zp=(e,t)=>ie.has(e,t),qp=(e,t)=>t.children.every(n=>de.isText(n)),Wp=e=>{X.splitNodes(e,{always:!0})},Hp=(e,t,n)=>{X.insertNodes(e,t,n)},Up=e=>{X.splitNodes(e,{always:!0})};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 Vp(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 Kp=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=Vp({text:n},i);X.insertNodes(t,s,{at:r.at,voids:r.voids})}else X.insertText(t,n,r);t.marks=null}},Zp=(e,t)=>!e.isInline(t),Yp=(e,t,n)=>b.isStart(e,t,n)||b.isEnd(e,t,n),Gp=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&de.isText(r)&&r.text===""&&!e.isVoid(t)},Qp=(e,t,n)=>{var r=b.end(e,n);return Ce.equals(t,r)},Jp=e=>{var t=Uc.get(e);return t===void 0?!0:t},Xp=(e,t,n)=>{if(t.offset!==0)return!1;var r=b.start(e,n);return Ce.equals(t,r)},eg=(e,t)=>{var n=b.path(e,t,{edge:"end"});return b.node(e,n)},tg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=ie.leaf(t,a);return[i,a]};function ng(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 ie.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&ce.isElement(l)&&b.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var rg=["text"],ag=["text"],ig=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:de.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=qt(u,rg);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:de.isText}),g=b.above(t,{match:E=>ce.isElement(E)&&b.isVoid(t,E)&&t.markableVoid(E)});if(!g){var h=b.above(t,{match:E=>ce.isElement(E)&&b.isBlock(t,E)});if(p&&h){var[D,v]=p,[,x]=h;P.isAncestor(x,v)&&(m=D)}}}var k=qt(m,ag);return k},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.after(t,s,{voids:a});if(o){var[,l]=b.last(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(P.isPath(s)){var[c]=b.parent(t,s);i=m=>c.children.includes(m)}else i=()=>!0;var[f]=b.nodes(t,{at:u,match:i,mode:r,voids:a});return f}}},og=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=ie.get(t,a);return[i,a]};function ug(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(Vm.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=ie.nodes(e,{reverse:i,from:u,to:c,pass:E=>{var[_]=E;return ce.isElement(_)?!!(!s&&(b.isVoid(e,_)||b.isElementReadOnly(e,_))||o&&!b.isSelectable(e,_)):!1}}),g=[],h;for(var[D,v]of p)if(!(o&&ce.isElement(D)&&!b.isSelectable(e,D))){var x=h&&P.compare(v,h[1])===0;if(!(r==="highest"&&x)){if(!l(D,v)){if(a&&!x&&de.isText(D))return;continue}if(r==="lowest"&&x){h=[D,v];continue}var k=r==="lowest"?h:[D,v];k&&(a?g.push(k):yield k),h=[D,v]}}r==="lowest"&&h&&(a?g.push(h):yield h),a&&(yield*g)}}()}var lg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>ga.get(c)||[],s=c=>va.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(ie.nodes(t),c=>{var[,f]=c;return f}),u=new Set(l.map(c=>c.join(",")));ga.set(t,l),va.set(t,u)}i(t).length!==0&&b.withoutNormalizing(t,()=>{for(var c of i(t))if(ie.has(t,c)){var f=b.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,D=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:D,initialDirtyPathsLength:h,operation:a}))return;var v=o(t);if(ie.has(t,v)){var x=b.node(t,v);t.normalizeNode(x,{operation:a})}D++,g=i(t)}})}},cg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=P.parent(a),s=b.node(t,i);return s},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=b.pathRefs(t);return l.delete(i),i.current=null,o}},s=b.pathRefs(t);return s.add(i),i},fg=e=>{var t=Lo.get(e);return t||(t=new Set,Lo.set(e,t)),t},hg=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},mg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.pointRefs(t);return l.delete(i),i.current=null,o}},s=b.pointRefs(t);return s.add(i),i},pg=e=>{var t=zo.get(e);return t||(t=new Set,zo.set(e,t)),t},gg=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 vg(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[D,v]of b.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(ce.isElement(D)){if(!i&&(e.isVoid(D)||e.isElementReadOnly(D))){yield b.start(e,v);continue}if(e.isInline(D))continue;if(b.hasInlines(e,D)){var x=P.isAncestor(v,u.path)?u:b.end(e,v),k=P.isAncestor(v,l.path)?l:b.start(e,v);m=b.string(e,{anchor:k,focus:x},{voids:i}),f=!0}}if(de.isText(D)){var E=P.equals(v,c.path);for(E?(g=a?c.offset:D.text.length-c.offset,h=c.offset):(g=D.text.length,h=a?g:0),(E||f||r==="offset")&&(yield{path:v,offset:h},f=!1);;){if(p===0){if(m==="")break;p=_(m,r,a),m=Ls(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 _(A,S,q){return S==="character"?$s(A,q):S==="word"?Jm(A,q):S==="line"||S==="block"?A.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=b.before(t,s,{voids:a});if(o){var[,l]=b.first(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(P.isPath(s)){var[c]=b.parent(t,s);i=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}}},yg=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},Dg=e=>{var t=qo.get(e);return t||(t=new Set,qo.set(e,t)),t},Cg=(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 fu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function xg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fu(Object(n),!0).forEach(function(r){it(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var wg=(e,t)=>{var{selection:n}=e;if(n){var r=(c,f)=>{if(!de.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)X.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=xg({},b.marks(e)||{});delete u[t],e.marks=u,ur.get(e)||e.onChange()}}},Eg=(e,t)=>{Uc.set(e,t)},_g=(e,t)=>b.point(e,t,{edge:"start"}),Bg=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: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},kg=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=b.above(t,{at:s,match:g=>ce.isElement(g)&&b.isBlock(t,g),voids:a}),l=o?o[1]:[],u=b.start(t,i),c={anchor:u,focus:s},f=!0;for(var[m,p]of b.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}},Ag=(e,t)=>{var n=b.isNormalizing(e);b.setNormalizing(e,!1);try{t()}finally{b.setNormalizing(e,n)}b.normalize(e)},Fg=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),Ce.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(P.isPath(u)){X.removeNodes(t,{at:u,voids:l});return}if(!W.isCollapsed(u)){if(!c){var[,D]=W.edges(u),v=b.end(t,[]);Ce.equals(D,v)||(u=b.unhangRange(t,u,{voids:l}))}var[x,k]=W.edges(u),E=b.above(t,{match:me=>ce.isElement(me)&&b.isBlock(t,me),at:x,voids:l}),_=b.above(t,{match:me=>ce.isElement(me)&&b.isBlock(t,me),at:k,voids:l}),A=E&&_&&!P.equals(E[1],_[1]),S=P.equals(x.path,k.path),q=l?null:(r=b.void(t,{at:x,mode:"highest"}))!==null&&r!==void 0?r:b.elementReadOnly(t,{at:x,mode:"highest"}),$=l?null:(a=b.void(t,{at:k,mode:"highest"}))!==null&&a!==void 0?a:b.elementReadOnly(t,{at:k,mode:"highest"});if(q){var j=b.before(t,x);j&&E&&P.isAncestor(E[1],j.path)&&(x=j)}if($){var N=b.after(t,k);N&&_&&P.isAncestor(_[1],N.path)&&(k=N)}var w=[],F;for(var R of b.nodes(t,{at:u,voids:l})){var[M,Y]=R;F&&P.compare(Y,F)===0||(!l&&ce.isElement(M)&&(b.isVoid(t,M)||b.isElementReadOnly(t,M))||!P.isCommon(Y,x.path)&&!P.isCommon(Y,k.path))&&(w.push(R),F=Y)}var K=Array.from(w,me=>{var[,_e]=me;return b.pathRef(t,_e)}),se=b.pointRef(t,x),ne=b.pointRef(t,k),y="";if(!S&&!q){var z=se.current,[J]=b.leaf(t,z),{path:B}=z,{offset:T}=x,L=J.text.slice(T);L.length>0&&(t.apply({type:"remove_text",path:B,offset:T,text:L}),y=L)}if(K.reverse().map(me=>me.unref()).filter(me=>me!==null).forEach(me=>X.removeNodes(t,{at:me,voids:l})),!$){var I=ne.current,[U]=b.leaf(t,I),{path:te}=I,ee=S?x.offset:0,Z=U.text.slice(ee,k.offset);Z.length>0&&(t.apply({type:"remove_text",path:te,offset:ee,text:Z}),y=Z)}!S&&A&&ne.current&&se.current&&X.mergeNodes(t,{at:ne.current,hanging:!0,voids:l}),f&&i&&s==="character"&&y.length>1&&y.match(/[\u0E00-\u0E7F]+/)&&X.insertText(t,y.slice(0,y.length-o));var ue=se.unref(),Q=ne.unref(),ge=i?ue||Q:Q||ue;n.at==null&&ge&&X.select(t,ge)}}})},Tg=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=Is(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);X.delete(t,{at:s}),s=u.unref()}else P.isPath(s)&&(s=b.start(t,s));if(!(!i&&b.void(t,{at:s}))){var c=b.above(t,{at:s,match:L=>ce.isElement(L)&&b.isInline(t,L),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:L=>ce.isElement(L)&&b.isBlock(t,L),at:s,voids:i}),[,h]=g,D=b.isStart(t,s,h),v=b.isEnd(t,s,h),x=D&&v,k=!D||D&&v,E=!v,[,_]=ie.first({children:n},[]),[,A]=ie.last({children:n},[]),S=[],q=L=>{var[I,U]=L,te=U.length===0;return te?!1:x?!0:!(k&&P.isAncestor(U,_)&&ce.isElement(I)&&!t.isVoid(I)&&!t.isInline(I)||E&&P.isAncestor(U,A)&&ce.isElement(I)&&!t.isVoid(I)&&!t.isInline(I))};for(var $ of ie.nodes({children:n},{pass:q}))q($)&&S.push($);var j=[],N=[],w=[],F=!0,R=!1;for(var[M]of S)ce.isElement(M)&&!t.isInline(M)?(F=!1,R=!0,N.push(M)):F?j.push(M):w.push(M);var[Y]=b.nodes(t,{at:s,match:L=>de.isText(L)||b.isInline(t,L),mode:"highest",voids:i}),[,K]=Y,se=b.isStart(t,s,K),ne=b.isEnd(t,s,K),y=b.pathRef(t,v&&!w.length?P.next(h):h),z=b.pathRef(t,ne?P.next(K):K);X.splitNodes(t,{at:s,match:L=>R?ce.isElement(L)&&b.isBlock(t,L):de.isText(L)||b.isInline(t,L),mode:R?"lowest":"highest",always:R&&(!D||j.length>0)&&(!v||w.length>0),voids:i});var J=b.pathRef(t,!se||se&&ne?P.next(K):K);if(X.insertNodes(t,j,{at:J.current,match:L=>de.isText(L)||b.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),x&&!j.length&&N.length&&!w.length&&X.delete(t,{at:h,voids:i}),X.insertNodes(t,N,{at:y.current,match:L=>ce.isElement(L)&&b.isBlock(t,L),mode:"lowest",voids:i,batchDirty:o}),X.insertNodes(t,w,{at:z.current,match:L=>de.isText(L)||b.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),!r.at){var B;if(w.length>0&&z.current?B=P.previous(z.current):N.length>0&&y.current?B=P.previous(y.current):J.current&&(B=P.previous(J.current)),B){var T=b.end(t,B);X.select(t,T)}}J.unref(),y.unref(),z.unref()}}})},Sg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")X.select(t,a.anchor);else if(r==="focus")X.select(t,a.focus);else if(r==="start"){var[i]=W.edges(a);X.select(t,i)}else if(r==="end"){var[,s]=W.edges(a);X.select(t,s)}}else return},jg=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},Og=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)}X.setSelection(t,f)}},Pg=(e,t)=>{var{selection:n}=e;if(t=b.range(e,t),n){X.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 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 Ng=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;X.setSelection(t,{[i==="anchor"?"anchor":"focus"]:mu(mu({},l),n)})}},Rg=(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})}},Mg=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(ie.isNode(n)&&(n=[n]),n.length!==0){var[f]=n;if(l||(l=Is(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);X.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)||b.isInline(t,j):u=j=>ce.isElement(j)&&b.isBlock(t,j));var[g]=b.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,h]=g,D=b.pathRef(t,h),v=b.isEnd(t,l,h);X.splitNodes(t,{at:l,match:u,mode:s,voids:i});var x=D.unref();l=v?P.next(x):x}else return}var k=P.parent(l),E=l[l.length-1];if(!(!i&&b.void(t,{at:k}))){if(o){var _=[],A=P.levels(k);Dp(t,()=>{var j=function(){var F=k.concat(E);E++;var R={type:"insert_node",path:F,node:N};t.apply(R),l=P.next(l),_.push(R),de.isText?A.push(...Array.from(ie.nodes(N),M=>{var[,Y]=M;return F.concat(Y)})):A.push(F)};for(var N of n)j()},()=>{Kc(t,A,j=>{var N=j;for(var w of _)if(P.operationCanTransformPath(w)&&(N=P.transform(N,w),!N))return null;return N})})}else for(var S of n){var q=k.concat(E);E++,t.apply({type:"insert_node",path:q,node:S}),l=P.next(l)}if(l=P.previous(l),c){var $=b.end(t,l);$&&X.select(t,$)}}}})},Ig=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=P.isPath(r)?Yn(t,r):E=>ce.isElement(E)&&b.isBlock(t,E)),!!r){var o=b.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,E=>{var[,_]=E;return b.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=b.node(t,P.parent(c)),[m,p]=f,g=c[c.length-1],{length:h}=m.children;if(h===1){var D=P.next(p);X.moveNodes(t,{at:c,to:D,voids:i}),X.removeNodes(t,{at:p,voids:i})}else if(g===0)X.moveNodes(t,{at:c,to:p,voids:i});else if(g===h-1){var v=P.next(p);X.moveNodes(t,{at:c,to:v,voids:i})}else{var x=P.next(c),k=P.next(p);X.splitNodes(t,{at:x,voids:i}),X.moveNodes(t,{at:c,to:k,voids:i})}}}})},$g=["text"],Lg=["children"],Zc=(e,t)=>{if(ce.isElement(t)){var n=t;return b.isVoid(e,t)?!0:n.children.length===1?Zc(e,n.children[0]):!1}else return!b.isEditor(t)},zg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(P.isPath(a)){var[l]=b.parent(t,a);r=j=>l.children.includes(j)}else r=j=>ce.isElement(j)&&b.isBlock(t,j);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);X.delete(t,{at:a}),a=c.unref(),n.at==null&&X.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,D]=m;if(!(g.length===0||D.length===0)){var v=P.next(D),x=P.common(g,D),k=P.isSibling(g,D),E=Array.from(b.levels(t,{at:g}),j=>{var[N]=j;return N}).slice(x.length).slice(0,-1),_=b.above(t,{at:g,mode:"highest",match:j=>E.includes(j)&&Zc(t,j)}),A=_&&b.pathRef(t,_[1]),S,q;if(de.isText(p)&&de.isText(h)){var $=qt(p,$g);q=h.text.length,S=$}else if(ce.isElement(p)&&ce.isElement(h)){var $=qt(p,Lg);q=h.children.length,S=$}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)));k||X.moveNodes(t,{at:g,to:v,voids:s}),A&&X.removeNodes(t,{at:A.current,voids:s}),ce.isElement(h)&&b.isEmpty(t,h)||de.isText(h)&&h.text===""&&D[D.length-1]!==0?X.removeNodes(t,{at:D,voids:s}):t.apply({type:"merge_node",path:v,position:q,properties:S}),A&&A.unref()}}}})},qg=(e,t)=>{b.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=P.isPath(r)?Yn(e,r):p=>ce.isElement(p)&&b.isBlock(e,p));var o=b.pathRef(e,n),l=b.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,p=>{var[,g]=p;return b.pathRef(e,g)});for(var c of u){var 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()}})},Wg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=P.isPath(s)?Yn(t,s):p=>ce.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})}}}})},Hg=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=P.isPath(i)?Yn(t,i):q=>ce.isElement(q)&&b.isBlock(t,q)),!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",D=b.isEnd(t,g,g.path);X.splitNodes(t,{at:g,match:a,mode:h,voids:f,always:!D});var v=b.isStart(t,p,p.path);X.splitNodes(t,{at:p,match:a,mode:h,voids:f,always:!v}),i=m.unref(),r.at==null&&X.select(t,i)}s||(s=(q,$)=>q!==$);for(var[x,k]of b.nodes(t,{at:i,match:a,mode:u,voids:f})){var E={},_={};if(k.length!==0){var A=!1;for(var S in n)S==="children"||S==="text"||s(n[S],x[S])&&(A=!0,x.hasOwnProperty(S)&&(E[S]=x[S]),o?n[S]!=null&&(_[S]=o(x[S],n[S])):n[S]!=null&&(_[S]=n[S]));A&&t.apply({type:"set_node",path:k,properties:E,newProperties:_})}}}})},Ug=(e,t)=>{if(W.isCollapsed(t))return t.anchor;var[,n]=W.edges(t),r=b.pointRef(e,n);return X.delete(e,{at:t}),r.unref()},Vg=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=>ce.isElement(ne)&&b.isBlock(t,ne)),W.isRange(s)&&(s=Ug(t,s)),P.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"}),D=0;if(!a&&h){var[v,x]=h;if(ce.isElement(v)&&t.isInline(v)){var k=b.after(t,x);if(!k){var E={text:""},_=P.next(x);X.insertNodes(t,E,{at:_,voids:a}),k=b.point(t,_)}s=k,l=!0}var A=s.path.length-x.length;o=A+1,l=!0}p=b.pointRef(t,s);var S=s.path.length-o,[,q]=g,$=s.path.slice(0,S),j=o===0?s.offset:s.path[S]+D;for(var[N,w]of b.levels(t,{at:$,reverse:!0,voids:a})){var F=!1;if(w.length<q.length||w.length===0||!a&&ce.isElement(N)&&b.isVoid(t,N))break;var R=m.current,M=b.isEnd(t,R,w);if(l||!m||!b.isEdge(t,R,w)){F=!0;var Y=ie.extractProps(N);t.apply({type:"split_node",path:w,position:j,properties:Y})}j=w[w.length-1]+(F||M?1:0)}if(n.at==null){var K=p.current||b.end(t,[]);X.select(t,K)}}finally{var se;m.unref(),(se=p)===null||se===void 0||se.unref()}}})},Kg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Array.isArray(n)||(n=[n]);var a={};for(var i of n)a[i]=null;X.setNodes(t,a,r)},Zg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=P.isPath(s)?Yn(t,s):p=>ce.isElement(p)&&b.isBlock(t,p)),P.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),D=b.range(t,g);a&&l&&(D=W.intersection(l.current,D)),X.liftNodes(t,{at:D,match:v=>ce.isAncestor(h)&&h.children.includes(v),voids:i})};for(var m of c)f();l&&l.unref()}})};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){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 Yg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(P.isPath(l)?o=Yn(t,l):t.isInline(n)?o=D=>ce.isElement(D)&&b.isInline(t,D)||de.isText(D):o=D=>ce.isElement(D)&&b.isBlock(t,D)),i&&W.isRange(l)){var[u,c]=W.edges(l),f=b.rangeRef(t,l,{affinity:"inward"});X.splitNodes(t,{at:c,match:o,voids:s}),X.splitNodes(t,{at:u,match:o,voids:s}),l=f.unref(),r.at==null&&X.select(t,l)}var m=Array.from(b.nodes(t,{at:l,match:t.isInline(n)?D=>ce.isElement(D)&&b.isBlock(t,D):D=>b.isEditor(D),mode:"lowest",voids:s})),p=function(){var 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[k]=x,E=x[x.length-1],[,_]=k,[,A]=E;if(_.length===0&&A.length===0)return 0;var S=P.equals(_,A)?P.parent(_):P.common(_,A),q=b.range(t,_,A),$=b.node(t,S),[j]=$,N=S.length+1,w=P.next(A.slice(0,N)),F=gu(gu({},n),{},{children:[]});X.insertNodes(t,F,{at:w,voids:s}),X.moveNodes(t,{at:q,match:R=>ce.isAncestor(j)&&j.children.includes(R),to:w.concat(0),voids:s})}},g;for(var[,h]of m)g=p()}})},Gg=()=>{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 Cp(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kp(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tp(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sp(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jp(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wp(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wp(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Up(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tg(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hp(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kp(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ep(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xp(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _p(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bp(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ap(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fp(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sg(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fg(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Op(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pp(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Np(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rp(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mp(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ig(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $p(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lp(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zp(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 Mg(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zp(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yp(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gp(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qp(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jp(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xp(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eg(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ng(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(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 sg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return og(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ug(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lg(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cg(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hg(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 fg(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gg(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mg(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pg(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vg(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 Cg(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hg(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kg(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zg(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ip(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yg(e,...r)}};return e},Qg={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))}},ui=new WeakMap,li=new WeakMap,Tn={isHistoryEditor(e){return Qg.isHistory(e.history)&&b.isEditor(e)},isMerging(e){return li.get(e)},isSaving(e){return ui.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Tn.isMerging(e);li.set(e,!1),t(),li.set(e,n)},withoutSaving(e,t){var n=Tn.isSaving(e);ui.set(e,!1),t(),ui.set(e,n)}},Jg=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&X.setSelection(t,i.selectionBefore),Tn.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];Tn.withoutSaving(t,()=>{b.withoutNormalizing(t,()=>{var s=i.operations.map(Yt.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&X.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=Tn.isSaving(t),c=Tn.isMerging(t);if(u==null&&(u=ev(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=Xg(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},Xg=(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)),ev=(e,t)=>e.type!=="set_selection",tv=av,Yc="֑-߿יִ-﷽ﹰ-ﻼ",Gc="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",nv=new RegExp("^[^"+Gc+"]*["+Yc+"]"),rv=new RegExp("^[^"+Yc+"]*["+Gc+"]");function av(e){return e=String(e||""),nv.test(e)?"rtl":rv.test(e)?"ltr":"neutral"}const Qc=bn(tv);function iv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var zs=iv,sv=typeof jr=="object"&&jr&&jr.Object===Object&&jr,ov=sv,uv=ov,lv=typeof self=="object"&&self&&self.Object===Object&&self,cv=uv||lv||Function("return this")(),Jc=cv,dv=Jc,fv=function(){return dv.Date.now()},hv=fv,mv=/\s/;function pv(e){for(var t=e.length;t--&&mv.test(e.charAt(t)););return t}var gv=pv,vv=gv,bv=/^\s+/;function yv(e){return e&&e.slice(0,vv(e)+1).replace(bv,"")}var Dv=yv,Cv=Jc,xv=Cv.Symbol,Xc=xv,vu=Xc,ed=Object.prototype,wv=ed.hasOwnProperty,Ev=ed.toString,er=vu?vu.toStringTag:void 0;function _v(e){var t=wv.call(e,er),n=e[er];try{e[er]=void 0;var r=!0}catch{}var a=Ev.call(e);return r&&(t?e[er]=n:delete e[er]),a}var Bv=_v,kv=Object.prototype,Av=kv.toString;function Fv(e){return Av.call(e)}var Tv=Fv,bu=Xc,Sv=Bv,jv=Tv,Ov="[object Null]",Pv="[object Undefined]",yu=bu?bu.toStringTag:void 0;function Nv(e){return e==null?e===void 0?Pv:Ov:yu&&yu in Object(e)?Sv(e):jv(e)}var Rv=Nv;function Mv(e){return e!=null&&typeof e=="object"}var Iv=Mv,$v=Rv,Lv=Iv,zv="[object Symbol]";function qv(e){return typeof e=="symbol"||Lv(e)&&$v(e)==zv}var Wv=qv,Hv=Dv,Du=zs,Uv=Wv,Cu=0/0,Vv=/^[-+]0x[0-9a-f]+$/i,Kv=/^0b[01]+$/i,Zv=/^0o[0-7]+$/i,Yv=parseInt;function Gv(e){if(typeof e=="number")return e;if(Uv(e))return Cu;if(Du(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Du(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Hv(e);var n=Kv.test(e);return n||Zv.test(e)?Yv(e.slice(2),n?2:8):Vv.test(e)?Cu:+e}var Qv=Gv,Jv=zs,ci=hv,xu=Qv,Xv="Expected a function",e0=Math.max,t0=Math.min;function n0(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(Xv);t=xu(t)||0,Jv(n)&&(c=!!n.leading,f="maxWait"in n,i=f?e0(xu(n.maxWait)||0,t):i,m="trailing"in n?!!n.trailing:m);function p(A){var S=r,q=a;return r=a=void 0,u=A,s=e.apply(q,S),s}function g(A){return u=A,o=setTimeout(v,t),c?p(A):s}function h(A){var S=A-l,q=A-u,$=t-S;return f?t0($,i-q):$}function D(A){var S=A-l,q=A-u;return l===void 0||S>=t||S<0||f&&q>=i}function v(){var A=ci();if(D(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 k(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function E(){return o===void 0?s:x(ci())}function _(){var A=ci(),S=D(A);if(r=arguments,a=this,l=A,S){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 _.cancel=k,_.flush=E,_}var td=n0;const r0=bn(td);var a0=td,i0=zs,s0="Expected a function";function o0(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(s0);return i0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),a0(e,t,{leading:r,maxWait:t,trailing:a})}var u0=o0;const l0=bn(u0),wu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Eu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",di=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Eu(n.overflowY,t)||Eu(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},Ir=(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,c0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},_u=(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:Y=>Y!==u;if(!wu(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let g=e;for(;wu(g)&&f(g);){if(g=c0(g),g===m){p.push(g);break}g!=null&&g===document.body&&di(g)&&!di(document.documentElement)||g!=null&&di(g,c)&&p.push(g)}const h=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,D=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:v,scrollY:x}=window,{height:k,width:E,top:_,right:A,bottom:S,left:q}=e.getBoundingClientRect(),{top:$,right:j,bottom:N,left:w}=(Y=>{const K=window.getComputedStyle(Y);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"?_-$:o==="end"?S+N:_+k/2-$+N,R=l==="center"?q+E/2-w+j:l==="end"?A+j:q-w;const M=[];for(let Y=0;Y<p.length;Y++){const K=p[Y],{height:se,width:ne,top:y,right:z,bottom:J,left:B}=K.getBoundingClientRect();if(s==="if-needed"&&_>=0&&q>=0&&S<=D&&A<=h&&_>=y&&S<=J&&q>=B&&A<=z)return M;const T=getComputedStyle(K),L=parseInt(T.borderLeftWidth,10),I=parseInt(T.borderTopWidth,10),U=parseInt(T.borderRightWidth,10),te=parseInt(T.borderBottomWidth,10);let ee=0,Z=0;const ue="offsetWidth"in K?K.offsetWidth-K.clientWidth-L-U:0,Q="offsetHeight"in K?K.offsetHeight-K.clientHeight-I-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-D:o==="nearest"?Ir(x,x+D,D,I,te,x+F,x+F+k,k):F-D/2,Z=l==="start"?R:l==="center"?R-h/2:l==="end"?R-h:Ir(v,v+h,h,L,U,v+R,v+R+E,E),ee=Math.max(0,ee+x),Z=Math.max(0,Z+v);else{ee=o==="start"?F-y-I:o==="end"?F-J+te+Q:o==="nearest"?Ir(y,J,se,I,te+Q,F,F+k,k):F-(y+se/2)+Q/2,Z=l==="start"?R-B-L:l==="center"?R-(B+ne/2)+ue/2:l==="end"?R-z+U+ue:Ir(B,z,ne,L,U+ue,R,R+E,E);const{scrollLeft:_e,scrollTop:Se}=K;ee=me===0?0:Math.max(0,Math.min(Se+ee/me,K.scrollHeight-se/me+Q)),Z=ge===0?0:Math.max(0,Math.min(_e+Z/ge,K.scrollWidth-ne/ge+ue)),F+=Se-ee,R+=_e-Z}M.push({el:K,top:ee,left:Z})}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 f0(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(_u(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of _u(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=[],h0=function(){return dn.some(function(e){return e.activeTargets.length>0})},m0=function(){return dn.some(function(e){return e.skippedTargets.length>0})},Bu="ResizeObserver loop completed with undelivered notifications.",p0=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Bu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Bu),window.dispatchEvent(e)},yr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(yr||(yr={}));var fn=function(e){return Object.freeze(e)},g0=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,fn(this)}return e}(),nd=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}(),qs=function(e){return e instanceof SVGElement&&"getBBox"in e},rd=function(e){if(qs(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)},ku=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)},v0=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},lr=typeof window<"u"?window:{},$r=new WeakMap,Au=/auto|scroll/,b0=/^tb|vertical/,y0=/msie|trident/i.test(lr.navigator&&lr.navigator.userAgent),Bt=function(e){return parseFloat(e||"0")},Nn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new g0((n?t:e)||0,(n?e:t)||0)},Fu=fn({devicePixelContentBoxSize:Nn(),borderBoxSize:Nn(),contentBoxSize:Nn(),contentRect:new nd(0,0,0,0)}),ad=function(e,t){if(t===void 0&&(t=!1),$r.has(e)&&!t)return $r.get(e);if(rd(e))return $r.set(e,Fu),Fu;var n=getComputedStyle(e),r=qs(e)&&e.ownerSVGElement&&e.getBBox(),a=!y0&&n.boxSizing==="border-box",i=b0.test(n.writingMode||""),s=!r&&Au.test(n.overflowY||""),o=!r&&Au.test(n.overflowX||""),l=r?0:Bt(n.paddingTop),u=r?0:Bt(n.paddingRight),c=r?0:Bt(n.paddingBottom),f=r?0:Bt(n.paddingLeft),m=r?0:Bt(n.borderTopWidth),p=r?0:Bt(n.borderRightWidth),g=r?0:Bt(n.borderBottomWidth),h=r?0:Bt(n.borderLeftWidth),D=f+u,v=l+c,x=h+p,k=m+g,E=o?e.offsetHeight-k-e.clientHeight:0,_=s?e.offsetWidth-x-e.clientWidth:0,A=a?D+x:0,S=a?v+k:0,q=r?r.width:Bt(n.width)-A-_,$=r?r.height:Bt(n.height)-S-E,j=q+D+_+x,N=$+v+E+k,w=fn({devicePixelContentBoxSize:Nn(Math.round(q*devicePixelRatio),Math.round($*devicePixelRatio),i),borderBoxSize:Nn(j,N,i),contentBoxSize:Nn(q,$,i),contentRect:new nd(f,l,q,$)});return $r.set(e,w),w},id=function(e,t,n){var r=ad(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case yr.DEVICE_PIXEL_CONTENT_BOX:return s;case yr.BORDER_BOX:return a;default:return i}},D0=function(){function e(t){var n=ad(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}(),sd=function(e){if(rd(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},C0=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 D0(u.target),f=sd(u.target);o.push(c),u.lastReportedSize=id(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},Tu=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()&&(sd(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},x0=function(){var e=0;for(Tu(e);h0();)e=C0(),Tu(e);return m0()&&p0(),e>0},fi,od=[],w0=function(){return od.splice(0).forEach(function(e){return e()})},E0=function(e){if(!fi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return w0()}).observe(n,r),fi=function(){n.textContent="".concat(t?t--:t++)}}od.push(e),fi()},_0=function(e){E0(function(){requestAnimationFrame(e)})},na=0,B0=function(){return!!na},k0=250,A0={attributes:!0,characterData:!0,childList:!0,subtree:!0},Su=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],ju=function(e){return e===void 0&&(e=0),Date.now()+e},hi=!1,F0=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=k0),!hi){hi=!0;var r=ju(t);_0(function(){var a=!1;try{a=x0()}finally{if(hi=!1,t=r-ju(),!B0())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,A0)};document.body?n():lr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Su.forEach(function(n){return lr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Su.forEach(function(n){return lr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),is=new F0,Ou=function(e){!na&&e>0&&is.start(),na+=e,!na&&is.stop()},T0=function(e){return!qs(e)&&!v0(e)&&getComputedStyle(e).display==="inline"},S0=function(){function e(t,n){this.target=t,this.observedBox=n||yr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=id(this.target,this.observedBox,!0);return T0(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),j0=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Lr=new WeakMap,Pu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},zr=function(){function e(){}return e.connect=function(t,n){var r=new j0(t,n);Lr.set(t,r)},e.observe=function(t,n,r){var a=Lr.get(t),i=a.observationTargets.length===0;Pu(a.observationTargets,n)<0&&(i&&dn.push(a),a.observationTargets.push(new S0(n,r&&r.box)),Ou(1),is.schedule())},e.unobserve=function(t,n){var r=Lr.get(t),a=Pu(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&dn.splice(dn.indexOf(r),1),r.observationTargets.splice(a,1),Ou(-1))},e.disconnect=function(t){var n=this,r=Lr.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),O0=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.");zr.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(!ku(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");zr.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(!ku(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");zr.unobserve(this,t)},e.prototype.disconnect=function(){zr.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();function P0(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function zn(e,t){if(e==null)return{};var n=P0(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 Dr(e){"@babel/helpers - typeof";return Dr=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},Dr(e)}function N0(e,t){if(Dr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Dr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function R0(e){var t=N0(e,"string");return Dr(t)==="symbol"?t:String(t)}function Dt(e,t,n){return t=R0(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ws=C.createContext(null),nn=()=>{var e=C.useContext(Ws);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},ud=parseInt(C.version.split(".")[0],10),M0=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Nu=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),at=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Sn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),sr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),I0=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),ld=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),$0=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),L0=at&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),z0=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),W0=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ra=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ht=(!$0||!L0)&&!I0&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Hs=new WeakMap,Us=new WeakMap,cd=new WeakMap,aa=new WeakMap,ss=new WeakMap,Cr=new WeakMap,hn=new WeakMap,ba=new WeakMap,$a=new WeakMap,os=new WeakMap,Gt=new WeakMap,ln=new WeakMap,cr=new WeakMap,us=new WeakMap,Vs=new WeakMap,wt=new WeakMap,$t=new WeakMap,ut=new WeakMap,Vt=new WeakMap,Kt=new WeakMap,dd=new WeakMap,qn=Symbol("placeholder"),fd=Symbol("mark-placeholder"),H0=globalThis.Text,Ks=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,U0=e=>Jt(e)&&e.nodeType===8,yt=e=>Jt(e)&&e.nodeType===1,Jt=e=>{var t=Ks(e);return!!t&&e instanceof t.Node},ls=e=>{var t=e&&e.anchorNode&&Ks(e.anchorNode);return!!t&&e instanceof t.Selection},hd=e=>Jt(e)&&e.nodeType===3,V0=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,K0=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]=md(t,a,r?"backward":"forward"),r=a<n;yt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=Y0(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},Z0=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},md=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(U0(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]},Y0=(e,t,n)=>{var[r]=md(e,t,n);return r},pd=e=>{var t="";if(hd(e)&&e.nodeValue)return e.nodeValue;if(yt(e)){for(var n of Array.from(e.childNodes))t+=pd(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
|
|
103
|
-
`)}return t},
|
|
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 Vc=Symbol.for("immer-nothing"),Mo=Symbol.for("immer-draftable"),mt=Symbol.for("immer-state"),Am=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=Am[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?Kc(e)||Array.isArray(e)||!!e[Mo]||!!((t=e.constructor)!=null&&t[Mo])||$a(e)||La(e):!1}var Fm=Object.prototype.constructor.toString();function Kc(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)===Fm}function ga(e,t){Ia(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Ia(e){const t=e[mt];return t?t.type_:Array.isArray(e)?1:$a(e)?2:La(e)?3:0}function ns(e,t){return Ia(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Zc(e,t,n){const r=Ia(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Tm(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function $a(e){return e instanceof Map}function La(e){return e instanceof Set}function sn(e){return e.copy_||e.base_}function rs(e,t){if($a(e))return new Map(e);if(La(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Kc(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 za(e)||mn(e)||!pn(e)||(Ia(e)>1&&(e.set=e.add=e.clear=e.delete=Sm),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Is(r,!0))),e}function Sm(){lt(2)}function za(e){return Object.isFrozen(e)}var jm={};function gn(e){const t=jm[e];return t||lt(0,e),t}var Dr;function Yc(){return Dr}function Om(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(Pm),e.drafts_=null}function is(e){e===Dr&&(Dr=e.parent_)}function $o(e){return Dr=Om(Dr,e)}function Pm(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=va(t,e),t.parent_||ba(t,e)),t.patches_&&gn("Patches").generateReplacementPatches_(n[mt].base_,e,t.patches_,t.inversePatches_)):e=va(t,n,[]),as(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Vc?e:void 0}function va(e,t,n){if(za(t))return t;const r=t[mt];if(!r)return ga(t,(a,i)=>zo(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return ba(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),ga(i,(o,l)=>zo(e,r,a,o,l,n,s)),ba(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=va(e,a,o);if(Zc(n,r,l),mn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(pn(a)&&!za(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;va(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&ba(e,a)}}function ba(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Is(t,n)}function Nm(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Yc(),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=Cr);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 Rm(e,n,t);const r=n[t];return e.finalized_||!pn(r)?r:r===ui(e.base_,t)?(li(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=Gc(sn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=ui(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(Tm(n,a)&&(n!==void 0||ns(e.base_,t)))return!0;li(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 ui(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,li(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)}},Cr={};ga($s,(e,t)=>{Cr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Cr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&<(13),Cr.set.call(this,e,t,void 0)};Cr.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 ui(e,t){const n=e[mt];return(n?sn(n):e)[t]}function Rm(e,t,n){var a;const r=Gc(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Gc(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 li(e){e.copy_||(e.copy_=rs(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Mm=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===Vc&&(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=Im(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=$a(e)?gn("MapSet").proxyMap_(e,t):La(e)?gn("MapSet").proxySet_(e,t):Nm(e,t);return(t?t.scope_:Yc()).drafts_.push(n),n}function Im(e){return mn(e)||lt(10,e),Qc(e)}function Qc(e){if(!pn(e)||za(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 ga(n,(r,a)=>{Zc(n,r,Qc(a))}),t&&(t.finalized_=!1),n}var pt=new Mm,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),$m={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()}}},Lm={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()}}},zm={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()}}},ya=new WeakMap,Da=new WeakMap,dr=new WeakMap,Jc=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 xr(e){"@babel/helpers - typeof";return xr=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},xr(e)}function qm(e,t){if(xr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(xr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Wm(e){var t=qm(e,"string");return xr(t)==="symbol"?t:String(t)}function it(e,t,n){return t=Wm(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 Hm=(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,D]of W.points(t))t[D]=Ce.transform(h,n);break}case"merge_node":{var{path:b}=n,x=ie.get(e,b),A=P.previous(b),_=ie.get(e,A),E=ie.parent(e,b),k=b[b.length-1];if(de.isText(x)&&de.isText(_))_.text+=x.text;else if(!de.isText(x)&&!de.isText(_))_.children.push(...x.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(b,"] to nodes of different interfaces: ").concat(Ye.stringify(x)," ").concat(Ye.stringify(_)));if(E.children.splice(k,1),t)for(var[F,z]of W.points(t))t[z]=Ce.transform(F,n);break}case"move_node":{var{path:$,newPath:j}=n;if(P.isAncestor($,j))throw new Error("Cannot move a path [".concat($,"] to new path [").concat(j,"] because the destination is inside itself."));var N=ie.get(e,$),w=ie.parent(e,$),T=$[$.length-1];w.children.splice(T,1);var R=P.transform($,n),M=ie.get(e,P.parent(R)),Y=R[R.length-1];if(M.children.splice(Y,0,N),t)for(var[K,se]of W.points(t))t[se]=Ce.transform(K,n);break}case"remove_node":{var{path:ne}=n,y=ne[ne.length-1],q=ie.parent(e,ne);if(q.children.splice(y,1),t)for(var[X,B]of W.points(t)){var S=Ce.transform(X,n);if(t!=null&&S!=null)t[B]=S;else{var L=void 0,I=void 0;for(var[U,te]of ie.texts(e))if(P.compare(te,ne)===-1)L=[U,te];else{I=[U,te];break}var ee=!1;L&&I&&(P.equals(I[1],ne)?ee=!P.hasPrevious(I[1]):ee=P.common(L[1],ne).length<P.common(I[1],ne).length),L&&!ee?(X.path=L[1],X.offset=L[0].text.length):I?(X.path=I[1],X.offset=0):t=null}}break}case"remove_text":{var{path:Z,offset:ue,text:J}=n;if(J.length===0)break;var ge=ie.leaf(e,Z),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),Ga=Ve.children.slice(De);Ve.children=ht,xt=nr(nr({},Ue),{},{children:Ga})}if(ft.children.splice(Pt+1,0,xt),t)for(var[Xn,Pr]of W.points(t))t[Pr]=Ce.transform(Xn,n);break}}return t},Um={transform(e,t){e.children=qo(e.children);var n=e.selection&&qo(e.selection);try{n=Hm(e,n,t)}finally{e.children=Wo(e.children),n?e.selection=mn(n)?Wo(n):n:e.selection=null}}},Vm={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)}},Km={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)}},Xc=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(Je(r)&&Je(a)){if(!Xc(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 Zm(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=Zm(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 Ym=["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 Gm(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,Ym),[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:Gm({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}},Qm=["children"],Jm=["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,Qm);return t}else{var t=qt(e,Jm);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,Xm=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 Xm(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)}},ep={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)}},tp=["text"],np=["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,tp);return s}return Xc(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,np),[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,D=void 0;if(c<l){var b=c-p;D=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),D&&o.push(D)}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?up(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=Dp(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=_p(t.substring(0,t.length-o)),!u)||i!==ye.None&&s!==ye.None&&xp(i,s))break;o+=c.length}return o||1},rp=/\s/,ap=/[\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]/,ip=/['\u2018\u2019]/,sp=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(op(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)]},op=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(rp.test(t))return!1;if(ip.test(t)){var a=qs(n,r),[i,s]=Ws(n,a,r);if(e(i,s,r))return!0}return!ap.test(t)},up=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(cp(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(lp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},lp=e=>e>=55296&&e<=56319,cp=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 dp=/^(?:[\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])$/,fp=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,hp=/^(?:[\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])$/,mp=/^[\u1100-\u115F\uA960-\uA97C]$/,pp=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,gp=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,vp=/^[\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]$/,bp=/^[\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]$/,yp=/^(?:[\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])$/,Dp=(e,t)=>{var n=ye.Any;return e.search(dp)!==-1&&(n|=ye.Extend),t===8205&&(n|=ye.ZWJ),t>=127462&&t<=127487&&(n|=ye.RI),e.search(fp)!==-1&&(n|=ye.Prepend),e.search(hp)!==-1&&(n|=ye.SpacingMark),e.search(mp)!==-1&&(n|=ye.L),e.search(pp)!==-1&&(n|=ye.V),e.search(gp)!==-1&&(n|=ye.T),e.search(vp)!==-1&&(n|=ye.LV),e.search(bp)!==-1&&(n|=ye.LVT),e.search(yp)!==-1&&(n|=ye.ExtPict),n};function Sn(e,t){return(e&t)!==0}var Cp=[[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 xp(e,t){return Cp.findIndex(n=>Sn(e,n[0])&&Sn(t,n[1]))===-1}var wp=/(?:[\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(wp)!==-1,Ep=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,_p=e=>{var t=e.match(Ep);if(t===null)return!1;var n=t[0].length/2;return n%2===1},kp={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);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&&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 Lr(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 Q=Lr(Lr(Lr(Lr({},Um),Vm),Km),kp),aa=new WeakMap,Bp=e=>aa.get(e)||!1,Ap=(e,t,n)=>{var r=aa.get(e)||!1;aa.set(e,!0);try{t(),n()}finally{aa.set(e,r)}};function ed(e,t,n){var r=ya.get(e)||[],a=Da.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);ya.set(e,i),Da.set(e,s)}var Fp=(e,t)=>{for(var n of v.pathRefs(e))$m.transform(n,t);for(var r of v.pointRefs(e))Lm.transform(r,t);for(var a of v.rangeRefs(e))zm.transform(a,t);if(!Bp(e)){var i=P.operationCanTransformPath(t)?s=>P.transform(s,t):void 0;ed(e,e.getDirtyPaths(t),i)}Q.transform(e,t),e.operations.push(t),v.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),dr.get(e)||(dr.set(e,!0),Promise.resolve().then(()=>{dr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Tp=(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[,N]=j;return a.concat(N)});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 D of P.ancestors(f)){var b=P.transform(D,t);p.push(b)}var x=p[p.length-1],A=f[f.length-1],_=x.concat(A);return[...m,...p,_]}case"remove_node":{var{path:E}=t,k=P.ancestors(E);return[...k]}case"split_node":{var{path:F}=t,z=P.levels(F),$=P.next(F);return[...z,$]}default:return[]}},Sp=e=>{var{selection:t}=e;return t?ie.fragment(e,t):[]},jp=(e,t)=>{var[n,r]=t;if(!de.isText(n)){if(ce.isElement(n)&&n.children.length===0){var a={text:""};Q.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)Q.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:""};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&&de.isText(c)&&(de.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--))}}}},Op=(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},Pp=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 Np=(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)Q.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=su(su({},v.marks(e)||{}),{},{[t]:n});e.marks=c,dr.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 Rp=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 Mp=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},Ip=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&Q.delete(e,{unit:t,reverse:!0})},$p=(e,t)=>{var{selection:n}=e;n&&W.isCollapsed(n)&&Q.delete(e,{unit:t})},Lp=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"})},zp=(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 qp=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)}))},Wp=(e,t)=>v.point(e,t,{edge:"end"}),Hp=(e,t)=>{var n=v.path(e,t,{edge:"start"});return v.node(e,n)},Up=(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 Vp=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)}))},Kp=(e,t)=>t.children.some(n=>ce.isElement(n)&&v.isBlock(e,n)),Zp=(e,t)=>t.children.some(n=>de.isText(n)||v.isInline(e,n)),Yp=(e,t)=>ie.has(e,t),Gp=(e,t)=>t.children.every(n=>de.isText(n)),Qp=e=>{Q.splitNodes(e,{always:!0})},Jp=(e,t,n)=>{Q.insertNodes(e,t,n)},Xp=e=>{Q.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 eg(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 tg=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=eg({text:n},i);Q.insertNodes(t,s,{at:r.at,voids:r.voids})}else Q.insertText(t,n,r);t.marks=null}},ng=(e,t)=>!e.isInline(t),rg=(e,t,n)=>v.isStart(e,t,n)||v.isEnd(e,t,n),ag=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&de.isText(r)&&r.text===""&&!e.isVoid(t)},ig=(e,t,n)=>{var r=v.end(e,n);return Ce.equals(t,r)},sg=e=>{var t=Jc.get(e);return t===void 0?!0:t},og=(e,t,n)=>{if(t.offset!==0)return!1;var r=v.start(e,n);return Ce.equals(t,r)},ug=(e,t)=>{var n=v.path(e,t,{edge:"end"});return v.node(e,n)},lg=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 cg(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 dg=["text"],fg=["text"],hg=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,dg);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:_=>ce.isElement(_)&&v.isVoid(t,_)&&t.markableVoid(_)});if(!g){var h=v.above(t,{match:_=>ce.isElement(_)&&v.isBlock(t,_)});if(p&&h){var[D,b]=p,[,x]=h;P.isAncestor(x,b)&&(m=D)}}}var A=qt(m,fg);return A},mg=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}}},pg=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 gg(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(ep.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:_=>{var[E]=_;return ce.isElement(E)?!!(!s&&(v.isVoid(e,E)||v.isElementReadOnly(e,E))||o&&!v.isSelectable(e,E)):!1}}),g=[],h;for(var[D,b]of p)if(!(o&&ce.isElement(D)&&!v.isSelectable(e,D))){var x=h&&P.compare(b,h[1])===0;if(!(r==="highest"&&x)){if(!l(D,b)){if(a&&!x&&de.isText(D))return;continue}if(r==="lowest"&&x){h=[D,b];continue}var A=r==="lowest"?h:[D,b];A&&(a?g.push(A):yield A),h=[D,b]}}r==="lowest"&&h&&(a?g.push(h):yield h),a&&(yield*g)}}()}var vg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>ya.get(c)||[],s=c=>Da.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(",")));ya.set(t,l),Da.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,D=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:D,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})}D++,g=i(t)}})}},bg=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},yg=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},Dg=e=>{var t=Ho.get(e);return t||(t=new Set,Ho.set(e,t)),t},Cg=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},xg=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},wg=e=>{var t=Uo.get(e);return t||(t=new Set,Uo.set(e,t)),t},Eg=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 _g(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[D,b]of v.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(ce.isElement(D)){if(!i&&(e.isVoid(D)||e.isElementReadOnly(D))){yield v.start(e,b);continue}if(e.isInline(D))continue;if(v.hasInlines(e,D)){var x=P.isAncestor(b,u.path)?u:v.end(e,b),A=P.isAncestor(b,l.path)?l:v.start(e,b);m=v.string(e,{anchor:A,focus:x},{voids:i}),f=!0}}if(de.isText(D)){var _=P.equals(b,c.path);for(_?(g=a?c.offset:D.text.length-c.offset,h=c.offset):(g=D.text.length,h=a?g:0),(_||f||r==="offset")&&(yield{path:b,offset:h},f=!1);;){if(p===0){if(m==="")break;p=E(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 E(k,F,z){return F==="character"?qs(k,z):F==="word"?sp(k,z):F==="line"||F==="block"?k.length:1}}()}var kg=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}}},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=v.rangeRefs(t);return l.delete(i),i.current=null,o}},s=v.rangeRefs(t);return s.add(i),i},Ag=e=>{var t=Vo.get(e);return t||(t=new Set,Vo.set(e,t)),t},Fg=(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 Tg(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 Sg=(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)Q.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Tg({},v.marks(e)||{});delete u[t],e.marks=u,dr.get(e)||e.onChange()}}},jg=(e,t)=>{Jc.set(e,t)},Og=(e,t)=>v.point(e,t,{edge:"start"}),Pg=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},Ng=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}},Rg=(e,t)=>{var n=v.isNormalizing(e);v.setNormalizing(e,!1);try{t()}finally{v.setNormalizing(e,n)}v.normalize(e)},Mg=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)){Q.removeNodes(t,{at:u,voids:l});return}if(!W.isCollapsed(u)){if(!c){var[,D]=W.edges(u),b=v.end(t,[]);Ce.equals(D,b)||(u=v.unhangRange(t,u,{voids:l}))}var[x,A]=W.edges(u),_=v.above(t,{match:me=>ce.isElement(me)&&v.isBlock(t,me),at:x,voids:l}),E=v.above(t,{match:me=>ce.isElement(me)&&v.isBlock(t,me),at:A,voids:l}),k=_&&E&&!P.equals(_[1],E[1]),F=P.equals(x.path,A.path),z=l?null:(r=v.void(t,{at:x,mode:"highest"}))!==null&&r!==void 0?r:v.elementReadOnly(t,{at:x,mode:"highest"}),$=l?null:(a=v.void(t,{at:A,mode:"highest"}))!==null&&a!==void 0?a:v.elementReadOnly(t,{at:A,mode:"highest"});if(z){var j=v.before(t,x);j&&_&&P.isAncestor(_[1],j.path)&&(x=j)}if($){var N=v.after(t,A);N&&E&&P.isAncestor(E[1],N.path)&&(A=N)}var w=[],T;for(var R of v.nodes(t,{at:u,voids:l})){var[M,Y]=R;T&&P.compare(Y,T)===0||(!l&&ce.isElement(M)&&(v.isVoid(t,M)||v.isElementReadOnly(t,M))||!P.isCommon(Y,x.path)&&!P.isCommon(Y,A.path))&&(w.push(R),T=Y)}var K=Array.from(w,me=>{var[,_e]=me;return v.pathRef(t,_e)}),se=v.pointRef(t,x),ne=v.pointRef(t,A),y="";if(!F&&!z){var q=se.current,[X]=v.leaf(t,q),{path:B}=q,{offset:S}=x,L=X.text.slice(S);L.length>0&&(t.apply({type:"remove_text",path:B,offset:S,text:L}),y=L)}if(K.reverse().map(me=>me.unref()).filter(me=>me!==null).forEach(me=>Q.removeNodes(t,{at:me,voids:l})),!$){var I=ne.current,[U]=v.leaf(t,I),{path:te}=I,ee=F?x.offset:0,Z=U.text.slice(ee,A.offset);Z.length>0&&(t.apply({type:"remove_text",path:te,offset:ee,text:Z}),y=Z)}!F&&k&&ne.current&&se.current&&Q.mergeNodes(t,{at:ne.current,hanging:!0,voids:l}),f&&i&&s==="character"&&y.length>1&&y.match(/[\u0E00-\u0E7F]+/)&&Q.insertText(t,y.slice(0,y.length-o));var ue=se.unref(),J=ne.unref(),ge=i?ue||J:J||ue;n.at==null&&ge&&Q.select(t,ge)}}})},Ig=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);Q.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:L=>ce.isElement(L)&&v.isInline(t,L),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:L=>ce.isElement(L)&&v.isBlock(t,L),at:s,voids:i}),[,h]=g,D=v.isStart(t,s,h),b=v.isEnd(t,s,h),x=D&&b,A=!D||D&&b,_=!b,[,E]=ie.first({children:n},[]),[,k]=ie.last({children:n},[]),F=[],z=L=>{var[I,U]=L,te=U.length===0;return te?!1:x?!0:!(A&&P.isAncestor(U,E)&&ce.isElement(I)&&!t.isVoid(I)&&!t.isInline(I)||_&&P.isAncestor(U,k)&&ce.isElement(I)&&!t.isVoid(I)&&!t.isInline(I))};for(var $ of ie.nodes({children:n},{pass:z}))z($)&&F.push($);var j=[],N=[],w=[],T=!0,R=!1;for(var[M]of F)ce.isElement(M)&&!t.isInline(M)?(T=!1,R=!0,N.push(M)):T?j.push(M):w.push(M);var[Y]=v.nodes(t,{at:s,match:L=>de.isText(L)||v.isInline(t,L),mode:"highest",voids:i}),[,K]=Y,se=v.isStart(t,s,K),ne=v.isEnd(t,s,K),y=v.pathRef(t,b&&!w.length?P.next(h):h),q=v.pathRef(t,ne?P.next(K):K);Q.splitNodes(t,{at:s,match:L=>R?ce.isElement(L)&&v.isBlock(t,L):de.isText(L)||v.isInline(t,L),mode:R?"lowest":"highest",always:R&&(!D||j.length>0)&&(!b||w.length>0),voids:i});var X=v.pathRef(t,!se||se&&ne?P.next(K):K);if(Q.insertNodes(t,j,{at:X.current,match:L=>de.isText(L)||v.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),x&&!j.length&&N.length&&!w.length&&Q.delete(t,{at:h,voids:i}),Q.insertNodes(t,N,{at:y.current,match:L=>ce.isElement(L)&&v.isBlock(t,L),mode:"lowest",voids:i,batchDirty:o}),Q.insertNodes(t,w,{at:q.current,match:L=>de.isText(L)||v.isInline(t,L),mode:"highest",voids:i,batchDirty:o}),!r.at){var B;if(w.length>0&&q.current?B=P.previous(q.current):N.length>0&&y.current?B=P.previous(y.current):X.current&&(B=P.previous(X.current)),B){var S=v.end(t,B);Q.select(t,S)}}X.unref(),y.unref(),q.unref()}}})},$g=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},Lg=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},zg=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)}Q.setSelection(t,f)}},qg=(e,t)=>{var{selection:n}=e;if(t=v.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(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 Wg=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"]:bu(bu({},l),n)})}},Hg=(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})}},Ug=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);Q.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,D=v.pathRef(t,h),b=v.isEnd(t,l,h);Q.splitNodes(t,{at:l,match:u,mode:s,voids:i});var x=D.unref();l=b?P.next(x):x}else return}var A=P.parent(l),_=l[l.length-1];if(!(!i&&v.void(t,{at:A}))){if(o){var E=[],k=P.levels(A);Ap(t,()=>{var j=function(){var T=A.concat(_);_++;var R={type:"insert_node",path:T,node:N};t.apply(R),l=P.next(l),E.push(R),de.isText?k.push(...Array.from(ie.nodes(N),M=>{var[,Y]=M;return T.concat(Y)})):k.push(T)};for(var N of n)j()},()=>{ed(t,k,j=>{var N=j;for(var w of E)if(P.operationCanTransformPath(w)&&(N=P.transform(N,w),!N))return null;return N})})}else for(var F of n){var z=A.concat(_);_++,t.apply({type:"insert_node",path:z,node:F}),l=P.next(l)}if(l=P.previous(l),c){var $=v.end(t,l);$&&Q.select(t,$)}}}})},Vg=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):_=>ce.isElement(_)&&v.isBlock(t,_)),!!r){var o=v.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,_=>{var[,E]=_;return v.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=v.node(t,P.parent(c)),[m,p]=f,g=c[c.length-1],{length:h}=m.children;if(h===1){var D=P.next(p);Q.moveNodes(t,{at:c,to:D,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 b=P.next(p);Q.moveNodes(t,{at:c,to:b,voids:i})}else{var x=P.next(c),A=P.next(p);Q.splitNodes(t,{at:x,voids:i}),Q.moveNodes(t,{at:c,to:A,voids:i})}}}})},Kg=["text"],Zg=["children"],td=(e,t)=>{if(ce.isElement(t)){var n=t;return v.isVoid(e,t)?!0:n.children.length===1?td(e,n.children[0]):!1}else return!v.isEditor(t)},Yg=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);Q.delete(t,{at:a}),a=c.unref(),n.at==null&&Q.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,D]=m;if(!(g.length===0||D.length===0)){var b=P.next(D),x=P.common(g,D),A=P.isSibling(g,D),_=Array.from(v.levels(t,{at:g}),j=>{var[N]=j;return N}).slice(x.length).slice(0,-1),E=v.above(t,{at:g,mode:"highest",match:j=>_.includes(j)&&td(t,j)}),k=E&&v.pathRef(t,E[1]),F,z;if(de.isText(p)&&de.isText(h)){var $=qt(p,Kg);z=h.text.length,F=$}else if(ce.isElement(p)&&ce.isElement(h)){var $=qt(p,Zg);z=h.children.length,F=$}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)));A||Q.moveNodes(t,{at:g,to:b,voids:s}),k&&Q.removeNodes(t,{at:k.current,voids:s}),ce.isElement(h)&&v.isEmpty(t,h)||de.isText(h)&&h.text===""&&D[D.length-1]!==0?Q.removeNodes(t,{at:D,voids:s}):t.apply({type:"merge_node",path:b,position:z,properties:F}),k&&k.unref()}}}})},Gg=(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()}})},Qg=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})}}}})},Jg=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):z=>ce.isElement(z)&&v.isBlock(t,z)),!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",D=v.isEnd(t,g,g.path);Q.splitNodes(t,{at:g,match:a,mode:h,voids:f,always:!D});var b=v.isStart(t,p,p.path);Q.splitNodes(t,{at:p,match:a,mode:h,voids:f,always:!b}),i=m.unref(),r.at==null&&Q.select(t,i)}s||(s=(z,$)=>z!==$);for(var[x,A]of v.nodes(t,{at:i,match:a,mode:u,voids:f})){var _={},E={};if(A.length!==0){var k=!1;for(var F in n)F==="children"||F==="text"||s(n[F],x[F])&&(k=!0,x.hasOwnProperty(F)&&(_[F]=x[F]),o?n[F]!=null&&(E[F]=o(x[F],n[F])):n[F]!=null&&(E[F]=n[F]));k&&t.apply({type:"set_node",path:A,properties:_,newProperties:E})}}}})},Xg=(e,t)=>{if(W.isCollapsed(t))return t.anchor;var[,n]=W.edges(t),r=v.pointRef(e,n);return Q.delete(e,{at:t}),r.unref()},ev=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=Xg(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"}),D=0;if(!a&&h){var[b,x]=h;if(ce.isElement(b)&&t.isInline(b)){var A=v.after(t,x);if(!A){var _={text:""},E=P.next(x);Q.insertNodes(t,_,{at:E,voids:a}),A=v.point(t,E)}s=A,l=!0}var k=s.path.length-x.length;o=k+1,l=!0}p=v.pointRef(t,s);var F=s.path.length-o,[,z]=g,$=s.path.slice(0,F),j=o===0?s.offset:s.path[F]+D;for(var[N,w]of v.levels(t,{at:$,reverse:!0,voids:a})){var T=!1;if(w.length<z.length||w.length===0||!a&&ce.isElement(N)&&v.isVoid(t,N))break;var R=m.current,M=v.isEnd(t,R,w);if(l||!m||!v.isEdge(t,R,w)){T=!0;var Y=ie.extractProps(N);t.apply({type:"split_node",path:w,position:j,properties:Y})}j=w[w.length-1]+(T||M?1:0)}if(n.at==null){var K=p.current||v.end(t,[]);Q.select(t,K)}}finally{var se;m.unref(),(se=p)===null||se===void 0||se.unref()}}})},tv=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)},nv=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),D=v.range(t,g);a&&l&&(D=W.intersection(l.current,D)),Q.liftNodes(t,{at:D,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 rv=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=D=>ce.isElement(D)&&v.isInline(t,D)||de.isText(D):o=D=>ce.isElement(D)&&v.isBlock(t,D)),i&&W.isRange(l)){var[u,c]=W.edges(l),f=v.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(v.nodes(t,{at:l,match:t.isInline(n)?D=>ce.isElement(D)&&v.isBlock(t,D):D=>v.isEditor(D),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[A]=x,_=x[x.length-1],[,E]=A,[,k]=_;if(E.length===0&&k.length===0)return 0;var F=P.equals(E,k)?P.parent(E):P.common(E,k),z=v.range(t,E,k),$=v.node(t,F),[j]=$,N=F.length+1,w=P.next(k.slice(0,N)),T=Du(Du({},n),{},{children:[]});Q.insertNodes(t,T,{at:w,voids:s}),Q.moveNodes(t,{at:z,match:R=>ce.isAncestor(j)&&j.children.includes(R),to:w.concat(0),voids:s})}},g;for(var[,h]of m)g=p()}})},av=()=>{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 Fp(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Np(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ip(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $p(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lp(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sp(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qp(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xp(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jp(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tg(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jp(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sg(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tp(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Op(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pp(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rp(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mp(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zp(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qp(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wp(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hp(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Up(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hg(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kp(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zp(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yp(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gp(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ug(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ng(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rg(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ag(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ig(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sg(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return og(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ug(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cg(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yg(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gg(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pg(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gg(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vg(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bg(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fg(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qg(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hg(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ev(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tv(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nv(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vp(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rv(e,...r)}};return e},iv={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))}},ci=new WeakMap,di=new WeakMap,jn={isHistoryEditor(e){return iv.isHistory(e.history)&&v.isEditor(e)},isMerging(e){return di.get(e)},isSaving(e){return ci.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=jn.isMerging(e);di.set(e,!1),t(),di.set(e,n)},withoutSaving(e,t){var n=jn.isSaving(e);ci.set(e,!1),t(),ci.set(e,n)}},sv=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),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&&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=jn.isSaving(t),c=jn.isMerging(t);if(u==null&&(u=uv(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=ov(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},ov=(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)),uv=(e,t)=>e.type!=="set_selection",lv=fv,nd="֑-߿יִ-﷽ﹰ-ﻼ",rd="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",cv=new RegExp("^[^"+rd+"]*["+nd+"]"),dv=new RegExp("^[^"+nd+"]*["+rd+"]");function fv(e){return e=String(e||""),cv.test(e)?"rtl":dv.test(e)?"ltr":"neutral"}const ad=bn(lv);function hv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Hs=hv,mv=typeof Nr=="object"&&Nr&&Nr.Object===Object&&Nr,pv=mv,gv=pv,vv=typeof self=="object"&&self&&self.Object===Object&&self,bv=gv||vv||Function("return this")(),id=bv,yv=id,Dv=function(){return yv.Date.now()},Cv=Dv,xv=/\s/;function wv(e){for(var t=e.length;t--&&xv.test(e.charAt(t)););return t}var Ev=wv,_v=Ev,kv=/^\s+/;function Bv(e){return e&&e.slice(0,_v(e)+1).replace(kv,"")}var Av=Bv,Fv=id,Tv=Fv.Symbol,sd=Tv,Cu=sd,od=Object.prototype,Sv=od.hasOwnProperty,jv=od.toString,rr=Cu?Cu.toStringTag:void 0;function Ov(e){var t=Sv.call(e,rr),n=e[rr];try{e[rr]=void 0;var r=!0}catch{}var a=jv.call(e);return r&&(t?e[rr]=n:delete e[rr]),a}var Pv=Ov,Nv=Object.prototype,Rv=Nv.toString;function Mv(e){return Rv.call(e)}var Iv=Mv,xu=sd,$v=Pv,Lv=Iv,zv="[object Null]",qv="[object Undefined]",wu=xu?xu.toStringTag:void 0;function Wv(e){return e==null?e===void 0?qv:zv:wu&&wu in Object(e)?$v(e):Lv(e)}var Hv=Wv;function Uv(e){return e!=null&&typeof e=="object"}var Vv=Uv,Kv=Hv,Zv=Vv,Yv="[object Symbol]";function Gv(e){return typeof e=="symbol"||Zv(e)&&Kv(e)==Yv}var Qv=Gv,Jv=Av,Eu=Hs,Xv=Qv,_u=0/0,e0=/^[-+]0x[0-9a-f]+$/i,t0=/^0b[01]+$/i,n0=/^0o[0-7]+$/i,r0=parseInt;function a0(e){if(typeof e=="number")return e;if(Xv(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=Jv(e);var n=t0.test(e);return n||n0.test(e)?r0(e.slice(2),n?2:8):e0.test(e)?_u:+e}var i0=a0,s0=Hs,fi=Cv,ku=i0,o0="Expected a function",u0=Math.max,l0=Math.min;function c0(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(o0);t=ku(t)||0,s0(n)&&(c=!!n.leading,f="maxWait"in n,i=f?u0(ku(n.maxWait)||0,t):i,m="trailing"in n?!!n.trailing:m);function p(k){var F=r,z=a;return r=a=void 0,u=k,s=e.apply(z,F),s}function g(k){return u=k,o=setTimeout(b,t),c?p(k):s}function h(k){var F=k-l,z=k-u,$=t-F;return f?l0($,i-z):$}function D(k){var F=k-l,z=k-u;return l===void 0||F>=t||F<0||f&&z>=i}function b(){var k=fi();if(D(k))return x(k);o=setTimeout(b,h(k))}function x(k){return o=void 0,m&&r?p(k):(r=a=void 0,s)}function A(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function _(){return o===void 0?s:x(fi())}function E(){var k=fi(),F=D(k);if(r=arguments,a=this,l=k,F){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 E.cancel=A,E.flush=_,E}var ud=c0;const d0=bn(ud);var f0=ud,h0=Hs,m0="Expected a function";function p0(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(m0);return h0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),f0(e,t,{leading:r,maxWait:t,trailing:a})}var g0=p0;const v0=bn(g0),Bu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Au=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",hi=(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},zr=(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,b0=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:Y=>Y!==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=b0(g),g===m){p.push(g);break}g!=null&&g===document.body&&hi(g)&&!hi(document.documentElement)||g!=null&&hi(g,c)&&p.push(g)}const h=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,D=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:b,scrollY:x}=window,{height:A,width:_,top:E,right:k,bottom:F,left:z}=e.getBoundingClientRect(),{top:$,right:j,bottom:N,left:w}=(Y=>{const K=window.getComputedStyle(Y);return{top:parseFloat(K.scrollMarginTop)||0,right:parseFloat(K.scrollMarginRight)||0,bottom:parseFloat(K.scrollMarginBottom)||0,left:parseFloat(K.scrollMarginLeft)||0}})(e);let T=o==="start"||o==="nearest"?E-$:o==="end"?F+N:E+A/2-$+N,R=l==="center"?z+_/2-w+j:l==="end"?k+j:z-w;const M=[];for(let Y=0;Y<p.length;Y++){const K=p[Y],{height:se,width:ne,top:y,right:q,bottom:X,left:B}=K.getBoundingClientRect();if(s==="if-needed"&&E>=0&&z>=0&&F<=D&&k<=h&&E>=y&&F<=X&&z>=B&&k<=q)return M;const S=getComputedStyle(K),L=parseInt(S.borderLeftWidth,10),I=parseInt(S.borderTopWidth,10),U=parseInt(S.borderRightWidth,10),te=parseInt(S.borderBottomWidth,10);let ee=0,Z=0;const ue="offsetWidth"in K?K.offsetWidth-K.clientWidth-L-U:0,J="offsetHeight"in K?K.offsetHeight-K.clientHeight-I-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"?T:o==="end"?T-D:o==="nearest"?zr(x,x+D,D,I,te,x+T,x+T+A,A):T-D/2,Z=l==="start"?R:l==="center"?R-h/2:l==="end"?R-h:zr(b,b+h,h,L,U,b+R,b+R+_,_),ee=Math.max(0,ee+x),Z=Math.max(0,Z+b);else{ee=o==="start"?T-y-I:o==="end"?T-X+te+J:o==="nearest"?zr(y,X,se,I,te+J,T,T+A,A):T-(y+se/2)+J/2,Z=l==="start"?R-B-L:l==="center"?R-(B+ne/2)+ue/2:l==="end"?R-q+U+ue:zr(B,q,ne,L,U+ue,R,R+_,_);const{scrollLeft:_e,scrollTop:Se}=K;ee=me===0?0:Math.max(0,Math.min(Se+ee/me,K.scrollHeight-se/me+J)),Z=ge===0?0:Math.max(0,Math.min(_e+Z/ge,K.scrollWidth-ne/ge+ue)),T+=Se-ee,R+=_e-Z}M.push({el:K,top:ee,left:Z})}return M},y0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function D0(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,y0(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var dn=[],C0=function(){return dn.some(function(e){return e.activeTargets.length>0})},x0=function(){return dn.some(function(e){return e.skippedTargets.length>0})},Tu="ResizeObserver loop completed with undelivered notifications.",w0=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)},wr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(wr||(wr={}));var fn=function(e){return Object.freeze(e)},E0=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,fn(this)}return e}(),ld=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},cd=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)},_0=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},fr=typeof window<"u"?window:{},qr=new WeakMap,ju=/auto|scroll/,k0=/^tb|vertical/,B0=/msie|trident/i.test(fr.navigator&&fr.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 E0((n?t:e)||0,(n?e:t)||0)},Ou=fn({devicePixelContentBoxSize:Mn(),borderBoxSize:Mn(),contentBoxSize:Mn(),contentRect:new ld(0,0,0,0)}),dd=function(e,t){if(t===void 0&&(t=!1),qr.has(e)&&!t)return qr.get(e);if(cd(e))return qr.set(e,Ou),Ou;var n=getComputedStyle(e),r=Us(e)&&e.ownerSVGElement&&e.getBBox(),a=!B0&&n.boxSizing==="border-box",i=k0.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),D=f+u,b=l+c,x=h+p,A=m+g,_=o?e.offsetHeight-A-e.clientHeight:0,E=s?e.offsetWidth-x-e.clientWidth:0,k=a?D+x:0,F=a?b+A:0,z=r?r.width:kt(n.width)-k-E,$=r?r.height:kt(n.height)-F-_,j=z+D+E+x,N=$+b+_+A,w=fn({devicePixelContentBoxSize:Mn(Math.round(z*devicePixelRatio),Math.round($*devicePixelRatio),i),borderBoxSize:Mn(j,N,i),contentBoxSize:Mn(z,$,i),contentRect:new ld(f,l,z,$)});return qr.set(e,w),w},fd=function(e,t,n){var r=dd(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case wr.DEVICE_PIXEL_CONTENT_BOX:return s;case wr.BORDER_BOX:return a;default:return i}},A0=function(){function e(t){var n=dd(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}(),hd=function(e){if(cd(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},F0=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 A0(u.target),f=hd(u.target);o.push(c),u.lastReportedSize=fd(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()&&(hd(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},T0=function(){var e=0;for(Pu(e);C0();)e=F0(),Pu(e);return x0()&&w0(),e>0},mi,md=[],S0=function(){return md.splice(0).forEach(function(e){return e()})},j0=function(e){if(!mi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return S0()}).observe(n,r),mi=function(){n.textContent="".concat(t?t--:t++)}}md.push(e),mi()},O0=function(e){j0(function(){requestAnimationFrame(e)})},ia=0,P0=function(){return!!ia},N0=250,R0={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},pi=!1,M0=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=N0),!pi){pi=!0;var r=Ru(t);O0(function(){var a=!1;try{a=T0()}finally{if(pi=!1,t=r-Ru(),!P0())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,R0)};document.body?n():fr.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 fr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Nu.forEach(function(n){return fr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),us=new M0,Mu=function(e){!ia&&e>0&&us.start(),ia+=e,!ia&&us.stop()},I0=function(e){return!Us(e)&&!_0(e)&&getComputedStyle(e).display==="inline"},$0=function(){function e(t,n){this.target=t,this.observedBox=n||wr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=fd(this.target,this.observedBox,!0);return I0(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),L0=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Wr=new WeakMap,Iu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Hr=function(){function e(){}return e.connect=function(t,n){var r=new L0(t,n);Wr.set(t,r)},e.observe=function(t,n,r){var a=Wr.get(t),i=a.observationTargets.length===0;Iu(a.observationTargets,n)<0&&(i&&dn.push(a),a.observationTargets.push(new $0(n,r&&r.box)),Mu(1),us.schedule())},e.unobserve=function(t,n){var r=Wr.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=Wr.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),z0=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.");Hr.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");Hr.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");Hr.unobserve(this,t)},e.prototype.disconnect=function(){Hr.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}();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 Wn(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 Er(e){"@babel/helpers - typeof";return Er=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Er(e)}function W0(e,t){if(Er(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Er(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function H0(e){var t=W0(e,"string");return Er(t)==="symbol"?t:String(t)}function Dt(e,t,n){return t=H0(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},pd=parseInt(C.version.split(".")[0],10),U0=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),lr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),V0=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),gd=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),K0=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Z0=at&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),Y0=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),G0=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),Q0=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),sa=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ht=(!K0||!Z0)&&!V0&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Ks=new WeakMap,Zs=new WeakMap,vd=new WeakMap,oa=new WeakMap,ls=new WeakMap,_r=new WeakMap,hn=new WeakMap,Ca=new WeakMap,qa=new WeakMap,cs=new WeakMap,Gt=new WeakMap,ln=new WeakMap,hr=new WeakMap,ds=new WeakMap,Ys=new WeakMap,wt=new WeakMap,$t=new WeakMap,ut=new WeakMap,Vt=new WeakMap,Kt=new WeakMap,bd=new WeakMap,Hn=Symbol("placeholder"),yd=Symbol("mark-placeholder"),J0=globalThis.Text,Gs=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,X0=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},Dd=e=>Jt(e)&&e.nodeType===3,eb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,tb=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]=Cd(t,a,r?"backward":"forward"),r=a<n;yt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=rb(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},nb=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Cd=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(X0(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]},rb=(e,t,n)=>{var[r]=Cd(e,t,n);return r},xd=e=>{var t="";if(Dd(e)&&e.nodeValue)return e.nodeValue;if(yt(e)){for(var n of Array.from(e.childNodes))t+=xd(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
|
|
103
|
+
`)}return t},ab=/data-slate-fragment="(.+?)"/m,ib=e=>{var t=e.getData("text/html"),[,n]=t.match(ab)||[];return n},Qs=(e,t,n)=>{var{target:r}=t;if(yt(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=G.getWindow(e);if(a.contains(r))return G.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:Qs(e,i,n)},sb=0;class ob{constructor(){Dt(this,"id",void 0),this.id="".concat(sb++)}}var G={androidPendingDiffs:e=>ut.get(e),androidScheduleFlush:e=>{var t;(t=Ys.get(e))===null||t===void 0||t()},blur:e=>{var t=G.toDOMNode(e,e),n=G.findDocumentOrShadowRoot(e);Gt.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=G.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&Q.deselect(e)},findDocumentOrShadowRoot:e=>{var t=G.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=G.toSlateNode(e,t.target),s=G.findPath(e,i);if(ce.isElement(i)&&v.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=v.point(e,s,{edge:l?"start":"end"}),c=l?v.before(e,u):v.after(e,u);if(c){var f=v.range(e,c);return f}}var m,{document:p}=G.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=G.toSlateRange(e,m,{exactMatch:!1,suppressThrow:!1});return h},findKey:(e,t)=>{var n=Ca.get(t);return n||(n=new ob,Ca.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=Zs.get(r);if(a==null){if(v.isEditor(r))return n;break}var i=Ks.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(Ye.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!Gt.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(()=>{G.focus(t,{retries:n.retries-1})},10);return}var r=G.toDOMNode(t,t),a=G.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=G.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(Q.select(t,v.start(t,[])),t.onChange()),Gt.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=vd.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=G.toDOMNode(t,t),s;try{s=yt(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)=>Jt(t)&&G.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return v.hasPath(e,n.path)&&v.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>G.hasEditableTarget(e,t)||G.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>Jt(t)&&G.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!ln.get(e),isFocused:e=>!!Gt.get(e),isReadOnly:e=>!!cs.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(cs.get(e))return!1;var n=G.hasTarget(e,t)&&G.toSlateNode(e,t);return ce.isElement(n)&&v.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=qa.get(e),r=v.isEditor(t)?oa.get(e):n==null?void 0:n.get(G.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(Ye.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=v.node(e,t.path),r=G.toDOMNode(e,n),a;v.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 D,b=h.childNodes[0];a=[b instanceof J0?b:h,(D=h.textContent)!==null&&D!==void 0&&D.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(Ye.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=W.isBackward(t),i=G.toDOMPoint(e,n),s=W.isCollapsed(t)?i:G.toDOMPoint(e,r),o=G.getWindow(e),l=o.document.createRange(),[u,c]=a?s:i,[f,m]=a?i:s,p=yt(u)?u:u.parentElement,g=!!p.getAttribute("data-slate-zero-width"),h=yt(f)?f:f.parentElement,D=!!h.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:c),l.setEnd(f,D?1:m),l},toSlateNode:(e,t)=>{var n=yt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?_r.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},toSlatePoint:(e,t,n)=>{var{exactMatch:r,suppressThrow:a}=n,[i,s]=r?t:tb(t),o=i.parentNode,l=null,u=0;if(o){var c,f,m=G.toDOMNode(e,e),p=o.closest('[data-slate-void="true"]'),g=p&&m.contains(p)?p:null,h=o.closest("[data-slate-leaf]"),D=null;if(h){if(l=h.closest('[data-slate-node="text"]'),l){var b=G.getWindow(e),x=b.document.createRange();x.setStart(l,0),x.setEnd(i,s);var A=x.cloneContents(),_=[...Array.prototype.slice.call(A.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(A.querySelectorAll("[contenteditable=false]"))];_.forEach(R=>{if(at&&!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=A.textContent.length,D=l}}else if(g){for(var E=g.querySelectorAll("[data-slate-leaf]"),k=0;k<E.length;k++){var F=E[k];if(G.hasDOMNode(e,F)){h=F;break}}h?(l=h.closest('[data-slate-node="text"]'),D=h,u=D.textContent.length,D.querySelectorAll("[data-slate-zero-width]").forEach(R=>{u-=R.textContent.length})):u=1}D&&u===D.textContent.length&&at&&D.getAttribute("data-slate-zero-width")==="z"&&(c=D.textContent)!==null&&c!==void 0&&c.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||On&&(f=D.textContent)!==null&&f!==void 0&&f.endsWith(`
|
|
104
104
|
|
|
105
|
-
`))&&u--}if(at&&!l&&!r){var
|
|
105
|
+
`))&&u--}if(at&&!l&&!r){var z=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(z&&G.hasDOMNode(e,z,{editable:!0})){var $=G.toSlateNode(e,z),{path:j,offset:N}=v.start(e,G.findPath(e,$));return z.querySelector("[data-slate-leaf]")||(N=s),{path:j,offset:N}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var w=G.toSlateNode(e,l),T=G.findPath(e,w);return{path:T,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=fs(t)?t.anchorNode:t.startContainer,o,l,u,c,f;if(s)if(fs(t)){if(On&&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 k=function(F){return F.childElementCount>0?k(F.children[0]):F};var g=m.startContainer,h=p.startContainer,D=k(g.children[m.startOffset]),b=k(h.children[p.startOffset]);c=0,b.childNodes.length>0?o=b.childNodes[0]:o=b,D.childNodes.length>0?u=D.childNodes[0]:u=D,b instanceof HTMLElement?l=b.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;gd&&nb(o)||On?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(On&&(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 k=G.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!k)return null;var E=f?k:G.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!E)return null;var _={anchor:k,focus:E};return W.isExpanded(_)&&W.isForward(_)&&yt(u)&&b.void(e,{at:_.focus,mode:"highest"})&&(_=b.unhangRange(e,_,{voids:!0})),_}};function eb(e,t){var{path:n,diff:r}=t;if(!b.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(!b.hasPath(e,i))return!1;var s=ie.get(e,i);return de.isText(s)&&s.text.startsWith(r.text)}function gd(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 tb(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 nb(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 vd(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=tb(i,a),o=Math.min(i.length-s,a.length-s),l=nb(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 rb(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=gd(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 vd(e,{start:r,end:l,text:o})}function ab(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function cs(e,t){var{path:n,offset:r}=t;if(!b.hasPath(e,n))return null;var a=ie.get(e,n);if(!de.isText(a))return null;var i=b.above(e,{match:o=>ce.isElement(o)&&b.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=b.next(e,{at:n,match:de.isText});if(!s||!P.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Ru(e,t){var n=cs(e,t.anchor);if(!n)return null;if(W.isCollapsed(t))return{anchor:n,focus:n};var r=cs(e,t.focus);return r?{anchor:n,focus:r}:null}function ds(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 Mu(e,t,n){var r=ds(e,t.anchor,n);if(!r)return null;if(W.isCollapsed(t))return{anchor:r,focus:r};var a=ds(e,t.focus,n);return a?{anchor:r,focus:a}:null}function ib(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 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 qr(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){Dt(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 sb=25,ob=200,ub=function(){},lb=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function cb(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,R=Ru(t,w);R&&(!F||!W.equals(R,F))&&X.select(t,R)}},f=()=>{var w=Vt.get(t);if(Vt.delete(t),!!w){if(w.at){var F=Ce.isPoint(w.at)?cs(t,w.at):Ru(t,w.at);if(!F)return;var R=b.range(t,F);(!t.selection||!W.equals(t.selection,R))&&X.select(t,F)}w.run()}},m=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!E()&&!k()){c();return}a||(a=!0,setTimeout(()=>a=!1)),k()&&(a="action");var w=t.selection&&b.rangeRef(t,t.selection,{affinity:"forward"});$t.set(t,t.marks),ub("flush",Vt.get(t),ut.get(t));for(var F=E(),R;R=(M=ut.get(t))===null||M===void 0?void 0:M[0];){var M,Y,K=wt.get(t);K!==void 0&&(wt.delete(t),t.marks=K),K&&u===!1&&(u=null);var se=ab(R);(!t.selection||!W.equals(t.selection,se))&&X.select(t,se),R.diff.text?b.insertText(t,R.diff.text):b.deleteFragment(t),ut.set(t,(Y=ut.get(t))===null||Y===void 0?void 0:Y.filter(z=>{var{id:J}=z;return J!==R.id})),eb(t,R)||(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))&&X.select(t,ne),k()){f();return}F&&n(),n.flush(),r.flush(),c();var y=$t.get(t);$t.delete(t),y!==void 0&&(t.marks=y,t.onChange())},p=w=>{i&&clearTimeout(i),i=setTimeout(()=>{ln.set(t,!1),m()},sb)},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,R=ss.get(t);if(R){if(E()||F){R.style.display="none";return}R.style.removeProperty("display")}},D=(w,F)=>{var R,M=(R=ut.get(t))!==null&&R!==void 0?R:[];ut.set(t,M);var Y=ie.leaf(t,w),K=M.findIndex(y=>P.equals(y.path,w));if(K<0){var se=vd(Y.text,F);se&&M.push({path:w,diff:F,id:l++}),h();return}var ne=rb(Y.text,M[K].diff,F);if(!ne){M.splice(K,1),h();return}M[K]=qr(qr({},M[K]),{},{diff:ne})},v=function(F){var{at:R}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,Kt.delete(t),n.cancel(),r.cancel(),k()&&m(),Vt.set(t,{at:R,run:F}),o=setTimeout(m)},x=w=>{var F;s&&(clearTimeout(s),s=null);var{inputType:R}=w,M=null,Y=w.dataTransfer||w.data||void 0;u!==!1&&R!=="insertText"&&R!=="insertCompositionText"&&(u=!1);var[K]=w.getTargetRanges();K&&(M=G.toSlateRange(t,K,{exactMatch:!1,suppressThrow:!0}));var se=G.getWindow(t),ne=se.getSelection();if(!M&&ne&&(K=ne,M=G.toSlateRange(t,ne,{exactMatch:!1,suppressThrow:!0})),M=(F=M)!==null&&F!==void 0?F:t.selection,!!M){var y=!0;if(R.startsWith("delete")){if(W.isExpanded(M)){var[z,J]=W.edges(M),B=ie.leaf(t,z.path);if(B.text.length===z.offset&&J.offset===0){var T=b.next(t,{at:z.path,match:de.isText});T&&P.equals(T[1],J.path)&&(M={anchor:J,focus:J})}}var L=R.endsWith("Backward")?"backward":"forward",[I,U]=W.edges(M),[te,ee]=b.leaf(t,I.path),Z={text:"",start:I.offset,end:U.offset},ue=ut.get(t),Q=ue==null?void 0:ue.find(pe=>P.equals(pe.path,ee)),ge=Q?[Q.diff,Z]:[Z],me=gd(te.text,...ge);if(me.length===0&&(y=!1),W.isExpanded(M)){if(y&&P.equals(M.anchor.path,M.focus.path)){var _e={path:M.anchor.path,offset:I.offset},Se=b.range(t,_e,_e);return S(Se),D(M.anchor.path,{text:"",end:U.offset,start:I.offset})}return v(()=>b.deleteFragment(t,{direction:L}),{at:M})}}switch(R){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>b.deleteFragment(t),{at:M});case"deleteContent":case"deleteContentForward":{var{anchor:Pe}=M;if(y&&W.isCollapsed(M)){var Ge=ie.leaf(t,Pe.path);if(Pe.offset<Ge.text.length)return D(Pe.path,{text:"",start:Pe.offset,end:Pe.offset+1})}return v(()=>b.deleteForward(t),{at:M})}case"deleteContentBackward":{var Ke,{anchor:Ze}=M,tt=ls(K)?K.isCollapsed:!!((Ke=K)!==null&&Ke!==void 0&&Ke.collapsed);return y&&tt&&W.isCollapsed(M)&&Ze.offset>0?D(Ze.path,{text:"",start:Ze.offset-1,end:Ze.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(lb(Y))return v(()=>G.insertData(t,Y),{at:M});var Ae=Y??"";if(wt.get(t)&&(Ae=Ae.replace("\uFEFF","")),R==="insertText"&&/.*\n.*\n$/.test(Ae)&&(Ae=Ae.slice(0,-1)),Ae.includes(`
|
|
108
|
-
`))return
|
|
109
|
-
`);pe.forEach((De,Ue)=>{De&&
|
|
110
|
-
`?C.createElement(
|
|
111
|
-
`:""),[i]=C.useState(a);return xr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),C.createElement(Eb,{ref:r},i)},Eb=C.memo(C.forwardRef((e,t)=>C.createElement("span",{"data-slate-string":!0,ref:t},e.children))),mi=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",xb({},a),!at||!n?"\uFEFF":null,n?C.createElement("br",null):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 yd(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 _b=at?300:0;function Bb(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function Wu(e){e.current&&(clearTimeout(e.current),e.current=null)}var kb=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=x=>C.createElement(Fb,yd({},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(Bb(l,x==null),x==null){var k;ss.delete(o),(k=t.onPlaceholderResize)===null||k===void 0||k.call(t,null)}else{if(ss.set(o,x),!l.current){var E=window.ResizeObserver||O0;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(wb,{isLast:n,leaf:t,parent:a,text:r}),h=!!t[qn];if(C.useEffect(()=>(h?m.current||(m.current=setTimeout(()=>{f(!0),m.current=null},_b)):(Wu(m),f(!1)),()=>Wu(m)),[h,f]),h&&c){var D={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:sr?"inherit":void 0},contentEditable:!1,ref:p}};g=C.createElement(C.Fragment,null,i(D),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},Ab=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&&de.equals(t.leaf,e.leaf)&&t.leaf[qn]===e.leaf[qn]),Fb=e=>{var{attributes:t,children:n}=e;return C.createElement("span",yd({},t),n)},Tb=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=G.findKey(o,s),f=[],m=0;m<u.length;m++){var p=u[m];f.push(C.createElement(Ab,{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 D=$a.get(o);h?(D==null||D.set(c,h),hn.set(s,h),Cr.set(h,s)):(D==null||D.delete(c),hn.delete(s),l.current&&Cr.delete(l.current)),l.current=h},[l,o,c,s]);return C.createElement("span",{"data-slate-node":"text",ref:g},f)},Dd=C.memo(Tb,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&Cb(t.decorations,e.decorations));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 fs(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){Dt(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 Sb=e=>{var{decorations:t,element:n,renderElement:r=x=>C.createElement(Ob,fs({},x)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=nn(),l=Rb(),u=o.isInline(n),c=G.findKey(o,n),f=C.useCallback(x=>{var k=$a.get(o);x?(k==null||k.set(c,x),hn.set(n,x),Cr.set(x,n)):(k==null||k.delete(c),hn.delete(n))},[o,c,n]),m=xd({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=ie.string(n),h=Qc(g);h==="rtl"&&(p.dir=h)}if(b.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var D=u?"span":"div",[[v]]=ie.texts(n);m=C.createElement(D,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},C.createElement(Dd,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),Hs.set(v,0),Us.set(v,n)}return r({attributes:p,children:m,element:n})},jb=C.memo(Sb,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&Db(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&W.equals(e.selection,t.selection))),Ob=e=>{var{attributes:t,children:n,element:r}=e,a=nn(),i=a.isInline(r)?"span":"div";return C.createElement(i,fs(fs({},t),{},{style:{position:"relative"}}),n)},Cd=C.createContext(()=>[]),Pb=()=>C.useContext(Cd),Nb=C.createContext(!1),xd=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=Pb(),l=nn(),u=G.findPath(l,n),c=[],f=ce.isElement(n)&&!l.isInline(n)&&b.hasInlines(l,n),m=0;m<n.children.length;m++){var p=u.concat(m),g=n.children[m],h=G.findKey(l,g),D=b.range(l,p),v=s&&W.intersection(D,s),x=o([g,p]);for(var k of t){var E=W.intersection(k,D);E&&x.push(E)}ce.isElement(g)?c.push(C.createElement(Nb.Provider,{key:"provider-".concat(h.id),value:!!v},C.createElement(jb,{decorations:x,element:g,key:h.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):c.push(C.createElement(Dd,{decorations:x,key:h.id,isLast:f&&m===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),Hs.set(g,m),Us.set(g,n)}return c},wd=C.createContext(!1),Rb=()=>C.useContext(wd),Ed=C.createContext(null),La=()=>{var e=C.useContext(Ed);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function Mb(){var e=nn(),t=C.useRef(!1),n=C.useRef(0),r=C.useCallback(()=>{if(!t.current){t.current=!0;var a=G.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 Ib=3,$b={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"},Lb={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"},zb={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Me=e=>{var t=$b[e],n=Lb[e],r=zb[e],a=t&&ni(t),i=n&&ni(n),s=r&&ni(r);return o=>!!(a&&a(o)||Nu&&i&&i(o)||!Nu&&s&&s(o))},Ie={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=>Zs(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}},Wb={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class _d 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,Wb)}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(_d,"contextType",Ws);var Hb=at?_d:e=>{var{children:t}=e;return C.createElement(C.Fragment,null,t)},Ub=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],Vb=["text"];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 At(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Uu(Object(n),!0).forEach(function(r){Dt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Uu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Kb=e=>C.createElement(C.Fragment,null,xd(e)),Zb=e=>{var t=C.useCallback(T=>C.createElement(Yb,At({},T)),[]),{autoFocus:n,decorate:r=Gb,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=Qb,style:f={},as:m="div",disableDefaultStyles:p=!1}=e,g=zn(e,Ub),h=La(),[D,v]=C.useState(!1),x=C.useRef(null),k=C.useRef([]),[E,_]=C.useState(),{onUserInput:A,receivedUserInput:S}=Mb(),[,q]=C.useReducer(T=>T+1,0);dd.set(h,q),os.set(h,s);var $=C.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);C.useEffect(()=>{x.current&&n&&x.current.focus()},[n]);var j=C.useRef(),N=C.useMemo(()=>l0(()=>{var T=j.current;if((at||!G.isComposing(h))&&(!$.isUpdatingSelection||T!=null&&T.isFlushing())&&!$.isDraggingInternally){var L=G.findDocumentOrShadowRoot(h),{activeElement:I}=L,U=G.toDOMNode(h,h),te=L.getSelection();if(I===U?($.latestElement=I,Gt.set(h,!0)):Gt.delete(h),!te)return X.deselect(h);var{anchorNode:ee,focusNode:Z}=te,ue=G.hasEditableTarget(h,ee)||G.isTargetInsideNonReadonlyVoid(h,ee),Q=G.hasEditableTarget(h,Z)||G.isTargetInsideNonReadonlyVoid(h,Z);if(ue&&Q){var ge=G.toSlateRange(h,te,{exactMatch:!1,suppressThrow:!0});ge&&(!G.isComposing(h)&&!(T!=null&&T.hasPendingChanges())&&!(T!=null&&T.isFlushing())?X.select(h,ge):T==null||T.handleUserSelect(ge))}s&&(!ue||!Q)&&X.deselect(h)}},100),[h,s,$]),w=C.useMemo(()=>r0(N,0),[N]);j.current=gb({node:x,onDOMSelectionChange:N,scheduleOnDOMSelectionChange:w}),xr(()=>{var T,L,I;x.current&&(I=Ks(x.current))?(cd.set(h,I),aa.set(h,x.current),hn.set(h,x.current),Cr.set(x.current,h)):hn.delete(h);var{selection:U}=h,te=G.findDocumentOrShadowRoot(h),ee=te.getSelection();if(!(!ee||!G.isFocused(h)||(T=j.current)!==null&&T!==void 0&&T.hasPendingAction())){var Z=me=>{var _e=ee.type!=="None";if(!(!U&&!_e)){var Se=ee.focusNode,Pe;if(Sn&&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=aa.get(h),tt=!1;if(Ze.contains(Pe)&&Ze.contains(Se)&&(tt=!0),_e&&tt&&U&&!me){var Ae=G.toSlateRange(h,ee,{exactMatch:!0,suppressThrow:!0});if(Ae&&W.equals(Ae,U)){var We;if(!$.hasMarkPlaceholder||(We=Pe)!==null&&We!==void 0&&(We=We.parentElement)!==null&&We!==void 0&&We.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!G.hasRange(h,U)){h.selection=G.toSlateRange(h,ee,{exactMatch:!1,suppressThrow:!0});return}$.isUpdatingSelection=!0;var Le=U&&G.toDOMRange(h,U);return Le?(G.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&&Z();var ue=((L=j.current)===null||L===void 0?void 0:L.isFlushing())==="action";if(!at||!ue){setTimeout(()=>{$.isUpdatingSelection=!1});return}var Q=null,ge=requestAnimationFrame(()=>{if(ue){var me=_e=>{try{var Se=G.toDOMNode(h,h);Se.focus(),Z(_e)}catch{}};me(),Q=setTimeout(()=>{me(!0),$.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ge),Q&&clearTimeout(Q)}}});var F=C.useCallback(T=>{if(A(),!s&&G.hasEditableTarget(h,T.target)&&!Jb(T,a)){var L;if(j.current)return j.current.handleDOMBeforeInput(T);w.flush(),N.flush();var{selection:I}=h,{inputType:U}=T,te=T.dataTransfer||T.data||void 0,ee=U==="insertCompositionText"||U==="deleteCompositionText";if(ee&&G.isComposing(h))return;var Z=!1;if(U==="insertText"&&I&&W.isCollapsed(I)&&T.data&&T.data.length===1&&/[a-z ]/i.test(T.data)&&I.anchor.offset!==0){var ue,Q;Z=!0,h.marks&&(Z=!1);var{anchor:ge}=I,[me,_e]=G.toDOMPoint(h,ge),Se=(ue=me.parentElement)===null||ue===void 0?void 0:ue.closest("a"),Pe=G.getWindow(h);if(Z&&Se&&G.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&&(Z=!1)}if(Z&&me.parentElement&&(Pe==null||(Q=Pe.getComputedStyle(me.parentElement))===null||Q===void 0?void 0:Q.whiteSpace)==="pre"){var Ze=b.above(h,{at:ge.path,match:ae=>ce.isElement(ae)&&b.isBlock(h,ae)});Ze&&ie.string(Ze[0]).includes(" ")&&(Z=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[tt]=T.getTargetRanges();if(tt){var Ae=G.toSlateRange(h,tt,{exactMatch:!1,suppressThrow:!1});if(!I||!W.equals(I,Ae)){Z=!1;var We=!ee&&h.selection&&b.rangeRef(h,h.selection);X.select(h,Ae),We&&cr.set(h,We)}}}if(ee)return;if(Z||T.preventDefault(),I&&W.isExpanded(I)&&U.startsWith("delete")){var Le=U.endsWith("Backward")?"backward":"forward";b.deleteFragment(h,{direction:Le});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"&&G.isComposing(h)&&(v(!1),ln.set(h,!1)),(te==null?void 0:te.constructor.name)==="DataTransfer"?G.insertData(h,te):typeof te=="string"&&(Z?k.current.push(()=>b.insertText(h,te)):b.insertText(h,te));break}}var H=(L=cr.get(h))===null||L===void 0?void 0:L.unref();cr.delete(h),H&&(!h.selection||!W.equals(h.selection,H))&&X.select(h,H)}},[h,N,A,a,s,w]),R=C.useCallback(T=>{T==null?(N.cancel(),w.cancel(),aa.delete(h),hn.delete(h),x.current&&Ht&&x.current.removeEventListener("beforeinput",F)):Ht&&T.addEventListener("beforeinput",F),x.current=T},[N,w,h,F]);xr(()=>{var T=G.getWindow(h);return T.document.addEventListener("selectionchange",w),()=>{T.document.removeEventListener("selectionchange",w)}},[w]);var M=r([h,[]]),Y=i&&h.children.length===1&&Array.from(ie.texts(h)).length===1&&ie.string(h)===""&&!D,K=C.useCallback(T=>{if(T&&Y){var L;_((L=T.getBoundingClientRect())===null||L===void 0?void 0:L.height)}else _(void 0)},[Y]);if(Y){var se=b.start(h,[]);M.push({[qn]:!0,placeholder:i,onPlaceholderResize:K,anchor:se,focus:se})}var{marks:ne}=h;if($.hasMarkPlaceholder=!1,h.selection&&W.isCollapsed(h.selection)&&ne){var{anchor:y}=h.selection,z=ie.leaf(h,y.path),J=zn(z,Vb);if(!de.equals(z,ne,{loose:!0})){$.hasMarkPlaceholder=!0;var B=Object.fromEntries(Object.keys(J).map(T=>[T,null]));M.push(At(At(At({[fd]:!0},B),ne),{},{anchor:y,focus:y}))}}return C.useEffect(()=>{setTimeout(()=>{var{selection:T}=h;if(T){var{anchor:L}=T,I=ie.leaf(h,L.path);if(ne&&!de.equals(I,ne,{loose:!0})){wt.set(h,ne);return}}wt.delete(h)})}),C.createElement(wd.Provider,{value:s},C.createElement(Cd.Provider,{value:r},C.createElement(Hb,{node:x,receivedUserInput:S},C.createElement(m,At(At({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Ht||!ra?g.spellCheck:!1,autoCorrect:Ht||!ra?g.autoCorrect:"false",autoCapitalize:Ht||!ra?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:R,style:At(At({},p?{}:At({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},E?{minHeight:E}:{})),f),onBeforeInput:C.useCallback(T=>{if(!Ht&&!s&&!rt(T,g.onBeforeInput)&&G.hasSelectableTarget(h,T.target)&&(T.preventDefault(),!G.isComposing(h))){var L=T.data;b.insertText(h,L)}},[g.onBeforeInput,h,s]),onInput:C.useCallback(T=>{if(!rt(T,g.onInput)){if(j.current){j.current.handleInput();return}for(var L of k.current)L();k.current=[]}},[g.onInput]),onBlur:C.useCallback(T=>{if(!(s||$.isUpdatingSelection||!G.hasSelectableTarget(h,T.target)||rt(T,g.onBlur))){var L=G.findDocumentOrShadowRoot(h);if($.latestElement!==L.activeElement){var{relatedTarget:I}=T,U=G.toDOMNode(h,h);if(I!==U&&!(yt(I)&&I.hasAttribute("data-slate-spacer"))){if(I!=null&&Jt(I)&&G.hasDOMNode(h,I)){var te=G.toSlateNode(h,I);if(ce.isElement(te)&&!h.isVoid(te))return}if(sr){var ee=L.getSelection();ee==null||ee.removeAllRanges()}Gt.delete(h)}}}},[s,$.isUpdatingSelection,$.latestElement,h,g.onBlur]),onClick:C.useCallback(T=>{if(G.hasTarget(h,T.target)&&!rt(T,g.onClick)&&Jt(T.target)){var L=G.toSlateNode(h,T.target),I=G.findPath(h,L);if(!b.hasPath(h,I)||ie.get(h,I)!==L)return;if(T.detail===Ib&&I.length>=1){var U=I;if(!(ce.isElement(L)&&b.isBlock(h,L))){var te,ee=b.above(h,{match:Se=>ce.isElement(Se)&&b.isBlock(h,Se),at:I});U=(te=ee==null?void 0:ee[1])!==null&&te!==void 0?te:I.slice(0,1)}var Z=b.range(h,U);X.select(h,Z);return}if(s)return;var ue=b.start(h,I),Q=b.end(h,I),ge=b.void(h,{at:ue}),me=b.void(h,{at:Q});if(ge&&me&&P.equals(ge[1],me[1])){var _e=b.range(h,ue);X.select(h,_e)}}},[h,g.onClick,s]),onCompositionEnd:C.useCallback(T=>{if(G.hasSelectableTarget(h,T.target)){var L;if(G.isComposing(h)&&Promise.resolve().then(()=>{v(!1),ln.set(h,!1)}),(L=j.current)===null||L===void 0||L.handleCompositionEnd(T),rt(T,g.onCompositionEnd)||at)return;if(!sr&&!z0&&!M0&&!W0&&!q0&&T.data){var I=wt.get(h);wt.delete(h),I!==void 0&&($t.set(h,h.marks),h.marks=I),b.insertText(h,T.data);var U=$t.get(h);$t.delete(h),U!==void 0&&(h.marks=U)}}},[g.onCompositionEnd,h]),onCompositionUpdate:C.useCallback(T=>{G.hasSelectableTarget(h,T.target)&&!rt(T,g.onCompositionUpdate)&&(G.isComposing(h)||(v(!0),ln.set(h,!0)))},[g.onCompositionUpdate,h]),onCompositionStart:C.useCallback(T=>{if(G.hasSelectableTarget(h,T.target)){var L;if((L=j.current)===null||L===void 0||L.handleCompositionStart(T),rt(T,g.onCompositionStart)||at)return;v(!0);var{selection:I}=h;if(I&&W.isExpanded(I)){b.deleteFragment(h);return}}},[g.onCompositionStart,h]),onCopy:C.useCallback(T=>{G.hasSelectableTarget(h,T.target)&&!rt(T,g.onCopy)&&!Vu(T)&&(T.preventDefault(),G.setFragmentData(h,T.clipboardData,"copy"))},[g.onCopy,h]),onCut:C.useCallback(T=>{if(!s&&G.hasSelectableTarget(h,T.target)&&!rt(T,g.onCut)&&!Vu(T)){T.preventDefault(),G.setFragmentData(h,T.clipboardData,"cut");var{selection:L}=h;if(L)if(W.isExpanded(L))b.deleteFragment(h);else{var I=ie.parent(h,L.anchor.path);b.isVoid(h,I)&&X.delete(h)}}},[s,h,g.onCut]),onDragOver:C.useCallback(T=>{if(G.hasTarget(h,T.target)&&!rt(T,g.onDragOver)){var L=G.toSlateNode(h,T.target);ce.isElement(L)&&b.isVoid(h,L)&&T.preventDefault()}},[g.onDragOver,h]),onDragStart:C.useCallback(T=>{if(!s&&G.hasTarget(h,T.target)&&!rt(T,g.onDragStart)){var L=G.toSlateNode(h,T.target),I=G.findPath(h,L),U=ce.isElement(L)&&b.isVoid(h,L)||b.void(h,{at:I,voids:!0});if(U){var te=b.range(h,I);X.select(h,te)}$.isDraggingInternally=!0,G.setFragmentData(h,T.dataTransfer,"drag")}},[s,h,g.onDragStart,$]),onDrop:C.useCallback(T=>{if(!s&&G.hasTarget(h,T.target)&&!rt(T,g.onDrop)){T.preventDefault();var L=h.selection,I=G.findEventRange(h,T),U=T.dataTransfer;X.select(h,I),$.isDraggingInternally&&L&&!W.equals(L,I)&&!b.void(h,{at:I,voids:!0})&&X.delete(h,{at:L}),G.insertData(h,U),G.isFocused(h)||G.focus(h)}$.isDraggingInternally=!1},[s,h,g.onDrop,$]),onDragEnd:C.useCallback(T=>{!s&&$.isDraggingInternally&&g.onDragEnd&&G.hasTarget(h,T.target)&&g.onDragEnd(T),$.isDraggingInternally=!1},[s,$,g,h]),onFocus:C.useCallback(T=>{if(!s&&!$.isUpdatingSelection&&G.hasEditableTarget(h,T.target)&&!rt(T,g.onFocus)){var L=G.toDOMNode(h,h),I=G.findDocumentOrShadowRoot(h);if($.latestElement=I.activeElement,Sn&&T.target!==L){L.focus();return}Gt.set(h,!0)}},[s,$,h,g.onFocus]),onKeyDown:C.useCallback(T=>{if(!s&&G.hasEditableTarget(h,T.target)){var L;(L=j.current)===null||L===void 0||L.handleKeyDown(T);var{nativeEvent:I}=T;if(G.isComposing(h)&&I.isComposing===!1&&(ln.set(h,!1),v(!1)),rt(T,g.onKeyDown)||G.isComposing(h))return;var{selection:U}=h,te=h.children[U!==null?U.focus.path[0]:0],ee=Qc(ie.string(te))==="rtl";if(Ie.isRedo(I)){T.preventDefault();var Z=h;typeof Z.redo=="function"&&Z.redo();return}if(Ie.isUndo(I)){T.preventDefault();var ue=h;typeof ue.undo=="function"&&ue.undo();return}if(Ie.isMoveLineBackward(I)){T.preventDefault(),X.move(h,{unit:"line",reverse:!0});return}if(Ie.isMoveLineForward(I)){T.preventDefault(),X.move(h,{unit:"line"});return}if(Ie.isExtendLineBackward(I)){T.preventDefault(),X.move(h,{unit:"line",edge:"focus",reverse:!0});return}if(Ie.isExtendLineForward(I)){T.preventDefault(),X.move(h,{unit:"line",edge:"focus"});return}if(Ie.isMoveBackward(I)){T.preventDefault(),U&&W.isCollapsed(U)?X.move(h,{reverse:!ee}):X.collapse(h,{edge:ee?"end":"start"});return}if(Ie.isMoveForward(I)){T.preventDefault(),U&&W.isCollapsed(U)?X.move(h,{reverse:ee}):X.collapse(h,{edge:ee?"start":"end"});return}if(Ie.isMoveWordBackward(I)){T.preventDefault(),U&&W.isExpanded(U)&&X.collapse(h,{edge:"focus"}),X.move(h,{unit:"word",reverse:!ee});return}if(Ie.isMoveWordForward(I)){T.preventDefault(),U&&W.isExpanded(U)&&X.collapse(h,{edge:"focus"}),X.move(h,{unit:"word",reverse:ee});return}if(Ht){if((ld||sr)&&U&&(Ie.isDeleteBackward(I)||Ie.isDeleteForward(I))&&W.isCollapsed(U)){var Q=ie.parent(h,U.anchor.path);if(ce.isElement(Q)&&b.isVoid(h,Q)&&(b.isInline(h,Q)||b.isBlock(h,Q))){T.preventDefault(),b.deleteBackward(h,{unit:"block"});return}}}else{if(Ie.isBold(I)||Ie.isItalic(I)||Ie.isTransposeCharacter(I)){T.preventDefault();return}if(Ie.isSoftBreak(I)){T.preventDefault(),b.insertSoftBreak(h);return}if(Ie.isSplitBlock(I)){T.preventDefault(),b.insertBreak(h);return}if(Ie.isDeleteBackward(I)){T.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(h,{direction:"backward"}):b.deleteBackward(h);return}if(Ie.isDeleteForward(I)){T.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(h,{direction:"forward"}):b.deleteForward(h);return}if(Ie.isDeleteLineBackward(I)){T.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(h,{direction:"backward"}):b.deleteBackward(h,{unit:"line"});return}if(Ie.isDeleteLineForward(I)){T.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(h,{direction:"forward"}):b.deleteForward(h,{unit:"line"});return}if(Ie.isDeleteWordBackward(I)){T.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(h,{direction:"backward"}):b.deleteBackward(h,{unit:"word"});return}if(Ie.isDeleteWordForward(I)){T.preventDefault(),U&&W.isExpanded(U)?b.deleteFragment(h,{direction:"forward"}):b.deleteForward(h,{unit:"word"});return}}}},[s,h,g.onKeyDown]),onPaste:C.useCallback(T=>{!s&&G.hasEditableTarget(h,T.target)&&!rt(T,g.onPaste)&&(!Ht||V0(T.nativeEvent)||sr)&&(T.preventDefault(),G.insertData(h,T.clipboardData))},[s,h,g.onPaste])}),C.createElement(Kb,{decorations:M,node:h,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:h.selection})))))},Yb=e=>{var{attributes:t,children:n}=e;return C.createElement("span",At({},t),n,at&&C.createElement("br",null))},Gb=()=>[],Qb=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&W.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),f0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},rt=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},Vu=e=>Jt(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),Jb=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},Xb=C.createContext(!1),ey=C.createContext({});function ty(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 ny=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],ry=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=zn(e,ny),[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(!b.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}=ty(t),m=C.useCallback(h=>{var D;switch(r&&r(t.children),h==null||(D=h.operation)===null||D===void 0?void 0:D.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(v=>({v:v.v+1,editor:t})),f(t)},[t,f,r,a,i]);C.useEffect(()=>(us.set(t,m),()=>{us.set(t,()=>{})}),[t,m]);var[p,g]=C.useState(G.isFocused(t));return C.useEffect(()=>{g(G.isFocused(t))},[t]),xr(()=>{var h=()=>g(G.isFocused(t));return ud>=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(ey.Provider,{value:c},C.createElement(Ed.Provider,{value:l},C.createElement(Ws.Provider,{value:l.editor},C.createElement(Xb.Provider,{value:p},n))))},Ku=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},Zu=(e,t,n)=>{var r=G.toDOMRange(e,t).getBoundingClientRect(),a=G.toDOMRange(e,n).getBoundingClientRect();return Ku(r,a)&&Ku(a,r)},ay=(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(Zu(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;)Zu(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 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 Gu(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 iy=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 $a.set(r,new WeakMap),r.addMark=(u,c)=>{var f,m;(f=Vs.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=b.above(r,{match:g=>ce.isElement(g)&&b.isBlock(r,g),at:r.selection});if(c){var[,f]=c,m=b.range(r,f,r.selection.anchor),p=ay(r,m);W.isCollapsed(p)||X.delete(r,{at:p})}}},r.apply=u=>{var c=[],f=[],m=ut.get(r);if(m!=null&&m.length){var p=m.map(R=>ib(R,u)).filter(Boolean);ut.set(r,p)}var g=Kt.get(r);g&&Kt.set(r,Mu(r,g,u));var h=Vt.get(r);if(h!=null&&h.at){var D=Ce.isPoint(h==null?void 0:h.at)?ds(r,h.at,u):Mu(r,h.at,u);Vt.set(r,D?Gu(Gu({},h),{},{at:D}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...En(r,u.path));break}case"set_selection":{var v;(v=cr.get(r))===null||v===void 0||v.unref(),cr.delete(r);break}case"insert_node":case"remove_node":{c.push(...En(r,P.parent(u.path)));break}case"merge_node":{var x=P.previous(u.path);c.push(...En(r,x));break}case"move_node":{var k=P.common(P.parent(u.path),P.parent(u.newPath));c.push(...En(r,k));var E;P.isBefore(u.path,u.newPath)?(c.push(...En(r,P.parent(u.path))),E=u.newPath):(c.push(...En(r,P.parent(u.newPath))),E=u.path);var _=ie.get(t,P.parent(E)),A=G.findKey(r,_),S=b.pathRef(r,P.parent(E));f.push([S,A]);break}}a(u);for(var[q,$]of c){var[j]=b.node(r,q);ba.set(j,$)}for(var[N,w]of f)if(N.current){var[F]=b.node(r,N.current);ba.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=G.toDOMRange(r,c),D=h.cloneContents(),v=D.childNodes[0];if(D.childNodes.forEach(j=>{j.textContent&&j.textContent.trim()!==""&&(v=j)}),g){var[x]=g,k=h.cloneRange(),E=G.toDOMNode(r,x);k.setEndAfter(E),D=k.cloneContents()}if(p&&(v=D.querySelector("[data-slate-spacer]")),Array.from(D.querySelectorAll("[data-slate-zero-width]")).forEach(j=>{var N=j.getAttribute("data-slate-zero-width")==="n";j.textContent=N?`
|
|
112
|
-
`:""}),hd(v)){var _=v.ownerDocument.createElement("span");_.style.whiteSpace="pre",_.appendChild(v),D.appendChild(_),v=_}var A=r.getFragment(),S=JSON.stringify(A),q=window.btoa(encodeURIComponent(S));v.setAttribute("data-slate-fragment",q),u.setData("application/".concat(n),q);var $=D.ownerDocument.createElement("div");return $.appendChild(D),$.setAttribute("hidden","true"),D.ownerDocument.body.appendChild($),u.setData("text/html",$.innerHTML),u.setData("text/plain",pd($)),D.ownerDocument.body.removeChild($),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||Q0(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&&X.splitNodes(r,{always:!0}),r.insertText(p),m=!0;return!0}return!1},r.onChange=u=>{var c=ud<18?Jl.unstable_batchedUpdates:f=>f();c(()=>{var f=us.get(r);f&&f(u),i(u)})},r},En=(e,t)=>{var n=[];for(var[r,a]of b.levels(e,{at:t})){var i=G.findKey(e,r);n.push([a,i])}return n};const sy={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,lastAnchor:null,dispatch:()=>{}},za=C.createContext(sy),oy=({attributes:e,children:t,element:n})=>{switch(n.type){case"block_quote":return d.jsx("blockquote",{...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})}},uy=({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})},Bd=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=oe.useIntl(),l=La(),{id:u,tabbableOption:c,setFocus:f,openTooltip:m,dispatch:p}=C.useContext(za),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 D=[{type:"openTooltip",value:null}];l.selection&&D.push({type:"lastAnchor",value:l.selection.anchor}),p(D)},contentEditable:!1,children:[d.jsxs("button",{...s,...g,className:V(e,a,{active:t}),onClick:h=>{h.stopPropagation(),h.preventDefault()},onMouseDown:h=>{h.stopPropagation(),h.preventDefault(),r()},onKeyDown:h=>{var D,v,x,k;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 q=E==null?void 0:E.previousElementSibling;q?_=q:_=(D=E==null?void 0:E.parentElement)==null?void 0:D.lastElementChild}else _||(_=(v=E==null?void 0:E.parentElement)==null?void 0:v.firstElementChild);const A=_==null?void 0:_.className.split(" ")[0];A&&(f(A),(x=_==null?void 0:_.querySelector("button"))==null||x.focus());break;default:const S=h.currentTarget.closest("fieldset");if(S){(k=S==null?void 0:S.previousElementSibling)==null||k.focus();break}}},children:[d.jsx($e,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(ao,{styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:m===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Qu=["ol_list","ul_list"],kd=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(b.nodes(e,{at:b.unhangRange(e,n),match:a=>{const i=a;return!b.isEditor(a)&&ce.isElement(a)&&i.type===t}}));return!!r},Ad=(e,t)=>{const n=kd(e,t),r=Qu.includes(t);X.unwrapNodes(e,{match:s=>{const o=s;return!b.isEditor(s)&&ce.isElement(s)&&Qu.includes(o.type)},split:!0});const i={type:n?"paragraph":r?"list_item":t};if(X.setNodes(e,i),!n&&r){const s={type:t,children:[]};X.wrapNodes(e,s)}},ly=({format:e,hasDivider:t=!1})=>{const{setFocus:n}=C.useContext(za),r=La(),a=kd(r,e);return d.jsx(Bd,{id:e,active:a,hasDivider:t,callback:()=>{Ad(r,e),n(a?null:e)}})},cy=e=>{const[t]=b.nodes(e,{match:n=>{const r=n;return!b.isEditor(n)&&ce.isElement(n)&&r.type==="link"}});return!!t},dy=(e,t,n)=>{cy(e)&&fy(e);const{selection:r}=e,a=r&&W.isCollapsed(r),i={type:"link",link:t,children:a?[{text:t}]:[]};a?X.insertNodes(e,i):(X.wrapNodes(e,i,{split:!0}),X.collapse(e,{edge:"end"}));const s=document.getElementById(n);if(s){const o=s.querySelector(".input");o&&(o==null||o.focus())}},fy=e=>{X.unwrapNodes(e,{match:t=>{const n=t;return!b.isEditor(t)&&ce.isElement(t)&&n.type==="link"}})};const hy=e=>["bold","italic","strikeThrough"].includes(e),Fd=(e,t)=>{const n=b.marks(e);return n?n[t]===!0:!1},Td=(e,t)=>{Fd(e,t)?b.removeMark(e,t):b.addMark(e,t,!0)},my=({format:e,hasDivider:t=!1})=>{const{setFocus:n}=C.useContext(za),r=La(),a=Fd(r,e);return d.jsx(Bd,{id:e,active:a,hasDivider:t,callback:()=>{Td(r,e),n(a?null:e)}})},ya=["bold","italic","strikeThrough"],py=["ol_list","ul_list","block_quote"];const gy=({...e})=>{const t=oe.useIntl();return d.jsx(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:[ya.map((n,r)=>d.jsx(my,{format:n,hasDivider:r===ya.length-1},n)),py.map((n,r)=>d.jsx(ly,{format:n,hasDivider:r===1},n))]})]})})},jn={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 Ju(e){if(e)throw e}var ia=Object.prototype.hasOwnProperty,Sd=Object.prototype.toString,Xu=Object.defineProperty,el=Object.getOwnPropertyDescriptor,tl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Sd.call(t)==="[object Array]"},nl=function(t){if(!t||Sd.call(t)!=="[object Object]")return!1;var n=ia.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&ia.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||ia.call(t,a)},rl=function(t,n){Xu&&n.name==="__proto__"?Xu(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},al=function(t,n){if(n==="__proto__")if(ia.call(t,n)){if(el)return el(t,n).value}else return;return t[n]},vy=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=al(o,n),a=al(t,n),o!==a&&(c&&a&&(nl(a)||(i=tl(a)))?(i?(i=!1,s=r&&tl(r)?r:[]):s=r&&nl(r)?r:{},rl(o,{name:n,newValue:e(c,s,a)})):typeof a<"u"&&rl(o,{name:n,newValue:a}));return o};const pi=bn(vy);function hs(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 by(){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?yy(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 yy(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 dr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?il(e.position):"start"in e||"end"in e?il(e):"line"in e||"column"in e?ms(e):""}function ms(e){return sl(e&&e.line)+":"+sl(e&&e.column)}function il(e){return ms(e&&e.start)+"-"+ms(e&&e.end)}function sl(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=dr(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:Dy,dirname:Cy,extname:xy,join:wy,sep:"/"};function Dy(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');kr(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 Cy(e){if(kr(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 xy(e){kr(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 wy(...e){let t=-1,n;for(;++t<e.length;)kr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Ey(n)}function Ey(e){kr(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 kr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const By={cwd:ky};function ky(){return"/"}function ps(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Ay(e){if(typeof e=="string")e=new URL(e);else if(!ps(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 Fy(e)}function Fy(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 gi=["history","path","basename","stem","extname","dirname"];class Ty{constructor(t){let n;t?ps(t)?n={path:t}:typeof t=="string"||Sy(t)?n={value:t}:n=t:n={},this.cwd=By.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<gi.length;){const i=gi[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)gi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ft.basename(this.path):void 0}set basename(t){bi(t,"basename"),vi(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){ol(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(vi(t,"extname"),ol(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){ps(t)&&(t=Ay(t)),bi(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){bi(t,"stem"),vi(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 vi(e,t){if(e&&e.includes(Ft.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ft.sep+"`")}function bi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ol(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Sy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const jy=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},Oy={}.hasOwnProperty;class Ys extends jy{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=by()}copy(){const t=new Ys;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(pi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ci("data",this.frozen),this.namespace[t]=n,this):Oy.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ci("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=Wr(t),r=this.parser||this.Parser;return yi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),yi("process",this.parser||this.Parser),Di("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=Wr(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);Ry(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(),yi("processSync",this.parser||this.Parser),Di("processSync",this.compiler||this.Compiler),this.process(t,a),ll("processSync","process",n),r;function a(i,s){n=!0,Ju(i),r=s}}run(t,n,r){ul(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=Wr(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),ll("runSync","run",r),a;function i(s,o){Ju(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=Wr(n),a=this.compiler||this.Compiler;return Di("stringify",a),ul(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Ci("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=pi(!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];hs(h)&&hs(p)&&(p=pi(!0,h,p)),r[m]=[u,p,...g]}}}}const Py=new Ys().freeze();function yi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Di(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ci(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 ul(e){if(!hs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function ll(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Wr(e){return Ny(e)?e:new Ty(e)}function Ny(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Ry(e){return typeof e=="string"||My(e)}function My(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Iy={};function $y(e,t){const n=t||Iy,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return jd(e,r,a)}function jd(e,t,n){if(Ly(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]=jd(e[a],t,n);return r.join("")}function Ly(e){return!!(e&&typeof e=="object")}const dl=document.createElement("i");function Gs(e){const t="&"+e+";";dl.innerHTML=t;const n=dl.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 fl={}.hasOwnProperty;function zy(e){const t={};let n=-1;for(;++n<e.length;)qy(t,e[n]);return t}function qy(e,t){let n;for(n in t){const a=(fl.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){fl.call(a,s)||(a[s]=[]);const o=i[s];Wy(a[s],Array.isArray(o)?o:o?[o]:[])}}}function Wy(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 Od(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 Rn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Tt=rn(/[A-Za-z]/),Et=rn(/[\dA-Za-z]/),Hy=rn(/[#-'*+\--9=?A-Z^-~]/);function gs(e){return e!==null&&(e<32||e===127)}const vs=rn(/\d/),Uy=rn(/[\dA-Fa-f]/),Vy=rn(/[!-/:-@[-`{-~]/);function ve(e){return e!==null&&e<-2}function ct(e){return e!==null&&(e<0||e===32)}function ke(e){return e===-2||e===-1||e===32}const Ky=rn(/\p{P}|\p{S}/u),Zy=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 ke(l)?(e.enter(n),o(l)):t(l)}function o(l){return ke(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const Yy={tokenize:Gy};function Gy(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 Qy={tokenize:Jy},hl={tokenize:Xy};function Jy(e){const t=this,n=[];let r=0,a,i,s;return o;function o(k){if(r<n.length){const E=n[r];return t.containerState=E[1],e.attempt(E[0].continuation,l,u)(k)}return u(k)}function l(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&x();const E=t.events.length;let _=E,A;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){A=t.events[_][1].end;break}v(r);let S=E;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},A),S++;return jt(t.events,_+1,0,t.events.slice(E)),t.events.length=S,u(k)}return o(k)}function u(k){if(r===n.length){if(!a)return m(k);if(a.currentConstruct&&a.currentConstruct.concrete)return g(k);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(hl,c,f)(k)}function c(k){return a&&x(),v(r),m(k)}function f(k){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(k)}function m(k){return t.containerState={},e.attempt(hl,p,g)(k)}function p(k){return r++,n.push([t.currentConstruct,t.containerState]),m(k)}function g(k){if(k===null){a&&x(),v(0),e.consume(k);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),h(k)}function h(k){if(k===null){D(e.exit("chunkFlow"),!0),v(0),e.consume(k);return}return ve(k)?(e.consume(k),D(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(k),h)}function D(k,E){const _=t.sliceStream(k);if(E&&_.push(null),k.previous=i,i&&(i.next=k),i=k,a.defineSkip(k.start),a.write(_),t.parser.lazy[k.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 S=t.events.length;let q=S,$,j;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){if($){j=t.events[q][1].end;break}$=!0}for(v(r),A=S;A<t.events.length;)t.events[A][1].end=Object.assign({},j),A++;jt(t.events,q+1,0,t.events.slice(S)),t.events.length=A}}function v(k){let E=n.length;for(;E-- >k;){const _=n[E];t.containerState=_[1],_[0].exit.call(t,e)}n.length=k}function x(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function Xy(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 ml(e){if(e===null||ct(e)||Zy(e))return 1;if(Ky(e))return 2}function Qs(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 bs={name:"attention",tokenize:t1,resolveAll:e1};function e1(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);pl(f,-l),pl(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,Qs(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 t1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=ml(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=ml(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 pl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const n1={name:"autolink",tokenize:r1};function r1(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||gs(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),c):Hy(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:a1,partial:!0};function a1(e,t,n){return r;function r(i){return ke(i)?Ne(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ve(i)?t(i):n(i)}}const Pd={name:"blockQuote",tokenize:i1,continuation:{tokenize:s1},exit:o1};function i1(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 ke(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function s1(e,t,n){const r=this;return a;function a(s){return ke(s)?Ne(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Pd,t,n)(s)}}function o1(e){e.exit("blockQuote")}const Nd={name:"characterEscape",tokenize:u1};function u1(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 Vy(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Rd={name:"characterReference",tokenize:l1};function l1(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=Uy,c):(e.enter("characterReferenceValue"),i=7,s=vs,c(f))}function c(f){if(f===59&&a){const m=e.exit("characterReferenceValue");return s===Et&&!Gs(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 gl={tokenize:d1,partial:!0},vl={name:"codeFenced",tokenize:c1,concrete:!0};function c1(e,t,n){const r=this,a={tokenize:_,partial:!0};let i=0,s=0,o;return l;function l(A){return u(A)}function u(A){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[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"),ke(A)?Ne(e,f,"whitespace")(A):f(A))}function f(A){return A===null||ve(A)?(e.exit("codeFencedFence"),r.interrupt?t(A):e.check(gl,h,E)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(A))}function m(A){return A===null||ve(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(A)):ke(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ne(e,p,"whitespace")(A)):A===96&&A===o?n(A):(e.consume(A),m)}function p(A){return A===null||ve(A)?f(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(A))}function g(A){return A===null||ve(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,E,D)(A)}function D(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),v}function v(A){return i>0&&ke(A)?Ne(e,x,"linePrefix",i+1)(A):x(A)}function x(A){return A===null||ve(A)?e.check(gl,h,E)(A):(e.enter("codeFlowValue"),k(A))}function k(A){return A===null||ve(A)?(e.exit("codeFlowValue"),x(A)):(e.consume(A),k)}function E(A){return e.exit("codeFenced"),t(A)}function _(A,S,q){let $=0;return j;function j(M){return A.enter("lineEnding"),A.consume(M),A.exit("lineEnding"),N}function N(M){return A.enter("codeFencedFence"),ke(M)?Ne(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)):q(M)}function F(M){return M===o?($++,A.consume(M),F):$>=s?(A.exit("codeFencedFenceSequence"),ke(M)?Ne(A,R,"whitespace")(M):R(M)):q(M)}function R(M){return M===null||ve(M)?(A.exit("codeFencedFence"),S(M)):q(M)}}}function d1(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 xi={name:"codeIndented",tokenize:h1},f1={tokenize:m1,partial:!0};function h1(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(f1,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 m1(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 p1={name:"codeText",tokenize:b1,resolve:g1,previous:v1};function g1(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 v1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function b1(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 Md(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,y1(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 y1(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 D=[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,D.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):D.pop(),m=D.length;m--;){const v=o.slice(D[m],D[m+1]),x=i.pop();l.unshift([x,x+v.length-1]),jt(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 D1={tokenize:w1,resolve:x1},C1={tokenize:E1,partial:!0};function x1(e){return Md(e),e}function w1(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(C1,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 E1(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 Id(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||gs(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||ve(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||ct(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||gs(v)?n(v):(e.consume(v),v===92?D:h)}function D(v){return v===40||v===41||v===92?(e.consume(v),h):h(v)}}function $d(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=!ke(p)),p===92?m:f)}function m(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}}function Ld(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 fr(e,t){let n;return r;function r(a){return ve(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):ke(a)?Ne(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const _1={name:"definition",tokenize:k1},B1={tokenize:A1,partial:!0};function k1(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return $d.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return a=Rn(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)?fr(e,u)(p):u(p)}function u(p){return Id(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(B1,f,f)(p)}function f(p){return ke(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 A1(e,t,n){return r;function r(o){return ct(o)?fr(e,a)(o):n(o)}function a(o){return Ld(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return ke(o)?Ne(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ve(o)?t(o):n(o)}}const F1={name:"hardBreakEscape",tokenize:T1};function T1(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 S1={name:"headingAtx",tokenize:O1,resolve:j1};function j1(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 O1(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)):ke(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 P1=["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"],bl=["pre","script","style","textarea"],N1={name:"htmlFlow",tokenize:$1,resolveTo:I1,concrete:!0},R1={tokenize:z1,partial:!0},M1={tokenize:L1,partial:!0};function I1(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 $1(e,t,n){const r=this;let a,i,s,o,l;return u;function u(B){return c(B)}function c(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),f}function f(B){return B===33?(e.consume(B),m):B===47?(e.consume(B),i=!0,h):B===63?(e.consume(B),a=3,r.interrupt?t:y):Tt(B)?(e.consume(B),s=String.fromCharCode(B),D):n(B)}function m(B){return B===45?(e.consume(B),a=2,p):B===91?(e.consume(B),a=5,o=0,g):Tt(B)?(e.consume(B),a=4,r.interrupt?t:y):n(B)}function p(B){return B===45?(e.consume(B),r.interrupt?t:y):n(B)}function g(B){const T="CDATA[";return B===T.charCodeAt(o++)?(e.consume(B),o===T.length?r.interrupt?t:w:g):n(B)}function h(B){return Tt(B)?(e.consume(B),s=String.fromCharCode(B),D):n(B)}function D(B){if(B===null||B===47||B===62||ct(B)){const T=B===47,L=s.toLowerCase();return!T&&!i&&bl.includes(L)?(a=1,r.interrupt?t(B):w(B)):P1.includes(s.toLowerCase())?(a=6,T?(e.consume(B),v):r.interrupt?t(B):w(B)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):i?x(B):k(B))}return B===45||Et(B)?(e.consume(B),s+=String.fromCharCode(B),D):n(B)}function v(B){return B===62?(e.consume(B),r.interrupt?t:w):n(B)}function x(B){return ke(B)?(e.consume(B),x):j(B)}function k(B){return B===47?(e.consume(B),j):B===58||B===95||Tt(B)?(e.consume(B),E):ke(B)?(e.consume(B),k):j(B)}function E(B){return B===45||B===46||B===58||B===95||Et(B)?(e.consume(B),E):_(B)}function _(B){return B===61?(e.consume(B),A):ke(B)?(e.consume(B),_):k(B)}function A(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),l=B,S):ke(B)?(e.consume(B),A):q(B)}function S(B){return B===l?(e.consume(B),l=null,$):B===null||ve(B)?n(B):(e.consume(B),S)}function q(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||ct(B)?_(B):(e.consume(B),q)}function $(B){return B===47||B===62||ke(B)?k(B):n(B)}function j(B){return B===62?(e.consume(B),N):n(B)}function N(B){return B===null||ve(B)?w(B):ke(B)?(e.consume(B),N):n(B)}function w(B){return B===45&&a===2?(e.consume(B),Y):B===60&&a===1?(e.consume(B),K):B===62&&a===4?(e.consume(B),z):B===63&&a===3?(e.consume(B),y):B===93&&a===5?(e.consume(B),ne):ve(B)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(R1,J,F)(B)):B===null||ve(B)?(e.exit("htmlFlowData"),F(B)):(e.consume(B),w)}function F(B){return e.check(M1,R,J)(B)}function R(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),M}function M(B){return B===null||ve(B)?F(B):(e.enter("htmlFlowData"),w(B))}function Y(B){return B===45?(e.consume(B),y):w(B)}function K(B){return B===47?(e.consume(B),s="",se):w(B)}function se(B){if(B===62){const T=s.toLowerCase();return bl.includes(T)?(e.consume(B),z):w(B)}return Tt(B)&&s.length<8?(e.consume(B),s+=String.fromCharCode(B),se):w(B)}function ne(B){return B===93?(e.consume(B),y):w(B)}function y(B){return B===62?(e.consume(B),z):B===45&&a===2?(e.consume(B),y):w(B)}function z(B){return B===null||ve(B)?(e.exit("htmlFlowData"),J(B)):(e.consume(B),z)}function J(B){return e.exit("htmlFlow"),t(B)}}function L1(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 z1(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(qa,t,n)}}const q1={name:"htmlText",tokenize:W1};function W1(e,t,n){const r=this;let a,i,s;return o;function o(y){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(y),l}function l(y){return y===33?(e.consume(y),u):y===47?(e.consume(y),_):y===63?(e.consume(y),k):Tt(y)?(e.consume(y),q):n(y)}function u(y){return y===45?(e.consume(y),c):y===91?(e.consume(y),i=0,g):Tt(y)?(e.consume(y),x):n(y)}function c(y){return y===45?(e.consume(y),p):n(y)}function f(y){return y===null?n(y):y===45?(e.consume(y),m):ve(y)?(s=f,K(y)):(e.consume(y),f)}function m(y){return y===45?(e.consume(y),p):f(y)}function p(y){return y===62?Y(y):y===45?m(y):f(y)}function g(y){const z="CDATA[";return y===z.charCodeAt(i++)?(e.consume(y),i===z.length?h:g):n(y)}function h(y){return y===null?n(y):y===93?(e.consume(y),D):ve(y)?(s=h,K(y)):(e.consume(y),h)}function D(y){return y===93?(e.consume(y),v):h(y)}function v(y){return y===62?Y(y):y===93?(e.consume(y),v):h(y)}function x(y){return y===null||y===62?Y(y):ve(y)?(s=x,K(y)):(e.consume(y),x)}function k(y){return y===null?n(y):y===63?(e.consume(y),E):ve(y)?(s=k,K(y)):(e.consume(y),k)}function E(y){return y===62?Y(y):k(y)}function _(y){return Tt(y)?(e.consume(y),A):n(y)}function A(y){return y===45||Et(y)?(e.consume(y),A):S(y)}function S(y){return ve(y)?(s=S,K(y)):ke(y)?(e.consume(y),S):Y(y)}function q(y){return y===45||Et(y)?(e.consume(y),q):y===47||y===62||ct(y)?$(y):n(y)}function $(y){return y===47?(e.consume(y),Y):y===58||y===95||Tt(y)?(e.consume(y),j):ve(y)?(s=$,K(y)):ke(y)?(e.consume(y),$):Y(y)}function j(y){return y===45||y===46||y===58||y===95||Et(y)?(e.consume(y),j):N(y)}function N(y){return y===61?(e.consume(y),w):ve(y)?(s=N,K(y)):ke(y)?(e.consume(y),N):$(y)}function w(y){return y===null||y===60||y===61||y===62||y===96?n(y):y===34||y===39?(e.consume(y),a=y,F):ve(y)?(s=w,K(y)):ke(y)?(e.consume(y),w):(e.consume(y),R)}function F(y){return y===a?(e.consume(y),a=void 0,M):y===null?n(y):ve(y)?(s=F,K(y)):(e.consume(y),F)}function R(y){return y===null||y===34||y===39||y===60||y===61||y===96?n(y):y===47||y===62||ct(y)?$(y):(e.consume(y),R)}function M(y){return y===47||y===62||ct(y)?$(y):n(y)}function Y(y){return y===62?(e.consume(y),e.exit("htmlTextData"),e.exit("htmlText"),t):n(y)}function K(y){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),se}function se(y){return ke(y)?Ne(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(y):ne(y)}function ne(y){return e.enter("htmlTextData"),s(y)}}const Js={name:"labelEnd",tokenize:Y1,resolveTo:Z1,resolveAll:K1},H1={tokenize:G1},U1={tokenize:Q1},V1={tokenize:J1};function K1(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 Z1(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,Qs(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 Y1(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(Rn(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(H1,c,s?c:f)(m):m===91?e.attempt(U1,c,s?u:f)(m):s?c(m):f(m)}function u(m){return e.attempt(V1,c,f)(m)}function c(m){return t(m)}function f(m){return i._balanced=!0,n(m)}}function G1(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)?fr(e,i)(f):i(f)}function i(f){return f===41?c(f):Id(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return ct(f)?fr(e,l)(f):c(f)}function o(f){return n(f)}function l(f){return f===34||f===39||f===40?Ld(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):c(f)}function u(f){return ct(f)?fr(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 Q1(e,t,n){const r=this;return a;function a(o){return $d.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Rn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function J1(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 X1={name:"labelStartImage",tokenize:eD,resolveAll:Js.resolveAll};function eD(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 tD={name:"labelStartLink",tokenize:nD,resolveAll:Js.resolveAll};function nD(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 wi={name:"lineEnding",tokenize:rD};function rD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ne(e,t,"linePrefix")}}const sa={name:"thematicBreak",tokenize:aD};function aD(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"),ke(u)?Ne(e,o,"whitespace")(u):o(u))}}const ot={name:"list",tokenize:oD,continuation:{tokenize:uD},exit:cD},iD={tokenize:dD,partial:!0},sD={tokenize:lD,partial:!0};function oD(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:vs(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(sa,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 vs(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(iD,m,f))}function c(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function f(p){return ke(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 uD(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||!ke(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(sD,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 lD(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 cD(e){e.exit(this.containerState.type)}function dD(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!ke(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const yl={name:"setextUnderline",tokenize:hD,resolveTo:fD};function fD(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 hD(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"),ke(u)?Ne(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ve(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const mD={tokenize:pD};function pD(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(D1,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 gD={resolveAll:qd()},vD=zd("string"),bD=zd("text");function zd(e){return{tokenize:t,resolveAll:qd(e==="text"?yD: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 yD(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 DD(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:k,exit:E,attempt:S(_),check:S(A),interrupt:S(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(N){return s=bt(s,N),D(),s[s.length-1]!==null?[]:(q(t,0),u.events=Qs(i,u.events,u),u.events)}function m(N,w){return xD(p(N),w)}function p(N){return CD(s,N)}function g(){const{line:N,column:w,offset:F,_index:R,_bufferIndex:M}=r;return{line:N,column:w,offset:F,_index:R,_bufferIndex:M}}function h(N){a[N.line]=N.column,j()}function D(){let N;for(;r._index<s.length;){const w=s[r._index];if(typeof w=="string")for(N=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===N&&r._bufferIndex<w.length;)v(w.charCodeAt(r._bufferIndex));else v(w)}}function v(N){c=c(N)}function x(N){ve(N)?(r.line++,r.column=1,r.offset+=N===-3?2:1,j()):N!==-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=N}function k(N,w){const F=w||{};return F.type=N,F.start=g(),u.events.push(["enter",F,u]),o.push(F),F}function E(N){const w=o.pop();return w.end=g(),u.events.push(["exit",w,u]),w}function _(N,w){q(N,w.from)}function A(N,w){w.restore()}function S(N,w){return F;function F(R,M,Y){let K,se,ne,y;return Array.isArray(R)?J(R):"tokenize"in R?J([R]):z(R);function z(I){return U;function U(te){const ee=te!==null&&I[te],Z=te!==null&&I.null,ue=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(Z)?Z:Z?[Z]:[]];return J(ue)(te)}}function J(I){return K=I,se=0,I.length===0?Y:B(I[se])}function B(I){return U;function U(te){return y=$(),ne=I,I.partial||(u.currentConstruct=I),I.name&&u.parser.constructs.disable.null.includes(I.name)?L():I.tokenize.call(w?Object.assign(Object.create(u),w):u,l,T,L)(te)}}function T(I){return N(ne,y),M}function L(I){return y.restore(),++se<K.length?B(K[se]):Y}}}function q(N,w){N.resolveAll&&!i.includes(N)&&i.push(N),N.resolve&&jt(u.events,w,u.events.length-w,N.resolve(u.events.slice(w),u)),N.resolveTo&&(u.events=N.resolveTo(u.events,u))}function $(){const N=g(),w=u.previous,F=u.currentConstruct,R=u.events.length,M=Array.from(o);return{restore:Y,from:R};function Y(){r=N,u.previous=w,u.currentConstruct=F,u.events.length=R,o=M,j()}}function j(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function CD(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 xD(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 A=G.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!A)return null;var _=f?A:G.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!_)return null;var E={anchor:A,focus:_};return W.isExpanded(E)&&W.isForward(E)&&yt(u)&&v.void(e,{at:E.focus,mode:"highest"})&&(E=v.unhangRange(e,E,{voids:!0})),E}};function ub(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 wd(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 lb(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 cb(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 Ed(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=lb(i,a),o=Math.min(i.length-s,a.length-s),l=cb(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=wd(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 Ed(e,{start:r,end:l,text:o})}function fb(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 hb(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 Ur(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 mb=25,pb=200,gb=function(){},vb=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=Kt.get(t);if(Kt.delete(t),w){var{selection:T}=t,R=Lu(t,w);R&&(!T||!W.equals(R,T))&&Q.select(t,R)}},f=()=>{var w=Vt.get(t);if(Vt.delete(t),!!w){if(w.at){var T=Ce.isPoint(w.at)?hs(t,w.at):Lu(t,w.at);if(!T)return;var R=v.range(t,T);(!t.selection||!W.equals(t.selection,R))&&Q.select(t,T)}w.run()}},m=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!_()&&!A()){c();return}a||(a=!0,setTimeout(()=>a=!1)),A()&&(a="action");var w=t.selection&&v.rangeRef(t,t.selection,{affinity:"forward"});$t.set(t,t.marks),gb("flush",Vt.get(t),ut.get(t));for(var T=_(),R;R=(M=ut.get(t))===null||M===void 0?void 0:M[0];){var M,Y,K=wt.get(t);K!==void 0&&(wt.delete(t),t.marks=K),K&&u===!1&&(u=null);var se=fb(R);(!t.selection||!W.equals(t.selection,se))&&Q.select(t,se),R.diff.text?v.insertText(t,R.diff.text):v.deleteFragment(t),ut.set(t,(Y=ut.get(t))===null||Y===void 0?void 0:Y.filter(q=>{var{id:X}=q;return X!==R.id})),ub(t,R)||(T=!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))&&Q.select(t,ne),A()){f();return}T&&n(),n.flush(),r.flush(),c();var y=$t.get(t);$t.delete(t),y!==void 0&&(t.marks=y,t.onChange())},p=w=>{i&&clearTimeout(i),i=setTimeout(()=>{ln.set(t,!1),m()},mb)},g=w=>{ln.set(t,!0),i&&(clearTimeout(i),i=null)},h=function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,R=ls.get(t);if(R){if(_()||T){R.style.display="none";return}R.style.removeProperty("display")}},D=(w,T)=>{var R,M=(R=ut.get(t))!==null&&R!==void 0?R:[];ut.set(t,M);var Y=ie.leaf(t,w),K=M.findIndex(y=>P.equals(y.path,w));if(K<0){var se=Ed(Y.text,T);se&&M.push({path:w,diff:T,id:l++}),h();return}var ne=db(Y.text,M[K].diff,T);if(!ne){M.splice(K,1),h();return}M[K]=Ur(Ur({},M[K]),{},{diff:ne})},b=function(T){var{at:R}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,Kt.delete(t),n.cancel(),r.cancel(),A()&&m(),Vt.set(t,{at:R,run:T}),o=setTimeout(m)},x=w=>{var T;s&&(clearTimeout(s),s=null);var{inputType:R}=w,M=null,Y=w.dataTransfer||w.data||void 0;u!==!1&&R!=="insertText"&&R!=="insertCompositionText"&&(u=!1);var[K]=w.getTargetRanges();K&&(M=G.toSlateRange(t,K,{exactMatch:!1,suppressThrow:!0}));var se=G.getWindow(t),ne=se.getSelection();if(!M&&ne&&(K=ne,M=G.toSlateRange(t,ne,{exactMatch:!1,suppressThrow:!0})),M=(T=M)!==null&&T!==void 0?T:t.selection,!!M){var y=!0;if(R.startsWith("delete")){if(W.isExpanded(M)){var[q,X]=W.edges(M),B=ie.leaf(t,q.path);if(B.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 L=R.endsWith("Backward")?"backward":"forward",[I,U]=W.edges(M),[te,ee]=v.leaf(t,I.path),Z={text:"",start:I.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,Z]:[Z],me=wd(te.text,...ge);if(me.length===0&&(y=!1),W.isExpanded(M)){if(y&&P.equals(M.anchor.path,M.focus.path)){var _e={path:M.anchor.path,offset:I.offset},Se=v.range(t,_e,_e);return F(Se),D(M.anchor.path,{text:"",end:U.offset,start:I.offset})}return b(()=>v.deleteFragment(t,{direction:L}),{at:M})}}switch(R){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return b(()=>v.deleteFragment(t),{at:M});case"deleteContent":case"deleteContentForward":{var{anchor:Pe}=M;if(y&&W.isCollapsed(M)){var Ge=ie.leaf(t,Pe.path);if(Pe.offset<Ge.text.length)return D(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 y&&tt&&W.isCollapsed(M)&&Ze.offset>0?D(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(vb(Y))return b(()=>G.insertData(t,Y),{at:M});var Ae=Y??"";if(wt.get(t)&&(Ae=Ae.replace("\uFEFF","")),R==="insertText"&&/.*\n.*\n$/.test(Ae)&&(Ae=Ae.slice(0,-1)),Ae.includes(`
|
|
108
|
+
`))return b(()=>{var pe=Ae.split(`
|
|
109
|
+
`);pe.forEach((De,Ue)=>{De&&v.insertText(t,De),Ue!==pe.length-1&&v.insertSoftBreak(t)})},{at:M});if(P.equals(M.anchor.path,M.focus.path)){var[We,Le]=W.edges(M),H={start:We.offset,end:Le.offset,text:Ae};if(Ae&&u&&R==="insertCompositionText"){var ae=u.start+u.text.search(/\S|$/),fe=H.start+H.text.search(/\S|$/);fe===ae+1&&H.end===u.start+u.text.length?(H.start-=1,u=null,j()):u=!1}else R==="insertText"?u===null?u=H:u&&W.isCollapsed(M)&&u.end+u.text.length===We.offset?u=Ur(Ur({},u),{},{text:u.text+Ae}):u=!1:u=!1;if(y){D(We.path,H);return}}return b(()=>v.insertText(t,Ae),{at:M})}}}},A=()=>!!Vt.get(t),_=()=>{var w;return!!((w=ut.get(t))!==null&&w!==void 0&&w.length)},E=()=>A()||_(),k=()=>a,F=w=>{Kt.set(t,w),s&&(clearTimeout(s),s=null);var{selection:T}=t;if(w){var R=!T||!P.equals(T.anchor.path,w.anchor.path),M=!T||!P.equals(T.anchor.path.slice(0,-1),w.anchor.path.slice(0,-1));(R&&u||M)&&(u=!1),(R||_())&&(s=setTimeout(m,pb))}},z=()=>{(A()||!_())&&m()},$=w=>{_()||(h(!0),setTimeout(h))},j=()=>{A()||(o=setTimeout(m))},N=w=>{if(!(_()||A())&&w.some(R=>Qs(t,R,w))){var T;(T=bd.get(t))===null||T===void 0||T()}};return{flush:m,scheduleFlush:j,hasPendingDiffs:_,hasPendingAction:A,hasPendingChanges:E,isFlushing:k,handleUserSelect:F,handleCompositionEnd:p,handleCompositionStart:g,handleDOMBeforeInput:x,handleKeyDown:$,handleDomMutations:N,handleInput:z}}function yb(){var e=C.useRef(!1);return C.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var kr=sa?C.useLayoutEffect:C.useEffect;function Db(e,t,n){var[r]=C.useState(()=>new MutationObserver(t));kr(()=>{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 Cb=["node"];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 xb(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){Dt(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 wb={subtree:!0,childList:!0,characterData:!0},Eb=at?e=>{var{node:t}=e,n=Wn(e,Cb);if(!at)return null;var r=nn(),a=yb(),[i]=C.useState(()=>bb(xb({editor:r},n)));return Db(t,i.handleDomMutations,wb),Ys.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,_b=["anchor","focus"],kb=["anchor","focus"],Bb=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),_d=(e,t)=>{var n=Wn(e,_b),r=Wn(t,kb);return e[Hn]===t[Hn]&&Bb(n,r)},Ab=(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)||!_d(r,a))return!1}return!0},Fb=(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||!_d(r,a))return!1}return!0};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 Tb(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){Dt(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 Sb=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=nn(),s=G.findPath(i,a),o=P.parent(s),l=!!n[yd];return i.isVoid(r)?C.createElement(gi,{length:ie.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&v.string(i,o)===""?C.createElement(gi,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?C.createElement(gi,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
|
|
110
|
+
`?C.createElement(Uu,{isTrailing:!0,text:n.text}):C.createElement(Uu,{text:n.text})},Uu=e=>{var{text:t,isTrailing:n=!1}=e,r=C.useRef(null),a=()=>"".concat(t??"").concat(n?`
|
|
111
|
+
`:""),[i]=C.useState(a);return kr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),C.createElement(jb,{ref:r},i)},jb=C.memo(C.forwardRef((e,t)=>C.createElement("span",{"data-slate-string":!0,ref:t},e.children))),gi=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",Tb({},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 kd(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 Ob=at?300:0;function Pb(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function Ku(e){e.current&&(clearTimeout(e.current),e.current=null)}var Nb=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=x=>C.createElement(Mb,kd({},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(Pb(l,x==null),x==null){var A;ls.delete(o),(A=t.onPlaceholderResize)===null||A===void 0||A.call(t,null)}else{if(ls.set(o,x),!l.current){var _=window.ResizeObserver||z0;l.current=new _(()=>{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(Sb,{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},Ob)):(Ku(m),f(!1)),()=>Ku(m)),[h,f]),h&&c){var D={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:lr?"inherit":void 0},contentEditable:!1,ref:p}};g=C.createElement(C.Fragment,null,i(D),g)}var b={"data-slate-leaf":!0};return s({attributes:b,children:g,leaf:t,text:r})},Rb=C.memo(Nb,(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]),Mb=e=>{var{attributes:t,children:n}=e;return C.createElement("span",kd({},t),n)},Ib=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=G.findKey(o,s),f=[],m=0;m<u.length;m++){var p=u[m];f.push(C.createElement(Rb,{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 D=qa.get(o);h?(D==null||D.set(c,h),hn.set(s,h),_r.set(h,s)):(D==null||D.delete(c),hn.delete(s),l.current&&_r.delete(l.current)),l.current=h},[l,o,c,s]);return C.createElement("span",{"data-slate-node":"text",ref:g},f)},Bd=C.memo(Ib,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&Fb(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 $b=e=>{var{decorations:t,element:n,renderElement:r=x=>C.createElement(zb,ps({},x)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=nn(),l=Hb(),u=o.isInline(n),c=G.findKey(o,n),f=C.useCallback(x=>{var A=qa.get(o);x?(A==null||A.set(c,x),hn.set(n,x),_r.set(x,n)):(A==null||A.delete(c),hn.delete(n))},[o,c,n]),m=Fd({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=ad(g);h==="rtl"&&(p.dir=h)}if(v.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var D=u?"span":"div",[[b]]=ie.texts(n);m=C.createElement(D,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},C.createElement(Bd,{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})},Lb=C.memo($b,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&Ab(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&W.equals(e.selection,t.selection))),zb=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)},Ad=C.createContext(()=>[]),qb=()=>C.useContext(Ad),Wb=C.createContext(!1),Fd=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=qb(),l=nn(),u=G.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=G.findKey(l,g),D=v.range(l,p),b=s&&W.intersection(D,s),x=o([g,p]);for(var A of t){var _=W.intersection(A,D);_&&x.push(_)}ce.isElement(g)?c.push(C.createElement(Wb.Provider,{key:"provider-".concat(h.id),value:!!b},C.createElement(Lb,{decorations:x,element:g,key:h.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:b}))):c.push(C.createElement(Bd,{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},Td=C.createContext(!1),Hb=()=>C.useContext(Td),Sd=C.createContext(null),Jn=()=>{var e=C.useContext(Sd);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function Ub(){var e=nn(),t=C.useRef(!1),n=C.useRef(0),r=C.useCallback(()=>{if(!t.current){t.current=!0;var a=G.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 Vb=3,Kb={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"},Zb={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"},Yb={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Me=e=>{var t=Kb[e],n=Zb[e],r=Yb[e],a=t&&ai(t),i=n&&ai(n),s=r&&ai(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")},Gb=(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}},Qb={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class jd 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,Qb)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=Gb(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(jd,"contextType",Vs);var Jb=at?jd:e=>{var{children:t}=e;return C.createElement(C.Fragment,null,t)},Xb=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],ey=["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 ty=e=>C.createElement(C.Fragment,null,Fd(e)),ny=e=>{var t=C.useCallback(S=>C.createElement(ry,At({},S)),[]),{autoFocus:n,decorate:r=ay,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=iy,style:f={},as:m="div",disableDefaultStyles:p=!1}=e,g=Wn(e,Xb),h=Jn(),[D,b]=C.useState(!1),x=C.useRef(null),A=C.useRef([]),[_,E]=C.useState(),{onUserInput:k,receivedUserInput:F}=Ub(),[,z]=C.useReducer(S=>S+1,0);bd.set(h,z),cs.set(h,s);var $=C.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);C.useEffect(()=>{x.current&&n&&x.current.focus()},[n]);var j=C.useRef(),N=C.useMemo(()=>v0(()=>{var S=j.current;if((at||!G.isComposing(h))&&(!$.isUpdatingSelection||S!=null&&S.isFlushing())&&!$.isDraggingInternally){var L=G.findDocumentOrShadowRoot(h),{activeElement:I}=L,U=G.toDOMNode(h,h),te=L.getSelection();if(I===U?($.latestElement=I,Gt.set(h,!0)):Gt.delete(h),!te)return Q.deselect(h);var{anchorNode:ee,focusNode:Z}=te,ue=G.hasEditableTarget(h,ee)||G.isTargetInsideNonReadonlyVoid(h,ee),J=G.hasEditableTarget(h,Z)||G.isTargetInsideNonReadonlyVoid(h,Z);if(ue&&J){var ge=G.toSlateRange(h,te,{exactMatch:!1,suppressThrow:!0});ge&&(!G.isComposing(h)&&!(S!=null&&S.hasPendingChanges())&&!(S!=null&&S.isFlushing())?Q.select(h,ge):S==null||S.handleUserSelect(ge))}s&&(!ue||!J)&&Q.deselect(h)}},100),[h,s,$]),w=C.useMemo(()=>d0(N,0),[N]);j.current=Eb({node:x,onDOMSelectionChange:N,scheduleOnDOMSelectionChange:w}),kr(()=>{var S,L,I;x.current&&(I=Gs(x.current))?(vd.set(h,I),oa.set(h,x.current),hn.set(h,x.current),_r.set(x.current,h)):hn.delete(h);var{selection:U}=h,te=G.findDocumentOrShadowRoot(h),ee=te.getSelection();if(!(!ee||!G.isFocused(h)||(S=j.current)!==null&&S!==void 0&&S.hasPendingAction())){var Z=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=oa.get(h),tt=!1;if(Ze.contains(Pe)&&Ze.contains(Se)&&(tt=!0),_e&&tt&&U&&!me){var Ae=G.toSlateRange(h,ee,{exactMatch:!0,suppressThrow:!0});if(Ae&&W.equals(Ae,U)){var We;if(!$.hasMarkPlaceholder||(We=Pe)!==null&&We!==void 0&&(We=We.parentElement)!==null&&We!==void 0&&We.hasAttribute("data-slate-mark-placeholder"))return}}if(U&&!G.hasRange(h,U)){h.selection=G.toSlateRange(h,ee,{exactMatch:!1,suppressThrow:!0});return}$.isUpdatingSelection=!0;var Le=U&&G.toDOMRange(h,U);return Le?(G.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&&Z();var ue=((L=j.current)===null||L===void 0?void 0:L.isFlushing())==="action";if(!at||!ue){setTimeout(()=>{$.isUpdatingSelection=!1});return}var J=null,ge=requestAnimationFrame(()=>{if(ue){var me=_e=>{try{var Se=G.toDOMNode(h,h);Se.focus(),Z(_e)}catch{}};me(),J=setTimeout(()=>{me(!0),$.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ge),J&&clearTimeout(J)}}});var T=C.useCallback(S=>{if(k(),!s&&G.hasEditableTarget(h,S.target)&&!sy(S,a)){var L;if(j.current)return j.current.handleDOMBeforeInput(S);w.flush(),N.flush();var{selection:I}=h,{inputType:U}=S,te=S.dataTransfer||S.data||void 0,ee=U==="insertCompositionText"||U==="deleteCompositionText";if(ee&&G.isComposing(h))return;var Z=!1;if(U==="insertText"&&I&&W.isCollapsed(I)&&S.data&&S.data.length===1&&/[a-z ]/i.test(S.data)&&I.anchor.offset!==0){var ue,J;Z=!0,h.marks&&(Z=!1);var{anchor:ge}=I,[me,_e]=G.toDOMPoint(h,ge),Se=(ue=me.parentElement)===null||ue===void 0?void 0:ue.closest("a"),Pe=G.getWindow(h);if(Z&&Se&&G.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&&(Z=!1)}if(Z&&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(" ")&&(Z=!1)}}if(!U.startsWith("delete")||U.startsWith("deleteBy")){var[tt]=S.getTargetRanges();if(tt){var Ae=G.toSlateRange(h,tt,{exactMatch:!1,suppressThrow:!1});if(!I||!W.equals(I,Ae)){Z=!1;var We=!ee&&h.selection&&v.rangeRef(h,h.selection);Q.select(h,Ae),We&&hr.set(h,We)}}}if(ee)return;if(Z||S.preventDefault(),I&&W.isExpanded(I)&&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"&&G.isComposing(h)&&(b(!1),ln.set(h,!1)),(te==null?void 0:te.constructor.name)==="DataTransfer"?G.insertData(h,te):typeof te=="string"&&(Z?A.current.push(()=>v.insertText(h,te)):v.insertText(h,te));break}}var H=(L=hr.get(h))===null||L===void 0?void 0:L.unref();hr.delete(h),H&&(!h.selection||!W.equals(h.selection,H))&&Q.select(h,H)}},[h,N,k,a,s,w]),R=C.useCallback(S=>{S==null?(N.cancel(),w.cancel(),oa.delete(h),hn.delete(h),x.current&&Ht&&x.current.removeEventListener("beforeinput",T)):Ht&&S.addEventListener("beforeinput",T),x.current=S},[N,w,h,T]);kr(()=>{var S=G.getWindow(h);return S.document.addEventListener("selectionchange",w),()=>{S.document.removeEventListener("selectionchange",w)}},[w]);var M=r([h,[]]),Y=i&&h.children.length===1&&Array.from(ie.texts(h)).length===1&&ie.string(h)===""&&!D,K=C.useCallback(S=>{if(S&&Y){var L;E((L=S.getBoundingClientRect())===null||L===void 0?void 0:L.height)}else E(void 0)},[Y]);if(Y){var se=v.start(h,[]);M.push({[Hn]:!0,placeholder:i,onPlaceholderResize:K,anchor:se,focus:se})}var{marks:ne}=h;if($.hasMarkPlaceholder=!1,h.selection&&W.isCollapsed(h.selection)&&ne){var{anchor:y}=h.selection,q=ie.leaf(h,y.path),X=Wn(q,ey);if(!de.equals(q,ne,{loose:!0})){$.hasMarkPlaceholder=!0;var B=Object.fromEntries(Object.keys(X).map(S=>[S,null]));M.push(At(At(At({[yd]:!0},B),ne),{},{anchor:y,focus:y}))}}return C.useEffect(()=>{setTimeout(()=>{var{selection:S}=h;if(S){var{anchor:L}=S,I=ie.leaf(h,L.path);if(ne&&!de.equals(I,ne,{loose:!0})){wt.set(h,ne);return}}wt.delete(h)})}),C.createElement(Td.Provider,{value:s},C.createElement(Ad.Provider,{value:r},C.createElement(Jb,{node:x,receivedUserInput:F},C.createElement(m,At(At({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Ht||!sa?g.spellCheck:!1,autoCorrect:Ht||!sa?g.autoCorrect:"false",autoCapitalize:Ht||!sa?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:R,style:At(At({},p?{}:At({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},_?{minHeight:_}:{})),f),onBeforeInput:C.useCallback(S=>{if(!Ht&&!s&&!rt(S,g.onBeforeInput)&&G.hasSelectableTarget(h,S.target)&&(S.preventDefault(),!G.isComposing(h))){var L=S.data;v.insertText(h,L)}},[g.onBeforeInput,h,s]),onInput:C.useCallback(S=>{if(!rt(S,g.onInput)){if(j.current){j.current.handleInput();return}for(var L of A.current)L();A.current=[]}},[g.onInput]),onBlur:C.useCallback(S=>{if(!(s||$.isUpdatingSelection||!G.hasSelectableTarget(h,S.target)||rt(S,g.onBlur))){var L=G.findDocumentOrShadowRoot(h);if($.latestElement!==L.activeElement){var{relatedTarget:I}=S,U=G.toDOMNode(h,h);if(I!==U&&!(yt(I)&&I.hasAttribute("data-slate-spacer"))){if(I!=null&&Jt(I)&&G.hasDOMNode(h,I)){var te=G.toSlateNode(h,I);if(ce.isElement(te)&&!h.isVoid(te))return}if(lr){var ee=L.getSelection();ee==null||ee.removeAllRanges()}Gt.delete(h)}}}},[s,$.isUpdatingSelection,$.latestElement,h,g.onBlur]),onClick:C.useCallback(S=>{if(G.hasTarget(h,S.target)&&!rt(S,g.onClick)&&Jt(S.target)){var L=G.toSlateNode(h,S.target),I=G.findPath(h,L);if(!v.hasPath(h,I)||ie.get(h,I)!==L)return;if(S.detail===Vb&&I.length>=1){var U=I;if(!(ce.isElement(L)&&v.isBlock(h,L))){var te,ee=v.above(h,{match:Se=>ce.isElement(Se)&&v.isBlock(h,Se),at:I});U=(te=ee==null?void 0:ee[1])!==null&&te!==void 0?te:I.slice(0,1)}var Z=v.range(h,U);Q.select(h,Z);return}if(s)return;var ue=v.start(h,I),J=v.end(h,I),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);Q.select(h,_e)}}},[h,g.onClick,s]),onCompositionEnd:C.useCallback(S=>{if(G.hasSelectableTarget(h,S.target)){var L;if(G.isComposing(h)&&Promise.resolve().then(()=>{b(!1),ln.set(h,!1)}),(L=j.current)===null||L===void 0||L.handleCompositionEnd(S),rt(S,g.onCompositionEnd)||at)return;if(!lr&&!Y0&&!U0&&!Q0&&!G0&&S.data){var I=wt.get(h);wt.delete(h),I!==void 0&&($t.set(h,h.marks),h.marks=I),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=>{G.hasSelectableTarget(h,S.target)&&!rt(S,g.onCompositionUpdate)&&(G.isComposing(h)||(b(!0),ln.set(h,!0)))},[g.onCompositionUpdate,h]),onCompositionStart:C.useCallback(S=>{if(G.hasSelectableTarget(h,S.target)){var L;if((L=j.current)===null||L===void 0||L.handleCompositionStart(S),rt(S,g.onCompositionStart)||at)return;b(!0);var{selection:I}=h;if(I&&W.isExpanded(I)){v.deleteFragment(h);return}}},[g.onCompositionStart,h]),onCopy:C.useCallback(S=>{G.hasSelectableTarget(h,S.target)&&!rt(S,g.onCopy)&&!Gu(S)&&(S.preventDefault(),G.setFragmentData(h,S.clipboardData,"copy"))},[g.onCopy,h]),onCut:C.useCallback(S=>{if(!s&&G.hasSelectableTarget(h,S.target)&&!rt(S,g.onCut)&&!Gu(S)){S.preventDefault(),G.setFragmentData(h,S.clipboardData,"cut");var{selection:L}=h;if(L)if(W.isExpanded(L))v.deleteFragment(h);else{var I=ie.parent(h,L.anchor.path);v.isVoid(h,I)&&Q.delete(h)}}},[s,h,g.onCut]),onDragOver:C.useCallback(S=>{if(G.hasTarget(h,S.target)&&!rt(S,g.onDragOver)){var L=G.toSlateNode(h,S.target);ce.isElement(L)&&v.isVoid(h,L)&&S.preventDefault()}},[g.onDragOver,h]),onDragStart:C.useCallback(S=>{if(!s&&G.hasTarget(h,S.target)&&!rt(S,g.onDragStart)){var L=G.toSlateNode(h,S.target),I=G.findPath(h,L),U=ce.isElement(L)&&v.isVoid(h,L)||v.void(h,{at:I,voids:!0});if(U){var te=v.range(h,I);Q.select(h,te)}$.isDraggingInternally=!0,G.setFragmentData(h,S.dataTransfer,"drag")}},[s,h,g.onDragStart,$]),onDrop:C.useCallback(S=>{if(!s&&G.hasTarget(h,S.target)&&!rt(S,g.onDrop)){S.preventDefault();var L=h.selection,I=G.findEventRange(h,S),U=S.dataTransfer;Q.select(h,I),$.isDraggingInternally&&L&&!W.equals(L,I)&&!v.void(h,{at:I,voids:!0})&&Q.delete(h,{at:L}),G.insertData(h,U),G.isFocused(h)||G.focus(h)}$.isDraggingInternally=!1},[s,h,g.onDrop,$]),onDragEnd:C.useCallback(S=>{!s&&$.isDraggingInternally&&g.onDragEnd&&G.hasTarget(h,S.target)&&g.onDragEnd(S),$.isDraggingInternally=!1},[s,$,g,h]),onFocus:C.useCallback(S=>{if(!s&&!$.isUpdatingSelection&&G.hasEditableTarget(h,S.target)&&!rt(S,g.onFocus)){var L=G.toDOMNode(h,h),I=G.findDocumentOrShadowRoot(h);if($.latestElement=I.activeElement,On&&S.target!==L){L.focus();return}Gt.set(h,!0)}},[s,$,h,g.onFocus]),onKeyDown:C.useCallback(S=>{if(!s&&G.hasEditableTarget(h,S.target)){var L;(L=j.current)===null||L===void 0||L.handleKeyDown(S);var{nativeEvent:I}=S;if(G.isComposing(h)&&I.isComposing===!1&&(ln.set(h,!1),b(!1)),rt(S,g.onKeyDown)||G.isComposing(h))return;var{selection:U}=h,te=h.children[U!==null?U.focus.path[0]:0],ee=ad(ie.string(te))==="rtl";if($e.isRedo(I)){S.preventDefault();var Z=h;typeof Z.redo=="function"&&Z.redo();return}if($e.isUndo(I)){S.preventDefault();var ue=h;typeof ue.undo=="function"&&ue.undo();return}if($e.isMoveLineBackward(I)){S.preventDefault(),Q.move(h,{unit:"line",reverse:!0});return}if($e.isMoveLineForward(I)){S.preventDefault(),Q.move(h,{unit:"line"});return}if($e.isExtendLineBackward(I)){S.preventDefault(),Q.move(h,{unit:"line",edge:"focus",reverse:!0});return}if($e.isExtendLineForward(I)){S.preventDefault(),Q.move(h,{unit:"line",edge:"focus"});return}if($e.isMoveBackward(I)){S.preventDefault(),U&&W.isCollapsed(U)?Q.move(h,{reverse:!ee}):Q.collapse(h,{edge:ee?"end":"start"});return}if($e.isMoveForward(I)){S.preventDefault(),U&&W.isCollapsed(U)?Q.move(h,{reverse:ee}):Q.collapse(h,{edge:ee?"start":"end"});return}if($e.isMoveWordBackward(I)){S.preventDefault(),U&&W.isExpanded(U)&&Q.collapse(h,{edge:"focus"}),Q.move(h,{unit:"word",reverse:!ee});return}if($e.isMoveWordForward(I)){S.preventDefault(),U&&W.isExpanded(U)&&Q.collapse(h,{edge:"focus"}),Q.move(h,{unit:"word",reverse:ee});return}if(Ht){if((gd||lr)&&U&&($e.isDeleteBackward(I)||$e.isDeleteForward(I))&&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(I)||$e.isItalic(I)||$e.isTransposeCharacter(I)){S.preventDefault();return}if($e.isSoftBreak(I)){S.preventDefault(),v.insertSoftBreak(h);return}if($e.isSplitBlock(I)){S.preventDefault(),v.insertBreak(h);return}if($e.isDeleteBackward(I)){S.preventDefault(),U&&W.isExpanded(U)?v.deleteFragment(h,{direction:"backward"}):v.deleteBackward(h);return}if($e.isDeleteForward(I)){S.preventDefault(),U&&W.isExpanded(U)?v.deleteFragment(h,{direction:"forward"}):v.deleteForward(h);return}if($e.isDeleteLineBackward(I)){S.preventDefault(),U&&W.isExpanded(U)?v.deleteFragment(h,{direction:"backward"}):v.deleteBackward(h,{unit:"line"});return}if($e.isDeleteLineForward(I)){S.preventDefault(),U&&W.isExpanded(U)?v.deleteFragment(h,{direction:"forward"}):v.deleteForward(h,{unit:"line"});return}if($e.isDeleteWordBackward(I)){S.preventDefault(),U&&W.isExpanded(U)?v.deleteFragment(h,{direction:"backward"}):v.deleteBackward(h,{unit:"word"});return}if($e.isDeleteWordForward(I)){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&&G.hasEditableTarget(h,S.target)&&!rt(S,g.onPaste)&&(!Ht||eb(S.nativeEvent)||lr)&&(S.preventDefault(),G.insertData(h,S.clipboardData))},[s,h,g.onPaste])}),C.createElement(ty,{decorations:M,node:h,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:h.selection})))))},ry=e=>{var{attributes:t,children:n}=e;return C.createElement("span",At({},t),n,at&&C.createElement("br",null))},ay=()=>[],iy=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&W.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),D0(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),sy=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},oy=C.createContext(!1),uy=C.createContext({});function ly(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 cy=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],dy=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Wn(e,cy),[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}=ly(t),m=C.useCallback(h=>{var D;switch(r&&r(t.children),h==null||(D=h.operation)===null||D===void 0?void 0:D.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(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(G.isFocused(t));return C.useEffect(()=>{g(G.isFocused(t))},[t]),kr(()=>{var h=()=>g(G.isFocused(t));return pd>=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(uy.Provider,{value:c},C.createElement(Sd.Provider,{value:l},C.createElement(Vs.Provider,{value:l.editor},C.createElement(oy.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=G.toDOMRange(e,t).getBoundingClientRect(),a=G.toDOMRange(e,n).getBoundingClientRect();return Qu(r,a)&&Qu(a,r)},fy=(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 hy=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 qa.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=fy(r,m);W.isCollapsed(p)||Q.delete(r,{at:p})}}},r.apply=u=>{var c=[],f=[],m=ut.get(r);if(m!=null&&m.length){var p=m.map(R=>hb(R,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 D=Ce.isPoint(h==null?void 0:h.at)?ms(r,h.at,u):zu(r,h.at,u);Vt.set(r,D?el(el({},h),{},{at:D}):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=hr.get(r))===null||b===void 0||b.unref(),hr.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 A=P.common(P.parent(u.path),P.parent(u.newPath));c.push(...kn(r,A));var _;P.isBefore(u.path,u.newPath)?(c.push(...kn(r,P.parent(u.path))),_=u.newPath):(c.push(...kn(r,P.parent(u.newPath))),_=u.path);var E=ie.get(t,P.parent(_)),k=G.findKey(r,E),F=v.pathRef(r,P.parent(_));f.push([F,k]);break}}a(u);for(var[z,$]of c){var[j]=v.node(r,z);Ca.set(j,$)}for(var[N,w]of f)if(N.current){var[T]=v.node(r,N.current);Ca.set(T,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=G.toDOMRange(r,c),D=h.cloneContents(),b=D.childNodes[0];if(D.childNodes.forEach(j=>{j.textContent&&j.textContent.trim()!==""&&(b=j)}),g){var[x]=g,A=h.cloneRange(),_=G.toDOMNode(r,x);A.setEndAfter(_),D=A.cloneContents()}if(p&&(b=D.querySelector("[data-slate-spacer]")),Array.from(D.querySelectorAll("[data-slate-zero-width]")).forEach(j=>{var N=j.getAttribute("data-slate-zero-width")==="n";j.textContent=N?`
|
|
112
|
+
`:""}),Dd(b)){var E=b.ownerDocument.createElement("span");E.style.whiteSpace="pre",E.appendChild(b),D.appendChild(E),b=E}var k=r.getFragment(),F=JSON.stringify(k),z=window.btoa(encodeURIComponent(F));b.setAttribute("data-slate-fragment",z),u.setData("application/".concat(n),z);var $=D.ownerDocument.createElement("div");return $.appendChild(D),$.setAttribute("hidden","true"),D.ownerDocument.body.appendChild($),u.setData("text/html",$.innerHTML),u.setData("text/plain",xd($)),D.ownerDocument.body.removeChild($),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||ib(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=pd<18?rc.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=G.findKey(e,r);n.push([a,i])}return n};const my={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,lastAnchor:null,dispatch:()=>{}},Cn=C.createContext(my),py=({attributes:e,children:t,element:n})=>{switch(n.type){case"block_quote":return d.jsx("blockquote",{...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})}},gy=({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 D=[{type:"openTooltip",value:null}];l.selection&&D.push({type:"lastAnchor",value:l.selection.anchor}),p(D)},contentEditable:!1,children:[d.jsxs("button",{...s,...g,className:V(e,a,{active:t}),onClick:h=>{h.stopPropagation(),h.preventDefault()},onMouseDown:h=>{h.stopPropagation(),h.preventDefault(),r()},onKeyDown:h=>{var D,b,x,A;if(h.key!=="Tab")switch(h.key){case"Enter":h.stopPropagation(),h.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":h.stopPropagation(),h.preventDefault();const _=h.currentTarget.closest("li");let E=_==null?void 0:_.nextElementSibling;if(h.key==="ArrowLeft"){const z=_==null?void 0:_.previousElementSibling;z?E=z:E=(D=_==null?void 0:_.parentElement)==null?void 0:D.lastElementChild}else E||(E=(b=_==null?void 0:_.parentElement)==null?void 0:b.firstElementChild);const k=E==null?void 0:E.className.split(" ")[0];k&&(f(k),(x=E==null?void 0:E.querySelector("button"))==null||x.focus());break;default:const F=h.currentTarget.closest("fieldset");if(F){(A=F==null?void 0:F.previousElementSibling)==null||A.focus();break}}},children:[d.jsx(Ie,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(Va,{styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:m===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},tl=["ol_list","ul_list"],Od=(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},Pd=(e,t)=>{const n=Od(e,t),r=tl.includes(t);Q.unwrapNodes(e,{match:s=>{const o=s;return!v.isEditor(s)&&ce.isElement(s)&&tl.includes(o.type)},split:!0});const i={type:n?"paragraph":r?"list_item":t};if(Q.setNodes(e,i),r)if(n){const{selection:s}=e;if(!s)return;const[o,l]=v.parent(e,s,{edge:"end"});Array.from(v.nodes(e,{at:l,match:c=>{const f=c;return!v.isEditor(c)&&ce.isElement(c)&&f.type==="list_item"}})).forEach(([c,f])=>{ie.string(c).trim()===""&&Q.removeNodes(e,{at:f})})}else{const s={type:t,children:[]};Q.wrapNodes(e,s)}},vy=({format:e,hasDivider:t=!1})=>{const{setFocus:n}=C.useContext(Cn),r=Jn(),a=Od(r,e);return d.jsx(Js,{id:e,active:a,hasDivider:t,callback:()=>{Pd(r,e),n(a?null:e)}})},by=52,nl=16,yy=(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-by,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},Dy=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=Dc(i.link);n(s)}else n(null)},[e,e.selection]),t},mr=e=>{const[t]=v.nodes(e,{match:n=>{const r=n;return!v.isEditor(n)&&ce.isElement(n)&&r.type==="link"}});return!!t},Cy=(e,t,n)=>{e.selection&&Xs(e,t,n)},xy=(e,t,n)=>{const{selection:r}=e;if(r&&W.isCollapsed(r)){const[i]=v.nodes(e,{match:s=>{const o=s;return!v.isEditor(s)&&ce.isElement(s)&&o.type==="link"}});if(i){const[s,o]=i,l={link:t};Q.setNodes(e,l,{at:o}),Nd(n)}}else Xs(e,t,n)},Xs=(e,t,n)=>{mr(e)&&Rd(e);const{selection:r}=e,a=r&&W.isCollapsed(r),i={type:"link",link:t,children:a?[{text:t}]:[]};a?(Q.insertNodes(e,i),Q.move(e,{distance:1,unit:"offset"})):(Q.wrapNodes(e,i,{split:!0}),Q.collapse(e,{edge:"end"}),Q.insertNodes(e,{text:""}),Q.move(e,{distance:1,unit:"offset"})),Nd(n)},Nd=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},Rd=e=>{Q.unwrapNodes(e,{match:t=>{const n=t;return!v.isEditor(t)&&ce.isElement(t)&&n.type==="link"}})};let vi=null;const wy=()=>{const e=oe.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,dispatch:a}=C.useContext(Cn),i=Jn(),s=Dy(i),[o,l]=C.useState(mr(i)),u=yy(i,"link-editor",`${n}-link`),c=C.useRef(null);C.useEffect(()=>{var p;!o&&r&&((p=c.current)==null||p.focus())},[o]),C.useEffect(()=>{vi&&clearTimeout(vi),vi=setTimeout(()=>{l(mr(i))},500)},[i.selection]);const f=[],m=["open","edit","remove"].map(p=>{const g={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${p}`},{link:s==null?void 0:s.pretty})};switch(f.push({className:p}),p){case"open":g.href=(s==null?void 0:s.full)||"",g.onClick=h=>{h.preventDefault(),h.stopPropagation(),window.open((s==null?void 0:s.full)||"","_blank"),a([{type:"showLinkEditor",value:!1}])},g.children=d.jsxs(d.Fragment,{children:[g.children,d.jsx(Ie,{children:e.formatMessage({id:`${t}${p}_text`})})]});break;case"edit":g.onClick=()=>{l(!1)};break;case"remove":g.onClick=()=>{const h=[{type:"showLinkEditor",value:!1}];mr(i)&&(Rd(i),h.push({type:"lastAnchor",value:null})),a(h)};break}return g});return d.jsx(Cc,{children:d.jsx(Va,{ref:u,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!o},functions:{onBlur:()=>{a([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var p;return(p=c.current)==null?void 0:p.focus()})}},children:o?d.jsx(yn,{wrappers:f,buttons:m}):d.jsx(Gn,{element:"fieldset",id:`${n}-link-editor`,meta:{shouldReset:!0},functions:{onSuccess:async p=>{setTimeout(()=>{const g=[{type:"showLinkEditor",value:!1}];if(p.url){const{full:h}=Dc(p.url);s!=null&&s.full?xy(i,h,n):Cy(i,h,n),g.push({type:"lastAnchor",value:null})}a(g)})}},fields:[{id:"url",type:"url",inputRef:c,label:e.formatMessage({id:`${t}placeholder`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(s==null?void 0:s.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"}})})})},Ey=()=>{const e=Jn(),{setFocus:t,dispatch:n}=C.useContext(Cn),[r,a]=C.useState(!1);return C.useEffect(()=>{a(mr(e))},[e.selection]),d.jsx(Js,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},_y=e=>["bold","italic","strikeThrough"].includes(e),Md=(e,t)=>{const n=v.marks(e);return n?n[t]===!0:!1},Id=(e,t)=>{Md(e,t)?v.removeMark(e,t):v.addMark(e,t,!0)},ky=({format:e,hasDivider:t=!1})=>{const{setFocus:n}=C.useContext(Cn),r=Jn(),a=Md(r,e);return d.jsx(Js,{id:e,active:a,hasDivider:t,callback:()=>{Id(r,e),n(a?null:e)}})},xa=["bold","italic","strikeThrough"],By=["ol_list","ul_list","block_quote"];const Ay=({...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:[xa.map((n,r)=>d.jsx(ky,{format:n,hasDivider:r===xa.length-1},n)),d.jsx(Ey,{}),By.map((n,r)=>d.jsx(vy,{format:n,hasDivider:r===1},n))]})]}),d.jsx(wy,{})]})},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 ua=Object.prototype.hasOwnProperty,$d=Object.prototype.toString,al=Object.defineProperty,il=Object.getOwnPropertyDescriptor,sl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):$d.call(t)==="[object Array]"},ol=function(t){if(!t||$d.call(t)!=="[object Object]")return!1;var n=ua.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&ua.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||ua.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(ua.call(t,n)){if(il)return il(t,n).value}else return;return t[n]},Fy=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 bi=bn(Fy);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 Ty(){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?Sy(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 Sy(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 pr(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=pr(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:jy,dirname:Oy,extname:Py,join:Ny,sep:"/"};function jy(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Tr(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 Oy(e){if(Tr(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 Py(e){Tr(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 Ny(...e){let t=-1,n;for(;++t<e.length;)Tr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Ry(n)}function Ry(e){Tr(e);const t=e.codePointAt(0)===47;let n=My(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function My(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 Tr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Iy={cwd:$y};function $y(){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 Ly(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 zy(e)}function zy(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 yi=["history","path","basename","stem","extname","dirname"];class qy{constructor(t){let n;t?bs(t)?n={path:t}:typeof t=="string"||Wy(t)?n={value:t}:n=t:n={},this.cwd=Iy.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<yi.length;){const i=yi[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)yi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ft.basename(this.path):void 0}set basename(t){Ci(t,"basename"),Di(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(Di(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=Ly(t)),Ci(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){Ci(t,"stem"),Di(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 Di(e,t){if(e&&e.includes(Ft.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ft.sep+"`")}function Ci(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 Wy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Hy=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},Uy={}.hasOwnProperty;class eo extends Hy{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=Ty()}copy(){const t=new eo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(bi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ei("data",this.frozen),this.namespace[t]=n,this):Uy.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ei("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=Vr(t),r=this.parser||this.Parser;return xi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),xi("process",this.parser||this.Parser),wi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=Vr(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);Zy(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(),xi("processSync",this.parser||this.Parser),wi("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=Vr(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=Vr(n),a=this.compiler||this.Compiler;return wi("stringify",a),hl(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Ei("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=bi(!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=bi(!0,h,p)),r[m]=[u,p,...g]}}}}const Vy=new eo().freeze();function xi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function wi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ei(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 Vr(e){return Ky(e)?e:new qy(e)}function Ky(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Zy(e){return typeof e=="string"||Yy(e)}function Yy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Gy={};function Qy(e,t){const n=t||Gy,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Ld(e,r,a)}function Ld(e,t,n){if(Jy(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]=Ld(e[a],t,n);return r.join("")}function Jy(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 Xy(e){const t={};let n=-1;for(;++n<e.length;)e1(t,e[n]);return t}function e1(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];t1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function t1(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 zd(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]/),n1=rn(/[#-'*+\--9=?A-Z^-~]/);function ys(e){return e!==null&&(e<32||e===127)}const Ds=rn(/\d/),r1=rn(/[\dA-Fa-f]/),a1=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 i1=rn(/\p{P}|\p{S}/u),s1=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 o1={tokenize:u1};function u1(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),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 l1={tokenize:c1},bl={tokenize:d1};function c1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(A){if(r<n.length){const _=n[r];return t.containerState=_[1],e.attempt(_[0].continuation,l,u)(A)}return u(A)}function l(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&x();const _=t.events.length;let E=_,k;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){k=t.events[E][1].end;break}b(r);let F=_;for(;F<t.events.length;)t.events[F][1].end=Object.assign({},k),F++;return jt(t.events,E+1,0,t.events.slice(_)),t.events.length=F,u(A)}return o(A)}function u(A){if(r===n.length){if(!a)return m(A);if(a.currentConstruct&&a.currentConstruct.concrete)return g(A);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(bl,c,f)(A)}function c(A){return a&&x(),b(r),m(A)}function f(A){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(A)}function m(A){return t.containerState={},e.attempt(bl,p,g)(A)}function p(A){return r++,n.push([t.currentConstruct,t.containerState]),m(A)}function g(A){if(A===null){a&&x(),b(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),h(A)}function h(A){if(A===null){D(e.exit("chunkFlow"),!0),b(0),e.consume(A);return}return ve(A)?(e.consume(A),D(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(A),h)}function D(A,_){const E=t.sliceStream(A);if(_&&E.push(null),A.previous=i,i&&(i.next=A),i=A,a.defineSkip(A.start),a.write(E),t.parser.lazy[A.start.line]){let k=a.events.length;for(;k--;)if(a.events[k][1].start.offset<s&&(!a.events[k][1].end||a.events[k][1].end.offset>s))return;const F=t.events.length;let z=F,$,j;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if($){j=t.events[z][1].end;break}$=!0}for(b(r),k=F;k<t.events.length;)t.events[k][1].end=Object.assign({},j),k++;jt(t.events,z+1,0,t.events.slice(F)),t.events.length=k}}function b(A){let _=n.length;for(;_-- >A;){const E=n[_];t.containerState=E[1],E[0].exit.call(t,e)}n.length=A}function x(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function d1(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)||s1(e))return 1;if(i1(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:h1,resolveAll:f1};function f1(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 h1(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 m1={name:"autolink",tokenize:p1};function p1(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):n1(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 Wa={tokenize:g1,partial:!0};function g1(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 qd={name:"blockQuote",tokenize:v1,continuation:{tokenize:b1},exit:y1};function v1(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 b1(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(qd,t,n)(s)}}function y1(e){e.exit("blockQuote")}const Wd={name:"characterEscape",tokenize:D1};function D1(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 a1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Hd={name:"characterReference",tokenize:C1};function C1(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=r1,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:w1,partial:!0},xl={name:"codeFenced",tokenize:x1,concrete:!0};function x1(e,t,n){const r=this,a={tokenize:E,partial:!0};let i=0,s=0,o;return l;function l(k){return u(k)}function u(k){const F=r.events[r.events.length-1];return i=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[1],!0).length:0,o=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(k)}function c(k){return k===o?(s++,e.consume(k),c):s<3?n(k):(e.exit("codeFencedFenceSequence"),Be(k)?Ne(e,f,"whitespace")(k):f(k))}function f(k){return k===null||ve(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(Cl,h,_)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||ve(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(k)):Be(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ne(e,p,"whitespace")(k)):k===96&&k===o?n(k):(e.consume(k),m)}function p(k){return k===null||ve(k)?f(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===null||ve(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(k)):k===96&&k===o?n(k):(e.consume(k),g)}function h(k){return e.attempt(a,_,D)(k)}function D(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),b}function b(k){return i>0&&Be(k)?Ne(e,x,"linePrefix",i+1)(k):x(k)}function x(k){return k===null||ve(k)?e.check(Cl,h,_)(k):(e.enter("codeFlowValue"),A(k))}function A(k){return k===null||ve(k)?(e.exit("codeFlowValue"),x(k)):(e.consume(k),A)}function _(k){return e.exit("codeFenced"),t(k)}function E(k,F,z){let $=0;return j;function j(M){return k.enter("lineEnding"),k.consume(M),k.exit("lineEnding"),N}function N(M){return k.enter("codeFencedFence"),Be(M)?Ne(k,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):w(M)}function w(M){return M===o?(k.enter("codeFencedFenceSequence"),T(M)):z(M)}function T(M){return M===o?($++,k.consume(M),T):$>=s?(k.exit("codeFencedFenceSequence"),Be(M)?Ne(k,R,"whitespace")(M):R(M)):z(M)}function R(M){return M===null||ve(M)?(k.exit("codeFencedFence"),F(M)):z(M)}}}function w1(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 _i={name:"codeIndented",tokenize:_1},E1={tokenize:k1,partial:!0};function _1(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(E1,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 k1(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 B1={name:"codeText",tokenize:T1,resolve:A1,previous:F1};function A1(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 F1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function T1(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 Ud(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,S1(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 S1(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 D=[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,D.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):D.pop(),m=D.length;m--;){const b=o.slice(D[m],D[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 j1={tokenize:N1,resolve:P1},O1={tokenize:R1,partial:!0};function P1(e){return Ud(e),e}function N1(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(O1,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 R1(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 Vd(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?D:h)}function D(b){return b===40||b===41||b===92?(e.consume(b),h):h(b)}}function Kd(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 Zd(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 gr(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 M1={name:"definition",tokenize:$1},I1={tokenize:L1,partial:!0};function $1(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return Kd.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)?gr(e,u)(p):u(p)}function u(p){return Vd(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(I1,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 L1(e,t,n){return r;function r(o){return ct(o)?gr(e,a)(o):n(o)}function a(o){return Zd(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 z1={name:"hardBreakEscape",tokenize:q1};function q1(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 W1={name:"headingAtx",tokenize:U1,resolve:H1};function H1(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 U1(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 V1=["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"],K1={name:"htmlFlow",tokenize:Q1,resolveTo:G1,concrete:!0},Z1={tokenize:X1,partial:!0},Y1={tokenize:J1,partial:!0};function G1(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 Q1(e,t,n){const r=this;let a,i,s,o,l;return u;function u(B){return c(B)}function c(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),f}function f(B){return B===33?(e.consume(B),m):B===47?(e.consume(B),i=!0,h):B===63?(e.consume(B),a=3,r.interrupt?t:y):Tt(B)?(e.consume(B),s=String.fromCharCode(B),D):n(B)}function m(B){return B===45?(e.consume(B),a=2,p):B===91?(e.consume(B),a=5,o=0,g):Tt(B)?(e.consume(B),a=4,r.interrupt?t:y):n(B)}function p(B){return B===45?(e.consume(B),r.interrupt?t:y):n(B)}function g(B){const S="CDATA[";return B===S.charCodeAt(o++)?(e.consume(B),o===S.length?r.interrupt?t:w:g):n(B)}function h(B){return Tt(B)?(e.consume(B),s=String.fromCharCode(B),D):n(B)}function D(B){if(B===null||B===47||B===62||ct(B)){const S=B===47,L=s.toLowerCase();return!S&&!i&&wl.includes(L)?(a=1,r.interrupt?t(B):w(B)):V1.includes(s.toLowerCase())?(a=6,S?(e.consume(B),b):r.interrupt?t(B):w(B)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):i?x(B):A(B))}return B===45||Et(B)?(e.consume(B),s+=String.fromCharCode(B),D):n(B)}function b(B){return B===62?(e.consume(B),r.interrupt?t:w):n(B)}function x(B){return Be(B)?(e.consume(B),x):j(B)}function A(B){return B===47?(e.consume(B),j):B===58||B===95||Tt(B)?(e.consume(B),_):Be(B)?(e.consume(B),A):j(B)}function _(B){return B===45||B===46||B===58||B===95||Et(B)?(e.consume(B),_):E(B)}function E(B){return B===61?(e.consume(B),k):Be(B)?(e.consume(B),E):A(B)}function k(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),l=B,F):Be(B)?(e.consume(B),k):z(B)}function F(B){return B===l?(e.consume(B),l=null,$):B===null||ve(B)?n(B):(e.consume(B),F)}function z(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||ct(B)?E(B):(e.consume(B),z)}function $(B){return B===47||B===62||Be(B)?A(B):n(B)}function j(B){return B===62?(e.consume(B),N):n(B)}function N(B){return B===null||ve(B)?w(B):Be(B)?(e.consume(B),N):n(B)}function w(B){return B===45&&a===2?(e.consume(B),Y):B===60&&a===1?(e.consume(B),K):B===62&&a===4?(e.consume(B),q):B===63&&a===3?(e.consume(B),y):B===93&&a===5?(e.consume(B),ne):ve(B)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(Z1,X,T)(B)):B===null||ve(B)?(e.exit("htmlFlowData"),T(B)):(e.consume(B),w)}function T(B){return e.check(Y1,R,X)(B)}function R(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),M}function M(B){return B===null||ve(B)?T(B):(e.enter("htmlFlowData"),w(B))}function Y(B){return B===45?(e.consume(B),y):w(B)}function K(B){return B===47?(e.consume(B),s="",se):w(B)}function se(B){if(B===62){const S=s.toLowerCase();return wl.includes(S)?(e.consume(B),q):w(B)}return Tt(B)&&s.length<8?(e.consume(B),s+=String.fromCharCode(B),se):w(B)}function ne(B){return B===93?(e.consume(B),y):w(B)}function y(B){return B===62?(e.consume(B),q):B===45&&a===2?(e.consume(B),y):w(B)}function q(B){return B===null||ve(B)?(e.exit("htmlFlowData"),X(B)):(e.consume(B),q)}function X(B){return e.exit("htmlFlow"),t(B)}}function J1(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 X1(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Wa,t,n)}}const eD={name:"htmlText",tokenize:tD};function tD(e,t,n){const r=this;let a,i,s;return o;function o(y){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(y),l}function l(y){return y===33?(e.consume(y),u):y===47?(e.consume(y),E):y===63?(e.consume(y),A):Tt(y)?(e.consume(y),z):n(y)}function u(y){return y===45?(e.consume(y),c):y===91?(e.consume(y),i=0,g):Tt(y)?(e.consume(y),x):n(y)}function c(y){return y===45?(e.consume(y),p):n(y)}function f(y){return y===null?n(y):y===45?(e.consume(y),m):ve(y)?(s=f,K(y)):(e.consume(y),f)}function m(y){return y===45?(e.consume(y),p):f(y)}function p(y){return y===62?Y(y):y===45?m(y):f(y)}function g(y){const q="CDATA[";return y===q.charCodeAt(i++)?(e.consume(y),i===q.length?h:g):n(y)}function h(y){return y===null?n(y):y===93?(e.consume(y),D):ve(y)?(s=h,K(y)):(e.consume(y),h)}function D(y){return y===93?(e.consume(y),b):h(y)}function b(y){return y===62?Y(y):y===93?(e.consume(y),b):h(y)}function x(y){return y===null||y===62?Y(y):ve(y)?(s=x,K(y)):(e.consume(y),x)}function A(y){return y===null?n(y):y===63?(e.consume(y),_):ve(y)?(s=A,K(y)):(e.consume(y),A)}function _(y){return y===62?Y(y):A(y)}function E(y){return Tt(y)?(e.consume(y),k):n(y)}function k(y){return y===45||Et(y)?(e.consume(y),k):F(y)}function F(y){return ve(y)?(s=F,K(y)):Be(y)?(e.consume(y),F):Y(y)}function z(y){return y===45||Et(y)?(e.consume(y),z):y===47||y===62||ct(y)?$(y):n(y)}function $(y){return y===47?(e.consume(y),Y):y===58||y===95||Tt(y)?(e.consume(y),j):ve(y)?(s=$,K(y)):Be(y)?(e.consume(y),$):Y(y)}function j(y){return y===45||y===46||y===58||y===95||Et(y)?(e.consume(y),j):N(y)}function N(y){return y===61?(e.consume(y),w):ve(y)?(s=N,K(y)):Be(y)?(e.consume(y),N):$(y)}function w(y){return y===null||y===60||y===61||y===62||y===96?n(y):y===34||y===39?(e.consume(y),a=y,T):ve(y)?(s=w,K(y)):Be(y)?(e.consume(y),w):(e.consume(y),R)}function T(y){return y===a?(e.consume(y),a=void 0,M):y===null?n(y):ve(y)?(s=T,K(y)):(e.consume(y),T)}function R(y){return y===null||y===34||y===39||y===60||y===61||y===96?n(y):y===47||y===62||ct(y)?$(y):(e.consume(y),R)}function M(y){return y===47||y===62||ct(y)?$(y):n(y)}function Y(y){return y===62?(e.consume(y),e.exit("htmlTextData"),e.exit("htmlText"),t):n(y)}function K(y){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),se}function se(y){return Be(y)?Ne(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(y):ne(y)}function ne(y){return e.enter("htmlTextData"),s(y)}}const ro={name:"labelEnd",tokenize:oD,resolveTo:sD,resolveAll:iD},nD={tokenize:uD},rD={tokenize:lD},aD={tokenize:cD};function iD(e){let t=-1;for(;++t<e.length;){const n=e[t][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(e.splice(t+1,n.type==="labelImage"?4:2),n.type="data",t++)}return e}function sD(e,t){let n=e.length,r=0,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 oD(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(nD,c,s?c:f)(m):m===91?e.attempt(rD,c,s?u:f)(m):s?c(m):f(m)}function u(m){return e.attempt(aD,c,f)(m)}function c(m){return t(m)}function f(m){return i._balanced=!0,n(m)}}function uD(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),a}function a(f){return ct(f)?gr(e,i)(f):i(f)}function i(f){return f===41?c(f):Vd(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return ct(f)?gr(e,l)(f):c(f)}function o(f){return n(f)}function l(f){return f===34||f===39||f===40?Zd(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):c(f)}function u(f){return ct(f)?gr(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 lD(e,t,n){const r=this;return a;function a(o){return Kd.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 cD(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const dD={name:"labelStartImage",tokenize:fD,resolveAll:ro.resolveAll};function fD(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 hD={name:"labelStartLink",tokenize:mD,resolveAll:ro.resolveAll};function mD(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 ki={name:"lineEnding",tokenize:pD};function pD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ne(e,t,"linePrefix")}}const la={name:"thematicBreak",tokenize:gD};function gD(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:yD,continuation:{tokenize:DD},exit:xD},vD={tokenize:wD,partial:!0},bD={tokenize:CD,partial:!0};function yD(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(la,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(Wa,r.interrupt?n:c,e.attempt(vD,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 DD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Wa,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(bD,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 CD(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 xD(e){e.exit(this.containerState.type)}function wD(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:_D,resolveTo:ED};function ED(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 _D(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 kD={tokenize:BD};function BD(e){const t=this,n=e.attempt(Wa,r,e.attempt(this.parser.constructs.flowInitial,a,Ne(e,e.attempt(this.parser.constructs.flow,a,e.attempt(j1,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 AD={resolveAll:Gd()},FD=Yd("string"),TD=Yd("text");function Yd(e){return{tokenize:t,resolveAll:Gd(e==="text"?SD: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 Gd(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 SD(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],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 jD(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:x,enter:A,exit:_,attempt:F(E),check:F(k),interrupt:F(k,{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(N){return s=bt(s,N),D(),s[s.length-1]!==null?[]:(z(t,0),u.events=no(i,u.events,u),u.events)}function m(N,w){return PD(p(N),w)}function p(N){return OD(s,N)}function g(){const{line:N,column:w,offset:T,_index:R,_bufferIndex:M}=r;return{line:N,column:w,offset:T,_index:R,_bufferIndex:M}}function h(N){a[N.line]=N.column,j()}function D(){let N;for(;r._index<s.length;){const w=s[r._index];if(typeof w=="string")for(N=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===N&&r._bufferIndex<w.length;)b(w.charCodeAt(r._bufferIndex));else b(w)}}function b(N){c=c(N)}function x(N){ve(N)?(r.line++,r.column=1,r.offset+=N===-3?2:1,j()):N!==-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=N}function A(N,w){const T=w||{};return T.type=N,T.start=g(),u.events.push(["enter",T,u]),o.push(T),T}function _(N){const w=o.pop();return w.end=g(),u.events.push(["exit",w,u]),w}function E(N,w){z(N,w.from)}function k(N,w){w.restore()}function F(N,w){return T;function T(R,M,Y){let K,se,ne,y;return Array.isArray(R)?X(R):"tokenize"in R?X([R]):q(R);function q(I){return U;function U(te){const ee=te!==null&&I[te],Z=te!==null&&I.null,ue=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(Z)?Z:Z?[Z]:[]];return X(ue)(te)}}function X(I){return K=I,se=0,I.length===0?Y:B(I[se])}function B(I){return U;function U(te){return y=$(),ne=I,I.partial||(u.currentConstruct=I),I.name&&u.parser.constructs.disable.null.includes(I.name)?L():I.tokenize.call(w?Object.assign(Object.create(u),w):u,l,S,L)(te)}}function S(I){return N(ne,y),M}function L(I){return y.restore(),++se<K.length?B(K[se]):Y}}}function z(N,w){N.resolveAll&&!i.includes(N)&&i.push(N),N.resolve&&jt(u.events,w,u.events.length-w,N.resolve(u.events.slice(w),u)),N.resolveTo&&(u.events=N.resolveTo(u.events,u))}function $(){const N=g(),w=u.previous,T=u.currentConstruct,R=u.events.length,M=Array.from(o);return{restore:Y,from:R};function Y(){r=N,u.previous=w,u.currentConstruct=T,u.events.length=R,o=M,j()}}function j(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function OD(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 PD(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 wD={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:Pd},ED={91:_1},_D={[-2]:xi,[-1]:xi,32:xi},BD={35:S1,42:sa,45:[yl,sa],60:N1,61:yl,95:sa,96:vl,126:vl},kD={38:Rd,92:Nd},AD={[-5]:wi,[-4]:wi,[-3]:wi,33:X1,38:Rd,42:bs,60:[n1,q1],91:tD,92:[F1,Nd],93:Js,95:bs,96:p1},FD={null:[bs,gD]},TD={null:[42,95]},SD={null:[]},jD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:TD,contentInitial:ED,disable:SD,document:wD,flow:BD,flowInitial:_D,insideSpan:FD,string:kD,text:AD},Symbol.toStringTag,{value:"Module"}));function OD(e){const n=zy([jD,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(Yy),document:a(Qy),flow:a(mD),string:a(vD),text:a(bD)};return r;function a(i){return s;function s(o){return DD(r,i,o)}}}function PD(e){for(;!Md(e););return e}const Dl=/[\0\t\n\r]/g;function ND(){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(Dl.lastIndex=f,u=Dl.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 RD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function MD(e){return e.replace(RD,ID)}function ID(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Od(n.slice(i?2:1),i?16:10)}return Gs(n)||e}const Wd={}.hasOwnProperty;function $D(e,t,n){return typeof t!="string"&&(n=t,t=void 0),LD(n)(PD(OD(n).document().write(ND()(e,t,!0))))}function LD(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ge),autolinkProtocol:$,autolinkEmail:$,atxHeading:i(me),blockQuote:i(ee),characterEscape:$,characterReference:$,codeFenced:i(Z),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(Z,s),codeText:i(ue,s),codeTextData:$,data:$,codeFlowValue:$,definition:i(Q),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ge),hardBreakEscape:i(_e),hardBreakTrailing:i(_e),htmlFlow:i(Se,s),htmlFlowData:$,htmlText:i(Se,s),htmlTextData:$,image:i(Pe),label:s,link:i(Ge),listItem:i(Ze),listItemValue:m,listOrdered:i(Ke,f),listUnordered:i(Ke),paragraph:i(tt),reference:B,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:L,characterReferenceMarkerNumeric:L,characterReferenceValue:I,codeFenced:l(D),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:j,codeIndented:l(v),codeText:l(M),codeTextData:j,data:j,definition:l(),definitionDestinationString:E,definitionLabelString:x,definitionTitleString:k,emphasis:l(),hardBreakEscape:l(w),hardBreakTrailing:l(w),htmlFlow:l(F),htmlFlowData:j,htmlText:l(R),htmlTextData:j,image:l(K),label:ne,labelText:se,lineEnding:N,link:l(Y),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:T,resourceDestinationString:y,resourceTitleString:z,resource:J,setextHeading:l(q),setextHeadingLineSequence:S,setextHeadingText:A,strong:l(),thematicBreak:l()}};Hd(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]];Wd.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]||Cl).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]||Cl).call(this,H,pe[0]));else throw new Error("Cannot close `"+H.type+"` ("+dr({start:H.start,end:H.end})+"): it’s not open");fe.position.end=Ut(H.end)}function c(){return $y(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 D(){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 v(){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=Rn(this.sliceSerialize(H)).toLowerCase()}function k(){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 A(){this.data.setextHeadingSlurpLineEnding=!0}function S(H){const ae=this.stack[this.stack.length-1];ae.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function $(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 N(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)&&($.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 R(){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 Y(){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=MD(ae),fe.identifier=Rn(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 y(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function z(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function J(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function T(H){const ae=this.resume(),fe=this.stack[this.stack.length-1];fe.label=ae,fe.identifier=Rn(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function L(H){this.data.characterReferenceType=H.type}function I(H){const ae=this.sliceSerialize(H),fe=this.data.characterReferenceType;let pe;fe?(pe=Od(ae,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):pe=Gs(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 Z(){return{type:"code",lang:null,meta:null,value:""}}function ue(){return{type:"inlineCode",value:""}}function Q(){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 Hd(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Hd(e,r):zD(e,r)}}function zD(e,t){let n;for(n in t)if(Wd.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 Cl(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+dr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+dr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+dr({start:t.start,end:t.end})+") is still open")}function qD(e){const t=this;t.parser=n;function n(r){return $D(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Ud(e,t){var l,u,c;const n={...jn,...t==null?void 0:t.nodeTypes,heading:{...jn.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=>Ud({...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,...Ei(s),...Hr(s)};case"strong":return{[n.strong_mark]:!0,...Ei(s),...Hr(s)};case"delete":return{[n.delete_mark]:!0,...Ei(s),...Hr(s)};case"inlineCode":return{[n.inline_code_mark]:!0,text:e.value,...Hr(s)};case"thematicBreak":return{type:n.thematic_break,children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Ei=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Hr(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const WD=function(t){const n=r=>r.children.map(a=>Ud(a,t));this.Compiler=n},HD=(e,t=n=>{})=>{Py().use(qD).use(WD).process(e).then(n=>{const r=cn(n.result);r.map(a=>{"children"in a&&a.children&&a.children.map((i,s)=>{if("text"in i&&i.text){const o=i.text.match(/~~(.*?)~~/g);o&&o.map(l=>{const u=l.replace(/~~/g,""),c=i.text.indexOf(l),f=i.text.substring(0,c),m=i.text.substring(c+l.length),p=[{text:f},{text:u,strikeThrough:!0},{text:m}];a.children.splice(s,1,...p)})}})}),t(r)})},xl={"mod+b":"bold","mod+i":"italic","mod+shift+x":"strikeThrough","mod+shift+7":"ol_list","mod+shift+8":"ul_list","mod+shift+9":"block_quote"},_n=e=>typeof e.text=="string",UD=["thematic_break","image"],wl="<br>";function Vd(e,t={nodeTypes:jn}){const{nodeTypes:n=jn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...jn,...n,heading:{...jn.heading,...n.heading}},l=[o.ul_list,o.ol_list];let u=i;if(_n(e)||(u=e.children.map(c=>{const f=_n(c)?!1:l.includes(c.type||""),m=l.includes(e.type||"");let p=!1;return!_n(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!_n(g)&&g.type===o.link)),Vd({...c,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||f||m||p)&&!c.break,listDepth:l.includes(c.type||"")?a+1:a})}).join("")),!r&&(i===""||i===`
|
|
115
|
-
`)&&e.parentType===o.paragraph&&(s=o.paragraph,u=
|
|
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 ND={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:qd},RD={91:M1},MD={[-2]:_i,[-1]:_i,32:_i},ID={35:W1,42:la,45:[El,la],60:K1,61:El,95:la,96:xl,126:xl},$D={38:Hd,92:Wd},LD={[-5]:ki,[-4]:ki,[-3]:ki,33:dD,38:Hd,42:Cs,60:[m1,eD],91:hD,92:[z1,Wd],93:ro,95:Cs,96:B1},zD={null:[Cs,AD]},qD={null:[42,95]},WD={null:[]},HD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:qD,contentInitial:RD,disable:WD,document:ND,flow:ID,flowInitial:MD,insideSpan:zD,string:$D,text:LD},Symbol.toStringTag,{value:"Module"}));function UD(e){const n=Xy([HD,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(o1),document:a(l1),flow:a(kD),string:a(FD),text:a(TD)};return r;function a(i){return s;function s(o){return jD(r,i,o)}}}function VD(e){for(;!Ud(e););return e}const _l=/[\0\t\n\r]/g;function KD(){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 ZD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function YD(e){return e.replace(ZD,GD)}function GD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return zd(n.slice(i?2:1),i?16:10)}return to(n)||e}const Qd={}.hasOwnProperty;function QD(e,t,n){return typeof t!="string"&&(n=t,t=void 0),JD(n)(VD(UD(n).document().write(KD()(e,t,!0))))}function JD(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ge),autolinkProtocol:$,autolinkEmail:$,atxHeading:i(me),blockQuote:i(ee),characterEscape:$,characterReference:$,codeFenced:i(Z),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(Z,s),codeText:i(ue,s),codeTextData:$,data:$,codeFlowValue:$,definition:i(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ge),hardBreakEscape:i(_e),hardBreakTrailing:i(_e),htmlFlow:i(Se,s),htmlFlowData:$,htmlText:i(Se,s),htmlTextData:$,image:i(Pe),label:s,link:i(Ge),listItem:i(Ze),listItemValue:m,listOrdered:i(Ke,f),listUnordered:i(Ke),paragraph:i(tt),reference:B,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(me),strong:i(Ae),thematicBreak:i(Le)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:te,autolinkProtocol:U,blockQuote:l(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:L,characterReferenceMarkerNumeric:L,characterReferenceValue:I,codeFenced:l(D),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:j,codeIndented:l(b),codeText:l(M),codeTextData:j,data:j,definition:l(),definitionDestinationString:_,definitionLabelString:x,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(w),hardBreakTrailing:l(w),htmlFlow:l(T),htmlFlowData:j,htmlText:l(R),htmlTextData:j,image:l(K),label:ne,labelText:se,lineEnding:N,link:l(Y),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:S,resourceDestinationString:y,resourceTitleString:q,resource:X,setextHeading:l(z),setextHeadingLineSequence:F,setextHeadingText:k,strong:l(),thematicBreak:l()}};Jd(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]];Qd.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+"` ("+pr({start:H.start,end:H.end})+"): it’s not open");fe.position.end=Ut(H.end)}function c(){return Qy(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 D(){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 A(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.title=H}function _(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.url=H}function E(H){const ae=this.stack[this.stack.length-1];if(!ae.depth){const fe=this.sliceSerialize(H).length;ae.depth=fe}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function F(H){const ae=this.stack[this.stack.length-1];ae.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function $(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 N(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)&&($.call(this,H),j.call(this,H))}function w(){this.data.atHardBreak=!0}function T(){const H=this.resume(),ae=this.stack[this.stack.length-1];ae.value=H}function R(){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 Y(){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=YD(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 y(){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 B(){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 L(H){this.data.characterReferenceType=H.type}function I(H){const ae=this.sliceSerialize(H),fe=this.data.characterReferenceType;let pe;fe?(pe=zd(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 Z(){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 Jd(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Jd(e,r):XD(e,r)}}function XD(e,t){let n;for(n in t)if(Qd.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+"` ("+pr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+pr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+pr({start:t.start,end:t.end})+") is still open")}function eC(e){const t=this;t.parser=n;function n(r){return QD(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Xd(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=>Xd({...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,...Bi(s),...Kr(s)};case"strong":return{[n.strong_mark]:!0,...Bi(s),...Kr(s)};case"delete":return{[n.delete_mark]:!0,...Bi(s),...Kr(s)};case"inlineCode":return{[n.inline_code_mark]:!0,text:e.value,...Kr(s)};case"thematicBreak":return{type:n.thematic_break,children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Bi=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Kr(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const tC=function(t){const n=r=>r.children.map(a=>Xd(a,t));this.Compiler=n},nC=(e,t=n=>{})=>{Vy().use(eC).use(tC).process(e).then(n=>{const r=cn(n.result);r.map(a=>{"children"in a&&a.children&&a.children.map((i,s)=>{if("text"in i&&i.text){const o=i.text.match(/~~(.*?)~~/g);o&&o.map(l=>{const u=l.replace(/~~/g,""),c=i.text.indexOf(l),f=i.text.substring(0,c),m=i.text.substring(c+l.length),p=[{text:f},{text:u,strikeThrough:!0},{text:m}];a.children.splice(s,1,...p)})}})}),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",rC=["thematic_break","image"],Al="<br>";function ef(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)),ef({...c,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||f||m||p)&&!c.break,listDepth:l.includes(c.type||"")?a+1:a})}).join("")),!r&&(i===""||i===`
|
|
115
|
+
`)&&e.parentType===o.paragraph&&(s=o.paragraph,u=Al),!(u===""&&!rC.find(c=>o[c]===s)))switch(u!==Al&&Bn(e)&&(e.strikeThrough&&e.bold&&e.italic?u=An(u,"~~***"):e.bold&&e.italic?u=An(u,"***"):(e.bold&&(u=An(u,"**")),e.italic&&(u=An(u,"_")),e.strikeThrough&&(u=An(u,"~~")),e.code&&(u=An(u,"`")))),s){case o.heading[1]:return`# ${u}
|
|
116
116
|
`;case o.heading[2]:return`## ${u}
|
|
117
117
|
`;case o.heading[3]:return`### ${u}
|
|
118
118
|
`;case o.heading[4]:return`#### ${u}
|
|
@@ -125,35 +125,35 @@ ${u}
|
|
|
125
125
|
\`\`\`
|
|
126
126
|
`;case o.link:return`[${u}](${e.link||""})`;case o.image:return``;case o.ul_list:case o.ol_list:return`
|
|
127
127
|
${u}
|
|
128
|
-
`;case o.listItem:const c=e&&e.parentType===o.ol_list,f=e.children.length===1&&
|
|
128
|
+
`;case o.listItem:const c=e&&e.parentType===o.ol_list,f=e.children.length===1&&Bn(e.children[0]);let m="";for(let p=0;a>p;p++)c?m+=" ":m+=" ";return`${m}${c?"1.":"-"} ${u}${f?`
|
|
129
129
|
`:""}`;case o.paragraph:return`${u}
|
|
130
130
|
|
|
131
131
|
`;case o.thematic_break:return`---
|
|
132
|
-
`;default:return u}}function Bn(e,t){const n=e.trim(),r=n,a=`${t}${r}${El(t)}`;if(r.length===e.length)return a;const i=t+r+El(t);return e.replace(n,i)}const El=e=>e.split("").reverse().join(""),VD=e=>e.map(t=>Vd(t)).join("").trim();var KD=QD,ZD=/^(?:\w+:)?\/\/(\S+)$/,YD=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,GD=/^[^\s\.]+\.\S{2,}$/;function QD(e){if(typeof e!="string")return!1;var t=e.match(ZD);if(!t)return!1;var n=t[1];return n?!!(YD.test(n)||GD.test(n)):!1}const JD=bn(KD),XD=(e,t)=>{const{insertText:n,isInline:r}=e;return e.isInline=a=>{const i=a;return["link"].includes(i.type)||r(a)},e.insertText=a=>{a&&JD(a)?dy(e,a,t):n(a)},e};const Kd=({id:e="rich-text-editor",value:t,placeholder:n,onChange:r=()=>{},autoFocus:a=!0,...i})=>{const s=oe.useIntl(),o=[{type:"paragraph",children:[{text:""}]}],l={originalValue:t||"",initialValue:t?null:o,tabbableOption:ya[0],openTooltip:null,showLinkEditor:!1,lastAnchor:null,hasInteracted:!1},[u,c]=C.useReducer(Er,l),{originalValue:f,initialValue:m,lastAnchor:p,hasInteracted:g}=u,h=E=>{const _=E||ya[0];E&&c([{type:"tabbableOption",value:_}])};C.useEffect(()=>{if(t){let E=cn(t);E.includes("<")&&(E=new fa().turndown(E)),HD(E,_=>{c([{type:"initialValue",value:_}])})}},[]),C.useEffect(()=>{t!==""||!k||Xl(f,t)&&!g||(b.withoutNormalizing(k,()=>{X.delete(k,{at:{anchor:b.start(k,[]),focus:b.end(k,[])}}),X.deselect(k),k.children.length!==0&&X.unwrapNodes(k,{at:[0]}),X.insertNodes(k,o,{at:[0]})}),c([{type:"initialValue",value:o},{type:"lastAnchor",value:null}]))},[t]);const D=`rte-${e}`,v=C.useCallback(E=>d.jsx(oy,{...E}),[]),x=C.useCallback(E=>d.jsx(uy,{...E}),[]),k=C.useMemo(()=>XD(Jg(iy(Gg())),D),[]);return m?d.jsx("div",{id:D,className:"rich-text-editor",children:d.jsx(za.Provider,{value:{...u,id:D,setFocus:h,dispatch:c},children:d.jsxs(ry,{editor:k,initialValue:m,onChange:E=>{if(k.operations.some(A=>A.type!=="set_selection")){const A=VD(E);r(A),g||c([{type:"hasInteracted",value:!0}])}},...i,children:[d.jsx(Zb,{className:"input",renderElement:v,renderLeaf:x,placeholder:n||s.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:a,tabIndex:0,onKeyDown:E=>{for(const _ in xl)if(Zh(_,E)){E.stopPropagation(),E.preventDefault();const A=xl[_];if(A==="link"){c([{type:"showLinkEditor",value:!0}]);return}if(hy(A)){Td(k,A);return}Ad(k,A)}},onBlur:()=>{k.selection&&c([{type:"lastAnchor",value:k.selection.anchor}])},onFocus:()=>{if(p){if(!P.isPath(p.path)||!ie.has(k,p.path))return;const E=ie.get(k,p.path);let _=0;if(de.isText(E)?_=E.text.length:E.children&&(_=E.children.length),p.offset>_)return;X.select(k,{anchor:p,focus:p})}}}),d.jsx(gy,{})]})})}):null};const eC=({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 tC({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 Zd=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(Br,{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 Yd=({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:D}=oe.useIntl(),v=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([])},k=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:D({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",D({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:D({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(xe,{onClick:k,children:D({id:"inviteForm_ctaDone"})})]}):d.jsx(xe,{onClick:x,children:D({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:v,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(Kf.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:D({id:"inviteForm_email_placeholder"}),emails:c,onChange:E=>{f(E),p(!E.length)},autoFocus:!1,getLabel:(E,_,A)=>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:()=>{A(_),p(!c.length)},className:"remove-email-button",screenreaderText:D({id:"overlay_close"})})]},_)})]}),d.jsx(Qt,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(xe,{className:"sendEmailsButton",disabled:m,children:n})})]})})},oa=e=>e.map(t=>({condition:t})),vt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},nC=({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=>!Zi(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:oa(["required",c]),functions:{onChange:p=>l(Zi(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:oa(["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:oa(["required"])}),i&&f.push({component:kc,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(Br,{...m}),r&&d.jsx(en,{variant:"error",text:r})]})};const Gd=({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);In(()=>{!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($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"})})})]})})})},_l=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}])},rC=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"]}},aC=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=rC(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}])},iC=({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:()=>{_l({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:xc,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"&&_l({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: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 oC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},uC=({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,D]=C.useReducer(Er,oC),{validFields:v,emailDetails:x,shouldManuallyApprove:k,shouldDisableButton:E,showSuccessMessage:_,showError:A}=h,[S,q]=ws.useCookies(["signup-this-session","functional-cookie-consent"]),$={form:C.createRef(),name:C.createRef(),email:C.createRef(),jobTitle:C.createRef(),organisation:C.createRef(),tc:C.createRef(),hiddenValidation:C.createRef()};C.useEffect(()=>{k===!0&&$.jobTitle.current&&$.jobTitle.current.focus()},[k]),C.useEffect(()=>{S["signup-this-session"]&&D([{type:"showSuccessMessage",value:!0}])},[S]),C.useEffect(()=>{_&&S["functional-cookie-consent"]&&q("signup-this-session","true",{path:"/",maxAge:3600})},[_]);const j=C.useMemo(()=>iC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:$,state:h,dispatch:D,dataToSubmit:s,intl:l}),[s,r,l,$,g,h]),N=E?!0:k?!Object.values(v).every(w=>w===!0):!v.name||!v.email||["exists","pending","verify"].includes(x.boxType);return g.successMessage&&_?d.jsx(sC,{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"})}),A&&d.jsx(en,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(Br,{className:"signup-form",formRef:$.form,id:"sign-up-form",fields:j,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:N?{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 aC({refs:$,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:D,state:h})},onCatch:w=>{r.handleError(w),D([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:$.hiddenValidation})]})};var ys={exports:{}},Ur={exports:{}},Fe={};/** @license React v16.13.1
|
|
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(""),aC=e=>e.map(t=>ef(t)).join("").trim();var iC=lC,sC=/^(?:\w+:)?\/\/(\S+)$/,oC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,uC=/^[^\s\.]+\.\S{2,}$/;function lC(e){if(typeof e!="string")return!1;var t=e.match(sC);if(!t)return!1;var n=t[1];return n?!!(oC.test(n)||uC.test(n)):!1}const cC=bn(iC),dC=(e,t)=>{const{insertText:n,isInline:r}=e;return e.isInline=a=>{const i=a;return["link"].includes(i.type)||r(a)},e.insertText=a=>{a&&cC(a)?Xs(e,a,t):n(a)},e},fC=e=>{const{normalizeNode:t}=e;return e.normalizeNode=([n,r])=>{if(n.type==="link"&&ie.string(n).trim()===""){Q.removeNodes(e,{at:r});return}t([n,r])},e};const tf=({id:e="rich-text-editor",value:t,placeholder:n,onChange:r=()=>{},autoFocus:a=!0,...i})=>{const s=oe.useIntl(),o=hh(),l=[{type:"paragraph",children:[{text:""}]}],u={originalValue:t||"",initialValue:t?null:l,tabbableOption:xa[0],openTooltip:null,showLinkEditor:!1,lastAnchor:null,lastKey:null,hasInteracted:!1},[c,f]=C.useReducer(Ar,u),{originalValue:m,initialValue:p,lastAnchor:g,lastKey:h,hasInteracted:D}=c,b=k=>{const F=k||xa[0];k&&f([{type:"tabbableOption",value:F}])};C.useEffect(()=>{if(t){let k=cn(t);k.includes("<")&&(k=new pa().turndown(k)),nC(k,F=>{f([{type:"initialValue",value:F}])})}},[]),C.useEffect(()=>{t!==""||!E||ac(m,t)&&!D||(v.withoutNormalizing(E,()=>{Q.delete(E,{at:{anchor:v.start(E,[]),focus:v.end(E,[])}}),Q.deselect(E),E.children.length!==0&&Q.unwrapNodes(E,{at:[0]}),Q.insertNodes(E,l,{at:[0]})}),f([{type:"initialValue",value:l},{type:"lastAnchor",value:null}]))},[t]);const x=`rte-${e}`,A=C.useCallback(k=>d.jsx(py,{...k}),[]),_=C.useCallback(k=>d.jsx(gy,{...k}),[]),E=C.useMemo(()=>dC(fC(sv(hy(av()))),x),[]);return p?d.jsx("div",{id:x,className:"rich-text-editor",children:d.jsx(Cn.Provider,{value:{...c,id:x,setFocus:b,dispatch:f},children:d.jsxs(dy,{editor:E,initialValue:p,onChange:k=>{if(E.operations.some(z=>z.type!=="set_selection")){const z=aC(k);r(z),D||f([{type:"hasInteracted",value:!0}]),o&&console.log({serialized:z,json:k})}},...i,children:[d.jsx(ny,{className:"input",renderElement:A,renderLeaf:_,placeholder:n||s.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:a,tabIndex:0,onKeyDown:k=>{if(k.key==="Enter"){const{selection:F}=E;if(F){const z=W.isCollapsed(F),[$,j]=v.node(E,F,{depth:1}),N=$,w=N.type;if(N&&ce.isElement(N)&&w!=="paragraph"){if(w==="block_quote"&&!k.shiftKey){k.stopPropagation(),k.preventDefault(),Q.insertNodes(E,l);return}if(z){const[T]=v.parent(E,F,{edge:"end"}),M=T.type;if(h==="Enter"&&M==="list_item"&&["ul_list","ol_list"].includes(w)){k.stopPropagation(),k.preventDefault(),Q.insertNodes(E,l,{at:P.next(j)}),Q.select(E,v.end(E,P.next(j)));return}}}}}f([{type:"lastKey",value:k.key}]);for(const F in Bl)if(nm(F,k)){k.stopPropagation(),k.preventDefault();const z=Bl[F];if(z==="link"){f([{type:"showLinkEditor",value:!0}]);return}if(_y(z)){Id(E,z);return}Pd(E,z)}},onBlur:()=>{E.selection&&f([{type:"lastAnchor",value:E.selection.anchor}])},onFocus:()=>{if(g){if(!P.isPath(g.path)||!ie.has(E,g.path))return;const k=ie.get(E,g.path);let F=0;if(de.isText(k)?F=k.text.length:k.children&&(F=k.children.length),g.offset>F)return;Q.select(E,{anchor:g,focus:g})}}}),d.jsx(Ay,{})]})})}):null};const hC=({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 mC({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 nf=({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 rf=({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:D}=oe.useIntl(),b=async _=>{_.preventDefault();try{await l(c),f([]),h("SUCCESS")}catch(E){h("ERROR"),o(E)}},x=_=>{_.preventDefault(),h("NOT_SUBMITTED"),p(!0),f([])},A=_=>{_.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:D({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",D({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:D({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(xe,{onClick:A,children:D({id:"inviteForm_ctaDone"})})]}):d.jsx(xe,{onClick:x,children:D({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(th.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:D({id:"inviteForm_email_placeholder"}),emails:c,onChange:_=>{f(_),p(!_.length)},autoFocus:!1,getLabel:(_,E,k)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:_}),d.jsx(xe,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{k(E),p(!c.length)},className:"remove-email-button",screenreaderText:D({id:"overlay_close"})})]},E)})]}),d.jsx(Qt,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(xe,{className:"sendEmailsButton",disabled:m,children:n})})]})})},ca=e=>e.map(t=>({condition:t})),vt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},pC=({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:ca(["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:ca(["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:ca(["required"])}),i&&f.push({component:Pc,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 af=({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}])},gC=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"]}},vC=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=gC(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}])},bC=({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:Fc,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 yC=({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 DC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},CC=({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,D]=C.useReducer(Ar,DC),{validFields:b,emailDetails:x,shouldManuallyApprove:A,shouldDisableButton:_,showSuccessMessage:E,showError:k}=h,[F,z]=ks.useCookies(["signup-this-session","functional-cookie-consent"]),$={form:C.createRef(),name:C.createRef(),email:C.createRef(),jobTitle:C.createRef(),organisation:C.createRef(),tc:C.createRef(),hiddenValidation:C.createRef()};C.useEffect(()=>{A===!0&&$.jobTitle.current&&$.jobTitle.current.focus()},[A]),C.useEffect(()=>{F["signup-this-session"]&&D([{type:"showSuccessMessage",value:!0}])},[F]),C.useEffect(()=>{E&&F["functional-cookie-consent"]&&z("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const j=C.useMemo(()=>bC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:$,state:h,dispatch:D,dataToSubmit:s,intl:l}),[s,r,l,$,g,h]),N=_?!0:A?!Object.values(b).every(w=>w===!0):!b.name||!b.email||["exists","pending","verify"].includes(x.boxType);return g.successMessage&&E?d.jsx(yC,{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"})}),k&&d.jsx(en,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(Gn,{className:"signup-form",formRef:$.form,id:"sign-up-form",fields:j,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:N?{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 vC({refs:$,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:D,state:h})},onCatch:w=>{r.handleError(w),D([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:$.hiddenValidation})]})};var xs={exports:{}},Zr={exports:{}},Fe={};/** @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 Sl;function xC(){if(Sl)return Fe;Sl=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,D=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function A(E){if(typeof E=="object"&&E!==null){var k=E.$$typeof;switch(k){case t:switch(E=E.type,E){case l:case u:case r:case 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 k}}case n:return k}}}function _(E){return A(E)===u}return Fe.AsyncMode=l,Fe.ConcurrentMode=u,Fe.ContextConsumer=o,Fe.ContextProvider=s,Fe.Element=t,Fe.ForwardRef=c,Fe.Fragment=r,Fe.Lazy=g,Fe.Memo=p,Fe.Portal=n,Fe.Profiler=i,Fe.StrictMode=a,Fe.Suspense=f,Fe.isAsyncMode=function(E){return _(E)||A(E)===l},Fe.isConcurrentMode=_,Fe.isContextConsumer=function(E){return A(E)===o},Fe.isContextProvider=function(E){return A(E)===s},Fe.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===t},Fe.isForwardRef=function(E){return A(E)===c},Fe.isFragment=function(E){return A(E)===r},Fe.isLazy=function(E){return A(E)===g},Fe.isMemo=function(E){return A(E)===p},Fe.isPortal=function(E){return A(E)===n},Fe.isProfiler=function(E){return A(E)===i},Fe.isStrictMode=function(E){return A(E)===a},Fe.isSuspense=function(E){return A(E)===f},Fe.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===D||E.$$typeof===b||E.$$typeof===x||E.$$typeof===h)},Fe.typeOf=A,Fe}var Te={};/** @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 jl;function wC(){return jl||(jl=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,D=e?Symbol.for("react.fundamental"):60117,b=e?Symbol.for("react.responder"):60118,x=e?Symbol.for("react.scope"):60119;function A(J){return typeof J=="string"||typeof J=="function"||J===r||J===u||J===i||J===a||J===f||J===m||typeof J=="object"&&J!==null&&(J.$$typeof===g||J.$$typeof===p||J.$$typeof===s||J.$$typeof===o||J.$$typeof===c||J.$$typeof===D||J.$$typeof===b||J.$$typeof===x||J.$$typeof===h)}function _(J){if(typeof J=="object"&&J!==null){var ge=J.$$typeof;switch(ge){case t:var me=J.type;switch(me){case l:case u:case r:case i:case a:case f:return me;default:var _e=me&&me.$$typeof;switch(_e){case o:case c:case g:case p:case s:return _e;default:return ge}}case n:return ge}}}var E=l,k=u,F=o,z=s,$=t,j=c,N=r,w=g,T=p,R=n,M=i,Y=a,K=f,se=!1;function ne(J){return se||(se=!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.")),y(J)||_(J)===l}function y(J){return _(J)===u}function q(J){return _(J)===o}function X(J){return _(J)===s}function B(J){return typeof J=="object"&&J!==null&&J.$$typeof===t}function S(J){return _(J)===c}function L(J){return _(J)===r}function I(J){return _(J)===g}function U(J){return _(J)===p}function te(J){return _(J)===n}function ee(J){return _(J)===i}function Z(J){return _(J)===a}function ue(J){return _(J)===f}Te.AsyncMode=E,Te.ConcurrentMode=k,Te.ContextConsumer=F,Te.ContextProvider=z,Te.Element=$,Te.ForwardRef=j,Te.Fragment=N,Te.Lazy=w,Te.Memo=T,Te.Portal=R,Te.Profiler=M,Te.StrictMode=Y,Te.Suspense=K,Te.isAsyncMode=ne,Te.isConcurrentMode=y,Te.isContextConsumer=q,Te.isContextProvider=X,Te.isElement=B,Te.isForwardRef=S,Te.isFragment=L,Te.isLazy=I,Te.isMemo=U,Te.isPortal=te,Te.isProfiler=ee,Te.isStrictMode=Z,Te.isSuspense=ue,Te.isValidElementType=A,Te.typeOf=_}()),Te}var Ol;function sf(){return Ol||(Ol=1,process.env.NODE_ENV==="production"?Zr.exports=xC():Zr.exports=wC()),Zr.exports}/*
|
|
147
147
|
object-assign
|
|
148
148
|
(c) Sindre Sorhus
|
|
149
149
|
@license MIT
|
|
150
|
-
*/var
|
|
151
|
-
Valid keys: `+JSON.stringify(Object.keys(y),null," "));var
|
|
150
|
+
*/var Ai,Pl;function EC(){if(Pl)return Ai;Pl=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 Ai=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},Ai}var Fi,Nl;function ao(){if(Nl)return Fi;Nl=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Fi=e,Fi}var Ti,Rl;function of(){return Rl||(Rl=1,Ti=Function.call.bind(Object.prototype.hasOwnProperty)),Ti}var Si,Ml;function _C(){if(Ml)return Si;Ml=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=ao(),n={},r=of();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={})},Si=a,Si}var ji,Il;function kC(){if(Il)return ji;Il=1;var e=sf(),t=EC(),n=ao(),r=of(),a=_C(),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 ji=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,c="@@iterator";function f(y){var q=y&&(u&&y[u]||y[c]);if(typeof q=="function")return q}var m="<<anonymous>>",p={array:b("array"),bigint:b("bigint"),bool:b("boolean"),func:b("function"),number:b("number"),object:b("object"),string:b("string"),symbol:b("symbol"),any:x(),arrayOf:A,element:_(),elementType:E(),instanceOf:k,node:j(),objectOf:z,oneOf:F,oneOfType:$,shape:w,exact:T};function g(y,q){return y===q?y!==0||1/y===1/q:y!==y&&q!==q}function h(y,q){this.message=y,this.data=q&&typeof q=="object"?q:{},this.stack=""}h.prototype=Error.prototype;function D(y){if(process.env.NODE_ENV!=="production")var q={},X=0;function B(L,I,U,te,ee,Z,ue){if(te=te||m,Z=Z||U,ue!==n){if(l){var J=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw J.name="Invariant Violation",J}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ge=te+":"+U;!q[ge]&&X<3&&(i("You are manually calling a React.PropTypes validation function for the `"+Z+"` prop on `"+te+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),q[ge]=!0,X++)}}return I[U]==null?L?I[U]===null?new h("The "+ee+" `"+Z+"` is marked as required "+("in `"+te+"`, but its value is `null`.")):new h("The "+ee+" `"+Z+"` is marked as required in "+("`"+te+"`, but its value is `undefined`.")):null:y(I,U,te,ee,Z)}var S=B.bind(null,!1);return S.isRequired=B.bind(null,!0),S}function b(y){function q(X,B,S,L,I,U){var te=X[B],ee=Y(te);if(ee!==y){var Z=K(te);return new h("Invalid "+L+" `"+I+"` of type "+("`"+Z+"` supplied to `"+S+"`, expected ")+("`"+y+"`."),{expectedType:y})}return null}return D(q)}function x(){return D(s)}function A(y){function q(X,B,S,L,I){if(typeof y!="function")return new h("Property `"+I+"` of component `"+S+"` has invalid PropType notation inside arrayOf.");var U=X[B];if(!Array.isArray(U)){var te=Y(U);return new h("Invalid "+L+" `"+I+"` of type "+("`"+te+"` supplied to `"+S+"`, expected an array."))}for(var ee=0;ee<U.length;ee++){var Z=y(U,ee,S,L,I+"["+ee+"]",n);if(Z instanceof Error)return Z}return null}return D(q)}function _(){function y(q,X,B,S,L){var I=q[X];if(!o(I)){var U=Y(I);return new h("Invalid "+S+" `"+L+"` of type "+("`"+U+"` supplied to `"+B+"`, expected a single ReactElement."))}return null}return D(y)}function E(){function y(q,X,B,S,L){var I=q[X];if(!e.isValidElementType(I)){var U=Y(I);return new h("Invalid "+S+" `"+L+"` of type "+("`"+U+"` supplied to `"+B+"`, expected a single ReactElement type."))}return null}return D(y)}function k(y){function q(X,B,S,L,I){if(!(X[B]instanceof y)){var U=y.name||m,te=ne(X[B]);return new h("Invalid "+L+" `"+I+"` of type "+("`"+te+"` supplied to `"+S+"`, expected ")+("instance of `"+U+"`."))}return null}return D(q)}function F(y){if(!Array.isArray(y))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(X,B,S,L,I){for(var U=X[B],te=0;te<y.length;te++)if(g(U,y[te]))return null;var ee=JSON.stringify(y,function(ue,J){var ge=K(J);return ge==="symbol"?String(J):J});return new h("Invalid "+L+" `"+I+"` of value `"+String(U)+"` "+("supplied to `"+S+"`, expected one of "+ee+"."))}return D(q)}function z(y){function q(X,B,S,L,I){if(typeof y!="function")return new h("Property `"+I+"` of component `"+S+"` has invalid PropType notation inside objectOf.");var U=X[B],te=Y(U);if(te!=="object")return new h("Invalid "+L+" `"+I+"` of type "+("`"+te+"` supplied to `"+S+"`, expected an object."));for(var ee in U)if(r(U,ee)){var Z=y(U,ee,S,L,I+"."+ee,n);if(Z instanceof Error)return Z}return null}return D(q)}function $(y){if(!Array.isArray(y))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var q=0;q<y.length;q++){var X=y[q];if(typeof X!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+se(X)+" at index "+q+"."),s}function B(S,L,I,U,te){for(var ee=[],Z=0;Z<y.length;Z++){var ue=y[Z],J=ue(S,L,I,U,te,n);if(J==null)return null;J.data&&r(J.data,"expectedType")&&ee.push(J.data.expectedType)}var ge=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new h("Invalid "+U+" `"+te+"` supplied to "+("`"+I+"`"+ge+"."))}return D(B)}function j(){function y(q,X,B,S,L){return R(q[X])?null:new h("Invalid "+S+" `"+L+"` supplied to "+("`"+B+"`, expected a ReactNode."))}return D(y)}function N(y,q,X,B,S){return new h((y||"React class")+": "+q+" type `"+X+"."+B+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+S+"`.")}function w(y){function q(X,B,S,L,I){var U=X[B],te=Y(U);if(te!=="object")return new h("Invalid "+L+" `"+I+"` of type `"+te+"` "+("supplied to `"+S+"`, expected `object`."));for(var ee in y){var Z=y[ee];if(typeof Z!="function")return N(S,L,I,ee,K(Z));var ue=Z(U,ee,S,L,I+"."+ee,n);if(ue)return ue}return null}return D(q)}function T(y){function q(X,B,S,L,I){var U=X[B],te=Y(U);if(te!=="object")return new h("Invalid "+L+" `"+I+"` of type `"+te+"` "+("supplied to `"+S+"`, expected `object`."));var ee=t({},X[B],y);for(var Z in ee){var ue=y[Z];if(r(y,Z)&&typeof ue!="function")return N(S,L,I,Z,K(ue));if(!ue)return new h("Invalid "+L+" `"+I+"` key `"+Z+"` supplied to `"+S+"`.\nBad object: "+JSON.stringify(X[B],null," ")+`
|
|
151
|
+
Valid keys: `+JSON.stringify(Object.keys(y),null," "));var J=ue(U,Z,S,L,I+"."+Z,n);if(J)return J}return null}return D(q)}function R(y){switch(typeof y){case"number":case"string":case"undefined":return!0;case"boolean":return!y;case"object":if(Array.isArray(y))return y.every(R);if(y===null||o(y))return!0;var q=f(y);if(q){var X=q.call(y),B;if(q!==y.entries){for(;!(B=X.next()).done;)if(!R(B.value))return!1}else for(;!(B=X.next()).done;){var S=B.value;if(S&&!R(S[1]))return!1}}else return!1;return!0;default:return!1}}function M(y,q){return y==="symbol"?!0:q?q["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&q instanceof Symbol:!1}function Y(y){var q=typeof y;return Array.isArray(y)?"array":y instanceof RegExp?"object":M(q,y)?"symbol":q}function K(y){if(typeof y>"u"||y===null)return""+y;var q=Y(y);if(q==="object"){if(y instanceof Date)return"date";if(y instanceof RegExp)return"regexp"}return q}function se(y){var q=K(y);switch(q){case"array":case"object":return"an "+q;case"boolean":case"date":case"regexp":return"a "+q;default:return q}}function ne(y){return!y.constructor||!y.constructor.name?m:y.constructor.name}return p.checkPropTypes=a,p.resetWarningCache=a.resetWarningCache,p.PropTypes=p,p},ji}var Oi,$l;function BC(){if($l)return Oi;$l=1;var e=ao();function t(){}function n(){}return n.resetWarningCache=t,Oi=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},Oi}if(process.env.NODE_ENV!=="production"){var AC=sf(),FC=!0;xs.exports=kC()(AC.isElement,FC)}else xs.exports=BC()();var TC=xs.exports;/*!
|
|
152
152
|
* tabbable 6.2.0
|
|
153
153
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
154
|
-
*/var
|
|
154
|
+
*/var uf=["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])"],wa=uf.join(","),lf=typeof Element>"u",vn=lf?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ea=!lf&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},_a=function e(t,n){var r;n===void 0&&(n=!0);var a=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=a===""||a==="true",s=i||n&&t&&e(t.parentNode);return s},SC=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},cf=function(t,n,r){if(_a(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(wa));return n&&vn.call(t,wa)&&a.unshift(t),a=a.filter(r),a},df=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!_a(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var c=vn.call(s,wa);c&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var f=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),m=!_a(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},ff=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Zt=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||SC(t))&&!ff(t)?0:t.tabIndex},jC=function(t,n){var r=Zt(t);return r<0&&n&&!ff(t)?0:r},OC=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},hf=function(t){return t.tagName==="INPUT"},PC=function(t){return hf(t)&&t.type==="hidden"},NC=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},RC=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},MC=function(t){if(!t.name)return!0;var n=t.form||Ea(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=RC(a,t.form);return!i||i===t},IC=function(t){return hf(t)&&t.type==="radio"},$C=function(t){return IC(t)&&!MC(t)},LC=function(t){var n,r=t&&Ea(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=Ea(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},Ll=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},zC=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=vn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(vn.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=Ea(t);if(l&&!l.shadowRoot&&a(l)===!0)return Ll(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(LC(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Ll(t);return!1},qC=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 vn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},ka=function(t,n){return!(n.disabled||_a(n)||PC(n)||zC(n,t)||NC(n)||qC(n))},ws=function(t,n){return!($C(n)||Zt(n)<0||!ka(t,n))},WC=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},HC=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=jC(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(OC).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},mf=function(t,n){n=n||{};var r;return n.getShadowRoot?r=df([t],n.includeContainer,{filter:ws.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:WC}):r=cf(t,n.includeContainer,ws.bind(null,n)),HC(r)},pf=function(t,n){n=n||{};var r;return n.getShadowRoot?r=df([t],n.includeContainer,{filter:ka.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=cf(t,n.includeContainer,ka.bind(null,n)),r},on=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return vn.call(t,wa)===!1?!1:ws(n,t)},UC=uf.concat("iframe").join(","),da=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return vn.call(t,UC)===!1?!1:ka(n,t)};const VC=Object.freeze(Object.defineProperty({__proto__:null,focusable:pf,getTabIndex:Zt,isFocusable:da,isTabbable:on,tabbable:mf},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 Rl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ml(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Rl(Object(n),!0).forEach(function(r){PC(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function PC(e,t,n){return t=RC(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function NC(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 RC(e){var t=NC(e,"string");return typeof t=="symbol"?t:String(t)}var Il={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()}},MC=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},IC=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},hr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},$C=function(t){return hr(t)&&!t.shiftKey},LC=function(t){return hr(t)&&t.shiftKey},$l=function(t){return setTimeout(t,0)},Ll=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},tr=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},Vr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},zC=[],qC=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||zC,i=Ml({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:$C,isKeyBackward:LC},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 Y=M.container,K=M.tabbableNodes;return Y.contains(w)||(R==null?void 0:R.includes(Y))||K.find(function(se){return se===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),Y=1;Y<R;Y++)M[Y-1]=arguments[Y];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||!ua(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=sf(w,i.tabbableOptions),R=of(w,i.tabbableOptions),M=F.length>0?F[0]:void 0,Y=F.length>0?F[F.length-1]:void 0,K=R.find(function(y){return on(y)}),se=R.slice().reverse().find(function(y){return on(y)}),ne=!!F.find(function(y){return Zt(y)>0});return{container:w,tabbableNodes:F,focusableNodes:R,posTabIndexesFound:ne,firstTabbableNode:M,lastTabbableNode:Y,firstDomTabbableNode:K,lastDomTabbableNode:se,nextTabbableNode:function(z){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,B=F.indexOf(z);return B<0?J?R.slice(R.indexOf(z)+1).find(function(T){return on(T)}):R.slice(0,R.indexOf(z)).reverse().find(function(T){return on(T)}):F[B+(J?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 N(w){var F=w.activeElement;if(F)return F.shadowRoot&&F.shadowRoot.activeElement!==null?N(F.shadowRoot):F},g=function N(w){if(w!==!1&&w!==p(document)){if(!w||!w.focus){N(f());return}w.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=w,MC(w)&&w.select()}},h=function(w){var F=c("setReturnFocus",w);return F||(F===!1?!1:w)},D=function(w){var F=w.target,R=w.event,M=w.isBackward,Y=M===void 0?!1:M;F=F||Vr(R),m();var K=null;if(s.tabbableGroups.length>0){var se=u(F,R),ne=se>=0?s.containerGroups[se]:void 0;if(se<0)Y?K=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:K=s.tabbableGroups[0].firstTabbableNode;else if(Y){var y=Ll(s.tabbableGroups,function(I){var U=I.firstTabbableNode;return F===U});if(y<0&&(ne.container===F||ua(F,i.tabbableOptions)&&!on(F,i.tabbableOptions)&&!ne.nextTabbableNode(F,!1))&&(y=se),y>=0){var z=y===0?s.tabbableGroups.length-1:y-1,J=s.tabbableGroups[z];K=Zt(F)>=0?J.lastTabbableNode:J.lastDomTabbableNode}else hr(R)||(K=ne.nextTabbableNode(F,!1))}else{var B=Ll(s.tabbableGroups,function(I){var U=I.lastTabbableNode;return F===U});if(B<0&&(ne.container===F||ua(F,i.tabbableOptions)&&!on(F,i.tabbableOptions)&&!ne.nextTabbableNode(F))&&(B=se),B>=0){var T=B===s.tabbableGroups.length-1?0:B+1,L=s.tabbableGroups[T];K=Zt(F)>=0?L.firstTabbableNode:L.firstDomTabbableNode}else hr(R)||(K=ne.nextTabbableNode(F))}}else K=c("fallbackFocus");return K},v=function(w){var F=Vr(w);if(!(u(F,w)>=0)){if(tr(i.clickOutsideDeactivates,w)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}tr(i.allowOutsideClick,w)||w.preventDefault()}},x=function(w){var F=Vr(w),R=u(F,w)>=0;if(R||F instanceof Document)R&&(s.mostRecentlyFocusedNode=F);else{w.stopImmediatePropagation();var M,Y=!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(y){return y===s.mostRecentlyFocusedNode});ne>=0&&(i.isKeyForward(s.recentNavEvent)?ne+1<se.length&&(M=se[ne+1],Y=!1):ne-1>=0&&(M=se[ne-1],Y=!1))}}else s.containerGroups.some(function(y){return y.tabbableNodes.some(function(z){return Zt(z)>0})})||(Y=!1);else Y=!1;Y&&(M=D({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(M||s.mostRecentlyFocusedNode||f())}s.recentNavEvent=void 0},k=function(w){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=w;var R=D({event:w,isBackward:F});R&&(hr(w)&&w.preventDefault(),g(R))},E=function(w){if(IC(w)&&tr(i.escapeDeactivates,w)!==!1){w.preventDefault(),o.deactivate();return}(i.isKeyForward(w)||i.isKeyBackward(w))&&k(w,i.isKeyBackward(w))},_=function(w){var F=Vr(w);u(F,w)>=0||tr(i.clickOutsideDeactivates,w)||tr(i.allowOutsideClick,w)||(w.preventDefault(),w.stopImmediatePropagation())},A=function(){if(s.active)return Il.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?$l(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",_,{capture:!0,passive:!1}),r.addEventListener("keydown",E,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",x,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",_,!0),r.removeEventListener("keydown",E,!0),o},q=function(w){var F=w.some(function(R){var M=Array.from(R.removedNodes);return M.some(function(Y){return Y===s.mostRecentlyFocusedNode})});F&&g(f())},$=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(q):void 0,j=function(){$&&($.disconnect(),s.active&&!s.paused&&s.containers.map(function(w){$.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 Y=function(){M&&m(),A(),j(),R==null||R()};return M?(M(s.containers.concat()).then(Y,Y),this):(Y(),this)},deactivate:function(w){if(!s.active)return this;var F=Ml({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},w);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,j(),Il.deactivateTrap(a,o);var R=l(F,"onDeactivate"),M=l(F,"onPostDeactivate"),Y=l(F,"checkCanReturnFocus"),K=l(F,"returnFocus","returnFocusOnDeactivate");R==null||R();var se=function(){$l(function(){K&&g(h(s.nodeFocusedBeforeActivation)),M==null||M()})};return K&&Y?(Y(h(s.nodeFocusedBeforeActivation)).then(se,se),this):(se(),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(),S(),j(),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(),j(),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(),j(),this}},o.updateContainerElements(t),o};const WC=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:qC},Symbol.toStringTag,{value:"Module"})),HC=tc(WC),UC=tc(OC);function Wn(e){"@babel/helpers - typeof";return Wn=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},Wn(e)}function VC(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zl(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,uf(r.key),r)}}function KC(e,t,n){return t&&zl(e.prototype,t),n&&zl(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ZC(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&&Cs(e,t)}function Cs(e,t){return Cs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Cs(e,t)}function YC(e){var t=QC();return function(){var r=Ea(e),a;if(t){var i=Ea(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return GC(this,a)}}function GC(e,t){if(t&&(Wn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return or(e)}function or(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function QC(){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 Ea(e){return Ea=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ea(e)}function JC(e,t,n){return t=uf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uf(e){var t=XC(e,"string");return Wn(t)==="symbol"?t:String(t)}function XC(e,t){if(Wn(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Wn(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Kr=C,he=vC,ex=HC,tx=ex.createFocusTrap,nx=UC,rx=nx.isFocusable,eo=function(e){ZC(n,e);var t=YC(n);function n(r){var a;VC(this,n),a=t.call(this,r),JC(or(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(or(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(or(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(or(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 KC(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&&!rx(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?Kr.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===Kr.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=Kr.cloneElement(i,{ref:s});return o}return null}}]),n}(Kr.Component),nr=typeof Element>"u"?Function:Element;eo.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(nr),he.string,he.bool,he.func]),fallbackFocus:he.oneOfType([he.instanceOf(nr),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(nr),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(nr)),children:he.oneOfType([he.element,he.instanceOf(nr)])};eo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:tx};var ax=eo;const ix=bn(ax),lf=({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(Vf.ReactQueryDevtools,{initialIsOpen:!1})]})};var sx=C.createContext({client:Xr});function ox(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&&(Xr.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),Xr.init(r,a)),Xr)},[n,r]);return C.createElement(sx.Provider,{value:{client:i}},t)}const cf=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(ox,{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={...uh[r],...n||{}};return d.jsx(oe.IntlProvider,{locale:r,messages:a,children:e})},to=C.createContext({}),la={en:"English",es:"Español",fr:"Français",pt:"Português"},Ot=C.createContext({isLoading:!0});function Wa(){return C.useContext(Ot)}const ff=({children:e,user:t})=>d.jsx(Ot.Provider,{value:t,children:e}),no=C.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),hf=()=>C.useContext(no),mf=({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(no.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},ux=({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}),mc(5e3)}).catch(c=>{c.message===dc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(to.Provider,{value:{language:o,updateLanguage:u},children:d.jsx(df,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(ws.CookiesProvider,{children:d.jsx(ff,{user:a,children:d.jsx(mf,{children:d.jsx(lf,{showDevTools:r,children:d.jsx(cf,{user:a,children:t})})})})})})})};const ro=({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 Ar=({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}=hf(),[h,D]=C.useState(t),v=E=>{E.key==="Escape"&&x(!1)};C.useEffect(()=>(window.addEventListener("keyup",v),()=>{window.removeEventListener("keyup",v)}));const x=E=>{D(E),E?(a(),p(e)):(i(),g(e))};C.useEffect(()=>(x(t),()=>{h&&g(e)}),[t]);const k=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{className:V("overlay",{open:h}),role:"dialog",children:d.jsx(ro,{id:e,className:V("overlay-modal",c,{"has-max-width":r}),hidden:!h,style:k,children:t&&d.jsx(ix,{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(Kn,{buttons:u})]}),s&&d.jsx(pr,{className:"error",children:s})]})})})})},pf=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const lx=({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(Ar,{title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:V("invite-modal",e,{success:!!n}),children:d.jsx(Yd,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const cx=({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(Ar,{isOpen:t!==!1,children:t===!1?"":d.jsxs(d.Fragment,{children:[r(t),d.jsx($n,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const dx=({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(_r,{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})})]})]}),fx=C.memo(dx);const hx=({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})};let rr=!1;const ao=C.forwardRef(({styling:e={},isOpen:t=!1,isLoading:n=!1,children:r,className:a="",functions:i={},callbacks:s={},...o},l)=>{const u=oe.useIntl(),c=C.useRef(null),f=l||c,[m,p]=C.useState(t?"open":"hidden"),{extraPadding:g=!0,hasPointer:h=!1,hasForm:D=!1}=e,{onOpen:v=()=>{},onClose:x=()=>{}}=s;C.useEffect(()=>{const A=f==null?void 0:f.current;if(A)return A.addEventListener("transitionend",k),A.addEventListener("keydown",E),()=>{A.removeEventListener("transitionend",k),A.removeEventListener("keydown",E)}},[]);const k=({propertyName:A})=>{A==="opacity"&&(rr!==!1&&clearTimeout(rr),p(S=>(S==="open"?v():S==="closed"&&x(),S==="opening"?"open":S==="closing"?"closed":S==="closed"?"hidden":S)))},E=A=>{A.key==="Escape"&&(A.stopPropagation(),A.preventDefault(),p("closing"))};In(()=>{rr!==!1&&clearTimeout(rr);let A="open";t?p("opening"):(p("closing"),A="hidden"),rr=setTimeout(()=>{p(A)},300)},[t]);const _={...o};return i&&i.onBlur&&(_.onBlur=i.onBlur),d.jsx("aside",{ref:f,className:V("tooltip text-medium",m,a,{loading:n,"extra-padding":g,"has-pointer":h,bottom:h==="bottom","has-form":D}),..._,children:d.jsx("div",{className:"content",hidden:m==="hidden",children:n?d.jsx("p",{children:u.formatMessage({id:"tooltip_loading"})}):typeof r=="string"?d.jsx("p",{children:r}):r})})});const mx=({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(Zn,{...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 px=({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(Kn,{buttons:r})]})})};function gf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const gx=({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:fc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(xe,{href:r,variant:"secondary",size:"small",onClick:()=>gf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},vx=({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(Ar,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:f},className:V("edit-section-modal"),children:d.jsx(Br,{...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:()=>gf({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(gx,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(Qt,{})]})};const bx=({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 yx=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Dx=({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(D=>{if(!t[D]){m[D]=!1;return}if(!s[D]){if(typeof t[D]=="object"){m[D]=t[D];const{text:v,element:x}=t[D];if(x&&yx.includes(x.toLowerCase()))return;m[D]={text:v,element:f[D]};return}m[D]={text:t[D],element:f[D]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=D=>{D.preventDefault(),D.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.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(D=>{if(m[D]&&typeof m[D]=="object"){const{text:v,element:x=""}=m[D];return D==="text"?d.jsx($n,{overrideType:"text-only",className:"text",children:v},D):C.createElement(x,{key:D,className:D},v)}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(Zn,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},Cx=C.memo(Dx);const xx=({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 wx=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx($n,{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(Zn,{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})})})]})},Ex=C.memo(wx);const _x=({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})]}),Bx=({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&&Ki(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"}):_s(c)});if(o)return d.jsx(Pn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const f=u&&Ki(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},_a={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"}},kx=({data:e,cta:t,link:n,gtmContext:r})=>{var h,D;const a=oe.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=_a[m])!=null&&h.gtmEvent&&(p=_a[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 v=i.loading||i.registered||((D=e==null?void 0:e.members)==null?void 0:D.isMember),x=async k=>{if(k.preventDefault(),k.stopPropagation(),!(v||!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: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 Ax={title:66,text:3e3,secondaryText:1e3,partner:25},io=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s})=>{var S,q,$;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||!_a[h])return d.jsx(Ct,{element:"li",className:"card-wrapper"});const{basePath:D="",className:v,length:x,gtmEvent:k}=_a[h];let E=m.slug?`${D}${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 _={...Ax,...x};let A={className:"card"};return E&&(A={href:E,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${k}-click`,"data-testid":"link"},m.openInNewTab&&(A.target="_blank")),d.jsx("li",{className:V("card-wrapper text-medium",v,i,{"has-link":E,"no-link":!E,"has-image":m.banner}),"data-testid":`${h}-card`,children:C.createElement(E?"a":"div",A,d.jsxs(d.Fragment,{children:[d.jsx(pc,{className:"card-label",contentType:h,customIcon:m.customIcon,customLabel:m.customLabel}),m.startDate&&!m.isOngoingEvent&&d.jsx(Pn,{size:"small",variant:m.dateHasPassed?"default":"information","data-testid":"date",children:m.dateHasPassed?o.formatMessage({id:"card_ended"}):hc(m.startDate)}),m.banner?d.jsxs("p",{className:"img",children:[m.registered&&d.jsx(Pn,{size:"small",variant:"registered",children:o.formatMessage({id:"card_registered"})}),d.jsx(Zn,{image:m.banner})]}):v==="people"?d.jsx(tn,{name:m.title||"",src:m.profile,"data-testid":"people-profile-picture"}):null,m.contributors&&d.jsx(Fs,{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}):Mn(m.partner[0],_.partner)}),["title","text","secondaryText"].map(j=>{const N=m[j];if(!N)return null;const w=uc(j);return d.jsx(Lt,{className:w,options:{wrapper:"p",forceWrapper:!0,forceInline:!0},"data-testid":w,children:Mn(N,_[j])},j)}),(l==null?void 0:l.id)&&(m==null?void 0:m.members)&&d.jsxs("span",{className:"member-information",children:[((S=m==null?void 0:m.members)==null?void 0:S.isMember)&&d.jsx(Pn,{size:"small",variant:"registered",icon:((q=m==null?void 0:m.members)==null?void 0:q.memberType)==="owner"?"user":"tick",children:o.formatMessage({id:`card_member_type_${($=m==null?void 0:m.members)==null?void 0:$.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(Bx,{type:v||"",data:m}),d.jsx(kx,{data:m,cta:r,link:E||"",gtmContext:a})]}))})};const vf=({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(io,{id:s,card:{...a,contentType:t[i]},...r},s)})}),Fx=(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},Tx=({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 Si={fourCards:1024,threeCards:769,twoCards:480};let Zr=null;const Sx=({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:D}=p,v=t.length,x=Math.ceil(v/f),k=C.useRef(null),E=Un(!0,!0,k==null?void 0:k.current);C.useEffect(()=>{let j=1;E&&(E>=Si.fourCards?j=4:E>=Si.threeCards?j=3:E>=Si.twoCards&&(j=2),j>v&&(j=v)),c(N=>({...N,cardsPerPage:j,isLoading:!1}))},[E,v]);const _=(j="next")=>{let N=h;if(typeof j=="string")if(j==="next")if(h<x-1)N=h+1;else return;else if(h>0)N=h-1;else return;else N=j;g(w=>({...w,currentPage:N,loadedPages:[...new Set([...D,N])]}))},A=j=>{Zr=j.touches[0].clientX},S=j=>{if(Zr===null)return;const N=j.touches[0].clientX,w=Zr-N;w>5?_("next"):w<-5&&_("previous"),Zr=null},q={"--width":`${E||0}px`,"--total-cards":v,"--cards-per-page":f,"--page":h};if(m)return d.jsx(ks,{layout:`carousel${a?"-with-title":""}`});const $=(j,N)=>{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[N],j.contentType].includes("customCard")&&(w=`card-${window.btoa(`${j.title} ${j.createdAt}`)}-${N}`),w};return d.jsxs("section",{ref:k,className:V("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx(Tx,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:A,onTouchMove:S,style:q,"data-testid":"carousel-list",children:t.map((j,N)=>{let w=$(j,N);return w&&Fx(N,f,h,D)?d.jsx(io,{id:w,card:{...j,contentType:n[N]},buildCardData:r,gtmContext:s,...o},w):(w=w||`${e}-card-${N}`,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,N)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:V("page-indicator",{selected:N===h}),onClick:w=>{w.preventDefault(),w.stopPropagation(),_(N)},children:d.jsx($e,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:N+1,total:x})})})},`page-indicator-${N}`)),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})})]})]})},jx=({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(ks,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),f?null:d.jsx(Qt,{})]},`placeholder-${c}`):d.jsxs(C.Fragment,{children:[d.jsx(Sx,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),f?null:d.jsx(Qt,{})]},`carousel-${c}`)});const ji="joinCommunityButton",so=({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:`${ji}_leave`}),f["aria-label"]=a.formatMessage({id:`${ji}_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:`${ji}${["joining","leaving"].includes(u)?`_${u}`:o?"_member":t?"_short":""}`})})})};const Oi="communityDetails_",Ox=({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:`${Oi}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:`${Oi}viewAll`})})})]}),d.jsx(Fs,{contributors:{total:r,data:c},styling:{size:"medium",showGap:!0,showPlaceholders:u===0},cutoff:l})]}),d.jsx(so,{isMember:t,functions:{...s}}),t&&d.jsx(xe,{variant:"primary",onClick:i,icon:{icon:"plus"},styling:{fullWidth:!0},children:o.formatMessage({id:`${Oi}invite`})})]})};const Px=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx($e,{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($e,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),d.jsx(yn,{href:s?void 0:i,...l,children:Mn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Nx=({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)})})},Rx=(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 Yr="languageSwitcher_",Mx=({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(to),[f,m]=C.useState(e);if(C.useEffect(()=>{e!==f&&m(e)},[e]),!r||!Object.values(r).some(D=>D&&D.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:`${Yr}label`})}),d.jsx("ul",{children:g.map(D=>{var k;if(!la[D])return null;const v=(k=r[D])==null?void 0:k.post_name;let x={className:D};if(f===D)x["aria-label"]=u.formatMessage({id:`${Yr}selected`},{language:la[D]});else{const E=Rx(D,v,i);x={...x,href:typeof E=="string"?E:E.url,onClick:_=>{m(D),c(D),typeof a<"u"&&(_.preventDefault(),_.stopPropagation(),a(D,typeof E=="string"?E:E.urlForRouter))}}}return d.jsx("li",{children:d.jsx(yn,{...x,fallbackElement:"span",children:la[D]})},D)})}),s!=="short"&&!h&&d.jsx("p",{children:u.formatMessage({id:`${Yr}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!h&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${Yr}disclaimer`},{email:kn.support,link:D=>{const v=`mailto:${D}`;return d.jsx("a",{href:v,children:D})}})})]})};const Pi=oe.createIntl({locale:"en",messages:Vn}),Fr=({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:Pi.formatMessage({id:"loadMore_button"}),endOfFeed:Pi.formatMessage({id:"loadMore_endOfFeed"}),error:Pi.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 oo=({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($e,{children:d.jsx(oe.FormattedMessage,{id:"apolitical"})})})});let Gr=!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:D=>{o(!1),typeof c=="function"&&c(D)},onFocus:()=>{Gr&&(clearTimeout(Gr),Gr=!1)},onBlur:()=>{Gr=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}`)})})]})})},Ix=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const $x=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],yf=({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:[$x.map(({key:a,href:i})=>{const s=Ix(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"})})]})})]})},ar=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Lx=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${ar(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(`${ar(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(`${ar(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 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){KC(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 KC(e,t,n){return t=YC(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ZC(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 YC(e){var t=ZC(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()}},GC=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},QC=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},vr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},JC=function(t){return vr(t)&&!t.shiftKey},XC=function(t){return vr(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},Yr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},ex=[],tx=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||ex,i=ql({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:JC,isKeyBackward:XC},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(w,T,R){return w&&w[T]!==void 0?w[T]:i[R||T]},u=function(w,T){var R=typeof(T==null?void 0:T.composedPath)=="function"?T.composedPath():void 0;return s.containerGroups.findIndex(function(M){var Y=M.container,K=M.tabbableNodes;return Y.contains(w)||(R==null?void 0:R.includes(Y))||K.find(function(se){return se===w})})},c=function(w){var T=i[w];if(typeof T=="function"){for(var R=arguments.length,M=new Array(R>1?R-1:0),Y=1;Y<R;Y++)M[Y-1]=arguments[Y];T=T.apply(void 0,M)}if(T===!0&&(T=void 0),!T){if(T===void 0||T===!1)return T;throw new Error("`".concat(w,"` was specified but was not a node, or did not return a node"))}var K=T;if(typeof T=="string"&&(K=r.querySelector(T),!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||!da(w,i.tabbableOptions))if(u(r.activeElement)>=0)w=r.activeElement;else{var T=s.tabbableGroups[0],R=T&&T.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 T=mf(w,i.tabbableOptions),R=pf(w,i.tabbableOptions),M=T.length>0?T[0]:void 0,Y=T.length>0?T[T.length-1]:void 0,K=R.find(function(y){return on(y)}),se=R.slice().reverse().find(function(y){return on(y)}),ne=!!T.find(function(y){return Zt(y)>0});return{container:w,tabbableNodes:T,focusableNodes:R,posTabIndexesFound:ne,firstTabbableNode:M,lastTabbableNode:Y,firstDomTabbableNode:K,lastDomTabbableNode:se,nextTabbableNode:function(q){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,B=T.indexOf(q);return B<0?X?R.slice(R.indexOf(q)+1).find(function(S){return on(S)}):R.slice(0,R.indexOf(q)).reverse().find(function(S){return on(S)}):T[B+(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 N(w){var T=w.activeElement;if(T)return T.shadowRoot&&T.shadowRoot.activeElement!==null?N(T.shadowRoot):T},g=function N(w){if(w!==!1&&w!==p(document)){if(!w||!w.focus){N(f());return}w.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=w,GC(w)&&w.select()}},h=function(w){var T=c("setReturnFocus",w);return T||(T===!1?!1:w)},D=function(w){var T=w.target,R=w.event,M=w.isBackward,Y=M===void 0?!1:M;T=T||Yr(R),m();var K=null;if(s.tabbableGroups.length>0){var se=u(T,R),ne=se>=0?s.containerGroups[se]:void 0;if(se<0)Y?K=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:K=s.tabbableGroups[0].firstTabbableNode;else if(Y){var y=Ul(s.tabbableGroups,function(I){var U=I.firstTabbableNode;return T===U});if(y<0&&(ne.container===T||da(T,i.tabbableOptions)&&!on(T,i.tabbableOptions)&&!ne.nextTabbableNode(T,!1))&&(y=se),y>=0){var q=y===0?s.tabbableGroups.length-1:y-1,X=s.tabbableGroups[q];K=Zt(T)>=0?X.lastTabbableNode:X.lastDomTabbableNode}else vr(R)||(K=ne.nextTabbableNode(T,!1))}else{var B=Ul(s.tabbableGroups,function(I){var U=I.lastTabbableNode;return T===U});if(B<0&&(ne.container===T||da(T,i.tabbableOptions)&&!on(T,i.tabbableOptions)&&!ne.nextTabbableNode(T))&&(B=se),B>=0){var S=B===s.tabbableGroups.length-1?0:B+1,L=s.tabbableGroups[S];K=Zt(T)>=0?L.firstTabbableNode:L.firstDomTabbableNode}else vr(R)||(K=ne.nextTabbableNode(T))}}else K=c("fallbackFocus");return K},b=function(w){var T=Yr(w);if(!(u(T,w)>=0)){if(ar(i.clickOutsideDeactivates,w)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}ar(i.allowOutsideClick,w)||w.preventDefault()}},x=function(w){var T=Yr(w),R=u(T,w)>=0;if(R||T instanceof Document)R&&(s.mostRecentlyFocusedNode=T);else{w.stopImmediatePropagation();var M,Y=!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(y){return y===s.mostRecentlyFocusedNode});ne>=0&&(i.isKeyForward(s.recentNavEvent)?ne+1<se.length&&(M=se[ne+1],Y=!1):ne-1>=0&&(M=se[ne-1],Y=!1))}}else s.containerGroups.some(function(y){return y.tabbableNodes.some(function(q){return Zt(q)>0})})||(Y=!1);else Y=!1;Y&&(M=D({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(M||s.mostRecentlyFocusedNode||f())}s.recentNavEvent=void 0},A=function(w){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=w;var R=D({event:w,isBackward:T});R&&(vr(w)&&w.preventDefault(),g(R))},_=function(w){if(QC(w)&&ar(i.escapeDeactivates,w)!==!1){w.preventDefault(),o.deactivate();return}(i.isKeyForward(w)||i.isKeyBackward(w))&&A(w,i.isKeyBackward(w))},E=function(w){var T=Yr(w);u(T,w)>=0||ar(i.clickOutsideDeactivates,w)||ar(i.allowOutsideClick,w)||(w.preventDefault(),w.stopImmediatePropagation())},k=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",E,{capture:!0,passive:!1}),r.addEventListener("keydown",_,{capture:!0,passive:!1}),o},F=function(){if(s.active)return r.removeEventListener("focusin",x,!0),r.removeEventListener("mousedown",b,!0),r.removeEventListener("touchstart",b,!0),r.removeEventListener("click",E,!0),r.removeEventListener("keydown",_,!0),o},z=function(w){var T=w.some(function(R){var M=Array.from(R.removedNodes);return M.some(function(Y){return Y===s.mostRecentlyFocusedNode})});T&&g(f())},$=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(z):void 0,j=function(){$&&($.disconnect(),s.active&&!s.paused&&s.containers.map(function(w){$.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 T=l(w,"onActivate"),R=l(w,"onPostActivate"),M=l(w,"checkCanFocusTrap");M||m(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,T==null||T();var Y=function(){M&&m(),k(),j(),R==null||R()};return M?(M(s.containers.concat()).then(Y,Y),this):(Y(),this)},deactivate:function(w){if(!s.active)return this;var T=ql({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},w);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,F(),s.active=!1,s.paused=!1,j(),Wl.deactivateTrap(a,o);var R=l(T,"onDeactivate"),M=l(T,"onPostDeactivate"),Y=l(T,"checkCanReturnFocus"),K=l(T,"returnFocus","returnFocusOnDeactivate");R==null||R();var se=function(){Hl(function(){K&&g(h(s.nodeFocusedBeforeActivation)),M==null||M()})};return K&&Y?(Y(h(s.nodeFocusedBeforeActivation)).then(se,se),this):(se(),this)},pause:function(w){if(s.paused||!s.active)return this;var T=l(w,"onPause"),R=l(w,"onPostPause");return s.paused=!0,T==null||T(),F(),j(),R==null||R(),this},unpause:function(w){if(!s.paused||!s.active)return this;var T=l(w,"onUnpause"),R=l(w,"onPostUnpause");return s.paused=!1,T==null||T(),m(),k(),j(),R==null||R(),this},updateContainerElements:function(w){var T=[].concat(w).filter(Boolean);return s.containers=T.map(function(R){return typeof R=="string"?r.querySelector(R):R}),s.active&&m(),j(),this}},o.updateContainerElements(t),o};const nx=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:tx},Symbol.toStringTag,{value:"Module"})),rx=sc(nx),ax=sc(VC);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 ix(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,gf(r.key),r)}}function sx(e,t,n){return t&&Vl(e.prototype,t),n&&Vl(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ox(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&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 ux(e){var t=cx();return function(){var r=Ba(e),a;if(t){var i=Ba(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return lx(this,a)}}function lx(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 cr(e)}function cr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cx(){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 Ba(e){return Ba=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ba(e)}function dx(e,t,n){return t=gf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gf(e){var t=fx(e,"string");return Un(t)==="symbol"?t:String(t)}function fx(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 Gr=C,he=TC,hx=rx,mx=hx.createFocusTrap,px=ax,gx=px.isFocusable,io=function(e){ox(n,e);var t=ux(n);function n(r){var a;ix(this,n),a=t.call(this,r),dx(cr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var 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(cr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(cr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(cr(a)),a.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:a.handleDeactivate,onPostDeactivate:a.handlePostDeactivate,clickOutsideDeactivates:a.handleClickOutsideDeactivates},a.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){a.originalOptions[s]=i[s];continue}a.internalOptions[s]=i[s]}return a.outsideClick=null,a.focusTrapElements=r.containerElements||[],a.updatePreviousElement(),a}return sx(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&&!gx(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?Gr.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===Gr.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=Gr.cloneElement(i,{ref:s});return o}return null}}]),n}(Gr.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:mx};var vx=io;const bx=bn(vx),vf=({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(eh.ReactQueryDevtools,{initialIsOpen:!1})]})};var yx=C.createContext({client:na});function Dx(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&&(na.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),na.init(r,a)),na)},[n,r]);return C.createElement(yx.Provider,{value:{client:i}},t)}const bf=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(Dx,{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}),yf=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...vh[r],...n||{}};return d.jsx(oe.IntlProvider,{locale:r,messages:a,children:e})},so=C.createContext({}),fa={en:"English",es:"Español",fr:"Français",pt:"Português"},Ot=C.createContext({isLoading:!0});function Ha(){return C.useContext(Ot)}const Df=({children:e,user:t})=>d.jsx(Ot.Provider,{value:t,children:e}),oo=C.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Cf=()=>C.useContext(oo),xf=({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})},Cx=({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}),yc(5e3)}).catch(c=>{c.message===gc&&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(yf,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(ks.CookiesProvider,{children:d.jsx(Df,{user:a,children:d.jsx(xf,{children:d.jsx(vf,{showDevTools:r,children:d.jsx(bf,{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 Sr=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:c="",gtmContext:f="Modal"})=>{const m=oe.useIntl(),{registerOverlay:p,unregisterOverlay:g}=Cf(),[h,D]=C.useState(t),b=_=>{_.key==="Escape"&&x(!1)};C.useEffect(()=>(window.addEventListener("keyup",b),()=>{window.removeEventListener("keyup",b)}));const x=_=>{D(_),_?(a(),p(e)):(i(),g(e))};C.useEffect(()=>(x(t),()=>{h&&g(e)}),[t]);const A=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:A,children:t&&d.jsx(bx,{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(yr,{className:"error",children:s})]})})})})},wf=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const xx=({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(Sr,{title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:V("invite-modal",e,{success:!!n}),children:d.jsx(rf,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const wx=({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(Sr,{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 Ex=({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(Fr,{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})})]})]}),_x=C.memo(Ex);const kx=({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 Ua=({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})};let sr=!1;const Va=C.forwardRef(({styling:e={},isOpen:t=!1,isLoading:n=!1,children:r,className:a="",functions:i={},callbacks:s={},...o},l)=>{const u=oe.useIntl(),c=C.useRef(null),f=l||c,[m,p]=C.useState(t?"open":"hidden"),{extraPadding:g=!0,hasPointer:h=!1,hasForm:D=!1}=e,{onOpen:b=()=>{},onClose:x=()=>{}}=s;C.useEffect(()=>{const k=f==null?void 0:f.current;if(k)return k.addEventListener("transitionend",A),k.addEventListener("keydown",_),()=>{k.removeEventListener("transitionend",A),k.removeEventListener("keydown",_)}},[]);const A=({propertyName:k})=>{k==="opacity"&&(sr!==!1&&clearTimeout(sr),p(F=>(F==="open"?b():F==="closed"&&x(),F==="opening"?"open":F==="closing"?"closed":F==="closed"?"hidden":F)))},_=k=>{k.key==="Escape"&&(k.stopPropagation(),k.preventDefault(),p("closing"))};Ln(()=>{sr!==!1&&clearTimeout(sr);let k="open";t?p("opening"):(p("closing"),k="hidden"),sr=setTimeout(()=>{p(k)},300)},[t]);const E={...o};return i&&i.onBlur&&(E.onBlur=i.onBlur),d.jsx("aside",{ref:f,className:V("tooltip text-medium",m,a,{loading:n,"extra-padding":g,"has-pointer":h,bottom:h==="bottom","has-form":D}),...E,children:d.jsx("div",{className:"content",hidden:m==="hidden",children:n?d.jsx("p",{children:u.formatMessage({id:"tooltip_loading"})}):typeof r=="string"?d.jsx("p",{children:r}):r})})});const Bx=({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 Ax=({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 Ef({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const Fx=({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:vc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(xe,{href:r,variant:"secondary",size:"small",onClick:()=>Ef({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},Tx=({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(Sr,{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:()=>Ef({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(Fx,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(Qt,{})]})};const Sx=({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 jx=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Ox=({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(D=>{if(!t[D]){m[D]=!1;return}if(!s[D]){if(typeof t[D]=="object"){m[D]=t[D];const{text:b,element:x}=t[D];if(x&&jx.includes(x.toLowerCase()))return;m[D]={text:b,element:f[D]};return}m[D]={text:t[D],element:f[D]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=D=>{D.preventDefault(),D.stopPropagation();const 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(D=>{if(m[D]&&typeof m[D]=="object"){const{text:b,element:x=""}=m[D];return D==="text"?d.jsx(zn,{overrideType:"text-only",className:"text",children:b},D):C.createElement(x,{key:D,className:D},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}})]})})},Px=C.memo(Ox);const Nx=({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 Rx=({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})})})]})},Mx=C.memo(Rx);const Ix=({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})]}),$x=({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},Aa={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"}},Lx=({data:e,cta:t,link:n,gtmContext:r})=>{var h,D;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=Aa[m])!=null&&h.gtmEvent&&(p=Aa[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||((D=e==null?void 0:e.members)==null?void 0:D.isMember),x=async A=>{if(A.preventDefault(),A.stopPropagation(),!(b||!t||!t.onClick)){s(_=>({..._,loading:!0}));try{const _=await t.onClick(e);s(_==="success"?()=>({registered:!0,loading:!1}):E=>({...E,loading:!1}))}catch{s(E=>({...E,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 zx={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 F,z,$;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||!Aa[h])return d.jsx(Ct,{element:"li",className:"card-wrapper"});const{basePath:D="",className:b,length:x,gtmEvent:A}=Aa[h];let _=m.slug?`${D}${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")&&(_=m.slug);const E={...zx,...x};let k={className:"card"};return _&&(k={href:_,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${A}-click`,"data-testid":"link"},m.openInNewTab&&(k.target="_blank")),d.jsx("li",{className:V("card-wrapper text-medium",b,i,{"has-link":_,"no-link":!_,"has-image":m.banner}),"data-testid":`${h}-card`,children:C.createElement(_?"a":"div",k,d.jsxs(d.Fragment,{children:[d.jsx(xc,{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"}):bc(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],E.partner)}),["title","text","secondaryText"].map(j=>{const N=m[j];if(!N)return null;const w=hc(j);return d.jsx(Lt,{className:w,options:{wrapper:"p",forceWrapper:!0,forceInline:!0},"data-testid":w,children:$n(N,E[j])},j)}),(l==null?void 0:l.id)&&(m==null?void 0:m.members)&&d.jsxs("span",{className:"member-information",children:[((F=m==null?void 0:m.members)==null?void 0:F.isMember)&&d.jsx(Rn,{size:"small",variant:"registered",icon:((z=m==null?void 0:m.members)==null?void 0:z.memberType)==="owner"?"user":"tick",children:o.formatMessage({id:`card_member_type_${($=m==null?void 0:m.members)==null?void 0:$.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($x,{type:b||"",data:m}),d.jsx(Lx,{data:m,cta:r,link:_||"",gtmContext:a})]}))})};const _f=({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)})}),qx=(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},Wx=({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 Pi={fourCards:1024,threeCards:769,twoCards:480};let Qr=null;const Hx=({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:D}=p,b=t.length,x=Math.ceil(b/f),A=C.useRef(null),_=Kn(!0,!0,A==null?void 0:A.current);C.useEffect(()=>{let j=1;_&&(_>=Pi.fourCards?j=4:_>=Pi.threeCards?j=3:_>=Pi.twoCards&&(j=2),j>b&&(j=b)),c(N=>({...N,cardsPerPage:j,isLoading:!1}))},[_,b]);const E=(j="next")=>{let N=h;if(typeof j=="string")if(j==="next")if(h<x-1)N=h+1;else return;else if(h>0)N=h-1;else return;else N=j;g(w=>({...w,currentPage:N,loadedPages:[...new Set([...D,N])]}))},k=j=>{Qr=j.touches[0].clientX},F=j=>{if(Qr===null)return;const N=j.touches[0].clientX,w=Qr-N;w>5?E("next"):w<-5&&E("previous"),Qr=null},z={"--width":`${_||0}px`,"--total-cards":b,"--cards-per-page":f,"--page":h};if(m)return d.jsx(Ts,{layout:`carousel${a?"-with-title":""}`});const $=(j,N)=>{var T;let w=null;return(T=j==null?void 0:j.sys)!=null&&T.id?w=`card-${j.sys.id}`:j!=null&&j.slug?w=`card-${j.slug}`:[n[N],j.contentType].includes("customCard")&&(w=`card-${window.btoa(`${j.title} ${j.createdAt}`)}-${N}`),w};return d.jsxs("section",{ref:A,className:V("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx(Wx,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:k,onTouchMove:F,style:z,"data-testid":"carousel-list",children:t.map((j,N)=>{let w=$(j,N);return w&&qx(N,f,h,D)?d.jsx(lo,{id:w,card:{...j,contentType:n[N]},buildCardData:r,gtmContext:s,...o},w):(w=w||`${e}-card-${N}`,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(),E("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:h<=0})}),[...Array(x)].map((j,N)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:V("page-indicator",{selected:N===h}),onClick:w=>{w.preventDefault(),w.stopPropagation(),E(N)},children:d.jsx(Ie,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:N+1,total:x})})})},`page-indicator-${N}`)),d.jsx("li",{className:"arrow next",children:d.jsx(xe,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:j=>{j.preventDefault(),j.stopPropagation(),E("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:h>=x-1})})]})]})},Ux=({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(Hx,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),f?null:d.jsx(Qt,{})]},`carousel-${c}`)});const Ni="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:`${Ni}_leave`}),f["aria-label"]=a.formatMessage({id:`${Ni}_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:`${Ni}${["joining","leaving"].includes(u)?`_${u}`:o?"_member":t?"_short":""}`})})})};const Ri="communityDetails_",Vx=({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:`${Ri}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:`${Ri}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:`${Ri}invite`})})]})};const Kx=({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 Zx=({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)})})},Yx=(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 Jr="languageSwitcher_",Gx=({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(D=>D&&D.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:`${Jr}label`})}),d.jsx("ul",{children:g.map(D=>{var A;if(!fa[D])return null;const b=(A=r[D])==null?void 0:A.post_name;let x={className:D};if(f===D)x["aria-label"]=u.formatMessage({id:`${Jr}selected`},{language:fa[D]});else{const _=Yx(D,b,i);x={...x,href:typeof _=="string"?_:_.url,onClick:E=>{m(D),c(D),typeof a<"u"&&(E.preventDefault(),E.stopPropagation(),a(D,typeof _=="string"?_:_.urlForRouter))}}}return d.jsx("li",{children:d.jsx(Dn,{...x,fallbackElement:"span",children:fa[D]})},D)})}),s!=="short"&&!h&&d.jsx("p",{children:u.formatMessage({id:`${Jr}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!h&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${Jr}disclaimer`},{email:Fn.support,link:D=>{const b=`mailto:${D}`;return d.jsx("a",{href:b,children:D})}})})]})};const Mi=oe.createIntl({locale:"en",messages:Zn}),jr=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:a="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:Mi.formatMessage({id:"loadMore_button"}),endOfFeed:Mi.formatMessage({id:"loadMore_endOfFeed"}),error:Mi.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[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 Xr=!1;const kf=({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:D=>{o(!1),typeof c=="function"&&c(D)},onFocus:()=>{Xr&&(clearTimeout(Xr),Xr=!1)},onBlur:()=>{Xr=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}`)})})]})})},Qx=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Jx=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Bf=({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:[Jx.map(({key:a,href:i})=>{const s=Qx(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"})})]})})]})},or=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Xx=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${or(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(`${or(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(`${or(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
|
|
158
158
|
|
|
159
|
-
${ar(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:ar(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const zx="shareLinks_",qx=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=oe.useIntl(),l=Lx({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:`${zx}link_${u}`}),...g})},u)})})]})};const Wx=({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 D=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:!D,role:"tabpanel","aria-labelledby":`tab-${c}`,"aria-live":D?"assertive":"off",children:typeof m=="string"?d.jsx("p",{children:m}):m},`section-${c}`))),o.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:p||`#${c}`,id:`tab-${c}`,className:V({selected:D}),role:"tab","aria-selected":D,...v,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 Hx={"2-1":901,"1-3":769,"1-1":769},Df=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Un(!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<Hx[e]?null:o)})};let Ni;const Ri="contactFooter_",Ux=({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(Ni),Ni=setTimeout(()=>{o(),s(!1)},500))};return C.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(Ni),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:`${Ri}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:`${Ri}text`})}),d.jsx(yn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(oe.FormattedMessage,{id:`${Ri}email`})})]}),d.jsx(Zd,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Vx=({activeLink:e,...t})=>d.jsx(an,{children:d.jsx(Df,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(yf,{activeLink:e}),d.jsx(yc,{...t})]})})});const Mi="cookieBanner_",Ii=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],$i=new Date(Date.now()+12*30*24*60*60*1e3),Cf=()=>{const e=oe.useIntl(),[t,n,r]=ws.useCookies(Ii),[a,i]=C.useState(!t["apol-cookie-banner"]),s=()=>{Ii.forEach(c=>{n(c,!0,{path:"/",expires:$i,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:$i}),Ii.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:$i});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:`${Mi}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${Mi}title`})}),d.jsx("p",{children:e.formatMessage({id:`${Mi}text`})}),d.jsx(Kn,{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:kn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:kn["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:kn.support,gtmType:"concierge-email-click"},business:{email:kn.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 On="footer_",Ba="SiteFooter",ql=({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:`${On}${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":Ba,"data-gtm-event-type":i,...s,children:d.jsx(oe.FormattedMessage,{id:`${On}${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:`${On}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(oe.FormattedMessage,{id:`${On}${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":Ba,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},uo=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx(Sa,{element:"hr"}),d.jsx(oo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Ba,"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(ql,{group:e}),Object.keys(It[e]).includes("child")&&d.jsx(ql,{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":Ba,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(oe.FormattedMessage,{id:`${On}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(oe.FormattedMessage,{id:`${On}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=ec(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)}}},wr={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"}}}},ka=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=oe.useIntl(),o=ec(wr,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 k=x.split("."),E=k[k.length-2];x=`${E==="topics"?`${E}-`:""}${k[k.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 D={},v={};if(h&&(D={...D,"aria-current":"page"}),p){const x=o.menuId||e,k={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&&(D={...k,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}),v={hidden:x in r?!r[x]:!0}),g||(v={...v,...k})}return d.jsxs("li",{className:V({[o.className]:o.className,"has-submenu":p,parent:g,active:h}),...D,children:[m?C.createElement(c?xe:"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 k={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(ka,{id:`${e}.${x}.${E}`,...k},E))})]},x):d.jsx(ka,{id:`${e}.${x}`,...k},x)})})]},e)};const Kx={height:67,height_desktop:83},lo=({showNavigation:e=!0})=>{const t=oe.useIntl(),n=C.useContext(Ot),r=Un(!0,!0),a=n&&typeof n.id=="string",i=C.useMemo(()=>je.getIsDesktopVersion(a,r),[a,r]),[s,o]=C.useReducer(Er,{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]),ic({scrollPosition:Kx[`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,D,v=!1)=>{je.handleMenus({id:h,value:D,menus:f.current.menus,dispatch:o,forceHandle:v})},p=C.useRef(null),g=h=>{h.key==="Escape"&&["navigation","search","account"].forEach(D=>{f.current.menus[D]&&m(D,!1,!0)})};return C.useEffect(()=>{var h;return(h=document.getElementById("header"))==null||h.addEventListener("keydown",g),()=>{var D;(D=document.getElementById("header"))==null||D.removeEventListener("keydown",g)}},[]),In(()=>{u.navigation&&je.autoFocus({menu:"navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.navigation]),In(()=>{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($e,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),d.jsx(oo,{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:wr.order.map(h=>d.jsx(ka,{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(Gd,{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($e,{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:wr.buttons.order.map(h=>d.jsx(ka,{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 Zx=()=>{const e=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(lo,{}),d.jsx("div",{id:"content",children:d.jsx(en,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(uo,{})]})},xf=({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=rc();C.useEffect(()=>{window.scrollTo(0,0)},[g]);const h=ea(e,{locale:o}),D=ea(t,{locale:o}),v=ea(n,{locale:o}),x={};return c!=="default"&&(x[c]=!0),f!=="default"&&(x[f]=!0),m!=="default"&&(x[m]=!0),d.jsx(Zf.ErrorBoundary,{onError:r,fallback:d.jsx(Zx,{}),children:d.jsx(C.Suspense,{fallback:null,children:d.jsxs("div",{id:"wrapper",className:V(s,x,{"has-footer":u}),children:[d.jsx(lo,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[D&&d.jsx("div",{className:V("additional-content prepended",{"large-modal":p==="large"}),children:D}),C.createElement(c==="bold"?ro:"div",{id:"content",children:h,className:V({"large-modal":p==="large"})})]}),v&&d.jsx("div",{className:"additional-content appended",children:v}),u&&d.jsx(uo,{}),d.jsx(Cf,{})]})})})},Wl={default:"tags_",headerTopics:"header_topics_topics_"},Li={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"},Yx={getTagDetails:e=>{if(e.includes("topic_")){if(e=Li.topic[e.replace("topic_","")],e){const t=wr.topics.topics[e].href;return t?{id:e,href:t,text:`${Wl.headerTopics}${e}`}:null}return null}return Li[e]?(e=Li[e],{id:e,text:`${Wl.default}${e}`}):null}};const Gx=({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=Yx.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 Qx=({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(_r,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(Pn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx(Fr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const Jx=({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(Bs,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const wf=({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 Ef=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=oe.useIntl(),o=ja(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):cc(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 Xx=({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(Oa,{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:D,icon:v,image:x,isIntroduction:k,optional:E,slug:_,subsectionId:A,title:S,type:q})=>{const $=a&&t||k,j={};return x&&(j.style={"--image":`url(${x})`}),d.jsx("li",{className:V({article:D===ir.ARTICLE,discussion:D===ir.DISCUSSION,quiz:D===ir.QUIZ,completed:g&&D===ir.ARTICLE,locked:!$}),...j,children:d.jsx(yn,{href:$?`/microcourses/en/${o}/${_}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${lc(S)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(wf,{sectionId:i,subsectionId:A,title:S,className:"course-title"})," ",d.jsx(Ef,{completionTime:h,icon:v,optional:E,type:q,children:c&&c[_]&&d.jsx("span",{className:"quiz-score",children:`${c[_]}%`})})]})})},_)})})]})};const ew=({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 Qr=null;const st="discussion_form_",Ua=({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 q,$,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,D]=C.useState(!1);if(r.isLoading)return d.jsx(Ct,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const v=N=>{m(N);let w;!c||!c.id?w=kt(u.formatMessage,`${st}error_loggedOut`,t.type,"action"):n?N.length>=i&&(w=`${st}error_tooLong`):w=kt(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 N=((q=t.slugs)==null?void 0:q.reply)||(($=t.slugs)==null?void 0:$.answer)||((j=t.slugs)==null?void 0:j.question)||"";N&&(x=`${x}-${N.slice(-15)}`)}e&&(x=`${e}-${x}`);const k=async N=>{var F;if(N.preventDefault(),N.stopPropagation(),!c||!c.id||!n||_)return;Qr&&clearTimeout(Qr),D("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 ah(1e3),o.callback&&await o.callback(R),Qr=setTimeout(()=>{m(""),D("submitted");const M=new Event("discussionFormSubmitted");document.dispatchEvent(M),E()},500)}catch(R){const M=R;let Y=`${st}error`;M!=null&&M.message.includes("entry already exists")&&(Y=kt(u.formatMessage,`${st}error_alreadyExists`,t.type,"action")),M!=null&&M.message.includes("429")?Y=kt(u.formatMessage,`${st}error_tooMany`,t.type,"action"):M!=null&&M.message.includes("400")&&(Y=`${st}error`),g(Y),E()}},E=()=>{Qr=setTimeout(()=>{g(!1),D(!1)},5e3)},_=!f||!ch(f),A=h==="submitting",S=[];return(r.isEditing&&!A||s.cancel)&&S.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`})}),S.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:N=>{if(r.isEditing){D("submitting"),o.handleSaveEdit&&o.handleSaveEdit(f);return}k(N)},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||_||A||r.isEditing&&f===r.isEditing.text,children:u.formatMessage({id:`${st}${A?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:kt(u.formatMessage,`${st}title`,t.type,"action")}),d.jsx(_r,{member:c||"community",gtmContext:l,gtmType:"profile-click"}),d.jsx($e,{element:"label",showOnFocus:!1,htmlFor:`${x}-input`,children:kt(u.formatMessage,`${st}label`,t.type,"action")}),d.jsx(Kd,{id:`${x}-input`,value:h==="submitting"&&!p?"":f,placeholder:a||kt(u.formatMessage,`${st}placeholder`,t.type,"action"),onChange:v,autoFocus:!!r.isEditing,"aria-invalid":!!p,"aria-errormessage":"error-message"}),d.jsx("small",{children:kt(u.formatMessage,`${st}explainer`,t.type,"action",{a:N=>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:N})})}),d.jsx(Kn,{buttons:S}),h==="submitted"&&r.showSuccessMessage&&d.jsx(pr,{className:"success","data-testid":"success",children:kt(u.formatMessage,`${st}success`,t.type,"action")}),p&&d.jsx(pr,{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})]})},co=({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(so,{isShort:!0,functions:{join:r,leave:a}})}});const{content:s,functions:o,meta:l,...u}=e;return d.jsx(Ua,{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||""}`})},tw={showForm:!1},Va=C.createContext(tw),_f=({children:e})=>{const[t,n]=C.useState({showForm:!1});return d.jsx(Va.Provider,{value:{...t,updateConversation:n},children:e})},nw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),rw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const xs=({icon:e,...t})=>d.jsx(xe,{className:"discussion-button",variant:"tertiary",icon:e,...t});let mr=!1;const zi=()=>{mr!==!1&&(clearTimeout(mr),mr=!1)},qi=5;let Wi=null;const Bf=({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(Er,c),{numberOfLikes:p,userLikedContent:g,ignoreInteractions:h,showLikers:D,tabbableLink:v}=f;C.useEffect(()=>{m([{type:"userLikedContent",value:a}])},[a]);const x=C.useMemo(()=>rw(n,qi),[n]),k=S=>{if(S.preventDefault(),S.stopPropagation(),m([{type:"showLikers",value:!1}]),mr)return zi(),!1;if(zi(),h||!s)return!1;mr=setTimeout(E,350)},E=async()=>{if(zi(),h||!s)return!1;let S=g?p-1:p+1;S<0&&(S=0),m([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const q=nw(i.slugs);g?await l(q):await o({...q,payload:{contentPath:window.location.pathname}})}}catch{m([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{m([{type:"ignoreInteractions",value:!1}])}},_=()=>{Wi=setTimeout(()=>{m([{type:"showLikers",value:!1}])},500)},A=()=>{Wi&&clearTimeout(Wi)};return C.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&m([{type:"showLikers",value:!1}])},onMouseEnter:()=>{A(),m([{type:"showLikers",value:!0}])},onMouseLeave:()=>{_()}},d.jsxs(d.Fragment,{children:[d.jsx(xs,{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:k,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:()=>_,onClick:S=>{var $;S.preventDefault(),S.stopPropagation(),A(),m([{type:"showLikers",value:!0}]);const q=($=S.currentTarget.nextSibling)==null?void 0:$.childNodes[0];if(q){const j=q.querySelector("li:first-child a");j&&(m([{type:"tabbableLink",value:0}]),setTimeout(()=>{j.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),_())},"aria-expanded":D,"aria-controls":`likes-tooltip-${i.slug}`,children:d.jsx($e,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),d.jsx(ao,{id:`likes-tooltip-${i.slug}`,isOpen:D,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[x.map((S,q)=>{if(typeof S=="string"||!S.name)return null;const $={};return v!==q&&($.tabIndex=-1),d.jsx("li",{"data-index":q,children:d.jsx(yn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:j=>j==null?void 0:j.stopPropagation(),onFocus:()=>A(),onKeyDown:j=>{var M,Y,K,se;if(!j||!["ArrowUp","ArrowDown"].includes(j.key||""))return;j.stopPropagation(),j.preventDefault();const N=j.key==="ArrowUp"?"up":"down",w=(M=j.currentTarget)==null?void 0:M.parentElement;let F=w==null?void 0:w.nextElementSibling;if(N==="up"){const ne=w==null?void 0:w.previousElementSibling;ne?F=ne:(F=(Y=w==null?void 0:w.parentElement)==null?void 0:Y.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 R=(F==null?void 0:F.getAttribute("data-index"))||"0";m([{type:"tabbableLink",value:R}]),(se=F==null?void 0:F.querySelector("a"))==null||se.focus()},...$,children:S.name})},S.id||window.btoa(S.name))}),t>qi&&d.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-qi})})]})})]})]}))},Hl=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Ka=(e,t)=>e&&!t;const Mt="discussion_",aw=280,Tr=({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:D=!1})=>{const v=oe.useIntl(),x=C.useContext(Ot),k=C.useContext(Va),{author:E,canLike:_,createdAt:A,id:S,likes:q=0,userLiked:$,comments:j=0}=t,N=x&&x.id&&typeof E!="string"&&E.id&&E.id===x.id||!1,w=typeof _=="boolean"?_:n?!N:!1,F=N&&(!t.createdAt||rh(t.createdAt,10,"seconds")),R=C.useRef(null),[M,Y]=C.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[K,se]=C.useState(!1),[ne,y]=C.useState(F?"highlighted":"default"),[z,J]=C.useState("");C.useEffect(()=>{const Z=R.current;if(!(!Z||ne==="default"))return document.addEventListener("discussionFormSubmitted",B),Z.addEventListener("transitionend",T),()=>{document.removeEventListener("discussionFormSubmitted",B),Z.removeEventListener("transitionend",T)}},[]),C.useEffect(()=>{Y({...M,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]);const B=()=>{setTimeout(()=>{y("fading")},1e3)},T=({propertyName:Z})=>{Z==="background-color"&&y(ue=>(ue==="default"&&(document.removeEventListener("discussionFormSubmitted",B),R.current&&R.current.removeEventListener("transitionend",T)),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 L=D?Mn(M.body,aw):M.body,I=async Z=>{Z||(Z=""),J("");try{if(!Xl(Z,M.body)){const ue=t.type==="question"?{title:Z}:{body:Z};await l(Hl(t.slugs),ue)}Y({body:Z,isEditing:!1,didEdit:!0})}catch{J(`${Mt}form_error`)}},U=()=>{k&&k.updateConversation&&k.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)}`,Q=document.getElementById(ue),ge=document.getElementById(`${ue}-input`);ge&&ge.focus(),Q&&Q.scrollIntoView({behavior:"smooth"})},0)},te=async()=>{se(!1);try{await o(Hl(t.slugs))}catch{J("delete-error")}},ee=[{text:v.formatMessage({id:`${Mt}moreMenu_report`}),onClick:Z=>{Z.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(v.formatMessage({id:`${Mt}report_subject`}))}&body=${encodeURI(v.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&&N&&ee.push({text:v.formatMessage({id:`${Mt}moreMenu_edit`}),onClick:()=>Y({...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:`${Mt}moreMenu_delete`}),onClick:Z=>{Z.preventDefault(),Z.stopPropagation(),se(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`delete-${t.type}-click`,...pf(`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:R,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${g}-post-click`,onClick:Z=>{!m.post||M.isEditing||(Z.preventDefault(),Z.stopPropagation(),window.location.href=m.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:S||t.slug,className:V("discussion-card",t.type,{editing:M.isEditing,"has-link":m.post&&!M.isEditing}),children:[!M.isEditing&&d.jsx(_r,{member:E,additionalContent:{createdAt:A,didEdit:M.didEdit},className:typeof E!="string"&&E.id===a?"highlighted":"",gtmContext:g,gtmType:"profile-click"}),M.isEditing?d.jsx(Ua,{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:z!==""&&z!=="delete-error"?v.formatMessage({id:z},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:s,handleSaveEdit:I,handleCancel:()=>{J(""),Y({...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(bc,{text:t==null?void 0:t.body.trim(),markdownOptions:{overrides:{a:Gi}}}):d.jsx($n,{options:{overrides:{a:Gi}},children:L.trim()})]}):d.jsx($n,{options:{wrapper:t.type==="question"?"h1":C.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:L.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(Bf,{element:"li",likes:q,isShort:!1,userLiked:$,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(xs,{onClick:Z=>{Z.preventDefault(),Z.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:`${Mt}comments_screenReader`},{count:j}),children:v.formatMessage({id:`${Mt}comments`},{count:j})})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(xs,{styling:{muted:!0},onClick:U,icon:{icon:"speech-bubble_square_thick"},children:v.formatMessage({id:`${Mt}reply`})})}),d.jsx(bf,{element:"li",id:`more-${t.slug}`,options:ee})]})]}),h,d.jsx(Ar,{id:`delete-${t.slug}-modal`,isOpen:K,functions:{onOpen:()=>{},onClose:()=>se(!1)},forceShow:{error:z==="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:()=>se(!1),children:v.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:te,children:v.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:Z=>d.jsx("p",{children:Z}),action:v.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Hi="discussion_responses_",kf=({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:`${Hi}title`},{action:n.formatMessage({id:`${Hi}${e}`}),count:t})}),t===0&&d.jsx("p",{children:kt(n.formatMessage,`${Hi}empty`,e,e)})]})};const Af=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=oe.useIntl(),s=C.useContext(Va),o=ea(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(Fr,{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(Ua,{...r})]})},iw="post",sw="reply",Ff="00000000-0000-0000-0000-000000000000";function fo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function ho({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 ow(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function uw(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Tf(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 lw({content:e}){return{content:e,id:Ff,time:new Date().toISOString(),verb:iw}}function Ul({activity:e,user:t}){return{...e,actor:Tf(t),...ow()}}function Aa({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 Sf({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 cw({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Ff,kind:sw,parent:t||""}}function Vl({reply:e,user:t}){const n=Tf(t);return{...e,user_id:n.id,user:n,...uw()}}function Kl({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 dw({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}const jf=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let Zl,Ui=0;const Of=()=>{C.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(Zl);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),Ui=0;return}Ui++,!(Ui>10)&&(Zl=setTimeout(()=>{e(t)},50))}},Hn=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}),Pf=Object.freeze({actor:`SU:${Hn.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"}),fw=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"}),hw=Object.freeze({actor:`SU:${Hn.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"}),mw=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:Pf.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:Pf.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:Hn.id,user:{id:Hn.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 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:hw.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:Hn.id,user:{id:Hn.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 4..."},parent:"",latest_children:{},children_counts:{}});function pw({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=Ul({activity:lw(o),user:i});return Yl(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=Ul({activity:o,user:i});r.setQueryData(a,Yl(c,u,!0)),setTimeout(()=>{jf(c.id)},0)}});return s}function gw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Fa(a,s);return o&&(o.content=i),s}),onError:n});return r}function vw({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:fo(u),mutate:ho(u)},user:l,...u},f=pw({...c,mutationFn:e}),m=gw({...c,mutationFn:t}),p=bw({...c,mutationFn:n}),g=Dw({...c,mutationFn:a}),h=Cw({...c,mutationFn:i}),{activities:D,...v}=yw({queryKey:s,queryFn:r});return{activities:D,mutations:{create:f,edit:m,remove:g,like:p,unlike:h},user:l,...v}}function bw({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=Fa(s,o);return l&&Aa({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Fa(o,l);u&&Aa({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function yw({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:ww(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Dw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>xw(a,i)),onError:n});return r}function Cw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Fa(i,s);return o&&Sf({activity:o,user:r}),s}),onError:n});return a}function Yl(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 Fa(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function xw(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 ww(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const Ew=({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:D},user:v}=vw({queryKey:[e,t,"activities"],queryFns:r});return Of(),l?d.jsx(en,{variant:"error",text:l.message}):d.jsxs("section",{children:[d.jsx(co,{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,k)=>{var R,M,Y,K,se,ne,y,z;const{id:E,own_reactions:_,latest_reactions:A,reaction_counts:S}=x,q=(((R=A==null?void 0:A.like)==null?void 0:R.length)||0)>0,$=(((M=_==null?void 0:_.like)==null?void 0:M.length)||0)>0,j=$?_==null?void 0:_.like[0].id:"",N=q?(Y=A==null?void 0:A.like)==null?void 0:Y.map(J=>{var B,T,L;return{id:(B=J==null?void 0:J.user)==null?void 0:B.id,name:(L=(T=J==null?void 0:J.user)==null?void 0:T.data)==null?void 0:L.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(Tr,{content:{type:"post",title:x==null?void 0:x.title,body:x==null?void 0:x.content,canLike:Ka(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:(y=w==null?void 0:w.data)==null?void 0:y.location,image:{thumbnail:((z=w==null?void 0:w.data)==null?void 0:z.thumbnail)||void 0}},userLiked:$,likes:(S==null?void 0:S.like)||0,comments:(S==null?void 0:S.reply)||0,peopleWhoLiked:N},links:{post:`${e}/${t}/${E}`,comments:`${e}/${t}/${E}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>g({activityId:E}),updateContent:(J,{body:B})=>p({activityId:E,content:B})},likes:{createLike:()=>h({activityId:E}),deleteLike:()=>D({activityId:E,reactionId:j})},comments:{openComments:()=>null}},isTruncated:!0})},E)}),!f&&d.jsx(Fr,{hasNextPage:c,loadNextPage:()=>u(),icon:{icon:"arrow-down",position:"right"},messages:{button:s.formatMessage({id:"loadMore_button"}),error:s.formatMessage({id:"loadMore_error"})}})]})},_w={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 Bw({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=Vl({reply:cw(o),user:i});return Gl(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=Vl({reply:o,user:i});r.setQueryData(a,Gl(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{jf(c.id)},0)}});return s}function kw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ta(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Nf({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:fo(u),mutate:ho(u)},user:l,...u},f=Bw({...c,mutationFn:e}),m=kw({...c,mutationFn:t}),p=Aw({...c,mutationFn:n}),g=Tw({...c,mutationFn:a}),h=Sw({...c,mutationFn:i}),{replies:D,...v}=Fw({queryKey:s,queryFn:r});return{replies:D,mutations:{create:f,edit:m,remove:g,like:p,unlike:h},user:l,...v}}function Aw({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=Ta(s,o);return l&&Kl({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ta(o,l);u&&Kl({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function Fw({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=Rw(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Tw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Nw(a,i)),onError:n});return r}function Sw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ta(i,s);return o&&dw({reply:o,user:r}),s}),onError:n});return a}function jw(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function Ow(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 Pw(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 Gl(e,t,n){return t?n!=null&&n.append?Ow(e,t,n):Pw(e,t,n):jw(e)}function Ta(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Nw(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 Rw(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 Mw=({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:D},user:v}=Nf({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:E=>i.list({...E,reactionId:r})}});Es([f]);const[x,k]=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:()=>k(!x),children:s.formatMessage({id:`discussion_thread_${x?"hide":"show"}`},{count:l==null?void 0:l.length})}),x&&d.jsx(Af,{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,y,z,J,B,T,L,I,U,te,ee,Z;const{id:_,own_children:A,latest_children:S,children_counts:q}=E,j=(((ne=A==null?void 0:A.like)==null?void 0:ne.length)||0)>0?(y=A==null?void 0:A.like)==null?void 0:y.find(ue=>{var Q;return((Q=ue==null?void 0:ue.user)==null?void 0:Q.id)===(v==null?void 0:v.id)}):!1,N=j?j==null?void 0:j.id:"",w=!!j,R=(((z=S==null?void 0:S.like)==null?void 0:z.length)||0)>0?(J=S==null?void 0:S.like)==null?void 0:J.map(ue=>{var Q,ge,me;return{id:(Q=ue==null?void 0:ue.user)==null?void 0:Q.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,Y=(M==null?void 0:M.id)===(v==null?void 0:v.id),K=Ka(a,Y),se=typeof E.data.content=="string"?(B=E==null?void 0:E.data)==null?void 0:B.content:((L=(T=E==null?void 0:E.data)==null?void 0:T.content)==null?void 0:L.text)||"";return d.jsx(Tr,{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:(I=M.data)==null?void 0:I.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:((Z=M.data)==null?void 0:Z.thumbnail)||void 0}},userLiked:w,likes:(q==null?void 0:q.like)||0,peopleWhoLiked:R},functions:{content:{createContent:()=>null,deleteContent:()=>h({replyId:_}),updateContent:(ue,{body:Q})=>p({replyId:_,content:Q})},likes:{createLike:()=>g({replyId:_}),deleteLike:()=>D({replyId:_,reactionId:N})},comments:{}}},_)}):null})]})};const Rf=({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:D,unlike:v},user:x}=Nf({queryKey:[e,t,n,"replies"],queryFns:a});return Es([m]),Of(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(kf,{type:"comment",responses:u}),d.jsx(co,{form:{content:{type:"reply",slugs:{}},functions:{create:(k,{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(k=>{var se,ne,y,z,J,B,T,L,I,U,te,ee;const{id:E,own_children:_,latest_children:A,children_counts:S}=k,$=(((se=_==null?void 0:_.like)==null?void 0:se.length)||0)>0?(ne=_==null?void 0:_.like)==null?void 0:ne.find(Z=>{var ue;return((ue=Z==null?void 0:Z.user)==null?void 0:ue.id)===(x==null?void 0:x.id)}):!1,j=$?$==null?void 0:$.id:"",N=!!$,F=(((y=A==null?void 0:A.like)==null?void 0:y.length)||0)>0?(z=A==null?void 0:A.like)==null?void 0:z.map(Z=>{var ue,Q,ge;return{id:(ue=Z==null?void 0:Z.user)==null?void 0:ue.id,name:(ge=(Q=Z==null?void 0:Z.user)==null?void 0:Q.data)==null?void 0:ge.name}}):!1,R=k==null?void 0:k.user,M=(R==null?void 0:R.id)===(x==null?void 0:x.id),Y=Ka(r,M),K=typeof k.data.content=="string"?(J=k==null?void 0:k.data)==null?void 0:J.content:((T=(B=k==null?void 0:k.data)==null?void 0:B.content)==null?void 0:T.text)||"";return d.jsx(_f,{children:d.jsx(Tr,{content:{id:E,type:"reply",body:K,canLike:Y,createdAt:k==null?void 0:k.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:E},slug:E,author:{id:R==null?void 0:R.id,name:(L=R.data)==null?void 0:L.name,organization:(I=R.data)==null?void 0:I.organization,jobTitle:(U=R.data)==null?void 0:U.jobTitle,location:(te=R.data)==null?void 0:te.location,image:{thumbnail:((ee=R.data)==null?void 0:ee.thumbnail)||void 0}},userLiked:N,likes:(S==null?void 0:S.like)||0,peopleWhoLiked:F},functions:{content:{createContent:()=>null,deleteContent:()=>D({replyId:E}),updateContent:(Z,{body:ue})=>g({replyId:E,content:ue})},likes:{createLike:()=>h({replyId:E}),deleteLike:()=>v({replyId:E,reactionId:j})},comments:{}},children:d.jsx(Mw,{basePath:e,parentId:t,activityId:n,replyId:E,isMember:r,functions:{...a}})},E)},E)}),!m&&d.jsx(Fr,{hasNextPage:f,loadNextPage:()=>c(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})};function Iw({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 $w({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 Lw({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:fo(o),mutate:ho(o)},user:s,...o},u=Iw({...l,mutationFn:t}),c=zw({...l,mutationFn:n}),f=qw({...l,mutationFn:r}),{activity:m,...p}=$w({queryKey:a,queryFn:e});return{activity:m,mutations:{edit:u,like:c,unlike:f},user:s,...p}}function zw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Aa({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Aa({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function qw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Sf({activity:s,user:r}),s)),onError:n});return a}const Ww=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,join:o,leave:l}})=>{var $,j,N,w,F,R,M,Y,K,se;const u=oe.useIntl(),c=C.useContext(Ot),{activity:f,error:m,isLoading:p,mutations:{edit:g,like:h,unlike:D}}=Lw({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:v,latest_reactions:x}=f,k=((($=x==null?void 0:x.like)==null?void 0:$.length)||0)>0,E=(((j=v==null?void 0:v.like)==null?void 0:j.length)||0)>0,_=E?v==null?void 0:v.like[0].id:"",A=k?(N=x==null?void 0:x.like)==null?void 0:N.map(ne=>{var y,z,J;return{id:(y=ne==null?void 0:ne.user)==null?void 0:y.id,name:(J=(z=ne==null?void 0:ne.user)==null?void 0:z.data)==null?void 0:J.name}}):!1,S=f==null?void 0:f.actor,q=(S==null?void 0:S.id)===(c==null?void 0:c.id);return d.jsxs("section",{className:"activity-section",children:[d.jsx(Tr,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:f==null?void 0:f.content,canLike:Ka(r,q),createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:{id:S.id,name:(w=S.data)==null?void 0:w.name,organization:(F=S.data)==null?void 0:F.organization,jobTitle:(R=S.data)==null?void 0:R.jobTitle,location:(M=S.data)==null?void 0:M.location,image:{thumbnail:((Y=S.data)==null?void 0:Y.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:A},originalAuthorId:S==null?void 0:S.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(ne,{body:y})=>g({content:y})},likes:{createLike:()=>h({activityId:n}),deleteLike:()=>D({activityId:n,reactionId:_})},comments:{openComments:()=>{}}}},n),d.jsx(Rf,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,join:o,leave:l}})]})},Hw=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Ql=[{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 Jr="notFoundError_",Uw=()=>{const e=oe.useIntl(),t=[];return Ql.forEach((n,r)=>{n.title=e.formatMessage({id:`${Jr}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(xf,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(an,{children:[d.jsx(vf,{cards:Ql,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(xe,{href:"/solution-articles/",children:e.formatMessage({id:`${Jr}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${Jr}title`})}),d.jsx("p",{children:e.formatMessage({id:`${Jr}text`})})]})};exports.ASSETS_BUCKET=zt;exports.ActivitiesFeed=Ew;exports.ActivitySection=Ww;exports.AddPost=co;exports.Banner=mx;exports.BannerSection=Cx;exports.Breadcrumbs=Px;exports.Buckets=vh;exports.Button=xe;exports.ButtonWrapper=Kn;exports.COURSE_CONTENT_TYPES=ir;exports.CacheProvider=lf;exports.Card=io;exports.CardBlock=vf;exports.Carousel=jx;exports.CollapsibleSection=Oa;exports.Columns=Df;exports.CommunityDetails=Ox;exports.ContactFooter=Ux;exports.ContactForm=Zd;exports.ContentTypeLabel=pc;exports.Contributors=Fs;exports.ConversationContext=Va;exports.CookieBanner=Cf;exports.CourseProgression=Jx;exports.CourseStructure=Xx;exports.CustomContentBanner=xx;exports.Directory=cx;exports.DiscussionConversation=_f;exports.DiscussionForm=Ua;exports.DiscussionLikes=Bf;exports.DiscussionPost=Tr;exports.DiscussionThread=Af;exports.Divider=Qt;exports.DownloadSection=px;exports.EMAILS=kn;exports.EditSection=vx;exports.EmailHelperTextBox=xc;exports.EmptyStateBox=en;exports.Filters=Nx;exports.FlagsProvider=cf;exports.Footer=uo;exports.Form=Br;exports.FullWidthSection=an;exports.GlobalProviders=ux;exports.Header=lo;exports.HelperTextBox=vc;exports.HiddenFromScreenReaders=Sa;exports.HideShowTextBox=bc;exports.HighlightSection=Ex;exports.HighlightedTextBox=St;exports.INVALID_TOKEN=dc;exports.IconBulletedList=Dh;exports.ImageContainer=hh;exports.IntlProvider=df;exports.InviteForm=Yd;exports.InviteModal=lx;exports.JoinButton=so;exports.LanguageContext=to;exports.LanguageSwitcher=Mx;exports.LessonName=wf;exports.LessonType=Ef;exports.Link=yn;exports.LoadMore=Fr;exports.LoadingBlock=Sh;exports.LoadingPlaceholder=Ct;exports.LoadingState=ks;exports.Logo=oo;exports.LogoSection=bx;exports.MarkCompleteButton=ew;exports.MarkdownText=$n;exports.MarketingBlock=_x;exports.Member=_r;exports.MembersList=Qx;exports.Modal=ro;exports.MoreMenu=bf;exports.NUMBER_OF_COUNTRIES=nh;exports.NUMBER_OF_USERS=th;exports.NavigationMenu=yf;exports.NotFoundError=Uw;exports.Overlay=Ar;exports.OverlayContext=no;exports.OverlayProvider=mf;exports.PageHeading=yc;exports.PageLayout=xf;exports.PasswordForm=nC;exports.PasswordRules=kc;exports.Pill=Pn;exports.Portal=mh;exports.ProfileImageChange=tC;exports.ProfilePicture=tn;exports.ProgressBar=Bs;exports.ProgressTracker=ph;exports.Rating=Hh;exports.RepliesFeed=Rf;exports.ResponsesHeading=kf;exports.ResponsiveImage=Zn;exports.ReturnToNavButton=gh;exports.RichTextEditor=Kd;exports.SearchForm=Gd;exports.ShareLinks=qx;exports.SignupForm=uC;exports.Span=Gi;exports.StatusBanner=pr;exports.TableOfContents=hx;exports.Tabs=Wx;exports.Tags=Gx;exports.TestimonialBlock=fx;exports.TimeToComplete=Ha;exports.Toggle=eC;exports.Tooltip=ao;exports.TopLevelPage=Vx;exports.UserContext=Ot;exports.UserProvider=ff;exports.VisuallyHidden=$e;exports.addAriaProps=pf;exports.basicReducer=Er;exports.camelCaseToDashCase=uc;exports.checkIntlPathExists=ja;exports.generateConditions=oa;exports.generateCssIcon=fc;exports.getLongDate=_s;exports.getMember=As;exports.getShortDate=hc;exports.headerData=wr;exports.mapGetStreamData=Hw;exports.pageReady=mc;exports.passwordValidator=Zi;exports.repliesFeedMock=_w;exports.supportedLanguages=la;exports.toCamelCase=lc;exports.toSentenceCase=cc;exports.useCurrentPath=rc;exports.useEffectAfterMount=In;exports.useElementWidth=Un;exports.useOverlay=hf;exports.useScrollListener=ic;exports.useScrollToHash=Es;exports.useUser=Wa;
|
|
159
|
+
${or(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:or(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const ew="shareLinks_",tw=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=oe.useIntl(),l=Xx({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:`${ew}link_${u}`}),...g})},u)})})]})};const nw=({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 D=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:!D,role:"tabpanel","aria-labelledby":`tab-${c}`,"aria-live":D?"assertive":"off",children:typeof m=="string"?d.jsx("p",{children:m}):m},`section-${c}`))),o.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:p||`#${c}`,id:`tab-${c}`,className:V({selected:D}),role:"tab","aria-selected":D,...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 rw={"2-1":901,"1-3":769,"1-1":769},Af=({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<rw[e]?null:o)})};let Ii;const $i="contactFooter_",aw=({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(Ii),Ii=setTimeout(()=>{o(),s(!1)},500))};return C.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(Ii),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:`${$i}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:`${$i}text`})}),d.jsx(Dn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(oe.FormattedMessage,{id:`${$i}email`})})]}),d.jsx(nf,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},iw=({activeLink:e,...t})=>d.jsx(an,{children:d.jsx(Af,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(Bf,{activeLink:e}),d.jsx(kc,{...t})]})})});const Li="cookieBanner_",zi=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],qi=new Date(Date.now()+12*30*24*60*60*1e3),Ff=()=>{const e=oe.useIntl(),[t,n,r]=ks.useCookies(zi),[a,i]=C.useState(!t["apol-cookie-banner"]),s=()=>{zi.forEach(c=>{n(c,!0,{path:"/",expires:qi,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:qi}),zi.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:qi});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:`${Li}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${Li}title`})}),d.jsx("p",{children:e.formatMessage({id:`${Li}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_",Fa="SiteFooter",Kl=({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":Fa,"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":Fa,"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(Pa,{element:"hr"}),d.jsx(fo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Fa,"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(Kl,{group:e}),Object.keys(It[e]).includes("child")&&d.jsx(Kl,{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":Fa,"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=ic(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)}}},Br={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"}}}},Ta=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=oe.useIntl(),o=ic(Br,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 A=x.split("."),_=A[A.length-2];x=`${_==="topics"?`${_}-`:""}${A[A.length-1]}`}m={href:o.href},u&&(m={...m,className:"gtm-trackable","data-gtm-event-type":x,"data-gtm-event-context":"HeaderButtons"}),c&&(m={...m,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],g=p&&o[o.order[0]].order,h=m&&window.location.pathname===o.href;let D={},b={};if(h&&(D={...D,"aria-current":"page"}),p){const x=o.menuId||e,A={onClick:_=>je.events.onClick(_,{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&&(D={...A,onKeyPress:_=>{_.key==="Enter"&&je.events.onClick(_,{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,...A})}return d.jsxs("li",{className:V({[o.className]:o.className,"has-submenu":p,parent:g,active:h}),...D,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 A={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(_=>d.jsx(Ta,{id:`${e}.${x}.${_}`,...A},_))})]},x):d.jsx(Ta,{id:`${e}.${x}`,...A},x)})})]},e)};const sw={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(Ar,{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]),cc({scrollPosition:sw[`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,D,b=!1)=>{je.handleMenus({id:h,value:D,menus:f.current.menus,dispatch:o,forceHandle:b})},p=C.useRef(null),g=h=>{h.key==="Escape"&&["navigation","search","account"].forEach(D=>{f.current.menus[D]&&m(D,!1,!0)})};return C.useEffect(()=>{var h;return(h=document.getElementById("header"))==null||h.addEventListener("keydown",g),()=>{var D;(D=document.getElementById("header"))==null||D.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:Br.order.map(h=>d.jsx(Ta,{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(af,{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:Br.buttons.order.map(h=>d.jsx(Ta,{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 ow=()=>{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,{})]})},Tf=({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=uc();C.useEffect(()=>{window.scrollTo(0,0)},[g]);const h=ra(e,{locale:o}),D=ra(t,{locale:o}),b=ra(n,{locale:o}),x={};return c!=="default"&&(x[c]=!0),f!=="default"&&(x[f]=!0),m!=="default"&&(x[m]=!0),d.jsx(nh.ErrorBoundary,{onError:r,fallback:d.jsx(ow,{}),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:[D&&d.jsx("div",{className:V("additional-content prepended",{"large-modal":p==="large"}),children:D}),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(Ff,{})]})})})},Zl={default:"tags_",headerTopics:"header_topics_topics_"},Wi={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"},uw={getTagDetails:e=>{if(e.includes("topic_")){if(e=Wi.topic[e.replace("topic_","")],e){const t=Br.topics.topics[e].href;return t?{id:e,href:t,text:`${Zl.headerTopics}${e}`}:null}return null}return Wi[e]?(e=Wi[e],{id:e,text:`${Zl.default}${e}`}):null}};const lw=({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=uw.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 cw=({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(Fr,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(Rn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx(jr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const dw=({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(Ua,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx(Fs,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Sf=({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 jf=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=oe.useIntl(),o=Na(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):pc(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(Ua,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const fw=({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(Ra,{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(Ua,{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:D,icon:b,image:x,isIntroduction:A,optional:_,slug:E,subsectionId:k,title:F,type:z})=>{const $=a&&t||A,j={};return x&&(j.style={"--image":`url(${x})`}),d.jsx("li",{className:V({article:D===ur.ARTICLE,discussion:D===ur.DISCUSSION,quiz:D===ur.QUIZ,completed:g&&D===ur.ARTICLE,locked:!$}),...j,children:d.jsx(Dn,{href:$?`/microcourses/en/${o}/${E}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${mc(F)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(Sf,{sectionId:i,subsectionId:k,title:F,className:"course-title"})," ",d.jsx(jf,{completionTime:h,icon:b,optional:_,type:z,children:c&&c[E]&&d.jsx("span",{className:"quiz-score",children:`${c[E]}%`})})]})})},E)})})]})};const hw=({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 ea=null;const st="discussion_form_",Ka=({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 z,$,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,D]=C.useState(!1);if(r.isLoading)return d.jsx(Ct,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const b=N=>{m(N);let w;!c||!c.id?w=Bt(u.formatMessage,`${st}error_loggedOut`,t.type,"action"):n?N.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 N=((z=t.slugs)==null?void 0:z.reply)||(($=t.slugs)==null?void 0:$.answer)||((j=t.slugs)==null?void 0:j.question)||"";N&&(x=`${x}-${N.slice(-15)}`)}e&&(x=`${e}-${x}`);const A=async N=>{var T;if(N.preventDefault(),N.stopPropagation(),!c||!c.id||!n||E)return;ea&&clearTimeout(ea),D("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,...(T=o.props)==null?void 0:T.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 fh(1e3),o.callback&&await o.callback(R),ea=setTimeout(()=>{m(""),D("submitted");const M=new Event("discussionFormSubmitted");document.dispatchEvent(M),_()},500)}catch(R){const M=R;let Y=`${st}error`;M!=null&&M.message.includes("entry already exists")&&(Y=Bt(u.formatMessage,`${st}error_alreadyExists`,t.type,"action")),M!=null&&M.message.includes("429")?Y=Bt(u.formatMessage,`${st}error_tooMany`,t.type,"action"):M!=null&&M.message.includes("400")&&(Y=`${st}error`),g(Y),_()}},_=()=>{ea=setTimeout(()=>{g(!1),D(!1)},5e3)},E=!f||!yh(f),k=h==="submitting",F=[];return(r.isEditing&&!k||s.cancel)&&F.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`})}),F.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:N=>{if(r.isEditing){D("submitting"),o.handleSaveEdit&&o.handleSaveEdit(f);return}A(N)},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||k||r.isEditing&&f===r.isEditing.text,children:u.formatMessage({id:`${st}${k?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(Fr,{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(tf,{id:`${x}-input`,value:h==="submitting"&&!p?"":f,placeholder:a||Bt(u.formatMessage,`${st}placeholder`,t.type,"action"),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:N=>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:N})})}),d.jsx(yn,{buttons:F}),h==="submitted"&&r.showSuccessMessage&&d.jsx(yr,{className:"success","data-testid":"success",children:Bt(u.formatMessage,`${st}success`,t.type,"action")}),p&&d.jsx(yr,{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(Ka,{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||""}`})},mw={showForm:!1},Za=C.createContext(mw),Of=({children:e})=>{const[t,n]=C.useState({showForm:!1});return d.jsx(Za.Provider,{value:{...t,updateConversation:n},children:e})},pw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),gw=(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 br=!1;const Hi=()=>{br!==!1&&(clearTimeout(br),br=!1)},Ui=5;let Vi=null;const Pf=({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(Ar,c),{numberOfLikes:p,userLikedContent:g,ignoreInteractions:h,showLikers:D,tabbableLink:b}=f;C.useEffect(()=>{m([{type:"userLikedContent",value:a}])},[a]);const x=C.useMemo(()=>gw(n,Ui),[n]),A=F=>{if(F.preventDefault(),F.stopPropagation(),m([{type:"showLikers",value:!1}]),br)return Hi(),!1;if(Hi(),h||!s)return!1;br=setTimeout(_,350)},_=async()=>{if(Hi(),h||!s)return!1;let F=g?p-1:p+1;F<0&&(F=0),m([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:F},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const z=pw(i.slugs);g?await l(z):await o({...z,payload:{contentPath:window.location.pathname}})}}catch{m([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{m([{type:"ignoreInteractions",value:!1}])}},E=()=>{Vi=setTimeout(()=>{m([{type:"showLikers",value:!1}])},500)},k=()=>{Vi&&clearTimeout(Vi)};return C.createElement(e,{className:"likes-wrapper",onKeyDown:F=>{F.key==="Escape"&&m([{type:"showLikers",value:!1}])},onMouseEnter:()=>{k(),m([{type:"showLikers",value:!0}])},onMouseLeave:()=>{E()}},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:A,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:p})})}),n&&d.jsxs(d.Fragment,{children:[d.jsx(Ie,{element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{k()},onBlur:()=>E,onClick:F=>{var $;F.preventDefault(),F.stopPropagation(),k(),m([{type:"showLikers",value:!0}]);const z=($=F.currentTarget.nextSibling)==null?void 0:$.childNodes[0];if(z){const j=z.querySelector("li:first-child a");j&&(m([{type:"tabbableLink",value:0}]),setTimeout(()=>{j.focus()},100))}},onKeyDown:F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),E())},"aria-expanded":D,"aria-controls":`likes-tooltip-${i.slug}`,children:d.jsx(Ie,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),d.jsx(Va,{id:`likes-tooltip-${i.slug}`,isOpen:D,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[x.map((F,z)=>{if(typeof F=="string"||!F.name)return null;const $={};return b!==z&&($.tabIndex=-1),d.jsx("li",{"data-index":z,children:d.jsx(Dn,{href:F.id?`/profiles/${F.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:j=>j==null?void 0:j.stopPropagation(),onFocus:()=>k(),onKeyDown:j=>{var M,Y,K,se;if(!j||!["ArrowUp","ArrowDown"].includes(j.key||""))return;j.stopPropagation(),j.preventDefault();const N=j.key==="ArrowUp"?"up":"down",w=(M=j.currentTarget)==null?void 0:M.parentElement;let T=w==null?void 0:w.nextElementSibling;if(N==="up"){const ne=w==null?void 0:w.previousElementSibling;ne?T=ne:(T=(Y=w==null?void 0:w.parentElement)==null?void 0:Y.lastElementChild,(T==null?void 0:T.getAttribute("data-index"))==="-1"&&(T=T==null?void 0:T.previousElementSibling))}else(!T||(T==null?void 0:T.getAttribute("data-index"))==="-1")&&(T=(K=w==null?void 0:w.parentElement)==null?void 0:K.firstElementChild);if(!T)return;const R=(T==null?void 0:T.getAttribute("data-index"))||"0";m([{type:"tabbableLink",value:R}]),(se=T==null?void 0:T.querySelector("a"))==null||se.focus()},...$,children:F.name})},F.id||window.btoa(F.name))}),t>Ui&&d.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Ui})})]})})]})]}))},Yl=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Ya=(e,t)=>e&&!t;const Mt="discussion_",vw=280,Or=({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:D=!1})=>{const b=oe.useIntl(),x=C.useContext(Ot),A=C.useContext(Za),{author:_,canLike:E,createdAt:k,id:F,likes:z=0,userLiked:$,comments:j=0}=t,N=x&&x.id&&typeof _!="string"&&_.id&&_.id===x.id||!1,w=typeof E=="boolean"?E:n?!N:!1,T=N&&(!t.createdAt||dh(t.createdAt,10,"seconds")),R=C.useRef(null),[M,Y]=C.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[K,se]=C.useState(!1),[ne,y]=C.useState(T?"highlighted":"default"),[q,X]=C.useState("");C.useEffect(()=>{const Z=R.current;if(!(!Z||ne==="default"))return document.addEventListener("discussionFormSubmitted",B),Z.addEventListener("transitionend",S),()=>{document.removeEventListener("discussionFormSubmitted",B),Z.removeEventListener("transitionend",S)}},[]),C.useEffect(()=>{Y({...M,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]);const B=()=>{setTimeout(()=>{y("fading")},1e3)},S=({propertyName:Z})=>{Z==="background-color"&&y(ue=>(ue==="default"&&(document.removeEventListener("discussionFormSubmitted",B),R.current&&R.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 L=D?$n(M.body,vw):M.body,I=async Z=>{Z||(Z=""),X("");try{if(!ac(Z,M.body)){const ue=t.type==="question"?{title:Z}:{body:Z};await l(Yl(t.slugs),ue)}Y({body:Z,isEditing:!1,didEdit:!0})}catch{X(`${Mt}form_error`)}},U=()=>{A&&A.updateConversation&&A.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(Yl(t.slugs))}catch{X("delete-error")}},ee=[{text:b.formatMessage({id:`${Mt}moreMenu_report`}),onClick:Z=>{Z.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&&N&&ee.push({text:b.formatMessage({id:`${Mt}moreMenu_edit`}),onClick:()=>Y({...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:Z=>{Z.preventDefault(),Z.stopPropagation(),se(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`delete-${t.type}-click`,...wf(`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:R,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${g}-post-click`,onClick:Z=>{!m.post||M.isEditing||(Z.preventDefault(),Z.stopPropagation(),window.location.href=m.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:F||t.slug,className:V("discussion-card",t.type,{editing:M.isEditing,"has-link":m.post&&!M.isEditing}),children:[!M.isEditing&&d.jsx(Fr,{member:_,additionalContent:{createdAt:k,didEdit:M.didEdit},className:typeof _!="string"&&_.id===a?"highlighted":"",gtmContext:g,gtmType:"profile-click"}),M.isEditing?d.jsx(Ka,{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:I,handleCancel:()=>{X(""),Y({...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(_c,{text:t==null?void 0:t.body.trim(),markdownOptions:{overrides:{a:Xi}}}):d.jsx(zn,{options:{overrides:{a:Xi}},children:L.trim()})]}):d.jsx(zn,{options:{wrapper:t.type==="question"?"h1":C.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question"},children:L.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(Pf,{element:"li",likes:z,isShort:!1,userLiked:$,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:Z=>{Z.preventDefault(),Z.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(kf,{element:"li",id:`more-${t.slug}`,options:ee})]})]}),h,d.jsx(Sr,{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:Z=>d.jsx("p",{children:Z}),action:b.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Ki="discussion_responses_",Nf=({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 Rf=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=oe.useIntl(),s=C.useContext(Za),o=ra(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(jr,{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(Ka,{...r})]})},bw="post",yw="reply",Mf="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 Dw(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Cw(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function If(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 xw({content:e}){return{content:e,id:Mf,time:new Date().toISOString(),verb:bw}}function Gl({activity:e,user:t}){return{...e,actor:If(t),...Dw()}}function Sa({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 $f({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 ww({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Mf,kind:yw,parent:t||""}}function Ql({reply:e,user:t}){const n=If(t);return{...e,user_id:n.id,user:n,...Cw()}}function Jl({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 Ew({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 Lf=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let Xl,Zi=0;const zf=()=>{C.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(Xl);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),Zi=0;return}Zi++,!(Zi>10)&&(Xl=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}),qf=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"}),_w=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"}),kw=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"}),Bw=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:qf.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:qf.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:_w.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:kw.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:Bw.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function Aw({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=Gl({activity:xw(o),user:i});return ec(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=Gl({activity:o,user:i});r.setQueryData(a,ec(c,u,!0)),setTimeout(()=>{Lf(c.id)},0)}});return s}function Fw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=ja(a,s);return o&&(o.content=i),s}),onError:n});return r}function Tw({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=Ha(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:go(u),mutate:vo(u)},user:l,...u},f=Aw({...c,mutationFn:e}),m=Fw({...c,mutationFn:t}),p=Sw({...c,mutationFn:n}),g=Ow({...c,mutationFn:a}),h=Pw({...c,mutationFn:i}),{activities:D,...b}=jw({queryKey:s,queryFn:r});return{activities:D,mutations:{create:f,edit:m,remove:g,like:p,unlike:h},user:l,...b}}function Sw({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=ja(s,o);return l&&Sa({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=ja(o,l);u&&Sa({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function jw({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:Rw(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Ow({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Nw(a,i)),onError:n});return r}function Pw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=ja(i,s);return o&&$f({activity:o,user:r}),s}),onError:n});return a}function ec(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 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 Nw(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 Rw(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const Mw=({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:D},user:b}=Tw({queryKey:[e,t,"activities"],queryFns:r});return zf(),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,A)=>{var R,M,Y,K,se,ne,y,q;const{id:_,own_reactions:E,latest_reactions:k,reaction_counts:F}=x,z=(((R=k==null?void 0:k.like)==null?void 0:R.length)||0)>0,$=(((M=E==null?void 0:E.like)==null?void 0:M.length)||0)>0,j=$?E==null?void 0:E.like[0].id:"",N=z?(Y=k==null?void 0:k.like)==null?void 0:Y.map(X=>{var B,S,L;return{id:(B=X==null?void 0:X.user)==null?void 0:B.id,name:(L=(S=X==null?void 0:X.user)==null?void 0:S.data)==null?void 0:L.name}}):!1,w=x==null?void 0:x.actor,T=(w==null?void 0:w.id)===(b==null?void 0:b.id);return d.jsx(C.Fragment,{children:d.jsx(Or,{content:{type:"post",title:x==null?void 0:x.title,body:x==null?void 0:x.content,canLike:Ya(n,T),createdAt:(x==null?void 0:x.time)||"",slugs:{question:`${e}/${t}`,answer:_},slug:_,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:(y=w==null?void 0:w.data)==null?void 0:y.location,image:{thumbnail:((q=w==null?void 0:w.data)==null?void 0:q.thumbnail)||void 0}},userLiked:$,likes:(F==null?void 0:F.like)||0,comments:(F==null?void 0:F.reply)||0,peopleWhoLiked:N},links:{post:`${e}/${t}/${_}`,comments:`${e}/${t}/${_}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>g({activityId:_}),updateContent:(X,{body:B})=>p({activityId:_,content:B})},likes:{createLike:()=>h({activityId:_}),deleteLike:()=>D({activityId:_,reactionId:j})},comments:{openComments:()=>null}},isTruncated:!0})},_)}),!f&&d.jsx(jr,{hasNextPage:c,loadNextPage:()=>u(),icon:{icon:"arrow-down",position:"right"},messages:{button:s.formatMessage({id:"loadMore_button"}),error:s.formatMessage({id:"loadMore_error"})}})]})},Iw={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 $w({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({reply:ww(o),user:i});return tc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=Ql({reply:o,user:i});r.setQueryData(a,tc(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Lf(c.id)},0)}});return s}function Lw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Oa(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Wf({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=qe.useQueryClient(),l=Ha(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:go(u),mutate:vo(u)},user:l,...u},f=$w({...c,mutationFn:e}),m=Lw({...c,mutationFn:t}),p=zw({...c,mutationFn:n}),g=Ww({...c,mutationFn:a}),h=Hw({...c,mutationFn:i}),{replies:D,...b}=qw({queryKey:s,queryFn:r});return{replies:D,mutations:{create:f,edit:m,remove:g,like:p,unlike:h},user:l,...b}}function zw({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=Oa(s,o);return l&&Jl({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Oa(o,l);u&&Jl({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function qw({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=Yw(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Ww({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=qe.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>Zw(a,i)),onError:n});return r}function Hw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Oa(i,s);return o&&Ew({reply:o,user:r}),s}),onError:n});return a}function Uw(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function Vw(e,t,n){const r=t.pages.length-1,a=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[a]=e:t.pages[r].results.push(e),t}function Kw(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 tc(e,t,n){return t?n!=null&&n.append?Vw(e,t,n):Kw(e,t,n):Uw(e)}function Oa(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Zw(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 Yw(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 Gw=({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:D},user:b}=Wf({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:_=>i.list({..._,reactionId:r})}});Bs([f]);const[x,A]=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:()=>A(!x),children:s.formatMessage({id:`discussion_thread_${x?"hide":"show"}`},{count:l==null?void 0:l.length})}),x&&d.jsx(Rf,{loadMore:{isLoading:f,hasNextPage:c,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(_,{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(_=>{var ne,y,q,X,B,S,L,I,U,te,ee,Z;const{id:E,own_children:k,latest_children:F,children_counts:z}=_,j=(((ne=k==null?void 0:k.like)==null?void 0:ne.length)||0)>0?(y=k==null?void 0:k.like)==null?void 0:y.find(ue=>{var J;return((J=ue==null?void 0:ue.user)==null?void 0:J.id)===(b==null?void 0:b.id)}):!1,N=j?j==null?void 0:j.id:"",w=!!j,R=(((q=F==null?void 0:F.like)==null?void 0:q.length)||0)>0?(X=F==null?void 0:F.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=_==null?void 0:_.user,Y=(M==null?void 0:M.id)===(b==null?void 0:b.id),K=Ya(a,Y),se=typeof _.data.content=="string"?(B=_==null?void 0:_.data)==null?void 0:B.content:((L=(S=_==null?void 0:_.data)==null?void 0:S.content)==null?void 0:L.text)||"";return d.jsx(Or,{content:{id:E,type:"reply",body:se,canLike:K,createdAt:_==null?void 0:_.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:_==null?void 0:_.parent},slug:"",author:{id:M==null?void 0:M.id,name:(I=M.data)==null?void 0:I.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:((Z=M.data)==null?void 0:Z.thumbnail)||void 0}},userLiked:w,likes:(z==null?void 0:z.like)||0,peopleWhoLiked:R},functions:{content:{createContent:()=>null,deleteContent:()=>h({replyId:E}),updateContent:(ue,{body:J})=>p({replyId:E,content:J})},likes:{createLike:()=>g({replyId:E}),deleteLike:()=>D({replyId:E,reactionId:N})},comments:{}}},E)}):null})]})};const Hf=({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:D,unlike:b},user:x}=Wf({queryKey:[e,t,n,"replies"],queryFns:a});return Bs([m]),zf(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(Nf,{type:"comment",responses:u}),d.jsx(po,{form:{content:{type:"reply",slugs:{}},functions:{create:(A,{body:_})=>p({activityId:n,content:_})},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(A=>{var se,ne,y,q,X,B,S,L,I,U,te,ee;const{id:_,own_children:E,latest_children:k,children_counts:F}=A,$=(((se=E==null?void 0:E.like)==null?void 0:se.length)||0)>0?(ne=E==null?void 0:E.like)==null?void 0:ne.find(Z=>{var ue;return((ue=Z==null?void 0:Z.user)==null?void 0:ue.id)===(x==null?void 0:x.id)}):!1,j=$?$==null?void 0:$.id:"",N=!!$,T=(((y=k==null?void 0:k.like)==null?void 0:y.length)||0)>0?(q=k==null?void 0:k.like)==null?void 0:q.map(Z=>{var ue,J,ge;return{id:(ue=Z==null?void 0:Z.user)==null?void 0:ue.id,name:(ge=(J=Z==null?void 0:Z.user)==null?void 0:J.data)==null?void 0:ge.name}}):!1,R=A==null?void 0:A.user,M=(R==null?void 0:R.id)===(x==null?void 0:x.id),Y=Ya(r,M),K=typeof A.data.content=="string"?(X=A==null?void 0:A.data)==null?void 0:X.content:((S=(B=A==null?void 0:A.data)==null?void 0:B.content)==null?void 0:S.text)||"";return d.jsx(Of,{children:d.jsx(Or,{content:{id:_,type:"reply",body:K,canLike:Y,createdAt:A==null?void 0:A.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:_},slug:_,author:{id:R==null?void 0:R.id,name:(L=R.data)==null?void 0:L.name,organization:(I=R.data)==null?void 0:I.organization,jobTitle:(U=R.data)==null?void 0:U.jobTitle,location:(te=R.data)==null?void 0:te.location,image:{thumbnail:((ee=R.data)==null?void 0:ee.thumbnail)||void 0}},userLiked:N,likes:(F==null?void 0:F.like)||0,peopleWhoLiked:T},functions:{content:{createContent:()=>null,deleteContent:()=>D({replyId:_}),updateContent:(Z,{body:ue})=>g({replyId:_,content:ue})},likes:{createLike:()=>h({replyId:_}),deleteLike:()=>b({replyId:_,reactionId:j})},comments:{}},children:d.jsx(Gw,{basePath:e,parentId:t,activityId:n,replyId:_,isMember:r,functions:{...a}})},_)},_)}),!m&&d.jsx(jr,{hasNextPage:f,loadNextPage:()=>c(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})};function Qw({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 Jw({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 Xw({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=qe.useQueryClient(),s=Ha(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:go(o),mutate:vo(o)},user:s,...o},u=Qw({...l,mutationFn:t}),c=eE({...l,mutationFn:n}),f=tE({...l,mutationFn:r}),{activity:m,...p}=Jw({queryKey:a,queryFn:e});return{activity:m,mutations:{edit:u,like:c,unlike:f},user:s,...p}}function eE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=qe.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Sa({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Sa({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function tE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=qe.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&$f({activity:s,user:r}),s)),onError:n});return a}const nE=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,join:o,leave:l}})=>{var $,j,N,w,T,R,M,Y,K,se;const u=oe.useIntl(),c=C.useContext(Ot),{activity:f,error:m,isLoading:p,mutations:{edit:g,like:h,unlike:D}}=Xw({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,A=((($=x==null?void 0:x.like)==null?void 0:$.length)||0)>0,_=(((j=b==null?void 0:b.like)==null?void 0:j.length)||0)>0,E=_?b==null?void 0:b.like[0].id:"",k=A?(N=x==null?void 0:x.like)==null?void 0:N.map(ne=>{var y,q,X;return{id:(y=ne==null?void 0:ne.user)==null?void 0:y.id,name:(X=(q=ne==null?void 0:ne.user)==null?void 0:q.data)==null?void 0:X.name}}):!1,F=f==null?void 0:f.actor,z=(F==null?void 0:F.id)===(c==null?void 0:c.id);return d.jsxs("section",{className:"activity-section",children:[d.jsx(Or,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:f==null?void 0:f.content,canLike:Ya(r,z),createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:{id:F.id,name:(w=F.data)==null?void 0:w.name,organization:(T=F.data)==null?void 0:T.organization,jobTitle:(R=F.data)==null?void 0:R.jobTitle,location:(M=F.data)==null?void 0:M.location,image:{thumbnail:((Y=F.data)==null?void 0:Y.thumbnail)||void 0}},userLiked:_,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:k},originalAuthorId:F==null?void 0:F.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(ne,{body:y})=>g({content:y})},likes:{createLike:()=>h({activityId:n}),deleteLike:()=>D({activityId:n,reactionId:E})},comments:{openComments:()=>{}}}},n),d.jsx(Hf,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,join:o,leave:l}})]})},rE=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),nc=[{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 ta="notFoundError_",aE=()=>{const e=oe.useIntl(),t=[];return nc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ta}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(Tf,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(an,{children:[d.jsx(_f,{cards:nc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(xe,{href:"/solution-articles/",children:e.formatMessage({id:`${ta}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ta}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ta}text`})})]})};exports.ASSETS_BUCKET=zt;exports.ActivitiesFeed=Mw;exports.ActivitySection=nE;exports.AddPost=po;exports.Banner=Bx;exports.BannerSection=Px;exports.Breadcrumbs=Kx;exports.Buckets=_h;exports.Button=xe;exports.ButtonWrapper=yn;exports.COURSE_CONTENT_TYPES=ur;exports.CacheProvider=vf;exports.Card=lo;exports.CardBlock=_f;exports.Carousel=Ux;exports.CollapsibleSection=Ra;exports.Columns=Af;exports.CommunityDetails=Vx;exports.ContactFooter=aw;exports.ContactForm=nf;exports.ContentTypeLabel=xc;exports.Contributors=js;exports.ConversationContext=Za;exports.CookieBanner=Ff;exports.CourseProgression=dw;exports.CourseStructure=fw;exports.CustomContentBanner=Nx;exports.Directory=wx;exports.DiscussionConversation=Of;exports.DiscussionForm=Ka;exports.DiscussionLikes=Pf;exports.DiscussionPost=Or;exports.DiscussionThread=Rf;exports.Divider=Qt;exports.DownloadSection=Ax;exports.EMAILS=Fn;exports.EditSection=Tx;exports.EmailHelperTextBox=Fc;exports.EmptyStateBox=en;exports.Filters=Zx;exports.FlagsProvider=bf;exports.Footer=ho;exports.Form=Gn;exports.FullWidthSection=an;exports.GlobalProviders=Cx;exports.Header=mo;exports.HelperTextBox=Ec;exports.HiddenFromScreenReaders=Pa;exports.HideShowTextBox=_c;exports.HighlightSection=Mx;exports.HighlightedTextBox=St;exports.INVALID_TOKEN=gc;exports.IconBulletedList=Ah;exports.ImageContainer=xh;exports.IntlProvider=yf;exports.InviteForm=rf;exports.InviteModal=xx;exports.JoinButton=co;exports.LanguageContext=so;exports.LanguageSwitcher=Gx;exports.LessonName=Sf;exports.LessonType=jf;exports.Link=Dn;exports.LoadMore=jr;exports.LoadingBlock=$h;exports.LoadingPlaceholder=Ct;exports.LoadingState=Ts;exports.Logo=fo;exports.LogoSection=Sx;exports.MarkCompleteButton=hw;exports.MarkdownText=zn;exports.MarketingBlock=Ix;exports.Member=Fr;exports.MembersList=cw;exports.Modal=uo;exports.MoreMenu=kf;exports.NUMBER_OF_COUNTRIES=ch;exports.NUMBER_OF_USERS=lh;exports.NavigationMenu=Bf;exports.NotFoundError=aE;exports.Overlay=Sr;exports.OverlayContext=oo;exports.OverlayProvider=xf;exports.PageHeading=kc;exports.PageLayout=Tf;exports.PasswordForm=pC;exports.PasswordRules=Pc;exports.Pill=Rn;exports.Portal=Cc;exports.ProfileImageChange=mC;exports.ProfilePicture=tn;exports.ProgressBar=Fs;exports.ProgressTracker=wh;exports.Rating=Jh;exports.RepliesFeed=Hf;exports.ResponsesHeading=Nf;exports.ResponsiveImage=Yn;exports.ReturnToNavButton=Eh;exports.RichTextEditor=tf;exports.SearchForm=af;exports.ShareLinks=tw;exports.SignupForm=CC;exports.Span=Xi;exports.StatusBanner=yr;exports.TableOfContents=kx;exports.Tabs=nw;exports.Tags=lw;exports.TestimonialBlock=_x;exports.TimeToComplete=Ua;exports.Toggle=hC;exports.Tooltip=Va;exports.TopLevelPage=iw;exports.UserContext=Ot;exports.UserProvider=Df;exports.VisuallyHidden=Ie;exports.addAriaProps=wf;exports.basicReducer=Ar;exports.camelCaseToDashCase=hc;exports.checkIntlPathExists=Na;exports.generateConditions=ca;exports.generateCssIcon=vc;exports.getLongDate=As;exports.getMember=Ss;exports.getShortDate=bc;exports.headerData=Br;exports.mapGetStreamData=rE;exports.pageReady=yc;exports.passwordValidator=Qi;exports.repliesFeedMock=Iw;exports.supportedLanguages=fa;exports.toCamelCase=mc;exports.toSentenceCase=pc;exports.useCurrentPath=uc;exports.useEffectAfterMount=Ln;exports.useElementWidth=Kn;exports.useOverlay=Cf;exports.useScrollListener=cc;exports.useScrollToHash=Bs;exports.useUser=Ha;
|