@apolitical/component-library 4.5.6 → 4.5.7-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/discussion/components/discussion-form-card/discussion-form-card.d.ts +14 -0
- package/discussion/components/discussion-form-card/index.d.ts +1 -0
- package/discussion/components/form/form.type.d.ts +5 -1
- package/discussion/components/post/index.d.ts +1 -0
- package/discussion/components/post/post.helpers.d.ts +1 -1
- package/form/components/rich-text-editor/components/context/context.d.ts +3 -0
- package/form/components/rich-text-editor/rich-text-editor.d.ts +3 -1
- package/index.js +59 -57
- package/index.mjs +8140 -8039
- package/modals/discussion-form-modal/discussion-form-modal.d.ts +19 -4
- package/package.json +1 -1
- package/style.css +1 -1
- package/text/markdown-text/components/fragment/fragment.d.ts +5 -0
- package/text/markdown-text/components/fragment/index.d.ts +1 -0
- package/text/markdown-text/components/index.d.ts +1 -0
- package/text/markdown-text/index.d.ts +1 -1
- package/text/markdown-text/markdown-text.d.ts +6 -1
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("react"),ue=require("react-intl"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("react"),ue=require("react-intl"),vn=require("lodash.clonedeep"),kh=require("lodash.set"),xc=require("react-dom"),Rt=require("markdown-to-jsx"),Zn=require("truncate"),Ye=require("@tanstack/react-query"),_h=require("@tanstack/react-query-devtools"),da=require("posthog-js"),Is=require("react-cookie"),is=require("lodash.isequal"),Bh=require("react-multi-email"),Cc=require("lodash.get"),Ah=require("react-error-boundary");var Hr=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 wc(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 Ec={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})()})(Ec);var Fh=Ec.exports;const Y=Bn(Fh),Th=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>D.createElement(e,{...a,className:Y("hidden",r,{"show-on-focus":t}),children:n}),Ie=D.memo(Th),Sh=({element:e="span",children:t=null,...n})=>D.createElement(e,{...n,"aria-hidden":!0},t),Wa=D.memo(Sh);var ss={exports:{}},ur={};/**
|
|
6
6
|
* @license React
|
|
7
7
|
* react-jsx-runtime.production.min.js
|
|
8
8
|
*
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* This source code is licensed under the MIT license found in the
|
|
12
12
|
* LICENSE file in the root directory of this source tree.
|
|
13
|
-
*/var
|
|
13
|
+
*/var $o;function jh(){if($o)return ur;$o=1;var e=D,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var c,h={},p=null,m=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(m=l.ref);for(c in l)r.call(l,c)&&!i.hasOwnProperty(c)&&(h[c]=l[c]);if(o&&o.defaultProps)for(c in l=o.defaultProps,l)h[c]===void 0&&(h[c]=l[c]);return{$$typeof:t,type:o,key:p,ref:m,props:h,_owner:a.current}}return ur.Fragment=n,ur.jsx=s,ur.jsxs=s,ur}var lr={};/**
|
|
14
14
|
* @license React
|
|
15
15
|
* react-jsx-runtime.development.js
|
|
16
16
|
*
|
|
@@ -18,38 +18,38 @@
|
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the MIT license found in the
|
|
20
20
|
* LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/var
|
|
22
|
-
`+
|
|
23
|
-
`),at=
|
|
24
|
-
`),
|
|
25
|
-
`+Be[
|
|
21
|
+
*/var Lo;function Oh(){return Lo||(Lo=1,process.env.NODE_ENV!=="production"&&function(){var e=D,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function y(j){if(j===null||typeof j!="object")return null;var se=g&&j[g]||j[f];return typeof se=="function"?se:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function k(j){{for(var se=arguments.length,ce=new Array(se>1?se-1:0),xe=1;xe<se;xe++)ce[xe-1]=arguments[xe];B("error",j,ce)}}function B(j,se,ce){{var xe=v.ReactDebugCurrentFrame,Oe=xe.getStackAddendum();Oe!==""&&(se+="%s",ce=ce.concat([Oe]));var Le=ce.map(function(je){return String(je)});Le.unshift("Warning: "+se),Function.prototype.apply.call(console[j],console,Le)}}var C=!1,w=!1,T=!1,S=!1,q=!1,P;P=Symbol.for("react.module.reference");function L(j){return!!(typeof j=="string"||typeof j=="function"||j===r||j===i||q||j===a||j===u||j===c||S||j===m||C||w||T||typeof j=="object"&&j!==null&&(j.$$typeof===p||j.$$typeof===h||j.$$typeof===s||j.$$typeof===o||j.$$typeof===l||j.$$typeof===P||j.getModuleId!==void 0))}function z(j,se,ce){var xe=j.displayName;if(xe)return xe;var Oe=se.displayName||se.name||"";return Oe!==""?ce+"("+Oe+")":ce}function E(j){return j.displayName||"Context"}function A(j){if(j==null)return null;if(typeof j.tag=="number"&&k("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof j=="function")return j.displayName||j.name||null;if(typeof j=="string")return j;switch(j){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 j=="object")switch(j.$$typeof){case o:var se=j;return E(se)+".Consumer";case s:var ce=j;return E(ce._context)+".Provider";case l:return z(j,j.render,"ForwardRef");case h:var xe=j.displayName||null;return xe!==null?xe:A(j.type)||"Memo";case p:{var Oe=j,Le=Oe._payload,je=Oe._init;try{return A(je(Le))}catch{return null}}}return null}var N=Object.assign,R=0,H,G,Q,re,x,$,W;function _(){}_.__reactDisabledLog=!0;function F(){{if(R===0){H=console.log,G=console.info,Q=console.warn,re=console.error,x=console.group,$=console.groupCollapsed,W=console.groupEnd;var j={configurable:!0,enumerable:!0,value:_,writable:!0};Object.defineProperties(console,{info:j,log:j,warn:j,error:j,group:j,groupCollapsed:j,groupEnd:j})}R++}}function I(){{if(R--,R===0){var j={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:N({},j,{value:H}),info:N({},j,{value:G}),warn:N({},j,{value:Q}),error:N({},j,{value:re}),group:N({},j,{value:x}),groupCollapsed:N({},j,{value:$}),groupEnd:N({},j,{value:W})})}R<0&&k("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var M=v.ReactCurrentDispatcher,V;function ne(j,se,ce){{if(V===void 0)try{throw Error()}catch(Oe){var xe=Oe.stack.trim().match(/\n( *(at )?)/);V=xe&&xe[1]||""}return`
|
|
22
|
+
`+V+j}}var te=!1,ae;{var le=typeof WeakMap=="function"?WeakMap:Map;ae=new le}function J(j,se){if(!j||te)return"";{var ce=ae.get(j);if(ce!==void 0)return ce}var xe;te=!0;var Oe=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Le;Le=M.current,M.current=null,F();try{if(se){var je=function(){throw Error()};if(Object.defineProperty(je.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(je,[])}catch(qt){xe=qt}Reflect.construct(j,[],je)}else{try{je.call()}catch(qt){xe=qt}j.call(je.prototype)}}else{try{throw Error()}catch(qt){xe=qt}j()}}catch(qt){if(qt&&xe&&typeof qt.stack=="string"){for(var Be=qt.stack.split(`
|
|
23
|
+
`),at=xe.stack.split(`
|
|
24
|
+
`),Ze=Be.length-1,Ge=at.length-1;Ze>=1&&Ge>=0&&Be[Ze]!==at[Ge];)Ge--;for(;Ze>=1&&Ge>=0;Ze--,Ge--)if(Be[Ze]!==at[Ge]){if(Ze!==1||Ge!==1)do if(Ze--,Ge--,Ge<0||Be[Ze]!==at[Ge]){var yt=`
|
|
25
|
+
`+Be[Ze].replace(" at new "," at ");return j.displayName&&yt.includes("<anonymous>")&&(yt=yt.replace("<anonymous>",j.displayName)),typeof j=="function"&&ae.set(j,yt),yt}while(Ze>=1&&Ge>=0);break}}}finally{te=!1,M.current=Le,I(),Error.prepareStackTrace=Oe}var On=j?j.displayName||j.name:"",Io=On?ne(On):"";return typeof j=="function"&&ae.set(j,Io),Io}function ge(j,se,ce){return J(j,!1)}function he(j){var se=j.prototype;return!!(se&&se.isReactComponent)}function ye(j,se,ce){if(j==null)return"";if(typeof j=="function")return J(j,he(j));if(typeof j=="string")return ne(j);switch(j){case u:return ne("Suspense");case c:return ne("SuspenseList")}if(typeof j=="object")switch(j.$$typeof){case l:return ge(j.render);case h:return ye(j.type,se,ce);case p:{var xe=j,Oe=xe._payload,Le=xe._init;try{return ye(Le(Oe),se,ce)}catch{}}}return""}var Ae=Object.prototype.hasOwnProperty,Fe={},He=v.ReactDebugCurrentFrame;function Se(j){if(j){var se=j._owner,ce=ye(j.type,j._source,se?se.type:null);He.setExtraStackFrame(ce)}else He.setExtraStackFrame(null)}function Te(j,se,ce,xe,Oe){{var Le=Function.call.bind(Ae);for(var je in j)if(Le(j,je)){var Be=void 0;try{if(typeof j[je]!="function"){var at=Error((xe||"React class")+": "+ce+" type `"+je+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof j[je]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw at.name="Invariant Violation",at}Be=j[je](se,je,xe,ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ze){Be=Ze}Be&&!(Be instanceof Error)&&(Se(Oe),k("%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).",xe||"React class",ce,je,typeof Be),Se(null)),Be instanceof Error&&!(Be.message in Fe)&&(Fe[Be.message]=!0,Se(Oe),k("Failed %s type: %s",ce,Be.message),Se(null))}}}var Ne=Array.isArray;function ke(j){return Ne(j)}function Ue(j){{var se=typeof Symbol=="function"&&Symbol.toStringTag,ce=se&&j[Symbol.toStringTag]||j.constructor.name||"Object";return ce}}function pe(j){try{return U(j),!1}catch{return!0}}function U(j){return""+j}function ie(j){if(pe(j))return k("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ue(j)),U(j)}var me=v.ReactCurrentOwner,ve={key:!0,ref:!0,__self:!0,__source:!0},we,Ke,Qe;Qe={};function mt(j){if(Ae.call(j,"ref")){var se=Object.getOwnPropertyDescriptor(j,"ref").get;if(se&&se.isReactWarning)return!1}return j.ref!==void 0}function zt(j){if(Ae.call(j,"key")){var se=Object.getOwnPropertyDescriptor(j,"key").get;if(se&&se.isReactWarning)return!1}return j.key!==void 0}function _t(j,se){if(typeof j.ref=="string"&&me.current&&se&&me.current.stateNode!==se){var ce=A(me.current.type);Qe[ce]||(k('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',A(me.current.type),j.ref),Qe[ce]=!0)}}function et(j,se){{var ce=function(){we||(we=!0,k("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",se))};ce.isReactWarning=!0,Object.defineProperty(j,"key",{get:ce,configurable:!0})}}function Tt(j,se){{var ce=function(){Ke||(Ke=!0,k("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",se))};ce.isReactWarning=!0,Object.defineProperty(j,"ref",{get:ce,configurable:!0})}}var pt=function(j,se,ce,xe,Oe,Le,je){var Be={$$typeof:t,type:j,key:se,ref:ce,props:je,_owner:Le};return Be._store={},Object.defineProperty(Be._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Be,"_self",{configurable:!1,enumerable:!1,writable:!1,value:xe}),Object.defineProperty(Be,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Oe}),Object.freeze&&(Object.freeze(Be.props),Object.freeze(Be)),Be};function ii(j,se,ce,xe,Oe){{var Le,je={},Be=null,at=null;ce!==void 0&&(ie(ce),Be=""+ce),zt(se)&&(ie(se.key),Be=""+se.key),mt(se)&&(at=se.ref,_t(se,Oe));for(Le in se)Ae.call(se,Le)&&!ve.hasOwnProperty(Le)&&(je[Le]=se[Le]);if(j&&j.defaultProps){var Ze=j.defaultProps;for(Le in Ze)je[Le]===void 0&&(je[Le]=Ze[Le])}if(Be||at){var Ge=typeof j=="function"?j.displayName||j.name||"Unknown":j;Be&&et(je,Ge),at&&Tt(je,Ge)}return pt(j,Be,at,Oe,xe,me.current,je)}}var or=v.ReactCurrentOwner,Wr=v.ReactDebugCurrentFrame;function jn(j){if(j){var se=j._owner,ce=ye(j.type,j._source,se?se.type:null);Wr.setExtraStackFrame(ce)}else Wr.setExtraStackFrame(null)}var si;si=!1;function oi(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function Oo(){{if(or.current){var j=A(or.current.type);if(j)return`
|
|
26
26
|
|
|
27
|
-
Check the render method of \``+
|
|
27
|
+
Check the render method of \``+j+"`."}return""}}function vh(j){{if(j!==void 0){var se=j.fileName.replace(/^.*[\\\/]/,""),ce=j.lineNumber;return`
|
|
28
28
|
|
|
29
|
-
Check your code at `+se+":"+ce+"."}return""}}var
|
|
29
|
+
Check your code at `+se+":"+ce+"."}return""}}var Po={};function bh(j){{var se=Oo();if(!se){var ce=typeof j=="string"?j:j.displayName||j.name;ce&&(se=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+ce+">.")}return se}}function Oo(O,se){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var ce=gh(se);if(jo[ce])return;jo[ce]=!0;var De="";O&&O._owner&&O._owner!==sr.current&&(De=" It was passed a child from "+A(O._owner.type)+"."),Tn(O),_('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ce,De),Tn(null)}}function Po(O,se){{if(typeof O!="object")return;if(je(O))for(var ce=0;ce<O.length;ce++){var De=O[ce];si(De)&&Oo(De,se)}else if(si(O))O._store&&(O._store.validated=!0);else if(O){var Oe=x(O);if(typeof Oe=="function"&&Oe!==O.entries)for(var $e=Oe.call(O),Te;!(Te=$e.next()).done;)si(Te.value)&&Oo(Te.value,se)}}}function vh(O){{var se=O.type;if(se==null||typeof se=="string")return;var ce;if(typeof se=="function")ce=se.propTypes;else if(typeof se=="object"&&(se.$$typeof===l||se.$$typeof===h))ce=se.propTypes;else return;if(ce){var De=A(se);Le(ce,O.props,"prop",De,O)}else if(se.PropTypes!==void 0&&!ii){ii=!0;var Oe=A(se);_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Oe||"Unknown")}typeof se.getDefaultProps=="function"&&!se.getDefaultProps.isReactClassApproved&&_("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function bh(O){{for(var se=Object.keys(O.props),ce=0;ce<se.length;ce++){var De=se[ce];if(De!=="children"&&De!=="key"){Tn(O),_("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",De),Tn(null);break}}O.ref!==null&&(Tn(O),_("Invalid attribute `ref` supplied to `React.Fragment`."),Tn(null))}}function No(O,se,ce,De,Oe,$e){{var Te=$(O);if(!Te){var Be="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(Be+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var at=ph(Oe);at?Be+=at:Be+=So();var Ke;O===null?Ke="null":je(O)?Ke="array":O!==void 0&&O.$$typeof===t?(Ke="<"+(A(O.type)||"Unknown")+" />",Be=" Did you accidentally export a JSX literal instead of a component?"):Ke=typeof O,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ke,Be)}var Ye=ai(O,se,ce,Oe,$e);if(Ye==null)return Ye;if(Te){var yt=se.children;if(yt!==void 0)if(De)if(je(yt)){for(var Sn=0;Sn<yt.length;Sn++)Po(yt[Sn],O);Object.freeze&&Object.freeze(yt)}else _("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Po(yt,O)}return O===r?bh(Ye):vh(Ye),Ye}}function yh(O,se,ce){return No(O,se,ce,!0)}function Dh(O,se,ce){return No(O,se,ce,!1)}var xh=Dh,Ch=yh;ur.Fragment=r,ur.jsx=xh,ur.jsxs=Ch}()),ur}process.env.NODE_ENV==="production"?is.exports=Th():is.exports=Sh();var c=is.exports;const wc=()=>{const[e,t]=D.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return D.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Kn=(e,t)=>{const n=D.useRef(!1);D.useEffect(()=>{n.current?e():n.current=!0},t)};function Ec(e,t,n){var r=this,a=D.useRef(null),i=D.useRef(0),s=D.useRef(null),o=D.useRef([]),l=D.useRef(),u=D.useRef(),d=D.useRef(e),h=D.useRef(!0);d.current=e;var p=typeof window<"u",m=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,x="maxWait"in n,b="debounceOnServer"in n&&!!n.debounceOnServer,_=x?Math.max(+n.maxWait||0,t):null;D.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var k=D.useMemo(function(){var w=function($){var L=o.current,E=l.current;return o.current=l.current=null,i.current=$,u.current=d.current.apply(E,L)},C=function($,L){m&&cancelAnimationFrame(s.current),s.current=m?requestAnimationFrame($):setTimeout($,L)},F=function($){if(!h.current)return!1;var L=$-a.current;return!a.current||L>=t||L<0||x&&$-i.current>=_},S=function($){return s.current=null,f&&o.current?w($):(o.current=l.current=null,u.current)},z=function $(){var L=Date.now();if(F(L))return S(L);if(h.current){var E=t-(L-a.current),A=x?Math.min(E,_-(L-i.current)):E;C($,A)}},N=function(){if(p||b){var $=Date.now(),L=F($);if(o.current=[].slice.call(arguments),l.current=r,a.current=$,L){if(!s.current&&h.current)return i.current=a.current,C(z,t),g?w(a.current):u.current;if(x)return C(z,t),w(a.current)}return s.current||C(z,t),u.current}};return N.cancel=function(){s.current&&(m?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},N.isPending=function(){return!!s.current},N.flush=function(){return s.current?S(Date.now()):u.current},N},[g,x,t,_,f,m,p,b]);return k}function kc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return Ec(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let oi;const er=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=D.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];D.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(oi),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:d})=>{const{id:h}=d;n==="window"||!n.closest(`#${h}`)||s()===r||o()},u=kc(()=>{s()!==r&&(t&&(clearTimeout(oi),document.body.classList.add("is-resizing"),oi=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},_c=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=D.useState({current:0,past:0})||[!1,()=>{}],[s,o]=D.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];D.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const d=window.scrollY,h=a.current,p=d-h,m=p>0?"down":"up";if(i({current:d,past:h}),m==="down"){d>=e+t.down&&!s.scrollDown&&(!s.scrollUp||p>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=kc(()=>{l()},250);return a},Is=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=D.useRef(!1);Kn(()=>{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)},$s=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=D.useState(!1);return{showTooltip:t,tooltipProps:{onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const $o={},_n=D.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},...l},u)=>{const d=ue.useIntl(),h=D.useRef(null),p=u||h,[m,g]=D.useState(n?"open":"hidden"),{extraPadding:f=!0,hasPointer:x=!1,hasForm:b=!1}=t,{onOpen:_=()=>{},onClose:k=()=>{}}=o;e||(e=Date.now().toString());const w=$o[e];D.useEffect(()=>{const z=p==null?void 0:p.current;if(z)return z.addEventListener("transitionend",C),z.addEventListener("keydown",F),()=>{z.removeEventListener("transitionend",C),z.removeEventListener("keydown",F)}},[]);const C=({propertyName:z})=>{z==="opacity"&&(w!==!1&&clearTimeout(w),g(N=>(N==="open"?_():N==="closed"&&k(),N==="opening"?"open":N==="closing"?"closed":N==="closed"?"hidden":N)))},F=z=>{z.key==="Escape"&&(z.stopPropagation(),z.preventDefault(),g("closing"))};Kn(()=>{w!==!1&&clearTimeout(w);let z="open";n?g("opening"):(g("closing"),z="hidden"),$o[e||""]=setTimeout(()=>{g(z)},300)},[n]);const S={...l};return s&&s.onBlur&&(S.onBlur=s.onBlur),c.jsx("aside",{ref:p,className:G("tooltip text-medium",m,i,{loading:r,"extra-padding":f,"has-pointer":x,bottom:x==="bottom","has-form":b}),...S,children:c.jsx("div",{className:"content",hidden:m==="hidden",children:r?c.jsx("p",{children:d.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?c.jsx("p",{children:a}):a})})}),Rr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=gn(e);return t.forEach(({type:r,value:a})=>{wh(n,r,a)}),n},Bc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Ac=(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},Fc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Tc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Sc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),jh=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Mt="https://storage.googleapis.com/apolitical-assets/",Mn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},pr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},ss="SU:",jc="Invalid token error: Logging user out...",Oh="200,000+",Ph="160+",_r=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Oc=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function Pc(e){return e?{"--icon":`url(${Mt}icons/${e}.svg)`}:{}}const hn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Nc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Ls=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),os=e=>{let t;const n=Da(),r=Da(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/hn.milliseconds.inHour,i=Math.floor(t/hn.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<=hn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/hn.year.days)}},Da=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Nh=(e,t,n)=>{let r;const a=Da(),i=Da(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/hn.milliseconds.inSecond<=t;case"minutes":return r/hn.milliseconds.inMinute<=t;case"hours":return r/hn.milliseconds.inHour<=t}return!1},Rh=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},Mh=e=>new Promise(t=>setTimeout(t,e)),Ih=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},tr={apolitical:"Apolitical",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",card_carousel_viewAll:"View all",card_label_communityPage:"Community",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_new:"New",card_registered:"Registered",card_partner:"{partner} and {number} more",card_contributors_event:"Multiple speakers",card_contributors_solutionArticle:"Multiple authors",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_member_type_owner:"Admin",card_member_type_member:"Member",card_member_count:"{count} members",card_cta_people:"View profile",card_cta_communityPage:"Join now",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_communityPage_loading:"Joining...",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_communityPage_done:"Joined",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"Previous",carousel_pagination_next:"Next",carousel_pagination_page:"Page {number} of {total}",carousel_pagination_aria_live:"{direction} {count} cards available",activitySection_notFoundError:"Post not found",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",joinCommunityButton_closed_tooltip:"Please contact the admin of this closed community if you would like to join it.",joinCommunityButton_aria_live:"You are {action} this community",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
|
|
31
|
+
Check the top-level render call using <`+ce+">.")}return se}}function No(j,se){{if(!j._store||j._store.validated||j.key!=null)return;j._store.validated=!0;var ce=bh(se);if(Po[ce])return;Po[ce]=!0;var xe="";j&&j._owner&&j._owner!==or.current&&(xe=" It was passed a child from "+A(j._owner.type)+"."),jn(j),k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ce,xe),jn(null)}}function Ro(j,se){{if(typeof j!="object")return;if(ke(j))for(var ce=0;ce<j.length;ce++){var xe=j[ce];oi(xe)&&No(xe,se)}else if(oi(j))j._store&&(j._store.validated=!0);else if(j){var Oe=y(j);if(typeof Oe=="function"&&Oe!==j.entries)for(var Le=Oe.call(j),je;!(je=Le.next()).done;)oi(je.value)&&No(je.value,se)}}}function yh(j){{var se=j.type;if(se==null||typeof se=="string")return;var ce;if(typeof se=="function")ce=se.propTypes;else if(typeof se=="object"&&(se.$$typeof===l||se.$$typeof===h))ce=se.propTypes;else return;if(ce){var xe=A(se);Te(ce,j.props,"prop",xe,j)}else if(se.PropTypes!==void 0&&!si){si=!0;var Oe=A(se);k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Oe||"Unknown")}typeof se.getDefaultProps=="function"&&!se.getDefaultProps.isReactClassApproved&&k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Dh(j){{for(var se=Object.keys(j.props),ce=0;ce<se.length;ce++){var xe=se[ce];if(xe!=="children"&&xe!=="key"){jn(j),k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",xe),jn(null);break}}j.ref!==null&&(jn(j),k("Invalid attribute `ref` supplied to `React.Fragment`."),jn(null))}}function Mo(j,se,ce,xe,Oe,Le){{var je=L(j);if(!je){var Be="";(j===void 0||typeof j=="object"&&j!==null&&Object.keys(j).length===0)&&(Be+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var at=vh(Oe);at?Be+=at:Be+=Oo();var Ze;j===null?Ze="null":ke(j)?Ze="array":j!==void 0&&j.$$typeof===t?(Ze="<"+(A(j.type)||"Unknown")+" />",Be=" Did you accidentally export a JSX literal instead of a component?"):Ze=typeof j,k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ze,Be)}var Ge=ii(j,se,ce,Oe,Le);if(Ge==null)return Ge;if(je){var yt=se.children;if(yt!==void 0)if(xe)if(ke(yt)){for(var On=0;On<yt.length;On++)Ro(yt[On],j);Object.freeze&&Object.freeze(yt)}else k("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 Ro(yt,j)}return j===r?Dh(Ge):yh(Ge),Ge}}function xh(j,se,ce){return Mo(j,se,ce,!0)}function Ch(j,se,ce){return Mo(j,se,ce,!1)}var wh=Ch,Eh=xh;lr.Fragment=r,lr.jsx=wh,lr.jsxs=Eh}()),lr}process.env.NODE_ENV==="production"?ss.exports=jh():ss.exports=Oh();var d=ss.exports;const kc=()=>{const[e,t]=D.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return D.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Yn=(e,t)=>{const n=D.useRef(!1);D.useEffect(()=>{n.current?e():n.current=!0},t)};function _c(e,t,n){var r=this,a=D.useRef(null),i=D.useRef(0),s=D.useRef(null),o=D.useRef([]),l=D.useRef(),u=D.useRef(),c=D.useRef(e),h=D.useRef(!0);c.current=e;var p=typeof window<"u",m=!t&&t!==0&&p;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,f=!("trailing"in n)||!!n.trailing,y="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,k=y?Math.max(+n.maxWait||0,t):null;D.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var B=D.useMemo(function(){var C=function(L){var z=o.current,E=l.current;return o.current=l.current=null,i.current=L,u.current=c.current.apply(E,z)},w=function(L,z){m&&cancelAnimationFrame(s.current),s.current=m?requestAnimationFrame(L):setTimeout(L,z)},T=function(L){if(!h.current)return!1;var z=L-a.current;return!a.current||z>=t||z<0||y&&L-i.current>=k},S=function(L){return s.current=null,f&&o.current?C(L):(o.current=l.current=null,u.current)},q=function L(){var z=Date.now();if(T(z))return S(z);if(h.current){var E=t-(z-a.current),A=y?Math.min(E,k-(z-i.current)):E;w(L,A)}},P=function(){if(p||v){var L=Date.now(),z=T(L);if(o.current=[].slice.call(arguments),l.current=r,a.current=L,z){if(!s.current&&h.current)return i.current=a.current,w(q,t),g?C(a.current):u.current;if(y)return w(q,t),C(a.current)}return s.current||w(q,t),u.current}};return P.cancel=function(){s.current&&(m?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},P.isPending=function(){return!!s.current},P.flush=function(){return s.current?S(Date.now()):u.current},P},[g,y,t,k,f,m,p,v]);return B}function Bc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return _c(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let ui;const tr=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=D.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];D.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(ui),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:c})=>{const{id:h}=c;n==="window"||!n.closest(`#${h}`)||s()===r||o()},u=Bc(()=>{s()!==r&&(t&&(clearTimeout(ui),document.body.classList.add("is-resizing"),ui=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Ac=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=D.useState({current:0,past:0})||[!1,()=>{}],[s,o]=D.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];D.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const c=window.scrollY,h=a.current,p=c-h,m=p>0?"down":"up";if(i({current:c,past:h}),m==="down"){c>=e+t.down&&!s.scrollDown&&(!s.scrollUp||p>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(p)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=Bc(()=>{l()},250);return a},$s=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=D.useRef(!1);Yn(()=>{if(window&&window.location&&window.location.hash){if(n.current)return;const r=document.getElementById(window.location.hash.replace("#",""));r&&(r.scrollIntoView(t?{behavior:"smooth"}:null),n.current=!0)}},e)},Ls=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=D.useState(!1);return{showTooltip:t,tooltipProps:{onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const zo={},An=D.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},...l},u)=>{const c=ue.useIntl(),h=D.useRef(null),p=u||h,[m,g]=D.useState(n?"open":"hidden"),{extraPadding:f=!0,hasPointer:y=!1,hasForm:v=!1}=t,{onOpen:k=()=>{},onClose:B=()=>{}}=o;e||(e=Date.now().toString());const C=zo[e];D.useEffect(()=>{const q=p==null?void 0:p.current;if(q)return q.addEventListener("transitionend",w),q.addEventListener("keydown",T),()=>{q.removeEventListener("transitionend",w),q.removeEventListener("keydown",T)}},[]);const w=({propertyName:q})=>{q==="opacity"&&(C!==!1&&clearTimeout(C),g(P=>(P==="open"?k():P==="closed"&&B(),P==="opening"?"open":P==="closing"?"closed":P==="closed"?"hidden":P)))},T=q=>{q.key==="Escape"&&(q.stopPropagation(),q.preventDefault(),g("closing"))};Yn(()=>{C!==!1&&clearTimeout(C);let q="open";n?g("opening"):(g("closing"),q="hidden"),zo[e||""]=setTimeout(()=>{g(q)},300)},[n]);const S={...l};return s&&s.onBlur&&(S.onBlur=s.onBlur),d.jsx("aside",{ref:p,className:Y("tooltip text-medium",m,i,{loading:r,"extra-padding":f,"has-pointer":y,bottom:y==="bottom","has-form":v}),...S,children:d.jsx("div",{className:"content",hidden:m==="hidden",children:r?d.jsx("p",{children:c.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?d.jsx("p",{children:a}):a})})}),Ir=(e,t)=>{Array.isArray(t)||(t=[t]);const n=vn(e);return t.forEach(({type:r,value:a})=>{kh(n,r,a)}),n},Fc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Tc=(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},Sc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),jc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Oc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Ph=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),It="https://storage.googleapis.com/apolitical-assets/",$n={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},gr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},os="SU:",Pc="Invalid token error: Logging user out...",Nh="200,000+",Rh="160+",Br=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Nc=new RegExp("(?<=^|\\s)@([A-Za-z]+(?:[- ]?[A-Za-z]*)*)$");function Rc(e){return e?{"--icon":`url(${It}icons/${e}.svg)`}:{}}const mn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Mc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),zs=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),us=e=>{let t;const n=Ca(),r=Ca(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/mn.milliseconds.inHour,i=Math.floor(t/mn.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<=mn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/mn.year.days)}},Ca=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Mh=(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/mn.milliseconds.inSecond<=t;case"minutes":return r/mn.milliseconds.inMinute<=t;case"hours":return r/mn.milliseconds.inHour<=t}return!1},Ih=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},$h=e=>new Promise(t=>setTimeout(t,e)),Lh=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},nr={apolitical:"Apolitical",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",card_carousel_viewAll:"View all",card_label_communityPage:"Community",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_new:"New",card_registered:"Registered",card_partner:"{partner} and {number} more",card_contributors_event:"Multiple speakers",card_contributors_solutionArticle:"Multiple authors",card_answers:"{number, plural, =0 {0 answers} one {# answer} other {# answers}}",card_time_ago:"{time} ago",card_time_read:"{time} min read",card_watch:"Watch recording",card_member_type_owner:"Admin",card_member_type_member:"Member",card_member_count:"{count} members",card_cta_people:"View profile",card_cta_communityPage:"Join now",card_cta_event:"Register now",card_cta_microcourse:"Enrol now",card_cta_communityPage_loading:"Joining...",card_cta_event_loading:"Registering...",card_cta_microcourse_loading:"Enrolling...",card_cta_communityPage_done:"Joined",card_cta_event_done:"Registered",card_cta_microcourse_done:"Enrolled",carousel_pagination_previous:"Previous",carousel_pagination_next:"Next",carousel_pagination_page:"Page {number} of {total}",carousel_pagination_aria_live:"{direction} {count} cards available",activitySection_notFoundError:"Post not found",communityDetails_members:"Members",communityDetails_viewAll:"View all",communityDetails_invite:"Invite colleagues",community_joinToPost:"Join community to create a post.",joinCommunityButton:"Join community",joinCommunityButton_short:"Join",joinCommunityButton_joining:"Joining...",joinCommunityButton_member:"Member",joinCommunityButton_member_aria:"Leave community",joinCommunityButton_leave:"Leave",joinCommunityButton_leaving:"Leaving...",joinCommunityButton_closed_tooltip:"Please contact the admin of this closed community if you would like to join it.",joinCommunityButton_aria_live:"You are {action} this community",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
|
|
32
32
|
|
|
33
33
|
Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
|
|
34
34
|
|
|
35
|
-
Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Share a question, insight, or announcement with the community",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_share_copy_link:"Copy link",discussion_share_copy_link_success:"Link copied to clipboard",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their email addresses below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"Link:",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_insights:"Insights",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",discussionFormModal_title:"Create a post",discussionFormModal_cta:"Create post",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their email addresses below.",inviteModal_cta:"Send",overlay_close:"Close",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",navigationMenu_profile:"My profile",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},$h={...tr,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>"},Lh={...tr,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"},zh={...tr,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>"},qh=Object.freeze(Object.defineProperty({__proto__:null,en:tr,es:$h,fr:Lh,pt:zh},Symbol.toStringTag,{value:"Module"})),Wa=(e,t=tr)=>e in t,_t=(e,t,n,r,a={})=>{let i="";return Wa(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},Wh=(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},ca=(e,t)=>D.Children.map(e,n=>Object.is(n,null)?n:D.cloneElement(n,{...t})),Rc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Hh=(e,t,n)=>!t.id||!t.name?"":n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Mc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(_r);if(!a)return e;for(const s of a){const o=s.replace(_r,(d,h)=>h),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"";else{const d=l;if(d.startsWith(ss))try{const h=d.replace(ss,"");u.id=h,await r({id:h}).then(p=>{const{name:m}=p;u.name=m||""})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Hh(e,u,t):s)}return e},Ic=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Uh=e=>new URLSearchParams(window.location.search).get(e),Lo=(e="")=>e.replace(/\s+/g,"").length>0,us=e=>{const t=e.length>8,n=/[0-9]/.test(e)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(e),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(e);return{isValid:t&&n&&r,matchingRules:{isMoreThanEightCharacters:t,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}};const _e=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:d=!1,children:h=!1,...p})=>{const g=er(typeof t=="object"),{showTooltip:f,tooltipProps:x}=$s(!!u);if(typeof t=="object"&&typeof g=="number"){const w=Object.assign({},t),C=Bc(Object.keys(w));t=Ac(g,C,w)}!l&&u&&(u="");const b=[];typeof t=="string"&&b.push(t),r&&(b.push("icon"),typeof r=="object"?(b.push(r.icon),r.position?b.push(r.position):b.push("left"),r.hover&&b.push(`hover_${r.hover}`),r.animate&&(b.push("animate"),typeof r.animate=="string"&&b.push(r.animate))):(b.push(r),!r.includes("right")&&!r.includes("left")&&b.push("left"))),n.muted&&b.push("muted"),n.fullWidth&&b.push("full-width");const _={...p,className:G(e,o,b,{"no-text":!h,disabled:l,button:a}),onClick:w=>{(!a||a[0]==="#")&&s&&(w.preventDefault(),w.stopPropagation()),s&&s(w)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",_.href=a);const k=D.createElement(i,_,h||(d?c.jsx(Me,{showOnFocus:!1,children:d}):null));return l&&u?c.jsxs("span",{className:"button-container",...x,children:[c.jsx(_n,{isOpen:f,children:u}),k]}):k},nr=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?c.jsx(_e,{...s},o):c.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:c.jsx(_e,{...s})},o)});return D.createElement(a,{className:G("button-wrapper",n),...r,children:i})};const Vt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return c.jsx("hr",{className:G(e,{"has-max-width":t}),style:n})},zo={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"}},Vh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?zo[e]:zo.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Kh=({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},ui=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Kh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const rr=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:d,fetchPriority:h}=e,{range:p,sizes:m}=Vh(e),g=ui({format:"avif",query:s,range:p,url:o}),f=ui({format:"webp",query:s,range:p,url:o}),x=ui({format:"",query:s,range:p,url:o});return i&&i.includes("svg")?c.jsx("picture",{className:t,children:c.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})}):c.jsxs("picture",{className:t,children:[i!=="image/gif"&&c.jsx("source",{type:"image/avif",srcSet:g,sizes:m,"data-testid":"source"}),c.jsx("source",{type:"image/webp",srcSet:f,sizes:m,"data-testid":"source"}),c.jsx("img",{srcSet:x,sizes:m,src:o,alt:r,loading:u||"lazy",decoding:d||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Zh=({image:e,className:t="",testId:n})=>c.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&c.jsx(rr,{image:{...e},className:"image"})}),Bn=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),c.jsx("a",{href:e,className:G("gtm-trackable",r),...l,children:t})}return n?D.createElement(n,{children:t,className:r,...o}):c.jsx(c.Fragment,{children:t})};const $c=D.forwardRef(({className:e="",children:t},n)=>{const r=D.useRef(null),a=n||r;return c.jsx("aside",{ref:a,className:G("popover",e),"aria-live":"polite",children:t})}),Ha=({parent:e=document.body,children:t})=>typeof document=="object"?yc.createPortal(t,e):null;const Yh=({currentStep:e=1,steps:t=1})=>c.jsxs(c.Fragment,{children:[c.jsx(Me,{children:c.jsx(ue.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),c.jsx("div",{className:"progress-tracker",children:c.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return c.jsxs("div",{className:"dot-wrapper",children:[c.jsx("div",{className:G("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),c.jsx("div",{className:G("line",{active:a<e})})]},r)})})})]});const Gh=({elementId:e,offset:t=20})=>{const n=ue.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return c.jsx(_e,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const Qh=({items:e,className:t="",...n})=>c.jsx("ul",{className:G("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>c.jsx("li",{className:"bucket text-medium",children:c.jsxs("a",{href:i,...s,children:[c.jsx("p",{className:"title",children:r}),c.jsx("p",{children:a})]})},o))}),qo=300,Wo="ease-in-out";class Jh{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:qo,easing:Wo}),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:qo,easing:Wo}),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 Ua=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ue.useIntl(),i=D.useRef(null);return D.useEffect(()=>{let s;return r&&(s=new Jh(i.current)),()=>{r&&s&&s.cleanUp()}},[]),c.jsxs("details",{ref:i,className:G("collapsible-section",t,{"should-animate":r}),children:[c.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),c.jsx("div",{className:"content",children:n})]})},Ho={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Xh=e=>{let t=e;return Object.keys(Ho).includes(e)&&(t=Ho[e]),`url(${Mt}icons/${t}.svg)`};const Uo={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Lc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ue.useIntl(),i=t?{"--custom-icon":Xh(t)}:{},s=Wa(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:c.jsx("small",{className:G("content-type-label text-small",e in Uo?Uo[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Rt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Mt}icons/${t}.svg)`}:{};return c.jsx("div",{className:G("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const on=({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=er(i);if(i&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),p=Bc(Object.keys(h));a=Ac(s,p,h)}const{breakpoints:o,text:l="",component:u,...d}=n;return c.jsx(Rt,{variant:"subtle",className:G("empty-state-box",e,r),children:c.jsxs(c.Fragment,{children:[t&&typeof t=="string"?c.jsx(Nt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||c.jsx(_e,{...d,variant:n.variant?n.variant:"secondary",children:l}))]})})};const ls=({children:e,...t})=>c.jsx("p",{...t,children:e}),zc={q:ls,blockquote:ls};for(let e=1;e<=6;e++)zc[`h${e}`]={component:ls,props:{className:"title"}};const qc=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>c.jsxs("div",{...a,className:G("helper-text-box text-small",e,t),children:[n&&c.jsx("p",{className:"title",children:n}),typeof r=="string"?c.jsx(Nt,{options:{wrapper:D.Fragment,forceBlock:!0,overrides:zc},children:r}):c.jsx("p",{children:r})]});const Wc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=ue.useIntl(),l=D.useRef(null);e||(e=Date.now().toString());const[u,d]=D.useState(""),[h,p]=D.useState("closed");D.useEffect(()=>{const f=l.current;if(f)return f.addEventListener("transitionend",m),()=>{f.removeEventListener("transitionend",m)}},[]),D.useEffect(()=>{if(!a||typeof a!="string")return;const f=a.split(`
|
|
36
|
-
`);
|
|
37
|
-
`))},[a]),D.useEffect(()=>{h==="ready-to-close"&&p("closing")},[h]);const m=({propertyName:f})=>{f==="max-height"&&p(x=>x==="opening"?"open":x==="closing"?"closed":x)};if(!a)return null;const g=["opening","open"].includes(h);return c.jsxs(Rt,{variant:"subtle",className:G("hide-show-text-box",t),children:[c.jsxs("div",{ref:l,id:e,className:G("content",h),children:[c.jsx(Nt,{options:{forceBlock:!0,...i},children:h==="closed"?u:a}),h!=="closed"&&s]}),c.jsx("p",{className:"cta",children:c.jsx(_e,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:G({"rotate-180":g}),onClick:()=>{p(g?"ready-to-close":"opening")},"aria-expanded":g,"aria-controls":e,children:g?r||o.formatMessage({id:"hideShowTextBox_hide"}):n||o.formatMessage({id:"hideShowTextBox_show"})})})]})};const em=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return D.createElement(e,{className:G("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const d={wrapper:D.Fragment,forceInline:!0},h={"--icon":`url(${Mt}icons/${l.icon}.svg)`};return e==="dl"?c.jsxs(D.Fragment,{children:[c.jsx("dt",{style:h,children:c.jsx(Nt,{options:d,children:l.dt||""})},`dt-${u}`),c.jsx("dd",{children:typeof l.text=="string"?c.jsx(Nt,{options:d,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):c.jsx("li",{style:h,children:typeof l.text=="string"?c.jsx(Nt,{options:d,children:l.text}):l.text},u)})})},nt=()=>D.Fragment,tm=({children:e})=>c.jsx(Rt,{variant:"secondary",children:e}),nm=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{className:"center",children:e}):c.jsx("div",{className:"center",children:e}),rm=["span","strong","h1","h2","h3","h4","h5","h6","p"],am=({children:e})=>{const t=ue.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of D.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(D.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of D.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&D.isValidElement(s)){const o=s.type;if(rm.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return c.jsx(Ua,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},im=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return c.jsx(Rt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return c.jsx(Rt,{variant:"primary",children:e});case"pink-textbox":return c.jsx(Rt,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?c.jsx("p",{children:e}):e;default:return c.jsx("div",{...t,children:e})}return c.jsx("div",{...t,children:e})},sm=e=>{const t=ue.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),c.jsxs(c.Fragment,{children:[c.jsx(Me,{element:"a",href:`#content-after-iframe-${n}`,onClick:i=>{var s;i.preventDefault(),i.stopPropagation(),(s=document.getElementById(`content-after-iframe-${n}`))==null||s.scrollIntoView({behavior:"smooth"})},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),c.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),c.jsx("span",{id:`content-after-iframe-${n}`})]})},Vo=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},om=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of D.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&D.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||Vo(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!D.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Vo(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},c.jsx("p",{className:"center",children:c.jsx(_e,{variant:"primary",size:"medium",...n,children:r})})):c.jsx("a",{...n,children:r})},cs=({children:e,...t})=>c.jsx("span",{className:G({url:t==null?void 0:t.href}),children:e});const um={default:{a:om,CollapsibleSection:Ua,TextBox:Rt,CaseStudy:tm,style:nt,details:am,div:im,iframe:sm,center:nm},"text-only":{h1:nt,h2:nt,h3:nt,h4:nt,h5:nt,h6:nt,style:nt,details:nt,div:nt,TextBox:nt,CollapsibleSection:nt,CaseStudy:nt,blockquote:nt,iframe:nt,button:nt}},Zn=({className:e="",options:t={},children:n,overrideType:r="default",styling:a={}})=>{if(!n)return null;const{highlightTitles:i=!1}=a;n=n.replace(/^<br\/?>/,"");const s={wrapper:D.Fragment,forceBlock:!0};let o=um[r];return t.overrides&&(o={...o,...t.overrides}),c.jsx("div",{className:G("markdown-text",e,{"highlight-titles":i}),children:c.jsx(Nt,{options:{...s,...t,overrides:o},children:n})})};const Hc=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return c.jsxs("section",{className:G("page-heading",a),children:[c.jsxs("div",{className:G("content",{"has-max-width":e}),style:i,children:[t&&t.text&&D.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&D.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const mn=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${Mt}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=$s(!!a),d=c.jsx("span",{...u,className:G("pill",e,t,n,{"has-icon":r}),style:o,...s,children:i});return a?c.jsxs("span",{className:"pill-wrapper",children:[c.jsx(_n,{isOpen:l,children:a}),d]}):d};const Br=({element:e="p",children:t=null,className:n="",...r})=>D.createElement(e,{...r,className:G("status-banner text-small",n),"aria-live":"assertive"},t);const lm=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ue.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,d={"--progress":`${t}%`};return c.jsx("span",{className:G(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:d,children:D.createElement(i?"span":Me,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},zs=D.memo(lm);const li="loadingBlock_",cm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ue.useIntl();t||(t={0:{text:r.formatMessage({id:`${li}loading`})},75:{text:r.formatMessage({id:`${li}almostDone`})},100:{text:r.formatMessage({id:`${li}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(${Mt}icons/${t[a].icon}.svg)`}:{};return c.jsxs(Rt,{className:G("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&c.jsx("span",{className:"step",children:t[a].text}),c.jsx(zs,{progress:e})]})},dm=D.memo(cm);const Et=({element:e="div",className:t="",...n})=>c.jsx(qa,{element:e,className:G("loading-placeholder",t),...n});const ds={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Uc=(e,t)=>e in ds?c.jsx("div",{className:e,children:ds[e].map((n,r)=>Uc(n,r))},t):c.jsx(Et,{className:e},t),qs=({layout:e="overview-page",...t})=>c.jsx("div",{className:G("loading-state",e),...t,children:ds[e].map((n,r)=>Uc(n,r))}),Vc=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):""},Wr=["#5AB6A3","#A2D7AF","#806056","#3962B3"],fm=e=>{const t=Math.ceil(26/Wr.length),n=Vc(e).toLowerCase();if(n==="")return Wr[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Wr.length;a++)if(r<=t*(a+1))return Wr[a]};const Ko=256,Zt=({className:e="",src:t="",name:n,alt:r,width:a=Ko,height:i=Ko,...s})=>{const[o,l]=D.useState(!1),u=D.useRef(null),d=r??n;D.useEffect(()=>{const p=u.current;if(!p)return;const m=p.getContext("2d");if(!m)return;const g=a,f=i;typeof window<"u"&&window.devicePixelRatio&&(p.width=g*window.devicePixelRatio,p.height=f*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=fm(n),m.fillRect(0,0,g,f),m.font=`${g/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Vc(n),g/2,f/1.6)},[n]);let h=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(h=!0),c.jsx("figure",{className:G("profile-picture",e,{error:o}),...s,children:h?c.jsx("img",{src:t,alt:d,onError:()=>{l(!0)},width:a,height:i}):c.jsx("canvas",{ref:u})})},Va=e=>e==="apolitical"?{image:`${Mt}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Mt}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},hm=({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=Vn(l,r)),l};const Dn=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},functions:a={},gtmContext:i="member",gtmType:s="member-click",className:o="",alt:l=""})=>{const u=ue.useIntl(),{size:d="medium"}=r,h=Va(t);h.name||(h.name=u.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:p,image:m}=h;let{url:g}=h;t.link!==void 0&&(t.link===!1?g=void 0:g=t.link);const f=hm(h),x=n&&n.createdAt?os(n.createdAt):!1,b=n&&n.createdAt?Ls(n.createdAt):"";return D.createElement(e,{className:G("member text-medium",d,o),...a,children:c.jsxs(Bn,{href:g,gtmType:s,gtmContext:i,onClick:_=>{_==null||_.stopPropagation()},children:[c.jsx(Zt,{name:p,src:m,alt:l}),c.jsxs("p",{className:"details",children:[c.jsxs("strong",{children:[p,n&&c.jsxs("span",{className:"additional-content",children:[n.createdAt&&x&&c.jsx("span",{className:"date",title:b,"aria-label":b,children:u.formatMessage({id:`dates_${x.path}`},{number:x.number})}),n.didEdit&&c.jsx("em",{children:u.formatMessage({id:"discussion_edited"})})]})]}),f&&c.jsx("small",{className:G({"text-medium":d==="large"}),children:f})]})]})})};const Zo={small:24,medium:48},Ws=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...d})=>{const h=ue.useIntl();return!n||n.length===0?null:D.createElement(e,{...d,className:G("contributors",u,a,{"has-gap":i}),children:c.jsxs(c.Fragment,{children:[c.jsx("ul",{children:n.map((p,m)=>{let g,f="";if(m<o){const{name:x="",image:b=""}=Va(p);if(s)return c.jsx(Et,{element:"li",className:"contributor"},m);g=c.jsx(Zt,{name:x,src:b,width:Zo[a||"medium"],height:Zo[a||"medium"]})}else if(m===o){const x=(t||n.length)-o;g=c.jsxs("small",{className:G({"large-number":x>99}),children:["+",Wh(x,0)]}),f="number-left"}return g?c.jsx("li",{className:G("contributor",f),children:g},m):null})}),r&&c.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?h.formatMessage({id:`member_${n[0]}`}):Vn(n[0].name||"",20):l||null})]})})},Kc=({showDevTools:e=!0,children:t})=>{const n=new Ze.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return c.jsxs(Ze.QueryClientProvider,{client:n,children:[t,e&&c.jsx(Eh.ReactQueryDevtools,{initialIsOpen:!1})]})};var mm=D.createContext({client:la});function pm(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=D.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(la.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),la.init(r,a)),la)},[n,r]);return D.createElement(mm.Provider,{value:{client:i}},t)}const Zc=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?c.jsx(pm,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):c.jsx(c.Fragment,{children:e}),Yc=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...qh[r],...n||{}};return c.jsx(ue.IntlProvider,{locale:r,messages:a,children:e})},Hs=D.createContext({}),da={en:"English",es:"Español",fr:"Français",pt:"Português"},$t=D.createContext({isLoading:!0});function Ka(){return D.useContext($t)}const Gc=({children:e,user:t})=>c.jsx($t.Provider,{value:t,children:e}),Us=D.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Qc=()=>D.useContext(Us),Jc=({children:e})=>{const[t,n]=D.useState([]);D.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=D.useCallback(i=>{n(s=>[...s,i])},[]),a=D.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return c.jsx(Us.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},gm=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=D.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=D.useState(s),u=d=>{localStorage.setItem("language",d),l(d)};return D.useEffect(()=>{e().then(d=>{i({...d,isLoading:!1}),Rc(5e3)}).catch(d=>{d.message===jc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),c.jsx(Hs.Provider,{value:{language:o,updateLanguage:u},children:c.jsx(Yc,{locale:o,messages:n==null?void 0:n.messages,children:c.jsx(Ms.CookiesProvider,{children:c.jsx(Gc,{user:a,children:c.jsx(Jc,{children:c.jsx(Kc,{showDevTools:r,children:c.jsx(Zc,{user:a,children:t})})})})})})})};const lr="joinCommunityButton",Vs=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ue.useIntl(),o=D.useContext($t),l=o&&typeof o.id=="string",u=r||!l,[d,h]=D.useState(e),[p,m]=D.useState(e?"joined":"notJoined");D.useEffect(()=>{p==="joining"?m("joined"):p==="leaving"&&m("notJoined")},[d]);const g={},f={};return d&&p!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${lr}_leave`}),g["aria-label"]=s.formatMessage({id:`${lr}_member_aria`}),f["aria-hidden"]="true"),c.jsx(_e,{variant:d?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:d&&p!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!d?s.formatMessage({id:`${lr}_closed_tooltip`}):"",onClick:async x=>{if(u)return;x.currentTarget.blur(),m(d?"leaving":"joining");const b=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${lr}_aria_live`},{action:d?"leaving":"joining"})}});document.dispatchEvent(b);const _=d?i:a;typeof _=="function"&&setTimeout(async()=>{await _()},500),h(!d)},className:G("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...g,children:c.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${lr}${["joining","leaving"].includes(p)?`_${p}`:d?"_member":n?"_short":""}`})})})};const ci="communityDetails_",vm=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=ue.useIntl(),u=5,d=a||i.length,h=i.length?i:Array(u).fill({}),p=`/communities/${r}/members`===window.location.pathname,m=t||n,g=!n&&!t;return c.jsxs("div",{className:G("community-details",e),children:[m&&c.jsxs("div",{className:"member-details",children:[c.jsxs("div",{className:"top",children:[c.jsxs("h4",{children:[l.formatMessage({id:`${ci}members`}),c.jsx("span",{className:"count",children:d})]}),!p&&c.jsx("p",{className:"text-small",children:c.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${ci}viewAll`})})})]}),c.jsx(Ws,{contributors:{total:a,data:h},styling:{size:"medium",showGap:!0,showPlaceholders:d===0},cutoff:u})]}),c.jsx(Vs,{isMember:t,isOpen:n,disabled:g,functions:{...o}}),t&&c.jsx(_e,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${ci}invite`})})]})};const bm=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ue.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(Me,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),c.jsx("ul",{className:G("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),c.jsxs("li",{children:[s&&c.jsx(Me,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),c.jsx(Bn,{href:s?void 0:i,...l,children:Vn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const ym=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=ue.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=D.useState(t?["all"]:[]),u=(d,h)=>{let p=[];o.includes(d)?p=o.filter(m=>m!==d):d==="all"?p=["all"]:n?p=[...o.filter(m=>m!=="all"),d]:p=[d],l(m=>(r&&typeof r=="function"&&r({current:p,previous:m}),p)),h&&typeof h=="function"&&h()};return c.jsx("ul",{className:G("filters",a),children:s.map(({id:d,text:h,disabled:p=!1,callback:m=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:h})}),c.jsx("li",{children:c.jsx("button",{className:G(d,{selected:o.includes(d)}),onClick:f=>{f.preventDefault(),f.stopPropagation(),u(d,m)},...g,children:h})},d)})})},Dm=(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 Hr="languageSwitcher_",xm=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ue.useIntl(),{updateLanguage:d=()=>{}}=D.useContext(Hs),[h,p]=D.useState(e);if(D.useEffect(()=>{e!==h&&p(e)},[e]),!r||!Object.values(r).some(x=>x&&x.post_name))return null;const g=Object.keys(r),f=h!==e;return c.jsxs("div",{className:G("language-switcher text-small",s,l),children:[c.jsxs("nav",{children:[s!=="short"&&c.jsx("p",{children:o||u.formatMessage({id:`${Hr}label`})}),c.jsx("ul",{children:g.map(x=>{var k;if(!da[x])return null;const b=(k=r[x])==null?void 0:k.post_name;let _={className:x};if(h===x)_["aria-label"]=u.formatMessage({id:`${Hr}selected`},{language:da[x]});else{const w=Dm(x,b,i);_={..._,href:typeof w=="string"?w:w.url,onClick:C=>{p(x),d(x),typeof a<"u"&&(C.preventDefault(),C.stopPropagation(),a(x,typeof w=="string"?w:w.urlForRouter))}}}return c.jsx("li",{children:c.jsx(Bn,{..._,fallbackElement:"span",children:da[x]})},x)})}),s!=="short"&&!f&&c.jsx("p",{children:u.formatMessage({id:`${Hr}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&c.jsx("small",{children:u.formatMessage({id:`${Hr}disclaimer`},{email:Mn.support,link:x=>{const b=`mailto:${x}`;return c.jsx("a",{href:b,children:x})}})})]})};const di=ue.createIntl({locale:"en",messages:tr}),Mr=({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:di.formatMessage({id:"loadMore_button"}),endOfFeed:di.formatMessage({id:"loadMore_endOfFeed"}),error:di.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[d,h]=D.useState(""),p=async m=>{if(!n)try{await t(m)}catch(g){g instanceof Error?h(g.message):h("Unknown error")}};return!d&&!e&&!o.endOfFeed?null:c.jsx("footer",{className:G("load-more",l),children:!d&&e?c.jsx(_e,{variant:r,size:a,styling:i,icon:s,onClick:p,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!d||d!=null&&d.includes("Cannot read items"))?c.jsx("p",{children:o.endOfFeed}):d&&c.jsx("p",{className:"error",children:o.error})})};const Ks=({variant:e="default",version:t="default",className:n="",...r})=>c.jsx("p",{className:"logo-wrapper",children:c.jsx("a",{href:"/home/",className:G("logo",e,t,n),...r,children:c.jsx(Me,{children:c.jsx(ue.FormattedMessage,{id:"apolitical"})})})});let Ur=!1;const Xc=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ue.useIntl(),i=D.useRef(null),[s,o]=D.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return D.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),D.createElement(e,{ref:i,className:G("more-menu text-medium",r),children:c.jsxs(c.Fragment,{children:[c.jsx(_e,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),c.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:d,text:h,icon:p,...m},g)=>{const f={...m,onClick:x=>{o(!1),typeof d=="function"&&d(x)},onFocus:()=>{Ur&&(clearTimeout(Ur),Ur=!1)},onBlur:()=>{Ur=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),c.jsx("li",{className:"more-menu-list-item",children:c.jsx(_e,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${g}`)})})]})})},Cm=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const wm=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],ed=({activeLink:e})=>{const t=ue.useIntl(),n=D.useContext($t),r=n&&typeof n.id=="string";return c.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[wm.map(({key:a,href:i})=>{const s=Cm(i,e),o={};return s&&(o["aria-current"]="page"),c.jsx("li",{className:G(a,{active:s}),children:c.jsx("a",{href:i,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...o,children:t.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),r&&c.jsx("li",{className:"profile","data-testid":"profile-link",children:c.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[c.jsx(Zt,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),c.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},cr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,Em=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${cr(t,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(e)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${cr(t,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(e)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${cr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
|
|
35
|
+
Thank you for helping to protect the Apolitical community from abusive content.`,discussionFormCard_placeholder:"Write a post or ask a question...",discussion_form_title:"Write your {action}",discussion_form_titleField_label:"Title",discussion_form_titleField_placeholder:"Write something...",discussion_form_titleField_error:"Please enter a title or a body for your post.",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Body",discussion_form_label_action:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Share a question, insight, or announcement with the community",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_share_copy_link:"Copy link",discussion_share_copy_link_success:"Link copied to clipboard",discussion_thread_show:"Show {count} {count, select, 1 {reply} other {replies}}",discussion_thread_hide:"Hide replies",discussion_thread_loadMore:"Load more replies",contactFooter_title:"Contact us",contactFooter_text:"We're always open to new ideas, so please reach out to see how we can collaborate.",contactFooter_phone:"+44 203 608 2241",contactFooter_email:"hello@apolitical.co",contactForm_name:"Name",contactForm_email:"Email address",contactForm_organisation:"Government department or organisation",contactForm_interests:"I'm interested in",contactForm_interests_publishingCourse:"Publishing or creating a course",contactForm_interests_buyingCourse:"Buying courses for my team",contactForm_interests_learningExperience:"Customised learning experiences",contactForm_interests_somethingElse:"Something else",contactForm_message:"Message",dropdown_menu_multiselect_all:"All",dropdown_menu_multiselect_none:"None",emailHelperTextBox_fallback_title:"Who can join",emailHelperTextBox_fallback_text:"Apolitical is a private community for public servants and policymakers.",emailHelperTextBox_default_title:"Who can join",emailHelperTextBox_default_text:"Apolitical is a private community for public servants and policymakers. <link>Learn more</link>.",emailHelperTextBox_autoApproved_title:"Email check",emailHelperTextBox_autoApproved_text:"Great! Looks like you are using a **government email domain we recognise.** You will be **auto-approved** once you sign up.",emailHelperTextBox_unrecognisedEmail_title:"Not a recognised government email",emailHelperTextBox_unrecognisedEmail_text:"To confirm you work in government or policy, please add more details below. <link>Learn more</link>.",emailHelperTextBox_pendingApproval_title:"Email is pending approval",emailHelperTextBox_pendingApproval_text:"Looks like this email has been used to sign up to Apolitical before, but <strong>we have not yet approved it.</strong> If you cannot wait to join, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_emailUnverified_title:"Hello again!",emailHelperTextBox_emailUnverified_text:"It looks like you're already an Apolitical member. To access your account, please verify your email address. <link>Click here to get a verification code sent to your email</link>.",emailHelperTextBox_emailAlreadyExists_title:"Email is already registered",emailHelperTextBox_emailAlreadyExists_text:"Looks like this email has been used to sign up to Apolitical before, try <link>logging in</link> instead. If you're still having issues, contact <mail>concierge@apolitical.co</mail>.",emailHelperTextBox_error_verificationFailedToSend_title:"Verification code failed to send",emailHelperTextBox_error_verificationFailedToSend_text:"Error details: <em>{error}</em>{br}<link>Click here to try again</link>.{br}If you continue to have problems, contact us at <mail>concierge@apolitical.co</mail>",emailHelperTextBox_error_noFunction:"Cannot resend verification code.",form_fieldWrapper_required:"required",form_fieldWrapper_characterLimit:"Character limit:",form_fieldWrapper_characterLimit_aria_default:"You have {remaining, plural, =0 {no characters} one {1 character} other {# characters}} remaining.",form_fieldWrapper_characterLimit_aria_over:"You are {over, plural, one {1 character} other {# characters}} over the limit. Please shorten your text to {limit} characters.",form_fieldWrapper_characterLimit_info:"You can enter up to {limit} characters",form_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their email addresses below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"Link:",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",richTextEditor_mention_fallback:"Can't find who you're looking for? Invite them to the community",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_insights:"Insights",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",discussionFormModal_title:"Create a post",discussionFormModal_cta:"Create post",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their email addresses below.",inviteModal_cta:"Send",overlay_close:"Close",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",navigationMenu_profile:"My profile",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},zh={...nr,languageSwitcher_label:"Me gustaría leer este artículo en...",languageSwitcher_translation_original:"idioma original",languageSwitcher_translation_human:"traducido por un humano",languageSwitcher_translation_machine:"traducido por máquina",languageSwitcher_disclaimer:"Este contenido fue traducido automáticamente y ocasionalmente tendrá errores de género u otras traducciones directas. Estamos intentando resolver este problema, pero mientras tanto, si notas algún error grave, escríbenos a <link>{email}</link>"},qh={...nr,languageSwitcher_label:"Je voudrais lire cet article dans...",languageSwitcher_translation_original:"langue originale",languageSwitcher_translation_human:"traduit par un humain",languageSwitcher_translation_machine:"traduit par machine",languageSwitcher_disclaimer:"Ce contenu est traduit automatiquement et contiendra d’évantuelles erreurs de genre ou d’autres traductions directes. Nous essayons de résoudre ce problème, mais en attendant, si vous remarquez une erreur importante, faites-le nous savoir à <link>{email}</link>",collapsibleSection_summary:"En savoir plus"},Wh={...nr,languageSwitcher_label:"Eu gostaria de ler este artigo em...",languageSwitcher_translation_original:"linguagem original",languageSwitcher_translation_human:"traduzido por um humano",languageSwitcher_translation_machine:"traduzido por máquina",languageSwitcher_disclaimer:"Este conteúdo foi traduzido automaticamente e, ocasionalmente, poderão ocorrer erros de linguagem de gênero ou outras traduções diretas. Estamos tentando resolver isso, porém se perceber algo errado por favor nos avise em <link>{email}</link>"},Hh=Object.freeze(Object.defineProperty({__proto__:null,en:nr,es:zh,fr:qh,pt:Wh},Symbol.toStringTag,{value:"Module"})),Ha=(e,t=nr)=>e in t,Bt=(e,t,n,r,a={})=>{let i="";return Ha(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},Uh=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let a=n.length-1;a>=0;a--){const i=Math.pow(10,(a+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&a<n.length-1&&(e=1,a++),r=`${e}${n[a]}`;break}}return r},fa=(e,t)=>D.Children.map(e,n=>Object.is(n,null)?n:D.cloneElement(n,{...t})),Ic=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Vh=(e,t,n)=>!t.id||!t.name?"":n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),$c=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(Br);if(!a)return e;for(const s of a){const o=s.replace(Br,(c,h)=>h),l=n[o];if(!l)continue;const u={};if(typeof l=="object")u.name=((i=l==null?void 0:l.data)==null?void 0:i.name)||"",u.id=l.id||"";else{const c=l;if(c.startsWith(os))try{const h=c.replace(os,"");u.id=h,await r({id:h}).then(p=>{const{name:m}=p;u.name=m||""})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Vh(e,u,t):s)}return e},Lc=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Kh=e=>new URLSearchParams(window.location.search).get(e),qo=(e="")=>e.replace(/\s+/g,"").length>0,ls=e=>{const t=e.length>8,n=/[0-9]/.test(e)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(e),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(e);return{isValid:t&&n&&r,matchingRules:{isMoreThanEightCharacters:t,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}};const _e=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:c=!1,children:h=!1,...p})=>{const g=tr(typeof t=="object"),{showTooltip:f,tooltipProps:y}=Ls(!!u);if(typeof t=="object"&&typeof g=="number"){const C=Object.assign({},t),w=Fc(Object.keys(C));t=Tc(g,w,C)}!l&&u&&(u="");const v=[];typeof t=="string"&&v.push(t),r&&(v.push("icon"),typeof r=="object"?(v.push(r.icon),r.position?v.push(r.position):v.push("left"),r.hover&&v.push(`hover_${r.hover}`),r.animate&&(v.push("animate"),typeof r.animate=="string"&&v.push(r.animate))):(v.push(r),!r.includes("right")&&!r.includes("left")&&v.push("left"))),n.muted&&v.push("muted"),n.fullWidth&&v.push("full-width");const k={...p,className:Y(e,o,v,{"no-text":!h,disabled:l,button:a}),onClick:C=>{(!a||a[0]==="#")&&s&&(C.preventDefault(),C.stopPropagation()),s&&s(C)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",k.href=a);const B=D.createElement(i,k,h||(c?d.jsx(Ie,{showOnFocus:!1,children:c}):null));return l&&u?d.jsxs("span",{className:"button-container",...y,children:[d.jsx(An,{isOpen:f,children:u}),B]}):B},rr=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?d.jsx(_e,{...s},o):d.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:d.jsx(_e,{...s})},o)});return D.createElement(a,{className:Y("button-wrapper",n),...r,children:i})};const Kt=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return d.jsx("hr",{className:Y(e,{"has-max-width":t}),style:n})},Wo={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"}},Zh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?Wo[e]:Wo.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Yh=({format:e,height:t,query:n,width:r})=>{let a=`w=${r}&h=${t}`;return a=e?`${a}&fm=${e}`:a,a=n?`${a}&${n}`:a,a},li=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Yh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const ar=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:c,fetchPriority:h}=e,{range:p,sizes:m}=Zh(e),g=li({format:"avif",query:s,range:p,url:o}),f=li({format:"webp",query:s,range:p,url:o}),y=li({format:"",query:s,range:p,url:o});return i&&i.includes("svg")?d.jsx("picture",{className:t,children:d.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})}):d.jsxs("picture",{className:t,children:[i!=="image/gif"&&d.jsx("source",{type:"image/avif",srcSet:g,sizes:m,"data-testid":"source"}),d.jsx("source",{type:"image/webp",srcSet:f,sizes:m,"data-testid":"source"}),d.jsx("img",{srcSet:y,sizes:m,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:h||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Gh=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(ar,{image:{...e},className:"image"})}),Fn=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),d.jsx("a",{href:e,className:Y("gtm-trackable",r),...l,children:t})}return n?D.createElement(n,{children:t,className:r,...o}):d.jsx(d.Fragment,{children:t})};const zc=D.forwardRef(({className:e="",children:t},n)=>{const r=D.useRef(null),a=n||r;return d.jsx("aside",{ref:a,className:Y("popover",e),"aria-live":"polite",children:t})}),Ua=({parent:e=document.body,children:t})=>typeof document=="object"?xc.createPortal(t,e):null;const Qh=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx(Ie,{children:d.jsx(ue.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),d.jsx("div",{className:"progress-tracker",children:d.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return d.jsxs("div",{className:"dot-wrapper",children:[d.jsx("div",{className:Y("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),d.jsx("div",{className:Y("line",{active:a<e})})]},r)})})})]});const Jh=({elementId:e,offset:t=20})=>{const n=ue.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return d.jsx(_e,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const Xh=({items:e,className:t="",...n})=>d.jsx("ul",{className:Y("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>d.jsx("li",{className:"bucket text-medium",children:d.jsxs("a",{href:i,...s,children:[d.jsx("p",{className:"title",children:r}),d.jsx("p",{children:a})]})},o))}),Ho=300,Uo="ease-in-out";class em{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:Ho,easing:Uo}),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:Ho,easing:Uo}),this.animation.onfinish=()=>this.onAnimationFinish(!0),this.animation.oncancel=()=>this.isExpanding=!1}onAnimationFinish(t){this.el.open=t,this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.el.style.height=this.el.style.overflow=""}}const Va=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ue.useIntl(),i=D.useRef(null);return D.useEffect(()=>{let s;return r&&(s=new em(i.current)),()=>{r&&s&&s.cleanUp()}},[]),d.jsxs("details",{ref:i,className:Y("collapsible-section",t,{"should-animate":r}),children:[d.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),d.jsx("div",{className:"content",children:n})]})},Vo={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},tm=e=>{let t=e;return Object.keys(Vo).includes(e)&&(t=Vo[e]),`url(${It}icons/${t}.svg)`};const Ko={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},qc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ue.useIntl(),i=t?{"--custom-icon":tm(t)}:{},s=Ha(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:Y("content-type-label text-small",e in Ko?Ko[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Mt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${It}icons/${t}.svg)`}:{};return d.jsx("div",{className:Y("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const un=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let a=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,s=tr(i);if(i&&typeof n=="object"&&typeof s=="number"){const h=Object.assign({},n.breakpoints),p=Fc(Object.keys(h));a=Tc(s,p,h)}const{breakpoints:o,text:l="",component:u,...c}=n;return d.jsx(Mt,{variant:"subtle",className:Y("empty-state-box",e,r),children:d.jsxs(d.Fragment,{children:[t&&typeof t=="string"?d.jsx(Rt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||d.jsx(_e,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const cs=({children:e,...t})=>d.jsx("p",{...t,children:e}),Wc={q:cs,blockquote:cs};for(let e=1;e<=6;e++)Wc[`h${e}`]={component:cs,props:{className:"title"}};const Hc=({type:e="default",className:t="",heading:n=!1,children:r,...a})=>d.jsxs("div",{...a,className:Y("helper-text-box text-small",e,t),children:[n&&d.jsx("p",{className:"title",children:n}),typeof r=="string"?d.jsx(Rt,{options:{wrapper:D.Fragment,forceBlock:!0,overrides:Wc},children:r}):d.jsx("p",{children:r})]});const Uc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=ue.useIntl(),l=D.useRef(null);e||(e=Date.now().toString());const[u,c]=D.useState(""),[h,p]=D.useState("closed");D.useEffect(()=>{const f=l.current;if(f)return f.addEventListener("transitionend",m),()=>{f.removeEventListener("transitionend",m)}},[]),D.useEffect(()=>{if(!a||typeof a!="string")return;const f=a.split(`
|
|
36
|
+
`);c(f.length<3?`${a.substring(0,400)}...`:f.slice(0,3).join(`
|
|
37
|
+
`))},[a]),D.useEffect(()=>{h==="ready-to-close"&&p("closing")},[h]);const m=({propertyName:f})=>{f==="max-height"&&p(y=>y==="opening"?"open":y==="closing"?"closed":y)};if(!a)return null;const g=["opening","open"].includes(h);return d.jsxs(Mt,{variant:"subtle",className:Y("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:Y("content",h),children:[d.jsx(Rt,{options:{forceBlock:!0,...i},children:h==="closed"?u:a}),h!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(_e,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Y({"rotate-180":g}),onClick:()=>{p(g?"ready-to-close":"opening")},"aria-expanded":g,"aria-controls":e,children:g?r||o.formatMessage({id:"hideShowTextBox_hide"}):n||o.formatMessage({id:"hideShowTextBox_show"})})})]})};const nm=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return D.createElement(e,{className:Y("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const c={wrapper:D.Fragment,forceInline:!0},h={"--icon":`url(${It}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(D.Fragment,{children:[d.jsx("dt",{style:h,children:d.jsx(Rt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Rt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:h,children:typeof l.text=="string"?d.jsx(Rt,{options:c,children:l.text}):l.text},u)})})},nt=()=>D.Fragment,rm=({children:e})=>d.jsx(Mt,{variant:"secondary",children:e}),am=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),im=["span","strong","h1","h2","h3","h4","h5","h6","p"],sm=({children:e})=>{const t=ue.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of D.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(D.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of D.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&D.isValidElement(s)){const o=s.type;if(im.includes(o)){for(n=s.props.children;typeof n!="string"&&(Array.isArray(n)&&n[0].props&&n[0].props.children&&n[0].props.children[0]);)n=n[0].props.children[0];break}}}}else r.push(i);const a=n?n.toString():"";return d.jsx(Va,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},om=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(Mt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(Mt,{variant:"primary",children:e});case"pink-textbox":return d.jsx(Mt,{variant:"tertiary",children:e});case"content":return typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{children:e}):e;default:return d.jsx("div",{...t,children:e})}return d.jsx("div",{...t,children:e})},xt=({children:e})=>d.jsx(d.Fragment,{children:e}),um=e=>{const t=ue.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),d.jsxs(d.Fragment,{children:[d.jsx(Ie,{element:"a",href:`#content-after-iframe-${n}`,onClick:i=>{var s;i.preventDefault(),i.stopPropagation(),(s=document.getElementById(`content-after-iframe-${n}`))==null||s.scrollIntoView({behavior:"smooth"})},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),d.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),d.jsx("span",{id:`content-after-iframe-${n}`})]})},Zo=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},lm=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of D.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&D.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||Zo(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!D.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Zo(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(_e,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},ds=({children:e,...t})=>d.jsx("span",{className:Y({url:t==null?void 0:t.href}),children:e});const cm={default:{a:lm,CollapsibleSection:Va,TextBox:Mt,CaseStudy:rm,style:nt,details:sm,div:om,iframe:um,center:am},"text-only":{h1:nt,h2:nt,h3:nt,h4:nt,h5:nt,h6:nt,style:nt,details:nt,div:nt,TextBox:nt,CollapsibleSection:nt,CaseStudy:nt,blockquote:nt,iframe:nt,button:nt}},xn=({element:e="div",className:t="",options:n={},children:r,overrideType:a="default",styling:i={}})=>{if(!r)return null;const{highlightTitles:s=!1}=i;r=r.replace(/^<br\/?>/,"");const o={wrapper:D.Fragment,forceBlock:!0};let l=cm[a];return n.overrides&&(l={...l,...n.overrides}),D.createElement(e,{className:Y("markdown-text",t,{"highlight-titles":s}),children:d.jsx(Rt,{options:{...o,...n,overrides:l},children:r})})};const Vc=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return d.jsxs("section",{className:Y("page-heading",a),children:[d.jsxs("div",{className:Y("content",{"has-max-width":e}),style:i,children:[t&&t.text&&D.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&D.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const pn=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${It}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=Ls(!!a),c=d.jsx("span",{...u,className:Y("pill",e,t,n,{"has-icon":r}),style:o,...s,children:i});return a?d.jsxs("span",{className:"pill-wrapper",children:[d.jsx(An,{isOpen:l,children:a}),c]}):c};const Ar=({element:e="p",children:t=null,className:n="",...r})=>D.createElement(e,{...r,className:Y("status-banner text-small",n),"aria-live":"assertive"},t);const dm=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=ue.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,c={"--progress":`${t}%`};return d.jsx("span",{className:Y(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:c,children:D.createElement(i?"span":Ie,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},qs=D.memo(dm);const ci="loadingBlock_",fm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ue.useIntl();t||(t={0:{text:r.formatMessage({id:`${ci}loading`})},75:{text:r.formatMessage({id:`${ci}almostDone`})},100:{text:r.formatMessage({id:`${ci}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${It}icons/${t[a].icon}.svg)`}:{};return d.jsxs(Mt,{className:Y("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&d.jsx("span",{className:"step",children:t[a].text}),d.jsx(qs,{progress:e})]})},hm=D.memo(fm);const kt=({element:e="div",className:t="",...n})=>d.jsx(Wa,{element:e,className:Y("loading-placeholder",t),...n});const fs={header:["logo","link","link","search"],sidebar:["text","text","text","text","text"],"cards-section":["subtitle","cards"],heading:["title"],cards:["card","card","card","card"],carousel:["cards","controls"],"carousel-with-title":["title","cards","controls"],answers:["text","text","text"],"text-page":["title","text","text","text","text","subtitle","text","text","text","text","subtitle","text","text","text","text"],"form-with-answers":["question","subtitle","form","answers","answers","answers","answers","answers"],"general-website-page":["banner","text-page"],"overview-page":["header","sidebar","title","text","cards-section","cards-section","footer"],"course-navigation":["button","button"],"course-lesson-page":["breadcrumb","course-navigation","text-page"],"course-lesson-quiz":["text-page","quiz-box"]},Kc=(e,t)=>e in fs?d.jsx("div",{className:e,children:fs[e].map((n,r)=>Kc(n,r))},t):d.jsx(kt,{className:e},t),Ws=({layout:e="overview-page",...t})=>d.jsx("div",{className:Y("loading-state",e),...t,children:fs[e].map((n,r)=>Kc(n,r))}),Zc=e=>{const t=e&&e.toUpperCase().trim().split(" ");return Array.isArray(t)&&t.length>1&&t[0]!==""?t[1]===""?t[0][0]:t[0][0]+t[t.length-1][0]:e?e.substr(0,1):""},Ur=["#5AB6A3","#A2D7AF","#806056","#3962B3"],mm=e=>{const t=Math.ceil(26/Ur.length),n=Zc(e).toLowerCase();if(n==="")return Ur[0];const r=n.charCodeAt(0)-96;for(let a=0;a<Ur.length;a++)if(r<=t*(a+1))return Ur[a]};const Yo=256,Yt=({className:e="",src:t="",name:n,alt:r,width:a=Yo,height:i=Yo,...s})=>{const[o,l]=D.useState(!1),u=D.useRef(null),c=r??n;D.useEffect(()=>{const p=u.current;if(!p)return;const m=p.getContext("2d");if(!m)return;const g=a,f=i;typeof window<"u"&&window.devicePixelRatio&&(p.width=g*window.devicePixelRatio,p.height=f*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=mm(n),m.fillRect(0,0,g,f),m.font=`${g/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Zc(n),g/2,f/1.6)},[n]);let h=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(h=!0),d.jsx("figure",{className:Y("profile-picture",e,{error:o}),...s,children:h?d.jsx("img",{src:t,alt:c,onError:()=>{l(!0)},width:a,height:i}):d.jsx("canvas",{ref:u})})},Ka=e=>e==="apolitical"?{image:`${It}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${It}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},pm=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const a=e!=="",i=t!=="",s=n!=="";if(!a&&!i&&!s)return"";const o=`${e}${a&&i?` — ${t}`:t}`;let l=`${o}${(a||i)&&s?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=Zn(l,r)),l};const Cn=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},functions:a={},gtmContext:i="member",gtmType:s="member-click",className:o="",alt:l=""})=>{const u=ue.useIntl(),{size:c="medium"}=r,h=Ka(t);h.name||(h.name=u.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:p,image:m}=h;let{url:g}=h;t.link!==void 0&&(t.link===!1?g=void 0:g=t.link);const f=pm(h),y=n&&n.createdAt?us(n.createdAt):!1,v=n&&n.createdAt?zs(n.createdAt):"";return D.createElement(e,{className:Y("member text-medium",c,o),...a,children:d.jsxs(Fn,{href:g,gtmType:s,gtmContext:i,onClick:k=>{k==null||k.stopPropagation()},children:[d.jsx(Yt,{name:p,src:m,alt:l}),d.jsxs("p",{className:"details",children:[d.jsxs("strong",{children:[p,n&&d.jsxs("span",{className:"additional-content",children:[n.createdAt&&y&&d.jsx("span",{className:"date",title:v,"aria-label":v,children:u.formatMessage({id:`dates_${y.path}`},{number:y.number})}),n.didEdit&&d.jsx("em",{children:u.formatMessage({id:"discussion_edited"})})]})]}),f&&d.jsx("small",{className:Y({"text-medium":c==="large"}),children:f})]})]})})};const Go={small:24,medium:48},Hs=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...c})=>{const h=ue.useIntl();return!n||n.length===0?null:D.createElement(e,{...c,className:Y("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((p,m)=>{let g,f="";if(m<o){const{name:y="",image:v=""}=Ka(p);if(s)return d.jsx(kt,{element:"li",className:"contributor"},m);g=d.jsx(Yt,{name:y,src:v,width:Go[a||"medium"],height:Go[a||"medium"]})}else if(m===o){const y=(t||n.length)-o;g=d.jsxs("small",{className:Y({"large-number":y>99}),children:["+",Uh(y,0)]}),f="number-left"}return g?d.jsx("li",{className:Y("contributor",f),children:g},m):null})}),r&&d.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?h.formatMessage({id:`member_${n[0]}`}):Zn(n[0].name||"",20):l||null})]})})},Yc=({showDevTools:e=!0,children:t})=>{const n=new Ye.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return d.jsxs(Ye.QueryClientProvider,{client:n,children:[t,e&&d.jsx(_h.ReactQueryDevtools,{initialIsOpen:!1})]})};var gm=D.createContext({client:da});function vm(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=D.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(da.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),da.init(r,a)),da)},[n,r]);return D.createElement(gm.Provider,{value:{client:i}},t)}const Gc=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(vm,{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}),Qc=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Hh[r],...n||{}};return d.jsx(ue.IntlProvider,{locale:r,messages:a,children:e})},Us=D.createContext({}),ha={en:"English",es:"Español",fr:"Français",pt:"Português"},Lt=D.createContext({isLoading:!0});function Za(){return D.useContext(Lt)}const Jc=({children:e,user:t})=>d.jsx(Lt.Provider,{value:t,children:e}),Vs=D.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Xc=()=>D.useContext(Vs),ed=({children:e})=>{const[t,n]=D.useState([]);D.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=D.useCallback(i=>{n(s=>[...s,i])},[]),a=D.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return d.jsx(Vs.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},bm=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=D.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=D.useState(s),u=c=>{localStorage.setItem("language",c),l(c)};return D.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),Ic(5e3)}).catch(c=>{c.message===Pc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(Us.Provider,{value:{language:o,updateLanguage:u},children:d.jsx(Qc,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(Is.CookiesProvider,{children:d.jsx(Jc,{user:a,children:d.jsx(ed,{children:d.jsx(Yc,{showDevTools:r,children:d.jsx(Gc,{user:a,children:t})})})})})})})};const cr="joinCommunityButton",Ks=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ue.useIntl(),o=D.useContext(Lt),l=o&&typeof o.id=="string",u=r||!l,[c,h]=D.useState(e),[p,m]=D.useState(e?"joined":"notJoined");D.useEffect(()=>{p==="joining"?m("joined"):p==="leaving"&&m("notJoined")},[c]);const g={},f={};return c&&p!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${cr}_leave`}),g["aria-label"]=s.formatMessage({id:`${cr}_member_aria`}),f["aria-hidden"]="true"),d.jsx(_e,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&p!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!c?s.formatMessage({id:`${cr}_closed_tooltip`}):"",onClick:async y=>{if(u)return;y.currentTarget.blur(),m(c?"leaving":"joining");const v=new CustomEvent("ariaLive",{detail:{message:s.formatMessage({id:`${cr}_aria_live`},{action:c?"leaving":"joining"})}});document.dispatchEvent(v);const k=c?i:a;typeof k=="function"&&setTimeout(async()=>{await k()},500),h(!c)},className:Y("join-community-button",p,{active:p==="joining"}),disabled:u,"data-testid":"join-button",...g,children:d.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${cr}${["joining","leaving"].includes(p)?`_${p}`:c?"_member":n?"_short":""}`})})})};const di="communityDetails_",ym=({className:e="",isMember:t=!1,isOpen:n=!1,slug:r,members:{number:a=0,data:i=[]}={number:0,data:[]},functions:{invite:s,...o}})=>{const l=ue.useIntl(),u=5,c=a||i.length,h=i.length?i:Array(u).fill({}),p=`/communities/${r}/members`===window.location.pathname,m=t||n,g=!n&&!t;return d.jsxs("div",{className:Y("community-details",e),children:[m&&d.jsxs("div",{className:"member-details",children:[d.jsxs("div",{className:"top",children:[d.jsxs("h4",{children:[l.formatMessage({id:`${di}members`}),d.jsx("span",{className:"count",children:c})]}),!p&&d.jsx("p",{className:"text-small",children:d.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${di}viewAll`})})})]}),d.jsx(Hs,{contributors:{total:a,data:h},styling:{size:"medium",showGap:!0,showPlaceholders:c===0},cutoff:u})]}),d.jsx(Ks,{isMember:t,isOpen:n,disabled:g,functions:{...o}}),t&&d.jsx(_e,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${di}invite`})})]})};const Dm=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Ie,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),d.jsx("ul",{className:Y("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),d.jsxs("li",{children:[s&&d.jsx(Ie,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),d.jsx(Fn,{href:s?void 0:i,...l,children:Zn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const xm=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=ue.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=D.useState(t?["all"]:[]),u=(c,h)=>{let p=[];o.includes(c)?p=o.filter(m=>m!==c):c==="all"?p=["all"]:n?p=[...o.filter(m=>m!=="all"),c]:p=[c],l(m=>(r&&typeof r=="function"&&r({current:p,previous:m}),p)),h&&typeof h=="function"&&h()};return d.jsx("ul",{className:Y("filters",a),children:s.map(({id:c,text:h,disabled:p=!1,callback:m=()=>{}})=>{let g={};return p&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:h})}),d.jsx("li",{children:d.jsx("button",{className:Y(c,{selected:o.includes(c)}),onClick:f=>{f.preventDefault(),f.stopPropagation(),u(c,m)},...g,children:h})},c)})})},Cm=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let a="",i=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(a+=`/${s}`,i=!0):(a.includes(`/${r}/`)||(a+=`/${r}`),a+=`/${s}`)}),a.includes(`/${r}/`)||(a+=`/${r}`),t&&(a+=`/${t}`),i?{url:a,urlForRouter:`/${a.split("/").slice(2).join("/")}`}:a};const Vr="languageSwitcher_",wm=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ue.useIntl(),{updateLanguage:c=()=>{}}=D.useContext(Us),[h,p]=D.useState(e);if(D.useEffect(()=>{e!==h&&p(e)},[e]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const g=Object.keys(r),f=h!==e;return d.jsxs("div",{className:Y("language-switcher text-small",s,l),children:[d.jsxs("nav",{children:[s!=="short"&&d.jsx("p",{children:o||u.formatMessage({id:`${Vr}label`})}),d.jsx("ul",{children:g.map(y=>{var B;if(!ha[y])return null;const v=(B=r[y])==null?void 0:B.post_name;let k={className:y};if(h===y)k["aria-label"]=u.formatMessage({id:`${Vr}selected`},{language:ha[y]});else{const C=Cm(y,v,i);k={...k,href:typeof C=="string"?C:C.url,onClick:w=>{p(y),c(y),typeof a<"u"&&(w.preventDefault(),w.stopPropagation(),a(y,typeof C=="string"?C:C.urlForRouter))}}}return d.jsx("li",{children:d.jsx(Fn,{...k,fallbackElement:"span",children:ha[y]})},y)})}),s!=="short"&&!f&&d.jsx("p",{children:u.formatMessage({id:`${Vr}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${Vr}disclaimer`},{email:$n.support,link:y=>{const v=`mailto:${y}`;return d.jsx("a",{href:v,children:y})}})})]})};const fi=ue.createIntl({locale:"en",messages:nr}),$r=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:a="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:fi.formatMessage({id:"loadMore_button"}),endOfFeed:fi.formatMessage({id:"loadMore_endOfFeed"}),error:fi.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,h]=D.useState(""),p=async m=>{if(!n)try{await t(m)}catch(g){g instanceof Error?h(g.message):h("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:d.jsx("footer",{className:Y("load-more",l),children:!c&&e?d.jsx(_e,{variant:r,size:a,styling:i,icon:s,onClick:p,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!c||c!=null&&c.includes("Cannot read items"))?d.jsx("p",{children:o.endOfFeed}):c&&d.jsx("p",{className:"error",children:o.error})})};const Zs=({variant:e="default",version:t="default",className:n="",...r})=>d.jsx("p",{className:"logo-wrapper",children:d.jsx("a",{href:"/home/",className:Y("logo",e,t,n),...r,children:d.jsx(Ie,{children:d.jsx(ue.FormattedMessage,{id:"apolitical"})})})});let Kr=!1;const td=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ue.useIntl(),i=D.useRef(null),[s,o]=D.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return D.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),D.createElement(e,{ref:i,className:Y("more-menu text-medium",r),children:d.jsxs(d.Fragment,{children:[d.jsx(_e,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),d.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:c,text:h,icon:p,...m},g)=>{const f={...m,onClick:y=>{o(!1),typeof c=="function"&&c(y)},onFocus:()=>{Kr&&(clearTimeout(Kr),Kr=!1)},onBlur:()=>{Kr=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),d.jsx("li",{className:"more-menu-list-item",children:d.jsx(_e,{variant:"tertiary",size:"medium",icon:p?{icon:p,position:"left"}:!1,...f,children:h})},`${window.btoa(h)}_${g}`)})})]})})},Em=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const km=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],nd=({activeLink:e})=>{const t=ue.useIntl(),n=D.useContext(Lt),r=n&&typeof n.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[km.map(({key:a,href:i})=>{const s=Em(i,e),o={};return s&&(o["aria-current"]="page"),d.jsx("li",{className:Y(a,{active:s}),children:d.jsx("a",{href:i,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...o,children:t.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),r&&d.jsx("li",{className:"profile","data-testid":"profile-link",children:d.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[d.jsx(Yt,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),d.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},dr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,_m=({title:e,link:t,referrer:n})=>[{key:"linkedin",icon:"social_linkedin",url:`https://www.linkedin.com/shareArticle?mini=true&url=${encodeURIComponent(`${dr(t,"linkedin",n)}&src=linkedin`)}&title=${encodeURIComponent(e)}&source=Apolitical`},{key:"twitter",icon:"social_twitter",url:`https://twitter.com/share?ref_src=twsrc%5Etfw&url=${encodeURIComponent(`${dr(t,"twitter",n)}&src=twitter`)}&text=${encodeURIComponent(e)}&via=${encodeURIComponent("apoliticalco")}`},{key:"facebook",icon:"social_facebook",url:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(`${dr(t,"facebook",n)}`)}&t=${e}`},{key:"email",icon:"share_email",url:`mailto:?subject=${encodeURIComponent(e)}&body=${encodeURIComponent(`${e}
|
|
38
38
|
|
|
39
|
-
${cr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:cr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const km="shareLinks_",_m=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ue.useIntl(),l=Em({title:e,link:t,referrer:n});return c.jsxs("aside",{className:G("share-links",a,i,s),children:[c.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),c.jsx("ul",{children:l.map(({key:u,icon:d,url:h,shouldRender:p=!0,onClick:m})=>{if(typeof p=="function"&&!p())return null;const g={};return m&&(g.onClick=f=>m(f,h)),c.jsx("li",{children:c.jsx(_e,{size:a,variant:"tertiary",icon:{icon:d||u},href:h,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${km}link_${u}`}),...g})},u)})})]})};const Bm=({tabs:e,className:t="",preventLocationChange:n})=>{var p;const r=(m,g,f)=>(m||(m=`panel-${window.btoa(g)}-${f}`),m);let a=e.findIndex(m=>m.current===!0);if(a<0&&(a=0),window.location.hash){const m=window.location.hash.replace("#","");if(e.find(f=>f.id===m)){for(let f=0;f<e.length;f++)if(r(e[f].id,e[f].text,f)===m){a=f;break}}}const[i,s]=D.useState((p=e[a])!=null&&p.id?e[a].id:r(e[a].id,e[a].text,a)),[o,l]=D.useState(""),u=(m,g)=>{switch(m.key){case"ArrowLeft":case"ArrowRight":{m.preventDefault();let f=g;m.key==="ArrowLeft"?g>0?f=g-1:f=e.length-1:m.key==="ArrowRight"&&(g<e.length-1?f=g+1:f=0);const x=r(e[f].id,e[f].text,f),b=document.getElementById(`tab-${x}`);b==null||b.focus(),l(x);break}case"Enter":s(o),window.location.hash=`#${o}`;break}};D.useEffect(()=>{if(e[a].hasCarousel){const m=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(m)}},[i]);const d=[],h=[];return e.forEach(({id:m,text:g,content:f,href:x,hasCarousel:b},_)=>{m=r(m,g,_);const k=i===m,w={};x||(w["aria-controls"]=m,w.onClick=C=>{C.preventDefault(),C.stopPropagation(),s(m),!n&&(window.location.hash=`#${m}`)},h.push(c.jsx("section",{id:m,hidden:!k,role:"tabpanel","aria-labelledby":`tab-${m}`,"aria-live":k?"assertive":"off",children:typeof f=="string"?c.jsx("p",{children:f}):f},`section-${m}`))),d.push(c.jsx("li",{"data-testid":"navigation-tab",children:c.jsx("a",{href:x||`#${m}`,id:`tab-${m}`,"aria-controls":m,className:G({selected:k}),role:"tab",tabIndex:k?0:-1,"aria-selected":k,onKeyDown:C=>u(C,_),...w,children:g})},`tab-${m}`))}),c.jsxs("div",{className:G("tabs-wrapper",t),children:[c.jsx("ul",{className:"tabs",role:"tablist",children:d}),c.jsx("div",{className:"tab-content",children:h})]})};const Am={"2-1":901,"1-3":769,"1-1":769},td=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=er(!0);let s=a;return D.Children.count(a)===1&&(s=D.Children.toArray(a)[0],s.props&&(s=s.props.children)),c.jsx("section",{className:G("columns",`layout-${e}`,r,{"has-containers":n}),children:D.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Am[e]?null:o)})};const Zs=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=ue.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,d=n>t;return c.jsxs(c.Fragment,{children:[c.jsx("small",{id:e,className:G("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":d?"":a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:d?a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"hidden",children:a.formatMessage({id:i})}),n," / ",t]})}),c.jsx(Me,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},Za=e=>(e==null?void 0:e.toString().length)||0,nd=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{Za(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const Vr="emailHelperTextBox_",rd=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=ue.useIntl(),[s,o]=D.useState({path:`${Vr}default`,type:"default",link:{},mail:{},error:""}),[l,u]=D.useState(!1),d=D.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=x=>{o({path:`${Vr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:b=>d(b),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:x})};if(typeof a!="function"){f(i.formatMessage({id:`${Vr}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(x=>{f(x.message)}).finally(()=>{u(!1)})},[n,r,a]);D.useEffect(()=>{let g=Vr,f="default",x={},b={};switch(t){case"gov":g+="autoApproved",f="success";break;case"nonGov":g+="unrecognisedEmail",f="error",x={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":g+="pendingApproval",f="error",b={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":g+="emailUnverified",f="error",x={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:_=>d(_),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",x={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},b={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",x={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:g,type:f,link:x,mail:b})},[t]);const h={};return["link","mail"].forEach(g=>{h[g]=Object.keys(s[g]).length?f=>c.jsx("a",{...s[g],children:f}):f=>f}),c.jsx(qc,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),children:l?c.jsxs(c.Fragment,{children:[c.jsx(Et,{element:"span"}),c.jsx(Et,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...h,strong:g=>c.jsx("strong",{children:g}),em:g=>c.jsx("em",{children:g}),br:c.jsxs(c.Fragment,{children:[c.jsx("br",{}),c.jsx("br",{})]}),error:s.error})})},In=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,autoFocus:u,...d})=>{const h=D.useRef(),p=r||h;return D.useEffect(()=>{var m;u&&((m=p.current)==null||m.focus())},[]),!(d!=null&&d.autoComplete)&&["email"].includes(o)&&(d.autoComplete="email"),D.createElement(t,{ref:p,...d,type:o,id:n,name:i,className:G(e,t,{"has-scrollbar":o==="textarea"&&p.current&&p.current.clientHeight<p.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:m=>{const g=m.target;a.onChange(g.value)}})};const jn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Fm=500,Tm=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:d},h]=D.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:m,isPredictionSelected:g},f]=D.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:x}=ue.useIntl();r||(r=x({id:"inputAutocomplete_placeholder"})),D.useEffect(()=>{const w=setTimeout(()=>{g||h(C=>({...C,debouncedInput:l}))},Fm);return()=>{clearTimeout(w)}},[l,g]),D.useEffect(()=>{d&&!g?(async()=>{try{const C=await o(d)||[];f(F=>({...F,predictions:C}))}catch(C){console.error("Error fetching predictions:",C),f(F=>({...F,predictions:[]}))}})():f(w=>({...w,predictions:[]}))},[d,g]),D.useEffect(()=>{m>=0&&p[m]&&h(w=>({...w,displayInput:p[m].description}))},[m,p]);const b=w=>{[jn.DOWN,jn.UP,jn.ENTER].includes(w.key)&&(w.preventDefault(),w.key===jn.DOWN&&m<p.length-1?f(C=>({...C,activePredictionIndex:m+1})):w.key===jn.UP&&m>0?f(C=>({...C,activePredictionIndex:m-1})):w.key===jn.ENTER&&m>-1&&(s(p[m].description),h(C=>({...C,input:p[m].description})),f(C=>({...C,predictions:[],isPredictionSelected:!0}))))},_=w=>{s(w.target.value),h(C=>({...C,input:w.target.value,displayInput:w.target.value})),f(C=>({...C,activePredictionIndex:-1,isPredictionSelected:!1}))},k=w=>{s(w.description),h(C=>({...C,input:w.description,displayInput:w.description})),f(C=>({...C,isPredictionSelected:!0,predictions:[]}))};return c.jsxs(c.Fragment,{children:[c.jsx("input",{type:"text",value:u,onChange:_,onKeyDown:b,placeholder:r,name:t,id:e,...i}),c.jsx("ul",{className:"predictions-list",children:p.map((w,C)=>c.jsx("li",{onClick:()=>k(w),onMouseEnter:()=>f(F=>({...F,activePredictionIndex:C})),className:G("predictions-list-item",{active:C===m}),children:w.description},C))})]})};const ad=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:d,...h})=>{const p=ue.useIntl(),{onChange:m,...g}=r,f=()=>{t||m(d?null:l)},x=c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:d,onKeyDown:b=>{(b.key==="Enter"||b.code==="Space")&&(b.preventDefault(),b.stopPropagation(),f())},readOnly:!0,disabled:t}),c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("label",{htmlFor:a,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return D.createElement(n,{onClick:b=>{const _=b.target;_.nodeName.toLowerCase()==="a"||_.parentNode&&_.parentNode.nodeName.toLowerCase()==="a"||(b.preventDefault(),b.stopPropagation(),f())},className:G("checkbox-wrapper",e),...h,...g},x)};const Sm=D.memo(function({direction:t="down"}){return c.jsx(qa,{className:G("rotating-chevron",`direction-${t}`)})});const jm=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const d=ue.useIntl(),[h,p]=D.useState(!1),m=r||n,g=Array.isArray(m)?[...m]:m?[m]:[],[f,x]=D.useState(g);let b;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?b=t&&f?t.find(S=>S.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?b=f[0]:b={id:"",label:""},D.useEffect(()=>{x(g)},[r,n]);const{onChange:_,onMultiSelectSubmit:k,...w}=a,C=S=>{if(o){let z=[];f!=null&&f.includes(S.id)?z=f.filter(N=>N!==S.id):z=[...f,S.id],x([...z]),_&&_([...z])}else x([S]),_&&_(S.id),p(!1)},F=S=>{if(S==="all"){const z=(t==null?void 0:t.map(N=>N.id))||[];x(z),_&&_(z)}else x([]),_&&_([])};return c.jsxs("div",{className:G("dropdown-wrapper",e),children:[c.jsxs("button",{className:"input","aria-expanded":h,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),p(!h)},"data-testid":"dropdown-selector",...w,children:[o?`${s} · ${f.length}`:b.label,c.jsx(Sm,{direction:h?"up":"down"})]}),c.jsx("select",{defaultValue:b.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const z=t&&t.find(N=>N.id===S.target.value);C(z)},hidden:!h,...w,children:t==null?void 0:t.map(S=>c.jsx("option",{value:S.id,children:S.label},S.id))}),c.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!h,children:[c.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&c.jsxs("div",{className:"action-bar",children:[c.jsx("p",{children:`${f==null?void 0:f.length} selected`}),c.jsxs("ul",{children:[c.jsx("li",{children:c.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>F("all"),className:"gtm-trackable",children:d.formatMessage({id:"dropdown_menu_multiselect_all"})})}),c.jsx("li",{children:c.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>F("none"),className:"gtm-trackable",children:d.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),c.jsx("ul",{children:t==null?void 0:t.map(S=>{const z=S.id===b.id||(f==null?void 0:f.includes(S))||(f==null?void 0:f.includes(S.id));return c.jsx("li",{"data-testid":"dropdown-options",children:c.jsxs("button",{className:G("gtm-trackable",{selected:z,"selected-single":z&&!o}),"data-gtm-event-type":`${S}-click`,"data-gtm-event-context":i,onClick:N=>{N.preventDefault(),N.stopPropagation(),C(S)},role:"menuitem","aria-current":z,"data-testid":z?"current-selection":"",children:[o&&c.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),c.jsx("span",{className:G({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&c.jsx("p",{className:"submit",children:c.jsx(_e,{variant:"secondary",onClick:()=>{k&&k(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),p(!1)},children:d.formatMessage({id:"form_submit"})})})]})]})};const Om=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:d,...h})=>{const p=ue.useIntl(),m=i?d:[],g=d;return c.jsx("ul",{...h,className:G("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:f,label:x=!1,value:b=f,disabled:_=!1})=>{const k=`${r}_${f}`,w=()=>{if(_)return;let C;if(i){const F=m==null?void 0:m.indexOf(b);Array.isArray(m)&&F>=0?(C=m,C.splice(F,1)):(!m||m.length===0?C=[]:C=m,C.push(b))}else C=g===b?void 0:b;t.onChange(C)};return c.jsx(ad,{element:"li",id:k,type:u==="checkboxes"?"checkbox":"radio",shownValue:b,value:i?m==null?void 0:m.includes(b):g===b,functions:{...t,onChange:w},intlPath:n,label:x||p.formatMessage({id:n?`${n}_${f}`:f}),disabled:_},k)})})};const Pm=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=ue.useIntl(),s=D.useRef(),o=e||s,[l,u]=D.useState(!1),[d,h]=D.useState(t),p=()=>{var m;u(!l),h(l?"password":"text"),(m=o.current)==null||m.focus()};return c.jsxs(c.Fragment,{children:[c.jsx("button",{type:"button",className:G("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:p,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),c.jsx(In,{inputRef:o,type:d,autoComplete:r,...a})]})};const On={text:{component:In},email:{component:In},url:{component:In},textarea:{component:In,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:ad},checkboxes:{component:Om,props:{multiSelect:!0}},select:{component:jm},password:{component:Pm},autocomplete:{component:Tm}},Nm=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:d,...h})=>{const p=ue.useIntl(),m=l&&l.some(({condition:N})=>N==="required"),g=Za(u),f=o&&On[o]&&On[o].component?On[o].component:In,x=o&&["checkboxes"].includes(o),b=r&&`error-${e}`,_=`character-limit-${e}`,k={};x?k.element="legend":k.htmlFor=e;let w={...h,id:e,name:e,className:r?"error":"",type:o,required:m,"aria-required":m,functions:gn(a),value:u};const C=N=>{w["aria-describedby"]?w["aria-describedby"]+=` ${N}`:w["aria-describedby"]=N};if(i>0){const N=nd(i,a.onChange);C(`${_}-info`),w={...w,...N},N.functions&&typeof N.functions=="object"&&(w.functions={...w.functions,...N.functions})}o&&On[o]&&On[o].props&&(w={...w,...On[o].props}),x&&(w.intlPath=`${t}_${e}`),r&&(w["aria-invalid"]=!0,w["aria-errormessage"]=b,C(b));const F=h.label||p.formatMessage({id:t?`${t}_${e}`:e}),S=({...N})=>r?D.createElement(N.as||"p",{id:b,className:"error text-small",...N},r):null;if(o&&["checkbox"].includes(o))return c.jsxs(c.Fragment,{children:[c.jsx(f,{...w,label:F,className:G("field-wrapper",n)}),c.jsx(S,{as:"p"})]});const z=N=>D.createElement(N.element||"label",{...N,className:"checkboxes-label text-small","data-testid":`label-${e}`});return c.jsx(c.Fragment,{children:D.createElement(x?"fieldset":"div",{className:G("field-wrapper text-medium",n)},c.jsxs(c.Fragment,{children:[D.createElement(x?"div":"p",{className:"field-label"},c.jsx(c.Fragment,{children:c.jsxs(z,{...k,children:[F,m&&s&&c.jsxs(c.Fragment,{children:[" ",c.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})})),D.createElement(x?"div":"p",{className:"field-component"},c.jsxs(c.Fragment,{children:[c.jsx(f,{...w}),c.jsx(Zs,{id:_,limit:i,valueLength:g})]})),c.jsx(S,{})]}))})},Rm=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?gn(e.errors):{},i=e.values?gn(e.values):{};switch(n){case"toggleSubmitting":return{...e,isSubmitting:!e.isSubmitting};case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:d}=r,h=gn(Object.keys(a));for(const p of s)if(p.validation)for(let m=0;m<p.validation.length;m++){const{condition:g="required",error:f=!1}=p.validation[m];let x=!1;if(typeof g=="function"){const b=g(i);b&&(x=f||b)}else{const b=i[p.id];switch(g){case"required":(!b||typeof b=="string"&&b.trim().length===0)&&(x=f||(d==null?void 0:d.formatMessage({id:"form_error_required"})));break;case"no-numbers":{b&&!/^([^0-9]*)$/.test(b)&&(x=f||(d==null?void 0:d.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)&&(x=f||(d==null?void 0:d.formatMessage({id:"form_error_email"})));break}case"valid-url":{b&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(b)&&(x=f||(d==null?void 0:d.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(x){o({type:"addError",payload:{key:p.id,value:x}}),h.push(p.id);break}}return h.length===0?l(i):u(i,h),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let fi=null;const An=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:d={context:"Form",event:"form-submit-click"},functions:{onSuccess:h=async()=>{},onCancel:p=()=>{},onCatch:m=()=>{},onFailure:g=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...f})=>{const{customOnSubmit:x,hideButton:b,overwriteSubmittingText:_=!1,...k}=s,w=40,{shouldShowCancelButton:C=!1,shouldReset:F=!0,shouldHide:S=!0,showRequiredLabels:z=!0,showSuccessMessage:N=!1}=l||{},$=ue.useIntl(),L={};t.length&&t.forEach(T=>{const R=T.id||T.name;R&&(L[R]=T.value||"")});const[E,A]=D.useReducer(Rm,{isSubmitting:!1,formSubmitted:!1,errors:{},values:L}),{errors:j,isSubmitting:I,formSubmitted:H,values:q}=E;D.useEffect(()=>{F&&H&&(fi=setTimeout(()=>{A({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[H]),D.useEffect(()=>()=>{fi&&clearTimeout(fi)},[]),D.useEffect(()=>{const T=R=>{A({type:"updateValue",payload:{key:R.detail.id,value:R.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",T),()=>{document.removeEventListener("dropdownMultiSelectSubmit",T)}},[]);const re=D.useRef(null),ne=a||re;if(!t.length)return null;let v=k.text;v||(v=s.children||$.formatMessage({id:"form_submit"})),delete k.text;const W=()=>{if(!I){if(A({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&A({type:"submitForm",payload:{fields:t,dispatch:A,intl:$}});return}A({type:"submitForm",payload:{fields:t,dispatch:A,onSuccess:async T=>{try{await h(T),A({type:F?"formSubmittedAndReset":"formSubmitted"})}catch(R){m(R),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(T,R)=>{g(T,R),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:$}})}},B=[{...k,icon:H?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:T=>{var K;if(T.preventDefault(),T.stopPropagation(),I)return;let R=0;if((K=ne==null?void 0:ne.current)!=null&&K.id){const ee=document.getElementById(ne.current.id);ee&&(R=ee.getBoundingClientRect().top+window.scrollY)}const M=document.getElementById("header");M&&(R=R-M.offsetHeight-w),R<0&&(R=0),window.scrollTo({top:R,behavior:"smooth"}),W()},disabled:I||H||s.disabled,"data-gtm-event-context":d.context,"data-gtm-event-type":d.event,children:_?v:I||H?$.formatMessage({id:`form_${I?"submitting":"submitted"}`}):v}];return C&&B.unshift({...o,className:"gtm-trackable","data-gtm-event-context":d.context,"data-gtm-event-type":d.event,disabled:I||H,onClick:p,children:o.text||$.formatMessage({id:"form_cancel"})}),c.jsxs(c.Fragment,{children:[D.createElement(e,{...f,id:r,className:G("form",n),ref:ne},c.jsxs(c.Fragment,{children:[j!=null&&j.general?c.jsx(on,{variant:"error",text:$.formatMessage({id:"form_error_generalError"})}):null,u,(!S||!I&&!H||x)&&t.map((T,R)=>{const{id:M=T.name||R,component:K,functions:ee={onChange:()=>{}},submitOnEnter:te=!1}=T;if(K)return c.jsx(K,{...T.props||{}},`component-${M}-${R}`);const ae=(q==null?void 0:q[M])||"",le={...ee,onChange:J=>{A({type:"updateValue",payload:{key:M,value:J}}),ee.onChange(J&&J.toString(),A)}};return te&&(le.onKeyDown=J=>{J.key==="Enter"&&(J.stopPropagation(),J.preventDefault(),W()),ee.onKeyDown&&ee.onKeyDown(J)}),c.jsx(Nm,{intlPath:i,...T,showRequiredLabels:z,value:ae,error:j==null?void 0:j[M],functions:le},M)}),b?null:(I||H)&&x?x:c.jsx(nr,{className:G("cta",{center:I||H,submitted:H}),buttons:B})]})),N&&H&&c.jsx(Br,{className:"success",children:typeof N=="string"?N:$.formatMessage({id:"form_success"})})]})};const Kr="passwordRules_",id="isMoreThanEightCharacters",sd="includesNumberAndSymbol",od="includesLowerAndUppercase",Mm={[id]:"8Characters",[sd]:"numberSymbol",[od]:"lowercaseUppercase"},Im=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ue.useIntl();return c.jsxs("aside",{className:G("password-rules",t),children:[c.jsx("small",{children:n.formatMessage({id:`${Kr}intro`})}),c.jsx("ul",{children:[id,sd,od].map(r=>c.jsxs("li",{className:G({matches:e[r]}),children:[c.jsxs(Me,{children:[n.formatMessage({id:`${Kr}rule_label`})," "]}),c.jsx("span",{children:n.formatMessage({id:`${Kr}rule_${Mm[r]}`})}),!e[r]&&c.jsxs(Me,{element:"strong",children:[" ",n.formatMessage({id:`${Kr}notMet`})]})]},`rule-${r}`))})]})},ud=D.memo(Im);const $m=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ue.useIntl(),[l,u]=D.useState({setUp:!1,id:null,rating:null,disabled:!0}),d=async()=>{try{const b=await n();u(_=>({..._,setUp:!0,id:b&&b.id,disabled:!1}))}catch(b){u(_=>({..._,setUp:!0,disabled:!0})),a(b)}};if(D.useEffect(()=>{s&&!l.setUp&&d()},[s]),!s)return c.jsx(Et,{className:"rating-placeholder"});const{id:h,rating:p,disabled:m}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},x=async b=>{if(!(!h||m))try{u(_=>({..._,rating:b,disabled:!0})),await r({id:h,value:b})}catch(_){u(k=>({...k,rating:null})),a(_)}finally{u(_=>({..._,disabled:!1}))}};return c.jsxs("div",{className:G("rating",i),children:[c.jsx("span",{className:"label",children:f[p?"success":"text"]}),c.jsx("ol",{children:Array.from(new Array(t).keys()).map(b=>{const _=b+1;return c.jsx("li",{className:G({selected:p&&_<=p}),children:c.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:`star${!p||_>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:_,total:t})}${_===1||_===t?` - ${f[_===1?"low":"high"]}`:""}`,onClick:k=>{k.preventDefault(),k.stopPropagation(),x(_)},disabled:m})},`rating-${_}`)})})]})};function Lm(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 fs(e,t){return Array(t+1).join(e)}function zm(e){return e.replace(/^\n*/,"")}function qm(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
40
|
-
`;)t--;return e.substring(0,t)}var
|
|
39
|
+
${dr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:dr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const Bm="shareLinks_",Am=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ue.useIntl(),l=_m({title:e,link:t,referrer:n});return d.jsxs("aside",{className:Y("share-links",a,i,s),children:[d.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),d.jsx("ul",{children:l.map(({key:u,icon:c,url:h,shouldRender:p=!0,onClick:m})=>{if(typeof p=="function"&&!p())return null;const g={};return m&&(g.onClick=f=>m(f,h)),d.jsx("li",{children:d.jsx(_e,{size:a,variant:"tertiary",icon:{icon:c||u},href:h,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${Bm}link_${u}`}),...g})},u)})})]})};const Fm=({tabs:e,className:t="",preventLocationChange:n})=>{var p;const r=(m,g,f)=>(m||(m=`panel-${window.btoa(g)}-${f}`),m);let a=e.findIndex(m=>m.current===!0);if(a<0&&(a=0),window.location.hash){const m=window.location.hash.replace("#","");if(e.find(f=>f.id===m)){for(let f=0;f<e.length;f++)if(r(e[f].id,e[f].text,f)===m){a=f;break}}}const[i,s]=D.useState((p=e[a])!=null&&p.id?e[a].id:r(e[a].id,e[a].text,a)),[o,l]=D.useState(""),u=(m,g)=>{switch(m.key){case"ArrowLeft":case"ArrowRight":{m.preventDefault();let f=g;m.key==="ArrowLeft"?g>0?f=g-1:f=e.length-1:m.key==="ArrowRight"&&(g<e.length-1?f=g+1:f=0);const y=r(e[f].id,e[f].text,f),v=document.getElementById(`tab-${y}`);v==null||v.focus(),l(y);break}case"Enter":s(o),window.location.hash=`#${o}`;break}};D.useEffect(()=>{if(e[a].hasCarousel){const m=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(m)}},[i]);const c=[],h=[];return e.forEach(({id:m,text:g,content:f,href:y,hasCarousel:v},k)=>{m=r(m,g,k);const B=i===m,C={};y||(C["aria-controls"]=m,C.onClick=w=>{w.preventDefault(),w.stopPropagation(),s(m),!n&&(window.location.hash=`#${m}`)},h.push(d.jsx("section",{id:m,hidden:!B,role:"tabpanel","aria-labelledby":`tab-${m}`,"aria-live":B?"assertive":"off",children:typeof f=="string"?d.jsx("p",{children:f}):f},`section-${m}`))),c.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:y||`#${m}`,id:`tab-${m}`,"aria-controls":m,className:Y({selected:B}),role:"tab",tabIndex:B?0:-1,"aria-selected":B,onKeyDown:w=>u(w,k),...C,children:g})},`tab-${m}`))}),d.jsxs("div",{className:Y("tabs-wrapper",t),children:[d.jsx("ul",{className:"tabs",role:"tablist",children:c}),d.jsx("div",{className:"tab-content",children:h})]})};const Tm={"2-1":901,"1-3":769,"1-1":769},rd=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=tr(!0);let s=a;return D.Children.count(a)===1&&(s=D.Children.toArray(a)[0],s.props&&(s=s.props.children)),d.jsx("section",{className:Y("columns",`layout-${e}`,r,{"has-containers":n}),children:D.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Tm[e]?null:o)})};const Ys=({id:e="character-limit",limit:t,valueLength:n,...r})=>{const a=ue.useIntl(),i="form_fieldWrapper_characterLimit";if(t===0)return null;const s=t-n,o=Math.abs(n-t),l=n>=.99*t,u=n>=.9*t&&n<.99*t,c=n>t;return d.jsxs(d.Fragment,{children:[d.jsx("small",{id:e,className:Y("character-limit",{"near-limit":l,"approaching-limit":u}),"aria-live":"polite","aria-label":c?"":a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}),children:c?a.formatMessage({id:`${i}_aria_${s<0?"over":"default"}`},{remaining:s,over:o,limit:t}):d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"hidden",children:a.formatMessage({id:i})}),n," / ",t]})}),d.jsx(Ie,{showOnFocus:!1,id:`${e}-info`,children:a.formatMessage({id:`${i}_info`},{limit:t})})]})},Ya=e=>(e==null?void 0:e.toString().length)||0,ad=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{Ya(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const Zr="emailHelperTextBox_",id=({id:e="email-helper-textbox",type:t,email:n,redirectPath:r,resendVerificationCode:a})=>{const i=ue.useIntl(),[s,o]=D.useState({path:`${Zr}default`,type:"default",link:{},mail:{},error:""}),[l,u]=D.useState(!1),c=D.useCallback(g=>{g.preventDefault(),g.stopPropagation();const f=y=>{o({path:`${Zr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>c(v),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:y})};if(typeof a!="function"){f(i.formatMessage({id:`${Zr}error_noFunction`}));return}u(!0),a(n).then(()=>{localStorage.setItem("email",n),window.location.href=r||"/signup/verify-email"}).catch(y=>{f(y.message)}).finally(()=>{u(!1)})},[n,r,a]);D.useEffect(()=>{let g=Zr,f="default",y={},v={};switch(t){case"gov":g+="autoApproved",f="success";break;case"nonGov":g+="unrecognisedEmail",f="error",y={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":g+="pendingApproval",f="error",v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":g+="emailUnverified",f="error",y={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:k=>c(k),"data-testid":"send-verify-email-click"};break;case"exists":g+="emailAlreadyExists",f="error",y={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},v={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:g+="default",y={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}o({...s,path:g,type:f,link:y,mail:v})},[t]);const h={};return["link","mail"].forEach(g=>{h[g]=Object.keys(s[g]).length?f=>d.jsx("a",{...s[g],children:f}):f=>f}),d.jsx(Hc,{id:e,type:s.type,heading:l?!1:i.formatMessage({id:`${s.path}_title`}),children:l?d.jsxs(d.Fragment,{children:[d.jsx(kt,{element:"span"}),d.jsx(kt,{element:"span"})]}):i.formatMessage({id:`${s.path}_text`},{...h,strong:g=>d.jsx("strong",{children:g}),em:g=>d.jsx("em",{children:g}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:s.error})})},Ln=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,autoFocus:u,...c})=>{const h=D.useRef(),p=r||h;return D.useEffect(()=>{var m;u&&((m=p.current)==null||m.focus())},[]),!(c!=null&&c.autoComplete)&&["email"].includes(o)&&(c.autoComplete="email"),D.createElement(t,{ref:p,...c,type:o,id:n,name:i,className:Y(e,t,{"has-scrollbar":o==="textarea"&&p.current&&p.current.clientHeight<p.current.scrollHeight}),value:l,placeholder:s,autoFocus:u,...a,onChange:m=>{const g=m.target;a.onChange(g.value)}})};const Pn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Sm=500,jm=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:c},h]=D.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:p,activePredictionIndex:m,isPredictionSelected:g},f]=D.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:y}=ue.useIntl();r||(r=y({id:"inputAutocomplete_placeholder"})),D.useEffect(()=>{const C=setTimeout(()=>{g||h(w=>({...w,debouncedInput:l}))},Sm);return()=>{clearTimeout(C)}},[l,g]),D.useEffect(()=>{c&&!g?(async()=>{try{const w=await o(c)||[];f(T=>({...T,predictions:w}))}catch(w){console.error("Error fetching predictions:",w),f(T=>({...T,predictions:[]}))}})():f(C=>({...C,predictions:[]}))},[c,g]),D.useEffect(()=>{m>=0&&p[m]&&h(C=>({...C,displayInput:p[m].description}))},[m,p]);const v=C=>{[Pn.DOWN,Pn.UP,Pn.ENTER].includes(C.key)&&(C.preventDefault(),C.key===Pn.DOWN&&m<p.length-1?f(w=>({...w,activePredictionIndex:m+1})):C.key===Pn.UP&&m>0?f(w=>({...w,activePredictionIndex:m-1})):C.key===Pn.ENTER&&m>-1&&(s(p[m].description),h(w=>({...w,input:p[m].description})),f(w=>({...w,predictions:[],isPredictionSelected:!0}))))},k=C=>{s(C.target.value),h(w=>({...w,input:C.target.value,displayInput:C.target.value})),f(w=>({...w,activePredictionIndex:-1,isPredictionSelected:!1}))},B=C=>{s(C.description),h(w=>({...w,input:C.description,displayInput:C.description})),f(w=>({...w,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:k,onKeyDown:v,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:p.map((C,w)=>d.jsx("li",{onClick:()=>B(C),onMouseEnter:()=>f(T=>({...T,activePredictionIndex:w})),className:Y("predictions-list-item",{active:w===m}),children:C.description},w))})]})};const sd=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:c,...h})=>{const p=ue.useIntl(),{onChange:m,...g}=r,f=()=>{t||m(c?null:l)},y=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),f())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||p.formatMessage({id:s?`${s}_${a}`:a})})]});return D.createElement(n,{onClick:v=>{const k=v.target;k.nodeName.toLowerCase()==="a"||k.parentNode&&k.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),f())},className:Y("checkbox-wrapper",e),...h,...g},y)};const Om=D.memo(function({direction:t="down"}){return d.jsx(Wa,{className:Y("rotating-chevron",`direction-${t}`)})});const Pm=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const c=ue.useIntl(),[h,p]=D.useState(!1),m=r||n,g=Array.isArray(m)?[...m]:m?[m]:[],[f,y]=D.useState(g);let v;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?v=t&&f?t.find(S=>S.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?v=f[0]:v={id:"",label:""},D.useEffect(()=>{y(g)},[r,n]);const{onChange:k,onMultiSelectSubmit:B,...C}=a,w=S=>{if(o){let q=[];f!=null&&f.includes(S.id)?q=f.filter(P=>P!==S.id):q=[...f,S.id],y([...q]),k&&k([...q])}else y([S]),k&&k(S.id),p(!1)},T=S=>{if(S==="all"){const q=(t==null?void 0:t.map(P=>P.id))||[];y(q),k&&k(q)}else y([]),k&&k([])};return d.jsxs("div",{className:Y("dropdown-wrapper",e),children:[d.jsxs("button",{className:"input","aria-expanded":h,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),p(!h)},"data-testid":"dropdown-selector",...C,children:[o?`${s} · ${f.length}`:v.label,d.jsx(Om,{direction:h?"up":"down"})]}),d.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const q=t&&t.find(P=>P.id===S.target.value);w(q)},hidden:!h,...C,children:t==null?void 0:t.map(S=>d.jsx("option",{value:S.id,children:S.label},S.id))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!h,children:[d.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&d.jsxs("div",{className:"action-bar",children:[d.jsx("p",{children:`${f==null?void 0:f.length} selected`}),d.jsxs("ul",{children:[d.jsx("li",{children:d.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>T("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(_e,{variant:"tertiary",size:"small",onClick:()=>T("none"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(S=>{const q=S.id===v.id||(f==null?void 0:f.includes(S))||(f==null?void 0:f.includes(S.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:Y("gtm-trackable",{selected:q,"selected-single":q&&!o}),"data-gtm-event-type":`${S}-click`,"data-gtm-event-context":i,onClick:P=>{P.preventDefault(),P.stopPropagation(),w(S)},role:"menuitem","aria-current":q,"data-testid":q?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:Y({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(_e,{variant:"secondary",onClick:()=>{B&&B(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),p(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const Nm=({className:e="",functions:t={onChange:()=>{}},intlPath:n=!1,id:r,label:a,multiSelect:i=!1,name:s,options:o,required:l,type:u="checkboxes",value:c,...h})=>{const p=ue.useIntl(),m=i?c:[],g=c;return d.jsx("ul",{...h,className:Y("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:f,label:y=!1,value:v=f,disabled:k=!1})=>{const B=`${r}_${f}`,C=()=>{if(k)return;let w;if(i){const T=m==null?void 0:m.indexOf(v);Array.isArray(m)&&T>=0?(w=m,w.splice(T,1)):(!m||m.length===0?w=[]:w=m,w.push(v))}else w=g===v?void 0:v;t.onChange(w)};return d.jsx(sd,{element:"li",id:B,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?m==null?void 0:m.includes(v):g===v,functions:{...t,onChange:C},intlPath:n,label:y||p.formatMessage({id:n?`${n}_${f}`:f}),disabled:k},B)})})};const Rm=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},autoComplete:r="on",...a})=>{const i=ue.useIntl(),s=D.useRef(),o=e||s,[l,u]=D.useState(!1),[c,h]=D.useState(t),p=()=>{var m;u(!l),h(l?"password":"text"),(m=o.current)==null||m.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:Y("show-password gtm-trackable",{"password-visible":l}),"data-gtm-event-context":n,"data-gtm-event-type":`${l?"hide":"show"}-password-click`,onClick:p,"aria-label":i.formatMessage({id:`showpassword_aria_${l?"hide":"show"}`}),children:i.formatMessage({id:`showpassword_${l?"hide":"show"}`})}),d.jsx(Ln,{inputRef:o,type:c,autoComplete:r,...a})]})};const Nn={text:{component:Ln},email:{component:Ln},url:{component:Ln},textarea:{component:Ln,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:sd},checkboxes:{component:Nm,props:{multiSelect:!0}},select:{component:Pm},password:{component:Rm},autocomplete:{component:jm}},Mm=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:c,...h})=>{const p=ue.useIntl(),m=l&&l.some(({condition:P})=>P==="required"),g=Ya(u),f=o&&Nn[o]&&Nn[o].component?Nn[o].component:Ln,y=o&&["checkboxes"].includes(o),v=r&&`error-${e}`,k=`character-limit-${e}`,B={};y?B.element="legend":B.htmlFor=e;let C={...h,id:e,name:e,className:r?"error":"",type:o,required:m,"aria-required":m,functions:vn(a),value:u};const w=P=>{C["aria-describedby"]?C["aria-describedby"]+=` ${P}`:C["aria-describedby"]=P};if(i>0){const P=ad(i,a.onChange);w(`${k}-info`),C={...C,...P},P.functions&&typeof P.functions=="object"&&(C.functions={...C.functions,...P.functions})}o&&Nn[o]&&Nn[o].props&&(C={...C,...Nn[o].props}),y&&(C.intlPath=`${t}_${e}`),r&&(C["aria-invalid"]=!0,C["aria-errormessage"]=v,w(v));const T=h.label||p.formatMessage({id:t?`${t}_${e}`:e}),S=({...P})=>r?D.createElement(P.as||"p",{id:v,className:"error text-small",...P},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(f,{...C,label:T,className:Y("field-wrapper",n)}),d.jsx(S,{as:"p"})]});const q=P=>D.createElement(P.element||"label",{...P,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsx(d.Fragment,{children:D.createElement(y?"fieldset":"div",{className:Y("field-wrapper text-medium",n)},d.jsxs(d.Fragment,{children:[D.createElement(y?"div":"p",{className:"field-label"},d.jsx(d.Fragment,{children:d.jsxs(q,{...B,children:[T,m&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",p.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})})),D.createElement(y?"div":"p",{className:"field-component"},d.jsxs(d.Fragment,{children:[d.jsx(f,{...C}),d.jsx(Ys,{id:k,limit:i,valueLength:g})]})),d.jsx(S,{})]}))})},Im=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?vn(e.errors):{},i=e.values?vn(e.values):{};switch(n){case"toggleSubmitting":return{...e,isSubmitting:!e.isSubmitting};case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:c}=r,h=vn(Object.keys(a));for(const p of s)if(p.validation)for(let m=0;m<p.validation.length;m++){const{condition:g="required",error:f=!1}=p.validation[m];let y=!1;if(typeof g=="function"){const v=g(i);v&&(y=f||v)}else{const v=i[p.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(y){o({type:"addError",payload:{key:p.id,value:y}}),h.push(p.id);break}}return h.length===0?l(i):u(i,h),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let hi=null;const Tn=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,children:u,gtm:c={context:"Form",event:"form-submit-click"},functions:{onSuccess:h=async()=>{},onCancel:p=()=>{},onCatch:m=()=>{},onFailure:g=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...f})=>{const{customOnSubmit:y,hideButton:v,overwriteSubmittingText:k=!1,...B}=s,C=40,{shouldShowCancelButton:w=!1,shouldReset:T=!0,shouldHide:S=!0,showRequiredLabels:q=!0,showSuccessMessage:P=!1}=l||{},L=ue.useIntl(),z={};t.length&&t.forEach(F=>{const I=F.id||F.name;I&&(z[I]=F.value||"")});const[E,A]=D.useReducer(Im,{isSubmitting:!1,formSubmitted:!1,errors:{},values:z}),{errors:N,isSubmitting:R,formSubmitted:H,values:G}=E;D.useEffect(()=>{T&&H&&(hi=setTimeout(()=>{A({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[H]),D.useEffect(()=>()=>{hi&&clearTimeout(hi)},[]),D.useEffect(()=>{const F=I=>{A({type:"updateValue",payload:{key:I.detail.id,value:I.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",F),()=>{document.removeEventListener("dropdownMultiSelectSubmit",F)}},[]);const Q=D.useRef(null),re=a||Q;if(!t.length)return null;let x=B.text;x||(x=s.children||L.formatMessage({id:"form_submit"})),delete B.text;const $=()=>{if(!R){if(A({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&A({type:"submitForm",payload:{fields:t,dispatch:A,intl:L}});return}A({type:"submitForm",payload:{fields:t,dispatch:A,onSuccess:async F=>{try{await h(F),A({type:T?"formSubmittedAndReset":"formSubmitted"})}catch(I){m(I),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(F,I)=>{g(F,I),A({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:L}})}},_=[{...B,icon:H?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:F=>{var V;if(F.preventDefault(),F.stopPropagation(),R)return;let I=0;if((V=re==null?void 0:re.current)!=null&&V.id){const ne=document.getElementById(re.current.id);ne&&(I=ne.getBoundingClientRect().top+window.scrollY)}const M=document.getElementById("header");M&&(I=I-M.offsetHeight-C),I<0&&(I=0),window.scrollTo({top:I,behavior:"smooth"}),$()},disabled:R||H||s.disabled,"data-gtm-event-context":c.context,"data-gtm-event-type":c.event,children:k?x:R||H?L.formatMessage({id:`form_${R?"submitting":"submitted"}`}):x}];return w&&_.unshift({...o,className:"gtm-trackable","data-gtm-event-context":c.context,"data-gtm-event-type":c.event,disabled:R||H,onClick:p,children:o.text||L.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[D.createElement(e,{...f,id:r,className:Y("form",n),ref:re},d.jsxs(d.Fragment,{children:[N!=null&&N.general?d.jsx(un,{variant:"error",text:L.formatMessage({id:"form_error_generalError"})}):null,u,(!S||!R&&!H||y)&&t.map((F,I)=>{const{id:M=F.name||I,component:V,functions:ne={onChange:()=>{}},submitOnEnter:te=!1}=F;if(V)return d.jsx(V,{...F.props||{}},`component-${M}-${I}`);const ae=(G==null?void 0:G[M])||"",le={...ne,onChange:J=>{A({type:"updateValue",payload:{key:M,value:J}}),ne.onChange(J&&J.toString(),A)}};return te&&(le.onKeyDown=J=>{J.key==="Enter"&&(J.stopPropagation(),J.preventDefault(),$()),ne.onKeyDown&&ne.onKeyDown(J)}),d.jsx(Mm,{intlPath:i,...F,showRequiredLabels:q,value:ae,error:N==null?void 0:N[M],functions:le},M)}),v?null:(R||H)&&y?y:d.jsx(rr,{className:Y("cta",{center:R||H,submitted:H}),buttons:_})]})),P&&H&&d.jsx(Ar,{className:"success",children:typeof P=="string"?P:L.formatMessage({id:"form_success"})})]})};const Yr="passwordRules_",od="isMoreThanEightCharacters",ud="includesNumberAndSymbol",ld="includesLowerAndUppercase",$m={[od]:"8Characters",[ud]:"numberSymbol",[ld]:"lowercaseUppercase"},Lm=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=ue.useIntl();return d.jsxs("aside",{className:Y("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${Yr}intro`})}),d.jsx("ul",{children:[od,ud,ld].map(r=>d.jsxs("li",{className:Y({matches:e[r]}),children:[d.jsxs(Ie,{children:[n.formatMessage({id:`${Yr}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${Yr}rule_${$m[r]}`})}),!e[r]&&d.jsxs(Ie,{element:"strong",children:[" ",n.formatMessage({id:`${Yr}notMet`})]})]},`rule-${r}`))})]})},cd=D.memo(Lm);const zm=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ue.useIntl(),[l,u]=D.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const v=await n();u(k=>({...k,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(k=>({...k,setUp:!0,disabled:!0})),a(v)}};if(D.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(kt,{className:"rating-placeholder"});const{id:h,rating:p,disabled:m}=l,g="ratings_",f={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},y=async v=>{if(!(!h||m))try{u(k=>({...k,rating:v,disabled:!0})),await r({id:h,value:v})}catch(k){u(B=>({...B,rating:null})),a(k)}finally{u(k=>({...k,disabled:!1}))}};return d.jsxs("div",{className:Y("rating",i),children:[d.jsx("span",{className:"label",children:f[p?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const k=v+1;return d.jsx("li",{className:Y({selected:p&&k<=p}),children:d.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:`star${!p||k>p?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:k,total:t})}${k===1||k===t?` - ${f[k===1?"low":"high"]}`:""}`,onClick:B=>{B.preventDefault(),B.stopPropagation(),y(k)},disabled:m})},`rating-${k}`)})})]})};function qm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}function hs(e,t){return Array(t+1).join(e)}function Wm(e){return e.replace(/^\n*/,"")}function Hm(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
40
|
+
`;)t--;return e.substring(0,t)}var Um=["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 Gs(e){return Qs(e,Um)}var dd=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function fd(e){return Qs(e,dd)}function Vm(e){return md(e,dd)}var hd=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function Km(e){return Qs(e,hd)}function Zm(e){return md(e,hd)}function Qs(e,t){return t.indexOf(e.nodeName)>=0}function md(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var rt={};rt.paragraph={filter:"p",replacement:function(e){return`
|
|
41
41
|
|
|
42
42
|
`+e+`
|
|
43
43
|
|
|
44
44
|
`}};rt.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+`
|
|
45
|
-
`}};rt.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var a=
|
|
45
|
+
`}};rt.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var a=hs(r===1?"=":"-",e.length);return`
|
|
46
46
|
|
|
47
47
|
`+e+`
|
|
48
48
|
`+a+`
|
|
49
49
|
|
|
50
50
|
`}else return`
|
|
51
51
|
|
|
52
|
-
`+
|
|
52
|
+
`+hs("#",r)+" "+e+`
|
|
53
53
|
|
|
54
54
|
`}};rt.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
|
|
55
55
|
|
|
@@ -68,23 +68,23 @@ ${cr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",
|
|
|
68
68
|
`+t.firstChild.textContent.replace(/\n/g,`
|
|
69
69
|
`)+`
|
|
70
70
|
|
|
71
|
-
`}};rt.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",a=(r.match(/language-(\S+)/)||[null,""])[1],i=t.firstChild.textContent,s=n.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(i);)u[0].length>=o&&(o=u[0].length+1);var
|
|
71
|
+
`}};rt.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",a=(r.match(/language-(\S+)/)||[null,""])[1],i=t.firstChild.textContent,s=n.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(i);)u[0].length>=o&&(o=u[0].length+1);var c=hs(s,o);return`
|
|
72
72
|
|
|
73
|
-
`+
|
|
73
|
+
`+c+a+`
|
|
74
74
|
`+i.replace(/\n$/,"")+`
|
|
75
|
-
`+
|
|
75
|
+
`+c+`
|
|
76
76
|
|
|
77
77
|
`}};rt.horizontalRule={filter:"hr",replacement:function(e,t,n){return`
|
|
78
78
|
|
|
79
79
|
`+n.hr+`
|
|
80
80
|
|
|
81
|
-
`}};rt.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var n=t.getAttribute("href"),r=
|
|
81
|
+
`}};rt.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var n=t.getAttribute("href"),r=wa(t.getAttribute("title"));return r&&(r=' "'+r+'"'),"["+e+"]("+n+r+")"}};rt.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,n){var r=t.getAttribute("href"),a=wa(t.getAttribute("title"));a&&(a=' "'+a+'"');var i,s;switch(n.linkReferenceStyle){case"collapsed":i="["+e+"][]",s="["+e+"]: "+r+a;break;case"shortcut":i="["+e+"]",s="["+e+"]: "+r+a;break;default:var o=this.references.length+1;i="["+e+"]["+o+"]",s="["+o+"]: "+r+a}return this.references.push(s),i},references:[],append:function(e){var t="";return this.references.length&&(t=`
|
|
82
82
|
|
|
83
83
|
`+this.references.join(`
|
|
84
84
|
`)+`
|
|
85
85
|
|
|
86
|
-
`,this.references=[]),t}};rt.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};rt.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};rt.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",r=e.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+t+e+t+n}};rt.image={filter:"img",replacement:function(e,t){var n=
|
|
87
|
-
`):""}function
|
|
86
|
+
`,this.references=[]),t}};rt.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};rt.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};rt.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",r=e.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+t+e+t+n}};rt.image={filter:"img",replacement:function(e,t){var n=wa(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=wa(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"":""}};function wa(e){return e?e.replace(/(\n+\s*)+/g,`
|
|
87
|
+
`):""}function pd(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])}pd.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=mi(this.array,e,this.options))||(t=mi(this._keep,e,this.options))||(t=mi(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function mi(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(Ym(a,t,n))return a}}function Ym(e,t,n){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function Gm(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(h){return h.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=Qo(o,t,a);l!==t;){if(l.nodeType===3||l.nodeType===4){var u=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!s&&u[0]===" "&&(u=u.substr(1)),!u){l=pi(l);continue}l.data=u,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,s=!1):r(l)||a(l)?(i=null,s=!0):i&&(s=!1);else{l=pi(l);continue}var c=Qo(o,l,a);o=l,l=c}i&&(i.data=i.data.replace(/ $/,""),i.data||pi(i))}}function pi(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Qo(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var Js=typeof window<"u"?window:{};function Qm(){var e=Js.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function Jm(){var e=function(){};return Xm()?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 Xm(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{Js.ActiveXObject&&(e=!0)}return e}var ep=Qm()?Js.DOMParser:Jm();function tp(e,t){var n;if(typeof e=="string"){var r=np().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return Gm({element:n,isBlock:Gs,isVoid:fd,isPre:t.preformattedCode?rp:null}),n}var gi;function np(){return gi=gi||new ep,gi}function rp(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function ap(e,t){return e.isBlock=Gs(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=ip(e),e.flankingWhitespace=sp(e,t),e}function ip(e){return!fd(e)&&!Km(e)&&/^\s*$/i.test(e.textContent)&&!Vm(e)&&!Zm(e)}function sp(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=op(e.textContent);return n.leadingAscii&&Jo("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Jo("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function op(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 Jo(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&&!Gs(r)&&(i=a.test(r.textContent))),i}var up=Array.prototype.reduce,lp=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Fr(e){if(!(this instanceof Fr))return new Fr(e);var t={rules:rt,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
|
|
88
88
|
|
|
89
89
|
`:""},keepReplacement:function(n,r){return r.isBlock?`
|
|
90
90
|
|
|
@@ -94,70 +94,72 @@ ${cr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",
|
|
|
94
94
|
|
|
95
95
|
`+n+`
|
|
96
96
|
|
|
97
|
-
`:n}};this.options=
|
|
97
|
+
`:n}};this.options=qm({},t,e),this.rules=new pd(this.options)}Fr.prototype={turndown:function(e){if(!fp(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=gd.call(this,new tp(e,this.options));return cp.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 lp.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function gd(e){var t=this;return up.call(e.childNodes,function(n,r){r=new ap(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=dp.call(t,r)),vd(n,a)},"")}function cp(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=vd(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function dp(e){var t=this.rules.forNode(e),n=gd.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function vd(e,t){var n=Hm(e),r=Wm(t),a=Math.max(e.length-n.length,t.length-r.length),i=`
|
|
98
98
|
|
|
99
|
-
`.substring(0,a);return n+i+r}function
|
|
99
|
+
`.substring(0,a);return n+i+r}function fp(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}/*!
|
|
100
100
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
101
101
|
*
|
|
102
102
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
103
103
|
* Released under the MIT License.
|
|
104
|
-
*/function Qo(e){return Object.prototype.toString.call(e)==="[object Object]"}function tt(e){var t,n;return Qo(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Qo(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var gd=Symbol.for("immer-nothing"),Jo=Symbol.for("immer-draftable"),vt=Symbol.for("immer-state"),dp=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function dt(e,...t){if(process.env.NODE_ENV!=="production"){const n=dp[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 Yn=Object.getPrototypeOf;function xn(e){return!!e&&!!e[vt]}function Cn(e){var t;return e?vd(e)||Array.isArray(e)||!!e[Jo]||!!((t=e.constructor)!=null&&t[Jo])||Ga(e)||Qa(e):!1}var fp=Object.prototype.constructor.toString();function vd(e){if(!e||typeof e!="object")return!1;const t=Yn(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)===fp}function wa(e,t){Ya(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Ya(e){const t=e[vt];return t?t.type_:Array.isArray(e)?1:Ga(e)?2:Qa(e)?3:0}function hs(e,t){return Ya(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function bd(e,t,n){const r=Ya(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function hp(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ga(e){return e instanceof Map}function Qa(e){return e instanceof Set}function dn(e){return e.copy_||e.base_}function ms(e,t){if(Ga(e))return new Map(e);if(Qa(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&vd(e))return Yn(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[vt];let r=Reflect.ownKeys(n);for(let a=0;a<r.length;a++){const i=r[a],s=n[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Yn(e),n)}function Js(e,t=!1){return Ja(e)||xn(e)||!Cn(e)||(Ya(e)>1&&(e.set=e.add=e.clear=e.delete=mp),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Js(r,!0))),e}function mp(){dt(2)}function Ja(e){return Object.isFrozen(e)}var pp={};function wn(e){const t=pp[e];return t||dt(0,e),t}var Ar;function yd(){return Ar}function gp(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Xo(e,t){t&&(wn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ps(e){gs(e),e.drafts_.forEach(vp),e.drafts_=null}function gs(e){e===Ar&&(Ar=e.parent_)}function eu(e){return Ar=gp(Ar,e)}function vp(e){const t=e[vt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function tu(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[vt].modified_&&(ps(t),dt(4)),Cn(e)&&(e=Ea(t,e),t.parent_||ka(t,e)),t.patches_&&wn("Patches").generateReplacementPatches_(n[vt].base_,e,t.patches_,t.inversePatches_)):e=Ea(t,n,[]),ps(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==gd?e:void 0}function Ea(e,t,n){if(Ja(t))return t;const r=t[vt];if(!r)return wa(t,(a,i)=>nu(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return ka(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),wa(i,(o,l)=>nu(e,r,a,o,l,n,s)),ka(e,a,!1),n&&e.patches_&&wn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function nu(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&dt(5),xn(a)){const o=i&&t&&t.type_!==3&&!hs(t.assigned_,r)?i.concat(r):void 0,l=Ea(e,a,o);if(bd(n,r,l),xn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Cn(a)&&!Ja(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ea(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&ka(e,a)}}function ka(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Js(t,n)}function bp(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:yd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=Xs;n&&(a=[r],i=Fr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var Xs={get(e,t){if(t===vt)return e;const n=dn(e);if(!hs(n,t))return yp(e,n,t);const r=n[t];return e.finalized_||!Cn(r)?r:r===gi(e.base_,t)?(vi(e),e.copy_[t]=bs(r,e)):r},has(e,t){return t in dn(e)},ownKeys(e){return Reflect.ownKeys(dn(e))},set(e,t,n){const r=Dd(dn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=gi(dn(e),t),i=a==null?void 0:a[vt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(hp(n,a)&&(n!==void 0||hs(e.base_,t)))return!0;vi(e),vs(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 gi(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,vi(e),vs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=dn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){dt(11)},getPrototypeOf(e){return Yn(e.base_)},setPrototypeOf(){dt(12)}},Fr={};wa(Xs,(e,t)=>{Fr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Fr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&dt(13),Fr.set.call(this,e,t,void 0)};Fr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&dt(14),Xs.set.call(this,e[0],t,n,e[0])};function gi(e,t){const n=e[vt];return(n?dn(n):e)[t]}function yp(e,t,n){var a;const r=Dd(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Dd(e,t){if(!(t in e))return;let n=Yn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Yn(n)}}function vs(e){e.modified_||(e.modified_=!0,e.parent_&&vs(e.parent_))}function vi(e){e.copy_||(e.copy_=ms(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Dp=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,d=>n.call(this,d,...u))}}typeof n!="function"&&dt(6),r!==void 0&&typeof r!="function"&&dt(7);let a;if(Cn(t)){const i=eu(this),s=bs(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?ps(i):gs(i)}return Xo(i,r),tu(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===gd&&(a=void 0),this.autoFreeze_&&Js(a,!0),r){const i=[],s=[];wn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else dt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,l=>t(l,...o));let r,a;return[this.produce(t,n,(s,o)=>{r=s,a=o}),r,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Cn(e)||dt(8),xn(e)&&(e=xp(e));const t=eu(this),n=bs(e,void 0);return n[vt].isManual_=!0,gs(t),n}finishDraft(e,t){const n=e&&e[vt];(!n||!n.isManual_)&&dt(9);const{scope_:r}=n;return Xo(r,t),tu(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=wn("Patches").applyPatches_;return xn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function bs(e,t){const n=Ga(e)?wn("MapSet").proxyMap_(e,t):Qa(e)?wn("MapSet").proxySet_(e,t):bp(e,t);return(t?t.scope_:yd()).drafts_.push(n),n}function xp(e){return xn(e)||dt(10,e),xd(e)}function xd(e){if(!Cn(e)||Ja(e))return e;const t=e[vt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ms(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ms(e,!0);return wa(n,(r,a)=>{bd(n,r,xd(a))}),t&&(t.finalized_=!1),n}var bt=new Dp,eo=bt.produce;bt.produceWithPatches.bind(bt);bt.setAutoFreeze.bind(bt);bt.setUseStrictShallowCopy.bind(bt);bt.applyPatches.bind(bt);var ru=bt.createDraft.bind(bt),au=bt.finishDraft.bind(bt),Cp={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()}}},wp={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=ke.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Ep={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Z.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},_a=new WeakMap,Ba=new WeakMap,br=new WeakMap,Cd=new WeakMap,iu=new WeakMap,su=new WeakMap,ou=new WeakMap,P={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=P.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var a=e[r],i=t[r];if(a!==i)break;n.push(a)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return P.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return P.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&P.compare(e,t)===0},isBefore(e,t){return P.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&P.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&P.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&P.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&P.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),a=e[e.length-1],i=t[t.length-1];return a!==i&&P.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!P.isAncestor(t,e)&&!P.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(P.equals(i,r)||P.endsBefore(i,r)||P.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(P.equals(s,r)||P.isAncestor(s,r))return null;P.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;P.equals(o,r)||P.endsBefore(o,r)?r[o.length-1]-=1:P.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:d}=t;if(P.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else P.endsBefore(u,r)?r[u.length-1]+=1:P.isAncestor(u,r)&&e[u.length]>=d&&(r[u.length-1]+=1,r[u.length]-=d);break}case"move_node":{var{path:h,newPath:p}=t;if(P.equals(h,p))return r;if(P.isAncestor(h,r)||P.equals(h,r)){var m=p.slice();return P.endsBefore(h,p)&&h.length<p.length&&(m[h.length-1]-=1),m.concat(r.slice(h.length))}else P.isSibling(h,p)&&(P.isAncestor(p,r)||P.equals(p,r))?P.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:P.endsBefore(p,r)||P.equals(p,r)||P.isAncestor(p,r)?(P.endsBefore(h,r)&&(r[h.length-1]-=1),r[p.length-1]+=1):P.endsBefore(h,r)&&(P.equals(p,r)&&(r[p.length-1]+=1),r[h.length-1]-=1);break}}return r}};function Tr(e){"@babel/helpers - typeof";return Tr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tr(e)}function kp(e,t){if(Tr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Tr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _p(e){var t=kp(e,"string");return Tr(t)==="symbol"?t:String(t)}function ut(e,t,n){return t=_p(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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 dr(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){ut(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 Bp=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=oe.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of Z.points(t))t[l]=ke.transform(o,n);break}case"insert_text":{var{path:u,offset:d,text:h}=n;if(h.length===0)break;var p=oe.leaf(e,u),m=p.text.slice(0,d),g=p.text.slice(d);if(p.text=m+h+g,t)for(var[f,x]of Z.points(t))t[x]=ke.transform(f,n);break}case"merge_node":{var{path:b}=n,_=oe.get(e,b),k=P.previous(b),w=oe.get(e,k),C=oe.parent(e,b),F=b[b.length-1];if(fe.isText(_)&&fe.isText(w))w.text+=_.text;else if(!fe.isText(_)&&!fe.isText(w))w.children.push(..._.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(b,"] to nodes of different interfaces: ").concat(Xe.stringify(_)," ").concat(Xe.stringify(w)));if(C.children.splice(F,1),t)for(var[S,z]of Z.points(t))t[z]=ke.transform(S,n);break}case"move_node":{var{path:N,newPath:$}=n;if(P.isAncestor(N,$))throw new Error("Cannot move a path [".concat(N,"] to new path [").concat($,"] because the destination is inside itself."));var L=oe.get(e,N),E=oe.parent(e,N),A=N[N.length-1];E.children.splice(A,1);var j=P.transform(N,n),I=oe.get(e,P.parent(j)),H=j[j.length-1];if(I.children.splice(H,0,L),t)for(var[q,re]of Z.points(t))t[re]=ke.transform(q,n);break}case"remove_node":{var{path:ne}=n,v=ne[ne.length-1],W=oe.parent(e,ne);if(W.children.splice(v,1),t)for(var[V,B]of Z.points(t)){var T=ke.transform(V,n);if(t!=null&&T!=null)t[B]=T;else{var R=void 0,M=void 0;for(var[K,ee]of oe.texts(e))if(P.compare(ee,ne)===-1)R=[K,ee];else{M=[K,ee];break}var te=!1;R&&M&&(P.equals(M[1],ne)?te=!P.hasPrevious(M[1]):te=P.common(R[1],ne).length<P.common(M[1],ne).length),R&&!te?(V.path=R[1],V.offset=R[0].text.length):M?(V.path=M[1],V.offset=0):t=null}}break}case"remove_text":{var{path:ae,offset:le,text:J}=n;if(J.length===0)break;var pe=oe.leaf(e,ae),he=pe.text.slice(0,le),Ce=pe.text.slice(le+J.length);if(pe.text=he+Ce,t)for(var[Ae,we]of Z.points(t))t[we]=ke.transform(Ae,n);break}case"set_node":{var{path:Fe,properties:Se,newProperties:Le}=n;if(Fe.length===0)throw new Error("Cannot set properties on the root node!");var Je=oe.get(e,Fe);for(var je in Le){if(je==="children"||je==="text")throw new Error('Cannot set the "'.concat(je,'" property of nodes!'));var He=Le[je];He==null?delete Je[je]:Je[je]=He}for(var ge in Se)Le.hasOwnProperty(ge)||delete Je[ge];break}case"set_selection":{var{newProperties:U}=n;if(U==null)t=U;else{if(t==null){if(!Z.isRange(U))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Xe.stringify(U)," when there is no current selection."));t=dr({},U)}for(var ie in U){var me=U[ie];if(me==null){if(ie==="anchor"||ie==="focus")throw new Error('Cannot remove the "'.concat(ie,'" selection property'));delete t[ie]}else t[ie]=me}}break}case"split_node":{var{path:ve,position:Ee,properties:Ve}=n;if(ve.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ve,"] because the root node cannot be split."));var Ge=oe.get(e,ve),mt=oe.parent(e,ve),Lt=ve[ve.length-1],kt;if(fe.isText(Ge)){var et=Ge.text.slice(0,Ee),Ft=Ge.text.slice(Ee);Ge.text=et,kt=dr(dr({},Ve),{},{text:Ft})}else{var pt=Ge.children.slice(0,Ee),ai=Ge.children.slice(Ee);Ge.children=pt,kt=dr(dr({},Ve),{},{children:ai})}if(mt.children.splice(Lt+1,0,kt),t)for(var[sr,zr]of Z.points(t))t[zr]=ke.transform(sr,n);break}}return t},Ap={transform(e,t){e.children=ru(e.children);var n=e.selection&&ru(e.selection);try{n=Bp(e,n,t)}finally{e.children=au(e.children),n?e.selection=xn(n)?au(n):n:e.selection=null}}},Fp={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)}},Tp={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)}},wd=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(tt(r)&&tt(a)){if(!wd(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 Sp(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 Kt(e,t){if(e==null)return{};var n=Sp(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 jp=["anchor","focus"];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 Op(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){ut(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 Z={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return Z.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=Z.edges(e);return t},equals(e,t){return ke.equals(e.anchor,t.anchor)&&ke.equals(e.focus,t.focus)},includes(e,t){if(Z.isRange(t)){if(Z.includes(e,t.anchor)||Z.includes(e,t.focus))return!0;var[n,r]=Z.edges(e),[a,i]=Z.edges(t);return ke.isBefore(n,a)&&ke.isAfter(r,i)}var[s,o]=Z.edges(e),l=!1,u=!1;return ke.isPoint(t)?(l=ke.compare(t,s)>=0,u=ke.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=Kt(e,jp),[r,a]=Z.edges(e),[i,s]=Z.edges(t),o=ke.isBefore(r,i)?i:r,l=ke.isBefore(a,s)?a:s;return ke.isBefore(l,o)?null:Op({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return ke.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return ke.equals(t,n)},isExpanded(e){return!Z.isCollapsed(e)},isForward(e){return!Z.isBackward(e)},isRange(e){return tt(e)&&ke.isPoint(e.anchor)&&ke.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Z.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return eo(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=Z.isCollapsed(r);Z.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?Z.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=ke.transform(r.anchor,t,{affinity:i}),u=ke.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},cu=e=>tt(e)&&oe.isNodeList(e.children)&&!y.isEditor(e),de={isAncestor(e){return tt(e)&&oe.isNodeList(e.children)},isElement:cu,isElementList(e){return Array.isArray(e)&&e.every(t=>de.isElement(t))},isElementProps(e){return e.children!==void 0},isElementType:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"type";return cu(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},Pp=["children"],Np=["text"],du=new WeakMap,oe={ancestor(e,t){var n=oe.get(e,t);if(fe.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(Xe.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.ancestors(t,n)){var a=oe.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(fe.isText(e))throw new Error("Cannot get the child of a text node: ".concat(Xe.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Xe.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=oe.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=oe.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=P.common(t,n),a=oe.get(e,r);return[a,r]},descendant(e,t){var n=oe.get(e,t);if(y.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Xe.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of oe.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of oe.nodes(e,t))de.isElement(n)&&(yield[n,r])}()},extractProps(e){if(de.isAncestor(e)){var t=Kt(e,Pp);return t}else{var t=Kt(e,Np);return t}},first(e,t){for(var n=t.slice(),r=oe.get(e,n);r&&!(fe.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(fe.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(Xe.stringify(e)));var n=eo({children:e.children},r=>{var[a,i]=Z.edges(t),s=oe.nodes(r,{reverse:!0,pass:p=>{var[,m]=p;return!Z.includes(t,m)}});for(var[,o]of s){if(!Z.includes(t,o)){var l=oe.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(P.equals(o,i.path)){var d=oe.leaf(r,o);d.text=d.text.slice(0,i.offset)}if(P.equals(o,a.path)){var h=oe.leaf(r,o);h.text=h.text.slice(a.offset)}}y.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(fe.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Xe.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(fe.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return fe.isText(e)||de.isElement(e)||y.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=du.get(e);if(t!==void 0)return t;var n=e.every(r=>oe.isNode(r));return du.set(e,n),n},last(e,t){for(var n=t.slice(),r=oe.get(e,n);r&&!(fe.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=oe.get(e,t);if(!fe.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(Xe.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.levels(t,n)){var a=oe.get(e,r);yield[a,r]}}()},matches(e,t){return de.isElement(e)&&de.isElementProps(t)&&de.matches(e,t)||fe.isText(e)&&fe.isTextProps(t)&&fe.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?P.isBefore(o,i):P.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!fe.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;P.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=oe.get(e,o);continue}if(o.length===0)break;if(!r){var d=P.next(o);if(oe.has(e,d)){o=d,l=oe.get(e,o);continue}}if(r&&o[o.length-1]!==0){var h=P.previous(o);o=h,l=oe.get(e,o);continue}o=P.parent(o),l=oe.get(e,o),s.add(l)}}()},parent(e,t){var n=P.parent(t),r=oe.get(e,n);if(fe.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string(e){return fe.isText(e)?e.text:e.children.map(oe.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of oe.nodes(e,t))fe.isText(n)&&(yield[n,r])}()}};function 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 qe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var nn={isNodeOperation(e){return nn.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!tt(e))return!1;switch(e.type){case"insert_node":return P.isPath(e.path)&&oe.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"merge_node":return typeof e.position=="number"&&P.isPath(e.path)&&tt(e.properties);case"move_node":return P.isPath(e.path)&&P.isPath(e.newPath);case"remove_node":return P.isPath(e.path)&&oe.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"set_node":return P.isPath(e.path)&&tt(e.properties)&&tt(e.newProperties);case"set_selection":return e.properties===null&&Z.isRange(e.newProperties)||e.newProperties===null&&Z.isRange(e.properties)||tt(e.properties)&&tt(e.newProperties);case"split_node":return P.isPath(e.path)&&typeof e.position=="number"&&tt(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>nn.isOperation(t))},isSelectionOperation(e){return nn.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return nn.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return qe(qe({},e),{},{type:"remove_node"});case"insert_text":return qe(qe({},e),{},{type:"remove_text"});case"merge_node":return qe(qe({},e),{},{type:"split_node",path:P.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(P.equals(t,n))return e;if(P.isSibling(n,t))return qe(qe({},e),{},{path:t,newPath:n});var r=P.transform(n,e),a=P.transform(P.next(n),e);return qe(qe({},e),{},{path:r,newPath:a})}case"remove_node":return qe(qe({},e),{},{type:"insert_node"});case"remove_text":return qe(qe({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return qe(qe({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?qe(qe({},e),{},{properties:l,newProperties:null}):l==null?qe(qe({},e),{},{properties:null,newProperties:o}):qe(qe({},e),{},{properties:l,newProperties:o})}case"split_node":return qe(qe({},e),{},{type:"merge_node",path:P.next(e.path)})}}},hu=new WeakMap,Rp=e=>{var t=hu.get(e);if(t!==void 0)return t;if(!tt(e))return!1;var n=typeof e.addMark=="function"&&typeof e.apply=="function"&&typeof e.deleteFragment=="function"&&typeof e.insertBreak=="function"&&typeof e.insertSoftBreak=="function"&&typeof e.insertFragment=="function"&&typeof e.insertNode=="function"&&typeof e.insertText=="function"&&typeof e.isElementReadOnly=="function"&&typeof e.isInline=="function"&&typeof e.isSelectable=="function"&&typeof e.isVoid=="function"&&typeof e.normalizeNode=="function"&&typeof e.onChange=="function"&&typeof e.removeMark=="function"&&typeof e.getDirtyPaths=="function"&&(e.marks===null||tt(e.marks))&&(e.selection===null||Z.isRange(e.selection))&&oe.isNodeList(e.children)&&nn.isOperationList(e.operations);return hu.set(e,n),n},y={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 Rp(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)}},Mp={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(P.isPath)}};function mu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function pu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?mu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ke={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 ke.compare(e,t)===1},isBefore(e,t){return ke.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&P.equals(e.path,t.path)},isPoint(e){return tt(e)&&typeof e.offset=="number"&&P.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return eo(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,pu(pu({},n),{},{affinity:"forward"})))}else r.path=P.transform(i,t,n);break}}})}},gu=void 0,Xe={setScrubber(e){gu=e},stringify(e){return JSON.stringify(e,gu)}},Ip=["text"],$p=["anchor","focus"];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 qt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var fe={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Kt(i,Ip);return s}return wd(r?a(e):e,r?a(t):t)},isText(e){return tt(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>fe.isText(t))},isTextProps(e){return e.text!==void 0},matches(e,t){for(var n in t)if(n!=="text"&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[qt({},e)];for(var r of t){var a=Kt(r,$p),[i,s]=Z.edges(r),o=[],l=0,u=i.offset,d=s.offset;for(var h of n){var{length:p}=h.text,m=l;if(l+=p,u<=m&&l<=d){Object.assign(h,a),o.push(h);continue}if(u!==d&&(u===l||d===m)||u>l||d<m||d===m&&m!==0){o.push(h);continue}var g=h,f=void 0,x=void 0;if(d<l){var b=d-m;x=qt(qt({},g),{},{text:g.text.slice(b)}),g=qt(qt({},g),{},{text:g.text.slice(0,b)})}if(u>m){var _=u-m;f=qt(qt({},g),{},{text:g.text.slice(0,_)}),g=qt(qt({},g),{},{text:g.text.slice(_)})}Object.assign(g,a),f&&o.push(f),o.push(g),x&&o.push(x)}n=o}return n}},to=e=>e.selection?e.selection:e.children.length>0?y.end(e,[]):[0],ar=(e,t)=>{var[n]=y.node(e,t);return r=>r===n},no=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?Up(t):t,i=xe.None,s=xe.None,o=0,l=null,u=null;for(var d of a){var h=d.codePointAt(0);if(!h)break;var p=rg(d,h);if([i,s]=r?[s,p]:[p,i],$n(i,xe.ZWJ)&&$n(s,xe.ExtPict)&&(r?l=bu(t.substring(0,o)):l=bu(t.substring(0,t.length-o)),!l)||$n(i,xe.RI)&&$n(s,xe.RI)&&(u!==null?u=!u:r?u=!0:u=ug(t.substring(0,t.length-o)),!u)||i!==xe.None&&s!==xe.None&&ig(i,s))break;o+=d.length}return o||1},Lp=/\s/,zp=/[\u002B\u0021-\u0023\u0025-\u002A\u002C-\u002F\u003A\u003B\u003F\u0040\u005B-\u005D\u005F\u007B\u007D\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E3B\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/,qp=/['\u2018\u2019]/,Wp=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=no(t,n),[s,o]=ro(t,i,n);if(Hp(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},ro=(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)]},Hp=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(Lp.test(t))return!1;if(qp.test(t)){var a=no(n,r),[i,s]=ro(n,a,r);if(e(i,s,r))return!0}return!zp.test(t)},Up=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(Kp(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(Vp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},Vp=e=>e>=55296&&e<=56319,Kp=e=>e>=56320&&e<=57343,xe;(function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"})(xe||(xe={}));var Zp=/^(?:[\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])$/,Yp=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,Gp=/^(?:[\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])$/,Qp=/^[\u1100-\u115F\uA960-\uA97C]$/,Jp=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,Xp=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,eg=/^[\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]$/,tg=/^[\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]$/,ng=/^(?:[\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])$/,rg=(e,t)=>{var n=xe.Any;return e.search(Zp)!==-1&&(n|=xe.Extend),t===8205&&(n|=xe.ZWJ),t>=127462&&t<=127487&&(n|=xe.RI),e.search(Yp)!==-1&&(n|=xe.Prepend),e.search(Gp)!==-1&&(n|=xe.SpacingMark),e.search(Qp)!==-1&&(n|=xe.L),e.search(Jp)!==-1&&(n|=xe.V),e.search(Xp)!==-1&&(n|=xe.T),e.search(eg)!==-1&&(n|=xe.LV),e.search(tg)!==-1&&(n|=xe.LVT),e.search(ng)!==-1&&(n|=xe.ExtPict),n};function $n(e,t){return(e&t)!==0}var ag=[[xe.L,xe.L|xe.V|xe.LV|xe.LVT],[xe.LV|xe.V,xe.V|xe.T],[xe.LVT|xe.T,xe.T],[xe.Any,xe.Extend|xe.ZWJ],[xe.Any,xe.SpacingMark],[xe.Prepend,xe.Any],[xe.ZWJ,xe.ExtPict],[xe.RI,xe.RI]];function ig(e,t){return ag.findIndex(n=>$n(e,n[0])&&$n(t,n[1]))===-1}var sg=/(?:[\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$/,bu=e=>e.search(sg)!==-1,og=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,ug=e=>{var t=e.match(og);if(t===null)return!1;var n=t[0].length/2;return n%2===1},lg={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]:{};y.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=to(e)}=n;if(P.isPath(a)&&(a=y.range(e,a)),Z.isRange(a))if(Z.isCollapsed(a))a=a.anchor;else{var i=Z.end(a);if(!r&&y.void(e,{at:i}))return;var s=Z.start(a),o=y.pointRef(e,s),l=y.pointRef(e,i);Q.delete(e,{at:a,voids:r});var u=o.unref(),d=l.unref();a=u||d,Q.setSelection(e,{anchor:a,focus:a})}if(!(!r&&y.void(e,{at:a})||y.elementReadOnly(e,{at:a}))){var{path:h,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:h,offset:p,text:t})}})}};function 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 Zr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Q=Zr(Zr(Zr(Zr({},Ap),Fp),Tp),lg),fa=new WeakMap,cg=e=>fa.get(e)||!1,dg=(e,t,n)=>{var r=fa.get(e)||!1;fa.set(e,!0);try{t(),n()}finally{fa.set(e,r)}};function Ed(e,t,n){var r=_a.get(e)||[],a=Ba.get(e)||new Set,i,s,o=h=>{if(h){var p=h.join(",");s.has(p)||(s.add(p),i.push(h))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var d of t)o(d);_a.set(e,i),Ba.set(e,s)}var fg=(e,t)=>{for(var n of y.pathRefs(e))Cp.transform(n,t);for(var r of y.pointRefs(e))wp.transform(r,t);for(var a of y.rangeRefs(e))Ep.transform(a,t);if(!cg(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),y.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),br.get(e)||(br.set(e,!0),Promise.resolve().then(()=>{br.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},hg=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return P.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=P.levels(a),s=fe.isText(r)?[]:Array.from(oe.nodes(r),$=>{var[,L]=$;return a.concat(L)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=P.ancestors(o),u=P.previous(o);return[...l,u]}case"move_node":{var{path:d,newPath:h}=t;if(P.equals(d,h))return[];var p=[],m=[];for(var g of P.ancestors(d)){var f=P.transform(g,t);p.push(f)}for(var x of P.ancestors(h)){var b=P.transform(x,t);m.push(b)}var _=m[m.length-1],k=h[h.length-1],w=_.concat(k);return[...p,...m,w]}case"remove_node":{var{path:C}=t,F=P.ancestors(C);return[...F]}case"split_node":{var{path:S}=t,z=P.levels(S),N=P.next(S);return[...z,N]}default:return[]}},mg=e=>{var{selection:t}=e;return t?oe.fragment(e,t):[]},pg=(e,t)=>{var[n,r]=t;if(!fe.isText(n)){if(de.isElement(n)&&n.children.length===0){var a={text:""};Q.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=y.isEditor(n)?!1:de.isElement(n)&&(e.isInline(n)||n.children.length===0||fe.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=oe.get(e,r);if(!fe.isText(l)){var u=l.children[s],d=l.children[s-1],h=o===n.children.length-1,p=fe.isText(u)||de.isElement(u)&&e.isInline(u);if(p!==i)Q.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(de.isElement(u)){if(e.isInline(u)){if(d==null||!fe.isText(d)){var m={text:""};Q.insertNodes(e,m,{at:r.concat(s),voids:!0}),s++}else if(h){var g={text:""};Q.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else d!=null&&fe.isText(d)&&(fe.equals(u,d,{loose:!0})?(Q.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):d.text===""?(Q.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(Q.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},gg=(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},vg=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=y.path(t,i),l=a==="lowest";for(var[u,d]of y.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!fe.isText(u)){if(Z.isRange(i)){if(P.isAncestor(d,i.anchor.path)&&P.isAncestor(d,i.focus.path))return[u,d]}else if(!P.equals(o,d))return[u,d]}}};function 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 xu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Du(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Du(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var bg=(e,t,n)=>{var{selection:r}=e;if(r){var a=(h,p)=>{if(!fe.isText(h))return!1;var[m,g]=y.parent(e,p);return!e.isVoid(m)||e.markableVoid(m)},i=Z.isExpanded(r),s=!1;if(!i){var[o,l]=y.node(e,r);if(o&&a(o,l)){var[u]=y.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)Q.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var d=xu(xu({},y.marks(e)||{}),{},{[t]:n});e.marks=d,br.get(e)||e.onChange()}}};function Cu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function wu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var yg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.point(t,n,{edge:"end"}),i=y.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of y.positions(t,wu(wu({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=d),l++}return u};function Eu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ku(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Eu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Eu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Dg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.start(t,[]),i=y.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var d of y.positions(t,ku(ku({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=d),l++}return u},xg=(e,t)=>{var{selection:n}=e;n&&Z.isCollapsed(n)&&Q.delete(e,{unit:t,reverse:!0})},Cg=(e,t)=>{var{selection:n}=e;n&&Z.isCollapsed(n)&&Q.delete(e,{unit:t})},wg=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&Z.isExpanded(r)&&Q.delete(t,{reverse:n==="backward"})},Eg=(e,t)=>[y.start(e,t),y.end(e,t)];function _u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Bu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_u(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_u(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var kg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return y.above(t,Bu(Bu({},n),{},{match:r=>de.isElement(r)&&y.isElementReadOnly(t,r)}))},_g=(e,t)=>y.point(e,t,{edge:"end"}),Bg=(e,t)=>{var n=y.path(e,t,{edge:"start"});return y.node(e,n)},Ag=(e,t)=>{var n=y.range(e,t);return oe.fragment(e,n)};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 Fu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Au(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Au(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Fg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return y.above(t,Fu(Fu({},n),{},{match:r=>de.isElement(r)&&y.isVoid(t,r)}))},Tg=(e,t)=>t.children.some(n=>de.isElement(n)&&y.isBlock(e,n)),Sg=(e,t)=>t.children.some(n=>fe.isText(n)||y.isInline(e,n)),jg=(e,t)=>oe.has(e,t),Og=(e,t)=>t.children.every(n=>fe.isText(n)),Pg=e=>{Q.splitNodes(e,{always:!0})},Ng=(e,t,n)=>{Q.insertNodes(e,t,n)},Rg=e=>{Q.splitNodes(e,{always:!0})};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 Mg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Tu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ig=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=Mg({text:n},i);Q.insertNodes(t,s,{at:r.at,voids:r.voids})}else Q.insertText(t,n,r);t.marks=null}},$g=(e,t)=>!e.isInline(t),Lg=(e,t,n)=>y.isStart(e,t,n)||y.isEnd(e,t,n),zg=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&fe.isText(r)&&r.text===""&&!e.isVoid(t)},qg=(e,t,n)=>{var r=y.end(e,n);return ke.equals(t,r)},Wg=e=>{var t=Cd.get(e);return t===void 0?!0:t},Hg=(e,t,n)=>{if(t.offset!==0)return!1;var r=y.start(e,n);return ke.equals(t,r)},Ug=(e,t)=>{var n=y.path(e,t,{edge:"end"});return y.node(e,n)},Vg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.path(t,n,r),i=oe.leaf(t,a);return[i,a]};function Kg(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=y.path(e,n);for(var[l,u]of oe.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&de.isElement(l)&&y.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var Zg=["text"],Yg=["text"],Gg=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(Z.isExpanded(r)){var s=y.isEnd(t,a,a.path);if(s){var o=y.after(t,a);o&&(a=o)}var[l]=y.nodes(t,{match:fe.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,d=Kt(u,Zg);return d}else return{}}var{path:h}=a,[p]=y.leaf(t,h);if(a.offset===0){var m=y.previous(t,{at:h,match:fe.isText}),g=y.above(t,{match:w=>de.isElement(w)&&y.isVoid(t,w)&&t.markableVoid(w)});if(!g){var f=y.above(t,{match:w=>de.isElement(w)&&y.isBlock(t,w)});if(m&&f){var[x,b]=m,[,_]=f;P.isAncestor(_,b)&&(p=x)}}}var k=Kt(p,Yg);return k},Qg=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=y.after(t,s,{voids:a});if(o){var[,l]=y.last(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(P.isPath(s)){var[d]=y.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[h]=y.nodes(t,{at:u,match:i,mode:r,voids:a});return h}}},Jg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.path(t,n,r),i=oe.get(t,a);return[i,a]};function Xg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,mode:r="all",universal:a=!1,reverse:i=!1,voids:s=!1,ignoreNonSelectable:o=!1}=t,{match:l}=t;if(l||(l=()=>!0),!!n){var u,d;if(Mp.isSpan(n))u=n[0],d=n[1];else{var h=y.path(e,n,{edge:"start"}),p=y.path(e,n,{edge:"end"});u=i?p:h,d=i?h:p}var m=oe.nodes(e,{reverse:i,from:u,to:d,pass:w=>{var[C]=w;return de.isElement(C)?!!(!s&&(y.isVoid(e,C)||y.isElementReadOnly(e,C))||o&&!y.isSelectable(e,C)):!1}}),g=[],f;for(var[x,b]of m)if(!(o&&de.isElement(x)&&!y.isSelectable(e,x))){var _=f&&P.compare(b,f[1])===0;if(!(r==="highest"&&_)){if(!l(x,b)){if(a&&!_&&fe.isText(x))return;continue}if(r==="lowest"&&_){f=[x,b];continue}var k=r==="lowest"?f:[x,b];k&&(a?g.push(k):yield k),f=[x,b]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var ev=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=d=>_a.get(d)||[],s=d=>Ba.get(d)||new Set,o=d=>{var h=i(d).pop(),p=h.join(",");return s(d).delete(p),h};if(y.isNormalizing(t)){if(r){var l=Array.from(oe.nodes(t),d=>{var[,h]=d;return h}),u=new Set(l.map(d=>d.join(",")));_a.set(t,l),Ba.set(t,u)}i(t).length!==0&&y.withoutNormalizing(t,()=>{for(var d of i(t))if(oe.has(t,d)){var h=y.node(t,d),[p,m]=h;de.isElement(p)&&p.children.length===0&&t.normalizeNode(h,{operation:a})}for(var g=i(t),f=g.length,x=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:x,initialDirtyPathsLength:f,operation:a}))return;var b=o(t);if(oe.has(t,b)){var _=y.node(t,b);t.normalizeNode(_,{operation:a})}x++,g=i(t)}})}},tv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=y.path(t,n,r),i=P.parent(a),s=y.node(t,i);return s},nv=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=y.pathRefs(t);return l.delete(i),i.current=null,o}},s=y.pathRefs(t);return s.add(i),i},rv=e=>{var t=iu.get(e);return t||(t=new Set,iu.set(e,t)),t},av=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(P.isPath(n)){if(i==="start"){var[,s]=oe.first(t,n);n=s}else if(i==="end"){var[,o]=oe.last(t,n);n=o}}return Z.isRange(n)&&(i==="start"?n=Z.start(n):i==="end"?n=Z.end(n):n=P.common(n.anchor.path,n.focus.path)),ke.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},iv=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=y.pointRefs(t);return l.delete(i),i.current=null,o}},s=y.pointRefs(t);return s.add(i),i},sv=e=>{var t=su.get(e);return t||(t=new Set,su.set(e,t)),t},ov=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(P.isPath(n)){var i;if(a==="end"){var[,s]=oe.last(t,n);i=s}else{var[,o]=oe.first(t,n);i=o}var l=oe.get(t,i);if(!fe.isText(l))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?l.text.length:0}}if(Z.isRange(n)){var[u,d]=Z.edges(n);return a==="start"?u:d}return n};function uv(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=y.range(e,n),[l,u]=Z.edges(o),d=a?u:l,h=!1,p="",m=0,g=0,f=0;for(var[x,b]of y.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(x)){if(!i&&(e.isVoid(x)||e.isElementReadOnly(x))){yield y.start(e,b);continue}if(e.isInline(x))continue;if(y.hasInlines(e,x)){var _=P.isAncestor(b,u.path)?u:y.end(e,b),k=P.isAncestor(b,l.path)?l:y.start(e,b);p=y.string(e,{anchor:k,focus:_},{voids:i}),h=!0}}if(fe.isText(x)){var w=P.equals(b,d.path);for(w?(g=a?d.offset:x.text.length-d.offset,f=d.offset):(g=x.text.length,f=a?g:0),(w||h||r==="offset")&&(yield{path:b,offset:f},h=!1);;){if(m===0){if(p==="")break;m=C(p,r,a),p=ro(p,m,a)[1]}if(f=a?f-m:f+m,g=g-m,g<0){m=-g;break}m=0,yield{path:b,offset:f}}}}function C(F,S,z){return S==="character"?no(F,z):S==="word"?Wp(F,z):S==="line"||S==="block"?F.length:1}}()}var lv=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=y.before(t,s,{voids:a});if(o){var[,l]=y.first(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(P.isPath(s)){var[d]=y.parent(t,s);i=p=>d.children.includes(p)}else i=()=>!0;var[h]=y.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return h}}},cv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=y.rangeRefs(t);return l.delete(i),i.current=null,o}},s=y.rangeRefs(t);return s.add(i),i},dv=e=>{var t=ou.get(e);return t||(t=new Set,ou.set(e,t)),t},fv=(e,t,n)=>{if(Z.isRange(t)&&!n)return t;var r=y.start(e,t),a=y.end(e,n||t);return{anchor:r,focus:a}};function Su(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function hv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Su(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Su(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var mv=(e,t)=>{var{selection:n}=e;if(n){var r=(d,h)=>{if(!fe.isText(d))return!1;var[p,m]=y.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},a=Z.isExpanded(n),i=!1;if(!a){var[s,o]=y.node(e,n);if(s&&r(s,o)){var[l]=y.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)Q.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=hv({},y.marks(e)||{});delete u[t],e.marks=u,br.get(e)||e.onChange()}}},pv=(e,t)=>{Cd.set(e,t)},gv=(e,t)=>y.point(e,t,{edge:"start"}),vv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=y.range(t,n),[s,o]=Z.edges(i),l="";for(var[u,d]of y.nodes(t,{at:i,match:fe.isText,voids:a})){var h=u.text;P.equals(d,o.path)&&(h=h.slice(0,o.offset)),P.equals(d,s.path)&&(h=h.slice(s.offset)),l+=h}return l},bv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=Z.edges(n);if(i.offset!==0||s.offset!==0||Z.isCollapsed(n)||P.hasPrevious(s.path))return n;var o=y.above(t,{at:s,match:g=>de.isElement(g)&&y.isBlock(t,g),voids:a}),l=o?o[1]:[],u=y.start(t,i),d={anchor:u,focus:s},h=!0;for(var[p,m]of y.nodes(t,{at:d,match:fe.isText,reverse:!0,voids:a})){if(h){h=!1;continue}if(p.text!==""||P.isBefore(m,l)){s={path:m,offset:p.text.length};break}}return{anchor:i,focus:s}},yv=(e,t)=>{var n=y.isNormalizing(e);y.setNormalizing(e,!1);try{t()}finally{y.setNormalizing(e,n)}y.normalize(e)},Dv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:d=!1}=n;if(u){var h=!1;if(Z.isRange(u)&&Z.isCollapsed(u)&&(h=!0,u=u.anchor),ke.isPoint(u)){var p=y.void(t,{at:u,mode:"highest"});if(!l&&p){var[,m]=p;u=m}else{var g={unit:s,distance:o},f=i?y.before(t,u,g)||y.start(t,[]):y.after(t,u,g)||y.end(t,[]);u={anchor:u,focus:f},d=!0}}if(P.isPath(u)){Q.removeNodes(t,{at:u,voids:l});return}if(!Z.isCollapsed(u)){if(!d){var[,x]=Z.edges(u),b=y.end(t,[]);ke.equals(x,b)||(u=y.unhangRange(t,u,{voids:l}))}var[_,k]=Z.edges(u),w=y.above(t,{match:he=>de.isElement(he)&&y.isBlock(t,he),at:_,voids:l}),C=y.above(t,{match:he=>de.isElement(he)&&y.isBlock(t,he),at:k,voids:l}),F=w&&C&&!P.equals(w[1],C[1]),S=P.equals(_.path,k.path),z=l?null:(r=y.void(t,{at:_,mode:"highest"}))!==null&&r!==void 0?r:y.elementReadOnly(t,{at:_,mode:"highest"}),N=l?null:(a=y.void(t,{at:k,mode:"highest"}))!==null&&a!==void 0?a:y.elementReadOnly(t,{at:k,mode:"highest"});if(z){var $=y.before(t,_);$&&w&&P.isAncestor(w[1],$.path)&&(_=$)}if(N){var L=y.after(t,k);L&&C&&P.isAncestor(C[1],L.path)&&(k=L)}var E=[],A;for(var j of y.nodes(t,{at:u,voids:l})){var[I,H]=j;A&&P.compare(H,A)===0||(!l&&de.isElement(I)&&(y.isVoid(t,I)||y.isElementReadOnly(t,I))||!P.isCommon(H,_.path)&&!P.isCommon(H,k.path))&&(E.push(j),A=H)}var q=Array.from(E,he=>{var[,Ce]=he;return y.pathRef(t,Ce)}),re=y.pointRef(t,_),ne=y.pointRef(t,k),v="";if(!S&&!z){var W=re.current,[V]=y.leaf(t,W),{path:B}=W,{offset:T}=_,R=V.text.slice(T);R.length>0&&(t.apply({type:"remove_text",path:B,offset:T,text:R}),v=R)}if(q.reverse().map(he=>he.unref()).filter(he=>he!==null).forEach(he=>Q.removeNodes(t,{at:he,voids:l})),!N){var M=ne.current,[K]=y.leaf(t,M),{path:ee}=M,te=S?_.offset:0,ae=K.text.slice(te,k.offset);ae.length>0&&(t.apply({type:"remove_text",path:ee,offset:te,text:ae}),v=ae)}!S&&F&&ne.current&&re.current&&Q.mergeNodes(t,{at:ne.current,hanging:!0,voids:l}),h&&i&&s==="character"&&v.length>1&&v.match(/[\u0E00-\u0E7F]+/)&&Q.insertText(t,v.slice(0,v.length-o));var le=re.unref(),J=ne.unref(),pe=i?le||J:J||le;n.at==null&&pe&&Q.select(t,pe)}}})},xv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=to(t),batchDirty:o=!0}=r;if(n.length){if(Z.isRange(s))if(a||(s=y.unhangRange(t,s,{voids:i})),Z.isCollapsed(s))s=s.anchor;else{var[,l]=Z.edges(s);if(!i&&y.void(t,{at:l}))return;var u=y.pointRef(t,l);Q.delete(t,{at:s}),s=u.unref()}else P.isPath(s)&&(s=y.start(t,s));if(!(!i&&y.void(t,{at:s}))){var d=y.above(t,{at:s,match:R=>de.isElement(R)&&y.isInline(t,R),mode:"highest",voids:i});if(d){var[,h]=d;if(y.isEnd(t,s,h)){var p=y.after(t,h);s=p}else if(y.isStart(t,s,h)){var m=y.before(t,h);s=m}}var g=y.above(t,{match:R=>de.isElement(R)&&y.isBlock(t,R),at:s,voids:i}),[,f]=g,x=y.isStart(t,s,f),b=y.isEnd(t,s,f),_=x&&b,k=!x||x&&b,w=!b,[,C]=oe.first({children:n},[]),[,F]=oe.last({children:n},[]),S=[],z=R=>{var[M,K]=R,ee=K.length===0;return ee?!1:_?!0:!(k&&P.isAncestor(K,C)&&de.isElement(M)&&!t.isVoid(M)&&!t.isInline(M)||w&&P.isAncestor(K,F)&&de.isElement(M)&&!t.isVoid(M)&&!t.isInline(M))};for(var N of oe.nodes({children:n},{pass:z}))z(N)&&S.push(N);var $=[],L=[],E=[],A=!0,j=!1;for(var[I]of S)de.isElement(I)&&!t.isInline(I)?(A=!1,j=!0,L.push(I)):A?$.push(I):E.push(I);var[H]=y.nodes(t,{at:s,match:R=>fe.isText(R)||y.isInline(t,R),mode:"highest",voids:i}),[,q]=H,re=y.isStart(t,s,q),ne=y.isEnd(t,s,q),v=y.pathRef(t,b&&!E.length?P.next(f):f),W=y.pathRef(t,ne?P.next(q):q);Q.splitNodes(t,{at:s,match:R=>j?de.isElement(R)&&y.isBlock(t,R):fe.isText(R)||y.isInline(t,R),mode:j?"lowest":"highest",always:j&&(!x||$.length>0)&&(!b||E.length>0),voids:i});var V=y.pathRef(t,!re||re&&ne?P.next(q):q);if(Q.insertNodes(t,$,{at:V.current,match:R=>fe.isText(R)||y.isInline(t,R),mode:"highest",voids:i,batchDirty:o}),_&&!$.length&&L.length&&!E.length&&Q.delete(t,{at:f,voids:i}),Q.insertNodes(t,L,{at:v.current,match:R=>de.isElement(R)&&y.isBlock(t,R),mode:"lowest",voids:i,batchDirty:o}),Q.insertNodes(t,E,{at:W.current,match:R=>fe.isText(R)||y.isInline(t,R),mode:"highest",voids:i,batchDirty:o}),!r.at){var B;if(E.length>0&&W.current?B=P.previous(W.current):L.length>0&&v.current?B=P.previous(v.current):V.current&&(B=P.previous(V.current)),B){var T=y.end(t,B);Q.select(t,T)}}V.unref(),v.unref(),W.unref()}}})},Cv=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]=Z.edges(a);Q.select(t,i)}else if(r==="end"){var[,s]=Z.edges(a);Q.select(t,s)}}else return},wv=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},Ev=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=Z.isBackward(r)?"focus":"anchor"),o==="end"&&(o=Z.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,d={distance:a,unit:i,ignoreNonSelectable:!0},h={};if(o==null||o==="anchor"){var p=s?y.before(t,l,d):y.after(t,l,d);p&&(h.anchor=p)}if(o==null||o==="focus"){var m=s?y.before(t,u,d):y.after(t,u,d);m&&(h.focus=m)}Q.setSelection(t,h)}},kv=(e,t)=>{var{selection:n}=e;if(t=y.range(e,t),n){Q.setSelection(e,t);return}if(!Z.isRange(t))throw new Error("When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: ".concat(Xe.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function ju(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ou(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ju(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ju(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var _v=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=Z.isBackward(a)?"focus":"anchor"),i==="end"&&(i=Z.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;Q.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Ou(Ou({},l),n)})}},Bv=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!ke.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!ke.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})}},Av=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:d}=r;if(oe.isNode(n)&&(n=[n]),n.length!==0){var[h]=n;if(l||(l=to(t),d!==!1&&(d=!0)),d==null&&(d=!1),Z.isRange(l))if(a||(l=y.unhangRange(t,l,{voids:i})),Z.isCollapsed(l))l=l.anchor;else{var[,p]=Z.edges(l),m=y.pointRef(t,p);Q.delete(t,{at:l}),l=m.unref()}if(ke.isPoint(l)){u==null&&(fe.isText(h)?u=$=>fe.isText($):t.isInline(h)?u=$=>fe.isText($)||y.isInline(t,$):u=$=>de.isElement($)&&y.isBlock(t,$));var[g]=y.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,x=y.pathRef(t,f),b=y.isEnd(t,l,f);Q.splitNodes(t,{at:l,match:u,mode:s,voids:i});var _=x.unref();l=b?P.next(_):_}else return}var k=P.parent(l),w=l[l.length-1];if(!(!i&&y.void(t,{at:k}))){if(o){var C=[],F=P.levels(k);dg(t,()=>{var $=function(){var A=k.concat(w);w++;var j={type:"insert_node",path:A,node:L};t.apply(j),l=P.next(l),C.push(j),fe.isText?F.push(...Array.from(oe.nodes(L),I=>{var[,H]=I;return A.concat(H)})):F.push(A)};for(var L of n)$()},()=>{Ed(t,F,$=>{var L=$;for(var E of C)if(P.operationCanTransformPath(E)&&(L=P.transform(L,E),!L))return null;return L})})}else for(var S of n){var z=k.concat(w);w++,t.apply({type:"insert_node",path:z,node:S}),l=P.next(l)}if(l=P.previous(l),d){var N=y.end(t,l);N&&Q.select(t,N)}}}})},Fv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=P.isPath(r)?ar(t,r):w=>de.isElement(w)&&y.isBlock(t,w)),!!r){var o=y.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,w=>{var[,C]=w;return y.pathRef(t,C)});for(var u of l){var d=u.unref();if(d.length<2)throw new Error("Cannot lift node at a path [".concat(d,"] because it has a depth of less than `2`."));var h=y.node(t,P.parent(d)),[p,m]=h,g=d[d.length-1],{length:f}=p.children;if(f===1){var x=P.next(m);Q.moveNodes(t,{at:d,to:x,voids:i}),Q.removeNodes(t,{at:m,voids:i})}else if(g===0)Q.moveNodes(t,{at:d,to:m,voids:i});else if(g===f-1){var b=P.next(m);Q.moveNodes(t,{at:d,to:b,voids:i})}else{var _=P.next(d),k=P.next(m);Q.splitNodes(t,{at:_,voids:i}),Q.moveNodes(t,{at:d,to:k,voids:i})}}}})},Tv=["text"],Sv=["children"],kd=(e,t)=>{if(de.isElement(t)){var n=t;return y.isVoid(e,t)?!0:n.children.length===1?kd(e,n.children[0]):!1}else return!y.isEditor(t)},jv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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]=y.parent(t,a);r=$=>l.children.includes($)}else r=$=>de.isElement($)&&y.isBlock(t,$);if(!i&&Z.isRange(a)&&(a=y.unhangRange(t,a,{voids:s})),Z.isRange(a))if(Z.isCollapsed(a))a=a.anchor;else{var[,u]=Z.edges(a),d=y.pointRef(t,u);Q.delete(t,{at:a}),a=d.unref(),n.at==null&&Q.select(t,a)}var[h]=y.nodes(t,{at:a,match:r,voids:s,mode:o}),p=y.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!h||!p)){var[m,g]=h,[f,x]=p;if(!(g.length===0||x.length===0)){var b=P.next(x),_=P.common(g,x),k=P.isSibling(g,x),w=Array.from(y.levels(t,{at:g}),$=>{var[L]=$;return L}).slice(_.length).slice(0,-1),C=y.above(t,{at:g,mode:"highest",match:$=>w.includes($)&&kd(t,$)}),F=C&&y.pathRef(t,C[1]),S,z;if(fe.isText(m)&&fe.isText(f)){var N=Kt(m,Tv);z=f.text.length,S=N}else if(de.isElement(m)&&de.isElement(f)){var N=Kt(m,Sv);z=f.children.length,S=N}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(Xe.stringify(m)," ").concat(Xe.stringify(f)));k||Q.moveNodes(t,{at:g,to:b,voids:s}),F&&Q.removeNodes(t,{at:F.current,voids:s}),de.isElement(f)&&y.isEmpty(t,f)||fe.isText(f)&&f.text===""&&x[x.length-1]!==0?Q.removeNodes(t,{at:x,voids:s}):t.apply({type:"merge_node",path:b,position:z,properties:S}),F&&F.unref()}}}})},Ov=(e,t)=>{y.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)?ar(e,r):m=>de.isElement(m)&&y.isBlock(e,m));var o=y.pathRef(e,n),l=y.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,m=>{var[,g]=m;return y.pathRef(e,g)});for(var d of u){var h=d.unref(),p=o.current;h.length!==0&&e.apply({type:"move_node",path:h,newPath:p}),o.current&&P.isSibling(p,h)&&P.isAfter(p,h)&&(o.current=P.next(o.current))}o.unref()}})},Pv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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)?ar(t,s):m=>de.isElement(m)&&y.isBlock(t,m)),!r&&Z.isRange(s)&&(s=y.unhangRange(t,s,{voids:a}));var l=y.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,m=>{var[,g]=m;return y.pathRef(t,g)});for(var d of u){var h=d.unref();if(h){var[p]=y.node(t,h);t.apply({type:"remove_node",path:h,node:p})}}}})},Nv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:d=!1,voids:h=!1}=r;if(i){if(a==null&&(a=P.isPath(i)?ar(t,i):z=>de.isElement(z)&&y.isBlock(t,z)),!l&&Z.isRange(i)&&(i=y.unhangRange(t,i,{voids:h})),d&&Z.isRange(i)){if(Z.isCollapsed(i)&&y.leaf(t,i.anchor)[0].text.length>0)return;var p=y.rangeRef(t,i,{affinity:"inward"}),[m,g]=Z.edges(i),f=u==="lowest"?"lowest":"highest",x=y.isEnd(t,g,g.path);Q.splitNodes(t,{at:g,match:a,mode:f,voids:h,always:!x});var b=y.isStart(t,m,m.path);Q.splitNodes(t,{at:m,match:a,mode:f,voids:h,always:!b}),i=p.unref(),r.at==null&&Q.select(t,i)}s||(s=(z,N)=>z!==N);for(var[_,k]of y.nodes(t,{at:i,match:a,mode:u,voids:h})){var w={},C={};if(k.length!==0){var F=!1;for(var S in n)S==="children"||S==="text"||s(n[S],_[S])&&(F=!0,_.hasOwnProperty(S)&&(w[S]=_[S]),o?n[S]!=null&&(C[S]=o(_[S],n[S])):n[S]!=null&&(C[S]=n[S]));F&&t.apply({type:"set_node",path:k,properties:w,newProperties:C})}}}})},Rv=(e,t)=>{if(Z.isCollapsed(t))return t.anchor;var[,n]=Z.edges(t),r=y.pointRef(e,n);return Q.delete(e,{at:t}),r.unref()},Mv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=ne=>de.isElement(ne)&&y.isBlock(t,ne)),Z.isRange(s)&&(s=Rv(t,s)),P.isPath(s)){var u=s,d=y.point(t,u),[h]=y.parent(t,u);i=ne=>ne===h,o=d.path.length-u.length+1,s=d,l=!0}if(s){var p=y.pointRef(t,s,{affinity:"backward"}),m;try{var[g]=y.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=y.void(t,{at:s,mode:"highest"}),x=0;if(!a&&f){var[b,_]=f;if(de.isElement(b)&&t.isInline(b)){var k=y.after(t,_);if(!k){var w={text:""},C=P.next(_);Q.insertNodes(t,w,{at:C,voids:a}),k=y.point(t,C)}s=k,l=!0}var F=s.path.length-_.length;o=F+1,l=!0}m=y.pointRef(t,s);var S=s.path.length-o,[,z]=g,N=s.path.slice(0,S),$=o===0?s.offset:s.path[S]+x;for(var[L,E]of y.levels(t,{at:N,reverse:!0,voids:a})){var A=!1;if(E.length<z.length||E.length===0||!a&&de.isElement(L)&&y.isVoid(t,L))break;var j=p.current,I=y.isEnd(t,j,E);if(l||!p||!y.isEdge(t,j,E)){A=!0;var H=oe.extractProps(L);t.apply({type:"split_node",path:E,position:$,properties:H})}$=E[E.length-1]+(A||I?1:0)}if(n.at==null){var q=m.current||y.end(t,[]);Q.select(t,q)}}finally{var re;p.unref(),(re=m)===null||re===void 0||re.unref()}}})},Iv=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)},$v=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};y.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)?ar(t,s):m=>de.isElement(m)&&y.isBlock(t,m)),P.isPath(s)&&(s=y.range(t,s));var l=Z.isRange(s)?y.rangeRef(t,s):null,u=y.nodes(t,{at:s,match:o,mode:r,voids:i}),d=Array.from(u,m=>{var[,g]=m;return y.pathRef(t,g)}).reverse(),h=function(){var g=p.unref(),[f]=y.node(t,g),x=y.range(t,g);a&&l&&(x=Z.intersection(l.current,x)),Q.liftNodes(t,{at:x,match:b=>de.isAncestor(f)&&f.children.includes(b),voids:i})};for(var p of d)h();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 Nu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Lv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};y.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=ar(t,l):t.isInline(n)?o=x=>de.isElement(x)&&y.isInline(t,x)||fe.isText(x):o=x=>de.isElement(x)&&y.isBlock(t,x)),i&&Z.isRange(l)){var[u,d]=Z.edges(l),h=y.rangeRef(t,l,{affinity:"inward"});Q.splitNodes(t,{at:d,match:o,voids:s}),Q.splitNodes(t,{at:u,match:o,voids:s}),l=h.unref(),r.at==null&&Q.select(t,l)}var p=Array.from(y.nodes(t,{at:l,match:t.isInline(n)?x=>de.isElement(x)&&y.isBlock(t,x):x=>y.isEditor(x),mode:"lowest",voids:s})),m=function(){var b=Z.isRange(l)?Z.intersection(l,y.range(t,f)):l;if(!b)return 0;var _=Array.from(y.nodes(t,{at:b,match:o,mode:a,voids:s}));if(_.length>0){var[k]=_,w=_[_.length-1],[,C]=k,[,F]=w;if(C.length===0&&F.length===0)return 0;var S=P.equals(C,F)?P.parent(C):P.common(C,F),z=y.range(t,C,F),N=y.node(t,S),[$]=N,L=S.length+1,E=P.next(F.slice(0,L)),A=Nu(Nu({},n),{},{children:[]});Q.insertNodes(t,A,{at:E,voids:s}),Q.moveNodes(t,{at:z,match:j=>de.isAncestor($)&&$.children.includes(j),to:E.concat(0),voids:s})}},g;for(var[,f]of p)g=m()}})},zv=()=>{var e={children:[],operations:[],selection:null,marks:null,isElementReadOnly:()=>!1,isInline:()=>!1,isSelectable:()=>!0,isVoid:()=>!1,markableVoid:()=>!1,onChange:()=>{},apply:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fg(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bg(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mg(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xv(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pg(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mv(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hg(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gg(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vg(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cv(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dv(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wv(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gg(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tg(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sg(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Av(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hg(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 Vg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kg(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fv(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jv(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ev(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ov(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xg(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ev(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tv(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return av(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nv(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rv(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ov(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iv(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sv(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uv(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lv(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fv(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cv(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dv(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pv(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kv(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Nv(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pv(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _v(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bv(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mv(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gv(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vv(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bv(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Iv(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $v(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fg(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yv(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lv(e,...r)}};return e},qv={isHistory(e){return tt(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||nn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||nn.isOperationList(e.undos[0].operations))}},bi=new WeakMap,yi=new WeakMap,Ln={isHistoryEditor(e){return qv.isHistory(e.history)&&y.isEditor(e)},isMerging(e){return yi.get(e)},isSaving(e){return bi.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Ln.isMerging(e);yi.set(e,!1),t(),yi.set(e,n)},withoutSaving(e,t){var n=Ln.isSaving(e);bi.set(e,!1),t(),bi.set(e,n)}},Wv=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),Ln.withoutSaving(t,()=>{y.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];Ln.withoutSaving(t,()=>{y.withoutNormalizing(t,()=>{var s=i.operations.map(nn.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=Ln.isSaving(t),d=Ln.isMerging(t);if(u==null&&(u=Uv(r)),u){if(d==null&&(o==null?d=!1:a.length!==0?d=!0:d=Hv(r,l)),o&&d)o.operations.push(r);else{var h={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",h)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},Hv=(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",Vv=Yv,_d="֑-߿יִ-﷽ﹰ-ﻼ",Bd="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",Kv=new RegExp("^[^"+Bd+"]*["+_d+"]"),Zv=new RegExp("^[^"+_d+"]*["+Bd+"]");function Yv(e){return e=String(e||""),Kv.test(e)?"rtl":Zv.test(e)?"ltr":"neutral"}const Ad=kn(Vv);function Gv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ao=Gv,Qv=typeof qr=="object"&&qr&&qr.Object===Object&&qr,Jv=Qv,Xv=Jv,e0=typeof self=="object"&&self&&self.Object===Object&&self,t0=Xv||e0||Function("return this")(),Fd=t0,n0=Fd,r0=function(){return n0.Date.now()},a0=r0,i0=/\s/;function s0(e){for(var t=e.length;t--&&i0.test(e.charAt(t)););return t}var o0=s0,u0=o0,l0=/^\s+/;function c0(e){return e&&e.slice(0,u0(e)+1).replace(l0,"")}var d0=c0,f0=Fd,h0=f0.Symbol,Td=h0,Ru=Td,Sd=Object.prototype,m0=Sd.hasOwnProperty,p0=Sd.toString,fr=Ru?Ru.toStringTag:void 0;function g0(e){var t=m0.call(e,fr),n=e[fr];try{e[fr]=void 0;var r=!0}catch{}var a=p0.call(e);return r&&(t?e[fr]=n:delete e[fr]),a}var v0=g0,b0=Object.prototype,y0=b0.toString;function D0(e){return y0.call(e)}var x0=D0,Mu=Td,C0=v0,w0=x0,E0="[object Null]",k0="[object Undefined]",Iu=Mu?Mu.toStringTag:void 0;function _0(e){return e==null?e===void 0?k0:E0:Iu&&Iu in Object(e)?C0(e):w0(e)}var B0=_0;function A0(e){return e!=null&&typeof e=="object"}var F0=A0,T0=B0,S0=F0,j0="[object Symbol]";function O0(e){return typeof e=="symbol"||S0(e)&&T0(e)==j0}var P0=O0,N0=d0,$u=ao,R0=P0,Lu=0/0,M0=/^[-+]0x[0-9a-f]+$/i,I0=/^0b[01]+$/i,$0=/^0o[0-7]+$/i,L0=parseInt;function z0(e){if(typeof e=="number")return e;if(R0(e))return Lu;if($u(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=$u(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=N0(e);var n=I0.test(e);return n||$0.test(e)?L0(e.slice(2),n?2:8):M0.test(e)?Lu:+e}var q0=z0,W0=ao,Di=a0,zu=q0,H0="Expected a function",U0=Math.max,V0=Math.min;function K0(e,t,n){var r,a,i,s,o,l,u=0,d=!1,h=!1,p=!0;if(typeof e!="function")throw new TypeError(H0);t=zu(t)||0,W0(n)&&(d=!!n.leading,h="maxWait"in n,i=h?U0(zu(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function m(F){var S=r,z=a;return r=a=void 0,u=F,s=e.apply(z,S),s}function g(F){return u=F,o=setTimeout(b,t),d?m(F):s}function f(F){var S=F-l,z=F-u,N=t-S;return h?V0(N,i-z):N}function x(F){var S=F-l,z=F-u;return l===void 0||S>=t||S<0||h&&z>=i}function b(){var F=Di();if(x(F))return _(F);o=setTimeout(b,f(F))}function _(F){return o=void 0,p&&r?m(F):(r=a=void 0,s)}function k(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function w(){return o===void 0?s:_(Di())}function C(){var F=Di(),S=x(F);if(r=arguments,a=this,l=F,S){if(o===void 0)return g(l);if(h)return clearTimeout(o),o=setTimeout(b,t),m(l)}return o===void 0&&(o=setTimeout(b,t)),s}return C.cancel=k,C.flush=w,C}var jd=K0;const Z0=kn(jd);var Y0=jd,G0=ao,Q0="Expected a function";function J0(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(Q0);return G0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),Y0(e,t,{leading:r,maxWait:t,trailing:a})}var X0=J0;const eb=kn(X0),qu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Wu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",xi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Wu(n.overflowY,t)||Wu(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},Yr=(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,tb=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Hu=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,h=typeof u=="function"?u:H=>H!==u;if(!qu(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,m=[];let g=e;for(;qu(g)&&h(g);){if(g=tb(g),g===p){m.push(g);break}g!=null&&g===document.body&&xi(g)&&!xi(document.documentElement)||g!=null&&xi(g,d)&&m.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,x=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:b,scrollY:_}=window,{height:k,width:w,top:C,right:F,bottom:S,left:z}=e.getBoundingClientRect(),{top:N,right:$,bottom:L,left:E}=(H=>{const q=window.getComputedStyle(H);return{top:parseFloat(q.scrollMarginTop)||0,right:parseFloat(q.scrollMarginRight)||0,bottom:parseFloat(q.scrollMarginBottom)||0,left:parseFloat(q.scrollMarginLeft)||0}})(e);let A=o==="start"||o==="nearest"?C-N:o==="end"?S+L:C+k/2-N+L,j=l==="center"?z+w/2-E+$:l==="end"?F+$:z-E;const I=[];for(let H=0;H<m.length;H++){const q=m[H],{height:re,width:ne,top:v,right:W,bottom:V,left:B}=q.getBoundingClientRect();if(s==="if-needed"&&C>=0&&z>=0&&S<=x&&F<=f&&C>=v&&S<=V&&z>=B&&F<=W)return I;const T=getComputedStyle(q),R=parseInt(T.borderLeftWidth,10),M=parseInt(T.borderTopWidth,10),K=parseInt(T.borderRightWidth,10),ee=parseInt(T.borderBottomWidth,10);let te=0,ae=0;const le="offsetWidth"in q?q.offsetWidth-q.clientWidth-R-K:0,J="offsetHeight"in q?q.offsetHeight-q.clientHeight-M-ee:0,pe="offsetWidth"in q?q.offsetWidth===0?0:ne/q.offsetWidth:0,he="offsetHeight"in q?q.offsetHeight===0?0:re/q.offsetHeight:0;if(p===q)te=o==="start"?A:o==="end"?A-x:o==="nearest"?Yr(_,_+x,x,M,ee,_+A,_+A+k,k):A-x/2,ae=l==="start"?j:l==="center"?j-f/2:l==="end"?j-f:Yr(b,b+f,f,R,K,b+j,b+j+w,w),te=Math.max(0,te+_),ae=Math.max(0,ae+b);else{te=o==="start"?A-v-M:o==="end"?A-V+ee+J:o==="nearest"?Yr(v,V,re,M,ee+J,A,A+k,k):A-(v+re/2)+J/2,ae=l==="start"?j-B-R:l==="center"?j-(B+ne/2)+le/2:l==="end"?j-W+K+le:Yr(B,W,ne,R,K+le,j,j+w,w);const{scrollLeft:Ce,scrollTop:Ae}=q;te=he===0?0:Math.max(0,Math.min(Ae+te/he,q.scrollHeight-re/he+J)),ae=pe===0?0:Math.max(0,Math.min(Ce+ae/pe,q.scrollWidth-ne/pe+le)),A+=Ae-te,j+=Ce-ae}I.push({el:q,top:te,left:ae})}return I},nb=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function rb(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(Hu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Hu(e,nb(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var vn=[],ab=function(){return vn.some(function(e){return e.activeTargets.length>0})},ib=function(){return vn.some(function(e){return e.skippedTargets.length>0})},Uu="ResizeObserver loop completed with undelivered notifications.",sb=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Uu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Uu),window.dispatchEvent(e)},Sr;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Sr||(Sr={}));var bn=function(e){return Object.freeze(e)},ob=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,bn(this)}return e}(),Od=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,bn(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}(),io=function(e){return e instanceof SVGElement&&"getBBox"in e},Pd=function(e){if(io(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)},Vu=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)},ub=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},yr=typeof window<"u"?window:{},Gr=new WeakMap,Ku=/auto|scroll/,lb=/^tb|vertical/,cb=/msie|trident/i.test(yr.navigator&&yr.navigator.userAgent),Tt=function(e){return parseFloat(e||"0")},Hn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new ob((n?t:e)||0,(n?e:t)||0)},Zu=bn({devicePixelContentBoxSize:Hn(),borderBoxSize:Hn(),contentBoxSize:Hn(),contentRect:new Od(0,0,0,0)}),Nd=function(e,t){if(t===void 0&&(t=!1),Gr.has(e)&&!t)return Gr.get(e);if(Pd(e))return Gr.set(e,Zu),Zu;var n=getComputedStyle(e),r=io(e)&&e.ownerSVGElement&&e.getBBox(),a=!cb&&n.boxSizing==="border-box",i=lb.test(n.writingMode||""),s=!r&&Ku.test(n.overflowY||""),o=!r&&Ku.test(n.overflowX||""),l=r?0:Tt(n.paddingTop),u=r?0:Tt(n.paddingRight),d=r?0:Tt(n.paddingBottom),h=r?0:Tt(n.paddingLeft),p=r?0:Tt(n.borderTopWidth),m=r?0:Tt(n.borderRightWidth),g=r?0:Tt(n.borderBottomWidth),f=r?0:Tt(n.borderLeftWidth),x=h+u,b=l+d,_=f+m,k=p+g,w=o?e.offsetHeight-k-e.clientHeight:0,C=s?e.offsetWidth-_-e.clientWidth:0,F=a?x+_:0,S=a?b+k:0,z=r?r.width:Tt(n.width)-F-C,N=r?r.height:Tt(n.height)-S-w,$=z+x+C+_,L=N+b+w+k,E=bn({devicePixelContentBoxSize:Hn(Math.round(z*devicePixelRatio),Math.round(N*devicePixelRatio),i),borderBoxSize:Hn($,L,i),contentBoxSize:Hn(z,N,i),contentRect:new Od(h,l,z,N)});return Gr.set(e,E),E},Rd=function(e,t,n){var r=Nd(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Sr.DEVICE_PIXEL_CONTENT_BOX:return s;case Sr.BORDER_BOX:return a;default:return i}},db=function(){function e(t){var n=Nd(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=bn([n.borderBoxSize]),this.contentBoxSize=bn([n.contentBoxSize]),this.devicePixelContentBoxSize=bn([n.devicePixelContentBoxSize])}return e}(),Md=function(e){if(Pd(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},fb=function(){var e=1/0,t=[];vn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var d=new db(u.target),h=Md(u.target);o.push(d),u.lastReportedSize=Rd(u.target,u.observedBox),h<e&&(e=h)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},Yu=function(e){vn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(Md(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},hb=function(){var e=0;for(Yu(e);ab();)e=fb(),Yu(e);return ib()&&sb(),e>0},Ci,Id=[],mb=function(){return Id.splice(0).forEach(function(e){return e()})},pb=function(e){if(!Ci){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return mb()}).observe(n,r),Ci=function(){n.textContent="".concat(t?t--:t++)}}Id.push(e),Ci()},gb=function(e){pb(function(){requestAnimationFrame(e)})},ha=0,vb=function(){return!!ha},bb=250,yb={attributes:!0,characterData:!0,childList:!0,subtree:!0},Gu=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Qu=function(e){return e===void 0&&(e=0),Date.now()+e},wi=!1,Db=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=bb),!wi){wi=!0;var r=Qu(t);gb(function(){var a=!1;try{a=hb()}finally{if(wi=!1,t=r-Qu(),!vb())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,yb)};document.body?n():yr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Gu.forEach(function(n){return yr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Gu.forEach(function(n){return yr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),ys=new Db,Ju=function(e){!ha&&e>0&&ys.start(),ha+=e,!ha&&ys.stop()},xb=function(e){return!io(e)&&!ub(e)&&getComputedStyle(e).display==="inline"},Cb=function(){function e(t,n){this.target=t,this.observedBox=n||Sr.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=Rd(this.target,this.observedBox,!0);return xb(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),wb=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Qr=new WeakMap,Xu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Jr=function(){function e(){}return e.connect=function(t,n){var r=new wb(t,n);Qr.set(t,r)},e.observe=function(t,n,r){var a=Qr.get(t),i=a.observationTargets.length===0;Xu(a.observationTargets,n)<0&&(i&&vn.push(a),a.observationTargets.push(new Cb(n,r&&r.box)),Ju(1),ys.schedule())},e.unobserve=function(t,n){var r=Qr.get(t),a=Xu(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&vn.splice(vn.indexOf(r),1),r.observationTargets.splice(a,1),Ju(-1))},e.disconnect=function(t){var n=this,r=Qr.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),Eb=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.");Jr.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(!Vu(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Jr.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(!Vu(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Jr.unobserve(this,t)},e.prototype.disconnect=function(){Jr.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Yt={};Object.defineProperty(Yt,"__esModule",{value:!0});var kb=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Ei={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},$d={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:kb?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},so={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 Xr=1;Xr<20;Xr++)so["f"+Xr]=111+Xr;function Xa(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Ld(s,t)}),a=function(o){return r.some(function(l){return zd(l,o)})},i=n==null?a:a(n);return i}function _b(e,t){return Xa(e,t)}function Bb(e,t){return Xa(e,{byKey:!0},t)}function Ld(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in Ei)r[Ei[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var d=a[Symbol.iterator](),h;!(o=(h=d.next()).done);o=!0){var p=h.value,m=p.endsWith("?")&&p.length>1;m&&(p=p.slice(0,-1));var g=oo(p),f=Ei[g];if(p.length>1&&!f&&!$d[p]&&!so[g])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!f)&&(n?r.key=g:r.which=qd(p)),f&&(r[f]=m?null:!0)}}catch(x){l=!0,u=x}finally{try{!o&&d.return&&d.return()}finally{if(l)throw u}}return r}function zd(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 qd(e){e=oo(e);var t=so[e]||e.toUpperCase().charCodeAt(0);return t}function oo(e){return e=e.toLowerCase(),e=$d[e]||e,e}var Ab=Yt.default=Xa,ki=Yt.isHotkey=Xa;Yt.isCodeHotkey=_b;Yt.isKeyHotkey=Bb;Yt.parseHotkey=Ld;Yt.compareHotkey=zd;Yt.toKeyCode=qd;Yt.toKeyName=oo;function Fb(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 Gn(e,t){if(e==null)return{};var n=Fb(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 jr(e){"@babel/helpers - typeof";return jr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jr(e)}function Tb(e,t){if(jr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(jr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sb(e){var t=Tb(e,"string");return jr(t)==="symbol"?t:String(t)}function wt(e,t,n){return t=Sb(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var uo=D.createContext(null),un=()=>{var e=D.useContext(uo);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Wd=parseInt(D.version.split(".")[0],10),jb=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,el=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),ot=typeof navigator<"u"&&/Android/.test(navigator.userAgent),zn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),gr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),Ob=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Hd=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Pb=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Nb=ot&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),Rb=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),Mb=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),Ib=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ma=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Qt=(!Pb||!Nb)&&!Ob&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",lo=new WeakMap,co=new WeakMap,Ud=new WeakMap,pa=new WeakMap,Ds=new WeakMap,Or=new WeakMap,yn=new WeakMap,Aa=new WeakMap,ei=new WeakMap,xs=new WeakMap,rn=new WeakMap,pn=new WeakMap,Dr=new WeakMap,Cs=new WeakMap,fo=new WeakMap,Bt=new WeakMap,Ut=new WeakMap,ct=new WeakMap,Xt=new WeakMap,en=new WeakMap,Vd=new WeakMap,Qn=Symbol("placeholder"),Kd=Symbol("mark-placeholder"),$b=globalThis.Text,ho=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,Lb=e=>an(e)&&e.nodeType===8,Ct=e=>an(e)&&e.nodeType===1,an=e=>{var t=ho(e);return!!t&&e instanceof t.Node},ws=e=>{var t=e&&e.anchorNode&&ho(e.anchorNode);return!!t&&e instanceof t.Selection},Zd=e=>an(e)&&e.nodeType===3,zb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,qb=e=>{var[t,n]=e;if(Ct(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=Yd(t,a,r?"backward":"forward"),r=a<n;Ct(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=Hb(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},Wb=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Yd=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(Lb(a)||Ct(a)&&a.childNodes.length===0||Ct(a)&&a.getAttribute("contenteditable")==="false")&&!(s&&o);){if(i>=r.length){s=!0,i=t-1,n="backward";continue}if(i<0){o=!0,i=t+1,n="forward";continue}a=r[i],t=i,i+=n==="forward"?1:-1}return[a,t]},Hb=(e,t,n)=>{var[r]=Yd(e,t,n);return r},Gd=e=>{var t="";if(Zd(e)&&e.nodeValue)return e.nodeValue;if(Ct(e)){for(var n of Array.from(e.childNodes))t+=Gd(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
|
|
105
|
-
`)}return t},
|
|
104
|
+
*/function Xo(e){return Object.prototype.toString.call(e)==="[object Object]"}function tt(e){var t,n;return Xo(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Xo(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var bd=Symbol.for("immer-nothing"),eu=Symbol.for("immer-draftable"),vt=Symbol.for("immer-state"),hp=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function dt(e,...t){if(process.env.NODE_ENV!=="production"){const n=hp[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Gn=Object.getPrototypeOf;function wn(e){return!!e&&!!e[vt]}function En(e){var t;return e?yd(e)||Array.isArray(e)||!!e[eu]||!!((t=e.constructor)!=null&&t[eu])||Qa(e)||Ja(e):!1}var mp=Object.prototype.constructor.toString();function yd(e){if(!e||typeof e!="object")return!1;const t=Gn(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===mp}function Ea(e,t){Ga(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Ga(e){const t=e[vt];return t?t.type_:Array.isArray(e)?1:Qa(e)?2:Ja(e)?3:0}function ms(e,t){return Ga(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Dd(e,t,n){const r=Ga(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function pp(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Qa(e){return e instanceof Map}function Ja(e){return e instanceof Set}function fn(e){return e.copy_||e.base_}function ps(e,t){if(Qa(e))return new Map(e);if(Ja(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&yd(e))return Gn(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[vt];let r=Reflect.ownKeys(n);for(let a=0;a<r.length;a++){const i=r[a],s=n[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Gn(e),n)}function Xs(e,t=!1){return Xa(e)||wn(e)||!En(e)||(Ga(e)>1&&(e.set=e.add=e.clear=e.delete=gp),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Xs(r,!0))),e}function gp(){dt(2)}function Xa(e){return Object.isFrozen(e)}var vp={};function kn(e){const t=vp[e];return t||dt(0,e),t}var Tr;function xd(){return Tr}function bp(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function tu(e,t){t&&(kn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function gs(e){vs(e),e.drafts_.forEach(yp),e.drafts_=null}function vs(e){e===Tr&&(Tr=e.parent_)}function nu(e){return Tr=bp(Tr,e)}function yp(e){const t=e[vt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function ru(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[vt].modified_&&(gs(t),dt(4)),En(e)&&(e=ka(t,e),t.parent_||_a(t,e)),t.patches_&&kn("Patches").generateReplacementPatches_(n[vt].base_,e,t.patches_,t.inversePatches_)):e=ka(t,n,[]),gs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==bd?e:void 0}function ka(e,t,n){if(Xa(t))return t;const r=t[vt];if(!r)return Ea(t,(a,i)=>au(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return _a(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const a=r.copy_;let i=a,s=!1;r.type_===3&&(i=new Set(a),a.clear(),s=!0),Ea(i,(o,l)=>au(e,r,a,o,l,n,s)),_a(e,a,!1),n&&e.patches_&&kn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function au(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&dt(5),wn(a)){const o=i&&t&&t.type_!==3&&!ms(t.assigned_,r)?i.concat(r):void 0,l=ka(e,a,o);if(Dd(n,r,l),wn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(En(a)&&!Xa(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ka(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&_a(e,a)}}function _a(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Xs(t,n)}function Dp(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:xd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=eo;n&&(a=[r],i=Sr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var eo={get(e,t){if(t===vt)return e;const n=fn(e);if(!ms(n,t))return xp(e,n,t);const r=n[t];return e.finalized_||!En(r)?r:r===vi(e.base_,t)?(bi(e),e.copy_[t]=ys(r,e)):r},has(e,t){return t in fn(e)},ownKeys(e){return Reflect.ownKeys(fn(e))},set(e,t,n){const r=Cd(fn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=vi(fn(e),t),i=a==null?void 0:a[vt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(pp(n,a)&&(n!==void 0||ms(e.base_,t)))return!0;bi(e),bs(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return vi(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,bi(e),bs(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=fn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){dt(11)},getPrototypeOf(e){return Gn(e.base_)},setPrototypeOf(){dt(12)}},Sr={};Ea(eo,(e,t)=>{Sr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Sr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&dt(13),Sr.set.call(this,e,t,void 0)};Sr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&dt(14),eo.set.call(this,e[0],t,n,e[0])};function vi(e,t){const n=e[vt];return(n?fn(n):e)[t]}function xp(e,t,n){var a;const r=Cd(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function Cd(e,t){if(!(t in e))return;let n=Gn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Gn(n)}}function bs(e){e.modified_||(e.modified_=!0,e.parent_&&bs(e.parent_))}function bi(e){e.copy_||(e.copy_=ps(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Cp=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,c=>n.call(this,c,...u))}}typeof n!="function"&&dt(6),r!==void 0&&typeof r!="function"&&dt(7);let a;if(En(t)){const i=nu(this),s=ys(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?gs(i):vs(i)}return tu(i,r),ru(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===bd&&(a=void 0),this.autoFreeze_&&Xs(a,!0),r){const i=[],s=[];kn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else dt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,l=>t(l,...o));let r,a;return[this.produce(t,n,(s,o)=>{r=s,a=o}),r,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){En(e)||dt(8),wn(e)&&(e=wp(e));const t=nu(this),n=ys(e,void 0);return n[vt].isManual_=!0,vs(t),n}finishDraft(e,t){const n=e&&e[vt];(!n||!n.isManual_)&&dt(9);const{scope_:r}=n;return tu(r,t),ru(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=kn("Patches").applyPatches_;return wn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function ys(e,t){const n=Qa(e)?kn("MapSet").proxyMap_(e,t):Ja(e)?kn("MapSet").proxySet_(e,t):Dp(e,t);return(t?t.scope_:xd()).drafts_.push(n),n}function wp(e){return wn(e)||dt(10,e),wd(e)}function wd(e){if(!En(e)||Xa(e))return e;const t=e[vt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ps(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ps(e,!0);return Ea(n,(r,a)=>{Dd(n,r,wd(a))}),t&&(t.finalized_=!1),n}var bt=new Cp,to=bt.produce;bt.produceWithPatches.bind(bt);bt.setAutoFreeze.bind(bt);bt.setUseStrictShallowCopy.bind(bt);bt.applyPatches.bind(bt);var iu=bt.createDraft.bind(bt),su=bt.finishDraft.bind(bt),Ep={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=O.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},kp={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=Ee.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},_p={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=K.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Ba=new WeakMap,Aa=new WeakMap,yr=new WeakMap,Ed=new WeakMap,ou=new WeakMap,uu=new WeakMap,lu=new WeakMap,O={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=O.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 O.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return O.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 O.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 O.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&O.compare(e,t)===0},isBefore(e,t){return O.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&O.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&O.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&O.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&O.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&&O.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(!O.isAncestor(t,e)&&!O.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;(O.equals(i,r)||O.endsBefore(i,r)||O.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(O.equals(s,r)||O.isAncestor(s,r))return null;O.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;O.equals(o,r)||O.endsBefore(o,r)?r[o.length-1]-=1:O.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:c}=t;if(O.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else O.endsBefore(u,r)?r[u.length-1]+=1:O.isAncestor(u,r)&&e[u.length]>=c&&(r[u.length-1]+=1,r[u.length]-=c);break}case"move_node":{var{path:h,newPath:p}=t;if(O.equals(h,p))return r;if(O.isAncestor(h,r)||O.equals(h,r)){var m=p.slice();return O.endsBefore(h,p)&&h.length<p.length&&(m[h.length-1]-=1),m.concat(r.slice(h.length))}else O.isSibling(h,p)&&(O.isAncestor(p,r)||O.equals(p,r))?O.endsBefore(h,r)?r[h.length-1]-=1:r[h.length-1]+=1:O.endsBefore(p,r)||O.equals(p,r)||O.isAncestor(p,r)?(O.endsBefore(h,r)&&(r[h.length-1]-=1),r[p.length-1]+=1):O.endsBefore(h,r)&&(O.equals(p,r)&&(r[p.length-1]+=1),r[h.length-1]-=1);break}}return r}};function jr(e){"@babel/helpers - typeof";return jr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jr(e)}function Bp(e,t){if(jr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(jr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ap(e){var t=Bp(e,"string");return jr(t)==="symbol"?t:String(t)}function ut(e,t,n){return t=Ap(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function fr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Fp=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=oe.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of K.points(t))t[l]=Ee.transform(o,n);break}case"insert_text":{var{path:u,offset:c,text:h}=n;if(h.length===0)break;var p=oe.leaf(e,u),m=p.text.slice(0,c),g=p.text.slice(c);if(p.text=m+h+g,t)for(var[f,y]of K.points(t))t[y]=Ee.transform(f,n);break}case"merge_node":{var{path:v}=n,k=oe.get(e,v),B=O.previous(v),C=oe.get(e,B),w=oe.parent(e,v),T=v[v.length-1];if(fe.isText(k)&&fe.isText(C))C.text+=k.text;else if(!fe.isText(k)&&!fe.isText(C))C.children.push(...k.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(Xe.stringify(k)," ").concat(Xe.stringify(C)));if(w.children.splice(T,1),t)for(var[S,q]of K.points(t))t[q]=Ee.transform(S,n);break}case"move_node":{var{path:P,newPath:L}=n;if(O.isAncestor(P,L))throw new Error("Cannot move a path [".concat(P,"] to new path [").concat(L,"] because the destination is inside itself."));var z=oe.get(e,P),E=oe.parent(e,P),A=P[P.length-1];E.children.splice(A,1);var N=O.transform(P,n),R=oe.get(e,O.parent(N)),H=N[N.length-1];if(R.children.splice(H,0,z),t)for(var[G,Q]of K.points(t))t[Q]=Ee.transform(G,n);break}case"remove_node":{var{path:re}=n,x=re[re.length-1],$=oe.parent(e,re);if($.children.splice(x,1),t)for(var[W,_]of K.points(t)){var F=Ee.transform(W,n);if(t!=null&&F!=null)t[_]=F;else{var I=void 0,M=void 0;for(var[V,ne]of oe.texts(e))if(O.compare(ne,re)===-1)I=[V,ne];else{M=[V,ne];break}var te=!1;I&&M&&(O.equals(M[1],re)?te=!O.hasPrevious(M[1]):te=O.common(I[1],re).length<O.common(M[1],re).length),I&&!te?(W.path=I[1],W.offset=I[0].text.length):M?(W.path=M[1],W.offset=0):t=null}}break}case"remove_text":{var{path:ae,offset:le,text:J}=n;if(J.length===0)break;var ge=oe.leaf(e,ae),he=ge.text.slice(0,le),ye=ge.text.slice(le+J.length);if(ge.text=he+ye,t)for(var[Ae,Fe]of K.points(t))t[Fe]=Ee.transform(Ae,n);break}case"set_node":{var{path:He,properties:Se,newProperties:Te}=n;if(He.length===0)throw new Error("Cannot set properties on the root node!");var Ne=oe.get(e,He);for(var ke in Te){if(ke==="children"||ke==="text")throw new Error('Cannot set the "'.concat(ke,'" property of nodes!'));var Ue=Te[ke];Ue==null?delete Ne[ke]:Ne[ke]=Ue}for(var pe in Se)Te.hasOwnProperty(pe)||delete Ne[pe];break}case"set_selection":{var{newProperties:U}=n;if(U==null)t=U;else{if(t==null){if(!K.isRange(U))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Xe.stringify(U)," when there is no current selection."));t=fr({},U)}for(var ie in U){var me=U[ie];if(me==null){if(ie==="anchor"||ie==="focus")throw new Error('Cannot remove the "'.concat(ie,'" selection property'));delete t[ie]}else t[ie]=me}}break}case"split_node":{var{path:ve,position:we,properties:Ke}=n;if(ve.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ve,"] because the root node cannot be split."));var Qe=oe.get(e,ve),mt=oe.parent(e,ve),zt=ve[ve.length-1],_t;if(fe.isText(Qe)){var et=Qe.text.slice(0,we),Tt=Qe.text.slice(we);Qe.text=et,_t=fr(fr({},Ke),{},{text:Tt})}else{var pt=Qe.children.slice(0,we),ii=Qe.children.slice(we);Qe.children=pt,_t=fr(fr({},Ke),{},{children:ii})}if(mt.children.splice(zt+1,0,_t),t)for(var[or,Wr]of K.points(t))t[Wr]=Ee.transform(or,n);break}}return t},Tp={transform(e,t){e.children=iu(e.children);var n=e.selection&&iu(e.selection);try{n=Fp(e,n,t)}finally{e.children=su(e.children),n?e.selection=wn(n)?su(n):n:e.selection=null}}},Sp={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)}},jp={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)}},kd=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(tt(r)&&tt(a)){if(!kd(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 Op(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Zt(e,t){if(e==null)return{};var n=Op(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 Pp=["anchor","focus"];function du(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Np(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?du(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):du(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var K={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return K.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=K.edges(e);return t},equals(e,t){return Ee.equals(e.anchor,t.anchor)&&Ee.equals(e.focus,t.focus)},includes(e,t){if(K.isRange(t)){if(K.includes(e,t.anchor)||K.includes(e,t.focus))return!0;var[n,r]=K.edges(e),[a,i]=K.edges(t);return Ee.isBefore(n,a)&&Ee.isAfter(r,i)}var[s,o]=K.edges(e),l=!1,u=!1;return Ee.isPoint(t)?(l=Ee.compare(t,s)>=0,u=Ee.compare(t,o)<=0):(l=O.compare(t,s.path)>=0,u=O.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=Zt(e,Pp),[r,a]=K.edges(e),[i,s]=K.edges(t),o=Ee.isBefore(r,i)?i:r,l=Ee.isBefore(a,s)?a:s;return Ee.isBefore(l,o)?null:Np({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return Ee.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return Ee.equals(t,n)},isExpanded(e){return!K.isCollapsed(e)},isForward(e){return!K.isBackward(e)},isRange(e){return tt(e)&&Ee.isPoint(e.anchor)&&Ee.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=K.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return to(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=K.isCollapsed(r);K.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?K.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=Ee.transform(r.anchor,t,{affinity:i}),u=Ee.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},fu=e=>tt(e)&&oe.isNodeList(e.children)&&!b.isEditor(e),de={isAncestor(e){return tt(e)&&oe.isNodeList(e.children)},isElement:fu,isElementList(e){return Array.isArray(e)&&e.every(t=>de.isElement(t))},isElementProps(e){return e.children!==void 0},isElementType:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"type";return fu(t)&&t[r]===n},matches(e,t){for(var n in t)if(n!=="children"&&e[n]!==t[n])return!1;return!0}},Rp=["children"],Mp=["text"],hu=new WeakMap,oe={ancestor(e,t){var n=oe.get(e,t);if(fe.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(Xe.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of O.ancestors(t,n)){var a=oe.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(fe.isText(e))throw new Error("Cannot get the child of a text node: ".concat(Xe.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Xe.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=oe.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=oe.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=O.common(t,n),a=oe.get(e,r);return[a,r]},descendant(e,t){var n=oe.get(e,t);if(b.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Xe.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of oe.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of oe.nodes(e,t))de.isElement(n)&&(yield[n,r])}()},extractProps(e){if(de.isAncestor(e)){var t=Zt(e,Rp);return t}else{var t=Zt(e,Mp);return t}},first(e,t){for(var n=t.slice(),r=oe.get(e,n);r&&!(fe.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(fe.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(Xe.stringify(e)));var n=to({children:e.children},r=>{var[a,i]=K.edges(t),s=oe.nodes(r,{reverse:!0,pass:p=>{var[,m]=p;return!K.includes(t,m)}});for(var[,o]of s){if(!K.includes(t,o)){var l=oe.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(O.equals(o,i.path)){var c=oe.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(O.equals(o,a.path)){var h=oe.leaf(r,o);h.text=h.text.slice(a.offset)}}b.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(fe.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Xe.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(fe.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return fe.isText(e)||de.isElement(e)||b.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=hu.get(e);if(t!==void 0)return t;var n=e.every(r=>oe.isNode(r));return hu.set(e,n),n},last(e,t){for(var n=t.slice(),r=oe.get(e,n);r&&!(fe.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=oe.get(e,t);if(!fe.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(Xe.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of O.levels(t,n)){var a=oe.get(e,r);yield[a,r]}}()},matches(e,t){return de.isElement(e)&&de.isElementProps(t)&&de.matches(e,t)||fe.isText(e)&&fe.isTextProps(t)&&fe.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?O.isBefore(o,i):O.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!fe.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;O.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=oe.get(e,o);continue}if(o.length===0)break;if(!r){var c=O.next(o);if(oe.has(e,c)){o=c,l=oe.get(e,o);continue}}if(r&&o[o.length-1]!==0){var h=O.previous(o);o=h,l=oe.get(e,o);continue}o=O.parent(o),l=oe.get(e,o),s.add(l)}}()},parent(e,t){var n=O.parent(t),r=oe.get(e,n);if(fe.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string(e){return fe.isText(e)?e.text:e.children.map(oe.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of oe.nodes(e,t))fe.isText(n)&&(yield[n,r])}()}};function mu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function qe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?mu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var rn={isNodeOperation(e){return rn.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!tt(e))return!1;switch(e.type){case"insert_node":return O.isPath(e.path)&&oe.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&O.isPath(e.path);case"merge_node":return typeof e.position=="number"&&O.isPath(e.path)&&tt(e.properties);case"move_node":return O.isPath(e.path)&&O.isPath(e.newPath);case"remove_node":return O.isPath(e.path)&&oe.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&O.isPath(e.path);case"set_node":return O.isPath(e.path)&&tt(e.properties)&&tt(e.newProperties);case"set_selection":return e.properties===null&&K.isRange(e.newProperties)||e.newProperties===null&&K.isRange(e.properties)||tt(e.properties)&&tt(e.newProperties);case"split_node":return O.isPath(e.path)&&typeof e.position=="number"&&tt(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>rn.isOperation(t))},isSelectionOperation(e){return rn.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return rn.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return qe(qe({},e),{},{type:"remove_node"});case"insert_text":return qe(qe({},e),{},{type:"remove_text"});case"merge_node":return qe(qe({},e),{},{type:"split_node",path:O.previous(e.path)});case"move_node":{var{newPath:t,path:n}=e;if(O.equals(t,n))return e;if(O.isSibling(n,t))return qe(qe({},e),{},{path:t,newPath:n});var r=O.transform(n,e),a=O.transform(O.next(n),e);return qe(qe({},e),{},{path:r,newPath:a})}case"remove_node":return qe(qe({},e),{},{type:"insert_node"});case"remove_text":return qe(qe({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return qe(qe({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?qe(qe({},e),{},{properties:l,newProperties:null}):l==null?qe(qe({},e),{},{properties:null,newProperties:o}):qe(qe({},e),{},{properties:l,newProperties:o})}case"split_node":return qe(qe({},e),{},{type:"merge_node",path:O.next(e.path)})}}},pu=new WeakMap,Ip=e=>{var t=pu.get(e);if(t!==void 0)return t;if(!tt(e))return!1;var n=typeof e.addMark=="function"&&typeof e.apply=="function"&&typeof e.deleteFragment=="function"&&typeof e.insertBreak=="function"&&typeof e.insertSoftBreak=="function"&&typeof e.insertFragment=="function"&&typeof e.insertNode=="function"&&typeof e.insertText=="function"&&typeof e.isElementReadOnly=="function"&&typeof e.isInline=="function"&&typeof e.isSelectable=="function"&&typeof e.isVoid=="function"&&typeof e.normalizeNode=="function"&&typeof e.onChange=="function"&&typeof e.removeMark=="function"&&typeof e.getDirtyPaths=="function"&&(e.marks===null||tt(e.marks))&&(e.selection===null||K.isRange(e.selection))&&oe.isNodeList(e.children)&&rn.isOperationList(e.operations);return pu.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 Ip(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)}},$p={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(O.isPath)}};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 vu(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){ut(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 Ee={compare(e,t){var n=O.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return Ee.compare(e,t)===1},isBefore(e,t){return Ee.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&O.equals(e.path,t.path)},isPoint(e){return tt(e)&&typeof e.offset=="number"&&O.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return to(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=O.transform(i,t,n);break}case"insert_text":{O.equals(t.path,i)&&(t.offset<s||t.offset===s&&a==="forward")&&(r.offset+=t.text.length);break}case"merge_node":{O.equals(t.path,i)&&(r.offset+=t.position),r.path=O.transform(i,t,n);break}case"remove_text":{O.equals(t.path,i)&&t.offset<=s&&(r.offset-=Math.min(s-t.offset,t.text.length));break}case"remove_node":{if(O.equals(t.path,i)||O.isAncestor(t.path,i))return null;r.path=O.transform(i,t,n);break}case"split_node":{if(O.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=O.transform(i,t,vu(vu({},n),{},{affinity:"forward"})))}else r.path=O.transform(i,t,n);break}}})}},bu=void 0,Xe={setScrubber(e){bu=e},stringify(e){return JSON.stringify(e,bu)}},Lp=["text"],zp=["anchor","focus"];function yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Wt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var fe={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Zt(i,Lp);return s}return kd(r?a(e):e,r?a(t):t)},isText(e){return tt(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>fe.isText(t))},isTextProps(e){return e.text!==void 0},matches(e,t){for(var n in t)if(n!=="text"&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[Wt({},e)];for(var r of t){var a=Zt(r,zp),[i,s]=K.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var h of n){var{length:p}=h.text,m=l;if(l+=p,u<=m&&l<=c){Object.assign(h,a),o.push(h);continue}if(u!==c&&(u===l||c===m)||u>l||c<m||c===m&&m!==0){o.push(h);continue}var g=h,f=void 0,y=void 0;if(c<l){var v=c-m;y=Wt(Wt({},g),{},{text:g.text.slice(v)}),g=Wt(Wt({},g),{},{text:g.text.slice(0,v)})}if(u>m){var k=u-m;f=Wt(Wt({},g),{},{text:g.text.slice(0,k)}),g=Wt(Wt({},g),{},{text:g.text.slice(k)})}Object.assign(g,a),f&&o.push(f),o.push(g),y&&o.push(y)}n=o}return n}},no=e=>e.selection?e.selection:e.children.length>0?b.end(e,[]):[0],ir=(e,t)=>{var[n]=b.node(e,t);return r=>r===n},ro=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?Kp(t):t,i=Ce.None,s=Ce.None,o=0,l=null,u=null;for(var c of a){var h=c.codePointAt(0);if(!h)break;var p=ig(c,h);if([i,s]=r?[s,p]:[p,i],zn(i,Ce.ZWJ)&&zn(s,Ce.ExtPict)&&(r?l=Du(t.substring(0,o)):l=Du(t.substring(0,t.length-o)),!l)||zn(i,Ce.RI)&&zn(s,Ce.RI)&&(u!==null?u=!u:r?u=!0:u=cg(t.substring(0,t.length-o)),!u)||i!==Ce.None&&s!==Ce.None&&og(i,s))break;o+=c.length}return o||1},qp=/\s/,Wp=/[\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]/,Hp=/['\u2018\u2019]/,Up=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=ro(t,n),[s,o]=ao(t,i,n);if(Vp(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},ao=(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)]},Vp=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(qp.test(t))return!1;if(Hp.test(t)){var a=ro(n,r),[i,s]=ao(n,a,r);if(e(i,s,r))return!0}return!Wp.test(t)},Kp=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(Yp(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(Zp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},Zp=e=>e>=55296&&e<=56319,Yp=e=>e>=56320&&e<=57343,Ce;(function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"})(Ce||(Ce={}));var Gp=/^(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC01\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDE41\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4\uDF00\uDF01\uDF36-\uDF3A\uDF40\uDF42]|\uD80D[\uDC40\uDC47-\uDC55]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])$/,Qp=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,Jp=/^(?:[\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])$/,Xp=/^[\u1100-\u115F\uA960-\uA97C]$/,eg=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,tg=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,ng=/^[\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]$/,rg=/^[\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]$/,ag=/^(?:[\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])$/,ig=(e,t)=>{var n=Ce.Any;return e.search(Gp)!==-1&&(n|=Ce.Extend),t===8205&&(n|=Ce.ZWJ),t>=127462&&t<=127487&&(n|=Ce.RI),e.search(Qp)!==-1&&(n|=Ce.Prepend),e.search(Jp)!==-1&&(n|=Ce.SpacingMark),e.search(Xp)!==-1&&(n|=Ce.L),e.search(eg)!==-1&&(n|=Ce.V),e.search(tg)!==-1&&(n|=Ce.T),e.search(ng)!==-1&&(n|=Ce.LV),e.search(rg)!==-1&&(n|=Ce.LVT),e.search(ag)!==-1&&(n|=Ce.ExtPict),n};function zn(e,t){return(e&t)!==0}var sg=[[Ce.L,Ce.L|Ce.V|Ce.LV|Ce.LVT],[Ce.LV|Ce.V,Ce.V|Ce.T],[Ce.LVT|Ce.T,Ce.T],[Ce.Any,Ce.Extend|Ce.ZWJ],[Ce.Any,Ce.SpacingMark],[Ce.Prepend,Ce.Any],[Ce.ZWJ,Ce.ExtPict],[Ce.RI,Ce.RI]];function og(e,t){return sg.findIndex(n=>zn(e,n[0])&&zn(t,n[1]))===-1}var ug=/(?:[\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$/,Du=e=>e.search(ug)!==-1,lg=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,cg=e=>{var t=e.match(lg);if(t===null)return!1;var n=t[0].length/2;return n%2===1},dg={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=no(e)}=n;if(O.isPath(a)&&(a=b.range(e,a)),K.isRange(a))if(K.isCollapsed(a))a=a.anchor;else{var i=K.end(a);if(!r&&b.void(e,{at:i}))return;var s=K.start(a),o=b.pointRef(e,s),l=b.pointRef(e,i);X.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,X.setSelection(e,{anchor:a,focus:a})}if(!(!r&&b.void(e,{at:a})||b.elementReadOnly(e,{at:a}))){var{path:h,offset:p}=a;t.length>0&&e.apply({type:"insert_text",path:h,offset:p,text:t})}})}};function xu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Gr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var X=Gr(Gr(Gr(Gr({},Tp),Sp),jp),dg),ma=new WeakMap,fg=e=>ma.get(e)||!1,hg=(e,t,n)=>{var r=ma.get(e)||!1;ma.set(e,!0);try{t(),n()}finally{ma.set(e,r)}};function _d(e,t,n){var r=Ba.get(e)||[],a=Aa.get(e)||new Set,i,s,o=h=>{if(h){var p=h.join(",");s.has(p)||(s.add(p),i.push(h))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var c of t)o(c);Ba.set(e,i),Aa.set(e,s)}var mg=(e,t)=>{for(var n of b.pathRefs(e))Ep.transform(n,t);for(var r of b.pointRefs(e))kp.transform(r,t);for(var a of b.rangeRefs(e))_p.transform(a,t);if(!fg(e)){var i=O.operationCanTransformPath(t)?s=>O.transform(s,t):void 0;_d(e,e.getDirtyPaths(t),i)}X.transform(e,t),e.operations.push(t),b.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),yr.get(e)||(yr.set(e,!0),Promise.resolve().then(()=>{yr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},pg=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return O.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=O.levels(a),s=fe.isText(r)?[]:Array.from(oe.nodes(r),L=>{var[,z]=L;return a.concat(z)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=O.ancestors(o),u=O.previous(o);return[...l,u]}case"move_node":{var{path:c,newPath:h}=t;if(O.equals(c,h))return[];var p=[],m=[];for(var g of O.ancestors(c)){var f=O.transform(g,t);p.push(f)}for(var y of O.ancestors(h)){var v=O.transform(y,t);m.push(v)}var k=m[m.length-1],B=h[h.length-1],C=k.concat(B);return[...p,...m,C]}case"remove_node":{var{path:w}=t,T=O.ancestors(w);return[...T]}case"split_node":{var{path:S}=t,q=O.levels(S),P=O.next(S);return[...q,P]}default:return[]}},gg=e=>{var{selection:t}=e;return t?oe.fragment(e,t):[]},vg=(e,t)=>{var[n,r]=t;if(!fe.isText(n)){if(de.isElement(n)&&n.children.length===0){var a={text:""};X.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=b.isEditor(n)?!1:de.isElement(n)&&(e.isInline(n)||n.children.length===0||fe.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=oe.get(e,r);if(!fe.isText(l)){var u=l.children[s],c=l.children[s-1],h=o===n.children.length-1,p=fe.isText(u)||de.isElement(u)&&e.isInline(u);if(p!==i)X.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(de.isElement(u)){if(e.isInline(u)){if(c==null||!fe.isText(c)){var m={text:""};X.insertNodes(e,m,{at:r.concat(s),voids:!0}),s++}else if(h){var g={text:""};X.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&fe.isText(c)&&(fe.equals(u,c,{loose:!0})?(X.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(X.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(X.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},bg=(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},yg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:s}=n;if(i){var o=b.path(t,i),l=a==="lowest";for(var[u,c]of b.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!fe.isText(u)){if(K.isRange(i)){if(O.isAncestor(c,i.anchor.path)&&O.isAncestor(c,i.focus.path))return[u,c]}else if(!O.equals(o,c))return[u,c]}}};function Cu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function wu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Dg=(e,t,n)=>{var{selection:r}=e;if(r){var a=(h,p)=>{if(!fe.isText(h))return!1;var[m,g]=b.parent(e,p);return!e.isVoid(m)||e.markableVoid(m)},i=K.isExpanded(r),s=!1;if(!i){var[o,l]=b.node(e,r);if(o&&a(o,l)){var[u]=b.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)X.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=wu(wu({},b.marks(e)||{}),{},{[t]:n});e.marks=c,yr.get(e)||e.onChange()}}};function Eu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ku(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Eu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Eu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var xg=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,ku(ku({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};function _u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Bu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_u(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_u(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Cg=function(t,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,Bu(Bu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},wg=(e,t)=>{var{selection:n}=e;n&&K.isCollapsed(n)&&X.delete(e,{unit:t,reverse:!0})},Eg=(e,t)=>{var{selection:n}=e;n&&K.isCollapsed(n)&&X.delete(e,{unit:t})},kg=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&K.isExpanded(r)&&X.delete(t,{reverse:n==="backward"})},_g=(e,t)=>[b.start(e,t),b.end(e,t)];function Au(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Fu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Au(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Au(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Bg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,Fu(Fu({},n),{},{match:r=>de.isElement(r)&&b.isElementReadOnly(t,r)}))},Ag=(e,t)=>b.point(e,t,{edge:"end"}),Fg=(e,t)=>{var n=b.path(e,t,{edge:"start"});return b.node(e,n)},Tg=(e,t)=>{var n=b.range(e,t);return oe.fragment(e,n)};function Tu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Su(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Tu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Sg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,Su(Su({},n),{},{match:r=>de.isElement(r)&&b.isVoid(t,r)}))},jg=(e,t)=>t.children.some(n=>de.isElement(n)&&b.isBlock(e,n)),Og=(e,t)=>t.children.some(n=>fe.isText(n)||b.isInline(e,n)),Pg=(e,t)=>oe.has(e,t),Ng=(e,t)=>t.children.every(n=>fe.isText(n)),Rg=e=>{X.splitNodes(e,{always:!0})},Mg=(e,t,n)=>{X.insertNodes(e,t,n)},Ig=e=>{X.splitNodes(e,{always:!0})};function ju(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function $g(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ju(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ju(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Lg=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=$g({text:n},i);X.insertNodes(t,s,{at:r.at,voids:r.voids})}else X.insertText(t,n,r);t.marks=null}},zg=(e,t)=>!e.isInline(t),qg=(e,t,n)=>b.isStart(e,t,n)||b.isEnd(e,t,n),Wg=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&fe.isText(r)&&r.text===""&&!e.isVoid(t)},Hg=(e,t,n)=>{var r=b.end(e,n);return Ee.equals(t,r)},Ug=e=>{var t=Ed.get(e);return t===void 0?!0:t},Vg=(e,t,n)=>{if(t.offset!==0)return!1;var r=b.start(e,n);return Ee.equals(t,r)},Kg=(e,t)=>{var n=b.path(e,t,{edge:"end"});return b.node(e,n)},Zg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=oe.leaf(t,a);return[i,a]};function Yg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var s=[],o=b.path(e,n);for(var[l,u]of oe.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&de.isElement(l)&&b.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var Gg=["text"],Qg=["text"],Jg=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(K.isExpanded(r)){var s=b.isEnd(t,a,a.path);if(s){var o=b.after(t,a);o&&(a=o)}var[l]=b.nodes(t,{match:fe.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=Zt(u,Gg);return c}else return{}}var{path:h}=a,[p]=b.leaf(t,h);if(a.offset===0){var m=b.previous(t,{at:h,match:fe.isText}),g=b.above(t,{match:C=>de.isElement(C)&&b.isVoid(t,C)&&t.markableVoid(C)});if(!g){var f=b.above(t,{match:C=>de.isElement(C)&&b.isBlock(t,C)});if(m&&f){var[y,v]=m,[,k]=f;O.isAncestor(k,v)&&(p=y)}}}var B=Zt(p,Qg);return B},Xg=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(O.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(O.isPath(s)){var[c]=b.parent(t,s);i=p=>c.children.includes(p)}else i=()=>!0;var[h]=b.nodes(t,{at:u,match:i,mode:r,voids:a});return h}}},ev=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=oe.get(t,a);return[i,a]};function tv(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($p.isSpan(n))u=n[0],c=n[1];else{var h=b.path(e,n,{edge:"start"}),p=b.path(e,n,{edge:"end"});u=i?p:h,c=i?h:p}var m=oe.nodes(e,{reverse:i,from:u,to:c,pass:C=>{var[w]=C;return de.isElement(w)?!!(!s&&(b.isVoid(e,w)||b.isElementReadOnly(e,w))||o&&!b.isSelectable(e,w)):!1}}),g=[],f;for(var[y,v]of m)if(!(o&&de.isElement(y)&&!b.isSelectable(e,y))){var k=f&&O.compare(v,f[1])===0;if(!(r==="highest"&&k)){if(!l(y,v)){if(a&&!k&&fe.isText(y))return;continue}if(r==="lowest"&&k){f=[y,v];continue}var B=r==="lowest"?f:[y,v];B&&(a?g.push(B):yield B),f=[y,v]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var nv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>Ba.get(c)||[],s=c=>Aa.get(c)||new Set,o=c=>{var h=i(c).pop(),p=h.join(",");return s(c).delete(p),h};if(b.isNormalizing(t)){if(r){var l=Array.from(oe.nodes(t),c=>{var[,h]=c;return h}),u=new Set(l.map(c=>c.join(",")));Ba.set(t,l),Aa.set(t,u)}i(t).length!==0&&b.withoutNormalizing(t,()=>{for(var c of i(t))if(oe.has(t,c)){var h=b.node(t,c),[p,m]=h;de.isElement(p)&&p.children.length===0&&t.normalizeNode(h,{operation:a})}for(var g=i(t),f=g.length,y=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:y,initialDirtyPathsLength:f,operation:a}))return;var v=o(t);if(oe.has(t,v)){var k=b.node(t,v);t.normalizeNode(k,{operation:a})}y++,g=i(t)}})}},rv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=O.parent(a),s=b.node(t,i);return s},av=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},iv=e=>{var t=ou.get(e);return t||(t=new Set,ou.set(e,t)),t},sv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(O.isPath(n)){if(i==="start"){var[,s]=oe.first(t,n);n=s}else if(i==="end"){var[,o]=oe.last(t,n);n=o}}return K.isRange(n)&&(i==="start"?n=K.start(n):i==="end"?n=K.end(n):n=O.common(n.anchor.path,n.focus.path)),Ee.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},ov=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.pointRefs(t);return l.delete(i),i.current=null,o}},s=b.pointRefs(t);return s.add(i),i},uv=e=>{var t=uu.get(e);return t||(t=new Set,uu.set(e,t)),t},lv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(O.isPath(n)){var i;if(a==="end"){var[,s]=oe.last(t,n);i=s}else{var[,o]=oe.first(t,n);i=o}var l=oe.get(t,i);if(!fe.isText(l))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?l.text.length:0}}if(K.isRange(n)){var[u,c]=K.edges(n);return a==="start"?u:c}return n};function cv(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:a=!1,voids:i=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=b.range(e,n),[l,u]=K.edges(o),c=a?u:l,h=!1,p="",m=0,g=0,f=0;for(var[y,v]of b.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(de.isElement(y)){if(!i&&(e.isVoid(y)||e.isElementReadOnly(y))){yield b.start(e,v);continue}if(e.isInline(y))continue;if(b.hasInlines(e,y)){var k=O.isAncestor(v,u.path)?u:b.end(e,v),B=O.isAncestor(v,l.path)?l:b.start(e,v);p=b.string(e,{anchor:B,focus:k},{voids:i}),h=!0}}if(fe.isText(y)){var C=O.equals(v,c.path);for(C?(g=a?c.offset:y.text.length-c.offset,f=c.offset):(g=y.text.length,f=a?g:0),(C||h||r==="offset")&&(yield{path:v,offset:f},h=!1);;){if(m===0){if(p==="")break;m=w(p,r,a),p=ao(p,m,a)[1]}if(f=a?f-m:f+m,g=g-m,g<0){m=-g;break}m=0,yield{path:v,offset:f}}}}function w(T,S,q){return S==="character"?ro(T,q):S==="word"?Up(T,q):S==="line"||S==="block"?T.length:1}}()}var dv=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(O.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(O.isPath(s)){var[c]=b.parent(t,s);i=p=>c.children.includes(p)}else i=()=>!0;var[h]=b.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return h}}},fv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.rangeRefs(t);return l.delete(i),i.current=null,o}},s=b.rangeRefs(t);return s.add(i),i},hv=e=>{var t=lu.get(e);return t||(t=new Set,lu.set(e,t)),t},mv=(e,t,n)=>{if(K.isRange(t)&&!n)return t;var r=b.start(e,t),a=b.end(e,n||t);return{anchor:r,focus:a}};function 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 pv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ou(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ou(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var gv=(e,t)=>{var{selection:n}=e;if(n){var r=(c,h)=>{if(!fe.isText(c))return!1;var[p,m]=b.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},a=K.isExpanded(n),i=!1;if(!a){var[s,o]=b.node(e,n);if(s&&r(s,o)){var[l]=b.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)X.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=pv({},b.marks(e)||{});delete u[t],e.marks=u,yr.get(e)||e.onChange()}}},vv=(e,t)=>{Ed.set(e,t)},bv=(e,t)=>b.point(e,t,{edge:"start"}),yv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=b.range(t,n),[s,o]=K.edges(i),l="";for(var[u,c]of b.nodes(t,{at:i,match:fe.isText,voids:a})){var h=u.text;O.equals(c,o.path)&&(h=h.slice(0,o.offset)),O.equals(c,s.path)&&(h=h.slice(s.offset)),l+=h}return l},Dv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=K.edges(n);if(i.offset!==0||s.offset!==0||K.isCollapsed(n)||O.hasPrevious(s.path))return n;var o=b.above(t,{at:s,match:g=>de.isElement(g)&&b.isBlock(t,g),voids:a}),l=o?o[1]:[],u=b.start(t,i),c={anchor:u,focus:s},h=!0;for(var[p,m]of b.nodes(t,{at:c,match:fe.isText,reverse:!0,voids:a})){if(h){h=!1;continue}if(p.text!==""||O.isBefore(m,l)){s={path:m,offset:p.text.length};break}}return{anchor:i,focus:s}},xv=(e,t)=>{var n=b.isNormalizing(e);b.setNormalizing(e,!1);try{t()}finally{b.setNormalizing(e,n)}b.normalize(e)},Cv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:c=!1}=n;if(u){var h=!1;if(K.isRange(u)&&K.isCollapsed(u)&&(h=!0,u=u.anchor),Ee.isPoint(u)){var p=b.void(t,{at:u,mode:"highest"});if(!l&&p){var[,m]=p;u=m}else{var g={unit:s,distance:o},f=i?b.before(t,u,g)||b.start(t,[]):b.after(t,u,g)||b.end(t,[]);u={anchor:u,focus:f},c=!0}}if(O.isPath(u)){X.removeNodes(t,{at:u,voids:l});return}if(!K.isCollapsed(u)){if(!c){var[,y]=K.edges(u),v=b.end(t,[]);Ee.equals(y,v)||(u=b.unhangRange(t,u,{voids:l}))}var[k,B]=K.edges(u),C=b.above(t,{match:he=>de.isElement(he)&&b.isBlock(t,he),at:k,voids:l}),w=b.above(t,{match:he=>de.isElement(he)&&b.isBlock(t,he),at:B,voids:l}),T=C&&w&&!O.equals(C[1],w[1]),S=O.equals(k.path,B.path),q=l?null:(r=b.void(t,{at:k,mode:"highest"}))!==null&&r!==void 0?r:b.elementReadOnly(t,{at:k,mode:"highest"}),P=l?null:(a=b.void(t,{at:B,mode:"highest"}))!==null&&a!==void 0?a:b.elementReadOnly(t,{at:B,mode:"highest"});if(q){var L=b.before(t,k);L&&C&&O.isAncestor(C[1],L.path)&&(k=L)}if(P){var z=b.after(t,B);z&&w&&O.isAncestor(w[1],z.path)&&(B=z)}var E=[],A;for(var N of b.nodes(t,{at:u,voids:l})){var[R,H]=N;A&&O.compare(H,A)===0||(!l&&de.isElement(R)&&(b.isVoid(t,R)||b.isElementReadOnly(t,R))||!O.isCommon(H,k.path)&&!O.isCommon(H,B.path))&&(E.push(N),A=H)}var G=Array.from(E,he=>{var[,ye]=he;return b.pathRef(t,ye)}),Q=b.pointRef(t,k),re=b.pointRef(t,B),x="";if(!S&&!q){var $=Q.current,[W]=b.leaf(t,$),{path:_}=$,{offset:F}=k,I=W.text.slice(F);I.length>0&&(t.apply({type:"remove_text",path:_,offset:F,text:I}),x=I)}if(G.reverse().map(he=>he.unref()).filter(he=>he!==null).forEach(he=>X.removeNodes(t,{at:he,voids:l})),!P){var M=re.current,[V]=b.leaf(t,M),{path:ne}=M,te=S?k.offset:0,ae=V.text.slice(te,B.offset);ae.length>0&&(t.apply({type:"remove_text",path:ne,offset:te,text:ae}),x=ae)}!S&&T&&re.current&&Q.current&&X.mergeNodes(t,{at:re.current,hanging:!0,voids:l}),h&&i&&s==="character"&&x.length>1&&x.match(/[\u0E00-\u0E7F]+/)&&X.insertText(t,x.slice(0,x.length-o));var le=Q.unref(),J=re.unref(),ge=i?le||J:J||le;n.at==null&&ge&&X.select(t,ge)}}})},wv=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=no(t),batchDirty:o=!0}=r;if(n.length){if(K.isRange(s))if(a||(s=b.unhangRange(t,s,{voids:i})),K.isCollapsed(s))s=s.anchor;else{var[,l]=K.edges(s);if(!i&&b.void(t,{at:l}))return;var u=b.pointRef(t,l);X.delete(t,{at:s}),s=u.unref()}else O.isPath(s)&&(s=b.start(t,s));if(!(!i&&b.void(t,{at:s}))){var c=b.above(t,{at:s,match:I=>de.isElement(I)&&b.isInline(t,I),mode:"highest",voids:i});if(c){var[,h]=c;if(b.isEnd(t,s,h)){var p=b.after(t,h);s=p}else if(b.isStart(t,s,h)){var m=b.before(t,h);s=m}}var g=b.above(t,{match:I=>de.isElement(I)&&b.isBlock(t,I),at:s,voids:i}),[,f]=g,y=b.isStart(t,s,f),v=b.isEnd(t,s,f),k=y&&v,B=!y||y&&v,C=!v,[,w]=oe.first({children:n},[]),[,T]=oe.last({children:n},[]),S=[],q=I=>{var[M,V]=I,ne=V.length===0;return ne?!1:k?!0:!(B&&O.isAncestor(V,w)&&de.isElement(M)&&!t.isVoid(M)&&!t.isInline(M)||C&&O.isAncestor(V,T)&&de.isElement(M)&&!t.isVoid(M)&&!t.isInline(M))};for(var P of oe.nodes({children:n},{pass:q}))q(P)&&S.push(P);var L=[],z=[],E=[],A=!0,N=!1;for(var[R]of S)de.isElement(R)&&!t.isInline(R)?(A=!1,N=!0,z.push(R)):A?L.push(R):E.push(R);var[H]=b.nodes(t,{at:s,match:I=>fe.isText(I)||b.isInline(t,I),mode:"highest",voids:i}),[,G]=H,Q=b.isStart(t,s,G),re=b.isEnd(t,s,G),x=b.pathRef(t,v&&!E.length?O.next(f):f),$=b.pathRef(t,re?O.next(G):G);X.splitNodes(t,{at:s,match:I=>N?de.isElement(I)&&b.isBlock(t,I):fe.isText(I)||b.isInline(t,I),mode:N?"lowest":"highest",always:N&&(!y||L.length>0)&&(!v||E.length>0),voids:i});var W=b.pathRef(t,!Q||Q&&re?O.next(G):G);if(X.insertNodes(t,L,{at:W.current,match:I=>fe.isText(I)||b.isInline(t,I),mode:"highest",voids:i,batchDirty:o}),k&&!L.length&&z.length&&!E.length&&X.delete(t,{at:f,voids:i}),X.insertNodes(t,z,{at:x.current,match:I=>de.isElement(I)&&b.isBlock(t,I),mode:"lowest",voids:i,batchDirty:o}),X.insertNodes(t,E,{at:$.current,match:I=>fe.isText(I)||b.isInline(t,I),mode:"highest",voids:i,batchDirty:o}),!r.at){var _;if(E.length>0&&$.current?_=O.previous($.current):z.length>0&&x.current?_=O.previous(x.current):W.current&&(_=O.previous(W.current)),_){var F=b.end(t,_);X.select(t,F)}}W.unref(),x.unref(),$.unref()}}})},Ev=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{edge:r="anchor"}=n,{selection:a}=t;if(a){if(r==="anchor")X.select(t,a.anchor);else if(r==="focus")X.select(t,a.focus);else if(r==="start"){var[i]=K.edges(a);X.select(t,i)}else if(r==="end"){var[,s]=K.edges(a);X.select(t,s)}}else return},kv=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},_v=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:a=1,unit:i="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=K.isBackward(r)?"focus":"anchor"),o==="end"&&(o=K.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,c={distance:a,unit:i,ignoreNonSelectable:!0},h={};if(o==null||o==="anchor"){var p=s?b.before(t,l,c):b.after(t,l,c);p&&(h.anchor=p)}if(o==null||o==="focus"){var m=s?b.before(t,u,c):b.after(t,u,c);m&&(h.focus=m)}X.setSelection(t,h)}},Bv=(e,t)=>{var{selection:n}=e;if(t=b.range(e,t),n){X.setSelection(e,t);return}if(!K.isRange(t))throw new Error("When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: ".concat(Xe.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function 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 Nu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pu(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Av=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a}=t,{edge:i="both"}=r;if(a){i==="start"&&(i=K.isBackward(a)?"focus":"anchor"),i==="end"&&(i=K.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;X.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Nu(Nu({},l),n)})}},Fv=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!Ee.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!Ee.equals(t.focus,n.focus)||i!=="anchor"&&i!=="focus"&&t[i]!==n[i])&&(r[i]=n[i],a[i]=t[i]);Object.keys(r).length>0&&e.apply({type:"set_selection",properties:r,newProperties:a})}},Tv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:c}=r;if(oe.isNode(n)&&(n=[n]),n.length!==0){var[h]=n;if(l||(l=no(t),c!==!1&&(c=!0)),c==null&&(c=!1),K.isRange(l))if(a||(l=b.unhangRange(t,l,{voids:i})),K.isCollapsed(l))l=l.anchor;else{var[,p]=K.edges(l),m=b.pointRef(t,p);X.delete(t,{at:l}),l=m.unref()}if(Ee.isPoint(l)){u==null&&(fe.isText(h)?u=L=>fe.isText(L):t.isInline(h)?u=L=>fe.isText(L)||b.isInline(t,L):u=L=>de.isElement(L)&&b.isBlock(t,L));var[g]=b.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,y=b.pathRef(t,f),v=b.isEnd(t,l,f);X.splitNodes(t,{at:l,match:u,mode:s,voids:i});var k=y.unref();l=v?O.next(k):k}else return}var B=O.parent(l),C=l[l.length-1];if(!(!i&&b.void(t,{at:B}))){if(o){var w=[],T=O.levels(B);hg(t,()=>{var L=function(){var A=B.concat(C);C++;var N={type:"insert_node",path:A,node:z};t.apply(N),l=O.next(l),w.push(N),fe.isText?T.push(...Array.from(oe.nodes(z),R=>{var[,H]=R;return A.concat(H)})):T.push(A)};for(var z of n)L()},()=>{_d(t,T,L=>{var z=L;for(var E of w)if(O.operationCanTransformPath(E)&&(z=O.transform(z,E),!z))return null;return z})})}else for(var S of n){var q=B.concat(C);C++,t.apply({type:"insert_node",path:q,node:S}),l=O.next(l)}if(l=O.previous(l),c){var P=b.end(t,l);P&&X.select(t,P)}}}})},Sv=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=O.isPath(r)?ir(t,r):C=>de.isElement(C)&&b.isBlock(t,C)),!!r){var o=b.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,C=>{var[,w]=C;return b.pathRef(t,w)});for(var u of l){var c=u.unref();if(c.length<2)throw new Error("Cannot lift node at a path [".concat(c,"] because it has a depth of less than `2`."));var h=b.node(t,O.parent(c)),[p,m]=h,g=c[c.length-1],{length:f}=p.children;if(f===1){var y=O.next(m);X.moveNodes(t,{at:c,to:y,voids:i}),X.removeNodes(t,{at:m,voids:i})}else if(g===0)X.moveNodes(t,{at:c,to:m,voids:i});else if(g===f-1){var v=O.next(m);X.moveNodes(t,{at:c,to:v,voids:i})}else{var k=O.next(c),B=O.next(m);X.splitNodes(t,{at:k,voids:i}),X.moveNodes(t,{at:c,to:B,voids:i})}}}})},jv=["text"],Ov=["children"],Bd=(e,t)=>{if(de.isElement(t)){var n=t;return b.isVoid(e,t)?!0:n.children.length===1?Bd(e,n.children[0]):!1}else return!b.isEditor(t)},Pv=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(O.isPath(a)){var[l]=b.parent(t,a);r=L=>l.children.includes(L)}else r=L=>de.isElement(L)&&b.isBlock(t,L);if(!i&&K.isRange(a)&&(a=b.unhangRange(t,a,{voids:s})),K.isRange(a))if(K.isCollapsed(a))a=a.anchor;else{var[,u]=K.edges(a),c=b.pointRef(t,u);X.delete(t,{at:a}),a=c.unref(),n.at==null&&X.select(t,a)}var[h]=b.nodes(t,{at:a,match:r,voids:s,mode:o}),p=b.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!h||!p)){var[m,g]=h,[f,y]=p;if(!(g.length===0||y.length===0)){var v=O.next(y),k=O.common(g,y),B=O.isSibling(g,y),C=Array.from(b.levels(t,{at:g}),L=>{var[z]=L;return z}).slice(k.length).slice(0,-1),w=b.above(t,{at:g,mode:"highest",match:L=>C.includes(L)&&Bd(t,L)}),T=w&&b.pathRef(t,w[1]),S,q;if(fe.isText(m)&&fe.isText(f)){var P=Zt(m,jv);q=f.text.length,S=P}else if(de.isElement(m)&&de.isElement(f)){var P=Zt(m,Ov);q=f.children.length,S=P}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(Xe.stringify(m)," ").concat(Xe.stringify(f)));B||X.moveNodes(t,{at:g,to:v,voids:s}),T&&X.removeNodes(t,{at:T.current,voids:s}),de.isElement(f)&&b.isEmpty(t,f)||fe.isText(f)&&f.text===""&&y[y.length-1]!==0?X.removeNodes(t,{at:y,voids:s}):t.apply({type:"merge_node",path:v,position:q,properties:S}),T&&T.unref()}}}})},Nv=(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=O.isPath(r)?ir(e,r):m=>de.isElement(m)&&b.isBlock(e,m));var o=b.pathRef(e,n),l=b.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,m=>{var[,g]=m;return b.pathRef(e,g)});for(var c of u){var h=c.unref(),p=o.current;h.length!==0&&e.apply({type:"move_node",path:h,newPath:p}),o.current&&O.isSibling(p,h)&&O.isAfter(p,h)&&(o.current=O.next(o.current))}o.unref()}})},Rv=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=O.isPath(s)?ir(t,s):m=>de.isElement(m)&&b.isBlock(t,m)),!r&&K.isRange(s)&&(s=b.unhangRange(t,s,{voids:a}));var l=b.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,m=>{var[,g]=m;return b.pathRef(t,g)});for(var c of u){var h=c.unref();if(h){var[p]=b.node(t,h);t.apply({type:"remove_node",path:h,node:p})}}}})},Mv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:c=!1,voids:h=!1}=r;if(i){if(a==null&&(a=O.isPath(i)?ir(t,i):q=>de.isElement(q)&&b.isBlock(t,q)),!l&&K.isRange(i)&&(i=b.unhangRange(t,i,{voids:h})),c&&K.isRange(i)){if(K.isCollapsed(i)&&b.leaf(t,i.anchor)[0].text.length>0)return;var p=b.rangeRef(t,i,{affinity:"inward"}),[m,g]=K.edges(i),f=u==="lowest"?"lowest":"highest",y=b.isEnd(t,g,g.path);X.splitNodes(t,{at:g,match:a,mode:f,voids:h,always:!y});var v=b.isStart(t,m,m.path);X.splitNodes(t,{at:m,match:a,mode:f,voids:h,always:!v}),i=p.unref(),r.at==null&&X.select(t,i)}s||(s=(q,P)=>q!==P);for(var[k,B]of b.nodes(t,{at:i,match:a,mode:u,voids:h})){var C={},w={};if(B.length!==0){var T=!1;for(var S in n)S==="children"||S==="text"||s(n[S],k[S])&&(T=!0,k.hasOwnProperty(S)&&(C[S]=k[S]),o?n[S]!=null&&(w[S]=o(k[S],n[S])):n[S]!=null&&(w[S]=n[S]));T&&t.apply({type:"set_node",path:B,properties:C,newProperties:w})}}}})},Iv=(e,t)=>{if(K.isCollapsed(t))return t.anchor;var[,n]=K.edges(t),r=b.pointRef(e,n);return X.delete(e,{at:t}),r.unref()},$v=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=re=>de.isElement(re)&&b.isBlock(t,re)),K.isRange(s)&&(s=Iv(t,s)),O.isPath(s)){var u=s,c=b.point(t,u),[h]=b.parent(t,u);i=re=>re===h,o=c.path.length-u.length+1,s=c,l=!0}if(s){var p=b.pointRef(t,s,{affinity:"backward"}),m;try{var[g]=b.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=b.void(t,{at:s,mode:"highest"}),y=0;if(!a&&f){var[v,k]=f;if(de.isElement(v)&&t.isInline(v)){var B=b.after(t,k);if(!B){var C={text:""},w=O.next(k);X.insertNodes(t,C,{at:w,voids:a}),B=b.point(t,w)}s=B,l=!0}var T=s.path.length-k.length;o=T+1,l=!0}m=b.pointRef(t,s);var S=s.path.length-o,[,q]=g,P=s.path.slice(0,S),L=o===0?s.offset:s.path[S]+y;for(var[z,E]of b.levels(t,{at:P,reverse:!0,voids:a})){var A=!1;if(E.length<q.length||E.length===0||!a&&de.isElement(z)&&b.isVoid(t,z))break;var N=p.current,R=b.isEnd(t,N,E);if(l||!p||!b.isEdge(t,N,E)){A=!0;var H=oe.extractProps(z);t.apply({type:"split_node",path:E,position:L,properties:H})}L=E[E.length-1]+(A||R?1:0)}if(n.at==null){var G=m.current||b.end(t,[]);X.select(t,G)}}finally{var Q;p.unref(),(Q=m)===null||Q===void 0||Q.unref()}}})},Lv=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)},zv=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=O.isPath(s)?ir(t,s):m=>de.isElement(m)&&b.isBlock(t,m)),O.isPath(s)&&(s=b.range(t,s));var l=K.isRange(s)?b.rangeRef(t,s):null,u=b.nodes(t,{at:s,match:o,mode:r,voids:i}),c=Array.from(u,m=>{var[,g]=m;return b.pathRef(t,g)}).reverse(),h=function(){var g=p.unref(),[f]=b.node(t,g),y=b.range(t,g);a&&l&&(y=K.intersection(l.current,y)),X.liftNodes(t,{at:y,match:v=>de.isAncestor(f)&&f.children.includes(v),voids:i})};for(var p of c)h();l&&l.unref()}})};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 Mu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ru(Object(n),!0).forEach(function(r){ut(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ru(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var qv=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&&(O.isPath(l)?o=ir(t,l):t.isInline(n)?o=y=>de.isElement(y)&&b.isInline(t,y)||fe.isText(y):o=y=>de.isElement(y)&&b.isBlock(t,y)),i&&K.isRange(l)){var[u,c]=K.edges(l),h=b.rangeRef(t,l,{affinity:"inward"});X.splitNodes(t,{at:c,match:o,voids:s}),X.splitNodes(t,{at:u,match:o,voids:s}),l=h.unref(),r.at==null&&X.select(t,l)}var p=Array.from(b.nodes(t,{at:l,match:t.isInline(n)?y=>de.isElement(y)&&b.isBlock(t,y):y=>b.isEditor(y),mode:"lowest",voids:s})),m=function(){var v=K.isRange(l)?K.intersection(l,b.range(t,f)):l;if(!v)return 0;var k=Array.from(b.nodes(t,{at:v,match:o,mode:a,voids:s}));if(k.length>0){var[B]=k,C=k[k.length-1],[,w]=B,[,T]=C;if(w.length===0&&T.length===0)return 0;var S=O.equals(w,T)?O.parent(w):O.common(w,T),q=b.range(t,w,T),P=b.node(t,S),[L]=P,z=S.length+1,E=O.next(T.slice(0,z)),A=Mu(Mu({},n),{},{children:[]});X.insertNodes(t,A,{at:E,voids:s}),X.moveNodes(t,{at:q,match:N=>de.isAncestor(L)&&L.children.includes(N),to:E.concat(0),voids:s})}},g;for(var[,f]of p)g=m()}})},Wv=()=>{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 mg(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gg(e,...r)},insertBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},insertSoftBreak:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wv(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vg(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gv(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pg(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bg(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ev(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cv(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kv(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fg(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tg(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tv(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hg(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ug(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kg(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yg(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sv(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pv(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _v(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Nv(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ev(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tv(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nv(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rv(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sv(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return av(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iv(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lv(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ov(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uv(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cv(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dv(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mv(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fv(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hv(e,...r)},removeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rv(e,...r)},select:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bv(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mv(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return vv(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Av(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fv(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $v(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bv(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yv(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dv(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lv(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zv(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sg(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xv(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qv(e,...r)}};return e},Hv={isHistory(e){return tt(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||rn.isOperationList(e.redos[0].operations))&&(e.undos.length===0||rn.isOperationList(e.undos[0].operations))}},yi=new WeakMap,Di=new WeakMap,qn={isHistoryEditor(e){return Hv.isHistory(e.history)&&b.isEditor(e)},isMerging(e){return Di.get(e)},isSaving(e){return yi.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=qn.isMerging(e);Di.set(e,!1),t(),Di.set(e,n)},withoutSaving(e,t){var n=qn.isSaving(e);yi.set(e,!1),t(),yi.set(e,n)}},Uv=e=>{var t=e,{apply:n}=t;return t.history={undos:[],redos:[]},t.redo=()=>{var{history:r}=t,{redos:a}=r;if(a.length>0){var i=a[a.length-1];i.selectionBefore&&X.setSelection(t,i.selectionBefore),qn.withoutSaving(t,()=>{b.withoutNormalizing(t,()=>{for(var s of i.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:r}=t,{undos:a}=r;if(a.length>0){var i=a[a.length-1];qn.withoutSaving(t,()=>{b.withoutNormalizing(t,()=>{var s=i.operations.map(rn.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&X.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=qn.isSaving(t),c=qn.isMerging(t);if(u==null&&(u=Kv(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=Vv(r,l)),o&&c)o.operations.push(r);else{var h={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",h)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},Vv=(e,t)=>!!(t&&e.type==="insert_text"&&t.type==="insert_text"&&e.offset===t.offset+t.text.length&&O.equals(e.path,t.path)||t&&e.type==="remove_text"&&t.type==="remove_text"&&e.offset+e.text.length===t.offset&&O.equals(e.path,t.path)),Kv=(e,t)=>e.type!=="set_selection",Zv=Qv,Ad="֑-߿יִ-﷽ﹰ-ﻼ",Fd="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",Yv=new RegExp("^[^"+Fd+"]*["+Ad+"]"),Gv=new RegExp("^[^"+Ad+"]*["+Fd+"]");function Qv(e){return e=String(e||""),Yv.test(e)?"rtl":Gv.test(e)?"ltr":"neutral"}const Td=Bn(Zv);function Jv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var io=Jv,Xv=typeof Hr=="object"&&Hr&&Hr.Object===Object&&Hr,e0=Xv,t0=e0,n0=typeof self=="object"&&self&&self.Object===Object&&self,r0=t0||n0||Function("return this")(),Sd=r0,a0=Sd,i0=function(){return a0.Date.now()},s0=i0,o0=/\s/;function u0(e){for(var t=e.length;t--&&o0.test(e.charAt(t)););return t}var l0=u0,c0=l0,d0=/^\s+/;function f0(e){return e&&e.slice(0,c0(e)+1).replace(d0,"")}var h0=f0,m0=Sd,p0=m0.Symbol,jd=p0,Iu=jd,Od=Object.prototype,g0=Od.hasOwnProperty,v0=Od.toString,hr=Iu?Iu.toStringTag:void 0;function b0(e){var t=g0.call(e,hr),n=e[hr];try{e[hr]=void 0;var r=!0}catch{}var a=v0.call(e);return r&&(t?e[hr]=n:delete e[hr]),a}var y0=b0,D0=Object.prototype,x0=D0.toString;function C0(e){return x0.call(e)}var w0=C0,$u=jd,E0=y0,k0=w0,_0="[object Null]",B0="[object Undefined]",Lu=$u?$u.toStringTag:void 0;function A0(e){return e==null?e===void 0?B0:_0:Lu&&Lu in Object(e)?E0(e):k0(e)}var F0=A0;function T0(e){return e!=null&&typeof e=="object"}var S0=T0,j0=F0,O0=S0,P0="[object Symbol]";function N0(e){return typeof e=="symbol"||O0(e)&&j0(e)==P0}var R0=N0,M0=h0,zu=io,I0=R0,qu=0/0,$0=/^[-+]0x[0-9a-f]+$/i,L0=/^0b[01]+$/i,z0=/^0o[0-7]+$/i,q0=parseInt;function W0(e){if(typeof e=="number")return e;if(I0(e))return qu;if(zu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=zu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=M0(e);var n=L0.test(e);return n||z0.test(e)?q0(e.slice(2),n?2:8):$0.test(e)?qu:+e}var H0=W0,U0=io,xi=s0,Wu=H0,V0="Expected a function",K0=Math.max,Z0=Math.min;function Y0(e,t,n){var r,a,i,s,o,l,u=0,c=!1,h=!1,p=!0;if(typeof e!="function")throw new TypeError(V0);t=Wu(t)||0,U0(n)&&(c=!!n.leading,h="maxWait"in n,i=h?K0(Wu(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function m(T){var S=r,q=a;return r=a=void 0,u=T,s=e.apply(q,S),s}function g(T){return u=T,o=setTimeout(v,t),c?m(T):s}function f(T){var S=T-l,q=T-u,P=t-S;return h?Z0(P,i-q):P}function y(T){var S=T-l,q=T-u;return l===void 0||S>=t||S<0||h&&q>=i}function v(){var T=xi();if(y(T))return k(T);o=setTimeout(v,f(T))}function k(T){return o=void 0,p&&r?m(T):(r=a=void 0,s)}function B(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function C(){return o===void 0?s:k(xi())}function w(){var T=xi(),S=y(T);if(r=arguments,a=this,l=T,S){if(o===void 0)return g(l);if(h)return clearTimeout(o),o=setTimeout(v,t),m(l)}return o===void 0&&(o=setTimeout(v,t)),s}return w.cancel=B,w.flush=C,w}var Pd=Y0;const G0=Bn(Pd);var Q0=Pd,J0=io,X0="Expected a function";function eb(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(X0);return J0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),Q0(e,t,{leading:r,maxWait:t,trailing:a})}var tb=eb;const nb=Bn(tb),Hu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Uu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Ci=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Uu(n.overflowY,t)||Uu(n.overflowX,t)||(r=>{const a=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!a&&(a.clientHeight<r.scrollHeight||a.clientWidth<r.scrollWidth)})(e)}return!1},Qr=(e,t,n,r,a,i,s,o)=>i<e&&s>t||i>e&&s<t?0:i<=e&&o<=n||s>=t&&o>=n?i-e-r:s>t&&o<n||i<e&&o>n?s-t+a:0,rb=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Vu=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,h=typeof u=="function"?u:H=>H!==u;if(!Hu(e))throw new TypeError("Invalid target");const p=document.scrollingElement||document.documentElement,m=[];let g=e;for(;Hu(g)&&h(g);){if(g=rb(g),g===p){m.push(g);break}g!=null&&g===document.body&&Ci(g)&&!Ci(document.documentElement)||g!=null&&Ci(g,c)&&m.push(g)}const f=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,y=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:v,scrollY:k}=window,{height:B,width:C,top:w,right:T,bottom:S,left:q}=e.getBoundingClientRect(),{top:P,right:L,bottom:z,left:E}=(H=>{const G=window.getComputedStyle(H);return{top:parseFloat(G.scrollMarginTop)||0,right:parseFloat(G.scrollMarginRight)||0,bottom:parseFloat(G.scrollMarginBottom)||0,left:parseFloat(G.scrollMarginLeft)||0}})(e);let A=o==="start"||o==="nearest"?w-P:o==="end"?S+z:w+B/2-P+z,N=l==="center"?q+C/2-E+L:l==="end"?T+L:q-E;const R=[];for(let H=0;H<m.length;H++){const G=m[H],{height:Q,width:re,top:x,right:$,bottom:W,left:_}=G.getBoundingClientRect();if(s==="if-needed"&&w>=0&&q>=0&&S<=y&&T<=f&&w>=x&&S<=W&&q>=_&&T<=$)return R;const F=getComputedStyle(G),I=parseInt(F.borderLeftWidth,10),M=parseInt(F.borderTopWidth,10),V=parseInt(F.borderRightWidth,10),ne=parseInt(F.borderBottomWidth,10);let te=0,ae=0;const le="offsetWidth"in G?G.offsetWidth-G.clientWidth-I-V:0,J="offsetHeight"in G?G.offsetHeight-G.clientHeight-M-ne:0,ge="offsetWidth"in G?G.offsetWidth===0?0:re/G.offsetWidth:0,he="offsetHeight"in G?G.offsetHeight===0?0:Q/G.offsetHeight:0;if(p===G)te=o==="start"?A:o==="end"?A-y:o==="nearest"?Qr(k,k+y,y,M,ne,k+A,k+A+B,B):A-y/2,ae=l==="start"?N:l==="center"?N-f/2:l==="end"?N-f:Qr(v,v+f,f,I,V,v+N,v+N+C,C),te=Math.max(0,te+k),ae=Math.max(0,ae+v);else{te=o==="start"?A-x-M:o==="end"?A-W+ne+J:o==="nearest"?Qr(x,W,Q,M,ne+J,A,A+B,B):A-(x+Q/2)+J/2,ae=l==="start"?N-_-I:l==="center"?N-(_+re/2)+le/2:l==="end"?N-$+V+le:Qr(_,$,re,I,V+le,N,N+C,C);const{scrollLeft:ye,scrollTop:Ae}=G;te=he===0?0:Math.max(0,Math.min(Ae+te/he,G.scrollHeight-Q/he+J)),ae=ge===0?0:Math.max(0,Math.min(ye+ae/ge,G.scrollWidth-re/ge+le)),A+=Ae-te,N+=ye-ae}R.push({el:G,top:te,left:ae})}return R},ab=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function ib(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(Vu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Vu(e,ab(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var bn=[],sb=function(){return bn.some(function(e){return e.activeTargets.length>0})},ob=function(){return bn.some(function(e){return e.skippedTargets.length>0})},Ku="ResizeObserver loop completed with undelivered notifications.",ub=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Ku}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Ku),window.dispatchEvent(e)},Or;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Or||(Or={}));var yn=function(e){return Object.freeze(e)},lb=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,yn(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,yn(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}(),so=function(e){return e instanceof SVGElement&&"getBBox"in e},Rd=function(e){if(so(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)},Zu=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)},cb=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},Dr=typeof window<"u"?window:{},Jr=new WeakMap,Yu=/auto|scroll/,db=/^tb|vertical/,fb=/msie|trident/i.test(Dr.navigator&&Dr.navigator.userAgent),St=function(e){return parseFloat(e||"0")},Vn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new lb((n?t:e)||0,(n?e:t)||0)},Gu=yn({devicePixelContentBoxSize:Vn(),borderBoxSize:Vn(),contentBoxSize:Vn(),contentRect:new Nd(0,0,0,0)}),Md=function(e,t){if(t===void 0&&(t=!1),Jr.has(e)&&!t)return Jr.get(e);if(Rd(e))return Jr.set(e,Gu),Gu;var n=getComputedStyle(e),r=so(e)&&e.ownerSVGElement&&e.getBBox(),a=!fb&&n.boxSizing==="border-box",i=db.test(n.writingMode||""),s=!r&&Yu.test(n.overflowY||""),o=!r&&Yu.test(n.overflowX||""),l=r?0:St(n.paddingTop),u=r?0:St(n.paddingRight),c=r?0:St(n.paddingBottom),h=r?0:St(n.paddingLeft),p=r?0:St(n.borderTopWidth),m=r?0:St(n.borderRightWidth),g=r?0:St(n.borderBottomWidth),f=r?0:St(n.borderLeftWidth),y=h+u,v=l+c,k=f+m,B=p+g,C=o?e.offsetHeight-B-e.clientHeight:0,w=s?e.offsetWidth-k-e.clientWidth:0,T=a?y+k:0,S=a?v+B:0,q=r?r.width:St(n.width)-T-w,P=r?r.height:St(n.height)-S-C,L=q+y+w+k,z=P+v+C+B,E=yn({devicePixelContentBoxSize:Vn(Math.round(q*devicePixelRatio),Math.round(P*devicePixelRatio),i),borderBoxSize:Vn(L,z,i),contentBoxSize:Vn(q,P,i),contentRect:new Nd(h,l,q,P)});return Jr.set(e,E),E},Id=function(e,t,n){var r=Md(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Or.DEVICE_PIXEL_CONTENT_BOX:return s;case Or.BORDER_BOX:return a;default:return i}},hb=function(){function e(t){var n=Md(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=yn([n.borderBoxSize]),this.contentBoxSize=yn([n.contentBoxSize]),this.devicePixelContentBoxSize=yn([n.devicePixelContentBoxSize])}return e}(),$d=function(e){if(Rd(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},mb=function(){var e=1/0,t=[];bn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var c=new hb(u.target),h=$d(u.target);o.push(c),u.lastReportedSize=Id(u.target,u.observedBox),h<e&&(e=h)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},Qu=function(e){bn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&($d(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},pb=function(){var e=0;for(Qu(e);sb();)e=mb(),Qu(e);return ob()&&ub(),e>0},wi,Ld=[],gb=function(){return Ld.splice(0).forEach(function(e){return e()})},vb=function(e){if(!wi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return gb()}).observe(n,r),wi=function(){n.textContent="".concat(t?t--:t++)}}Ld.push(e),wi()},bb=function(e){vb(function(){requestAnimationFrame(e)})},pa=0,yb=function(){return!!pa},Db=250,xb={attributes:!0,characterData:!0,childList:!0,subtree:!0},Ju=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Xu=function(e){return e===void 0&&(e=0),Date.now()+e},Ei=!1,Cb=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=Db),!Ei){Ei=!0;var r=Xu(t);bb(function(){var a=!1;try{a=pb()}finally{if(Ei=!1,t=r-Xu(),!yb())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,xb)};document.body?n():Dr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Ju.forEach(function(n){return Dr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Ju.forEach(function(n){return Dr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),Ds=new Cb,el=function(e){!pa&&e>0&&Ds.start(),pa+=e,!pa&&Ds.stop()},wb=function(e){return!so(e)&&!cb(e)&&getComputedStyle(e).display==="inline"},Eb=function(){function e(t,n){this.target=t,this.observedBox=n||Or.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=Id(this.target,this.observedBox,!0);return wb(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),kb=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Xr=new WeakMap,tl=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},ea=function(){function e(){}return e.connect=function(t,n){var r=new kb(t,n);Xr.set(t,r)},e.observe=function(t,n,r){var a=Xr.get(t),i=a.observationTargets.length===0;tl(a.observationTargets,n)<0&&(i&&bn.push(a),a.observationTargets.push(new Eb(n,r&&r.box)),el(1),Ds.schedule())},e.unobserve=function(t,n){var r=Xr.get(t),a=tl(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&bn.splice(bn.indexOf(r),1),r.observationTargets.splice(a,1),el(-1))},e.disconnect=function(t){var n=this,r=Xr.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),_b=function(){function e(t){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof t!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");ea.connect(this,t)}return e.prototype.observe=function(t,n){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Zu(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");ea.observe(this,t,n)},e.prototype.unobserve=function(t){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Zu(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");ea.unobserve(this,t)},e.prototype.disconnect=function(){ea.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Gt={};Object.defineProperty(Gt,"__esModule",{value:!0});var Bb=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),ki={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},zd={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Bb?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},oo={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222};for(var ta=1;ta<20;ta++)oo["f"+ta]=111+ta;function ei(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return qd(s,t)}),a=function(o){return r.some(function(l){return Wd(l,o)})},i=n==null?a:a(n);return i}function Ab(e,t){return ei(e,t)}function Fb(e,t){return ei(e,{byKey:!0},t)}function qd(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in ki)r[ki[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var c=a[Symbol.iterator](),h;!(o=(h=c.next()).done);o=!0){var p=h.value,m=p.endsWith("?")&&p.length>1;m&&(p=p.slice(0,-1));var g=uo(p),f=ki[g];if(p.length>1&&!f&&!zd[p]&&!oo[g])throw new TypeError('Unknown modifier: "'+p+'"');(i===1||!f)&&(n?r.key=g:r.which=Hd(p)),f&&(r[f]=m?null:!0)}}catch(y){l=!0,u=y}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Wd(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 Hd(e){e=uo(e);var t=oo[e]||e.toUpperCase().charCodeAt(0);return t}function uo(e){return e=e.toLowerCase(),e=zd[e]||e,e}var Tb=Gt.default=ei,_i=Gt.isHotkey=ei;Gt.isCodeHotkey=Ab;Gt.isKeyHotkey=Fb;Gt.parseHotkey=qd;Gt.compareHotkey=Wd;Gt.toKeyCode=Hd;Gt.toKeyName=uo;function Sb(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Qn(e,t){if(e==null)return{};var n=Sb(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Pr(e){"@babel/helpers - typeof";return Pr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pr(e)}function jb(e,t){if(Pr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Pr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ob(e){var t=jb(e,"string");return Pr(t)==="symbol"?t:String(t)}function Et(e,t,n){return t=Ob(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var lo=D.createContext(null),ln=()=>{var e=D.useContext(lo);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Ud=parseInt(D.version.split(".")[0],10),Pb=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,nl=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),ot=typeof navigator<"u"&&/Android/.test(navigator.userAgent),Wn=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),vr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),Nb=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Vd=typeof navigator<"u"&&/Chrome/i.test(navigator.userAgent),Rb=typeof navigator<"u"&&/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent),Mb=ot&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),Ib=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),$b=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),Lb=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ga=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Jt=(!Rb||!Mb)&&!Nb&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",co=new WeakMap,fo=new WeakMap,Kd=new WeakMap,va=new WeakMap,xs=new WeakMap,Nr=new WeakMap,Dn=new WeakMap,Fa=new WeakMap,ti=new WeakMap,Cs=new WeakMap,an=new WeakMap,gn=new WeakMap,xr=new WeakMap,ws=new WeakMap,ho=new WeakMap,At=new WeakMap,Vt=new WeakMap,ct=new WeakMap,en=new WeakMap,tn=new WeakMap,Zd=new WeakMap,Jn=Symbol("placeholder"),Yd=Symbol("mark-placeholder"),zb=globalThis.Text,mo=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,qb=e=>sn(e)&&e.nodeType===8,wt=e=>sn(e)&&e.nodeType===1,sn=e=>{var t=mo(e);return!!t&&e instanceof t.Node},Es=e=>{var t=e&&e.anchorNode&&mo(e.anchorNode);return!!t&&e instanceof t.Selection},Gd=e=>sn(e)&&e.nodeType===3,Wb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,Hb=e=>{var[t,n]=e;if(wt(t)&&t.childNodes.length){var r=n===t.childNodes.length,a=r?n-1:n;for([t,a]=Qd(t,a,r?"backward":"forward"),r=a<n;wt(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=Vb(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},Ub=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Qd=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(qb(a)||wt(a)&&a.childNodes.length===0||wt(a)&&a.getAttribute("contenteditable")==="false")&&!(s&&o);){if(i>=r.length){s=!0,i=t-1,n="backward";continue}if(i<0){o=!0,i=t+1,n="forward";continue}a=r[i],t=i,i+=n==="forward"?1:-1}return[a,t]},Vb=(e,t,n)=>{var[r]=Qd(e,t,n);return r},Jd=e=>{var t="";if(Gd(e)&&e.nodeValue)return e.nodeValue;if(wt(e)){for(var n of Array.from(e.childNodes))t+=Jd(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
|
|
105
|
+
`)}return t},Kb=/data-slate-fragment="(.+?)"/m,Zb=e=>{var t=e.getData("text/html"),[,n]=t.match(Kb)||[];return n},po=(e,t,n)=>{var{target:r}=t;if(wt(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=ee.getWindow(e);if(a.contains(r))return ee.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var c of l)if(c===r||c.contains(r))return!0});return!i||i===t?!1:po(e,i,n)},Yb=0;class Gb{constructor(){Et(this,"id",void 0),this.id="".concat(Yb++)}}var ee={androidPendingDiffs:e=>ct.get(e),androidScheduleFlush:e=>{var t;(t=ho.get(e))===null||t===void 0||t()},blur:e=>{var t=ee.toDOMNode(e,e),n=ee.findDocumentOrShadowRoot(e);an.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=ee.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&X.deselect(e)},findDocumentOrShadowRoot:e=>{var t=ee.toDOMNode(e,e),n=t.getRootNode();return(n instanceof Document||n instanceof ShadowRoot)&&n.getSelection!=null?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:a}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i=ee.toSlateNode(e,t.target),s=ee.findPath(e,i);if(de.isElement(i)&&b.isVoid(e,i)){var o=a.getBoundingClientRect(),l=e.isInline(i)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,u=b.point(e,s,{edge:l?"start":"end"}),c=l?b.before(e,u):b.after(e,u);if(c){var h=b.range(e,c);return h}}var p,{document:m}=ee.getWindow(e);if(m.caretRangeFromPoint)p=m.caretRangeFromPoint(n,r);else{var g=m.caretPositionFromPoint(n,r);g&&(p=m.createRange(),p.setStart(g.offsetNode,g.offset),p.setEnd(g.offsetNode,g.offset))}if(!p)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=ee.toSlateRange(e,p,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=Fa.get(t);return n||(n=new Gb,Fa.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=fo.get(r);if(a==null){if(b.isEditor(r))return n;break}var i=co.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(Xe.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!an.get(t)){if(n.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(t.operations.length>0){setTimeout(()=>{ee.focus(t,{retries:n.retries-1})},10);return}var r=ee.toDOMNode(t,t),a=ee.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=ee.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(X.select(t,b.start(t,[])),t.onChange()),an.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=Kd.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{editable:a=!1}=r,i=ee.toDOMNode(t,t),s;try{s=wt(n)?n:n.parentElement}catch(o){if(o instanceof Error&&!o.message.includes('Permission denied to access property "nodeType"'))throw o}return s?s.closest("[data-slate-editor]")===i&&(!a||s.isContentEditable?!0:typeof s.isContentEditable=="boolean"&&s.closest('[contenteditable="false"]')===i||!!s.getAttribute("data-slate-zero-width")):!1},hasEditableTarget:(e,t)=>sn(t)&&ee.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return b.hasPath(e,n.path)&&b.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>ee.hasEditableTarget(e,t)||ee.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>sn(t)&&ee.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!gn.get(e),isFocused:e=>!!an.get(e),isReadOnly:e=>!!Cs.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(Cs.get(e))return!1;var n=ee.hasTarget(e,t)&&ee.toSlateNode(e,t);return de.isElement(n)&&b.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=ti.get(e),r=b.isEditor(t)?va.get(e):n==null?void 0:n.get(ee.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(Xe.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=b.node(e,t.path),r=ee.toDOMNode(e,n),a;b.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],c=u.childNodes[0];if(!(c==null||c.textContent==null)){var{length:h}=c.textContent,p=u.getAttribute("data-slate-length"),m=p==null?h:parseInt(p,10),g=o+m,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var y,v=f.childNodes[0];a=[v instanceof zb?v:f,(y=f.textContent)!==null&&y!==void 0&&y.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var k=Math.min(h,Math.max(0,t.offset-o));a=[c,k];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(Xe.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=K.isBackward(t),i=ee.toDOMPoint(e,n),s=K.isCollapsed(t)?i:ee.toDOMPoint(e,r),o=ee.getWindow(e),l=o.document.createRange(),[u,c]=a?s:i,[h,p]=a?i:s,m=wt(u)?u:u.parentElement,g=!!m.getAttribute("data-slate-zero-width"),f=wt(h)?h:h.parentElement,y=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:c),l.setEnd(h,y?1:p),l},toSlateNode:(e,t)=>{var n=wt(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Nr.get(n):null;if(!r)throw new Error("Cannot resolve a Slate node from DOM node: ".concat(n));return r},toSlatePoint:(e,t,n)=>{var{exactMatch:r,suppressThrow:a}=n,[i,s]=r?t:Hb(t),o=i.parentNode,l=null,u=0;if(o){var c,h,p=ee.toDOMNode(e,e),m=o.closest('[data-slate-void="true"]'),g=m&&p.contains(m)?m:null,f=o.closest("[data-slate-leaf]"),y=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var v=ee.getWindow(e),k=v.document.createRange();k.setStart(l,0),k.setEnd(i,s);var B=k.cloneContents(),C=[...Array.prototype.slice.call(B.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(B.querySelectorAll("[contenteditable=false]"))];C.forEach(N=>{if(ot&&!r&&N.hasAttribute("data-slate-zero-width")&&N.textContent.length>0&&N.textContext!=="\uFEFF"){N.textContent.startsWith("\uFEFF")&&(N.textContent=N.textContent.slice(1));return}N.parentNode.removeChild(N)}),u=B.textContent.length,y=l}}else if(g){for(var w=g.querySelectorAll("[data-slate-leaf]"),T=0;T<w.length;T++){var S=w[T];if(ee.hasDOMNode(e,S)){f=S;break}}f?(l=f.closest('[data-slate-node="text"]'),y=f,u=y.textContent.length,y.querySelectorAll("[data-slate-zero-width]").forEach(N=>{u-=N.textContent.length})):u=1}y&&u===y.textContent.length&&ot&&y.getAttribute("data-slate-zero-width")==="z"&&(c=y.textContent)!==null&&c!==void 0&&c.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||Wn&&(h=y.textContent)!==null&&h!==void 0&&h.endsWith(`
|
|
106
106
|
|
|
107
|
-
`))&&u--}if(ot&&!l&&!r){var
|
|
107
|
+
`))&&u--}if(ot&&!l&&!r){var q=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(q&&ee.hasDOMNode(e,q,{editable:!0})){var P=ee.toSlateNode(e,q),{path:L,offset:z}=b.start(e,ee.findPath(e,P));return q.querySelector("[data-slate-leaf]")||(z=s),{path:L,offset:z}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var E=ee.toSlateNode(e,l),A=ee.findPath(e,E);return{path:A,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=Es(t)?t.anchorNode:t.startContainer,o,l,u,c,h;if(s)if(Es(t)){if(Wn&&t.rangeCount>1){u=t.focusNode;var p=t.getRangeAt(0),m=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement&&m.startContainer instanceof HTMLTableRowElement){let T=function(S){return S.childElementCount>0?T(S.children[0]):S};var g=p.startContainer,f=m.startContainer,y=T(g.children[p.startOffset]),v=T(f.children[m.startOffset]);c=0,v.childNodes.length>0?o=v.childNodes[0]:o=v,y.childNodes.length>0?u=y.childNodes[0]:u=y,v instanceof HTMLElement?l=v.innerHTML.length:l=0}else p.startContainer===u?(o=m.endContainer,l=m.endOffset,c=p.startOffset):(o=p.startContainer,l=p.endOffset,c=m.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,c=t.focusOffset;Vd&&Ub(o)||Wn?h=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:h=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,c=t.endOffset,h=t.collapsed;if(o==null||u==null||l==null||c==null)throw new Error("Cannot resolve a Slate range from DOM range: ".concat(t));if(Wn&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
|
|
108
108
|
|
|
109
|
-
`)&&d===u.textContent.length&&d--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var _;u=o,d=((_=o.textContent)===null||_===void 0?void 0:_.length)||0}var k=X.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!k)return null;var w=h?k:X.toSlatePoint(e,[u,d],{exactMatch:a,suppressThrow:i});if(!w)return null;var C={anchor:k,focus:w};return Z.isExpanded(C)&&Z.isForward(C)&&Ct(u)&&y.void(e,{at:C.focus,mode:"highest"})&&(C=y.unhangRange(e,C,{voids:!0})),C}};function Yb(e,t){var{path:n,diff:r}=t;if(!y.hasPath(e,n))return!1;var a=oe.get(e,n);if(!fe.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=P.next(n);if(!y.hasPath(e,i))return!1;var s=oe.get(e,i);return fe.isText(s)&&s.text.startsWith(r.text)}function Qd(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 Gb(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 Qb(e,t,n){for(var r=Math.min(e.length,t.length,n),a=0;a<r;a++)if(e.charAt(e.length-a-1)!==t.charAt(t.length-a-1))return a;return r}function Jd(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=Gb(i,a),o=Math.min(i.length-s,a.length-s),l=Qb(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 Jb(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=Qd(e,t,n),s=Math.max(n.start+n.text.length,t.start+t.text.length+(t.start+t.text.length>n.start?n.text.length:0)-a),o=i.slice(r,s),l=Math.max(t.end,n.end-t.text.length+(t.end-t.start));return Jd(e,{start:r,end:l,text:o})}function Xb(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Es(e,t){var{path:n,offset:r}=t;if(!y.hasPath(e,n))return null;var a=oe.get(e,n);if(!fe.isText(a))return null;var i=y.above(e,{match:o=>de.isElement(o)&&y.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=y.next(e,{at:n,match:fe.isText});if(!s||!P.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function tl(e,t){var n=Es(e,t.anchor);if(!n)return null;if(Z.isCollapsed(t))return{anchor:n,focus:n};var r=Es(e,t.focus);return r?{anchor:n,focus:r}:null}function ks(e,t,n){var r=ct.get(e),a=r==null?void 0:r.find(d=>{var{path:h}=d;return P.equals(h,t.path)});if(!a||t.offset<=a.diff.start)return ke.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=ke.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=ke.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 nl(e,t,n){var r=ks(e,t.anchor,n);if(!r)return null;if(Z.isCollapsed(t))return{anchor:r,focus:r};var a=ks(e,t.focus,n);return a?{anchor:r,focus:a}:null}function ey(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 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 ea(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){wt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ty=25,ny=200,ry=function(){},ay=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function iy(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,d=()=>{var E=en.get(t);if(en.delete(t),E){var{selection:A}=t,j=tl(t,E);j&&(!A||!Z.equals(j,A))&&Q.select(t,j)}},h=()=>{var E=Xt.get(t);if(Xt.delete(t),!!E){if(E.at){var A=ke.isPoint(E.at)?Es(t,E.at):tl(t,E.at);if(!A)return;var j=y.range(t,A);(!t.selection||!Z.equals(t.selection,j))&&Q.select(t,A)}E.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!w()&&!k()){d();return}a||(a=!0,setTimeout(()=>a=!1)),k()&&(a="action");var E=t.selection&&y.rangeRef(t,t.selection,{affinity:"forward"});Ut.set(t,t.marks),ry("flush",Xt.get(t),ct.get(t));for(var A=w(),j;j=(I=ct.get(t))===null||I===void 0?void 0:I[0];){var I,H,q=Bt.get(t);q!==void 0&&(Bt.delete(t),t.marks=q),q&&u===!1&&(u=null);var re=Xb(j);(!t.selection||!Z.equals(t.selection,re))&&Q.select(t,re),j.diff.text?y.insertText(t,j.diff.text):y.deleteFragment(t),ct.set(t,(H=ct.get(t))===null||H===void 0?void 0:H.filter(W=>{var{id:V}=W;return V!==j.id})),Yb(t,j)||(A=!1,Xt.delete(t),Ut.delete(t),a="action",en.delete(t),n.cancel(),r.cancel(),E==null||E.unref())}var ne=E==null?void 0:E.unref();if(ne&&!en.get(t)&&(!t.selection||!Z.equals(ne,t.selection))&&Q.select(t,ne),k()){h();return}A&&n(),n.flush(),r.flush(),d();var v=Ut.get(t);Ut.delete(t),v!==void 0&&(t.marks=v,t.onChange())},m=E=>{i&&clearTimeout(i),i=setTimeout(()=>{pn.set(t,!1),p()},ty)},g=E=>{pn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=Ds.get(t);if(j){if(w()||A){j.style.display="none";return}j.style.removeProperty("display")}},x=(E,A)=>{var j,I=(j=ct.get(t))!==null&&j!==void 0?j:[];ct.set(t,I);var H=oe.leaf(t,E),q=I.findIndex(v=>P.equals(v.path,E));if(q<0){var re=Jd(H.text,A);re&&I.push({path:E,diff:A,id:l++}),f();return}var ne=Jb(H.text,I[q].diff,A);if(!ne){I.splice(q,1),f();return}I[q]=ea(ea({},I[q]),{},{diff:ne})},b=function(A){var{at:j}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,en.delete(t),n.cancel(),r.cancel(),k()&&p(),Xt.set(t,{at:j,run:A}),o=setTimeout(p)},_=E=>{var A;s&&(clearTimeout(s),s=null);var{inputType:j}=E,I=null,H=E.dataTransfer||E.data||void 0;u!==!1&&j!=="insertText"&&j!=="insertCompositionText"&&(u=!1);var[q]=E.getTargetRanges();q&&(I=X.toSlateRange(t,q,{exactMatch:!1,suppressThrow:!0}));var re=X.getWindow(t),ne=re.getSelection();if(!I&&ne&&(q=ne,I=X.toSlateRange(t,ne,{exactMatch:!1,suppressThrow:!0})),I=(A=I)!==null&&A!==void 0?A:t.selection,!!I){var v=!0;if(j.startsWith("delete")){if(Z.isExpanded(I)){var[W,V]=Z.edges(I),B=oe.leaf(t,W.path);if(B.text.length===W.offset&&V.offset===0){var T=y.next(t,{at:W.path,match:fe.isText});T&&P.equals(T[1],V.path)&&(I={anchor:V,focus:V})}}var R=j.endsWith("Backward")?"backward":"forward",[M,K]=Z.edges(I),[ee,te]=y.leaf(t,M.path),ae={text:"",start:M.offset,end:K.offset},le=ct.get(t),J=le==null?void 0:le.find(ve=>P.equals(ve.path,te)),pe=J?[J.diff,ae]:[ae],he=Qd(ee.text,...pe);if(he.length===0&&(v=!1),Z.isExpanded(I)){if(v&&P.equals(I.anchor.path,I.focus.path)){var Ce={path:I.anchor.path,offset:M.offset},Ae=y.range(t,Ce,Ce);return S(Ae),x(I.anchor.path,{text:"",end:K.offset,start:M.offset})}return b(()=>y.deleteFragment(t,{direction:R}),{at:I})}}switch(j){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return b(()=>y.deleteFragment(t),{at:I});case"deleteContent":case"deleteContentForward":{var{anchor:we}=I;if(v&&Z.isCollapsed(I)){var Fe=oe.leaf(t,we.path);if(we.offset<Fe.text.length)return x(we.path,{text:"",start:we.offset,end:we.offset+1})}return b(()=>y.deleteForward(t),{at:I})}case"deleteContentBackward":{var Se,{anchor:Le}=I,Je=ws(q)?q.isCollapsed:!!((Se=q)!==null&&Se!==void 0&&Se.collapsed);return v&&Je&&Z.isCollapsed(I)&&Le.offset>0?x(Le.path,{text:"",start:Le.offset-1,end:Le.offset}):b(()=>y.deleteBackward(t),{at:I})}case"deleteEntireSoftLine":return b(()=>{y.deleteBackward(t,{unit:"line"}),y.deleteForward(t,{unit:"line"})},{at:I});case"deleteHardLineBackward":return b(()=>y.deleteBackward(t,{unit:"block"}),{at:I});case"deleteSoftLineBackward":return b(()=>y.deleteBackward(t,{unit:"line"}),{at:I});case"deleteHardLineForward":return b(()=>y.deleteForward(t,{unit:"block"}),{at:I});case"deleteSoftLineForward":return b(()=>y.deleteForward(t,{unit:"line"}),{at:I});case"deleteWordBackward":return b(()=>y.deleteBackward(t,{unit:"word"}),{at:I});case"deleteWordForward":return b(()=>y.deleteForward(t,{unit:"word"}),{at:I});case"insertLineBreak":return b(()=>y.insertSoftBreak(t),{at:I});case"insertParagraph":return b(()=>y.insertBreak(t),{at:I});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(ay(H))return b(()=>X.insertData(t,H),{at:I});var je=H??"";if(Bt.get(t)&&(je=je.replace("\uFEFF","")),j==="insertText"&&/.*\n.*\n$/.test(je)&&(je=je.slice(0,-1)),je.includes(`
|
|
110
|
-
`))return
|
|
111
|
-
`);ve.forEach((
|
|
112
|
-
`?D.createElement(
|
|
113
|
-
`:""),[i]=D.useState(a);return Pr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),D.createElement(yy,{ref:r},i)},yy=D.memo(D.forwardRef((e,t)=>D.createElement("span",{"data-slate-string":!0,ref:t},e.children))),_i=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),D.createElement("span",vy({},a),!ot||!n?"\uFEFF":null,n?D.createElement("br",null):null)};function ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ef(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ol(Object(n),!0).forEach(function(r){wt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ol(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Dy=ot?300:0;function xy(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function ul(e){e.current&&(clearTimeout(e.current),e.current=null)}var Cy=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=_=>D.createElement(Ey,ef({},_))}=e,o=un(),l=D.useRef(null),u=D.useRef(null),[d,h]=D.useState(!1),p=D.useRef(null),m=D.useCallback(_=>{if(xy(l,_==null),_==null){var k;Ds.delete(o),(k=t.onPlaceholderResize)===null||k===void 0||k.call(t,null)}else{if(Ds.set(o,_),!l.current){var w=window.ResizeObserver||Eb;l.current=new w(()=>{var C;(C=t.onPlaceholderResize)===null||C===void 0||C.call(t,_)})}l.current.observe(_),u.current=_}},[u,t,o]),g=D.createElement(by,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[Qn];if(D.useEffect(()=>(f?p.current||(p.current=setTimeout(()=>{h(!0),p.current=null},Dy)):(ul(p),h(!1)),()=>ul(p)),[f,h]),f&&d){var x={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:gr?"inherit":void 0},contentEditable:!1,ref:m}};g=D.createElement(D.Fragment,null,i(x),g)}var b={"data-slate-leaf":!0};return s({attributes:b,children:g,leaf:t,text:r})},wy=D.memo(Cy,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&fe.equals(t.leaf,e.leaf)&&t.leaf[Qn]===e.leaf[Qn]),Ey=e=>{var{attributes:t,children:n}=e;return D.createElement("span",ef({},t),n)},ky=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=un(),l=D.useRef(null),u=fe.decorations(s,t),d=X.findKey(o,s),h=[],p=0;p<u.length;p++){var m=u[p];h.push(D.createElement(wy,{isLast:n&&p===u.length-1,key:"".concat(d.id,"-").concat(p),renderPlaceholder:a,leaf:m,text:s,parent:r,renderLeaf:i}))}var g=D.useCallback(f=>{var x=ei.get(o);f?(x==null||x.set(d,f),yn.set(s,f),Or.set(f,s)):(x==null||x.delete(d),yn.delete(s),l.current&&Or.delete(l.current)),l.current=f},[l,o,d,s]);return D.createElement("span",{"data-slate-node":"text",ref:g},h)},tf=D.memo(ky,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&gy(t.decorations,e.decorations));function ll(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function _s(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ll(Object(n),!0).forEach(function(r){wt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ll(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var _y=e=>{var{decorations:t,element:n,renderElement:r=_=>D.createElement(Ay,_s({},_)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=un(),l=Sy(),u=o.isInline(n),d=X.findKey(o,n),h=D.useCallback(_=>{var k=ei.get(o);_?(k==null||k.set(d,_),yn.set(n,_),Or.set(_,n)):(k==null||k.delete(d),yn.delete(n))},[o,d,n]),p=rf({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),m={"data-slate-node":"element",ref:h};if(u&&(m["data-slate-inline"]=!0),!u&&y.hasInlines(o,n)){var g=oe.string(n),f=Ad(g);f==="rtl"&&(m.dir=f)}if(y.isVoid(o,n)){m["data-slate-void"]=!0,!l&&u&&(m.contentEditable=!1);var x=u?"span":"div",[[b]]=oe.texts(n);p=D.createElement(x,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},D.createElement(tf,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:b})),lo.set(b,0),co.set(b,n)}return r({attributes:m,children:p,element:n})},By=D.memo(_y,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&py(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&Z.equals(e.selection,t.selection))),Ay=e=>{var{attributes:t,children:n,element:r}=e,a=un(),i=a.isInline(r)?"span":"div";return D.createElement(i,_s(_s({},t),{},{style:{position:"relative"}}),n)},nf=D.createContext(()=>[]),Fy=()=>D.useContext(nf),Ty=D.createContext(!1),rf=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=Fy(),l=un(),u=X.findPath(l,n),d=[],h=de.isElement(n)&&!l.isInline(n)&&y.hasInlines(l,n),p=0;p<n.children.length;p++){var m=u.concat(p),g=n.children[p],f=X.findKey(l,g),x=y.range(l,m),b=s&&Z.intersection(x,s),_=o([g,m]);for(var k of t){var w=Z.intersection(k,x);w&&_.push(w)}de.isElement(g)?d.push(D.createElement(Ty.Provider,{key:"provider-".concat(f.id),value:!!b},D.createElement(By,{decorations:_,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:b}))):d.push(D.createElement(tf,{decorations:_,key:f.id,isLast:h&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),lo.set(g,p),co.set(g,n)}return d},af=D.createContext(!1),Sy=()=>D.useContext(af),sf=D.createContext(null),Fn=()=>{var e=D.useContext(sf);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function jy(){var e=un(),t=D.useRef(!1),n=D.useRef(0),r=D.useCallback(()=>{if(!t.current){t.current=!0;var a=X.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return D.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var Oy=3,Py={bold:"mod+b",compose:["down","left","right","up","backspace","enter"],moveBackward:"left",moveForward:"right",moveWordBackward:"ctrl+left",moveWordForward:"ctrl+right",deleteBackward:"shift?+backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",italic:"mod+i",insertSoftBreak:"shift+enter",splitBlock:"enter",undo:"mod+z"},Ny={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"},Ry={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},We=e=>{var t=Py[e],n=Ny[e],r=Ry[e],a=t&&ki(t),i=n&&ki(n),s=r&&ki(r);return o=>!!(a&&a(o)||el&&i&&i(o)||!el&&s&&s(o))},Ue={isBold:We("bold"),isCompose:We("compose"),isMoveBackward:We("moveBackward"),isMoveForward:We("moveForward"),isDeleteBackward:We("deleteBackward"),isDeleteForward:We("deleteForward"),isDeleteLineBackward:We("deleteLineBackward"),isDeleteLineForward:We("deleteLineForward"),isDeleteWordBackward:We("deleteWordBackward"),isDeleteWordForward:We("deleteWordForward"),isExtendBackward:We("extendBackward"),isExtendForward:We("extendForward"),isExtendLineBackward:We("extendLineBackward"),isExtendLineForward:We("extendLineForward"),isItalic:We("italic"),isMoveLineBackward:We("moveLineBackward"),isMoveLineForward:We("moveLineForward"),isMoveWordBackward:We("moveWordBackward"),isMoveWordForward:We("moveWordForward"),isRedo:We("redo"),isSoftBreak:We("insertSoftBreak"),isSplitBlock:We("splitBlock"),isTransposeCharacter:We("transposeCharacter"),isUndo:We("undo")},My=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>mo(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}},Iy={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class of extends D.Component{constructor(){super(...arguments),wt(this,"context",null),wt(this,"manager",null),wt(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,Iy)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=My(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}}wt(of,"contextType",uo);var $y=ot?of:e=>{var{children:t}=e;return D.createElement(D.Fragment,null,t)},Ly=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],zy=["text"];function cl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function St(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cl(Object(n),!0).forEach(function(r){wt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var qy=e=>D.createElement(D.Fragment,null,rf(e)),Wy=e=>{var t=D.useCallback(T=>D.createElement(Hy,St({},T)),[]),{autoFocus:n,decorate:r=Uy,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:d=Vy,style:h={},as:p="div",disableDefaultStyles:m=!1}=e,g=Gn(e,Ly),f=Fn(),[x,b]=D.useState(!1),_=D.useRef(null),k=D.useRef([]),[w,C]=D.useState(),{onUserInput:F,receivedUserInput:S}=jy(),[,z]=D.useReducer(T=>T+1,0);Vd.set(f,z),xs.set(f,s);var N=D.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);D.useEffect(()=>{_.current&&n&&_.current.focus()},[n]);var $=D.useRef(),L=D.useMemo(()=>eb(()=>{var T=$.current;if((ot||!X.isComposing(f))&&(!N.isUpdatingSelection||T!=null&&T.isFlushing())&&!N.isDraggingInternally){var R=X.findDocumentOrShadowRoot(f),{activeElement:M}=R,K=X.toDOMNode(f,f),ee=R.getSelection();if(M===K?(N.latestElement=M,rn.set(f,!0)):rn.delete(f),!ee)return Q.deselect(f);var{anchorNode:te,focusNode:ae}=ee,le=X.hasEditableTarget(f,te)||X.isTargetInsideNonReadonlyVoid(f,te),J=X.hasEditableTarget(f,ae)||X.isTargetInsideNonReadonlyVoid(f,ae);if(le&&J){var pe=X.toSlateRange(f,ee,{exactMatch:!1,suppressThrow:!0});pe&&(!X.isComposing(f)&&!(T!=null&&T.hasPendingChanges())&&!(T!=null&&T.isFlushing())?Q.select(f,pe):T==null||T.handleUserSelect(pe))}s&&(!le||!J)&&Q.deselect(f)}},100),[f,s,N]),E=D.useMemo(()=>Z0(L,0),[L]);$.current=dy({node:_,onDOMSelectionChange:L,scheduleOnDOMSelectionChange:E}),Pr(()=>{var T,R,M;_.current&&(M=ho(_.current))?(Ud.set(f,M),pa.set(f,_.current),yn.set(f,_.current),Or.set(_.current,f)):yn.delete(f);var{selection:K}=f,ee=X.findDocumentOrShadowRoot(f),te=ee.getSelection();if(!(!te||!X.isFocused(f)||(T=$.current)!==null&&T!==void 0&&T.hasPendingAction())){var ae=he=>{var Ce=te.type!=="None";if(!(!K&&!Ce)){var Ae=te.focusNode,we;if(zn&&te.rangeCount>1){var Fe=te.getRangeAt(0),Se=te.getRangeAt(te.rangeCount-1);Fe.startContainer===Ae?we=Se.endContainer:we=Fe.startContainer}else we=te.anchorNode;var Le=pa.get(f),Je=!1;if(Le.contains(we)&&Le.contains(Ae)&&(Je=!0),Ce&&Je&&K&&!he){var je=X.toSlateRange(f,te,{exactMatch:!0,suppressThrow:!0});if(je&&Z.equals(je,K)){var He;if(!N.hasMarkPlaceholder||(He=we)!==null&&He!==void 0&&(He=He.parentElement)!==null&&He!==void 0&&He.hasAttribute("data-slate-mark-placeholder"))return}}if(K&&!X.hasRange(f,K)){f.selection=X.toSlateRange(f,te,{exactMatch:!1,suppressThrow:!0});return}N.isUpdatingSelection=!0;var ge=K&&X.toDOMRange(f,K);return ge?(X.isComposing(f)&&!ot?te.collapseToEnd():Z.isBackward(K)?te.setBaseAndExtent(ge.endContainer,ge.endOffset,ge.startContainer,ge.startOffset):te.setBaseAndExtent(ge.startContainer,ge.startOffset,ge.endContainer,ge.endOffset),d(f,ge)):te.removeAllRanges(),ge}};te.rangeCount<=1&&ae();var le=((R=$.current)===null||R===void 0?void 0:R.isFlushing())==="action";if(!ot||!le){setTimeout(()=>{N.isUpdatingSelection=!1});return}var J=null,pe=requestAnimationFrame(()=>{if(le){var he=Ce=>{try{var Ae=X.toDOMNode(f,f);Ae.focus(),ae(Ce)}catch{}};he(),J=setTimeout(()=>{he(!0),N.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(pe),J&&clearTimeout(J)}}});var A=D.useCallback(T=>{if(F(),!s&&X.hasEditableTarget(f,T.target)&&!Ky(T,a)){var R;if($.current)return $.current.handleDOMBeforeInput(T);E.flush(),L.flush();var{selection:M}=f,{inputType:K}=T,ee=T.dataTransfer||T.data||void 0,te=K==="insertCompositionText"||K==="deleteCompositionText";if(te&&X.isComposing(f))return;var ae=!1;if(K==="insertText"&&M&&Z.isCollapsed(M)&&T.data&&T.data.length===1&&/[a-z ]/i.test(T.data)&&M.anchor.offset!==0){var le,J;ae=!0,f.marks&&(ae=!1);var{anchor:pe}=M,[he,Ce]=X.toDOMPoint(f,pe),Ae=(le=he.parentElement)===null||le===void 0?void 0:le.closest("a"),we=X.getWindow(f);if(ae&&Ae&&X.hasDOMNode(f,Ae)){var Fe,Se=we==null?void 0:we.document.createTreeWalker(Ae,NodeFilter.SHOW_TEXT).lastChild();Se===he&&((Fe=Se.textContent)===null||Fe===void 0?void 0:Fe.length)===Ce&&(ae=!1)}if(ae&&he.parentElement&&(we==null||(J=we.getComputedStyle(he.parentElement))===null||J===void 0?void 0:J.whiteSpace)==="pre"){var Le=y.above(f,{at:pe.path,match:ie=>de.isElement(ie)&&y.isBlock(f,ie)});Le&&oe.string(Le[0]).includes(" ")&&(ae=!1)}}if(!K.startsWith("delete")||K.startsWith("deleteBy")){var[Je]=T.getTargetRanges();if(Je){var je=X.toSlateRange(f,Je,{exactMatch:!1,suppressThrow:!1});if(!M||!Z.equals(M,je)){ae=!1;var He=!te&&f.selection&&y.rangeRef(f,f.selection);Q.select(f,je),He&&Dr.set(f,He)}}}if(te)return;if(ae||T.preventDefault(),M&&Z.isExpanded(M)&&K.startsWith("delete")){var ge=K.endsWith("Backward")?"backward":"forward";y.deleteFragment(f,{direction:ge});return}switch(K){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{y.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{y.deleteForward(f);break}case"deleteContentBackward":{y.deleteBackward(f);break}case"deleteEntireSoftLine":{y.deleteBackward(f,{unit:"line"}),y.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{y.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{y.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{y.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{y.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{y.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{y.deleteForward(f,{unit:"word"});break}case"insertLineBreak":y.insertSoftBreak(f);break;case"insertParagraph":{y.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{K==="insertFromComposition"&&X.isComposing(f)&&(b(!1),pn.set(f,!1)),(ee==null?void 0:ee.constructor.name)==="DataTransfer"?X.insertData(f,ee):typeof ee=="string"&&(ae?k.current.push(()=>y.insertText(f,ee)):y.insertText(f,ee));break}}var U=(R=Dr.get(f))===null||R===void 0?void 0:R.unref();Dr.delete(f),U&&(!f.selection||!Z.equals(f.selection,U))&&Q.select(f,U)}},[f,L,F,a,s,E]),j=D.useCallback(T=>{T==null?(L.cancel(),E.cancel(),pa.delete(f),yn.delete(f),_.current&&Qt&&_.current.removeEventListener("beforeinput",A)):Qt&&T.addEventListener("beforeinput",A),_.current=T},[L,E,f,A]);Pr(()=>{var T=X.getWindow(f);return T.document.addEventListener("selectionchange",E),()=>{T.document.removeEventListener("selectionchange",E)}},[E]);var I=r([f,[]]),H=i&&f.children.length===1&&Array.from(oe.texts(f)).length===1&&oe.string(f)===""&&!x,q=D.useCallback(T=>{if(T&&H){var R;C((R=T.getBoundingClientRect())===null||R===void 0?void 0:R.height)}else C(void 0)},[H]);if(H){var re=y.start(f,[]);I.push({[Qn]:!0,placeholder:i,onPlaceholderResize:q,anchor:re,focus:re})}var{marks:ne}=f;if(N.hasMarkPlaceholder=!1,f.selection&&Z.isCollapsed(f.selection)&&ne){var{anchor:v}=f.selection,W=oe.leaf(f,v.path),V=Gn(W,zy);if(!fe.equals(W,ne,{loose:!0})){N.hasMarkPlaceholder=!0;var B=Object.fromEntries(Object.keys(V).map(T=>[T,null]));I.push(St(St(St({[Kd]:!0},B),ne),{},{anchor:v,focus:v}))}}return D.useEffect(()=>{setTimeout(()=>{var{selection:T}=f;if(T){var{anchor:R}=T,M=oe.leaf(f,R.path);if(ne&&!fe.equals(M,ne,{loose:!0})){Bt.set(f,ne);return}}Bt.delete(f)})}),D.createElement(af.Provider,{value:s},D.createElement(nf.Provider,{value:r},D.createElement($y,{node:_,receivedUserInput:S},D.createElement(p,St(St({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Qt||!ma?g.spellCheck:!1,autoCorrect:Qt||!ma?g.autoCorrect:"false",autoCapitalize:Qt||!ma?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:j,style:St(St({},m?{}:St({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},w?{minHeight:w}:{})),h),onBeforeInput:D.useCallback(T=>{if(!Qt&&!s&&!it(T,g.onBeforeInput)&&X.hasSelectableTarget(f,T.target)&&(T.preventDefault(),!X.isComposing(f))){var R=T.data;y.insertText(f,R)}},[g.onBeforeInput,f,s]),onInput:D.useCallback(T=>{if(!it(T,g.onInput)){if($.current){$.current.handleInput();return}for(var R of k.current)R();k.current=[]}},[g.onInput]),onBlur:D.useCallback(T=>{if(!(s||N.isUpdatingSelection||!X.hasSelectableTarget(f,T.target)||it(T,g.onBlur))){var R=X.findDocumentOrShadowRoot(f);if(N.latestElement!==R.activeElement){var{relatedTarget:M}=T,K=X.toDOMNode(f,f);if(M!==K&&!(Ct(M)&&M.hasAttribute("data-slate-spacer"))){if(M!=null&&an(M)&&X.hasDOMNode(f,M)){var ee=X.toSlateNode(f,M);if(de.isElement(ee)&&!f.isVoid(ee))return}if(gr){var te=R.getSelection();te==null||te.removeAllRanges()}rn.delete(f)}}}},[s,N.isUpdatingSelection,N.latestElement,f,g.onBlur]),onClick:D.useCallback(T=>{if(X.hasTarget(f,T.target)&&!it(T,g.onClick)&&an(T.target)){var R=X.toSlateNode(f,T.target),M=X.findPath(f,R);if(!y.hasPath(f,M)||oe.get(f,M)!==R)return;if(T.detail===Oy&&M.length>=1){var K=M;if(!(de.isElement(R)&&y.isBlock(f,R))){var ee,te=y.above(f,{match:Ae=>de.isElement(Ae)&&y.isBlock(f,Ae),at:M});K=(ee=te==null?void 0:te[1])!==null&&ee!==void 0?ee:M.slice(0,1)}var ae=y.range(f,K);Q.select(f,ae);return}if(s)return;var le=y.start(f,M),J=y.end(f,M),pe=y.void(f,{at:le}),he=y.void(f,{at:J});if(pe&&he&&P.equals(pe[1],he[1])){var Ce=y.range(f,le);Q.select(f,Ce)}}},[f,g.onClick,s]),onCompositionEnd:D.useCallback(T=>{if(X.hasSelectableTarget(f,T.target)){var R;if(X.isComposing(f)&&Promise.resolve().then(()=>{b(!1),pn.set(f,!1)}),(R=$.current)===null||R===void 0||R.handleCompositionEnd(T),it(T,g.onCompositionEnd)||ot)return;if(!gr&&!Rb&&!jb&&!Ib&&!Mb&&T.data){var M=Bt.get(f);Bt.delete(f),M!==void 0&&(Ut.set(f,f.marks),f.marks=M),y.insertText(f,T.data);var K=Ut.get(f);Ut.delete(f),K!==void 0&&(f.marks=K)}}},[g.onCompositionEnd,f]),onCompositionUpdate:D.useCallback(T=>{X.hasSelectableTarget(f,T.target)&&!it(T,g.onCompositionUpdate)&&(X.isComposing(f)||(b(!0),pn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:D.useCallback(T=>{if(X.hasSelectableTarget(f,T.target)){var R;if((R=$.current)===null||R===void 0||R.handleCompositionStart(T),it(T,g.onCompositionStart)||ot)return;b(!0);var{selection:M}=f;if(M&&Z.isExpanded(M)){y.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:D.useCallback(T=>{X.hasSelectableTarget(f,T.target)&&!it(T,g.onCopy)&&!dl(T)&&(T.preventDefault(),X.setFragmentData(f,T.clipboardData,"copy"))},[g.onCopy,f]),onCut:D.useCallback(T=>{if(!s&&X.hasSelectableTarget(f,T.target)&&!it(T,g.onCut)&&!dl(T)){T.preventDefault(),X.setFragmentData(f,T.clipboardData,"cut");var{selection:R}=f;if(R)if(Z.isExpanded(R))y.deleteFragment(f);else{var M=oe.parent(f,R.anchor.path);y.isVoid(f,M)&&Q.delete(f)}}},[s,f,g.onCut]),onDragOver:D.useCallback(T=>{if(X.hasTarget(f,T.target)&&!it(T,g.onDragOver)){var R=X.toSlateNode(f,T.target);de.isElement(R)&&y.isVoid(f,R)&&T.preventDefault()}},[g.onDragOver,f]),onDragStart:D.useCallback(T=>{if(!s&&X.hasTarget(f,T.target)&&!it(T,g.onDragStart)){var R=X.toSlateNode(f,T.target),M=X.findPath(f,R),K=de.isElement(R)&&y.isVoid(f,R)||y.void(f,{at:M,voids:!0});if(K){var ee=y.range(f,M);Q.select(f,ee)}N.isDraggingInternally=!0,X.setFragmentData(f,T.dataTransfer,"drag")}},[s,f,g.onDragStart,N]),onDrop:D.useCallback(T=>{if(!s&&X.hasTarget(f,T.target)&&!it(T,g.onDrop)){T.preventDefault();var R=f.selection,M=X.findEventRange(f,T),K=T.dataTransfer;Q.select(f,M),N.isDraggingInternally&&R&&!Z.equals(R,M)&&!y.void(f,{at:M,voids:!0})&&Q.delete(f,{at:R}),X.insertData(f,K),X.isFocused(f)||X.focus(f)}N.isDraggingInternally=!1},[s,f,g.onDrop,N]),onDragEnd:D.useCallback(T=>{!s&&N.isDraggingInternally&&g.onDragEnd&&X.hasTarget(f,T.target)&&g.onDragEnd(T),N.isDraggingInternally=!1},[s,N,g,f]),onFocus:D.useCallback(T=>{if(!s&&!N.isUpdatingSelection&&X.hasEditableTarget(f,T.target)&&!it(T,g.onFocus)){var R=X.toDOMNode(f,f),M=X.findDocumentOrShadowRoot(f);if(N.latestElement=M.activeElement,zn&&T.target!==R){R.focus();return}rn.set(f,!0)}},[s,N,f,g.onFocus]),onKeyDown:D.useCallback(T=>{if(!s&&X.hasEditableTarget(f,T.target)){var R;(R=$.current)===null||R===void 0||R.handleKeyDown(T);var{nativeEvent:M}=T;if(X.isComposing(f)&&M.isComposing===!1&&(pn.set(f,!1),b(!1)),it(T,g.onKeyDown)||X.isComposing(f))return;var{selection:K}=f,ee=f.children[K!==null?K.focus.path[0]:0],te=Ad(oe.string(ee))==="rtl";if(Ue.isRedo(M)){T.preventDefault();var ae=f;typeof ae.redo=="function"&&ae.redo();return}if(Ue.isUndo(M)){T.preventDefault();var le=f;typeof le.undo=="function"&&le.undo();return}if(Ue.isMoveLineBackward(M)){T.preventDefault(),Q.move(f,{unit:"line",reverse:!0});return}if(Ue.isMoveLineForward(M)){T.preventDefault(),Q.move(f,{unit:"line"});return}if(Ue.isExtendLineBackward(M)){T.preventDefault(),Q.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Ue.isExtendLineForward(M)){T.preventDefault(),Q.move(f,{unit:"line",edge:"focus"});return}if(Ue.isMoveBackward(M)){T.preventDefault(),K&&Z.isCollapsed(K)?Q.move(f,{reverse:!te}):Q.collapse(f,{edge:te?"end":"start"});return}if(Ue.isMoveForward(M)){T.preventDefault(),K&&Z.isCollapsed(K)?Q.move(f,{reverse:te}):Q.collapse(f,{edge:te?"start":"end"});return}if(Ue.isMoveWordBackward(M)){T.preventDefault(),K&&Z.isExpanded(K)&&Q.collapse(f,{edge:"focus"}),Q.move(f,{unit:"word",reverse:!te});return}if(Ue.isMoveWordForward(M)){T.preventDefault(),K&&Z.isExpanded(K)&&Q.collapse(f,{edge:"focus"}),Q.move(f,{unit:"word",reverse:te});return}if(Qt){if((Hd||gr)&&K&&(Ue.isDeleteBackward(M)||Ue.isDeleteForward(M))&&Z.isCollapsed(K)){var J=oe.parent(f,K.anchor.path);if(de.isElement(J)&&y.isVoid(f,J)&&(y.isInline(f,J)||y.isBlock(f,J))){T.preventDefault(),y.deleteBackward(f,{unit:"block"});return}}}else{if(Ue.isBold(M)||Ue.isItalic(M)||Ue.isTransposeCharacter(M)){T.preventDefault();return}if(Ue.isSoftBreak(M)){T.preventDefault(),y.insertSoftBreak(f);return}if(Ue.isSplitBlock(M)){T.preventDefault(),y.insertBreak(f);return}if(Ue.isDeleteBackward(M)){T.preventDefault(),K&&Z.isExpanded(K)?y.deleteFragment(f,{direction:"backward"}):y.deleteBackward(f);return}if(Ue.isDeleteForward(M)){T.preventDefault(),K&&Z.isExpanded(K)?y.deleteFragment(f,{direction:"forward"}):y.deleteForward(f);return}if(Ue.isDeleteLineBackward(M)){T.preventDefault(),K&&Z.isExpanded(K)?y.deleteFragment(f,{direction:"backward"}):y.deleteBackward(f,{unit:"line"});return}if(Ue.isDeleteLineForward(M)){T.preventDefault(),K&&Z.isExpanded(K)?y.deleteFragment(f,{direction:"forward"}):y.deleteForward(f,{unit:"line"});return}if(Ue.isDeleteWordBackward(M)){T.preventDefault(),K&&Z.isExpanded(K)?y.deleteFragment(f,{direction:"backward"}):y.deleteBackward(f,{unit:"word"});return}if(Ue.isDeleteWordForward(M)){T.preventDefault(),K&&Z.isExpanded(K)?y.deleteFragment(f,{direction:"forward"}):y.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:D.useCallback(T=>{!s&&X.hasEditableTarget(f,T.target)&&!it(T,g.onPaste)&&(!Qt||zb(T.nativeEvent)||gr)&&(T.preventDefault(),X.insertData(f,T.clipboardData))},[s,f,g.onPaste])}),D.createElement(qy,{decorations:I,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},Hy=e=>{var{attributes:t,children:n}=e;return D.createElement("span",St({},t),n,ot&&D.createElement("br",null))},Uy=()=>[],Vy=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&Z.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),rb(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},it=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},dl=e=>an(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),Ky=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},Zy=D.createContext(!1),Yy=D.createContext({});function Gy(e){var t=D.useRef([]).current,n=D.useRef({editor:e}).current,r=D.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=D.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var Qy=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],Jy=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Gn(e,Qy),[l,u]=D.useState(()=>{if(!oe.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Xe.stringify(s)));if(!y.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Xe.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:d,onChange:h}=Gy(t),p=D.useCallback(f=>{var x;switch(r&&r(t.children),f==null||(x=f.operation)===null||x===void 0?void 0:x.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(b=>({v:b.v+1,editor:t})),h(t)},[t,h,r,a,i]);D.useEffect(()=>(Cs.set(t,p),()=>{Cs.set(t,()=>{})}),[t,p]);var[m,g]=D.useState(X.isFocused(t));return D.useEffect(()=>{g(X.isFocused(t))},[t]),Pr(()=>{var f=()=>g(X.isFocused(t));return Wd>=17?(document.addEventListener("focusin",f),document.addEventListener("focusout",f),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",f)}):(document.addEventListener("focus",f,!0),document.addEventListener("blur",f,!0),()=>{document.removeEventListener("focus",f,!0),document.removeEventListener("blur",f,!0)})},[]),D.createElement(Yy.Provider,{value:d},D.createElement(sf.Provider,{value:l},D.createElement(uo.Provider,{value:l.editor},D.createElement(Zy.Provider,{value:m},n))))},fl=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},hl=(e,t,n)=>{var r=X.toDOMRange(e,t).getBoundingClientRect(),a=X.toDOMRange(e,n).getBoundingClientRect();return fl(r,a)&&fl(a,r)},Xy=(e,t)=>{var n=y.range(e,Z.end(t)),r=Array.from(y.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(hl(e,y.range(e,r[a]),n))return y.range(e,r[a],n);if(r.length<2)return y.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)hl(e,y.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return y.range(e,r[i],n)};function ml(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function pl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ml(Object(n),!0).forEach(function(r){wt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ml(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var e1=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 ei.set(r,new WeakMap),r.addMark=(u,d)=>{var h,p;(h=fo.get(r))===null||h===void 0||h(),!Bt.get(r)&&(p=ct.get(r))!==null&&p!==void 0&&p.length&&Bt.set(r,null),Ut.delete(r),o(u,d)},r.removeMark=u=>{var d;!Bt.get(r)&&(d=ct.get(r))!==null&&d!==void 0&&d.length&&Bt.set(r,null),Ut.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&Z.isCollapsed(r.selection)){var d=y.above(r,{match:g=>de.isElement(g)&&y.isBlock(r,g),at:r.selection});if(d){var[,h]=d,p=y.range(r,h,r.selection.anchor),m=Xy(r,p);Z.isCollapsed(m)||Q.delete(r,{at:m})}}},r.apply=u=>{var d=[],h=[],p=ct.get(r);if(p!=null&&p.length){var m=p.map(j=>ey(j,u)).filter(Boolean);ct.set(r,m)}var g=en.get(r);g&&en.set(r,nl(r,g,u));var f=Xt.get(r);if(f!=null&&f.at){var x=ke.isPoint(f==null?void 0:f.at)?ks(r,f.at,u):nl(r,f.at,u);Xt.set(r,x?pl(pl({},f),{},{at:x}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{d.push(...Pn(r,u.path));break}case"set_selection":{var b;(b=Dr.get(r))===null||b===void 0||b.unref(),Dr.delete(r);break}case"insert_node":case"remove_node":{d.push(...Pn(r,P.parent(u.path)));break}case"merge_node":{var _=P.previous(u.path);d.push(...Pn(r,_));break}case"move_node":{var k=P.common(P.parent(u.path),P.parent(u.newPath));d.push(...Pn(r,k));var w;P.isBefore(u.path,u.newPath)?(d.push(...Pn(r,P.parent(u.path))),w=u.newPath):(d.push(...Pn(r,P.parent(u.newPath))),w=u.path);var C=oe.get(t,P.parent(w)),F=X.findKey(r,C),S=y.pathRef(r,P.parent(w));h.push([S,F]);break}}a(u);for(var[z,N]of d){var[$]=y.node(r,z);Aa.set($,N)}for(var[L,E]of h)if(L.current){var[A]=y.node(r,L.current);Aa.set(A,E)}},r.setFragmentData=u=>{var{selection:d}=r;if(d){var[h,p]=Z.edges(d),m=y.void(r,{at:h.path}),g=y.void(r,{at:p.path});if(!(Z.isCollapsed(d)&&!m)){var f=X.toDOMRange(r,d),x=f.cloneContents(),b=x.childNodes[0];if(x.childNodes.forEach($=>{$.textContent&&$.textContent.trim()!==""&&(b=$)}),g){var[_]=g,k=f.cloneRange(),w=X.toDOMNode(r,_);k.setEndAfter(w),x=k.cloneContents()}if(m&&(b=x.querySelector("[data-slate-spacer]")),Array.from(x.querySelectorAll("[data-slate-zero-width]")).forEach($=>{var L=$.getAttribute("data-slate-zero-width")==="n";$.textContent=L?`
|
|
114
|
-
`:""}),Zd(b)){var C=b.ownerDocument.createElement("span");C.style.whiteSpace="pre",C.appendChild(b),x.appendChild(C),b=C}var F=r.getFragment(),S=JSON.stringify(F),z=window.btoa(encodeURIComponent(S));b.setAttribute("data-slate-fragment",z),u.setData("application/".concat(n),z);var N=x.ownerDocument.createElement("div");return N.appendChild(x),N.setAttribute("hidden","true"),x.ownerDocument.body.appendChild(N),u.setData("text/html",N.innerHTML),u.setData("text/plain",Gd(N)),x.ownerDocument.body.removeChild(N),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var d=u.getData("application/".concat(n))||Vb(u);if(d){var h=decodeURIComponent(window.atob(d)),p=JSON.parse(h);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var d=u.getData("text/plain");if(d){var h=d.split(/\r\n|\r|\n/),p=!1;for(var m of h)p&&Q.splitNodes(r,{always:!0}),r.insertText(m),p=!0;return!0}return!1},r.onChange=u=>{var d=Wd<18?yc.unstable_batchedUpdates:h=>h();d(()=>{var h=Cs.get(r);h&&h(u),i(u)})},r},Pn=(e,t)=>{var n=[];for(var[r,a]of y.levels(e,{at:t})){var i=X.findKey(e,r);n.push([a,i])}return n};const t1={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},reportError:e=>{console.error(e)}},Gt=D.createContext(t1);var Y=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e))(Y||{}),Pt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Pt||{});const n1=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case Y.blockquote:return c.jsx("blockquote",{className:"subtle",...e,children:t});case Y.link:return c.jsx("a",{...e,children:t});case Y.li:return c.jsx("li",{...e,children:t});case Y.mention:const a=r;return c.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case Y.ol:return c.jsx("ol",{...e,children:t});case Y.ul:return c.jsx("ul",{...e,children:t});case Y.span:return c.jsx("span",{...e,children:t});case Y.paragraph:return c.jsx("p",{...e,children:t});default:return c.jsx("span",{...e,children:t})}},r1=({attributes:e,children:t,leaf:n})=>{const r=n;return r[Y.bold]&&(t=c.jsx("strong",{children:t})),r[Y.italic]&&(t=c.jsx("em",{children:t})),r[Y.strikethrough]&&(t=c.jsx("s",{children:t})),c.jsx("span",{...e,children:t})},Bs="MENTION: ",uf={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},gl={"mention-popover":35,default:-52},Bi=16,lf=(e,t,n)=>{const r=D.useRef(null),{showLinkEditor:a,mentionPopover:i}=D.useContext(Gt),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),D.useEffect(()=>{var m,g;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,d=0;if(t==="mention-popover"){const{position:f}=i,x=k=>{if(!y.hasPath(e,k.path))return!1;const w=oe.get(e,k.path);return y.isEditor(w)||de.isElement(w)?k.offset<=w.children.length:fe.isText(w)?k.offset<=w.text.length:!1};if(f&&(!x(f==null?void 0:f.anchor)||!x(f==null?void 0:f.focus)))return;u=X.toDOMRange(e,f||uf).getBoundingClientRect();const _=(m=document.getElementById(n))==null?void 0:m.getBoundingClientRect();l.style.setProperty("--width",`${((_==null?void 0:_.width)||0)/Bi}rem`),d=(_==null?void 0:_.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(u=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}u||(u=(g=document.getElementById(n))==null?void 0:g.getBoundingClientRect());const h=gl[t]||gl.default,p=((u==null?void 0:u.top)||0)+window.scrollY+h;d===0&&(d=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${p/Bi}rem`,l.style.left=`${d/Bi}rem`},o),r},a1=e=>{const[t,n]=D.useState(null);return D.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=y.nodes(e,{at:r,match:i=>i.type===Y.link});if(a){const i=a[0],s=Ic(i.link),o=i.children[0],l=(o==null?void 0:o.text)||"";n({...s,text:l})}else n(null)},[e,e.selection]),t};var st=(e=>(e.paragraph="paragraph",e.heading="heading",e.list="list",e.listItem="listItem",e.link="link",e.mention="mention",e.image="image",e.blockquote="blockquote",e.code="code",e.html="html",e.emphasis="emphasis",e.strong="strong",e.delete="delete",e.inlineCode="inlineCode",e.thematicBreak="thematicBreak",e.text="text",e))(st||{});const qn={[Y.paragraph]:Y.paragraph,[Y.blockquote]:Y.blockquote,[Y.codeblock]:Y.codeblock,[Y.link]:Y.link,[Y.ul]:Y.ul,[Y.ol]:Y.ol,[Y.li]:Y.li,[Y.mention]:Y.mention,[Y.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Pt.emphasis]:Y.italic,[Pt.strong]:Y.bold,[Pt.delete]:Y.strikethrough,[Pt.code]:Y.code,[Y.hr]:Y.hr,[Y.image]:Y.image};function vl(e){if(e)throw e}var ga=Object.prototype.hasOwnProperty,cf=Object.prototype.toString,bl=Object.defineProperty,yl=Object.getOwnPropertyDescriptor,Dl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):cf.call(t)==="[object Array]"},xl=function(t){if(!t||cf.call(t)!=="[object Object]")return!1;var n=ga.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&ga.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||ga.call(t,a)},Cl=function(t,n){bl&&n.name==="__proto__"?bl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},wl=function(t,n){if(n==="__proto__")if(ga.call(t,n)){if(yl)return yl(t,n).value}else return;return t[n]},i1=function e(){var t,n,r,a,i,s,o=arguments[0],l=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},l=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});l<u;++l)if(t=arguments[l],t!=null)for(n in t)r=wl(o,n),a=wl(t,n),o!==a&&(d&&a&&(xl(a)||(i=Dl(a)))?(i?(i=!1,s=r&&Dl(r)?r:[]):s=r&&xl(r)?r:{},Cl(o,{name:n,newValue:e(d,s,a)})):typeof a<"u"&&Cl(o,{name:n,newValue:a}));return o};const Ai=kn(i1);function As(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function s1(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const d=e[++i];let h=-1;if(l){s(l);return}for(;++h<a.length;)(u[h]===null||u[h]===void 0)&&(u[h]=a[h]);a=u,d?o1(d,o)(...u):s(null,...u)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function o1(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const d=u;if(o&&n)throw d;return a(d)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function xr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?El(e.position):"start"in e||"end"in e?El(e):"line"in e||"column"in e?Fs(e):""}function Fs(e){return kl(e&&e.line)+":"+kl(e&&e.column)}function El(e){return Fs(e&&e.start)+"-"+Fs(e&&e.end)}function kl(e){return e&&typeof e=="number"?e:1}class ht extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=o?o.line:void 0,this.name=xr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}ht.prototype.file="";ht.prototype.name="";ht.prototype.reason="";ht.prototype.message="";ht.prototype.stack="";ht.prototype.column=void 0;ht.prototype.line=void 0;ht.prototype.ancestors=void 0;ht.prototype.cause=void 0;ht.prototype.fatal=void 0;ht.prototype.place=void 0;ht.prototype.ruleId=void 0;ht.prototype.source=void 0;const jt={basename:u1,dirname:l1,extname:c1,join:d1,sep:"/"};function u1(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ir(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 l1(e){if(Ir(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 c1(e){Ir(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 d1(...e){let t=-1,n;for(;++t<e.length;)Ir(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":f1(n)}function f1(e){Ir(e);const t=e.codePointAt(0)===47;let n=h1(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function h1(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 Ir(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const m1={cwd:p1};function p1(){return"/"}function Ts(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function g1(e){if(typeof e=="string")e=new URL(e);else if(!Ts(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 v1(e)}function v1(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 Fi=["history","path","basename","stem","extname","dirname"];class b1{constructor(t){let n;t?Ts(t)?n={path:t}:typeof t=="string"||y1(t)?n={value:t}:n=t:n={},this.cwd=m1.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Fi.length;){const i=Fi[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)Fi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?jt.basename(this.path):void 0}set basename(t){Si(t,"basename"),Ti(t,"basename"),this.path=jt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?jt.dirname(this.path):void 0}set dirname(t){_l(this.basename,"dirname"),this.path=jt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?jt.extname(this.path):void 0}set extname(t){if(Ti(t,"extname"),_l(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=jt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ts(t)&&(t=g1(t)),Si(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?jt.basename(this.path,this.extname):void 0}set stem(t){Si(t,"stem"),Ti(t,"stem"),this.path=jt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new ht(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Ti(e,t){if(e&&e.includes(jt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+jt.sep+"`")}function Si(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function _l(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function y1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const D1=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},x1={}.hasOwnProperty;class po extends D1{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=s1()}copy(){const t=new po;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ai(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Pi("data",this.frozen),this.namespace[t]=n,this):x1.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Pi("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=ta(t),r=this.parser||this.Parser;return ji("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ji("process",this.parser||this.Parser),Oi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=ta(t),l=r.parse(o);r.run(l,o,function(d,h,p){if(d||!h||!p)return u(d);const m=h,g=r.stringify(m,p);E1(g)?p.value=g:p.result=g,u(d,p)});function u(d,h){d||!h?s(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),ji("processSync",this.parser||this.Parser),Oi("processSync",this.compiler||this.Compiler),this.process(t,a),Al("processSync","process",n),r;function a(i,s){n=!0,vl(i),r=s}}run(t,n,r){Bl(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=ta(n);a.run(t,l,u);function u(d,h,p){const m=h||t;d?o(d):s?s(m):r(void 0,m,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),Al("runSync","run",r),a;function i(s,o){vl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=ta(n),a=this.compiler||this.Compiler;return Oi("stringify",a),Bl(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Pi("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;l(d,h)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(a.settings=Ai(!0,a.settings,u.settings))}function o(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,d){let h=-1,p=-1;for(;++h<r.length;)if(r[h][0]===u){p=h;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[m,...g]=d;const f=r[p][1];As(f)&&As(m)&&(m=Ai(!0,f,m)),r[p]=[u,m,...g]}}}}const C1=new po().freeze();function ji(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Oi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Pi(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 Bl(e){if(!As(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Al(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ta(e){return w1(e)?e:new b1(e)}function w1(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function E1(e){return typeof e=="string"||k1(e)}function k1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const _1={};function B1(e,t){const n=t||_1,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return df(e,r,a)}function df(e,t,n){if(A1(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 Fl(e.children,t,n)}return Array.isArray(e)?Fl(e,t,n):""}function Fl(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=df(e[a],t,n);return r.join("")}function A1(e){return!!(e&&typeof e=="object")}const Tl=document.createElement("i");function go(e){const t="&"+e+";";Tl.innerHTML=t;const n=Tl.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function It(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function xt(e,t){return e.length>0?(It(e,e.length,0,t),e):t}const Sl={}.hasOwnProperty;function F1(e){const t={};let n=-1;for(;++n<e.length;)T1(t,e[n]);return t}function T1(e,t){let n;for(n in t){const a=(Sl.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){Sl.call(a,s)||(a[s]=[]);const o=i[s];S1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function S1(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);It(e,0,0,r)}function ff(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 Un(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ot=ln(/[A-Za-z]/),At=ln(/[\dA-Za-z]/),j1=ln(/[#-'*+\--9=?A-Z^-~]/);function Ss(e){return e!==null&&(e<32||e===127)}const js=ln(/\d/),O1=ln(/[\dA-Fa-f]/),P1=ln(/[!-/:-@[-`{-~]/);function ye(e){return e!==null&&e<-2}function ft(e){return e!==null&&(e<0||e===32)}function Pe(e){return e===-2||e===-1||e===32}const N1=ln(/\p{P}|\p{S}/u),R1=ln(/\s/);function ln(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ze(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Pe(l)?(e.enter(n),o(l)):t(l)}function o(l){return Pe(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const M1={tokenize:I1};function I1(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ze(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return ye(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const $1={tokenize:L1},jl={tokenize:z1};function L1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(k){if(r<n.length){const w=n[r];return t.containerState=w[1],e.attempt(w[0].continuation,l,u)(k)}return u(k)}function l(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&_();const w=t.events.length;let C=w,F;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){F=t.events[C][1].end;break}b(r);let S=w;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},F),S++;return It(t.events,C+1,0,t.events.slice(w)),t.events.length=S,u(k)}return o(k)}function u(k){if(r===n.length){if(!a)return p(k);if(a.currentConstruct&&a.currentConstruct.concrete)return g(k);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(jl,d,h)(k)}function d(k){return a&&_(),b(r),p(k)}function h(k){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(k)}function p(k){return t.containerState={},e.attempt(jl,m,g)(k)}function m(k){return r++,n.push([t.currentConstruct,t.containerState]),p(k)}function g(k){if(k===null){a&&_(),b(0),e.consume(k);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(k)}function f(k){if(k===null){x(e.exit("chunkFlow"),!0),b(0),e.consume(k);return}return ye(k)?(e.consume(k),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(k),f)}function x(k,w){const C=t.sliceStream(k);if(w&&C.push(null),k.previous=i,i&&(i.next=k),i=k,a.defineSkip(k.start),a.write(C),t.parser.lazy[k.start.line]){let F=a.events.length;for(;F--;)if(a.events[F][1].start.offset<s&&(!a.events[F][1].end||a.events[F][1].end.offset>s))return;const S=t.events.length;let z=S,N,$;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(N){$=t.events[z][1].end;break}N=!0}for(b(r),F=S;F<t.events.length;)t.events[F][1].end=Object.assign({},$),F++;It(t.events,z+1,0,t.events.slice(S)),t.events.length=F}}function b(k){let w=n.length;for(;w-- >k;){const C=n[w];t.containerState=C[1],C[0].exit.call(t,e)}n.length=k}function _(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function z1(e,t,n){return ze(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ol(e){if(e===null||ft(e)||R1(e))return 1;if(N1(e))return 2}function vo(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 Os={name:"attention",tokenize:W1,resolveAll:q1};function q1(e,t){let n=-1,r,a,i,s,o,l,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);Pl(h,-l),Pl(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:p},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=xt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=xt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=xt(u,vo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=xt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=xt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,It(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function W1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Ol(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),o(l)}function o(l){if(l===i)return e.consume(l),o;const u=e.exit("attentionSequence"),d=Ol(l),h=!d||d===2&&a||n.includes(l),p=!a||a===2&&d||n.includes(r);return u._open=!!(i===42?h:h&&(a||!p)),u._close=!!(i===42?p:p&&(d||!h)),t(l)}}function Pl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const H1={name:"autolink",tokenize:U1};function U1(e,t,n){let r=0;return a;function a(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return Ot(m)?(e.consume(m),s):u(m)}function s(m){return m===43||m===45||m===46||At(m)?(r=1,o(m)):u(m)}function o(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||At(m))&&r++<32?(e.consume(m),o):(r=0,u(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||Ss(m)?n(m):(e.consume(m),l)}function u(m){return m===64?(e.consume(m),d):j1(m)?(e.consume(m),u):n(m)}function d(m){return At(m)?h(m):n(m)}function h(m){return m===46?(e.consume(m),r=0,d):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):p(m)}function p(m){if((m===45||At(m))&&r++<63){const g=m===45?p:h;return e.consume(m),g}return n(m)}}const ti={tokenize:V1,partial:!0};function V1(e,t,n){return r;function r(i){return Pe(i)?ze(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ye(i)?t(i):n(i)}}const hf={name:"blockQuote",tokenize:K1,continuation:{tokenize:Z1},exit:Y1};function K1(e,t,n){const r=this;return a;function a(s){if(s===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return Pe(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function Z1(e,t,n){const r=this;return a;function a(s){return Pe(s)?ze(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(hf,t,n)(s)}}function Y1(e){e.exit("blockQuote")}const mf={name:"characterEscape",tokenize:G1};function G1(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),a}function a(i){return P1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const pf={name:"characterReference",tokenize:Q1};function Q1(e,t,n){const r=this;let a=0,i,s;return o;function o(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=At,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=O1,d):(e.enter("characterReferenceValue"),i=7,s=js,d(h))}function d(h){if(h===59&&a){const p=e.exit("characterReferenceValue");return s===At&&!go(r.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&a++<i?(e.consume(h),d):n(h)}}const Nl={tokenize:X1,partial:!0},Rl={name:"codeFenced",tokenize:J1,concrete:!0};function J1(e,t,n){const r=this,a={tokenize:C,partial:!0};let i=0,s=0,o;return l;function l(F){return u(F)}function u(F){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=F,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(F)}function d(F){return F===o?(s++,e.consume(F),d):s<3?n(F):(e.exit("codeFencedFenceSequence"),Pe(F)?ze(e,h,"whitespace")(F):h(F))}function h(F){return F===null||ye(F)?(e.exit("codeFencedFence"),r.interrupt?t(F):e.check(Nl,f,w)(F)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(F))}function p(F){return F===null||ye(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(F)):Pe(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ze(e,m,"whitespace")(F)):F===96&&F===o?n(F):(e.consume(F),p)}function m(F){return F===null||ye(F)?h(F):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(F))}function g(F){return F===null||ye(F)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(F)):F===96&&F===o?n(F):(e.consume(F),g)}function f(F){return e.attempt(a,w,x)(F)}function x(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),b}function b(F){return i>0&&Pe(F)?ze(e,_,"linePrefix",i+1)(F):_(F)}function _(F){return F===null||ye(F)?e.check(Nl,f,w)(F):(e.enter("codeFlowValue"),k(F))}function k(F){return F===null||ye(F)?(e.exit("codeFlowValue"),_(F)):(e.consume(F),k)}function w(F){return e.exit("codeFenced"),t(F)}function C(F,S,z){let N=0;return $;function $(I){return F.enter("lineEnding"),F.consume(I),F.exit("lineEnding"),L}function L(I){return F.enter("codeFencedFence"),Pe(I)?ze(F,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):E(I)}function E(I){return I===o?(F.enter("codeFencedFenceSequence"),A(I)):z(I)}function A(I){return I===o?(N++,F.consume(I),A):N>=s?(F.exit("codeFencedFenceSequence"),Pe(I)?ze(F,j,"whitespace")(I):j(I)):z(I)}function j(I){return I===null||ye(I)?(F.exit("codeFencedFence"),S(I)):z(I)}}}function X1(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 Ni={name:"codeIndented",tokenize:tD},eD={tokenize:nD,partial:!0};function tD(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),ze(e,i,"linePrefix",4+1)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):ye(u)?e.attempt(eD,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||ye(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function nD(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):ye(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):ze(e,i,"linePrefix",4+1)(s)}function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):ye(s)?a(s):n(s)}}const rD={name:"codeText",tokenize:sD,resolve:aD,previous:iD};function aD(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 iD(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function sD(e,t,n){let r=0,a,i;return s;function s(h){return e.enter("codeText"),e.enter("codeTextSequence"),o(h)}function o(h){return h===96?(e.consume(h),r++,o):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(i=e.enter("codeTextSequence"),a=0,d(h)):ye(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||ye(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}function gf(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,oD(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),It(e,a,n-a+1,o))}}return!u}function oD(e,t){const n=e[t][1],r=e[t][2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let d,h,p=-1,m=n,g=0,f=0;const x=[f];for(;m;){for(;e[++a][1]!==m;);i.push(a),m._tokenizer||(d=r.sliceStream(m),m.next||d.push(null),h&&s.defineSkip(m.start),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(f=p+1,x.push(f),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(s.events=[],m?(m._tokenizer=void 0,m.previous=void 0):x.pop(),p=x.length;p--;){const b=o.slice(x[p],x[p+1]),_=i.pop();l.unshift([_,_+b.length-1]),It(e,_,2,b)}for(p=-1;++p<l.length;)u[g+l[p][0]]=g+l[p][1],g+=l[p][1]-l[p][0]-1;return u}const uD={tokenize:dD,resolve:cD},lD={tokenize:fD,partial:!0};function cD(e){return gf(e),e}function dD(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):ye(o)?e.check(lD,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 fD(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ze(e,i,"linePrefix")}function i(s){if(s===null||ye(s))return n(s);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function vf(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(b){return b===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(b),e.exit(i),p):b===null||b===32||b===41||Ss(b)?n(b):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(b))}function p(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"}),m(b))}function m(b){return b===62?(e.exit("chunkString"),e.exit(o),p(b)):b===null||b===60||ye(b)?n(b):(e.consume(b),b===92?g:m)}function g(b){return b===60||b===62||b===92?(e.consume(b),m):m(b)}function f(b){return!d&&(b===null||b===41||ft(b))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(b)):d<u&&b===40?(e.consume(b),d++,f):b===41?(e.consume(b),d--,f):b===null||b===32||b===40||Ss(b)?n(b):(e.consume(b),b===92?x:f)}function x(b){return b===40||b===41||b===92?(e.consume(b),f):f(b)}}function bf(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(m){return e.enter(r),e.enter(a),e.consume(m),e.exit(a),e.enter(i),d}function d(m){return o>999||m===null||m===91||m===93&&!l||m===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(m):m===93?(e.exit(i),e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):ye(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||ye(m)||o++>999?(e.exit("chunkString"),d(m)):(e.consume(m),l||(l=!Pe(m)),m===92?p:h)}function p(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}}function yf(e,t,n,r,a,i){let s;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(a),e.consume(p),e.exit(a),s=p===40?41:p,l):n(p)}function l(p){return p===s?(e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===s?(e.exit(i),l(s)):p===null?n(p):ye(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),ze(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===s||p===null||ye(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:d)}function h(p){return p===s||p===92?(e.consume(p),d):d(p)}}function Cr(e,t){let n;return r;function r(a){return ye(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Pe(a)?ze(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const hD={name:"definition",tokenize:pD},mD={tokenize:gD,partial:!0};function pD(e,t,n){const r=this;let a;return i;function i(m){return e.enter("definition"),s(m)}function s(m){return bf.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return a=Un(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):n(m)}function l(m){return ft(m)?Cr(e,u)(m):u(m)}function u(m){return vf(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(mD,h,h)(m)}function h(m){return Pe(m)?ze(e,p,"whitespace")(m):p(m)}function p(m){return m===null||ye(m)?(e.exit("definition"),r.parser.defined.push(a),t(m)):n(m)}}function gD(e,t,n){return r;function r(o){return ft(o)?Cr(e,a)(o):n(o)}function a(o){return yf(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Pe(o)?ze(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ye(o)?t(o):n(o)}}const vD={name:"hardBreakEscape",tokenize:bD};function bD(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return ye(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const yD={name:"headingAtx",tokenize:xD,resolve:DD};function DD(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"},It(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function xD(e,t,n){let r=0;return a;function a(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):d===null||ft(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),l(d)):d===null||ye(d)?(e.exit("atxHeading"),t(d)):Pe(d)?ze(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function l(d){return d===35?(e.consume(d),l):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||ft(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const CD=["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"],Ml=["pre","script","style","textarea"],wD={name:"htmlFlow",tokenize:BD,resolveTo:_D,concrete:!0},ED={tokenize:FD,partial:!0},kD={tokenize:AD,partial:!0};function _D(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 BD(e,t,n){const r=this;let a,i,s,o,l;return u;function u(B){return d(B)}function d(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),h}function h(B){return B===33?(e.consume(B),p):B===47?(e.consume(B),i=!0,f):B===63?(e.consume(B),a=3,r.interrupt?t:v):Ot(B)?(e.consume(B),s=String.fromCharCode(B),x):n(B)}function p(B){return B===45?(e.consume(B),a=2,m):B===91?(e.consume(B),a=5,o=0,g):Ot(B)?(e.consume(B),a=4,r.interrupt?t:v):n(B)}function m(B){return B===45?(e.consume(B),r.interrupt?t:v):n(B)}function g(B){const T="CDATA[";return B===T.charCodeAt(o++)?(e.consume(B),o===T.length?r.interrupt?t:E:g):n(B)}function f(B){return Ot(B)?(e.consume(B),s=String.fromCharCode(B),x):n(B)}function x(B){if(B===null||B===47||B===62||ft(B)){const T=B===47,R=s.toLowerCase();return!T&&!i&&Ml.includes(R)?(a=1,r.interrupt?t(B):E(B)):CD.includes(s.toLowerCase())?(a=6,T?(e.consume(B),b):r.interrupt?t(B):E(B)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):i?_(B):k(B))}return B===45||At(B)?(e.consume(B),s+=String.fromCharCode(B),x):n(B)}function b(B){return B===62?(e.consume(B),r.interrupt?t:E):n(B)}function _(B){return Pe(B)?(e.consume(B),_):$(B)}function k(B){return B===47?(e.consume(B),$):B===58||B===95||Ot(B)?(e.consume(B),w):Pe(B)?(e.consume(B),k):$(B)}function w(B){return B===45||B===46||B===58||B===95||At(B)?(e.consume(B),w):C(B)}function C(B){return B===61?(e.consume(B),F):Pe(B)?(e.consume(B),C):k(B)}function F(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),l=B,S):Pe(B)?(e.consume(B),F):z(B)}function S(B){return B===l?(e.consume(B),l=null,N):B===null||ye(B)?n(B):(e.consume(B),S)}function z(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||ft(B)?C(B):(e.consume(B),z)}function N(B){return B===47||B===62||Pe(B)?k(B):n(B)}function $(B){return B===62?(e.consume(B),L):n(B)}function L(B){return B===null||ye(B)?E(B):Pe(B)?(e.consume(B),L):n(B)}function E(B){return B===45&&a===2?(e.consume(B),H):B===60&&a===1?(e.consume(B),q):B===62&&a===4?(e.consume(B),W):B===63&&a===3?(e.consume(B),v):B===93&&a===5?(e.consume(B),ne):ye(B)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(ED,V,A)(B)):B===null||ye(B)?(e.exit("htmlFlowData"),A(B)):(e.consume(B),E)}function A(B){return e.check(kD,j,V)(B)}function j(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),I}function I(B){return B===null||ye(B)?A(B):(e.enter("htmlFlowData"),E(B))}function H(B){return B===45?(e.consume(B),v):E(B)}function q(B){return B===47?(e.consume(B),s="",re):E(B)}function re(B){if(B===62){const T=s.toLowerCase();return Ml.includes(T)?(e.consume(B),W):E(B)}return Ot(B)&&s.length<8?(e.consume(B),s+=String.fromCharCode(B),re):E(B)}function ne(B){return B===93?(e.consume(B),v):E(B)}function v(B){return B===62?(e.consume(B),W):B===45&&a===2?(e.consume(B),v):E(B)}function W(B){return B===null||ye(B)?(e.exit("htmlFlowData"),V(B)):(e.consume(B),W)}function V(B){return e.exit("htmlFlow"),t(B)}}function AD(e,t,n){const r=this;return a;function a(s){return ye(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function FD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(ti,t,n)}}const TD={name:"htmlText",tokenize:SD};function SD(e,t,n){const r=this;let a,i,s;return o;function o(v){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(v),l}function l(v){return v===33?(e.consume(v),u):v===47?(e.consume(v),C):v===63?(e.consume(v),k):Ot(v)?(e.consume(v),z):n(v)}function u(v){return v===45?(e.consume(v),d):v===91?(e.consume(v),i=0,g):Ot(v)?(e.consume(v),_):n(v)}function d(v){return v===45?(e.consume(v),m):n(v)}function h(v){return v===null?n(v):v===45?(e.consume(v),p):ye(v)?(s=h,q(v)):(e.consume(v),h)}function p(v){return v===45?(e.consume(v),m):h(v)}function m(v){return v===62?H(v):v===45?p(v):h(v)}function g(v){const W="CDATA[";return v===W.charCodeAt(i++)?(e.consume(v),i===W.length?f:g):n(v)}function f(v){return v===null?n(v):v===93?(e.consume(v),x):ye(v)?(s=f,q(v)):(e.consume(v),f)}function x(v){return v===93?(e.consume(v),b):f(v)}function b(v){return v===62?H(v):v===93?(e.consume(v),b):f(v)}function _(v){return v===null||v===62?H(v):ye(v)?(s=_,q(v)):(e.consume(v),_)}function k(v){return v===null?n(v):v===63?(e.consume(v),w):ye(v)?(s=k,q(v)):(e.consume(v),k)}function w(v){return v===62?H(v):k(v)}function C(v){return Ot(v)?(e.consume(v),F):n(v)}function F(v){return v===45||At(v)?(e.consume(v),F):S(v)}function S(v){return ye(v)?(s=S,q(v)):Pe(v)?(e.consume(v),S):H(v)}function z(v){return v===45||At(v)?(e.consume(v),z):v===47||v===62||ft(v)?N(v):n(v)}function N(v){return v===47?(e.consume(v),H):v===58||v===95||Ot(v)?(e.consume(v),$):ye(v)?(s=N,q(v)):Pe(v)?(e.consume(v),N):H(v)}function $(v){return v===45||v===46||v===58||v===95||At(v)?(e.consume(v),$):L(v)}function L(v){return v===61?(e.consume(v),E):ye(v)?(s=L,q(v)):Pe(v)?(e.consume(v),L):N(v)}function E(v){return v===null||v===60||v===61||v===62||v===96?n(v):v===34||v===39?(e.consume(v),a=v,A):ye(v)?(s=E,q(v)):Pe(v)?(e.consume(v),E):(e.consume(v),j)}function A(v){return v===a?(e.consume(v),a=void 0,I):v===null?n(v):ye(v)?(s=A,q(v)):(e.consume(v),A)}function j(v){return v===null||v===34||v===39||v===60||v===61||v===96?n(v):v===47||v===62||ft(v)?N(v):(e.consume(v),j)}function I(v){return v===47||v===62||ft(v)?N(v):n(v)}function H(v){return v===62?(e.consume(v),e.exit("htmlTextData"),e.exit("htmlText"),t):n(v)}function q(v){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),re}function re(v){return Pe(v)?ze(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(v):ne(v)}function ne(v){return e.enter("htmlTextData"),s(v)}}const bo={name:"labelEnd",tokenize:MD,resolveTo:RD,resolveAll:ND},jD={tokenize:ID},OD={tokenize:$D},PD={tokenize:LD};function ND(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 RD(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},d={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=xt(o,e.slice(i+1,i+r+3)),o=xt(o,[["enter",d,t]]),o=xt(o,vo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=xt(o,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),o=xt(o,e.slice(s+1)),o=xt(o,[["exit",l,t]]),It(e,i,e.length,o),e}function MD(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(p){return i?i._inactive?h(p):(s=r.parser.defined.includes(Un(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(jD,d,s?d:h)(p):p===91?e.attempt(OD,d,s?u:h)(p):s?d(p):h(p)}function u(p){return e.attempt(PD,d,h)(p)}function d(p){return t(p)}function h(p){return i._balanced=!0,n(p)}}function ID(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),a}function a(h){return ft(h)?Cr(e,i)(h):i(h)}function i(h){return h===41?d(h):vf(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return ft(h)?Cr(e,l)(h):d(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?yf(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return ft(h)?Cr(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function $D(e,t,n){const r=this;return a;function a(o){return bf.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Un(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function LD(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const zD={name:"labelStartImage",tokenize:qD,resolveAll:bo.resolveAll};function qD(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 WD={name:"labelStartLink",tokenize:HD,resolveAll:bo.resolveAll};function HD(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 Ri={name:"lineEnding",tokenize:UD};function UD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ze(e,t,"linePrefix")}}const va={name:"thematicBreak",tokenize:VD};function VD(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||ye(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Pe(u)?ze(e,o,"whitespace")(u):o(u))}}const lt={name:"list",tokenize:YD,continuation:{tokenize:GD},exit:JD},KD={tokenize:XD,partial:!0},ZD={tokenize:QD,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(m){const g=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:js(m)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(va,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return js(m)&&++s<10?(e.consume(m),l):(!r.interrupt||s<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(ti,r.interrupt?n:d,e.attempt(KD,p,h))}function d(m){return r.containerState.initialBlankLine=!0,i++,p(m)}function h(m){return Pe(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function GD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ti,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ze(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Pe(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ZD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,ze(e,e.attempt(lt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function QD(e,t,n){const r=this;return ze(e,a,"listItemIndent",r.containerState.size+1);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function JD(e){e.exit(this.containerState.type)}function XD(e,t,n){const r=this;return ze(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function a(i){const s=r.events[r.events.length-1];return!Pe(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Il={name:"setextUnderline",tokenize:tx,resolveTo:ex};function ex(e,t){let n=e.length,r,a,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:Object.assign({},e[a][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[a][1].type="setextHeadingText",i?(e.splice(a,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[i][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}function tx(e,t,n){const r=this;let a;return i;function i(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Pe(u)?ze(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ye(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const nx={tokenize:rx};function rx(e){const t=this,n=e.attempt(ti,r,e.attempt(this.parser.constructs.flowInitial,a,ze(e,e.attempt(this.parser.constructs.flow,a,e.attempt(uD,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 ax={resolveAll:xf()},ix=Df("string"),sx=Df("text");function Df(e){return{tokenize:t,resolveAll:xf(e==="text"?ox:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function u(d){if(d===null)return!0;const h=a[d];let p=-1;if(h)for(;++p<h.length;){const m=h[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function xf(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 ox(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 ux(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:_,enter:k,exit:w,attempt:S(C),check:S(F),interrupt:S(F,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:m,sliceSerialize:p,now:g,defineSkip:f,write:h};let d=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function h(L){return s=xt(s,L),x(),s[s.length-1]!==null?[]:(z(t,0),u.events=vo(i,u.events,u),u.events)}function p(L,E){return cx(m(L),E)}function m(L){return lx(s,L)}function g(){const{line:L,column:E,offset:A,_index:j,_bufferIndex:I}=r;return{line:L,column:E,offset:A,_index:j,_bufferIndex:I}}function f(L){a[L.line]=L.column,$()}function x(){let L;for(;r._index<s.length;){const E=s[r._index];if(typeof E=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<E.length;)b(E.charCodeAt(r._bufferIndex));else b(E)}}function b(L){d=d(L)}function _(L){ye(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,$()):L!==-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=L}function k(L,E){const A=E||{};return A.type=L,A.start=g(),u.events.push(["enter",A,u]),o.push(A),A}function w(L){const E=o.pop();return E.end=g(),u.events.push(["exit",E,u]),E}function C(L,E){z(L,E.from)}function F(L,E){E.restore()}function S(L,E){return A;function A(j,I,H){let q,re,ne,v;return Array.isArray(j)?V(j):"tokenize"in j?V([j]):W(j);function W(M){return K;function K(ee){const te=ee!==null&&M[ee],ae=ee!==null&&M.null,le=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(ae)?ae:ae?[ae]:[]];return V(le)(ee)}}function V(M){return q=M,re=0,M.length===0?H:B(M[re])}function B(M){return K;function K(ee){return v=N(),ne=M,M.partial||(u.currentConstruct=M),M.name&&u.parser.constructs.disable.null.includes(M.name)?R():M.tokenize.call(E?Object.assign(Object.create(u),E):u,l,T,R)(ee)}}function T(M){return L(ne,v),I}function R(M){return v.restore(),++re<q.length?B(q[re]):H}}}function z(L,E){L.resolveAll&&!i.includes(L)&&i.push(L),L.resolve&&It(u.events,E,u.events.length-E,L.resolve(u.events.slice(E),u)),L.resolveTo&&(u.events=L.resolveTo(u.events,u))}function N(){const L=g(),E=u.previous,A=u.currentConstruct,j=u.events.length,I=Array.from(o);return{restore:H,from:j};function H(){r=L,u.previous=E,u.currentConstruct=A,u.events.length=j,o=I,$()}}function $(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function lx(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 cx(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=`
|
|
109
|
+
`)&&c===u.textContent.length&&c--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var k;u=o,c=((k=o.textContent)===null||k===void 0?void 0:k.length)||0}var B=ee.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!B)return null;var C=h?B:ee.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!C)return null;var w={anchor:B,focus:C};return K.isExpanded(w)&&K.isForward(w)&&wt(u)&&b.void(e,{at:w.focus,mode:"highest"})&&(w=b.unhangRange(e,w,{voids:!0})),w}};function Qb(e,t){var{path:n,diff:r}=t;if(!b.hasPath(e,n))return!1;var a=oe.get(e,n);if(!fe.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=O.next(n);if(!b.hasPath(e,i))return!1;var s=oe.get(e,i);return fe.isText(s)&&s.text.startsWith(r.text)}function Xd(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 Jb(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 Xb(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 ef(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=Jb(i,a),o=Math.min(i.length-s,a.length-s),l=Xb(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 ey(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=Xd(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 ef(e,{start:r,end:l,text:o})}function ty(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function ks(e,t){var{path:n,offset:r}=t;if(!b.hasPath(e,n))return null;var a=oe.get(e,n);if(!fe.isText(a))return null;var i=b.above(e,{match:o=>de.isElement(o)&&b.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=b.next(e,{at:n,match:fe.isText});if(!s||!O.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function rl(e,t){var n=ks(e,t.anchor);if(!n)return null;if(K.isCollapsed(t))return{anchor:n,focus:n};var r=ks(e,t.focus);return r?{anchor:n,focus:r}:null}function _s(e,t,n){var r=ct.get(e),a=r==null?void 0:r.find(c=>{var{path:h}=c;return O.equals(h,t.path)});if(!a||t.offset<=a.diff.start)return Ee.transform(t,n,{affinity:"backward"});var{diff:i}=a;if(t.offset<=i.start+i.text.length){var s={path:t.path,offset:i.start},o=Ee.transform(s,n,{affinity:"backward"});return o?{path:o.path,offset:o.offset+t.offset-i.start}:null}var l={path:t.path,offset:t.offset-i.text.length+i.end-i.start},u=Ee.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&O.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 al(e,t,n){var r=_s(e,t.anchor,n);if(!r)return null;if(K.isCollapsed(t))return{anchor:r,focus:r};var a=_s(e,t.focus,n);return a?{anchor:r,focus:a}:null}function ny(e,t){var{path:n,diff:r,id:a}=e;switch(t.type){case"insert_text":return!O.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!O.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!O.equals(t.path,n)||t.position>=r.end?{diff:r,id:a,path:O.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:O.transform(n,t,{affinity:"forward"})};case"merge_node":return O.equals(t.path,n)?{diff:{start:r.start+t.position,end:r.end+t.position,text:r.text},id:a,path:O.transform(n,t)}:{diff:r,id:a,path:O.transform(n,t)}}var i=O.transform(n,t);return i?{diff:r,path:i,id:a}:null}function il(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function na(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?il(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):il(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ry=25,ay=200,iy=function(){},sy=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function oy(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,c=()=>{var E=tn.get(t);if(tn.delete(t),E){var{selection:A}=t,N=rl(t,E);N&&(!A||!K.equals(N,A))&&X.select(t,N)}},h=()=>{var E=en.get(t);if(en.delete(t),!!E){if(E.at){var A=Ee.isPoint(E.at)?ks(t,E.at):rl(t,E.at);if(!A)return;var N=b.range(t,A);(!t.selection||!K.equals(t.selection,N))&&X.select(t,A)}E.run()}},p=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!C()&&!B()){c();return}a||(a=!0,setTimeout(()=>a=!1)),B()&&(a="action");var E=t.selection&&b.rangeRef(t,t.selection,{affinity:"forward"});Vt.set(t,t.marks),iy("flush",en.get(t),ct.get(t));for(var A=C(),N;N=(R=ct.get(t))===null||R===void 0?void 0:R[0];){var R,H,G=At.get(t);G!==void 0&&(At.delete(t),t.marks=G),G&&u===!1&&(u=null);var Q=ty(N);(!t.selection||!K.equals(t.selection,Q))&&X.select(t,Q),N.diff.text?b.insertText(t,N.diff.text):b.deleteFragment(t),ct.set(t,(H=ct.get(t))===null||H===void 0?void 0:H.filter($=>{var{id:W}=$;return W!==N.id})),Qb(t,N)||(A=!1,en.delete(t),Vt.delete(t),a="action",tn.delete(t),n.cancel(),r.cancel(),E==null||E.unref())}var re=E==null?void 0:E.unref();if(re&&!tn.get(t)&&(!t.selection||!K.equals(re,t.selection))&&X.select(t,re),B()){h();return}A&&n(),n.flush(),r.flush(),c();var x=Vt.get(t);Vt.delete(t),x!==void 0&&(t.marks=x,t.onChange())},m=E=>{i&&clearTimeout(i),i=setTimeout(()=>{gn.set(t,!1),p()},ry)},g=E=>{gn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,N=xs.get(t);if(N){if(C()||A){N.style.display="none";return}N.style.removeProperty("display")}},y=(E,A)=>{var N,R=(N=ct.get(t))!==null&&N!==void 0?N:[];ct.set(t,R);var H=oe.leaf(t,E),G=R.findIndex(x=>O.equals(x.path,E));if(G<0){var Q=ef(H.text,A);Q&&R.push({path:E,diff:A,id:l++}),f();return}var re=ey(H.text,R[G].diff,A);if(!re){R.splice(G,1),f();return}R[G]=na(na({},R[G]),{},{diff:re})},v=function(A){var{at:N}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,tn.delete(t),n.cancel(),r.cancel(),B()&&p(),en.set(t,{at:N,run:A}),o=setTimeout(p)},k=E=>{var A;s&&(clearTimeout(s),s=null);var{inputType:N}=E,R=null,H=E.dataTransfer||E.data||void 0;u!==!1&&N!=="insertText"&&N!=="insertCompositionText"&&(u=!1);var[G]=E.getTargetRanges();G&&(R=ee.toSlateRange(t,G,{exactMatch:!1,suppressThrow:!0}));var Q=ee.getWindow(t),re=Q.getSelection();if(!R&&re&&(G=re,R=ee.toSlateRange(t,re,{exactMatch:!1,suppressThrow:!0})),R=(A=R)!==null&&A!==void 0?A:t.selection,!!R){var x=!0;if(N.startsWith("delete")){if(K.isExpanded(R)){var[$,W]=K.edges(R),_=oe.leaf(t,$.path);if(_.text.length===$.offset&&W.offset===0){var F=b.next(t,{at:$.path,match:fe.isText});F&&O.equals(F[1],W.path)&&(R={anchor:W,focus:W})}}var I=N.endsWith("Backward")?"backward":"forward",[M,V]=K.edges(R),[ne,te]=b.leaf(t,M.path),ae={text:"",start:M.offset,end:V.offset},le=ct.get(t),J=le==null?void 0:le.find(ve=>O.equals(ve.path,te)),ge=J?[J.diff,ae]:[ae],he=Xd(ne.text,...ge);if(he.length===0&&(x=!1),K.isExpanded(R)){if(x&&O.equals(R.anchor.path,R.focus.path)){var ye={path:R.anchor.path,offset:M.offset},Ae=b.range(t,ye,ye);return S(Ae),y(R.anchor.path,{text:"",end:V.offset,start:M.offset})}return v(()=>b.deleteFragment(t,{direction:I}),{at:R})}}switch(N){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>b.deleteFragment(t),{at:R});case"deleteContent":case"deleteContentForward":{var{anchor:Fe}=R;if(x&&K.isCollapsed(R)){var He=oe.leaf(t,Fe.path);if(Fe.offset<He.text.length)return y(Fe.path,{text:"",start:Fe.offset,end:Fe.offset+1})}return v(()=>b.deleteForward(t),{at:R})}case"deleteContentBackward":{var Se,{anchor:Te}=R,Ne=Es(G)?G.isCollapsed:!!((Se=G)!==null&&Se!==void 0&&Se.collapsed);return x&&Ne&&K.isCollapsed(R)&&Te.offset>0?y(Te.path,{text:"",start:Te.offset-1,end:Te.offset}):v(()=>b.deleteBackward(t),{at:R})}case"deleteEntireSoftLine":return v(()=>{b.deleteBackward(t,{unit:"line"}),b.deleteForward(t,{unit:"line"})},{at:R});case"deleteHardLineBackward":return v(()=>b.deleteBackward(t,{unit:"block"}),{at:R});case"deleteSoftLineBackward":return v(()=>b.deleteBackward(t,{unit:"line"}),{at:R});case"deleteHardLineForward":return v(()=>b.deleteForward(t,{unit:"block"}),{at:R});case"deleteSoftLineForward":return v(()=>b.deleteForward(t,{unit:"line"}),{at:R});case"deleteWordBackward":return v(()=>b.deleteBackward(t,{unit:"word"}),{at:R});case"deleteWordForward":return v(()=>b.deleteForward(t,{unit:"word"}),{at:R});case"insertLineBreak":return v(()=>b.insertSoftBreak(t),{at:R});case"insertParagraph":return v(()=>b.insertBreak(t),{at:R});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if(sy(H))return v(()=>ee.insertData(t,H),{at:R});var ke=H??"";if(At.get(t)&&(ke=ke.replace("\uFEFF","")),N==="insertText"&&/.*\n.*\n$/.test(ke)&&(ke=ke.slice(0,-1)),ke.includes(`
|
|
110
|
+
`))return v(()=>{var ve=ke.split(`
|
|
111
|
+
`);ve.forEach((we,Ke)=>{we&&b.insertText(t,we),Ke!==ve.length-1&&b.insertSoftBreak(t)})},{at:R});if(O.equals(R.anchor.path,R.focus.path)){var[Ue,pe]=K.edges(R),U={start:Ue.offset,end:pe.offset,text:ke};if(ke&&u&&N==="insertCompositionText"){var ie=u.start+u.text.search(/\S|$/),me=U.start+U.text.search(/\S|$/);me===ie+1&&U.end===u.start+u.text.length?(U.start-=1,u=null,L()):u=!1}else N==="insertText"?u===null?u=U:u&&K.isCollapsed(R)&&u.end+u.text.length===Ue.offset?u=na(na({},u),{},{text:u.text+ke}):u=!1:u=!1;if(x){y(Ue.path,U);return}}return v(()=>b.insertText(t,ke),{at:R})}}}},B=()=>!!en.get(t),C=()=>{var E;return!!((E=ct.get(t))!==null&&E!==void 0&&E.length)},w=()=>B()||C(),T=()=>a,S=E=>{tn.set(t,E),s&&(clearTimeout(s),s=null);var{selection:A}=t;if(E){var N=!A||!O.equals(A.anchor.path,E.anchor.path),R=!A||!O.equals(A.anchor.path.slice(0,-1),E.anchor.path.slice(0,-1));(N&&u||R)&&(u=!1),(N||C())&&(s=setTimeout(p,ay))}},q=()=>{(B()||!C())&&p()},P=E=>{C()||(f(!0),setTimeout(f))},L=()=>{B()||(o=setTimeout(p))},z=E=>{if(!(C()||B())&&E.some(N=>po(t,N,E))){var A;(A=Zd.get(t))===null||A===void 0||A()}};return{flush:p,scheduleFlush:L,hasPendingDiffs:C,hasPendingAction:B,hasPendingChanges:w,isFlushing:T,handleUserSelect:S,handleCompositionEnd:m,handleCompositionStart:g,handleDOMBeforeInput:k,handleKeyDown:P,handleDomMutations:z,handleInput:q}}function uy(){var e=D.useRef(!1);return D.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Rr=ga?D.useLayoutEffect:D.useEffect;function ly(e,t,n){var[r]=D.useState(()=>new MutationObserver(t));Rr(()=>{r.takeRecords()}),D.useEffect(()=>{if(!e.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");return r.observe(e.current,n),()=>r.disconnect()},[r,e,n])}var cy=["node"];function sl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function dy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sl(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var fy={subtree:!0,childList:!0,characterData:!0},hy=ot?e=>{var{node:t}=e,n=Qn(e,cy);if(!ot)return null;var r=ln(),a=uy(),[i]=D.useState(()=>oy(dy({editor:r},n)));return ly(t,i.handleDomMutations,fy),ho.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,my=["anchor","focus"],py=["anchor","focus"],gy=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),tf=(e,t)=>{var n=Qn(e,my),r=Qn(t,py);return e[Jn]===t[Jn]&&gy(n,r)},vy=(e,t)=>{if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++){var r=e[n],a=t[n];if(!K.equals(r,a)||!tf(r,a))return!1}return!0},by=(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||!tf(r,a))return!1}return!0};function ol(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function yy(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ol(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ol(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Dy=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=ln(),s=ee.findPath(i,a),o=O.parent(s),l=!!n[Yd];return i.isVoid(r)?D.createElement(Bi,{length:oe.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&b.string(i,o)===""?D.createElement(Bi,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?D.createElement(Bi,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
|
|
112
|
+
`?D.createElement(ul,{isTrailing:!0,text:n.text}):D.createElement(ul,{text:n.text})},ul=e=>{var{text:t,isTrailing:n=!1}=e,r=D.useRef(null),a=()=>"".concat(t??"").concat(n?`
|
|
113
|
+
`:""),[i]=D.useState(a);return Rr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),D.createElement(xy,{ref:r},i)},xy=D.memo(D.forwardRef((e,t)=>D.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Bi=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),D.createElement("span",yy({},a),!ot||!n?"\uFEFF":null,n?D.createElement("br",null):null)};function ll(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function nf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ll(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ll(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Cy=ot?300:0;function wy(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function cl(e){e.current&&(clearTimeout(e.current),e.current=null)}var Ey=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=k=>D.createElement(_y,nf({},k))}=e,o=ln(),l=D.useRef(null),u=D.useRef(null),[c,h]=D.useState(!1),p=D.useRef(null),m=D.useCallback(k=>{if(wy(l,k==null),k==null){var B;xs.delete(o),(B=t.onPlaceholderResize)===null||B===void 0||B.call(t,null)}else{if(xs.set(o,k),!l.current){var C=window.ResizeObserver||_b;l.current=new C(()=>{var w;(w=t.onPlaceholderResize)===null||w===void 0||w.call(t,k)})}l.current.observe(k),u.current=k}},[u,t,o]),g=D.createElement(Dy,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[Jn];if(D.useEffect(()=>(f?p.current||(p.current=setTimeout(()=>{h(!0),p.current=null},Cy)):(cl(p),h(!1)),()=>cl(p)),[f,h]),f&&c){var y={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:vr?"inherit":void 0},contentEditable:!1,ref:m}};g=D.createElement(D.Fragment,null,i(y),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},ky=D.memo(Ey,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&fe.equals(t.leaf,e.leaf)&&t.leaf[Jn]===e.leaf[Jn]),_y=e=>{var{attributes:t,children:n}=e;return D.createElement("span",nf({},t),n)},By=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=ln(),l=D.useRef(null),u=fe.decorations(s,t),c=ee.findKey(o,s),h=[],p=0;p<u.length;p++){var m=u[p];h.push(D.createElement(ky,{isLast:n&&p===u.length-1,key:"".concat(c.id,"-").concat(p),renderPlaceholder:a,leaf:m,text:s,parent:r,renderLeaf:i}))}var g=D.useCallback(f=>{var y=ti.get(o);f?(y==null||y.set(c,f),Dn.set(s,f),Nr.set(f,s)):(y==null||y.delete(c),Dn.delete(s),l.current&&Nr.delete(l.current)),l.current=f},[l,o,c,s]);return D.createElement("span",{"data-slate-node":"text",ref:g},h)},rf=D.memo(By,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&by(t.decorations,e.decorations));function dl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Bs(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?dl(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ay=e=>{var{decorations:t,element:n,renderElement:r=k=>D.createElement(Ty,Bs({},k)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=ln(),l=Oy(),u=o.isInline(n),c=ee.findKey(o,n),h=D.useCallback(k=>{var B=ti.get(o);k?(B==null||B.set(c,k),Dn.set(n,k),Nr.set(k,n)):(B==null||B.delete(c),Dn.delete(n))},[o,c,n]),p=sf({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),m={"data-slate-node":"element",ref:h};if(u&&(m["data-slate-inline"]=!0),!u&&b.hasInlines(o,n)){var g=oe.string(n),f=Td(g);f==="rtl"&&(m.dir=f)}if(b.isVoid(o,n)){m["data-slate-void"]=!0,!l&&u&&(m.contentEditable=!1);var y=u?"span":"div",[[v]]=oe.texts(n);p=D.createElement(y,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},D.createElement(rf,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),co.set(v,0),fo.set(v,n)}return r({attributes:m,children:p,element:n})},Fy=D.memo(Ay,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&vy(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&K.equals(e.selection,t.selection))),Ty=e=>{var{attributes:t,children:n,element:r}=e,a=ln(),i=a.isInline(r)?"span":"div";return D.createElement(i,Bs(Bs({},t),{},{style:{position:"relative"}}),n)},af=D.createContext(()=>[]),Sy=()=>D.useContext(af),jy=D.createContext(!1),sf=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=Sy(),l=ln(),u=ee.findPath(l,n),c=[],h=de.isElement(n)&&!l.isInline(n)&&b.hasInlines(l,n),p=0;p<n.children.length;p++){var m=u.concat(p),g=n.children[p],f=ee.findKey(l,g),y=b.range(l,m),v=s&&K.intersection(y,s),k=o([g,m]);for(var B of t){var C=K.intersection(B,y);C&&k.push(C)}de.isElement(g)?c.push(D.createElement(jy.Provider,{key:"provider-".concat(f.id),value:!!v},D.createElement(Fy,{decorations:k,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):c.push(D.createElement(rf,{decorations:k,key:f.id,isLast:h&&p===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),co.set(g,p),fo.set(g,n)}return c},of=D.createContext(!1),Oy=()=>D.useContext(of),uf=D.createContext(null),Sn=()=>{var e=D.useContext(uf);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function Py(){var e=ln(),t=D.useRef(!1),n=D.useRef(0),r=D.useCallback(()=>{if(!t.current){t.current=!0;var a=ee.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return D.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var Ny=3,Ry={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"},My={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"},Iy={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},We=e=>{var t=Ry[e],n=My[e],r=Iy[e],a=t&&_i(t),i=n&&_i(n),s=r&&_i(r);return o=>!!(a&&a(o)||nl&&i&&i(o)||!nl&&s&&s(o))},Ve={isBold:We("bold"),isCompose:We("compose"),isMoveBackward:We("moveBackward"),isMoveForward:We("moveForward"),isDeleteBackward:We("deleteBackward"),isDeleteForward:We("deleteForward"),isDeleteLineBackward:We("deleteLineBackward"),isDeleteLineForward:We("deleteLineForward"),isDeleteWordBackward:We("deleteWordBackward"),isDeleteWordForward:We("deleteWordForward"),isExtendBackward:We("extendBackward"),isExtendForward:We("extendForward"),isExtendLineBackward:We("extendLineBackward"),isExtendLineForward:We("extendLineForward"),isItalic:We("italic"),isMoveLineBackward:We("moveLineBackward"),isMoveLineForward:We("moveLineForward"),isMoveWordBackward:We("moveWordBackward"),isMoveWordForward:We("moveWordForward"),isRedo:We("redo"),isSoftBreak:We("insertSoftBreak"),isSplitBlock:We("splitBlock"),isTransposeCharacter:We("transposeCharacter"),isUndo:We("undo")},$y=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>po(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}},Ly={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class lf extends D.Component{constructor(){super(...arguments),Et(this,"context",null),Et(this,"manager",null),Et(this,"mutationObserver",null)}observe(){var t,{node:n}=this.props;if(!n.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");(t=this.mutationObserver)===null||t===void 0||t.observe(n.current,Ly)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=$y(n,t),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var t,n,r,a=(t=this.mutationObserver)===null||t===void 0?void 0:t.takeRecords();if(a!=null&&a.length){var i;(i=this.manager)===null||i===void 0||i.registerMutations(a)}return(n=this.mutationObserver)===null||n===void 0||n.disconnect(),(r=this.manager)===null||r===void 0||r.restoreDOM(),null}componentDidUpdate(){var t;(t=this.manager)===null||t===void 0||t.clear(),this.observe()}componentWillUnmount(){var t;(t=this.mutationObserver)===null||t===void 0||t.disconnect()}render(){return this.props.children}}Et(lf,"contextType",lo);var zy=ot?lf:e=>{var{children:t}=e;return D.createElement(D.Fragment,null,t)},qy=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],Wy=["text"];function fl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function jt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fl(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Hy=e=>D.createElement(D.Fragment,null,sf(e)),Uy=e=>{var t=D.useCallback(F=>D.createElement(Vy,jt({},F)),[]),{autoFocus:n,decorate:r=Ky,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=Zy,style:h={},as:p="div",disableDefaultStyles:m=!1}=e,g=Qn(e,qy),f=Sn(),[y,v]=D.useState(!1),k=D.useRef(null),B=D.useRef([]),[C,w]=D.useState(),{onUserInput:T,receivedUserInput:S}=Py(),[,q]=D.useReducer(F=>F+1,0);Zd.set(f,q),Cs.set(f,s);var P=D.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);D.useEffect(()=>{k.current&&n&&k.current.focus()},[n]);var L=D.useRef(),z=D.useMemo(()=>nb(()=>{var F=L.current;if((ot||!ee.isComposing(f))&&(!P.isUpdatingSelection||F!=null&&F.isFlushing())&&!P.isDraggingInternally){var I=ee.findDocumentOrShadowRoot(f),{activeElement:M}=I,V=ee.toDOMNode(f,f),ne=I.getSelection();if(M===V?(P.latestElement=M,an.set(f,!0)):an.delete(f),!ne)return X.deselect(f);var{anchorNode:te,focusNode:ae}=ne,le=ee.hasEditableTarget(f,te)||ee.isTargetInsideNonReadonlyVoid(f,te),J=ee.hasEditableTarget(f,ae)||ee.isTargetInsideNonReadonlyVoid(f,ae);if(le&&J){var ge=ee.toSlateRange(f,ne,{exactMatch:!1,suppressThrow:!0});ge&&(!ee.isComposing(f)&&!(F!=null&&F.hasPendingChanges())&&!(F!=null&&F.isFlushing())?X.select(f,ge):F==null||F.handleUserSelect(ge))}s&&(!le||!J)&&X.deselect(f)}},100),[f,s,P]),E=D.useMemo(()=>G0(z,0),[z]);L.current=hy({node:k,onDOMSelectionChange:z,scheduleOnDOMSelectionChange:E}),Rr(()=>{var F,I,M;k.current&&(M=mo(k.current))?(Kd.set(f,M),va.set(f,k.current),Dn.set(f,k.current),Nr.set(k.current,f)):Dn.delete(f);var{selection:V}=f,ne=ee.findDocumentOrShadowRoot(f),te=ne.getSelection();if(!(!te||!ee.isFocused(f)||(F=L.current)!==null&&F!==void 0&&F.hasPendingAction())){var ae=he=>{var ye=te.type!=="None";if(!(!V&&!ye)){var Ae=te.focusNode,Fe;if(Wn&&te.rangeCount>1){var He=te.getRangeAt(0),Se=te.getRangeAt(te.rangeCount-1);He.startContainer===Ae?Fe=Se.endContainer:Fe=He.startContainer}else Fe=te.anchorNode;var Te=va.get(f),Ne=!1;if(Te.contains(Fe)&&Te.contains(Ae)&&(Ne=!0),ye&&Ne&&V&&!he){var ke=ee.toSlateRange(f,te,{exactMatch:!0,suppressThrow:!0});if(ke&&K.equals(ke,V)){var Ue;if(!P.hasMarkPlaceholder||(Ue=Fe)!==null&&Ue!==void 0&&(Ue=Ue.parentElement)!==null&&Ue!==void 0&&Ue.hasAttribute("data-slate-mark-placeholder"))return}}if(V&&!ee.hasRange(f,V)){f.selection=ee.toSlateRange(f,te,{exactMatch:!1,suppressThrow:!0});return}P.isUpdatingSelection=!0;var pe=V&&ee.toDOMRange(f,V);return pe?(ee.isComposing(f)&&!ot?te.collapseToEnd():K.isBackward(V)?te.setBaseAndExtent(pe.endContainer,pe.endOffset,pe.startContainer,pe.startOffset):te.setBaseAndExtent(pe.startContainer,pe.startOffset,pe.endContainer,pe.endOffset),c(f,pe)):te.removeAllRanges(),pe}};te.rangeCount<=1&&ae();var le=((I=L.current)===null||I===void 0?void 0:I.isFlushing())==="action";if(!ot||!le){setTimeout(()=>{P.isUpdatingSelection=!1});return}var J=null,ge=requestAnimationFrame(()=>{if(le){var he=ye=>{try{var Ae=ee.toDOMNode(f,f);Ae.focus(),ae(ye)}catch{}};he(),J=setTimeout(()=>{he(!0),P.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(ge),J&&clearTimeout(J)}}});var A=D.useCallback(F=>{if(T(),!s&&ee.hasEditableTarget(f,F.target)&&!Yy(F,a)){var I;if(L.current)return L.current.handleDOMBeforeInput(F);E.flush(),z.flush();var{selection:M}=f,{inputType:V}=F,ne=F.dataTransfer||F.data||void 0,te=V==="insertCompositionText"||V==="deleteCompositionText";if(te&&ee.isComposing(f))return;var ae=!1;if(V==="insertText"&&M&&K.isCollapsed(M)&&F.data&&F.data.length===1&&/[a-z ]/i.test(F.data)&&M.anchor.offset!==0){var le,J;ae=!0,f.marks&&(ae=!1);var{anchor:ge}=M,[he,ye]=ee.toDOMPoint(f,ge),Ae=(le=he.parentElement)===null||le===void 0?void 0:le.closest("a"),Fe=ee.getWindow(f);if(ae&&Ae&&ee.hasDOMNode(f,Ae)){var He,Se=Fe==null?void 0:Fe.document.createTreeWalker(Ae,NodeFilter.SHOW_TEXT).lastChild();Se===he&&((He=Se.textContent)===null||He===void 0?void 0:He.length)===ye&&(ae=!1)}if(ae&&he.parentElement&&(Fe==null||(J=Fe.getComputedStyle(he.parentElement))===null||J===void 0?void 0:J.whiteSpace)==="pre"){var Te=b.above(f,{at:ge.path,match:ie=>de.isElement(ie)&&b.isBlock(f,ie)});Te&&oe.string(Te[0]).includes(" ")&&(ae=!1)}}if(!V.startsWith("delete")||V.startsWith("deleteBy")){var[Ne]=F.getTargetRanges();if(Ne){var ke=ee.toSlateRange(f,Ne,{exactMatch:!1,suppressThrow:!1});if(!M||!K.equals(M,ke)){ae=!1;var Ue=!te&&f.selection&&b.rangeRef(f,f.selection);X.select(f,ke),Ue&&xr.set(f,Ue)}}}if(te)return;if(ae||F.preventDefault(),M&&K.isExpanded(M)&&V.startsWith("delete")){var pe=V.endsWith("Backward")?"backward":"forward";b.deleteFragment(f,{direction:pe});return}switch(V){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{b.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{b.deleteForward(f);break}case"deleteContentBackward":{b.deleteBackward(f);break}case"deleteEntireSoftLine":{b.deleteBackward(f,{unit:"line"}),b.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{b.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{b.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{b.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{b.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{b.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{b.deleteForward(f,{unit:"word"});break}case"insertLineBreak":b.insertSoftBreak(f);break;case"insertParagraph":{b.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{V==="insertFromComposition"&&ee.isComposing(f)&&(v(!1),gn.set(f,!1)),(ne==null?void 0:ne.constructor.name)==="DataTransfer"?ee.insertData(f,ne):typeof ne=="string"&&(ae?B.current.push(()=>b.insertText(f,ne)):b.insertText(f,ne));break}}var U=(I=xr.get(f))===null||I===void 0?void 0:I.unref();xr.delete(f),U&&(!f.selection||!K.equals(f.selection,U))&&X.select(f,U)}},[f,z,T,a,s,E]),N=D.useCallback(F=>{F==null?(z.cancel(),E.cancel(),va.delete(f),Dn.delete(f),k.current&&Jt&&k.current.removeEventListener("beforeinput",A)):Jt&&F.addEventListener("beforeinput",A),k.current=F},[z,E,f,A]);Rr(()=>{var F=ee.getWindow(f);return F.document.addEventListener("selectionchange",E),()=>{F.document.removeEventListener("selectionchange",E)}},[E]);var R=r([f,[]]),H=i&&f.children.length===1&&Array.from(oe.texts(f)).length===1&&oe.string(f)===""&&!y,G=D.useCallback(F=>{if(F&&H){var I;w((I=F.getBoundingClientRect())===null||I===void 0?void 0:I.height)}else w(void 0)},[H]);if(H){var Q=b.start(f,[]);R.push({[Jn]:!0,placeholder:i,onPlaceholderResize:G,anchor:Q,focus:Q})}var{marks:re}=f;if(P.hasMarkPlaceholder=!1,f.selection&&K.isCollapsed(f.selection)&&re){var{anchor:x}=f.selection,$=oe.leaf(f,x.path),W=Qn($,Wy);if(!fe.equals($,re,{loose:!0})){P.hasMarkPlaceholder=!0;var _=Object.fromEntries(Object.keys(W).map(F=>[F,null]));R.push(jt(jt(jt({[Yd]:!0},_),re),{},{anchor:x,focus:x}))}}return D.useEffect(()=>{setTimeout(()=>{var{selection:F}=f;if(F){var{anchor:I}=F,M=oe.leaf(f,I.path);if(re&&!fe.equals(M,re,{loose:!0})){At.set(f,re);return}}At.delete(f)})}),D.createElement(of.Provider,{value:s},D.createElement(af.Provider,{value:r},D.createElement(zy,{node:k,receivedUserInput:S},D.createElement(p,jt(jt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Jt||!ga?g.spellCheck:!1,autoCorrect:Jt||!ga?g.autoCorrect:"false",autoCapitalize:Jt||!ga?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:N,style:jt(jt({},m?{}:jt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},C?{minHeight:C}:{})),h),onBeforeInput:D.useCallback(F=>{if(!Jt&&!s&&!it(F,g.onBeforeInput)&&ee.hasSelectableTarget(f,F.target)&&(F.preventDefault(),!ee.isComposing(f))){var I=F.data;b.insertText(f,I)}},[g.onBeforeInput,f,s]),onInput:D.useCallback(F=>{if(!it(F,g.onInput)){if(L.current){L.current.handleInput();return}for(var I of B.current)I();B.current=[]}},[g.onInput]),onBlur:D.useCallback(F=>{if(!(s||P.isUpdatingSelection||!ee.hasSelectableTarget(f,F.target)||it(F,g.onBlur))){var I=ee.findDocumentOrShadowRoot(f);if(P.latestElement!==I.activeElement){var{relatedTarget:M}=F,V=ee.toDOMNode(f,f);if(M!==V&&!(wt(M)&&M.hasAttribute("data-slate-spacer"))){if(M!=null&&sn(M)&&ee.hasDOMNode(f,M)){var ne=ee.toSlateNode(f,M);if(de.isElement(ne)&&!f.isVoid(ne))return}if(vr){var te=I.getSelection();te==null||te.removeAllRanges()}an.delete(f)}}}},[s,P.isUpdatingSelection,P.latestElement,f,g.onBlur]),onClick:D.useCallback(F=>{if(ee.hasTarget(f,F.target)&&!it(F,g.onClick)&&sn(F.target)){var I=ee.toSlateNode(f,F.target),M=ee.findPath(f,I);if(!b.hasPath(f,M)||oe.get(f,M)!==I)return;if(F.detail===Ny&&M.length>=1){var V=M;if(!(de.isElement(I)&&b.isBlock(f,I))){var ne,te=b.above(f,{match:Ae=>de.isElement(Ae)&&b.isBlock(f,Ae),at:M});V=(ne=te==null?void 0:te[1])!==null&&ne!==void 0?ne:M.slice(0,1)}var ae=b.range(f,V);X.select(f,ae);return}if(s)return;var le=b.start(f,M),J=b.end(f,M),ge=b.void(f,{at:le}),he=b.void(f,{at:J});if(ge&&he&&O.equals(ge[1],he[1])){var ye=b.range(f,le);X.select(f,ye)}}},[f,g.onClick,s]),onCompositionEnd:D.useCallback(F=>{if(ee.hasSelectableTarget(f,F.target)){var I;if(ee.isComposing(f)&&Promise.resolve().then(()=>{v(!1),gn.set(f,!1)}),(I=L.current)===null||I===void 0||I.handleCompositionEnd(F),it(F,g.onCompositionEnd)||ot)return;if(!vr&&!Ib&&!Pb&&!Lb&&!$b&&F.data){var M=At.get(f);At.delete(f),M!==void 0&&(Vt.set(f,f.marks),f.marks=M),b.insertText(f,F.data);var V=Vt.get(f);Vt.delete(f),V!==void 0&&(f.marks=V)}}},[g.onCompositionEnd,f]),onCompositionUpdate:D.useCallback(F=>{ee.hasSelectableTarget(f,F.target)&&!it(F,g.onCompositionUpdate)&&(ee.isComposing(f)||(v(!0),gn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:D.useCallback(F=>{if(ee.hasSelectableTarget(f,F.target)){var I;if((I=L.current)===null||I===void 0||I.handleCompositionStart(F),it(F,g.onCompositionStart)||ot)return;v(!0);var{selection:M}=f;if(M&&K.isExpanded(M)){b.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:D.useCallback(F=>{ee.hasSelectableTarget(f,F.target)&&!it(F,g.onCopy)&&!hl(F)&&(F.preventDefault(),ee.setFragmentData(f,F.clipboardData,"copy"))},[g.onCopy,f]),onCut:D.useCallback(F=>{if(!s&&ee.hasSelectableTarget(f,F.target)&&!it(F,g.onCut)&&!hl(F)){F.preventDefault(),ee.setFragmentData(f,F.clipboardData,"cut");var{selection:I}=f;if(I)if(K.isExpanded(I))b.deleteFragment(f);else{var M=oe.parent(f,I.anchor.path);b.isVoid(f,M)&&X.delete(f)}}},[s,f,g.onCut]),onDragOver:D.useCallback(F=>{if(ee.hasTarget(f,F.target)&&!it(F,g.onDragOver)){var I=ee.toSlateNode(f,F.target);de.isElement(I)&&b.isVoid(f,I)&&F.preventDefault()}},[g.onDragOver,f]),onDragStart:D.useCallback(F=>{if(!s&&ee.hasTarget(f,F.target)&&!it(F,g.onDragStart)){var I=ee.toSlateNode(f,F.target),M=ee.findPath(f,I),V=de.isElement(I)&&b.isVoid(f,I)||b.void(f,{at:M,voids:!0});if(V){var ne=b.range(f,M);X.select(f,ne)}P.isDraggingInternally=!0,ee.setFragmentData(f,F.dataTransfer,"drag")}},[s,f,g.onDragStart,P]),onDrop:D.useCallback(F=>{if(!s&&ee.hasTarget(f,F.target)&&!it(F,g.onDrop)){F.preventDefault();var I=f.selection,M=ee.findEventRange(f,F),V=F.dataTransfer;X.select(f,M),P.isDraggingInternally&&I&&!K.equals(I,M)&&!b.void(f,{at:M,voids:!0})&&X.delete(f,{at:I}),ee.insertData(f,V),ee.isFocused(f)||ee.focus(f)}P.isDraggingInternally=!1},[s,f,g.onDrop,P]),onDragEnd:D.useCallback(F=>{!s&&P.isDraggingInternally&&g.onDragEnd&&ee.hasTarget(f,F.target)&&g.onDragEnd(F),P.isDraggingInternally=!1},[s,P,g,f]),onFocus:D.useCallback(F=>{if(!s&&!P.isUpdatingSelection&&ee.hasEditableTarget(f,F.target)&&!it(F,g.onFocus)){var I=ee.toDOMNode(f,f),M=ee.findDocumentOrShadowRoot(f);if(P.latestElement=M.activeElement,Wn&&F.target!==I){I.focus();return}an.set(f,!0)}},[s,P,f,g.onFocus]),onKeyDown:D.useCallback(F=>{if(!s&&ee.hasEditableTarget(f,F.target)){var I;(I=L.current)===null||I===void 0||I.handleKeyDown(F);var{nativeEvent:M}=F;if(ee.isComposing(f)&&M.isComposing===!1&&(gn.set(f,!1),v(!1)),it(F,g.onKeyDown)||ee.isComposing(f))return;var{selection:V}=f,ne=f.children[V!==null?V.focus.path[0]:0],te=Td(oe.string(ne))==="rtl";if(Ve.isRedo(M)){F.preventDefault();var ae=f;typeof ae.redo=="function"&&ae.redo();return}if(Ve.isUndo(M)){F.preventDefault();var le=f;typeof le.undo=="function"&&le.undo();return}if(Ve.isMoveLineBackward(M)){F.preventDefault(),X.move(f,{unit:"line",reverse:!0});return}if(Ve.isMoveLineForward(M)){F.preventDefault(),X.move(f,{unit:"line"});return}if(Ve.isExtendLineBackward(M)){F.preventDefault(),X.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(Ve.isExtendLineForward(M)){F.preventDefault(),X.move(f,{unit:"line",edge:"focus"});return}if(Ve.isMoveBackward(M)){F.preventDefault(),V&&K.isCollapsed(V)?X.move(f,{reverse:!te}):X.collapse(f,{edge:te?"end":"start"});return}if(Ve.isMoveForward(M)){F.preventDefault(),V&&K.isCollapsed(V)?X.move(f,{reverse:te}):X.collapse(f,{edge:te?"start":"end"});return}if(Ve.isMoveWordBackward(M)){F.preventDefault(),V&&K.isExpanded(V)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:!te});return}if(Ve.isMoveWordForward(M)){F.preventDefault(),V&&K.isExpanded(V)&&X.collapse(f,{edge:"focus"}),X.move(f,{unit:"word",reverse:te});return}if(Jt){if((Vd||vr)&&V&&(Ve.isDeleteBackward(M)||Ve.isDeleteForward(M))&&K.isCollapsed(V)){var J=oe.parent(f,V.anchor.path);if(de.isElement(J)&&b.isVoid(f,J)&&(b.isInline(f,J)||b.isBlock(f,J))){F.preventDefault(),b.deleteBackward(f,{unit:"block"});return}}}else{if(Ve.isBold(M)||Ve.isItalic(M)||Ve.isTransposeCharacter(M)){F.preventDefault();return}if(Ve.isSoftBreak(M)){F.preventDefault(),b.insertSoftBreak(f);return}if(Ve.isSplitBlock(M)){F.preventDefault(),b.insertBreak(f);return}if(Ve.isDeleteBackward(M)){F.preventDefault(),V&&K.isExpanded(V)?b.deleteFragment(f,{direction:"backward"}):b.deleteBackward(f);return}if(Ve.isDeleteForward(M)){F.preventDefault(),V&&K.isExpanded(V)?b.deleteFragment(f,{direction:"forward"}):b.deleteForward(f);return}if(Ve.isDeleteLineBackward(M)){F.preventDefault(),V&&K.isExpanded(V)?b.deleteFragment(f,{direction:"backward"}):b.deleteBackward(f,{unit:"line"});return}if(Ve.isDeleteLineForward(M)){F.preventDefault(),V&&K.isExpanded(V)?b.deleteFragment(f,{direction:"forward"}):b.deleteForward(f,{unit:"line"});return}if(Ve.isDeleteWordBackward(M)){F.preventDefault(),V&&K.isExpanded(V)?b.deleteFragment(f,{direction:"backward"}):b.deleteBackward(f,{unit:"word"});return}if(Ve.isDeleteWordForward(M)){F.preventDefault(),V&&K.isExpanded(V)?b.deleteFragment(f,{direction:"forward"}):b.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:D.useCallback(F=>{!s&&ee.hasEditableTarget(f,F.target)&&!it(F,g.onPaste)&&(!Jt||Wb(F.nativeEvent)||vr)&&(F.preventDefault(),ee.insertData(f,F.clipboardData))},[s,f,g.onPaste])}),D.createElement(Hy,{decorations:R,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},Vy=e=>{var{attributes:t,children:n}=e;return D.createElement("span",jt({},t),n,ot&&D.createElement("br",null))},Ky=()=>[],Zy=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&K.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),ib(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},it=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},hl=e=>sn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),Yy=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},Gy=D.createContext(!1),Qy=D.createContext({});function Jy(e){var t=D.useRef([]).current,n=D.useRef({editor:e}).current,r=D.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=D.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var Xy=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],e1=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Qn(e,Xy),[l,u]=D.useState(()=>{if(!oe.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Xe.stringify(s)));if(!b.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Xe.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:c,onChange:h}=Jy(t),p=D.useCallback(f=>{var y;switch(r&&r(t.children),f==null||(y=f.operation)===null||y===void 0?void 0:y.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(v=>({v:v.v+1,editor:t})),h(t)},[t,h,r,a,i]);D.useEffect(()=>(ws.set(t,p),()=>{ws.set(t,()=>{})}),[t,p]);var[m,g]=D.useState(ee.isFocused(t));return D.useEffect(()=>{g(ee.isFocused(t))},[t]),Rr(()=>{var f=()=>g(ee.isFocused(t));return Ud>=17?(document.addEventListener("focusin",f),document.addEventListener("focusout",f),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",f)}):(document.addEventListener("focus",f,!0),document.addEventListener("blur",f,!0),()=>{document.removeEventListener("focus",f,!0),document.removeEventListener("blur",f,!0)})},[]),D.createElement(Qy.Provider,{value:c},D.createElement(uf.Provider,{value:l},D.createElement(lo.Provider,{value:l.editor},D.createElement(Gy.Provider,{value:m},n))))},ml=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},pl=(e,t,n)=>{var r=ee.toDOMRange(e,t).getBoundingClientRect(),a=ee.toDOMRange(e,n).getBoundingClientRect();return ml(r,a)&&ml(a,r)},t1=(e,t)=>{var n=b.range(e,K.end(t)),r=Array.from(b.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(pl(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;)pl(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 gl(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 vl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?gl(Object(n),!0).forEach(function(r){Et(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var n1=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",r=t,{apply:a,onChange:i,deleteBackward:s,addMark:o,removeMark:l}=r;return ti.set(r,new WeakMap),r.addMark=(u,c)=>{var h,p;(h=ho.get(r))===null||h===void 0||h(),!At.get(r)&&(p=ct.get(r))!==null&&p!==void 0&&p.length&&At.set(r,null),Vt.delete(r),o(u,c)},r.removeMark=u=>{var c;!At.get(r)&&(c=ct.get(r))!==null&&c!==void 0&&c.length&&At.set(r,null),Vt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&K.isCollapsed(r.selection)){var c=b.above(r,{match:g=>de.isElement(g)&&b.isBlock(r,g),at:r.selection});if(c){var[,h]=c,p=b.range(r,h,r.selection.anchor),m=t1(r,p);K.isCollapsed(m)||X.delete(r,{at:m})}}},r.apply=u=>{var c=[],h=[],p=ct.get(r);if(p!=null&&p.length){var m=p.map(N=>ny(N,u)).filter(Boolean);ct.set(r,m)}var g=tn.get(r);g&&tn.set(r,al(r,g,u));var f=en.get(r);if(f!=null&&f.at){var y=Ee.isPoint(f==null?void 0:f.at)?_s(r,f.at,u):al(r,f.at,u);en.set(r,y?vl(vl({},f),{},{at:y}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...Rn(r,u.path));break}case"set_selection":{var v;(v=xr.get(r))===null||v===void 0||v.unref(),xr.delete(r);break}case"insert_node":case"remove_node":{c.push(...Rn(r,O.parent(u.path)));break}case"merge_node":{var k=O.previous(u.path);c.push(...Rn(r,k));break}case"move_node":{var B=O.common(O.parent(u.path),O.parent(u.newPath));c.push(...Rn(r,B));var C;O.isBefore(u.path,u.newPath)?(c.push(...Rn(r,O.parent(u.path))),C=u.newPath):(c.push(...Rn(r,O.parent(u.newPath))),C=u.path);var w=oe.get(t,O.parent(C)),T=ee.findKey(r,w),S=b.pathRef(r,O.parent(C));h.push([S,T]);break}}a(u);for(var[q,P]of c){var[L]=b.node(r,q);Fa.set(L,P)}for(var[z,E]of h)if(z.current){var[A]=b.node(r,z.current);Fa.set(A,E)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[h,p]=K.edges(c),m=b.void(r,{at:h.path}),g=b.void(r,{at:p.path});if(!(K.isCollapsed(c)&&!m)){var f=ee.toDOMRange(r,c),y=f.cloneContents(),v=y.childNodes[0];if(y.childNodes.forEach(L=>{L.textContent&&L.textContent.trim()!==""&&(v=L)}),g){var[k]=g,B=f.cloneRange(),C=ee.toDOMNode(r,k);B.setEndAfter(C),y=B.cloneContents()}if(m&&(v=y.querySelector("[data-slate-spacer]")),Array.from(y.querySelectorAll("[data-slate-zero-width]")).forEach(L=>{var z=L.getAttribute("data-slate-zero-width")==="n";L.textContent=z?`
|
|
114
|
+
`:""}),Gd(v)){var w=v.ownerDocument.createElement("span");w.style.whiteSpace="pre",w.appendChild(v),y.appendChild(w),v=w}var T=r.getFragment(),S=JSON.stringify(T),q=window.btoa(encodeURIComponent(S));v.setAttribute("data-slate-fragment",q),u.setData("application/".concat(n),q);var P=y.ownerDocument.createElement("div");return P.appendChild(y),P.setAttribute("hidden","true"),y.ownerDocument.body.appendChild(P),u.setData("text/html",P.innerHTML),u.setData("text/plain",Jd(P)),y.ownerDocument.body.removeChild(P),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||Zb(u);if(c){var h=decodeURIComponent(window.atob(c)),p=JSON.parse(h);return r.insertFragment(p),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var h=c.split(/\r\n|\r|\n/),p=!1;for(var m of h)p&&X.splitNodes(r,{always:!0}),r.insertText(m),p=!0;return!0}return!1},r.onChange=u=>{var c=Ud<18?xc.unstable_batchedUpdates:h=>h();c(()=>{var h=ws.get(r);h&&h(u),i(u)})},r},Rn=(e,t)=>{var n=[];for(var[r,a]of b.levels(e,{at:t})){var i=ee.findKey(e,r);n.push([a,i])}return n};const r1={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,isInOverlay:!1,dispatch:()=>{},onMention:()=>{},reportError:e=>{console.error(e)}},Qt=D.createContext(r1);var Z=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.mention="mention",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e))(Z||{}),Nt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Nt||{});const a1=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case Z.blockquote:return d.jsx("blockquote",{className:"subtle",...e,children:t});case Z.link:return d.jsx("a",{...e,children:t});case Z.li:return d.jsx("li",{...e,children:t});case Z.mention:const a=r;return d.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case Z.ol:return d.jsx("ol",{...e,children:t});case Z.ul:return d.jsx("ul",{...e,children:t});case Z.span:return d.jsx("span",{...e,children:t});case Z.paragraph:return d.jsx("p",{...e,children:t});default:return d.jsx("span",{...e,children:t})}},i1=({attributes:e,children:t,leaf:n})=>{const r=n;return r[Z.bold]&&(t=d.jsx("strong",{children:t})),r[Z.italic]&&(t=d.jsx("em",{children:t})),r[Z.strikethrough]&&(t=d.jsx("s",{children:t})),d.jsx("span",{...e,children:t})},As="MENTION: ",cf={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},bl={"mention-popover":35,default:-52},Ai=16,df=(e,t,n)=>{const r=D.useRef(null),{showLinkEditor:a,mentionPopover:i}=D.useContext(Qt),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),D.useEffect(()=>{var m,g;if(!(r!=null&&r.current)||!s)return;const l=r==null?void 0:r.current;if(!l)return;let u,c=0;if(t==="mention-popover"){const{position:f}=i,y=B=>{if(!b.hasPath(e,B.path))return!1;const C=oe.get(e,B.path);return b.isEditor(C)||de.isElement(C)?B.offset<=C.children.length:fe.isText(C)?B.offset<=C.text.length:!1};if(f&&(!y(f==null?void 0:f.anchor)||!y(f==null?void 0:f.focus)))return;u=ee.toDOMRange(e,f||cf).getBoundingClientRect();const k=(m=document.getElementById(n))==null?void 0:m.getBoundingClientRect();l.style.setProperty("--width",`${((k==null?void 0:k.width)||0)/Ai}rem`),c=(k==null?void 0:k.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(u=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}u||(u=(g=document.getElementById(n))==null?void 0:g.getBoundingClientRect());const h=bl[t]||bl.default,p=((u==null?void 0:u.top)||0)+window.scrollY+h;c===0&&(c=Math.max(((u==null?void 0:u.left)||0)-(l.offsetWidth-((u==null?void 0:u.width)||0)),0)),l.style.top=`${p/Ai}rem`,l.style.left=`${c/Ai}rem`},o),r},s1=e=>{const[t,n]=D.useState(null);return D.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=b.nodes(e,{at:r,match:i=>i.type===Z.link});if(a){const i=a[0],s=Lc(i.link),o=i.children[0],l=(o==null?void 0:o.text)||"";n({...s,text:l})}else n(null)},[e,e.selection]),t};var st=(e=>(e.paragraph="paragraph",e.heading="heading",e.list="list",e.listItem="listItem",e.link="link",e.mention="mention",e.image="image",e.blockquote="blockquote",e.code="code",e.html="html",e.emphasis="emphasis",e.strong="strong",e.delete="delete",e.inlineCode="inlineCode",e.thematicBreak="thematicBreak",e.text="text",e))(st||{});const Hn={[Z.paragraph]:Z.paragraph,[Z.blockquote]:Z.blockquote,[Z.codeblock]:Z.codeblock,[Z.link]:Z.link,[Z.ul]:Z.ul,[Z.ol]:Z.ol,[Z.li]:Z.li,[Z.mention]:Z.mention,[Z.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Nt.emphasis]:Z.italic,[Nt.strong]:Z.bold,[Nt.delete]:Z.strikethrough,[Nt.code]:Z.code,[Z.hr]:Z.hr,[Z.image]:Z.image};function yl(e){if(e)throw e}var ba=Object.prototype.hasOwnProperty,ff=Object.prototype.toString,Dl=Object.defineProperty,xl=Object.getOwnPropertyDescriptor,Cl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):ff.call(t)==="[object Array]"},wl=function(t){if(!t||ff.call(t)!=="[object Object]")return!1;var n=ba.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&ba.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||ba.call(t,a)},El=function(t,n){Dl&&n.name==="__proto__"?Dl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},kl=function(t,n){if(n==="__proto__")if(ba.call(t,n)){if(xl)return xl(t,n).value}else return;return t[n]},o1=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=kl(o,n),a=kl(t,n),o!==a&&(c&&a&&(wl(a)||(i=Cl(a)))?(i?(i=!1,s=r&&Cl(r)?r:[]):s=r&&wl(r)?r:{},El(o,{name:n,newValue:e(c,s,a)})):typeof a<"u"&&El(o,{name:n,newValue:a}));return o};const Fi=Bn(o1);function Fs(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 u1(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const c=e[++i];let h=-1;if(l){s(l);return}for(;++h<a.length;)(u[h]===null||u[h]===void 0)&&(u[h]=a[h]);a=u,c?l1(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 l1(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 Cr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?_l(e.position):"start"in e||"end"in e?_l(e):"line"in e||"column"in e?Ts(e):""}function Ts(e){return Bl(e&&e.line)+":"+Bl(e&&e.column)}function _l(e){return Ts(e&&e.start)+"-"+Ts(e&&e.end)}function Bl(e){return e&&typeof e=="number"?e:1}class ht extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?a=t:!i.cause&&t&&(s=!0,a=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=o?o.line:void 0,this.name=Cr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}ht.prototype.file="";ht.prototype.name="";ht.prototype.reason="";ht.prototype.message="";ht.prototype.stack="";ht.prototype.column=void 0;ht.prototype.line=void 0;ht.prototype.ancestors=void 0;ht.prototype.cause=void 0;ht.prototype.fatal=void 0;ht.prototype.place=void 0;ht.prototype.ruleId=void 0;ht.prototype.source=void 0;const Ot={basename:c1,dirname:d1,extname:f1,join:h1,sep:"/"};function c1(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Lr(e);let n=0,r=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else r<0&&(i=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function d1(e){if(Lr(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function f1(e){Lr(e);let t=e.length,n=-1,r=0,a=-1,i=0,s;for(;t--;){const o=e.codePointAt(t);if(o===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),o===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function h1(...e){let t=-1,n;for(;++t<e.length;)Lr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":m1(n)}function m1(e){Lr(e);const t=e.codePointAt(0)===47;let n=p1(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function p1(e,t){let n="",r=0,a=-1,i=0,s=-1,o,l;for(;++s<=e.length;){if(s<e.length)o=e.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(a===s-1||i===1))if(a!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),a=s,i=0;continue}}else if(n.length>0){n="",r=0,a=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,s):n=e.slice(a+1,s),r=s-a-1;a=s,i=0}else o===46&&i>-1?i++:i=-1}return n}function Lr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const g1={cwd:v1};function v1(){return"/"}function Ss(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function b1(e){if(typeof e=="string")e=new URL(e);else if(!Ss(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return y1(e)}function y1(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Ti=["history","path","basename","stem","extname","dirname"];class D1{constructor(t){let n;t?Ss(t)?n={path:t}:typeof t=="string"||x1(t)?n={value:t}:n=t:n={},this.cwd=g1.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ti.length;){const i=Ti[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let a;for(a in n)Ti.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?Ot.basename(this.path):void 0}set basename(t){ji(t,"basename"),Si(t,"basename"),this.path=Ot.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ot.dirname(this.path):void 0}set dirname(t){Al(this.basename,"dirname"),this.path=Ot.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ot.extname(this.path):void 0}set extname(t){if(Si(t,"extname"),Al(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ot.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ss(t)&&(t=b1(t)),ji(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ot.basename(this.path,this.extname):void 0}set stem(t){ji(t,"stem"),Si(t,"stem"),this.path=Ot.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new ht(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Si(e,t){if(e&&e.includes(Ot.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ot.sep+"`")}function ji(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Al(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function x1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const C1=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},w1={}.hasOwnProperty;class go extends C1{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=u1()}copy(){const t=new go;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Fi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ni("data",this.frozen),this.namespace[t]=n,this):w1.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ni("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=ra(t),r=this.parser||this.Parser;return Oi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Oi("process",this.parser||this.Parser),Pi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=ra(t),l=r.parse(o);r.run(l,o,function(c,h,p){if(c||!h||!p)return u(c);const m=h,g=r.stringify(m,p);_1(g)?p.value=g:p.result=g,u(c,p)});function u(c,h){c||!h?s(c):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Oi("processSync",this.parser||this.Parser),Pi("processSync",this.compiler||this.Compiler),this.process(t,a),Tl("processSync","process",n),r;function a(i,s){n=!0,yl(i),r=s}}run(t,n,r){Fl(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,o){const l=ra(n);a.run(t,l,u);function u(c,h,p){const m=h||t;c?o(c):s?s(m):r(void 0,m,p)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),Tl("runSync","run",r),a;function i(s,o){yl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=ra(n),a=this.compiler||this.Compiler;return Pi("stringify",a),Fl(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Ni("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...h]=u;l(c,h)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(a.settings=Fi(!0,a.settings,u.settings))}function o(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const h=u[c];i(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let h=-1,p=-1;for(;++h<r.length;)if(r[h][0]===u){p=h;break}if(p===-1)r.push([u,...c]);else if(c.length>0){let[m,...g]=c;const f=r[p][1];Fs(f)&&Fs(m)&&(m=Fi(!0,f,m)),r[p]=[u,m,...g]}}}}const E1=new go().freeze();function Oi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Pi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ni(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Fl(e){if(!Fs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Tl(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ra(e){return k1(e)?e:new D1(e)}function k1(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function _1(e){return typeof e=="string"||B1(e)}function B1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const A1={};function F1(e,t){const n=t||A1,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return hf(e,r,a)}function hf(e,t,n){if(T1(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 Sl(e.children,t,n)}return Array.isArray(e)?Sl(e,t,n):""}function Sl(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=hf(e[a],t,n);return r.join("")}function T1(e){return!!(e&&typeof e=="object")}const jl=document.createElement("i");function vo(e){const t="&"+e+";";jl.innerHTML=t;const n=jl.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function $t(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function Ct(e,t){return e.length>0?($t(e,e.length,0,t),e):t}const Ol={}.hasOwnProperty;function S1(e){const t={};let n=-1;for(;++n<e.length;)j1(t,e[n]);return t}function j1(e,t){let n;for(n in t){const a=(Ol.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){Ol.call(a,s)||(a[s]=[]);const o=i[s];O1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function O1(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);$t(e,0,0,r)}function mf(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Kn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Pt=cn(/[A-Za-z]/),Ft=cn(/[\dA-Za-z]/),P1=cn(/[#-'*+\--9=?A-Z^-~]/);function js(e){return e!==null&&(e<32||e===127)}const Os=cn(/\d/),N1=cn(/[\dA-Fa-f]/),R1=cn(/[!-/:-@[-`{-~]/);function De(e){return e!==null&&e<-2}function ft(e){return e!==null&&(e<0||e===32)}function Pe(e){return e===-2||e===-1||e===32}const M1=cn(/\p{P}|\p{S}/u),I1=cn(/\s/);function cn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ze(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Pe(l)?(e.enter(n),o(l)):t(l)}function o(l){return Pe(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const $1={tokenize:L1};function L1(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),ze(e,t,"linePrefix")}function a(o){return e.enter("paragraph"),i(o)}function i(o){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(o)}function s(o){if(o===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(o);return}return De(o)?(e.consume(o),e.exit("chunkText"),i):(e.consume(o),s)}}const z1={tokenize:q1},Pl={tokenize:W1};function q1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(B){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,l,u)(B)}return u(B)}function l(B){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&k();const C=t.events.length;let w=C,T;for(;w--;)if(t.events[w][0]==="exit"&&t.events[w][1].type==="chunkFlow"){T=t.events[w][1].end;break}v(r);let S=C;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},T),S++;return $t(t.events,w+1,0,t.events.slice(C)),t.events.length=S,u(B)}return o(B)}function u(B){if(r===n.length){if(!a)return p(B);if(a.currentConstruct&&a.currentConstruct.concrete)return g(B);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Pl,c,h)(B)}function c(B){return a&&k(),v(r),p(B)}function h(B){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(B)}function p(B){return t.containerState={},e.attempt(Pl,m,g)(B)}function m(B){return r++,n.push([t.currentConstruct,t.containerState]),p(B)}function g(B){if(B===null){a&&k(),v(0),e.consume(B);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(B)}function f(B){if(B===null){y(e.exit("chunkFlow"),!0),v(0),e.consume(B);return}return De(B)?(e.consume(B),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(B),f)}function y(B,C){const w=t.sliceStream(B);if(C&&w.push(null),B.previous=i,i&&(i.next=B),i=B,a.defineSkip(B.start),a.write(w),t.parser.lazy[B.start.line]){let T=a.events.length;for(;T--;)if(a.events[T][1].start.offset<s&&(!a.events[T][1].end||a.events[T][1].end.offset>s))return;const S=t.events.length;let q=S,P,L;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){if(P){L=t.events[q][1].end;break}P=!0}for(v(r),T=S;T<t.events.length;)t.events[T][1].end=Object.assign({},L),T++;$t(t.events,q+1,0,t.events.slice(S)),t.events.length=T}}function v(B){let C=n.length;for(;C-- >B;){const w=n[C];t.containerState=w[1],w[0].exit.call(t,e)}n.length=B}function k(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function W1(e,t,n){return ze(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Nl(e){if(e===null||ft(e)||I1(e))return 1;if(M1(e))return 2}function bo(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Ps={name:"attention",tokenize:U1,resolveAll:H1};function H1(e,t){let n=-1,r,a,i,s,o,l,u,c;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h=Object.assign({},e[r][1].end),p=Object.assign({},e[n][1].start);Rl(h,-l),Rl(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:h,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:p},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Ct(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Ct(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Ct(u,bo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Ct(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=Ct(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,$t(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function U1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Nl(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=Nl(l),h=!c||c===2&&a||n.includes(l),p=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?h:h&&(a||!p)),u._close=!!(i===42?p:p&&(c||!h)),t(l)}}function Rl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const V1={name:"autolink",tokenize:K1};function K1(e,t,n){let r=0;return a;function a(m){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(m){return Pt(m)?(e.consume(m),s):u(m)}function s(m){return m===43||m===45||m===46||Ft(m)?(r=1,o(m)):u(m)}function o(m){return m===58?(e.consume(m),r=0,l):(m===43||m===45||m===46||Ft(m))&&r++<32?(e.consume(m),o):(r=0,u(m))}function l(m){return m===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):m===null||m===32||m===60||js(m)?n(m):(e.consume(m),l)}function u(m){return m===64?(e.consume(m),c):P1(m)?(e.consume(m),u):n(m)}function c(m){return Ft(m)?h(m):n(m)}function h(m){return m===46?(e.consume(m),r=0,c):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):p(m)}function p(m){if((m===45||Ft(m))&&r++<63){const g=m===45?p:h;return e.consume(m),g}return n(m)}}const ni={tokenize:Z1,partial:!0};function Z1(e,t,n){return r;function r(i){return Pe(i)?ze(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||De(i)?t(i):n(i)}}const pf={name:"blockQuote",tokenize:Y1,continuation:{tokenize:G1},exit:Q1};function Y1(e,t,n){const r=this;return a;function a(s){if(s===62){const o=r.containerState;return o.open||(e.enter("blockQuote",{_container:!0}),o.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return Pe(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function G1(e,t,n){const r=this;return a;function a(s){return Pe(s)?ze(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(pf,t,n)(s)}}function Q1(e){e.exit("blockQuote")}const gf={name:"characterEscape",tokenize:J1};function J1(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 R1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const vf={name:"characterReference",tokenize:X1};function X1(e,t,n){const r=this;let a=0,i,s;return o;function o(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),l}function l(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=Ft,c(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=N1,c):(e.enter("characterReferenceValue"),i=7,s=Os,c(h))}function c(h){if(h===59&&a){const p=e.exit("characterReferenceValue");return s===Ft&&!vo(r.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&a++<i?(e.consume(h),c):n(h)}}const Ml={tokenize:tD,partial:!0},Il={name:"codeFenced",tokenize:eD,concrete:!0};function eD(e,t,n){const r=this,a={tokenize:w,partial:!0};let i=0,s=0,o;return l;function l(T){return u(T)}function u(T){const S=r.events[r.events.length-1];return i=S&&S[1].type==="linePrefix"?S[2].sliceSerialize(S[1],!0).length:0,o=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),c(T)}function c(T){return T===o?(s++,e.consume(T),c):s<3?n(T):(e.exit("codeFencedFenceSequence"),Pe(T)?ze(e,h,"whitespace")(T):h(T))}function h(T){return T===null||De(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(Ml,f,C)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(T))}function p(T){return T===null||De(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(T)):Pe(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ze(e,m,"whitespace")(T)):T===96&&T===o?n(T):(e.consume(T),p)}function m(T){return T===null||De(T)?h(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||De(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(T)):T===96&&T===o?n(T):(e.consume(T),g)}function f(T){return e.attempt(a,C,y)(T)}function y(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),v}function v(T){return i>0&&Pe(T)?ze(e,k,"linePrefix",i+1)(T):k(T)}function k(T){return T===null||De(T)?e.check(Ml,f,C)(T):(e.enter("codeFlowValue"),B(T))}function B(T){return T===null||De(T)?(e.exit("codeFlowValue"),k(T)):(e.consume(T),B)}function C(T){return e.exit("codeFenced"),t(T)}function w(T,S,q){let P=0;return L;function L(R){return T.enter("lineEnding"),T.consume(R),T.exit("lineEnding"),z}function z(R){return T.enter("codeFencedFence"),Pe(R)?ze(T,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):E(R)}function E(R){return R===o?(T.enter("codeFencedFenceSequence"),A(R)):q(R)}function A(R){return R===o?(P++,T.consume(R),A):P>=s?(T.exit("codeFencedFenceSequence"),Pe(R)?ze(T,N,"whitespace")(R):N(R)):q(R)}function N(R){return R===null||De(R)?(T.exit("codeFencedFence"),S(R)):q(R)}}}function tD(e,t,n){const r=this;return a;function a(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const Ri={name:"codeIndented",tokenize:rD},nD={tokenize:aD,partial:!0};function rD(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),ze(e,i,"linePrefix",4+1)(u)}function i(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):De(u)?e.attempt(nD,s,l)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||De(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),o)}function l(u){return e.exit("codeIndented"),t(u)}}function aD(e,t,n){const r=this;return a;function a(s){return r.parser.lazy[r.now().line]?n(s):De(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),a):ze(e,i,"linePrefix",4+1)(s)}function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):De(s)?a(s):n(s)}}const iD={name:"codeText",tokenize:uD,resolve:sD,previous:oD};function sD(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 oD(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function uD(e,t,n){let r=0,a,i;return s;function s(h){return e.enter("codeText"),e.enter("codeTextSequence"),o(h)}function o(h){return h===96?(e.consume(h),r++,o):(e.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),l):h===96?(i=e.enter("codeTextSequence"),a=0,c(h)):De(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||De(h)?(e.exit("codeTextData"),l(h)):(e.consume(h),u)}function c(h){return h===96?(e.consume(h),a++,c):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",u(h))}}function bf(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,lD(e,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,a=void 0;i--&&(s=e[i],s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(a&&(e[a][1].type="lineEndingBlank"),s[1].type="lineEnding",a=i);a&&(r[1].end=Object.assign({},e[a][1].start),o=e.slice(a,n),o.unshift(r),$t(e,a,n-a+1,o))}}return!u}function lD(e,t){const n=e[t][1],r=e[t][2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let c,h,p=-1,m=n,g=0,f=0;const y=[f];for(;m;){for(;e[++a][1]!==m;);i.push(a),m._tokenizer||(c=r.sliceStream(m),m.next||c.push(null),h&&s.defineSkip(m.start),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),m._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),h=m,m=m.next}for(m=n;++p<o.length;)o[p][0]==="exit"&&o[p-1][0]==="enter"&&o[p][1].type===o[p-1][1].type&&o[p][1].start.line!==o[p][1].end.line&&(f=p+1,y.push(f),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(s.events=[],m?(m._tokenizer=void 0,m.previous=void 0):y.pop(),p=y.length;p--;){const v=o.slice(y[p],y[p+1]),k=i.pop();l.unshift([k,k+v.length-1]),$t(e,k,2,v)}for(p=-1;++p<l.length;)u[g+l[p][0]]=g+l[p][1],g+=l[p][1]-l[p][0]-1;return u}const cD={tokenize:hD,resolve:fD},dD={tokenize:mD,partial:!0};function fD(e){return bf(e),e}function hD(e,t){let n;return r;function r(o){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(o)}function a(o){return o===null?i(o):De(o)?e.check(dD,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 mD(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ze(e,i,"linePrefix")}function i(s){if(s===null||De(s))return n(s);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function yf(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return h;function h(v){return v===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(v),e.exit(i),p):v===null||v===32||v===41||js(v)?n(v):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(v))}function p(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),m(v))}function m(v){return v===62?(e.exit("chunkString"),e.exit(o),p(v)):v===null||v===60||De(v)?n(v):(e.consume(v),v===92?g:m)}function g(v){return v===60||v===62||v===92?(e.consume(v),m):m(v)}function f(v){return!c&&(v===null||v===41||ft(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):c<u&&v===40?(e.consume(v),c++,f):v===41?(e.consume(v),c--,f):v===null||v===32||v===40||js(v)?n(v):(e.consume(v),v===92?y:f)}function y(v){return v===40||v===41||v===92?(e.consume(v),f):f(v)}}function Df(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(m){return e.enter(r),e.enter(a),e.consume(m),e.exit(a),e.enter(i),c}function c(m){return o>999||m===null||m===91||m===93&&!l||m===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(m):m===93?(e.exit(i),e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):De(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||De(m)||o++>999?(e.exit("chunkString"),c(m)):(e.consume(m),l||(l=!Pe(m)),m===92?p:h)}function p(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}}function xf(e,t,n,r,a,i){let s;return o;function o(p){return p===34||p===39||p===40?(e.enter(r),e.enter(a),e.consume(p),e.exit(a),s=p===40?41:p,l):n(p)}function l(p){return p===s?(e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===s?(e.exit(i),l(s)):p===null?n(p):De(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),ze(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===s||p===null||De(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:c)}function h(p){return p===s||p===92?(e.consume(p),c):c(p)}}function wr(e,t){let n;return r;function r(a){return De(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Pe(a)?ze(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const pD={name:"definition",tokenize:vD},gD={tokenize:bD,partial:!0};function vD(e,t,n){const r=this;let a;return i;function i(m){return e.enter("definition"),s(m)}function s(m){return Df.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function o(m){return a=Kn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),l):n(m)}function l(m){return ft(m)?wr(e,u)(m):u(m)}function u(m){return yf(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function c(m){return e.attempt(gD,h,h)(m)}function h(m){return Pe(m)?ze(e,p,"whitespace")(m):p(m)}function p(m){return m===null||De(m)?(e.exit("definition"),r.parser.defined.push(a),t(m)):n(m)}}function bD(e,t,n){return r;function r(o){return ft(o)?wr(e,a)(o):n(o)}function a(o){return xf(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Pe(o)?ze(e,s,"whitespace")(o):s(o)}function s(o){return o===null||De(o)?t(o):n(o)}}const yD={name:"hardBreakEscape",tokenize:DD};function DD(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),a}function a(i){return De(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const xD={name:"headingAtx",tokenize:wD,resolve:CD};function CD(e,t){let n=e.length-2,r=3,a,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},$t(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function wD(e,t,n){let r=0;return a;function a(c){return e.enter("atxHeading"),i(c)}function i(c){return e.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(e.consume(c),s):c===null||ft(c)?(e.exit("atxHeadingSequence"),o(c)):n(c)}function o(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||De(c)?(e.exit("atxHeading"),t(c)):Pe(c)?ze(e,o,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),o(c))}function u(c){return c===null||c===35||ft(c)?(e.exit("atxHeadingText"),o(c)):(e.consume(c),u)}}const ED=["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"],$l=["pre","script","style","textarea"],kD={name:"htmlFlow",tokenize:FD,resolveTo:AD,concrete:!0},_D={tokenize:SD,partial:!0},BD={tokenize:TD,partial:!0};function AD(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 FD(e,t,n){const r=this;let a,i,s,o,l;return u;function u(_){return c(_)}function c(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),h}function h(_){return _===33?(e.consume(_),p):_===47?(e.consume(_),i=!0,f):_===63?(e.consume(_),a=3,r.interrupt?t:x):Pt(_)?(e.consume(_),s=String.fromCharCode(_),y):n(_)}function p(_){return _===45?(e.consume(_),a=2,m):_===91?(e.consume(_),a=5,o=0,g):Pt(_)?(e.consume(_),a=4,r.interrupt?t:x):n(_)}function m(_){return _===45?(e.consume(_),r.interrupt?t:x):n(_)}function g(_){const F="CDATA[";return _===F.charCodeAt(o++)?(e.consume(_),o===F.length?r.interrupt?t:E:g):n(_)}function f(_){return Pt(_)?(e.consume(_),s=String.fromCharCode(_),y):n(_)}function y(_){if(_===null||_===47||_===62||ft(_)){const F=_===47,I=s.toLowerCase();return!F&&!i&&$l.includes(I)?(a=1,r.interrupt?t(_):E(_)):ED.includes(s.toLowerCase())?(a=6,F?(e.consume(_),v):r.interrupt?t(_):E(_)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?k(_):B(_))}return _===45||Ft(_)?(e.consume(_),s+=String.fromCharCode(_),y):n(_)}function v(_){return _===62?(e.consume(_),r.interrupt?t:E):n(_)}function k(_){return Pe(_)?(e.consume(_),k):L(_)}function B(_){return _===47?(e.consume(_),L):_===58||_===95||Pt(_)?(e.consume(_),C):Pe(_)?(e.consume(_),B):L(_)}function C(_){return _===45||_===46||_===58||_===95||Ft(_)?(e.consume(_),C):w(_)}function w(_){return _===61?(e.consume(_),T):Pe(_)?(e.consume(_),w):B(_)}function T(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,S):Pe(_)?(e.consume(_),T):q(_)}function S(_){return _===l?(e.consume(_),l=null,P):_===null||De(_)?n(_):(e.consume(_),S)}function q(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||ft(_)?w(_):(e.consume(_),q)}function P(_){return _===47||_===62||Pe(_)?B(_):n(_)}function L(_){return _===62?(e.consume(_),z):n(_)}function z(_){return _===null||De(_)?E(_):Pe(_)?(e.consume(_),z):n(_)}function E(_){return _===45&&a===2?(e.consume(_),H):_===60&&a===1?(e.consume(_),G):_===62&&a===4?(e.consume(_),$):_===63&&a===3?(e.consume(_),x):_===93&&a===5?(e.consume(_),re):De(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(_D,W,A)(_)):_===null||De(_)?(e.exit("htmlFlowData"),A(_)):(e.consume(_),E)}function A(_){return e.check(BD,N,W)(_)}function N(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),R}function R(_){return _===null||De(_)?A(_):(e.enter("htmlFlowData"),E(_))}function H(_){return _===45?(e.consume(_),x):E(_)}function G(_){return _===47?(e.consume(_),s="",Q):E(_)}function Q(_){if(_===62){const F=s.toLowerCase();return $l.includes(F)?(e.consume(_),$):E(_)}return Pt(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),Q):E(_)}function re(_){return _===93?(e.consume(_),x):E(_)}function x(_){return _===62?(e.consume(_),$):_===45&&a===2?(e.consume(_),x):E(_)}function $(_){return _===null||De(_)?(e.exit("htmlFlowData"),W(_)):(e.consume(_),$)}function W(_){return e.exit("htmlFlow"),t(_)}}function TD(e,t,n){const r=this;return a;function a(s){return De(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function SD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(ni,t,n)}}const jD={name:"htmlText",tokenize:OD};function OD(e,t,n){const r=this;let a,i,s;return o;function o(x){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(x),l}function l(x){return x===33?(e.consume(x),u):x===47?(e.consume(x),w):x===63?(e.consume(x),B):Pt(x)?(e.consume(x),q):n(x)}function u(x){return x===45?(e.consume(x),c):x===91?(e.consume(x),i=0,g):Pt(x)?(e.consume(x),k):n(x)}function c(x){return x===45?(e.consume(x),m):n(x)}function h(x){return x===null?n(x):x===45?(e.consume(x),p):De(x)?(s=h,G(x)):(e.consume(x),h)}function p(x){return x===45?(e.consume(x),m):h(x)}function m(x){return x===62?H(x):x===45?p(x):h(x)}function g(x){const $="CDATA[";return x===$.charCodeAt(i++)?(e.consume(x),i===$.length?f:g):n(x)}function f(x){return x===null?n(x):x===93?(e.consume(x),y):De(x)?(s=f,G(x)):(e.consume(x),f)}function y(x){return x===93?(e.consume(x),v):f(x)}function v(x){return x===62?H(x):x===93?(e.consume(x),v):f(x)}function k(x){return x===null||x===62?H(x):De(x)?(s=k,G(x)):(e.consume(x),k)}function B(x){return x===null?n(x):x===63?(e.consume(x),C):De(x)?(s=B,G(x)):(e.consume(x),B)}function C(x){return x===62?H(x):B(x)}function w(x){return Pt(x)?(e.consume(x),T):n(x)}function T(x){return x===45||Ft(x)?(e.consume(x),T):S(x)}function S(x){return De(x)?(s=S,G(x)):Pe(x)?(e.consume(x),S):H(x)}function q(x){return x===45||Ft(x)?(e.consume(x),q):x===47||x===62||ft(x)?P(x):n(x)}function P(x){return x===47?(e.consume(x),H):x===58||x===95||Pt(x)?(e.consume(x),L):De(x)?(s=P,G(x)):Pe(x)?(e.consume(x),P):H(x)}function L(x){return x===45||x===46||x===58||x===95||Ft(x)?(e.consume(x),L):z(x)}function z(x){return x===61?(e.consume(x),E):De(x)?(s=z,G(x)):Pe(x)?(e.consume(x),z):P(x)}function E(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(e.consume(x),a=x,A):De(x)?(s=E,G(x)):Pe(x)?(e.consume(x),E):(e.consume(x),N)}function A(x){return x===a?(e.consume(x),a=void 0,R):x===null?n(x):De(x)?(s=A,G(x)):(e.consume(x),A)}function N(x){return x===null||x===34||x===39||x===60||x===61||x===96?n(x):x===47||x===62||ft(x)?P(x):(e.consume(x),N)}function R(x){return x===47||x===62||ft(x)?P(x):n(x)}function H(x){return x===62?(e.consume(x),e.exit("htmlTextData"),e.exit("htmlText"),t):n(x)}function G(x){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),Q}function Q(x){return Pe(x)?ze(e,re,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(x):re(x)}function re(x){return e.enter("htmlTextData"),s(x)}}const yo={name:"labelEnd",tokenize:$D,resolveTo:ID,resolveAll:MD},PD={tokenize:LD},ND={tokenize:zD},RD={tokenize:qD};function MD(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 ID(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=Ct(o,e.slice(i+1,i+r+3)),o=Ct(o,[["enter",c,t]]),o=Ct(o,bo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=Ct(o,[["exit",c,t],e[s-2],e[s-1],["exit",u,t]]),o=Ct(o,e.slice(s+1)),o=Ct(o,[["exit",l,t]]),$t(e,i,e.length,o),e}function $D(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(p){return i?i._inactive?h(p):(s=r.parser.defined.includes(Kn(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(PD,c,s?c:h)(p):p===91?e.attempt(ND,c,s?u:h)(p):s?c(p):h(p)}function u(p){return e.attempt(RD,c,h)(p)}function c(p){return t(p)}function h(p){return i._balanced=!0,n(p)}}function LD(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),a}function a(h){return ft(h)?wr(e,i)(h):i(h)}function i(h){return h===41?c(h):yf(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return ft(h)?wr(e,l)(h):c(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?xf(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):c(h)}function u(h){return ft(h)?wr(e,c)(h):c(h)}function c(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function zD(e,t,n){const r=this;return a;function a(o){return Df.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Kn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function qD(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 WD={name:"labelStartImage",tokenize:HD,resolveAll:yo.resolveAll};function HD(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 UD={name:"labelStartLink",tokenize:VD,resolveAll:yo.resolveAll};function VD(e,t,n){const r=this;return a;function a(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Mi={name:"lineEnding",tokenize:KD};function KD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ze(e,t,"linePrefix")}}const ya={name:"thematicBreak",tokenize:ZD};function ZD(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||De(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Pe(u)?ze(e,o,"whitespace")(u):o(u))}}const lt={name:"list",tokenize:QD,continuation:{tokenize:JD},exit:ex},YD={tokenize:tx,partial:!0},GD={tokenize:XD,partial:!0};function QD(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(m){const g=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Os(m)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(ya,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(m)}return n(m)}function l(m){return Os(m)&&++s<10?(e.consume(m),l):(!r.interrupt||s<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(ni,r.interrupt?n:c,e.attempt(YD,p,h))}function c(m){return r.containerState.initialBlankLine=!0,i++,p(m)}function h(m){return Pe(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function JD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ni,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ze(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Pe(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(GD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,ze(e,e.attempt(lt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function XD(e,t,n){const r=this;return ze(e,a,"listItemIndent",r.containerState.size+1);function a(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function ex(e){e.exit(this.containerState.type)}function tx(e,t,n){const r=this;return ze(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function a(i){const s=r.events[r.events.length-1];return!Pe(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Ll={name:"setextUnderline",tokenize:rx,resolveTo:nx};function nx(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 rx(e,t,n){const r=this;let a;return i;function i(u){let c=r.events.length,h;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){h=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Pe(u)?ze(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||De(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const ax={tokenize:ix};function ix(e){const t=this,n=e.attempt(ni,r,e.attempt(this.parser.constructs.flowInitial,a,ze(e,e.attempt(this.parser.constructs.flow,a,e.attempt(cD,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 sx={resolveAll:wf()},ox=Cf("string"),ux=Cf("text");function Cf(e){return{tokenize:t,resolveAll:wf(e==="text"?lx:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(c){return u(c)?i(c):o(c)}function o(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const h=a[c];let p=-1;if(h)for(;++p<h.length;){const m=h[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function wf(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 lx(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 cx(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:k,enter:B,exit:C,attempt:S(w),check:S(T),interrupt:S(T,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:m,sliceSerialize:p,now:g,defineSkip:f,write:h};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function h(z){return s=Ct(s,z),y(),s[s.length-1]!==null?[]:(q(t,0),u.events=bo(i,u.events,u),u.events)}function p(z,E){return fx(m(z),E)}function m(z){return dx(s,z)}function g(){const{line:z,column:E,offset:A,_index:N,_bufferIndex:R}=r;return{line:z,column:E,offset:A,_index:N,_bufferIndex:R}}function f(z){a[z.line]=z.column,L()}function y(){let z;for(;r._index<s.length;){const E=s[r._index];if(typeof E=="string")for(z=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===z&&r._bufferIndex<E.length;)v(E.charCodeAt(r._bufferIndex));else v(E)}}function v(z){c=c(z)}function k(z){De(z)?(r.line++,r.column=1,r.offset+=z===-3?2:1,L()):z!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=z}function B(z,E){const A=E||{};return A.type=z,A.start=g(),u.events.push(["enter",A,u]),o.push(A),A}function C(z){const E=o.pop();return E.end=g(),u.events.push(["exit",E,u]),E}function w(z,E){q(z,E.from)}function T(z,E){E.restore()}function S(z,E){return A;function A(N,R,H){let G,Q,re,x;return Array.isArray(N)?W(N):"tokenize"in N?W([N]):$(N);function $(M){return V;function V(ne){const te=ne!==null&&M[ne],ae=ne!==null&&M.null,le=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(ae)?ae:ae?[ae]:[]];return W(le)(ne)}}function W(M){return G=M,Q=0,M.length===0?H:_(M[Q])}function _(M){return V;function V(ne){return x=P(),re=M,M.partial||(u.currentConstruct=M),M.name&&u.parser.constructs.disable.null.includes(M.name)?I():M.tokenize.call(E?Object.assign(Object.create(u),E):u,l,F,I)(ne)}}function F(M){return z(re,x),R}function I(M){return x.restore(),++Q<G.length?_(G[Q]):H}}}function q(z,E){z.resolveAll&&!i.includes(z)&&i.push(z),z.resolve&&$t(u.events,E,u.events.length-E,z.resolve(u.events.slice(E),u)),z.resolveTo&&(u.events=z.resolveTo(u.events,u))}function P(){const z=g(),E=u.previous,A=u.currentConstruct,N=u.events.length,R=Array.from(o);return{restore:H,from:N};function H(){r=z,u.previous=E,u.currentConstruct=A,u.events.length=N,o=R,L()}}function L(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function dx(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 fx(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
|
|
115
115
|
`;break}case-3:{s=`\r
|
|
116
|
-
`;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const dx={42:lt,43:lt,45:lt,48:lt,49:lt,50:lt,51:lt,52:lt,53:lt,54:lt,55:lt,56:lt,57:lt,62:hf},fx={91:hD},hx={[-2]:Ni,[-1]:Ni,32:Ni},mx={35:yD,42:va,45:[Il,va],60:wD,61:Il,95:va,96:Rl,126:Rl},px={38:pf,92:mf},gx={[-5]:Ri,[-4]:Ri,[-3]:Ri,33:zD,38:pf,42:Os,60:[H1,TD],91:WD,92:[vD,mf],93:bo,95:Os,96:rD},vx={null:[Os,ax]},bx={null:[42,95]},yx={null:[]},Dx=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:bx,contentInitial:fx,disable:yx,document:dx,flow:mx,flowInitial:hx,insideSpan:vx,string:px,text:gx},Symbol.toStringTag,{value:"Module"}));function xx(e){const n=F1([Dx,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(M1),document:a($1),flow:a(nx),string:a(ix),text:a(sx)};return r;function a(i){return s;function s(o){return ux(r,i,o)}}}function Cx(e){for(;!gf(e););return e}const $l=/[\0\t\n\r]/g;function wx(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,d,h,p,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if($l.lastIndex=h,u=$l.exec(i),p=u&&u.index!==void 0?u.index:i.length,m=i.charCodeAt(p),!u){t=i.slice(h);break}if(m===10&&h===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<p&&(l.push(i.slice(h,p)),e+=p-h),m){case 0:{l.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,l.push(-2);e++<d;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}h=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const Ex=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function kx(e){return e.replace(Ex,_x)}function _x(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return ff(n.slice(i?2:1),i?16:10)}return go(n)||e}const Cf={}.hasOwnProperty;function Bx(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Ax(n)(Cx(xx(n).document().write(wx()(e,t,!0))))}function Ax(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Fe),autolinkProtocol:N,autolinkEmail:N,atxHeading:i(he),blockQuote:i(te),characterEscape:N,characterReference:N,codeFenced:i(ae),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ae,s),codeText:i(le,s),codeTextData:N,data:N,codeFlowValue:N,definition:i(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(pe),hardBreakEscape:i(Ce),hardBreakTrailing:i(Ce),htmlFlow:i(Ae,s),htmlFlowData:N,htmlText:i(Ae,s),htmlTextData:N,image:i(we),label:s,link:i(Fe),listItem:i(Le),listItemValue:p,listOrdered:i(Se,h),listUnordered:i(Se),paragraph:i(Je),reference:B,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(he),strong:i(je),thematicBreak:i(ge)},exit:{atxHeading:l(),atxHeadingSequence:C,autolink:l(),autolinkEmail:ee,autolinkProtocol:K,blockQuote:l(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:R,characterReferenceMarkerNumeric:R,characterReferenceValue:M,codeFenced:l(x),codeFencedFence:f,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:$,codeIndented:l(b),codeText:l(I),codeTextData:$,data:$,definition:l(),definitionDestinationString:w,definitionLabelString:_,definitionTitleString:k,emphasis:l(),hardBreakEscape:l(E),hardBreakTrailing:l(E),htmlFlow:l(A),htmlFlowData:$,htmlText:l(j),htmlTextData:$,image:l(q),label:ne,labelText:re,lineEnding:L,link:l(H),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:T,resourceDestinationString:v,resourceTitleString:W,resource:V,setextHeading:l(z),setextHeadingLineSequence:S,setextHeadingText:F,strong:l(),thematicBreak:l()}};wf(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(U){let ie={type:"root",children:[]};const me={stack:[ie],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:d,data:n},ve=[];let Ee=-1;for(;++Ee<U.length;)if(U[Ee][1].type==="listOrdered"||U[Ee][1].type==="listUnordered")if(U[Ee][0]==="enter")ve.push(Ee);else{const Ve=ve.pop();Ee=a(U,Ve,Ee)}for(Ee=-1;++Ee<U.length;){const Ve=t[U[Ee][0]];Cf.call(Ve,U[Ee][1].type)&&Ve[U[Ee][1].type].call(Object.assign({sliceSerialize:U[Ee][2].sliceSerialize},me),U[Ee][1])}if(me.tokenStack.length>0){const Ve=me.tokenStack[me.tokenStack.length-1];(Ve[1]||Ll).call(me,void 0,Ve[0])}for(ie.position={start:Jt(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:Jt(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee<t.transforms.length;)ie=t.transforms[Ee](ie)||ie;return ie}function a(U,ie,me){let ve=ie-1,Ee=-1,Ve=!1,Ge,mt,Lt,kt;for(;++ve<=me;){const et=U[ve];switch(et[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{et[0]==="enter"?Ee++:Ee--,kt=void 0;break}case"lineEndingBlank":{et[0]==="enter"&&(Ge&&!kt&&!Ee&&!Lt&&(Lt=ve),kt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:kt=void 0}if(!Ee&&et[0]==="enter"&&et[1].type==="listItemPrefix"||Ee===-1&&et[0]==="exit"&&(et[1].type==="listUnordered"||et[1].type==="listOrdered")){if(Ge){let Ft=ve;for(mt=void 0;Ft--;){const pt=U[Ft];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;mt&&(U[mt][1].type="lineEndingBlank",Ve=!0),pt[1].type="lineEnding",mt=Ft}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}Lt&&(!mt||Lt<mt)&&(Ge._spread=!0),Ge.end=Object.assign({},mt?U[mt][1].start:et[1].end),U.splice(mt||ve,0,["exit",Ge,et[2]]),ve++,me++}if(et[1].type==="listItemPrefix"){const Ft={type:"listItem",_spread:!1,start:Object.assign({},et[1].start),end:void 0};Ge=Ft,U.splice(ve,0,["enter",Ft,et[2]]),ve++,me++,Lt=void 0,kt=!0}}}return U[ie][1]._spread=Ve,me}function i(U,ie){return me;function me(ve){o.call(this,U(ve),ve),ie&&ie.call(this,ve)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(U,ie,me){this.stack[this.stack.length-1].children.push(U),this.stack.push(U),this.tokenStack.push([ie,me]),U.position={start:Jt(ie.start),end:void 0}}function l(U){return ie;function ie(me){U&&U.call(this,me),u.call(this,me)}}function u(U,ie){const me=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==U.type&&(ie?ie.call(this,U,ve[0]):(ve[1]||Ll).call(this,U,ve[0]));else throw new Error("Cannot close `"+U.type+"` ("+xr({start:U.start,end:U.end})+"): it’s not open");me.position.end=Jt(U.end)}function d(){return B1(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(U){if(this.data.expectingFirstListItemValue){const ie=this.stack[this.stack.length-2];ie.start=Number.parseInt(this.sliceSerialize(U),10),this.data.expectingFirstListItemValue=void 0}}function m(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.lang=U}function g(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.meta=U}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U.replace(/(\r?\n|\r)$/g,"")}function _(U){const ie=this.resume(),me=this.stack[this.stack.length-1];me.label=ie,me.identifier=Un(this.sliceSerialize(U)).toLowerCase()}function k(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.title=U}function w(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.url=U}function C(U){const ie=this.stack[this.stack.length-1];if(!ie.depth){const me=this.sliceSerialize(U).length;ie.depth=me}}function F(){this.data.setextHeadingSlurpLineEnding=!0}function S(U){const ie=this.stack[this.stack.length-1];ie.depth=this.sliceSerialize(U).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function N(U){const me=this.stack[this.stack.length-1].children;let ve=me[me.length-1];(!ve||ve.type!=="text")&&(ve=He(),ve.position={start:Jt(U.start),end:void 0},me.push(ve)),this.stack.push(ve)}function $(U){const ie=this.stack.pop();ie.value+=this.sliceSerialize(U),ie.position.end=Jt(U.end)}function L(U){const ie=this.stack[this.stack.length-1];if(this.data.atHardBreak){const me=ie.children[ie.children.length-1];me.position.end=Jt(U.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ie.type)&&(N.call(this,U),$.call(this,U))}function E(){this.data.atHardBreak=!0}function A(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U}function j(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U}function I(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U}function H(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=ie,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function q(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=ie,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function re(U){const ie=this.sliceSerialize(U),me=this.stack[this.stack.length-2];me.label=kx(ie),me.identifier=Un(ie).toLowerCase()}function ne(){const U=this.stack[this.stack.length-1],ie=this.resume(),me=this.stack[this.stack.length-1];if(this.data.inReference=!0,me.type==="link"){const ve=U.children;me.children=ve}else me.alt=ie}function v(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.url=U}function W(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.title=U}function V(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function T(U){const ie=this.resume(),me=this.stack[this.stack.length-1];me.label=ie,me.identifier=Un(this.sliceSerialize(U)).toLowerCase(),this.data.referenceType="full"}function R(U){this.data.characterReferenceType=U.type}function M(U){const ie=this.sliceSerialize(U),me=this.data.characterReferenceType;let ve;me?(ve=ff(ie,me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=go(ie);const Ee=this.stack.pop();Ee.value+=ve,Ee.position.end=Jt(U.end)}function K(U){$.call(this,U);const ie=this.stack[this.stack.length-1];ie.url=this.sliceSerialize(U)}function ee(U){$.call(this,U);const ie=this.stack[this.stack.length-1];ie.url="mailto:"+this.sliceSerialize(U)}function te(){return{type:"blockquote",children:[]}}function ae(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function he(){return{type:"heading",depth:0,children:[]}}function Ce(){return{type:"break"}}function Ae(){return{type:"html",value:""}}function we(){return{type:"image",title:null,url:"",alt:null}}function Fe(){return{type:"link",title:null,url:"",children:[]}}function Se(U){return{type:"list",ordered:U.type==="listOrdered",start:null,spread:U._spread,children:[]}}function Le(U){return{type:"listItem",spread:U._spread,checked:null,children:[]}}function Je(){return{type:"paragraph",children:[]}}function je(){return{type:"strong",children:[]}}function He(){return{type:"text",value:""}}function ge(){return{type:"thematicBreak"}}}function Jt(e){return{line:e.line,column:e.column,offset:e.offset}}function wf(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?wf(e,r):Fx(e,r)}}function Fx(e,t){let n;for(n in t)if(Cf.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 Ll(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+xr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+xr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+xr({start:t.start,end:t.end})+") is still open")}function Tx(e){const t=this;t.parser=n;function n(r){return Bx(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Ef(e,t){var l,u,d;const n={...qn,...t==null?void 0:t.nodeTypes,[Y.heading]:{...qn[Y.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[Y.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(h=>Ef({...h,ordered:e.ordered||!1},t))),e.type){case st.heading:return{type:n[Y.heading][e.depth||1],children:s};case st.list:return{type:e.ordered?n[Y.ol]:n[Y.ul],children:s};case st.listItem:return{type:n[Y.li],children:s};case st.paragraph:return{type:n[Y.paragraph],children:s};case st.link:return{type:n[Y.link],[r]:e.url,children:s};case st.image:return{type:n[Y.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case st.blockquote:return{type:n[Y.blockquote],children:s};case st.code:return{type:n[Y.codeblock],language:e.lang,children:[{text:e.value}]};case st.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[Y.paragraph],children:[{text:((d=e.value)==null?void 0:d.replace(/<br>/g,""))||""}]}:{type:Y.paragraph,children:[{text:e.value||""}]};case st.emphasis:return{[n[Pt.emphasis]]:!0,...Mi(s),...na(s)};case st.strong:return{[n[Pt.strong]]:!0,...Mi(s),...na(s)};case st.delete:return{[n[Pt.delete]]:!0,...Mi(s),...na(s)};case st.inlineCode:return{[n[Pt.code]]:!0,text:e.value,...na(s)};case st.thematicBreak:return{type:n[Y.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Mi=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function na(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const Sx=function(t){const n=r=>r.children.map(a=>Ef(a,t));this.Compiler=n},jx=(e,t=n=>{})=>{C1().use(Tx).use(Sx).process(e).then(n=>{const r=gn(n.result),a=s=>{const o=s;[Y.li,Y.blockquote].includes(o.type)&&o.children.map((l,u)=>{const d=l;d.type===Y.paragraph&&o.children.splice(u,1,...d.children)}),"children"in s&&s.children&&s.children.forEach(l=>a(l))};r.forEach(a);const i=s=>{for(let o=0;o<s.length;o++){const l=s[o],u=l;if(u.type===Y.link){const d=u.children&&u.children[0];if(d&&"text"in d&&d.text.includes(Bs)){const h=u,p=d.text.replace(Bs,""),m="link"in h&&h.link?h.link:"";h.type=Y.mention,h.id=m,h.name=p,h.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in l&&l.children&&i(l.children)}};i(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,l)=>{if("text"in o&&o.text){const u=o.text.match(/~~(.*?)~~/g);u&&u.map(d=>{const h=d.replace(/~~/g,""),p=o.text.indexOf(d),m=o.text.substring(0,p),g=o.text.substring(p+d.length),f=[{text:m},{text:h,[Y.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},yo=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},Ox=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=y.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=P.parent(a),r=oe.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},Px=e=>{const{selection:t}=e;return t?y.string(e,t):null},zl=e=>{let t="";for(const n of oe.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},ql={"mod+b":Y.bold,"mod+i":Y.italic,"mod+shift+x":Y.strikethrough,"mod+k":Y.link,"mod+shift+7":Y.ol,"mod+shift+8":Y.ul,"mod+shift+9":Y.blockquote},Nx=(e,t,n,r)=>{for(const a in ql)if(Ab(a,e)){e.stopPropagation(),e.preventDefault();const i=ql[a];if(i===Y.link){n([{type:"showLinkEditor",value:!0}]);return}if(Vx(i)){jf(t,i,r);return}Ff(t,i,r)}},kf=(e,t,n,r)=>{var d;const{selectedUser:a,possibleUsers:i}=t,s=i[a];if(!s)return;const o=s.userId||"",l=(d=s.user)==null?void 0:d.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const u={type:Y.mention,id:o,name:l,children:[{text:""}]};Q.select(e,(t==null?void 0:t.position)||uf),Q.insertNodes(e,[u,{text:" "}]),Q.move(e,{distance:1,unit:"offset"}),yo(r)},Rx=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&Z.isCollapsed(i)){const[s]=Z.edges(i),o=y.start(e,s.path),l=y.range(e,o,s),d=y.string(e,l).match(Oc);if(d){const h=d.index||0,p={path:s.path,offset:h},m={path:s.path,offset:h+d[0].length},g=y.range(e,p,m),f=y.after(e,s),x=y.range(e,s,f);if(y.string(e,x).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const k=d[1];let w=[];r&&(w=await r({name:k})),a([{type:"mentionPopover",value:{show:w.length>0?!0:n!==null,selectedUser:0,possibleUsers:w,position:w.length>0?g:null,numberOfUsers:w.length>0?w.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},_f=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},Nn=e=>typeof e.text=="string",Mx=[Y.hr,Y.image,Y.mention],Wl="<br>";function Bf(e,t={nodeTypes:qn}){const{nodeTypes:n=qn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...qn,...n,heading:{...qn[Y.heading],...n[Y.heading]}},l=[o[Y.ul],o[Y.ol]];let u=i;if(!Nn(e)&&s!==Y.mention&&(u=e.children.map(d=>{const h=Nn(d)?!1:l.includes(d.type||""),p=l.includes(e.type||"");let m=!1;return!Nn(e)&&Array.isArray(e.children)&&(m=e.children.some(g=>!Nn(g)&&g.type===o.link)),Bf({...d,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||h||p||m)&&!d.break,listDepth:l.includes(d.type||"")?a+1:a,inBlockquote:s===o[Y.blockquote]||e.parentType===o[Y.blockquote]})}).join("")),!r&&(i===""||i===`
|
|
117
|
-
`)&&e.parentType===o[
|
|
118
|
-
`;case o[
|
|
119
|
-
`;case o[
|
|
120
|
-
`;case o[
|
|
121
|
-
`;case o[
|
|
122
|
-
`;case o[
|
|
123
|
-
`;case o[
|
|
124
|
-
|
|
125
|
-
`;case o[
|
|
116
|
+
`;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const hx={42:lt,43:lt,45:lt,48:lt,49:lt,50:lt,51:lt,52:lt,53:lt,54:lt,55:lt,56:lt,57:lt,62:pf},mx={91:pD},px={[-2]:Ri,[-1]:Ri,32:Ri},gx={35:xD,42:ya,45:[Ll,ya],60:kD,61:Ll,95:ya,96:Il,126:Il},vx={38:vf,92:gf},bx={[-5]:Mi,[-4]:Mi,[-3]:Mi,33:WD,38:vf,42:Ps,60:[V1,jD],91:UD,92:[yD,gf],93:yo,95:Ps,96:iD},yx={null:[Ps,sx]},Dx={null:[42,95]},xx={null:[]},Cx=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Dx,contentInitial:mx,disable:xx,document:hx,flow:gx,flowInitial:px,insideSpan:yx,string:vx,text:bx},Symbol.toStringTag,{value:"Module"}));function wx(e){const n=S1([Cx,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a($1),document:a(z1),flow:a(ax),string:a(ox),text:a(ux)};return r;function a(i){return s;function s(o){return cx(r,i,o)}}}function Ex(e){for(;!bf(e););return e}const zl=/[\0\t\n\r]/g;function kx(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,h,p,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(zl.lastIndex=h,u=zl.exec(i),p=u&&u.index!==void 0?u.index:i.length,m=i.charCodeAt(p),!u){t=i.slice(h);break}if(m===10&&h===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<p&&(l.push(i.slice(h,p)),e+=p-h),m){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}h=p+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const _x=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Bx(e){return e.replace(_x,Ax)}function Ax(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return mf(n.slice(i?2:1),i?16:10)}return vo(n)||e}const Ef={}.hasOwnProperty;function Fx(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Tx(n)(Ex(wx(n).document().write(kx()(e,t,!0))))}function Tx(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(He),autolinkProtocol:P,autolinkEmail:P,atxHeading:i(he),blockQuote:i(te),characterEscape:P,characterReference:P,codeFenced:i(ae),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ae,s),codeText:i(le,s),codeTextData:P,data:P,codeFlowValue:P,definition:i(J),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(ge),hardBreakEscape:i(ye),hardBreakTrailing:i(ye),htmlFlow:i(Ae,s),htmlFlowData:P,htmlText:i(Ae,s),htmlTextData:P,image:i(Fe),label:s,link:i(He),listItem:i(Te),listItemValue:p,listOrdered:i(Se,h),listUnordered:i(Se),paragraph:i(Ne),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(he),strong:i(ke),thematicBreak:i(pe)},exit:{atxHeading:l(),atxHeadingSequence:w,autolink:l(),autolinkEmail:ne,autolinkProtocol:V,blockQuote:l(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:I,characterReferenceMarkerNumeric:I,characterReferenceValue:M,codeFenced:l(y),codeFencedFence:f,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:L,codeIndented:l(v),codeText:l(R),codeTextData:L,data:L,definition:l(),definitionDestinationString:C,definitionLabelString:k,definitionTitleString:B,emphasis:l(),hardBreakEscape:l(E),hardBreakTrailing:l(E),htmlFlow:l(A),htmlFlowData:L,htmlText:l(N),htmlTextData:L,image:l(G),label:re,labelText:Q,lineEnding:z,link:l(H),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:F,resourceDestinationString:x,resourceTitleString:$,resource:W,setextHeading:l(q),setextHeadingLineSequence:S,setextHeadingText:T,strong:l(),thematicBreak:l()}};kf(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(U){let ie={type:"root",children:[]};const me={stack:[ie],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:c,data:n},ve=[];let we=-1;for(;++we<U.length;)if(U[we][1].type==="listOrdered"||U[we][1].type==="listUnordered")if(U[we][0]==="enter")ve.push(we);else{const Ke=ve.pop();we=a(U,Ke,we)}for(we=-1;++we<U.length;){const Ke=t[U[we][0]];Ef.call(Ke,U[we][1].type)&&Ke[U[we][1].type].call(Object.assign({sliceSerialize:U[we][2].sliceSerialize},me),U[we][1])}if(me.tokenStack.length>0){const Ke=me.tokenStack[me.tokenStack.length-1];(Ke[1]||ql).call(me,void 0,Ke[0])}for(ie.position={start:Xt(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:Xt(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<t.transforms.length;)ie=t.transforms[we](ie)||ie;return ie}function a(U,ie,me){let ve=ie-1,we=-1,Ke=!1,Qe,mt,zt,_t;for(;++ve<=me;){const et=U[ve];switch(et[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{et[0]==="enter"?we++:we--,_t=void 0;break}case"lineEndingBlank":{et[0]==="enter"&&(Qe&&!_t&&!we&&!zt&&(zt=ve),_t=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:_t=void 0}if(!we&&et[0]==="enter"&&et[1].type==="listItemPrefix"||we===-1&&et[0]==="exit"&&(et[1].type==="listUnordered"||et[1].type==="listOrdered")){if(Qe){let Tt=ve;for(mt=void 0;Tt--;){const pt=U[Tt];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;mt&&(U[mt][1].type="lineEndingBlank",Ke=!0),pt[1].type="lineEnding",mt=Tt}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}zt&&(!mt||zt<mt)&&(Qe._spread=!0),Qe.end=Object.assign({},mt?U[mt][1].start:et[1].end),U.splice(mt||ve,0,["exit",Qe,et[2]]),ve++,me++}if(et[1].type==="listItemPrefix"){const Tt={type:"listItem",_spread:!1,start:Object.assign({},et[1].start),end:void 0};Qe=Tt,U.splice(ve,0,["enter",Tt,et[2]]),ve++,me++,zt=void 0,_t=!0}}}return U[ie][1]._spread=Ke,me}function i(U,ie){return me;function me(ve){o.call(this,U(ve),ve),ie&&ie.call(this,ve)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(U,ie,me){this.stack[this.stack.length-1].children.push(U),this.stack.push(U),this.tokenStack.push([ie,me]),U.position={start:Xt(ie.start),end:void 0}}function l(U){return ie;function ie(me){U&&U.call(this,me),u.call(this,me)}}function u(U,ie){const me=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==U.type&&(ie?ie.call(this,U,ve[0]):(ve[1]||ql).call(this,U,ve[0]));else throw new Error("Cannot close `"+U.type+"` ("+Cr({start:U.start,end:U.end})+"): it’s not open");me.position.end=Xt(U.end)}function c(){return F1(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(U){if(this.data.expectingFirstListItemValue){const ie=this.stack[this.stack.length-2];ie.start=Number.parseInt(this.sliceSerialize(U),10),this.data.expectingFirstListItemValue=void 0}}function m(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.lang=U}function g(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.meta=U}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function v(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U.replace(/(\r?\n|\r)$/g,"")}function k(U){const ie=this.resume(),me=this.stack[this.stack.length-1];me.label=ie,me.identifier=Kn(this.sliceSerialize(U)).toLowerCase()}function B(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.title=U}function C(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.url=U}function w(U){const ie=this.stack[this.stack.length-1];if(!ie.depth){const me=this.sliceSerialize(U).length;ie.depth=me}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function S(U){const ie=this.stack[this.stack.length-1];ie.depth=this.sliceSerialize(U).codePointAt(0)===61?1:2}function q(){this.data.setextHeadingSlurpLineEnding=void 0}function P(U){const me=this.stack[this.stack.length-1].children;let ve=me[me.length-1];(!ve||ve.type!=="text")&&(ve=Ue(),ve.position={start:Xt(U.start),end:void 0},me.push(ve)),this.stack.push(ve)}function L(U){const ie=this.stack.pop();ie.value+=this.sliceSerialize(U),ie.position.end=Xt(U.end)}function z(U){const ie=this.stack[this.stack.length-1];if(this.data.atHardBreak){const me=ie.children[ie.children.length-1];me.position.end=Xt(U.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ie.type)&&(P.call(this,U),L.call(this,U))}function E(){this.data.atHardBreak=!0}function A(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U}function N(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U}function R(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U}function H(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=ie,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function G(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const ie=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=ie,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function Q(U){const ie=this.sliceSerialize(U),me=this.stack[this.stack.length-2];me.label=Bx(ie),me.identifier=Kn(ie).toLowerCase()}function re(){const U=this.stack[this.stack.length-1],ie=this.resume(),me=this.stack[this.stack.length-1];if(this.data.inReference=!0,me.type==="link"){const ve=U.children;me.children=ve}else me.alt=ie}function x(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.url=U}function $(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.title=U}function W(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function F(U){const ie=this.resume(),me=this.stack[this.stack.length-1];me.label=ie,me.identifier=Kn(this.sliceSerialize(U)).toLowerCase(),this.data.referenceType="full"}function I(U){this.data.characterReferenceType=U.type}function M(U){const ie=this.sliceSerialize(U),me=this.data.characterReferenceType;let ve;me?(ve=mf(ie,me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=vo(ie);const we=this.stack.pop();we.value+=ve,we.position.end=Xt(U.end)}function V(U){L.call(this,U);const ie=this.stack[this.stack.length-1];ie.url=this.sliceSerialize(U)}function ne(U){L.call(this,U);const ie=this.stack[this.stack.length-1];ie.url="mailto:"+this.sliceSerialize(U)}function te(){return{type:"blockquote",children:[]}}function ae(){return{type:"code",lang:null,meta:null,value:""}}function le(){return{type:"inlineCode",value:""}}function J(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ge(){return{type:"emphasis",children:[]}}function he(){return{type:"heading",depth:0,children:[]}}function ye(){return{type:"break"}}function Ae(){return{type:"html",value:""}}function Fe(){return{type:"image",title:null,url:"",alt:null}}function He(){return{type:"link",title:null,url:"",children:[]}}function Se(U){return{type:"list",ordered:U.type==="listOrdered",start:null,spread:U._spread,children:[]}}function Te(U){return{type:"listItem",spread:U._spread,checked:null,children:[]}}function Ne(){return{type:"paragraph",children:[]}}function ke(){return{type:"strong",children:[]}}function Ue(){return{type:"text",value:""}}function pe(){return{type:"thematicBreak"}}}function Xt(e){return{line:e.line,column:e.column,offset:e.offset}}function kf(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?kf(e,r):Sx(e,r)}}function Sx(e,t){let n;for(n in t)if(Ef.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 ql(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Cr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Cr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Cr({start:t.start,end:t.end})+") is still open")}function jx(e){const t=this;t.parser=n;function n(r){return Fx(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function _f(e,t){var l,u,c;const n={...Hn,...t==null?void 0:t.nodeTypes,[Z.heading]:{...Hn[Z.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[Z.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(h=>_f({...h,ordered:e.ordered||!1},t))),e.type){case st.heading:return{type:n[Z.heading][e.depth||1],children:s};case st.list:return{type:e.ordered?n[Z.ol]:n[Z.ul],children:s};case st.listItem:return{type:n[Z.li],children:s};case st.paragraph:return{type:n[Z.paragraph],children:s};case st.link:return{type:n[Z.link],[r]:e.url,children:s};case st.image:return{type:n[Z.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case st.blockquote:return{type:n[Z.blockquote],children:s};case st.code:return{type:n[Z.codeblock],language:e.lang,children:[{text:e.value}]};case st.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[Z.paragraph],children:[{text:((c=e.value)==null?void 0:c.replace(/<br>/g,""))||""}]}:{type:Z.paragraph,children:[{text:e.value||""}]};case st.emphasis:return{[n[Nt.emphasis]]:!0,...Ii(s),...aa(s)};case st.strong:return{[n[Nt.strong]]:!0,...Ii(s),...aa(s)};case st.delete:return{[n[Nt.delete]]:!0,...Ii(s),...aa(s)};case st.inlineCode:return{[n[Nt.code]]:!0,text:e.value,...aa(s)};case st.thematicBreak:return{type:n[Z.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Ii=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function aa(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const Ox=function(t){const n=r=>r.children.map(a=>_f(a,t));this.Compiler=n},Px=(e,t=n=>{})=>{E1().use(jx).use(Ox).process(e).then(n=>{const r=vn(n.result),a=s=>{const o=s;[Z.li,Z.blockquote].includes(o.type)&&o.children.map((l,u)=>{const c=l;c.type===Z.paragraph&&o.children.splice(u,1,...c.children)}),"children"in s&&s.children&&s.children.forEach(l=>a(l))};r.forEach(a);const i=s=>{for(let o=0;o<s.length;o++){const l=s[o],u=l;if(u.type===Z.link){const c=u.children&&u.children[0];if(c&&"text"in c&&c.text.includes(As)){const h=u,p=c.text.replace(As,""),m="link"in h&&h.link?h.link:"";h.type=Z.mention,h.id=m,h.name=p,h.children=[{text:""}],s[o+1]||s.splice(o+1,0,{text:" "}),o++}}"children"in l&&l.children&&i(l.children)}};i(r),r.map(s=>{"children"in s&&s.children&&s.children.map((o,l)=>{if("text"in o&&o.text){const u=o.text.match(/~~(.*?)~~/g);u&&u.map(c=>{const h=c.replace(/~~/g,""),p=o.text.indexOf(c),m=o.text.substring(0,p),g=o.text.substring(p+c.length),f=[{text:m},{text:h,[Z.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},Do=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},Nx=(e,t)=>{const{selection:n}=e;if(!n)return[null,null];let[r,a]=b.parent(e,n,{edge:"end"}),i=r;for(;i.type!==t&&a.length>0&&a.length!==1;)a=O.parent(a),r=oe.get(e,a),i=r;return i.type===t?[r,a]:[null,null]},Rx=e=>{const{selection:t}=e;return t?b.string(e,t):null},Wl=e=>{let t="";for(const n of oe.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},Hl={"mod+b":Z.bold,"mod+i":Z.italic,"mod+shift+x":Z.strikethrough,"mod+k":Z.link,"mod+shift+7":Z.ol,"mod+shift+8":Z.ul,"mod+shift+9":Z.blockquote},Mx=(e,t,n,r)=>{for(const a in Hl)if(Tb(a,e)){e.stopPropagation(),e.preventDefault();const i=Hl[a];if(i===Z.link){n([{type:"showLinkEditor",value:!0}]);return}if(Zx(i)){Pf(t,i,r);return}Sf(t,i,r)}},Bf=(e,t,n,r)=>{var c;const{selectedUser:a,possibleUsers:i}=t,s=i[a];if(!s)return;const o=s.userId||"",l=(c=s.user)==null?void 0:c.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const u={type:Z.mention,id:o,name:l,children:[{text:""}]};X.select(e,(t==null?void 0:t.position)||cf),X.insertNodes(e,[u,{text:" "}]),X.move(e,{distance:1,unit:"offset"}),Do(r)},Ix=async({editor:e,isShowing:t,numberOfUsers:n,listMembers:r,dispatch:a})=>{const{selection:i}=e;if(i&&K.isCollapsed(i)){const[s]=K.edges(i),o=b.start(e,s.path),l=b.range(e,o,s),c=b.string(e,l).match(Nc);if(c){const h=c.index||0,p={path:s.path,offset:h},m={path:s.path,offset:h+c[0].length},g=b.range(e,p,m),f=b.after(e,s),y=b.range(e,s,f);if(b.string(e,y).match(/^(\s|\.|,|\?|!|:|;|'|"|`|$)/)){const B=c[1];let C=[];r&&(C=await r({name:B})),a([{type:"mentionPopover",value:{show:C.length>0?!0:n!==null,selectedUser:0,possibleUsers:C,position:C.length>0?g:null,numberOfUsers:C.length>0?C.length:null}}]);return}}}t&&a([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null}}])},Af=e=>{let t=document.body;if(e!==!1){const n=document.getElementById(e);n&&(t=n)}return t},Mn=e=>typeof e.text=="string",$x=[Z.hr,Z.image,Z.mention],Ul="<br>";function Ff(e,t={nodeTypes:Hn}){const{nodeTypes:n=Hn,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Hn,...n,heading:{...Hn[Z.heading],...n[Z.heading]}},l=[o[Z.ul],o[Z.ol]];let u=i;if(!Mn(e)&&s!==Z.mention&&(u=e.children.map(c=>{const h=Mn(c)?!1:l.includes(c.type||""),p=l.includes(e.type||"");let m=!1;return!Mn(e)&&Array.isArray(e.children)&&(m=e.children.some(g=>!Mn(g)&&g.type===o.link)),Ff({...c,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||h||p||m)&&!c.break,listDepth:l.includes(c.type||"")?a+1:a,inBlockquote:s===o[Z.blockquote]||e.parentType===o[Z.blockquote]})}).join("")),!r&&(i===""||i===`
|
|
117
|
+
`)&&e.parentType===o[Z.paragraph]&&s!==o[Z.mention]&&(s=o[Z.paragraph],u=Ul),!(u===""&&!$x.find(c=>o[c]===s)))switch(u!==Ul&&Mn(e)&&(e[Z.strikethrough]&&e[Z.bold]&&e[Z.italic]?u=In(u,"~~***"):e[Z.bold]&&e[Z.italic]?u=In(u,"***"):(e[Z.bold]&&(u=In(u,"**")),e[Z.italic]&&(u=In(u,"_")),e[Z.strikethrough]&&(u=In(u,"~~")),e[Z.code]&&(u=In(u,"`")))),s){case o[Z.heading][1]:return`# ${u}
|
|
118
|
+
`;case o[Z.heading][2]:return`## ${u}
|
|
119
|
+
`;case o[Z.heading][3]:return`### ${u}
|
|
120
|
+
`;case o[Z.heading][4]:return`#### ${u}
|
|
121
|
+
`;case o[Z.heading][5]:return`##### ${u}
|
|
122
|
+
`;case o[Z.heading][6]:return`###### ${u}
|
|
123
|
+
`;case o[Z.blockquote]:return`> ${u}
|
|
124
|
+
|
|
125
|
+
`;case o[Z.codeblock]:return`\`\`\`${e.language||""}
|
|
126
126
|
${u}
|
|
127
127
|
\`\`\`
|
|
128
|
-
`;case o[
|
|
128
|
+
`;case o[Z.link]:return`[${u}](${e.link||""})`;case o.image:return``;case o[Z.mention]:const{id:c}=e;return e?`@{{${c}}}`:u;case o[Z.ul]:case o[Z.ol]:return`
|
|
129
129
|
${u}
|
|
130
130
|
|
|
131
|
-
`;case o[
|
|
131
|
+
`;case o[Z.li]:const h=e&&e.parentType===o[Z.ol],p=e.children.length===1&&Mn(e.children[0]);let m="";for(let g=0;a>g;g++)h?m+=" ":m+=" ";return t.inBlockquote&&(m="> "+m),`
|
|
132
132
|
${m}${h?"1.":"-"} ${u}${p?`
|
|
133
|
-
`:""}`;case o[
|
|
133
|
+
`:""}`;case o[Z.paragraph]:return`${u}
|
|
134
134
|
|
|
135
|
-
`;case o[
|
|
136
|
-
`;default:return u}}function Rn(e,t){const n=e.trim(),r=n,a=`${t}${r}${Hl(t)}`;if(r.length===e.length)return a;const i=t+r+Hl(t);return e.replace(n,i)}const Hl=e=>e.split("").reverse().join(""),Ix=e=>e.map(t=>Bf(t)).join("").trim();const $x=({onFallbackClick:e=()=>{}})=>{const t=ue.useIntl(),n=Fn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s}=D.useContext(Gt),{show:o,selectedUser:l,possibleUsers:u}=i,d=lf(n,"mention-popover",`toolbar-${s}`);if(!o)return c.jsx(c.Fragment,{});const h=_f(a);return c.jsx(Ha,{parent:h,children:c.jsx($c,{ref:d,className:"mention-popover",onKeyDown:p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:c.jsxs("ul",{children:[u.map(({userId:p,user:m},g)=>c.jsx(Dn,{element:"li",className:G({selected:g===l}),member:{id:p,...m,link:!1},functions:{onClick:f=>{f.preventDefault(),f.stopPropagation();const x={...i,selectedUser:g};r([{type:"mentionPopover",value:x}]),kf(n,x,r,s)}}},p)),c.jsx(Dn,{element:"li",className:G("fallback",{selected:u.length===l}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${Mt}icons/invite-user.svg`},link:!1},functions:{onClick:p=>{p.preventDefault(),p.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})},Do=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=ue.useIntl(),l=Fn(),{id:u,tabbableOption:d,setFocus:h,openTooltip:p,dispatch:m}=D.useContext(Gt),g={};return e!==d&&(g.tabIndex=-1),c.jsxs("li",{id:`${u}-${e}`,className:G(e,{"has-divider":n}),onMouseEnter:()=>{m([{type:"openTooltip",value:e}])},onMouseLeave:()=>{m([{type:"openTooltip",value:null}])},onFocus:()=>{m([{type:"openTooltip",value:e}])},onBlur:f=>{f.stopPropagation();const x=[{type:"openTooltip",value:null}];l.selection&&x.push({type:"lastAnchor",value:l.selection.anchor}),m(x)},contentEditable:!1,children:[c.jsxs("button",{...s,...g,className:G(e,a,{active:t}),onClick:f=>{f.stopPropagation(),f.preventDefault()},onMouseDown:f=>{f.stopPropagation(),f.preventDefault(),r()},onKeyDown:f=>{var x,b,_,k;if(f.key!=="Tab")switch(f.key){case"Enter":f.stopPropagation(),f.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":f.stopPropagation(),f.preventDefault();const w=f.currentTarget.closest("li");let C=w==null?void 0:w.nextElementSibling;if(f.key==="ArrowLeft"){const z=w==null?void 0:w.previousElementSibling;z?C=z:C=(x=w==null?void 0:w.parentElement)==null?void 0:x.lastElementChild}else C||(C=(b=w==null?void 0:w.parentElement)==null?void 0:b.firstElementChild);const F=C==null?void 0:C.className.split(" ")[0];F&&(h(F),(_=C==null?void 0:C.querySelector("button"))==null||_.focus());break;default:const S=f.currentTarget.closest("fieldset");if(S){(k=S==null?void 0:S.previousElementSibling)==null||k.focus();break}}},children:[c.jsx(Me,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),c.jsx(_n,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Ul=[Y.ol,Y.ul],Af=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(y.nodes(e,{at:y.unhangRange(e,n),match:a=>{const i=a;return!y.isEditor(a)&&de.isElement(a)&&i.type===t}}));return!!r},Lx=e=>{const[t]=y.nodes(e,{match:n=>n.type===Y.blockquote});return!!t},Ff=(e,t,n)=>{try{const r=Lx(e),a=Af(e,t),i=Ul.includes(t);Q.unwrapNodes(e,{match:l=>{const u=l;return!y.isEditor(u)&&de.isElement(u)&&Ul.includes(u.type)},split:!0});const o={type:a?Y.paragraph:i?Y.li:t};if(Q.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,d]=y.parent(e,l,{edge:"end"});Array.from(y.nodes(e,{at:d,match:p=>{const m=p;return!y.isEditor(p)&&de.isElement(p)&&m.type===Y.li}})).forEach(([p,m])=>{oe.string(p).trim()===""&&Q.removeNodes(e,{at:m})})}else{if(r){const u={type:Y.blockquote,children:[]};Q.wrapNodes(e,u)}const l={type:t,children:[]};Q.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},zx=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=D.useContext(Gt),a=Fn(),i=Af(a,e);return c.jsx(Do,{id:e,active:i,hasDivider:t,callback:()=>{Ff(a,e,r),n(i?null:e)}})},wr=e=>{const[t]=y.nodes(e,{match:n=>{const r=n;return!y.isEditor(n)&&de.isElement(n)&&r.type===Y.link}});return!!t},qx=(e,t,n,r)=>{e.selection&&xo(e,t,n,r)},Wx=(e,t,n,r)=>{const{selection:a}=e;if(a&&Z.isCollapsed(a)){const[s]=y.nodes(e,{match:o=>{const l=o;return!y.isEditor(o)&&de.isElement(o)&&l.type===Y.link}});if(s){const[o,l]=s,u={link:t};Q.setNodes(e,u,{at:l}),yo(n)}}else xo(e,t,n,r)},xo=(e,t,n,r=a=>{console.error(a)})=>{try{wr(e)&&Tf(e);const{selection:a}=e,i=a&&Z.isCollapsed(a),s={type:Y.link,link:t,children:i?[{text:t}]:[]};i?(Q.insertNodes(e,s),Q.move(e,{distance:1,unit:"offset"})):(Q.wrapNodes(e,s,{split:!0}),Q.collapse(e,{edge:"end"}),Q.insertNodes(e,{text:""}),Q.move(e,{distance:1,unit:"offset"})),yo(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},Tf=e=>{Q.unwrapNodes(e,{match:t=>{const n=t;return!y.isEditor(t)&&de.isElement(t)&&n.type===Y.link}})};let Ii=null;const Hx=()=>{const e=ue.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,dispatch:i,reportError:s}=D.useContext(Gt),o=Fn(),l=a1(o),u=(l==null?void 0:l.text)||Px(o),[d,h]=D.useState(wr(o)),p=lf(o,"link-editor",`${n}-link`),m=D.useRef(null);D.useEffect(()=>{var _;!d&&r&&((_=m.current)==null||_.focus())},[d]),D.useEffect(()=>{Ii&&clearTimeout(Ii),Ii=setTimeout(()=>{h(wr(o))},500)},[o.selection]);const g=[],f=["open","edit","remove"].map(_=>{const k={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${_}`},{link:l==null?void 0:l.pretty})};switch(g.push({className:_}),_){case"open":k.href=(l==null?void 0:l.full)||"",k.onClick=w=>{w.preventDefault(),w.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),i([{type:"showLinkEditor",value:!1}])},k.children=c.jsxs(c.Fragment,{children:[k.children,c.jsx(Me,{children:e.formatMessage({id:`${t}${_}_text`})})]});break;case"edit":k.onClick=()=>{h(!1)};break;case"remove":k.onClick=()=>{const w=[{type:"showLinkEditor",value:!1}];wr(o)&&(Tf(o),w.push({type:"lastAnchor",value:null})),i(w)};break}return k}),x=[{id:"url",type:"url",inputRef:m,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(l==null?void 0:l.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];u&&x.unshift({component:()=>c.jsxs("p",{children:[c.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",u]})});const b=_f(a);return c.jsx(Ha,{parent:b,children:c.jsx(_n,{ref:p,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!d},functions:{onBlur:()=>{i([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var _;return(_=m.current)==null?void 0:_.focus()})}},children:d?c.jsx(nr,{wrappers:g,buttons:f}):c.jsx(An,{element:"fieldset",id:`${n}-link-editor`,className:G({"show-labels":u}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async _=>{setTimeout(()=>{const k=[{type:"showLinkEditor",value:!1}];if(_.url){const{full:w}=Ic(_.url);l!=null&&l.full?Wx(o,w,n,s):qx(o,w,n,s),k.push({type:"lastAnchor",value:null})}i(k)})}},fields:x,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},Ux=()=>{const e=Fn(),{setFocus:t,dispatch:n}=D.useContext(Gt),[r,a]=D.useState(!1);return D.useEffect(()=>{a(wr(e))},[e.selection]),c.jsx(Do,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},Vx=e=>[Y.bold,Y.italic,Y.strikethrough].includes(e),Sf=(e,t)=>{const n=y.marks(e);return n?n[t]===!0:!1},jf=(e,t,n)=>{try{Sf(e,t)?y.removeMark(e,t):y.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},Kx=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=D.useContext(Gt),a=Fn(),i=Sf(a,e);return c.jsx(Do,{id:e,active:i,hasDivider:t,callback:()=>{jf(a,e,r),n(i?null:e)}})},Fa=[Y.bold,Y.italic,Y.strikethrough],Zx=[Y.ol,Y.ul,Y.blockquote];const Yx=({...e})=>{const t=ue.useIntl(),{id:n}=D.useContext(Gt);return c.jsxs(c.Fragment,{children:[c.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[c.jsx(Me,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),c.jsxs("ul",{children:[Fa.map((r,a)=>c.jsx(Kx,{format:r,hasDivider:a===Fa.length-1},r)),c.jsx(Ux,{}),Zx.map((r,a)=>c.jsx(zx,{format:r,hasDivider:a===1},r))]})]}),c.jsx(Hx,{})]})};var Gx=eC,Qx=/^(?:\w+:)?\/\/(\S+)$/,Jx=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,Xx=/^[^\s\.]+\.\S{2,}$/;function eC(e){if(typeof e!="string")return!1;var t=e.match(Qx);if(!t)return!1;var n=t[1];return n?!!(Jx.test(n)||Xx.test(n)):!1}const tC=kn(Gx),nC=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[Y.link].includes(s.type)||a(i)},e.insertText=i=>{i&&tC(i)?xo(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},rC=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===Y.mention?!0:n(i),e.isVoid=i=>i.type===Y.mention?!0:r(i),e.markableVoid=i=>i.type===Y.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},aC=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===Y.link&&oe.string(r).trim()===""){Q.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const Of=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,...l})=>{const u=ue.useIntl(),d=Ih();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=a||{},{listMembers:p,clickMentionFallback:m,onChange:g=()=>{},reportError:f=v=>{console.error(v)}}=i||{},x=[{type:Y.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const b={editorKey:null,originalValue:t||"",initialValue:t?null:x,tabbableOption:Fa[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[_,k]=D.useReducer(Rr,b),{editorKey:w,originalValue:C,initialValue:F,stringValue:S,lastAnchor:z,lastKey:N,hasInteracted:$,hasLoaded:L,mentionPopover:E}=_,A=v=>{const W=v||Fa[0];v&&k([{type:"tabbableOption",value:W}])},j=`rte-${e}`,I=D.useCallback(v=>c.jsx(n1,{...v}),[]),H=D.useCallback(v=>c.jsx(r1,{...v}),[]),q=D.useMemo(()=>nC(rC(aC(Wv(e1(zv())),f),f),j,f),[]);D.useEffect(()=>{if(!t)return;_r.lastIndex=0;const v=t.match(_r);!v||v.length>1||v[0].length!==t.length||$||k([{type:"originalValue",value:t}])},[t]);const re=v=>{if(!q||v!==j)return;const W=y.end(q,[]);Q.select(q,W),X.focus(q)};D.useEffect(()=>{const v=W=>{var T;const V=W,B=((T=V==null?void 0:V.detail)==null?void 0:T.id)||null;B&&re(B)};return window.addEventListener("focusEditor",v),()=>{window.removeEventListener("focusEditor",v)}},[]),D.useEffect(()=>{if(q.children.length>0&&!L){if(k([{type:"hasLoaded",value:!0}]),!s)return;re(j)}},[q.children.length,F]),D.useEffect(()=>{C&&(async()=>{let W=gn(C);W.includes("<")&&(W=new Ca().turndown(W)),o&&o.mentions&&(W=await Mc({text:W,template:`[${Bs}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),jx(W,V=>{k([{type:"initialValue",value:V},{type:"editorKey",value:C.toString()}]),setTimeout(()=>{k([{type:"stringValue",value:zl(q)}])},150)})})()},[C]),D.useEffect(()=>{t!==""||!q||as(C,t)&&!$||(y.withoutNormalizing(q,()=>{Q.delete(q,{at:{anchor:y.start(q,[]),focus:y.end(q,[])}}),Q.deselect(q),q.children.length!==0&&Q.unwrapNodes(q,{at:[0]}),Q.insertNodes(q,x,{at:[0]})}),k([{type:"initialValue",value:x},{type:"lastAnchor",value:null}]))},[t]);const ne=Ec(()=>{Rx({editor:q,isShowing:E.show,numberOfUsers:E.numberOfUsers,listMembers:p,dispatch:k})},100);return F?c.jsx("div",{id:j,className:"rich-text-editor",children:c.jsxs(Gt.Provider,{value:{..._,id:j,isInOverlay:h,setFocus:A,dispatch:k,reportError:f},children:[c.jsxs(Jy,{editor:q,initialValue:F,onChange:v=>{if(q.operations.some(V=>V.type!=="set_selection")){const V=Ix(v);g(V),k([{type:"stringValue",value:zl(q)}]),$||k([{type:"hasInteracted",value:!0}]),ne(),d&&console.log({serialized:V,json:v})}},...l,children:[c.jsx(Wy,{className:"input",renderElement:I,renderLeaf:H,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onKeyDown:v=>{if(v.key==="Enter"){E.show&&(v.preventDefault(),v.stopPropagation(),kf(q,E,k,j));const{selection:W}=q;if(W){const V=Z.isCollapsed(W),[B,T]=y.node(q,W,{depth:1});let R=B,M=R.type;const K=R.children[0];if(K&&[Y.ol,Y.ul].includes(K.type)&&(R=K,M=K.type),R&&de.isElement(R)&&M!==Y.paragraph){if(M===Y.blockquote&&!v.shiftKey){v.stopPropagation(),v.preventDefault(),Q.insertNodes(q,x);return}if(V){const[ee,te]=y.parent(q,W,{edge:"end"}),le=ee.type;if([Y.ul,Y.ol].includes(M))if(v.stopPropagation(),v.preventDefault(),le===Y.li&&N==="Enter"){ee.children.length===1&&"text"in ee.children[0]&&ee.children[0].text===""&&Q.removeNodes(q,{at:te}),Q.insertNodes(q,x,{at:P.next(T)}),Q.select(q,y.end(q,P.next(T)));return}else{const[J,pe]=Ox(q,Y.li),he={type:Y.li,children:[{text:""}]};Q.insertNodes(q,he,{at:P.next(pe)}),Q.select(q,y.end(q,P.next(pe)))}}}}}else if(v.key==="Escape"){if(E.show){v.preventDefault(),v.stopPropagation(),k([{type:"mentionPopover",value:{...E,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(v.key)&&E.show){v.preventDefault(),v.stopPropagation();const{selectedUser:W,possibleUsers:V}=E;let B=v.key==="ArrowUp"?W-1:W+1;B<0&&(B=V.length-1),B>=V.length+1&&(B=0),k([{type:"mentionPopover",value:{...E,selectedUser:B}}])}k([{type:"lastKey",value:v.key}]),Nx(v,q,k,f)},onBlur:()=>{q.selection&&k([{type:"lastAnchor",value:q.selection.anchor}])},onFocus:()=>{if(z){if(!P.isPath(z.path)||!oe.has(q,z.path))return;const v=oe.get(q,z.path);let W=0;if(fe.isText(v)?W=v.text.length:v.children&&(W=v.children.length),z.offset>W)return;try{Q.select(q,{anchor:z,focus:z})}catch(V){const B=V.message;f(`Error focusing editor: ${B}`)}}}}),c.jsx(Yx,{}),p?c.jsx($x,{onFallbackClick:m}):null]},w),c.jsx(Zs,{id:`character-limit-${e}`,limit:r,valueLength:Za(S)})]})}):c.jsx(c.Fragment,{})};const iC=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=D.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);D.useEffect(()=>{r&&l(r)},[r]);const u=d=>{i||(l(d),a(d))};return c.jsxs("div",{className:G("toggle",s),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[c.jsx("p",{children:t}),c.jsx("ul",{className:G("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(d=>{const h=`${e}-${d.value}`;return c.jsxs("li",{className:"hidden",children:[c.jsx("input",{type:"radio",id:h,name:e,value:d.value,checked:o===d.value,onChange:()=>u(d.value),disabled:i}),c.jsx("label",{htmlFor:h,children:d.label})]},h)})})]})};function sC({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=D.useState(!1),[l,u]=D.useState(!1),d=D.useRef(null),h=async p=>{o(!0),u(!1);try{const m=p.target.files&&p.target.files[0];if(!m||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:m,userId:t});a(f=>({...f,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return c.jsxs("div",{className:G("profile-image-change-figure",e),children:[c.jsx(Zt,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&c.jsx("p",{className:"error text-small",children:c.jsx(ue.FormattedMessage,{id:"profile_image_change_error"})}),c.jsx("input",{id:"file",type:"file",accept:"image/*",ref:d,onChange:h,hidden:!0,"data-testid":"file-input"}),c.jsx(_e,{onClick:()=>d.current&&d.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:s,children:c.jsx(ue.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const Pf=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return c.jsx(An,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const Nf=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[d,h]=D.useState([]),[p,m]=D.useState(!0),[g,f]=D.useState(u),{formatMessage:x}=ue.useIntl(),b=async w=>{w.preventDefault();try{await l(d),h([]),f("SUCCESS")}catch(C){f("ERROR"),o(C)}},_=w=>{w.preventDefault(),f("NOT_SUBMITTED"),m(!0),h([])},k=w=>{w.preventDefault(),s(),f("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?c.jsxs("div",{className:"invite-form-wrapper",children:[c.jsx("div",{className:"content centred",children:g==="SUCCESS"?c.jsx("h2",{className:"success-title",children:x({id:"inviteForm_success"})}):c.jsxs("h2",{className:"error-title",children:[" ",x({id:"inviteForm_error"})]})}),c.jsx(Vt,{}),c.jsx("div",{className:"footer",children:g==="SUCCESS"?c.jsxs(c.Fragment,{children:[c.jsx(_e,{variant:"secondary",onClick:_,children:x({id:"inviteForm_ctaSendMoreInvites"})}),c.jsx(_e,{onClick:k,children:x({id:"inviteForm_ctaDone"})})]}):c.jsx(_e,{onClick:_,children:x({id:"inviteForm_ctaTryAgain"})})})]}):c.jsx("div",{className:"invite-form-wrapper",children:c.jsxs("form",{style:{backgroundColor:i},onSubmit:b,className:G("invite-form gtm-trackable"),children:[c.jsxs("fieldset",{className:"content",children:[c.jsx("h2",{className:"title",style:{color:r},children:e}),c.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),c.jsx(kh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:x({id:"inviteForm_email_placeholder"}),emails:d,onChange:w=>{h(w),m(!w.length)},autoFocus:!1,getLabel:(w,C,F)=>c.jsxs("div",{className:"email text-medium",children:[c.jsx("div",{"data-tag-item":!0,children:w}),c.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{F(C),m(!d.length)},className:"remove-email-button",screenreaderText:x({id:"overlay_close"})})]},C)})]}),c.jsx(Vt,{}),c.jsx("fieldset",{className:"footer",children:c.jsx(_e,{className:"sendEmailsButton",disabled:p,children:n})})]})})},ba=e=>e.map(t=>({condition:t})),Dt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},oC=({functions:e,...t})=>{const{formatMessage:n}=ue.useIntl(),[r,a]=D.useState(null),[i,s]=D.useState(!1),[o,l]=D.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[Dt.NEW_PASSWORD]!==m[Dt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,d=m=>!us(m[Dt.NEW_PASSWORD]).isValid,h=[{"data-testid":Dt.NEW_PASSWORD,id:Dt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ba(["required",d]),functions:{onChange:m=>l(us(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Dt.CONFIRMED_PASSWORD,id:Dt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ba(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":Dt.CURRENT_PASSWORD,id:Dt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ba(["required"])}),i&&h.push({component:ud,props:{matchingRules:o}});const p={id:Dt.FORM_ID,fields:h,functions:{...e,onSuccess:async m=>(e.createPassword(m),e.onSuccess&&e.onSuccess(m)),onCatch:m=>a(m==null?void 0:m.statusCode),onFailure:(m,g)=>{(g.includes(Dt.NEW_PASSWORD)||g.includes(Dt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return c.jsxs(c.Fragment,{children:[c.jsx(An,{...p}),r&&c.jsx(on,{variant:"error",text:r})]})};const Rf=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=ue.useIntl(),u=D.useRef(null);Kn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const d=h=>{h.preventDefault(),h.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return c.jsx("form",{onSubmit:d,className:G("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:c.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:c.jsxs("p",{children:[c.jsx(Me,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),c.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:h=>{h.key==="Enter"&&d(h)}}),c.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:c.jsx(Me,{children:l.formatMessage({id:"search_clear"})})}),c.jsx("button",{className:"search",onClick:d,children:c.jsx(Me,{children:l.formatMessage({id:"search_cta"})})})]})})})},Vl=async({ref:e,validateEmail:t,dispatch:n})=>{const r=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(!e.current.validity.valid||!r.test(e.current.value))return n([{type:"validFields.email",value:!1}]);const a=e.current.value.toString().toLowerCase().trim(),i={valid:!1,autoApproved:!1,exists:{auth:!1,engagement:!1,registration:!1,user:!1}};let s=Object.assign({},i);try{s=await t(a),s===void 0&&(s=i)}catch{return n([{type:"shouldManuallyApprove",value:!0},{type:"emailDetails",value:{email:a,boxType:"nonGov",isEnd2End:!1}},{type:"validFields.email",value:!1}])}const{valid:o=!1,autoApproved:l=!1,exists:u}=s;let d="";return o?d=l?"gov":"nonGov":u.registration?u.engagement&&!u.user?d=u.auth?"verify":"pending":d="exists":u.auth&&(d="exists"),n([{type:"shouldDisableButton",value:!1},{type:"shouldManuallyApprove",value:!l},{type:"emailDetails",value:{email:a,boxType:d,isEnd2End:/testing\+[0-9]+@apolitical.co$/.test(a)}},{type:"validFields.email",value:!0}])},uC=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"]}},lC=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=uC(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}])},cC=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:d}=s,h=(m,g)=>{m.current&&s.validFields[g]!==m.current.validity.valid&&o([{type:`validFields.${g}`,value:m.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>h(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Vl({ref:i.email,validateEmail:r,dispatch:o})},onChange:(m,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:rd,props:{email:d.email,type:d.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>h(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{h(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:m=>c.jsx("small",{children:m})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:m=>c.jsx("small",{className:"notes text-small",children:m})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:m=>c.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:m}),privacy:m=>c.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:m})}),shownValue:"accepted",functions:{onChange:m=>{if(!m)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Vl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const dC=({className:e=""})=>c.jsxs("div",{className:G("success-message",e),"data-testid":"success-message",children:[c.jsx("p",{className:"success-title",children:c.jsx(ue.FormattedMessage,{id:"signup_success_title"})}),c.jsx(ue.FormattedMessage,{id:"signup_success_text",values:{p:t=>c.jsx("p",{children:t})}})]});const fC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},hC=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ue.useIntl(),{title:u=!0,expectation:d=!1,url:h=!0,logInButton:p=!0,successMessage:m=!0}=a,g={title:u,expectation:d,url:h,logInButton:p,successMessage:m},[f,x]=D.useReducer(Rr,fC),{validFields:b,emailDetails:_,shouldManuallyApprove:k,shouldDisableButton:w,showSuccessMessage:C,showError:F}=f,[S,z]=Ms.useCookies(["signup-this-session","functional-cookie-consent"]),N={form:D.createRef(),name:D.createRef(),email:D.createRef(),jobTitle:D.createRef(),organisation:D.createRef(),tc:D.createRef(),hiddenValidation:D.createRef()};D.useEffect(()=>{k===!0&&N.jobTitle.current&&N.jobTitle.current.focus()},[k]),D.useEffect(()=>{S["signup-this-session"]&&x([{type:"showSuccessMessage",value:!0}])},[S]),D.useEffect(()=>{C&&S["functional-cookie-consent"]&&z("signup-this-session","true",{path:"/",maxAge:3600})},[C]);const $=D.useMemo(()=>cC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:N,state:f,dispatch:x,dataToSubmit:s,intl:l}),[s,r,l,N,g,f]),L=w?!0:k?!Object.values(b).every(E=>E===!0):!b.name||!b.email||["exists","pending","verify"].includes(_.boxType);return g.successMessage&&C?c.jsx(dC,{className:e}):c.jsxs("fieldset",{className:G("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&c.jsx("p",{className:"signup-title",children:c.jsx(ue.FormattedMessage,{id:"signup_title"})}),F&&c.jsx(on,{variant:"error",text:l.formatMessage({id:"signup_error"})}),c.jsx(An,{className:"signup-form",formRef:N.form,id:"sign-up-form",fields:$,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:L?{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 lC({refs:N,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:x,state:f})},onCatch:E=>{r.handleError(E),x([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),c.jsx("button",{className:"validation-button",ref:N.hiddenValidation})]})};const cn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return c.jsx("section",{className:G("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const mC=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),c.jsx(cn,{className:G("download-section",n),children:c.jsxs("div",{className:"content-default",children:[D.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),c.jsx(nr,{buttons:r})]})})};function Mf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const pC=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ue.useIntl();return c.jsxs("div",{className:G("edit-section-placeholder",{"has-icon":!!e}),style:Pc(e),children:[c.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&c.jsx(_e,{href:r,variant:"secondary",size:"small",onClick:()=>Mf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},gC=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=D.useState(!1),d=typeof r=="string"||!!n,h=()=>u(!1);return c.jsxs("section",{className:G("edit-section",t),children:[n&&c.jsx(ir,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:h},className:G("edit-section-modal"),children:c.jsx(An,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async p=>{var m,g;(m=n==null?void 0:n.functions)!=null&&m.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(p)),u(!1)},onCancel:h}})}),c.jsxs("div",{className:"edit-section-header",children:[c.jsx("h2",{className:"edit-section-header-title",children:a}),d&&c.jsx(_e,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Mf({href:r,setShowModal:u}),children:"Edit"})]}),e||c.jsx(pC,{...s,href:r,setShowModal:u,showEditButton:d}),o&&c.jsx(Vt,{})]})};const vC=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return c.jsxs("div",{className:G("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&D.createElement(s.element,{className:G("title",s.className)},s.text),t&&c.jsx("p",{children:t}),c.jsx("ul",{className:G({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:d,nameOfBusiness:h,link:p=!1,description:m=!1},g)=>{if(!d||!d.url)return null;const f=c.jsx("img",{src:d.url,width:d.width||"auto",height:d.height||"auto",alt:h});return c.jsxs("li",{children:[c.jsx("p",{className:"img-wrapper",children:p?c.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),m&&c.jsx("small",{children:m})]},window.btoa(`${d.url}_${g}`))})})]})};let $i;const Li="contactFooter_",bC=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=D.useRef(null),[r,a]=D.useState(0),[i,s]=D.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout($i),$i=setTimeout(()=>{o(),s(!1)},500))};return D.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout($i),window.removeEventListener("resize",l)}),[]),c.jsx(cn,{id:"contactForm",className:"contact-footer",children:c.jsxs("div",{className:"inner-wrapper",children:[c.jsx("h2",{children:c.jsx(ue.FormattedMessage,{id:`${Li}title`})}),c.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[c.jsxs("aside",{children:[c.jsx("p",{children:c.jsx(ue.FormattedMessage,{id:`${Li}text`})}),c.jsx(Bn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:c.jsx(ue.FormattedMessage,{id:`${Li}email`})})]}),c.jsx(Pf,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},yC=({activeLink:e,...t})=>c.jsx(cn,{children:c.jsx(td,{layout:"1-3",children:c.jsxs(c.Fragment,{children:[c.jsx(ed,{activeLink:e}),c.jsx(Hc,{...t})]})})});const zi="cookieBanner_",qi=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Wi=new Date(Date.now()+12*30*24*60*60*1e3),If=()=>{const e=ue.useIntl(),[t,n,r]=Ms.useCookies(qi),[a,i]=D.useState(!t["apol-cookie-banner"]),s=()=>{qi.forEach(d=>{n(d,!0,{path:"/",expires:Wi,domain:d==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Wi}),qi.forEach(d=>{if(d==="apol-cookie-banner"){n(d,!0,{path:"/",expires:Wi});return}r(d)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(d=>{u.push({variant:d.href?"tertiary":"primary",href:d.href,onClick:d.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${d.gtmType}-click`,children:e.formatMessage({id:`${zi}buttons_${d.id}`})})}),c.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[c.jsx("h6",{children:e.formatMessage({id:`${zi}title`})}),c.jsx("p",{children:e.formatMessage({id:`${zi}text`})}),c.jsx(nr,{buttons:u})]})},Ht={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","insights","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},insights:{href:"/learning-hub/global-insights/",gtmType:"insights-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Mn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Mn["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:Mn.support,gtmType:"concierge-email-click"},business:{email:Mn.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 Wn="footer_",Ta="SiteFooter",Kl=({group:e})=>{const t=Ht[e].order||[];let n=!1;return"text"in Ht[e]&&(n=Ht[e].text),c.jsxs(D.Fragment,{children:[c.jsx("p",{className:"pre-title",children:c.jsx(ue.FormattedMessage,{id:`${Wn}${e}`})}),Array.isArray(t)&&t.length>0&&c.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=Ht[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),c.jsx("li",{children:c.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Ta,"data-gtm-event-type":i,...s,children:c.jsx(ue.FormattedMessage,{id:`${Wn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&c.jsx("dl",{className:"text-medium",children:n.order.map(r=>c.jsxs(D.Fragment,{children:[c.jsx("dt",{children:c.jsx(ue.FormattedMessage,{id:`${Wn}${e}_${r}`})}),c.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&c.jsx("address",{children:c.jsx(ue.FormattedMessage,{id:`${Wn}${e}_${r}_address`,values:{br:c.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&c.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Ta,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Co=()=>c.jsx("div",{id:"footer",children:c.jsxs("div",{className:"wrapper",children:[c.jsx(qa,{element:"hr"}),c.jsx(Ks,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Ta,"data-gtm-event-type":"logo-homepage-link"}),c.jsx("footer",{children:["platform","community","company","contact"].map(e=>c.jsxs("div",{className:"group",children:[c.jsx(Kl,{group:e}),Object.keys(Ht[e]).includes("child")&&c.jsx(Kl,{group:Ht[e].child})]},e))}),c.jsx("hr",{}),c.jsxs("div",{className:"sub-footer",children:[c.jsx("ul",{children:Array.isArray(Ht.social.order)&&Ht.social.order.map(e=>{const t=Ht.social[e];return c.jsx("li",{className:e,children:c.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Ta,"data-gtm-event-type":"social-click",children:c.jsx("span",{className:"hidden",children:c.jsx(ue.FormattedMessage,{id:`${Wn}social_${e}`})})})},e)})}),c.jsx("small",{children:c.jsx(ue.FormattedMessage,{id:`${Wn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Ie={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e===gt.ACCOUNT&&t===!1&&n[gt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&Ie.handlerCalled[e]&&i-Ie.handlerCalled[e]<500)return;Ie.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case gt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case gt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case gt.ACCOUNT:o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=Dc(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?Ie.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case gt.SITE:if(n){const u=Ie.findFirstChild(t.current.children,"attributes.aria-controls",gt.SITE);s=Ie.findFirstChild(u.children,"href")}else s=Ie.findFirstChild(t.current.children,"href");break;case gt.ACCOUNT:if(o=Ie.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Ie.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(Ie.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Ie.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Ie.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Ie.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Nr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},Sa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ue.useIntl(),o=Dc(Nr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,d=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let k=o.gtmType||`${e}-click`;if(k.includes(".")){const w=k.split("."),C=w[w.length-2];k=`${C==="topics"?`${C}-`:""}${w[w.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":k,"data-gtm-event-context":"HeaderButtons"}),d&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const m=o.order&&o.order[0]&&o[o.order[0]],g=m&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let x={},b={},_={};if(f&&(x={...x,"aria-current":"page"}),m){const k=o.menuId||e,w={onClick:C=>Ie.events.onClick(C,{id:k,callback:a,isOpen:r[k]}),onFocus:()=>Ie.events.onFocus({id:k}),onBlur:()=>Ie.events.onBlur({id:k,callback:a}),onMouseLeave:()=>Ie.events.onBlur({id:k,callback:a}),onMouseEnter:()=>Ie.events.onMouseEnter({id:k,callback:a})};b={...w,id:k===gt.SITE?gt.SITE:gt.ACCOUNT},n&&(g&&(_={...w,className:"navigation-button",onKeyPress:C=>{C.key==="Enter"&&Ie.events.onClick(C,{id:k,callback:a,isOpen:r[k]})},"aria-haspopup":!0,"aria-expanded":r[k],"aria-controls":k}),b={...b,hidden:k in r?!r[k]:!0}),g||(b={...b})}return c.jsxs("li",{className:G({[o.className]:o.className,"has-submenu":m,parent:g,active:f}),...x,children:[p?D.createElement(d?_e:"a",p,s.formatMessage({id:h})):n&&o.order&&g?c.jsxs("button",{..._,children:[s.formatMessage({id:h}),c.jsx(Me,{children:s.formatMessage({id:`header_menu_${r[gt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:h}),o.order&&c.jsx("ul",{...b,children:o.order.map(k=>{if(!o[k])return null;const w={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[k].order?c.jsxs("li",{className:G({[o[k].className]:o[k].className}),children:[s.formatMessage({id:`${h}_${k}`}),c.jsx("ul",{children:o[k].order.map(C=>c.jsx(Sa,{id:`${e}.${k}.${C}`,...w},C))})]},k):c.jsx(Sa,{id:`${e}.${k}`,...w},k)})})]},e)};const DC={height:67,height_desktop:83};var gt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(gt||{});const wo=({showNavigation:e=!0})=>{const t=ue.useIntl(),n=D.useContext($t),r=er(!0,!0),a=n&&typeof n.id=="string",i=D.useMemo(()=>Ie.getIsDesktopVersion(a,r),[a,r]),[s,o]=D.useReducer(Rr,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:d}=s,h=D.useRef(s);D.useEffect(()=>{h.current=s},[s]),_c({scrollPosition:DC[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const b=h.current.menus;!i&&b["site-navigation"]||Ie.shouldChangeHeaderIsVisible(!0,b,o)},scrollDown:()=>{const b=h.current.menus;!i&&b["site-navigation"]||Ie.shouldChangeHeaderIsVisible(!1,b,o)}}});const p=(b,_,k=!1)=>{Ie.handleMenus({id:b,value:_,menus:h.current.menus,dispatch:o,forceHandle:k})},m=D.useRef(null),g=b=>{b.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(_=>{h.current.menus[_]&&p(_,!1,!0)})};D.useEffect(()=>{var b;return(b=document.getElementById("header"))==null||b.addEventListener("keydown",g),()=>{var _;(_=document.getElementById("header"))==null||_.removeEventListener("keydown",g)}},[]),Kn(()=>{u["site-navigation"]&&Ie.autoFocus({menu:"site-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["site-navigation"]]),Kn(()=>{u["account-navigation"]&&Ie.autoFocus({menu:"account-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:d,dispatch:o})},[u["account-navigation"]]);const f=c.jsxs(c.Fragment,{children:[!i.search&&c.jsx("button",{className:"search toggle-search-button",onClick:b=>{b.preventDefault(),b.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:c.jsx(Me,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),c.jsx(Rf,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),x=c.jsxs(c.Fragment,{children:[!i.navigation&&c.jsx("button",{className:"menu-button gtm-trackable",onClick:b=>{b.preventDefault(),b.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:c.jsx(Me,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),c.jsx("ul",{ref:m,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Nr.order.map(b=>c.jsx(Sa,{id:b,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},b))})]});return n&&n.isLoading?null:c.jsxs(c.Fragment,{children:[c.jsxs("nav",{id:"header",className:G({"logged-in":a,"logged-out":!a,visible:l}),children:[c.jsx(Me,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),c.jsx(Ks,{variant:"monochrome"}),e&&c.jsxs(c.Fragment,{children:[i.navigation?c.jsxs(c.Fragment,{children:[x,f]}):c.jsxs(c.Fragment,{children:[f,x]}),a?c.jsxs("button",{className:"account-button",onClick:b=>Ie.events.onClick(b,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>Ie.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>Ie.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[c.jsx(Me,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),c.jsx(Zt,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):c.jsx("ul",{className:"sign-in-buttons",children:Nr.buttons.order.map(b=>c.jsx(Sa,{id:`buttons.${b}`},b))})]})]}),c.jsx("hr",{id:"content-of-page"}),c.jsx("div",{className:G("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const xC=()=>{const e=ue.useIntl();return c.jsxs(c.Fragment,{children:[c.jsx(wo,{}),c.jsx("div",{id:"content",children:c.jsx(on,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),c.jsx(Co,{})]})},$f=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:d="default",variant:h="default",circle:p="default",modal:m="default"}=i,g=wc(),[f,x]=D.useState(""),b=F=>{const{detail:{message:S}}=F;x(S)};D.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",b),()=>{document.removeEventListener("ariaLive",b)}),[g]);const _=ca(e,{locale:o}),k=ca(t,{locale:o}),w=ca(n,{locale:o}),C={};return d!=="default"&&(C[d]=!0),h!=="default"&&(C[h]=!0),p!=="default"&&(C[p]=!0),c.jsx(_h.ErrorBoundary,{onError:r,fallback:c.jsx(xC,{}),children:c.jsxs(D.Suspense,{fallback:null,children:[c.jsxs("div",{id:"wrapper",className:G(s,C,{"has-footer":u}),children:[c.jsx(wo,{showNavigation:l}),c.jsxs("main",{id:"content-wrapper",children:[k&&c.jsx("div",{className:G("additional-content prepended",{"large-modal":m==="large"}),children:k}),D.createElement(d==="bold"?Fo:"div",{id:"content",children:_,className:G({"large-modal":m==="large"})})]}),w&&c.jsx("div",{className:"additional-content appended",children:w}),u&&c.jsx(Co,{}),c.jsx(If,{})]}),f&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Zl={default:"tags_",headerTopics:"header_topics_topics_"},Hi={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"},CC={getTagDetails:e=>{if(e.includes("topic_")){if(e=Hi.topic[e.replace("topic_","")],e){const t=Nr.topics.topics[e].href;return t?{id:e,href:t,text:`${Zl.headerTopics}${e}`}:null}return null}return Hi[e]?(e=Hi[e],{id:e,text:`${Zl.default}${e}`}):null}};const wC=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ue.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const d=CC.getTagDetails(u);d&&l.push(d)}),l.length<1?null:c.jsx("ul",{className:G("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const d=o.formatMessage({id:u.text});return c.jsx("li",{children:u.href&&r?c.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:d}):d},u.id)})})};const EC=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=ue.useIntl();return e.length===0?null:c.jsxs("div",{className:G("members-list",s),children:[c.jsxs("h1",{children:[o.formatMessage({id:"membersList"}),c.jsx("span",{className:"count",children:t})]}),c.jsx("ul",{children:e.map((l,u)=>c.jsxs("li",{children:[c.jsx(Dn,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&c.jsx(mn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&c.jsx(Mr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const kC=D.lazy(()=>Promise.resolve().then(()=>DE)),Lf=({forceShow:e,form:t,className:n})=>{const r=ue.useIntl(),i=D.useContext($t)||"community",s=Va(i);s.name||(s.name=r.formatMessage({id:`member_${typeof i=="string"?i:"community"}`}));const{modal:o=!1}=e||{},[l,u]=D.useState(o||Uh("showPost")==="true"||!1);return c.jsxs(c.Fragment,{children:[c.jsxs("button",{className:G("discussion-form-card",n),onClick:d=>{d.preventDefault(),d.stopPropagation(),u(!0)},"data-testid":"discussion-form-card",children:[c.jsx(Zt,{name:s.name,src:s.image,alt:""}),c.jsx("span",{className:"input",children:r.formatMessage({id:"discussionFormCard_placeholder"})})]}),c.jsx(Ha,{children:c.jsx(kC,{showModal:l,onClose:()=>{u(!1)},form:t,className:"in-portal"})})]})},_C=D.lazy(()=>Promise.resolve().then(()=>TC)),Eo=({isCard:e=!1,form:t,membershipRequiredToPost:{isMember:n,required:r,join:a,leave:i,notMemberStateText:s}})=>{if(r&&!n)return c.jsx(on,{text:s,button:{breakpoints:{mobile:!0,901:!1},component:c.jsx(Vs,{isShort:!0,functions:{join:a,leave:i}})}});const{content:o,functions:l,meta:u,...d}=t,h={content:{type:(o==null?void 0:o.type)||"reply",slugs:(o==null?void 0:o.slugs)||{}},functions:{...l,create:(l==null?void 0:l.create)||(()=>{})},meta:{...u,isEditing:(u==null?void 0:u.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1},...d,id:`add-post-${d.id||""}`};return e?c.jsx(Lf,{form:h}):c.jsx(_C,{...h})},BC={showForm:!1},ni=D.createContext(BC),zf=({children:e})=>{const[t,n]=D.useState({showForm:!1});return c.jsx(ni.Provider,{value:{...t,updateConversation:n},children:e})},AC=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ue.useIntl();return t?c.jsx("small",{children:_t(a.formatMessage,`${e}explainer`,n,"action",{a:i=>c.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):c.jsx(c.Fragment,{})},FC=({formID:e,intlPath:t,showLabel:n,type:r})=>{const a=ue.useIntl();return n?c.jsx("label",{htmlFor:`${e}-input`,className:"text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:a.formatMessage({id:`${t}label`})}):c.jsx(Me,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:_t(a.formatMessage,`${t}label_action`,r,"action")})};let ra=null;const Qe="discussion_form_",$r=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r,placeholder:a,maxLength:i=0,buttons:s,forceShow:o={cancel:!1,error:!1},isCommunity:l=!1,functions:u,data:d={},gtmContext:h="DiscussionForm"})=>{var he,Ce,Ae;const p=ue.useIntl(),m=D.useContext($t),[g,f]=D.useState(""),{isLoading:x=!1,isInWrapper:b=!1,isInOverlay:_=!1,isAutoFocused:k=!1,isEditing:w=!1,hasTitleField:C=!1,isPrepopulated:F=!1,showTitle:S=!1,showGuidelines:z=!0,showDivider:N=!1,showSuccessMessage:$=!0}=r||{},{create:L=()=>{},handleSaveEdit:E=()=>{},handleCancel:A=()=>{},callback:j=()=>{},listMembers:I=()=>Promise.resolve([]),clickMentionFallback:H=()=>{},props:q={create:{projectNames:["questions-answers"]}}}=u,[re,ne]=D.useState({title:C&&C.text||"",body:w&&w.text||F&&F.text||""}),[v,W]=D.useState(o.error||!1),[V,B]=D.useState(!1);if(D.useEffect(()=>{l&&!w&&F&&F!==re.body&&ne({...re,body:F.text||""})},[F]),x)return c.jsx(Et,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const T=we=>{ne({...re,body:we});let Fe;!m||!m.id?Fe=_t(p.formatMessage,`${Qe}error_loggedOut`,t.type,"action"):n?i>0&&we.length>=i&&(Fe=`${Qe}error_tooLong`):Fe=_t(p.formatMessage,`${Qe}error_noPermission`,t.type,"action"),Fe?W(Fe):v&&W(!1)};let R=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const we=((he=t.slugs)==null?void 0:he.reply)||((Ce=t.slugs)==null?void 0:Ce.answer)||((Ae=t.slugs)==null?void 0:Ae.question)||"";we&&(R=`${R}-${we.slice(-15)}`)}e&&(R=`${e}-${R}`);const M=async()=>{if(!m||!m.id||!n||ae)return;ra&&clearTimeout(ra),B("submitting");const we=window.location.pathname;try{let Fe;switch(t.type){case"post":Fe=await L({title:re.title,content:re.body});break;case"question":Fe=await L({title:re.body,authorId:m&&m.id,...q==null?void 0:q.create});break;case"response":Fe=await L({questionSlug:t.slugs.question},{body:re.body,authorId:m&&m.id,contentPath:we});break;case"reply":Fe=await L({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:re.body,authorId:m&&m.id,contentPath:we});break;default:break}await Mh(1e3),j&&await j(Fe),ra=setTimeout(()=>{ne({title:"",body:""}),B("submitted"),f(_t(p.formatMessage,`${Qe}success`,t.type,"action"));const Se=new Event("discussionFormSubmitted");document.dispatchEvent(Se),K()},500)}catch(Fe){const Se=Fe;let Le=`${Qe}error`;Se!=null&&Se.message.includes("entry already exists")&&(Le=_t(p.formatMessage,`${Qe}error_alreadyExists`,t.type,"action")),Se!=null&&Se.message.includes("429")?Le=_t(p.formatMessage,`${Qe}error_tooMany`,t.type,"action"):Se!=null&&Se.message.includes("400")&&(Le=`${Qe}error`),W(Le),K()}},K=()=>{ra=setTimeout(()=>{W(!1),B(!1),f("")},5e3)},ee=!re.title||!Lo(re.title),te=!re.body||!Lo(re.body);let ae=te;C&&(ae=ee&&te);const le=V==="submitting",J=[{component:FC,props:{formID:R,intlPath:Qe,showLabel:C!==!1,type:t.type}},{component:Of,props:{id:`${R}-input`,value:V==="submitting"&&!v?"":re.body,placeholder:a||_t(p.formatMessage,`${Qe}placeholder`,t.type,"action"),maxLength:i,meta:{isInOverlay:_},functions:{onChange:T,listMembers:I,clickMentionFallback:H},data:d,autoFocus:w!==!1||k&&!C,"aria-invalid":!!v,"aria-errormessage":"error-message"}},{component:AC,props:{intlPath:Qe,showGuidelines:z,type:t.type,gtmContext:h}}];N&&J.push({component:Vt}),C&&J.unshift({id:"title",type:"text",value:C.text,limit:250,autoFocus:k,label:p.formatMessage({id:`${Qe}titleField_label`}),placeholder:p.formatMessage({id:`${Qe}titleField_placeholder`}),functions:{onChange:we=>{ne({...re,title:we})}},validation:[{condition:()=>ae,error:p.formatMessage({id:`${Qe}titleField_error`})}]});let pe=!m||!m.id||!n||ae||le;return w&&(C?pe=pe||re.body===w.text&&re.title===C.text:pe=pe||re.body===w.text),c.jsxs(c.Fragment,{children:[c.jsxs(An,{id:R,className:G("discussion-card discussion-form",{"no-styling":b&&w}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:w&&!le||o.cancel},functions:{onSuccess:async()=>{if(w){B("submitting"),E(re);return}await M()},onCancel:A},fields:J,intlPath:Qe,button:{variant:"primary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`${w?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:pe,overwriteSubmittingText:!0,text:!le&&!w&&(s!=null&&s.submit)?s==null?void 0:s.submit:p.formatMessage({id:`${Qe}${le?w?"saving":"posting":w?"save":"post"}`})},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!o.cancel&&(!m||!m.id||!re.body),text:s!=null&&s.cancel?s==null?void 0:s.cancel:p.formatMessage({id:`${Qe}cancel`})},gtm:{context:h,event:`${t.type}-form`},"data-testid":`discussion-${t.type}-form`,children:[S&&!w&&["question"].includes(t.type)&&c.jsx("h2",{children:_t(p.formatMessage,`${Qe}title`,t.type,"action")}),c.jsx(Dn,{member:m?{...m,link:!1}:"community",gtmContext:h,gtmType:"profile-click"})]}),V==="submitted"&&$&&c.jsx(Br,{className:"success","data-testid":"success",children:_t(p.formatMessage,`${Qe}success`,t.type,"action")}),v&&c.jsx(Br,{id:"error-message",className:"error","data-testid":"error",children:o.error?o.error:typeof v=="string"?v.includes(" ")?v:p.formatMessage({id:v},{action:p.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):v}),g&&c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:g})]})},TC=Object.freeze(Object.defineProperty({__proto__:null,default:$r},Symbol.toStringTag,{value:"Module"})),SC=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),jC=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const ja=({icon:e,className:t="",...n})=>c.jsx(_e,{className:G("discussion-button",t),variant:"tertiary",icon:e,...n});let Er=!1;const Ui=()=>{Er!==!1&&(clearTimeout(Er),Er=!1)},Vi=5;let Ki=null;const qf=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const u=ue.useIntl(),d={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[h,p]=D.useReducer(Rr,d),{numberOfLikes:m,userLikedContent:g,ignoreInteractions:f,showLikers:x,tabbableLink:b}=h;D.useEffect(()=>{p([{type:"userLikedContent",value:a}])},[a]);const _=D.useMemo(()=>jC(n,Vi),[n]),k=S=>{if(S.preventDefault(),S.stopPropagation(),p([{type:"showLikers",value:!1}]),Er)return Ui(),!1;if(Ui(),f||!s)return!1;Er=setTimeout(w,350)},w=async()=>{if(Ui(),f||!s)return!1;let S=g?m-1:m+1;S<0&&(S=0),p([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const z=SC(i.slugs);g?await l(z):await o({...z,payload:{contentPath:window.location.pathname}})}}catch{p([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{p([{type:"ignoreInteractions",value:!1}])}},C=()=>{Ki=setTimeout(()=>{p([{type:"showLikers",value:!1}])},500)},F=()=>{Ki&&clearTimeout(Ki)};return D.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&p([{type:"showLikers",value:!1}])},onMouseEnter:()=>{F(),p([{type:"showLikers",value:!0}])},onMouseLeave:()=>{C()}},c.jsxs(c.Fragment,{children:[c.jsx(ja,{className:G("discussion-button text-medium action-button",{"show-spinner":f,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:k,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:c.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:m})})}),n&&c.jsxs(c.Fragment,{children:[c.jsx(Me,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{F()},onBlur:()=>C,onClick:S=>{var N;S.preventDefault(),S.stopPropagation(),F(),p([{type:"showLikers",value:!0}]);const z=(N=S.currentTarget.nextSibling)==null?void 0:N.childNodes[0];if(z){const $=z.querySelector("li:first-child a");$&&(p([{type:"tabbableLink",value:0}]),setTimeout(()=>{$.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),C())},"aria-expanded":x,"aria-controls":`likes-tooltip-${i.slug}`,children:c.jsx(Me,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),c.jsx(_n,{id:`likes-tooltip-${i.slug}`,isOpen:x,isLoading:n.length===0,children:n.length&&c.jsxs("ul",{children:[_.map((S,z)=>{if(typeof S=="string"||!S.name)return null;const N={};return b!==z&&(N.tabIndex=-1),c.jsx("li",{"data-index":z,children:c.jsx(Bn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:$=>$==null?void 0:$.stopPropagation(),onFocus:()=>F(),onKeyDown:$=>{var I,H,q,re;if(!$||!["ArrowUp","ArrowDown"].includes($.key||""))return;$.stopPropagation(),$.preventDefault();const L=$.key==="ArrowUp"?"up":"down",E=(I=$.currentTarget)==null?void 0:I.parentElement;let A=E==null?void 0:E.nextElementSibling;if(L==="up"){const ne=E==null?void 0:E.previousElementSibling;ne?A=ne:(A=(H=E==null?void 0:E.parentElement)==null?void 0:H.lastElementChild,(A==null?void 0:A.getAttribute("data-index"))==="-1"&&(A=A==null?void 0:A.previousElementSibling))}else(!A||(A==null?void 0:A.getAttribute("data-index"))==="-1")&&(A=(q=E==null?void 0:E.parentElement)==null?void 0:q.firstElementChild);if(!A)return;const j=(A==null?void 0:A.getAttribute("data-index"))||"0";p([{type:"tabbableLink",value:j}]),(re=A==null?void 0:A.querySelector("a"))==null||re.focus()},...N,children:S.name})},S.id||window.btoa(S.name))}),t>Vi&&c.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Vi})})]})})]})]}))},Yl=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},Zi=({children:e,class:t,...n})=>{const r={...n,class:G("subtle",t)};return c.jsx("blockquote",{...r,children:e})},OC=280,PC=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Vn(e,OC):e;a=a.trim();const i=`<br>
|
|
135
|
+
`;case o[Z.hr]:return`---
|
|
136
|
+
`;default:return u}}function In(e,t){const n=e.trim(),r=n,a=`${t}${r}${Vl(t)}`;if(r.length===e.length)return a;const i=t+r+Vl(t);return e.replace(n,i)}const Vl=e=>e.split("").reverse().join(""),Lx=e=>e.map(t=>Ff(t)).join("").trim();const zx=({onFallbackClick:e=()=>{}})=>{const t=ue.useIntl(),n=Sn(),{dispatch:r,isInOverlay:a,mentionPopover:i,id:s,onMention:o}=D.useContext(Qt),{show:l,selectedUser:u,possibleUsers:c}=i,h=df(n,"mention-popover",`toolbar-${s}`);if(!l)return d.jsx(d.Fragment,{});const p=Af(a);return d.jsx(Ua,{parent:p,children:d.jsx(zc,{ref:h,className:"mention-popover",onKeyDown:m=>{m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),r([{type:"showMentionPopover",value:!1}]))},children:d.jsxs("ul",{children:[c.map(({userId:m,user:g},f)=>d.jsx(Cn,{element:"li",className:Y({selected:f===u}),member:{id:m,...g,link:!1},functions:{onClick:y=>{y.preventDefault(),y.stopPropagation();const v={...i,selectedUser:f};r([{type:"mentionPopover",value:v}]),Bf(n,v,r,s),o&&o({id:m||"",name:g.name||""})}}},m)),d.jsx(Cn,{element:"li",className:Y("fallback",{selected:c.length===u}),member:{id:"0",name:t.formatMessage({id:"richTextEditor_mention_fallback"}),image:{thumbnail:`${It}icons/invite-user.svg`},link:!1},functions:{onClick:m=>{m.preventDefault(),m.stopPropagation(),e(),r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])}}})]})})})},xo=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=ue.useIntl(),l=Sn(),{id:u,tabbableOption:c,setFocus:h,openTooltip:p,dispatch:m}=D.useContext(Qt),g={};return e!==c&&(g.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:Y(e,{"has-divider":n}),onMouseEnter:()=>{m([{type:"openTooltip",value:e}])},onMouseLeave:()=>{m([{type:"openTooltip",value:null}])},onFocus:()=>{m([{type:"openTooltip",value:e}])},onBlur:f=>{f.stopPropagation();const y=[{type:"openTooltip",value:null}];l.selection&&y.push({type:"lastAnchor",value:l.selection.anchor}),m(y)},contentEditable:!1,children:[d.jsxs("button",{...s,...g,className:Y(e,a,{active:t}),onClick:f=>{f.stopPropagation(),f.preventDefault()},onMouseDown:f=>{f.stopPropagation(),f.preventDefault(),r()},onKeyDown:f=>{var y,v,k,B;if(f.key!=="Tab")switch(f.key){case"Enter":f.stopPropagation(),f.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":f.stopPropagation(),f.preventDefault();const C=f.currentTarget.closest("li");let w=C==null?void 0:C.nextElementSibling;if(f.key==="ArrowLeft"){const q=C==null?void 0:C.previousElementSibling;q?w=q:w=(y=C==null?void 0:C.parentElement)==null?void 0:y.lastElementChild}else w||(w=(v=C==null?void 0:C.parentElement)==null?void 0:v.firstElementChild);const T=w==null?void 0:w.className.split(" ")[0];T&&(h(T),(k=w==null?void 0:w.querySelector("button"))==null||k.focus());break;default:const S=f.currentTarget.closest("fieldset");if(S){(B=S==null?void 0:S.previousElementSibling)==null||B.focus();break}}},children:[d.jsx(Ie,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(An,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:p===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},Kl=[Z.ol,Z.ul],Tf=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(b.nodes(e,{at:b.unhangRange(e,n),match:a=>{const i=a;return!b.isEditor(a)&&de.isElement(a)&&i.type===t}}));return!!r},qx=e=>{const[t]=b.nodes(e,{match:n=>n.type===Z.blockquote});return!!t},Sf=(e,t,n)=>{try{const r=qx(e),a=Tf(e,t),i=Kl.includes(t);X.unwrapNodes(e,{match:l=>{const u=l;return!b.isEditor(u)&&de.isElement(u)&&Kl.includes(u.type)},split:!0});const o={type:a?Z.paragraph:i?Z.li:t};if(X.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,c]=b.parent(e,l,{edge:"end"});Array.from(b.nodes(e,{at:c,match:p=>{const m=p;return!b.isEditor(p)&&de.isElement(p)&&m.type===Z.li}})).forEach(([p,m])=>{oe.string(p).trim()===""&&X.removeNodes(e,{at:m})})}else{if(r){const u={type:Z.blockquote,children:[]};X.wrapNodes(e,u)}const l={type:t,children:[]};X.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},Wx=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=D.useContext(Qt),a=Sn(),i=Tf(a,e);return d.jsx(xo,{id:e,active:i,hasDivider:t,callback:()=>{Sf(a,e,r),n(i?null:e)}})},Er=e=>{const[t]=b.nodes(e,{match:n=>{const r=n;return!b.isEditor(n)&&de.isElement(n)&&r.type===Z.link}});return!!t},Hx=(e,t,n,r)=>{e.selection&&Co(e,t,n,r)},Ux=(e,t,n,r)=>{const{selection:a}=e;if(a&&K.isCollapsed(a)){const[s]=b.nodes(e,{match:o=>{const l=o;return!b.isEditor(o)&&de.isElement(o)&&l.type===Z.link}});if(s){const[o,l]=s,u={link:t};X.setNodes(e,u,{at:l}),Do(n)}}else Co(e,t,n,r)},Co=(e,t,n,r=a=>{console.error(a)})=>{try{Er(e)&&jf(e);const{selection:a}=e,i=a&&K.isCollapsed(a),s={type:Z.link,link:t,children:i?[{text:t}]:[]};i?(X.insertNodes(e,s),X.move(e,{distance:1,unit:"offset"})):(X.wrapNodes(e,s,{split:!0}),X.collapse(e,{edge:"end"}),X.insertNodes(e,{text:""}),X.move(e,{distance:1,unit:"offset"})),Do(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},jf=e=>{X.unwrapNodes(e,{match:t=>{const n=t;return!b.isEditor(t)&&de.isElement(t)&&n.type===Z.link}})};let $i=null;const Vx=()=>{const e=ue.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,isInOverlay:a,dispatch:i,reportError:s}=D.useContext(Qt),o=Sn(),l=s1(o),u=(l==null?void 0:l.text)||Rx(o),[c,h]=D.useState(Er(o)),p=df(o,"link-editor",`${n}-link`),m=D.useRef(null);D.useEffect(()=>{var k;!c&&r&&((k=m.current)==null||k.focus())},[c]),D.useEffect(()=>{$i&&clearTimeout($i),$i=setTimeout(()=>{h(Er(o))},500)},[o.selection]);const g=[],f=["open","edit","remove"].map(k=>{const B={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${k}`},{link:l==null?void 0:l.pretty})};switch(g.push({className:k}),k){case"open":B.href=(l==null?void 0:l.full)||"",B.onClick=C=>{C.preventDefault(),C.stopPropagation(),window.open((l==null?void 0:l.full)||"","_blank"),i([{type:"showLinkEditor",value:!1}])},B.children=d.jsxs(d.Fragment,{children:[B.children,d.jsx(Ie,{children:e.formatMessage({id:`${t}${k}_text`})})]});break;case"edit":B.onClick=()=>{h(!1)};break;case"remove":B.onClick=()=>{const C=[{type:"showLinkEditor",value:!1}];Er(o)&&(jf(o),C.push({type:"lastAnchor",value:null})),i(C)};break}return B}),y=[{id:"url",type:"url",inputRef:m,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(l==null?void 0:l.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];u&&y.unshift({component:()=>d.jsxs("p",{children:[d.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",u]})});const v=Af(a);return d.jsx(Ua,{parent:v,children:d.jsx(An,{ref:p,id:`${n}-link-editor`,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!c},functions:{onBlur:()=>{i([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var k;return(k=m.current)==null?void 0:k.focus()})}},children:c?d.jsx(rr,{wrappers:g,buttons:f}):d.jsx(Tn,{element:"fieldset",id:`${n}-link-editor`,className:Y({"show-labels":u}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async k=>{setTimeout(()=>{const B=[{type:"showLinkEditor",value:!1}];if(k.url){const{full:C}=Lc(k.url);l!=null&&l.full?Ux(o,C,n,s):Hx(o,C,n,s),B.push({type:"lastAnchor",value:null})}i(B)})}},fields:y,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},Kx=()=>{const e=Sn(),{setFocus:t,dispatch:n}=D.useContext(Qt),[r,a]=D.useState(!1);return D.useEffect(()=>{a(Er(e))},[e.selection]),d.jsx(xo,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},Zx=e=>[Z.bold,Z.italic,Z.strikethrough].includes(e),Of=(e,t)=>{const n=b.marks(e);return n?n[t]===!0:!1},Pf=(e,t,n)=>{try{Of(e,t)?b.removeMark(e,t):b.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},Yx=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=D.useContext(Qt),a=Sn(),i=Of(a,e);return d.jsx(xo,{id:e,active:i,hasDivider:t,callback:()=>{Pf(a,e,r),n(i?null:e)}})},Ta=[Z.bold,Z.italic,Z.strikethrough],Gx=[Z.ol,Z.ul,Z.blockquote];const Qx=({...e})=>{const t=ue.useIntl(),{id:n}=D.useContext(Qt);return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{id:`toolbar-${n}`,className:"toolbar",...e,children:[d.jsx(Ie,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[Ta.map((r,a)=>d.jsx(Yx,{format:r,hasDivider:a===Ta.length-1},r)),d.jsx(Kx,{}),Gx.map((r,a)=>d.jsx(Wx,{format:r,hasDivider:a===1},r))]})]}),d.jsx(Vx,{})]})};var Jx=nC,Xx=/^(?:\w+:)?\/\/(\S+)$/,eC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,tC=/^[^\s\.]+\.\S{2,}$/;function nC(e){if(typeof e!="string")return!1;var t=e.match(Xx);if(!t)return!1;var n=t[1];return n?!!(eC.test(n)||tC.test(n)):!1}const rC=Bn(Jx),aC=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[Z.link].includes(s.type)||a(i)},e.insertText=i=>{i&&rC(i)?Co(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},iC=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===Z.mention?!0:n(i),e.isVoid=i=>i.type===Z.mention?!0:r(i),e.markableVoid=i=>i.type===Z.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},sC=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===Z.link&&oe.string(r).trim()===""){X.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const Nf=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,meta:a,functions:i,autoFocus:s,data:o,...l})=>{const u=ue.useIntl(),c=Lh();typeof s>"u"&&(s=!0);const{isInOverlay:h=!1}=a||{},{listMembers:p,clickMentionFallback:m,onChange:g=()=>{},onMention:f=()=>{},reportError:y=$=>{console.error($)}}=i||{},v=[{type:Z.paragraph,children:[{text:""}]}];t==="<br>"&&(t="");const k={editorKey:null,originalValue:t||"",initialValue:t?null:v,tabbableOption:Ta[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null,numberOfUsers:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1,hasLoaded:!1},[B,C]=D.useReducer(Ir,k),{editorKey:w,originalValue:T,initialValue:S,stringValue:q,lastAnchor:P,lastKey:L,hasInteracted:z,hasLoaded:E,mentionPopover:A}=B,N=$=>{const W=$||Ta[0];$&&C([{type:"tabbableOption",value:W}])},R=`rte-${e}`,H=D.useCallback($=>d.jsx(a1,{...$}),[]),G=D.useCallback($=>d.jsx(i1,{...$}),[]),Q=D.useMemo(()=>aC(iC(sC(Uv(n1(Wv())),y),y),R,y),[]);D.useEffect(()=>{if(!t)return;Br.lastIndex=0;const $=t.match(Br);!$||$.length>1||$[0].length!==t.length||z||C([{type:"originalValue",value:t}])},[t]);const re=$=>{if(!Q||$!==R)return;const W=b.end(Q,[]);X.select(Q,W),ee.focus(Q)};D.useEffect(()=>{const $=W=>{var I;const _=W,F=((I=_==null?void 0:_.detail)==null?void 0:I.id)||null;F&&re(F)};return window.addEventListener("focusEditor",$),()=>{window.removeEventListener("focusEditor",$)}},[]),D.useEffect(()=>{if(Q.children.length>0&&!E){if(C([{type:"hasLoaded",value:!0}]),!s)return;re(R)}},[Q.children.length,S]),D.useEffect(()=>{T&&(async()=>{let W=vn(T);if(W.includes("<")){Fr.prototype.escape=F=>F;const _=new Fr;_.addRule("br",{filter:["br"],replacement:F=>F+`
|
|
137
137
|
|
|
138
|
-
`;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await Mc({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const NC=3e3,RC=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ue.useIntl(),[r,a]=D.useState({isOpen:!1,isCopied:!1});return c.jsxs("li",{children:[c.jsx(_n,{className:G("tooltip-share-link",{"tooltip-share-link-copied":r.isCopied}),isOpen:r.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:r.isCopied?n.formatMessage({id:"discussion_share_copy_link_success"}):n.formatMessage({id:"discussion_share_copy_link"})}),c.jsx(ja,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>a({...r,isOpen:!0}),onFocus:()=>a({...r,isOpen:!0}),onMouseOut:()=>a({isOpen:!1,isCopied:!1}),onBlur:()=>a({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{a({isOpen:!0,isCopied:!0}),setTimeout(()=>{a({isOpen:!1,isCopied:!1})},NC)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event})]})},Wt="discussion_",MC=195,Lr=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,forceHide:i={actionBar:!1,comments:!1,likes:!1},functions:s,links:o={},className:l,gtmContext:u="DiscussionAnswer",children:d,isTruncated:h=!1,styling:{showShareLinkButton:p=!1}={},setFocus:m=!1,isCommunity:g=!1})=>{var Ae,we,Fe,Se,Le,Je,je,He;const f=ue.useIntl(),x=D.useContext($t),b=D.useContext(ni),{createContent:_=async()=>{},deleteContent:k=async()=>{},updateContent:w=async()=>{}}=s.content||{},{createLike:C=()=>{},deleteLike:F=()=>{}}=s.likes||{},{openComments:S=()=>{}}=s.comments||{},{listMembers:z=()=>Promise.resolve([]),clickMentionFallback:N=()=>{}}=s.mentions||{},{author:$,canLike:L,createdAt:E,id:A,likes:j=0,userLiked:I,comments:H=0,mentions:q}=t,re=x&&x.id&&typeof $!="string"&&$.id&&$.id===x.id||!1,ne=typeof L=="boolean"?L:!0,v=re&&(!t.createdAt||Nh(t.createdAt,10,"seconds")),W=D.useRef(null),[V,B]=D.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[T,R]=D.useState(!1),[M,K]=D.useState(v?"highlighted":"default"),[ee,te]=D.useState("");D.useEffect(()=>{const ge=W.current;if(!(!ge||M==="default"))return document.addEventListener("discussionFormSubmitted",ae),ge.addEventListener("transitionend",le),()=>{document.removeEventListener("discussionFormSubmitted",ae),ge.removeEventListener("transitionend",le)}},[]),D.useEffect(()=>{B({...V,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),D.useEffect(()=>{(async()=>{const U=await PC(V.body,h,q,z);B({...V,postBody:U})})()},[V.body,q]);const ae=()=>{setTimeout(()=>{K("fading")},1e3)},le=({propertyName:ge})=>{ge==="background-color"&&K(U=>(U==="default"&&(document.removeEventListener("discussionFormSubmitted",ae),W.current&&W.current.removeEventListener("transitionend",le)),U==="fading"?"default":U))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||V.postBody===""&&t.title==="")return c.jsx(Et,{className:"discussion-card"});const J=async({title:ge,body:U})=>{ge||(ge=""),U||(U=""),te("");try{if(!as(ge,V.title)||!as(U,V.body)){const ie=t.type==="question"?{title:U}:{title:ge,body:U};await w(Yl(t.slugs),ie)}B({...V,title:ge,body:U,isEditing:!1,didEdit:!0})}catch{te(`${Wt}form_error`)}},pe=()=>{if(b&&b.updateConversation){const ge={showForm:!0},U=t.author;U&&U.id&&(g&&(ge.prepopulateForm=`@{{${U.id}}}`),ge.mentionData={id:U.id,name:U.name}),b.updateConversation(ge)}setTimeout(()=>{var ve,Ee,Ve;const U=`reply-form-${(t.type==="answer"?t.slug:((ve=t.slugs)==null?void 0:ve.reply)||((Ee=t.slugs)==null?void 0:Ee.answer)||((Ve=t.slugs)==null?void 0:Ve.question)||"").toLowerCase().slice(-15)}`,ie=document.getElementById(U),me=document.getElementById(`${U}-input`);me&&me.focus(),ie&&ie.scrollIntoView({behavior:"smooth"})},0)},he=async()=>{R(!1);try{await k(Yl(t.slugs))}catch{te("delete-error")}},Ce=[{text:f.formatMessage({id:`${Wt}moreMenu_report`}),onClick:ge=>{ge.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(f.formatMessage({id:`${Wt}report_subject`}))}&body=${encodeURI(f.formatMessage({id:`${Wt}report_body`},{contentType:t.type||"",contentSlug:t.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}))}`,icon:"flag"}];return n&&re&&Ce.push({text:f.formatMessage({id:`${Wt}moreMenu_edit`}),onClick:()=>B({...V,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`edit-${t.type}-click`},{text:f.formatMessage({id:`${Wt}moreMenu_delete`}),onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),R(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`delete-${t.type}-click`,...ch(`delete-${t.slug}-modal`,T)}),m&&((Ae=W==null?void 0:W.current)==null||Ae.focus(),(we=W==null?void 0:W.current)==null||we.scrollIntoView({behavior:"smooth"})),D.createElement(e,{className:G("discussion-post",l,{[M]:!l||!l.includes("highlighted-text-box"),"has-link":o.post&&!V.isEditing}),ref:W,tabIndex:m?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${u}-post-click`,onClick:ge=>{!o.post||V.isEditing||(ge.preventDefault(),ge.stopPropagation(),window.location.href=o.post)},children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{id:A||t.slug,className:G("discussion-card",t.type,{editing:V.isEditing,"has-link":o.post&&!V.isEditing}),children:[!V.isEditing&&c.jsx(Dn,{member:$,additionalContent:{createdAt:E,didEdit:V.didEdit},className:typeof $!="string"&&$.id===a?"highlighted":"",gtmContext:u,gtmType:"profile-click"}),V.isEditing?c.jsx($r,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,hasTitleField:V.title!==""?{text:V.title}:!1,isEditing:{text:V.body},isPrepopulated:!1},isCommunity:g,maxLength:t.type==="question"?250:5e4,forceShow:{error:ee!==""&&ee!=="delete-error"?f.formatMessage({id:ee},{action:f.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:_,handleSaveEdit:J,handleCancel:()=>{te(""),B({...V,isEditing:!1})},listMembers:z,clickMentionFallback:N},gtmContext:`${u}Form`,data:{mentions:t.mentions}}):o.post?c.jsxs("a",{href:o.post,children:[(V==null?void 0:V.title)&&c.jsx("p",{className:"content-title",children:V==null?void 0:V.title}),V.postBody.length>MC?c.jsx(Wc,{text:V.postBody,markdownOptions:{overrides:{a:cs,blockquote:{component:Zi}}}}):c.jsx(Zn,{options:{overrides:{a:cs,blockquote:{component:Zi}}},children:V.postBody})]}):c.jsxs(c.Fragment,{children:[(V==null?void 0:V.title)&&c.jsx("p",{className:"content-title",children:V==null?void 0:V.title}),c.jsx(Zn,{options:{wrapper:t.type==="question"?"h1":D.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:Zi}}},children:V.postBody})]}),!V.isEditing&&!(i!=null&&i.actionBar)&&c.jsxs("ul",{className:G("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!i.likes&&c.jsx(qf,{element:"li",likes:j,isShort:!1,userLiked:I,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:ne,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:C,deleteLike:F}}),!i.comments&&(["question","post"].includes(t.type)||o.comments)&&c.jsx("li",{children:c.jsx(ja,{onClick:ge=>{ge.preventDefault(),ge.stopPropagation(),o.comments&&(window.location.href=o.comments),typeof S=="function"&&S()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":u,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:f.formatMessage({id:`${Wt}comments_screenReader`},{count:H}),children:f.formatMessage({id:`${Wt}comments`},{count:H})})}),(t.type==="answer"||t.type==="reply")&&c.jsx("li",{children:c.jsx(ja,{styling:{muted:!0},onClick:pe,icon:{icon:"speech-bubble_square"},children:f.formatMessage({id:`${Wt}reply`})})}),p&&c.jsx(RC,{url:(Fe=t.slugs)!=null&&Fe.reply?`${window.location.origin}${(Se=t.slugs)==null?void 0:Se.question}/${(Le=t.slugs)==null?void 0:Le.answer}#${(Je=t.slugs)==null?void 0:Je.reply}`:`${window.location.origin}${(je=t.slugs)==null?void 0:je.question}/${(He=t.slugs)==null?void 0:He.answer}`,gtm:{context:u,event:`copy-link-${t.type}-click`}}),c.jsx(Xc,{element:"li",id:`more-${t.slug}`,options:Ce})]})]}),d,c.jsx(ir,{id:`delete-${t.slug}-modal`,isOpen:T,functions:{onOpen:()=>{},onClose:()=>R(!1)},forceShow:{error:ee==="delete-error"?f.formatMessage({id:"discussion_delete_error"},{action:f.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:f.formatMessage({id:"discussion_delete_title"},{action:f.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>R(!1),children:f.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:he,children:f.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:c.jsx(ue.FormattedMessage,{id:"discussion_delete_text",values:{p:ge=>c.jsx("p",{children:ge}),action:f.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Yi="discussion_responses_",Wf=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ue.useIntl();return t=parseInt(t),c.jsxs("div",{className:"responses-heading",children:[c.jsx("h4",{children:r.formatMessage({id:`${Yi}title`},{action:r.formatMessage({id:`${Yi}${e}`}),count:t})}),!n&&t===0&&c.jsx("p",{children:_t(r.formatMessage,`${Yi}empty`,e,e)})]})};const Hf=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ue.useIntl(),s=D.useContext(ni),o=ca(a,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return c.jsxs("div",{className:G("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&c.jsx("ul",{className:"thread",children:o}),!e&&c.jsx(Mr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&c.jsx($r,{...r})]})},IC="post",$C="reply",Uf="00000000-0000-0000-0000-000000000000";function ko({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function _o({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 LC(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function zC(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Vf(e){const{id:t="",name:n="",organization:r="",jobTitle:a="",image:i={}}=e,{thumbnail:s=""}=i;return{id:t,data:{name:n,organization:r,jobTitle:a,thumbnail:s}}}function qC({title:e,content:t}){return{title:e,content:t,id:Uf,time:new Date().toISOString(),verb:IC}}function Gl({activity:e,user:t}){return{...e,actor:Vf(t),...LC()}}function Oa({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((a=e.own_reactions)==null?void 0:a.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function Kf({activity:e,user:t}){var n,r,a;e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like-1:0},t!=null&&t.id&&(e.latest_reactions={...e.latest_reactions||{},like:(((r=e.latest_reactions)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_reactions={...e.own_reactions||{},like:(((a=e.own_reactions)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}function WC({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Uf,kind:$C,parent:t||""}}function Ql({reply:e,user:t}){const n=Vf(t);return{...e,user_id:n.id,user:n,...zC()}}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 HC({reply:e,user:t}){var n,r,a;e.children_counts={...e.children_counts||{},like:(n=e.children_counts)!=null&&n.like?e.children_counts.like-1:0},t!=null&&t.id&&(e.latest_children={...e.latest_children||{},like:(((r=e.latest_children)==null?void 0:r.like)||[]).filter(({user_id:i})=>i!==t.id)},e.own_children={...e.own_children||{},like:(((a=e.own_children)==null?void 0:a.like)||[]).filter(({user_id:i})=>i!==t.id)})}const Zf=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let Xl,Gi=0;const Yf=()=>{D.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"}),Gi=0;return}Gi++,!(Gi>10)&&(Xl=setTimeout(()=>{e(t)},50))}},Jn=Object.freeze({id:"some-user-id-1",name:"some user name 1",organization:"some user organization 1",jobTitle:"some user job title 1",image:{thumbnail:"https://some-user-thumbnail.com/avatar1.png"},isLoading:!1}),sn=Object.freeze({id:"some-user-id-2",name:"some user name 2",organization:"some user organization 2",jobTitle:"some user job title 2",image:{thumbnail:"https://some-user-thumbnail.com/avatar2.png"},isLoading:!1}),Gf=Object.freeze({actor:`SU:${Jn.id}`,content:"some content 1",duration:"5.53ms",feed_id:"some-feed-id-1",foreign_id:"post:some-foriegn-id-1",id:"some-activity-id-1",object:"comment",time:"2023-11-24T17:52:36.162000",verb:"post"}),UC=Object.freeze({actor:`SU:${sn.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"}),VC=Object.freeze({actor:`SU:${Jn.id}`,content:"some content 3",duration:"5.53ms",feed_id:"some-feed-id-3",foreign_id:"post:some-foriegn-id-3",id:"some-activity-id-3",object:"comment",time:"2023-11-24T17:56:36.162000",verb:"post"}),KC=Object.freeze({actor:`SU:${sn.id}`,content:"some content 4",duration:"5.53ms",feed_id:"some-feed-id-4",foreign_id:"post:some-foriegn-id-4",id:"some-activity-id-4",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"});Object.freeze({id:"some-reaction-id-1",activity_id:Gf.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:sn.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:sn.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:sn.id,user:{id:sn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Gf.id,data:{content:"Some content 1..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-2",user_id:Jn.id,user:{id:Jn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:UC.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:sn.id,user:{id:sn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:VC.id,data:{content:"Some content 3..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Jn.id,user:{id:Jn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:KC.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function ZC({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ze.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Gl({activity:qC(o),user:i});return ec(u,l)}),onError:n,onSuccess:(o,l,u)=>{const d=Gl({activity:o,user:i});r.setQueryData(a,ec(d,u,!0)),setTimeout(()=>{Zf(d.id)},0)}});return s}function YC({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ze.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Pa(a,s);return o&&(o.content=i),s}),onError:n});return r}function GC({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ze.useQueryClient(),l=Ka(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:ko(u),mutate:_o(u)},user:l,...u},h=ZC({...d,mutationFn:e}),p=YC({...d,mutationFn:t}),m=QC({...d,mutationFn:n}),g=XC({...d,mutationFn:a}),f=ew({...d,mutationFn:i}),{activities:x,...b}=JC({queryKey:s,queryFn:r});return{activities:x,mutations:{create:h,edit:p,remove:g,like:m,unlike:f},user:l,...b}}function QC({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ze.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Pa(s,o);return l&&Oa({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Pa(o,l);u&&Oa({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function JC({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ze.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{activities:nw(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function XC({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ze.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>tw(a,i)),onError:n});return r}function ew({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ze.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Pa(i,s);return o&&Kf({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 Pa(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function tw(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 nw(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const rw=({basePath:e,parentId:t,isMember:n,functions:{activities:r,mentions:a,join:i,leave:s}})=>{const o=ue.useIntl(),{activities:l,error:u,fetchNextPage:d,hasNextPage:h,isLoading:p,mutations:{create:m,edit:g,remove:f,like:x,unlike:b}}=GC({queryKey:[e,t,"activities"],queryFns:r}),[_,k]=D.useState(null),w=()=>{k(l.length),d()};return Yf(),u?c.jsx(on,{variant:"error",text:u.message}):c.jsxs("section",{children:[c.jsx(Eo,{isCard:!0,form:{content:{type:"post",slugs:{}},functions:{create:m,...a},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),l==null?void 0:l.map((C,F)=>{var q,re,ne,v,W,V,B,T;const{id:S,own_reactions:z,latest_reactions:N,reaction_counts:$,mentioned_users:L}=C,E=(((q=N==null?void 0:N.like)==null?void 0:q.length)||0)>0,A=(((re=z==null?void 0:z.like)==null?void 0:re.length)||0)>0,j=A?z==null?void 0:z.like[0].id:"",I=E?(ne=N==null?void 0:N.like)==null?void 0:ne.map(R=>{var M,K,ee;return{id:(M=R==null?void 0:R.user)==null?void 0:M.id,name:(ee=(K=R==null?void 0:R.user)==null?void 0:K.data)==null?void 0:ee.name}}):!1,H=C==null?void 0:C.actor;return c.jsx(D.Fragment,{children:c.jsx(Lr,{content:{type:"post",title:C==null?void 0:C.title,body:C==null?void 0:C.content,canLike:n,createdAt:(C==null?void 0:C.time)||"",slugs:{question:`${e}/${t}`,answer:S},slug:S,author:{id:H==null?void 0:H.id,name:(v=H==null?void 0:H.data)==null?void 0:v.name,organization:(W=H==null?void 0:H.data)==null?void 0:W.organization,jobTitle:(V=H==null?void 0:H.data)==null?void 0:V.jobTitle,location:(B=H==null?void 0:H.data)==null?void 0:B.location,image:{thumbnail:((T=H==null?void 0:H.data)==null?void 0:T.thumbnail)||void 0}},userLiked:A,likes:($==null?void 0:$.like)||0,comments:($==null?void 0:$.reply)||0,peopleWhoLiked:I,mentions:L},links:{post:`${e}/${t}/${S}`,comments:`${e}/${t}/${S}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>f({activityId:S}),updateContent:(R,{body:M})=>g({activityId:S,content:M})},likes:{createLike:()=>x({activityId:S}),deleteLike:()=>b({activityId:S,reactionId:j})},comments:{openComments:()=>null},mentions:a},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:F===_})},S)}),!p&&c.jsx(Mr,{hasNextPage:h,loadNextPage:w,icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})},aw={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 iw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ze.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Ql({reply:WC(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 d=Ql({reply:o,user:i});r.setQueryData(a,tc(d,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Zf(d.id)},0)}});return s}function sw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ze.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Na(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Qf({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ze.useQueryClient(),l=Ka(),u={queryClient:o,queryKey:s},d={mutationHandlers:{error:ko(u),mutate:_o(u)},user:l,...u},h=iw({...d,mutationFn:e}),p=sw({...d,mutationFn:t}),m=ow({...d,mutationFn:n}),g=lw({...d,mutationFn:a}),f=cw({...d,mutationFn:i}),{replies:x,...b}=uw({queryKey:s,queryFn:r});return{replies:x,mutations:{create:h,edit:p,remove:g,like:m,unlike:f},user:l,...b}}function ow({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ze.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Na(s,o);return l&&Jl({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Na(o,l);u&&Jl({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function uw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ze.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=pw(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function lw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ze.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>mw(a,i)),onError:n});return r}function cw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ze.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Na(i,s);return o&&HC({reply:o,user:r}),s}),onError:n});return a}function dw(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function fw(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 hw(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?fw(e,t,n):hw(e,t,n):dw(e)}function Na(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function mw(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function pw(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=ue.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:d,isLoading:h,mutations:{create:p,edit:m,like:g,remove:f,unlike:x},user:b}=Qf({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:w=>i.list({...w,reactionId:r})}});Is([h]);const[_,k]=D.useState(!0);return c.jsxs(c.Fragment,{children:[(l==null?void 0:l.length)>=o&&c.jsx(_e,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${_?"up_left":"down_right"}`,position:"left"},onClick:()=>k(!_),children:s.formatMessage({id:`discussion_thread_${_?"hide":"show"}`},{count:l==null?void 0:l.length})}),_&&c.jsx(Hf,{loadMore:{isLoading:h,hasNextPage:d,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(w,{body:C})=>p({activityId:n,replyId:r,content:C}),listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(w=>{var re,ne,v,W,V,B,T,R,M,K,ee,te;const{id:C,own_children:F,latest_children:S,children_counts:z,data:{mentioned_users:N}}=w,L=(((re=F==null?void 0:F.like)==null?void 0:re.length)||0)>0?(ne=F==null?void 0:F.like)==null?void 0:ne.find(ae=>{var le;return((le=ae==null?void 0:ae.user)==null?void 0:le.id)===(b==null?void 0:b.id)}):!1,E=L?L==null?void 0:L.id:"",A=!!L,I=(((v=S==null?void 0:S.like)==null?void 0:v.length)||0)>0?(W=S==null?void 0:S.like)==null?void 0:W.map(ae=>{var le,J,pe;return{id:(le=ae==null?void 0:ae.user)==null?void 0:le.id,name:(pe=(J=ae==null?void 0:ae.user)==null?void 0:J.data)==null?void 0:pe.name}}):!1,H=w==null?void 0:w.user,q=typeof w.data.content=="string"?(V=w==null?void 0:w.data)==null?void 0:V.content:((T=(B=w==null?void 0:w.data)==null?void 0:B.content)==null?void 0:T.text)||"";return c.jsx(Lr,{isCommunity:!0,content:{id:C,type:"reply",body:q,canLike:a,createdAt:w==null?void 0:w.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:w==null?void 0:w.parent},slug:"",author:{id:H==null?void 0:H.id,name:(R=H.data)==null?void 0:R.name,organization:(M=H.data)==null?void 0:M.organization,jobTitle:(K=H.data)==null?void 0:K.jobTitle,location:(ee=H.data)==null?void 0:ee.location,image:{thumbnail:((te=H.data)==null?void 0:te.thumbnail)||void 0}},userLiked:A,likes:(z==null?void 0:z.like)||0,peopleWhoLiked:I,mentions:N},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:C}),updateContent:(ae,{body:le})=>m({replyId:C,content:le})},likes:{createLike:()=>g({replyId:C}),deleteLike:()=>x({replyId:C,reactionId:E})},comments:{},mentions:{listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback}},styling:{showShareLinkButton:!0}},C)}):null})]})};const Jf=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,mentions:i,join:s,leave:o}})=>{const l=ue.useIntl(),{replies:u,repliesCount:d,fetchNextPage:h,hasNextPage:p,isLoading:m,mutations:{create:g,edit:f,like:x,remove:b,unlike:_},user:k}=Qf({queryKey:[e,t,n,"replies"],queryFns:a}),w=()=>{F(u.length),h()},[C,F]=D.useState(null);return Is([m]),Yf(),c.jsxs("section",{className:"replies-feed",children:[c.jsx(Wf,{type:"comment",responses:d,isLoading:m}),c.jsx(Eo,{form:{content:{type:"reply",slugs:{}},functions:{create:(S,{body:z})=>g({activityId:n,content:z}),...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:l.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:s,leave:o,notMemberStateText:l.formatMessage({id:"community_joinToPost"})}}),u==null?void 0:u.map((S,z)=>{var V,B,T,R,M,K,ee,te,ae,le,J,pe;const{id:N,own_children:$,latest_children:L,children_counts:E,data:{mentioned_users:A}}=S,I=(((V=$==null?void 0:$.like)==null?void 0:V.length)||0)>0?(B=$==null?void 0:$.like)==null?void 0:B.find(he=>{var Ce;return((Ce=he==null?void 0:he.user)==null?void 0:Ce.id)===(k==null?void 0:k.id)}):!1,H=I?I==null?void 0:I.id:"",q=!!I,ne=(((T=L==null?void 0:L.like)==null?void 0:T.length)||0)>0?(R=L==null?void 0:L.like)==null?void 0:R.map(he=>{var Ce,Ae,we;return{id:(Ce=he==null?void 0:he.user)==null?void 0:Ce.id,name:(we=(Ae=he==null?void 0:he.user)==null?void 0:Ae.data)==null?void 0:we.name}}):!1,v=S==null?void 0:S.user,W=typeof S.data.content=="string"?(M=S==null?void 0:S.data)==null?void 0:M.content:((ee=(K=S==null?void 0:S.data)==null?void 0:K.content)==null?void 0:ee.text)||"";return c.jsx(zf,{children:c.jsx(Lr,{isCommunity:!0,content:{id:N,type:"reply",body:W,canLike:r,createdAt:S==null?void 0:S.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:N},slug:N,author:{id:v==null?void 0:v.id,name:(te=v.data)==null?void 0:te.name,organization:(ae=v.data)==null?void 0:ae.organization,jobTitle:(le=v.data)==null?void 0:le.jobTitle,location:(J=v.data)==null?void 0:J.location,image:{thumbnail:((pe=v.data)==null?void 0:pe.thumbnail)||void 0}},userLiked:q,likes:(E==null?void 0:E.like)||0,peopleWhoLiked:ne,mentions:A},functions:{content:{createContent:()=>null,deleteContent:()=>b({replyId:N}),updateContent:(he,{body:Ce})=>f({replyId:N,content:Ce})},likes:{createLike:()=>x({replyId:N}),deleteLike:()=>_({replyId:N,reactionId:H})},comments:{},mentions:i},children:c.jsx(gw,{basePath:e,parentId:t,activityId:n,replyId:N,isMember:r,functions:{...a,...i}}),styling:{showShareLinkButton:!0},setFocus:z===C},N)},N)}),!m&&c.jsx(Mr,{hasNextPage:p,loadNextPage:w,icon:{icon:"arrow-down",position:"right"},messages:{button:l.formatMessage({id:"loadMore_button"}),error:l.formatMessage({id:"loadMore_error"})}})]})};function vw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ze.useMutation({mutationFn:e,onMutate:({content:a,title:i})=>t(s=>(s&&(a!=null&&(s.content=a),i!=null&&(s.title=i)),s)),onError:n});return r}function bw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=Ze.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function yw({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=Ze.useQueryClient(),s=Ka(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:ko(o),mutate:_o(o)},user:s,...o},u=vw({...l,mutationFn:t}),d=Dw({...l,mutationFn:n}),h=xw({...l,mutationFn:r}),{activity:p,...m}=bw({queryKey:a,queryFn:e});return{activity:p,mutations:{edit:u,like:d,unlike:h},user:s,...m}}function Dw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ze.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Oa({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Oa({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function xw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ze.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Kf({activity:s,user:r}),s)),onError:n});return a}const Cw=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,mentions:o,join:l,leave:u}})=>{var N,$,L,E,A,j,I,H,q,re;const d=ue.useIntl(),{activity:h,error:p,isLoading:m,mutations:{edit:g,like:f,unlike:x}}=yw({queryFns:i,queryKey:[e,t,n]});if(m)return c.jsx(Et,{style:{height:"400px"}});if(p||!h)return c.jsx(on,{variant:"error",text:d.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:b,latest_reactions:_,mentioned_users:k}=h,w=(((N=_==null?void 0:_.like)==null?void 0:N.length)||0)>0,C=((($=b==null?void 0:b.like)==null?void 0:$.length)||0)>0,F=C?b==null?void 0:b.like[0].id:"",S=w?(L=_==null?void 0:_.like)==null?void 0:L.map(ne=>{var v,W,V;return{id:(v=ne==null?void 0:ne.user)==null?void 0:v.id,name:(V=(W=ne==null?void 0:ne.user)==null?void 0:W.data)==null?void 0:V.name}}):!1,z=h==null?void 0:h.actor;return c.jsxs("section",{className:"activity-section",children:[c.jsx(Lr,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:h==null?void 0:h.title,body:h==null?void 0:h.content,canLike:r,createdAt:(h==null?void 0:h.time)||"",slugs:{question:`${e}/${t}`,answer:h==null?void 0:h.id},slug:n,author:{id:z.id,name:(E=z.data)==null?void 0:E.name,organization:(A=z.data)==null?void 0:A.organization,jobTitle:(j=z.data)==null?void 0:j.jobTitle,location:(I=z.data)==null?void 0:I.location,image:{thumbnail:((H=z.data)==null?void 0:H.thumbnail)||void 0}},userLiked:C,likes:((q=h==null?void 0:h.reaction_counts)==null?void 0:q.like)||0,comments:((re=h==null?void 0:h.reaction_counts)==null?void 0:re.reply)||0,peopleWhoLiked:S,mentions:k},originalAuthorId:z==null?void 0:z.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(ne,{title:v,body:W})=>g({title:v,content:W})},likes:{createLike:()=>f({activityId:n}),deleteLike:()=>x({activityId:n,reactionId:F})},comments:{openComments:()=>{}},mentions:o},styling:{showShareLinkButton:!0}},n),c.jsx(Jf,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,mentions:o,join:l,leave:u}})]})};var Ps={exports:{}},aa={exports:{}},Ne={};/** @license React v16.13.1
|
|
138
|
+
`}),W=_.turndown(W)}o&&o.mentions&&(W=await $c({text:W,template:`[${As}{{name}}]({{id}})`,mentions:o.mentions,listMembers:p||(()=>Promise.resolve([]))})),Px(W,_=>{C([{type:"initialValue",value:_},{type:"editorKey",value:T.toString()}]),setTimeout(()=>{C([{type:"stringValue",value:Wl(Q)}])},150)})})()},[T]),D.useEffect(()=>{t!==""||!Q||is(T,t)&&!z||(b.withoutNormalizing(Q,()=>{X.delete(Q,{at:{anchor:b.start(Q,[]),focus:b.end(Q,[])}}),X.deselect(Q),Q.children.length!==0&&X.unwrapNodes(Q,{at:[0]}),X.insertNodes(Q,v,{at:[0]})}),C([{type:"initialValue",value:v},{type:"lastAnchor",value:null}]))},[t]);const x=_c(()=>{Ix({editor:Q,isShowing:A.show,numberOfUsers:A.numberOfUsers,listMembers:p,dispatch:C})},100);return S?d.jsx("div",{id:R,className:"rich-text-editor",children:d.jsxs(Qt.Provider,{value:{...B,id:R,isInOverlay:h,setFocus:N,dispatch:C,onMention:f,reportError:y},children:[d.jsxs(e1,{editor:Q,initialValue:S,onChange:$=>{if(Q.operations.some(_=>_.type!=="set_selection")){const _=Lx($);g(_),C([{type:"stringValue",value:Wl(Q)}]),z||C([{type:"hasInteracted",value:!0}]),x(),c&&console.log({serialized:_,json:$})}},...l,children:[d.jsx(Uy,{className:"input",renderElement:H,renderLeaf:G,placeholder:n||u.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:s,tabIndex:0,onKeyDown:$=>{if($.key==="Enter"){A.show&&($.preventDefault(),$.stopPropagation(),Bf(Q,A,C,R));const{selection:W}=Q;if(W){const _=K.isCollapsed(W),[F,I]=b.node(Q,W,{depth:1});let M=F,V=M.type;const ne=M.children[0];if(ne&&[Z.ol,Z.ul].includes(ne.type)&&(M=ne,V=ne.type),M&&de.isElement(M)&&V!==Z.paragraph){if(V===Z.blockquote&&!$.shiftKey){$.stopPropagation(),$.preventDefault(),X.insertNodes(Q,v);return}if(_){const[te,ae]=b.parent(Q,W,{edge:"end"}),J=te.type;if([Z.ul,Z.ol].includes(V))if($.stopPropagation(),$.preventDefault(),J===Z.li&&L==="Enter"){te.children.length===1&&"text"in te.children[0]&&te.children[0].text===""&&X.removeNodes(Q,{at:ae}),X.insertNodes(Q,v,{at:O.next(I)}),X.select(Q,b.end(Q,O.next(I)));return}else{const[ge,he]=Nx(Q,Z.li),ye={type:Z.li,children:[{text:""}]};X.insertNodes(Q,ye,{at:O.next(he)}),X.select(Q,b.end(Q,O.next(he)))}}}}}else if($.key==="Escape"){if(A.show){$.preventDefault(),$.stopPropagation(),C([{type:"mentionPopover",value:{...A,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes($.key)&&A.show){$.preventDefault(),$.stopPropagation();const{selectedUser:W,possibleUsers:_}=A;let F=$.key==="ArrowUp"?W-1:W+1;F<0&&(F=_.length-1),F>=_.length+1&&(F=0),C([{type:"mentionPopover",value:{...A,selectedUser:F}}])}C([{type:"lastKey",value:$.key}]),Mx($,Q,C,y)},onBlur:()=>{Q.selection&&C([{type:"lastAnchor",value:Q.selection.anchor}])},onFocus:()=>{if(P){if(!O.isPath(P.path)||!oe.has(Q,P.path))return;const $=oe.get(Q,P.path);let W=0;if(fe.isText($)?W=$.text.length:$.children&&(W=$.children.length),P.offset>W)return;try{X.select(Q,{anchor:P,focus:P})}catch(_){const F=_.message;y(`Error focusing editor: ${F}`)}}}}),d.jsx(Qx,{}),p?d.jsx(zx,{onFallbackClick:m}):null]},w),d.jsx(Ys,{id:`character-limit-${e}`,limit:r,valueLength:Ya(q)})]})}):d.jsx(d.Fragment,{})};const oC=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=D.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);D.useEffect(()=>{r&&l(r)},[r]);const u=c=>{i||(l(c),a(c))};return d.jsxs("div",{className:Y("toggle",s),onClick:c=>{c.preventDefault(),c.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[d.jsx("p",{children:t}),d.jsx("ul",{className:Y("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(c=>{const h=`${e}-${c.value}`;return d.jsxs("li",{className:"hidden",children:[d.jsx("input",{type:"radio",id:h,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:i}),d.jsx("label",{htmlFor:h,children:c.label})]},h)})})]})};function uC({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=D.useState(!1),[l,u]=D.useState(!1),c=D.useRef(null),h=async p=>{o(!0),u(!1);try{const m=p.target.files&&p.target.files[0];if(!m||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:m,userId:t});a(f=>({...f,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return d.jsxs("div",{className:Y("profile-image-change-figure",e),children:[d.jsx(Yt,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&d.jsx("p",{className:"error text-small",children:d.jsx(ue.FormattedMessage,{id:"profile_image_change_error"})}),d.jsx("input",{id:"file",type:"file",accept:"image/*",ref:c,onChange:h,hidden:!0,"data-testid":"file-input"}),d.jsx(_e,{onClick:()=>c.current&&c.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:s,children:d.jsx(ue.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const Rf=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(Tn,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}],autoComplete:"name"},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const Mf=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[c,h]=D.useState([]),[p,m]=D.useState(!0),[g,f]=D.useState(u),{formatMessage:y}=ue.useIntl(),v=async C=>{C.preventDefault();try{await l(c),h([]),f("SUCCESS")}catch(w){f("ERROR"),o(w)}},k=C=>{C.preventDefault(),f("NOT_SUBMITTED"),m(!0),h([])},B=C=>{C.preventDefault(),s(),f("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?d.jsxs("div",{className:"invite-form-wrapper",children:[d.jsx("div",{className:"content centred",children:g==="SUCCESS"?d.jsx("h2",{className:"success-title",children:y({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",y({id:"inviteForm_error"})]})}),d.jsx(Kt,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(_e,{variant:"secondary",onClick:k,children:y({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(_e,{onClick:B,children:y({id:"inviteForm_ctaDone"})})]}):d.jsx(_e,{onClick:k,children:y({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:Y("invite-form gtm-trackable"),children:[d.jsxs("fieldset",{className:"content",children:[d.jsx("h2",{className:"title",style:{color:r},children:e}),d.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),d.jsx(Bh.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:y({id:"inviteForm_email_placeholder"}),emails:c,onChange:C=>{h(C),m(!C.length)},autoFocus:!1,getLabel:(C,w,T)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:C}),d.jsx(_e,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{T(w),m(!c.length)},className:"remove-email-button",screenreaderText:y({id:"overlay_close"})})]},w)})]}),d.jsx(Kt,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(_e,{className:"sendEmailsButton",disabled:p,children:n})})]})})},Da=e=>e.map(t=>({condition:t})),Dt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},lC=({functions:e,...t})=>{const{formatMessage:n}=ue.useIntl(),[r,a]=D.useState(null),[i,s]=D.useState(!1),[o,l]=D.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=m=>m[Dt.NEW_PASSWORD]!==m[Dt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=m=>!ls(m[Dt.NEW_PASSWORD]).isValid,h=[{"data-testid":Dt.NEW_PASSWORD,id:Dt.NEW_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:Da(["required",c]),functions:{onChange:m=>l(ls(m).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":Dt.CONFIRMED_PASSWORD,id:Dt.CONFIRMED_PASSWORD,type:"password",autoComplete:"new-password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:Da(["required",u])}];t.isPasswordChange&&h.unshift({"data-testid":Dt.CURRENT_PASSWORD,id:Dt.CURRENT_PASSWORD,type:"password",autoComplete:"current-password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:Da(["required"])}),i&&h.push({component:cd,props:{matchingRules:o}});const p={id:Dt.FORM_ID,fields:h,functions:{...e,onSuccess:async m=>(e.createPassword(m),e.onSuccess&&e.onSuccess(m)),onCatch:m=>a(m==null?void 0:m.statusCode),onFailure:(m,g)=>{(g.includes(Dt.NEW_PASSWORD)||g.includes(Dt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(Tn,{...p}),r&&d.jsx(un,{variant:"error",text:r})]})};const If=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=ue.useIntl(),u=D.useRef(null);Yn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=h=>{h.preventDefault(),h.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return d.jsx("form",{onSubmit:c,className:Y("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:d.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:d.jsxs("p",{children:[d.jsx(Ie,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),d.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:h=>{h.key==="Enter"&&c(h)}}),d.jsx("button",{className:"clear",onClick:h=>{h.preventDefault(),h.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:d.jsx(Ie,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Ie,{children:l.formatMessage({id:"search_cta"})})})]})})})},Zl=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}])},cC=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"]}},dC=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=cC(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}])},fC=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,h=(m,g)=>{m.current&&s.validFields[g]!==m.current.validity.valid&&o([{type:`validFields.${g}`,value:m.current.validity.valid}])},p=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>h(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),"aria-describedby":"email-helper-textbox",functions:{onBlur:()=>{Zl({ref:i.email,validateEmail:r,dispatch:o})},onChange:(m,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:id,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(p.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>h(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{h(i.organisation,"organisation")}},validation:[{condition:"required"}],autoComplete:"organization","data-testid":"signup-org-input"}),e.url&&p.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:m=>d.jsx("small",{children:m})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&p.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:m=>d.jsx("small",{className:"notes text-small",children:m})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),p.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:m=>d.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:m}),privacy:m=>d.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:m})}),shownValue:"accepted",functions:{onChange:m=>{if(!m)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Zl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),p};const hC=({className:e=""})=>d.jsxs("div",{className:Y("success-message",e),"data-testid":"success-message",children:[d.jsx("p",{className:"success-title",children:d.jsx(ue.FormattedMessage,{id:"signup_success_title"})}),d.jsx(ue.FormattedMessage,{id:"signup_success_text",values:{p:t=>d.jsx("p",{children:t})}})]});const mC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},pC=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>Promise.resolve()},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ue.useIntl(),{title:u=!0,expectation:c=!1,url:h=!0,logInButton:p=!0,successMessage:m=!0}=a,g={title:u,expectation:c,url:h,logInButton:p,successMessage:m},[f,y]=D.useReducer(Ir,mC),{validFields:v,emailDetails:k,shouldManuallyApprove:B,shouldDisableButton:C,showSuccessMessage:w,showError:T}=f,[S,q]=Is.useCookies(["signup-this-session","functional-cookie-consent"]),P={form:D.createRef(),name:D.createRef(),email:D.createRef(),jobTitle:D.createRef(),organisation:D.createRef(),tc:D.createRef(),hiddenValidation:D.createRef()};D.useEffect(()=>{B===!0&&P.jobTitle.current&&P.jobTitle.current.focus()},[B]),D.useEffect(()=>{S["signup-this-session"]&&y([{type:"showSuccessMessage",value:!0}])},[S]),D.useEffect(()=>{w&&S["functional-cookie-consent"]&&q("signup-this-session","true",{path:"/",maxAge:3600})},[w]);const L=D.useMemo(()=>fC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:P,state:f,dispatch:y,dataToSubmit:s,intl:l}),[s,r,l,P,g,f]),z=C?!0:B?!Object.values(v).every(E=>E===!0):!v.name||!v.email||["exists","pending","verify"].includes(k.boxType);return g.successMessage&&w?d.jsx(hC,{className:e}):d.jsxs("fieldset",{className:Y("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&d.jsx("p",{className:"signup-title",children:d.jsx(ue.FormattedMessage,{id:"signup_title"})}),T&&d.jsx(un,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(Tn,{className:"signup-form",formRef:P.form,id:"sign-up-form",fields:L,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:z?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/user-onboarding/login","data-gtm-event-context":"SignupForm","data-gtm-event-type":"login-click",text:l.formatMessage({id:"signup_button_login"})},meta:{shouldReset:!1,showRequiredLabels:!1,shouldShowCancelButton:g.logInButton},gtm:{context:"SignupForm",event:"signup-submit-click"},functions:{onSuccess:async()=>{await dC({refs:P,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:y,state:f})},onCatch:E=>{r.handleError(E),y([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:P.hiddenValidation})]})};const dn=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return d.jsx("section",{className:Y("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const gC=({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(dn,{className:Y("download-section",n),children:d.jsxs("div",{className:"content-default",children:[D.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),d.jsx(rr,{buttons:r})]})})};function $f({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const vC=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=ue.useIntl();return d.jsxs("div",{className:Y("edit-section-placeholder",{"has-icon":!!e}),style:Rc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(_e,{href:r,variant:"secondary",size:"small",onClick:()=>$f({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},bC=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=D.useState(!1),c=typeof r=="string"||!!n,h=()=>u(!1);return d.jsxs("section",{className:Y("edit-section",t),children:[n&&d.jsx(sr,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:h},className:Y("edit-section-modal"),children:d.jsx(Tn,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async p=>{var m,g;(m=n==null?void 0:n.functions)!=null&&m.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(p)),u(!1)},onCancel:h}})}),d.jsxs("div",{className:"edit-section-header",children:[d.jsx("h2",{className:"edit-section-header-title",children:a}),c&&d.jsx(_e,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>$f({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(vC,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(Kt,{})]})};const yC=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return d.jsxs("div",{className:Y("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&D.createElement(s.element,{className:Y("title",s.className)},s.text),t&&d.jsx("p",{children:t}),d.jsx("ul",{className:Y({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:c,nameOfBusiness:h,link:p=!1,description:m=!1},g)=>{if(!c||!c.url)return null;const f=d.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:h});return d.jsxs("li",{children:[d.jsx("p",{className:"img-wrapper",children:p?d.jsx("a",{href:p,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),m&&d.jsx("small",{children:m})]},window.btoa(`${c.url}_${g}`))})})]})};let Li;const zi="contactFooter_",DC=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=D.useRef(null),[r,a]=D.useState(0),[i,s]=D.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(Li),Li=setTimeout(()=>{o(),s(!1)},500))};return D.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(Li),window.removeEventListener("resize",l)}),[]),d.jsx(dn,{id:"contactForm",className:"contact-footer",children:d.jsxs("div",{className:"inner-wrapper",children:[d.jsx("h2",{children:d.jsx(ue.FormattedMessage,{id:`${zi}title`})}),d.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[d.jsxs("aside",{children:[d.jsx("p",{children:d.jsx(ue.FormattedMessage,{id:`${zi}text`})}),d.jsx(Fn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(ue.FormattedMessage,{id:`${zi}email`})})]}),d.jsx(Rf,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},xC=({activeLink:e,...t})=>d.jsx(dn,{children:d.jsx(rd,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(nd,{activeLink:e}),d.jsx(Vc,{...t})]})})});const qi="cookieBanner_",Wi=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Hi=new Date(Date.now()+12*30*24*60*60*1e3),Lf=()=>{const e=ue.useIntl(),[t,n,r]=Is.useCookies(Wi),[a,i]=D.useState(!t["apol-cookie-banner"]),s=()=>{Wi.forEach(c=>{n(c,!0,{path:"/",expires:Hi,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Hi}),Wi.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:Hi});return}r(c)}),i(!1)};if(!a)return null;const l=[{id:"settings",href:"/pages/cookie-policy",gtmType:"policy-page"},{id:"reject",onClick:o,gtmType:"reject-all"},{id:"accept",onClick:s,gtmType:"accepted-all"}],u=[];return l.forEach(c=>{u.push({variant:c.href?"tertiary":"primary",href:c.href,onClick:c.onClick,className:"gtm-trackable","data-gtm-event-context":"cookie-banner","data-gtm-event-type":`cookie-${c.gtmType}-click`,children:e.formatMessage({id:`${qi}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${qi}title`})}),d.jsx("p",{children:e.formatMessage({id:`${qi}text`})}),d.jsx(rr,{buttons:u})]})},Ut={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","insights","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},insights:{href:"/learning-hub/global-insights/",gtmType:"insights-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:$n["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:$n["data-protection"].eu,gtmType:"email-eu-dpo-link"}}},contact:{text:{order:["correspondence","registered","berlin","support","business"],correspondence:{address:!0},registered:{address:!0},berlin:{address:!0},support:{email:$n.support,gtmType:"concierge-email-click"},business:{email:$n.general,gtmType:"hello-email-click"}}},social:{order:["linkedin","twitter","facebook"],linkedin:{href:"https://www.linkedin.com/company/apolitical"},twitter:{href:"https://twitter.com/apoliticalco"},facebook:{href:"https://www.facebook.com/apoliticalco"}}};const Un="footer_",Sa="SiteFooter",Yl=({group:e})=>{const t=Ut[e].order||[];let n=!1;return"text"in Ut[e]&&(n=Ut[e].text),d.jsxs(D.Fragment,{children:[d.jsx("p",{className:"pre-title",children:d.jsx(ue.FormattedMessage,{id:`${Un}${e}`})}),Array.isArray(t)&&t.length>0&&d.jsx("ul",{className:"text-medium",children:t.map(r=>{if(["order","child","text"].includes(r))return null;const{href:a,gtmType:i}=Ut[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),d.jsx("li",{children:d.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Sa,"data-gtm-event-type":i,...s,children:d.jsx(ue.FormattedMessage,{id:`${Un}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&d.jsx("dl",{className:"text-medium",children:n.order.map(r=>d.jsxs(D.Fragment,{children:[d.jsx("dt",{children:d.jsx(ue.FormattedMessage,{id:`${Un}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(ue.FormattedMessage,{id:`${Un}${e}_${r}_address`,values:{br:d.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&d.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Sa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},wo=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx(Wa,{element:"hr"}),d.jsx(Zs,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Sa,"data-gtm-event-type":"logo-homepage-link"}),d.jsx("footer",{children:["platform","community","company","contact"].map(e=>d.jsxs("div",{className:"group",children:[d.jsx(Yl,{group:e}),Object.keys(Ut[e]).includes("child")&&d.jsx(Yl,{group:Ut[e].child})]},e))}),d.jsx("hr",{}),d.jsxs("div",{className:"sub-footer",children:[d.jsx("ul",{children:Array.isArray(Ut.social.order)&&Ut.social.order.map(e=>{const t=Ut.social[e];return d.jsx("li",{className:e,children:d.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Sa,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(ue.FormattedMessage,{id:`${Un}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(ue.FormattedMessage,{id:`${Un}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),$e={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e===gt.ACCOUNT&&t===!1&&n[gt.SITE]===!0)return;const i=Date.now();if(!a&&!t&&$e.handlerCalled[e]&&i-$e.handlerCalled[e]<500)return;$e.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case gt.SITE:o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation .navigation-button"));break;case gt.SEARCH:o=document.querySelector("#header .toggle-search-button");break;case gt.ACCOUNT:o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=Cc(e[r],t);if(!(typeof a>"u")&&(!n||a[t]&&a[t].includes(n)||a.value&&a.value.includes(n)||a.toString().includes(n)))return e[r]}return e[0].children?$e.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case gt.SITE:if(n){const u=$e.findFirstChild(t.current.children,"attributes.aria-controls",gt.SITE);s=$e.findFirstChild(u.children,"href")}else s=$e.findFirstChild(t.current.children,"href");break;case gt.ACCOUNT:if(o=$e.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=$e.findFirstChild(o.children,"href");break;default:return}s&&(a([{type:`focusElements.${e}.${i}`,value:s.attributes.href.value}]),s.focus())},events:{onClick:(e,{id:t,callback:n,isOpen:r})=>{e.target&&e.target.attributes&&e.target.attributes.href||(e.preventDefault(),e.stopPropagation(),clearTimeout($e.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout($e.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout($e.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{$e.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Mr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"site-navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{menuId:"account-navigation",order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup?ref=header-banner",props:{variant:"primary"}}}},ja=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ue.useIntl(),o=Cc(Mr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,c=e.includes("buttons.");let h=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(h+=`_logged${t?"In":"Out"}`);let p=!1;if(o.href){let B=o.gtmType||`${e}-click`;if(B.includes(".")){const C=B.split("."),w=C[C.length-2];B=`${w==="topics"?`${w}-`:""}${C[C.length-1]}`}p={href:o.href},u&&(p={...p,className:"gtm-trackable","data-gtm-event-type":B,"data-gtm-event-context":"HeaderButtons"}),c&&(p={...p,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const m=o.order&&o.order[0]&&o[o.order[0]],g=m&&o[o.order[0]].order,f=p&&window.location.pathname===o.href;let y={},v={},k={};if(f&&(y={...y,"aria-current":"page"}),m){const B=o.menuId||e,C={onClick:w=>$e.events.onClick(w,{id:B,callback:a,isOpen:r[B]}),onFocus:()=>$e.events.onFocus({id:B}),onBlur:()=>$e.events.onBlur({id:B,callback:a}),onMouseLeave:()=>$e.events.onBlur({id:B,callback:a}),onMouseEnter:()=>$e.events.onMouseEnter({id:B,callback:a})};v={...C,id:B===gt.SITE?gt.SITE:gt.ACCOUNT},n&&(g&&(k={...C,className:"navigation-button",onKeyPress:w=>{w.key==="Enter"&&$e.events.onClick(w,{id:B,callback:a,isOpen:r[B]})},"aria-haspopup":!0,"aria-expanded":r[B],"aria-controls":B}),v={...v,hidden:B in r?!r[B]:!0}),g||(v={...v})}return d.jsxs("li",{className:Y({[o.className]:o.className,"has-submenu":m,parent:g,active:f}),...y,children:[p?D.createElement(c?_e:"a",p,s.formatMessage({id:h})):n&&o.order&&g?d.jsxs("button",{...k,children:[s.formatMessage({id:h}),d.jsx(Ie,{children:s.formatMessage({id:`header_menu_${r[gt.SITE]?"hide":"show"}`})})]}):s.formatMessage({id:h}),o.order&&d.jsx("ul",{...v,children:o.order.map(B=>{if(!o[B])return null;const C={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[B].order?d.jsxs("li",{className:Y({[o[B].className]:o[B].className}),children:[s.formatMessage({id:`${h}_${B}`}),d.jsx("ul",{children:o[B].order.map(w=>d.jsx(ja,{id:`${e}.${B}.${w}`,...C},w))})]},B):d.jsx(ja,{id:`${e}.${B}`,...C},B)})})]},e)};const CC={height:67,height_desktop:83};var gt=(e=>(e.NAVIGATION="navigation",e.SEARCH="search",e.ACCOUNT="account-navigation",e.SITE="site-navigation",e))(gt||{});const Eo=({showNavigation:e=!0})=>{const t=ue.useIntl(),n=D.useContext(Lt),r=tr(!0,!0),a=n&&typeof n.id=="string",i=D.useMemo(()=>$e.getIsDesktopVersion(a,r),[a,r]),[s,o]=D.useReducer(Ir,{headerIsVisible:!0,menus:{"site-navigation":!1,search:!1,"account-navigation":!1},focusElements:{"site-navigation":{desktop:!1,default:!1},"account-navigation":{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:c}=s,h=D.useRef(s);D.useEffect(()=>{h.current=s},[s]),Ac({scrollPosition:CC[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const v=h.current.menus;!i&&v["site-navigation"]||$e.shouldChangeHeaderIsVisible(!0,v,o)},scrollDown:()=>{const v=h.current.menus;!i&&v["site-navigation"]||$e.shouldChangeHeaderIsVisible(!1,v,o)}}});const p=(v,k,B=!1)=>{$e.handleMenus({id:v,value:k,menus:h.current.menus,dispatch:o,forceHandle:B})},m=D.useRef(null),g=v=>{v.key==="Escape"&&["site-navigation","search","account-navigation"].forEach(k=>{h.current.menus[k]&&p(k,!1,!0)})};D.useEffect(()=>{var v;return(v=document.getElementById("header"))==null||v.addEventListener("keydown",g),()=>{var k;(k=document.getElementById("header"))==null||k.removeEventListener("keydown",g)}},[]),Yn(()=>{u["site-navigation"]&&$e.autoFocus({menu:"site-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u["site-navigation"]]),Yn(()=>{u["account-navigation"]&&$e.autoFocus({menu:"account-navigation",navigationRef:m,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u["account-navigation"]]);const f=d.jsxs(d.Fragment,{children:[!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:d.jsx(Ie,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),d.jsx(If,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"})]}),y=d.jsxs(d.Fragment,{children:[!i.navigation&&d.jsx("button",{className:"menu-button gtm-trackable",onClick:v=>{v.preventDefault(),v.stopPropagation(),p("site-navigation",!u["site-navigation"])},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u["site-navigation"],"aria-controls":"site-navigation",children:d.jsx(Ie,{children:t.formatMessage({id:`header_menu_${u["site-navigation"]?"hide":"show"}`})})}),d.jsx("ul",{ref:m,id:"navigation",hidden:i.navigation||u["account-navigation"]?!1:!u["site-navigation"],"data-showing":!i.navigation&&u["account-navigation"]?"account":"default",children:Mr.order.map(v=>d.jsx(ja,{id:v,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{"site-navigation":u["site-navigation"],"account-navigation":u["account-navigation"]},callback:p},v))})]});return n&&n.isLoading?null:d.jsxs(d.Fragment,{children:[d.jsxs("nav",{id:"header",className:Y({"logged-in":a,"logged-out":!a,visible:l}),children:[d.jsx(Ie,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),d.jsx(Zs,{variant:"monochrome"}),e&&d.jsxs(d.Fragment,{children:[i.navigation?d.jsxs(d.Fragment,{children:[y,f]}):d.jsxs(d.Fragment,{children:[f,y]}),a?d.jsxs("button",{className:"account-button",onClick:v=>$e.events.onClick(v,{id:"account-navigation",callback:p,isOpen:u["account-navigation"]}),onMouseEnter:()=>$e.events.onMouseEnter({id:"account-navigation",callback:p}),onMouseLeave:()=>$e.events.onBlur({id:"account-navigation",callback:p}),"aria-haspopup":"true","aria-expanded":u["account-navigation"],"aria-controls":"account-navigation",children:[d.jsx(Ie,{children:t.formatMessage({id:`header_account_${u["account-navigation"]?"hide":"show"}`})}),d.jsx(Yt,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):d.jsx("ul",{className:"sign-in-buttons",children:Mr.buttons.order.map(v=>d.jsx(ja,{id:`buttons.${v}`},v))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:Y("overlay",{open:u["site-navigation"]||u["account-navigation"]||!i.search&&u.search})})]})};const wC=()=>{const e=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Eo,{}),d.jsx("div",{id:"content",children:d.jsx(un,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(wo,{})]})},zf=({children:e,additionalContent:{prepended:t,appended:n}={},reportError:r,forceShow:a={},styling:i={},className:s="",locale:o="en"})=>{const{navigation:l=!0,footer:u=!0}=a,{background:c="default",variant:h="default",circle:p="default",modal:m="default"}=i,g=kc(),[f,y]=D.useState(""),v=T=>{const{detail:{message:S}}=T;y(S)};D.useEffect(()=>(window.scrollTo(0,0),document.addEventListener("ariaLive",v),()=>{document.removeEventListener("ariaLive",v)}),[g]);const k=fa(e,{locale:o}),B=fa(t,{locale:o}),C=fa(n,{locale:o}),w={};return c!=="default"&&(w[c]=!0),h!=="default"&&(w[h]=!0),p!=="default"&&(w[p]=!0),d.jsx(Ah.ErrorBoundary,{onError:r,fallback:d.jsx(wC,{}),children:d.jsxs(D.Suspense,{fallback:null,children:[d.jsxs("div",{id:"wrapper",className:Y(s,w,{"has-footer":u}),children:[d.jsx(Eo,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[B&&d.jsx("div",{className:Y("additional-content prepended",{"large-modal":m==="large"}),children:B}),D.createElement(c==="bold"?So:"div",{id:"content",children:k,className:Y({"large-modal":m==="large"})})]}),C&&d.jsx("div",{className:"additional-content appended",children:C}),u&&d.jsx(wo,{}),d.jsx(Lf,{})]}),f&&d.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,"data-testid":"layout-aria-live",children:f})]})})},Gl={default:"tags_",headerTopics:"header_topics_topics_"},Ui={topic:{Climate:"climate",CitiesAndLocalGovernment:"cities-and-local-government",DigitalAndData:"digital-and-data",Education:"education",EquityJusticeAndInclusion:"equity-justice-and-inclusion",HealthAndSocialCare:"health-and-social-care",Innovation:"innovation",LeadershipAndSkills:"leadership-and-skills",LifeInGovernment:"life-in-government",Policymaking:"policymaking",TransportAndInfrastructure:"transport-and-infrastructure",WorkAndTheEconomy:"work-and-the-economy"},"from the community":"community"},EC={getTagDetails:e=>{if(e.includes("topic_")){if(e=Ui.topic[e.replace("topic_","")],e){const t=Mr.topics.topics[e].href;return t?{id:e,href:t,text:`${Gl.headerTopics}${e}`}:null}return null}return Ui[e]?(e=Ui[e],{id:e,text:`${Gl.default}${e}`}):null}};const kC=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=ue.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=EC.getTagDetails(u);c&&l.push(c)}),l.length<1?null:d.jsx("ul",{className:Y("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const c=o.formatMessage({id:u.text});return d.jsx("li",{children:u.href&&r?d.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:c}):c},u.id)})})};const _C=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=ue.useIntl();return e.length===0?null:d.jsxs("div",{className:Y("members-list",s),children:[d.jsxs("h1",{children:[o.formatMessage({id:"membersList"}),d.jsx("span",{className:"count",children:t})]}),d.jsx("ul",{children:e.map((l,u)=>d.jsxs("li",{children:[d.jsx(Cn,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(pn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx($r,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})},BC={showForm:!1},ri=D.createContext(BC),qf=({children:e})=>{const[t,n]=D.useState({showForm:!1});return d.jsx(ri.Provider,{value:{...t,updateConversation:n},children:e})},Ql=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},AC=({intlPath:e,showGuidelines:t,type:n,gtmContext:r})=>{const a=ue.useIntl();return t?d.jsx("small",{children:Bt(a.formatMessage,`${e}explainer`,n,"action",{a:i=>d.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":r,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:i})})}):d.jsx(d.Fragment,{})},FC=({formID:e,intlPath:t,showLabel:n,type:r})=>{const a=ue.useIntl();return n?d.jsx("label",{htmlFor:`${e}-input`,className:"text-small",onClick:i=>{i.preventDefault(),i.stopPropagation();const s=new CustomEvent("focusEditor",{detail:{id:`rte-${e}-input`}});window.dispatchEvent(s)},children:a.formatMessage({id:`${t}label`})}):d.jsx(Ie,{element:"label",showOnFocus:!1,htmlFor:`${e}-input`,children:Bt(a.formatMessage,`${t}label_action`,r,"action")})};let ia=null;const Je="discussion_form_",zr=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r,placeholder:a,maxLength:i=0,buttons:s,forceShow:o={cancel:!1,error:!1},isCommunity:l=!1,functions:u,data:c={},gtmContext:h="DiscussionForm"})=>{var Ae,Fe,He;const p=ue.useIntl(),m=D.useContext(Lt),[g,f]=D.useState(""),{isLoading:y=!1,isInWrapper:v=!1,isInOverlay:k=!1,isAutoFocused:B=!1,isEditing:C=!1,hasTitleField:w=!1,isPrepopulated:T=!1,showTitle:S=!1,showGuidelines:q=!0,showDivider:P=!1,showSuccessMessage:L=!0}=r||{},{onChange:z=()=>{},create:E=()=>{},handleSaveEdit:A=()=>{},handleCancel:N=()=>{},callback:R=()=>{},onMention:H=()=>{},listMembers:G=()=>Promise.resolve([]),clickMentionFallback:Q=()=>{},props:re={create:{projectNames:["questions-answers"]}}}=u,[x,$]=D.useState({title:w&&w.text||"",body:C&&C.text||T&&T.text||""}),[W,_]=D.useState(o.error||!1),[F,I]=D.useState(!1);if(D.useEffect(()=>{l&&!C&&T&&T!==x.body&&$({...x,body:T.text||""})},[T]),y)return d.jsx(kt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const M=Se=>{$({...x,body:Se}),z({body:Se});let Te;!m||!m.id?Te=Bt(p.formatMessage,`${Je}error_loggedOut`,t.type,"action"):n?i>0&&Se.length>=i&&(Te=`${Je}error_tooLong`):Te=Bt(p.formatMessage,`${Je}error_noPermission`,t.type,"action"),Te?_(Te):W&&_(!1)};let V=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const Se=((Ae=t.slugs)==null?void 0:Ae.reply)||((Fe=t.slugs)==null?void 0:Fe.answer)||((He=t.slugs)==null?void 0:He.question)||"";Se&&(V=`${V}-${Se.slice(-15)}`)}e&&(V=`${e}-${V}`);const ne=async()=>{if(!m||!m.id||!n||J)return;ia&&clearTimeout(ia),I("submitting");const Se=window.location.pathname;try{let Te;switch(t.type){case"post":Te=await E({title:x.title,content:x.body});break;case"question":Te=await E({title:x.body,authorId:m&&m.id,...re==null?void 0:re.create});break;case"response":Te=await E({questionSlug:t.slugs.question},{body:x.body,authorId:m&&m.id,contentPath:Se});break;case"reply":Te=await E({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:x.body,authorId:m&&m.id,contentPath:Se});break;default:break}await $h(1e3),R&&await R(Te),ia=setTimeout(()=>{$({title:"",body:""}),I("submitted"),f(Bt(p.formatMessage,`${Je}success`,t.type,"action"));const Ne=new Event("discussionFormSubmitted");document.dispatchEvent(Ne),te()},500)}catch(Te){const Ne=Te;let ke=`${Je}error`;Ne!=null&&Ne.message.includes("entry already exists")&&(ke=Bt(p.formatMessage,`${Je}error_alreadyExists`,t.type,"action")),Ne!=null&&Ne.message.includes("429")?ke=Bt(p.formatMessage,`${Je}error_tooMany`,t.type,"action"):Ne!=null&&Ne.message.includes("400")&&(ke=`${Je}error`),_(ke),te()}},te=()=>{ia=setTimeout(()=>{_(!1),I(!1),f("")},5e3)},ae=!x.title||!qo(x.title),le=!x.body||!qo(x.body);let J=le;w&&(J=ae&&le);const ge=F==="submitting",he=[{component:FC,props:{formID:V,intlPath:Je,showLabel:w!==!1,type:t.type}},{component:Nf,props:{id:`${V}-input`,value:F==="submitting"&&!W?"":x.body,placeholder:a||Bt(p.formatMessage,`${Je}placeholder`,t.type,"action"),maxLength:i,meta:{isInOverlay:k},functions:{onChange:M,onMention:H,listMembers:G,clickMentionFallback:Q},data:c,autoFocus:C!==!1||B&&!w,"aria-invalid":!!W,"aria-errormessage":"error-message"}},{component:AC,props:{intlPath:Je,showGuidelines:q,type:t.type,gtmContext:h}}];P&&he.push({component:Kt}),w&&he.unshift({id:"title",type:"text",value:w.text,limit:250,autoFocus:B,label:p.formatMessage({id:`${Je}titleField_label`}),placeholder:p.formatMessage({id:`${Je}titleField_placeholder`}),functions:{onChange:Se=>{$({...x,title:Se}),z({title:Se})}},validation:[{condition:()=>J,error:p.formatMessage({id:`${Je}titleField_error`})}]});let ye=!m||!m.id||!n||J||ge;return C&&(w?ye=ye||x.body===C.text&&x.title===w.text:ye=ye||x.body===C.text),d.jsxs(d.Fragment,{children:[d.jsxs(Tn,{id:V,className:Y("discussion-card discussion-form",{"no-styling":v&&C}),meta:{shouldReset:!0,shouldHide:!1,showRequiredLabels:!1,shouldShowCancelButton:C&&!ge||o.cancel},functions:{onSuccess:async()=>{if(C){I("submitting"),A(x);return}await ne()},onCancel:N},fields:he,intlPath:Je,button:{variant:"primary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`${C?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:ye,overwriteSubmittingText:!0,text:!ge&&!C&&(s!=null&&s.submit)?s==null?void 0:s.submit:p.formatMessage({id:`${Je}${ge?C?"saving":"posting":C?"save":"post"}`})},secondaryActionButton:{variant:"secondary",size:{mobile:"small",600:"medium"},className:"gtm-trackable","data-gtm-event-context":h,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!o.cancel&&(!m||!m.id||!x.body),text:s!=null&&s.cancel?s==null?void 0:s.cancel:p.formatMessage({id:`${Je}cancel`})},gtm:{context:h,event:`${t.type}-form`},"data-testid":`discussion-${t.type}-form`,children:[S&&!C&&["question"].includes(t.type)&&d.jsx("h2",{children:Bt(p.formatMessage,`${Je}title`,t.type,"action")}),d.jsx(Cn,{member:m?{...m,link:!1}:"community",gtmContext:h,gtmType:"profile-click"})]}),F==="submitted"&&L&&d.jsx(Ar,{className:"success","data-testid":"success",children:Bt(p.formatMessage,`${Je}success`,t.type,"action")}),W&&d.jsx(Ar,{id:"error-message",className:"error","data-testid":"error",children:o.error?o.error:typeof W=="string"?W.includes(" ")?W:p.formatMessage({id:W},{action:p.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):W}),g&&d.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:g})]})},TC=Object.freeze(Object.defineProperty({__proto__:null,default:zr},Symbol.toStringTag,{value:"Module"})),SC=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),jC=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Oa=({icon:e,className:t="",...n})=>d.jsx(_e,{className:Y("discussion-button",t),variant:"tertiary",icon:e,...n});let kr=!1;const Vi=()=>{kr!==!1&&(clearTimeout(kr),kr=!1)},Ki=5;let Zi=null;const Wf=({element:e="div",likes:t=0,peopleWhoLiked:n=!1,isShort:r=!0,userLiked:a=!1,content:i={type:"reply",slugs:{}},canLike:s=!0,functions:{createLike:o=()=>{},deleteLike:l=()=>{}}={}})=>{const u=ue.useIntl(),c={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[h,p]=D.useReducer(Ir,c),{numberOfLikes:m,userLikedContent:g,ignoreInteractions:f,showLikers:y,tabbableLink:v}=h;D.useEffect(()=>{p([{type:"userLikedContent",value:a}])},[a]);const k=D.useMemo(()=>jC(n,Ki),[n]),B=S=>{if(S.preventDefault(),S.stopPropagation(),p([{type:"showLikers",value:!1}]),kr)return Vi(),!1;if(Vi(),f||!s)return!1;kr=setTimeout(C,350)},C=async()=>{if(Vi(),f||!s)return!1;let S=g?m-1:m+1;S<0&&(S=0),p([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const q=SC(i.slugs);g?await l(q):await o({...q,payload:{contentPath:window.location.pathname}})}}catch{p([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{p([{type:"ignoreInteractions",value:!1}])}},w=()=>{Zi=setTimeout(()=>{p([{type:"showLikers",value:!1}])},500)},T=()=>{Zi&&clearTimeout(Zi)};return D.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&p([{type:"showLikers",value:!1}])},onMouseEnter:()=>{T(),p([{type:"showLikers",value:!0}])},onMouseLeave:()=>{w()}},d.jsxs(d.Fragment,{children:[d.jsx(Oa,{className:Y("discussion-button text-medium action-button",{"show-spinner":f,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:B,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:m})})}),n&&d.jsxs(d.Fragment,{children:[d.jsx(Ie,{"data-testid":"like-a11y-button",element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{T()},onBlur:()=>w,onClick:S=>{var P;S.preventDefault(),S.stopPropagation(),T(),p([{type:"showLikers",value:!0}]);const q=(P=S.currentTarget.nextSibling)==null?void 0:P.childNodes[0];if(q){const L=q.querySelector("li:first-child a");L&&(p([{type:"tabbableLink",value:0}]),setTimeout(()=>{L.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),w())},"aria-expanded":y,"aria-controls":`likes-tooltip-${i.slug}`,children:d.jsx(Ie,{showOnFocus:!1,children:u.formatMessage({id:"discussion_likes_show"},{action:i.type})})}),d.jsx(An,{id:`likes-tooltip-${i.slug}`,isOpen:y,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[k.map((S,q)=>{if(typeof S=="string"||!S.name)return null;const P={};return v!==q&&(P.tabIndex=-1),d.jsx("li",{"data-index":q,children:d.jsx(Fn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:L=>L==null?void 0:L.stopPropagation(),onFocus:()=>T(),onKeyDown:L=>{var R,H,G,Q;if(!L||!["ArrowUp","ArrowDown"].includes(L.key||""))return;L.stopPropagation(),L.preventDefault();const z=L.key==="ArrowUp"?"up":"down",E=(R=L.currentTarget)==null?void 0:R.parentElement;let A=E==null?void 0:E.nextElementSibling;if(z==="up"){const re=E==null?void 0:E.previousElementSibling;re?A=re:(A=(H=E==null?void 0:E.parentElement)==null?void 0:H.lastElementChild,(A==null?void 0:A.getAttribute("data-index"))==="-1"&&(A=A==null?void 0:A.previousElementSibling))}else(!A||(A==null?void 0:A.getAttribute("data-index"))==="-1")&&(A=(G=E==null?void 0:E.parentElement)==null?void 0:G.firstElementChild);if(!A)return;const N=(A==null?void 0:A.getAttribute("data-index"))||"0";p([{type:"tabbableLink",value:N}]),(Q=A==null?void 0:A.querySelector("a"))==null||Q.focus()},...P,children:S.name})},S.id||window.btoa(S.name))}),t>Ki&&d.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Ki})})]})})]})]}))},Yi=({children:e,class:t,...n})=>{const r={...n,class:Y("subtle",t)};return d.jsx("blockquote",{...r,children:e})},OC=280,ko=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Zn(e,typeof t=="number"?t:OC):e;a=a.trim();const i=`<br>
|
|
139
|
+
|
|
140
|
+
`;return a.slice(0,i.length)===i&&(a=a.slice(i.length)),n?await $c({text:a,template:"[@{{name}}](/profiles/{{id}})",mentions:n,listMembers:r}):a};const PC=3e3,NC=({url:e,gtm:t={context:"ShareLink",event:"copy-link-click"}})=>{const n=ue.useIntl(),[r,a]=D.useState({isOpen:!1,isCopied:!1});return d.jsxs("li",{children:[d.jsx(An,{className:Y("tooltip-share-link",{"tooltip-share-link-copied":r.isCopied}),isOpen:r.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:r.isCopied?n.formatMessage({id:"discussion_share_copy_link_success"}):n.formatMessage({id:"discussion_share_copy_link"})}),d.jsx(Oa,{className:"gtm-trackable",icon:{icon:"link_chain"},onMouseOver:()=>a({...r,isOpen:!0}),onFocus:()=>a({...r,isOpen:!0}),onMouseOut:()=>a({isOpen:!1,isCopied:!1}),onBlur:()=>a({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{a({isOpen:!0,isCopied:!0}),setTimeout(()=>{a({isOpen:!1,isCopied:!1})},PC)})},"data-gtm-event-context":t.context,"data-gtm-event-type":t.event})]})},Ht="discussion_",RC=195,qr=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,forceHide:i={actionBar:!1,comments:!1,likes:!1},functions:s,links:o={},className:l,gtmContext:u="DiscussionAnswer",children:c,isTruncated:h=!1,styling:{showShareLinkButton:p=!1}={},setFocus:m=!1,isCommunity:g=!1})=>{var Ae,Fe,He,Se,Te,Ne,ke,Ue;const f=ue.useIntl(),y=D.useContext(Lt),v=D.useContext(ri),{createContent:k=async()=>{},deleteContent:B=async()=>{},updateContent:C=async()=>{}}=s.content||{},{createLike:w=()=>{},deleteLike:T=()=>{}}=s.likes||{},{openComments:S=()=>{}}=s.comments||{},{listMembers:q=()=>Promise.resolve([]),clickMentionFallback:P=()=>{}}=s.mentions||{},{author:L,canLike:z,createdAt:E,id:A,likes:N=0,userLiked:R,comments:H=0,mentions:G}=t,Q=y&&y.id&&typeof L!="string"&&L.id&&L.id===y.id||!1,re=typeof z=="boolean"?z:!0,x=Q&&(!t.createdAt||Mh(t.createdAt,10,"seconds")),$=D.useRef(null),[W,_]=D.useState({title:t&&t.body!==t.title&&t.title||"",body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[F,I]=D.useState(!1),[M,V]=D.useState(x?"highlighted":"default"),[ne,te]=D.useState("");D.useEffect(()=>{const pe=$.current;if(!(!pe||M==="default"))return document.addEventListener("discussionFormSubmitted",ae),pe.addEventListener("transitionend",le),()=>{document.removeEventListener("discussionFormSubmitted",ae),pe.removeEventListener("transitionend",le)}},[]),D.useEffect(()=>{_({...W,title:t&&t.title||"",body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),D.useEffect(()=>{(async()=>{const U=await ko(W.body,h,G,q);_({...W,postBody:U})})()},[W.body,G]);const ae=()=>{setTimeout(()=>{V("fading")},1e3)},le=({propertyName:pe})=>{pe==="background-color"&&V(U=>(U==="default"&&(document.removeEventListener("discussionFormSubmitted",ae),$.current&&$.current.removeEventListener("transitionend",le)),U==="fading"?"default":U))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||W.postBody===""&&t.title==="")return d.jsx(kt,{className:"discussion-card"});const J=async({title:pe,body:U})=>{pe||(pe=""),U||(U=""),te("");try{if(!is(pe,W.title)||!is(U,W.body)){const ie=t.type==="question"?{title:U}:{title:pe,body:U};await C(Ql(t.slugs),ie)}_({...W,title:pe,body:U,isEditing:!1,didEdit:!0})}catch{te(`${Ht}form_error`)}},ge=()=>{if(v&&v.updateConversation){const pe={showForm:!0},U=t.author;U&&U.id&&(g&&(pe.prepopulateForm=`@{{${U.id}}}`),pe.mentionData={id:U.id,name:U.name}),v.updateConversation(pe)}setTimeout(()=>{var ve,we,Ke;const U=`reply-form-${(t.type==="answer"?t.slug:((ve=t.slugs)==null?void 0:ve.reply)||((we=t.slugs)==null?void 0:we.answer)||((Ke=t.slugs)==null?void 0:Ke.question)||"").toLowerCase().slice(-15)}`,ie=document.getElementById(U),me=document.getElementById(`${U}-input`);me&&me.focus(),ie&&ie.scrollIntoView({behavior:"smooth"})},0)},he=async()=>{I(!1);try{await B(Ql(t.slugs))}catch{te("delete-error")}},ye=[{text:f.formatMessage({id:`${Ht}moreMenu_report`}),onClick:pe=>{pe.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(f.formatMessage({id:`${Ht}report_subject`}))}&body=${encodeURI(f.formatMessage({id:`${Ht}report_body`},{contentType:t.type||"",contentSlug:t.slug||"",contentUrl:`${window.origin}${typeof process<"u"&&process.env.PUBLIC_URL||""}/${t.slugs.question||""}`}))}`,icon:"flag"}];return n&&Q&&ye.push({text:f.formatMessage({id:`${Ht}moreMenu_edit`}),onClick:()=>_({...W,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`edit-${t.type}-click`},{text:f.formatMessage({id:`${Ht}moreMenu_delete`}),onClick:pe=>{pe.preventDefault(),pe.stopPropagation(),I(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`delete-${t.type}-click`,...fh(`delete-${t.slug}-modal`,F)}),m&&((Ae=$==null?void 0:$.current)==null||Ae.focus(),(Fe=$==null?void 0:$.current)==null||Fe.scrollIntoView({behavior:"smooth"})),D.createElement(e,{className:Y("discussion-post",l,{[M]:!l||!l.includes("highlighted-text-box"),"has-link":o.post&&!W.isEditing}),ref:$,tabIndex:m?0:null,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${u}-post-click`,onClick:pe=>{!o.post||W.isEditing||(pe.preventDefault(),pe.stopPropagation(),window.location.href=o.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:A||t.slug,className:Y("discussion-card",t.type,{editing:W.isEditing,"has-link":o.post&&!W.isEditing}),children:[!W.isEditing&&d.jsx(Cn,{member:L,additionalContent:{createdAt:E,didEdit:W.didEdit},className:typeof L!="string"&&L.id===a?"highlighted":"",gtmContext:u,gtmType:"profile-click"}),W.isEditing?d.jsx(zr,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,hasTitleField:W.title!==""?{text:W.title}:!1,isEditing:{text:W.body},isPrepopulated:!1},isCommunity:g,maxLength:t.type==="question"?250:5e4,forceShow:{error:ne!==""&&ne!=="delete-error"?f.formatMessage({id:ne},{action:f.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:k,handleSaveEdit:J,handleCancel:()=>{te(""),_({...W,isEditing:!1})},listMembers:q,clickMentionFallback:P},gtmContext:`${u}Form`,data:{mentions:t.mentions}}):o.post?d.jsxs("a",{href:o.post,children:[(W==null?void 0:W.title)&&d.jsx("p",{className:"content-title",children:W==null?void 0:W.title}),W.postBody.length>RC?d.jsx(Uc,{text:W.postBody,markdownOptions:{overrides:{a:ds,blockquote:{component:Yi}}}}):d.jsx(xn,{options:{overrides:{a:ds,blockquote:{component:Yi}}},children:W.postBody})]}):d.jsxs(d.Fragment,{children:[(W==null?void 0:W.title)&&d.jsx("p",{className:"content-title",children:W==null?void 0:W.title}),d.jsx(xn,{options:{wrapper:t.type==="question"?"h1":D.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:Yi}}},children:W.postBody})]}),!W.isEditing&&!(i!=null&&i.actionBar)&&d.jsxs("ul",{className:Y("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!i.likes&&d.jsx(Wf,{element:"li",likes:N,isShort:!1,userLiked:R,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:re,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:w,deleteLike:T}}),!i.comments&&(["question","post"].includes(t.type)||o.comments)&&d.jsx("li",{children:d.jsx(Oa,{onClick:pe=>{pe.preventDefault(),pe.stopPropagation(),o.comments&&(window.location.href=o.comments),typeof S=="function"&&S()},icon:{icon:"speech-bubble_square"},"data-gtm-event-context":u,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:f.formatMessage({id:`${Ht}comments_screenReader`},{count:H}),children:f.formatMessage({id:`${Ht}comments`},{count:H})})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(Oa,{styling:{muted:!0},onClick:ge,icon:{icon:"speech-bubble_square"},children:f.formatMessage({id:`${Ht}reply`})})}),p&&d.jsx(NC,{url:(He=t.slugs)!=null&&He.reply?`${window.location.origin}${(Se=t.slugs)==null?void 0:Se.question}/${(Te=t.slugs)==null?void 0:Te.answer}#${(Ne=t.slugs)==null?void 0:Ne.reply}`:`${window.location.origin}${(ke=t.slugs)==null?void 0:ke.question}/${(Ue=t.slugs)==null?void 0:Ue.answer}`,gtm:{context:u,event:`copy-link-${t.type}-click`}}),d.jsx(td,{element:"li",id:`more-${t.slug}`,options:ye})]})]}),c,d.jsx(sr,{id:`delete-${t.slug}-modal`,isOpen:F,functions:{onOpen:()=>{},onClose:()=>I(!1)},forceShow:{error:ne==="delete-error"?f.formatMessage({id:"discussion_delete_error"},{action:f.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:f.formatMessage({id:"discussion_delete_title"},{action:f.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>I(!1),children:f.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:he,children:f.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:d.jsx(ue.FormattedMessage,{id:"discussion_delete_text",values:{p:pe=>d.jsx("p",{children:pe}),action:f.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const MC=D.lazy(()=>Promise.resolve().then(()=>CE)),IC=65,Hf=({forceShow:e,form:t,className:n})=>{const r=ue.useIntl(),i=D.useContext(Lt)||"community",s=Ka(i);s.name||(s.name=r.formatMessage({id:`member_${typeof i=="string"?i:"community"}`}));const{modal:o=!1}=e||{},[l,u]=D.useState(o||Kh("showPost")==="true"||!1),[c,h]=D.useState({showCachedText:!1});D.useEffect(()=>{if(!c.showCachedText)return;(async()=>{const g=await ko(c.title||c.body||"",IC,c.mentions);h({...c,prettifiedText:g})})()},[c.showCachedText,c.title,c.body]);let p=r.formatMessage({id:"discussionFormCard_placeholder"});return c.showCachedText&&(c.title||c.body)&&(p=c.prettifiedText||p),d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:Y("discussion-form-card",n),onClick:m=>{m.preventDefault(),m.stopPropagation(),u(!0)},"data-testid":"discussion-form-card",children:[d.jsx(Yt,{name:s.name,src:s.image,alt:""}),d.jsx(xn,{className:Y("input",{placeholder:!c.showCachedText}),element:"span",options:{forceInline:!0,overrides:{a:xt,blockquote:xt,br:xt,em:xt,li:xt,ol:xt,p:xt,s:xt,span:xt,strong:xt,ul:xt}},children:p})]}),d.jsx(Ua,{children:d.jsx(MC,{showModal:l,functions:{cacheText:h,onClose:()=>{u(!1)}},form:t,cachedText:c,className:"in-portal"})})]})},$C=D.lazy(()=>Promise.resolve().then(()=>TC)),_o=({isCard:e=!1,form:t,membershipRequiredToPost:{isMember:n,required:r,join:a,leave:i,notMemberStateText:s}})=>{if(r&&!n)return d.jsx(un,{text:s,button:{breakpoints:{mobile:!0,901:!1},component:d.jsx(Ks,{isShort:!0,functions:{join:a,leave:i}})}});const{content:o,functions:l,meta:u,...c}=t,h={content:{type:(o==null?void 0:o.type)||"reply",slugs:(o==null?void 0:o.slugs)||{}},functions:{...l,create:(l==null?void 0:l.create)||(()=>{})},meta:{...u,isEditing:(u==null?void 0:u.isEditing)||!1,isPrepopulated:!1,showSuccessMessage:!1},...c,id:`add-post-${c.id||""}`};return e?d.jsx(Hf,{form:h}):d.jsx($C,{...h})};const Gi="discussion_responses_",Uf=({type:e="answer",responses:t=0,isLoading:n=!1})=>{const r=ue.useIntl();return t=parseInt(t),d.jsxs("div",{className:"responses-heading",children:[d.jsx("h4",{children:r.formatMessage({id:`${Gi}title`},{action:r.formatMessage({id:`${Gi}${e}`}),count:t})}),!n&&t===0&&d.jsx("p",{children:Bt(r.formatMessage,`${Gi}empty`,e,e)})]})};const Vf=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ue.useIntl(),s=D.useContext(ri),o=fa(a,{element:"li"});if(s.prepopulateForm&&(r!=null&&r.meta)&&(r.meta.isPrepopulated={text:s.prepopulateForm},s.mentionData)){const l=r.data||{};l.mentions||(l.mentions={});const u=s.mentionData.id||"1";l.mentions[u]={created_at:"",updated_at:"",id:u,data:s.mentionData},r.data=l,r.meta.isAutoFocused=!0}return d.jsxs("div",{className:Y("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&d.jsx("ul",{className:"thread",children:o}),!e&&d.jsx($r,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&d.jsx(zr,{...r})]})},LC="post",zC="reply",Kf="00000000-0000-0000-0000-000000000000";function Bo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function Ao({queryClient:e,queryKey:t}){async function n(r){await e.cancelQueries({queryKey:t});const a=e.getQueryData(t);return e.setQueryData(t,r),a}return n}function qC(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function WC(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Zf(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 HC({title:e,content:t}){return{title:e,content:t,id:Kf,time:new Date().toISOString(),verb:LC}}function Jl({activity:e,user:t}){return{...e,actor:Zf(t),...qC()}}function Pa({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((a=e.own_reactions)==null?void 0:a.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function Yf({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 UC({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Kf,kind:zC,parent:t||""}}function Xl({reply:e,user:t}){const n=Zf(t);return{...e,user_id:n.id,user:n,...WC()}}function ec({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 VC({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 Gf=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let tc,Qi=0;const Qf=()=>{D.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(tc);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),Qi=0;return}Qi++,!(Qi>10)&&(tc=setTimeout(()=>{e(t)},50))}},Xn=Object.freeze({id:"some-user-id-1",name:"some user name 1",organization:"some user organization 1",jobTitle:"some user job title 1",image:{thumbnail:"https://some-user-thumbnail.com/avatar1.png"},isLoading:!1}),on=Object.freeze({id:"some-user-id-2",name:"some user name 2",organization:"some user organization 2",jobTitle:"some user job title 2",image:{thumbnail:"https://some-user-thumbnail.com/avatar2.png"},isLoading:!1}),Jf=Object.freeze({actor:`SU:${Xn.id}`,content:"some content 1",duration:"5.53ms",feed_id:"some-feed-id-1",foreign_id:"post:some-foriegn-id-1",id:"some-activity-id-1",object:"comment",time:"2023-11-24T17:52:36.162000",verb:"post"}),KC=Object.freeze({actor:`SU:${on.id}`,content:"some content 2",duration:"5.53ms",feed_id:"some-feed-id-2",foreign_id:"post:some-foriegn-id-2",id:"some-activity-id-2",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"}),ZC=Object.freeze({actor:`SU:${Xn.id}`,content:"some content 3",duration:"5.53ms",feed_id:"some-feed-id-3",foreign_id:"post:some-foriegn-id-3",id:"some-activity-id-3",object:"comment",time:"2023-11-24T17:56:36.162000",verb:"post"}),YC=Object.freeze({actor:`SU:${on.id}`,content:"some content 4",duration:"5.53ms",feed_id:"some-feed-id-4",foreign_id:"post:some-foriegn-id-4",id:"some-activity-id-4",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"});Object.freeze({id:"some-reaction-id-1",activity_id:Jf.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:on.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:on.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-1",user_id:on.id,user:{id:on.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Jf.id,data:{content:"Some content 1..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-2",user_id:Xn.id,user:{id:Xn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:KC.id,data:{content:"Some content 2..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:on.id,user:{id:on.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:ZC.id,data:{content:"Some content 3..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Xn.id,user:{id:Xn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:YC.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function GC({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ye.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Jl({activity:HC(o),user:i});return nc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=Jl({activity:o,user:i});r.setQueryData(a,nc(c,u,!0)),setTimeout(()=>{Gf(c.id)},0)}});return s}function QC({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ye.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Na(a,s);return o&&(o.content=i),s}),onError:n});return r}function JC({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ye.useQueryClient(),l=Za(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:Bo(u),mutate:Ao(u)},user:l,...u},h=GC({...c,mutationFn:e}),p=QC({...c,mutationFn:t}),m=XC({...c,mutationFn:n}),g=tw({...c,mutationFn:a}),f=nw({...c,mutationFn:i}),{activities:y,...v}=ew({queryKey:s,queryFn:r});return{activities:y,mutations:{create:h,edit:p,remove:g,like:m,unlike:f},user:l,...v}}function XC({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ye.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Na(s,o);return l&&Pa({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Na(o,l);u&&Pa({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function ew({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ye.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{activities:aw(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function tw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ye.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>rw(a,i)),onError:n});return r}function nw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ye.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Na(i,s);return o&&Yf({activity:o,user:r}),s}),onError:n});return a}function nc(e,t,n=!1){return t?(n?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t):{pages:[{next:"",results:[e]}],pageParams:[""]}}function Na(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function rw(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 aw(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const iw=({basePath:e,parentId:t,isMember:n,functions:{activities:r,mentions:a,join:i,leave:s}})=>{const o=ue.useIntl(),{activities:l,error:u,fetchNextPage:c,hasNextPage:h,isLoading:p,mutations:{create:m,edit:g,remove:f,like:y,unlike:v}}=JC({queryKey:[e,t,"activities"],queryFns:r}),[k,B]=D.useState(null),C=()=>{B(l.length),c()};return Qf(),u?d.jsx(un,{variant:"error",text:u.message}):d.jsxs("section",{children:[d.jsx(_o,{isCard:!0,form:{content:{type:"post",slugs:{}},functions:{create:m,...a},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),l==null?void 0:l.map((w,T)=>{var G,Q,re,x,$,W,_,F;const{id:S,own_reactions:q,latest_reactions:P,reaction_counts:L,mentioned_users:z}=w,E=(((G=P==null?void 0:P.like)==null?void 0:G.length)||0)>0,A=(((Q=q==null?void 0:q.like)==null?void 0:Q.length)||0)>0,N=A?q==null?void 0:q.like[0].id:"",R=E?(re=P==null?void 0:P.like)==null?void 0:re.map(I=>{var M,V,ne;return{id:(M=I==null?void 0:I.user)==null?void 0:M.id,name:(ne=(V=I==null?void 0:I.user)==null?void 0:V.data)==null?void 0:ne.name}}):!1,H=w==null?void 0:w.actor;return d.jsx(D.Fragment,{children:d.jsx(qr,{content:{type:"post",title:w==null?void 0:w.title,body:w==null?void 0:w.content,canLike:n,createdAt:(w==null?void 0:w.time)||"",slugs:{question:`${e}/${t}`,answer:S},slug:S,author:{id:H==null?void 0:H.id,name:(x=H==null?void 0:H.data)==null?void 0:x.name,organization:($=H==null?void 0:H.data)==null?void 0:$.organization,jobTitle:(W=H==null?void 0:H.data)==null?void 0:W.jobTitle,location:(_=H==null?void 0:H.data)==null?void 0:_.location,image:{thumbnail:((F=H==null?void 0:H.data)==null?void 0:F.thumbnail)||void 0}},userLiked:A,likes:(L==null?void 0:L.like)||0,comments:(L==null?void 0:L.reply)||0,peopleWhoLiked:R,mentions:z},links:{post:`${e}/${t}/${S}`,comments:`${e}/${t}/${S}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>f({activityId:S}),updateContent:(I,{body:M})=>g({activityId:S,content:M})},likes:{createLike:()=>y({activityId:S}),deleteLike:()=>v({activityId:S,reactionId:N})},comments:{openComments:()=>null},mentions:a},isTruncated:!0,styling:{showShareLinkButton:!0},setFocus:T===k})},S)}),!p&&d.jsx($r,{hasNextPage:h,loadNextPage:C,icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})},sw={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 ow({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ye.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=Xl({reply:UC(o),user:i});return rc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=Xl({reply:o,user:i});r.setQueryData(a,rc(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Gf(c.id)},0)}});return s}function uw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ye.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ra(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Xf({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ye.useQueryClient(),l=Za(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:Bo(u),mutate:Ao(u)},user:l,...u},h=ow({...c,mutationFn:e}),p=uw({...c,mutationFn:t}),m=lw({...c,mutationFn:n}),g=dw({...c,mutationFn:a}),f=fw({...c,mutationFn:i}),{replies:y,...v}=cw({queryKey:s,queryFn:r});return{replies:y,mutations:{create:h,edit:p,remove:g,like:m,unlike:f},user:l,...v}}function lw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ye.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Ra(s,o);return l&&ec({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ra(o,l);u&&ec({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function cw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ye.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=vw(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function dw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ye.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>gw(a,i)),onError:n});return r}function fw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ye.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ra(i,s);return o&&VC({reply:o,user:r}),s}),onError:n});return a}function hw(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function mw(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 rc(e,t,n){return t?n!=null&&n.append?mw(e,t,n):pw(e,t,n):hw(e)}function Ra(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function gw(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function vw(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 bw=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=ue.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:c,isLoading:h,mutations:{create:p,edit:m,like:g,remove:f,unlike:y},user:v}=Xf({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:C=>i.list({...C,reactionId:r})}});$s([h]);const[k,B]=D.useState(!0);return d.jsxs(d.Fragment,{children:[(l==null?void 0:l.length)>=o&&d.jsx(_e,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${k?"up_left":"down_right"}`,position:"left"},onClick:()=>B(!k),children:s.formatMessage({id:`discussion_thread_${k?"hide":"show"}`},{count:l==null?void 0:l.length})}),k&&d.jsx(Vf,{loadMore:{isLoading:h,hasNextPage:c,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(C,{body:w})=>p({activityId:n,replyId:r,content:w}),listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback},meta:{isEditing:!1,isAutoFocused:!0,isPrepopulated:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(C=>{var Q,re,x,$,W,_,F,I,M,V,ne,te;const{id:w,own_children:T,latest_children:S,children_counts:q,data:{mentioned_users:P}}=C,z=(((Q=T==null?void 0:T.like)==null?void 0:Q.length)||0)>0?(re=T==null?void 0:T.like)==null?void 0:re.find(ae=>{var le;return((le=ae==null?void 0:ae.user)==null?void 0:le.id)===(v==null?void 0:v.id)}):!1,E=z?z==null?void 0:z.id:"",A=!!z,R=(((x=S==null?void 0:S.like)==null?void 0:x.length)||0)>0?($=S==null?void 0:S.like)==null?void 0:$.map(ae=>{var le,J,ge;return{id:(le=ae==null?void 0:ae.user)==null?void 0:le.id,name:(ge=(J=ae==null?void 0:ae.user)==null?void 0:J.data)==null?void 0:ge.name}}):!1,H=C==null?void 0:C.user,G=typeof C.data.content=="string"?(W=C==null?void 0:C.data)==null?void 0:W.content:((F=(_=C==null?void 0:C.data)==null?void 0:_.content)==null?void 0:F.text)||"";return d.jsx(qr,{isCommunity:!0,content:{id:w,type:"reply",body:G,canLike:a,createdAt:C==null?void 0:C.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:C==null?void 0:C.parent},slug:"",author:{id:H==null?void 0:H.id,name:(I=H.data)==null?void 0:I.name,organization:(M=H.data)==null?void 0:M.organization,jobTitle:(V=H.data)==null?void 0:V.jobTitle,location:(ne=H.data)==null?void 0:ne.location,image:{thumbnail:((te=H.data)==null?void 0:te.thumbnail)||void 0}},userLiked:A,likes:(q==null?void 0:q.like)||0,peopleWhoLiked:R,mentions:P},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:w}),updateContent:(ae,{body:le})=>m({replyId:w,content:le})},likes:{createLike:()=>g({replyId:w}),deleteLike:()=>y({replyId:w,reactionId:E})},comments:{},mentions:{listMembers:i.listMembers,clickMentionFallback:i.clickMentionFallback}},styling:{showShareLinkButton:!0}},w)}):null})]})};const eh=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,mentions:i,join:s,leave:o}})=>{const l=ue.useIntl(),{replies:u,repliesCount:c,fetchNextPage:h,hasNextPage:p,isLoading:m,mutations:{create:g,edit:f,like:y,remove:v,unlike:k},user:B}=Xf({queryKey:[e,t,n,"replies"],queryFns:a}),C=()=>{T(u.length),h()},[w,T]=D.useState(null);return $s([m]),Qf(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(Uf,{type:"comment",responses:c,isLoading:m}),d.jsx(_o,{form:{content:{type:"reply",slugs:{}},functions:{create:(S,{body:q})=>g({activityId:n,content:q}),...i},meta:{isEditing:!1,isAutoFocused:!1,isPrepopulated:!1,showSuccessMessage:!1},placeholder:l.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:s,leave:o,notMemberStateText:l.formatMessage({id:"community_joinToPost"})}}),u==null?void 0:u.map((S,q)=>{var W,_,F,I,M,V,ne,te,ae,le,J,ge;const{id:P,own_children:L,latest_children:z,children_counts:E,data:{mentioned_users:A}}=S,R=(((W=L==null?void 0:L.like)==null?void 0:W.length)||0)>0?(_=L==null?void 0:L.like)==null?void 0:_.find(he=>{var ye;return((ye=he==null?void 0:he.user)==null?void 0:ye.id)===(B==null?void 0:B.id)}):!1,H=R?R==null?void 0:R.id:"",G=!!R,re=(((F=z==null?void 0:z.like)==null?void 0:F.length)||0)>0?(I=z==null?void 0:z.like)==null?void 0:I.map(he=>{var ye,Ae,Fe;return{id:(ye=he==null?void 0:he.user)==null?void 0:ye.id,name:(Fe=(Ae=he==null?void 0:he.user)==null?void 0:Ae.data)==null?void 0:Fe.name}}):!1,x=S==null?void 0:S.user,$=typeof S.data.content=="string"?(M=S==null?void 0:S.data)==null?void 0:M.content:((ne=(V=S==null?void 0:S.data)==null?void 0:V.content)==null?void 0:ne.text)||"";return d.jsx(qf,{children:d.jsx(qr,{isCommunity:!0,content:{id:P,type:"reply",body:$,canLike:r,createdAt:S==null?void 0:S.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:P},slug:P,author:{id:x==null?void 0:x.id,name:(te=x.data)==null?void 0:te.name,organization:(ae=x.data)==null?void 0:ae.organization,jobTitle:(le=x.data)==null?void 0:le.jobTitle,location:(J=x.data)==null?void 0:J.location,image:{thumbnail:((ge=x.data)==null?void 0:ge.thumbnail)||void 0}},userLiked:G,likes:(E==null?void 0:E.like)||0,peopleWhoLiked:re,mentions:A},functions:{content:{createContent:()=>null,deleteContent:()=>v({replyId:P}),updateContent:(he,{body:ye})=>f({replyId:P,content:ye})},likes:{createLike:()=>y({replyId:P}),deleteLike:()=>k({replyId:P,reactionId:H})},comments:{},mentions:i},children:d.jsx(bw,{basePath:e,parentId:t,activityId:n,replyId:P,isMember:r,functions:{...a,...i}}),styling:{showShareLinkButton:!0},setFocus:q===w},P)},P)}),!m&&d.jsx($r,{hasNextPage:p,loadNextPage:C,icon:{icon:"arrow-down",position:"right"},messages:{button:l.formatMessage({id:"loadMore_button"}),error:l.formatMessage({id:"loadMore_error"})}})]})};function yw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ye.useMutation({mutationFn:e,onMutate:({content:a,title:i})=>t(s=>(s&&(a!=null&&(s.content=a),i!=null&&(s.title=i)),s)),onError:n});return r}function Dw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=Ye.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function xw({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=Ye.useQueryClient(),s=Za(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:Bo(o),mutate:Ao(o)},user:s,...o},u=yw({...l,mutationFn:t}),c=Cw({...l,mutationFn:n}),h=ww({...l,mutationFn:r}),{activity:p,...m}=Dw({queryKey:a,queryFn:e});return{activity:p,mutations:{edit:u,like:c,unlike:h},user:s,...m}}function Cw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ye.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Pa({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Pa({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function ww({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ye.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Yf({activity:s,user:r}),s)),onError:n});return a}const Ew=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,mentions:o,join:l,leave:u}})=>{var P,L,z,E,A,N,R,H,G,Q;const c=ue.useIntl(),{activity:h,error:p,isLoading:m,mutations:{edit:g,like:f,unlike:y}}=xw({queryFns:i,queryKey:[e,t,n]});if(m)return d.jsx(kt,{style:{height:"400px"}});if(p||!h)return d.jsx(un,{variant:"error",text:c.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:v,latest_reactions:k,mentioned_users:B}=h,C=(((P=k==null?void 0:k.like)==null?void 0:P.length)||0)>0,w=(((L=v==null?void 0:v.like)==null?void 0:L.length)||0)>0,T=w?v==null?void 0:v.like[0].id:"",S=C?(z=k==null?void 0:k.like)==null?void 0:z.map(re=>{var x,$,W;return{id:(x=re==null?void 0:re.user)==null?void 0:x.id,name:(W=($=re==null?void 0:re.user)==null?void 0:$.data)==null?void 0:W.name}}):!1,q=h==null?void 0:h.actor;return d.jsxs("section",{className:"activity-section",children:[d.jsx(qr,{className:"highlighted-text-box subtle",isCommunity:!0,content:{id:n,type:"post",title:h==null?void 0:h.title,body:h==null?void 0:h.content,canLike:r,createdAt:(h==null?void 0:h.time)||"",slugs:{question:`${e}/${t}`,answer:h==null?void 0:h.id},slug:n,author:{id:q.id,name:(E=q.data)==null?void 0:E.name,organization:(A=q.data)==null?void 0:A.organization,jobTitle:(N=q.data)==null?void 0:N.jobTitle,location:(R=q.data)==null?void 0:R.location,image:{thumbnail:((H=q.data)==null?void 0:H.thumbnail)||void 0}},userLiked:w,likes:((G=h==null?void 0:h.reaction_counts)==null?void 0:G.like)||0,comments:((Q=h==null?void 0:h.reaction_counts)==null?void 0:Q.reply)||0,peopleWhoLiked:S,mentions:B},originalAuthorId:q==null?void 0:q.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(re,{title:x,body:$})=>g({title:x,content:$})},likes:{createLike:()=>f({activityId:n}),deleteLike:()=>y({activityId:n,reactionId:T})},comments:{openComments:()=>{}},mentions:o},styling:{showShareLinkButton:!0}},n),d.jsx(eh,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,mentions:o,join:l,leave:u}})]})};var Ns={exports:{}},sa={exports:{}},Re={};/** @license React v16.13.1
|
|
139
141
|
* react-is.production.min.js
|
|
140
142
|
*
|
|
141
143
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
142
144
|
*
|
|
143
145
|
* This source code is licensed under the MIT license found in the
|
|
144
146
|
* LICENSE file in the root directory of this source tree.
|
|
145
|
-
*/var
|
|
147
|
+
*/var ac;function kw(){if(ac)return Re;ac=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,k=e?Symbol.for("react.scope"):60119;function B(w){if(typeof w=="object"&&w!==null){var T=w.$$typeof;switch(T){case t:switch(w=w.type,w){case l:case u:case r:case i:case a:case h:return w;default:switch(w=w&&w.$$typeof,w){case o:case c:case g:case m:case s:return w;default:return T}}case n:return T}}}function C(w){return B(w)===u}return Re.AsyncMode=l,Re.ConcurrentMode=u,Re.ContextConsumer=o,Re.ContextProvider=s,Re.Element=t,Re.ForwardRef=c,Re.Fragment=r,Re.Lazy=g,Re.Memo=m,Re.Portal=n,Re.Profiler=i,Re.StrictMode=a,Re.Suspense=h,Re.isAsyncMode=function(w){return C(w)||B(w)===l},Re.isConcurrentMode=C,Re.isContextConsumer=function(w){return B(w)===o},Re.isContextProvider=function(w){return B(w)===s},Re.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===t},Re.isForwardRef=function(w){return B(w)===c},Re.isFragment=function(w){return B(w)===r},Re.isLazy=function(w){return B(w)===g},Re.isMemo=function(w){return B(w)===m},Re.isPortal=function(w){return B(w)===n},Re.isProfiler=function(w){return B(w)===i},Re.isStrictMode=function(w){return B(w)===a},Re.isSuspense=function(w){return B(w)===h},Re.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===r||w===u||w===i||w===a||w===h||w===p||typeof w=="object"&&w!==null&&(w.$$typeof===g||w.$$typeof===m||w.$$typeof===s||w.$$typeof===o||w.$$typeof===c||w.$$typeof===y||w.$$typeof===v||w.$$typeof===k||w.$$typeof===f)},Re.typeOf=B,Re}var Me={};/** @license React v16.13.1
|
|
146
148
|
* react-is.development.js
|
|
147
149
|
*
|
|
148
150
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
149
151
|
*
|
|
150
152
|
* This source code is licensed under the MIT license found in the
|
|
151
153
|
* LICENSE file in the root directory of this source tree.
|
|
152
|
-
*/var
|
|
154
|
+
*/var ic;function _w(){return ic||(ic=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,c=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,f=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,k=e?Symbol.for("react.scope"):60119;function B(J){return typeof J=="string"||typeof J=="function"||J===r||J===u||J===i||J===a||J===h||J===p||typeof J=="object"&&J!==null&&(J.$$typeof===g||J.$$typeof===m||J.$$typeof===s||J.$$typeof===o||J.$$typeof===c||J.$$typeof===y||J.$$typeof===v||J.$$typeof===k||J.$$typeof===f)}function C(J){if(typeof J=="object"&&J!==null){var ge=J.$$typeof;switch(ge){case t:var he=J.type;switch(he){case l:case u:case r:case i:case a:case h:return he;default:var ye=he&&he.$$typeof;switch(ye){case o:case c:case g:case m:case s:return ye;default:return ge}}case n:return ge}}}var w=l,T=u,S=o,q=s,P=t,L=c,z=r,E=g,A=m,N=n,R=i,H=a,G=h,Q=!1;function re(J){return Q||(Q=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),x(J)||C(J)===l}function x(J){return C(J)===u}function $(J){return C(J)===o}function W(J){return C(J)===s}function _(J){return typeof J=="object"&&J!==null&&J.$$typeof===t}function F(J){return C(J)===c}function I(J){return C(J)===r}function M(J){return C(J)===g}function V(J){return C(J)===m}function ne(J){return C(J)===n}function te(J){return C(J)===i}function ae(J){return C(J)===a}function le(J){return C(J)===h}Me.AsyncMode=w,Me.ConcurrentMode=T,Me.ContextConsumer=S,Me.ContextProvider=q,Me.Element=P,Me.ForwardRef=L,Me.Fragment=z,Me.Lazy=E,Me.Memo=A,Me.Portal=N,Me.Profiler=R,Me.StrictMode=H,Me.Suspense=G,Me.isAsyncMode=re,Me.isConcurrentMode=x,Me.isContextConsumer=$,Me.isContextProvider=W,Me.isElement=_,Me.isForwardRef=F,Me.isFragment=I,Me.isLazy=M,Me.isMemo=V,Me.isPortal=ne,Me.isProfiler=te,Me.isStrictMode=ae,Me.isSuspense=le,Me.isValidElementType=B,Me.typeOf=C}()),Me}var sc;function th(){return sc||(sc=1,process.env.NODE_ENV==="production"?sa.exports=kw():sa.exports=_w()),sa.exports}/*
|
|
153
155
|
object-assign
|
|
154
156
|
(c) Sindre Sorhus
|
|
155
157
|
@license MIT
|
|
156
|
-
*/var
|
|
157
|
-
Valid keys: `+JSON.stringify(Object.keys(
|
|
158
|
+
*/var Ji,oc;function Bw(){if(oc)return Ji;oc=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function a(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var s={},o=0;o<10;o++)s["_"+String.fromCharCode(o)]=o;var l=Object.getOwnPropertyNames(s).map(function(c){return s[c]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(c){u[c]=c}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ji=a()?Object.assign:function(i,s){for(var o,l=r(i),u,c=1;c<arguments.length;c++){o=Object(arguments[c]);for(var h in o)t.call(o,h)&&(l[h]=o[h]);if(e){u=e(o);for(var p=0;p<u.length;p++)n.call(o,u[p])&&(l[u[p]]=o[u[p]])}}return l},Ji}var Xi,uc;function Fo(){if(uc)return Xi;uc=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Xi=e,Xi}var es,lc;function nh(){return lc||(lc=1,es=Function.call.bind(Object.prototype.hasOwnProperty)),es}var ts,cc;function Aw(){if(cc)return ts;cc=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Fo(),n={},r=nh();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function a(i,s,o,l,u){if(process.env.NODE_ENV!=="production"){for(var c in i)if(r(i,c)){var h;try{if(typeof i[c]!="function"){var p=Error((l||"React class")+": "+o+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}h=i[c](s,c,l,o,null,t)}catch(g){h=g}if(h&&!(h instanceof Error)&&e((l||"React class")+": type specification of "+o+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof h+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),h instanceof Error&&!(h.message in n)){n[h.message]=!0;var m=u?u():"";e("Failed "+o+" type: "+h.message+(m??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ts=a,ts}var ns,dc;function Fw(){if(dc)return ns;dc=1;var e=th(),t=Bw(),n=Fo(),r=nh(),a=Aw(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(o){var l="Warning: "+o;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function s(){return null}return ns=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,c="@@iterator";function h(x){var $=x&&(u&&x[u]||x[c]);if(typeof $=="function")return $}var p="<<anonymous>>",m={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:k(),arrayOf:B,element:C(),elementType:w(),instanceOf:T,node:L(),objectOf:q,oneOf:S,oneOfType:P,shape:E,exact:A};function g(x,$){return x===$?x!==0||1/x===1/$:x!==x&&$!==$}function f(x,$){this.message=x,this.data=$&&typeof $=="object"?$:{},this.stack=""}f.prototype=Error.prototype;function y(x){if(process.env.NODE_ENV!=="production")var $={},W=0;function _(I,M,V,ne,te,ae,le){if(ne=ne||p,ae=ae||V,le!==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=ne+":"+V;!$[ge]&&W<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ae+"` prop on `"+ne+"`. 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."),$[ge]=!0,W++)}}return M[V]==null?I?M[V]===null?new f("The "+te+" `"+ae+"` is marked as required "+("in `"+ne+"`, but its value is `null`.")):new f("The "+te+" `"+ae+"` is marked as required in "+("`"+ne+"`, but its value is `undefined`.")):null:x(M,V,ne,te,ae)}var F=_.bind(null,!1);return F.isRequired=_.bind(null,!0),F}function v(x){function $(W,_,F,I,M,V){var ne=W[_],te=H(ne);if(te!==x){var ae=G(ne);return new f("Invalid "+I+" `"+M+"` of type "+("`"+ae+"` supplied to `"+F+"`, expected ")+("`"+x+"`."),{expectedType:x})}return null}return y($)}function k(){return y(s)}function B(x){function $(W,_,F,I,M){if(typeof x!="function")return new f("Property `"+M+"` of component `"+F+"` has invalid PropType notation inside arrayOf.");var V=W[_];if(!Array.isArray(V)){var ne=H(V);return new f("Invalid "+I+" `"+M+"` of type "+("`"+ne+"` supplied to `"+F+"`, expected an array."))}for(var te=0;te<V.length;te++){var ae=x(V,te,F,I,M+"["+te+"]",n);if(ae instanceof Error)return ae}return null}return y($)}function C(){function x($,W,_,F,I){var M=$[W];if(!o(M)){var V=H(M);return new f("Invalid "+F+" `"+I+"` of type "+("`"+V+"` supplied to `"+_+"`, expected a single ReactElement."))}return null}return y(x)}function w(){function x($,W,_,F,I){var M=$[W];if(!e.isValidElementType(M)){var V=H(M);return new f("Invalid "+F+" `"+I+"` of type "+("`"+V+"` supplied to `"+_+"`, expected a single ReactElement type."))}return null}return y(x)}function T(x){function $(W,_,F,I,M){if(!(W[_]instanceof x)){var V=x.name||p,ne=re(W[_]);return new f("Invalid "+I+" `"+M+"` of type "+("`"+ne+"` supplied to `"+F+"`, expected ")+("instance of `"+V+"`."))}return null}return y($)}function S(x){if(!Array.isArray(x))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 $(W,_,F,I,M){for(var V=W[_],ne=0;ne<x.length;ne++)if(g(V,x[ne]))return null;var te=JSON.stringify(x,function(le,J){var ge=G(J);return ge==="symbol"?String(J):J});return new f("Invalid "+I+" `"+M+"` of value `"+String(V)+"` "+("supplied to `"+F+"`, expected one of "+te+"."))}return y($)}function q(x){function $(W,_,F,I,M){if(typeof x!="function")return new f("Property `"+M+"` of component `"+F+"` has invalid PropType notation inside objectOf.");var V=W[_],ne=H(V);if(ne!=="object")return new f("Invalid "+I+" `"+M+"` of type "+("`"+ne+"` supplied to `"+F+"`, expected an object."));for(var te in V)if(r(V,te)){var ae=x(V,te,F,I,M+"."+te,n);if(ae instanceof Error)return ae}return null}return y($)}function P(x){if(!Array.isArray(x))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var $=0;$<x.length;$++){var W=x[$];if(typeof W!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Q(W)+" at index "+$+"."),s}function _(F,I,M,V,ne){for(var te=[],ae=0;ae<x.length;ae++){var le=x[ae],J=le(F,I,M,V,ne,n);if(J==null)return null;J.data&&r(J.data,"expectedType")&&te.push(J.data.expectedType)}var ge=te.length>0?", expected one of type ["+te.join(", ")+"]":"";return new f("Invalid "+V+" `"+ne+"` supplied to "+("`"+M+"`"+ge+"."))}return y(_)}function L(){function x($,W,_,F,I){return N($[W])?null:new f("Invalid "+F+" `"+I+"` supplied to "+("`"+_+"`, expected a ReactNode."))}return y(x)}function z(x,$,W,_,F){return new f((x||"React class")+": "+$+" type `"+W+"."+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+F+"`.")}function E(x){function $(W,_,F,I,M){var V=W[_],ne=H(V);if(ne!=="object")return new f("Invalid "+I+" `"+M+"` of type `"+ne+"` "+("supplied to `"+F+"`, expected `object`."));for(var te in x){var ae=x[te];if(typeof ae!="function")return z(F,I,M,te,G(ae));var le=ae(V,te,F,I,M+"."+te,n);if(le)return le}return null}return y($)}function A(x){function $(W,_,F,I,M){var V=W[_],ne=H(V);if(ne!=="object")return new f("Invalid "+I+" `"+M+"` of type `"+ne+"` "+("supplied to `"+F+"`, expected `object`."));var te=t({},W[_],x);for(var ae in te){var le=x[ae];if(r(x,ae)&&typeof le!="function")return z(F,I,M,ae,G(le));if(!le)return new f("Invalid "+I+" `"+M+"` key `"+ae+"` supplied to `"+F+"`.\nBad object: "+JSON.stringify(W[_],null," ")+`
|
|
159
|
+
Valid keys: `+JSON.stringify(Object.keys(x),null," "));var J=le(V,ae,F,I,M+"."+ae,n);if(J)return J}return null}return y($)}function N(x){switch(typeof x){case"number":case"string":case"undefined":return!0;case"boolean":return!x;case"object":if(Array.isArray(x))return x.every(N);if(x===null||o(x))return!0;var $=h(x);if($){var W=$.call(x),_;if($!==x.entries){for(;!(_=W.next()).done;)if(!N(_.value))return!1}else for(;!(_=W.next()).done;){var F=_.value;if(F&&!N(F[1]))return!1}}else return!1;return!0;default:return!1}}function R(x,$){return x==="symbol"?!0:$?$["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&$ instanceof Symbol:!1}function H(x){var $=typeof x;return Array.isArray(x)?"array":x instanceof RegExp?"object":R($,x)?"symbol":$}function G(x){if(typeof x>"u"||x===null)return""+x;var $=H(x);if($==="object"){if(x instanceof Date)return"date";if(x instanceof RegExp)return"regexp"}return $}function Q(x){var $=G(x);switch($){case"array":case"object":return"an "+$;case"boolean":case"date":case"regexp":return"a "+$;default:return $}}function re(x){return!x.constructor||!x.constructor.name?p:x.constructor.name}return m.checkPropTypes=a,m.resetWarningCache=a.resetWarningCache,m.PropTypes=m,m},ns}var rs,fc;function Tw(){if(fc)return rs;fc=1;var e=Fo();function t(){}function n(){}return n.resetWarningCache=t,rs=function(){function r(s,o,l,u,c,h){if(h!==e){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},rs}if(process.env.NODE_ENV!=="production"){var Sw=th(),jw=!0;Ns.exports=Fw()(Sw.isElement,jw)}else Ns.exports=Tw()();var Ow=Ns.exports;/*!
|
|
158
160
|
* tabbable 6.2.0
|
|
159
161
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
160
|
-
*/var
|
|
162
|
+
*/var rh=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Ma=rh.join(","),ah=typeof Element>"u",_n=ah?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ia=!ah&&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},Pw=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},ih=function(t,n,r){if($a(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(Ma));return n&&_n.call(t,Ma)&&a.unshift(t),a=a.filter(r),a},sh=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=_n.call(s,Ma);c&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var h=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!$a(h,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(h&&p){var m=e(h===!0?s.children:h.children,!0,r);r.flatten?a.push.apply(a,m):a.push({scopeParent:s,candidates:m})}else i.unshift.apply(i,s.children)}}return a},oh=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},nn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Pw(t))&&!oh(t)?0:t.tabIndex},Nw=function(t,n){var r=nn(t);return r<0&&n&&!oh(t)?0:r},Rw=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},uh=function(t){return t.tagName==="INPUT"},Mw=function(t){return uh(t)&&t.type==="hidden"},Iw=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},$w=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Lw=function(t){if(!t.name)return!0;var n=t.form||Ia(t),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},a;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")a=r(window.CSS.escape(t.name));else try{a=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=$w(a,t.form);return!i||i===t},zw=function(t){return uh(t)&&t.type==="radio"},qw=function(t){return zw(t)&&!Lw(t)},Ww=function(t){var n,r=t&&Ia(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,c,h;r=Ia(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((c=a)!==null&&c!==void 0&&(h=c.ownerDocument)!==null&&h!==void 0&&h.contains(a))}}return i},hc=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},Hw=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=_n.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(_n.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof a=="function"){for(var o=t;t;){var l=t.parentElement,u=Ia(t);if(l&&!l.shadowRoot&&a(l)===!0)return hc(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(Ww(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return hc(t);return!1},Uw=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 _n.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},La=function(t,n){return!(n.disabled||$a(n)||Mw(n)||Hw(n,t)||Iw(n)||Uw(n))},Rs=function(t,n){return!(qw(n)||nn(n)<0||!La(t,n))},Vw=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Kw=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=Nw(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(Rw).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},lh=function(t,n){n=n||{};var r;return n.getShadowRoot?r=sh([t],n.includeContainer,{filter:Rs.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Vw}):r=ih(t,n.includeContainer,Rs.bind(null,n)),Kw(r)},ch=function(t,n){n=n||{};var r;return n.getShadowRoot?r=sh([t],n.includeContainer,{filter:La.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=ih(t,n.includeContainer,La.bind(null,n)),r},hn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return _n.call(t,Ma)===!1?!1:Rs(n,t)},Zw=rh.concat("iframe").join(","),xa=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return _n.call(t,Zw)===!1?!1:La(n,t)};const Yw=Object.freeze(Object.defineProperty({__proto__:null,focusable:ch,getTabIndex:nn,isFocusable:xa,isTabbable:hn,tabbable:lh},Symbol.toStringTag,{value:"Module"}));/*!
|
|
161
163
|
* focus-trap 7.5.4
|
|
162
164
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
163
|
-
*/function fc(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 hc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fc(Object(n),!0).forEach(function(r){Zw(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Zw(e,t,n){return t=Gw(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yw(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 Gw(e){var t=Yw(e,"string");return typeof t=="symbol"?t:String(t)}var mc={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()}},Qw=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},Jw=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},kr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},Xw=function(t){return kr(t)&&!t.shiftKey},eE=function(t){return kr(t)&&t.shiftKey},pc=function(t){return setTimeout(t,0)},gc=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},hr=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return typeof t=="function"?t.apply(void 0,r):t},ia=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},tE=[],nE=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||tE,i=hc({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Xw,isKeyBackward:eE},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(E,A,j){return E&&E[A]!==void 0?E[A]:i[j||A]},u=function(E,A){var j=typeof(A==null?void 0:A.composedPath)=="function"?A.composedPath():void 0;return s.containerGroups.findIndex(function(I){var H=I.container,q=I.tabbableNodes;return H.contains(E)||(j==null?void 0:j.includes(H))||q.find(function(re){return re===E})})},d=function(E){var A=i[E];if(typeof A=="function"){for(var j=arguments.length,I=new Array(j>1?j-1:0),H=1;H<j;H++)I[H-1]=arguments[H];A=A.apply(void 0,I)}if(A===!0&&(A=void 0),!A){if(A===void 0||A===!1)return A;throw new Error("`".concat(E,"` was specified but was not a node, or did not return a node"))}var q=A;if(typeof A=="string"&&(q=r.querySelector(A),!q))throw new Error("`".concat(E,"` as selector refers to no known node"));return q},h=function(){var E=d("initialFocus");if(E===!1)return!1;if(E===void 0||!ya(E,i.tabbableOptions))if(u(r.activeElement)>=0)E=r.activeElement;else{var A=s.tabbableGroups[0],j=A&&A.firstTabbableNode;E=j||d("fallbackFocus")}if(!E)throw new Error("Your focus-trap needs to have at least one focusable element");return E},p=function(){if(s.containerGroups=s.containers.map(function(E){var A=oh(E,i.tabbableOptions),j=uh(E,i.tabbableOptions),I=A.length>0?A[0]:void 0,H=A.length>0?A[A.length-1]:void 0,q=j.find(function(v){return fn(v)}),re=j.slice().reverse().find(function(v){return fn(v)}),ne=!!A.find(function(v){return tn(v)>0});return{container:E,tabbableNodes:A,focusableNodes:j,posTabIndexesFound:ne,firstTabbableNode:I,lastTabbableNode:H,firstDomTabbableNode:q,lastDomTabbableNode:re,nextTabbableNode:function(W){var V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,B=A.indexOf(W);return B<0?V?j.slice(j.indexOf(W)+1).find(function(T){return fn(T)}):j.slice(0,j.indexOf(W)).reverse().find(function(T){return fn(T)}):A[B+(V?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(E){return E.tabbableNodes.length>0}),s.tabbableGroups.length<=0&&!d("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(s.containerGroups.find(function(E){return E.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},m=function L(E){var A=E.activeElement;if(A)return A.shadowRoot&&A.shadowRoot.activeElement!==null?L(A.shadowRoot):A},g=function L(E){if(E!==!1&&E!==m(document)){if(!E||!E.focus){L(h());return}E.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=E,Qw(E)&&E.select()}},f=function(E){var A=d("setReturnFocus",E);return A||(A===!1?!1:E)},x=function(E){var A=E.target,j=E.event,I=E.isBackward,H=I===void 0?!1:I;A=A||ia(j),p();var q=null;if(s.tabbableGroups.length>0){var re=u(A,j),ne=re>=0?s.containerGroups[re]:void 0;if(re<0)H?q=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:q=s.tabbableGroups[0].firstTabbableNode;else if(H){var v=gc(s.tabbableGroups,function(M){var K=M.firstTabbableNode;return A===K});if(v<0&&(ne.container===A||ya(A,i.tabbableOptions)&&!fn(A,i.tabbableOptions)&&!ne.nextTabbableNode(A,!1))&&(v=re),v>=0){var W=v===0?s.tabbableGroups.length-1:v-1,V=s.tabbableGroups[W];q=tn(A)>=0?V.lastTabbableNode:V.lastDomTabbableNode}else kr(j)||(q=ne.nextTabbableNode(A,!1))}else{var B=gc(s.tabbableGroups,function(M){var K=M.lastTabbableNode;return A===K});if(B<0&&(ne.container===A||ya(A,i.tabbableOptions)&&!fn(A,i.tabbableOptions)&&!ne.nextTabbableNode(A))&&(B=re),B>=0){var T=B===s.tabbableGroups.length-1?0:B+1,R=s.tabbableGroups[T];q=tn(A)>=0?R.firstTabbableNode:R.firstDomTabbableNode}else kr(j)||(q=ne.nextTabbableNode(A))}}else q=d("fallbackFocus");return q},b=function(E){var A=ia(E);if(!(u(A,E)>=0)){if(hr(i.clickOutsideDeactivates,E)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}hr(i.allowOutsideClick,E)||E.preventDefault()}},_=function(E){var A=ia(E),j=u(A,E)>=0;if(j||A instanceof Document)j&&(s.mostRecentlyFocusedNode=A);else{E.stopImmediatePropagation();var I,H=!0;if(s.mostRecentlyFocusedNode)if(tn(s.mostRecentlyFocusedNode)>0){var q=u(s.mostRecentlyFocusedNode),re=s.containerGroups[q].tabbableNodes;if(re.length>0){var ne=re.findIndex(function(v){return v===s.mostRecentlyFocusedNode});ne>=0&&(i.isKeyForward(s.recentNavEvent)?ne+1<re.length&&(I=re[ne+1],H=!1):ne-1>=0&&(I=re[ne-1],H=!1))}}else s.containerGroups.some(function(v){return v.tabbableNodes.some(function(W){return tn(W)>0})})||(H=!1);else H=!1;H&&(I=x({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(I||s.mostRecentlyFocusedNode||h())}s.recentNavEvent=void 0},k=function(E){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=E;var j=x({event:E,isBackward:A});j&&(kr(E)&&E.preventDefault(),g(j))},w=function(E){if(Jw(E)&&hr(i.escapeDeactivates,E)!==!1){E.preventDefault(),o.deactivate();return}(i.isKeyForward(E)||i.isKeyBackward(E))&&k(E,i.isKeyBackward(E))},C=function(E){var A=ia(E);u(A,E)>=0||hr(i.clickOutsideDeactivates,E)||hr(i.allowOutsideClick,E)||(E.preventDefault(),E.stopImmediatePropagation())},F=function(){if(s.active)return mc.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?pc(function(){g(h())}):g(h()),r.addEventListener("focusin",_,!0),r.addEventListener("mousedown",b,{capture:!0,passive:!1}),r.addEventListener("touchstart",b,{capture:!0,passive:!1}),r.addEventListener("click",C,{capture:!0,passive:!1}),r.addEventListener("keydown",w,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",_,!0),r.removeEventListener("mousedown",b,!0),r.removeEventListener("touchstart",b,!0),r.removeEventListener("click",C,!0),r.removeEventListener("keydown",w,!0),o},z=function(E){var A=E.some(function(j){var I=Array.from(j.removedNodes);return I.some(function(H){return H===s.mostRecentlyFocusedNode})});A&&g(h())},N=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(z):void 0,$=function(){N&&(N.disconnect(),s.active&&!s.paused&&s.containers.map(function(E){N.observe(E,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(E){if(s.active)return this;var A=l(E,"onActivate"),j=l(E,"onPostActivate"),I=l(E,"checkCanFocusTrap");I||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,A==null||A();var H=function(){I&&p(),F(),$(),j==null||j()};return I?(I(s.containers.concat()).then(H,H),this):(H(),this)},deactivate:function(E){if(!s.active)return this;var A=hc({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},E);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,$(),mc.deactivateTrap(a,o);var j=l(A,"onDeactivate"),I=l(A,"onPostDeactivate"),H=l(A,"checkCanReturnFocus"),q=l(A,"returnFocus","returnFocusOnDeactivate");j==null||j();var re=function(){pc(function(){q&&g(f(s.nodeFocusedBeforeActivation)),I==null||I()})};return q&&H?(H(f(s.nodeFocusedBeforeActivation)).then(re,re),this):(re(),this)},pause:function(E){if(s.paused||!s.active)return this;var A=l(E,"onPause"),j=l(E,"onPostPause");return s.paused=!0,A==null||A(),S(),$(),j==null||j(),this},unpause:function(E){if(!s.paused||!s.active)return this;var A=l(E,"onUnpause"),j=l(E,"onPostUnpause");return s.paused=!1,A==null||A(),p(),F(),$(),j==null||j(),this},updateContainerElements:function(E){var A=[].concat(E).filter(Boolean);return s.containers=A.map(function(j){return typeof j=="string"?r.querySelector(j):j}),s.active&&p(),$(),this}},o.updateContainerElements(t),o};const rE=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:nE},Symbol.toStringTag,{value:"Module"})),aE=xc(rE),iE=xc(Kw);function Xn(e){"@babel/helpers - typeof";return Xn=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},Xn(e)}function sE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vc(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,lh(r.key),r)}}function oE(e,t,n){return t&&vc(e.prototype,t),n&&vc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function uE(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&&Rs(e,t)}function Rs(e,t){return Rs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Rs(e,t)}function lE(e){var t=dE();return function(){var r=La(e),a;if(t){var i=La(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return cE(this,a)}}function cE(e,t){if(t&&(Xn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vr(e)}function vr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dE(){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 La(e){return La=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},La(e)}function fE(e,t,n){return t=lh(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lh(e){var t=hE(e,"string");return Xn(t)==="symbol"?t:String(t)}function hE(e,t){if(Xn(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Xn(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var sa=D,be=Sw,mE=aE,pE=mE.createFocusTrap,gE=iE,vE=gE.isFocusable,Ao=function(e){uE(n,e);var t=lE(n);function n(r){var a;sE(this,n),a=t.call(this,r),fE(vr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var d=arguments.length,h=new Array(d>1?d-1:0),p=1;p<d;p++)h[p-1]=arguments[p];u=u.apply(void 0,h)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var m=u;if(typeof u=="string"){var g;if(m=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!m)throw new Error("`".concat(o,"` as selector refers to no known node"))}return m}),a.handleDeactivate=a.handleDeactivate.bind(vr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(vr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(vr(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 oE(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&&!vE(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,d=u===void 0?!1:u;l&&o.focus({preventScroll:d}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?sa.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===sa.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var d=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=d||[u]},o=sa.cloneElement(i,{ref:s});return o}return null}}]),n}(sa.Component),mr=typeof Element>"u"?Function:Element;Ao.propTypes={active:be.bool,paused:be.bool,focusTrapOptions:be.shape({document:be.object,onActivate:be.func,onPostActivate:be.func,checkCanFocusTrap:be.func,onPause:be.func,onPostPause:be.func,onUnpause:be.func,onPostUnpause:be.func,onDeactivate:be.func,onPostDeactivate:be.func,checkCanReturnFocus:be.func,initialFocus:be.oneOfType([be.instanceOf(mr),be.string,be.bool,be.func]),fallbackFocus:be.oneOfType([be.instanceOf(mr),be.string,be.func]),escapeDeactivates:be.oneOfType([be.bool,be.func]),clickOutsideDeactivates:be.oneOfType([be.bool,be.func]),returnFocusOnDeactivate:be.bool,setReturnFocus:be.oneOfType([be.instanceOf(mr),be.string,be.bool,be.func]),allowOutsideClick:be.oneOfType([be.bool,be.func]),preventScroll:be.bool,tabbableOptions:be.shape({displayCheck:be.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:be.oneOfType([be.bool,be.func])}),trapStack:be.array,isKeyForward:be.func,isKeyBackward:be.func}),containerElements:be.arrayOf(be.instanceOf(mr)),children:be.oneOfType([be.element,be.instanceOf(mr)])};Ao.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:pE};var bE=Ao;const yE=kn(bE);const Fo=({element:e="section",children:t,className:n,...r})=>D.createElement(e,{className:G("modal",n),children:typeof t=="string"?c.jsx("p",{children:t}):t,...r});const ir=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:d="",gtmContext:h="Modal"})=>{const p=ue.useIntl(),{registerOverlay:m,unregisterOverlay:g}=Qc(),[f,x]=D.useState(t),b=D.useRef(null),_=C=>{C.key==="Escape"&&k(!1)};D.useEffect(()=>(window.addEventListener("keyup",_),()=>{window.removeEventListener("keyup",_)}));const k=C=>{x(C),C?(a(),m(e)):(i(),g(e))};D.useEffect(()=>(k(t),()=>{f&&g(e)}),[t]);const w=r?{"--max-width":`${r/16}rem`}:{};return c.jsx("div",{id:`${e}-overlay`,ref:b,className:G("overlay",{open:f,"in-portal":d.includes("in-portal")}),role:"dialog",children:c.jsx(Fo,{id:e,className:G("overlay-modal",d,{"has-max-width":r}),hidden:!f,style:w,children:t&&c.jsx(yE,{containerElements:[b.current],children:c.jsxs("div",{className:"overlay-content",children:[c.jsxs("div",{className:"top",children:[o&&c.jsx("h2",{className:"modal-title",children:o}),c.jsx(_e,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>k(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":h,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&c.jsx(Vt,{}),l,u&&c.jsxs("div",{className:"bottom",children:[c.jsx(Vt,{}),c.jsx(nr,{buttons:u})]}),s&&c.jsx(Br,{className:"error",children:s})]})})})})},ch=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const dh=({showModal:e=!0,onClose:t=()=>{},form:n,className:r})=>{const a=ue.useIntl(),i="discussionFormModal_",{meta:s,functions:o}=n,l="discussion-form-modal";return c.jsx(ir,{id:l,title:a.formatMessage({id:`${i}title`}),isOpen:e,functions:{onClose:t},className:G("discussion-form-modal",r),children:c.jsx($r,{...n,meta:{...s,isAutoFocused:!0,isInOverlay:`${l}-overlay`,hasTitleField:{text:""},showGuidelines:!1,showDivider:!0},buttons:{submit:a.formatMessage({id:`${i}cta`})},functions:{...o,create:async u=>{t(),o.create&&await o.create(u)},handleSaveEdit:async u=>{t(),o.handleSaveEdit&&await o.handleSaveEdit(u)}}})})},DE=Object.freeze(Object.defineProperty({__proto__:null,default:dh},Symbol.toStringTag,{value:"Module"}));const xE=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const d=ue.useIntl();return r||(r=d.formatMessage({id:"inviteModal_formTitle"})),a||(a=d.formatMessage({id:"inviteModal_formLabel"})),i||(i=d.formatMessage({id:"inviteModal_cta"})),c.jsx(ir,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:G("invite-modal",e,{success:!!n}),children:c.jsx(Nf,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const CE=({members:e})=>{const[t,n]=D.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return c.jsxs(c.Fragment,{children:[c.jsx(Zt,{name:i,src:l}),c.jsx("p",{children:i}),c.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return c.jsxs("div",{className:"directory-wrapper",children:[c.jsx("ul",{className:"directory",children:e.map(a=>c.jsx("li",{children:c.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),c.jsx(ir,{isOpen:t!==!1,children:t===!1?"":c.jsxs(c.Fragment,{children:[r(t),c.jsx(Zn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const wE=({author:e,authorCite:t,content:n,member:r,className:a=""})=>c.jsxs("blockquote",{className:G("testimonial-block",a),children:[c.jsx(Nt,{className:"testimonial",children:n}),r?c.jsx(Dn,{member:r,styling:{size:"large"}}):c.jsxs(c.Fragment,{children:[e&&c.jsx("p",{className:G("author",{"text-small":!a.includes("new")}),children:e}),t&&c.jsx("p",{className:G("author-cite",{"text-small":!a.includes("new")}),children:c.jsx("cite",{children:t})})]})]}),EE=D.memo(wE);const kE=({items:e=[],selector:t="",className:n=""})=>{const r=ue.useIntl(),[a,i]=D.useState(e);return D.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,d)=>{s+=`${d>0?", ":""}${t} h${d+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&c.jsxs(Rt,{variant:"subtle",className:G("table-of-contents",n),children:[c.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),c.jsx("nav",{children:c.jsx("ul",{children:a.map(({id:s,text:o})=>c.jsx("li",{children:c.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const ri=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ue.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=d=>{const h=d/60,p=Math.floor(h),m=(h-p)*60,g=Math.round(m),f=`${i.formatMessage({id:`${s}hours`},{time:p})}${p>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${p>0?`${i.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:d,ariaText:h}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:d}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:h})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),c.jsx("span",{className:G("time-to-complete",a),"aria-label":u,children:l})};const _E=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",c.jsx(rr,{...n,className:G("banner",e),image:{...t,aspect:"banner"}})):null;const BE=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],AE=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const d=["eyebrow","title","text"],h={eyebrow:"small",title:"h1",text:"p"},p={};d.forEach(x=>{if(!t[x]){p[x]=!1;return}if(!s[x]){if(typeof t[x]=="object"){p[x]=t[x];const{text:b,element:_}=t[x];if(_&&BE.includes(_.toLowerCase()))return;p[x]={text:b,element:h[x]};return}p[x]={text:t[x],element:h[x]}}});const m=o&&o.text&&o.link;return m&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=x=>{x.preventDefault(),x.stopPropagation();const b=document.getElementById(o.link.substring(1));b&&b.scrollIntoView({behavior:"smooth"})}),c.jsx(cn,{className:G("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":m,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"content-wrapper",children:[d.map(x=>{if(p[x]&&typeof p[x]=="object"){const{text:b,element:_=""}=p[x];return x==="text"?c.jsx(Zn,{overrideType:"text-only",className:"text",children:b},x):D.createElement(_,{key:x,className:x},b)}return null}),l,m&&c.jsx(_e,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:G({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&c.jsx(rr,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},FE=D.memo(AE);const TE=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),c.jsx(cn,{className:G("custom-content-banner",t,r,{"has-image":e}),style:a,children:c.jsx("div",{className:"content-slim",children:n})})};const SE=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?c.jsx(Zn,{children:n}):n;return c.jsxs(cn,{className:G("highlight-section",t),children:[r&&c.jsx("div",{className:G("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:c.jsx(rr,{image:{...r,description:""}})}),c.jsx("div",{className:G("highlight-container highlight-content-wrapper",{"no-image":!r}),children:c.jsx("div",{className:G("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:c.jsx("div",{className:"content-default",children:a})})})]})},jE=D.memo(SE);const OE=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:c.jsxs("aside",{className:G("marketing-block",e),children:[n&&c.jsx("p",{className:"title",children:n}),r&&c.jsx("p",{children:r}),t&&c.jsx(_e,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),PE=({type:e,data:t})=>{const n=ue.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:d}=t;if(e==="question"){const h=a&&os(a);return c.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&c.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})]})]})}if(d&&!i||s)return c.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):Ls(d)});if(o)return c.jsx(mn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&os(u);return c.jsxs("ul",{className:"details",children:[l&&c.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&c.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})})]})}return null},za={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"}},NE=({data:e,cta:t,link:n,gtmContext:r})=>{var f,x;const a=ue.useIntl(),[i,s]=D.useState({loading:!1,registered:e.registered||!1});D.useEffect(()=>{e.registered&&s(b=>({...b,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:d,slug:h}=e,p=e.contentType;let m="";if((f=za[p])!=null&&f.gtmEvent&&(m=za[p].gtmEvent),l&&u)return n?c.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?c.jsx(_e,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(p)&&d!=="premium"){const b=i.loading||i.registered||((x=e==null?void 0:e.members)==null?void 0:x.isMember),_=async k=>{if(k.preventDefault(),k.stopPropagation(),!(b||!t||!t.onClick)){s(w=>({...w,loading:!0}));try{const w=await t.onClick(e);s(w==="success"?()=>({registered:!0,loading:!1}):C=>({...C,loading:!1}))}catch{s(C=>({...C,loading:!1}))}}};return c.jsx("p",{className:G("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:c.jsx(_e,{onClick:_,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:b,"data-gtm-event-context":`${r}Page-${p}: ${h}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${p}${b?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const RE={title:66,text:3e3,secondaryText:1e3,partner:25},To=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s,setFocus:o=!1})=>{var L,E,A,j,I;const l=ue.useIntl(),u=D.useContext($t),d=u&&typeof u.id=="string",h=D.useRef(null),[p,m]=D.useState({data:null,isLoading:!0}),{data:g,isLoading:f}=p,x=D.useCallback(()=>{n(t,d).then(H=>{m(()=>({data:H,isLoading:!1}))}).catch(()=>m(H=>({...H,isLoading:!1})))},[e]);if(D.useEffect(()=>{x()},[]),f||!g)return c.jsx(Et,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:l.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:b}=g;if(!b||!za[b])return c.jsx(Et,{element:"li",className:"card-wrapper"});const{basePath:_="",className:k,length:w,gtmEvent:C}=za[b];let F=g.slug?`${_}${g.slug}`:!1;g.slug&&(g.slug.slice(0,4)==="http"||g.slug.slice(0,2)==="//"||g.slug.slice(0,6)==="mailto"||g.slug.slice(0,3)==="tel")&&(F=g.slug);const S=H=>{F&&(H.preventDefault(),H.stopPropagation(),window.location.href=F)},z={...RE,...w};let N={className:"card"},$={};return F&&($={href:F,className:"gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${C}-click`,"data-testid":"link"},g.openInNewTab&&($.target="_blank"),N={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${C}-click`}),o&&(N={...N,tabIndex:"0"},(L=h==null?void 0:h.current)==null||L.focus(),(E=h==null?void 0:h.current)==null||E.scrollIntoView({behavior:"smooth"})),c.jsx("li",{className:G("card-wrapper text-medium",k,i,{"has-link":F,"no-link":!F,"has-image":g.banner}),"data-testid":`${b}-card`,children:c.jsxs("div",{...N,ref:h,children:[c.jsx(Lc,{className:"card-label",contentType:b,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),b==="communityPage"&&(g==null?void 0:g.createdAt)&&Rh(g==null?void 0:g.createdAt,60)&&c.jsx(mn,{size:"small",variant:"information","data-testid":"new-community",children:l.formatMessage({id:"card_new"})}),g.startDate&&!g.isOngoingEvent&&c.jsx(mn,{size:"small",variant:g.dateHasPassed?"default":"information","data-testid":"date",children:g.dateHasPassed?l.formatMessage({id:"card_ended"}):Nc(g.startDate)}),g.banner?c.jsxs("p",{className:"img",children:[g.registered&&c.jsx(mn,{size:"small",variant:"registered",children:l.formatMessage({id:"card_registered"})}),c.jsx(rr,{image:{...g.banner,description:""}})]}):k==="people"?c.jsx(Zt,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&c.jsx(Ws,{contributors:{data:g.contributors},styling:{size:"small",showGap:k!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(b)?l.formatMessage({id:`card_contributors_${b}`}):void 0,"data-testid":"contributors"}),g.partner&&c.jsx("p",{className:"partners","data-testid":"partners",children:g.partner.length>1?l.formatMessage({id:"card_partner"},{partner:g.partner[0],number:g.partner.length-1}):Vn(g.partner[0],z.partner)}),["title","text","secondaryText"].map(H=>{const q=g[H];if(!q)return null;const re=Fc(H),ne={key:H,className:re,"data-testid":re},v={wrapper:"p",forceWrapper:!0,forceInline:!0},W=Vn(q,z[H]);return["title","text"].includes(H)&&F?(v.wrapper="a",c.jsx("p",{...ne,children:c.jsx(Nt,{options:v,...$,children:W})})):c.jsx(Nt,{options:v,...ne,children:W})}),(u==null?void 0:u.id)&&(g==null?void 0:g.members)&&c.jsxs("span",{className:"member-information",children:[((A=g==null?void 0:g.members)==null?void 0:A.isMember)&&c.jsx(mn,{size:"small",variant:"registered",icon:((j=g==null?void 0:g.members)==null?void 0:j.memberType)==="owner"?"user":"tick",children:l.formatMessage({id:`card_member_type_${(I=g==null?void 0:g.members)==null?void 0:I.memberType}`})}),c.jsx("br",{}),c.jsx("span",{className:"label member-count",children:l.formatMessage({id:"card_member_count"},{count:g==null?void 0:g.members.count})})]}),c.jsx(PE,{type:k||"",data:g}),c.jsx(NE,{data:g,cta:r,link:F||"",gtmContext:a})]})})};const fh=({cards:e,cardTypes:t,className:n="",...r})=>c.jsx("ul",{className:G("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return c.jsx(To,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),ME=(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},IE=({id:e,title:t})=>{const n=ue.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return D.createElement(a,{className:G("title",i,s,{"highlighted-title":i==="highlighted"}),children:c.jsxs(c.Fragment,{children:[r,o&&c.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const rs={fourCards:1024,threeCards:769,twoCards:480};let oa=null;const $E=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ue.useIntl(),[u,d]=D.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:h,isLoading:p}=u,[m,g]=D.useState({currentPage:0,loadedPages:[0]}),{currentPage:f,loadedPages:x}=m,[b,_]=D.useState(""),k=t.length,w=Math.ceil(k/h),C=D.useRef(null),F=er(!0,!0,C==null?void 0:C.current);D.useEffect(()=>{let E=1;F&&(F>=rs.fourCards?E=4:F>=rs.threeCards?E=3:F>=rs.twoCards&&(E=2),E>k&&(E=k)),d(A=>({...A,cardsPerPage:E,isLoading:!1}))},[F,k]);const S=(E="next")=>{let A=f;if(typeof E=="string")if(E==="next")if(f<w-1)A=f+1;else return;else if(f>0)A=f-1;else return;else A=E;g(I=>({...I,currentPage:A,loadedPages:[...new Set([...x,A])]}));const j=()=>{const I=A*u.cardsPerPage,H=I+u.cardsPerPage;return t.slice(I,H).length};_(l.formatMessage({id:"carousel_pagination_aria_live"},{direction:E,count:j()}))},z=E=>{oa=E.touches[0].clientX},N=E=>{if(oa===null)return;const A=E.touches[0].clientX,j=oa-A;j>5?S("next"):j<-5&&S("previous"),oa=null},$={"--width":`${F||0}px`,"--total-cards":k,"--cards-per-page":h,"--page":f};if(p)return c.jsx(qs,{layout:`carousel${a?"-with-title":""}`});const L=(E,A)=>{var I;let j=null;return(I=E==null?void 0:E.sys)!=null&&I.id?j=`card-${E.sys.id}`:E!=null&&E.slug?j=`card-${E.slug}`:[n[A],E.contentType].includes("customCard")&&(j=`card-${window.btoa(`${E.title} ${E.createdAt}`)}-${A}`),j};return c.jsxs("section",{ref:C,className:G("carousel-wrapper",i),"data-testid":"carousel",children:[c.jsx(IE,{id:e,title:a}),c.jsx("ul",{className:"carousel",onTouchStart:z,onTouchMove:N,style:$,"data-testid":"carousel-list",children:t.map((E,A)=>{let j=L(E,A);return j&&ME(A,h,f,x)?c.jsx(To,{id:j,card:{...E,contentType:n[A]},buildCardData:r,gtmContext:s,...o},j):(j=j||`${e}-card-${A}`,c.jsx(Et,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},j))})}),w<=1?null:c.jsxs(c.Fragment,{children:[c.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[c.jsx("li",{className:"arrow previous",children:c.jsx(_e,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:E=>{E.preventDefault(),E.stopPropagation(),S("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:f<=0})}),[...Array(w)].map((E,A)=>c.jsx("li",{"data-testid":"carousel-controls-button",children:c.jsx("button",{className:G("page-indicator",{selected:A===f}),onClick:j=>{j.preventDefault(),j.stopPropagation(),S(A)},children:c.jsx(Me,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:A+1,total:w})})})},`page-indicator-${A}`)),c.jsx("li",{className:"arrow next",children:c.jsx(_e,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:E=>{E.preventDefault(),E.stopPropagation(),S("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:f>=w-1})})]}),c.jsx(Me,{"aria-live":"polite",showOnFocus:!1,children:b})]})]})},LE=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const d=i?window.btoa(i):`carousel-${u}`,h=u===e.length-1;return t?c.jsxs(D.Fragment,{children:[c.jsx(qs,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:c.jsx(Vt,{})]},`placeholder-${d}`):c.jsxs(D.Fragment,{children:[c.jsx($E,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),h?null:c.jsx(Vt,{})]},`carousel-${d}`)});const zE=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ue.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:d=!1}=s;return D.createElement(e,{className:G("course-progression",o,{"highlight-percentage":d,"has-circle-graph":i==="circle"}),children:c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:h=>c.jsx("strong",{children:h}),number:u})}),u<100&&a&&c.jsx(ri,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),c.jsx(zs,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const hh=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>D.createElement(e,{className:G("lesson-name",a),"data-number":`${t}.${n}`,children:r});const mh=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ue.useIntl(),o=Wa(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Sc(a||"");return c.jsxs("small",{className:G("content-type",{[e]:e!=="default"}),children:[c.jsx("span",{className:G("type",n),children:o})," ",t>0&&!r&&c.jsx(ri,{time:t})," ",i?c.jsx("span",{className:"additional",children:i}):null]})};const qE=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:d})=>{const h=ue.useIntl(),p="courseStructure_",m=u.toLowerCase().includes("course conclusion");return c.jsxs(Ua,{className:"course-structure",label:c.jsxs(c.Fragment,{children:[c.jsxs("small",{children:[h.formatMessage({id:`${p}section${m?"_end":""}`},{number:i})," ",!r&&s>=0&&c.jsx("span",{className:"time",children:a&&l===0?h.formatMessage({id:`${p}time_completed`}):c.jsx(ri,{time:s,appendedText:a?h.formatMessage({id:`${p}time_left`}):""})})]}),c.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[c.jsx("p",{children:n}),c.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:f,contentType:x,icon:b,image:_,isIntroduction:k,optional:w,slug:C,subsectionId:F,title:S,type:z})=>{const N=a&&t||k,$={};return _&&($.style={"--image":`url(${_})`}),c.jsx("li",{className:G({article:x===pr.ARTICLE,discussion:x===pr.DISCUSSION,quiz:x===pr.QUIZ,completed:g&&x===pr.ARTICLE,locked:!N}),...$,children:c.jsx(Bn,{href:N?`/microcourses/en/${o}/${C}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Tc(S)}`,gtmType:"article-click",children:c.jsxs(c.Fragment,{children:[c.jsx(hh,{sectionId:i,subsectionId:F,title:S,className:"course-title"})," ",c.jsx(mh,{completionTime:f,icon:b,optional:w,type:z,children:d&&d[C]&&c.jsx("span",{className:"quiz-score",children:`${d[C]}%`})})]})})},C)})})]})};const WE=({isComplete:e=!1,onClick:t,...n})=>{const r=ue.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),c.jsx(_e,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className:G("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},HE=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),bc=[{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 ua="notFoundError_",UE=()=>{const e=ue.useIntl(),t=[];return bc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ua}post_${r+1}`}),t.push("solutionArticle")}),c.jsxs($f,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:c.jsxs(cn,{children:[c.jsx(fh,{cards:bc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),c.jsx(_e,{href:"/solution-articles/",children:e.formatMessage({id:`${ua}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[c.jsx("h1",{children:e.formatMessage({id:`${ua}title`})}),c.jsx("p",{children:e.formatMessage({id:`${ua}text`})})]})};exports.ASSETS_BUCKET=Mt;exports.ActivitiesFeed=rw;exports.ActivitySection=Cw;exports.AddPost=Eo;exports.Banner=_E;exports.BannerSection=FE;exports.Breadcrumbs=bm;exports.Buckets=Qh;exports.Button=_e;exports.ButtonWrapper=nr;exports.COURSE_CONTENT_TYPES=pr;exports.CacheProvider=Kc;exports.Card=To;exports.CardBlock=fh;exports.Carousel=LE;exports.CharacterLimit=Zs;exports.CollapsibleSection=Ua;exports.Columns=td;exports.CommunityDetails=vm;exports.ContactFooter=bC;exports.ContactForm=Pf;exports.ContentTypeLabel=Lc;exports.Contributors=Ws;exports.ConversationContext=ni;exports.CookieBanner=If;exports.CourseProgression=zE;exports.CourseStructure=qE;exports.CustomContentBanner=TE;exports.Directory=CE;exports.DiscussionConversation=zf;exports.DiscussionForm=$r;exports.DiscussionFormCard=Lf;exports.DiscussionFormModal=dh;exports.DiscussionLikes=qf;exports.DiscussionPost=Lr;exports.DiscussionThread=Hf;exports.Divider=Vt;exports.DownloadSection=mC;exports.EMAILS=Mn;exports.EditSection=gC;exports.EmailHelperTextBox=rd;exports.EmptyStateBox=on;exports.Filters=ym;exports.FlagsProvider=Zc;exports.Footer=Co;exports.Form=An;exports.Formatting=Y;exports.FullWidthSection=cn;exports.GET_STREAM_USER_PREFIX=ss;exports.GlobalProviders=gm;exports.Header=wo;exports.HelperTextBox=qc;exports.HiddenFromScreenReaders=qa;exports.HideShowTextBox=Wc;exports.HighlightSection=jE;exports.HighlightedTextBox=Rt;exports.INVALID_TOKEN=jc;exports.IconBulletedList=em;exports.ImageContainer=Zh;exports.IntlProvider=Yc;exports.InviteForm=Nf;exports.InviteModal=xE;exports.JoinButton=Vs;exports.LanguageContext=Hs;exports.LanguageSwitcher=xm;exports.LessonName=hh;exports.LessonType=mh;exports.Link=Bn;exports.LoadMore=Mr;exports.LoadingBlock=dm;exports.LoadingPlaceholder=Et;exports.LoadingState=qs;exports.Logo=Ks;exports.LogoSection=vC;exports.MENTION_REGEX=Oc;exports.MarkCompleteButton=WE;exports.MarkdownText=Zn;exports.MarketingBlock=OE;exports.Marks=Pt;exports.Member=Dn;exports.MembersList=EC;exports.Modal=Fo;exports.MoreMenu=Xc;exports.NUMBER_OF_COUNTRIES=Ph;exports.NUMBER_OF_USERS=Oh;exports.NavigationMenu=ed;exports.NotFoundError=UE;exports.Overlay=ir;exports.OverlayContext=Us;exports.OverlayProvider=Jc;exports.PageHeading=Hc;exports.PageLayout=$f;exports.PasswordForm=oC;exports.PasswordRules=ud;exports.Pill=mn;exports.Popover=$c;exports.Portal=Ha;exports.ProfileImageChange=sC;exports.ProfilePicture=Zt;exports.ProgressBar=zs;exports.ProgressTracker=Yh;exports.Rating=$m;exports.RepliesFeed=Jf;exports.ResponsesHeading=Wf;exports.ResponsiveImage=rr;exports.ReturnToNavButton=Gh;exports.RichTextEditor=Of;exports.SearchForm=Rf;exports.ShareLinks=_m;exports.SignupForm=hC;exports.Span=cs;exports.StatusBanner=Br;exports.TableOfContents=kE;exports.Tabs=Bm;exports.Tags=wC;exports.TestimonialBlock=EE;exports.TimeToComplete=ri;exports.Toggle=iC;exports.Tooltip=_n;exports.TopLevelPage=yC;exports.UUID_V4_REGEX=_r;exports.UserContext=$t;exports.UserProvider=Gc;exports.VisuallyHidden=Me;exports.addAriaProps=ch;exports.basicReducer=Rr;exports.camelCaseToDashCase=Fc;exports.checkIntlPathExists=Wa;exports.generateConditions=ba;exports.generateCssIcon=Pc;exports.getCharacterLimitProps=nd;exports.getLongDate=Ls;exports.getMember=Va;exports.getShortDate=Nc;exports.getValueLength=Za;exports.headerData=Nr;exports.mapGetStreamData=HE;exports.pageReady=Rc;exports.passwordValidator=us;exports.repliesFeedMock=aw;exports.supportedLanguages=da;exports.toCamelCase=Tc;exports.toCapitalisedCase=jh;exports.toSentenceCase=Sc;exports.useCurrentPath=wc;exports.useEffectAfterMount=Kn;exports.useElementWidth=er;exports.useOverlay=Qc;exports.useScrollListener=_c;exports.useScrollToHash=Is;exports.useTooltips=$s;exports.useUser=Ka;
|
|
165
|
+
*/function mc(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 pc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?mc(Object(n),!0).forEach(function(r){Gw(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mc(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Gw(e,t,n){return t=Jw(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qw(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 Jw(e){var t=Qw(e,"string");return typeof t=="symbol"?t:String(t)}var gc={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()}},Xw=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},eE=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},_r=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},tE=function(t){return _r(t)&&!t.shiftKey},nE=function(t){return _r(t)&&t.shiftKey},vc=function(t){return setTimeout(t,0)},bc=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},mr=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return typeof t=="function"?t.apply(void 0,r):t},oa=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},rE=[],aE=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||rE,i=pc({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:tE,isKeyBackward:nE},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(E,A,N){return E&&E[A]!==void 0?E[A]:i[N||A]},u=function(E,A){var N=typeof(A==null?void 0:A.composedPath)=="function"?A.composedPath():void 0;return s.containerGroups.findIndex(function(R){var H=R.container,G=R.tabbableNodes;return H.contains(E)||(N==null?void 0:N.includes(H))||G.find(function(Q){return Q===E})})},c=function(E){var A=i[E];if(typeof A=="function"){for(var N=arguments.length,R=new Array(N>1?N-1:0),H=1;H<N;H++)R[H-1]=arguments[H];A=A.apply(void 0,R)}if(A===!0&&(A=void 0),!A){if(A===void 0||A===!1)return A;throw new Error("`".concat(E,"` was specified but was not a node, or did not return a node"))}var G=A;if(typeof A=="string"&&(G=r.querySelector(A),!G))throw new Error("`".concat(E,"` as selector refers to no known node"));return G},h=function(){var E=c("initialFocus");if(E===!1)return!1;if(E===void 0||!xa(E,i.tabbableOptions))if(u(r.activeElement)>=0)E=r.activeElement;else{var A=s.tabbableGroups[0],N=A&&A.firstTabbableNode;E=N||c("fallbackFocus")}if(!E)throw new Error("Your focus-trap needs to have at least one focusable element");return E},p=function(){if(s.containerGroups=s.containers.map(function(E){var A=lh(E,i.tabbableOptions),N=ch(E,i.tabbableOptions),R=A.length>0?A[0]:void 0,H=A.length>0?A[A.length-1]:void 0,G=N.find(function(x){return hn(x)}),Q=N.slice().reverse().find(function(x){return hn(x)}),re=!!A.find(function(x){return nn(x)>0});return{container:E,tabbableNodes:A,focusableNodes:N,posTabIndexesFound:re,firstTabbableNode:R,lastTabbableNode:H,firstDomTabbableNode:G,lastDomTabbableNode:Q,nextTabbableNode:function($){var W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=A.indexOf($);return _<0?W?N.slice(N.indexOf($)+1).find(function(F){return hn(F)}):N.slice(0,N.indexOf($)).reverse().find(function(F){return hn(F)}):A[_+(W?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(E){return E.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(E){return E.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},m=function z(E){var A=E.activeElement;if(A)return A.shadowRoot&&A.shadowRoot.activeElement!==null?z(A.shadowRoot):A},g=function z(E){if(E!==!1&&E!==m(document)){if(!E||!E.focus){z(h());return}E.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=E,Xw(E)&&E.select()}},f=function(E){var A=c("setReturnFocus",E);return A||(A===!1?!1:E)},y=function(E){var A=E.target,N=E.event,R=E.isBackward,H=R===void 0?!1:R;A=A||oa(N),p();var G=null;if(s.tabbableGroups.length>0){var Q=u(A,N),re=Q>=0?s.containerGroups[Q]:void 0;if(Q<0)H?G=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:G=s.tabbableGroups[0].firstTabbableNode;else if(H){var x=bc(s.tabbableGroups,function(M){var V=M.firstTabbableNode;return A===V});if(x<0&&(re.container===A||xa(A,i.tabbableOptions)&&!hn(A,i.tabbableOptions)&&!re.nextTabbableNode(A,!1))&&(x=Q),x>=0){var $=x===0?s.tabbableGroups.length-1:x-1,W=s.tabbableGroups[$];G=nn(A)>=0?W.lastTabbableNode:W.lastDomTabbableNode}else _r(N)||(G=re.nextTabbableNode(A,!1))}else{var _=bc(s.tabbableGroups,function(M){var V=M.lastTabbableNode;return A===V});if(_<0&&(re.container===A||xa(A,i.tabbableOptions)&&!hn(A,i.tabbableOptions)&&!re.nextTabbableNode(A))&&(_=Q),_>=0){var F=_===s.tabbableGroups.length-1?0:_+1,I=s.tabbableGroups[F];G=nn(A)>=0?I.firstTabbableNode:I.firstDomTabbableNode}else _r(N)||(G=re.nextTabbableNode(A))}}else G=c("fallbackFocus");return G},v=function(E){var A=oa(E);if(!(u(A,E)>=0)){if(mr(i.clickOutsideDeactivates,E)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}mr(i.allowOutsideClick,E)||E.preventDefault()}},k=function(E){var A=oa(E),N=u(A,E)>=0;if(N||A instanceof Document)N&&(s.mostRecentlyFocusedNode=A);else{E.stopImmediatePropagation();var R,H=!0;if(s.mostRecentlyFocusedNode)if(nn(s.mostRecentlyFocusedNode)>0){var G=u(s.mostRecentlyFocusedNode),Q=s.containerGroups[G].tabbableNodes;if(Q.length>0){var re=Q.findIndex(function(x){return x===s.mostRecentlyFocusedNode});re>=0&&(i.isKeyForward(s.recentNavEvent)?re+1<Q.length&&(R=Q[re+1],H=!1):re-1>=0&&(R=Q[re-1],H=!1))}}else s.containerGroups.some(function(x){return x.tabbableNodes.some(function($){return nn($)>0})})||(H=!1);else H=!1;H&&(R=y({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(R||s.mostRecentlyFocusedNode||h())}s.recentNavEvent=void 0},B=function(E){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=E;var N=y({event:E,isBackward:A});N&&(_r(E)&&E.preventDefault(),g(N))},C=function(E){if(eE(E)&&mr(i.escapeDeactivates,E)!==!1){E.preventDefault(),o.deactivate();return}(i.isKeyForward(E)||i.isKeyBackward(E))&&B(E,i.isKeyBackward(E))},w=function(E){var A=oa(E);u(A,E)>=0||mr(i.clickOutsideDeactivates,E)||mr(i.allowOutsideClick,E)||(E.preventDefault(),E.stopImmediatePropagation())},T=function(){if(s.active)return gc.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?vc(function(){g(h())}):g(h()),r.addEventListener("focusin",k,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",w,{capture:!0,passive:!1}),r.addEventListener("keydown",C,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",k,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",w,!0),r.removeEventListener("keydown",C,!0),o},q=function(E){var A=E.some(function(N){var R=Array.from(N.removedNodes);return R.some(function(H){return H===s.mostRecentlyFocusedNode})});A&&g(h())},P=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(q):void 0,L=function(){P&&(P.disconnect(),s.active&&!s.paused&&s.containers.map(function(E){P.observe(E,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(E){if(s.active)return this;var A=l(E,"onActivate"),N=l(E,"onPostActivate"),R=l(E,"checkCanFocusTrap");R||p(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,A==null||A();var H=function(){R&&p(),T(),L(),N==null||N()};return R?(R(s.containers.concat()).then(H,H),this):(H(),this)},deactivate:function(E){if(!s.active)return this;var A=pc({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},E);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,L(),gc.deactivateTrap(a,o);var N=l(A,"onDeactivate"),R=l(A,"onPostDeactivate"),H=l(A,"checkCanReturnFocus"),G=l(A,"returnFocus","returnFocusOnDeactivate");N==null||N();var Q=function(){vc(function(){G&&g(f(s.nodeFocusedBeforeActivation)),R==null||R()})};return G&&H?(H(f(s.nodeFocusedBeforeActivation)).then(Q,Q),this):(Q(),this)},pause:function(E){if(s.paused||!s.active)return this;var A=l(E,"onPause"),N=l(E,"onPostPause");return s.paused=!0,A==null||A(),S(),L(),N==null||N(),this},unpause:function(E){if(!s.paused||!s.active)return this;var A=l(E,"onUnpause"),N=l(E,"onPostUnpause");return s.paused=!1,A==null||A(),p(),T(),L(),N==null||N(),this},updateContainerElements:function(E){var A=[].concat(E).filter(Boolean);return s.containers=A.map(function(N){return typeof N=="string"?r.querySelector(N):N}),s.active&&p(),L(),this}},o.updateContainerElements(t),o};const iE=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:aE},Symbol.toStringTag,{value:"Module"})),sE=wc(iE),oE=wc(Yw);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 uE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yc(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,dh(r.key),r)}}function lE(e,t,n){return t&&yc(e.prototype,t),n&&yc(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function cE(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ms(e,t)}function Ms(e,t){return Ms=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Ms(e,t)}function dE(e){var t=hE();return function(){var r=za(e),a;if(t){var i=za(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return fE(this,a)}}function fE(e,t){if(t&&(er(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return br(e)}function br(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hE(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function za(e){return za=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},za(e)}function mE(e,t,n){return t=dh(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dh(e){var t=pE(e,"string");return er(t)==="symbol"?t:String(t)}function pE(e,t){if(er(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(er(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ua=D,be=Ow,gE=sE,vE=gE.createFocusTrap,bE=oE,yE=bE.isFocusable,To=function(e){cE(n,e);var t=dE(n);function n(r){var a;uE(this,n),a=t.call(this,r),mE(br(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var c=arguments.length,h=new Array(c>1?c-1:0),p=1;p<c;p++)h[p-1]=arguments[p];u=u.apply(void 0,h)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var m=u;if(typeof u=="string"){var g;if(m=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!m)throw new Error("`".concat(o,"` as selector refers to no known node"))}return m}),a.handleDeactivate=a.handleDeactivate.bind(br(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(br(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(br(a)),a.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:a.handleDeactivate,onPostDeactivate:a.handlePostDeactivate,clickOutsideDeactivates:a.handleClickOutsideDeactivates},a.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){a.originalOptions[s]=i[s];continue}a.internalOptions[s]=i[s]}return a.outsideClick=null,a.focusTrapElements=r.containerElements||[],a.updatePreviousElement(),a}return lE(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&&!yE(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,c=u===void 0?!1:u;l&&o.focus({preventScroll:c}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?ua.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===ua.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var c=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=c||[u]},o=ua.cloneElement(i,{ref:s});return o}return null}}]),n}(ua.Component),pr=typeof Element>"u"?Function:Element;To.propTypes={active:be.bool,paused:be.bool,focusTrapOptions:be.shape({document:be.object,onActivate:be.func,onPostActivate:be.func,checkCanFocusTrap:be.func,onPause:be.func,onPostPause:be.func,onUnpause:be.func,onPostUnpause:be.func,onDeactivate:be.func,onPostDeactivate:be.func,checkCanReturnFocus:be.func,initialFocus:be.oneOfType([be.instanceOf(pr),be.string,be.bool,be.func]),fallbackFocus:be.oneOfType([be.instanceOf(pr),be.string,be.func]),escapeDeactivates:be.oneOfType([be.bool,be.func]),clickOutsideDeactivates:be.oneOfType([be.bool,be.func]),returnFocusOnDeactivate:be.bool,setReturnFocus:be.oneOfType([be.instanceOf(pr),be.string,be.bool,be.func]),allowOutsideClick:be.oneOfType([be.bool,be.func]),preventScroll:be.bool,tabbableOptions:be.shape({displayCheck:be.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:be.oneOfType([be.bool,be.func])}),trapStack:be.array,isKeyForward:be.func,isKeyBackward:be.func}),containerElements:be.arrayOf(be.instanceOf(pr)),children:be.oneOfType([be.element,be.instanceOf(pr)])};To.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:vE};var DE=To;const xE=Bn(DE);const So=({element:e="section",children:t,className:n,...r})=>D.createElement(e,{className:Y("modal",n),children:typeof t=="string"?d.jsx("p",{children:t}):t,...r});const sr=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:c="",gtmContext:h="Modal"})=>{const p=ue.useIntl(),{registerOverlay:m,unregisterOverlay:g}=Xc(),[f,y]=D.useState(t),v=D.useRef(null),k=w=>{w.key==="Escape"&&B(!1)};D.useEffect(()=>(window.addEventListener("keyup",k),()=>{window.removeEventListener("keyup",k)}));const B=w=>{if(y(w),w)a(),m(e);else{if(f===w)return;i(),g(e)}};D.useEffect(()=>(B(t),()=>{f&&g(e)}),[t]);const C=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{id:`${e}-overlay`,ref:v,className:Y("overlay",{open:f,"in-portal":c.includes("in-portal")}),role:"dialog",children:d.jsx(So,{id:e,className:Y("overlay-modal",c,{"has-max-width":r}),hidden:!f,style:C,children:t&&d.jsx(xE,{containerElements:[v.current],children:d.jsxs("div",{className:"overlay-content",children:[d.jsxs("div",{className:"top",children:[o&&d.jsx("h2",{className:"modal-title",children:o}),d.jsx(_e,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>B(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":h,screenreaderText:p.formatMessage({id:"overlay_close"})})]}),n&&d.jsx(Kt,{}),l,u&&d.jsxs("div",{className:"bottom",children:[d.jsx(Kt,{}),d.jsx(rr,{buttons:u})]}),s&&d.jsx(Ar,{className:"error",children:s})]})})})})},fh=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const hh=({showModal:e=!0,functions:t,form:n,cachedText:r,className:a})=>{const i=ue.useIntl(),s="discussionFormModal_",{onClose:o=()=>{},cacheText:l=()=>{}}=t,{data:u,meta:c,functions:h}=n,{title:p="",body:m="",mentions:g}=r||{},f="discussion-form-modal";return d.jsx(sr,{id:f,title:i.formatMessage({id:`${s}title`}),isOpen:e,functions:{onClose:()=>{l({...r,showCachedText:!0}),o()}},className:Y("discussion-form-modal",a),children:d.jsx(zr,{...n,data:{...u,mentions:g||(u==null?void 0:u.mentions)},meta:{...c,isAutoFocused:!0,isInOverlay:`${f}-overlay`,hasTitleField:{text:p},isPrepopulated:{text:m||(c==null?void 0:c.isPrepopulated)!==!1&&(c==null?void 0:c.isPrepopulated.text)||""},showGuidelines:!1,showDivider:!0},buttons:{submit:i.formatMessage({id:`${s}cta`})},functions:{...h,onChange:y=>{l({...r,...y})},onMention:({id:y,name:v}={})=>{if(!y||!v)return;const k=g||{};k[y]={created_at:"",updated_at:"",id:y,data:{name:v}},l({...r,mentions:k})},create:async y=>{o(),h.create&&await h.create(y),l({showCachedText:!1})},handleSaveEdit:async y=>{o(),h.handleSaveEdit&&await h.handleSaveEdit(y),l({showCachedText:!1})}}})})},CE=Object.freeze(Object.defineProperty({__proto__:null,default:hh},Symbol.toStringTag,{value:"Module"}));const wE=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const c=ue.useIntl();return r||(r=c.formatMessage({id:"inviteModal_formTitle"})),a||(a=c.formatMessage({id:"inviteModal_formLabel"})),i||(i=c.formatMessage({id:"inviteModal_cta"})),d.jsx(sr,{id:"invite-user-modal",title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:Y("invite-modal",e,{success:!!n}),children:d.jsx(Mf,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const EE=({members:e})=>{const[t,n]=D.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return d.jsxs(d.Fragment,{children:[d.jsx(Yt,{name:i,src:l}),d.jsx("p",{children:i}),d.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return d.jsxs("div",{className:"directory-wrapper",children:[d.jsx("ul",{className:"directory",children:e.map(a=>d.jsx("li",{children:d.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),d.jsx(sr,{isOpen:t!==!1,children:t===!1?"":d.jsxs(d.Fragment,{children:[r(t),d.jsx(xn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const kE=({author:e,authorCite:t,content:n,member:r,className:a=""})=>d.jsxs("blockquote",{className:Y("testimonial-block",a),children:[d.jsx(Rt,{className:"testimonial",children:n}),r?d.jsx(Cn,{member:r,styling:{size:"large"}}):d.jsxs(d.Fragment,{children:[e&&d.jsx("p",{className:Y("author",{"text-small":!a.includes("new")}),children:e}),t&&d.jsx("p",{className:Y("author-cite",{"text-small":!a.includes("new")}),children:d.jsx("cite",{children:t})})]})]}),_E=D.memo(kE);const BE=({items:e=[],selector:t="",className:n=""})=>{const r=ue.useIntl(),[a,i]=D.useState(e);return D.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,c)=>{s+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&d.jsxs(Mt,{variant:"subtle",className:Y("table-of-contents",n),children:[d.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),d.jsx("nav",{children:d.jsx("ul",{children:a.map(({id:s,text:o})=>d.jsx("li",{children:d.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const ai=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=ue.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=c=>{const h=c/60,p=Math.floor(h),m=(h-p)*60,g=Math.round(m),f=`${i.formatMessage({id:`${s}hours`},{time:p})}${p>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${p>0?`${i.formatMessage({id:`${s}hours_short`},{time:p})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:f}};let{text:l,ariaText:u}=o(e);if(t){const{text:c,ariaText:h}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:c}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:h})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),d.jsx("span",{className:Y("time-to-complete",a),"aria-label":u,children:l})};const AE=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",d.jsx(ar,{...n,className:Y("banner",e),image:{...t,aspect:"banner"}})):null;const FE=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],TE=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,f;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],h={eyebrow:"small",title:"h1",text:"p"},p={};c.forEach(y=>{if(!t[y]){p[y]=!1;return}if(!s[y]){if(typeof t[y]=="object"){p[y]=t[y];const{text:v,element:k}=t[y];if(k&&FE.includes(k.toLowerCase()))return;p[y]={text:v,element:h[y]};return}p[y]={text:t[y],element:h[y]}}});const m=o&&o.text&&o.link;return m&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=y=>{y.preventDefault(),y.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),d.jsx(dn,{className:Y("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":m,"has-extra-spacing":r!=="subtle"&&a==="normal"&&p.eyebrow&&p.title}),children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"content-wrapper",children:[c.map(y=>{if(p[y]&&typeof p[y]=="object"){const{text:v,element:k=""}=p[y];return y==="text"?d.jsx(xn,{overrideType:"text-only",className:"text",children:v},y):D.createElement(k,{key:y,className:y},v)}return null}),l,m&&d.jsx(_e,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:Y({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(f=o.props)==null?void 0:f.className}),children:o.text})]}),n&&d.jsx(ar,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},SE=D.memo(TE);const jE=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),d.jsx(dn,{className:Y("custom-content-banner",t,r,{"has-image":e}),style:a,children:d.jsx("div",{className:"content-slim",children:n})})};const OE=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx(xn,{children:n}):n;return d.jsxs(dn,{className:Y("highlight-section",t),children:[r&&d.jsx("div",{className:Y("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:d.jsx(ar,{image:{...r,description:""}})}),d.jsx("div",{className:Y("highlight-container highlight-content-wrapper",{"no-image":!r}),children:d.jsx("div",{className:Y("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:d.jsx("div",{className:"content-default",children:a})})})]})},PE=D.memo(OE);const NE=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:d.jsxs("aside",{className:Y("marketing-block",e),children:[n&&d.jsx("p",{className:"title",children:n}),r&&d.jsx("p",{children:r}),t&&d.jsx(_e,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),RE=({type:e,data:t})=>{const n=ue.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const h=a&&us(a);return d.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&d.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})]})]})}if(c&&!i||s)return d.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):zs(c)});if(o)return d.jsx(pn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const h=u&&us(u);return d.jsxs("ul",{className:"details",children:[l&&d.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&d.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:h?n.formatMessage({id:`dates_${h.path}`},{number:h.number}):0})})]})}return null},qa={communityPage:{basePath:"/communities/",className:"communityPage",gtmEvent:"community"},customCard:{className:"custom",gtmEvent:"custom",length:{text:335,secondaryText:150}},event:{basePath:"/events/",className:"event",gtmEvent:"event"},microcourse:{basePath:"/microcourses/en/",className:"course",gtmEvent:"microcourse-overview"},solutionArticle:{basePath:"/solution-articles/en/",className:"article",length:{title:60},gtmEvent:"article"},qaQuestion:{basePath:"/questions-answers/",className:"question",length:{title:190},gtmEvent:"q-and-a-question"},listPage:{basePath:"/list/en/",className:"list",gtmEvent:"list"},people:{basePath:"/profiles/",className:"people",length:{people:1e3},gtmEvent:"person"},learningHub:{basePath:"/learning-hub/",className:"learning-hub",length:{title:190},gtmEvent:"learning-hub"}},ME=({data:e,cta:t,link:n,gtmContext:r})=>{var f,y;const a=ue.useIntl(),[i,s]=D.useState({loading:!1,registered:e.registered||!1});D.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:c,slug:h}=e,p=e.contentType;let m="";if((f=qa[p])!=null&&f.gtmEvent&&(m=qa[p].gtmEvent),l&&u)return n?d.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(p==="people")return n?d.jsx(_e,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${m}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(p)&&c!=="premium"){const v=i.loading||i.registered||((y=e==null?void 0:e.members)==null?void 0:y.isMember),k=async B=>{if(B.preventDefault(),B.stopPropagation(),!(v||!t||!t.onClick)){s(C=>({...C,loading:!0}));try{const C=await t.onClick(e);s(C==="success"?()=>({registered:!0,loading:!1}):w=>({...w,loading:!1}))}catch{s(w=>({...w,loading:!1}))}}};return d.jsx("p",{className:Y("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:d.jsx(_e,{onClick:k,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${p}: ${h}`,"data-gtm-event-type":`${r}-${p}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${p}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const IE={title:66,text:3e3,secondaryText:1e3,partner:25},jo=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s,setFocus:o=!1})=>{var z,E,A,N,R;const l=ue.useIntl(),u=D.useContext(Lt),c=u&&typeof u.id=="string",h=D.useRef(null),[p,m]=D.useState({data:null,isLoading:!0}),{data:g,isLoading:f}=p,y=D.useCallback(()=>{n(t,c).then(H=>{m(()=>({data:H,isLoading:!1}))}).catch(()=>m(H=>({...H,isLoading:!1})))},[e]);if(D.useEffect(()=>{y()},[]),f||!g)return d.jsx(kt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:l.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:v}=g;if(!v||!qa[v])return d.jsx(kt,{element:"li",className:"card-wrapper"});const{basePath:k="",className:B,length:C,gtmEvent:w}=qa[v];let T=g.slug?`${k}${g.slug}`:!1;g.slug&&(g.slug.slice(0,4)==="http"||g.slug.slice(0,2)==="//"||g.slug.slice(0,6)==="mailto"||g.slug.slice(0,3)==="tel")&&(T=g.slug);const S=H=>{T&&(H.preventDefault(),H.stopPropagation(),window.location.href=T)},q={...IE,...C};let P={className:"card"},L={};return T&&(L={href:T,className:"gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${w}-click`,"data-testid":"link"},g.openInNewTab&&(L.target="_blank"),P={onClick:S,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${w}-click`}),o&&(P={...P,tabIndex:"0"},(z=h==null?void 0:h.current)==null||z.focus(),(E=h==null?void 0:h.current)==null||E.scrollIntoView({behavior:"smooth"})),d.jsx("li",{className:Y("card-wrapper text-medium",B,i,{"has-link":T,"no-link":!T,"has-image":g.banner}),"data-testid":`${v}-card`,children:d.jsxs("div",{...P,ref:h,children:[d.jsx(qc,{className:"card-label",contentType:v,customIcon:g.isPrivate?"lock-locked":g.customIcon,customLabel:g.customLabel}),v==="communityPage"&&(g==null?void 0:g.createdAt)&&Ih(g==null?void 0:g.createdAt,60)&&d.jsx(pn,{size:"small",variant:"information","data-testid":"new-community",children:l.formatMessage({id:"card_new"})}),g.startDate&&!g.isOngoingEvent&&d.jsx(pn,{size:"small",variant:g.dateHasPassed?"default":"information","data-testid":"date",children:g.dateHasPassed?l.formatMessage({id:"card_ended"}):Mc(g.startDate)}),g.banner?d.jsxs("p",{className:"img",children:[g.registered&&d.jsx(pn,{size:"small",variant:"registered",children:l.formatMessage({id:"card_registered"})}),d.jsx(ar,{image:{...g.banner,description:""}})]}):B==="people"?d.jsx(Yt,{name:g.title||"",src:g.profile,"data-testid":"people-profile-picture"}):null,g.contributors&&d.jsx(Hs,{contributors:{data:g.contributors},styling:{size:"small",showGap:B!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(v)?l.formatMessage({id:`card_contributors_${v}`}):void 0,"data-testid":"contributors"}),g.partner&&d.jsx("p",{className:"partners","data-testid":"partners",children:g.partner.length>1?l.formatMessage({id:"card_partner"},{partner:g.partner[0],number:g.partner.length-1}):Zn(g.partner[0],q.partner)}),["title","text","secondaryText"].map(H=>{const G=g[H];if(!G)return null;const Q=Sc(H),re={key:H,className:Q,"data-testid":Q},x={wrapper:"p",forceWrapper:!0,forceInline:!0},$=Zn(G,q[H]);return["title","text"].includes(H)&&T?(x.wrapper="a",d.jsx("p",{...re,children:d.jsx(Rt,{options:x,...L,children:$})})):d.jsx(Rt,{options:x,...re,children:$})}),(u==null?void 0:u.id)&&(g==null?void 0:g.members)&&d.jsxs("span",{className:"member-information",children:[((A=g==null?void 0:g.members)==null?void 0:A.isMember)&&d.jsx(pn,{size:"small",variant:"registered",icon:((N=g==null?void 0:g.members)==null?void 0:N.memberType)==="owner"?"user":"tick",children:l.formatMessage({id:`card_member_type_${(R=g==null?void 0:g.members)==null?void 0:R.memberType}`})}),d.jsx("br",{}),d.jsx("span",{className:"label member-count",children:l.formatMessage({id:"card_member_count"},{count:g==null?void 0:g.members.count})})]}),d.jsx(RE,{type:B||"",data:g}),d.jsx(ME,{data:g,cta:r,link:T||"",gtmContext:a})]})})};const mh=({cards:e,cardTypes:t,className:n="",...r})=>d.jsx("ul",{className:Y("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return d.jsx(jo,{id:s,card:{...a,contentType:t[i]},setFocus:i===(r==null?void 0:r.focusCardIndex),...r},s)})}),$E=(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},LE=({id:e,title:t})=>{const n=ue.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return D.createElement(a,{className:Y("title",i,s,{"highlighted-title":i==="highlighted"}),children:d.jsxs(d.Fragment,{children:[r,o&&d.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const as={fourCards:1024,threeCards:769,twoCards:480};let la=null;const zE=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ue.useIntl(),[u,c]=D.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:h,isLoading:p}=u,[m,g]=D.useState({currentPage:0,loadedPages:[0]}),{currentPage:f,loadedPages:y}=m,[v,k]=D.useState(""),B=t.length,C=Math.ceil(B/h),w=D.useRef(null),T=tr(!0,!0,w==null?void 0:w.current);D.useEffect(()=>{let E=1;T&&(T>=as.fourCards?E=4:T>=as.threeCards?E=3:T>=as.twoCards&&(E=2),E>B&&(E=B)),c(A=>({...A,cardsPerPage:E,isLoading:!1}))},[T,B]);const S=(E="next")=>{let A=f;if(typeof E=="string")if(E==="next")if(f<C-1)A=f+1;else return;else if(f>0)A=f-1;else return;else A=E;g(R=>({...R,currentPage:A,loadedPages:[...new Set([...y,A])]}));const N=()=>{const R=A*u.cardsPerPage,H=R+u.cardsPerPage;return t.slice(R,H).length};k(l.formatMessage({id:"carousel_pagination_aria_live"},{direction:E,count:N()}))},q=E=>{la=E.touches[0].clientX},P=E=>{if(la===null)return;const A=E.touches[0].clientX,N=la-A;N>5?S("next"):N<-5&&S("previous"),la=null},L={"--width":`${T||0}px`,"--total-cards":B,"--cards-per-page":h,"--page":f};if(p)return d.jsx(Ws,{layout:`carousel${a?"-with-title":""}`});const z=(E,A)=>{var R;let N=null;return(R=E==null?void 0:E.sys)!=null&&R.id?N=`card-${E.sys.id}`:E!=null&&E.slug?N=`card-${E.slug}`:[n[A],E.contentType].includes("customCard")&&(N=`card-${window.btoa(`${E.title} ${E.createdAt}`)}-${A}`),N};return d.jsxs("section",{ref:w,className:Y("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx(LE,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:q,onTouchMove:P,style:L,"data-testid":"carousel-list",children:t.map((E,A)=>{let N=z(E,A);return N&&$E(A,h,f,y)?d.jsx(jo,{id:N,card:{...E,contentType:n[A]},buildCardData:r,gtmContext:s,...o},N):(N=N||`${e}-card-${A}`,d.jsx(kt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},N))})}),C<=1?null:d.jsxs(d.Fragment,{children:[d.jsxs("ul",{className:"controls","data-testid":"carousel-controls",children:[d.jsx("li",{className:"arrow previous",children:d.jsx(_e,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:E=>{E.preventDefault(),E.stopPropagation(),S("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:f<=0})}),[...Array(C)].map((E,A)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:Y("page-indicator",{selected:A===f}),onClick:N=>{N.preventDefault(),N.stopPropagation(),S(A)},children:d.jsx(Ie,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:A+1,total:C})})})},`page-indicator-${A}`)),d.jsx("li",{className:"arrow next",children:d.jsx(_e,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:E=>{E.preventDefault(),E.stopPropagation(),S("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:f>=C-1})})]}),d.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:v})]})]})},qE=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const c=i?window.btoa(i):`carousel-${u}`,h=u===e.length-1;return t?d.jsxs(D.Fragment,{children:[d.jsx(Ws,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),h?null:d.jsx(Kt,{})]},`placeholder-${c}`):d.jsxs(D.Fragment,{children:[d.jsx(zE,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),h?null:d.jsx(Kt,{})]},`carousel-${c}`)});const WE=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ue.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=s;return D.createElement(e,{className:Y("course-progression",o,{"highlight-percentage":c,"has-circle-graph":i==="circle"}),children:d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:h=>d.jsx("strong",{children:h}),number:u})}),u<100&&a&&d.jsx(ai,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx(qs,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const ph=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>D.createElement(e,{className:Y("lesson-name",a),"data-number":`${t}.${n}`,children:r});const gh=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ue.useIntl(),o=Ha(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Oc(a||"");return d.jsxs("small",{className:Y("content-type",{[e]:e!=="default"}),children:[d.jsx("span",{className:Y("type",n),children:o})," ",t>0&&!r&&d.jsx(ai,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const HE=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const h=ue.useIntl(),p="courseStructure_",m=u.toLowerCase().includes("course conclusion");return d.jsxs(Va,{className:"course-structure",label:d.jsxs(d.Fragment,{children:[d.jsxs("small",{children:[h.formatMessage({id:`${p}section${m?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?h.formatMessage({id:`${p}time_completed`}):d.jsx(ai,{time:s,appendedText:a?h.formatMessage({id:`${p}time_left`}):""})})]}),d.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[d.jsx("p",{children:n}),d.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:f,contentType:y,icon:v,image:k,isIntroduction:B,optional:C,slug:w,subsectionId:T,title:S,type:q})=>{const P=a&&t||B,L={};return k&&(L.style={"--image":`url(${k})`}),d.jsx("li",{className:Y({article:y===gr.ARTICLE,discussion:y===gr.DISCUSSION,quiz:y===gr.QUIZ,completed:g&&y===gr.ARTICLE,locked:!P}),...L,children:d.jsx(Fn,{href:P?`/microcourses/en/${o}/${w}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${jc(S)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(ph,{sectionId:i,subsectionId:T,title:S,className:"course-title"})," ",d.jsx(gh,{completionTime:f,icon:v,optional:C,type:q,children:c&&c[w]&&d.jsx("span",{className:"quiz-score",children:`${c[w]}%`})})]})})},w)})})]})};const UE=({isComplete:e=!1,onClick:t,...n})=>{const r=ue.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),d.jsx(_e,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className:Y("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})},VE=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),Dc=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ca="notFoundError_",KE=()=>{const e=ue.useIntl(),t=[];return Dc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ca}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(zf,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(dn,{children:[d.jsx(mh,{cards:Dc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(_e,{href:"/solution-articles/",children:e.formatMessage({id:`${ca}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ca}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ca}text`})})]})};exports.ASSETS_BUCKET=It;exports.ActivitiesFeed=iw;exports.ActivitySection=Ew;exports.AddPost=_o;exports.Banner=AE;exports.BannerSection=SE;exports.Breadcrumbs=Dm;exports.Buckets=Xh;exports.Button=_e;exports.ButtonWrapper=rr;exports.COURSE_CONTENT_TYPES=gr;exports.CacheProvider=Yc;exports.Card=jo;exports.CardBlock=mh;exports.Carousel=qE;exports.CharacterLimit=Ys;exports.CollapsibleSection=Va;exports.Columns=rd;exports.CommunityDetails=ym;exports.ContactFooter=DC;exports.ContactForm=Rf;exports.ContentTypeLabel=qc;exports.Contributors=Hs;exports.ConversationContext=ri;exports.CookieBanner=Lf;exports.CourseProgression=WE;exports.CourseStructure=HE;exports.CustomContentBanner=jE;exports.Directory=EE;exports.DiscussionConversation=qf;exports.DiscussionForm=zr;exports.DiscussionFormCard=Hf;exports.DiscussionFormModal=hh;exports.DiscussionLikes=Wf;exports.DiscussionPost=qr;exports.DiscussionThread=Vf;exports.Divider=Kt;exports.DownloadSection=gC;exports.EMAILS=$n;exports.EditSection=bC;exports.EmailHelperTextBox=id;exports.EmptyStateBox=un;exports.Filters=xm;exports.FlagsProvider=Gc;exports.Footer=wo;exports.Form=Tn;exports.Formatting=Z;exports.Fragment=xt;exports.FullWidthSection=dn;exports.GET_STREAM_USER_PREFIX=os;exports.GlobalProviders=bm;exports.Header=Eo;exports.HelperTextBox=Hc;exports.HiddenFromScreenReaders=Wa;exports.HideShowTextBox=Uc;exports.HighlightSection=PE;exports.HighlightedTextBox=Mt;exports.INVALID_TOKEN=Pc;exports.IconBulletedList=nm;exports.ImageContainer=Gh;exports.IntlProvider=Qc;exports.InviteForm=Mf;exports.InviteModal=wE;exports.JoinButton=Ks;exports.LanguageContext=Us;exports.LanguageSwitcher=wm;exports.LessonName=ph;exports.LessonType=gh;exports.Link=Fn;exports.LoadMore=$r;exports.LoadingBlock=hm;exports.LoadingPlaceholder=kt;exports.LoadingState=Ws;exports.Logo=Zs;exports.LogoSection=yC;exports.MENTION_REGEX=Nc;exports.MarkCompleteButton=UE;exports.MarkdownText=xn;exports.MarketingBlock=NE;exports.Marks=Nt;exports.Member=Cn;exports.MembersList=_C;exports.Modal=So;exports.MoreMenu=td;exports.NUMBER_OF_COUNTRIES=Rh;exports.NUMBER_OF_USERS=Nh;exports.NavigationMenu=nd;exports.NotFoundError=KE;exports.Overlay=sr;exports.OverlayContext=Vs;exports.OverlayProvider=ed;exports.PageHeading=Vc;exports.PageLayout=zf;exports.PasswordForm=lC;exports.PasswordRules=cd;exports.Pill=pn;exports.Popover=zc;exports.Portal=Ua;exports.ProfileImageChange=uC;exports.ProfilePicture=Yt;exports.ProgressBar=qs;exports.ProgressTracker=Qh;exports.Rating=zm;exports.RepliesFeed=eh;exports.ResponsesHeading=Uf;exports.ResponsiveImage=ar;exports.ReturnToNavButton=Jh;exports.RichTextEditor=Nf;exports.SearchForm=If;exports.ShareLinks=Am;exports.SignupForm=pC;exports.Span=ds;exports.StatusBanner=Ar;exports.TableOfContents=BE;exports.Tabs=Fm;exports.Tags=kC;exports.TestimonialBlock=_E;exports.TimeToComplete=ai;exports.Toggle=oC;exports.Tooltip=An;exports.TopLevelPage=xC;exports.UUID_V4_REGEX=Br;exports.UserContext=Lt;exports.UserProvider=Jc;exports.VisuallyHidden=Ie;exports.addAriaProps=fh;exports.basicReducer=Ir;exports.camelCaseToDashCase=Sc;exports.checkIntlPathExists=Ha;exports.generateConditions=Da;exports.generateCssIcon=Rc;exports.getCharacterLimitProps=ad;exports.getLongDate=zs;exports.getMember=Ka;exports.getPostBody=ko;exports.getShortDate=Mc;exports.getValueLength=Ya;exports.headerData=Mr;exports.mapGetStreamData=VE;exports.pageReady=Ic;exports.passwordValidator=ls;exports.repliesFeedMock=sw;exports.supportedLanguages=ha;exports.toCamelCase=jc;exports.toCapitalisedCase=Ph;exports.toSentenceCase=Oc;exports.useCurrentPath=kc;exports.useEffectAfterMount=Yn;exports.useElementWidth=tr;exports.useOverlay=Xc;exports.useScrollListener=Ac;exports.useScrollToHash=$s;exports.useTooltips=Ls;exports.useUser=Za;
|