@apolitical/component-library 4.1.13 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/constants/discussion.d.ts +1 -0
- package/constants/index.d.ts +2 -0
- package/constants/regex.d.ts +2 -0
- package/discussion/components/form/form.d.ts +9 -2
- package/discussion/components/post/post.d.ts +11 -2
- package/discussion/components/post/post.helpers.d.ts +2 -1
- package/discussion/components/post/post.mock.d.ts +3 -0
- package/discussion/feeds/activities-feed/activities-feed.d.ts +3 -0
- package/discussion/feeds/replies-feed/nested-replies-feed/nested-replies-feed.d.ts +4 -1
- package/discussion/feeds/replies-feed/replies-feed.d.ts +3 -0
- package/discussion/index.d.ts +1 -0
- package/discussion/sections/activity-section/activity-section.d.ts +2 -0
- package/form/components/rich-text-editor/components/context/context.d.ts +3 -1
- package/form/components/rich-text-editor/components/editor/index.d.ts +1 -0
- package/form/components/rich-text-editor/components/editor/mention-popover/index.d.ts +1 -0
- package/form/components/rich-text-editor/components/editor/mention-popover/mention-popover.d.ts +2 -0
- package/form/components/rich-text-editor/helpers/ast-types/ast-types.d.ts +4 -1
- package/form/components/rich-text-editor/helpers/index.d.ts +1 -0
- package/form/components/rich-text-editor/helpers/mentions/index.d.ts +2 -0
- package/form/components/rich-text-editor/helpers/mentions/insert-mention.d.ts +5 -0
- package/form/components/rich-text-editor/helpers/mentions/should-show-mentions-popover.d.ts +5 -0
- package/form/components/rich-text-editor/helpers/transform/transform.d.ts +3 -3
- package/form/components/rich-text-editor/index.d.ts +1 -0
- package/form/components/rich-text-editor/plugins/index.d.ts +1 -0
- package/form/components/rich-text-editor/plugins/with-mentions/index.d.ts +1 -0
- package/form/components/rich-text-editor/plugins/with-mentions/with-mentions.d.ts +6 -0
- package/form/components/rich-text-editor/rich-text-editor.const.d.ts +11 -0
- package/form/components/rich-text-editor/rich-text-editor.d.ts +10 -2
- package/form/components/rich-text-editor/rich-text-editor.types.d.ts +28 -2
- package/general/index.d.ts +1 -0
- package/general/popover/index.d.ts +1 -0
- package/general/popover/popover.d.ts +11 -0
- package/helpers/cases.d.ts +1 -0
- package/helpers/index.d.ts +1 -0
- package/helpers/replace-mention-data.d.ts +9 -0
- package/index.js +51 -51
- package/index.mjs +7522 -7236
- package/package.json +1 -1
- package/style.css +1 -1
- package/styles/variables/colors/theme/_discussion.scss +1 -0
- package/styles/variables/colors/theme/_form.scss +1 -0
- package/styles/variables/colors/theme/_general.scss +3 -0
- package/user/member/member.d.ts +9 -2
package/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),ue=require("react-intl"),pn=require("lodash.clonedeep"),yh=require("lodash.set"),gc=require("react-dom"),Pt=require("markdown-to-jsx"),Hn=require("truncate"),Ke=require("@tanstack/react-query"),Dh=require("@tanstack/react-query-devtools"),sa=require("posthog-js"),Ps=require("react-cookie"),vc=require("lodash.isequal"),Ch=require("react-multi-email"),bc=require("lodash.get"),xh=require("react-error-boundary");var Ir=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function yc(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 Dc={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})()})(Dc);var wh=Dc.exports;const Y=wn(wh),Eh=({element:e="span",showOnFocus:t=!0,children:n,className:r="",...a})=>C.createElement(e,{...a,className:Y("hidden",r,{"show-on-focus":t}),children:n}),Ie=C.memo(Eh),kh=({element:e="span",children:t=null,...n})=>C.createElement(e,{...n,"aria-hidden":!0},t),$a=C.memo(kh);var ts={exports:{}},ir={};/**
|
|
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 No;function _h(){if(No)return ir;No=1;var e=C,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(o,l,u){var c,m={},h=null,p=null;u!==void 0&&(h=""+u),l.key!==void 0&&(h=""+l.key),l.ref!==void 0&&(p=l.ref);for(c in l)r.call(l,c)&&!i.hasOwnProperty(c)&&(m[c]=l[c]);if(o&&o.defaultProps)for(c in l=o.defaultProps,l)m[c]===void 0&&(m[c]=l[c]);return{$$typeof:t,type:o,key:h,ref:p,props:m,_owner:a.current}}return ir.Fragment=n,ir.jsx=s,ir.jsxs=s,ir}var sr={};/**
|
|
14
14
|
* @license React
|
|
15
15
|
* react-jsx-runtime.development.js
|
|
16
16
|
*
|
|
@@ -18,36 +18,36 @@
|
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the MIT license found in the
|
|
20
20
|
* LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/var
|
|
22
|
-
`+
|
|
21
|
+
*/var Ro;function Bh(){return Ro||(Ro=1,process.env.NODE_ENV!=="production"&&function(){var e=C,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function y(O){if(O===null||typeof O!="object")return null;var re=g&&O[g]||O[f];return typeof re=="function"?re:null}var b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(O){{for(var re=arguments.length,le=new Array(re>1?re-1:0),De=1;De<re;De++)le[De-1]=arguments[De];A("error",O,le)}}function A(O,re,le){{var De=b.ReactDebugCurrentFrame,Fe=De.getStackAddendum();Fe!==""&&(re+="%s",le=le.concat([Fe]));var Re=le.map(function(Be){return String(Be)});Re.unshift("Warning: "+re),Function.prototype.apply.call(console[O],console,Re)}}var k=!1,E=!1,T=!1,j=!1,z=!1,R;R=Symbol.for("react.module.reference");function $(O){return!!(typeof O=="string"||typeof O=="function"||O===r||O===i||z||O===a||O===u||O===c||j||O===p||k||E||T||typeof O=="object"&&O!==null&&(O.$$typeof===h||O.$$typeof===m||O.$$typeof===s||O.$$typeof===o||O.$$typeof===l||O.$$typeof===R||O.getModuleId!==void 0))}function M(O,re,le){var De=O.displayName;if(De)return De;var Fe=re.displayName||re.name||"";return Fe!==""?le+"("+Fe+")":le}function x(O){return O.displayName||"Context"}function B(O){if(O==null)return null;if(typeof O.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof O=="function")return O.displayName||O.name||null;if(typeof O=="string")return O;switch(O){case r:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case c:return"SuspenseList"}if(typeof O=="object")switch(O.$$typeof){case o:var re=O;return x(re)+".Consumer";case s:var le=O;return x(le._context)+".Provider";case l:return M(O,O.render,"ForwardRef");case m:var De=O.displayName||null;return De!==null?De:B(O.type)||"Memo";case h:{var Fe=O,Re=Fe._payload,Be=Fe._init;try{return B(Be(Re))}catch{return null}}}return null}var F=Object.assign,N=0,L,q,oe,ne,D,H,X;function _(){}_.__reactDisabledLog=!0;function S(){{if(N===0){L=console.log,q=console.info,oe=console.warn,ne=console.error,D=console.group,H=console.groupCollapsed,X=console.groupEnd;var O={configurable:!0,enumerable:!0,value:_,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}N++}}function W(){{if(N--,N===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},O,{value:L}),info:F({},O,{value:q}),warn:F({},O,{value:oe}),error:F({},O,{value:ne}),group:F({},O,{value:D}),groupCollapsed:F({},O,{value:H}),groupEnd:F({},O,{value:X})})}N<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var I=b.ReactCurrentDispatcher,V;function te(O,re,le){{if(V===void 0)try{throw Error()}catch(Fe){var De=Fe.stack.trim().match(/\n( *(at )?)/);V=De&&De[1]||""}return`
|
|
22
|
+
`+V+O}}var ee=!1,ae;{var fe=typeof WeakMap=="function"?WeakMap:Map;ae=new fe}function G(O,re){if(!O||ee)return"";{var le=ae.get(O);if(le!==void 0)return le}var De;ee=!0;var Fe=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Re;Re=I.current,I.current=null,S();try{if(re){var Be=function(){throw Error()};if(Object.defineProperty(Be.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Be,[])}catch($t){De=$t}Reflect.construct(O,[],Be)}else{try{Be.call()}catch($t){De=$t}O.call(Be.prototype)}}else{try{throw Error()}catch($t){De=$t}O()}}catch($t){if($t&&De&&typeof $t.stack=="string"){for(var _e=$t.stack.split(`
|
|
23
23
|
`),rt=De.stack.split(`
|
|
24
|
-
`),Ve=
|
|
25
|
-
`+
|
|
24
|
+
`),Ve=_e.length-1,Ze=rt.length-1;Ve>=1&&Ze>=0&&_e[Ve]!==rt[Ze];)Ze--;for(;Ve>=1&&Ze>=0;Ve--,Ze--)if(_e[Ve]!==rt[Ze]){if(Ve!==1||Ze!==1)do if(Ve--,Ze--,Ze<0||_e[Ve]!==rt[Ze]){var bt=`
|
|
25
|
+
`+_e[Ve].replace(" at new "," at ");return O.displayName&&bt.includes("<anonymous>")&&(bt=bt.replace("<anonymous>",O.displayName)),typeof O=="function"&&ae.set(O,bt),bt}while(Ve>=1&&Ze>=0);break}}}finally{ee=!1,I.current=Re,W(),Error.prepareStackTrace=Fe}var Fn=O?O.displayName||O.name:"",Po=Fn?te(Fn):"";return typeof O=="function"&&ae.set(O,Po),Po}function he(O,re,le){return G(O,!1)}function ge(O){var re=O.prototype;return!!(re&&re.isReactComponent)}function Ee(O,re,le){if(O==null)return"";if(typeof O=="function")return G(O,ge(O));if(typeof O=="string")return te(O);switch(O){case u:return te("Suspense");case c:return te("SuspenseList")}if(typeof O=="object")switch(O.$$typeof){case l:return he(O.render);case m:return Ee(O.type,re,le);case h:{var De=O,Fe=De._payload,Re=De._init;try{return Ee(Re(Fe),re,le)}catch{}}}return""}var Oe=Object.prototype.hasOwnProperty,me={},Pe=b.ReactDebugCurrentFrame;function He(O){if(O){var re=O._owner,le=Ee(O.type,O._source,re?re.type:null);Pe.setExtraStackFrame(le)}else Pe.setExtraStackFrame(null)}function Ue(O,re,le,De,Fe){{var Re=Function.call.bind(Oe);for(var Be in O)if(Re(O,Be)){var _e=void 0;try{if(typeof O[Be]!="function"){var rt=Error((De||"React class")+": "+le+" type `"+Be+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[Be]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw rt.name="Invariant Violation",rt}_e=O[Be](re,Be,De,le,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ve){_e=Ve}_e&&!(_e instanceof Error)&&(He(Fe),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",De||"React class",le,Be,typeof _e),He(null)),_e instanceof Error&&!(_e.message in me)&&(me[_e.message]=!0,He(Fe),w("Failed %s type: %s",le,_e.message),He(null))}}}var Qe=Array.isArray;function Ae(O){return Qe(O)}function ze(O){{var re=typeof Symbol=="function"&&Symbol.toStringTag,le=re&&O[Symbol.toStringTag]||O.constructor.name||"Object";return le}}function We(O){try{return Z(O),!1}catch{return!0}}function Z(O){return""+O}function se(O){if(We(O))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ze(O)),Z(O)}var pe=b.ReactCurrentOwner,be={key:!0,ref:!0,__self:!0,__source:!0},xe,Ye,Ge;Ge={};function mt(O){if(Oe.call(O,"ref")){var re=Object.getOwnPropertyDescriptor(O,"ref").get;if(re&&re.isReactWarning)return!1}return O.ref!==void 0}function It(O){if(Oe.call(O,"key")){var re=Object.getOwnPropertyDescriptor(O,"key").get;if(re&&re.isReactWarning)return!1}return O.key!==void 0}function Et(O,re){if(typeof O.ref=="string"&&pe.current&&re&&pe.current.stateNode!==re){var le=B(pe.current.type);Ge[le]||(w('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',B(pe.current.type),O.ref),Ge[le]=!0)}}function Xe(O,re){{var le=function(){xe||(xe=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",re))};le.isReactWarning=!0,Object.defineProperty(O,"key",{get:le,configurable:!0})}}function Bt(O,re){{var le=function(){Ye||(Ye=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",re))};le.isReactWarning=!0,Object.defineProperty(O,"ref",{get:le,configurable:!0})}}var pt=function(O,re,le,De,Fe,Re,Be){var _e={$$typeof:t,type:O,key:re,ref:le,props:Be,_owner:Re};return _e._store={},Object.defineProperty(_e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(_e,"_self",{configurable:!1,enumerable:!1,writable:!1,value:De}),Object.defineProperty(_e,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Fe}),Object.freeze&&(Object.freeze(_e.props),Object.freeze(_e)),_e};function ti(O,re,le,De,Fe){{var Re,Be={},_e=null,rt=null;le!==void 0&&(se(le),_e=""+le),It(re)&&(se(re.key),_e=""+re.key),mt(re)&&(rt=re.ref,Et(re,Fe));for(Re in re)Oe.call(re,Re)&&!be.hasOwnProperty(Re)&&(Be[Re]=re[Re]);if(O&&O.defaultProps){var Ve=O.defaultProps;for(Re in Ve)Be[Re]===void 0&&(Be[Re]=Ve[Re])}if(_e||rt){var Ze=typeof O=="function"?O.displayName||O.name||"Unknown":O;_e&&Xe(Be,Ze),rt&&Bt(Be,Ze)}return pt(O,_e,rt,Fe,De,pe.current,Be)}}var ar=b.ReactCurrentOwner,Mr=b.ReactDebugCurrentFrame;function An(O){if(O){var re=O._owner,le=Ee(O.type,O._source,re?re.type:null);Mr.setExtraStackFrame(le)}else Mr.setExtraStackFrame(null)}var ni;ni=!1;function ri(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function Fo(){{if(ar.current){var O=B(ar.current.type);if(O)return`
|
|
26
26
|
|
|
27
|
-
Check the render method of \``+O+"`."}return""}}function
|
|
27
|
+
Check the render method of \``+O+"`."}return""}}function dh(O){{if(O!==void 0){var re=O.fileName.replace(/^.*[\\\/]/,""),le=O.lineNumber;return`
|
|
28
28
|
|
|
29
|
-
Check your code at `+re+":"+le+"."}return""}}var
|
|
29
|
+
Check your code at `+re+":"+le+"."}return""}}var To={};function fh(O){{var re=Fo();if(!re){var le=typeof O=="string"?O:O.displayName||O.name;le&&(re=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+le+">.")}return re}}function _o(O,re){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var le=th(re);if(ko[le])return;ko[le]=!0;var De="";O&&O._owner&&O._owner!==rr.current&&(De=" It was passed a child from "+_(O._owner.type)+"."),Bn(O),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',le,De),Bn(null)}}function Bo(O,re){{if(typeof O!="object")return;if(Ae(O))for(var le=0;le<O.length;le++){var De=O[le];ri(De)&&_o(De,re)}else if(ri(O))O._store&&(O._store.validated=!0);else if(O){var Fe=y(O);if(typeof Fe=="function"&&Fe!==O.entries)for(var Re=Fe.call(O),Be;!(Be=Re.next()).done;)ri(Be.value)&&_o(Be.value,re)}}}function nh(O){{var re=O.type;if(re==null||typeof re=="string")return;var le;if(typeof re=="function")le=re.propTypes;else if(typeof re=="object"&&(re.$$typeof===l||re.$$typeof===f))le=re.propTypes;else return;if(le){var De=_(re);Ue(le,O.props,"prop",De,O)}else if(re.PropTypes!==void 0&&!ni){ni=!0;var Fe=_(re);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Fe||"Unknown")}typeof re.getDefaultProps=="function"&&!re.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function rh(O){{for(var re=Object.keys(O.props),le=0;le<re.length;le++){var De=re[le];if(De!=="children"&&De!=="key"){Bn(O),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",De),Bn(null);break}}O.ref!==null&&(Bn(O),w("Invalid attribute `ref` supplied to `React.Fragment`."),Bn(null))}}function Ao(O,re,le,De,Fe,Re){{var Be=N(O);if(!Be){var ke="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(ke+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var rt=eh(Fe);rt?ke+=rt:ke+=Eo();var Ve;O===null?Ve="null":Ae(O)?Ve="array":O!==void 0&&O.$$typeof===t?(Ve="<"+(_(O.type)||"Unknown")+" />",ke=" Did you accidentally export a JSX literal instead of a component?"):Ve=typeof O,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ve,ke)}var Ze=ti(O,re,le,Fe,Re);if(Ze==null)return Ze;if(Be){var bt=re.children;if(bt!==void 0)if(De)if(Ae(bt)){for(var An=0;An<bt.length;An++)Bo(bt[An],O);Object.freeze&&Object.freeze(bt)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Bo(bt,O)}return O===r?rh(Ze):nh(Ze),Ze}}function ah(O,re,le){return Ao(O,re,le,!0)}function ih(O,re,le){return Ao(O,re,le,!1)}var sh=ih,oh=ah;ir.Fragment=r,ir.jsx=sh,ir.jsxs=oh}()),ir}process.env.NODE_ENV==="production"?es.exports=ph():es.exports=gh();var d=es.exports;const gc=()=>{const[e,t]=C.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return C.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Hn=(e,t)=>{const n=C.useRef(!1);C.useEffect(()=>{n.current?e():n.current=!0},t)};function vh(e,t,n){var r=this,a=C.useRef(null),i=C.useRef(0),s=C.useRef(null),o=C.useRef([]),l=C.useRef(),u=C.useRef(),c=C.useRef(e),f=C.useRef(!0);c.current=e;var m=typeof window<"u",p=!t&&t!==0&&m;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var g=!!(n=n||{}).leading,h=!("trailing"in n)||!!n.trailing,y="maxWait"in n,v="debounceOnServer"in n&&!!n.debounceOnServer,w=y?Math.max(+n.maxWait||0,t):null;C.useEffect(function(){return f.current=!0,function(){f.current=!1}},[]);var A=C.useMemo(function(){var E=function(N){var M=o.current,x=l.current;return o.current=l.current=null,i.current=N,u.current=c.current.apply(x,M)},k=function(N,M){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame(N):setTimeout(N,M)},F=function(N){if(!f.current)return!1;var M=N-a.current;return!a.current||M>=t||M<0||y&&N-i.current>=w},S=function(N){return s.current=null,h&&o.current?E(N):(o.current=l.current=null,u.current)},L=function N(){var M=Date.now();if(F(M))return S(M);if(f.current){var x=t-(M-a.current),_=y?Math.min(x,w-(M-i.current)):x;k(N,_)}},I=function(){if(m||v){var N=Date.now(),M=F(N);if(o.current=[].slice.call(arguments),l.current=r,a.current=N,M){if(!s.current&&f.current)return i.current=a.current,k(L,t),g?E(a.current):u.current;if(y)return k(L,t),E(a.current)}return s.current||k(L,t),u.current}};return I.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},I.isPending=function(){return!!s.current},I.flush=function(){return s.current?S(Date.now()):u.current},I},[g,y,t,w,h,p,m,v]);return A}function vc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return vh(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let ai;const Qn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=C.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];C.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(ai),u.flush(),window.removeEventListener("resize",u),window.removeEventListener("hashchange",u),window.removeEventListener("hiddenSectionVisible",l)}),i);const s=()=>{if(n)return n==="window"?window.innerWidth:n.offsetWidth},o=()=>{a(s())},l=({detail:c})=>{const{id:f}=c;n==="window"||!n.closest(`#${f}`)||s()===r||o()},u=vc(()=>{s()!==r&&(t&&(clearTimeout(ai),document.body.classList.add("is-resizing"),ai=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},bc=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=C.useState({current:0,past:0})||[!1,()=>{}],[s,o]=C.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];C.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const c=window.scrollY,f=a.current,m=c-f,p=m>0?"down":"up";if(i({current:c,past:f}),p==="down"){c>=e+t.down&&!s.scrollDown&&(!s.scrollUp||m>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(m)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=vc(()=>{l()},250);return a},Ss=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=C.useRef(!1);Hn(()=>{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)},js=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=C.useState(!1);return{showTooltip:t,tooltipProps:{onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const jo={},wn=C.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},...l},u)=>{const c=oe.useIntl(),f=C.useRef(null),m=u||f,[p,g]=C.useState(n?"open":"hidden"),{extraPadding:h=!0,hasPointer:y=!1,hasForm:v=!1}=t,{onOpen:w=()=>{},onClose:A=()=>{}}=o;e||(e=Date.now().toString());const E=jo[e];C.useEffect(()=>{const L=m==null?void 0:m.current;if(L)return L.addEventListener("transitionend",k),L.addEventListener("keydown",F),()=>{L.removeEventListener("transitionend",k),L.removeEventListener("keydown",F)}},[]);const k=({propertyName:L})=>{L==="opacity"&&(E!==!1&&clearTimeout(E),g(I=>(I==="open"?w():I==="closed"&&A(),I==="opening"?"open":I==="closing"?"closed":I==="closed"?"hidden":I)))},F=L=>{L.key==="Escape"&&(L.stopPropagation(),L.preventDefault(),g("closing"))};Hn(()=>{E!==!1&&clearTimeout(E);let L="open";n?g("opening"):(g("closing"),L="hidden"),jo[e||""]=setTimeout(()=>{g(L)},300)},[n]);const S={...l};return s&&s.onBlur&&(S.onBlur=s.onBlur),d.jsx("aside",{ref:m,className:Z("tooltip text-medium",p,i,{loading:r,"extra-padding":h,"has-pointer":y,bottom:y==="bottom","has-form":v}),...S,children:d.jsx("div",{className:"content",hidden:p==="hidden",children:r?d.jsx("p",{children:c.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?d.jsx("p",{children:a}):a})})}),Sr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=mn(e);return t.forEach(({type:r,value:a})=>{uh(n,r,a)}),n},yc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},Dc=(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},Cc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),xc=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),wc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Ht="https://storage.googleapis.com/apolitical-assets/",Pn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},dr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},Ec="Invalid token error: Logging user out...",bh="200,000+",yh="160+";function kc(e){return e?{"--icon":`url(${Ht}icons/${e}.svg)`}:{}}const dn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},_c=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Os=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),ts=e=>{let t;const n=va(),r=va(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/dn.milliseconds.inHour,i=Math.floor(t/dn.milliseconds.inDay);if(i<1)return a<1?{path:"now"}:{path:"hours",number:Math.floor(a)};if(i<7)return{path:"days",number:i};const s=Math.floor(i/7);return s<=dn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/dn.year.days)}},va=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Dh=(e,t,n)=>{let r;const a=va(),i=va(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/dn.milliseconds.inSecond<=t;case"minutes":return r/dn.milliseconds.inMinute<=t;case"hours":return r/dn.milliseconds.inHour<=t}return!1},Ch=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},xh=e=>new Promise(t=>setTimeout(t,e)),wh=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},Jn={apolitical:"Apolitical",dates_now:"now",dates_hours:"{number}h",dates_days:"{number}d",dates_weeks:"{number}w",dates_years:"{number}y",card_carousel_viewAll:"View all",card_label_communityPage:"Community",card_label_event:"Event",card_label_learningHub:"Programme",card_label_listPage:"List",card_label_microcourse:"Course",card_label_qaQuestion:"Q&A",card_label_solutionArticle:"Article",card_bootcamp:"Email boot camp",card_ended:"Ended",card_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.",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
|
|
31
|
+
Check the top-level render call using <`+le+">.")}return re}}function So(O,re){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var le=fh(re);if(To[le])return;To[le]=!0;var De="";O&&O._owner&&O._owner!==ar.current&&(De=" It was passed a child from "+B(O._owner.type)+"."),An(O),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',le,De),An(null)}}function jo(O,re){{if(typeof O!="object")return;if(Ae(O))for(var le=0;le<O.length;le++){var De=O[le];ri(De)&&So(De,re)}else if(ri(O))O._store&&(O._store.validated=!0);else if(O){var Fe=y(O);if(typeof Fe=="function"&&Fe!==O.entries)for(var Re=Fe.call(O),Be;!(Be=Re.next()).done;)ri(Be.value)&&So(Be.value,re)}}}function hh(O){{var re=O.type;if(re==null||typeof re=="string")return;var le;if(typeof re=="function")le=re.propTypes;else if(typeof re=="object"&&(re.$$typeof===l||re.$$typeof===m))le=re.propTypes;else return;if(le){var De=B(re);Ue(le,O.props,"prop",De,O)}else if(re.PropTypes!==void 0&&!ni){ni=!0;var Fe=B(re);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Fe||"Unknown")}typeof re.getDefaultProps=="function"&&!re.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function mh(O){{for(var re=Object.keys(O.props),le=0;le<re.length;le++){var De=re[le];if(De!=="children"&&De!=="key"){An(O),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",De),An(null);break}}O.ref!==null&&(An(O),w("Invalid attribute `ref` supplied to `React.Fragment`."),An(null))}}function Oo(O,re,le,De,Fe,Re){{var Be=$(O);if(!Be){var _e="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(_e+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var rt=dh(Fe);rt?_e+=rt:_e+=Fo();var Ve;O===null?Ve="null":Ae(O)?Ve="array":O!==void 0&&O.$$typeof===t?(Ve="<"+(B(O.type)||"Unknown")+" />",_e=" Did you accidentally export a JSX literal instead of a component?"):Ve=typeof O,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ve,_e)}var Ze=ti(O,re,le,Fe,Re);if(Ze==null)return Ze;if(Be){var bt=re.children;if(bt!==void 0)if(De)if(Ae(bt)){for(var Fn=0;Fn<bt.length;Fn++)jo(bt[Fn],O);Object.freeze&&Object.freeze(bt)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else jo(bt,O)}return O===r?mh(Ze):hh(Ze),Ze}}function ph(O,re,le){return Oo(O,re,le,!0)}function gh(O,re,le){return Oo(O,re,le,!1)}var vh=gh,bh=ph;sr.Fragment=r,sr.jsx=vh,sr.jsxs=bh}()),sr}process.env.NODE_ENV==="production"?ts.exports=_h():ts.exports=Bh();var d=ts.exports;const Cc=()=>{const[e,t]=C.useState(window.location.pathname),n=()=>{const r=window.location.pathname;t(r)};return C.useEffect(()=>(window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}),[]),e},Un=(e,t)=>{const n=C.useRef(!1);C.useEffect(()=>{n.current?e():n.current=!0},t)};function xc(e,t,n){var r=this,a=C.useRef(null),i=C.useRef(0),s=C.useRef(null),o=C.useRef([]),l=C.useRef(),u=C.useRef(),c=C.useRef(e),m=C.useRef(!0);c.current=e;var h=typeof window<"u",p=!t&&t!==0&&h;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,b="debounceOnServer"in n&&!!n.debounceOnServer,w=y?Math.max(+n.maxWait||0,t):null;C.useEffect(function(){return m.current=!0,function(){m.current=!1}},[]);var A=C.useMemo(function(){var k=function($){var M=o.current,x=l.current;return o.current=l.current=null,i.current=$,u.current=c.current.apply(x,M)},E=function($,M){p&&cancelAnimationFrame(s.current),s.current=p?requestAnimationFrame($):setTimeout($,M)},T=function($){if(!m.current)return!1;var M=$-a.current;return!a.current||M>=t||M<0||y&&$-i.current>=w},j=function($){return s.current=null,f&&o.current?k($):(o.current=l.current=null,u.current)},z=function $(){var M=Date.now();if(T(M))return j(M);if(m.current){var x=t-(M-a.current),B=y?Math.min(x,w-(M-i.current)):x;E($,B)}},R=function(){if(h||b){var $=Date.now(),M=T($);if(o.current=[].slice.call(arguments),l.current=r,a.current=$,M){if(!s.current&&m.current)return i.current=a.current,E(z,t),g?k(a.current):u.current;if(y)return E(z,t),k(a.current)}return s.current||E(z,t),u.current}};return R.cancel=function(){s.current&&(p?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,o.current=a.current=l.current=s.current=null},R.isPending=function(){return!!s.current},R.flush=function(){return s.current?j(Date.now()):u.current},R},[g,y,t,w,f,p,h,b]);return A}function wc(e,t,n){var r=n===void 0?{}:n,a=r.leading,i=r.trailing;return xc(e,t,{maxWait:t,leading:a===void 0||a,trailing:i===void 0||i})}let ai;const Jn=(e=!0,t=!1,n="window")=>{if(!e)return;const[r,a]=C.useState(0)||[!1,()=>{}],i=n==="window"?[]:[n];C.useEffect(()=>(o(),window.addEventListener("resize",u),window.addEventListener("hashchange",u),window.addEventListener("hiddenSectionVisible",l),()=>{clearTimeout(ai),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:m}=c;n==="window"||!n.closest(`#${m}`)||s()===r||o()},u=wc(()=>{s()!==r&&(t&&(clearTimeout(ai),document.body.classList.add("is-resizing"),ai=setTimeout(()=>{document.body.classList.remove("is-resizing")},550)),o())},500,{leading:!0});return r},Ec=({scrollPosition:e=0,offset:t={down:0,up:10},callbacks:{scrollDown:n=()=>{},scrollUp:r=()=>{}}})=>{if(!window)return;const[a,i]=C.useState({current:0,past:0})||[!1,()=>{}],[s,o]=C.useState({scrollDown:!1,scrollUp:!1})||[!1,()=>{}];C.useEffect(()=>(l(),window.addEventListener("scroll",u),()=>{u.flush(),window.removeEventListener("scroll",u)}),[]);const l=()=>{const c=window.scrollY,m=a.current,h=c-m,p=h>0?"down":"up";if(i({current:c,past:m}),p==="down"){c>=e+t.down&&!s.scrollDown&&(!s.scrollUp||h>t.up)&&(n(),o({scrollUp:!1,scrollDown:!0}));return}Math.abs(h)>=t.up&&!s.scrollUp&&(r(),o({scrollUp:!0,scrollDown:!1}))},u=wc(()=>{l()},250);return a},Ns=(e=[],t=!0)=>{e=Array.isArray(e)?e:[e];const n=C.useRef(!1);Un(()=>{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)},Rs=(e=!1)=>{if(!e)return{showTooltip:!1,tooltipProps:{}};const[t,n]=C.useState(!1);return{showTooltip:t,tooltipProps:{onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),tabIndex:0}}};const Mo={},En=C.forwardRef(({id:e,styling:t={},isOpen:n=!1,isLoading:r=!1,children:a,className:i="",functions:s={},callbacks:o={},...l},u)=>{const c=ue.useIntl(),m=C.useRef(null),h=u||m,[p,g]=C.useState(n?"open":"hidden"),{extraPadding:f=!0,hasPointer:y=!1,hasForm:b=!1}=t,{onOpen:w=()=>{},onClose:A=()=>{}}=o;e||(e=Date.now().toString());const k=Mo[e];C.useEffect(()=>{const z=h==null?void 0:h.current;if(z)return z.addEventListener("transitionend",E),z.addEventListener("keydown",T),()=>{z.removeEventListener("transitionend",E),z.removeEventListener("keydown",T)}},[]);const E=({propertyName:z})=>{z==="opacity"&&(k!==!1&&clearTimeout(k),g(R=>(R==="open"?w():R==="closed"&&A(),R==="opening"?"open":R==="closing"?"closed":R==="closed"?"hidden":R)))},T=z=>{z.key==="Escape"&&(z.stopPropagation(),z.preventDefault(),g("closing"))};Un(()=>{k!==!1&&clearTimeout(k);let z="open";n?g("opening"):(g("closing"),z="hidden"),Mo[e||""]=setTimeout(()=>{g(z)},300)},[n]);const j={...l};return s&&s.onBlur&&(j.onBlur=s.onBlur),d.jsx("aside",{ref:h,className:Y("tooltip text-medium",p,i,{loading:r,"extra-padding":f,"has-pointer":y,bottom:y==="bottom","has-form":b}),...j,children:d.jsx("div",{className:"content",hidden:p==="hidden",children:r?d.jsx("p",{children:c.formatMessage({id:"tooltip_loading"})}):typeof a=="string"?d.jsx("p",{children:a}):a})})}),jr=(e,t)=>{Array.isArray(t)||(t=[t]);const n=pn(e);return t.forEach(({type:r,value:a})=>{yh(n,r,a)}),n},kc=e=>{const t=[];return e.forEach(n=>{const r=parseInt(n);isNaN(r)||t.push(r)}),t.sort((n,r)=>n-r)},_c=(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},Bc=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`),Ac=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()).replace(/[&\s]+/g,""),Fc=(e="")=>e.charAt(0).toUpperCase()+e.slice(1),Ah=(e="")=>e.replace(/(?:^\w|[A-Z]|\b\w)/g,t=>t.toUpperCase()),Ht="https://storage.googleapis.com/apolitical-assets/",Nn={general:"hello@apolitical.co",support:"concierge@apolitical.co","data-protection":{default:"dpo@apolitical.co",eu:"dpo.agl@apolitical.foundation"}},fr={ARTICLE:"microcourseArticle",DISCUSSION:"microcourseDiscussion",QUIZ:"assessmentQuiz"},ns="SU:",Tc="Invalid token error: Logging user out...",rs=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Sc=/^@(\w+)$/,Fh="200,000+",Th="160+";function jc(e){return e?{"--icon":`url(${Ht}icons/${e}.svg)`}:{}}const fn={milliseconds:{inSecond:1e3,inMinute:6e4,inHour:36e5,inDay:864e5},year:{weeks:52,days:365}},Oc=(e,t="en")=>new Date(e).toLocaleString(t,{day:"numeric",month:"short"}),Ms=(e,t="en")=>new Date(e).toLocaleString(t,{weekday:"long",day:"numeric",month:"short",year:"numeric"}),as=e=>{let t;const n=va(),r=va(new Date(e));try{t=n.getTime()-r.getTime()}catch{return""}const a=t/fn.milliseconds.inHour,i=Math.floor(t/fn.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<=fn.year.weeks?{path:"weeks",number:s}:{path:"years",number:Math.floor(i/fn.year.days)}},va=e=>{const n=(e||new Date).toUTCString();return new Date(n)},Sh=(e,t,n)=>{let r;const a=va(),i=va(new Date(e));try{r=a.getTime()-i.getTime()}catch{return!1}switch(n){case"seconds":return r/fn.milliseconds.inSecond<=t;case"minutes":return r/fn.milliseconds.inMinute<=t;case"hours":return r/fn.milliseconds.inHour<=t}return!1},jh=(e,t)=>{const n=new Date(e);return Math.abs(new Date().getTime()-n.getTime())/(1e3*60*60*24)<t},Oh=e=>new Promise(t=>setTimeout(t,e)),Ph=()=>{let e=!1;return typeof window<"u"&&(e=!!(window&&window.location&&window.location.href&&window.location.href.includes("localhost"))),e},Xn={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.",member_apolitical:"Apolitical",member_community:"Community post",membersList:"Members",membersList_admin:"Admin",courseStructure_section:"{number, plural, =0 {Start here} other {Section #}}",courseStructure_section_end:"End here",courseStructure_time_left:"left",courseStructure_time_completed:"Completed",courseProgression_done:"<percent>{number}%</percent> done",courseProgression_timeLeft:"left","lessonType_analyse-data":"Analyse data","lessonType_analyse-scenarios":"Analyse scenarios","lessonType_attend-webinar":"Attend webinar","lessonType_brainstorm-ideas":"Brainstorm ideas","lessonType_discuss-with-peers":"Discuss with peers","lessonType_discuss-with-team":"Discuss with team","lessonType_do-activity":"Do activity","lessonType_do-assessment":"Do assessment","lessonType_explore-casebook":"Explore casebook","lessonType_fill-out-workbook":"Fill out workbook","lessonType_fill-out-worksheet":"Fill out worksheet","lessonType_investigate-interview":"Investigate interview","lessonType_listen-to-audio":"Listen to audio","lessonType_listen-to-audiocast":"Listen to audiocast","lessonType_listen-to-podcast":"Listen to podcast","lessonType_read-article":"Read article","lessonType_read-article-by-expert":"Read article by expert","lessonType_read-article-by-public-servant":"Read article by public servant","lessonType_read-conclusion":"Read conclusion","lessonType_read-infographic":"Read infographic","lessonType_read-introduction":"Read introduction","lessonType_read-resource":"Read resource","lessonType_reflect-on-content":"Reflect on content","lessonType_share-experiences":"Share experiences","lessonType_take-quiz":"Take quiz","lessonType_use-toolkit":"Use toolkit","lessonType_watch-video":"Watch video","lessonType_watch-webinar":"Watch webinar",markCompleteButton:"Mark as complete",markCompleteButton_completed:"Lesson complete",discussion_action_answer:"answer",discussion_action_comment:"comment",discussion_action_post:"post",discussion_action_response:"response",discussion_action_reply:"reply",discussion_action_question:"question",discussion_edited:"Edited",discussion_delete_title:"Delete {action}",discussion_delete_text:"<p>Are you sure you want to delete your {action}?</p><p>This can't be undone.</p>",discussion_delete_cancel:"Cancel",discussion_delete_delete:"Delete",discussion_delete_error:"We are unable to delete your {action} at the moment. Please try again later or contact us if problem persists.",discussion_reply:"Reply",discussion_report_subject:"Report a post on Apolitical",discussion_report_body:`I'd like to report the {contentType} <{contentSlug}> at {contentUrl}.
|
|
32
32
|
|
|
33
33
|
Please explain why you're reporting this post. Reasons could include: inappropriate language, harassment, spam, hate speech, false information, among others. Include as much detail as you feel comfortable.
|
|
34
34
|
|
|
35
|
-
Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_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_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"Link:",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their emails below.",inviteModal_cta:"Send",overlay_close:"Close",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",navigationMenu_profile:"My profile",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},Eh={...Jn,languageSwitcher_label:"Me gustaría leer este artículo en...",languageSwitcher_translation_original:"idioma original",languageSwitcher_translation_human:"traducido por un humano",languageSwitcher_translation_machine:"traducido por máquina",languageSwitcher_disclaimer:"Este contenido fue traducido automáticamente y ocasionalmente tendrá errores de género u otras traducciones directas. Estamos intentando resolver este problema, pero mientras tanto, si notas algún error grave, escríbenos a <link>{email}</link>"},kh={...Jn,languageSwitcher_label:"Je voudrais lire cet article dans...",languageSwitcher_translation_original:"langue originale",languageSwitcher_translation_human:"traduit par un humain",languageSwitcher_translation_machine:"traduit par machine",languageSwitcher_disclaimer:"Ce contenu est traduit automatiquement et contiendra d’évantuelles erreurs de genre ou d’autres traductions directes. Nous essayons de résoudre ce problème, mais en attendant, si vous remarquez une erreur importante, faites-le nous savoir à <link>{email}</link>",collapsibleSection_summary:"En savoir plus"},_h={...Jn,languageSwitcher_label:"Eu gostaria de ler este artigo em...",languageSwitcher_translation_original:"linguagem original",languageSwitcher_translation_human:"traduzido por um humano",languageSwitcher_translation_machine:"traduzido por máquina",languageSwitcher_disclaimer:"Este conteúdo foi traduzido automaticamente e, ocasionalmente, poderão ocorrer erros de linguagem de gênero ou outras traduções diretas. Estamos tentando resolver isso, porém se perceber algo errado por favor nos avise em <link>{email}</link>"},Bh=Object.freeze(Object.defineProperty({__proto__:null,en:Jn,es:Eh,fr:kh,pt:_h},Symbol.toStringTag,{value:"Module"})),La=(e,t=Jn)=>e in t,Ft=(e,t,n,r,a={})=>{let i="";return La(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},Ah=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let a=n.length-1;a>=0;a--){const i=Math.pow(10,(a+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&a<n.length-1&&(e=1,a++),r=`${e}${n[a]}`;break}}return r},oa=(e,t)=>C.Children.map(e,n=>Object.is(n,null)?n:C.cloneElement(n,{...t})),Bc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Ac=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},Fh=(e="")=>e.replace(/\s+/g,"").length>0,ns=e=>{const t=e.length>8,n=/[0-9]/.test(e)&&/[`!@#$%^&*()_+\-=[\]{}£;':"\\|,.<>/?~]/.test(e),r=new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])").test(e);return{isValid:t&&n&&r,matchingRules:{isMoreThanEightCharacters:t,includesNumberAndSymbol:n,includesLowerAndUppercase:r}}};const Ee=({variant:e="primary",size:t="medium",styling:n={muted:!1,fullWidth:!1},icon:r=!1,href:a=!1,element:i="button",onClick:s=!1,className:o="",disabled:l=!1,tooltip:u="",screenreaderText:c=!1,children:f=!1,...m})=>{const g=Qn(typeof t=="object"),{showTooltip:h,tooltipProps:y}=js(!!u);if(typeof t=="object"&&typeof g=="number"){const E=Object.assign({},t),k=yc(Object.keys(E));t=Dc(g,k,E)}!l&&u&&(u="");const v=[];typeof t=="string"&&v.push(t),r&&(v.push("icon"),typeof r=="object"?(v.push(r.icon),r.position?v.push(r.position):v.push("left"),r.hover&&v.push(`hover_${r.hover}`),r.animate&&(v.push("animate"),typeof r.animate=="string"&&v.push(r.animate))):(v.push(r),!r.includes("right")&&!r.includes("left")&&v.push("left"))),n.muted&&v.push("muted"),n.fullWidth&&v.push("full-width");const w={...m,className:Z(e,o,v,{"no-text":!f,disabled:l,button:a}),onClick:E=>{(!a||a[0]==="#")&&s&&(E.preventDefault(),E.stopPropagation()),s&&s(E)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",w.href=a);const A=C.createElement(i,w,f||(c?d.jsx(Ie,{showOnFocus:!1,children:c}):null));return l&&u?d.jsxs("span",{className:"button-container",...y,children:[d.jsx(wn,{isOpen:h,children:u}),A]}):A},En=({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(Ee,{...s},o):d.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:d.jsx(Ee,{...s})},o)});return C.createElement(a,{className:Z("button-wrapper",n),...r,children:i})};const en=({className:e="",maxWidth:t=!1})=>{const n=t?{"--max-width":`${t/16}rem`}:{};return d.jsx("hr",{className:Z(e,{"has-max-width":t}),style:n})},Oo={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"}},Th=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?Oo[e]:Oo.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Sh=({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},ii=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Sh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const Xn=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:c,fetchPriority:f}=e,{range:m,sizes:p}=Th(e),g=ii({format:"avif",query:s,range:m,url:o}),h=ii({format:"webp",query:s,range:m,url:o}),y=ii({format:"",query:s,range:m,url:o});return i&&i.includes("svg")?d.jsx("picture",{className:t,children:d.jsx("img",{src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})}):d.jsxs("picture",{className:t,children:[i!=="image/gif"&&d.jsx("source",{type:"image/avif",srcSet:g,sizes:p,"data-testid":"source"}),d.jsx("source",{type:"image/webp",srcSet:h,sizes:p,"data-testid":"source"}),d.jsx("img",{srcSet:y,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:f||"auto",width:l,height:a,"data-testid":n||"image"})]})};const jh=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(Xn,{image:{...e},className:"image"})}),kn=({href:e,children:t,fallbackElement:n,className:r="",onClick:a,gtmContext:i,gtmType:s,...o})=>{if(e){const l={...o};return a&&(l.onClick=a),i&&(l["data-gtm-event-context"]=i),s&&(l["data-gtm-event-type"]=s),d.jsx("a",{href:e,className:Z("gtm-trackable",r),...l,children:t})}return n?C.createElement(n,{children:t,className:r,...o}):d.jsx(d.Fragment,{children:t})},Fc=({children:e})=>typeof document=="object"?dc.createPortal(e,document.body):null;const Oh=({currentStep:e=1,steps:t=1})=>d.jsxs(d.Fragment,{children:[d.jsx(Ie,{children:d.jsx(oe.FormattedMessage,{id:"progressTracker",values:{current:e,total:t}})}),d.jsx("div",{className:"progress-tracker",children:d.jsx("div",{className:"dots-wrapper",children:new Array(t).fill("").map((n,r)=>{const a=r+1;return d.jsxs("div",{className:"dot-wrapper",children:[d.jsx("div",{className:Z("dot",{active:a===e,completed:a<e}),"data-testid":"progress-dot"}),d.jsx("div",{className:Z("line",{active:a<e})})]},r)})})})]});const Ph=({elementId:e,offset:t=20})=>{const n=oe.useIntl(),r=()=>{const a=document.getElementById(e);if(!a)return;const i=document.getElementById("header");i&&window.scrollTo({top:a.offsetTop-i.clientHeight-t})};return d.jsx(Ee,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const Nh=({items:e,className:t="",...n})=>d.jsx("ul",{className:Z("buckets",t),...n,children:e.map(({title:r,text:a,link:i,...s},o)=>d.jsx("li",{className:"bucket text-medium",children:d.jsxs("a",{href:i,...s,children:[d.jsx("p",{className:"title",children:r}),d.jsx("p",{children:a})]})},o))}),Po=300,No="ease-in-out";class Rh{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:Po,easing:No}),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:Po,easing:No}),this.animation.onfinish=()=>this.onAnimationFinish(!0),this.animation.oncancel=()=>this.isExpanding=!1}onAnimationFinish(t){this.el.open=t,this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.el.style.height=this.el.style.overflow=""}}const za=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=oe.useIntl(),i=C.useRef(null);return C.useEffect(()=>{let s;return r&&(s=new Rh(i.current)),()=>{r&&s&&s.cleanUp()}},[]),d.jsxs("details",{ref:i,className:Z("collapsible-section",t,{"should-animate":r}),children:[d.jsx("summary",{children:e||a.formatMessage({id:"collapsibleSection_summary"})}),d.jsx("div",{className:"content",children:n})]})},Ro={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Mh=e=>{let t=e;return Object.keys(Ro).includes(e)&&(t=Ro[e]),`url(${Ht}icons/${t}.svg)`};const Mo={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Tc=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=oe.useIntl(),i=t?{"--custom-icon":Mh(t)}:{},s=La(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:Z("content-type-label text-small",e in Mo?Mo[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Pt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Ht}icons/${t}.svg)`}:{};return d.jsx("div",{className:Z("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const rn=({variant:e="empty",text:t=!1,button:n=!1,className:r=""})=>{let a=n&&!!Object.keys(n).length;const i=typeof n=="object"&&"breakpoints"in n,s=Qn(i);if(i&&typeof n=="object"&&typeof s=="number"){const f=Object.assign({},n.breakpoints),m=yc(Object.keys(f));a=Dc(s,m,f)}const{breakpoints:o,text:l="",component:u,...c}=n;return d.jsx(Pt,{variant:"subtle",className:Z("empty-state-box",e,r),children:d.jsxs(d.Fragment,{children:[t&&typeof t=="string"?d.jsx(Ot,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||d.jsx(Ee,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const rs=({children:e,...t})=>d.jsx("p",{...t,children:e}),Sc={q:rs,blockquote:rs};for(let e=1;e<=6;e++)Sc[`h${e}`]={component:rs,props:{className:"title"}};const jc=({type:e="default",className:t="",heading:n=!1,children:r})=>d.jsxs("div",{className:Z("helper-text-box text-small",e,t),children:[n&&d.jsx("p",{className:"title",children:n}),typeof r=="string"?d.jsx(Ot,{options:{wrapper:C.Fragment,forceBlock:!0,overrides:Sc},children:r}):d.jsx("p",{children:r})]});const Oc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=oe.useIntl(),l=C.useRef(null);e||(e=Date.now().toString());const[u,c]=C.useState(""),[f,m]=C.useState("closed");C.useEffect(()=>{const h=l.current;if(h)return h.addEventListener("transitionend",p),()=>{h.removeEventListener("transitionend",p)}},[]),C.useEffect(()=>{if(!a||typeof a!="string")return;const h=a.split(`
|
|
36
|
-
`);c(
|
|
37
|
-
`))},[a]),C.useEffect(()=>{f==="ready-to-close"&&m("closing")},[f]);const p=({propertyName:h})=>{h==="max-height"&&m(y=>y==="opening"?"open":y==="closing"?"closed":y)};if(!a)return null;const g=["opening","open"].includes(f);return d.jsxs(Pt,{variant:"subtle",className:Z("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:Z("content",f),children:[d.jsx(Ot,{options:{forceBlock:!0,...i},children:f==="closed"?u:a}),f!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(Ee,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Z({"rotate-180":g}),onClick:()=>{m(g?"ready-to-close":"opening")},"aria-expanded":g,"aria-controls":e,children:g?r||o.formatMessage({id:"hideShowTextBox_hide"}):n||o.formatMessage({id:"hideShowTextBox_show"})})})]})};const Ih=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return C.createElement(e,{className:Z("icon-bulleted-list text-medium",n,i,{"has-border":s,"has-zebra-stripes":o,[t]:e!=="dl"}),children:r.map((l,u)=>{const c={wrapper:C.Fragment,forceInline:!0},f={"--icon":`url(${Ht}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(C.Fragment,{children:[d.jsx("dt",{style:f,children:d.jsx(Ot,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Ot,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:f,children:typeof l.text=="string"?d.jsx(Ot,{options:c,children:l.text}):l.text},u)})})},tt=()=>C.Fragment,$h=({children:e})=>d.jsx(Pt,{variant:"secondary",children:e}),Lh=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),zh=["span","strong","h1","h2","h3","h4","h5","h6","p"],qh=({children:e})=>{const t=oe.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(C.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of C.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&C.isValidElement(s)){const o=s.type;if(zh.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(za,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},Wh=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(Pt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(Pt,{variant:"primary",children:e});case"pink-textbox":return d.jsx(Pt,{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})},Hh=e=>{const t=oe.useIntl(),n=Date.now().toString();let r="default";const a=e.src;return a.includes("youtube")||a.includes("vimeo")?r="video":a.includes("riddle")||a.includes("sli.do")?r="poll":a.includes("padlet")&&(r="padlet"),d.jsxs(d.Fragment,{children:[d.jsx(Ie,{element:"a",href:`#content-after-iframe-${n}`,onClick:i=>{var s;i.preventDefault(),i.stopPropagation(),(s=document.getElementById(`content-after-iframe-${n}`))==null||s.scrollIntoView({behavior:"smooth"})},children:t.formatMessage({id:`markdown_skip${r==="default"?"":`_${r}`}`})}),d.jsx("iframe",{...e,title:t.formatMessage({id:`markdown_iframe${r==="default"?"":`_${r}`}`})}),d.jsx("span",{id:`content-after-iframe-${n}`})]})},Io=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},Uh=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&C.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||Io(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!C.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Io(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(Ee,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},as=({children:e,...t})=>d.jsx("span",{className:Z({url:t==null?void 0:t.href}),children:e});const Vh={default:{a:Uh,CollapsibleSection:za,TextBox:Pt,CaseStudy:$h,style:tt,details:qh,div:Wh,iframe:Hh,center:Lh},"text-only":{h1:tt,h2:tt,h3:tt,h4:tt,h5:tt,h6:tt,style:tt,details:tt,div:tt,TextBox:tt,CollapsibleSection:tt,CaseStudy:tt,blockquote:tt,iframe:tt,button:tt}},Un=({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:C.Fragment,forceBlock:!0};let o=Vh[r];return t.overrides&&(o={...o,...t.overrides}),d.jsx("div",{className:Z("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Ot,{options:{...s,...t,overrides:o},children:n})})};const Pc=({maxWidth:e=!1,title:t,subtitle:n,children:r,className:a=""})=>{const i=e?{"--max-width":`${e/16}rem`}:{};return d.jsxs("section",{className:Z("page-heading",a),children:[d.jsxs("div",{className:Z("content",{"has-max-width":e}),style:i,children:[t&&t.text&&C.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&C.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const fn=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${Ht}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=js(!!a),c=d.jsx("span",{...u,className:Z("pill",e,t,n,{"has-icon":r}),style:o,...s,children:i});return a?d.jsxs("span",{className:"pill-wrapper",children:[d.jsx(wn,{isOpen:l,children:a}),c]}):c};const xr=({element:e="p",children:t=null,className:n="",...r})=>C.createElement(e,{...r,className:Z("status-banner text-small",n),"aria-live":"assertive"},t);const Kh=({styling:e={},progress:t=0,text:n=!1,className:r=""})=>{const a=oe.useIntl(),{showText:i=!1,layout:s="bar",size:o="default",color:l="default"}=e,u=t>75?100:t>50?75:t>25?50:t>5?25:0,c={"--progress":`${t}%`};return d.jsx("span",{className:Z(`progress-bar section-${u}`,s,r,{[o]:o!=="default",[l!=="default"?l:""]:l!=="default"}),style:c,children:C.createElement(i?"span":Ie,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},Ps=C.memo(Kh);const si="loadingBlock_",Zh=({progress:e=0,steps:t=!1,className:n=""})=>{const r=oe.useIntl();t||(t={0:{text:r.formatMessage({id:`${si}loading`})},75:{text:r.formatMessage({id:`${si}almostDone`})},100:{text:r.formatMessage({id:`${si}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${Ht}icons/${t[a].icon}.svg)`}:{};return d.jsxs(Pt,{className:Z("loading-block",n,{"has-icon":a&&t[a].icon}),variant:"subtle",style:s,children:[a&&d.jsx("span",{className:"step",children:t[a].text}),d.jsx(Ps,{progress:e})]})},Yh=C.memo(Zh);const wt=({element:e="div",className:t="",...n})=>d.jsx($a,{element:e,className:Z("loading-placeholder",t),...n});const is={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"]},Nc=(e,t)=>e in is?d.jsx("div",{className:e,children:is[e].map((n,r)=>Nc(n,r))},t):d.jsx(wt,{className:e},t),Ns=({layout:e="overview-page",...t})=>d.jsx("div",{className:Z("loading-state",e),...t,children:is[e].map((n,r)=>Nc(n,r))}),Rc=e=>{const t=e&&e.toUpperCase().trim().split(" ");return Array.isArray(t)&&t.length>1&&t[0]!==""?t[1]===""?t[0][0]:t[0][0]+t[t.length-1][0]:e?e.substr(0,1):""},$r=["#5AB6A3","#A2D7AF","#806056","#3962B3"],Gh=e=>{const t=Math.ceil(26/$r.length),n=Rc(e).toLowerCase();if(n==="")return $r[0];const r=n.charCodeAt(0)-96;for(let a=0;a<$r.length;a++)if(r<=t*(a+1))return $r[a]};const $o=256,an=({className:e="",src:t="",name:n,alt:r,width:a=$o,height:i=$o,...s})=>{const[o,l]=C.useState(!1),u=C.useRef(null);C.useEffect(()=>{const f=u.current;if(!f)return;const m=f.getContext("2d");if(!m)return;const p=a,g=i;typeof window<"u"&&window.devicePixelRatio&&(f.width=p*window.devicePixelRatio,f.height=g*window.devicePixelRatio,m.scale(window.devicePixelRatio,window.devicePixelRatio)),m.fillStyle=Gh(n),m.fillRect(0,0,p,g),m.font=`${p/3}px Arial`,m.textAlign="center",m.fillStyle="white",m.fillText(Rc(n),p/2,g/1.6)},[n]);let c=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(c=!0),d.jsx("figure",{className:Z("profile-picture",e,{error:o}),...s,children:c?d.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:a,height:i}):d.jsx("canvas",{ref:u})})},Rs=e=>e==="apolitical"?{image:`${Ht}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ht}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},Qh=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const a=e!=="",i=t!=="",s=n!=="";if(!a&&!i&&!s)return"";const o=`${e}${a&&i?` — ${t}`:t}`;let l=`${o}${(a||i)&&s?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=Wn(l,r)),l};const jr=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=oe.useIntl(),{size:l="medium"}=r,u=Rs(t);u.name||(u.name=o.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:c,image:f}=u;let{url:m}=u;t.link!==void 0&&(t.link===!1?m=void 0:m=t.link);const p=Qh(u),g=n&&n.createdAt?ts(n.createdAt):!1,h=n&&n.createdAt?Os(n.createdAt):"";return C.createElement(e,{className:Z("member text-medium",l,s),children:d.jsxs(kn,{href:m,gtmType:i,gtmContext:a,onClick:y=>{y==null||y.stopPropagation()},children:[d.jsx(an,{name:c,src:f}),d.jsxs("p",{className:"details",children:[d.jsx("strong",{children:c}),n&&d.jsxs("span",{className:"additional-content",children:[n.createdAt&&g&&d.jsx("span",{className:"date",title:h,"aria-label":h,children:o.formatMessage({id:`dates_${g.path}`},{number:g.number})}),n.didEdit&&d.jsx("em",{children:o.formatMessage({id:"discussion_edited"})})]}),p&&d.jsx("small",{className:Z({"text-medium":l==="large"}),children:p})]})]})})};const Lo={small:24,medium:48},Ms=({element:e="div",contributors:{total:t,data:n}={total:void 0,data:[]},styling:{showText:r,size:a,showGap:i,showPlaceholders:s}={showText:!0,size:"medium",showGap:!0,showPlaceholders:!1},cutoff:o=2,multipleText:l,className:u="",...c})=>{const f=oe.useIntl();return!n||n.length===0?null:C.createElement(e,{...c,className:Z("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((m,p)=>{let g,h="";if(p<o){const{name:y="",image:v=""}=Rs(m);if(s)return d.jsx(wt,{element:"li",className:"contributor"},p);g=d.jsx(an,{name:y,src:v,width:Lo[a||"medium"],height:Lo[a||"medium"]})}else if(p===o){const y=(t||n.length)-o;g=d.jsxs("small",{className:Z({"large-number":y>99}),children:["+",Ah(y,0)]}),h="number-left"}return g?d.jsx("li",{className:Z("contributor",h),children:g},p):null})}),r&&d.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?f.formatMessage({id:`member_${n[0]}`}):Wn(n[0].name||"",20):l||null})]})})};const Is=({limit:e,valueLength:t})=>{const n=oe.useIntl(),r="form_fieldWrapper_characterLimit";if(e===0)return null;const a=e-t,i=Math.abs(t-e);return d.jsxs("small",{className:Z("character-limit",{"near-limit":t>=.99*e,"approaching-limit":t>=.9*e&&t<.99*e}),"aria-live":"polite","aria-label":n.formatMessage({id:`${r}_aria_${a<0?"over":"default"}`},{remaining:a,over:i,limit:e}),children:[d.jsx("span",{className:"hidden",children:n.formatMessage({id:r})}),t," / ",e]})},qa=e=>(e==null?void 0:e.toString().length)||0,Mc=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{qa(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const Lr="emailHelperTextBox_",Ic=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=oe.useIntl(),[i,s]=C.useState({path:`${Lr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=C.useState(!1),u=C.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=h=>{s({path:`${Lr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:y=>u(y),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:h})};if(typeof r!="function"){g(a.formatMessage({id:`${Lr}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(h=>{g(h.message)}).finally(()=>{l(!1)})},[t,n,r]);C.useEffect(()=>{let p=Lr,g="default",h={},y={};switch(e){case"gov":p+="autoApproved",g="success";break;case"nonGov":p+="unrecognisedEmail",g="error",h={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":p+="pendingApproval",g="error",y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",g="error",h={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:v=>u(v),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",g="error",h={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",h={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:p,type:g,link:h,mail:y})},[e]);const c={};return["link","mail"].forEach(p=>{c[p]=Object.keys(i[p]).length?g=>d.jsx("a",{...i[p],children:g}):g=>g}),d.jsx(jc,{type:i.type,heading:o?!1:a.formatMessage({id:`${i.path}_title`}),children:o?d.jsxs(d.Fragment,{children:[d.jsx(wt,{element:"span"}),d.jsx(wt,{element:"span"})]}):a.formatMessage({id:`${i.path}_text`},{...c,strong:p=>d.jsx("strong",{children:p}),em:p=>d.jsx("em",{children:p}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:i.error})})},Nn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,...u})=>{const c=C.useRef(),f=r||c;return C.createElement(t,{ref:f,...u,type:o,id:n,name:i,className:Z(e,t,{"has-scrollbar":o==="textarea"&&f.current&&f.current.clientHeight<f.current.scrollHeight}),value:l,placeholder:s,...a,onChange:m=>{const p=m.target;a.onChange(p.value)}})};const Fn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},Jh=500,Xh=({id:e,name:t=e,value:n,placeholder:r,functions:a={onChange:()=>{},onKeyInput:async()=>new Promise(()=>{})},...i})=>{const{onChange:s=()=>{},onKeyInput:o=async()=>{}}=a,[{input:l,displayInput:u,debouncedInput:c},f]=C.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:m,activePredictionIndex:p,isPredictionSelected:g},h]=C.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:y}=oe.useIntl();r||(r=y({id:"inputAutocomplete_placeholder"})),C.useEffect(()=>{const E=setTimeout(()=>{g||f(k=>({...k,debouncedInput:l}))},Jh);return()=>{clearTimeout(E)}},[l,g]),C.useEffect(()=>{c&&!g?(async()=>{try{const k=await o(c)||[];h(F=>({...F,predictions:k}))}catch(k){console.error("Error fetching predictions:",k),h(F=>({...F,predictions:[]}))}})():h(E=>({...E,predictions:[]}))},[c,g]),C.useEffect(()=>{p>=0&&m[p]&&f(E=>({...E,displayInput:m[p].description}))},[p,m]);const v=E=>{[Fn.DOWN,Fn.UP,Fn.ENTER].includes(E.key)&&(E.preventDefault(),E.key===Fn.DOWN&&p<m.length-1?h(k=>({...k,activePredictionIndex:p+1})):E.key===Fn.UP&&p>0?h(k=>({...k,activePredictionIndex:p-1})):E.key===Fn.ENTER&&p>-1&&(s(m[p].description),f(k=>({...k,input:m[p].description})),h(k=>({...k,predictions:[],isPredictionSelected:!0}))))},w=E=>{s(E.target.value),f(k=>({...k,input:E.target.value,displayInput:E.target.value})),h(k=>({...k,activePredictionIndex:-1,isPredictionSelected:!1}))},A=E=>{s(E.description),f(k=>({...k,input:E.description,displayInput:E.description})),h(k=>({...k,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:w,onKeyDown:v,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:m.map((E,k)=>d.jsx("li",{onClick:()=>A(E),onMouseEnter:()=>h(F=>({...F,activePredictionIndex:k})),className:Z("predictions-list-item",{active:k===p}),children:E.description},k))})]})};const $c=({className:e="",disabled:t,element:n="p",functions:r={onChange:()=>{}},id:a,inputRef:i,intlPath:s=!1,label:o,shownValue:l=!0,type:u="checkbox",value:c,...f})=>{const m=oe.useIntl(),{onChange:p,...g}=r,h=()=>{t||p(c?null:l)},y=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:v=>{(v.key==="Enter"||v.code==="Space")&&(v.preventDefault(),v.stopPropagation(),h())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||m.formatMessage({id:s?`${s}_${a}`:a})})]});return C.createElement(n,{onClick:v=>{const w=v.target;w.nodeName.toLowerCase()==="a"||w.parentNode&&w.parentNode.nodeName.toLowerCase()==="a"||(v.preventDefault(),v.stopPropagation(),h())},className:Z("checkbox-wrapper",e),...f,...g},y)};const em=C.memo(function({direction:t="down"}){return d.jsx($a,{className:Z("rotating-chevron",`direction-${t}`)})});const tm=({className:e,options:t,initialValue:n,value:r,functions:a={onChange:()=>{},onMultiSelectSubmit:()=>{}},gtm:{context:i}={context:""},placeholder:s,multiSelect:o,multiSelectOptions:l,id:u})=>{const c=oe.useIntl(),[f,m]=C.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[h,y]=C.useState(g);let v;Array.isArray(h)&&h.length===1&&typeof h[0]=="string"?v=t&&h?t.find(S=>S.id===h[0]):t?t[0]:{id:"",label:""}:Array.isArray(h)&&h.length===1&&typeof h[0]!="string"?v=h[0]:v={id:"",label:""},C.useEffect(()=>{y(g)},[r,n]);const{onChange:w,onMultiSelectSubmit:A,...E}=a,k=S=>{if(o){let L=[];h!=null&&h.includes(S.id)?L=h.filter(I=>I!==S.id):L=[...h,S.id],y([...L]),w&&w([...L])}else y([S]),w&&w(S.id),m(!1)},F=S=>{if(S==="all"){const L=(t==null?void 0:t.map(I=>I.id))||[];y(L),w&&w(L)}else y([]),w&&w([])};return d.jsxs("div",{className:Z("dropdown-wrapper",e),children:[d.jsxs("button",{className:"input","aria-expanded":f,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:S=>{S.preventDefault(),S.stopPropagation(),m(!f)},"data-testid":"dropdown-selector",...E,children:[o?`${s} · ${h.length}`:v.label,d.jsx(em,{direction:f?"up":"down"})]}),d.jsx("select",{defaultValue:v.id,onChange:S=>{S.preventDefault(),S.stopPropagation();const L=t&&t.find(I=>I.id===S.target.value);k(L)},hidden:!f,...E,children:t==null?void 0:t.map(S=>d.jsx("option",{value:S.id,children:S.label},S.id))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!f,children:[d.jsxs("div",{className:"dropdown-menu-list",children:[(l==null?void 0:l.topbar)&&d.jsxs("div",{className:"action-bar",children:[d.jsx("p",{children:`${h==null?void 0:h.length} selected`}),d.jsxs("ul",{children:[d.jsx("li",{children:d.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>F("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(Ee,{variant:"tertiary",size:"small",onClick:()=>F("none"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_none"})})})]})]}),d.jsx("ul",{children:t==null?void 0:t.map(S=>{const L=S.id===v.id||(h==null?void 0:h.includes(S))||(h==null?void 0:h.includes(S.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:Z("gtm-trackable",{selected:L,"selected-single":L&&!o}),"data-gtm-event-type":`${S}-click`,"data-gtm-event-context":i,onClick:I=>{I.preventDefault(),I.stopPropagation(),k(S)},role:"menuitem","aria-current":L,"data-testid":L?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:Z({"menu-option-label":o}),children:S.label})]})},S.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(Ee,{variant:"secondary",onClick:()=>{A&&A(h),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:h}})),m(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const 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,...f})=>{const m=oe.useIntl(),p=i?c:[],g=c;return d.jsx("ul",{...f,className:Z("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:h,label:y=!1,value:v=h,disabled:w=!1})=>{const A=`${r}_${h}`,E=()=>{if(w)return;let k;if(i){const F=p==null?void 0:p.indexOf(v);Array.isArray(p)&&F>=0?(k=p,k.splice(F,1)):(!p||p.length===0?k=[]:k=p,k.push(v))}else k=g===v?void 0:v;t.onChange(k)};return d.jsx($c,{element:"li",id:A,type:u==="checkboxes"?"checkbox":"radio",shownValue:v,value:i?p==null?void 0:p.includes(v):g===v,functions:{...t,onChange:E},intlPath:n,label:y||m.formatMessage({id:n?`${n}_${h}`:h}),disabled:w},A)})})};const rm=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},...r})=>{const a=oe.useIntl(),i=C.useRef(),s=e||i,[o,l]=C.useState(!1),[u,c]=C.useState(t),f=()=>{var m;l(!o),c(o?"password":"text"),(m=s.current)==null||m.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:Z("show-password gtm-trackable",{"password-visible":o}),"data-gtm-event-context":n,"data-gtm-event-type":`${o?"hide":"show"}-password-click`,onClick:f,"aria-label":a.formatMessage({id:`showpassword_aria_${o?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${o?"hide":"show"}`})}),d.jsx(Nn,{inputRef:s,type:u,...r})]})};const Tn={text:{component:Nn},email:{component:Nn},url:{component:Nn},textarea:{component:Nn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:$c},checkboxes:{component:nm,props:{multiSelect:!0}},select:{component:tm},password:{component:rm},autocomplete:{component:Xh}},am=({id:e,intlPath:t=!1,className:n="",error:r,functions:a={onChange:()=>{}},limit:i=0,showRequiredLabels:s=!0,type:o,validation:l,value:u,submitOnEnter:c,...f})=>{const m=oe.useIntl(),p=l&&l.some(({condition:k})=>k==="required"),g=qa(u),h=o&&Tn[o]&&Tn[o].component?Tn[o].component:Nn,y={};o&&["checkboxes"].includes(o)?y.element="span":y.htmlFor=e;let v={...f,id:e,name:e,className:r?"error":"",type:o,required:p,"aria-required":p,functions:mn(a),value:u};if(i>0){const k=Mc(i,a.onChange);v={...v,...k},k.functions&&typeof k.functions=="object"&&(v.functions={...v.functions,...k.functions})}o&&Tn[o]&&Tn[o].props&&(v={...v,...Tn[o].props}),o&&["checkboxes"].includes(o)&&(v.intlPath=`${t}_${e}`),r&&(v["aria-invalid"]=!0,v["aria-describedby"]=`error-${e}`);const w=f.label||m.formatMessage({id:t?`${t}_${e}`:e}),A=({...k})=>r?C.createElement(k.as||"dd",{id:`error-${e}`,className:"error text-small",role:"alert","aria-live":"assertive",...k},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(h,{...v,label:w,className:Z("field-wrapper",n)}),d.jsx(A,{as:"p"})]});const E=k=>C.createElement(k.element||"label",{...k,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsxs("dl",{className:Z("field-wrapper text-medium",n),children:[d.jsx("dt",{children:d.jsxs(E,{...y,children:[w,p&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",m.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),d.jsxs("dd",{children:[d.jsx(h,{...v}),d.jsx(Is,{limit:i,valueLength:g})]}),d.jsx(A,{})]})},im=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?mn(e.errors):{},i=e.values?mn(e.values):{};switch(n){case"toggleSubmitting":return{...e,isSubmitting:!e.isSubmitting};case"updateValue":if(r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],r!=null&&r.key){if(["isSubmitting","formSubmitted","errors"].includes(r==null?void 0:r.key))return{...e,errors:a,[r==null?void 0:r.key]:r==null?void 0:r.value};i[r==null?void 0:r.key]=r==null?void 0:r.value}return{...e,errors:a,values:i};case"addError":return r!=null&&r.key&&!a[r==null?void 0:r.key]&&(a[r==null?void 0:r.key]=r==null?void 0:r.value),{...e,errors:a};case"removeError":return r!=null&&r.key&&a[r==null?void 0:r.key]&&delete a[r==null?void 0:r.key],{...e,errors:a};case"submitForm":{const{fields:s=[],dispatch:o=()=>{},onSuccess:l=()=>{},onFailure:u=()=>{},intl:c}=r,f=mn(Object.keys(a));for(const m of s)if(m.validation)for(let p=0;p<m.validation.length;p++){const{condition:g="required",error:h=!1}=m.validation[p];let y=!1;if(typeof g=="function"){const v=g(i);v&&(y=h||v)}else{const v=i[m.id];switch(g){case"required":(!v||typeof v=="string"&&v.trim().length===0)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{v&&!/^([^0-9]*)$/.test(v)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{v&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(v)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{v&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(v)&&(y=h||(c==null?void 0:c.formatMessage({id:"form_error_url"})));break}default:console.warn("WARNING! No field validation condition has been set")}}if(y){o({type:"addError",payload:{key:m.id,value:y}}),f.push(m.id);break}}return f.length===0?l(i):u(i,f),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let oi=null;const er=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,gtm:u={context:"Form",event:"form-submit-click"},functions:{onSuccess:c=async()=>{},onCancel:f=()=>{},onCatch:m=()=>{},onFailure:p=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...g})=>{const{customOnSubmit:h,hideButton:y,...v}=s,w=40,{shouldShowCancelButton:A=!1,shouldReset:E=!0,showRequiredLabels:k=!0,showSuccessMessage:F=!1}=l||{},S=oe.useIntl(),L={};t.length&&t.forEach(D=>{const W=D.id||D.name;W&&(L[W]=D.value||"")});const[I,N]=C.useReducer(im,{isSubmitting:!1,formSubmitted:!1,errors:{},values:L}),{errors:M,isSubmitting:x,formSubmitted:_,values:j}=I;C.useEffect(()=>{E&&_&&(oi=setTimeout(()=>{N({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[_]),C.useEffect(()=>()=>{oi&&clearTimeout(oi)},[]),C.useEffect(()=>{const D=W=>{N({type:"updateValue",payload:{key:W.detail.id,value:W.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",D),()=>{document.removeEventListener("dropdownMultiSelectSubmit",D)}},[]);const R=C.useRef(null),q=a||R;if(!t.length)return null;s.text||(s.text=S.formatMessage({id:"form_submit"}));const V=()=>{if(!x){if(N({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&N({type:"submitForm",payload:{fields:t,dispatch:N,intl:S}});return}N({type:"submitForm",payload:{fields:t,dispatch:N,onSuccess:async D=>{try{await c(D),N({type:E?"formSubmittedAndReset":"formSubmitted"})}catch(W){m(W),N({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(D,W)=>{p(D,W),N({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:S}})}},ne=[{...v,icon:_?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:D=>{var B;if(D.preventDefault(),D.stopPropagation(),x)return;let W=0;if((B=q==null?void 0:q.current)!=null&&B.id){const T=document.getElementById(q.current.id);T&&(W=T.getBoundingClientRect().top+window.scrollY)}const X=document.getElementById("header");X&&(W=W-X.offsetHeight-w),W<0&&(W=0),window.scrollTo({top:W,behavior:"smooth"}),V()},disabled:x||_||s.disabled,"data-gtm-event-context":u.context,"data-gtm-event-type":u.event,children:x||_?S.formatMessage({id:`form_${x?"submitting":"submitted"}`}):s.text}];return A&&ne.unshift({...o,className:"gtm-trackable","data-gtm-event-context":u.context,"data-gtm-event-type":u.event,disabled:x||_,onClick:f,children:o.text||S.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[C.createElement(e,{...g,id:r,className:Z("form",n),ref:q},d.jsxs(d.Fragment,{children:[M!=null&&M.general?d.jsx(rn,{variant:"error",text:S.formatMessage({id:"form_error_generalError"})}):null,(!E||!x&&!_||h)&&t.map((D,W)=>{const{id:X=D.name||W,component:B,functions:T={onChange:()=>{}},submitOnEnter:z=!1}=D;if(B)return d.jsx(B,{...D.props||{}},`component-${X}-${W}`);const $=j?j[X]:"",K={...T,onChange:te=>{N({type:"updateValue",payload:{key:X,value:te}}),T.onChange(te&&te.toString(),N)}};return z&&(K.onKeyDown=te=>{te.key==="Enter"&&(te.stopPropagation(),te.preventDefault(),V()),T.onKeyDown&&T.onKeyDown(te)}),d.jsx(am,{intlPath:i,...D,showRequiredLabels:k,value:$,error:M==null?void 0:M[X],functions:K},X)}),y?null:(x||_)&&h?h:d.jsx(En,{className:Z("cta",{center:x||_,submitted:_}),buttons:ne})]})),F&&_&&d.jsx(xr,{className:"success",children:typeof F=="string"?F:S.formatMessage({id:"form_success"})})]})};const zr="passwordRules_",Lc="isMoreThanEightCharacters",zc="includesNumberAndSymbol",qc="includesLowerAndUppercase",sm={[Lc]:"8Characters",[zc]:"numberSymbol",[qc]:"lowercaseUppercase"},om=({matchingRules:e={isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1},className:t=""})=>{const n=oe.useIntl();return d.jsxs("aside",{className:Z("password-rules",t),children:[d.jsx("small",{children:n.formatMessage({id:`${zr}intro`})}),d.jsx("ul",{children:[Lc,zc,qc].map(r=>d.jsxs("li",{className:Z({matches:e[r]}),children:[d.jsxs(Ie,{children:[n.formatMessage({id:`${zr}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${zr}rule_${sm[r]}`})}),!e[r]&&d.jsxs(Ie,{element:"strong",children:[" ",n.formatMessage({id:`${zr}notMet`})]})]},`rule-${r}`))})]})},Wc=C.memo(om);const um=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=oe.useIntl(),[l,u]=C.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const v=await n();u(w=>({...w,setUp:!0,id:v&&v.id,disabled:!1}))}catch(v){u(w=>({...w,setUp:!0,disabled:!0})),a(v)}};if(C.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(wt,{className:"rating-placeholder"});const{id:f,rating:m,disabled:p}=l,g="ratings_",h={text:o.formatMessage({id:`${g}text`}),low:o.formatMessage({id:`${g}low`}),high:o.formatMessage({id:`${g}high`}),success:o.formatMessage({id:`${g}success`}),...e},y=async v=>{if(!(!f||p))try{u(w=>({...w,rating:v,disabled:!0})),await r({id:f,value:v})}catch(w){u(A=>({...A,rating:null})),a(w)}finally{u(w=>({...w,disabled:!1}))}};return d.jsxs("div",{className:Z("rating",i),children:[d.jsx("span",{className:"label",children:h[m?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(v=>{const w=v+1;return d.jsx("li",{className:Z({selected:m&&w<=m}),children:d.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:`star${!m||w>m?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:w,total:t})}${w===1||w===t?` - ${h[w===1?"low":"high"]}`:""}`,onClick:A=>{A.preventDefault(),A.stopPropagation(),y(w)},disabled:p})},`rating-${w}`)})})]})};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 ss(e,t){return Array(t+1).join(e)}function cm(e){return e.replace(/^\n*/,"")}function dm(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
38
|
-
`;)t--;return e.substring(0,t)}var
|
|
35
|
+
Thank you for helping to protect the Apolitical community from abusive content.`,discussion_form_title:"Write your {action}",discussion_form_placeholder:"Write a {action}...",discussion_form_label:"Your {action}",discussion_form_explainer:"Try to make your {action} specific and practical. Be respectful and kind. See our <a>community guidelines</a>",discussion_form_success:"Your {action} has been submitted.",discussion_form_post:"Post",discussion_form_posting:"Posting...",discussion_form_save:"Save",discussion_form_saving:"Saving...",discussion_form_cancel:"Cancel",discussion_form_submitting:"Submitting...",discussion_form_placeholder_post:"Write something...",discussion_form_error:"We are unable to process your {action} right now. Please try again later or contact us if the problem persists",discussion_form_error_tooLong:"Please keep your content to {maxLength, plural, one {1 character} other {# characters}}.",discussion_form_error_tooMany:"You have posted too many times in a row. Please wait and try again.",discussion_form_error_loggedOut:"Please log in to submit your {action}.",discussion_form_error_noPermission:"You do not have permission to {action}.",discussion_form_error_alreadyExists:"This {action} already exists.",discussion_form_title_question:"Start a conversation",discussion_form_placeholder_question:"Ask your question here",discussion_form_explainer_question:"Unsure what you can post? See our <a>community guidelines</a>.",discussion_likes:"{number, plural, =0 {0 likes} one {# like} other {# likes}}",discussion_likes_short:"{number}",discussion_likes_more:"and {number} more...",discussion_likes_like:"Like this {action}",discussion_likes_unlike:"Unlike {action}",discussion_likes_show:"Show who liked this {action}",discussion_moreMenu_edit:"Edit",discussion_moreMenu_delete:"Delete",discussion_moreMenu_report:"Report",discussion_comments_screenReader:"See {count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_comments:"{count, plural, =0 {0 comments} one {# comment} other {# comments}}",discussion_responses_answer:"Answers",discussion_responses_comment:"Comments",discussion_responses_title:"{action} ({count})",discussion_responses_empty:"Be the first to respond",discussion_responses_empty_answer:"Be the first to answer this question",discussion_responses_placeholder:"Write a comment...",discussion_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_error_generalError:"Sorry, something has gone. Please refresh the page and try again.",form_error_required:"Please fill in this required field",form_error_numbers:"Numbers are not allowed in this text field",form_error_email:"Please enter a valid email address",form_error_url:"Please enter a valid URL",form_cancel:"Cancel",form_submit:"Submit",form_submitting:"Submitting form...",form_submitted:"Submitted",form_success:"Thank you for submitting the form!",inviteForm_email_placeholder:"Add email addresses...",inviteForm_title:"Know someone who might like to join this workshop?",inviteForm_label:"Invite your colleagues by typing or pasting their emails below",inviteForm_ctaMessage:"Send",inviteForm_success:"Invitation Sent!",inviteForm_error:"Something went wrong!",inviteForm_ctaTryAgain:"Try again!",inviteForm_ctaSendMoreInvites:"Send more invites",inviteForm_ctaDone:"Done",inputAutocomplete_placeholder:"Start typing...",passwordRules_unmatched_text:"Passwords do not match",passwordRules_intro:"We advise you not to use your name or email in your password.",passwordRules_rule_label:"Password",passwordRules_rule_8Characters:"must be longer than 8 characters",passwordRules_rule_numberSymbol:"must include a number and a symbol",passwordRules_rule_lowercaseUppercase:"must include both lower and upper case characters",passwordRules_notMet:"Your password does not meet this requirement",passwordRules_currentPassword_label:"Current password",passwordRules_newPassword_label:"New password",passwordRules_confirmPassword_label:"Confirm new password",profile_image_change_uploading_text:"Uploading image...",profile_image_change_cta_with_picture:"Change photo",profile_image_change_cta_without_picture:"+ Add profile photo",profile_image_change_error:"There was an error uploading the image. Please try a different file format or reduce the file size to less than 5MB. Contact us if problem persists.",ratings_text:"Rate answer",ratings_stars:"{number} out of {total}",ratings_low:"this is incorrect or confusing",ratings_high:"this is a fantastic answer",ratings_success:"Thank you!",richTextEditor_placeholder:"Write something...",richTextEditor_toolbar:"Formatting options",richTextEditor_bold:"Bold",richTextEditor_italic:"Italic",richTextEditor_strikeThrough:"Strikethrough",richTextEditor_link:"Link",richTextEditor_link_text:"Text:",richTextEditor_link_text_aria:"Text to be linked:",richTextEditor_link_url:"Link:",richTextEditor_link_placeholder:"Type or paste URL",richTextEditor_link_error_required:"Please enter a URL to link to",richTextEditor_link_open:"Open: {link}",richTextEditor_link_open_text:"Opens in a new window",richTextEditor_link_edit:"Edit",richTextEditor_link_remove:"Remove",richTextEditor_link_button:"Add link",richTextEditor_ol_list:"Numbered list",richTextEditor_ul_list:"Bullet-point list",richTextEditor_block_quote:"Quote",search_label:"Search for:",search_placeholder:"Ask Apolitical",search_clear:"Clear search",search_cta:"Search",showpassword_show:"Show",showpassword_hide:"Hide",showpassword_aria_show:"Your password is hidden. Click to show.",showpassword_aria_hide:"Your password is visible. Click to hide.",signup_title:"Sign up",signup_full_name:"Full name",signup_full_name_placeholder:"Lionel Messi",signup_email_address:"Work email",signup_email_address_placeholder:"lionel.messi@argentina.gov",signup_job_title:"Job title",signup_job_title_placeholder:"e.g. Senior Policy Advisor",signup_organization:"Organisation",signup_organization_placeholder:"e.g. Department of Justice",signup_url:"Link to official government bio / LinkedIn <small>(optional)</small>",signup_url_placeholder:"https://organisation.com/bio",signup_expectation:"What do you want to know<small>Optional, but we will use your response to build the session!</small>",signup_expectation_placeholder:"What do you want to know?",signup_terms:"I accept Apolitical's <terms>Terms of Service</terms>, <privacy>Privacy Policy</privacy> and that I'll get essential emails for my use of Apolitical",signup_error:"We're really sorry, but we've had a problem trying to sign you up. This could be an issue with our system, so we suggest you try again later.",signup_button_join:"Join for free",signup_button_login:"Log in",signup_submitting:"Submitting form...",signup_success_title:"Thank you for applying to join Apolitical!",signup_success_text:"<p>Once we've vetted your application, you'll get a secure login link to help you get started.</p><p>Please note that trust is everything to our community, so you can't login until your identity has been verified.</p>",tableOfContents:"Table of contents",timeToComplete_hours:"{time, plural, =0 {} one {1 hour} other {# hours}}",timeToComplete_hours_short:"{time}h",timeToComplete_minutes:"{time, plural, =0 {} one {1 minute} other {# minutes}}",timeToComplete_minutes_short:"{time}m",timeToComplete_range:"{early} - {late}",timeToComplete_range_aria:"between {early} and {late}",tooltip_loading:"Loading...",return_to_nav_button:"Back to top",progressTracker:"Step {current} of {total}",cookieBanner_title:"Cookies and your privacy",cookieBanner_text:"We take your trust and privacy very seriously. Apolitical uses safe cookies (small files on your device) to run the site. You can reject non-essential cookies, but some site features may not work without them.",cookieBanner_buttons_settings:"Change my settings",cookieBanner_buttons_reject:"Reject all",cookieBanner_buttons_accept:"Accept all",footer_platform:"Platform",footer_platform_events:"Events",footer_platform_courses:"Courses",footer_platform_qanda:"Q&A",footer_platform_articles:"Articles",footer_platform_communities:"Communities",footer_community:"Community",footer_community_support:"Support FAQ",footer_community_post:"Post on Apolitical",footer_community_join:"Who can join",footer_community_guidelines:"Guidelines & values",footer_company:"Company",footer_company_news:"News",footer_company_story:"Our story",footer_company_team:"Meet our team",footer_company_careers:"Careers",footer_company_partner:"Partner with us",footer_company_contact:"Get in touch",footer_legal:"Legal",footer_legal_privacy:"Privacy policy",footer_legal_terms:"Terms & conditions",footer_legal_cookie:"Cookie policy",footer_legal_accessibility:"Accessibility statement",footer_legal_ai:"AI principles",footer_legal_dataProtection:"Data protection officer",footer_legal_euDataProtection:"EU data protection officer",footer_contact:"Contact",footer_contact_correspondence:"Correspondence address",footer_contact_correspondence_address:"251 Southwark Bridge Road{br}London, SE1 6FL{br}United Kingdom",footer_contact_registered:"Registered address",footer_contact_registered_address:"20–22 Wenlock Road{br}London, N1 7GU{br}United Kingdom",footer_contact_berlin:"Berlin address",footer_contact_berlin_address:"Torstraße 220{br}10115 Berlin{br}Germany",footer_contact_support:"For platform support",footer_contact_business:"For business inquiries",footer_social_linkedin:"LinkedIn",footer_social_twitter:"Twitter",footer_social_facebook:"Facebook",footer_copyright:"Copyright © {currentYear} Apolitical Group Limited",header_skip:"Skip to main content",header_search_show:"Show search bar",header_search_hide:"Close search bar",header_menu_show:"Show navigation",header_menu_hide:"Close navigation",header_home_loggedOut:"Home",header_home_loggedIn:"My Home",header_topics:"Topics",header_topics_explore:"Explore",header_topics_explore_events:"Events",header_topics_explore_courses:"Courses","header_topics_explore_q-and-a":"Q&A",header_topics_explore_articles:"Articles",header_topics_explore_communities:"Communities",header_topics_topics:"Topics",header_topics_topics_climate:"Climate","header_topics_topics_cities-and-local-government":"Cities and local government","header_topics_topics_digital-and-data":"Digital and data",header_topics_topics_education:"Education","header_topics_topics_equity-justice-and-inclusion":"Equity, justice and inclusion","header_topics_topics_health-and-social-care":"Health and social care",header_topics_topics_innovation:"Innovation","header_topics_topics_leadership-and-skills":"Leadership and skills","header_topics_topics_life-in-government":"Life in government",header_topics_topics_policymaking:"Policymaking","header_topics_topics_transport-and-infrastructure":"Transport and infrastructure","header_topics_topics_work-and-the-economy":"Work and the economy",header_partners:"For partners",header_account:"My account",header_account_show:"Show account menu",header_account_hide:"Close account menu",header_account_profile:"My profile",header_account_settings:"Settings & privacy","header_account_log-out":"Log out",header_buttons_login:"Log in",header_buttons_signup:"Sign up",pageLayout_error:"An error occurred while rendering this page. Please refresh the page or try again later.",loadingBlock_loading:"Loading...",loadingBlock_almostDone:"Almost done...",loadingBlock_complete:"Complete!",progressBar:"{number}% loaded",inviteModal_title:"You’re registered",inviteModal_formTitle:"Know someone who might like to join this workshop?",inviteModal_formLabel:"Invite your colleagues by typing or pasting their emails below.",inviteModal_cta:"Send",overlay_close:"Close",breadcrumbs_label:"Go back to:",breadcrumbs_currentPage:"Current page:",filters_all:"Show all",filters_disabled:"{name} - no results",languageSwitcher_label:"I would like to read this article in...",languageSwitcher_translation_original:"original language",languageSwitcher_translation_human:"translated by person",languageSwitcher_translation_machine:"translated by machine",languageSwitcher_selected:"{language} - currently selected",languageSwitcher_disclaimer:"This content is machine translated and will occasionally get gendered language or other direct translations wrong. We’re trying to resolve this but in the meantime, if you notice something very wrong, let us know at <link>{email}</link>",loadMore_button:"Load more",loadMore_endOfFeed:"You're all caught up",loadMore_error:"We're having trouble loading more content. Please refresh the page or try again later.",moreMenu:"See more options",navigationMenu_links_homepage:"Home",navigationMenu_links_events:"Events",navigationMenu_links_microcourses:"Courses","navigationMenu_links_q-and-a":"Q&A",navigationMenu_links_articles:"Articles",navigationMenu_links_communities:"Communities",navigationMenu_profile:"My profile",shareLinks_label:"Share",shareLinks_link_linkedin:"Share on LinkedIn",shareLinks_link_twitter:"Share on Twitter",shareLinks_link_facebook:"Share on Facebook",shareLinks_link_email:"Share by email","shareLinks_link_clipboard-copy":"Copy the link",tags_community:"From the community",edit_section_placeholder_description:"Add some details",edit_section_placeholder_cta:"add",notFoundError_title:"We can't find that page",notFoundError_text:"Sorry about that. We all mess up sometimes - read some ‘fail’ stories below.",notFoundError_post_1:"Why public servants must learn to fail — and 3 tips for how to do it",notFoundError_post_2:"What failure has taught me",notFoundError_post_3:"How to learn from failure without causing a scandal",notFoundError_cta:"View more articles",collapsibleSection_summary:"Find out more",contentTypeLabel_event:"Event",contentTypeLabel_learningHub:"Programme",contentTypeLabel_listPage:"List",contentTypeLabel_microcourse:"Course",contentTypeLabel_qaQuestion:"Q&A",contentTypeLabel_solutionArticle:"Article",contentTypeLabel_communityPage:"Community",hideShowTextBox_hide:"View less",hideShowTextBox_show:"View more",markdown_collapsibleSection_summary:"Resources",markdown_skip_video:"Skip past video",markdown_skip_padlet:"Skip past interactive board",markdown_skip_poll:"Skip past poll",markdown_skip:"Skip to next section",markdown_iframe_title:"Course information",markdown_iframe_video:"Video",markdown_iframe_padlet:"Interactive board",markdown_iframe_poll:"Poll"},Nh={...Xn,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>"},Rh={...Xn,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"},Mh={...Xn,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>"},Ih=Object.freeze(Object.defineProperty({__proto__:null,en:Xn,es:Nh,fr:Rh,pt:Mh},Symbol.toStringTag,{value:"Module"})),La=(e,t=Xn)=>e in t,Ft=(e,t,n,r,a={})=>{let i="";return La(`${t}_${n}`)?i=e({id:`${t}_${n}`},a):i=e({id:t},{[r]:n,...a}),i},$h=(e,t,n)=>{if(!e||e===0)return"0";t||(t=0),n||(n=["k","m","b","t"]);let r=e.toString();t=Math.pow(10,t);for(let a=n.length-1;a>=0;a--){const i=Math.pow(10,(a+1)*3);if(i<=e){e=Math.round(e*t/i)/t,e===1e3&&a<n.length-1&&(e=1,a++),r=`${e}${n[a]}`;break}}return r},oa=(e,t)=>C.Children.map(e,n=>Object.is(n,null)?n:C.cloneElement(n,{...t})),Pc=(e=0)=>{setTimeout(()=>{const t=document.querySelector(".splash-screen");t&&t.remove(),window.prerenderReady=!0},e)},Lh=(e,t,n)=>!t.id||!t.name?"":n.replace(/{{name}}/g,t.name).replace(/{{id}}/g,t.id),Nc=async({text:e,template:t,mentions:n,listMembers:r=()=>Promise.resolve([])})=>{var i;if(!n)return e;const a=e.match(rs);if(!a)return e;for(const s of a){const o=s.replace(rs,(c,m)=>m),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(ns))try{const m=c.replace(ns,"");u.id=m,await r({id:m}).then(h=>{const{name:p}=h;u.name=p||""})}catch{e.replace(s,"@");continue}else continue}e=e.replace(s,u.name?Lh(e,u,t):s)}return e},Rc=e=>{const t=e.startsWith("http")?e:`https://${e}`,r=new URL(t).hostname;return{full:t,pretty:r}},zh=(e="")=>e.replace(/\s+/g,"").length>0,is=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 ke=({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:m=!1,...h})=>{const g=Jn(typeof t=="object"),{showTooltip:f,tooltipProps:y}=Rs(!!u);if(typeof t=="object"&&typeof g=="number"){const k=Object.assign({},t),E=kc(Object.keys(k));t=_c(g,E,k)}!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 w={...h,className:Y(e,o,b,{"no-text":!m,disabled:l,button:a}),onClick:k=>{(!a||a[0]==="#")&&s&&(k.preventDefault(),k.stopPropagation()),s&&s(k)},disabled:typeof l=="object"&&"isClickable"in l?!l.isClickable:l};a&&(i="a",w.href=a);const A=C.createElement(i,w,m||(c?d.jsx(Ie,{showOnFocus:!1,children:c}):null));return l&&u?d.jsxs("span",{className:"button-container",...y,children:[d.jsx(En,{isOpen:f,children:u}),A]}):A},kn=({buttons:e,wrappers:t=[],className:n="",...r})=>{const a=e.length>1?"ul":"p",i=e.map((s,o)=>{var l;return a==="p"?d.jsx(ke,{...s},o):d.jsx("li",{className:((l=t[o])==null?void 0:l.className)||"",children:d.jsx(ke,{...s})},o)});return C.createElement(a,{className:Y("button-wrapper",n),...r,children:i})};const tn=({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})},Io={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"}},qh=({aspect:e,range:t,sizes:n})=>{const{range:r,sizes:a}=e?Io[e]:Io.fallback;return{range:t&&t.length>0?t:r,sizes:n||a}},Wh=({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},ii=({format:e,range:t,url:n,query:r})=>t.map(({height:a,width:i})=>`${n}?${Wh({format:e,height:a,query:r,width:i})} ${i}w`).join(", ");const er=({image:e,className:t,testId:n})=>{const{description:r,height:a,type:i,query:s,url:o,width:l,loading:u,decoding:c,fetchPriority:m}=e,{range:h,sizes:p}=qh(e),g=ii({format:"avif",query:s,range:h,url:o}),f=ii({format:"webp",query:s,range:h,url:o}),y=ii({format:"",query:s,range:h,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:m||"auto",width:l,height:a,"data-testid":n||"image"})}):d.jsxs("picture",{className:t,children:[i!=="image/gif"&&d.jsx("source",{type:"image/avif",srcSet:g,sizes:p,"data-testid":"source"}),d.jsx("source",{type:"image/webp",srcSet:f,sizes:p,"data-testid":"source"}),d.jsx("img",{srcSet:y,sizes:p,src:o,alt:r,loading:u||"lazy",decoding:c||"async",fetchpriority:m||"auto",width:l,height:a,"data-testid":n||"image"})]})};const Hh=({image:e,className:t="",testId:n})=>d.jsx("div",{className:`image-container ${t}`,"data-testid":n||"image-container",children:e&&d.jsx(er,{image:{...e},className:"image"})}),_n=({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?C.createElement(n,{children:t,className:r,...o}):d.jsx(d.Fragment,{children:t})};const Mc=C.forwardRef(({className:e="",children:t},n)=>{const r=C.useRef(null),a=n||r;return d.jsx("aside",{ref:a,className:Y("popover",e),"aria-live":"polite",children:t})}),Is=({children:e})=>typeof document=="object"?gc.createPortal(e,document.body):null;const Uh=({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 Vh=({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(ke,{variant:"secondary",className:"return-to-nav",onClick:r,"data-gtm-event-context":"ListPageMobile","data-gtm-event-type":"back-to-nav-button-click",screenreaderText:n.formatMessage({id:"return_to_nav_button"})})};const Kh=({items:e,className:t="",...n})=>d.jsx("ul",{className: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))}),$o=300,Lo="ease-in-out";class Zh{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:$o,easing:Lo}),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:$o,easing:Lo}),this.animation.onfinish=()=>this.onAnimationFinish(!0),this.animation.oncancel=()=>this.isExpanding=!1}onAnimationFinish(t){this.el.open=t,this.animation=null,this.isClosing=!1,this.isExpanding=!1,this.el.style.height=this.el.style.overflow=""}}const za=({label:e=!1,className:t="",children:n,shouldAnimate:r=!1})=>{const a=ue.useIntl(),i=C.useRef(null);return C.useEffect(()=>{let s;return r&&(s=new Zh(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})]})},zo={cube:"box",graduationCap:"graduation-cap",person:"user",speech:"speech-bubble_round",star:"star_empty_thin"},Yh=e=>{let t=e;return Object.keys(zo).includes(e)&&(t=zo[e]),`url(${Ht}icons/${t}.svg)`};const qo={customCard:"custom",microcourse:"course",solutionArticle:"article",qaQuestion:"question",listPage:"list",learningHub:"learning-hub",communityPage:"communityPage"},Ic=({contentType:e,customIcon:t,customLabel:n,className:r=""})=>{const a=ue.useIntl(),i=t?{"--custom-icon":Yh(t)}:{},s=La(`contentTypeLabel_${e}`)?a.formatMessage({id:`contentTypeLabel_${e}`}):!1;return!n&&!s?null:d.jsx("small",{className:Y("content-type-label text-small",e in qo?qo[e]:e,r,{"has-custom-icon":t}),style:i,"data-testid":"content-type-label",children:n||s})};const Nt=({variant:e="primary",icon:t,styling:n={},className:r="",children:a,...i})=>{const{showHighlight:s=!1,background:o="default"}=n,l=t?{"--icon":`url(${Ht}icons/${t}.svg)`}:{};return d.jsx("div",{className:Y("highlighted-text-box",e,r,{"has-icon":t,"show-highlight":s,[o]:o!=="default"}),style:l,...i,children:a})};const an=({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=Jn(i);if(i&&typeof n=="object"&&typeof s=="number"){const m=Object.assign({},n.breakpoints),h=kc(Object.keys(m));a=_c(s,h,m)}const{breakpoints:o,text:l="",component:u,...c}=n;return d.jsx(Nt,{variant:"subtle",className:Y("empty-state-box",e,r),children:d.jsxs(d.Fragment,{children:[t&&typeof t=="string"?d.jsx(Pt,{options:{forceBlock:!0},children:t}):t,a&&typeof n=="object"&&(u||d.jsx(ke,{...c,variant:n.variant?n.variant:"secondary",children:l}))]})})};const ss=({children:e,...t})=>d.jsx("p",{...t,children:e}),$c={q:ss,blockquote:ss};for(let e=1;e<=6;e++)$c[`h${e}`]={component:ss,props:{className:"title"}};const Lc=({type:e="default",className:t="",heading:n=!1,children:r})=>d.jsxs("div",{className:Y("helper-text-box text-small",e,t),children:[n&&d.jsx("p",{className:"title",children:n}),typeof r=="string"?d.jsx(Pt,{options:{wrapper:C.Fragment,forceBlock:!0,overrides:$c},children:r}):d.jsx("p",{children:r})]});const zc=({id:e,className:t="",show:n=!1,hide:r=!1,text:a,markdownOptions:i,children:s})=>{const o=ue.useIntl(),l=C.useRef(null);e||(e=Date.now().toString());const[u,c]=C.useState(""),[m,h]=C.useState("closed");C.useEffect(()=>{const f=l.current;if(f)return f.addEventListener("transitionend",p),()=>{f.removeEventListener("transitionend",p)}},[]),C.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]),C.useEffect(()=>{m==="ready-to-close"&&h("closing")},[m]);const p=({propertyName:f})=>{f==="max-height"&&h(y=>y==="opening"?"open":y==="closing"?"closed":y)};if(!a)return null;const g=["opening","open"].includes(m);return d.jsxs(Nt,{variant:"subtle",className:Y("hide-show-text-box",t),children:[d.jsxs("div",{ref:l,id:e,className:Y("content",m),children:[d.jsx(Pt,{options:{forceBlock:!0,...i},children:m==="closed"?u:a}),m!=="closed"&&s]}),d.jsx("p",{className:"cta",children:d.jsx(ke,{variant:"tertiary",icon:{icon:"navigation_arrow",position:"left",animate:!0},styling:{muted:!0},className:Y({"rotate-180":g}),onClick:()=>{h(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 Gh=({element:e="ul",layout:t="vertical",variant:n="default",items:r=[],styling:a={},className:i=""})=>{const{hasBorder:s=!1,zebraStriping:o=!1}=a;return C.createElement(e,{className: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:C.Fragment,forceInline:!0},m={"--icon":`url(${Ht}icons/${l.icon}.svg)`};return e==="dl"?d.jsxs(C.Fragment,{children:[d.jsx("dt",{style:m,children:d.jsx(Pt,{options:c,children:l.dt||""})},`dt-${u}`),d.jsx("dd",{children:typeof l.text=="string"?d.jsx(Pt,{options:c,children:l.text}):l.text},`dd-${u}`)]},`dl-${u}`):d.jsx("li",{style:m,children:typeof l.text=="string"?d.jsx(Pt,{options:c,children:l.text}):l.text},u)})})},tt=()=>C.Fragment,Qh=({children:e})=>d.jsx(Nt,{variant:"secondary",children:e}),Jh=({children:e})=>typeof e=="object"&&Object.keys(e||{}).length===1?d.jsx("p",{className:"center",children:e}):d.jsx("div",{className:"center",children:e}),Xh=["span","strong","h1","h2","h3","h4","h5","h6","p"],em=({children:e})=>{const t=ue.useIntl();if(!e)return null;let n=t.formatMessage({id:"markdown_collapsibleSection_summary"});const r=[];for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number"))if(C.isValidElement(i)&&i.type==="summary"){if(i.props&&i.props.children){for(const s of C.Children.toArray(i.props.children))if(!(!s||typeof s=="string"||typeof s=="number")&&C.isValidElement(s)){const o=s.type;if(Xh.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(za,{label:a,className:["Sources","Resources"].includes(a)?"discrete-links":"",children:r.map(i=>i)})},tm=({children:e,...t})=>{if(t.class)switch(t.class){case"casestudy":return d.jsx(Nt,{variant:"secondary",children:e});case"general-textbox":case"highlight-box":return d.jsx(Nt,{variant:"primary",children:e});case"pink-textbox":return d.jsx(Nt,{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})},nm=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}`})]})},Wo=e=>{let t="";return e&&typeof e!="string"&&typeof e!="number"&&typeof e!="boolean"&&"type"in e&&(t=e.type),t},rm=({children:e,...t})=>{let n={...t};t.href&&(t.href.includes("http:")||t.href.includes("https:"))&&!t.target&&(n.target="_blank");let r=e,a=!1;for(const i of C.Children.toArray(e))if(!(!i||typeof i=="string"||typeof i=="number")&&C.isValidElement(i)){const s=i.type;if(["button","center","span","strong"].includes(s)&&i.props&&i.props.children&&i.props.children[0])for((s==="button"||Wo(i.props.children[0])==="button")&&(a=!0),r=i.props.children[0];r&&typeof r!="string"&&!(typeof r=="boolean"||typeof r=="number"||!C.isValidElement(r));)if(r.props&&r.props.children&&r.props.children[0])r=r.props.children[0],r&&Wo(r)==="button"&&(a=!0);else break}return a?(n={...n,className:"button primary medium"},d.jsx("p",{className:"center",children:d.jsx(ke,{variant:"primary",size:"medium",...n,children:r})})):d.jsx("a",{...n,children:r})},os=({children:e,...t})=>d.jsx("span",{className:Y({url:t==null?void 0:t.href}),children:e});const am={default:{a:rm,CollapsibleSection:za,TextBox:Nt,CaseStudy:Qh,style:tt,details:em,div:tm,iframe:nm,center:Jh},"text-only":{h1:tt,h2:tt,h3:tt,h4:tt,h5:tt,h6:tt,style:tt,details:tt,div:tt,TextBox:tt,CollapsibleSection:tt,CaseStudy:tt,blockquote:tt,iframe:tt,button:tt}},Vn=({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:C.Fragment,forceBlock:!0};let o=am[r];return t.overrides&&(o={...o,...t.overrides}),d.jsx("div",{className:Y("markdown-text",e,{"highlight-titles":i}),children:d.jsx(Pt,{options:{...s,...t,overrides:o},children:n})})};const qc=({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&&C.createElement(t.element||"h1",{className:"title"},t.text),n&&n.text&&C.createElement(n.element||"h2",{className:"text-medium"},n.text)]}),r]})};const hn=({size:e="medium",variant:t="default",className:n="",icon:r,tooltip:a="",children:i,...s})=>{const o={"--icon":`url(${Ht}icons/${r}.svg)`},{showTooltip:l,tooltipProps:u}=Rs(!!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(En,{isOpen:l,children:a}),c]}):c};const wr=({element:e="p",children:t=null,className:n="",...r})=>C.createElement(e,{...r,className:Y("status-banner text-small",n),"aria-live":"assertive"},t);const im=({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:C.createElement(i?"span":Ie,{className:i?"text":"",children:n||a.formatMessage({id:"progressBar"},{number:t})})})},$s=C.memo(im);const si="loadingBlock_",sm=({progress:e=0,steps:t=!1,className:n=""})=>{const r=ue.useIntl();t||(t={0:{text:r.formatMessage({id:`${si}loading`})},75:{text:r.formatMessage({id:`${si}almostDone`})},100:{text:r.formatMessage({id:`${si}complete`})}});let a=null;const i=Object.keys(t);for(let o=0;o<i.length&&!(e<parseInt(i[o]));o++)a=i[o];const s=a&&t[a].icon?{"--icon":`url(${Ht}icons/${t[a].icon}.svg)`}:{};return d.jsxs(Nt,{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($s,{progress:e})]})},om=C.memo(sm);const wt=({element:e="div",className:t="",...n})=>d.jsx($a,{element:e,className:Y("loading-placeholder",t),...n});const us={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"]},Wc=(e,t)=>e in us?d.jsx("div",{className:e,children:us[e].map((n,r)=>Wc(n,r))},t):d.jsx(wt,{className:e},t),Ls=({layout:e="overview-page",...t})=>d.jsx("div",{className:Y("loading-state",e),...t,children:us[e].map((n,r)=>Wc(n,r))}),Hc=e=>{const t=e&&e.toUpperCase().trim().split(" ");return Array.isArray(t)&&t.length>1&&t[0]!==""?t[1]===""?t[0][0]:t[0][0]+t[t.length-1][0]:e?e.substr(0,1):""},$r=["#5AB6A3","#A2D7AF","#806056","#3962B3"],um=e=>{const t=Math.ceil(26/$r.length),n=Hc(e).toLowerCase();if(n==="")return $r[0];const r=n.charCodeAt(0)-96;for(let a=0;a<$r.length;a++)if(r<=t*(a+1))return $r[a]};const Ho=256,sn=({className:e="",src:t="",name:n,alt:r,width:a=Ho,height:i=Ho,...s})=>{const[o,l]=C.useState(!1),u=C.useRef(null);C.useEffect(()=>{const m=u.current;if(!m)return;const h=m.getContext("2d");if(!h)return;const p=a,g=i;typeof window<"u"&&window.devicePixelRatio&&(m.width=p*window.devicePixelRatio,m.height=g*window.devicePixelRatio,h.scale(window.devicePixelRatio,window.devicePixelRatio)),h.fillStyle=um(n),h.fillRect(0,0,p,g),h.font=`${p/3}px Arial`,h.textAlign="center",h.fillStyle="white",h.fillText(Hc(n),p/2,g/1.6)},[n]);let c=!1;return t&&t!==""&&!o&&(t.includes("http")||t.includes("//"))&&(c=!0),d.jsx("figure",{className:Y("profile-picture",e,{error:o}),...s,children:c?d.jsx("img",{src:t,alt:r||n,onError:()=>{l(!0)},width:a,height:i}):d.jsx("canvas",{ref:u})})},zs=e=>e==="apolitical"?{image:`${Ht}logos/member_apolitical.svg`}:e==="community"||typeof e=="object"&&!e.name?{image:`${Ht}logos/member_community.svg`}:{name:e.name,role:e.jobTitle||"",organisation:e.organization||"",country:e.location&&e.location.country||"",url:`/profiles/${e.id}`,image:e.image&&e.image.thumbnail},lm=({role:e="",organisation:t="",country:n="",maximumCharacters:r=80})=>{const a=e!=="",i=t!=="",s=n!=="";if(!a&&!i&&!s)return"";const o=`${e}${a&&i?` — ${t}`:t}`;let l=`${o}${(a||i)&&s?`, ${n}`:n}`;return l.length>r&&(l=o),l.length>r&&(l=Hn(l,r)),l};const tr=({element:e="div",member:t="community",additionalContent:n=!1,styling:r={},functions:a={},gtmContext:i="member",gtmType:s="member-click",className:o=""})=>{const l=ue.useIntl(),{size:u="medium"}=r,c=zs(t);c.name||(c.name=l.formatMessage({id:`member_${typeof t=="string"?t:"community"}`}));const{name:m,image:h}=c;let{url:p}=c;t.link!==void 0&&(t.link===!1?p=void 0:p=t.link);const g=lm(c),f=n&&n.createdAt?as(n.createdAt):!1,y=n&&n.createdAt?Ms(n.createdAt):"";return C.createElement(e,{className:Y("member text-medium",u,o),...a,children:d.jsxs(_n,{href:p,gtmType:s,gtmContext:i,onClick:b=>{b==null||b.stopPropagation()},children:[d.jsx(sn,{name:m,src:h}),d.jsxs("p",{className:"details",children:[d.jsxs("strong",{children:[m,n&&d.jsxs("span",{className:"additional-content",children:[n.createdAt&&f&&d.jsx("span",{className:"date",title:y,"aria-label":y,children:l.formatMessage({id:`dates_${f.path}`},{number:f.number})}),n.didEdit&&d.jsx("em",{children:l.formatMessage({id:"discussion_edited"})})]})]}),g&&d.jsx("small",{className:Y({"text-medium":u==="large"}),children:g})]})]})})};const Uo={small:24,medium:48},qs=({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 m=ue.useIntl();return!n||n.length===0?null:C.createElement(e,{...c,className:Y("contributors",u,a,{"has-gap":i}),children:d.jsxs(d.Fragment,{children:[d.jsx("ul",{children:n.map((h,p)=>{let g,f="";if(p<o){const{name:y="",image:b=""}=zs(h);if(s)return d.jsx(wt,{element:"li",className:"contributor"},p);g=d.jsx(sn,{name:y,src:b,width:Uo[a||"medium"],height:Uo[a||"medium"]})}else if(p===o){const y=(t||n.length)-o;g=d.jsxs("small",{className:Y({"large-number":y>99}),children:["+",$h(y,0)]}),f="number-left"}return g?d.jsx("li",{className:Y("contributor",f),children:g},p):null})}),r&&d.jsx("span",{className:"label",children:typeof r=="string"?r:n.length===1?typeof n[0]=="string"?m.formatMessage({id:`member_${n[0]}`}):Hn(n[0].name||"",20):l||null})]})})};const Ws=({limit:e,valueLength:t})=>{const n=ue.useIntl(),r="form_fieldWrapper_characterLimit";if(e===0)return null;const a=e-t,i=Math.abs(t-e);return d.jsxs("small",{className:Y("character-limit",{"near-limit":t>=.99*e,"approaching-limit":t>=.9*e&&t<.99*e}),"aria-live":"polite","aria-label":n.formatMessage({id:`${r}_aria_${a<0?"over":"default"}`},{remaining:a,over:i,limit:e}),children:[d.jsx("span",{className:"hidden",children:n.formatMessage({id:r})}),t," / ",e]})},qa=e=>(e==null?void 0:e.toString().length)||0,Uc=(e,t=null)=>{const n={};return e===0||(n["data-character-limit"]=e,t&&(n.functions={onChange:r=>{qa(r)>e&&(r=r==null?void 0:r.toString().slice(0,e)),t(r)}})),n};const Lr="emailHelperTextBox_",Vc=({type:e,email:t,redirectPath:n,resendVerificationCode:r})=>{const a=ue.useIntl(),[i,s]=C.useState({path:`${Lr}default`,type:"default",link:{},mail:{},error:""}),[o,l]=C.useState(!1),u=C.useCallback(p=>{p.preventDefault(),p.stopPropagation();const g=f=>{s({path:`${Lr}error_verificationFailedToSend`,type:"error",link:{"data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:y=>u(y),href:"#","data-testid":"send-verify-email-click"},mail:{href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"ErrorVerifyingBox","data-gtm-event-type":"email-concierge-click"},error:f})};if(typeof r!="function"){g(a.formatMessage({id:`${Lr}error_noFunction`}));return}l(!0),r(t).then(()=>{localStorage.setItem("email",t),window.location.href=n||"/signup/verify-email"}).catch(f=>{g(f.message)}).finally(()=>{l(!1)})},[t,n,r]);C.useEffect(()=>{let p=Lr,g="default",f={},y={};switch(e){case"gov":p+="autoApproved",g="success";break;case"nonGov":p+="unrecognisedEmail",g="error",f={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"NonGovEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break;case"pending":p+="pendingApproval",g="error",y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;case"verify":p+="emailUnverified",g="error",f={href:"#","data-gtm-event-context":"VerifyEmailBox","data-gtm-event-type":"SendEmailClick",className:"gtm-trackable",onClick:b=>u(b),"data-testid":"send-verify-email-click"};break;case"exists":p+="emailAlreadyExists",g="error",f={href:"/user-onboarding/login","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"login-click"},y={href:"mailto:concierge@apolitical.co",className:"gtm-trackable","data-gtm-event-context":"EmailExistsBox","data-gtm-event-type":"email-concierge-click"};break;default:p+="default",f={href:"https://about.apolitical.co/who-can-join-the-community","data-gtm-event-context":"DefaultEmailHelperTextBox","data-gtm-event-type":"LearnMoreClick"};break}s({...i,path:p,type:g,link:f,mail:y})},[e]);const c={};return["link","mail"].forEach(p=>{c[p]=Object.keys(i[p]).length?g=>d.jsx("a",{...i[p],children:g}):g=>g}),d.jsx(Lc,{type:i.type,heading:o?!1:a.formatMessage({id:`${i.path}_title`}),children:o?d.jsxs(d.Fragment,{children:[d.jsx(wt,{element:"span"}),d.jsx(wt,{element:"span"})]}):a.formatMessage({id:`${i.path}_text`},{...c,strong:p=>d.jsx("strong",{children:p}),em:p=>d.jsx("em",{children:p}),br:d.jsxs(d.Fragment,{children:[d.jsx("br",{}),d.jsx("br",{})]}),error:i.error})})},Rn=({className:e="",element:t="input",id:n,inputRef:r,functions:a={onChange:()=>{}},name:i=n,placeholder:s,type:o="text",value:l,...u})=>{const c=C.useRef(),m=r||c;return C.createElement(t,{ref:m,...u,type:o,id:n,name:i,className:Y(e,t,{"has-scrollbar":o==="textarea"&&m.current&&m.current.clientHeight<m.current.scrollHeight}),value:l,placeholder:s,...a,onChange:h=>{const p=h.target;a.onChange(p.value)}})};const Tn={UP:"ArrowUp",DOWN:"ArrowDown",ENTER:"Enter"},cm=500,dm=({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},m]=C.useState({input:n,displayInput:n,debouncedInput:n}),[{predictions:h,activePredictionIndex:p,isPredictionSelected:g},f]=C.useState({predictions:[],activePredictionIndex:-1,isPredictionSelected:!!n}),{formatMessage:y}=ue.useIntl();r||(r=y({id:"inputAutocomplete_placeholder"})),C.useEffect(()=>{const k=setTimeout(()=>{g||m(E=>({...E,debouncedInput:l}))},cm);return()=>{clearTimeout(k)}},[l,g]),C.useEffect(()=>{c&&!g?(async()=>{try{const E=await o(c)||[];f(T=>({...T,predictions:E}))}catch(E){console.error("Error fetching predictions:",E),f(T=>({...T,predictions:[]}))}})():f(k=>({...k,predictions:[]}))},[c,g]),C.useEffect(()=>{p>=0&&h[p]&&m(k=>({...k,displayInput:h[p].description}))},[p,h]);const b=k=>{[Tn.DOWN,Tn.UP,Tn.ENTER].includes(k.key)&&(k.preventDefault(),k.key===Tn.DOWN&&p<h.length-1?f(E=>({...E,activePredictionIndex:p+1})):k.key===Tn.UP&&p>0?f(E=>({...E,activePredictionIndex:p-1})):k.key===Tn.ENTER&&p>-1&&(s(h[p].description),m(E=>({...E,input:h[p].description})),f(E=>({...E,predictions:[],isPredictionSelected:!0}))))},w=k=>{s(k.target.value),m(E=>({...E,input:k.target.value,displayInput:k.target.value})),f(E=>({...E,activePredictionIndex:-1,isPredictionSelected:!1}))},A=k=>{s(k.description),m(E=>({...E,input:k.description,displayInput:k.description})),f(E=>({...E,isPredictionSelected:!0,predictions:[]}))};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"text",value:u,onChange:w,onKeyDown:b,placeholder:r,name:t,id:e,...i}),d.jsx("ul",{className:"predictions-list",children:h.map((k,E)=>d.jsx("li",{onClick:()=>A(k),onMouseEnter:()=>f(T=>({...T,activePredictionIndex:E})),className:Y("predictions-list-item",{active:E===p}),children:k.description},E))})]})};const Kc=({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,...m})=>{const h=ue.useIntl(),{onChange:p,...g}=r,f=()=>{t||p(c?null:l)},y=d.jsxs(d.Fragment,{children:[d.jsx("input",{ref:i,id:a,name:a,type:u,value:l,checked:c,onKeyDown:b=>{(b.key==="Enter"||b.code==="Space")&&(b.preventDefault(),b.stopPropagation(),f())},readOnly:!0,disabled:t}),d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("label",{htmlFor:a,children:o||h.formatMessage({id:s?`${s}_${a}`:a})})]});return C.createElement(n,{onClick:b=>{const w=b.target;w.nodeName.toLowerCase()==="a"||w.parentNode&&w.parentNode.nodeName.toLowerCase()==="a"||(b.preventDefault(),b.stopPropagation(),f())},className:Y("checkbox-wrapper",e),...m,...g},y)};const fm=C.memo(function({direction:t="down"}){return d.jsx($a,{className:Y("rotating-chevron",`direction-${t}`)})});const hm=({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(),[m,h]=C.useState(!1),p=r||n,g=Array.isArray(p)?[...p]:p?[p]:[],[f,y]=C.useState(g);let b;Array.isArray(f)&&f.length===1&&typeof f[0]=="string"?b=t&&f?t.find(j=>j.id===f[0]):t?t[0]:{id:"",label:""}:Array.isArray(f)&&f.length===1&&typeof f[0]!="string"?b=f[0]:b={id:"",label:""},C.useEffect(()=>{y(g)},[r,n]);const{onChange:w,onMultiSelectSubmit:A,...k}=a,E=j=>{if(o){let z=[];f!=null&&f.includes(j.id)?z=f.filter(R=>R!==j.id):z=[...f,j.id],y([...z]),w&&w([...z])}else y([j]),w&&w(j.id),h(!1)},T=j=>{if(j==="all"){const z=(t==null?void 0:t.map(R=>R.id))||[];y(z),w&&w(z)}else y([]),w&&w([])};return d.jsxs("div",{className:Y("dropdown-wrapper",e),children:[d.jsxs("button",{className:"input","aria-expanded":m,"aria-haspopup":"listbox","aria-controls":"dropdown-list",onClick:j=>{j.preventDefault(),j.stopPropagation(),h(!m)},"data-testid":"dropdown-selector",...k,children:[o?`${s} · ${f.length}`:b.label,d.jsx(fm,{direction:m?"up":"down"})]}),d.jsx("select",{defaultValue:b.id,onChange:j=>{j.preventDefault(),j.stopPropagation();const z=t&&t.find(R=>R.id===j.target.value);E(z)},hidden:!m,...k,children:t==null?void 0:t.map(j=>d.jsx("option",{value:j.id,children:j.label},j.id))}),d.jsxs("div",{className:"menu-options input dropdown-menu",role:"menu",hidden:!m,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(ke,{variant:"tertiary",size:"small",onClick:()=>T("all"),className:"gtm-trackable",children:c.formatMessage({id:"dropdown_menu_multiselect_all"})})}),d.jsx("li",{children:d.jsx(ke,{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(j=>{const z=j.id===b.id||(f==null?void 0:f.includes(j))||(f==null?void 0:f.includes(j.id));return d.jsx("li",{"data-testid":"dropdown-options",children:d.jsxs("button",{className:Y("gtm-trackable",{selected:z,"selected-single":z&&!o}),"data-gtm-event-type":`${j}-click`,"data-gtm-event-context":i,onClick:R=>{R.preventDefault(),R.stopPropagation(),E(j)},role:"menuitem","aria-current":z,"data-testid":z?"current-selection":"",children:[o&&d.jsx("span",{className:"pretty-checkbox","data-testid":"pretty-checkbox"}),d.jsx("span",{className:Y({"menu-option-label":o}),children:j.label})]})},j.id)})})]}),(l==null?void 0:l.submitSection)&&d.jsx("p",{className:"submit",children:d.jsx(ke,{variant:"secondary",onClick:()=>{A&&A(f),document.dispatchEvent(new CustomEvent("dropdownMultiSelectSubmit",{detail:{id:u||"dropdown-multi-select",value:f}})),h(!1)},children:c.formatMessage({id:"form_submit"})})})]})]})};const mm=({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,...m})=>{const h=ue.useIntl(),p=i?c:[],g=c;return d.jsx("ul",{...m,className:Y("options-wrapper",e),"data-testid":`ul-${r}`,children:o==null?void 0:o.map(({id:f,label:y=!1,value:b=f,disabled:w=!1})=>{const A=`${r}_${f}`,k=()=>{if(w)return;let E;if(i){const T=p==null?void 0:p.indexOf(b);Array.isArray(p)&&T>=0?(E=p,E.splice(T,1)):(!p||p.length===0?E=[]:E=p,E.push(b))}else E=g===b?void 0:b;t.onChange(E)};return d.jsx(Kc,{element:"li",id:A,type:u==="checkboxes"?"checkbox":"radio",shownValue:b,value:i?p==null?void 0:p.includes(b):g===b,functions:{...t,onChange:k},intlPath:n,label:y||h.formatMessage({id:n?`${n}_${f}`:f}),disabled:w},A)})})};const pm=({inputRef:e,type:t="password",gtm:{context:n}={context:void 0},...r})=>{const a=ue.useIntl(),i=C.useRef(),s=e||i,[o,l]=C.useState(!1),[u,c]=C.useState(t),m=()=>{var h;l(!o),c(o?"password":"text"),(h=s.current)==null||h.focus()};return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:Y("show-password gtm-trackable",{"password-visible":o}),"data-gtm-event-context":n,"data-gtm-event-type":`${o?"hide":"show"}-password-click`,onClick:m,"aria-label":a.formatMessage({id:`showpassword_aria_${o?"hide":"show"}`}),children:a.formatMessage({id:`showpassword_${o?"hide":"show"}`})}),d.jsx(Rn,{inputRef:s,type:u,...r})]})};const Sn={text:{component:Rn},email:{component:Rn},url:{component:Rn},textarea:{component:Rn,props:{element:"textarea",rows:4,cols:10}},checkbox:{component:Kc},checkboxes:{component:mm,props:{multiSelect:!0}},select:{component:hm},password:{component:pm},autocomplete:{component:dm}},gm=({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,...m})=>{const h=ue.useIntl(),p=l&&l.some(({condition:E})=>E==="required"),g=qa(u),f=o&&Sn[o]&&Sn[o].component?Sn[o].component:Rn,y={};o&&["checkboxes"].includes(o)?y.element="span":y.htmlFor=e;let b={...m,id:e,name:e,className:r?"error":"",type:o,required:p,"aria-required":p,functions:pn(a),value:u};if(i>0){const E=Uc(i,a.onChange);b={...b,...E},E.functions&&typeof E.functions=="object"&&(b.functions={...b.functions,...E.functions})}o&&Sn[o]&&Sn[o].props&&(b={...b,...Sn[o].props}),o&&["checkboxes"].includes(o)&&(b.intlPath=`${t}_${e}`),r&&(b["aria-invalid"]=!0,b["aria-describedby"]=`error-${e}`);const w=m.label||h.formatMessage({id:t?`${t}_${e}`:e}),A=({...E})=>r?C.createElement(E.as||"dd",{id:`error-${e}`,className:"error text-small",role:"alert","aria-live":"assertive",...E},r):null;if(o&&["checkbox"].includes(o))return d.jsxs(d.Fragment,{children:[d.jsx(f,{...b,label:w,className:Y("field-wrapper",n)}),d.jsx(A,{as:"p"})]});const k=E=>C.createElement(E.element||"label",{...E,className:"checkboxes-label text-small","data-testid":`label-${e}`});return d.jsxs("dl",{className:Y("field-wrapper text-medium",n),children:[d.jsx("dt",{children:d.jsxs(k,{...y,children:[w,p&&s&&d.jsxs(d.Fragment,{children:[" ",d.jsxs("small",{children:["(",h.formatMessage({id:"form_fieldWrapper_required"}),")"]})]})]})}),d.jsxs("dd",{children:[d.jsx(f,{...b}),d.jsx(Ws,{limit:i,valueLength:g})]}),d.jsx(A,{})]})},vm=(e,t)=>{const{type:n,payload:r}=t,a=e.errors?pn(e.errors):{},i=e.values?pn(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,m=pn(Object.keys(a));for(const h of s)if(h.validation)for(let p=0;p<h.validation.length;p++){const{condition:g="required",error:f=!1}=h.validation[p];let y=!1;if(typeof g=="function"){const b=g(i);b&&(y=f||b)}else{const b=i[h.id];switch(g){case"required":(!b||typeof b=="string"&&b.trim().length===0)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_required"})));break;case"no-numbers":{b&&!/^([^0-9]*)$/.test(b)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_numbers"})));break}case"valid-email":{b&&!/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(b)&&(y=f||(c==null?void 0:c.formatMessage({id:"form_error_email"})));break}case"valid-url":{b&&!/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/.test(b)&&(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:h.id,value:y}}),m.push(h.id);break}}return m.length===0?l(i):u(i,m),{...e,isSubmitting:!1}}case"formSubmitted":return{...e,isSubmitting:!1,formSubmitted:!0,errors:{}};case"formSubmittedAndReset":return{isSubmitting:!1,formSubmitted:!0,errors:{}};default:return e}};let oi=null;const nr=({element:e="form",fields:t,className:n="",id:r=t.length?`form__${t[0].id}`:"form",formRef:a,intlPath:i=!1,button:s={variant:"primary",size:"large",customOnSubmit:!1},secondaryActionButton:o={variant:"secondary",size:"large"},meta:l,gtm:u={context:"Form",event:"form-submit-click"},functions:{onSuccess:c=async()=>{},onCancel:m=()=>{},onCatch:h=()=>{},onFailure:p=()=>{}}={onSuccess:async()=>{},onCancel:()=>{},onCatch:()=>{},onFailure:()=>{}},...g})=>{const{customOnSubmit:f,hideButton:y,...b}=s,w=40,{shouldShowCancelButton:A=!1,shouldReset:k=!0,showRequiredLabels:E=!0,showSuccessMessage:T=!1}=l||{},j=ue.useIntl(),z={};t.length&&t.forEach(D=>{const H=D.id||D.name;H&&(z[H]=D.value||"")});const[R,$]=C.useReducer(vm,{isSubmitting:!1,formSubmitted:!1,errors:{},values:z}),{errors:M,isSubmitting:x,formSubmitted:B,values:F}=R;C.useEffect(()=>{k&&B&&(oi=setTimeout(()=>{$({type:"updateValue",payload:{key:"formSubmitted",value:!1}})},3e3))},[B]),C.useEffect(()=>()=>{oi&&clearTimeout(oi)},[]),C.useEffect(()=>{const D=H=>{$({type:"updateValue",payload:{key:H.detail.id,value:H.detail.value}})};return document.addEventListener("dropdownMultiSelectSubmit",D),()=>{document.removeEventListener("dropdownMultiSelectSubmit",D)}},[]);const N=C.useRef(null),L=a||N;if(!t.length)return null;s.text||(s.text=j.formatMessage({id:"form_submit"}));const q=()=>{if(!x){if($({type:"toggleSubmitting"}),s.disabled){typeof s.disabled=="object"&&s.disabled.isClickable&&$({type:"submitForm",payload:{fields:t,dispatch:$,intl:j}});return}$({type:"submitForm",payload:{fields:t,dispatch:$,onSuccess:async D=>{try{await c(D),$({type:k?"formSubmittedAndReset":"formSubmitted"})}catch(H){h(H),$({type:"updateValue",payload:{key:"isSubmitting",value:!1}})}},onFailure:(D,H)=>{p(D,H),$({type:"updateValue",payload:{key:"isSubmitting",value:!1}})},intl:j}})}},ne=[{...b,icon:B?{icon:"tick",position:"left"}:!1,className:"gtm-trackable",onClick:D=>{var _;if(D.preventDefault(),D.stopPropagation(),x)return;let H=0;if((_=L==null?void 0:L.current)!=null&&_.id){const S=document.getElementById(L.current.id);S&&(H=S.getBoundingClientRect().top+window.scrollY)}const X=document.getElementById("header");X&&(H=H-X.offsetHeight-w),H<0&&(H=0),window.scrollTo({top:H,behavior:"smooth"}),q()},disabled:x||B||s.disabled,"data-gtm-event-context":u.context,"data-gtm-event-type":u.event,children:x||B?j.formatMessage({id:`form_${x?"submitting":"submitted"}`}):s.text}];return A&&ne.unshift({...o,className:"gtm-trackable","data-gtm-event-context":u.context,"data-gtm-event-type":u.event,disabled:x||B,onClick:m,children:o.text||j.formatMessage({id:"form_cancel"})}),d.jsxs(d.Fragment,{children:[C.createElement(e,{...g,id:r,className:Y("form",n),ref:L},d.jsxs(d.Fragment,{children:[M!=null&&M.general?d.jsx(an,{variant:"error",text:j.formatMessage({id:"form_error_generalError"})}):null,(!k||!x&&!B||f)&&t.map((D,H)=>{const{id:X=D.name||H,component:_,functions:S={onChange:()=>{}},submitOnEnter:W=!1}=D;if(_)return d.jsx(_,{...D.props||{}},`component-${X}-${H}`);const I=F?F[X]:"",V={...S,onChange:te=>{$({type:"updateValue",payload:{key:X,value:te}}),S.onChange(te&&te.toString(),$)}};return W&&(V.onKeyDown=te=>{te.key==="Enter"&&(te.stopPropagation(),te.preventDefault(),q()),S.onKeyDown&&S.onKeyDown(te)}),d.jsx(gm,{intlPath:i,...D,showRequiredLabels:E,value:I,error:M==null?void 0:M[X],functions:V},X)}),y?null:(x||B)&&f?f:d.jsx(kn,{className:Y("cta",{center:x||B,submitted:B}),buttons:ne})]})),T&&B&&d.jsx(wr,{className:"success",children:typeof T=="string"?T:j.formatMessage({id:"form_success"})})]})};const zr="passwordRules_",Zc="isMoreThanEightCharacters",Yc="includesNumberAndSymbol",Gc="includesLowerAndUppercase",bm={[Zc]:"8Characters",[Yc]:"numberSymbol",[Gc]:"lowercaseUppercase"},ym=({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:`${zr}intro`})}),d.jsx("ul",{children:[Zc,Yc,Gc].map(r=>d.jsxs("li",{className:Y({matches:e[r]}),children:[d.jsxs(Ie,{children:[n.formatMessage({id:`${zr}rule_label`})," "]}),d.jsx("span",{children:n.formatMessage({id:`${zr}rule_${bm[r]}`})}),!e[r]&&d.jsxs(Ie,{element:"strong",children:[" ",n.formatMessage({id:`${zr}notMet`})]})]},`rule-${r}`))})]})},Qc=C.memo(ym);const Dm=({text:e={},topRating:t=5,functions:{createRating:n=()=>null,updateRating:r=()=>{},reportError:a=()=>{}},className:i="",hasLoaded:s=!1})=>{const o=ue.useIntl(),[l,u]=C.useState({setUp:!1,id:null,rating:null,disabled:!0}),c=async()=>{try{const b=await n();u(w=>({...w,setUp:!0,id:b&&b.id,disabled:!1}))}catch(b){u(w=>({...w,setUp:!0,disabled:!0})),a(b)}};if(C.useEffect(()=>{s&&!l.setUp&&c()},[s]),!s)return d.jsx(wt,{className:"rating-placeholder"});const{id:m,rating:h,disabled:p}=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 b=>{if(!(!m||p))try{u(w=>({...w,rating:b,disabled:!0})),await r({id:m,value:b})}catch(w){u(A=>({...A,rating:null})),a(w)}finally{u(w=>({...w,disabled:!1}))}};return d.jsxs("div",{className:Y("rating",i),children:[d.jsx("span",{className:"label",children:f[h?"success":"text"]}),d.jsx("ol",{children:Array.from(new Array(t).keys()).map(b=>{const w=b+1;return d.jsx("li",{className:Y({selected:h&&w<=h}),children:d.jsx(ke,{variant:"tertiary",size:"small",icon:{icon:`star${!h||w>h?"_empty":""}`,position:"left",hover:"star"},screenreaderText:`${o.formatMessage({id:`${g}stars`},{number:w,total:t})}${w===1||w===t?` - ${f[w===1?"low":"high"]}`:""}`,onClick:A=>{A.preventDefault(),A.stopPropagation(),y(w)},disabled:p})},`rating-${w}`)})})]})};function Cm(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 ls(e,t){return Array(t+1).join(e)}function xm(e){return e.replace(/^\n*/,"")}function wm(e){for(var t=e.length;t>0&&e[t-1]===`
|
|
38
|
+
`;)t--;return e.substring(0,t)}var Em=["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 Hs(e){return Us(e,Em)}var Jc=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Xc(e){return Us(e,Jc)}function km(e){return td(e,Jc)}var ed=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function _m(e){return Us(e,ed)}function Bm(e){return td(e,ed)}function Us(e,t){return t.indexOf(e.nodeName)>=0}function td(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var nt={};nt.paragraph={filter:"p",replacement:function(e){return`
|
|
39
39
|
|
|
40
40
|
`+e+`
|
|
41
41
|
|
|
42
42
|
`}};nt.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+`
|
|
43
|
-
`}};nt.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var a=
|
|
43
|
+
`}};nt.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=ls(r===1?"=":"-",e.length);return`
|
|
44
44
|
|
|
45
45
|
`+e+`
|
|
46
46
|
`+a+`
|
|
47
47
|
|
|
48
48
|
`}else return`
|
|
49
49
|
|
|
50
|
-
`+
|
|
50
|
+
`+ls("#",r)+" "+e+`
|
|
51
51
|
|
|
52
52
|
`}};nt.blockquote={filter:"blockquote",replacement:function(e){return e=e.replace(/^\n+|\n+$/g,""),e=e.replace(/^/gm,"> "),`
|
|
53
53
|
|
|
@@ -66,7 +66,7 @@ Thank you for helping to protect the Apolitical community from abusive content.`
|
|
|
66
66
|
`+t.firstChild.textContent.replace(/\n/g,`
|
|
67
67
|
`)+`
|
|
68
68
|
|
|
69
|
-
`}};nt.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",a=(r.match(/language-(\S+)/)||[null,""])[1],i=t.firstChild.textContent,s=n.fence.charAt(0),o=3,l=new RegExp("^"+s+"{3,}","gm"),u;u=l.exec(i);)u[0].length>=o&&(o=u[0].length+1);var c=
|
|
69
|
+
`}};nt.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=ls(s,o);return`
|
|
70
70
|
|
|
71
71
|
`+c+a+`
|
|
72
72
|
`+i.replace(/\n$/,"")+`
|
|
@@ -82,7 +82,7 @@ Thank you for helping to protect the Apolitical community from abusive content.`
|
|
|
82
82
|
`)+`
|
|
83
83
|
|
|
84
84
|
`,this.references=[]),t}};nt.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};nt.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};nt.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}};nt.image={filter:"img",replacement:function(e,t){var n=ba(t.getAttribute("alt")),r=t.getAttribute("src")||"",a=ba(t.getAttribute("title")),i=a?' "'+a+'"':"";return r?"":""}};function ba(e){return e?e.replace(/(\n+\s*)+/g,`
|
|
85
|
-
`):""}function
|
|
85
|
+
`):""}function nd(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])}nd.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=ui(this.array,e,this.options))||(t=ui(this._keep,e,this.options))||(t=ui(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 ui(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(Am(a,t,n))return a}}function Am(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 Fm(e){var t=e.element,n=e.isBlock,r=e.isVoid,a=e.isPre||function(m){return m.nodeName==="PRE"};if(!(!t.firstChild||a(t))){for(var i=null,s=!1,o=null,l=Vo(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=li(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=li(l);continue}var c=Vo(o,l,a);o=l,l=c}i&&(i.data=i.data.replace(/ $/,""),i.data||li(i))}}function li(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function Vo(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var Vs=typeof window<"u"?window:{};function Tm(){var e=Vs.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function Sm(){var e=function(){};return jm()?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 jm(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{Vs.ActiveXObject&&(e=!0)}return e}var Om=Tm()?Vs.DOMParser:Sm();function Pm(e,t){var n;if(typeof e=="string"){var r=Nm().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return Fm({element:n,isBlock:Hs,isVoid:Xc,isPre:t.preformattedCode?Rm:null}),n}var ci;function Nm(){return ci=ci||new Om,ci}function Rm(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function Mm(e,t){return e.isBlock=Hs(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=Im(e),e.flankingWhitespace=$m(e,t),e}function Im(e){return!Xc(e)&&!_m(e)&&/^\s*$/i.test(e.textContent)&&!km(e)&&!Bm(e)}function $m(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=Lm(e.textContent);return n.leadingAscii&&Ko("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Ko("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function Lm(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 Ko(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&&!Hs(r)&&(i=a.test(r.textContent))),i}var zm=Array.prototype.reduce,qm=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function ya(e){if(!(this instanceof ya))return new ya(e);var t={rules:nt,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
|
|
86
86
|
|
|
87
87
|
`:""},keepReplacement:function(n,r){return r.isBlock?`
|
|
88
88
|
|
|
@@ -92,68 +92,68 @@ Thank you for helping to protect the Apolitical community from abusive content.`
|
|
|
92
92
|
|
|
93
93
|
`+n+`
|
|
94
94
|
|
|
95
|
-
`:n}};this.options=
|
|
95
|
+
`:n}};this.options=Cm({},t,e),this.rules=new nd(this.options)}ya.prototype={turndown:function(e){if(!Um(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=rd.call(this,new Pm(e,this.options));return Wm.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 qm.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function rd(e){var t=this;return zm.call(e.childNodes,function(n,r){r=new Mm(r,t.options);var a="";return r.nodeType===3?a=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(a=Hm.call(t,r)),ad(n,a)},"")}function Wm(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=ad(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function Hm(e){var t=this.rules.forNode(e),n=rd.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 ad(e,t){var n=wm(e),r=xm(t),a=Math.max(e.length-n.length,t.length-r.length),i=`
|
|
96
96
|
|
|
97
|
-
`.substring(0,a);return n+i+r}function
|
|
97
|
+
`.substring(0,a);return n+i+r}function Um(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}/*!
|
|
98
98
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
99
99
|
*
|
|
100
100
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
101
101
|
* Released under the MIT License.
|
|
102
|
-
*/function Wo(e){return Object.prototype.toString.call(e)==="[object Object]"}function et(e){var t,n;return Wo(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Wo(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var Qc=Symbol.for("immer-nothing"),Ho=Symbol.for("immer-draftable"),gt=Symbol.for("immer-state"),Pm=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=Pm[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 Vn=Object.getPrototypeOf;function bn(e){return!!e&&!!e[gt]}function yn(e){var t;return e?Jc(e)||Array.isArray(e)||!!e[Ho]||!!((t=e.constructor)!=null&&t[Ho])||Ha(e)||Ua(e):!1}var Nm=Object.prototype.constructor.toString();function Jc(e){if(!e||typeof e!="object")return!1;const t=Vn(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)===Nm}function Da(e,t){Wa(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Wa(e){const t=e[gt];return t?t.type_:Array.isArray(e)?1:Ha(e)?2:Ua(e)?3:0}function os(e,t){return Wa(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Xc(e,t,n){const r=Wa(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Rm(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ha(e){return e instanceof Map}function Ua(e){return e instanceof Set}function ln(e){return e.copy_||e.base_}function us(e,t){if(Ha(e))return new Map(e);if(Ua(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Jc(e))return Vn(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[gt];let r=Reflect.ownKeys(n);for(let a=0;a<r.length;a++){const i=r[a],s=n[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Vn(e),n)}function qs(e,t=!1){return Va(e)||bn(e)||!yn(e)||(Wa(e)>1&&(e.set=e.add=e.clear=e.delete=Mm),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>qs(r,!0))),e}function Mm(){dt(2)}function Va(e){return Object.isFrozen(e)}var Im={};function Dn(e){const t=Im[e];return t||dt(0,e),t}var wr;function ed(){return wr}function $m(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Uo(e,t){t&&(Dn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ls(e){cs(e),e.drafts_.forEach(Lm),e.drafts_=null}function cs(e){e===wr&&(wr=e.parent_)}function Vo(e){return wr=$m(wr,e)}function Lm(e){const t=e[gt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ko(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[gt].modified_&&(ls(t),dt(4)),yn(e)&&(e=Ca(t,e),t.parent_||xa(t,e)),t.patches_&&Dn("Patches").generateReplacementPatches_(n[gt].base_,e,t.patches_,t.inversePatches_)):e=Ca(t,n,[]),ls(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Qc?e:void 0}function Ca(e,t,n){if(Va(t))return t;const r=t[gt];if(!r)return Da(t,(a,i)=>Zo(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return xa(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const a=r.copy_;let i=a,s=!1;r.type_===3&&(i=new Set(a),a.clear(),s=!0),Da(i,(o,l)=>Zo(e,r,a,o,l,n,s)),xa(e,a,!1),n&&e.patches_&&Dn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Zo(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&dt(5),bn(a)){const o=i&&t&&t.type_!==3&&!os(t.assigned_,r)?i.concat(r):void 0,l=Ca(e,a,o);if(Xc(n,r,l),bn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(yn(a)&&!Va(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ca(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&xa(e,a)}}function xa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&qs(t,n)}function zm(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ed(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=Ws;n&&(a=[r],i=Er);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var Ws={get(e,t){if(t===gt)return e;const n=ln(e);if(!os(n,t))return qm(e,n,t);const r=n[t];return e.finalized_||!yn(r)?r:r===di(e.base_,t)?(fi(e),e.copy_[t]=fs(r,e)):r},has(e,t){return t in ln(e)},ownKeys(e){return Reflect.ownKeys(ln(e))},set(e,t,n){const r=td(ln(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=di(ln(e),t),i=a==null?void 0:a[gt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Rm(n,a)&&(n!==void 0||os(e.base_,t)))return!0;fi(e),ds(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return di(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,fi(e),ds(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=ln(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){dt(11)},getPrototypeOf(e){return Vn(e.base_)},setPrototypeOf(){dt(12)}},Er={};Da(Ws,(e,t)=>{Er[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Er.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&dt(13),Er.set.call(this,e,t,void 0)};Er.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&dt(14),Ws.set.call(this,e[0],t,n,e[0])};function di(e,t){const n=e[gt];return(n?ln(n):e)[t]}function qm(e,t,n){var a;const r=td(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function td(e,t){if(!(t in e))return;let n=Vn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Vn(n)}}function ds(e){e.modified_||(e.modified_=!0,e.parent_&&ds(e.parent_))}function fi(e){e.copy_||(e.copy_=us(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Wm=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...u){return s.produce(l,c=>n.call(this,c,...u))}}typeof n!="function"&&dt(6),r!==void 0&&typeof r!="function"&&dt(7);let a;if(yn(t)){const i=Vo(this),s=fs(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?ls(i):cs(i)}return Uo(i,r),Ko(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===Qc&&(a=void 0),this.autoFreeze_&&qs(a,!0),r){const i=[],s=[];Dn("Patches").generateReplacementPatches_(t,a,i,s),r(i,s)}return a}else dt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...o)=>this.produceWithPatches(s,l=>t(l,...o));let r,a;return[this.produce(t,n,(s,o)=>{r=s,a=o}),r,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){yn(e)||dt(8),bn(e)&&(e=Hm(e));const t=Vo(this),n=fs(e,void 0);return n[gt].isManual_=!0,cs(t),n}finishDraft(e,t){const n=e&&e[gt];(!n||!n.isManual_)&&dt(9);const{scope_:r}=n;return Uo(r,t),Ko(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const a=t[n];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}n>-1&&(t=t.slice(n+1));const r=Dn("Patches").applyPatches_;return bn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function fs(e,t){const n=Ha(e)?Dn("MapSet").proxyMap_(e,t):Ua(e)?Dn("MapSet").proxySet_(e,t):zm(e,t);return(t?t.scope_:ed()).drafts_.push(n),n}function Hm(e){return bn(e)||dt(10,e),nd(e)}function nd(e){if(!yn(e)||Va(e))return e;const t=e[gt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=us(e,t.scope_.immer_.useStrictShallowCopy_)}else n=us(e,!0);return Da(n,(r,a)=>{Xc(n,r,nd(a))}),t&&(t.finalized_=!1),n}var vt=new Wm,Hs=vt.produce;vt.produceWithPatches.bind(vt);vt.setAutoFreeze.bind(vt);vt.setUseStrictShallowCopy.bind(vt);vt.applyPatches.bind(vt);var Yo=vt.createDraft.bind(vt),Go=vt.finishDraft.bind(vt),Um={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()}}},Vm={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=we.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},Km={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=H.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},wa=new WeakMap,Ea=new WeakMap,mr=new WeakMap,rd=new WeakMap,Qo=new WeakMap,Jo=new WeakMap,Xo=new WeakMap,P={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=P.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var a=e[r],i=t[r];if(a!==i)break;n.push(a)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return P.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return P.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&P.compare(e,t)===0},isBefore(e,t){return P.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&P.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&P.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&P.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&P.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),a=e[e.length-1],i=t[t.length-1];return a!==i&&P.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!P.isAncestor(t,e)&&!P.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(P.equals(i,r)||P.endsBefore(i,r)||P.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(P.equals(s,r)||P.isAncestor(s,r))return null;P.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;P.equals(o,r)||P.endsBefore(o,r)?r[o.length-1]-=1:P.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:c}=t;if(P.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else P.endsBefore(u,r)?r[u.length-1]+=1:P.isAncestor(u,r)&&e[u.length]>=c&&(r[u.length-1]+=1,r[u.length]-=c);break}case"move_node":{var{path:f,newPath:m}=t;if(P.equals(f,m))return r;if(P.isAncestor(f,r)||P.equals(f,r)){var p=m.slice();return P.endsBefore(f,m)&&f.length<m.length&&(p[f.length-1]-=1),p.concat(r.slice(f.length))}else P.isSibling(f,m)&&(P.isAncestor(m,r)||P.equals(m,r))?P.endsBefore(f,r)?r[f.length-1]-=1:r[f.length-1]+=1:P.endsBefore(m,r)||P.equals(m,r)||P.isAncestor(m,r)?(P.endsBefore(f,r)&&(r[f.length-1]-=1),r[m.length-1]+=1):P.endsBefore(f,r)&&(P.equals(m,r)&&(r[m.length-1]+=1),r[f.length-1]-=1);break}}return r}};function kr(e){"@babel/helpers - typeof";return kr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kr(e)}function Zm(e,t){if(kr(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(kr(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ym(e){var t=Zm(e,"string");return kr(t)==="symbol"?t:String(t)}function ot(e,t,n){return t=Ym(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}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 sr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?eu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Gm=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=se.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of H.points(t))t[l]=we.transform(o,n);break}case"insert_text":{var{path:u,offset:c,text:f}=n;if(f.length===0)break;var m=se.leaf(e,u),p=m.text.slice(0,c),g=m.text.slice(c);if(m.text=p+f+g,t)for(var[h,y]of H.points(t))t[y]=we.transform(h,n);break}case"merge_node":{var{path:v}=n,w=se.get(e,v),A=P.previous(v),E=se.get(e,A),k=se.parent(e,v),F=v[v.length-1];if(fe.isText(w)&&fe.isText(E))E.text+=w.text;else if(!fe.isText(w)&&!fe.isText(E))E.children.push(...w.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(v,"] to nodes of different interfaces: ").concat(Je.stringify(w)," ").concat(Je.stringify(E)));if(k.children.splice(F,1),t)for(var[S,L]of H.points(t))t[L]=we.transform(S,n);break}case"move_node":{var{path:I,newPath:N}=n;if(P.isAncestor(I,N))throw new Error("Cannot move a path [".concat(I,"] to new path [").concat(N,"] because the destination is inside itself."));var M=se.get(e,I),x=se.parent(e,I),_=I[I.length-1];x.children.splice(_,1);var j=P.transform(I,n),R=se.get(e,P.parent(j)),q=j[j.length-1];if(R.children.splice(q,0,M),t)for(var[V,ue]of H.points(t))t[ue]=we.transform(V,n);break}case"remove_node":{var{path:ne}=n,D=ne[ne.length-1],W=se.parent(e,ne);if(W.children.splice(D,1),t)for(var[X,B]of H.points(t)){var T=we.transform(X,n);if(t!=null&&T!=null)t[B]=T;else{var z=void 0,$=void 0;for(var[K,te]of se.texts(e))if(P.compare(te,ne)===-1)z=[K,te];else{$=[K,te];break}var ee=!1;z&&$&&(P.equals($[1],ne)?ee=!P.hasPrevious($[1]):ee=P.common(z[1],ne).length<P.common($[1],ne).length),z&&!ee?(X.path=z[1],X.offset=z[0].text.length):$?(X.path=$[1],X.offset=0):t=null}}break}case"remove_text":{var{path:ae,offset:de,text:Y}=n;if(Y.length===0)break;var pe=se.leaf(e,ae),ge=pe.text.slice(0,de),_e=pe.text.slice(de+Y.length);if(pe.text=ge+_e,t)for(var[Oe,he]of H.points(t))t[he]=we.transform(Oe,n);break}case"set_node":{var{path:Ne,properties:He,newProperties:Ue}=n;if(Ne.length===0)throw new Error("Cannot set properties on the root node!");var Qe=se.get(e,Ne);for(var Ae in Ue){if(Ae==="children"||Ae==="text")throw new Error('Cannot set the "'.concat(Ae,'" property of nodes!'));var ze=Ue[Ae];ze==null?delete Qe[Ae]:Qe[Ae]=ze}for(var We in He)Ue.hasOwnProperty(We)||delete Qe[We];break}case"set_selection":{var{newProperties:U}=n;if(U==null)t=U;else{if(t==null){if(!H.isRange(U))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Je.stringify(U)," when there is no current selection."));t=sr({},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:be,position:xe,properties:Ye}=n;if(be.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(be,"] because the root node cannot be split."));var Ge=se.get(e,be),mt=se.parent(e,be),Mt=be[be.length-1],Et;if(fe.isText(Ge)){var Xe=Ge.text.slice(0,xe),Bt=Ge.text.slice(xe);Ge.text=Xe,Et=sr(sr({},Ye),{},{text:Bt})}else{var pt=Ge.children.slice(0,xe),ti=Ge.children.slice(xe);Ge.children=pt,Et=sr(sr({},Ye),{},{children:ti})}if(mt.children.splice(Mt+1,0,Et),t)for(var[rr,Mr]of H.points(t))t[Mr]=we.transform(rr,n);break}}return t},Qm={transform(e,t){e.children=Yo(e.children);var n=e.selection&&Yo(e.selection);try{n=Gm(e,n,t)}finally{e.children=Go(e.children),n?e.selection=bn(n)?Go(n):n:e.selection=null}}},Jm={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)}},Xm={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},ad=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(et(r)&&et(a)){if(!ad(r,a))return!1}else if(Array.isArray(r)&&Array.isArray(a)){if(r.length!==a.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==a[i])return!1}else if(r!==a)return!1}for(var s in t)if(e[s]===void 0&&t[s]!==void 0)return!1;return!0};function ep(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Ut(e,t){if(e==null)return{};var n=ep(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 tp=["anchor","focus"];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 np(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){ot(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 H={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return H.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=H.edges(e);return t},equals(e,t){return we.equals(e.anchor,t.anchor)&&we.equals(e.focus,t.focus)},includes(e,t){if(H.isRange(t)){if(H.includes(e,t.anchor)||H.includes(e,t.focus))return!0;var[n,r]=H.edges(e),[a,i]=H.edges(t);return we.isBefore(n,a)&&we.isAfter(r,i)}var[s,o]=H.edges(e),l=!1,u=!1;return we.isPoint(t)?(l=we.compare(t,s)>=0,u=we.compare(t,o)<=0):(l=P.compare(t,s.path)>=0,u=P.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=Ut(e,tp),[r,a]=H.edges(e),[i,s]=H.edges(t),o=we.isBefore(r,i)?i:r,l=we.isBefore(a,s)?a:s;return we.isBefore(l,o)?null:np({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return we.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return we.equals(t,n)},isExpanded(e){return!H.isCollapsed(e)},isForward(e){return!H.isBackward(e)},isRange(e){return et(e)&&we.isPoint(e.anchor)&&we.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=H.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Hs(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=H.isCollapsed(r);H.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?H.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=we.transform(r.anchor,t,{affinity:i}),u=we.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},nu=e=>et(e)&&se.isNodeList(e.children)&&!b.isEditor(e),ce={isAncestor(e){return et(e)&&se.isNodeList(e.children)},isElement:nu,isElementList(e){return Array.isArray(e)&&e.every(t=>ce.isElement(t))},isElementProps(e){return e.children!==void 0},isElementType:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"type";return nu(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"],ap=["text"],ru=new WeakMap,se={ancestor(e,t){var n=se.get(e,t);if(fe.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(Je.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=se.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(fe.isText(e))throw new Error("Cannot get the child of a text node: ".concat(Je.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Je.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=se.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=se.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=P.common(t,n),a=se.get(e,r);return[a,r]},descendant(e,t){var n=se.get(e,t);if(b.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Je.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))ce.isElement(n)&&(yield[n,r])}()},extractProps(e){if(ce.isAncestor(e)){var t=Ut(e,rp);return t}else{var t=Ut(e,ap);return t}},first(e,t){for(var n=t.slice(),r=se.get(e,n);r&&!(fe.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(fe.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(Je.stringify(e)));var n=Hs({children:e.children},r=>{var[a,i]=H.edges(t),s=se.nodes(r,{reverse:!0,pass:m=>{var[,p]=m;return!H.includes(t,p)}});for(var[,o]of s){if(!H.includes(t,o)){var l=se.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(P.equals(o,i.path)){var c=se.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(P.equals(o,a.path)){var f=se.leaf(r,o);f.text=f.text.slice(a.offset)}}b.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(fe.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Je.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(fe.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return fe.isText(e)||ce.isElement(e)||b.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=ru.get(e);if(t!==void 0)return t;var n=e.every(r=>se.isNode(r));return ru.set(e,n),n},last(e,t){for(var n=t.slice(),r=se.get(e,n);r&&!(fe.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=se.get(e,t);if(!fe.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(Je.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=se.get(e,r);yield[a,r]}}()},matches(e,t){return ce.isElement(e)&&ce.isElementProps(t)&&ce.matches(e,t)||fe.isText(e)&&fe.isTextProps(t)&&fe.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?P.isBefore(o,i):P.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!fe.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;P.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=se.get(e,o);continue}if(o.length===0)break;if(!r){var c=P.next(o);if(se.has(e,c)){o=c,l=se.get(e,o);continue}}if(r&&o[o.length-1]!==0){var f=P.previous(o);o=f,l=se.get(e,o);continue}o=P.parent(o),l=se.get(e,o),s.add(l)}}()},parent(e,t){var n=P.parent(t),r=se.get(e,n);if(fe.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string(e){return fe.isText(e)?e.text:e.children.map(se.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of se.nodes(e,t))fe.isText(n)&&(yield[n,r])}()}};function 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 $e(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){ot(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 Jt={isNodeOperation(e){return Jt.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!et(e))return!1;switch(e.type){case"insert_node":return P.isPath(e.path)&&se.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)&&et(e.properties);case"move_node":return P.isPath(e.path)&&P.isPath(e.newPath);case"remove_node":return P.isPath(e.path)&&se.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)&&et(e.properties)&&et(e.newProperties);case"set_selection":return e.properties===null&&H.isRange(e.newProperties)||e.newProperties===null&&H.isRange(e.properties)||et(e.properties)&&et(e.newProperties);case"split_node":return P.isPath(e.path)&&typeof e.position=="number"&&et(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>Jt.isOperation(t))},isSelectionOperation(e){return Jt.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return Jt.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return $e($e({},e),{},{type:"remove_node"});case"insert_text":return $e($e({},e),{},{type:"remove_text"});case"merge_node":return $e($e({},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 $e($e({},e),{},{path:t,newPath:n});var r=P.transform(n,e),a=P.transform(P.next(n),e);return $e($e({},e),{},{path:r,newPath:a})}case"remove_node":return $e($e({},e),{},{type:"insert_node"});case"remove_text":return $e($e({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return $e($e({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?$e($e({},e),{},{properties:l,newProperties:null}):l==null?$e($e({},e),{},{properties:null,newProperties:o}):$e($e({},e),{},{properties:l,newProperties:o})}case"split_node":return $e($e({},e),{},{type:"merge_node",path:P.next(e.path)})}}},iu=new WeakMap,ip=e=>{var t=iu.get(e);if(t!==void 0)return t;if(!et(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||et(e.marks))&&(e.selection===null||H.isRange(e.selection))&&se.isNodeList(e.children)&&Jt.isOperationList(e.operations);return iu.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)}},sp={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(P.isPath)}};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 ou(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){ot(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 we={compare(e,t){var n=P.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return we.compare(e,t)===1},isBefore(e,t){return we.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&P.equals(e.path,t.path)},isPoint(e){return et(e)&&typeof e.offset=="number"&&P.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Hs(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,ou(ou({},n),{},{affinity:"forward"})))}else r.path=P.transform(i,t,n);break}}})}},uu=void 0,Je={setScrubber(e){uu=e},stringify(e){return JSON.stringify(e,uu)}},op=["text"],up=["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 $t(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){ot(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 fe={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Ut(i,op);return s}return ad(r?a(e):e,r?a(t):t)},isText(e){return et(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=[$t({},e)];for(var r of t){var a=Ut(r,up),[i,s]=H.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var f of n){var{length:m}=f.text,p=l;if(l+=m,u<=p&&l<=c){Object.assign(f,a),o.push(f);continue}if(u!==c&&(u===l||c===p)||u>l||c<p||c===p&&p!==0){o.push(f);continue}var g=f,h=void 0,y=void 0;if(c<l){var v=c-p;y=$t($t({},g),{},{text:g.text.slice(v)}),g=$t($t({},g),{},{text:g.text.slice(0,v)})}if(u>p){var w=u-p;h=$t($t({},g),{},{text:g.text.slice(0,w)}),g=$t($t({},g),{},{text:g.text.slice(w)})}Object.assign(g,a),h&&o.push(h),o.push(g),y&&o.push(y)}n=o}return n}},Us=e=>e.selection?e.selection:e.children.length>0?b.end(e,[]):[0],tr=(e,t)=>{var[n]=b.node(e,t);return r=>r===n},Vs=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?mp(t):t,i=Ce.None,s=Ce.None,o=0,l=null,u=null;for(var c of a){var f=c.codePointAt(0);if(!f)break;var m=_p(c,f);if([i,s]=r?[s,m]:[m,i],Rn(i,Ce.ZWJ)&&Rn(s,Ce.ExtPict)&&(r?l=cu(t.substring(0,o)):l=cu(t.substring(0,t.length-o)),!l)||Rn(i,Ce.RI)&&Rn(s,Ce.RI)&&(u!==null?u=!u:r?u=!0:u=Sp(t.substring(0,t.length-o)),!u)||i!==Ce.None&&s!==Ce.None&&Ap(i,s))break;o+=c.length}return o||1},lp=/\s/,cp=/[\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]/,dp=/['\u2018\u2019]/,fp=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=Vs(t,n),[s,o]=Ks(t,i,n);if(hp(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Ks=(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(dp.test(t)){var a=Vs(n,r),[i,s]=Ks(n,a,r);if(e(i,s,r))return!0}return!cp.test(t)},mp=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(gp(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(pp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},pp=e=>e>=55296&&e<=56319,gp=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 vp=/^(?:[\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])$/,bp=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,yp=/^(?:[\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])$/,Dp=/^[\u1100-\u115F\uA960-\uA97C]$/,Cp=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,xp=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,wp=/^[\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]$/,Ep=/^[\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]$/,kp=/^(?:[\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])$/,_p=(e,t)=>{var n=Ce.Any;return e.search(vp)!==-1&&(n|=Ce.Extend),t===8205&&(n|=Ce.ZWJ),t>=127462&&t<=127487&&(n|=Ce.RI),e.search(bp)!==-1&&(n|=Ce.Prepend),e.search(yp)!==-1&&(n|=Ce.SpacingMark),e.search(Dp)!==-1&&(n|=Ce.L),e.search(Cp)!==-1&&(n|=Ce.V),e.search(xp)!==-1&&(n|=Ce.T),e.search(wp)!==-1&&(n|=Ce.LV),e.search(Ep)!==-1&&(n|=Ce.LVT),e.search(kp)!==-1&&(n|=Ce.ExtPict),n};function Rn(e,t){return(e&t)!==0}var Bp=[[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 Ap(e,t){return Bp.findIndex(n=>Rn(e,n[0])&&Rn(t,n[1]))===-1}var Fp=/(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFA]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC01\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDE41\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4\uDF00\uDF01\uDF36-\uDF3A\uDF40\uDF42]|\uD80D[\uDC40\uDC47-\uDC55]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])*\u200D$/,cu=e=>e.search(Fp)!==-1,Tp=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Sp=e=>{var t=e.match(Tp);if(t===null)return!1;var n=t[0].length/2;return n%2===1},jp={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=Us(e)}=n;if(P.isPath(a)&&(a=b.range(e,a)),H.isRange(a))if(H.isCollapsed(a))a=a.anchor;else{var i=H.end(a);if(!r&&b.void(e,{at:i}))return;var s=H.start(a),o=b.pointRef(e,s),l=b.pointRef(e,i);Q.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,Q.setSelection(e,{anchor:a,focus:a})}if(!(!r&&b.void(e,{at:a})||b.elementReadOnly(e,{at:a}))){var{path:f,offset:m}=a;t.length>0&&e.apply({type:"insert_text",path:f,offset:m,text:t})}})}};function 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 qr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?du(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):du(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Q=qr(qr(qr(qr({},Qm),Jm),Xm),jp),ua=new WeakMap,Op=e=>ua.get(e)||!1,Pp=(e,t,n)=>{var r=ua.get(e)||!1;ua.set(e,!0);try{t(),n()}finally{ua.set(e,r)}};function id(e,t,n){var r=wa.get(e)||[],a=Ea.get(e)||new Set,i,s,o=f=>{if(f){var m=f.join(",");s.has(m)||(s.add(m),i.push(f))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var c of t)o(c);wa.set(e,i),Ea.set(e,s)}var Np=(e,t)=>{for(var n of b.pathRefs(e))Um.transform(n,t);for(var r of b.pointRefs(e))Vm.transform(r,t);for(var a of b.rangeRefs(e))Km.transform(a,t);if(!Op(e)){var i=P.operationCanTransformPath(t)?s=>P.transform(s,t):void 0;id(e,e.getDirtyPaths(t),i)}Q.transform(e,t),e.operations.push(t),b.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),mr.get(e)||(mr.set(e,!0),Promise.resolve().then(()=>{mr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Rp=(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(se.nodes(r),N=>{var[,M]=N;return a.concat(M)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=P.ancestors(o),u=P.previous(o);return[...l,u]}case"move_node":{var{path:c,newPath:f}=t;if(P.equals(c,f))return[];var m=[],p=[];for(var g of P.ancestors(c)){var h=P.transform(g,t);m.push(h)}for(var y of P.ancestors(f)){var v=P.transform(y,t);p.push(v)}var w=p[p.length-1],A=f[f.length-1],E=w.concat(A);return[...m,...p,E]}case"remove_node":{var{path:k}=t,F=P.ancestors(k);return[...F]}case"split_node":{var{path:S}=t,L=P.levels(S),I=P.next(S);return[...L,I]}default:return[]}},Mp=e=>{var{selection:t}=e;return t?se.fragment(e,t):[]},Ip=(e,t)=>{var[n,r]=t;if(!fe.isText(n)){if(ce.isElement(n)&&n.children.length===0){var a={text:""};Q.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=b.isEditor(n)?!1:ce.isElement(n)&&(e.isInline(n)||n.children.length===0||fe.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=se.get(e,r);if(!fe.isText(l)){var u=l.children[s],c=l.children[s-1],f=o===n.children.length-1,m=fe.isText(u)||ce.isElement(u)&&e.isInline(u);if(m!==i)Q.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(ce.isElement(u)){if(e.isInline(u)){if(c==null||!fe.isText(c)){var p={text:""};Q.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(f){var g={text:""};Q.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&fe.isText(c)&&(fe.equals(u,c,{loose:!0})?(Q.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(Q.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(Q.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},$p=(e,t)=>{var{iteration:n,initialDirtyPathsLength:r}=t,a=r*42;if(n>a)throw new Error("Could not completely normalize the editor after ".concat(a," iterations! This is usually due to incorrect normalization logic that leaves a node in an invalid state."));return!0},Lp=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(H.isRange(i)){if(P.isAncestor(c,i.anchor.path)&&P.isAncestor(c,i.focus.path))return[u,c]}else if(!P.equals(o,c))return[u,c]}}};function 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 hu(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){ot(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 zp=(e,t,n)=>{var{selection:r}=e;if(r){var a=(f,m)=>{if(!fe.isText(f))return!1;var[p,g]=b.parent(e,m);return!e.isVoid(p)||e.markableVoid(p)},i=H.isExpanded(r),s=!1;if(!i){var[o,l]=b.node(e,r);if(o&&a(o,l)){var[u]=b.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)Q.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=hu(hu({},b.marks(e)||{}),{},{[t]:n});e.marks=c,mr.get(e)||e.onChange()}}};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){ot(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 qp=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,pu(pu({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};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){ot(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 Wp=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,vu(vu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},Hp=(e,t)=>{var{selection:n}=e;n&&H.isCollapsed(n)&&Q.delete(e,{unit:t,reverse:!0})},Up=(e,t)=>{var{selection:n}=e;n&&H.isCollapsed(n)&&Q.delete(e,{unit:t})},Vp=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&H.isExpanded(r)&&Q.delete(t,{reverse:n==="backward"})},Kp=(e,t)=>[b.start(e,t),b.end(e,t)];function bu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function yu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Zp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,yu(yu({},n),{},{match:r=>ce.isElement(r)&&b.isElementReadOnly(t,r)}))},Yp=(e,t)=>b.point(e,t,{edge:"end"}),Gp=(e,t)=>{var n=b.path(e,t,{edge:"start"});return b.node(e,n)},Qp=(e,t)=>{var n=b.range(e,t);return se.fragment(e,n)};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 Cu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Du(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Du(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Jp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return b.above(t,Cu(Cu({},n),{},{match:r=>ce.isElement(r)&&b.isVoid(t,r)}))},Xp=(e,t)=>t.children.some(n=>ce.isElement(n)&&b.isBlock(e,n)),eg=(e,t)=>t.children.some(n=>fe.isText(n)||b.isInline(e,n)),tg=(e,t)=>se.has(e,t),ng=(e,t)=>t.children.every(n=>fe.isText(n)),rg=e=>{Q.splitNodes(e,{always:!0})},ag=(e,t,n)=>{Q.insertNodes(e,t,n)},ig=e=>{Q.splitNodes(e,{always:!0})};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 sg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?xu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var og=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=sg({text:n},i);Q.insertNodes(t,s,{at:r.at,voids:r.voids})}else Q.insertText(t,n,r);t.marks=null}},ug=(e,t)=>!e.isInline(t),lg=(e,t,n)=>b.isStart(e,t,n)||b.isEnd(e,t,n),cg=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&fe.isText(r)&&r.text===""&&!e.isVoid(t)},dg=(e,t,n)=>{var r=b.end(e,n);return we.equals(t,r)},fg=e=>{var t=rd.get(e);return t===void 0?!0:t},hg=(e,t,n)=>{if(t.offset!==0)return!1;var r=b.start(e,n);return we.equals(t,r)},mg=(e,t)=>{var n=b.path(e,t,{edge:"end"});return b.node(e,n)},pg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=se.leaf(t,a);return[i,a]};function gg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var s=[],o=b.path(e,n);for(var[l,u]of se.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&ce.isElement(l)&&b.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var vg=["text"],bg=["text"],yg=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(H.isExpanded(r)){var s=b.isEnd(t,a,a.path);if(s){var o=b.after(t,a);o&&(a=o)}var[l]=b.nodes(t,{match:fe.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=Ut(u,vg);return c}else return{}}var{path:f}=a,[m]=b.leaf(t,f);if(a.offset===0){var p=b.previous(t,{at:f,match:fe.isText}),g=b.above(t,{match:E=>ce.isElement(E)&&b.isVoid(t,E)&&t.markableVoid(E)});if(!g){var h=b.above(t,{match:E=>ce.isElement(E)&&b.isBlock(t,E)});if(p&&h){var[y,v]=p,[,w]=h;P.isAncestor(w,v)&&(m=y)}}}var A=Ut(m,bg);return A},Dg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=b.after(t,s,{voids:a});if(o){var[,l]=b.last(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(P.isPath(s)){var[c]=b.parent(t,s);i=m=>c.children.includes(m)}else i=()=>!0;var[f]=b.nodes(t,{at:u,match:i,mode:r,voids:a});return f}}},Cg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=se.get(t,a);return[i,a]};function 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,c;if(sp.isSpan(n))u=n[0],c=n[1];else{var f=b.path(e,n,{edge:"start"}),m=b.path(e,n,{edge:"end"});u=i?m:f,c=i?f:m}var p=se.nodes(e,{reverse:i,from:u,to:c,pass:E=>{var[k]=E;return ce.isElement(k)?!!(!s&&(b.isVoid(e,k)||b.isElementReadOnly(e,k))||o&&!b.isSelectable(e,k)):!1}}),g=[],h;for(var[y,v]of p)if(!(o&&ce.isElement(y)&&!b.isSelectable(e,y))){var w=h&&P.compare(v,h[1])===0;if(!(r==="highest"&&w)){if(!l(y,v)){if(a&&!w&&fe.isText(y))return;continue}if(r==="lowest"&&w){h=[y,v];continue}var A=r==="lowest"?h:[y,v];A&&(a?g.push(A):yield A),h=[y,v]}}r==="lowest"&&h&&(a?g.push(h):yield h),a&&(yield*g)}}()}var wg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>wa.get(c)||[],s=c=>Ea.get(c)||new Set,o=c=>{var f=i(c).pop(),m=f.join(",");return s(c).delete(m),f};if(b.isNormalizing(t)){if(r){var l=Array.from(se.nodes(t),c=>{var[,f]=c;return f}),u=new Set(l.map(c=>c.join(",")));wa.set(t,l),Ea.set(t,u)}i(t).length!==0&&b.withoutNormalizing(t,()=>{for(var c of i(t))if(se.has(t,c)){var f=b.node(t,c),[m,p]=f;ce.isElement(m)&&m.children.length===0&&t.normalizeNode(f,{operation:a})}for(var g=i(t),h=g.length,y=0;g.length!==0;){if(!t.shouldNormalize({dirtyPaths:g,iteration:y,initialDirtyPathsLength:h,operation:a}))return;var v=o(t);if(se.has(t,v)){var w=b.node(t,v);t.normalizeNode(w,{operation:a})}y++,g=i(t)}})}},Eg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=b.path(t,n,r),i=P.parent(a),s=b.node(t,i);return s},kg=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},_g=e=>{var t=Qo.get(e);return t||(t=new Set,Qo.set(e,t)),t},Bg=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]=se.first(t,n);n=s}else if(i==="end"){var[,o]=se.last(t,n);n=o}}return H.isRange(n)&&(i==="start"?n=H.start(n):i==="end"?n=H.end(n):n=P.common(n.anchor.path,n.focus.path)),we.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},Ag=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=b.pointRefs(t);return l.delete(i),i.current=null,o}},s=b.pointRefs(t);return s.add(i),i},Fg=e=>{var t=Jo.get(e);return t||(t=new Set,Jo.set(e,t)),t},Tg=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]=se.last(t,n);i=s}else{var[,o]=se.first(t,n);i=o}var l=se.get(t,i);if(!fe.isText(l))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?l.text.length:0}}if(H.isRange(n)){var[u,c]=H.edges(n);return a==="start"?u:c}return n};function Sg(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]=H.edges(o),c=a?u:l,f=!1,m="",p=0,g=0,h=0;for(var[y,v]of b.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(ce.isElement(y)){if(!i&&(e.isVoid(y)||e.isElementReadOnly(y))){yield b.start(e,v);continue}if(e.isInline(y))continue;if(b.hasInlines(e,y)){var w=P.isAncestor(v,u.path)?u:b.end(e,v),A=P.isAncestor(v,l.path)?l:b.start(e,v);m=b.string(e,{anchor:A,focus:w},{voids:i}),f=!0}}if(fe.isText(y)){var E=P.equals(v,c.path);for(E?(g=a?c.offset:y.text.length-c.offset,h=c.offset):(g=y.text.length,h=a?g:0),(E||f||r==="offset")&&(yield{path:v,offset:h},f=!1);;){if(p===0){if(m==="")break;p=k(m,r,a),m=Ks(m,p,a)[1]}if(h=a?h-p:h+p,g=g-p,g<0){p=-g;break}p=0,yield{path:v,offset:h}}}}function k(F,S,L){return S==="character"?Vs(F,L):S==="word"?fp(F,L):S==="line"||S==="block"?F.length:1}}()}var jg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=b.before(t,s,{voids:a});if(o){var[,l]=b.first(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(P.isPath(s)){var[c]=b.parent(t,s);i=m=>c.children.includes(m)}else i=()=>!0;var[f]=b.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return f}}},Og=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},Pg=e=>{var t=Xo.get(e);return t||(t=new Set,Xo.set(e,t)),t},Ng=(e,t,n)=>{if(H.isRange(t)&&!n)return t;var r=b.start(e,t),a=b.end(e,n||t);return{anchor:r,focus:a}};function wu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Rg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?wu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Mg=(e,t)=>{var{selection:n}=e;if(n){var r=(c,f)=>{if(!fe.isText(c))return!1;var[m,p]=b.parent(e,f);return!e.isVoid(m)||e.markableVoid(m)},a=H.isExpanded(n),i=!1;if(!a){var[s,o]=b.node(e,n);if(s&&r(s,o)){var[l]=b.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)Q.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Rg({},b.marks(e)||{});delete u[t],e.marks=u,mr.get(e)||e.onChange()}}},Ig=(e,t)=>{rd.set(e,t)},$g=(e,t)=>b.point(e,t,{edge:"start"}),Lg=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]=H.edges(i),l="";for(var[u,c]of b.nodes(t,{at:i,match:fe.isText,voids:a})){var f=u.text;P.equals(c,o.path)&&(f=f.slice(0,o.offset)),P.equals(c,s.path)&&(f=f.slice(s.offset)),l+=f}return l},zg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=H.edges(n);if(i.offset!==0||s.offset!==0||H.isCollapsed(n)||P.hasPrevious(s.path))return n;var o=b.above(t,{at:s,match:g=>ce.isElement(g)&&b.isBlock(t,g),voids:a}),l=o?o[1]:[],u=b.start(t,i),c={anchor:u,focus:s},f=!0;for(var[m,p]of b.nodes(t,{at:c,match:fe.isText,reverse:!0,voids:a})){if(f){f=!1;continue}if(m.text!==""||P.isBefore(p,l)){s={path:p,offset:m.text.length};break}}return{anchor:i,focus:s}},qg=(e,t)=>{var n=b.isNormalizing(e);b.setNormalizing(e,!1);try{t()}finally{b.setNormalizing(e,n)}b.normalize(e)},Wg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:c=!1}=n;if(u){var f=!1;if(H.isRange(u)&&H.isCollapsed(u)&&(f=!0,u=u.anchor),we.isPoint(u)){var m=b.void(t,{at:u,mode:"highest"});if(!l&&m){var[,p]=m;u=p}else{var g={unit:s,distance:o},h=i?b.before(t,u,g)||b.start(t,[]):b.after(t,u,g)||b.end(t,[]);u={anchor:u,focus:h},c=!0}}if(P.isPath(u)){Q.removeNodes(t,{at:u,voids:l});return}if(!H.isCollapsed(u)){if(!c){var[,y]=H.edges(u),v=b.end(t,[]);we.equals(y,v)||(u=b.unhangRange(t,u,{voids:l}))}var[w,A]=H.edges(u),E=b.above(t,{match:ge=>ce.isElement(ge)&&b.isBlock(t,ge),at:w,voids:l}),k=b.above(t,{match:ge=>ce.isElement(ge)&&b.isBlock(t,ge),at:A,voids:l}),F=E&&k&&!P.equals(E[1],k[1]),S=P.equals(w.path,A.path),L=l?null:(r=b.void(t,{at:w,mode:"highest"}))!==null&&r!==void 0?r:b.elementReadOnly(t,{at:w,mode:"highest"}),I=l?null:(a=b.void(t,{at:A,mode:"highest"}))!==null&&a!==void 0?a:b.elementReadOnly(t,{at:A,mode:"highest"});if(L){var N=b.before(t,w);N&&E&&P.isAncestor(E[1],N.path)&&(w=N)}if(I){var M=b.after(t,A);M&&k&&P.isAncestor(k[1],M.path)&&(A=M)}var x=[],_;for(var j of b.nodes(t,{at:u,voids:l})){var[R,q]=j;_&&P.compare(q,_)===0||(!l&&ce.isElement(R)&&(b.isVoid(t,R)||b.isElementReadOnly(t,R))||!P.isCommon(q,w.path)&&!P.isCommon(q,A.path))&&(x.push(j),_=q)}var V=Array.from(x,ge=>{var[,_e]=ge;return b.pathRef(t,_e)}),ue=b.pointRef(t,w),ne=b.pointRef(t,A),D="";if(!S&&!L){var W=ue.current,[X]=b.leaf(t,W),{path:B}=W,{offset:T}=w,z=X.text.slice(T);z.length>0&&(t.apply({type:"remove_text",path:B,offset:T,text:z}),D=z)}if(V.reverse().map(ge=>ge.unref()).filter(ge=>ge!==null).forEach(ge=>Q.removeNodes(t,{at:ge,voids:l})),!I){var $=ne.current,[K]=b.leaf(t,$),{path:te}=$,ee=S?w.offset:0,ae=K.text.slice(ee,A.offset);ae.length>0&&(t.apply({type:"remove_text",path:te,offset:ee,text:ae}),D=ae)}!S&&F&&ne.current&&ue.current&&Q.mergeNodes(t,{at:ne.current,hanging:!0,voids:l}),f&&i&&s==="character"&&D.length>1&&D.match(/[\u0E00-\u0E7F]+/)&&Q.insertText(t,D.slice(0,D.length-o));var de=ue.unref(),Y=ne.unref(),pe=i?de||Y:Y||de;n.at==null&&pe&&Q.select(t,pe)}}})},Hg=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=Us(t),batchDirty:o=!0}=r;if(n.length){if(H.isRange(s))if(a||(s=b.unhangRange(t,s,{voids:i})),H.isCollapsed(s))s=s.anchor;else{var[,l]=H.edges(s);if(!i&&b.void(t,{at:l}))return;var u=b.pointRef(t,l);Q.delete(t,{at:s}),s=u.unref()}else P.isPath(s)&&(s=b.start(t,s));if(!(!i&&b.void(t,{at:s}))){var c=b.above(t,{at:s,match:z=>ce.isElement(z)&&b.isInline(t,z),mode:"highest",voids:i});if(c){var[,f]=c;if(b.isEnd(t,s,f)){var m=b.after(t,f);s=m}else if(b.isStart(t,s,f)){var p=b.before(t,f);s=p}}var g=b.above(t,{match:z=>ce.isElement(z)&&b.isBlock(t,z),at:s,voids:i}),[,h]=g,y=b.isStart(t,s,h),v=b.isEnd(t,s,h),w=y&&v,A=!y||y&&v,E=!v,[,k]=se.first({children:n},[]),[,F]=se.last({children:n},[]),S=[],L=z=>{var[$,K]=z,te=K.length===0;return te?!1:w?!0:!(A&&P.isAncestor(K,k)&&ce.isElement($)&&!t.isVoid($)&&!t.isInline($)||E&&P.isAncestor(K,F)&&ce.isElement($)&&!t.isVoid($)&&!t.isInline($))};for(var I of se.nodes({children:n},{pass:L}))L(I)&&S.push(I);var N=[],M=[],x=[],_=!0,j=!1;for(var[R]of S)ce.isElement(R)&&!t.isInline(R)?(_=!1,j=!0,M.push(R)):_?N.push(R):x.push(R);var[q]=b.nodes(t,{at:s,match:z=>fe.isText(z)||b.isInline(t,z),mode:"highest",voids:i}),[,V]=q,ue=b.isStart(t,s,V),ne=b.isEnd(t,s,V),D=b.pathRef(t,v&&!x.length?P.next(h):h),W=b.pathRef(t,ne?P.next(V):V);Q.splitNodes(t,{at:s,match:z=>j?ce.isElement(z)&&b.isBlock(t,z):fe.isText(z)||b.isInline(t,z),mode:j?"lowest":"highest",always:j&&(!y||N.length>0)&&(!v||x.length>0),voids:i});var X=b.pathRef(t,!ue||ue&&ne?P.next(V):V);if(Q.insertNodes(t,N,{at:X.current,match:z=>fe.isText(z)||b.isInline(t,z),mode:"highest",voids:i,batchDirty:o}),w&&!N.length&&M.length&&!x.length&&Q.delete(t,{at:h,voids:i}),Q.insertNodes(t,M,{at:D.current,match:z=>ce.isElement(z)&&b.isBlock(t,z),mode:"lowest",voids:i,batchDirty:o}),Q.insertNodes(t,x,{at:W.current,match:z=>fe.isText(z)||b.isInline(t,z),mode:"highest",voids:i,batchDirty:o}),!r.at){var B;if(x.length>0&&W.current?B=P.previous(W.current):M.length>0&&D.current?B=P.previous(D.current):X.current&&(B=P.previous(X.current)),B){var T=b.end(t,B);Q.select(t,T)}}X.unref(),D.unref(),W.unref()}}})},Ug=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]=H.edges(a);Q.select(t,i)}else if(r==="end"){var[,s]=H.edges(a);Q.select(t,s)}}else return},Vg=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},Kg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t,{distance:a=1,unit:i="character",reverse:s=!1}=n,{edge:o=null}=n;if(r){o==="start"&&(o=H.isBackward(r)?"focus":"anchor"),o==="end"&&(o=H.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,c={distance:a,unit:i,ignoreNonSelectable:!0},f={};if(o==null||o==="anchor"){var m=s?b.before(t,l,c):b.after(t,l,c);m&&(f.anchor=m)}if(o==null||o==="focus"){var p=s?b.before(t,u,c):b.after(t,u,c);p&&(f.focus=p)}Q.setSelection(t,f)}},Zg=(e,t)=>{var{selection:n}=e;if(t=b.range(e,t),n){Q.setSelection(e,t);return}if(!H.isRange(t))throw new Error("When setting the selection and the current selection is `null` you must provide at least an `anchor` and `focus`, but you passed: ".concat(Je.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};function Eu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function 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){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Eu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Yg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a}=t,{edge:i="both"}=r;if(a){i==="start"&&(i=H.isBackward(a)?"focus":"anchor"),i==="end"&&(i=H.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;Q.setSelection(t,{[i==="anchor"?"anchor":"focus"]:ku(ku({},l),n)})}},Gg=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!we.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!we.equals(t.focus,n.focus)||i!=="anchor"&&i!=="focus"&&t[i]!==n[i])&&(r[i]=n[i],a[i]=t[i]);Object.keys(r).length>0&&e.apply({type:"set_selection",properties:r,newProperties:a})}},Qg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:c}=r;if(se.isNode(n)&&(n=[n]),n.length!==0){var[f]=n;if(l||(l=Us(t),c!==!1&&(c=!0)),c==null&&(c=!1),H.isRange(l))if(a||(l=b.unhangRange(t,l,{voids:i})),H.isCollapsed(l))l=l.anchor;else{var[,m]=H.edges(l),p=b.pointRef(t,m);Q.delete(t,{at:l}),l=p.unref()}if(we.isPoint(l)){u==null&&(fe.isText(f)?u=N=>fe.isText(N):t.isInline(f)?u=N=>fe.isText(N)||b.isInline(t,N):u=N=>ce.isElement(N)&&b.isBlock(t,N));var[g]=b.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,h]=g,y=b.pathRef(t,h),v=b.isEnd(t,l,h);Q.splitNodes(t,{at:l,match:u,mode:s,voids:i});var w=y.unref();l=v?P.next(w):w}else return}var A=P.parent(l),E=l[l.length-1];if(!(!i&&b.void(t,{at:A}))){if(o){var k=[],F=P.levels(A);Pp(t,()=>{var N=function(){var _=A.concat(E);E++;var j={type:"insert_node",path:_,node:M};t.apply(j),l=P.next(l),k.push(j),fe.isText?F.push(...Array.from(se.nodes(M),R=>{var[,q]=R;return _.concat(q)})):F.push(_)};for(var M of n)N()},()=>{id(t,F,N=>{var M=N;for(var x of k)if(P.operationCanTransformPath(x)&&(M=P.transform(M,x),!M))return null;return M})})}else for(var S of n){var L=A.concat(E);E++,t.apply({type:"insert_node",path:L,node:S}),l=P.next(l)}if(l=P.previous(l),c){var I=b.end(t,l);I&&Q.select(t,I)}}}})},Jg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=P.isPath(r)?tr(t,r):E=>ce.isElement(E)&&b.isBlock(t,E)),!!r){var o=b.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,E=>{var[,k]=E;return b.pathRef(t,k)});for(var u of l){var c=u.unref();if(c.length<2)throw new Error("Cannot lift node at a path [".concat(c,"] because it has a depth of less than `2`."));var f=b.node(t,P.parent(c)),[m,p]=f,g=c[c.length-1],{length:h}=m.children;if(h===1){var y=P.next(p);Q.moveNodes(t,{at:c,to:y,voids:i}),Q.removeNodes(t,{at:p,voids:i})}else if(g===0)Q.moveNodes(t,{at:c,to:p,voids:i});else if(g===h-1){var v=P.next(p);Q.moveNodes(t,{at:c,to:v,voids:i})}else{var w=P.next(c),A=P.next(p);Q.splitNodes(t,{at:w,voids:i}),Q.moveNodes(t,{at:c,to:A,voids:i})}}}})},Xg=["text"],ev=["children"],sd=(e,t)=>{if(ce.isElement(t)){var n=t;return b.isVoid(e,t)?!0:n.children.length===1?sd(e,n.children[0]):!1}else return!b.isEditor(t)},tv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(P.isPath(a)){var[l]=b.parent(t,a);r=N=>l.children.includes(N)}else r=N=>ce.isElement(N)&&b.isBlock(t,N);if(!i&&H.isRange(a)&&(a=b.unhangRange(t,a,{voids:s})),H.isRange(a))if(H.isCollapsed(a))a=a.anchor;else{var[,u]=H.edges(a),c=b.pointRef(t,u);Q.delete(t,{at:a}),a=c.unref(),n.at==null&&Q.select(t,a)}var[f]=b.nodes(t,{at:a,match:r,voids:s,mode:o}),m=b.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!f||!m)){var[p,g]=f,[h,y]=m;if(!(g.length===0||y.length===0)){var v=P.next(y),w=P.common(g,y),A=P.isSibling(g,y),E=Array.from(b.levels(t,{at:g}),N=>{var[M]=N;return M}).slice(w.length).slice(0,-1),k=b.above(t,{at:g,mode:"highest",match:N=>E.includes(N)&&sd(t,N)}),F=k&&b.pathRef(t,k[1]),S,L;if(fe.isText(p)&&fe.isText(h)){var I=Ut(p,Xg);L=h.text.length,S=I}else if(ce.isElement(p)&&ce.isElement(h)){var I=Ut(p,ev);L=h.children.length,S=I}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(Je.stringify(p)," ").concat(Je.stringify(h)));A||Q.moveNodes(t,{at:g,to:v,voids:s}),F&&Q.removeNodes(t,{at:F.current,voids:s}),ce.isElement(h)&&b.isEmpty(t,h)||fe.isText(h)&&h.text===""&&y[y.length-1]!==0?Q.removeNodes(t,{at:y,voids:s}):t.apply({type:"merge_node",path:v,position:L,properties:S}),F&&F.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=P.isPath(r)?tr(e,r):p=>ce.isElement(p)&&b.isBlock(e,p));var o=b.pathRef(e,n),l=b.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,p=>{var[,g]=p;return b.pathRef(e,g)});for(var c of u){var f=c.unref(),m=o.current;f.length!==0&&e.apply({type:"move_node",path:f,newPath:m}),o.current&&P.isSibling(m,f)&&P.isAfter(m,f)&&(o.current=P.next(o.current))}o.unref()}})},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=P.isPath(s)?tr(t,s):p=>ce.isElement(p)&&b.isBlock(t,p)),!r&&H.isRange(s)&&(s=b.unhangRange(t,s,{voids:a}));var l=b.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,p=>{var[,g]=p;return b.pathRef(t,g)});for(var c of u){var f=c.unref();if(f){var[m]=b.node(t,f);t.apply({type:"remove_node",path:f,node:m})}}}})},av=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:c=!1,voids:f=!1}=r;if(i){if(a==null&&(a=P.isPath(i)?tr(t,i):L=>ce.isElement(L)&&b.isBlock(t,L)),!l&&H.isRange(i)&&(i=b.unhangRange(t,i,{voids:f})),c&&H.isRange(i)){if(H.isCollapsed(i)&&b.leaf(t,i.anchor)[0].text.length>0)return;var m=b.rangeRef(t,i,{affinity:"inward"}),[p,g]=H.edges(i),h=u==="lowest"?"lowest":"highest",y=b.isEnd(t,g,g.path);Q.splitNodes(t,{at:g,match:a,mode:h,voids:f,always:!y});var v=b.isStart(t,p,p.path);Q.splitNodes(t,{at:p,match:a,mode:h,voids:f,always:!v}),i=m.unref(),r.at==null&&Q.select(t,i)}s||(s=(L,I)=>L!==I);for(var[w,A]of b.nodes(t,{at:i,match:a,mode:u,voids:f})){var E={},k={};if(A.length!==0){var F=!1;for(var S in n)S==="children"||S==="text"||s(n[S],w[S])&&(F=!0,w.hasOwnProperty(S)&&(E[S]=w[S]),o?n[S]!=null&&(k[S]=o(w[S],n[S])):n[S]!=null&&(k[S]=n[S]));F&&t.apply({type:"set_node",path:A,properties:E,newProperties:k})}}}})},iv=(e,t)=>{if(H.isCollapsed(t))return t.anchor;var[,n]=H.edges(t),r=b.pointRef(e,n);return Q.delete(e,{at:t}),r.unref()},sv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=ne=>ce.isElement(ne)&&b.isBlock(t,ne)),H.isRange(s)&&(s=iv(t,s)),P.isPath(s)){var u=s,c=b.point(t,u),[f]=b.parent(t,u);i=ne=>ne===f,o=c.path.length-u.length+1,s=c,l=!0}if(s){var m=b.pointRef(t,s,{affinity:"backward"}),p;try{var[g]=b.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var h=b.void(t,{at:s,mode:"highest"}),y=0;if(!a&&h){var[v,w]=h;if(ce.isElement(v)&&t.isInline(v)){var A=b.after(t,w);if(!A){var E={text:""},k=P.next(w);Q.insertNodes(t,E,{at:k,voids:a}),A=b.point(t,k)}s=A,l=!0}var F=s.path.length-w.length;o=F+1,l=!0}p=b.pointRef(t,s);var S=s.path.length-o,[,L]=g,I=s.path.slice(0,S),N=o===0?s.offset:s.path[S]+y;for(var[M,x]of b.levels(t,{at:I,reverse:!0,voids:a})){var _=!1;if(x.length<L.length||x.length===0||!a&&ce.isElement(M)&&b.isVoid(t,M))break;var j=m.current,R=b.isEnd(t,j,x);if(l||!m||!b.isEdge(t,j,x)){_=!0;var q=se.extractProps(M);t.apply({type:"split_node",path:x,position:N,properties:q})}N=x[x.length-1]+(_||R?1:0)}if(n.at==null){var V=p.current||b.end(t,[]);Q.select(t,V)}}finally{var ue;m.unref(),(ue=p)===null||ue===void 0||ue.unref()}}})},ov=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)},uv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};b.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=P.isPath(s)?tr(t,s):p=>ce.isElement(p)&&b.isBlock(t,p)),P.isPath(s)&&(s=b.range(t,s));var l=H.isRange(s)?b.rangeRef(t,s):null,u=b.nodes(t,{at:s,match:o,mode:r,voids:i}),c=Array.from(u,p=>{var[,g]=p;return b.pathRef(t,g)}).reverse(),f=function(){var g=m.unref(),[h]=b.node(t,g),y=b.range(t,g);a&&l&&(y=H.intersection(l.current,y)),Q.liftNodes(t,{at:y,match:v=>ce.isAncestor(h)&&h.children.includes(v),voids:i})};for(var m of c)f();l&&l.unref()}})};function _u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function 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){ot(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 lv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};b.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(P.isPath(l)?o=tr(t,l):t.isInline(n)?o=y=>ce.isElement(y)&&b.isInline(t,y)||fe.isText(y):o=y=>ce.isElement(y)&&b.isBlock(t,y)),i&&H.isRange(l)){var[u,c]=H.edges(l),f=b.rangeRef(t,l,{affinity:"inward"});Q.splitNodes(t,{at:c,match:o,voids:s}),Q.splitNodes(t,{at:u,match:o,voids:s}),l=f.unref(),r.at==null&&Q.select(t,l)}var m=Array.from(b.nodes(t,{at:l,match:t.isInline(n)?y=>ce.isElement(y)&&b.isBlock(t,y):y=>b.isEditor(y),mode:"lowest",voids:s})),p=function(){var v=H.isRange(l)?H.intersection(l,b.range(t,h)):l;if(!v)return 0;var w=Array.from(b.nodes(t,{at:v,match:o,mode:a,voids:s}));if(w.length>0){var[A]=w,E=w[w.length-1],[,k]=A,[,F]=E;if(k.length===0&&F.length===0)return 0;var S=P.equals(k,F)?P.parent(k):P.common(k,F),L=b.range(t,k,F),I=b.node(t,S),[N]=I,M=S.length+1,x=P.next(F.slice(0,M)),_=Bu(Bu({},n),{},{children:[]});Q.insertNodes(t,_,{at:x,voids:s}),Q.moveNodes(t,{at:L,match:j=>ce.isAncestor(N)&&N.children.includes(j),to:x.concat(0),voids:s})}},g;for(var[,h]of m)g=p()}})},cv=()=>{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 Np(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zp(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hp(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Up(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vp(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mp(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 Hg(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ag(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return og(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ip(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rp(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $p(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lp(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qp(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wp(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ug(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kp(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zp(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yp(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gp(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qp(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xp(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eg(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tg(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 Qg(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ug(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 cg(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dg(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fg(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 mg(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return pg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gg(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tv(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kg(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 Dg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(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 wg(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Tg(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Fg(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sg(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(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 Zg(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return av(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yg(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gg(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sv(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ov(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uv(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jp(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(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},dv={isHistory(e){return et(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||Jt.isOperationList(e.redos[0].operations))&&(e.undos.length===0||Jt.isOperationList(e.undos[0].operations))}},hi=new WeakMap,mi=new WeakMap,Mn={isHistoryEditor(e){return dv.isHistory(e.history)&&b.isEditor(e)},isMerging(e){return mi.get(e)},isSaving(e){return hi.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=Mn.isMerging(e);mi.set(e,!1),t(),mi.set(e,n)},withoutSaving(e,t){var n=Mn.isSaving(e);hi.set(e,!1),t(),hi.set(e,n)}},fv=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),Mn.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];Mn.withoutSaving(t,()=>{b.withoutNormalizing(t,()=>{var s=i.operations.map(Jt.inverse).reverse();for(var o of s)t.apply(o);i.selectionBefore&&Q.setSelection(t,i.selectionBefore)})}),t.writeHistory("redos",i),r.undos.pop()}},t.apply=r=>{var{operations:a,history:i}=t,{undos:s}=i,o=s[s.length-1],l=o&&o.operations[o.operations.length-1],u=Mn.isSaving(t),c=Mn.isMerging(t);if(u==null&&(u=mv(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=hv(r,l)),o&&c)o.operations.push(r);else{var f={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",f)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},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)),mv=(e,t)=>e.type!=="set_selection",pv=bv,od="֑-߿יִ-﷽ﹰ-ﻼ",ud="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",gv=new RegExp("^[^"+ud+"]*["+od+"]"),vv=new RegExp("^[^"+od+"]*["+ud+"]");function bv(e){return e=String(e||""),gv.test(e)?"rtl":vv.test(e)?"ltr":"neutral"}const ld=xn(pv);function yv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Zs=yv,Dv=typeof Ir=="object"&&Ir&&Ir.Object===Object&&Ir,Cv=Dv,xv=Cv,wv=typeof self=="object"&&self&&self.Object===Object&&self,Ev=xv||wv||Function("return this")(),cd=Ev,kv=cd,_v=function(){return kv.Date.now()},Bv=_v,Av=/\s/;function Fv(e){for(var t=e.length;t--&&Av.test(e.charAt(t)););return t}var Tv=Fv,Sv=Tv,jv=/^\s+/;function Ov(e){return e&&e.slice(0,Sv(e)+1).replace(jv,"")}var Pv=Ov,Nv=cd,Rv=Nv.Symbol,dd=Rv,Au=dd,fd=Object.prototype,Mv=fd.hasOwnProperty,Iv=fd.toString,or=Au?Au.toStringTag:void 0;function $v(e){var t=Mv.call(e,or),n=e[or];try{e[or]=void 0;var r=!0}catch{}var a=Iv.call(e);return r&&(t?e[or]=n:delete e[or]),a}var Lv=$v,zv=Object.prototype,qv=zv.toString;function Wv(e){return qv.call(e)}var Hv=Wv,Fu=dd,Uv=Lv,Vv=Hv,Kv="[object Null]",Zv="[object Undefined]",Tu=Fu?Fu.toStringTag:void 0;function Yv(e){return e==null?e===void 0?Zv:Kv:Tu&&Tu in Object(e)?Uv(e):Vv(e)}var Gv=Yv;function Qv(e){return e!=null&&typeof e=="object"}var Jv=Qv,Xv=Gv,e0=Jv,t0="[object Symbol]";function n0(e){return typeof e=="symbol"||e0(e)&&Xv(e)==t0}var r0=n0,a0=Pv,Su=Zs,i0=r0,ju=0/0,s0=/^[-+]0x[0-9a-f]+$/i,o0=/^0b[01]+$/i,u0=/^0o[0-7]+$/i,l0=parseInt;function c0(e){if(typeof e=="number")return e;if(i0(e))return ju;if(Su(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Su(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=a0(e);var n=o0.test(e);return n||u0.test(e)?l0(e.slice(2),n?2:8):s0.test(e)?ju:+e}var d0=c0,f0=Zs,pi=Bv,Ou=d0,h0="Expected a function",m0=Math.max,p0=Math.min;function g0(e,t,n){var r,a,i,s,o,l,u=0,c=!1,f=!1,m=!0;if(typeof e!="function")throw new TypeError(h0);t=Ou(t)||0,f0(n)&&(c=!!n.leading,f="maxWait"in n,i=f?m0(Ou(n.maxWait)||0,t):i,m="trailing"in n?!!n.trailing:m);function p(F){var S=r,L=a;return r=a=void 0,u=F,s=e.apply(L,S),s}function g(F){return u=F,o=setTimeout(v,t),c?p(F):s}function h(F){var S=F-l,L=F-u,I=t-S;return f?p0(I,i-L):I}function y(F){var S=F-l,L=F-u;return l===void 0||S>=t||S<0||f&&L>=i}function v(){var F=pi();if(y(F))return w(F);o=setTimeout(v,h(F))}function w(F){return o=void 0,m&&r?p(F):(r=a=void 0,s)}function A(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function E(){return o===void 0?s:w(pi())}function k(){var F=pi(),S=y(F);if(r=arguments,a=this,l=F,S){if(o===void 0)return g(l);if(f)return clearTimeout(o),o=setTimeout(v,t),p(l)}return o===void 0&&(o=setTimeout(v,t)),s}return k.cancel=A,k.flush=E,k}var hd=g0;const v0=xn(hd);var b0=hd,y0=Zs,D0="Expected a function";function C0(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(D0);return y0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),b0(e,t,{leading:r,maxWait:t,trailing:a})}var x0=C0;const w0=xn(x0),Pu=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Nu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",gi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Nu(n.overflowY,t)||Nu(n.overflowX,t)||(r=>{const a=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!a&&(a.clientHeight<r.scrollHeight||a.clientWidth<r.scrollWidth)})(e)}return!1},Wr=(e,t,n,r,a,i,s,o)=>i<e&&s>t||i>e&&s<t?0:i<=e&&o<=n||s>=t&&o>=n?i-e-r:s>t&&o<n||i<e&&o>n?s-t+a:0,E0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Ru=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,f=typeof u=="function"?u:q=>q!==u;if(!Pu(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let g=e;for(;Pu(g)&&f(g);){if(g=E0(g),g===m){p.push(g);break}g!=null&&g===document.body&&gi(g)&&!gi(document.documentElement)||g!=null&&gi(g,c)&&p.push(g)}const h=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,y=(i=(a=window.visualViewport)==null?void 0:a.height)!=null?i:innerHeight,{scrollX:v,scrollY:w}=window,{height:A,width:E,top:k,right:F,bottom:S,left:L}=e.getBoundingClientRect(),{top:I,right:N,bottom:M,left:x}=(q=>{const V=window.getComputedStyle(q);return{top:parseFloat(V.scrollMarginTop)||0,right:parseFloat(V.scrollMarginRight)||0,bottom:parseFloat(V.scrollMarginBottom)||0,left:parseFloat(V.scrollMarginLeft)||0}})(e);let _=o==="start"||o==="nearest"?k-I:o==="end"?S+M:k+A/2-I+M,j=l==="center"?L+E/2-x+N:l==="end"?F+N:L-x;const R=[];for(let q=0;q<p.length;q++){const V=p[q],{height:ue,width:ne,top:D,right:W,bottom:X,left:B}=V.getBoundingClientRect();if(s==="if-needed"&&k>=0&&L>=0&&S<=y&&F<=h&&k>=D&&S<=X&&L>=B&&F<=W)return R;const T=getComputedStyle(V),z=parseInt(T.borderLeftWidth,10),$=parseInt(T.borderTopWidth,10),K=parseInt(T.borderRightWidth,10),te=parseInt(T.borderBottomWidth,10);let ee=0,ae=0;const de="offsetWidth"in V?V.offsetWidth-V.clientWidth-z-K:0,Y="offsetHeight"in V?V.offsetHeight-V.clientHeight-$-te:0,pe="offsetWidth"in V?V.offsetWidth===0?0:ne/V.offsetWidth:0,ge="offsetHeight"in V?V.offsetHeight===0?0:ue/V.offsetHeight:0;if(m===V)ee=o==="start"?_:o==="end"?_-y:o==="nearest"?Wr(w,w+y,y,$,te,w+_,w+_+A,A):_-y/2,ae=l==="start"?j:l==="center"?j-h/2:l==="end"?j-h:Wr(v,v+h,h,z,K,v+j,v+j+E,E),ee=Math.max(0,ee+w),ae=Math.max(0,ae+v);else{ee=o==="start"?_-D-$:o==="end"?_-X+te+Y:o==="nearest"?Wr(D,X,ue,$,te+Y,_,_+A,A):_-(D+ue/2)+Y/2,ae=l==="start"?j-B-z:l==="center"?j-(B+ne/2)+de/2:l==="end"?j-W+K+de:Wr(B,W,ne,z,K+de,j,j+E,E);const{scrollLeft:_e,scrollTop:Oe}=V;ee=ge===0?0:Math.max(0,Math.min(Oe+ee/ge,V.scrollHeight-ue/ge+Y)),ae=pe===0?0:Math.max(0,Math.min(_e+ae/pe,V.scrollWidth-ne/pe+de)),_+=Oe-ee,j+=_e-ae}R.push({el:V,top:ee,left:ae})}return R},k0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function _0(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(Ru(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of Ru(e,k0(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var pn=[],B0=function(){return pn.some(function(e){return e.activeTargets.length>0})},A0=function(){return pn.some(function(e){return e.skippedTargets.length>0})},Mu="ResizeObserver loop completed with undelivered notifications.",F0=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:Mu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=Mu),window.dispatchEvent(e)},_r;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(_r||(_r={}));var gn=function(e){return Object.freeze(e)},T0=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,gn(this)}return e}(),md=function(){function e(t,n,r,a){return this.x=t,this.y=n,this.width=r,this.height=a,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,gn(this)}return e.prototype.toJSON=function(){var t=this,n=t.x,r=t.y,a=t.top,i=t.right,s=t.bottom,o=t.left,l=t.width,u=t.height;return{x:n,y:r,top:a,right:i,bottom:s,left:o,width:l,height:u}},e.fromRect=function(t){return new e(t.x,t.y,t.width,t.height)},e}(),Ys=function(e){return e instanceof SVGElement&&"getBBox"in e},pd=function(e){if(Ys(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)},Iu=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)},S0=function(e){switch(e.tagName){case"INPUT":if(e.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},pr=typeof window<"u"?window:{},Hr=new WeakMap,$u=/auto|scroll/,j0=/^tb|vertical/,O0=/msie|trident/i.test(pr.navigator&&pr.navigator.userAgent),At=function(e){return parseFloat(e||"0")},zn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new T0((n?t:e)||0,(n?e:t)||0)},Lu=gn({devicePixelContentBoxSize:zn(),borderBoxSize:zn(),contentBoxSize:zn(),contentRect:new md(0,0,0,0)}),gd=function(e,t){if(t===void 0&&(t=!1),Hr.has(e)&&!t)return Hr.get(e);if(pd(e))return Hr.set(e,Lu),Lu;var n=getComputedStyle(e),r=Ys(e)&&e.ownerSVGElement&&e.getBBox(),a=!O0&&n.boxSizing==="border-box",i=j0.test(n.writingMode||""),s=!r&&$u.test(n.overflowY||""),o=!r&&$u.test(n.overflowX||""),l=r?0:At(n.paddingTop),u=r?0:At(n.paddingRight),c=r?0:At(n.paddingBottom),f=r?0:At(n.paddingLeft),m=r?0:At(n.borderTopWidth),p=r?0:At(n.borderRightWidth),g=r?0:At(n.borderBottomWidth),h=r?0:At(n.borderLeftWidth),y=f+u,v=l+c,w=h+p,A=m+g,E=o?e.offsetHeight-A-e.clientHeight:0,k=s?e.offsetWidth-w-e.clientWidth:0,F=a?y+w:0,S=a?v+A:0,L=r?r.width:At(n.width)-F-k,I=r?r.height:At(n.height)-S-E,N=L+y+k+w,M=I+v+E+A,x=gn({devicePixelContentBoxSize:zn(Math.round(L*devicePixelRatio),Math.round(I*devicePixelRatio),i),borderBoxSize:zn(N,M,i),contentBoxSize:zn(L,I,i),contentRect:new md(f,l,L,I)});return Hr.set(e,x),x},vd=function(e,t,n){var r=gd(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case _r.DEVICE_PIXEL_CONTENT_BOX:return s;case _r.BORDER_BOX:return a;default:return i}},P0=function(){function e(t){var n=gd(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=gn([n.borderBoxSize]),this.contentBoxSize=gn([n.contentBoxSize]),this.devicePixelContentBoxSize=gn([n.devicePixelContentBoxSize])}return e}(),bd=function(e){if(pd(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},N0=function(){var e=1/0,t=[];pn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var c=new P0(u.target),f=bd(u.target);o.push(c),u.lastReportedSize=vd(u.target,u.observedBox),f<e&&(e=f)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},zu=function(e){pn.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(a){a.isActive()&&(bd(a.target)>e?n.activeTargets.push(a):n.skippedTargets.push(a))})})},R0=function(){var e=0;for(zu(e);B0();)e=N0(),zu(e);return A0()&&F0(),e>0},vi,yd=[],M0=function(){return yd.splice(0).forEach(function(e){return e()})},I0=function(e){if(!vi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return M0()}).observe(n,r),vi=function(){n.textContent="".concat(t?t--:t++)}}yd.push(e),vi()},$0=function(e){I0(function(){requestAnimationFrame(e)})},la=0,L0=function(){return!!la},z0=250,q0={attributes:!0,characterData:!0,childList:!0,subtree:!0},qu=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Wu=function(e){return e===void 0&&(e=0),Date.now()+e},bi=!1,W0=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=z0),!bi){bi=!0;var r=Wu(t);$0(function(){var a=!1;try{a=R0()}finally{if(bi=!1,t=r-Wu(),!L0())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,q0)};document.body?n():pr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),qu.forEach(function(n){return pr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),qu.forEach(function(n){return pr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),hs=new W0,Hu=function(e){!la&&e>0&&hs.start(),la+=e,!la&&hs.stop()},H0=function(e){return!Ys(e)&&!S0(e)&&getComputedStyle(e).display==="inline"},U0=function(){function e(t,n){this.target=t,this.observedBox=n||_r.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=vd(this.target,this.observedBox,!0);return H0(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),V0=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Ur=new WeakMap,Uu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Vr=function(){function e(){}return e.connect=function(t,n){var r=new V0(t,n);Ur.set(t,r)},e.observe=function(t,n,r){var a=Ur.get(t),i=a.observationTargets.length===0;Uu(a.observationTargets,n)<0&&(i&&pn.push(a),a.observationTargets.push(new U0(n,r&&r.box)),Hu(1),hs.schedule())},e.unobserve=function(t,n){var r=Ur.get(t),a=Uu(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&pn.splice(pn.indexOf(r),1),r.observationTargets.splice(a,1),Hu(-1))},e.disconnect=function(t){var n=this,r=Ur.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),K0=function(){function e(t){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof t!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Vr.connect(this,t)}return e.prototype.observe=function(t,n){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Iu(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Vr.observe(this,t,n)},e.prototype.unobserve=function(t){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Iu(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Vr.unobserve(this,t)},e.prototype.disconnect=function(){Vr.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Vt={};Object.defineProperty(Vt,"__esModule",{value:!0});var Z0=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),yi={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Dd={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Z0?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Gs={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222};for(var Kr=1;Kr<20;Kr++)Gs["f"+Kr]=111+Kr;function Ka(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Cd(s,t)}),a=function(o){return r.some(function(l){return xd(l,o)})},i=n==null?a:a(n);return i}function Y0(e,t){return Ka(e,t)}function G0(e,t){return Ka(e,{byKey:!0},t)}function Cd(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in yi)r[yi[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var c=a[Symbol.iterator](),f;!(o=(f=c.next()).done);o=!0){var m=f.value,p=m.endsWith("?")&&m.length>1;p&&(m=m.slice(0,-1));var g=Qs(m),h=yi[g];if(m.length>1&&!h&&!Dd[m]&&!Gs[g])throw new TypeError('Unknown modifier: "'+m+'"');(i===1||!h)&&(n?r.key=g:r.which=wd(m)),h&&(r[h]=p?null:!0)}}catch(y){l=!0,u=y}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function xd(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 wd(e){e=Qs(e);var t=Gs[e]||e.toUpperCase().charCodeAt(0);return t}function Qs(e){return e=e.toLowerCase(),e=Dd[e]||e,e}var Q0=Vt.default=Ka,Di=Vt.isHotkey=Ka;Vt.isCodeHotkey=Y0;Vt.isKeyHotkey=G0;Vt.parseHotkey=Cd;Vt.compareHotkey=xd;Vt.toKeyCode=wd;Vt.toKeyName=Qs;function J0(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 Kn(e,t){if(e==null)return{};var n=J0(e,t),r,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Br(e){"@babel/helpers - typeof";return Br=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Br(e)}function X0(e,t){if(Br(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Br(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function eb(e){var t=X0(e,"string");return Br(t)==="symbol"?t:String(t)}function xt(e,t,n){return t=eb(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Js=C.createContext(null),sn=()=>{var e=C.useContext(Js);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},Ed=parseInt(C.version.split(".")[0],10),tb=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Vu=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),st=typeof navigator<"u"&&/Android/.test(navigator.userAgent),In=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),fr=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),kd=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),ab=st&&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),sb=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),ob=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ca=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Kt=(!rb||!ab)&&!nb&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",Xs=new WeakMap,eo=new WeakMap,_d=new WeakMap,da=new WeakMap,ms=new WeakMap,Ar=new WeakMap,vn=new WeakMap,ka=new WeakMap,Za=new WeakMap,ps=new WeakMap,Xt=new WeakMap,hn=new WeakMap,gr=new WeakMap,gs=new WeakMap,to=new WeakMap,kt=new WeakMap,qt=new WeakMap,ct=new WeakMap,Yt=new WeakMap,Gt=new WeakMap,Bd=new WeakMap,Zn=Symbol("placeholder"),Ad=Symbol("mark-placeholder"),ub=globalThis.Text,no=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,lb=e=>tn(e)&&e.nodeType===8,Ct=e=>tn(e)&&e.nodeType===1,tn=e=>{var t=no(e);return!!t&&e instanceof t.Node},vs=e=>{var t=e&&e.anchorNode&&no(e.anchorNode);return!!t&&e instanceof t.Selection},Fd=e=>tn(e)&&e.nodeType===3,cb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,db=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]=Td(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]},fb=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Td=(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]=Td(e,t,n);return r},Sd=e=>{var t="";if(Fd(e)&&e.nodeValue)return e.nodeValue;if(Ct(e)){for(var n of Array.from(e.childNodes))t+=Sd(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
|
|
103
|
-
`)}return t},
|
|
102
|
+
*/function Zo(e){return Object.prototype.toString.call(e)==="[object Object]"}function et(e){var t,n;return Zo(e)===!1?!1:(t=e.constructor,t===void 0?!0:(n=t.prototype,!(Zo(n)===!1||n.hasOwnProperty("isPrototypeOf")===!1)))}var id=Symbol.for("immer-nothing"),Yo=Symbol.for("immer-draftable"),gt=Symbol.for("immer-state"),Vm=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=Vm[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 Kn=Object.getPrototypeOf;function yn(e){return!!e&&!!e[gt]}function Dn(e){var t;return e?sd(e)||Array.isArray(e)||!!e[Yo]||!!((t=e.constructor)!=null&&t[Yo])||Ha(e)||Ua(e):!1}var Km=Object.prototype.constructor.toString();function sd(e){if(!e||typeof e!="object")return!1;const t=Kn(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)===Km}function Da(e,t){Wa(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Wa(e){const t=e[gt];return t?t.type_:Array.isArray(e)?1:Ha(e)?2:Ua(e)?3:0}function cs(e,t){return Wa(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function od(e,t,n){const r=Wa(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Zm(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Ha(e){return e instanceof Map}function Ua(e){return e instanceof Set}function cn(e){return e.copy_||e.base_}function ds(e,t){if(Ha(e))return new Map(e);if(Ua(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&sd(e))return Kn(e)?{...e}:Object.assign(Object.create(null),e);const n=Object.getOwnPropertyDescriptors(e);delete n[gt];let r=Reflect.ownKeys(n);for(let a=0;a<r.length;a++){const i=r[a],s=n[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(n[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Kn(e),n)}function Ks(e,t=!1){return Va(e)||yn(e)||!Dn(e)||(Wa(e)>1&&(e.set=e.add=e.clear=e.delete=Ym),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Ks(r,!0))),e}function Ym(){dt(2)}function Va(e){return Object.isFrozen(e)}var Gm={};function Cn(e){const t=Gm[e];return t||dt(0,e),t}var Er;function ud(){return Er}function Qm(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Go(e,t){t&&(Cn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fs(e){hs(e),e.drafts_.forEach(Jm),e.drafts_=null}function hs(e){e===Er&&(Er=e.parent_)}function Qo(e){return Er=Qm(Er,e)}function Jm(e){const t=e[gt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Jo(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[gt].modified_&&(fs(t),dt(4)),Dn(e)&&(e=Ca(t,e),t.parent_||xa(t,e)),t.patches_&&Cn("Patches").generateReplacementPatches_(n[gt].base_,e,t.patches_,t.inversePatches_)):e=Ca(t,n,[]),fs(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==id?e:void 0}function Ca(e,t,n){if(Va(t))return t;const r=t[gt];if(!r)return Da(t,(a,i)=>Xo(e,r,t,a,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return xa(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const a=r.copy_;let i=a,s=!1;r.type_===3&&(i=new Set(a),a.clear(),s=!0),Da(i,(o,l)=>Xo(e,r,a,o,l,n,s)),xa(e,a,!1),n&&e.patches_&&Cn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Xo(e,t,n,r,a,i,s){if(process.env.NODE_ENV!=="production"&&a===n&&dt(5),yn(a)){const o=i&&t&&t.type_!==3&&!cs(t.assigned_,r)?i.concat(r):void 0,l=Ca(e,a,o);if(od(n,r,l),yn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(a);if(Dn(a)&&!Va(a)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ca(e,a),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&xa(e,a)}}function xa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ks(t,n)}function Xm(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ud(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=r,i=Zs;n&&(a=[r],i=kr);const{revoke:s,proxy:o}=Proxy.revocable(a,i);return r.draft_=o,r.revoke_=s,o}var Zs={get(e,t){if(t===gt)return e;const n=cn(e);if(!cs(n,t))return ep(e,n,t);const r=n[t];return e.finalized_||!Dn(r)?r:r===di(e.base_,t)?(fi(e),e.copy_[t]=ps(r,e)):r},has(e,t){return t in cn(e)},ownKeys(e){return Reflect.ownKeys(cn(e))},set(e,t,n){const r=ld(cn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const a=di(cn(e),t),i=a==null?void 0:a[gt];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Zm(n,a)&&(n!==void 0||cs(e.base_,t)))return!0;fi(e),ms(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 di(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,fi(e),ms(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=cn(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 Kn(e.base_)},setPrototypeOf(){dt(12)}},kr={};Da(Zs,(e,t)=>{kr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});kr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&dt(13),kr.set.call(this,e,t,void 0)};kr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&dt(14),Zs.set.call(this,e[0],t,n,e[0])};function di(e,t){const n=e[gt];return(n?cn(n):e)[t]}function ep(e,t,n){var a;const r=ld(t,n);return r?"value"in r?r.value:(a=r.get)==null?void 0:a.call(e.draft_):void 0}function ld(e,t){if(!(t in e))return;let n=Kn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Kn(n)}}function ms(e){e.modified_||(e.modified_=!0,e.parent_&&ms(e.parent_))}function fi(e){e.copy_||(e.copy_=ds(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var tp=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(Dn(t)){const i=Qo(this),s=ps(t,void 0);let o=!0;try{a=n(s),o=!1}finally{o?fs(i):hs(i)}return Go(i,r),Jo(a,i)}else if(!t||typeof t!="object"){if(a=n(t),a===void 0&&(a=t),a===id&&(a=void 0),this.autoFreeze_&&Ks(a,!0),r){const i=[],s=[];Cn("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){Dn(e)||dt(8),yn(e)&&(e=np(e));const t=Qo(this),n=ps(e,void 0);return n[gt].isManual_=!0,hs(t),n}finishDraft(e,t){const n=e&&e[gt];(!n||!n.isManual_)&&dt(9);const{scope_:r}=n;return Go(r,t),Jo(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=Cn("Patches").applyPatches_;return yn(e)?r(e,t):this.produce(e,a=>r(a,t))}};function ps(e,t){const n=Ha(e)?Cn("MapSet").proxyMap_(e,t):Ua(e)?Cn("MapSet").proxySet_(e,t):Xm(e,t);return(t?t.scope_:ud()).drafts_.push(n),n}function np(e){return yn(e)||dt(10,e),cd(e)}function cd(e){if(!Dn(e)||Va(e))return e;const t=e[gt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ds(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ds(e,!0);return Da(n,(r,a)=>{od(n,r,cd(a))}),t&&(t.finalized_=!1),n}var vt=new tp,Ys=vt.produce;vt.produceWithPatches.bind(vt);vt.setAutoFreeze.bind(vt);vt.setUseStrictShallowCopy.bind(vt);vt.applyPatches.bind(vt);var eu=vt.createDraft.bind(vt),tu=vt.finishDraft.bind(vt),rp={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()}}},ap={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=we.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},ip={transform(e,t){var{current:n,affinity:r}=e;if(n!=null){var a=U.transform(n,t,{affinity:r});e.current=a,a==null&&e.unref()}}},wa=new WeakMap,Ea=new WeakMap,pr=new WeakMap,dd=new WeakMap,nu=new WeakMap,ru=new WeakMap,au=new WeakMap,P={ancestors(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=P.levels(e,t);return n?r=r.slice(1):r=r.slice(0,-1),r},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var a=e[r],i=t[r];if(a!==i)break;n.push(a)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i>s},endsAt(e,t){var n=e.length,r=e.slice(0,n),a=t.slice(0,n);return P.equals(r,a)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),a=t.slice(0,n),i=e[n],s=t[n];return P.equals(r,a)&&i<s},equals(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])},hasPrevious(e){return e[e.length-1]>0},isAfter(e,t){return P.compare(e,t)===1},isAncestor(e,t){return e.length<t.length&&P.compare(e,t)===0},isBefore(e,t){return P.compare(e,t)===-1},isChild(e,t){return e.length===t.length+1&&P.compare(e,t)===0},isCommon(e,t){return e.length<=t.length&&P.compare(e,t)===0},isDescendant(e,t){return e.length>t.length&&P.compare(e,t)===0},isParent(e,t){return e.length+1===t.length&&P.compare(e,t)===0},isPath(e){return Array.isArray(e)&&(e.length===0||typeof e[0]=="number")},isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1),a=e[e.length-1],i=t[t.length-1];return a!==i&&P.equals(n,r)},levels(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,r=[],a=0;a<=e.length;a++)r.push(e.slice(0,a));return n&&r.reverse(),r},next(e){if(e.length===0)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(e.length===0)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(e.length===0)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!P.isAncestor(t,e)&&!P.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:a="forward"}=n;if(e.length===0)return r;switch(t.type){case"insert_node":{var{path:i}=t;(P.equals(i,r)||P.endsBefore(i,r)||P.isAncestor(i,r))&&(r[i.length-1]+=1);break}case"remove_node":{var{path:s}=t;if(P.equals(s,r)||P.isAncestor(s,r))return null;P.endsBefore(s,r)&&(r[s.length-1]-=1);break}case"merge_node":{var{path:o,position:l}=t;P.equals(o,r)||P.endsBefore(o,r)?r[o.length-1]-=1:P.isAncestor(o,r)&&(r[o.length-1]-=1,r[o.length]+=l);break}case"split_node":{var{path:u,position:c}=t;if(P.equals(u,r)){if(a==="forward")r[r.length-1]+=1;else if(a!=="backward")return null}else P.endsBefore(u,r)?r[u.length-1]+=1:P.isAncestor(u,r)&&e[u.length]>=c&&(r[u.length-1]+=1,r[u.length]-=c);break}case"move_node":{var{path:m,newPath:h}=t;if(P.equals(m,h))return r;if(P.isAncestor(m,r)||P.equals(m,r)){var p=h.slice();return P.endsBefore(m,h)&&m.length<h.length&&(p[m.length-1]-=1),p.concat(r.slice(m.length))}else P.isSibling(m,h)&&(P.isAncestor(h,r)||P.equals(h,r))?P.endsBefore(m,r)?r[m.length-1]-=1:r[m.length-1]+=1:P.endsBefore(h,r)||P.equals(h,r)||P.isAncestor(h,r)?(P.endsBefore(m,r)&&(r[m.length-1]-=1),r[h.length-1]+=1):P.endsBefore(m,r)&&(P.equals(h,r)&&(r[h.length-1]+=1),r[m.length-1]-=1);break}}return r}};function _r(e){"@babel/helpers - typeof";return _r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_r(e)}function sp(e,t){if(_r(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(_r(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function op(e){var t=sp(e,"string");return _r(t)==="symbol"?t:String(t)}function ot(e,t,n){return t=op(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function or(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?iu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):iu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var up=(e,t,n)=>{switch(n.type){case"insert_node":{var{path:r,node:a}=n,i=ie.parent(e,r),s=r[r.length-1];if(s>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(s,0,a),t)for(var[o,l]of U.points(t))t[l]=we.transform(o,n);break}case"insert_text":{var{path:u,offset:c,text:m}=n;if(m.length===0)break;var h=ie.leaf(e,u),p=h.text.slice(0,c),g=h.text.slice(c);if(h.text=p+m+g,t)for(var[f,y]of U.points(t))t[y]=we.transform(f,n);break}case"merge_node":{var{path:b}=n,w=ie.get(e,b),A=P.previous(b),k=ie.get(e,A),E=ie.parent(e,b),T=b[b.length-1];if(de.isText(w)&&de.isText(k))k.text+=w.text;else if(!de.isText(w)&&!de.isText(k))k.children.push(...w.children);else throw new Error('Cannot apply a "merge_node" operation at path ['.concat(b,"] to nodes of different interfaces: ").concat(Je.stringify(w)," ").concat(Je.stringify(k)));if(E.children.splice(T,1),t)for(var[j,z]of U.points(t))t[z]=we.transform(j,n);break}case"move_node":{var{path:R,newPath:$}=n;if(P.isAncestor(R,$))throw new Error("Cannot move a path [".concat(R,"] to new path [").concat($,"] because the destination is inside itself."));var M=ie.get(e,R),x=ie.parent(e,R),B=R[R.length-1];x.children.splice(B,1);var F=P.transform(R,n),N=ie.get(e,P.parent(F)),L=F[F.length-1];if(N.children.splice(L,0,M),t)for(var[q,oe]of U.points(t))t[oe]=we.transform(q,n);break}case"remove_node":{var{path:ne}=n,D=ne[ne.length-1],H=ie.parent(e,ne);if(H.children.splice(D,1),t)for(var[X,_]of U.points(t)){var S=we.transform(X,n);if(t!=null&&S!=null)t[_]=S;else{var W=void 0,I=void 0;for(var[V,te]of ie.texts(e))if(P.compare(te,ne)===-1)W=[V,te];else{I=[V,te];break}var ee=!1;W&&I&&(P.equals(I[1],ne)?ee=!P.hasPrevious(I[1]):ee=P.common(W[1],ne).length<P.common(I[1],ne).length),W&&!ee?(X.path=W[1],X.offset=W[0].text.length):I?(X.path=I[1],X.offset=0):t=null}}break}case"remove_text":{var{path:ae,offset:fe,text:G}=n;if(G.length===0)break;var he=ie.leaf(e,ae),ge=he.text.slice(0,fe),Ee=he.text.slice(fe+G.length);if(he.text=ge+Ee,t)for(var[Oe,me]of U.points(t))t[me]=we.transform(Oe,n);break}case"set_node":{var{path:Pe,properties:He,newProperties:Ue}=n;if(Pe.length===0)throw new Error("Cannot set properties on the root node!");var Qe=ie.get(e,Pe);for(var Ae in Ue){if(Ae==="children"||Ae==="text")throw new Error('Cannot set the "'.concat(Ae,'" property of nodes!'));var ze=Ue[Ae];ze==null?delete Qe[Ae]:Qe[Ae]=ze}for(var We in He)Ue.hasOwnProperty(We)||delete Qe[We];break}case"set_selection":{var{newProperties:Z}=n;if(Z==null)t=Z;else{if(t==null){if(!U.isRange(Z))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(Je.stringify(Z)," when there is no current selection."));t=or({},Z)}for(var se in Z){var pe=Z[se];if(pe==null){if(se==="anchor"||se==="focus")throw new Error('Cannot remove the "'.concat(se,'" selection property'));delete t[se]}else t[se]=pe}}break}case"split_node":{var{path:be,position:xe,properties:Ye}=n;if(be.length===0)throw new Error('Cannot apply a "split_node" operation at path ['.concat(be,"] because the root node cannot be split."));var Ge=ie.get(e,be),mt=ie.parent(e,be),It=be[be.length-1],Et;if(de.isText(Ge)){var Xe=Ge.text.slice(0,xe),Bt=Ge.text.slice(xe);Ge.text=Xe,Et=or(or({},Ye),{},{text:Bt})}else{var pt=Ge.children.slice(0,xe),ti=Ge.children.slice(xe);Ge.children=pt,Et=or(or({},Ye),{},{children:ti})}if(mt.children.splice(It+1,0,Et),t)for(var[ar,Mr]of U.points(t))t[Mr]=we.transform(ar,n);break}}return t},lp={transform(e,t){e.children=eu(e.children);var n=e.selection&&eu(e.selection);try{n=up(e,n,t)}finally{e.children=tu(e.children),n?e.selection=yn(n)?tu(n):n:e.selection=null}}},cp={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)}},dp={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)}},fd=(e,t)=>{for(var n in e){var r=e[n],a=t[n];if(et(r)&&et(a)){if(!fd(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 fp(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Ut(e,t){if(e==null)return{};var n=fp(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 hp=["anchor","focus"];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 mp(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){ot(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 U={edges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:a}=e;return U.isBackward(e)===n?[r,a]:[a,r]},end(e){var[,t]=U.edges(e);return t},equals(e,t){return we.equals(e.anchor,t.anchor)&&we.equals(e.focus,t.focus)},includes(e,t){if(U.isRange(t)){if(U.includes(e,t.anchor)||U.includes(e,t.focus))return!0;var[n,r]=U.edges(e),[a,i]=U.edges(t);return we.isBefore(n,a)&&we.isAfter(r,i)}var[s,o]=U.edges(e),l=!1,u=!1;return we.isPoint(t)?(l=we.compare(t,s)>=0,u=we.compare(t,o)<=0):(l=P.compare(t,s.path)>=0,u=P.compare(t,o.path)<=0),l&&u},intersection(e,t){var n=Ut(e,hp),[r,a]=U.edges(e),[i,s]=U.edges(t),o=we.isBefore(r,i)?i:r,l=we.isBefore(a,s)?a:s;return we.isBefore(l,o)?null:mp({anchor:o,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return we.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return we.equals(t,n)},isExpanded(e){return!U.isCollapsed(e)},isForward(e){return!U.isBackward(e)},isRange(e){return et(e)&&we.isPoint(e.anchor)&&we.isPoint(e.focus)},*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=U.edges(e);return t},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ys(e,r=>{if(r===null)return null;var{affinity:a="inward"}=n,i,s;if(a==="inward"){var o=U.isCollapsed(r);U.isForward(r)?(i="forward",s=o?i:"backward"):(i="backward",s=o?i:"forward")}else a==="outward"?U.isForward(r)?(i="backward",s="forward"):(i="forward",s="backward"):(i=a,s=a);var l=we.transform(r.anchor,t,{affinity:i}),u=we.transform(r.focus,t,{affinity:s});if(!l||!u)return null;r.anchor=l,r.focus=u})}},ou=e=>et(e)&&ie.isNodeList(e.children)&&!v.isEditor(e),ce={isAncestor(e){return et(e)&&ie.isNodeList(e.children)},isElement:ou,isElementList(e){return Array.isArray(e)&&e.every(t=>ce.isElement(t))},isElementProps(e){return e.children!==void 0},isElementType:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"type";return ou(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"],gp=["text"],uu=new WeakMap,ie={ancestor(e,t){var n=ie.get(e,t);if(de.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(Je.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.ancestors(t,n)){var a=ie.ancestor(e,r),i=[a,r];yield i}}()},child(e,t){if(de.isText(e))throw new Error("Cannot get the child of a text node: ".concat(Je.stringify(e)));var n=e.children[t];if(n==null)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(Je.stringify(e)));return n},children(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,a=ie.ancestor(e,t),{children:i}=a,s=r?i.length-1:0;r?s>=0:s<i.length;){var o=ie.child(a,s),l=t.concat(s);yield[o,l],s=r?s-1:s+1}}()},common(e,t,n){var r=P.common(t,n),a=ie.get(e,r);return[a,r]},descendant(e,t){var n=ie.get(e,t);if(v.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(Je.stringify(n)));return n},descendants(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ie.nodes(e,t))r.length!==0&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ie.nodes(e,t))ce.isElement(n)&&(yield[n,r])}()},extractProps(e){if(ce.isAncestor(e)){var t=Ut(e,pp);return t}else{var t=Ut(e,gp);return t}},first(e,t){for(var n=t.slice(),r=ie.get(e,n);r&&!(de.isText(r)||r.children.length===0);)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(de.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(Je.stringify(e)));var n=Ys({children:e.children},r=>{var[a,i]=U.edges(t),s=ie.nodes(r,{reverse:!0,pass:h=>{var[,p]=h;return!U.includes(t,p)}});for(var[,o]of s){if(!U.includes(t,o)){var l=ie.parent(r,o),u=o[o.length-1];l.children.splice(u,1)}if(P.equals(o,i.path)){var c=ie.leaf(r,o);c.text=c.text.slice(0,i.offset)}if(P.equals(o,a.path)){var m=ie.leaf(r,o);m.text=m.text.slice(a.offset)}}v.isEditor(r)&&(r.selection=null)});return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(de.isText(n)||!n.children[a])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(Je.stringify(e)));n=n.children[a]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var a=t[r];if(de.isText(n)||!n.children[a])return!1;n=n.children[a]}return!0},isNode(e){return de.isText(e)||ce.isElement(e)||v.isEditor(e)},isNodeList(e){if(!Array.isArray(e))return!1;var t=uu.get(e);if(t!==void 0)return t;var n=e.every(r=>ie.isNode(r));return uu.set(e,n),n},last(e,t){for(var n=t.slice(),r=ie.get(e,n);r&&!(de.isText(r)||r.children.length===0);){var a=r.children.length-1;r=r.children[a],n.push(a)}return[r,n]},leaf(e,t){var n=ie.get(e,t);if(!de.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(Je.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){for(var r of P.levels(t,n)){var a=ie.get(e,r);yield[a,r]}}()},matches(e,t){return ce.isElement(e)&&ce.isElementProps(t)&&ce.matches(e,t)||de.isText(e)&&de.isTextProps(t)&&de.matches(e,t)},nodes(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:a=[],to:i}=t,s=new Set,o=[],l=e;!(i&&(r?P.isBefore(o,i):P.isAfter(o,i)));){if(s.has(l)||(yield[l,o]),!s.has(l)&&!de.isText(l)&&l.children.length!==0&&(n==null||n([l,o])===!1)){s.add(l);var u=r?l.children.length-1:0;P.isAncestor(o,a)&&(u=a[o.length]),o=o.concat(u),l=ie.get(e,o);continue}if(o.length===0)break;if(!r){var c=P.next(o);if(ie.has(e,c)){o=c,l=ie.get(e,o);continue}}if(r&&o[o.length-1]!==0){var m=P.previous(o);o=m,l=ie.get(e,o);continue}o=P.parent(o),l=ie.get(e,o),s.add(l)}}()},parent(e,t){var n=P.parent(t),r=ie.get(e,n);if(de.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string(e){return de.isText(e)?e.text:e.children.map(ie.string).join("")},texts(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){for(var[n,r]of ie.nodes(e,t))de.isText(n)&&(yield[n,r])}()}};function 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 $e(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){ot(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 Xt={isNodeOperation(e){return Xt.isOperation(e)&&e.type.endsWith("_node")},isOperation(e){if(!et(e))return!1;switch(e.type){case"insert_node":return P.isPath(e.path)&&ie.isNode(e.node);case"insert_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"merge_node":return typeof e.position=="number"&&P.isPath(e.path)&&et(e.properties);case"move_node":return P.isPath(e.path)&&P.isPath(e.newPath);case"remove_node":return P.isPath(e.path)&&ie.isNode(e.node);case"remove_text":return typeof e.offset=="number"&&typeof e.text=="string"&&P.isPath(e.path);case"set_node":return P.isPath(e.path)&&et(e.properties)&&et(e.newProperties);case"set_selection":return e.properties===null&&U.isRange(e.newProperties)||e.newProperties===null&&U.isRange(e.properties)||et(e.properties)&&et(e.newProperties);case"split_node":return P.isPath(e.path)&&typeof e.position=="number"&&et(e.properties);default:return!1}},isOperationList(e){return Array.isArray(e)&&e.every(t=>Xt.isOperation(t))},isSelectionOperation(e){return Xt.isOperation(e)&&e.type.endsWith("_selection")},isTextOperation(e){return Xt.isOperation(e)&&e.type.endsWith("_text")},inverse(e){switch(e.type){case"insert_node":return $e($e({},e),{},{type:"remove_node"});case"insert_text":return $e($e({},e),{},{type:"remove_text"});case"merge_node":return $e($e({},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 $e($e({},e),{},{path:t,newPath:n});var r=P.transform(n,e),a=P.transform(P.next(n),e);return $e($e({},e),{},{path:r,newPath:a})}case"remove_node":return $e($e({},e),{},{type:"insert_node"});case"remove_text":return $e($e({},e),{},{type:"insert_text"});case"set_node":{var{properties:i,newProperties:s}=e;return $e($e({},e),{},{properties:s,newProperties:i})}case"set_selection":{var{properties:o,newProperties:l}=e;return o==null?$e($e({},e),{},{properties:l,newProperties:null}):l==null?$e($e({},e),{},{properties:null,newProperties:o}):$e($e({},e),{},{properties:l,newProperties:o})}case"split_node":return $e($e({},e),{},{type:"merge_node",path:P.next(e.path)})}}},cu=new WeakMap,vp=e=>{var t=cu.get(e);if(t!==void 0)return t;if(!et(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||et(e.marks))&&(e.selection===null||U.isRange(e.selection))&&ie.isNodeList(e.children)&&Xt.isOperationList(e.operations);return cu.set(e,n),n},v={above(e,t){return e.above(t)},addMark(e,t,n){e.addMark(t,n)},after(e,t,n){return e.after(t,n)},before(e,t,n){return e.before(t,n)},deleteBackward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges(e,t){return e.edges(t)},elementReadOnly(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e.elementReadOnly(t)},end(e,t){return e.end(t)},first(e,t){return e.first(t)},fragment(e,t){return e.fragment(t)},hasBlocks(e,t){return e.hasBlocks(t)},hasInlines(e,t){return e.hasInlines(t)},hasPath(e,t){return e.hasPath(t)},hasTexts(e,t){return e.hasTexts(t)},insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock(e,t){return e.isBlock(t)},isEdge(e,t,n){return e.isEdge(t,n)},isEditor(e){return vp(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)}},bp={isSpan(e){return Array.isArray(e)&&e.length===2&&e.every(P.isPath)}};function du(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function fu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?du(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):du(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var we={compare(e,t){var n=P.compare(e.path,t.path);return n===0?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter(e,t){return we.compare(e,t)===1},isBefore(e,t){return we.compare(e,t)===-1},equals(e,t){return e.offset===t.offset&&P.equals(e.path,t.path)},isPoint(e){return et(e)&&typeof e.offset=="number"&&P.isPath(e.path)},transform(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Ys(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,fu(fu({},n),{},{affinity:"forward"})))}else r.path=P.transform(i,t,n);break}}})}},hu=void 0,Je={setScrubber(e){hu=e},stringify(e){return JSON.stringify(e,hu)}},yp=["text"],Dp=["anchor","focus"];function mu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Lt(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){ot(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 de={equals(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{loose:r=!1}=n;function a(i){var s=Ut(i,yp);return s}return fd(r?a(e):e,r?a(t):t)},isText(e){return et(e)&&typeof e.text=="string"},isTextList(e){return Array.isArray(e)&&e.every(t=>de.isText(t))},isTextProps(e){return e.text!==void 0},matches(e,t){for(var n in t)if(n!=="text"&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[Lt({},e)];for(var r of t){var a=Ut(r,Dp),[i,s]=U.edges(r),o=[],l=0,u=i.offset,c=s.offset;for(var m of n){var{length:h}=m.text,p=l;if(l+=h,u<=p&&l<=c){Object.assign(m,a),o.push(m);continue}if(u!==c&&(u===l||c===p)||u>l||c<p||c===p&&p!==0){o.push(m);continue}var g=m,f=void 0,y=void 0;if(c<l){var b=c-p;y=Lt(Lt({},g),{},{text:g.text.slice(b)}),g=Lt(Lt({},g),{},{text:g.text.slice(0,b)})}if(u>p){var w=u-p;f=Lt(Lt({},g),{},{text:g.text.slice(0,w)}),g=Lt(Lt({},g),{},{text:g.text.slice(w)})}Object.assign(g,a),f&&o.push(f),o.push(g),y&&o.push(y)}n=o}return n}},Gs=e=>e.selection?e.selection:e.children.length>0?v.end(e,[]):[0],rr=(e,t)=>{var[n]=v.node(e,t);return r=>r===n},Qs=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=!n,a=n?_p(t):t,i=Ce.None,s=Ce.None,o=0,l=null,u=null;for(var c of a){var m=c.codePointAt(0);if(!m)break;var h=Ip(c,m);if([i,s]=r?[s,h]:[h,i],Mn(i,Ce.ZWJ)&&Mn(s,Ce.ExtPict)&&(r?l=pu(t.substring(0,o)):l=pu(t.substring(0,t.length-o)),!l)||Mn(i,Ce.RI)&&Mn(s,Ce.RI)&&(u!==null?u=!u:r?u=!0:u=Wp(t.substring(0,t.length-o)),!u)||i!==Ce.None&&s!==Ce.None&&Lp(i,s))break;o+=c.length}return o||1},Cp=/\s/,xp=/[\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]/,wp=/['\u2018\u2019]/,Ep=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=0,a=!1;t.length>0;){var i=Qs(t,n),[s,o]=Js(t,i,n);if(kp(s,o,n))a=!0,r+=i;else if(!a)r+=i;else break;t=o}return r},Js=(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)]},kp=function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(Cp.test(t))return!1;if(wp.test(t)){var a=Qs(n,r),[i,s]=Js(n,a,r);if(e(i,s,r))return!0}return!xp.test(t)},_p=function*(t){for(var n=t.length-1,r=0;r<t.length;r++){var a=t.charAt(n-r);if(Ap(a.charCodeAt(0))){var i=t.charAt(n-r-1);if(Bp(i.charCodeAt(0))){yield i+a,r++;continue}}yield a}},Bp=e=>e>=55296&&e<=56319,Ap=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 Fp=/^(?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0902\u093A\u093C\u0941-\u0948\u094D\u0951-\u0957\u0962\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01\u0A02\u0A3C\u0A41\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81\u0A82\u0ABC\u0AC1-\u0AC5\u0AC7\u0AC8\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C04\u0C3C\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00\u0D01\u0D3B\u0D3C\u0D3E\u0D41-\u0D44\u0D4D\u0D57\u0D62\u0D63\u0D81\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039\u103A\u103D\u103E\u1058\u1059\u105E-\u1060\u1071-\u1074\u1082\u1085\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732\u1733\u1752\u1753\u1772\u1773\u17B4\u17B5\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193B\u1A17\u1A18\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ACE\u1B00-\u1B03\u1B34-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80\u1B81\u1BA2-\u1BA5\u1BA8\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8\u1BE9\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8\u1CF9\u1DC0-\u1DFF\u200C\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA825\uA826\uA82C\uA8C4\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC\uA9BD\uA9E5\uAA29-\uAA2E\uAA31\uAA32\uAA35\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEC\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDEAB\uDEAC\uDEFD-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC01\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC81\uDCB3-\uDCB6\uDCB9\uDCBA\uDCC2\uDD00-\uDD02\uDD27-\uDD2B\uDD2D-\uDD34\uDD73\uDD80\uDD81\uDDB6-\uDDBE\uDDC9-\uDDCC\uDDCF\uDE2F-\uDE31\uDE34\uDE36\uDE37\uDE3E\uDE41\uDEDF\uDEE3-\uDEEA\uDF00\uDF01\uDF3B\uDF3C\uDF3E\uDF40\uDF57\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC38-\uDC3F\uDC42-\uDC44\uDC46\uDC5E\uDCB0\uDCB3-\uDCB8\uDCBA\uDCBD\uDCBF\uDCC0\uDCC2\uDCC3\uDDAF\uDDB2-\uDDB5\uDDBC\uDDBD\uDDBF\uDDC0\uDDDC\uDDDD\uDE33-\uDE3A\uDE3D\uDE3F\uDE40\uDEAB\uDEAD\uDEB0-\uDEB5\uDEB7\uDF1D-\uDF1F\uDF22-\uDF25\uDF27-\uDF2B]|\uD806[\uDC2F-\uDC37\uDC39\uDC3A\uDD30\uDD3B\uDD3C\uDD3E\uDD43\uDDD4-\uDDD7\uDDDA\uDDDB\uDDE0\uDE01-\uDE0A\uDE33-\uDE38\uDE3B-\uDE3E\uDE47\uDE51-\uDE56\uDE59-\uDE5B\uDE8A-\uDE96\uDE98\uDE99]|\uD807[\uDC30-\uDC36\uDC38-\uDC3D\uDC3F\uDC92-\uDCA7\uDCAA-\uDCB0\uDCB2\uDCB3\uDCB5\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD90\uDD91\uDD95\uDD97\uDEF3\uDEF4\uDF00\uDF01\uDF36-\uDF3A\uDF40\uDF42]|\uD80D[\uDC40\uDC47-\uDC55]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF4F\uDF8F-\uDF92\uDFE4]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65\uDD67-\uDD69\uDD6E-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF])$/,Tp=/^(?:[\u0600-\u0605\u06DD\u070F\u0890\u0891\u08E2\u0D4E]|\uD804[\uDCBD\uDCCD\uDDC2\uDDC3]|\uD806[\uDD3F\uDD41\uDE3A\uDE84-\uDE89]|\uD807\uDD46)$/,Sp=/^(?:[\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])$/,jp=/^[\u1100-\u115F\uA960-\uA97C]$/,Op=/^[\u1160-\u11A7\uD7B0-\uD7C6]$/,Pp=/^[\u11A8-\u11FF\uD7CB-\uD7FB]$/,Np=/^[\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]$/,Rp=/^[\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]$/,Mp=/^(?:[\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])$/,Ip=(e,t)=>{var n=Ce.Any;return e.search(Fp)!==-1&&(n|=Ce.Extend),t===8205&&(n|=Ce.ZWJ),t>=127462&&t<=127487&&(n|=Ce.RI),e.search(Tp)!==-1&&(n|=Ce.Prepend),e.search(Sp)!==-1&&(n|=Ce.SpacingMark),e.search(jp)!==-1&&(n|=Ce.L),e.search(Op)!==-1&&(n|=Ce.V),e.search(Pp)!==-1&&(n|=Ce.T),e.search(Np)!==-1&&(n|=Ce.LV),e.search(Rp)!==-1&&(n|=Ce.LVT),e.search(Mp)!==-1&&(n|=Ce.ExtPict),n};function Mn(e,t){return(e&t)!==0}var $p=[[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 Lp(e,t){return $p.findIndex(n=>Mn(e,n[0])&&Mn(t,n[1]))===-1}var zp=/(?:[\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$/,pu=e=>e.search(zp)!==-1,qp=/(?:\uD83C[\uDDE6-\uDDFF])+$/g,Wp=e=>{var t=e.match(qp);if(t===null)return!1;var n=t[0].length/2;return n%2===1},Hp={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:a=Gs(e)}=n;if(P.isPath(a)&&(a=v.range(e,a)),U.isRange(a))if(U.isCollapsed(a))a=a.anchor;else{var i=U.end(a);if(!r&&v.void(e,{at:i}))return;var s=U.start(a),o=v.pointRef(e,s),l=v.pointRef(e,i);Q.delete(e,{at:a,voids:r});var u=o.unref(),c=l.unref();a=u||c,Q.setSelection(e,{anchor:a,focus:a})}if(!(!r&&v.void(e,{at:a})||v.elementReadOnly(e,{at:a}))){var{path:m,offset:h}=a;t.length>0&&e.apply({type:"insert_text",path:m,offset:h,text:t})}})}};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 qr(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){ot(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 Q=qr(qr(qr(qr({},lp),cp),dp),Hp),ua=new WeakMap,Up=e=>ua.get(e)||!1,Vp=(e,t,n)=>{var r=ua.get(e)||!1;ua.set(e,!0);try{t(),n()}finally{ua.set(e,r)}};function hd(e,t,n){var r=wa.get(e)||[],a=Ea.get(e)||new Set,i,s,o=m=>{if(m){var h=m.join(",");s.has(h)||(s.add(h),i.push(m))}};if(n){i=[],s=new Set;for(var l of r){var u=n(l);o(u)}}else i=r,s=a;for(var c of t)o(c);wa.set(e,i),Ea.set(e,s)}var Kp=(e,t)=>{for(var n of v.pathRefs(e))rp.transform(n,t);for(var r of v.pointRefs(e))ap.transform(r,t);for(var a of v.rangeRefs(e))ip.transform(a,t);if(!Up(e)){var i=P.operationCanTransformPath(t)?s=>P.transform(s,t):void 0;hd(e,e.getDirtyPaths(t),i)}Q.transform(e,t),e.operations.push(t),v.normalize(e,{operation:t}),t.type==="set_selection"&&(e.marks=null),pr.get(e)||(pr.set(e,!0),Promise.resolve().then(()=>{pr.set(e,!1),e.onChange({operation:t}),e.operations=[]}))},Zp=(e,t)=>{switch(t.type){case"insert_text":case"remove_text":case"set_node":{var{path:n}=t;return P.levels(n)}case"insert_node":{var{node:r,path:a}=t,i=P.levels(a),s=de.isText(r)?[]:Array.from(ie.nodes(r),$=>{var[,M]=$;return a.concat(M)});return[...i,...s]}case"merge_node":{var{path:o}=t,l=P.ancestors(o),u=P.previous(o);return[...l,u]}case"move_node":{var{path:c,newPath:m}=t;if(P.equals(c,m))return[];var h=[],p=[];for(var g of P.ancestors(c)){var f=P.transform(g,t);h.push(f)}for(var y of P.ancestors(m)){var b=P.transform(y,t);p.push(b)}var w=p[p.length-1],A=m[m.length-1],k=w.concat(A);return[...h,...p,k]}case"remove_node":{var{path:E}=t,T=P.ancestors(E);return[...T]}case"split_node":{var{path:j}=t,z=P.levels(j),R=P.next(j);return[...z,R]}default:return[]}},Yp=e=>{var{selection:t}=e;return t?ie.fragment(e,t):[]},Gp=(e,t)=>{var[n,r]=t;if(!de.isText(n)){if(ce.isElement(n)&&n.children.length===0){var a={text:""};Q.insertNodes(e,a,{at:r.concat(0),voids:!0});return}for(var i=v.isEditor(n)?!1:ce.isElement(n)&&(e.isInline(n)||n.children.length===0||de.isText(n.children[0])||e.isInline(n.children[0])),s=0,o=0;o<n.children.length;o++,s++){var l=ie.get(e,r);if(!de.isText(l)){var u=l.children[s],c=l.children[s-1],m=o===n.children.length-1,h=de.isText(u)||ce.isElement(u)&&e.isInline(u);if(h!==i)Q.removeNodes(e,{at:r.concat(s),voids:!0}),s--;else if(ce.isElement(u)){if(e.isInline(u)){if(c==null||!de.isText(c)){var p={text:""};Q.insertNodes(e,p,{at:r.concat(s),voids:!0}),s++}else if(m){var g={text:""};Q.insertNodes(e,g,{at:r.concat(s+1),voids:!0}),s++}}}else c!=null&&de.isText(c)&&(de.equals(u,c,{loose:!0})?(Q.mergeNodes(e,{at:r.concat(s),voids:!0}),s--):c.text===""?(Q.removeNodes(e,{at:r.concat(s-1),voids:!0}),s--):u.text===""&&(Q.removeNodes(e,{at:r.concat(s),voids:!0}),s--))}}}},Qp=(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},Jp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{voids:r=!1,mode:a="lowest",at:i=t.selection,match:s}=n;if(i){var o=v.path(t,i),l=a==="lowest";for(var[u,c]of v.levels(t,{at:o,voids:r,match:s,reverse:l}))if(!de.isText(u)){if(U.isRange(i)){if(P.isAncestor(c,i.anchor.path)&&P.isAncestor(c,i.focus.path))return[u,c]}else if(!P.equals(o,c))return[u,c]}}};function vu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function bu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Xp=(e,t,n)=>{var{selection:r}=e;if(r){var a=(m,h)=>{if(!de.isText(m))return!1;var[p,g]=v.parent(e,h);return!e.isVoid(p)||e.markableVoid(p)},i=U.isExpanded(r),s=!1;if(!i){var[o,l]=v.node(e,r);if(o&&a(o,l)){var[u]=v.parent(e,l);s=u&&e.markableVoid(u)}}if(i||s)Q.setNodes(e,{[t]:n},{match:a,split:!0,voids:!0});else{var c=bu(bu({},v.marks(e)||{}),{},{[t]:n});e.marks=c,pr.get(e)||e.onChange()}}};function yu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Du(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var eg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.point(t,n,{edge:"end"}),i=v.end(t,[]),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of v.positions(t,Du(Du({},r),{},{at:s}))){if(l>o)break;l!==0&&(u=c),l++}return u};function Cu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function xu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var tg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.start(t,[]),i=v.point(t,n,{edge:"start"}),s={anchor:a,focus:i},{distance:o=1}=r,l=0,u;for(var c of v.positions(t,xu(xu({},r),{},{at:s,reverse:!0}))){if(l>o)break;l!==0&&(u=c),l++}return u},ng=(e,t)=>{var{selection:n}=e;n&&U.isCollapsed(n)&&Q.delete(e,{unit:t,reverse:!0})},rg=(e,t)=>{var{selection:n}=e;n&&U.isCollapsed(n)&&Q.delete(e,{unit:t})},ag=function(t){var{direction:n="forward"}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{selection:r}=t;r&&U.isExpanded(r)&&Q.delete(t,{reverse:n==="backward"})},ig=(e,t)=>[v.start(e,t),v.end(e,t)];function wu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Eu(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?wu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var sg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return v.above(t,Eu(Eu({},n),{},{match:r=>ce.isElement(r)&&v.isElementReadOnly(t,r)}))},og=(e,t)=>v.point(e,t,{edge:"end"}),ug=(e,t)=>{var n=v.path(e,t,{edge:"start"});return v.node(e,n)},lg=(e,t)=>{var n=v.range(e,t);return ie.fragment(e,n)};function ku(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function _u(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ku(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ku(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var cg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return v.above(t,_u(_u({},n),{},{match:r=>ce.isElement(r)&&v.isVoid(t,r)}))},dg=(e,t)=>t.children.some(n=>ce.isElement(n)&&v.isBlock(e,n)),fg=(e,t)=>t.children.some(n=>de.isText(n)||v.isInline(e,n)),hg=(e,t)=>ie.has(e,t),mg=(e,t)=>t.children.every(n=>de.isText(n)),pg=e=>{Q.splitNodes(e,{always:!0})},gg=(e,t,n)=>{Q.insertNodes(e,t,n)},vg=e=>{Q.splitNodes(e,{always:!0})};function Bu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function bg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Bu(Object(n),!0).forEach(function(r){ot(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var yg=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=bg({text:n},i);Q.insertNodes(t,s,{at:r.at,voids:r.voids})}else Q.insertText(t,n,r);t.marks=null}},Dg=(e,t)=>!e.isInline(t),Cg=(e,t,n)=>v.isStart(e,t,n)||v.isEnd(e,t,n),xg=(e,t)=>{var{children:n}=t,[r]=n;return n.length===0||n.length===1&&de.isText(r)&&r.text===""&&!e.isVoid(t)},wg=(e,t,n)=>{var r=v.end(e,n);return we.equals(t,r)},Eg=e=>{var t=dd.get(e);return t===void 0?!0:t},kg=(e,t,n)=>{if(t.offset!==0)return!1;var r=v.start(e,n);return we.equals(t,r)},_g=(e,t)=>{var n=v.path(e,t,{edge:"end"});return v.node(e,n)},Bg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.path(t,n,r),i=ie.leaf(t,a);return[i,a]};function Ag(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,reverse:r=!1,voids:a=!1}=t,{match:i}=t;if(i==null&&(i=()=>!0),!!n){var s=[],o=v.path(e,n);for(var[l,u]of ie.levels(e,o))if(i(l,u)&&(s.push([l,u]),!a&&ce.isElement(l)&&v.isVoid(e,l)))break;r&&s.reverse(),yield*s}}()}var Fg=["text"],Tg=["text"],Sg=function(t){var{marks:n,selection:r}=t;if(!r)return null;var{anchor:a,focus:i}=r;if(n)return n;if(U.isExpanded(r)){var s=v.isEnd(t,a,a.path);if(s){var o=v.after(t,a);o&&(a=o)}var[l]=v.nodes(t,{match:de.isText,at:{anchor:a,focus:i}});if(l){var[u]=l,c=Ut(u,Fg);return c}else return{}}var{path:m}=a,[h]=v.leaf(t,m);if(a.offset===0){var p=v.previous(t,{at:m,match:de.isText}),g=v.above(t,{match:k=>ce.isElement(k)&&v.isVoid(t,k)&&t.markableVoid(k)});if(!g){var f=v.above(t,{match:k=>ce.isElement(k)&&v.isBlock(t,k)});if(p&&f){var[y,b]=p,[,w]=f;P.isAncestor(w,b)&&(h=y)}}}var A=Ut(h,Tg);return A},jg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=v.after(t,s,{voids:a});if(o){var[,l]=v.last(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the next node from the root node!");if(i==null)if(P.isPath(s)){var[c]=v.parent(t,s);i=h=>c.children.includes(h)}else i=()=>!0;var[m]=v.nodes(t,{at:u,match:i,mode:r,voids:a});return m}}},Og=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.path(t,n,r),i=ie.get(t,a);return[i,a]};function Pg(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(bp.isSpan(n))u=n[0],c=n[1];else{var m=v.path(e,n,{edge:"start"}),h=v.path(e,n,{edge:"end"});u=i?h:m,c=i?m:h}var p=ie.nodes(e,{reverse:i,from:u,to:c,pass:k=>{var[E]=k;return ce.isElement(E)?!!(!s&&(v.isVoid(e,E)||v.isElementReadOnly(e,E))||o&&!v.isSelectable(e,E)):!1}}),g=[],f;for(var[y,b]of p)if(!(o&&ce.isElement(y)&&!v.isSelectable(e,y))){var w=f&&P.compare(b,f[1])===0;if(!(r==="highest"&&w)){if(!l(y,b)){if(a&&!w&&de.isText(y))return;continue}if(r==="lowest"&&w){f=[y,b];continue}var A=r==="lowest"?f:[y,b];A&&(a?g.push(A):yield A),f=[y,b]}}r==="lowest"&&f&&(a?g.push(f):yield f),a&&(yield*g)}}()}var Ng=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{force:r=!1,operation:a}=n,i=c=>wa.get(c)||[],s=c=>Ea.get(c)||new Set,o=c=>{var m=i(c).pop(),h=m.join(",");return s(c).delete(h),m};if(v.isNormalizing(t)){if(r){var l=Array.from(ie.nodes(t),c=>{var[,m]=c;return m}),u=new Set(l.map(c=>c.join(",")));wa.set(t,l),Ea.set(t,u)}i(t).length!==0&&v.withoutNormalizing(t,()=>{for(var c of i(t))if(ie.has(t,c)){var m=v.node(t,c),[h,p]=m;ce.isElement(h)&&h.children.length===0&&t.normalizeNode(m,{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 b=o(t);if(ie.has(t,b)){var w=v.node(t,b);t.normalizeNode(w,{operation:a})}y++,g=i(t)}})}},Rg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=v.path(t,n,r),i=P.parent(a),s=v.node(t,i);return s},Mg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=v.pathRefs(t);return l.delete(i),i.current=null,o}},s=v.pathRefs(t);return s.add(i),i},Ig=e=>{var t=nu.get(e);return t||(t=new Set,nu.set(e,t)),t},$g=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{depth:a,edge:i}=r;if(P.isPath(n)){if(i==="start"){var[,s]=ie.first(t,n);n=s}else if(i==="end"){var[,o]=ie.last(t,n);n=o}}return U.isRange(n)&&(i==="start"?n=U.start(n):i==="end"?n=U.end(n):n=P.common(n.anchor.path,n.focus.path)),we.isPoint(n)&&(n=n.path),a!=null&&(n=n.slice(0,a)),n},Lg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=v.pointRefs(t);return l.delete(i),i.current=null,o}},s=v.pointRefs(t);return s.add(i),i},zg=e=>{var t=ru.get(e);return t||(t=new Set,ru.set(e,t)),t},qg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{edge:a="start"}=r;if(P.isPath(n)){var i;if(a==="end"){var[,s]=ie.last(t,n);i=s}else{var[,o]=ie.first(t,n);i=o}var l=ie.get(t,i);if(!de.isText(l))throw new Error("Cannot get the ".concat(a," point in the node at path [").concat(n,"] because it has no ").concat(a," text node."));return{path:i,offset:a==="end"?l.text.length:0}}if(U.isRange(n)){var[u,c]=U.edges(n);return a==="start"?u:c}return n};function Wg(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){var{at:n=e.selection,unit:r="offset",reverse:a=!1,voids:i=!1,ignoreNonSelectable:s=!1}=t;if(!n)return;var o=v.range(e,n),[l,u]=U.edges(o),c=a?u:l,m=!1,h="",p=0,g=0,f=0;for(var[y,b]of v.nodes(e,{at:n,reverse:a,voids:i,ignoreNonSelectable:s})){if(ce.isElement(y)){if(!i&&(e.isVoid(y)||e.isElementReadOnly(y))){yield v.start(e,b);continue}if(e.isInline(y))continue;if(v.hasInlines(e,y)){var w=P.isAncestor(b,u.path)?u:v.end(e,b),A=P.isAncestor(b,l.path)?l:v.start(e,b);h=v.string(e,{anchor:A,focus:w},{voids:i}),m=!0}}if(de.isText(y)){var k=P.equals(b,c.path);for(k?(g=a?c.offset:y.text.length-c.offset,f=c.offset):(g=y.text.length,f=a?g:0),(k||m||r==="offset")&&(yield{path:b,offset:f},m=!1);;){if(p===0){if(h==="")break;p=E(h,r,a),h=Js(h,p,a)[1]}if(f=a?f-p:f+p,g=g-p,g<0){p=-g;break}p=0,yield{path:b,offset:f}}}}function E(T,j,z){return j==="character"?Qs(T,z):j==="word"?Ep(T,z):j==="line"||j==="block"?T.length:1}}()}var Hg=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection}=n;if(s){var o=v.before(t,s,{voids:a});if(o){var[,l]=v.first(t,[]),u=[o.path,l];if(P.isPath(s)&&s.length===0)throw new Error("Cannot get the previous node from the root node!");if(i==null)if(P.isPath(s)){var[c]=v.parent(t,s);i=h=>c.children.includes(h)}else i=()=>!0;var[m]=v.nodes(t,{reverse:!0,at:u,match:i,mode:r,voids:a});return m}}},Ug=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{affinity:a="forward"}=r,i={current:n,affinity:a,unref(){var{current:o}=i,l=v.rangeRefs(t);return l.delete(i),i.current=null,o}},s=v.rangeRefs(t);return s.add(i),i},Vg=e=>{var t=au.get(e);return t||(t=new Set,au.set(e,t)),t},Kg=(e,t,n)=>{if(U.isRange(t)&&!n)return t;var r=v.start(e,t),a=v.end(e,n||t);return{anchor:r,focus:a}};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 Zg(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){ot(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 Yg=(e,t)=>{var{selection:n}=e;if(n){var r=(c,m)=>{if(!de.isText(c))return!1;var[h,p]=v.parent(e,m);return!e.isVoid(h)||e.markableVoid(h)},a=U.isExpanded(n),i=!1;if(!a){var[s,o]=v.node(e,n);if(s&&r(s,o)){var[l]=v.parent(e,o);i=l&&e.markableVoid(l)}}if(a||i)Q.unsetNodes(e,t,{match:r,split:!0,voids:!0});else{var u=Zg({},v.marks(e)||{});delete u[t],e.marks=u,pr.get(e)||e.onChange()}}},Gg=(e,t)=>{dd.set(e,t)},Qg=(e,t)=>v.point(e,t,{edge:"start"}),Jg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,i=v.range(t,n),[s,o]=U.edges(i),l="";for(var[u,c]of v.nodes(t,{at:i,match:de.isText,voids:a})){var m=u.text;P.equals(c,o.path)&&(m=m.slice(0,o.offset)),P.equals(c,s.path)&&(m=m.slice(s.offset)),l+=m}return l},Xg=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{voids:a=!1}=r,[i,s]=U.edges(n);if(i.offset!==0||s.offset!==0||U.isCollapsed(n)||P.hasPrevious(s.path))return n;var o=v.above(t,{at:s,match:g=>ce.isElement(g)&&v.isBlock(t,g),voids:a}),l=o?o[1]:[],u=v.start(t,i),c={anchor:u,focus:s},m=!0;for(var[h,p]of v.nodes(t,{at:c,match:de.isText,reverse:!0,voids:a})){if(m){m=!1;continue}if(h.text!==""||P.isBefore(p,l)){s={path:p,offset:h.text.length};break}}return{anchor:i,focus:s}},ev=(e,t)=>{var n=v.isNormalizing(e);v.setNormalizing(e,!1);try{t()}finally{v.setNormalizing(e,n)}v.normalize(e)},tv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.withoutNormalizing(t,()=>{var r,a,{reverse:i=!1,unit:s="character",distance:o=1,voids:l=!1}=n,{at:u=t.selection,hanging:c=!1}=n;if(u){var m=!1;if(U.isRange(u)&&U.isCollapsed(u)&&(m=!0,u=u.anchor),we.isPoint(u)){var h=v.void(t,{at:u,mode:"highest"});if(!l&&h){var[,p]=h;u=p}else{var g={unit:s,distance:o},f=i?v.before(t,u,g)||v.start(t,[]):v.after(t,u,g)||v.end(t,[]);u={anchor:u,focus:f},c=!0}}if(P.isPath(u)){Q.removeNodes(t,{at:u,voids:l});return}if(!U.isCollapsed(u)){if(!c){var[,y]=U.edges(u),b=v.end(t,[]);we.equals(y,b)||(u=v.unhangRange(t,u,{voids:l}))}var[w,A]=U.edges(u),k=v.above(t,{match:ge=>ce.isElement(ge)&&v.isBlock(t,ge),at:w,voids:l}),E=v.above(t,{match:ge=>ce.isElement(ge)&&v.isBlock(t,ge),at:A,voids:l}),T=k&&E&&!P.equals(k[1],E[1]),j=P.equals(w.path,A.path),z=l?null:(r=v.void(t,{at:w,mode:"highest"}))!==null&&r!==void 0?r:v.elementReadOnly(t,{at:w,mode:"highest"}),R=l?null:(a=v.void(t,{at:A,mode:"highest"}))!==null&&a!==void 0?a:v.elementReadOnly(t,{at:A,mode:"highest"});if(z){var $=v.before(t,w);$&&k&&P.isAncestor(k[1],$.path)&&(w=$)}if(R){var M=v.after(t,A);M&&E&&P.isAncestor(E[1],M.path)&&(A=M)}var x=[],B;for(var F of v.nodes(t,{at:u,voids:l})){var[N,L]=F;B&&P.compare(L,B)===0||(!l&&ce.isElement(N)&&(v.isVoid(t,N)||v.isElementReadOnly(t,N))||!P.isCommon(L,w.path)&&!P.isCommon(L,A.path))&&(x.push(F),B=L)}var q=Array.from(x,ge=>{var[,Ee]=ge;return v.pathRef(t,Ee)}),oe=v.pointRef(t,w),ne=v.pointRef(t,A),D="";if(!j&&!z){var H=oe.current,[X]=v.leaf(t,H),{path:_}=H,{offset:S}=w,W=X.text.slice(S);W.length>0&&(t.apply({type:"remove_text",path:_,offset:S,text:W}),D=W)}if(q.reverse().map(ge=>ge.unref()).filter(ge=>ge!==null).forEach(ge=>Q.removeNodes(t,{at:ge,voids:l})),!R){var I=ne.current,[V]=v.leaf(t,I),{path:te}=I,ee=j?w.offset:0,ae=V.text.slice(ee,A.offset);ae.length>0&&(t.apply({type:"remove_text",path:te,offset:ee,text:ae}),D=ae)}!j&&T&&ne.current&&oe.current&&Q.mergeNodes(t,{at:ne.current,hanging:!0,voids:l}),m&&i&&s==="character"&&D.length>1&&D.match(/[\u0E00-\u0E7F]+/)&&Q.insertText(t,D.slice(0,D.length-o));var fe=oe.unref(),G=ne.unref(),he=i?fe||G:G||fe;n.at==null&&he&&Q.select(t,he)}}})},nv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1}=r,{at:s=Gs(t),batchDirty:o=!0}=r;if(n.length){if(U.isRange(s))if(a||(s=v.unhangRange(t,s,{voids:i})),U.isCollapsed(s))s=s.anchor;else{var[,l]=U.edges(s);if(!i&&v.void(t,{at:l}))return;var u=v.pointRef(t,l);Q.delete(t,{at:s}),s=u.unref()}else P.isPath(s)&&(s=v.start(t,s));if(!(!i&&v.void(t,{at:s}))){var c=v.above(t,{at:s,match:W=>ce.isElement(W)&&v.isInline(t,W),mode:"highest",voids:i});if(c){var[,m]=c;if(v.isEnd(t,s,m)){var h=v.after(t,m);s=h}else if(v.isStart(t,s,m)){var p=v.before(t,m);s=p}}var g=v.above(t,{match:W=>ce.isElement(W)&&v.isBlock(t,W),at:s,voids:i}),[,f]=g,y=v.isStart(t,s,f),b=v.isEnd(t,s,f),w=y&&b,A=!y||y&&b,k=!b,[,E]=ie.first({children:n},[]),[,T]=ie.last({children:n},[]),j=[],z=W=>{var[I,V]=W,te=V.length===0;return te?!1:w?!0:!(A&&P.isAncestor(V,E)&&ce.isElement(I)&&!t.isVoid(I)&&!t.isInline(I)||k&&P.isAncestor(V,T)&&ce.isElement(I)&&!t.isVoid(I)&&!t.isInline(I))};for(var R of ie.nodes({children:n},{pass:z}))z(R)&&j.push(R);var $=[],M=[],x=[],B=!0,F=!1;for(var[N]of j)ce.isElement(N)&&!t.isInline(N)?(B=!1,F=!0,M.push(N)):B?$.push(N):x.push(N);var[L]=v.nodes(t,{at:s,match:W=>de.isText(W)||v.isInline(t,W),mode:"highest",voids:i}),[,q]=L,oe=v.isStart(t,s,q),ne=v.isEnd(t,s,q),D=v.pathRef(t,b&&!x.length?P.next(f):f),H=v.pathRef(t,ne?P.next(q):q);Q.splitNodes(t,{at:s,match:W=>F?ce.isElement(W)&&v.isBlock(t,W):de.isText(W)||v.isInline(t,W),mode:F?"lowest":"highest",always:F&&(!y||$.length>0)&&(!b||x.length>0),voids:i});var X=v.pathRef(t,!oe||oe&&ne?P.next(q):q);if(Q.insertNodes(t,$,{at:X.current,match:W=>de.isText(W)||v.isInline(t,W),mode:"highest",voids:i,batchDirty:o}),w&&!$.length&&M.length&&!x.length&&Q.delete(t,{at:f,voids:i}),Q.insertNodes(t,M,{at:D.current,match:W=>ce.isElement(W)&&v.isBlock(t,W),mode:"lowest",voids:i,batchDirty:o}),Q.insertNodes(t,x,{at:H.current,match:W=>de.isText(W)||v.isInline(t,W),mode:"highest",voids:i,batchDirty:o}),!r.at){var _;if(x.length>0&&H.current?_=P.previous(H.current):M.length>0&&D.current?_=P.previous(D.current):X.current&&(_=P.previous(X.current)),_){var S=v.end(t,_);Q.select(t,S)}}X.unref(),D.unref(),H.unref()}}})},rv=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]=U.edges(a);Q.select(t,i)}else if(r==="end"){var[,s]=U.edges(a);Q.select(t,s)}}else return},av=e=>{var{selection:t}=e;t&&e.apply({type:"set_selection",properties:t,newProperties:null})},iv=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=U.isBackward(r)?"focus":"anchor"),o==="end"&&(o=U.isBackward(r)?"anchor":"focus");var{anchor:l,focus:u}=r,c={distance:a,unit:i,ignoreNonSelectable:!0},m={};if(o==null||o==="anchor"){var h=s?v.before(t,l,c):v.after(t,l,c);h&&(m.anchor=h)}if(o==null||o==="focus"){var p=s?v.before(t,u,c):v.after(t,u,c);p&&(m.focus=p)}Q.setSelection(t,m)}},sv=(e,t)=>{var{selection:n}=e;if(t=v.range(e,t),n){Q.setSelection(e,t);return}if(!U.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(Je.stringify(t)));e.apply({type:"set_selection",properties:n,newProperties:t})};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 Tu(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){ot(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 ov=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{selection:a}=t,{edge:i="both"}=r;if(a){i==="start"&&(i=U.isBackward(a)?"focus":"anchor"),i==="end"&&(i=U.isBackward(a)?"anchor":"focus");var{anchor:s,focus:o}=a,l=i==="anchor"?s:o;Q.setSelection(t,{[i==="anchor"?"anchor":"focus"]:Tu(Tu({},l),n)})}},uv=(e,t)=>{var{selection:n}=e,r={},a={};if(n){for(var i in t)(i==="anchor"&&t.anchor!=null&&!we.equals(t.anchor,n.anchor)||i==="focus"&&t.focus!=null&&!we.equals(t.focus,n.focus)||i!=="anchor"&&i!=="focus"&&t[i]!==n[i])&&(r[i]=n[i],a[i]=t[i]);Object.keys(r).length>0&&e.apply({type:"set_selection",properties:r,newProperties:a})}},lv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.withoutNormalizing(t,()=>{var{hanging:a=!1,voids:i=!1,mode:s="lowest",batchDirty:o=!0}=r,{at:l,match:u,select:c}=r;if(ie.isNode(n)&&(n=[n]),n.length!==0){var[m]=n;if(l||(l=Gs(t),c!==!1&&(c=!0)),c==null&&(c=!1),U.isRange(l))if(a||(l=v.unhangRange(t,l,{voids:i})),U.isCollapsed(l))l=l.anchor;else{var[,h]=U.edges(l),p=v.pointRef(t,h);Q.delete(t,{at:l}),l=p.unref()}if(we.isPoint(l)){u==null&&(de.isText(m)?u=$=>de.isText($):t.isInline(m)?u=$=>de.isText($)||v.isInline(t,$):u=$=>ce.isElement($)&&v.isBlock(t,$));var[g]=v.nodes(t,{at:l.path,match:u,mode:s,voids:i});if(g){var[,f]=g,y=v.pathRef(t,f),b=v.isEnd(t,l,f);Q.splitNodes(t,{at:l,match:u,mode:s,voids:i});var w=y.unref();l=b?P.next(w):w}else return}var A=P.parent(l),k=l[l.length-1];if(!(!i&&v.void(t,{at:A}))){if(o){var E=[],T=P.levels(A);Vp(t,()=>{var $=function(){var B=A.concat(k);k++;var F={type:"insert_node",path:B,node:M};t.apply(F),l=P.next(l),E.push(F),de.isText?T.push(...Array.from(ie.nodes(M),N=>{var[,L]=N;return B.concat(L)})):T.push(B)};for(var M of n)$()},()=>{hd(t,T,$=>{var M=$;for(var x of E)if(P.operationCanTransformPath(x)&&(M=P.transform(M,x),!M))return null;return M})})}else for(var j of n){var z=A.concat(k);k++,t.apply({type:"insert_node",path:z,node:j}),l=P.next(l)}if(l=P.previous(l),c){var R=v.end(t,l);R&&Q.select(t,R)}}}})},cv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.withoutNormalizing(t,()=>{var{at:r=t.selection,mode:a="lowest",voids:i=!1}=n,{match:s}=n;if(s==null&&(s=P.isPath(r)?rr(t,r):k=>ce.isElement(k)&&v.isBlock(t,k)),!!r){var o=v.nodes(t,{at:r,match:s,mode:a,voids:i}),l=Array.from(o,k=>{var[,E]=k;return v.pathRef(t,E)});for(var u of l){var c=u.unref();if(c.length<2)throw new Error("Cannot lift node at a path [".concat(c,"] because it has a depth of less than `2`."));var m=v.node(t,P.parent(c)),[h,p]=m,g=c[c.length-1],{length:f}=h.children;if(f===1){var y=P.next(p);Q.moveNodes(t,{at:c,to:y,voids:i}),Q.removeNodes(t,{at:p,voids:i})}else if(g===0)Q.moveNodes(t,{at:c,to:p,voids:i});else if(g===f-1){var b=P.next(p);Q.moveNodes(t,{at:c,to:b,voids:i})}else{var w=P.next(c),A=P.next(p);Q.splitNodes(t,{at:w,voids:i}),Q.moveNodes(t,{at:c,to:A,voids:i})}}}})},dv=["text"],fv=["children"],md=(e,t)=>{if(ce.isElement(t)){var n=t;return v.isVoid(e,t)?!0:n.children.length===1?md(e,n.children[0]):!1}else return!v.isEditor(t)},hv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.withoutNormalizing(t,()=>{var{match:r,at:a=t.selection}=n,{hanging:i=!1,voids:s=!1,mode:o="lowest"}=n;if(a){if(r==null)if(P.isPath(a)){var[l]=v.parent(t,a);r=$=>l.children.includes($)}else r=$=>ce.isElement($)&&v.isBlock(t,$);if(!i&&U.isRange(a)&&(a=v.unhangRange(t,a,{voids:s})),U.isRange(a))if(U.isCollapsed(a))a=a.anchor;else{var[,u]=U.edges(a),c=v.pointRef(t,u);Q.delete(t,{at:a}),a=c.unref(),n.at==null&&Q.select(t,a)}var[m]=v.nodes(t,{at:a,match:r,voids:s,mode:o}),h=v.previous(t,{at:a,match:r,voids:s,mode:o});if(!(!m||!h)){var[p,g]=m,[f,y]=h;if(!(g.length===0||y.length===0)){var b=P.next(y),w=P.common(g,y),A=P.isSibling(g,y),k=Array.from(v.levels(t,{at:g}),$=>{var[M]=$;return M}).slice(w.length).slice(0,-1),E=v.above(t,{at:g,mode:"highest",match:$=>k.includes($)&&md(t,$)}),T=E&&v.pathRef(t,E[1]),j,z;if(de.isText(p)&&de.isText(f)){var R=Ut(p,dv);z=f.text.length,j=R}else if(ce.isElement(p)&&ce.isElement(f)){var R=Ut(p,fv);z=f.children.length,j=R}else throw new Error("Cannot merge the node at path [".concat(g,"] with the previous sibling because it is not the same kind: ").concat(Je.stringify(p)," ").concat(Je.stringify(f)));A||Q.moveNodes(t,{at:g,to:b,voids:s}),T&&Q.removeNodes(t,{at:T.current,voids:s}),ce.isElement(f)&&v.isEmpty(t,f)||de.isText(f)&&f.text===""&&y[y.length-1]!==0?Q.removeNodes(t,{at:y,voids:s}):t.apply({type:"merge_node",path:b,position:z,properties:j}),T&&T.unref()}}}})},mv=(e,t)=>{v.withoutNormalizing(e,()=>{var{to:n,at:r=e.selection,mode:a="lowest",voids:i=!1}=t,{match:s}=t;if(r){s==null&&(s=P.isPath(r)?rr(e,r):p=>ce.isElement(p)&&v.isBlock(e,p));var o=v.pathRef(e,n),l=v.nodes(e,{at:r,match:s,mode:a,voids:i}),u=Array.from(l,p=>{var[,g]=p;return v.pathRef(e,g)});for(var c of u){var m=c.unref(),h=o.current;m.length!==0&&e.apply({type:"move_node",path:m,newPath:h}),o.current&&P.isSibling(h,m)&&P.isAfter(h,m)&&(o.current=P.next(o.current))}o.unref()}})},pv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.withoutNormalizing(t,()=>{var{hanging:r=!1,voids:a=!1,mode:i="lowest"}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=P.isPath(s)?rr(t,s):p=>ce.isElement(p)&&v.isBlock(t,p)),!r&&U.isRange(s)&&(s=v.unhangRange(t,s,{voids:a}));var l=v.nodes(t,{at:s,match:o,mode:i,voids:a}),u=Array.from(l,p=>{var[,g]=p;return v.pathRef(t,g)});for(var c of u){var m=c.unref();if(m){var[h]=v.node(t,m);t.apply({type:"remove_node",path:m,node:h})}}}})},gv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.withoutNormalizing(t,()=>{var{match:a,at:i=t.selection,compare:s,merge:o}=r,{hanging:l=!1,mode:u="lowest",split:c=!1,voids:m=!1}=r;if(i){if(a==null&&(a=P.isPath(i)?rr(t,i):z=>ce.isElement(z)&&v.isBlock(t,z)),!l&&U.isRange(i)&&(i=v.unhangRange(t,i,{voids:m})),c&&U.isRange(i)){if(U.isCollapsed(i)&&v.leaf(t,i.anchor)[0].text.length>0)return;var h=v.rangeRef(t,i,{affinity:"inward"}),[p,g]=U.edges(i),f=u==="lowest"?"lowest":"highest",y=v.isEnd(t,g,g.path);Q.splitNodes(t,{at:g,match:a,mode:f,voids:m,always:!y});var b=v.isStart(t,p,p.path);Q.splitNodes(t,{at:p,match:a,mode:f,voids:m,always:!b}),i=h.unref(),r.at==null&&Q.select(t,i)}s||(s=(z,R)=>z!==R);for(var[w,A]of v.nodes(t,{at:i,match:a,mode:u,voids:m})){var k={},E={};if(A.length!==0){var T=!1;for(var j in n)j==="children"||j==="text"||s(n[j],w[j])&&(T=!0,w.hasOwnProperty(j)&&(k[j]=w[j]),o?n[j]!=null&&(E[j]=o(w[j],n[j])):n[j]!=null&&(E[j]=n[j]));T&&t.apply({type:"set_node",path:A,properties:k,newProperties:E})}}}})},vv=(e,t)=>{if(U.isCollapsed(t))return t.anchor;var[,n]=U.edges(t),r=v.pointRef(e,n);return Q.delete(e,{at:t}),r.unref()},bv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.withoutNormalizing(t,()=>{var{mode:r="lowest",voids:a=!1}=n,{match:i,at:s=t.selection,height:o=0,always:l=!1}=n;if(i==null&&(i=ne=>ce.isElement(ne)&&v.isBlock(t,ne)),U.isRange(s)&&(s=vv(t,s)),P.isPath(s)){var u=s,c=v.point(t,u),[m]=v.parent(t,u);i=ne=>ne===m,o=c.path.length-u.length+1,s=c,l=!0}if(s){var h=v.pointRef(t,s,{affinity:"backward"}),p;try{var[g]=v.nodes(t,{at:s,match:i,mode:r,voids:a});if(!g)return;var f=v.void(t,{at:s,mode:"highest"}),y=0;if(!a&&f){var[b,w]=f;if(ce.isElement(b)&&t.isInline(b)){var A=v.after(t,w);if(!A){var k={text:""},E=P.next(w);Q.insertNodes(t,k,{at:E,voids:a}),A=v.point(t,E)}s=A,l=!0}var T=s.path.length-w.length;o=T+1,l=!0}p=v.pointRef(t,s);var j=s.path.length-o,[,z]=g,R=s.path.slice(0,j),$=o===0?s.offset:s.path[j]+y;for(var[M,x]of v.levels(t,{at:R,reverse:!0,voids:a})){var B=!1;if(x.length<z.length||x.length===0||!a&&ce.isElement(M)&&v.isVoid(t,M))break;var F=h.current,N=v.isEnd(t,F,x);if(l||!h||!v.isEdge(t,F,x)){B=!0;var L=ie.extractProps(M);t.apply({type:"split_node",path:x,position:$,properties:L})}$=x[x.length-1]+(B||N?1:0)}if(n.at==null){var q=p.current||v.end(t,[]);Q.select(t,q)}}finally{var oe;h.unref(),(oe=p)===null||oe===void 0||oe.unref()}}})},yv=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)},Dv=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};v.withoutNormalizing(t,()=>{var{mode:r="lowest",split:a=!1,voids:i=!1}=n,{at:s=t.selection,match:o}=n;if(s){o==null&&(o=P.isPath(s)?rr(t,s):p=>ce.isElement(p)&&v.isBlock(t,p)),P.isPath(s)&&(s=v.range(t,s));var l=U.isRange(s)?v.rangeRef(t,s):null,u=v.nodes(t,{at:s,match:o,mode:r,voids:i}),c=Array.from(u,p=>{var[,g]=p;return v.pathRef(t,g)}).reverse(),m=function(){var g=h.unref(),[f]=v.node(t,g),y=v.range(t,g);a&&l&&(y=U.intersection(l.current,y)),Q.liftNodes(t,{at:y,match:b=>ce.isAncestor(f)&&f.children.includes(b),voids:i})};for(var h of c)m();l&&l.unref()}})};function Su(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ju(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Su(Object(n),!0).forEach(function(r){ot(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 Cv=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};v.withoutNormalizing(t,()=>{var{mode:a="lowest",split:i=!1,voids:s=!1}=r,{match:o,at:l=t.selection}=r;if(l){if(o==null&&(P.isPath(l)?o=rr(t,l):t.isInline(n)?o=y=>ce.isElement(y)&&v.isInline(t,y)||de.isText(y):o=y=>ce.isElement(y)&&v.isBlock(t,y)),i&&U.isRange(l)){var[u,c]=U.edges(l),m=v.rangeRef(t,l,{affinity:"inward"});Q.splitNodes(t,{at:c,match:o,voids:s}),Q.splitNodes(t,{at:u,match:o,voids:s}),l=m.unref(),r.at==null&&Q.select(t,l)}var h=Array.from(v.nodes(t,{at:l,match:t.isInline(n)?y=>ce.isElement(y)&&v.isBlock(t,y):y=>v.isEditor(y),mode:"lowest",voids:s})),p=function(){var b=U.isRange(l)?U.intersection(l,v.range(t,f)):l;if(!b)return 0;var w=Array.from(v.nodes(t,{at:b,match:o,mode:a,voids:s}));if(w.length>0){var[A]=w,k=w[w.length-1],[,E]=A,[,T]=k;if(E.length===0&&T.length===0)return 0;var j=P.equals(E,T)?P.parent(E):P.common(E,T),z=v.range(t,E,T),R=v.node(t,j),[$]=R,M=j.length+1,x=P.next(T.slice(0,M)),B=ju(ju({},n),{},{children:[]});Q.insertNodes(t,B,{at:x,voids:s}),Q.moveNodes(t,{at:z,match:F=>ce.isAncestor($)&&$.children.includes(F),to:x.concat(0),voids:s})}},g;for(var[,f]of h)g=p()}})},xv=()=>{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 Kp(e,...r)},addMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xp(e,...r)},deleteBackward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ng(e,...r)},deleteForward:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rg(e,...r)},deleteFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ag(e,...r)},getFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yp(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 vg(e,...r)},insertFragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return nv(e,...r)},insertNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gg(e,...r)},insertText:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yg(e,...r)},normalizeNode:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gp(e,...r)},removeMark:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Yg(e,...r)},getDirtyPaths:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Zp(e,...r)},shouldNormalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qp(e,...r)},above:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jp(e,...r)},after:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return eg(e,...r)},before:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tg(e,...r)},collapse:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return rv(e,...r)},delete:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return tv(e,...r)},deselect:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return av(e,...r)},edges:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ig(e,...r)},elementReadOnly:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return sg(e,...r)},end:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return og(e,...r)},first:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ug(e,...r)},fragment:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lg(e,...r)},getMarks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Sg(e,...r)},hasBlocks:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return dg(e,...r)},hasInlines:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return fg(e,...r)},hasPath:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hg(e,...r)},hasTexts:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mg(e,...r)},insertNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return lv(e,...r)},isBlock:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dg(e,...r)},isEdge:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cg(e,...r)},isEmpty:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return xg(e,...r)},isEnd:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return wg(e,...r)},isNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Eg(e,...r)},isStart:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return kg(e,...r)},last:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return _g(e,...r)},leaf:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Bg(e,...r)},levels:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ag(e,...r)},liftNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cv(e,...r)},mergeNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return hv(e,...r)},move:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return iv(e,...r)},moveNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return mv(e,...r)},next:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return jg(e,...r)},node:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Og(e,...r)},nodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Pg(e,...r)},normalize:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ng(e,...r)},parent:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Rg(e,...r)},path:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return $g(e,...r)},pathRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Mg(e,...r)},pathRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ig(e,...r)},point:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return qg(e,...r)},pointRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Lg(e,...r)},pointRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return zg(e,...r)},positions:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Wg(e,...r)},previous:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Hg(e,...r)},range:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Kg(e,...r)},rangeRef:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Ug(e,...r)},rangeRefs:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Vg(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 sv(e,...r)},setNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return gv(e,...r)},setNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Gg(e,...r)},setPoint:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ov(e,...r)},setSelection:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return uv(e,...r)},splitNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return bv(e,...r)},start:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Qg(e,...r)},string:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Jg(e,...r)},unhangRange:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Xg(e,...r)},unsetNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return yv(e,...r)},unwrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Dv(e,...r)},void:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return cg(e,...r)},withoutNormalizing:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return ev(e,...r)},wrapNodes:function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return Cv(e,...r)}};return e},wv={isHistory(e){return et(e)&&Array.isArray(e.redos)&&Array.isArray(e.undos)&&(e.redos.length===0||Xt.isOperationList(e.redos[0].operations))&&(e.undos.length===0||Xt.isOperationList(e.undos[0].operations))}},hi=new WeakMap,mi=new WeakMap,In={isHistoryEditor(e){return wv.isHistory(e.history)&&v.isEditor(e)},isMerging(e){return mi.get(e)},isSaving(e){return hi.get(e)},redo(e){e.redo()},undo(e){e.undo()},withoutMerging(e,t){var n=In.isMerging(e);mi.set(e,!1),t(),mi.set(e,n)},withoutSaving(e,t){var n=In.isSaving(e);hi.set(e,!1),t(),hi.set(e,n)}},Ev=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),In.withoutSaving(t,()=>{v.withoutNormalizing(t,()=>{for(var s of i.operations)t.apply(s)})}),r.redos.pop(),t.writeHistory("undos",i)}},t.undo=()=>{var{history:r}=t,{undos:a}=r;if(a.length>0){var i=a[a.length-1];In.withoutSaving(t,()=>{v.withoutNormalizing(t,()=>{var s=i.operations.map(Xt.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=In.isSaving(t),c=In.isMerging(t);if(u==null&&(u=_v(r)),u){if(c==null&&(o==null?c=!1:a.length!==0?c=!0:c=kv(r,l)),o&&c)o.operations.push(r);else{var m={operations:[r],selectionBefore:t.selection};t.writeHistory("undos",m)}for(;s.length>100;)s.shift();i.redos=[]}n(r)},t.writeHistory=(r,a)=>{t.history[r].push(a)},t},kv=(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)),_v=(e,t)=>e.type!=="set_selection",Bv=Tv,pd="֑-߿יִ-﷽ﹰ-ﻼ",gd="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",Av=new RegExp("^[^"+gd+"]*["+pd+"]"),Fv=new RegExp("^[^"+pd+"]*["+gd+"]");function Tv(e){return e=String(e||""),Av.test(e)?"rtl":Fv.test(e)?"ltr":"neutral"}const vd=wn(Bv);function Sv(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Xs=Sv,jv=typeof Ir=="object"&&Ir&&Ir.Object===Object&&Ir,Ov=jv,Pv=Ov,Nv=typeof self=="object"&&self&&self.Object===Object&&self,Rv=Pv||Nv||Function("return this")(),bd=Rv,Mv=bd,Iv=function(){return Mv.Date.now()},$v=Iv,Lv=/\s/;function zv(e){for(var t=e.length;t--&&Lv.test(e.charAt(t)););return t}var qv=zv,Wv=qv,Hv=/^\s+/;function Uv(e){return e&&e.slice(0,Wv(e)+1).replace(Hv,"")}var Vv=Uv,Kv=bd,Zv=Kv.Symbol,yd=Zv,Ou=yd,Dd=Object.prototype,Yv=Dd.hasOwnProperty,Gv=Dd.toString,ur=Ou?Ou.toStringTag:void 0;function Qv(e){var t=Yv.call(e,ur),n=e[ur];try{e[ur]=void 0;var r=!0}catch{}var a=Gv.call(e);return r&&(t?e[ur]=n:delete e[ur]),a}var Jv=Qv,Xv=Object.prototype,e0=Xv.toString;function t0(e){return e0.call(e)}var n0=t0,Pu=yd,r0=Jv,a0=n0,i0="[object Null]",s0="[object Undefined]",Nu=Pu?Pu.toStringTag:void 0;function o0(e){return e==null?e===void 0?s0:i0:Nu&&Nu in Object(e)?r0(e):a0(e)}var u0=o0;function l0(e){return e!=null&&typeof e=="object"}var c0=l0,d0=u0,f0=c0,h0="[object Symbol]";function m0(e){return typeof e=="symbol"||f0(e)&&d0(e)==h0}var p0=m0,g0=Vv,Ru=Xs,v0=p0,Mu=0/0,b0=/^[-+]0x[0-9a-f]+$/i,y0=/^0b[01]+$/i,D0=/^0o[0-7]+$/i,C0=parseInt;function x0(e){if(typeof e=="number")return e;if(v0(e))return Mu;if(Ru(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ru(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=g0(e);var n=y0.test(e);return n||D0.test(e)?C0(e.slice(2),n?2:8):b0.test(e)?Mu:+e}var w0=x0,E0=Xs,pi=$v,Iu=w0,k0="Expected a function",_0=Math.max,B0=Math.min;function A0(e,t,n){var r,a,i,s,o,l,u=0,c=!1,m=!1,h=!0;if(typeof e!="function")throw new TypeError(k0);t=Iu(t)||0,E0(n)&&(c=!!n.leading,m="maxWait"in n,i=m?_0(Iu(n.maxWait)||0,t):i,h="trailing"in n?!!n.trailing:h);function p(T){var j=r,z=a;return r=a=void 0,u=T,s=e.apply(z,j),s}function g(T){return u=T,o=setTimeout(b,t),c?p(T):s}function f(T){var j=T-l,z=T-u,R=t-j;return m?B0(R,i-z):R}function y(T){var j=T-l,z=T-u;return l===void 0||j>=t||j<0||m&&z>=i}function b(){var T=pi();if(y(T))return w(T);o=setTimeout(b,f(T))}function w(T){return o=void 0,h&&r?p(T):(r=a=void 0,s)}function A(){o!==void 0&&clearTimeout(o),u=0,r=l=a=o=void 0}function k(){return o===void 0?s:w(pi())}function E(){var T=pi(),j=y(T);if(r=arguments,a=this,l=T,j){if(o===void 0)return g(l);if(m)return clearTimeout(o),o=setTimeout(b,t),p(l)}return o===void 0&&(o=setTimeout(b,t)),s}return E.cancel=A,E.flush=k,E}var Cd=A0;const F0=wn(Cd);var T0=Cd,S0=Xs,j0="Expected a function";function O0(e,t,n){var r=!0,a=!0;if(typeof e!="function")throw new TypeError(j0);return S0(n)&&(r="leading"in n?!!n.leading:r,a="trailing"in n?!!n.trailing:a),T0(e,t,{leading:r,maxWait:t,trailing:a})}var P0=O0;const N0=wn(P0),$u=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Lu=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",gi=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Lu(n.overflowY,t)||Lu(n.overflowX,t)||(r=>{const a=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!a&&(a.clientHeight<r.scrollHeight||a.clientWidth<r.scrollWidth)})(e)}return!1},Wr=(e,t,n,r,a,i,s,o)=>i<e&&s>t||i>e&&s<t?0:i<=e&&o<=n||s>=t&&o>=n?i-e-r:s>t&&o<n||i<e&&o>n?s-t+a:0,R0=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},zu=(e,t)=>{var n,r,a,i;if(typeof document>"u")return[];const{scrollMode:s,block:o,inline:l,boundary:u,skipOverflowHiddenElements:c}=t,m=typeof u=="function"?u:L=>L!==u;if(!$u(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let g=e;for(;$u(g)&&m(g);){if(g=R0(g),g===h){p.push(g);break}g!=null&&g===document.body&&gi(g)&&!gi(document.documentElement)||g!=null&&gi(g,c)&&p.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:b,scrollY:w}=window,{height:A,width:k,top:E,right:T,bottom:j,left:z}=e.getBoundingClientRect(),{top:R,right:$,bottom:M,left:x}=(L=>{const q=window.getComputedStyle(L);return{top:parseFloat(q.scrollMarginTop)||0,right:parseFloat(q.scrollMarginRight)||0,bottom:parseFloat(q.scrollMarginBottom)||0,left:parseFloat(q.scrollMarginLeft)||0}})(e);let B=o==="start"||o==="nearest"?E-R:o==="end"?j+M:E+A/2-R+M,F=l==="center"?z+k/2-x+$:l==="end"?T+$:z-x;const N=[];for(let L=0;L<p.length;L++){const q=p[L],{height:oe,width:ne,top:D,right:H,bottom:X,left:_}=q.getBoundingClientRect();if(s==="if-needed"&&E>=0&&z>=0&&j<=y&&T<=f&&E>=D&&j<=X&&z>=_&&T<=H)return N;const S=getComputedStyle(q),W=parseInt(S.borderLeftWidth,10),I=parseInt(S.borderTopWidth,10),V=parseInt(S.borderRightWidth,10),te=parseInt(S.borderBottomWidth,10);let ee=0,ae=0;const fe="offsetWidth"in q?q.offsetWidth-q.clientWidth-W-V:0,G="offsetHeight"in q?q.offsetHeight-q.clientHeight-I-te:0,he="offsetWidth"in q?q.offsetWidth===0?0:ne/q.offsetWidth:0,ge="offsetHeight"in q?q.offsetHeight===0?0:oe/q.offsetHeight:0;if(h===q)ee=o==="start"?B:o==="end"?B-y:o==="nearest"?Wr(w,w+y,y,I,te,w+B,w+B+A,A):B-y/2,ae=l==="start"?F:l==="center"?F-f/2:l==="end"?F-f:Wr(b,b+f,f,W,V,b+F,b+F+k,k),ee=Math.max(0,ee+w),ae=Math.max(0,ae+b);else{ee=o==="start"?B-D-I:o==="end"?B-X+te+G:o==="nearest"?Wr(D,X,oe,I,te+G,B,B+A,A):B-(D+oe/2)+G/2,ae=l==="start"?F-_-W:l==="center"?F-(_+ne/2)+fe/2:l==="end"?F-H+V+fe:Wr(_,H,ne,W,V+fe,F,F+k,k);const{scrollLeft:Ee,scrollTop:Oe}=q;ee=ge===0?0:Math.max(0,Math.min(Oe+ee/ge,q.scrollHeight-oe/ge+G)),ae=he===0?0:Math.max(0,Math.min(Ee+ae/he,q.scrollWidth-ne/he+fe)),B+=Oe-ee,F+=Ee-ae}N.push({el:q,top:ee,left:ae})}return N},M0=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function I0(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(zu(e,t));const r=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:a,top:i,left:s}of zu(e,M0(t))){const o=i-n.top+n.bottom,l=s-n.left+n.right;a.scroll({top:o,left:l,behavior:r})}}var gn=[],$0=function(){return gn.some(function(e){return e.activeTargets.length>0})},L0=function(){return gn.some(function(e){return e.skippedTargets.length>0})},qu="ResizeObserver loop completed with undelivered notifications.",z0=function(){var e;typeof ErrorEvent=="function"?e=new ErrorEvent("error",{message:qu}):(e=document.createEvent("Event"),e.initEvent("error",!1,!1),e.message=qu),window.dispatchEvent(e)},Br;(function(e){e.BORDER_BOX="border-box",e.CONTENT_BOX="content-box",e.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Br||(Br={}));var vn=function(e){return Object.freeze(e)},q0=function(){function e(t,n){this.inlineSize=t,this.blockSize=n,vn(this)}return e}(),xd=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,vn(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}(),eo=function(e){return e instanceof SVGElement&&"getBBox"in e},wd=function(e){if(eo(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)},Wu=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)},W0=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},gr=typeof window<"u"?window:{},Hr=new WeakMap,Hu=/auto|scroll/,H0=/^tb|vertical/,U0=/msie|trident/i.test(gr.navigator&&gr.navigator.userAgent),At=function(e){return parseFloat(e||"0")},qn=function(e,t,n){return e===void 0&&(e=0),t===void 0&&(t=0),n===void 0&&(n=!1),new q0((n?t:e)||0,(n?e:t)||0)},Uu=vn({devicePixelContentBoxSize:qn(),borderBoxSize:qn(),contentBoxSize:qn(),contentRect:new xd(0,0,0,0)}),Ed=function(e,t){if(t===void 0&&(t=!1),Hr.has(e)&&!t)return Hr.get(e);if(wd(e))return Hr.set(e,Uu),Uu;var n=getComputedStyle(e),r=eo(e)&&e.ownerSVGElement&&e.getBBox(),a=!U0&&n.boxSizing==="border-box",i=H0.test(n.writingMode||""),s=!r&&Hu.test(n.overflowY||""),o=!r&&Hu.test(n.overflowX||""),l=r?0:At(n.paddingTop),u=r?0:At(n.paddingRight),c=r?0:At(n.paddingBottom),m=r?0:At(n.paddingLeft),h=r?0:At(n.borderTopWidth),p=r?0:At(n.borderRightWidth),g=r?0:At(n.borderBottomWidth),f=r?0:At(n.borderLeftWidth),y=m+u,b=l+c,w=f+p,A=h+g,k=o?e.offsetHeight-A-e.clientHeight:0,E=s?e.offsetWidth-w-e.clientWidth:0,T=a?y+w:0,j=a?b+A:0,z=r?r.width:At(n.width)-T-E,R=r?r.height:At(n.height)-j-k,$=z+y+E+w,M=R+b+k+A,x=vn({devicePixelContentBoxSize:qn(Math.round(z*devicePixelRatio),Math.round(R*devicePixelRatio),i),borderBoxSize:qn($,M,i),contentBoxSize:qn(z,R,i),contentRect:new xd(m,l,z,R)});return Hr.set(e,x),x},kd=function(e,t,n){var r=Ed(e,n),a=r.borderBoxSize,i=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Br.DEVICE_PIXEL_CONTENT_BOX:return s;case Br.BORDER_BOX:return a;default:return i}},V0=function(){function e(t){var n=Ed(t);this.target=t,this.contentRect=n.contentRect,this.borderBoxSize=vn([n.borderBoxSize]),this.contentBoxSize=vn([n.contentBoxSize]),this.devicePixelContentBoxSize=vn([n.devicePixelContentBoxSize])}return e}(),_d=function(e){if(wd(e))return 1/0;for(var t=0,n=e.parentNode;n;)t+=1,n=n.parentNode;return t},K0=function(){var e=1/0,t=[];gn.forEach(function(s){if(s.activeTargets.length!==0){var o=[];s.activeTargets.forEach(function(u){var c=new V0(u.target),m=_d(u.target);o.push(c),u.lastReportedSize=kd(u.target,u.observedBox),m<e&&(e=m)}),t.push(function(){s.callback.call(s.observer,o,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var n=0,r=t;n<r.length;n++){var a=r[n];a()}return e},Vu=function(e){gn.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))})})},Z0=function(){var e=0;for(Vu(e);$0();)e=K0(),Vu(e);return L0()&&z0(),e>0},vi,Bd=[],Y0=function(){return Bd.splice(0).forEach(function(e){return e()})},G0=function(e){if(!vi){var t=0,n=document.createTextNode(""),r={characterData:!0};new MutationObserver(function(){return Y0()}).observe(n,r),vi=function(){n.textContent="".concat(t?t--:t++)}}Bd.push(e),vi()},Q0=function(e){G0(function(){requestAnimationFrame(e)})},la=0,J0=function(){return!!la},X0=250,eb={attributes:!0,characterData:!0,childList:!0,subtree:!0},Ku=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],Zu=function(e){return e===void 0&&(e=0),Date.now()+e},bi=!1,tb=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=X0),!bi){bi=!0;var r=Zu(t);Q0(function(){var a=!1;try{a=Z0()}finally{if(bi=!1,t=r-Zu(),!J0())return;a?n.run(1e3):t>0?n.run(t):n.start()}})}},e.prototype.schedule=function(){this.stop(),this.run()},e.prototype.observe=function(){var t=this,n=function(){return t.observer&&t.observer.observe(document.body,eb)};document.body?n():gr.addEventListener("DOMContentLoaded",n)},e.prototype.start=function(){var t=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Ku.forEach(function(n){return gr.addEventListener(n,t.listener,!0)}))},e.prototype.stop=function(){var t=this;this.stopped||(this.observer&&this.observer.disconnect(),Ku.forEach(function(n){return gr.removeEventListener(n,t.listener,!0)}),this.stopped=!0)},e}(),gs=new tb,Yu=function(e){!la&&e>0&&gs.start(),la+=e,!la&&gs.stop()},nb=function(e){return!eo(e)&&!W0(e)&&getComputedStyle(e).display==="inline"},rb=function(){function e(t,n){this.target=t,this.observedBox=n||Br.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return e.prototype.isActive=function(){var t=kd(this.target,this.observedBox,!0);return nb(this.target)&&(this.lastReportedSize=t),this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize},e}(),ab=function(){function e(t,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=t,this.callback=n}return e}(),Ur=new WeakMap,Gu=function(e,t){for(var n=0;n<e.length;n+=1)if(e[n].target===t)return n;return-1},Vr=function(){function e(){}return e.connect=function(t,n){var r=new ab(t,n);Ur.set(t,r)},e.observe=function(t,n,r){var a=Ur.get(t),i=a.observationTargets.length===0;Gu(a.observationTargets,n)<0&&(i&&gn.push(a),a.observationTargets.push(new rb(n,r&&r.box)),Yu(1),gs.schedule())},e.unobserve=function(t,n){var r=Ur.get(t),a=Gu(r.observationTargets,n),i=r.observationTargets.length===1;a>=0&&(i&&gn.splice(gn.indexOf(r),1),r.observationTargets.splice(a,1),Yu(-1))},e.disconnect=function(t){var n=this,r=Ur.get(t);r.observationTargets.slice().forEach(function(a){return n.unobserve(t,a.target)}),r.activeTargets.splice(0,r.activeTargets.length)},e}(),ib=function(){function e(t){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof t!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Vr.connect(this,t)}return e.prototype.observe=function(t,n){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Wu(t))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Vr.observe(this,t,n)},e.prototype.unobserve=function(t){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Wu(t))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Vr.unobserve(this,t)},e.prototype.disconnect=function(){Vr.disconnect(this)},e.toString=function(){return"function ResizeObserver () { [polyfill code] }"},e}(),Vt={};Object.defineProperty(Vt,"__esModule",{value:!0});var sb=typeof window<"u"&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),yi={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Ad={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:sb?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},to={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222};for(var Kr=1;Kr<20;Kr++)to["f"+Kr]=111+Kr;function Ka(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map(function(s){return Fd(s,t)}),a=function(o){return r.some(function(l){return Td(l,o)})},i=n==null?a:a(n);return i}function ob(e,t){return Ka(e,t)}function ub(e,t){return Ka(e,{byKey:!0},t)}function Fd(e,t){var n=t&&t.byKey,r={};e=e.replace("++","+add");var a=e.split("+"),i=a.length;for(var s in yi)r[yi[s]]=!1;var o=!0,l=!1,u=void 0;try{for(var c=a[Symbol.iterator](),m;!(o=(m=c.next()).done);o=!0){var h=m.value,p=h.endsWith("?")&&h.length>1;p&&(h=h.slice(0,-1));var g=no(h),f=yi[g];if(h.length>1&&!f&&!Ad[h]&&!to[g])throw new TypeError('Unknown modifier: "'+h+'"');(i===1||!f)&&(n?r.key=g:r.which=Sd(h)),f&&(r[f]=p?null:!0)}}catch(y){l=!0,u=y}finally{try{!o&&c.return&&c.return()}finally{if(l)throw u}}return r}function Td(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 Sd(e){e=no(e);var t=to[e]||e.toUpperCase().charCodeAt(0);return t}function no(e){return e=e.toLowerCase(),e=Ad[e]||e,e}var lb=Vt.default=Ka,Di=Vt.isHotkey=Ka;Vt.isCodeHotkey=ob;Vt.isKeyHotkey=ub;Vt.parseHotkey=Fd;Vt.compareHotkey=Td;Vt.toKeyCode=Sd;Vt.toKeyName=no;function cb(e,t){if(e==null)return{};var n={},r=Object.keys(e),a,i;for(i=0;i<r.length;i++)a=r[i],!(t.indexOf(a)>=0)&&(n[a]=e[a]);return n}function Zn(e,t){if(e==null)return{};var n=cb(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 Ar(e){"@babel/helpers - typeof";return Ar=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},Ar(e)}function db(e,t){if(Ar(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Ar(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fb(e){var t=db(e,"string");return Ar(t)==="symbol"?t:String(t)}function xt(e,t,n){return t=fb(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ro=C.createContext(null),on=()=>{var e=C.useContext(ro);if(!e)throw new Error("The `useSlateStatic` hook must be used inside the <Slate> component's context.");return e},jd=parseInt(C.version.split(".")[0],10),hb=typeof navigator<"u"&&typeof window<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Qu=typeof navigator<"u"&&/Mac OS X/.test(navigator.userAgent),st=typeof navigator<"u"&&/Android/.test(navigator.userAgent),$n=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),hr=typeof navigator<"u"&&/AppleWebKit(?!.*Chrome)/i.test(navigator.userAgent),mb=typeof navigator<"u"&&/Edge?\/(?:[0-6][0-9]|[0-7][0-8])(?:\.)/i.test(navigator.userAgent),Od=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),gb=st&&typeof navigator<"u"&&/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent),vb=typeof navigator<"u"&&/^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent),bb=typeof navigator<"u"&&/.*UCBrowser/.test(navigator.userAgent),yb=typeof navigator<"u"&&/.*Wechat/.test(navigator.userAgent)&&!/.*MacWechat/.test(navigator.userAgent),ca=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Zt=(!pb||!gb)&&!mb&&typeof globalThis<"u"&&globalThis.InputEvent&&typeof globalThis.InputEvent.prototype.getTargetRanges=="function",ao=new WeakMap,io=new WeakMap,Pd=new WeakMap,da=new WeakMap,vs=new WeakMap,Fr=new WeakMap,bn=new WeakMap,ka=new WeakMap,Za=new WeakMap,bs=new WeakMap,en=new WeakMap,mn=new WeakMap,vr=new WeakMap,ys=new WeakMap,so=new WeakMap,kt=new WeakMap,Wt=new WeakMap,ct=new WeakMap,Gt=new WeakMap,Qt=new WeakMap,Nd=new WeakMap,Yn=Symbol("placeholder"),Rd=Symbol("mark-placeholder"),Db=globalThis.Text,oo=e=>e&&e.ownerDocument&&e.ownerDocument.defaultView||null,Cb=e=>nn(e)&&e.nodeType===8,Ct=e=>nn(e)&&e.nodeType===1,nn=e=>{var t=oo(e);return!!t&&e instanceof t.Node},Ds=e=>{var t=e&&e.anchorNode&&oo(e.anchorNode);return!!t&&e instanceof t.Selection},Md=e=>nn(e)&&e.nodeType===3,xb=e=>e.clipboardData&&e.clipboardData.getData("text/plain")!==""&&e.clipboardData.types.length===1,wb=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]=Id(t,a,r?"backward":"forward"),r=a<n;Ct(t)&&t.childNodes.length;){var i=r?t.childNodes.length-1:0;t=kb(t,i,r?"backward":"forward")}n=r&&t.textContent!=null?t.textContent.length:0}return[t,n]},Eb=e=>{for(var t=e&&e.parentNode;t;){if(t.toString()==="[object ShadowRoot]")return!0;t=t.parentNode}return!1},Id=(e,t,n)=>{for(var{childNodes:r}=e,a=r[t],i=t,s=!1,o=!1;(Cb(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]},kb=(e,t,n)=>{var[r]=Id(e,t,n);return r},$d=e=>{var t="";if(Md(e)&&e.nodeValue)return e.nodeValue;if(Ct(e)){for(var n of Array.from(e.childNodes))t+=$d(n);var r=getComputedStyle(e).getPropertyValue("display");(r==="block"||r==="list"||e.tagName==="BR")&&(t+=`
|
|
103
|
+
`)}return t},_b=/data-slate-fragment="(.+?)"/m,Bb=e=>{var t=e.getData("text/html"),[,n]=t.match(_b)||[];return n},uo=(e,t,n)=>{var{target:r}=t;if(Ct(r)&&r.matches('[contentEditable="false"]'))return!1;var{document:a}=J.getWindow(e);if(a.contains(r))return J.hasDOMNode(e,r,{editable:!0});var i=n.find(s=>{var{addedNodes:o,removedNodes:l}=s;for(var u of o)if(u===r||u.contains(r))return!0;for(var c of l)if(c===r||c.contains(r))return!0});return!i||i===t?!1:uo(e,i,n)},Ab=0;class Fb{constructor(){xt(this,"id",void 0),this.id="".concat(Ab++)}}var J={androidPendingDiffs:e=>ct.get(e),androidScheduleFlush:e=>{var t;(t=so.get(e))===null||t===void 0||t()},blur:e=>{var t=J.toDOMNode(e,e),n=J.findDocumentOrShadowRoot(e);en.set(e,!1),n.activeElement===t&&t.blur()},deselect:e=>{var{selection:t}=e,n=J.findDocumentOrShadowRoot(e),r=n.getSelection();r&&r.rangeCount>0&&r.removeAllRanges(),t&&Q.deselect(e)},findDocumentOrShadowRoot:e=>{var t=J.toDOMNode(e,e),n=t.getRootNode();return(n instanceof Document||n instanceof ShadowRoot)&&n.getSelection!=null?n:t.ownerDocument},findEventRange:(e,t)=>{"nativeEvent"in t&&(t=t.nativeEvent);var{clientX:n,clientY:r,target:a}=t;if(n==null||r==null)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var i=J.toSlateNode(e,t.target),s=J.findPath(e,i);if(ce.isElement(i)&&v.isVoid(e,i)){var o=a.getBoundingClientRect(),l=e.isInline(i)?n-o.left<o.left+o.width-n:r-o.top<o.top+o.height-r,u=v.point(e,s,{edge:l?"start":"end"}),c=l?v.before(e,u):v.after(e,u);if(c){var m=v.range(e,c);return m}}var h,{document:p}=J.getWindow(e);if(p.caretRangeFromPoint)h=p.caretRangeFromPoint(n,r);else{var g=p.caretPositionFromPoint(n,r);g&&(h=p.createRange(),h.setStart(g.offsetNode,g.offset),h.setEnd(g.offsetNode,g.offset))}if(!h)throw new Error("Cannot resolve a Slate range from a DOM event: ".concat(t));var f=J.toSlateRange(e,h,{exactMatch:!1,suppressThrow:!1});return f},findKey:(e,t)=>{var n=ka.get(t);return n||(n=new Fb,ka.set(t,n)),n},findPath:(e,t)=>{for(var n=[],r=t;;){var a=io.get(r);if(a==null){if(v.isEditor(r))return n;break}var i=ao.get(r);if(i==null)break;n.unshift(i),r=a}throw new Error("Unable to find the path for Slate node: ".concat(Je.stringify(t)))},focus:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{retries:5};if(!en.get(t)){if(n.retries<=0)throw new Error("Could not set focus, editor seems stuck with pending operations");if(t.operations.length>0){setTimeout(()=>{J.focus(t,{retries:n.retries-1})},10);return}var r=J.toDOMNode(t,t),a=J.findDocumentOrShadowRoot(t);if(a.activeElement!==r){if(t.selection&&a instanceof Document){var i=a.getSelection(),s=J.toDOMRange(t,t.selection);i==null||i.removeAllRanges(),i==null||i.addRange(s)}t.selection||(Q.select(t,v.start(t,[])),t.onChange()),en.set(t,!0),r.focus({preventScroll:!0})}}},getWindow:e=>{var t=Pd.get(e);if(!t)throw new Error("Unable to find a host window element for this editor");return t},hasDOMNode:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{editable:a=!1}=r,i=J.toDOMNode(t,t),s;try{s=Ct(n)?n:n.parentElement}catch(o){if(o instanceof Error&&!o.message.includes('Permission denied to access property "nodeType"'))throw o}return s?s.closest("[data-slate-editor]")===i&&(!a||s.isContentEditable?!0:typeof s.isContentEditable=="boolean"&&s.closest('[contenteditable="false"]')===i||!!s.getAttribute("data-slate-zero-width")):!1},hasEditableTarget:(e,t)=>nn(t)&&J.hasDOMNode(e,t,{editable:!0}),hasRange:(e,t)=>{var{anchor:n,focus:r}=t;return v.hasPath(e,n.path)&&v.hasPath(e,r.path)},hasSelectableTarget:(e,t)=>J.hasEditableTarget(e,t)||J.isTargetInsideNonReadonlyVoid(e,t),hasTarget:(e,t)=>nn(t)&&J.hasDOMNode(e,t),insertData:(e,t)=>{e.insertData(t)},insertFragmentData:(e,t)=>e.insertFragmentData(t),insertTextData:(e,t)=>e.insertTextData(t),isComposing:e=>!!mn.get(e),isFocused:e=>!!en.get(e),isReadOnly:e=>!!bs.get(e),isTargetInsideNonReadonlyVoid:(e,t)=>{if(bs.get(e))return!1;var n=J.hasTarget(e,t)&&J.toSlateNode(e,t);return ce.isElement(n)&&v.isVoid(e,n)},setFragmentData:(e,t,n)=>e.setFragmentData(t,n),toDOMNode:(e,t)=>{var n=Za.get(e),r=v.isEditor(t)?da.get(e):n==null?void 0:n.get(J.findKey(e,t));if(!r)throw new Error("Cannot resolve a DOM node from Slate node: ".concat(Je.stringify(t)));return r},toDOMPoint:(e,t)=>{var[n]=v.node(e,t.path),r=J.toDOMNode(e,n),a;v.void(e,{at:t})&&(t={path:t.path,offset:0});for(var i="[data-slate-string], [data-slate-zero-width]",s=Array.from(r.querySelectorAll(i)),o=0,l=0;l<s.length;l++){var u=s[l],c=u.childNodes[0];if(!(c==null||c.textContent==null)){var{length:m}=c.textContent,h=u.getAttribute("data-slate-length"),p=h==null?m:parseInt(h,10),g=o+p,f=s[l+1];if(t.offset===g&&f!==null&&f!==void 0&&f.hasAttribute("data-slate-mark-placeholder")){var y,b=f.childNodes[0];a=[b instanceof Db?b:f,(y=f.textContent)!==null&&y!==void 0&&y.startsWith("\uFEFF")?1:0];break}if(t.offset<=g){var w=Math.min(m,Math.max(0,t.offset-o));a=[c,w];break}o=g}}if(!a)throw new Error("Cannot resolve a DOM point from Slate point: ".concat(Je.stringify(t)));return a},toDOMRange:(e,t)=>{var{anchor:n,focus:r}=t,a=U.isBackward(t),i=J.toDOMPoint(e,n),s=U.isCollapsed(t)?i:J.toDOMPoint(e,r),o=J.getWindow(e),l=o.document.createRange(),[u,c]=a?s:i,[m,h]=a?i:s,p=Ct(u)?u:u.parentElement,g=!!p.getAttribute("data-slate-zero-width"),f=Ct(m)?m:m.parentElement,y=!!f.getAttribute("data-slate-zero-width");return l.setStart(u,g?1:c),l.setEnd(m,y?1:h),l},toSlateNode:(e,t)=>{var n=Ct(t)?t:t.parentElement;n&&!n.hasAttribute("data-slate-node")&&(n=n.closest("[data-slate-node]"));var r=n?Fr.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:wb(t),o=i.parentNode,l=null,u=0;if(o){var c,m,h=J.toDOMNode(e,e),p=o.closest('[data-slate-void="true"]'),g=p&&h.contains(p)?p:null,f=o.closest("[data-slate-leaf]"),y=null;if(f){if(l=f.closest('[data-slate-node="text"]'),l){var b=J.getWindow(e),w=b.document.createRange();w.setStart(l,0),w.setEnd(i,s);var A=w.cloneContents(),k=[...Array.prototype.slice.call(A.querySelectorAll("[data-slate-zero-width]")),...Array.prototype.slice.call(A.querySelectorAll("[contenteditable=false]"))];k.forEach(F=>{if(st&&!r&&F.hasAttribute("data-slate-zero-width")&&F.textContent.length>0&&F.textContext!=="\uFEFF"){F.textContent.startsWith("\uFEFF")&&(F.textContent=F.textContent.slice(1));return}F.parentNode.removeChild(F)}),u=A.textContent.length,y=l}}else if(g){for(var E=g.querySelectorAll("[data-slate-leaf]"),T=0;T<E.length;T++){var j=E[T];if(J.hasDOMNode(e,j)){f=j;break}}f?(l=f.closest('[data-slate-node="text"]'),y=f,u=y.textContent.length,y.querySelectorAll("[data-slate-zero-width]").forEach(F=>{u-=F.textContent.length})):u=1}y&&u===y.textContent.length&&st&&y.getAttribute("data-slate-zero-width")==="z"&&(c=y.textContent)!==null&&c!==void 0&&c.startsWith("\uFEFF")&&(o.hasAttribute("data-slate-zero-width")||$n&&(m=y.textContent)!==null&&m!==void 0&&m.endsWith(`
|
|
104
104
|
|
|
105
|
-
`))&&u--}if(st&&!l&&!r){var
|
|
105
|
+
`))&&u--}if(st&&!l&&!r){var z=o.hasAttribute("data-slate-node")?o:o.closest("[data-slate-node]");if(z&&J.hasDOMNode(e,z,{editable:!0})){var R=J.toSlateNode(e,z),{path:$,offset:M}=v.start(e,J.findPath(e,R));return z.querySelector("[data-slate-leaf]")||(M=s),{path:$,offset:M}}}if(!l){if(a)return null;throw new Error("Cannot resolve a Slate point from DOM point: ".concat(t))}var x=J.toSlateNode(e,l),B=J.findPath(e,x);return{path:B,offset:u}},toSlateRange:(e,t,n)=>{var r,{exactMatch:a,suppressThrow:i}=n,s=Ds(t)?t.anchorNode:t.startContainer,o,l,u,c,m;if(s)if(Ds(t)){if($n&&t.rangeCount>1){u=t.focusNode;var h=t.getRangeAt(0),p=t.getRangeAt(t.rangeCount-1);if(u instanceof HTMLTableRowElement&&h.startContainer instanceof HTMLTableRowElement&&p.startContainer instanceof HTMLTableRowElement){let T=function(j){return j.childElementCount>0?T(j.children[0]):j};var g=h.startContainer,f=p.startContainer,y=T(g.children[h.startOffset]),b=T(f.children[p.startOffset]);c=0,b.childNodes.length>0?o=b.childNodes[0]:o=b,y.childNodes.length>0?u=y.childNodes[0]:u=y,b instanceof HTMLElement?l=b.innerHTML.length:l=0}else h.startContainer===u?(o=p.endContainer,l=p.endOffset,c=h.startOffset):(o=h.startContainer,l=h.endOffset,c=p.startOffset)}else o=t.anchorNode,l=t.anchorOffset,u=t.focusNode,c=t.focusOffset;Od&&Eb(o)||$n?m=t.anchorNode===t.focusNode&&t.anchorOffset===t.focusOffset:m=t.isCollapsed}else o=t.startContainer,l=t.startOffset,u=t.endContainer,c=t.endOffset,m=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($n&&(r=u.textContent)!==null&&r!==void 0&&r.endsWith(`
|
|
106
106
|
|
|
107
|
-
`)&&c===u.textContent.length&&c--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var w;u=o,c=((w=o.textContent)===null||w===void 0?void 0:w.length)||0}var A=J.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!A)return null;var E=f?A:J.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!E)return null;var k={anchor:A,focus:E};return H.isExpanded(k)&&H.isForward(k)&&Ct(u)&&b.void(e,{at:k.focus,mode:"highest"})&&(k=b.unhangRange(e,k,{voids:!0})),k}};function bb(e,t){var{path:n,diff:r}=t;if(!b.hasPath(e,n))return!1;var a=se.get(e,n);if(!fe.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=P.next(n);if(!b.hasPath(e,i))return!1;var s=se.get(e,i);return fe.isText(s)&&s.text.startsWith(r.text)}function jd(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 yb(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++)if(e.charAt(r)!==t.charAt(r))return r;return n}function Db(e,t,n){for(var r=Math.min(e.length,t.length,n),a=0;a<r;a++)if(e.charAt(e.length-a-1)!==t.charAt(t.length-a-1))return a;return r}function Od(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=yb(i,a),o=Math.min(i.length-s,a.length-s),l=Db(i,a,o),u={start:n+s,end:r-l,text:a.slice(s,a.length-l)};return u.start===u.end&&u.text.length===0?null:u}function Cb(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=jd(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 Od(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 bs(e,t){var{path:n,offset:r}=t;if(!b.hasPath(e,n))return null;var a=se.get(e,n);if(!fe.isText(a))return null;var i=b.above(e,{match:o=>ce.isElement(o)&&b.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=b.next(e,{at:n,match: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 Ku(e,t){var n=bs(e,t.anchor);if(!n)return null;if(H.isCollapsed(t))return{anchor:n,focus:n};var r=bs(e,t.focus);return r?{anchor:n,focus:r}:null}function ys(e,t,n){var r=ct.get(e),a=r==null?void 0:r.find(c=>{var{path:f}=c;return P.equals(f,t.path)});if(!a||t.offset<=a.diff.start)return we.transform(t,n,{affinity:"backward"});var{diff:i}=a;if(t.offset<=i.start+i.text.length){var s={path:t.path,offset:i.start},o=we.transform(s,n,{affinity:"backward"});return o?{path:o.path,offset:o.offset+t.offset-i.start}:null}var l={path:t.path,offset:t.offset-i.text.length+i.end-i.start},u=we.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&P.equals(n.path,t.path)&&l.offset<n.position&&i.start<n.position?u:{path:u.path,offset:u.offset+i.text.length-i.end+i.start}:null}function Zu(e,t,n){var r=ys(e,t.anchor,n);if(!r)return null;if(H.isCollapsed(t))return{anchor:r,focus:r};var a=ys(e,t.focus,n);return a?{anchor:r,focus:a}:null}function wb(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 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){xt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yu(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Eb=25,kb=200,_b=function(){},Bb=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function Ab(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,c=()=>{var x=Gt.get(t);if(Gt.delete(t),x){var{selection:_}=t,j=Ku(t,x);j&&(!_||!H.equals(j,_))&&Q.select(t,j)}},f=()=>{var x=Yt.get(t);if(Yt.delete(t),!!x){if(x.at){var _=we.isPoint(x.at)?bs(t,x.at):Ku(t,x.at);if(!_)return;var j=b.range(t,_);(!t.selection||!H.equals(t.selection,j))&&Q.select(t,_)}x.run()}},m=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!E()&&!A()){c();return}a||(a=!0,setTimeout(()=>a=!1)),A()&&(a="action");var x=t.selection&&b.rangeRef(t,t.selection,{affinity:"forward"});qt.set(t,t.marks),_b("flush",Yt.get(t),ct.get(t));for(var _=E(),j;j=(R=ct.get(t))===null||R===void 0?void 0:R[0];){var R,q,V=kt.get(t);V!==void 0&&(kt.delete(t),t.marks=V),V&&u===!1&&(u=null);var ue=xb(j);(!t.selection||!H.equals(t.selection,ue))&&Q.select(t,ue),j.diff.text?b.insertText(t,j.diff.text):b.deleteFragment(t),ct.set(t,(q=ct.get(t))===null||q===void 0?void 0:q.filter(W=>{var{id:X}=W;return X!==j.id})),bb(t,j)||(_=!1,Yt.delete(t),qt.delete(t),a="action",Gt.delete(t),n.cancel(),r.cancel(),x==null||x.unref())}var ne=x==null?void 0:x.unref();if(ne&&!Gt.get(t)&&(!t.selection||!H.equals(ne,t.selection))&&Q.select(t,ne),A()){f();return}_&&n(),n.flush(),r.flush(),c();var D=qt.get(t);qt.delete(t),D!==void 0&&(t.marks=D,t.onChange())},p=x=>{i&&clearTimeout(i),i=setTimeout(()=>{hn.set(t,!1),m()},Eb)},g=x=>{hn.set(t,!0),i&&(clearTimeout(i),i=null)},h=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=ms.get(t);if(j){if(E()||_){j.style.display="none";return}j.style.removeProperty("display")}},y=(x,_)=>{var j,R=(j=ct.get(t))!==null&&j!==void 0?j:[];ct.set(t,R);var q=se.leaf(t,x),V=R.findIndex(D=>P.equals(D.path,x));if(V<0){var ue=Od(q.text,_);ue&&R.push({path:x,diff:_,id:l++}),h();return}var ne=Cb(q.text,R[V].diff,_);if(!ne){R.splice(V,1),h();return}R[V]=Zr(Zr({},R[V]),{},{diff:ne})},v=function(_){var{at:j}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,Gt.delete(t),n.cancel(),r.cancel(),A()&&m(),Yt.set(t,{at:j,run:_}),o=setTimeout(m)},w=x=>{var _;s&&(clearTimeout(s),s=null);var{inputType:j}=x,R=null,q=x.dataTransfer||x.data||void 0;u!==!1&&j!=="insertText"&&j!=="insertCompositionText"&&(u=!1);var[V]=x.getTargetRanges();V&&(R=J.toSlateRange(t,V,{exactMatch:!1,suppressThrow:!0}));var ue=J.getWindow(t),ne=ue.getSelection();if(!R&&ne&&(V=ne,R=J.toSlateRange(t,ne,{exactMatch:!1,suppressThrow:!0})),R=(_=R)!==null&&_!==void 0?_:t.selection,!!R){var D=!0;if(j.startsWith("delete")){if(H.isExpanded(R)){var[W,X]=H.edges(R),B=se.leaf(t,W.path);if(B.text.length===W.offset&&X.offset===0){var T=b.next(t,{at:W.path,match:fe.isText});T&&P.equals(T[1],X.path)&&(R={anchor:X,focus:X})}}var z=j.endsWith("Backward")?"backward":"forward",[$,K]=H.edges(R),[te,ee]=b.leaf(t,$.path),ae={text:"",start:$.offset,end:K.offset},de=ct.get(t),Y=de==null?void 0:de.find(be=>P.equals(be.path,ee)),pe=Y?[Y.diff,ae]:[ae],ge=jd(te.text,...pe);if(ge.length===0&&(D=!1),H.isExpanded(R)){if(D&&P.equals(R.anchor.path,R.focus.path)){var _e={path:R.anchor.path,offset:$.offset},Oe=b.range(t,_e,_e);return S(Oe),y(R.anchor.path,{text:"",end:K.offset,start:$.offset})}return v(()=>b.deleteFragment(t,{direction:z}),{at:R})}}switch(j){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return v(()=>b.deleteFragment(t),{at:R});case"deleteContent":case"deleteContentForward":{var{anchor:he}=R;if(D&&H.isCollapsed(R)){var Ne=se.leaf(t,he.path);if(he.offset<Ne.text.length)return y(he.path,{text:"",start:he.offset,end:he.offset+1})}return v(()=>b.deleteForward(t),{at:R})}case"deleteContentBackward":{var He,{anchor:Ue}=R,Qe=vs(V)?V.isCollapsed:!!((He=V)!==null&&He!==void 0&&He.collapsed);return D&&Qe&&H.isCollapsed(R)&&Ue.offset>0?y(Ue.path,{text:"",start:Ue.offset-1,end:Ue.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(Bb(q))return v(()=>J.insertData(t,q),{at:R});var Ae=q??"";if(kt.get(t)&&(Ae=Ae.replace("\uFEFF","")),j==="insertText"&&/.*\n.*\n$/.test(Ae)&&(Ae=Ae.slice(0,-1)),Ae.includes(`
|
|
108
|
-
`))return
|
|
109
|
-
`);be.forEach((xe,Ye)=>{xe&&
|
|
110
|
-
`?C.createElement(
|
|
111
|
-
`:""),[i]=C.useState(a);return Fr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),C.createElement(qb,{ref:r},i)},qb=C.memo(C.forwardRef((e,t)=>C.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Ci=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),C.createElement("span",Lb({},a),!st||!n?"\uFEFF":null,n?C.createElement("br",null):null)};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 Nd(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){xt(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 Wb=st?300:0;function Hb(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function el(e){e.current&&(clearTimeout(e.current),e.current=null)}var Ub=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=w=>C.createElement(Kb,Nd({},w))}=e,o=sn(),l=C.useRef(null),u=C.useRef(null),[c,f]=C.useState(!1),m=C.useRef(null),p=C.useCallback(w=>{if(Hb(l,w==null),w==null){var A;ms.delete(o),(A=t.onPlaceholderResize)===null||A===void 0||A.call(t,null)}else{if(ms.set(o,w),!l.current){var E=window.ResizeObserver||K0;l.current=new E(()=>{var k;(k=t.onPlaceholderResize)===null||k===void 0||k.call(t,w)})}l.current.observe(w),u.current=w}},[u,t,o]),g=C.createElement(zb,{isLast:n,leaf:t,parent:a,text:r}),h=!!t[Zn];if(C.useEffect(()=>(h?m.current||(m.current=setTimeout(()=>{f(!0),m.current=null},Wb)):(el(m),f(!1)),()=>el(m)),[h,f]),h&&c){var y={children:t.placeholder,attributes:{"data-slate-placeholder":!0,style:{position:"absolute",top:0,pointerEvents:"none",width:"100%",maxWidth:"100%",display:"block",opacity:"0.333",userSelect:"none",textDecoration:"none",WebkitUserModify:fr?"inherit":void 0},contentEditable:!1,ref:p}};g=C.createElement(C.Fragment,null,i(y),g)}var v={"data-slate-leaf":!0};return s({attributes:v,children:g,leaf:t,text:r})},Vb=C.memo(Ub,(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[Zn]===e.leaf[Zn]),Kb=e=>{var{attributes:t,children:n}=e;return C.createElement("span",Nd({},t),n)},Zb=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=sn(),l=C.useRef(null),u=fe.decorations(s,t),c=J.findKey(o,s),f=[],m=0;m<u.length;m++){var p=u[m];f.push(C.createElement(Vb,{isLast:n&&m===u.length-1,key:"".concat(c.id,"-").concat(m),renderPlaceholder:a,leaf:p,text:s,parent:r,renderLeaf:i}))}var g=C.useCallback(h=>{var y=Za.get(o);h?(y==null||y.set(c,h),vn.set(s,h),Ar.set(h,s)):(y==null||y.delete(c),vn.delete(s),l.current&&Ar.delete(l.current)),l.current=h},[l,o,c,s]);return C.createElement("span",{"data-slate-node":"text",ref:g},f)},Rd=C.memo(Zb,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&$b(t.decorations,e.decorations));function tl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Ds(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tl(Object(n),!0).forEach(function(r){xt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Yb=e=>{var{decorations:t,element:n,renderElement:r=w=>C.createElement(Qb,Ds({},w)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=sn(),l=ey(),u=o.isInline(n),c=J.findKey(o,n),f=C.useCallback(w=>{var A=Za.get(o);w?(A==null||A.set(c,w),vn.set(n,w),Ar.set(w,n)):(A==null||A.delete(c),vn.delete(n))},[o,c,n]),m=Id({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),p={"data-slate-node":"element",ref:f};if(u&&(p["data-slate-inline"]=!0),!u&&b.hasInlines(o,n)){var g=se.string(n),h=ld(g);h==="rtl"&&(p.dir=h)}if(b.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var y=u?"span":"div",[[v]]=se.texts(n);m=C.createElement(y,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},C.createElement(Rd,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:v})),Xs.set(v,0),eo.set(v,n)}return r({attributes:p,children:m,element:n})},Gb=C.memo(Yb,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&Ib(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&H.equals(e.selection,t.selection))),Qb=e=>{var{attributes:t,children:n,element:r}=e,a=sn(),i=a.isInline(r)?"span":"div";return C.createElement(i,Ds(Ds({},t),{},{style:{position:"relative"}}),n)},Md=C.createContext(()=>[]),Jb=()=>C.useContext(Md),Xb=C.createContext(!1),Id=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=Jb(),l=sn(),u=J.findPath(l,n),c=[],f=ce.isElement(n)&&!l.isInline(n)&&b.hasInlines(l,n),m=0;m<n.children.length;m++){var p=u.concat(m),g=n.children[m],h=J.findKey(l,g),y=b.range(l,p),v=s&&H.intersection(y,s),w=o([g,p]);for(var A of t){var E=H.intersection(A,y);E&&w.push(E)}ce.isElement(g)?c.push(C.createElement(Xb.Provider,{key:"provider-".concat(h.id),value:!!v},C.createElement(Gb,{decorations:w,element:g,key:h.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:v}))):c.push(C.createElement(Rd,{decorations:w,key:h.id,isLast:f&&m===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),Xs.set(g,m),eo.set(g,n)}return c},$d=C.createContext(!1),ey=()=>C.useContext($d),Ld=C.createContext(null),nr=()=>{var e=C.useContext(Ld);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function ty(){var e=sn(),t=C.useRef(!1),n=C.useRef(0),r=C.useCallback(()=>{if(!t.current){t.current=!0;var a=J.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return C.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var 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"},ay={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"]},Le=e=>{var t=ry[e],n=ay[e],r=iy[e],a=t&&Di(t),i=n&&Di(n),s=r&&Di(r);return o=>!!(a&&a(o)||Vu&&i&&i(o)||!Vu&&s&&s(o))},qe={isBold:Le("bold"),isCompose:Le("compose"),isMoveBackward:Le("moveBackward"),isMoveForward:Le("moveForward"),isDeleteBackward:Le("deleteBackward"),isDeleteForward:Le("deleteForward"),isDeleteLineBackward:Le("deleteLineBackward"),isDeleteLineForward:Le("deleteLineForward"),isDeleteWordBackward:Le("deleteWordBackward"),isDeleteWordForward:Le("deleteWordForward"),isExtendBackward:Le("extendBackward"),isExtendForward:Le("extendForward"),isExtendLineBackward:Le("extendLineBackward"),isExtendLineForward:Le("extendLineForward"),isItalic:Le("italic"),isMoveLineBackward:Le("moveLineBackward"),isMoveLineForward:Le("moveLineForward"),isMoveWordBackward:Le("moveWordBackward"),isMoveWordForward:Le("moveWordForward"),isRedo:Le("redo"),isSoftBreak:Le("insertSoftBreak"),isSplitBlock:Le("splitBlock"),isTransposeCharacter:Le("transposeCharacter"),isUndo:Le("undo")},sy=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>ro(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}},oy={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class zd extends C.Component{constructor(){super(...arguments),xt(this,"context",null),xt(this,"manager",null),xt(this,"mutationObserver",null)}observe(){var t,{node:n}=this.props;if(!n.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");(t=this.mutationObserver)===null||t===void 0||t.observe(n.current,oy)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=sy(n,t),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var t,n,r,a=(t=this.mutationObserver)===null||t===void 0?void 0:t.takeRecords();if(a!=null&&a.length){var i;(i=this.manager)===null||i===void 0||i.registerMutations(a)}return(n=this.mutationObserver)===null||n===void 0||n.disconnect(),(r=this.manager)===null||r===void 0||r.restoreDOM(),null}componentDidUpdate(){var t;(t=this.manager)===null||t===void 0||t.clear(),this.observe()}componentWillUnmount(){var t;(t=this.mutationObserver)===null||t===void 0||t.disconnect()}render(){return this.props.children}}xt(zd,"contextType",Js);var uy=st?zd:e=>{var{children:t}=e;return C.createElement(C.Fragment,null,t)},ly=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],cy=["text"];function nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Tt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nl(Object(n),!0).forEach(function(r){xt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var dy=e=>C.createElement(C.Fragment,null,Id(e)),fy=e=>{var t=C.useCallback(T=>C.createElement(hy,Tt({},T)),[]),{autoFocus:n,decorate:r=my,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=py,style:f={},as:m="div",disableDefaultStyles:p=!1}=e,g=Kn(e,ly),h=nr(),[y,v]=C.useState(!1),w=C.useRef(null),A=C.useRef([]),[E,k]=C.useState(),{onUserInput:F,receivedUserInput:S}=ty(),[,L]=C.useReducer(T=>T+1,0);Bd.set(h,L),ps.set(h,s);var I=C.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);C.useEffect(()=>{w.current&&n&&w.current.focus()},[n]);var N=C.useRef(),M=C.useMemo(()=>w0(()=>{var T=N.current;if((st||!J.isComposing(h))&&(!I.isUpdatingSelection||T!=null&&T.isFlushing())&&!I.isDraggingInternally){var z=J.findDocumentOrShadowRoot(h),{activeElement:$}=z,K=J.toDOMNode(h,h),te=z.getSelection();if($===K?(I.latestElement=$,Xt.set(h,!0)):Xt.delete(h),!te)return Q.deselect(h);var{anchorNode:ee,focusNode:ae}=te,de=J.hasEditableTarget(h,ee)||J.isTargetInsideNonReadonlyVoid(h,ee),Y=J.hasEditableTarget(h,ae)||J.isTargetInsideNonReadonlyVoid(h,ae);if(de&&Y){var pe=J.toSlateRange(h,te,{exactMatch:!1,suppressThrow:!0});pe&&(!J.isComposing(h)&&!(T!=null&&T.hasPendingChanges())&&!(T!=null&&T.isFlushing())?Q.select(h,pe):T==null||T.handleUserSelect(pe))}s&&(!de||!Y)&&Q.deselect(h)}},100),[h,s,I]),x=C.useMemo(()=>v0(M,0),[M]);N.current=Pb({node:w,onDOMSelectionChange:M,scheduleOnDOMSelectionChange:x}),Fr(()=>{var T,z,$;w.current&&($=no(w.current))?(_d.set(h,$),da.set(h,w.current),vn.set(h,w.current),Ar.set(w.current,h)):vn.delete(h);var{selection:K}=h,te=J.findDocumentOrShadowRoot(h),ee=te.getSelection();if(!(!ee||!J.isFocused(h)||(T=N.current)!==null&&T!==void 0&&T.hasPendingAction())){var ae=ge=>{var _e=ee.type!=="None";if(!(!K&&!_e)){var Oe=ee.focusNode,he;if(In&&ee.rangeCount>1){var Ne=ee.getRangeAt(0),He=ee.getRangeAt(ee.rangeCount-1);Ne.startContainer===Oe?he=He.endContainer:he=Ne.startContainer}else he=ee.anchorNode;var Ue=da.get(h),Qe=!1;if(Ue.contains(he)&&Ue.contains(Oe)&&(Qe=!0),_e&&Qe&&K&&!ge){var Ae=J.toSlateRange(h,ee,{exactMatch:!0,suppressThrow:!0});if(Ae&&H.equals(Ae,K)){var ze;if(!I.hasMarkPlaceholder||(ze=he)!==null&&ze!==void 0&&(ze=ze.parentElement)!==null&&ze!==void 0&&ze.hasAttribute("data-slate-mark-placeholder"))return}}if(K&&!J.hasRange(h,K)){h.selection=J.toSlateRange(h,ee,{exactMatch:!1,suppressThrow:!0});return}I.isUpdatingSelection=!0;var We=K&&J.toDOMRange(h,K);return We?(J.isComposing(h)&&!st?ee.collapseToEnd():H.isBackward(K)?ee.setBaseAndExtent(We.endContainer,We.endOffset,We.startContainer,We.startOffset):ee.setBaseAndExtent(We.startContainer,We.startOffset,We.endContainer,We.endOffset),c(h,We)):ee.removeAllRanges(),We}};ee.rangeCount<=1&&ae();var de=((z=N.current)===null||z===void 0?void 0:z.isFlushing())==="action";if(!st||!de){setTimeout(()=>{I.isUpdatingSelection=!1});return}var Y=null,pe=requestAnimationFrame(()=>{if(de){var ge=_e=>{try{var Oe=J.toDOMNode(h,h);Oe.focus(),ae(_e)}catch{}};ge(),Y=setTimeout(()=>{ge(!0),I.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(pe),Y&&clearTimeout(Y)}}});var _=C.useCallback(T=>{if(F(),!s&&J.hasEditableTarget(h,T.target)&&!gy(T,a)){var z;if(N.current)return N.current.handleDOMBeforeInput(T);x.flush(),M.flush();var{selection:$}=h,{inputType:K}=T,te=T.dataTransfer||T.data||void 0,ee=K==="insertCompositionText"||K==="deleteCompositionText";if(ee&&J.isComposing(h))return;var ae=!1;if(K==="insertText"&&$&&H.isCollapsed($)&&T.data&&T.data.length===1&&/[a-z ]/i.test(T.data)&&$.anchor.offset!==0){var de,Y;ae=!0,h.marks&&(ae=!1);var{anchor:pe}=$,[ge,_e]=J.toDOMPoint(h,pe),Oe=(de=ge.parentElement)===null||de===void 0?void 0:de.closest("a"),he=J.getWindow(h);if(ae&&Oe&&J.hasDOMNode(h,Oe)){var Ne,He=he==null?void 0:he.document.createTreeWalker(Oe,NodeFilter.SHOW_TEXT).lastChild();He===ge&&((Ne=He.textContent)===null||Ne===void 0?void 0:Ne.length)===_e&&(ae=!1)}if(ae&&ge.parentElement&&(he==null||(Y=he.getComputedStyle(ge.parentElement))===null||Y===void 0?void 0:Y.whiteSpace)==="pre"){var Ue=b.above(h,{at:pe.path,match:ie=>ce.isElement(ie)&&b.isBlock(h,ie)});Ue&&se.string(Ue[0]).includes(" ")&&(ae=!1)}}if(!K.startsWith("delete")||K.startsWith("deleteBy")){var[Qe]=T.getTargetRanges();if(Qe){var Ae=J.toSlateRange(h,Qe,{exactMatch:!1,suppressThrow:!1});if(!$||!H.equals($,Ae)){ae=!1;var ze=!ee&&h.selection&&b.rangeRef(h,h.selection);Q.select(h,Ae),ze&&gr.set(h,ze)}}}if(ee)return;if(ae||T.preventDefault(),$&&H.isExpanded($)&&K.startsWith("delete")){var We=K.endsWith("Backward")?"backward":"forward";b.deleteFragment(h,{direction:We});return}switch(K){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{b.deleteFragment(h);break}case"deleteContent":case"deleteContentForward":{b.deleteForward(h);break}case"deleteContentBackward":{b.deleteBackward(h);break}case"deleteEntireSoftLine":{b.deleteBackward(h,{unit:"line"}),b.deleteForward(h,{unit:"line"});break}case"deleteHardLineBackward":{b.deleteBackward(h,{unit:"block"});break}case"deleteSoftLineBackward":{b.deleteBackward(h,{unit:"line"});break}case"deleteHardLineForward":{b.deleteForward(h,{unit:"block"});break}case"deleteSoftLineForward":{b.deleteForward(h,{unit:"line"});break}case"deleteWordBackward":{b.deleteBackward(h,{unit:"word"});break}case"deleteWordForward":{b.deleteForward(h,{unit:"word"});break}case"insertLineBreak":b.insertSoftBreak(h);break;case"insertParagraph":{b.insertBreak(h);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{K==="insertFromComposition"&&J.isComposing(h)&&(v(!1),hn.set(h,!1)),(te==null?void 0:te.constructor.name)==="DataTransfer"?J.insertData(h,te):typeof te=="string"&&(ae?A.current.push(()=>b.insertText(h,te)):b.insertText(h,te));break}}var U=(z=gr.get(h))===null||z===void 0?void 0:z.unref();gr.delete(h),U&&(!h.selection||!H.equals(h.selection,U))&&Q.select(h,U)}},[h,M,F,a,s,x]),j=C.useCallback(T=>{T==null?(M.cancel(),x.cancel(),da.delete(h),vn.delete(h),w.current&&Kt&&w.current.removeEventListener("beforeinput",_)):Kt&&T.addEventListener("beforeinput",_),w.current=T},[M,x,h,_]);Fr(()=>{var T=J.getWindow(h);return T.document.addEventListener("selectionchange",x),()=>{T.document.removeEventListener("selectionchange",x)}},[x]);var R=r([h,[]]),q=i&&h.children.length===1&&Array.from(se.texts(h)).length===1&&se.string(h)===""&&!y,V=C.useCallback(T=>{if(T&&q){var z;k((z=T.getBoundingClientRect())===null||z===void 0?void 0:z.height)}else k(void 0)},[q]);if(q){var ue=b.start(h,[]);R.push({[Zn]:!0,placeholder:i,onPlaceholderResize:V,anchor:ue,focus:ue})}var{marks:ne}=h;if(I.hasMarkPlaceholder=!1,h.selection&&H.isCollapsed(h.selection)&&ne){var{anchor:D}=h.selection,W=se.leaf(h,D.path),X=Kn(W,cy);if(!fe.equals(W,ne,{loose:!0})){I.hasMarkPlaceholder=!0;var B=Object.fromEntries(Object.keys(X).map(T=>[T,null]));R.push(Tt(Tt(Tt({[Ad]:!0},B),ne),{},{anchor:D,focus:D}))}}return C.useEffect(()=>{setTimeout(()=>{var{selection:T}=h;if(T){var{anchor:z}=T,$=se.leaf(h,z.path);if(ne&&!fe.equals($,ne,{loose:!0})){kt.set(h,ne);return}}kt.delete(h)})}),C.createElement($d.Provider,{value:s},C.createElement(Md.Provider,{value:r},C.createElement(uy,{node:w,receivedUserInput:S},C.createElement(m,Tt(Tt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Kt||!ca?g.spellCheck:!1,autoCorrect:Kt||!ca?g.autoCorrect:"false",autoCapitalize:Kt||!ca?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:j,style:Tt(Tt({},p?{}:Tt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},E?{minHeight:E}:{})),f),onBeforeInput:C.useCallback(T=>{if(!Kt&&!s&&!at(T,g.onBeforeInput)&&J.hasSelectableTarget(h,T.target)&&(T.preventDefault(),!J.isComposing(h))){var z=T.data;b.insertText(h,z)}},[g.onBeforeInput,h,s]),onInput:C.useCallback(T=>{if(!at(T,g.onInput)){if(N.current){N.current.handleInput();return}for(var z of A.current)z();A.current=[]}},[g.onInput]),onBlur:C.useCallback(T=>{if(!(s||I.isUpdatingSelection||!J.hasSelectableTarget(h,T.target)||at(T,g.onBlur))){var z=J.findDocumentOrShadowRoot(h);if(I.latestElement!==z.activeElement){var{relatedTarget:$}=T,K=J.toDOMNode(h,h);if($!==K&&!(Ct($)&&$.hasAttribute("data-slate-spacer"))){if($!=null&&tn($)&&J.hasDOMNode(h,$)){var te=J.toSlateNode(h,$);if(ce.isElement(te)&&!h.isVoid(te))return}if(fr){var ee=z.getSelection();ee==null||ee.removeAllRanges()}Xt.delete(h)}}}},[s,I.isUpdatingSelection,I.latestElement,h,g.onBlur]),onClick:C.useCallback(T=>{if(J.hasTarget(h,T.target)&&!at(T,g.onClick)&&tn(T.target)){var z=J.toSlateNode(h,T.target),$=J.findPath(h,z);if(!b.hasPath(h,$)||se.get(h,$)!==z)return;if(T.detail===ny&&$.length>=1){var K=$;if(!(ce.isElement(z)&&b.isBlock(h,z))){var te,ee=b.above(h,{match:Oe=>ce.isElement(Oe)&&b.isBlock(h,Oe),at:$});K=(te=ee==null?void 0:ee[1])!==null&&te!==void 0?te:$.slice(0,1)}var ae=b.range(h,K);Q.select(h,ae);return}if(s)return;var de=b.start(h,$),Y=b.end(h,$),pe=b.void(h,{at:de}),ge=b.void(h,{at:Y});if(pe&&ge&&P.equals(pe[1],ge[1])){var _e=b.range(h,de);Q.select(h,_e)}}},[h,g.onClick,s]),onCompositionEnd:C.useCallback(T=>{if(J.hasSelectableTarget(h,T.target)){var z;if(J.isComposing(h)&&Promise.resolve().then(()=>{v(!1),hn.set(h,!1)}),(z=N.current)===null||z===void 0||z.handleCompositionEnd(T),at(T,g.onCompositionEnd)||st)return;if(!fr&&!ib&&!tb&&!ob&&!sb&&T.data){var $=kt.get(h);kt.delete(h),$!==void 0&&(qt.set(h,h.marks),h.marks=$),b.insertText(h,T.data);var K=qt.get(h);qt.delete(h),K!==void 0&&(h.marks=K)}}},[g.onCompositionEnd,h]),onCompositionUpdate:C.useCallback(T=>{J.hasSelectableTarget(h,T.target)&&!at(T,g.onCompositionUpdate)&&(J.isComposing(h)||(v(!0),hn.set(h,!0)))},[g.onCompositionUpdate,h]),onCompositionStart:C.useCallback(T=>{if(J.hasSelectableTarget(h,T.target)){var z;if((z=N.current)===null||z===void 0||z.handleCompositionStart(T),at(T,g.onCompositionStart)||st)return;v(!0);var{selection:$}=h;if($&&H.isExpanded($)){b.deleteFragment(h);return}}},[g.onCompositionStart,h]),onCopy:C.useCallback(T=>{J.hasSelectableTarget(h,T.target)&&!at(T,g.onCopy)&&!rl(T)&&(T.preventDefault(),J.setFragmentData(h,T.clipboardData,"copy"))},[g.onCopy,h]),onCut:C.useCallback(T=>{if(!s&&J.hasSelectableTarget(h,T.target)&&!at(T,g.onCut)&&!rl(T)){T.preventDefault(),J.setFragmentData(h,T.clipboardData,"cut");var{selection:z}=h;if(z)if(H.isExpanded(z))b.deleteFragment(h);else{var $=se.parent(h,z.anchor.path);b.isVoid(h,$)&&Q.delete(h)}}},[s,h,g.onCut]),onDragOver:C.useCallback(T=>{if(J.hasTarget(h,T.target)&&!at(T,g.onDragOver)){var z=J.toSlateNode(h,T.target);ce.isElement(z)&&b.isVoid(h,z)&&T.preventDefault()}},[g.onDragOver,h]),onDragStart:C.useCallback(T=>{if(!s&&J.hasTarget(h,T.target)&&!at(T,g.onDragStart)){var z=J.toSlateNode(h,T.target),$=J.findPath(h,z),K=ce.isElement(z)&&b.isVoid(h,z)||b.void(h,{at:$,voids:!0});if(K){var te=b.range(h,$);Q.select(h,te)}I.isDraggingInternally=!0,J.setFragmentData(h,T.dataTransfer,"drag")}},[s,h,g.onDragStart,I]),onDrop:C.useCallback(T=>{if(!s&&J.hasTarget(h,T.target)&&!at(T,g.onDrop)){T.preventDefault();var z=h.selection,$=J.findEventRange(h,T),K=T.dataTransfer;Q.select(h,$),I.isDraggingInternally&&z&&!H.equals(z,$)&&!b.void(h,{at:$,voids:!0})&&Q.delete(h,{at:z}),J.insertData(h,K),J.isFocused(h)||J.focus(h)}I.isDraggingInternally=!1},[s,h,g.onDrop,I]),onDragEnd:C.useCallback(T=>{!s&&I.isDraggingInternally&&g.onDragEnd&&J.hasTarget(h,T.target)&&g.onDragEnd(T),I.isDraggingInternally=!1},[s,I,g,h]),onFocus:C.useCallback(T=>{if(!s&&!I.isUpdatingSelection&&J.hasEditableTarget(h,T.target)&&!at(T,g.onFocus)){var z=J.toDOMNode(h,h),$=J.findDocumentOrShadowRoot(h);if(I.latestElement=$.activeElement,In&&T.target!==z){z.focus();return}Xt.set(h,!0)}},[s,I,h,g.onFocus]),onKeyDown:C.useCallback(T=>{if(!s&&J.hasEditableTarget(h,T.target)){var z;(z=N.current)===null||z===void 0||z.handleKeyDown(T);var{nativeEvent:$}=T;if(J.isComposing(h)&&$.isComposing===!1&&(hn.set(h,!1),v(!1)),at(T,g.onKeyDown)||J.isComposing(h))return;var{selection:K}=h,te=h.children[K!==null?K.focus.path[0]:0],ee=ld(se.string(te))==="rtl";if(qe.isRedo($)){T.preventDefault();var ae=h;typeof ae.redo=="function"&&ae.redo();return}if(qe.isUndo($)){T.preventDefault();var de=h;typeof de.undo=="function"&&de.undo();return}if(qe.isMoveLineBackward($)){T.preventDefault(),Q.move(h,{unit:"line",reverse:!0});return}if(qe.isMoveLineForward($)){T.preventDefault(),Q.move(h,{unit:"line"});return}if(qe.isExtendLineBackward($)){T.preventDefault(),Q.move(h,{unit:"line",edge:"focus",reverse:!0});return}if(qe.isExtendLineForward($)){T.preventDefault(),Q.move(h,{unit:"line",edge:"focus"});return}if(qe.isMoveBackward($)){T.preventDefault(),K&&H.isCollapsed(K)?Q.move(h,{reverse:!ee}):Q.collapse(h,{edge:ee?"end":"start"});return}if(qe.isMoveForward($)){T.preventDefault(),K&&H.isCollapsed(K)?Q.move(h,{reverse:ee}):Q.collapse(h,{edge:ee?"start":"end"});return}if(qe.isMoveWordBackward($)){T.preventDefault(),K&&H.isExpanded(K)&&Q.collapse(h,{edge:"focus"}),Q.move(h,{unit:"word",reverse:!ee});return}if(qe.isMoveWordForward($)){T.preventDefault(),K&&H.isExpanded(K)&&Q.collapse(h,{edge:"focus"}),Q.move(h,{unit:"word",reverse:ee});return}if(Kt){if((kd||fr)&&K&&(qe.isDeleteBackward($)||qe.isDeleteForward($))&&H.isCollapsed(K)){var Y=se.parent(h,K.anchor.path);if(ce.isElement(Y)&&b.isVoid(h,Y)&&(b.isInline(h,Y)||b.isBlock(h,Y))){T.preventDefault(),b.deleteBackward(h,{unit:"block"});return}}}else{if(qe.isBold($)||qe.isItalic($)||qe.isTransposeCharacter($)){T.preventDefault();return}if(qe.isSoftBreak($)){T.preventDefault(),b.insertSoftBreak(h);return}if(qe.isSplitBlock($)){T.preventDefault(),b.insertBreak(h);return}if(qe.isDeleteBackward($)){T.preventDefault(),K&&H.isExpanded(K)?b.deleteFragment(h,{direction:"backward"}):b.deleteBackward(h);return}if(qe.isDeleteForward($)){T.preventDefault(),K&&H.isExpanded(K)?b.deleteFragment(h,{direction:"forward"}):b.deleteForward(h);return}if(qe.isDeleteLineBackward($)){T.preventDefault(),K&&H.isExpanded(K)?b.deleteFragment(h,{direction:"backward"}):b.deleteBackward(h,{unit:"line"});return}if(qe.isDeleteLineForward($)){T.preventDefault(),K&&H.isExpanded(K)?b.deleteFragment(h,{direction:"forward"}):b.deleteForward(h,{unit:"line"});return}if(qe.isDeleteWordBackward($)){T.preventDefault(),K&&H.isExpanded(K)?b.deleteFragment(h,{direction:"backward"}):b.deleteBackward(h,{unit:"word"});return}if(qe.isDeleteWordForward($)){T.preventDefault(),K&&H.isExpanded(K)?b.deleteFragment(h,{direction:"forward"}):b.deleteForward(h,{unit:"word"});return}}}},[s,h,g.onKeyDown]),onPaste:C.useCallback(T=>{!s&&J.hasEditableTarget(h,T.target)&&!at(T,g.onPaste)&&(!Kt||cb(T.nativeEvent)||fr)&&(T.preventDefault(),J.insertData(h,T.clipboardData))},[s,h,g.onPaste])}),C.createElement(dy,{decorations:R,node:h,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:h.selection})))))},hy=e=>{var{attributes:t,children:n}=e;return C.createElement("span",Tt({},t),n,st&&C.createElement("br",null))},my=()=>[],py=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&H.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),_0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},at=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},rl=e=>tn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),gy=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},vy=C.createContext(!1),by=C.createContext({});function yy(e){var t=C.useRef([]).current,n=C.useRef({editor:e}).current,r=C.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=C.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var Dy=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],Cy=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Kn(e,Dy),[l,u]=C.useState(()=>{if(!se.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Je.stringify(s)));if(!b.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Je.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:c,onChange:f}=yy(t),m=C.useCallback(h=>{var y;switch(r&&r(t.children),h==null||(y=h.operation)===null||y===void 0?void 0:y.type){case"set_selection":a==null||a(t.selection);break;default:i==null||i(t.children)}u(v=>({v:v.v+1,editor:t})),f(t)},[t,f,r,a,i]);C.useEffect(()=>(gs.set(t,m),()=>{gs.set(t,()=>{})}),[t,m]);var[p,g]=C.useState(J.isFocused(t));return C.useEffect(()=>{g(J.isFocused(t))},[t]),Fr(()=>{var h=()=>g(J.isFocused(t));return Ed>=17?(document.addEventListener("focusin",h),document.addEventListener("focusout",h),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",h)}):(document.addEventListener("focus",h,!0),document.addEventListener("blur",h,!0),()=>{document.removeEventListener("focus",h,!0),document.removeEventListener("blur",h,!0)})},[]),C.createElement(by.Provider,{value:c},C.createElement(Ld.Provider,{value:l},C.createElement(Js.Provider,{value:l.editor},C.createElement(vy.Provider,{value:p},n))))},al=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},il=(e,t,n)=>{var r=J.toDOMRange(e,t).getBoundingClientRect(),a=J.toDOMRange(e,n).getBoundingClientRect();return al(r,a)&&al(a,r)},xy=(e,t)=>{var n=b.range(e,H.end(t)),r=Array.from(b.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(il(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;)il(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 sl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function ol(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sl(Object(n),!0).forEach(function(r){xt(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 wy=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",r=t,{apply:a,onChange:i,deleteBackward:s,addMark:o,removeMark:l}=r;return Za.set(r,new WeakMap),r.addMark=(u,c)=>{var f,m;(f=to.get(r))===null||f===void 0||f(),!kt.get(r)&&(m=ct.get(r))!==null&&m!==void 0&&m.length&&kt.set(r,null),qt.delete(r),o(u,c)},r.removeMark=u=>{var c;!kt.get(r)&&(c=ct.get(r))!==null&&c!==void 0&&c.length&&kt.set(r,null),qt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&H.isCollapsed(r.selection)){var c=b.above(r,{match:g=>ce.isElement(g)&&b.isBlock(r,g),at:r.selection});if(c){var[,f]=c,m=b.range(r,f,r.selection.anchor),p=xy(r,m);H.isCollapsed(p)||Q.delete(r,{at:p})}}},r.apply=u=>{var c=[],f=[],m=ct.get(r);if(m!=null&&m.length){var p=m.map(j=>wb(j,u)).filter(Boolean);ct.set(r,p)}var g=Gt.get(r);g&&Gt.set(r,Zu(r,g,u));var h=Yt.get(r);if(h!=null&&h.at){var y=we.isPoint(h==null?void 0:h.at)?ys(r,h.at,u):Zu(r,h.at,u);Yt.set(r,y?ol(ol({},h),{},{at:y}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...Sn(r,u.path));break}case"set_selection":{var v;(v=gr.get(r))===null||v===void 0||v.unref(),gr.delete(r);break}case"insert_node":case"remove_node":{c.push(...Sn(r,P.parent(u.path)));break}case"merge_node":{var w=P.previous(u.path);c.push(...Sn(r,w));break}case"move_node":{var A=P.common(P.parent(u.path),P.parent(u.newPath));c.push(...Sn(r,A));var E;P.isBefore(u.path,u.newPath)?(c.push(...Sn(r,P.parent(u.path))),E=u.newPath):(c.push(...Sn(r,P.parent(u.newPath))),E=u.path);var k=se.get(t,P.parent(E)),F=J.findKey(r,k),S=b.pathRef(r,P.parent(E));f.push([S,F]);break}}a(u);for(var[L,I]of c){var[N]=b.node(r,L);ka.set(N,I)}for(var[M,x]of f)if(M.current){var[_]=b.node(r,M.current);ka.set(_,x)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[f,m]=H.edges(c),p=b.void(r,{at:f.path}),g=b.void(r,{at:m.path});if(!(H.isCollapsed(c)&&!p)){var h=J.toDOMRange(r,c),y=h.cloneContents(),v=y.childNodes[0];if(y.childNodes.forEach(N=>{N.textContent&&N.textContent.trim()!==""&&(v=N)}),g){var[w]=g,A=h.cloneRange(),E=J.toDOMNode(r,w);A.setEndAfter(E),y=A.cloneContents()}if(p&&(v=y.querySelector("[data-slate-spacer]")),Array.from(y.querySelectorAll("[data-slate-zero-width]")).forEach(N=>{var M=N.getAttribute("data-slate-zero-width")==="n";N.textContent=M?`
|
|
112
|
-
`:""}),Fd(v)){var k=v.ownerDocument.createElement("span");k.style.whiteSpace="pre",k.appendChild(v),y.appendChild(k),v=k}var F=r.getFragment(),S=JSON.stringify(F),L=window.btoa(encodeURIComponent(S));v.setAttribute("data-slate-fragment",L),u.setData("application/".concat(n),L);var I=y.ownerDocument.createElement("div");return I.appendChild(y),I.setAttribute("hidden","true"),y.ownerDocument.body.appendChild(I),u.setData("text/html",I.innerHTML),u.setData("text/plain",Sd(I)),y.ownerDocument.body.removeChild(I),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||pb(u);if(c){var f=decodeURIComponent(window.atob(c)),m=JSON.parse(f);return r.insertFragment(m),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var f=c.split(/\r\n|\r|\n/),m=!1;for(var p of f)m&&Q.splitNodes(r,{always:!0}),r.insertText(p),m=!0;return!0}return!1},r.onChange=u=>{var c=Ed<18?dc.unstable_batchedUpdates:f=>f();c(()=>{var f=gs.get(r);f&&f(u),i(u)})},r},Sn=(e,t)=>{var n=[];for(var[r,a]of b.levels(e,{at:t})){var i=J.findKey(e,r);n.push([a,i])}return n};const Ey={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,lastAnchor:null,dispatch:()=>{},reportError:e=>{console.error(e)}},_n=C.createContext(Ey);var G=(e=>(e.blockquote="block_quote",e.bold="bold",e.code="code",e.codeblock="code_block",e.heading="heading",e.hr="thematic_break",e.image="image",e.italic="italic",e.li="list_item",e.link="link",e.ol="ol_list",e.paragraph="paragraph",e.ul="ul_list",e.strikethrough="strikeThrough",e.span="span",e))(G||{}),Wt=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Wt||{});const ky=({attributes:e,children:t,element:n})=>{switch(n.type){case G.blockquote:return d.jsx("blockquote",{className:"subtle",...e,children:t});case G.link:return d.jsx("a",{...e,children:t});case G.li:return d.jsx("li",{...e,children:t});case G.ol:return d.jsx("ol",{...e,children:t});case G.ul:return d.jsx("ul",{...e,children:t});case G.span:return d.jsx("span",{...e,children:t});case G.paragraph:return d.jsx("p",{...e,children:t});default:return d.jsx("span",{...e,children:t})}},_y=({attributes:e,children:t,leaf:n})=>{const r=n;return r[G.bold]&&(t=d.jsx("strong",{children:t})),r[G.italic]&&(t=d.jsx("em",{children:t})),r[G.strikethrough]&&(t=d.jsx("s",{children:t})),d.jsx("span",{...e,children:t})},ao=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=oe.useIntl(),l=nr(),{id:u,tabbableOption:c,setFocus:f,openTooltip:m,dispatch:p}=C.useContext(_n),g={};return e!==c&&(g.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:Z(e,{"has-divider":n}),onMouseEnter:()=>{p([{type:"openTooltip",value:e}])},onMouseLeave:()=>{p([{type:"openTooltip",value:null}])},onFocus:()=>{p([{type:"openTooltip",value:e}])},onBlur:h=>{h.stopPropagation();const y=[{type:"openTooltip",value:null}];l.selection&&y.push({type:"lastAnchor",value:l.selection.anchor}),p(y)},contentEditable:!1,children:[d.jsxs("button",{...s,...g,className:Z(e,a,{active:t}),onClick:h=>{h.stopPropagation(),h.preventDefault()},onMouseDown:h=>{h.stopPropagation(),h.preventDefault(),r()},onKeyDown:h=>{var y,v,w,A;if(h.key!=="Tab")switch(h.key){case"Enter":h.stopPropagation(),h.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":h.stopPropagation(),h.preventDefault();const E=h.currentTarget.closest("li");let k=E==null?void 0:E.nextElementSibling;if(h.key==="ArrowLeft"){const L=E==null?void 0:E.previousElementSibling;L?k=L:k=(y=E==null?void 0:E.parentElement)==null?void 0:y.lastElementChild}else k||(k=(v=E==null?void 0:E.parentElement)==null?void 0:v.firstElementChild);const F=k==null?void 0:k.className.split(" ")[0];F&&(f(F),(w=k==null?void 0:k.querySelector("button"))==null||w.focus());break;default:const S=h.currentTarget.closest("fieldset");if(S){(A=S==null?void 0:S.previousElementSibling)==null||A.focus();break}}},children:[d.jsx(Ie,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(wn,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:m===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},ul=[G.ol,G.ul],qd=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(b.nodes(e,{at:b.unhangRange(e,n),match:a=>{const i=a;return!b.isEditor(a)&&ce.isElement(a)&&i.type===t}}));return!!r},By=e=>{const[t]=b.nodes(e,{match:n=>n.type===G.blockquote});return!!t},Wd=(e,t,n)=>{try{const r=By(e),a=qd(e,t),i=ul.includes(t);Q.unwrapNodes(e,{match:l=>{const u=l;return!b.isEditor(u)&&ce.isElement(u)&&ul.includes(u.type)},split:!0});const o={type:a?G.paragraph:i?G.li:t};if(Q.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,c]=b.parent(e,l,{edge:"end"});Array.from(b.nodes(e,{at:c,match:m=>{const p=m;return!b.isEditor(m)&&ce.isElement(m)&&p.type===G.li}})).forEach(([m,p])=>{se.string(m).trim()===""&&Q.removeNodes(e,{at:p})})}else{if(r){const u={type:G.blockquote,children:[]};Q.wrapNodes(e,u)}const l={type:t,children:[]};Q.wrapNodes(e,l)}}catch(r){const a=r.message;n(`Error toggling block: ${a}`)}},Ay=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(_n),a=nr(),i=qd(a,e);return d.jsx(ao,{id:e,active:i,hasDivider:t,callback:()=>{Wd(a,e,r),n(i?null:e)}})},Fy=52,ll=16,Ty=(e,t,n)=>{const r=C.useRef(null),{showLinkEditor:a}=C.useContext(_n),i=t==="link-editor"?a:!1;return C.useEffect(()=>{var f;if(!(r!=null&&r.current)||!i)return;const s=r==null?void 0:r.current;if(!s)return;const o=document.getSelection();let l;o!=null&&o.toString().trim().length?l=o==null?void 0:o.getRangeAt(0).getBoundingClientRect():l=(f=document.getElementById(n))==null?void 0:f.getBoundingClientRect();const u=((l==null?void 0:l.top)||0)+window.scrollY-Fy,c=Math.max(((l==null?void 0:l.left)||0)-(s.offsetWidth-((l==null?void 0:l.width)||0)),0);s.style.top=`${u/ll}rem`,s.style.left=`${c/ll}rem`},[i,e.selection]),r},Sy=e=>{const[t,n]=C.useState(null);return C.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=b.nodes(e,{at:r,match:i=>i.type===G.link});if(a){const i=a[0],s=Ac(i.link),o=i.children[0],l=(o==null?void 0:o.text)||"";n({...s,text:l})}else n(null)},[e,e.selection]),t};var it=(e=>(e.paragraph="paragraph",e.heading="heading",e.list="list",e.listItem="listItem",e.link="link",e.image="image",e.blockquote="blockquote",e.code="code",e.html="html",e.emphasis="emphasis",e.strong="strong",e.delete="delete",e.inlineCode="inlineCode",e.thematicBreak="thematicBreak",e.text="text",e))(it||{});const $n={[G.paragraph]:G.paragraph,[G.blockquote]:G.blockquote,[G.codeblock]:G.codeblock,[G.link]:G.link,[G.ul]:G.ul,[G.ol]:G.ol,[G.li]:G.li,[G.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Wt.emphasis]:G.italic,[Wt.strong]:G.bold,[Wt.delete]:G.strikethrough,[Wt.code]:G.code,[G.hr]:G.hr,[G.image]:G.image};function cl(e){if(e)throw e}var fa=Object.prototype.hasOwnProperty,Hd=Object.prototype.toString,dl=Object.defineProperty,fl=Object.getOwnPropertyDescriptor,hl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Hd.call(t)==="[object Array]"},ml=function(t){if(!t||Hd.call(t)!=="[object Object]")return!1;var n=fa.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&fa.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||fa.call(t,a)},pl=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},gl=function(t,n){if(n==="__proto__")if(fa.call(t,n)){if(fl)return fl(t,n).value}else return;return t[n]},jy=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=gl(o,n),a=gl(t,n),o!==a&&(c&&a&&(ml(a)||(i=hl(a)))?(i?(i=!1,s=r&&hl(r)?r:[]):s=r&&ml(r)?r:{},pl(o,{name:n,newValue:e(c,s,a)})):typeof a<"u"&&pl(o,{name:n,newValue:a}));return o};const xi=xn(jy);function Cs(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 Oy(){const e=[],t={run:n,use:r};return t;function n(...a){let i=-1;const s=a.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);o(null,...a);function o(l,...u){const c=e[++i];let f=-1;if(l){s(l);return}for(;++f<a.length;)(u[f]===null||u[f]===void 0)&&(u[f]=a[f]);a=u,c?Py(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 Py(e,t){let n;return r;function r(...s){const o=e.length>s.length;let l;o&&s.push(a);try{l=e.apply(this,s)}catch(u){const c=u;if(o&&n)throw c;return a(c)}o||(l&&l.then&&typeof l.then=="function"?l.then(i,a):l instanceof Error?a(l):i(l))}function a(s,...o){n||(n=!0,t(s,...o))}function i(s){a(null,s)}}function vr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?vl(e.position):"start"in e||"end"in e?vl(e):"line"in e||"column"in e?xs(e):""}function xs(e){return bl(e&&e.line)+":"+bl(e&&e.column)}function vl(e){return xs(e&&e.start)+"-"+xs(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=vr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}ht.prototype.file="";ht.prototype.name="";ht.prototype.reason="";ht.prototype.message="";ht.prototype.stack="";ht.prototype.column=void 0;ht.prototype.line=void 0;ht.prototype.ancestors=void 0;ht.prototype.cause=void 0;ht.prototype.fatal=void 0;ht.prototype.place=void 0;ht.prototype.ruleId=void 0;ht.prototype.source=void 0;const St={basename:Ny,dirname:Ry,extname:My,join:Iy,sep:"/"};function Ny(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Or(e);let n=0,r=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else r<0&&(i=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function Ry(e){if(Or(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function My(e){Or(e);let t=e.length,n=-1,r=0,a=-1,i=0,s;for(;t--;){const o=e.codePointAt(t);if(o===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),o===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function Iy(...e){let t=-1,n;for(;++t<e.length;)Or(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":$y(n)}function $y(e){Or(e);const t=e.codePointAt(0)===47;let n=Ly(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Ly(e,t){let n="",r=0,a=-1,i=0,s=-1,o,l;for(;++s<=e.length;){if(s<e.length)o=e.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(a===s-1||i===1))if(a!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),a=s,i=0;continue}}else if(n.length>0){n="",r=0,a=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,s):n=e.slice(a+1,s),r=s-a-1;a=s,i=0}else o===46&&i>-1?i++:i=-1}return n}function Or(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const zy={cwd:qy};function qy(){return"/"}function ws(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Wy(e){if(typeof e=="string")e=new URL(e);else if(!ws(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Hy(e)}function Hy(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 wi=["history","path","basename","stem","extname","dirname"];class Uy{constructor(t){let n;t?ws(t)?n={path:t}:typeof t=="string"||Vy(t)?n={value:t}:n=t:n={},this.cwd=zy.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<wi.length;){const i=wi[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)wi.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?St.basename(this.path):void 0}set basename(t){ki(t,"basename"),Ei(t,"basename"),this.path=St.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?St.dirname(this.path):void 0}set dirname(t){yl(this.basename,"dirname"),this.path=St.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?St.extname(this.path):void 0}set extname(t){if(Ei(t,"extname"),yl(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=St.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ws(t)&&(t=Wy(t)),ki(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?St.basename(this.path,this.extname):void 0}set stem(t){ki(t,"stem"),Ei(t,"stem"),this.path=St.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new ht(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Ei(e,t){if(e&&e.includes(St.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+St.sep+"`")}function ki(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function yl(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Vy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Ky=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},Zy={}.hasOwnProperty;class io extends Ky{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=Oy()}copy(){const t=new io;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(xi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ai("data",this.frozen),this.namespace[t]=n,this):Zy.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ai("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Yr(t),r=this.parser||this.Parser;return _i("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),_i("process",this.parser||this.Parser),Bi("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=Yr(t),l=r.parse(o);r.run(l,o,function(c,f,m){if(c||!f||!m)return u(c);const p=f,g=r.stringify(p,m);Qy(g)?m.value=g:m.result=g,u(c,m)});function u(c,f){c||!f?s(c):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),_i("processSync",this.parser||this.Parser),Bi("processSync",this.compiler||this.Compiler),this.process(t,a),Cl("processSync","process",n),r;function a(i,s){n=!0,cl(i),r=s}}run(t,n,r){Dl(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,o){const l=Yr(n);a.run(t,l,u);function u(c,f,m){const p=f||t;c?o(c):s?s(p):r(void 0,p,m)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),Cl("runSync","run",r),a;function i(s,o){cl(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=Yr(n),a=this.compiler||this.Compiler;return Bi("stringify",a),Dl(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Ai("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?o(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...f]=u;l(c,f)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(a.settings=xi(!0,a.settings,u.settings))}function o(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const f=u[c];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let f=-1,m=-1;for(;++f<r.length;)if(r[f][0]===u){m=f;break}if(m===-1)r.push([u,...c]);else if(c.length>0){let[p,...g]=c;const h=r[m][1];Cs(h)&&Cs(p)&&(p=xi(!0,h,p)),r[m]=[u,p,...g]}}}}const Yy=new io().freeze();function _i(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Bi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ai(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 Dl(e){if(!Cs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Cl(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Yr(e){return Gy(e)?e:new Uy(e)}function Gy(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Qy(e){return typeof e=="string"||Jy(e)}function Jy(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Xy={};function e1(e,t){const n=t||Xy,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Ud(e,r,a)}function Ud(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 xl(e.children,t,n)}return Array.isArray(e)?xl(e,t,n):""}function xl(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Ud(e[a],t,n);return r.join("")}function t1(e){return!!(e&&typeof e=="object")}const wl=document.createElement("i");function so(e){const t="&"+e+";";wl.innerHTML=t;const n=wl.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Nt(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function Dt(e,t){return e.length>0?(Nt(e,e.length,0,t),e):t}const El={}.hasOwnProperty;function n1(e){const t={};let n=-1;for(;++n<e.length;)r1(t,e[n]);return t}function r1(e,t){let n;for(n in t){const a=(El.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){El.call(a,s)||(a[s]=[]);const o=i[s];a1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function a1(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Nt(e,0,0,r)}function Vd(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function qn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const jt=on(/[A-Za-z]/),_t=on(/[\dA-Za-z]/),i1=on(/[#-'*+\--9=?A-Z^-~]/);function Es(e){return e!==null&&(e<32||e===127)}const ks=on(/\d/),s1=on(/[\dA-Fa-f]/),o1=on(/[!-/:-@[-`{-~]/);function ye(e){return e!==null&&e<-2}function ft(e){return e!==null&&(e<0||e===32)}function Te(e){return e===-2||e===-1||e===32}const u1=on(/\p{P}|\p{S}/u),l1=on(/\s/);function on(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Me(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Te(l)?(e.enter(n),o(l)):t(l)}function o(l){return Te(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const c1={tokenize:d1};function d1(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"),Me(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 f1={tokenize:h1},kl={tokenize:m1};function h1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(A){if(r<n.length){const E=n[r];return t.containerState=E[1],e.attempt(E[0].continuation,l,u)(A)}return u(A)}function l(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&w();const E=t.events.length;let k=E,F;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){F=t.events[k][1].end;break}v(r);let S=E;for(;S<t.events.length;)t.events[S][1].end=Object.assign({},F),S++;return Nt(t.events,k+1,0,t.events.slice(E)),t.events.length=S,u(A)}return o(A)}function u(A){if(r===n.length){if(!a)return m(A);if(a.currentConstruct&&a.currentConstruct.concrete)return g(A);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(kl,c,f)(A)}function c(A){return a&&w(),v(r),m(A)}function f(A){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(A)}function m(A){return t.containerState={},e.attempt(kl,p,g)(A)}function p(A){return r++,n.push([t.currentConstruct,t.containerState]),m(A)}function g(A){if(A===null){a&&w(),v(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),h(A)}function h(A){if(A===null){y(e.exit("chunkFlow"),!0),v(0),e.consume(A);return}return ye(A)?(e.consume(A),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(A),h)}function y(A,E){const k=t.sliceStream(A);if(E&&k.push(null),A.previous=i,i&&(i.next=A),i=A,a.defineSkip(A.start),a.write(k),t.parser.lazy[A.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 L=S,I,N;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(I){N=t.events[L][1].end;break}I=!0}for(v(r),F=S;F<t.events.length;)t.events[F][1].end=Object.assign({},N),F++;Nt(t.events,L+1,0,t.events.slice(S)),t.events.length=F}}function v(A){let E=n.length;for(;E-- >A;){const k=n[E];t.containerState=k[1],k[0].exit.call(t,e)}n.length=A}function w(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function m1(e,t,n){return Me(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function _l(e){if(e===null||ft(e)||l1(e))return 1;if(u1(e))return 2}function oo(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const i=e[a].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const _s={name:"attention",tokenize:g1,resolveAll:p1};function p1(e,t){let n=-1,r,a,i,s,o,l,u,c;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f=Object.assign({},e[r][1].end),m=Object.assign({},e[n][1].start);Bl(f,-l),Bl(m,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:m},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Dt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Dt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Dt(u,oo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Dt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=Dt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Nt(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 g1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=_l(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=_l(l),f=!c||c===2&&a||n.includes(l),m=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?f:f&&(a||!m)),u._close=!!(i===42?m:m&&(c||!f)),t(l)}}function Bl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const v1={name:"autolink",tokenize:b1};function b1(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return jt(p)?(e.consume(p),s):u(p)}function s(p){return p===43||p===45||p===46||_t(p)?(r=1,o(p)):u(p)}function o(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||_t(p))&&r++<32?(e.consume(p),o):(r=0,u(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Es(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),c):i1(p)?(e.consume(p),u):n(p)}function c(p){return _t(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,c):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):m(p)}function m(p){if((p===45||_t(p))&&r++<63){const g=p===45?m:f;return e.consume(p),g}return n(p)}}const Ya={tokenize:y1,partial:!0};function y1(e,t,n){return r;function r(i){return Te(i)?Me(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ye(i)?t(i):n(i)}}const Kd={name:"blockQuote",tokenize:D1,continuation:{tokenize:C1},exit:x1};function D1(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 Te(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function C1(e,t,n){const r=this;return a;function a(s){return Te(s)?Me(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Kd,t,n)(s)}}function x1(e){e.exit("blockQuote")}const Zd={name:"characterEscape",tokenize:w1};function w1(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 o1(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Yd={name:"characterReference",tokenize:E1};function E1(e,t,n){const r=this;let a=0,i,s;return o;function o(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=_t,c(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=s1,c):(e.enter("characterReferenceValue"),i=7,s=ks,c(f))}function c(f){if(f===59&&a){const m=e.exit("characterReferenceValue");return s===_t&&!so(r.sliceSerialize(m))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(f)&&a++<i?(e.consume(f),c):n(f)}}const Al={tokenize:_1,partial:!0},Fl={name:"codeFenced",tokenize:k1,concrete:!0};function k1(e,t,n){const r=this,a={tokenize:k,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"),c(F)}function c(F){return F===o?(s++,e.consume(F),c):s<3?n(F):(e.exit("codeFencedFenceSequence"),Te(F)?Me(e,f,"whitespace")(F):f(F))}function f(F){return F===null||ye(F)?(e.exit("codeFencedFence"),r.interrupt?t(F):e.check(Al,h,E)(F)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(F))}function m(F){return F===null||ye(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(F)):Te(F)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Me(e,p,"whitespace")(F)):F===96&&F===o?n(F):(e.consume(F),m)}function p(F){return F===null||ye(F)?f(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"),f(F)):F===96&&F===o?n(F):(e.consume(F),g)}function h(F){return e.attempt(a,E,y)(F)}function y(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),v}function v(F){return i>0&&Te(F)?Me(e,w,"linePrefix",i+1)(F):w(F)}function w(F){return F===null||ye(F)?e.check(Al,h,E)(F):(e.enter("codeFlowValue"),A(F))}function A(F){return F===null||ye(F)?(e.exit("codeFlowValue"),w(F)):(e.consume(F),A)}function E(F){return e.exit("codeFenced"),t(F)}function k(F,S,L){let I=0;return N;function N(R){return F.enter("lineEnding"),F.consume(R),F.exit("lineEnding"),M}function M(R){return F.enter("codeFencedFence"),Te(R)?Me(F,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):x(R)}function x(R){return R===o?(F.enter("codeFencedFenceSequence"),_(R)):L(R)}function _(R){return R===o?(I++,F.consume(R),_):I>=s?(F.exit("codeFencedFenceSequence"),Te(R)?Me(F,j,"whitespace")(R):j(R)):L(R)}function j(R){return R===null||ye(R)?(F.exit("codeFencedFence"),S(R)):L(R)}}}function _1(e,t,n){const r=this;return a;function a(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const Fi={name:"codeIndented",tokenize:A1},B1={tokenize:F1,partial:!0};function A1(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Me(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):ye(u)?e.attempt(B1,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 F1(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):Me(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 T1={name:"codeText",tokenize:O1,resolve:S1,previous:j1};function S1(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 j1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function O1(e,t,n){let r=0,a,i;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),o(f)}function o(f){return f===96?(e.consume(f),r++,o):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(i=e.enter("codeTextSequence"),a=0,c(f)):ye(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||ye(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),u)}function c(f){return f===96?(e.consume(f),a++,c):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}function Gd(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,P1(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),Nt(e,a,n-a+1,o))}}return!u}function P1(e,t){const n=e[t][1],r=e[t][2];let a=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),o=s.events,l=[],u={};let c,f,m=-1,p=n,g=0,h=0;const y=[h];for(;p;){for(;e[++a][1]!==p;);i.push(a),p._tokenizer||(c=r.sliceStream(p),p.next||c.push(null),f&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++m<o.length;)o[m][0]==="exit"&&o[m-1][0]==="enter"&&o[m][1].type===o[m-1][1].type&&o[m][1].start.line!==o[m][1].end.line&&(h=m+1,y.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),m=y.length;m--;){const v=o.slice(y[m],y[m+1]),w=i.pop();l.unshift([w,w+v.length-1]),Nt(e,w,2,v)}for(m=-1;++m<l.length;)u[g+l[m][0]]=g+l[m][1],g+=l[m][1]-l[m][0]-1;return u}const N1={tokenize:I1,resolve:M1},R1={tokenize:$1,partial:!0};function M1(e){return Gd(e),e}function I1(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(R1,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 $1(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Me(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 Qd(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(v){return v===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(v),e.exit(i),m):v===null||v===32||v===41||Es(v)?n(v):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),h(v))}function m(v){return v===62?(e.enter(i),e.consume(v),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===62?(e.exit("chunkString"),e.exit(o),m(v)):v===null||v===60||ye(v)?n(v):(e.consume(v),v===92?g:p)}function g(v){return v===60||v===62||v===92?(e.consume(v),p):p(v)}function h(v){return!c&&(v===null||v===41||ft(v))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(v)):c<u&&v===40?(e.consume(v),c++,h):v===41?(e.consume(v),c--,h):v===null||v===32||v===40||Es(v)?n(v):(e.consume(v),v===92?y:h)}function y(v){return v===40||v===41||v===92?(e.consume(v),h):h(v)}}function Jd(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),c}function c(p){return o>999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):ye(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||ye(p)||o++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!Te(p)),p===92?m:f)}function m(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}}function Xd(e,t,n,r,a,i){let s;return o;function o(m){return m===34||m===39||m===40?(e.enter(r),e.enter(a),e.consume(m),e.exit(a),s=m===40?41:m,l):n(m)}function l(m){return m===s?(e.enter(a),e.consume(m),e.exit(a),e.exit(r),t):(e.enter(i),u(m))}function u(m){return m===s?(e.exit(i),l(s)):m===null?n(m):ye(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),Me(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(m))}function c(m){return m===s||m===null||ye(m)?(e.exit("chunkString"),u(m)):(e.consume(m),m===92?f:c)}function f(m){return m===s||m===92?(e.consume(m),c):c(m)}}function br(e,t){let n;return r;function r(a){return ye(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Te(a)?Me(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const L1={name:"definition",tokenize:q1},z1={tokenize:W1,partial:!0};function q1(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return Jd.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return a=qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ft(p)?br(e,u)(p):u(p)}function u(p){return Qd(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(z1,f,f)(p)}function f(p){return Te(p)?Me(e,m,"whitespace")(p):m(p)}function m(p){return p===null||ye(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function W1(e,t,n){return r;function r(o){return ft(o)?br(e,a)(o):n(o)}function a(o){return Xd(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Te(o)?Me(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ye(o)?t(o):n(o)}}const H1={name:"hardBreakEscape",tokenize:U1};function U1(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 V1={name:"headingAtx",tokenize:Z1,resolve:K1};function K1(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"},Nt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function Z1(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||ye(c)?(e.exit("atxHeading"),t(c)):Te(c)?Me(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 Y1=["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"],Tl=["pre","script","style","textarea"],G1={name:"htmlFlow",tokenize:eD,resolveTo:X1,concrete:!0},Q1={tokenize:nD,partial:!0},J1={tokenize:tD,partial:!0};function X1(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 eD(e,t,n){const r=this;let a,i,s,o,l;return u;function u(B){return c(B)}function c(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),f}function f(B){return B===33?(e.consume(B),m):B===47?(e.consume(B),i=!0,h):B===63?(e.consume(B),a=3,r.interrupt?t:D):jt(B)?(e.consume(B),s=String.fromCharCode(B),y):n(B)}function m(B){return B===45?(e.consume(B),a=2,p):B===91?(e.consume(B),a=5,o=0,g):jt(B)?(e.consume(B),a=4,r.interrupt?t:D):n(B)}function p(B){return B===45?(e.consume(B),r.interrupt?t:D):n(B)}function g(B){const T="CDATA[";return B===T.charCodeAt(o++)?(e.consume(B),o===T.length?r.interrupt?t:x:g):n(B)}function h(B){return jt(B)?(e.consume(B),s=String.fromCharCode(B),y):n(B)}function y(B){if(B===null||B===47||B===62||ft(B)){const T=B===47,z=s.toLowerCase();return!T&&!i&&Tl.includes(z)?(a=1,r.interrupt?t(B):x(B)):Y1.includes(s.toLowerCase())?(a=6,T?(e.consume(B),v):r.interrupt?t(B):x(B)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):i?w(B):A(B))}return B===45||_t(B)?(e.consume(B),s+=String.fromCharCode(B),y):n(B)}function v(B){return B===62?(e.consume(B),r.interrupt?t:x):n(B)}function w(B){return Te(B)?(e.consume(B),w):N(B)}function A(B){return B===47?(e.consume(B),N):B===58||B===95||jt(B)?(e.consume(B),E):Te(B)?(e.consume(B),A):N(B)}function E(B){return B===45||B===46||B===58||B===95||_t(B)?(e.consume(B),E):k(B)}function k(B){return B===61?(e.consume(B),F):Te(B)?(e.consume(B),k):A(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):Te(B)?(e.consume(B),F):L(B)}function S(B){return B===l?(e.consume(B),l=null,I):B===null||ye(B)?n(B):(e.consume(B),S)}function L(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||ft(B)?k(B):(e.consume(B),L)}function I(B){return B===47||B===62||Te(B)?A(B):n(B)}function N(B){return B===62?(e.consume(B),M):n(B)}function M(B){return B===null||ye(B)?x(B):Te(B)?(e.consume(B),M):n(B)}function x(B){return B===45&&a===2?(e.consume(B),q):B===60&&a===1?(e.consume(B),V):B===62&&a===4?(e.consume(B),W):B===63&&a===3?(e.consume(B),D):B===93&&a===5?(e.consume(B),ne):ye(B)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(Q1,X,_)(B)):B===null||ye(B)?(e.exit("htmlFlowData"),_(B)):(e.consume(B),x)}function _(B){return e.check(J1,j,X)(B)}function j(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),R}function R(B){return B===null||ye(B)?_(B):(e.enter("htmlFlowData"),x(B))}function q(B){return B===45?(e.consume(B),D):x(B)}function V(B){return B===47?(e.consume(B),s="",ue):x(B)}function ue(B){if(B===62){const T=s.toLowerCase();return Tl.includes(T)?(e.consume(B),W):x(B)}return jt(B)&&s.length<8?(e.consume(B),s+=String.fromCharCode(B),ue):x(B)}function ne(B){return B===93?(e.consume(B),D):x(B)}function D(B){return B===62?(e.consume(B),W):B===45&&a===2?(e.consume(B),D):x(B)}function W(B){return B===null||ye(B)?(e.exit("htmlFlowData"),X(B)):(e.consume(B),W)}function X(B){return e.exit("htmlFlow"),t(B)}}function tD(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 nD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Ya,t,n)}}const rD={name:"htmlText",tokenize:aD};function aD(e,t,n){const r=this;let a,i,s;return o;function o(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),l}function l(D){return D===33?(e.consume(D),u):D===47?(e.consume(D),k):D===63?(e.consume(D),A):jt(D)?(e.consume(D),L):n(D)}function u(D){return D===45?(e.consume(D),c):D===91?(e.consume(D),i=0,g):jt(D)?(e.consume(D),w):n(D)}function c(D){return D===45?(e.consume(D),p):n(D)}function f(D){return D===null?n(D):D===45?(e.consume(D),m):ye(D)?(s=f,V(D)):(e.consume(D),f)}function m(D){return D===45?(e.consume(D),p):f(D)}function p(D){return D===62?q(D):D===45?m(D):f(D)}function g(D){const W="CDATA[";return D===W.charCodeAt(i++)?(e.consume(D),i===W.length?h:g):n(D)}function h(D){return D===null?n(D):D===93?(e.consume(D),y):ye(D)?(s=h,V(D)):(e.consume(D),h)}function y(D){return D===93?(e.consume(D),v):h(D)}function v(D){return D===62?q(D):D===93?(e.consume(D),v):h(D)}function w(D){return D===null||D===62?q(D):ye(D)?(s=w,V(D)):(e.consume(D),w)}function A(D){return D===null?n(D):D===63?(e.consume(D),E):ye(D)?(s=A,V(D)):(e.consume(D),A)}function E(D){return D===62?q(D):A(D)}function k(D){return jt(D)?(e.consume(D),F):n(D)}function F(D){return D===45||_t(D)?(e.consume(D),F):S(D)}function S(D){return ye(D)?(s=S,V(D)):Te(D)?(e.consume(D),S):q(D)}function L(D){return D===45||_t(D)?(e.consume(D),L):D===47||D===62||ft(D)?I(D):n(D)}function I(D){return D===47?(e.consume(D),q):D===58||D===95||jt(D)?(e.consume(D),N):ye(D)?(s=I,V(D)):Te(D)?(e.consume(D),I):q(D)}function N(D){return D===45||D===46||D===58||D===95||_t(D)?(e.consume(D),N):M(D)}function M(D){return D===61?(e.consume(D),x):ye(D)?(s=M,V(D)):Te(D)?(e.consume(D),M):I(D)}function x(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),a=D,_):ye(D)?(s=x,V(D)):Te(D)?(e.consume(D),x):(e.consume(D),j)}function _(D){return D===a?(e.consume(D),a=void 0,R):D===null?n(D):ye(D)?(s=_,V(D)):(e.consume(D),_)}function j(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||ft(D)?I(D):(e.consume(D),j)}function R(D){return D===47||D===62||ft(D)?I(D):n(D)}function q(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function V(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),ue}function ue(D){return Te(D)?Me(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):ne(D)}function ne(D){return e.enter("htmlTextData"),s(D)}}const uo={name:"labelEnd",tokenize:cD,resolveTo:lD,resolveAll:uD},iD={tokenize:dD},sD={tokenize:fD},oD={tokenize:hD};function uD(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 lD(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},c={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=Dt(o,e.slice(i+1,i+r+3)),o=Dt(o,[["enter",c,t]]),o=Dt(o,oo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=Dt(o,[["exit",c,t],e[s-2],e[s-1],["exit",u,t]]),o=Dt(o,e.slice(s+1)),o=Dt(o,[["exit",l,t]]),Nt(e,i,e.length,o),e}function cD(e,t,n){const r=this;let a=r.events.length,i,s;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){i=r.events[a][1];break}return o;function o(m){return i?i._inactive?f(m):(s=r.parser.defined.includes(qn(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):n(m)}function l(m){return m===40?e.attempt(iD,c,s?c:f)(m):m===91?e.attempt(sD,c,s?u:f)(m):s?c(m):f(m)}function u(m){return e.attempt(oD,c,f)(m)}function c(m){return t(m)}function f(m){return i._balanced=!0,n(m)}}function dD(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),a}function a(f){return ft(f)?br(e,i)(f):i(f)}function i(f){return f===41?c(f):Qd(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return ft(f)?br(e,l)(f):c(f)}function o(f){return n(f)}function l(f){return f===34||f===39||f===40?Xd(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):c(f)}function u(f){return ft(f)?br(e,c)(f):c(f)}function c(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function fD(e,t,n){const r=this;return a;function a(o){return Jd.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(qn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function hD(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 mD={name:"labelStartImage",tokenize:pD,resolveAll:uo.resolveAll};function pD(e,t,n){const r=this;return a;function a(o){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(o),e.exit("labelImageMarker"),i}function i(o){return o===91?(e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelImage"),s):n(o)}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const gD={name:"labelStartLink",tokenize:vD,resolveAll:uo.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 Ti={name:"lineEnding",tokenize:bD};function bD(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Me(e,t,"linePrefix")}}const ha={name:"thematicBreak",tokenize:yD};function yD(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"),Te(u)?Me(e,o,"whitespace")(u):o(u))}}const lt={name:"list",tokenize:xD,continuation:{tokenize:wD},exit:kD},DD={tokenize:_D,partial:!0},CD={tokenize:ED,partial:!0};function xD(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:ks(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ha,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return ks(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Ya,r.interrupt?n:c,e.attempt(DD,m,f))}function c(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function f(p){return Te(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function wD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ya,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Me(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Te(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(CD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Me(e,e.attempt(lt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function ED(e,t,n){const r=this;return Me(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 kD(e){e.exit(this.containerState.type)}function _D(e,t,n){const r=this;return Me(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!Te(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Sl={name:"setextUnderline",tokenize:AD,resolveTo:BD};function BD(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 AD(e,t,n){const r=this;let a;return i;function i(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Te(u)?Me(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ye(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const FD={tokenize:TD};function TD(e){const t=this,n=e.attempt(Ya,r,e.attempt(this.parser.constructs.flowInitial,a,Me(e,e.attempt(this.parser.constructs.flow,a,e.attempt(N1,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 SD={resolveAll:tf()},jD=ef("string"),OD=ef("text");function ef(e){return{tokenize:t,resolveAll:tf(e==="text"?PD:void 0)};function t(n){const r=this,a=this.parser.constructs[e],i=n.attempt(a,s,o);return s;function s(c){return u(c)?i(c):o(c)}function o(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const f=a[c];let m=-1;if(f)for(;++m<f.length;){const p=f[m];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function tf(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 PD(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 ND(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:w,enter:A,exit:E,attempt:S(k),check:S(F),interrupt:S(F,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:m,now:g,defineSkip:h,write:f};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function f(M){return s=Dt(s,M),y(),s[s.length-1]!==null?[]:(L(t,0),u.events=oo(i,u.events,u),u.events)}function m(M,x){return MD(p(M),x)}function p(M){return RD(s,M)}function g(){const{line:M,column:x,offset:_,_index:j,_bufferIndex:R}=r;return{line:M,column:x,offset:_,_index:j,_bufferIndex:R}}function h(M){a[M.line]=M.column,N()}function y(){let M;for(;r._index<s.length;){const x=s[r._index];if(typeof x=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<x.length;)v(x.charCodeAt(r._bufferIndex));else v(x)}}function v(M){c=c(M)}function w(M){ye(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,N()):M!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=M}function A(M,x){const _=x||{};return _.type=M,_.start=g(),u.events.push(["enter",_,u]),o.push(_),_}function E(M){const x=o.pop();return x.end=g(),u.events.push(["exit",x,u]),x}function k(M,x){L(M,x.from)}function F(M,x){x.restore()}function S(M,x){return _;function _(j,R,q){let V,ue,ne,D;return Array.isArray(j)?X(j):"tokenize"in j?X([j]):W(j);function W($){return K;function K(te){const ee=te!==null&&$[te],ae=te!==null&&$.null,de=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(ae)?ae:ae?[ae]:[]];return X(de)(te)}}function X($){return V=$,ue=0,$.length===0?q:B($[ue])}function B($){return K;function K(te){return D=I(),ne=$,$.partial||(u.currentConstruct=$),$.name&&u.parser.constructs.disable.null.includes($.name)?z():$.tokenize.call(x?Object.assign(Object.create(u),x):u,l,T,z)(te)}}function T($){return M(ne,D),R}function z($){return D.restore(),++ue<V.length?B(V[ue]):q}}}function L(M,x){M.resolveAll&&!i.includes(M)&&i.push(M),M.resolve&&Nt(u.events,x,u.events.length-x,M.resolve(u.events.slice(x),u)),M.resolveTo&&(u.events=M.resolveTo(u.events,u))}function I(){const M=g(),x=u.previous,_=u.currentConstruct,j=u.events.length,R=Array.from(o);return{restore:q,from:j};function q(){r=M,u.previous=x,u.currentConstruct=_,u.events.length=j,o=R,N()}}function N(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function RD(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 MD(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
|
|
107
|
+
`)&&c===u.textContent.length&&c--,"getAttribute"in u&&u.getAttribute("contenteditable")==="false"&&u.getAttribute("data-slate-void")!=="true"){var w;u=o,c=((w=o.textContent)===null||w===void 0?void 0:w.length)||0}var A=J.toSlatePoint(e,[o,l],{exactMatch:a,suppressThrow:i});if(!A)return null;var k=m?A:J.toSlatePoint(e,[u,c],{exactMatch:a,suppressThrow:i});if(!k)return null;var E={anchor:A,focus:k};return U.isExpanded(E)&&U.isForward(E)&&Ct(u)&&v.void(e,{at:E.focus,mode:"highest"})&&(E=v.unhangRange(e,E,{voids:!0})),E}};function Tb(e,t){var{path:n,diff:r}=t;if(!v.hasPath(e,n))return!1;var a=ie.get(e,n);if(!de.isText(a))return!1;if(r.start!==a.text.length||r.text.length===0)return a.text.slice(r.start,r.start+r.text.length)===r.text;var i=P.next(n);if(!v.hasPath(e,i))return!1;var s=ie.get(e,i);return de.isText(s)&&s.text.startsWith(r.text)}function Ld(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 Sb(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 jb(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 zd(e,t){var{start:n,end:r,text:a}=t,i=e.slice(n,r),s=Sb(i,a),o=Math.min(i.length-s,a.length-s),l=jb(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 Ob(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=Ld(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 zd(e,{start:r,end:l,text:o})}function Pb(e){var{path:t,diff:n}=e;return{anchor:{path:t,offset:n.start},focus:{path:t,offset:n.end}}}function Cs(e,t){var{path:n,offset:r}=t;if(!v.hasPath(e,n))return null;var a=ie.get(e,n);if(!de.isText(a))return null;var i=v.above(e,{match:o=>ce.isElement(o)&&v.isBlock(e,o),at:n});if(!i)return null;for(;r>a.text.length;){var s=v.next(e,{at:n,match:de.isText});if(!s||!P.isDescendant(s[1],i[1]))return null;r-=a.text.length,a=s[0],n=s[1]}return{path:n,offset:r}}function Ju(e,t){var n=Cs(e,t.anchor);if(!n)return null;if(U.isCollapsed(t))return{anchor:n,focus:n};var r=Cs(e,t.focus);return r?{anchor:n,focus:r}:null}function xs(e,t,n){var r=ct.get(e),a=r==null?void 0:r.find(c=>{var{path:m}=c;return P.equals(m,t.path)});if(!a||t.offset<=a.diff.start)return we.transform(t,n,{affinity:"backward"});var{diff:i}=a;if(t.offset<=i.start+i.text.length){var s={path:t.path,offset:i.start},o=we.transform(s,n,{affinity:"backward"});return o?{path:o.path,offset:o.offset+t.offset-i.start}:null}var l={path:t.path,offset:t.offset-i.text.length+i.end-i.start},u=we.transform(l,n,{affinity:"backward"});return u?n.type==="split_node"&&P.equals(n.path,t.path)&&l.offset<n.position&&i.start<n.position?u:{path:u.path,offset:u.offset+i.text.length-i.end+i.start}:null}function Xu(e,t,n){var r=xs(e,t.anchor,n);if(!r)return null;if(U.isCollapsed(t))return{anchor:r,focus:r};var a=xs(e,t.focus,n);return a?{anchor:r,focus:a}:null}function Nb(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 el(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Zr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?el(Object(n),!0).forEach(function(r){xt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):el(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Rb=25,Mb=200,Ib=function(){},$b=e=>(e==null?void 0:e.constructor.name)==="DataTransfer";function Lb(e){var{editor:t,scheduleOnDOMSelectionChange:n,onDOMSelectionChange:r}=e,a=!1,i=null,s=null,o=null,l=0,u=!1,c=()=>{var x=Qt.get(t);if(Qt.delete(t),x){var{selection:B}=t,F=Ju(t,x);F&&(!B||!U.equals(F,B))&&Q.select(t,F)}},m=()=>{var x=Gt.get(t);if(Gt.delete(t),!!x){if(x.at){var B=we.isPoint(x.at)?Cs(t,x.at):Ju(t,x.at);if(!B)return;var F=v.range(t,B);(!t.selection||!U.equals(t.selection,F))&&Q.select(t,B)}x.run()}},h=()=>{if(s&&(clearTimeout(s),s=null),o&&(clearTimeout(o),o=null),!k()&&!A()){c();return}a||(a=!0,setTimeout(()=>a=!1)),A()&&(a="action");var x=t.selection&&v.rangeRef(t,t.selection,{affinity:"forward"});Wt.set(t,t.marks),Ib("flush",Gt.get(t),ct.get(t));for(var B=k(),F;F=(N=ct.get(t))===null||N===void 0?void 0:N[0];){var N,L,q=kt.get(t);q!==void 0&&(kt.delete(t),t.marks=q),q&&u===!1&&(u=null);var oe=Pb(F);(!t.selection||!U.equals(t.selection,oe))&&Q.select(t,oe),F.diff.text?v.insertText(t,F.diff.text):v.deleteFragment(t),ct.set(t,(L=ct.get(t))===null||L===void 0?void 0:L.filter(H=>{var{id:X}=H;return X!==F.id})),Tb(t,F)||(B=!1,Gt.delete(t),Wt.delete(t),a="action",Qt.delete(t),n.cancel(),r.cancel(),x==null||x.unref())}var ne=x==null?void 0:x.unref();if(ne&&!Qt.get(t)&&(!t.selection||!U.equals(ne,t.selection))&&Q.select(t,ne),A()){m();return}B&&n(),n.flush(),r.flush(),c();var D=Wt.get(t);Wt.delete(t),D!==void 0&&(t.marks=D,t.onChange())},p=x=>{i&&clearTimeout(i),i=setTimeout(()=>{mn.set(t,!1),h()},Rb)},g=x=>{mn.set(t,!0),i&&(clearTimeout(i),i=null)},f=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,F=vs.get(t);if(F){if(k()||B){F.style.display="none";return}F.style.removeProperty("display")}},y=(x,B)=>{var F,N=(F=ct.get(t))!==null&&F!==void 0?F:[];ct.set(t,N);var L=ie.leaf(t,x),q=N.findIndex(D=>P.equals(D.path,x));if(q<0){var oe=zd(L.text,B);oe&&N.push({path:x,diff:B,id:l++}),f();return}var ne=Ob(L.text,N[q].diff,B);if(!ne){N.splice(q,1),f();return}N[q]=Zr(Zr({},N[q]),{},{diff:ne})},b=function(B){var{at:F}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u=!1,Qt.delete(t),n.cancel(),r.cancel(),A()&&h(),Gt.set(t,{at:F,run:B}),o=setTimeout(h)},w=x=>{var B;s&&(clearTimeout(s),s=null);var{inputType:F}=x,N=null,L=x.dataTransfer||x.data||void 0;u!==!1&&F!=="insertText"&&F!=="insertCompositionText"&&(u=!1);var[q]=x.getTargetRanges();q&&(N=J.toSlateRange(t,q,{exactMatch:!1,suppressThrow:!0}));var oe=J.getWindow(t),ne=oe.getSelection();if(!N&&ne&&(q=ne,N=J.toSlateRange(t,ne,{exactMatch:!1,suppressThrow:!0})),N=(B=N)!==null&&B!==void 0?B:t.selection,!!N){var D=!0;if(F.startsWith("delete")){if(U.isExpanded(N)){var[H,X]=U.edges(N),_=ie.leaf(t,H.path);if(_.text.length===H.offset&&X.offset===0){var S=v.next(t,{at:H.path,match:de.isText});S&&P.equals(S[1],X.path)&&(N={anchor:X,focus:X})}}var W=F.endsWith("Backward")?"backward":"forward",[I,V]=U.edges(N),[te,ee]=v.leaf(t,I.path),ae={text:"",start:I.offset,end:V.offset},fe=ct.get(t),G=fe==null?void 0:fe.find(be=>P.equals(be.path,ee)),he=G?[G.diff,ae]:[ae],ge=Ld(te.text,...he);if(ge.length===0&&(D=!1),U.isExpanded(N)){if(D&&P.equals(N.anchor.path,N.focus.path)){var Ee={path:N.anchor.path,offset:I.offset},Oe=v.range(t,Ee,Ee);return j(Oe),y(N.anchor.path,{text:"",end:V.offset,start:I.offset})}return b(()=>v.deleteFragment(t,{direction:W}),{at:N})}}switch(F){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":return b(()=>v.deleteFragment(t),{at:N});case"deleteContent":case"deleteContentForward":{var{anchor:me}=N;if(D&&U.isCollapsed(N)){var Pe=ie.leaf(t,me.path);if(me.offset<Pe.text.length)return y(me.path,{text:"",start:me.offset,end:me.offset+1})}return b(()=>v.deleteForward(t),{at:N})}case"deleteContentBackward":{var He,{anchor:Ue}=N,Qe=Ds(q)?q.isCollapsed:!!((He=q)!==null&&He!==void 0&&He.collapsed);return D&&Qe&&U.isCollapsed(N)&&Ue.offset>0?y(Ue.path,{text:"",start:Ue.offset-1,end:Ue.offset}):b(()=>v.deleteBackward(t),{at:N})}case"deleteEntireSoftLine":return b(()=>{v.deleteBackward(t,{unit:"line"}),v.deleteForward(t,{unit:"line"})},{at:N});case"deleteHardLineBackward":return b(()=>v.deleteBackward(t,{unit:"block"}),{at:N});case"deleteSoftLineBackward":return b(()=>v.deleteBackward(t,{unit:"line"}),{at:N});case"deleteHardLineForward":return b(()=>v.deleteForward(t,{unit:"block"}),{at:N});case"deleteSoftLineForward":return b(()=>v.deleteForward(t,{unit:"line"}),{at:N});case"deleteWordBackward":return b(()=>v.deleteBackward(t,{unit:"word"}),{at:N});case"deleteWordForward":return b(()=>v.deleteForward(t,{unit:"word"}),{at:N});case"insertLineBreak":return b(()=>v.insertSoftBreak(t),{at:N});case"insertParagraph":return b(()=>v.insertBreak(t),{at:N});case"insertCompositionText":case"deleteCompositionText":case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{if($b(L))return b(()=>J.insertData(t,L),{at:N});var Ae=L??"";if(kt.get(t)&&(Ae=Ae.replace("\uFEFF","")),F==="insertText"&&/.*\n.*\n$/.test(Ae)&&(Ae=Ae.slice(0,-1)),Ae.includes(`
|
|
108
|
+
`))return b(()=>{var be=Ae.split(`
|
|
109
|
+
`);be.forEach((xe,Ye)=>{xe&&v.insertText(t,xe),Ye!==be.length-1&&v.insertSoftBreak(t)})},{at:N});if(P.equals(N.anchor.path,N.focus.path)){var[ze,We]=U.edges(N),Z={start:ze.offset,end:We.offset,text:Ae};if(Ae&&u&&F==="insertCompositionText"){var se=u.start+u.text.search(/\S|$/),pe=Z.start+Z.text.search(/\S|$/);pe===se+1&&Z.end===u.start+u.text.length?(Z.start-=1,u=null,$()):u=!1}else F==="insertText"?u===null?u=Z:u&&U.isCollapsed(N)&&u.end+u.text.length===ze.offset?u=Zr(Zr({},u),{},{text:u.text+Ae}):u=!1:u=!1;if(D){y(ze.path,Z);return}}return b(()=>v.insertText(t,Ae),{at:N})}}}},A=()=>!!Gt.get(t),k=()=>{var x;return!!((x=ct.get(t))!==null&&x!==void 0&&x.length)},E=()=>A()||k(),T=()=>a,j=x=>{Qt.set(t,x),s&&(clearTimeout(s),s=null);var{selection:B}=t;if(x){var F=!B||!P.equals(B.anchor.path,x.anchor.path),N=!B||!P.equals(B.anchor.path.slice(0,-1),x.anchor.path.slice(0,-1));(F&&u||N)&&(u=!1),(F||k())&&(s=setTimeout(h,Mb))}},z=()=>{(A()||!k())&&h()},R=x=>{k()||(f(!0),setTimeout(f))},$=()=>{A()||(o=setTimeout(h))},M=x=>{if(!(k()||A())&&x.some(F=>uo(t,F,x))){var B;(B=Nd.get(t))===null||B===void 0||B()}};return{flush:h,scheduleFlush:$,hasPendingDiffs:k,hasPendingAction:A,hasPendingChanges:E,isFlushing:T,handleUserSelect:j,handleCompositionEnd:p,handleCompositionStart:g,handleDOMBeforeInput:w,handleKeyDown:R,handleDomMutations:M,handleInput:z}}function zb(){var e=C.useRef(!1);return C.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),e.current}var Tr=ca?C.useLayoutEffect:C.useEffect;function qb(e,t,n){var[r]=C.useState(()=>new MutationObserver(t));Tr(()=>{r.takeRecords()}),C.useEffect(()=>{if(!e.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");return r.observe(e.current,n),()=>r.disconnect()},[r,e,n])}var Wb=["node"];function tl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Hb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tl(Object(n),!0).forEach(function(r){xt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ub={subtree:!0,childList:!0,characterData:!0},Vb=st?e=>{var{node:t}=e,n=Zn(e,Wb);if(!st)return null;var r=on(),a=zb(),[i]=C.useState(()=>Lb(Hb({editor:r},n)));return qb(t,i.handleDomMutations,Ub),so.set(r,i.scheduleFlush),a&&i.flush(),i}:()=>null,Kb=["anchor","focus"],Zb=["anchor","focus"],Yb=(e,t)=>Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>t.hasOwnProperty(n)&&e[n]===t[n]),qd=(e,t)=>{var n=Zn(e,Kb),r=Zn(t,Zb);return e[Yn]===t[Yn]&&Yb(n,r)},Gb=(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(!U.equals(r,a)||!qd(r,a))return!1}return!0},Qb=(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||!qd(r,a))return!1}return!0};function nl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Jb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nl(Object(n),!0).forEach(function(r){xt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Xb=e=>{var{isLast:t,leaf:n,parent:r,text:a}=e,i=on(),s=J.findPath(i,a),o=P.parent(s),l=!!n[Rd];return i.isVoid(r)?C.createElement(Ci,{length:ie.string(r).length}):n.text===""&&r.children[r.children.length-1]===a&&!i.isInline(r)&&v.string(i,o)===""?C.createElement(Ci,{isLineBreak:!0,isMarkPlaceholder:l}):n.text===""?C.createElement(Ci,{isMarkPlaceholder:l}):t&&n.text.slice(-1)===`
|
|
110
|
+
`?C.createElement(rl,{isTrailing:!0,text:n.text}):C.createElement(rl,{text:n.text})},rl=e=>{var{text:t,isTrailing:n=!1}=e,r=C.useRef(null),a=()=>"".concat(t??"").concat(n?`
|
|
111
|
+
`:""),[i]=C.useState(a);return Tr(()=>{var s=a();r.current&&r.current.textContent!==s&&(r.current.textContent=s)}),C.createElement(ey,{ref:r},i)},ey=C.memo(C.forwardRef((e,t)=>C.createElement("span",{"data-slate-string":!0,ref:t},e.children))),Ci=e=>{var{length:t=0,isLineBreak:n=!1,isMarkPlaceholder:r=!1}=e,a={"data-slate-zero-width":n?"n":"z","data-slate-length":t};return r&&(a["data-slate-mark-placeholder"]=!0),C.createElement("span",Jb({},a),!st||!n?"\uFEFF":null,n?C.createElement("br",null):null)};function al(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Wd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?al(Object(n),!0).forEach(function(r){xt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):al(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ty=st?300:0;function ny(e,t){e.current&&(e.current.disconnect(),t&&(e.current=null))}function il(e){e.current&&(clearTimeout(e.current),e.current=null)}var ry=e=>{var{leaf:t,isLast:n,text:r,parent:a,renderPlaceholder:i,renderLeaf:s=w=>C.createElement(iy,Wd({},w))}=e,o=on(),l=C.useRef(null),u=C.useRef(null),[c,m]=C.useState(!1),h=C.useRef(null),p=C.useCallback(w=>{if(ny(l,w==null),w==null){var A;vs.delete(o),(A=t.onPlaceholderResize)===null||A===void 0||A.call(t,null)}else{if(vs.set(o,w),!l.current){var k=window.ResizeObserver||ib;l.current=new k(()=>{var E;(E=t.onPlaceholderResize)===null||E===void 0||E.call(t,w)})}l.current.observe(w),u.current=w}},[u,t,o]),g=C.createElement(Xb,{isLast:n,leaf:t,parent:a,text:r}),f=!!t[Yn];if(C.useEffect(()=>(f?h.current||(h.current=setTimeout(()=>{m(!0),h.current=null},ty)):(il(h),m(!1)),()=>il(h)),[f,m]),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:hr?"inherit":void 0},contentEditable:!1,ref:p}};g=C.createElement(C.Fragment,null,i(y),g)}var b={"data-slate-leaf":!0};return s({attributes:b,children:g,leaf:t,text:r})},ay=C.memo(ry,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&de.equals(t.leaf,e.leaf)&&t.leaf[Yn]===e.leaf[Yn]),iy=e=>{var{attributes:t,children:n}=e;return C.createElement("span",Wd({},t),n)},sy=e=>{for(var{decorations:t,isLast:n,parent:r,renderPlaceholder:a,renderLeaf:i,text:s}=e,o=on(),l=C.useRef(null),u=de.decorations(s,t),c=J.findKey(o,s),m=[],h=0;h<u.length;h++){var p=u[h];m.push(C.createElement(ay,{isLast:n&&h===u.length-1,key:"".concat(c.id,"-").concat(h),renderPlaceholder:a,leaf:p,text:s,parent:r,renderLeaf:i}))}var g=C.useCallback(f=>{var y=Za.get(o);f?(y==null||y.set(c,f),bn.set(s,f),Fr.set(f,s)):(y==null||y.delete(c),bn.delete(s),l.current&&Fr.delete(l.current)),l.current=f},[l,o,c,s]);return C.createElement("span",{"data-slate-node":"text",ref:g},m)},Hd=C.memo(sy,(e,t)=>t.parent===e.parent&&t.isLast===e.isLast&&t.renderLeaf===e.renderLeaf&&t.renderPlaceholder===e.renderPlaceholder&&t.text===e.text&&Qb(t.decorations,e.decorations));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 ws(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){xt(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 oy=e=>{var{decorations:t,element:n,renderElement:r=w=>C.createElement(ly,ws({},w)),renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=on(),l=fy(),u=o.isInline(n),c=J.findKey(o,n),m=C.useCallback(w=>{var A=Za.get(o);w?(A==null||A.set(c,w),bn.set(n,w),Fr.set(w,n)):(A==null||A.delete(c),bn.delete(n))},[o,c,n]),h=Vd({decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}),p={"data-slate-node":"element",ref:m};if(u&&(p["data-slate-inline"]=!0),!u&&v.hasInlines(o,n)){var g=ie.string(n),f=vd(g);f==="rtl"&&(p.dir=f)}if(v.isVoid(o,n)){p["data-slate-void"]=!0,!l&&u&&(p.contentEditable=!1);var y=u?"span":"div",[[b]]=ie.texts(n);h=C.createElement(y,{"data-slate-spacer":!0,style:{height:"0",color:"transparent",outline:"none",position:"absolute"}},C.createElement(Hd,{renderPlaceholder:a,decorations:[],isLast:!1,parent:n,text:b})),ao.set(b,0),io.set(b,n)}return r({attributes:p,children:h,element:n})},uy=C.memo(oy,(e,t)=>e.element===t.element&&e.renderElement===t.renderElement&&e.renderLeaf===t.renderLeaf&&e.renderPlaceholder===t.renderPlaceholder&&Gb(e.decorations,t.decorations)&&(e.selection===t.selection||!!e.selection&&!!t.selection&&U.equals(e.selection,t.selection))),ly=e=>{var{attributes:t,children:n,element:r}=e,a=on(),i=a.isInline(r)?"span":"div";return C.createElement(i,ws(ws({},t),{},{style:{position:"relative"}}),n)},Ud=C.createContext(()=>[]),cy=()=>C.useContext(Ud),dy=C.createContext(!1),Vd=e=>{for(var{decorations:t,node:n,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:s}=e,o=cy(),l=on(),u=J.findPath(l,n),c=[],m=ce.isElement(n)&&!l.isInline(n)&&v.hasInlines(l,n),h=0;h<n.children.length;h++){var p=u.concat(h),g=n.children[h],f=J.findKey(l,g),y=v.range(l,p),b=s&&U.intersection(y,s),w=o([g,p]);for(var A of t){var k=U.intersection(A,y);k&&w.push(k)}ce.isElement(g)?c.push(C.createElement(dy.Provider,{key:"provider-".concat(f.id),value:!!b},C.createElement(uy,{decorations:w,element:g,key:f.id,renderElement:r,renderPlaceholder:a,renderLeaf:i,selection:b}))):c.push(C.createElement(Hd,{decorations:w,key:f.id,isLast:m&&h===n.children.length-1,parent:n,renderPlaceholder:a,renderLeaf:i,text:g})),ao.set(g,h),io.set(g,n)}return c},Kd=C.createContext(!1),fy=()=>C.useContext(Kd),Zd=C.createContext(null),Bn=()=>{var e=C.useContext(Zd);if(!e)throw new Error("The `useSlate` hook must be used inside the <Slate> component's context.");var{editor:t}=e;return t};function hy(){var e=on(),t=C.useRef(!1),n=C.useRef(0),r=C.useCallback(()=>{if(!t.current){t.current=!0;var a=J.getWindow(e);a.cancelAnimationFrame(n.current),n.current=a.requestAnimationFrame(()=>{t.current=!1})}},[e]);return C.useEffect(()=>()=>cancelAnimationFrame(n.current),[]),{receivedUserInput:t,onUserInput:r}}var my=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"},gy={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"},vy={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Le=e=>{var t=py[e],n=gy[e],r=vy[e],a=t&&Di(t),i=n&&Di(n),s=r&&Di(r);return o=>!!(a&&a(o)||Qu&&i&&i(o)||!Qu&&s&&s(o))},qe={isBold:Le("bold"),isCompose:Le("compose"),isMoveBackward:Le("moveBackward"),isMoveForward:Le("moveForward"),isDeleteBackward:Le("deleteBackward"),isDeleteForward:Le("deleteForward"),isDeleteLineBackward:Le("deleteLineBackward"),isDeleteLineForward:Le("deleteLineForward"),isDeleteWordBackward:Le("deleteWordBackward"),isDeleteWordForward:Le("deleteWordForward"),isExtendBackward:Le("extendBackward"),isExtendForward:Le("extendForward"),isExtendLineBackward:Le("extendLineBackward"),isExtendLineForward:Le("extendLineForward"),isItalic:Le("italic"),isMoveLineBackward:Le("moveLineBackward"),isMoveLineForward:Le("moveLineForward"),isMoveWordBackward:Le("moveWordBackward"),isMoveWordForward:Le("moveWordForward"),isRedo:Le("redo"),isSoftBreak:Le("insertSoftBreak"),isSplitBlock:Le("splitBlock"),isTransposeCharacter:Le("transposeCharacter"),isUndo:Le("undo")},by=(e,t)=>{var n=[],r=()=>{n=[]},a=s=>{if(t.current){var o=s.filter(l=>uo(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}},yy={subtree:!0,childList:!0,characterData:!0,characterDataOldValue:!0};class Yd extends C.Component{constructor(){super(...arguments),xt(this,"context",null),xt(this,"manager",null),xt(this,"mutationObserver",null)}observe(){var t,{node:n}=this.props;if(!n.current)throw new Error("Failed to attach MutationObserver, `node` is undefined");(t=this.mutationObserver)===null||t===void 0||t.observe(n.current,yy)}componentDidMount(){var{receivedUserInput:t}=this.props,n=this.context;this.manager=by(n,t),this.mutationObserver=new MutationObserver(this.manager.registerMutations),this.observe()}getSnapshotBeforeUpdate(){var t,n,r,a=(t=this.mutationObserver)===null||t===void 0?void 0:t.takeRecords();if(a!=null&&a.length){var i;(i=this.manager)===null||i===void 0||i.registerMutations(a)}return(n=this.mutationObserver)===null||n===void 0||n.disconnect(),(r=this.manager)===null||r===void 0||r.restoreDOM(),null}componentDidUpdate(){var t;(t=this.manager)===null||t===void 0||t.clear(),this.observe()}componentWillUnmount(){var t;(t=this.mutationObserver)===null||t===void 0||t.disconnect()}render(){return this.props.children}}xt(Yd,"contextType",ro);var Dy=st?Yd:e=>{var{children:t}=e;return C.createElement(C.Fragment,null,t)},Cy=["autoFocus","decorate","onDOMBeforeInput","placeholder","readOnly","renderElement","renderLeaf","renderPlaceholder","scrollSelectionIntoView","style","as","disableDefaultStyles"],xy=["text"];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 Tt(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){xt(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 wy=e=>C.createElement(C.Fragment,null,Vd(e)),Ey=e=>{var t=C.useCallback(S=>C.createElement(ky,Tt({},S)),[]),{autoFocus:n,decorate:r=_y,onDOMBeforeInput:a,placeholder:i,readOnly:s=!1,renderElement:o,renderLeaf:l,renderPlaceholder:u=t,scrollSelectionIntoView:c=By,style:m={},as:h="div",disableDefaultStyles:p=!1}=e,g=Zn(e,Cy),f=Bn(),[y,b]=C.useState(!1),w=C.useRef(null),A=C.useRef([]),[k,E]=C.useState(),{onUserInput:T,receivedUserInput:j}=hy(),[,z]=C.useReducer(S=>S+1,0);Nd.set(f,z),bs.set(f,s);var R=C.useMemo(()=>({isDraggingInternally:!1,isUpdatingSelection:!1,latestElement:null,hasMarkPlaceholder:!1}),[]);C.useEffect(()=>{w.current&&n&&w.current.focus()},[n]);var $=C.useRef(),M=C.useMemo(()=>N0(()=>{var S=$.current;if((st||!J.isComposing(f))&&(!R.isUpdatingSelection||S!=null&&S.isFlushing())&&!R.isDraggingInternally){var W=J.findDocumentOrShadowRoot(f),{activeElement:I}=W,V=J.toDOMNode(f,f),te=W.getSelection();if(I===V?(R.latestElement=I,en.set(f,!0)):en.delete(f),!te)return Q.deselect(f);var{anchorNode:ee,focusNode:ae}=te,fe=J.hasEditableTarget(f,ee)||J.isTargetInsideNonReadonlyVoid(f,ee),G=J.hasEditableTarget(f,ae)||J.isTargetInsideNonReadonlyVoid(f,ae);if(fe&&G){var he=J.toSlateRange(f,te,{exactMatch:!1,suppressThrow:!0});he&&(!J.isComposing(f)&&!(S!=null&&S.hasPendingChanges())&&!(S!=null&&S.isFlushing())?Q.select(f,he):S==null||S.handleUserSelect(he))}s&&(!fe||!G)&&Q.deselect(f)}},100),[f,s,R]),x=C.useMemo(()=>F0(M,0),[M]);$.current=Vb({node:w,onDOMSelectionChange:M,scheduleOnDOMSelectionChange:x}),Tr(()=>{var S,W,I;w.current&&(I=oo(w.current))?(Pd.set(f,I),da.set(f,w.current),bn.set(f,w.current),Fr.set(w.current,f)):bn.delete(f);var{selection:V}=f,te=J.findDocumentOrShadowRoot(f),ee=te.getSelection();if(!(!ee||!J.isFocused(f)||(S=$.current)!==null&&S!==void 0&&S.hasPendingAction())){var ae=ge=>{var Ee=ee.type!=="None";if(!(!V&&!Ee)){var Oe=ee.focusNode,me;if($n&&ee.rangeCount>1){var Pe=ee.getRangeAt(0),He=ee.getRangeAt(ee.rangeCount-1);Pe.startContainer===Oe?me=He.endContainer:me=Pe.startContainer}else me=ee.anchorNode;var Ue=da.get(f),Qe=!1;if(Ue.contains(me)&&Ue.contains(Oe)&&(Qe=!0),Ee&&Qe&&V&&!ge){var Ae=J.toSlateRange(f,ee,{exactMatch:!0,suppressThrow:!0});if(Ae&&U.equals(Ae,V)){var ze;if(!R.hasMarkPlaceholder||(ze=me)!==null&&ze!==void 0&&(ze=ze.parentElement)!==null&&ze!==void 0&&ze.hasAttribute("data-slate-mark-placeholder"))return}}if(V&&!J.hasRange(f,V)){f.selection=J.toSlateRange(f,ee,{exactMatch:!1,suppressThrow:!0});return}R.isUpdatingSelection=!0;var We=V&&J.toDOMRange(f,V);return We?(J.isComposing(f)&&!st?ee.collapseToEnd():U.isBackward(V)?ee.setBaseAndExtent(We.endContainer,We.endOffset,We.startContainer,We.startOffset):ee.setBaseAndExtent(We.startContainer,We.startOffset,We.endContainer,We.endOffset),c(f,We)):ee.removeAllRanges(),We}};ee.rangeCount<=1&&ae();var fe=((W=$.current)===null||W===void 0?void 0:W.isFlushing())==="action";if(!st||!fe){setTimeout(()=>{R.isUpdatingSelection=!1});return}var G=null,he=requestAnimationFrame(()=>{if(fe){var ge=Ee=>{try{var Oe=J.toDOMNode(f,f);Oe.focus(),ae(Ee)}catch{}};ge(),G=setTimeout(()=>{ge(!0),R.isUpdatingSelection=!1})}});return()=>{cancelAnimationFrame(he),G&&clearTimeout(G)}}});var B=C.useCallback(S=>{if(T(),!s&&J.hasEditableTarget(f,S.target)&&!Ay(S,a)){var W;if($.current)return $.current.handleDOMBeforeInput(S);x.flush(),M.flush();var{selection:I}=f,{inputType:V}=S,te=S.dataTransfer||S.data||void 0,ee=V==="insertCompositionText"||V==="deleteCompositionText";if(ee&&J.isComposing(f))return;var ae=!1;if(V==="insertText"&&I&&U.isCollapsed(I)&&S.data&&S.data.length===1&&/[a-z ]/i.test(S.data)&&I.anchor.offset!==0){var fe,G;ae=!0,f.marks&&(ae=!1);var{anchor:he}=I,[ge,Ee]=J.toDOMPoint(f,he),Oe=(fe=ge.parentElement)===null||fe===void 0?void 0:fe.closest("a"),me=J.getWindow(f);if(ae&&Oe&&J.hasDOMNode(f,Oe)){var Pe,He=me==null?void 0:me.document.createTreeWalker(Oe,NodeFilter.SHOW_TEXT).lastChild();He===ge&&((Pe=He.textContent)===null||Pe===void 0?void 0:Pe.length)===Ee&&(ae=!1)}if(ae&&ge.parentElement&&(me==null||(G=me.getComputedStyle(ge.parentElement))===null||G===void 0?void 0:G.whiteSpace)==="pre"){var Ue=v.above(f,{at:he.path,match:se=>ce.isElement(se)&&v.isBlock(f,se)});Ue&&ie.string(Ue[0]).includes(" ")&&(ae=!1)}}if(!V.startsWith("delete")||V.startsWith("deleteBy")){var[Qe]=S.getTargetRanges();if(Qe){var Ae=J.toSlateRange(f,Qe,{exactMatch:!1,suppressThrow:!1});if(!I||!U.equals(I,Ae)){ae=!1;var ze=!ee&&f.selection&&v.rangeRef(f,f.selection);Q.select(f,Ae),ze&&vr.set(f,ze)}}}if(ee)return;if(ae||S.preventDefault(),I&&U.isExpanded(I)&&V.startsWith("delete")){var We=V.endsWith("Backward")?"backward":"forward";v.deleteFragment(f,{direction:We});return}switch(V){case"deleteByComposition":case"deleteByCut":case"deleteByDrag":{v.deleteFragment(f);break}case"deleteContent":case"deleteContentForward":{v.deleteForward(f);break}case"deleteContentBackward":{v.deleteBackward(f);break}case"deleteEntireSoftLine":{v.deleteBackward(f,{unit:"line"}),v.deleteForward(f,{unit:"line"});break}case"deleteHardLineBackward":{v.deleteBackward(f,{unit:"block"});break}case"deleteSoftLineBackward":{v.deleteBackward(f,{unit:"line"});break}case"deleteHardLineForward":{v.deleteForward(f,{unit:"block"});break}case"deleteSoftLineForward":{v.deleteForward(f,{unit:"line"});break}case"deleteWordBackward":{v.deleteBackward(f,{unit:"word"});break}case"deleteWordForward":{v.deleteForward(f,{unit:"word"});break}case"insertLineBreak":v.insertSoftBreak(f);break;case"insertParagraph":{v.insertBreak(f);break}case"insertFromComposition":case"insertFromDrop":case"insertFromPaste":case"insertFromYank":case"insertReplacementText":case"insertText":{V==="insertFromComposition"&&J.isComposing(f)&&(b(!1),mn.set(f,!1)),(te==null?void 0:te.constructor.name)==="DataTransfer"?J.insertData(f,te):typeof te=="string"&&(ae?A.current.push(()=>v.insertText(f,te)):v.insertText(f,te));break}}var Z=(W=vr.get(f))===null||W===void 0?void 0:W.unref();vr.delete(f),Z&&(!f.selection||!U.equals(f.selection,Z))&&Q.select(f,Z)}},[f,M,T,a,s,x]),F=C.useCallback(S=>{S==null?(M.cancel(),x.cancel(),da.delete(f),bn.delete(f),w.current&&Zt&&w.current.removeEventListener("beforeinput",B)):Zt&&S.addEventListener("beforeinput",B),w.current=S},[M,x,f,B]);Tr(()=>{var S=J.getWindow(f);return S.document.addEventListener("selectionchange",x),()=>{S.document.removeEventListener("selectionchange",x)}},[x]);var N=r([f,[]]),L=i&&f.children.length===1&&Array.from(ie.texts(f)).length===1&&ie.string(f)===""&&!y,q=C.useCallback(S=>{if(S&&L){var W;E((W=S.getBoundingClientRect())===null||W===void 0?void 0:W.height)}else E(void 0)},[L]);if(L){var oe=v.start(f,[]);N.push({[Yn]:!0,placeholder:i,onPlaceholderResize:q,anchor:oe,focus:oe})}var{marks:ne}=f;if(R.hasMarkPlaceholder=!1,f.selection&&U.isCollapsed(f.selection)&&ne){var{anchor:D}=f.selection,H=ie.leaf(f,D.path),X=Zn(H,xy);if(!de.equals(H,ne,{loose:!0})){R.hasMarkPlaceholder=!0;var _=Object.fromEntries(Object.keys(X).map(S=>[S,null]));N.push(Tt(Tt(Tt({[Rd]:!0},_),ne),{},{anchor:D,focus:D}))}}return C.useEffect(()=>{setTimeout(()=>{var{selection:S}=f;if(S){var{anchor:W}=S,I=ie.leaf(f,W.path);if(ne&&!de.equals(I,ne,{loose:!0})){kt.set(f,ne);return}}kt.delete(f)})}),C.createElement(Kd.Provider,{value:s},C.createElement(Ud.Provider,{value:r},C.createElement(Dy,{node:w,receivedUserInput:j},C.createElement(h,Tt(Tt({role:s?void 0:"textbox","aria-multiline":s?void 0:!0},g),{},{spellCheck:Zt||!ca?g.spellCheck:!1,autoCorrect:Zt||!ca?g.autoCorrect:"false",autoCapitalize:Zt||!ca?g.autoCapitalize:"false","data-slate-editor":!0,"data-slate-node":"value",contentEditable:!s,zindex:-1,suppressContentEditableWarning:!0,ref:F,style:Tt(Tt({},p?{}:Tt({position:"relative",whiteSpace:"pre-wrap",wordWrap:"break-word"},k?{minHeight:k}:{})),m),onBeforeInput:C.useCallback(S=>{if(!Zt&&!s&&!at(S,g.onBeforeInput)&&J.hasSelectableTarget(f,S.target)&&(S.preventDefault(),!J.isComposing(f))){var W=S.data;v.insertText(f,W)}},[g.onBeforeInput,f,s]),onInput:C.useCallback(S=>{if(!at(S,g.onInput)){if($.current){$.current.handleInput();return}for(var W of A.current)W();A.current=[]}},[g.onInput]),onBlur:C.useCallback(S=>{if(!(s||R.isUpdatingSelection||!J.hasSelectableTarget(f,S.target)||at(S,g.onBlur))){var W=J.findDocumentOrShadowRoot(f);if(R.latestElement!==W.activeElement){var{relatedTarget:I}=S,V=J.toDOMNode(f,f);if(I!==V&&!(Ct(I)&&I.hasAttribute("data-slate-spacer"))){if(I!=null&&nn(I)&&J.hasDOMNode(f,I)){var te=J.toSlateNode(f,I);if(ce.isElement(te)&&!f.isVoid(te))return}if(hr){var ee=W.getSelection();ee==null||ee.removeAllRanges()}en.delete(f)}}}},[s,R.isUpdatingSelection,R.latestElement,f,g.onBlur]),onClick:C.useCallback(S=>{if(J.hasTarget(f,S.target)&&!at(S,g.onClick)&&nn(S.target)){var W=J.toSlateNode(f,S.target),I=J.findPath(f,W);if(!v.hasPath(f,I)||ie.get(f,I)!==W)return;if(S.detail===my&&I.length>=1){var V=I;if(!(ce.isElement(W)&&v.isBlock(f,W))){var te,ee=v.above(f,{match:Oe=>ce.isElement(Oe)&&v.isBlock(f,Oe),at:I});V=(te=ee==null?void 0:ee[1])!==null&&te!==void 0?te:I.slice(0,1)}var ae=v.range(f,V);Q.select(f,ae);return}if(s)return;var fe=v.start(f,I),G=v.end(f,I),he=v.void(f,{at:fe}),ge=v.void(f,{at:G});if(he&&ge&&P.equals(he[1],ge[1])){var Ee=v.range(f,fe);Q.select(f,Ee)}}},[f,g.onClick,s]),onCompositionEnd:C.useCallback(S=>{if(J.hasSelectableTarget(f,S.target)){var W;if(J.isComposing(f)&&Promise.resolve().then(()=>{b(!1),mn.set(f,!1)}),(W=$.current)===null||W===void 0||W.handleCompositionEnd(S),at(S,g.onCompositionEnd)||st)return;if(!hr&&!vb&&!hb&&!yb&&!bb&&S.data){var I=kt.get(f);kt.delete(f),I!==void 0&&(Wt.set(f,f.marks),f.marks=I),v.insertText(f,S.data);var V=Wt.get(f);Wt.delete(f),V!==void 0&&(f.marks=V)}}},[g.onCompositionEnd,f]),onCompositionUpdate:C.useCallback(S=>{J.hasSelectableTarget(f,S.target)&&!at(S,g.onCompositionUpdate)&&(J.isComposing(f)||(b(!0),mn.set(f,!0)))},[g.onCompositionUpdate,f]),onCompositionStart:C.useCallback(S=>{if(J.hasSelectableTarget(f,S.target)){var W;if((W=$.current)===null||W===void 0||W.handleCompositionStart(S),at(S,g.onCompositionStart)||st)return;b(!0);var{selection:I}=f;if(I&&U.isExpanded(I)){v.deleteFragment(f);return}}},[g.onCompositionStart,f]),onCopy:C.useCallback(S=>{J.hasSelectableTarget(f,S.target)&&!at(S,g.onCopy)&&!ul(S)&&(S.preventDefault(),J.setFragmentData(f,S.clipboardData,"copy"))},[g.onCopy,f]),onCut:C.useCallback(S=>{if(!s&&J.hasSelectableTarget(f,S.target)&&!at(S,g.onCut)&&!ul(S)){S.preventDefault(),J.setFragmentData(f,S.clipboardData,"cut");var{selection:W}=f;if(W)if(U.isExpanded(W))v.deleteFragment(f);else{var I=ie.parent(f,W.anchor.path);v.isVoid(f,I)&&Q.delete(f)}}},[s,f,g.onCut]),onDragOver:C.useCallback(S=>{if(J.hasTarget(f,S.target)&&!at(S,g.onDragOver)){var W=J.toSlateNode(f,S.target);ce.isElement(W)&&v.isVoid(f,W)&&S.preventDefault()}},[g.onDragOver,f]),onDragStart:C.useCallback(S=>{if(!s&&J.hasTarget(f,S.target)&&!at(S,g.onDragStart)){var W=J.toSlateNode(f,S.target),I=J.findPath(f,W),V=ce.isElement(W)&&v.isVoid(f,W)||v.void(f,{at:I,voids:!0});if(V){var te=v.range(f,I);Q.select(f,te)}R.isDraggingInternally=!0,J.setFragmentData(f,S.dataTransfer,"drag")}},[s,f,g.onDragStart,R]),onDrop:C.useCallback(S=>{if(!s&&J.hasTarget(f,S.target)&&!at(S,g.onDrop)){S.preventDefault();var W=f.selection,I=J.findEventRange(f,S),V=S.dataTransfer;Q.select(f,I),R.isDraggingInternally&&W&&!U.equals(W,I)&&!v.void(f,{at:I,voids:!0})&&Q.delete(f,{at:W}),J.insertData(f,V),J.isFocused(f)||J.focus(f)}R.isDraggingInternally=!1},[s,f,g.onDrop,R]),onDragEnd:C.useCallback(S=>{!s&&R.isDraggingInternally&&g.onDragEnd&&J.hasTarget(f,S.target)&&g.onDragEnd(S),R.isDraggingInternally=!1},[s,R,g,f]),onFocus:C.useCallback(S=>{if(!s&&!R.isUpdatingSelection&&J.hasEditableTarget(f,S.target)&&!at(S,g.onFocus)){var W=J.toDOMNode(f,f),I=J.findDocumentOrShadowRoot(f);if(R.latestElement=I.activeElement,$n&&S.target!==W){W.focus();return}en.set(f,!0)}},[s,R,f,g.onFocus]),onKeyDown:C.useCallback(S=>{if(!s&&J.hasEditableTarget(f,S.target)){var W;(W=$.current)===null||W===void 0||W.handleKeyDown(S);var{nativeEvent:I}=S;if(J.isComposing(f)&&I.isComposing===!1&&(mn.set(f,!1),b(!1)),at(S,g.onKeyDown)||J.isComposing(f))return;var{selection:V}=f,te=f.children[V!==null?V.focus.path[0]:0],ee=vd(ie.string(te))==="rtl";if(qe.isRedo(I)){S.preventDefault();var ae=f;typeof ae.redo=="function"&&ae.redo();return}if(qe.isUndo(I)){S.preventDefault();var fe=f;typeof fe.undo=="function"&&fe.undo();return}if(qe.isMoveLineBackward(I)){S.preventDefault(),Q.move(f,{unit:"line",reverse:!0});return}if(qe.isMoveLineForward(I)){S.preventDefault(),Q.move(f,{unit:"line"});return}if(qe.isExtendLineBackward(I)){S.preventDefault(),Q.move(f,{unit:"line",edge:"focus",reverse:!0});return}if(qe.isExtendLineForward(I)){S.preventDefault(),Q.move(f,{unit:"line",edge:"focus"});return}if(qe.isMoveBackward(I)){S.preventDefault(),V&&U.isCollapsed(V)?Q.move(f,{reverse:!ee}):Q.collapse(f,{edge:ee?"end":"start"});return}if(qe.isMoveForward(I)){S.preventDefault(),V&&U.isCollapsed(V)?Q.move(f,{reverse:ee}):Q.collapse(f,{edge:ee?"start":"end"});return}if(qe.isMoveWordBackward(I)){S.preventDefault(),V&&U.isExpanded(V)&&Q.collapse(f,{edge:"focus"}),Q.move(f,{unit:"word",reverse:!ee});return}if(qe.isMoveWordForward(I)){S.preventDefault(),V&&U.isExpanded(V)&&Q.collapse(f,{edge:"focus"}),Q.move(f,{unit:"word",reverse:ee});return}if(Zt){if((Od||hr)&&V&&(qe.isDeleteBackward(I)||qe.isDeleteForward(I))&&U.isCollapsed(V)){var G=ie.parent(f,V.anchor.path);if(ce.isElement(G)&&v.isVoid(f,G)&&(v.isInline(f,G)||v.isBlock(f,G))){S.preventDefault(),v.deleteBackward(f,{unit:"block"});return}}}else{if(qe.isBold(I)||qe.isItalic(I)||qe.isTransposeCharacter(I)){S.preventDefault();return}if(qe.isSoftBreak(I)){S.preventDefault(),v.insertSoftBreak(f);return}if(qe.isSplitBlock(I)){S.preventDefault(),v.insertBreak(f);return}if(qe.isDeleteBackward(I)){S.preventDefault(),V&&U.isExpanded(V)?v.deleteFragment(f,{direction:"backward"}):v.deleteBackward(f);return}if(qe.isDeleteForward(I)){S.preventDefault(),V&&U.isExpanded(V)?v.deleteFragment(f,{direction:"forward"}):v.deleteForward(f);return}if(qe.isDeleteLineBackward(I)){S.preventDefault(),V&&U.isExpanded(V)?v.deleteFragment(f,{direction:"backward"}):v.deleteBackward(f,{unit:"line"});return}if(qe.isDeleteLineForward(I)){S.preventDefault(),V&&U.isExpanded(V)?v.deleteFragment(f,{direction:"forward"}):v.deleteForward(f,{unit:"line"});return}if(qe.isDeleteWordBackward(I)){S.preventDefault(),V&&U.isExpanded(V)?v.deleteFragment(f,{direction:"backward"}):v.deleteBackward(f,{unit:"word"});return}if(qe.isDeleteWordForward(I)){S.preventDefault(),V&&U.isExpanded(V)?v.deleteFragment(f,{direction:"forward"}):v.deleteForward(f,{unit:"word"});return}}}},[s,f,g.onKeyDown]),onPaste:C.useCallback(S=>{!s&&J.hasEditableTarget(f,S.target)&&!at(S,g.onPaste)&&(!Zt||xb(S.nativeEvent)||hr)&&(S.preventDefault(),J.insertData(f,S.clipboardData))},[s,f,g.onPaste])}),C.createElement(wy,{decorations:N,node:f,renderElement:o,renderPlaceholder:u,renderLeaf:l,selection:f.selection})))))},ky=e=>{var{attributes:t,children:n}=e;return C.createElement("span",Tt({},t),n,st&&C.createElement("br",null))},_y=()=>[],By=(e,t)=>{if(t.getBoundingClientRect&&(!e.selection||e.selection&&U.isCollapsed(e.selection))){var n=t.startContainer.parentElement;n.getBoundingClientRect=t.getBoundingClientRect.bind(t),I0(n,{scrollMode:"if-needed"}),delete n.getBoundingClientRect}},at=(e,t)=>{if(!t)return!1;var n=t(e);return n??(e.isDefaultPrevented()||e.isPropagationStopped())},ul=e=>nn(e.target)&&(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement),Ay=(e,t)=>{if(!t)return!1;var n=t(e);return n??e.defaultPrevented},Fy=C.createContext(!1),Ty=C.createContext({});function Sy(e){var t=C.useRef([]).current,n=C.useRef({editor:e}).current,r=C.useCallback(i=>{n.editor=i,t.forEach(s=>s(i))},[t,n]),a=C.useMemo(()=>({getSlate:()=>n.editor,addEventListener:i=>(t.push(i),()=>{t.splice(t.indexOf(i),1)})}),[t,n]);return{selectorContext:a,onChange:r}}var jy=["editor","children","onChange","onSelectionChange","onValueChange","initialValue"],Oy=e=>{var{editor:t,children:n,onChange:r,onSelectionChange:a,onValueChange:i,initialValue:s}=e,o=Zn(e,jy),[l,u]=C.useState(()=>{if(!ie.isNodeList(s))throw new Error("[Slate] initialValue is invalid! Expected a list of elements but got: ".concat(Je.stringify(s)));if(!v.isEditor(t))throw new Error("[Slate] editor is invalid! You passed: ".concat(Je.stringify(t)));return t.children=s,Object.assign(t,o),{v:0,editor:t}}),{selectorContext:c,onChange:m}=Sy(t),h=C.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(b=>({v:b.v+1,editor:t})),m(t)},[t,m,r,a,i]);C.useEffect(()=>(ys.set(t,h),()=>{ys.set(t,()=>{})}),[t,h]);var[p,g]=C.useState(J.isFocused(t));return C.useEffect(()=>{g(J.isFocused(t))},[t]),Tr(()=>{var f=()=>g(J.isFocused(t));return jd>=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)})},[]),C.createElement(Ty.Provider,{value:c},C.createElement(Zd.Provider,{value:l},C.createElement(ro.Provider,{value:l.editor},C.createElement(Fy.Provider,{value:p},n))))},ll=(e,t)=>{var n=(t.top+t.bottom)/2;return e.top<=n&&e.bottom>=n},cl=(e,t,n)=>{var r=J.toDOMRange(e,t).getBoundingClientRect(),a=J.toDOMRange(e,n).getBoundingClientRect();return ll(r,a)&&ll(a,r)},Py=(e,t)=>{var n=v.range(e,U.end(t)),r=Array.from(v.positions(e,{at:t})),a=0,i=r.length,s=Math.floor(i/2);if(cl(e,v.range(e,r[a]),n))return v.range(e,r[a],n);if(r.length<2)return v.range(e,r[r.length-1],n);for(;s!==r.length&&s!==a;)cl(e,v.range(e,r[s]),n)?i=s:a=s,s=Math.floor((a+i)/2);return v.range(e,r[i],n)};function 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 fl(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){xt(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 Ny=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"x-slate-fragment",r=t,{apply:a,onChange:i,deleteBackward:s,addMark:o,removeMark:l}=r;return Za.set(r,new WeakMap),r.addMark=(u,c)=>{var m,h;(m=so.get(r))===null||m===void 0||m(),!kt.get(r)&&(h=ct.get(r))!==null&&h!==void 0&&h.length&&kt.set(r,null),Wt.delete(r),o(u,c)},r.removeMark=u=>{var c;!kt.get(r)&&(c=ct.get(r))!==null&&c!==void 0&&c.length&&kt.set(r,null),Wt.delete(r),l(u)},r.deleteBackward=u=>{if(u!=="line")return s(u);if(r.selection&&U.isCollapsed(r.selection)){var c=v.above(r,{match:g=>ce.isElement(g)&&v.isBlock(r,g),at:r.selection});if(c){var[,m]=c,h=v.range(r,m,r.selection.anchor),p=Py(r,h);U.isCollapsed(p)||Q.delete(r,{at:p})}}},r.apply=u=>{var c=[],m=[],h=ct.get(r);if(h!=null&&h.length){var p=h.map(F=>Nb(F,u)).filter(Boolean);ct.set(r,p)}var g=Qt.get(r);g&&Qt.set(r,Xu(r,g,u));var f=Gt.get(r);if(f!=null&&f.at){var y=we.isPoint(f==null?void 0:f.at)?xs(r,f.at,u):Xu(r,f.at,u);Gt.set(r,y?fl(fl({},f),{},{at:y}):null)}switch(u.type){case"insert_text":case"remove_text":case"set_node":case"split_node":{c.push(...jn(r,u.path));break}case"set_selection":{var b;(b=vr.get(r))===null||b===void 0||b.unref(),vr.delete(r);break}case"insert_node":case"remove_node":{c.push(...jn(r,P.parent(u.path)));break}case"merge_node":{var w=P.previous(u.path);c.push(...jn(r,w));break}case"move_node":{var A=P.common(P.parent(u.path),P.parent(u.newPath));c.push(...jn(r,A));var k;P.isBefore(u.path,u.newPath)?(c.push(...jn(r,P.parent(u.path))),k=u.newPath):(c.push(...jn(r,P.parent(u.newPath))),k=u.path);var E=ie.get(t,P.parent(k)),T=J.findKey(r,E),j=v.pathRef(r,P.parent(k));m.push([j,T]);break}}a(u);for(var[z,R]of c){var[$]=v.node(r,z);ka.set($,R)}for(var[M,x]of m)if(M.current){var[B]=v.node(r,M.current);ka.set(B,x)}},r.setFragmentData=u=>{var{selection:c}=r;if(c){var[m,h]=U.edges(c),p=v.void(r,{at:m.path}),g=v.void(r,{at:h.path});if(!(U.isCollapsed(c)&&!p)){var f=J.toDOMRange(r,c),y=f.cloneContents(),b=y.childNodes[0];if(y.childNodes.forEach($=>{$.textContent&&$.textContent.trim()!==""&&(b=$)}),g){var[w]=g,A=f.cloneRange(),k=J.toDOMNode(r,w);A.setEndAfter(k),y=A.cloneContents()}if(p&&(b=y.querySelector("[data-slate-spacer]")),Array.from(y.querySelectorAll("[data-slate-zero-width]")).forEach($=>{var M=$.getAttribute("data-slate-zero-width")==="n";$.textContent=M?`
|
|
112
|
+
`:""}),Md(b)){var E=b.ownerDocument.createElement("span");E.style.whiteSpace="pre",E.appendChild(b),y.appendChild(E),b=E}var T=r.getFragment(),j=JSON.stringify(T),z=window.btoa(encodeURIComponent(j));b.setAttribute("data-slate-fragment",z),u.setData("application/".concat(n),z);var R=y.ownerDocument.createElement("div");return R.appendChild(y),R.setAttribute("hidden","true"),y.ownerDocument.body.appendChild(R),u.setData("text/html",R.innerHTML),u.setData("text/plain",$d(R)),y.ownerDocument.body.removeChild(R),u}}},r.insertData=u=>{r.insertFragmentData(u)||r.insertTextData(u)},r.insertFragmentData=u=>{var c=u.getData("application/".concat(n))||Bb(u);if(c){var m=decodeURIComponent(window.atob(c)),h=JSON.parse(m);return r.insertFragment(h),!0}return!1},r.insertTextData=u=>{var c=u.getData("text/plain");if(c){var m=c.split(/\r\n|\r|\n/),h=!1;for(var p of m)h&&Q.splitNodes(r,{always:!0}),r.insertText(p),h=!0;return!0}return!1},r.onChange=u=>{var c=jd<18?gc.unstable_batchedUpdates:m=>m();c(()=>{var m=ys.get(r);m&&m(u),i(u)})},r},jn=(e,t)=>{var n=[];for(var[r,a]of v.levels(e,{at:t})){var i=J.findKey(e,r);n.push([a,i])}return n};const Ry={id:"",tabbableOption:"",setFocus:()=>{},openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null},lastAnchor:null,dispatch:()=>{},reportError:e=>{console.error(e)}},Kt=C.createContext(Ry);var K=(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))(K||{}),Ot=(e=>(e.delete="delete_mark",e.emphasis="emphasis_mark",e.code="inline_code_mark",e.strong="strong_mark",e))(Ot||{});const My=({attributes:e,children:t,element:n})=>{const r=n;switch(r.type){case K.blockquote:return d.jsx("blockquote",{className:"subtle",...e,children:t});case K.link:return d.jsx("a",{...e,children:t});case K.li:return d.jsx("li",{...e,children:t});case K.mention:const a=r;return d.jsxs("a",{...e,className:"mention",children:["@",(a==null?void 0:a.name)||"",t]});case K.ol:return d.jsx("ol",{...e,children:t});case K.ul:return d.jsx("ul",{...e,children:t});case K.span:return d.jsx("span",{...e,children:t});case K.paragraph:return d.jsx("p",{...e,children:t});default:return d.jsx("span",{...e,children:t})}},Iy=({attributes:e,children:t,leaf:n})=>{const r=n;return r[K.bold]&&(t=d.jsx("strong",{children:t})),r[K.italic]&&(t=d.jsx("em",{children:t})),r[K.strikethrough]&&(t=d.jsx("s",{children:t})),d.jsx("span",{...e,children:t})},Es="MENTION: ",Gd={anchor:{offset:0,path:[0,0]},focus:{offset:0,path:[0,0]}},hl={"mention-popover":35,default:-52},xi=16,Qd=(e,t,n)=>{const r=C.useRef(null),{showLinkEditor:a,mentionPopover:i}=C.useContext(Kt),s=t==="link-editor"?a:i.show,o=[s];return e&&t==="link-editor"&&o.push(e.selection),C.useEffect(()=>{var p,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=A=>{if(!v.hasPath(e,A.path))return!1;const k=ie.get(e,A.path);return v.isEditor(k)||ce.isElement(k)?A.offset<=k.children.length:de.isText(k)?A.offset<=k.text.length:!1};if(f&&(!y(f==null?void 0:f.anchor)||!y(f==null?void 0:f.focus)))return;u=J.toDOMRange(e,f||Gd).getBoundingClientRect();const w=(p=document.getElementById(n))==null?void 0:p.getBoundingClientRect();l.style.setProperty("--width",`${((w==null?void 0:w.width)||0)/xi}rem`),c=(w==null?void 0:w.left)||0}else{const f=document.getSelection();f!=null&&f.toString().trim().length&&(u=f==null?void 0:f.getRangeAt(0).getBoundingClientRect())}u||(u=(g=document.getElementById(n))==null?void 0:g.getBoundingClientRect());const m=hl[t]||hl.default,h=((u==null?void 0:u.top)||0)+window.scrollY+m;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=`${h/xi}rem`,l.style.left=`${c/xi}rem`},o),r},$y=e=>{const[t,n]=C.useState(null);return C.useEffect(()=>{const{selection:r}=e;if(!r){n(null);return}const[a]=v.nodes(e,{at:r,match:i=>i.type===K.link});if(a){const i=a[0],s=Rc(i.link),o=i.children[0],l=(o==null?void 0:o.text)||"";n({...s,text:l})}else n(null)},[e,e.selection]),t};var it=(e=>(e.paragraph="paragraph",e.heading="heading",e.list="list",e.listItem="listItem",e.link="link",e.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))(it||{});const Ln={[K.paragraph]:K.paragraph,[K.blockquote]:K.blockquote,[K.codeblock]:K.codeblock,[K.link]:K.link,[K.ul]:K.ul,[K.ol]:K.ol,[K.li]:K.li,[K.mention]:K.mention,[K.heading]:{1:"heading_one",2:"heading_two",3:"heading_three",4:"heading_four",5:"heading_five",6:"heading_six"},[Ot.emphasis]:K.italic,[Ot.strong]:K.bold,[Ot.delete]:K.strikethrough,[Ot.code]:K.code,[K.hr]:K.hr,[K.image]:K.image};function ml(e){if(e)throw e}var fa=Object.prototype.hasOwnProperty,Jd=Object.prototype.toString,pl=Object.defineProperty,gl=Object.getOwnPropertyDescriptor,vl=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Jd.call(t)==="[object Array]"},bl=function(t){if(!t||Jd.call(t)!=="[object Object]")return!1;var n=fa.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&fa.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var a;for(a in t);return typeof a>"u"||fa.call(t,a)},yl=function(t,n){pl&&n.name==="__proto__"?pl(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Dl=function(t,n){if(n==="__proto__")if(fa.call(t,n)){if(gl)return gl(t,n).value}else return;return t[n]},Ly=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=Dl(o,n),a=Dl(t,n),o!==a&&(c&&a&&(bl(a)||(i=vl(a)))?(i?(i=!1,s=r&&vl(r)?r:[]):s=r&&bl(r)?r:{},yl(o,{name:n,newValue:e(c,s,a)})):typeof a<"u"&&yl(o,{name:n,newValue:a}));return o};const wi=wn(Ly);function ks(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 zy(){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 m=-1;if(l){s(l);return}for(;++m<a.length;)(u[m]===null||u[m]===void 0)&&(u[m]=a[m]);a=u,c?qy(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 qy(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 br(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Cl(e.position):"start"in e||"end"in e?Cl(e):"line"in e||"column"in e?_s(e):""}function _s(e){return xl(e&&e.line)+":"+xl(e&&e.column)}function Cl(e){return _s(e&&e.start)+"-"+_s(e&&e.end)}function xl(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=br(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}ht.prototype.file="";ht.prototype.name="";ht.prototype.reason="";ht.prototype.message="";ht.prototype.stack="";ht.prototype.column=void 0;ht.prototype.line=void 0;ht.prototype.ancestors=void 0;ht.prototype.cause=void 0;ht.prototype.fatal=void 0;ht.prototype.place=void 0;ht.prototype.ruleId=void 0;ht.prototype.source=void 0;const St={basename:Wy,dirname:Hy,extname:Uy,join:Vy,sep:"/"};function Wy(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Or(e);let n=0,r=-1,a=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else r<0&&(i=!0,r=a+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,o=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(i){n=a+1;break}}else s<0&&(i=!0,s=a+1),o>-1&&(e.codePointAt(a)===t.codePointAt(o--)?o<0&&(r=a):(o=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function Hy(e){if(Or(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Uy(e){Or(e);let t=e.length,n=-1,r=0,a=-1,i=0,s;for(;t--;){const o=e.codePointAt(t);if(o===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),o===46?a<0?a=t:i!==1&&(i=1):a>-1&&(i=-1)}return a<0||n<0||i===0||i===1&&a===n-1&&a===r+1?"":e.slice(a,n)}function Vy(...e){let t=-1,n;for(;++t<e.length;)Or(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Ky(n)}function Ky(e){Or(e);const t=e.codePointAt(0)===47;let n=Zy(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Zy(e,t){let n="",r=0,a=-1,i=0,s=-1,o,l;for(;++s<=e.length;){if(s<e.length)o=e.codePointAt(s);else{if(o===47)break;o=47}if(o===47){if(!(a===s-1||i===1))if(a!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),a=s,i=0;continue}}else if(n.length>0){n="",r=0,a=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(a+1,s):n=e.slice(a+1,s),r=s-a-1;a=s,i=0}else o===46&&i>-1?i++:i=-1}return n}function Or(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Yy={cwd:Gy};function Gy(){return"/"}function Bs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Qy(e){if(typeof e=="string")e=new URL(e);else if(!Bs(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Jy(e)}function Jy(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 Ei=["history","path","basename","stem","extname","dirname"];class Xy{constructor(t){let n;t?Bs(t)?n={path:t}:typeof t=="string"||e1(t)?n={value:t}:n=t:n={},this.cwd=Yy.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ei.length;){const i=Ei[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)Ei.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?St.basename(this.path):void 0}set basename(t){_i(t,"basename"),ki(t,"basename"),this.path=St.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?St.dirname(this.path):void 0}set dirname(t){wl(this.basename,"dirname"),this.path=St.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?St.extname(this.path):void 0}set extname(t){if(ki(t,"extname"),wl(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=St.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Bs(t)&&(t=Qy(t)),_i(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?St.basename(this.path,this.extname):void 0}set stem(t){_i(t,"stem"),ki(t,"stem"),this.path=St.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const a=this.message(t,n,r);throw a.fatal=!0,a}info(t,n,r){const a=this.message(t,n,r);return a.fatal=void 0,a}message(t,n,r){const a=new ht(t,n,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function ki(e,t){if(e&&e.includes(St.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+St.sep+"`")}function _i(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function wl(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function e1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const t1=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},n1={}.hasOwnProperty;class lo extends t1{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=zy()}copy(){const t=new lo;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(wi(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Fi("data",this.frozen),this.namespace[t]=n,this):n1.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Fi("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=n.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Yr(t),r=this.parser||this.Parser;return Bi("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Bi("process",this.parser||this.Parser),Ai("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(i,s){const o=Yr(t),l=r.parse(o);r.run(l,o,function(c,m,h){if(c||!m||!h)return u(c);const p=m,g=r.stringify(p,h);i1(g)?h.value=g:h.result=g,u(c,h)});function u(c,m){c||!m?s(c):i?i(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),Bi("processSync",this.parser||this.Parser),Ai("processSync",this.compiler||this.Compiler),this.process(t,a),kl("processSync","process",n),r;function a(i,s){n=!0,ml(i),r=s}}run(t,n,r){El(t),this.freeze();const a=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,o){const l=Yr(n);a.run(t,l,u);function u(c,m,h){const p=m||t;c?o(c):s?s(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,a;return this.run(t,n,i),kl("runSync","run",r),a;function i(s,o){ml(s),a=o,r=!0}}stringify(t,n){this.freeze();const r=Yr(n),a=this.compiler||this.Compiler;return Ai("stringify",a),El(t),a(t,r)}use(t,...n){const r=this.attachers,a=this.namespace;if(Fi("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,...m]=u;l(c,m)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(u.plugins),u.settings&&(a.settings=wi(!0,a.settings,u.settings))}function o(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const m=u[c];i(m)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let m=-1,h=-1;for(;++m<r.length;)if(r[m][0]===u){h=m;break}if(h===-1)r.push([u,...c]);else if(c.length>0){let[p,...g]=c;const f=r[h][1];ks(f)&&ks(p)&&(p=wi(!0,f,p)),r[h]=[u,p,...g]}}}}const r1=new lo().freeze();function Bi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ai(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Fi(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 El(e){if(!ks(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function kl(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Yr(e){return a1(e)?e:new Xy(e)}function a1(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function i1(e){return typeof e=="string"||s1(e)}function s1(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const o1={};function u1(e,t){const n=t||o1,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Xd(e,r,a)}function Xd(e,t,n){if(l1(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 _l(e.children,t,n)}return Array.isArray(e)?_l(e,t,n):""}function _l(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=Xd(e[a],t,n);return r.join("")}function l1(e){return!!(e&&typeof e=="object")}const Bl=document.createElement("i");function co(e){const t="&"+e+";";Bl.innerHTML=t;const n=Bl.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Rt(e,t,n,r){const a=e.length;let i=0,s;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function Dt(e,t){return e.length>0?(Rt(e,e.length,0,t),e):t}const Al={}.hasOwnProperty;function c1(e){const t={};let n=-1;for(;++n<e.length;)d1(t,e[n]);return t}function d1(e,t){let n;for(n in t){const a=(Al.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){Al.call(a,s)||(a[s]=[]);const o=i[s];f1(a[s],Array.isArray(o)?o:o?[o]:[])}}}function f1(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Rt(e,0,0,r)}function ef(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 Wn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const jt=un(/[A-Za-z]/),_t=un(/[\dA-Za-z]/),h1=un(/[#-'*+\--9=?A-Z^-~]/);function As(e){return e!==null&&(e<32||e===127)}const Fs=un(/\d/),m1=un(/[\dA-Fa-f]/),p1=un(/[!-/:-@[-`{-~]/);function ye(e){return e!==null&&e<-2}function ft(e){return e!==null&&(e<0||e===32)}function Te(e){return e===-2||e===-1||e===32}const g1=un(/\p{P}|\p{S}/u),v1=un(/\s/);function un(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Me(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Te(l)?(e.enter(n),o(l)):t(l)}function o(l){return Te(l)&&i++<a?(e.consume(l),o):(e.exit(n),t(l))}}const b1={tokenize:y1};function y1(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"),Me(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 D1={tokenize:C1},Fl={tokenize:x1};function C1(e){const t=this,n=[];let r=0,a,i,s;return o;function o(A){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,l,u)(A)}return u(A)}function l(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&w();const k=t.events.length;let E=k,T;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){T=t.events[E][1].end;break}b(r);let j=k;for(;j<t.events.length;)t.events[j][1].end=Object.assign({},T),j++;return Rt(t.events,E+1,0,t.events.slice(k)),t.events.length=j,u(A)}return o(A)}function u(A){if(r===n.length){if(!a)return h(A);if(a.currentConstruct&&a.currentConstruct.concrete)return g(A);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Fl,c,m)(A)}function c(A){return a&&w(),b(r),h(A)}function m(A){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,g(A)}function h(A){return t.containerState={},e.attempt(Fl,p,g)(A)}function p(A){return r++,n.push([t.currentConstruct,t.containerState]),h(A)}function g(A){if(A===null){a&&w(),b(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:a}),f(A)}function f(A){if(A===null){y(e.exit("chunkFlow"),!0),b(0),e.consume(A);return}return ye(A)?(e.consume(A),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,o):(e.consume(A),f)}function y(A,k){const E=t.sliceStream(A);if(k&&E.push(null),A.previous=i,i&&(i.next=A),i=A,a.defineSkip(A.start),a.write(E),t.parser.lazy[A.start.line]){let 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 j=t.events.length;let z=j,R,$;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(R){$=t.events[z][1].end;break}R=!0}for(b(r),T=j;T<t.events.length;)t.events[T][1].end=Object.assign({},$),T++;Rt(t.events,z+1,0,t.events.slice(j)),t.events.length=T}}function b(A){let k=n.length;for(;k-- >A;){const E=n[k];t.containerState=E[1],E[0].exit.call(t,e)}n.length=A}function w(){a.write([null]),i=void 0,a=void 0,t.containerState._closeFlow=void 0}}function x1(e,t,n){return Me(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Tl(e){if(e===null||ft(e)||v1(e))return 1;if(g1(e))return 2}function fo(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 Ts={name:"attention",tokenize:E1,resolveAll:w1};function w1(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 m=Object.assign({},e[r][1].end),h=Object.assign({},e[n][1].start);Sl(m,-l),Sl(h,l),s={type:l>1?"strongSequence":"emphasisSequence",start:m,end:Object.assign({},e[r][1].end)},o={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:h},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},a={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},o.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},o.end),u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Dt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Dt(u,[["enter",a,t],["enter",s,t],["exit",s,t],["enter",i,t]]),u=Dt(u,fo(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Dt(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=Dt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,Rt(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 E1(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Tl(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=Tl(l),m=!c||c===2&&a||n.includes(l),h=!a||a===2&&c||n.includes(r);return u._open=!!(i===42?m:m&&(a||!h)),u._close=!!(i===42?h:h&&(c||!m)),t(l)}}function Sl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const k1={name:"autolink",tokenize:_1};function _1(e,t,n){let r=0;return a;function a(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return jt(p)?(e.consume(p),s):u(p)}function s(p){return p===43||p===45||p===46||_t(p)?(r=1,o(p)):u(p)}function o(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||_t(p))&&r++<32?(e.consume(p),o):(r=0,u(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||As(p)?n(p):(e.consume(p),l)}function u(p){return p===64?(e.consume(p),c):h1(p)?(e.consume(p),u):n(p)}function c(p){return _t(p)?m(p):n(p)}function m(p){return p===46?(e.consume(p),r=0,c):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||_t(p))&&r++<63){const g=p===45?h:m;return e.consume(p),g}return n(p)}}const Ya={tokenize:B1,partial:!0};function B1(e,t,n){return r;function r(i){return Te(i)?Me(e,a,"linePrefix")(i):a(i)}function a(i){return i===null||ye(i)?t(i):n(i)}}const tf={name:"blockQuote",tokenize:A1,continuation:{tokenize:F1},exit:T1};function A1(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 Te(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function F1(e,t,n){const r=this;return a;function a(s){return Te(s)?Me(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(tf,t,n)(s)}}function T1(e){e.exit("blockQuote")}const nf={name:"characterEscape",tokenize:S1};function S1(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 rf={name:"characterReference",tokenize:j1};function j1(e,t,n){const r=this;let a=0,i,s;return o;function o(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),l}function l(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,s=_t,c(m))}function u(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=m1,c):(e.enter("characterReferenceValue"),i=7,s=Fs,c(m))}function c(m){if(m===59&&a){const h=e.exit("characterReferenceValue");return s===_t&&!co(r.sliceSerialize(h))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(m)&&a++<i?(e.consume(m),c):n(m)}}const jl={tokenize:P1,partial:!0},Ol={name:"codeFenced",tokenize:O1,concrete:!0};function O1(e,t,n){const r=this,a={tokenize:E,partial:!0};let i=0,s=0,o;return l;function l(T){return u(T)}function u(T){const j=r.events[r.events.length-1];return i=j&&j[1].type==="linePrefix"?j[2].sliceSerialize(j[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"),Te(T)?Me(e,m,"whitespace")(T):m(T))}function m(T){return T===null||ye(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(jl,f,k)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(T))}function h(T){return T===null||ye(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(T)):Te(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Me(e,p,"whitespace")(T)):T===96&&T===o?n(T):(e.consume(T),h)}function p(T){return T===null||ye(T)?m(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||ye(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(T)):T===96&&T===o?n(T):(e.consume(T),g)}function f(T){return e.attempt(a,k,y)(T)}function y(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),b}function b(T){return i>0&&Te(T)?Me(e,w,"linePrefix",i+1)(T):w(T)}function w(T){return T===null||ye(T)?e.check(jl,f,k)(T):(e.enter("codeFlowValue"),A(T))}function A(T){return T===null||ye(T)?(e.exit("codeFlowValue"),w(T)):(e.consume(T),A)}function k(T){return e.exit("codeFenced"),t(T)}function E(T,j,z){let R=0;return $;function $(N){return T.enter("lineEnding"),T.consume(N),T.exit("lineEnding"),M}function M(N){return T.enter("codeFencedFence"),Te(N)?Me(T,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):x(N)}function x(N){return N===o?(T.enter("codeFencedFenceSequence"),B(N)):z(N)}function B(N){return N===o?(R++,T.consume(N),B):R>=s?(T.exit("codeFencedFenceSequence"),Te(N)?Me(T,F,"whitespace")(N):F(N)):z(N)}function F(N){return N===null||ye(N)?(T.exit("codeFencedFence"),j(N)):z(N)}}}function P1(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 Ti={name:"codeIndented",tokenize:R1},N1={tokenize:M1,partial:!0};function R1(e,t,n){const r=this;return a;function a(u){return e.enter("codeIndented"),Me(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):ye(u)?e.attempt(N1,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 M1(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):Me(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 I1={name:"codeText",tokenize:z1,resolve:$1,previous:L1};function $1(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 L1(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function z1(e,t,n){let r=0,a,i;return s;function s(m){return e.enter("codeText"),e.enter("codeTextSequence"),o(m)}function o(m){return m===96?(e.consume(m),r++,o):(e.exit("codeTextSequence"),l(m))}function l(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),l):m===96?(i=e.enter("codeTextSequence"),a=0,c(m)):ye(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),l):(e.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||ye(m)?(e.exit("codeTextData"),l(m)):(e.consume(m),u)}function c(m){return m===96?(e.consume(m),a++,c):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(i.type="codeTextData",u(m))}}function af(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,q1(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),Rt(e,a,n-a+1,o))}}return!u}function q1(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,m,h=-1,p=n,g=0,f=0;const y=[f];for(;p;){for(;e[++a][1]!==p;);i.push(a),p._tokenizer||(c=r.sliceStream(p),p.next||c.push(null),m&&s.defineSkip(p.start),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(c),p._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),m=p,p=p.next}for(p=n;++h<o.length;)o[h][0]==="exit"&&o[h-1][0]==="enter"&&o[h][1].type===o[h-1][1].type&&o[h][1].start.line!==o[h][1].end.line&&(f=h+1,y.push(f),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(s.events=[],p?(p._tokenizer=void 0,p.previous=void 0):y.pop(),h=y.length;h--;){const b=o.slice(y[h],y[h+1]),w=i.pop();l.unshift([w,w+b.length-1]),Rt(e,w,2,b)}for(h=-1;++h<l.length;)u[g+l[h][0]]=g+l[h][1],g+=l[h][1]-l[h][0]-1;return u}const W1={tokenize:V1,resolve:U1},H1={tokenize:K1,partial:!0};function U1(e){return af(e),e}function V1(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(H1,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 K1(e,t,n){const r=this;return a;function a(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Me(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 sf(e,t,n,r,a,i,s,o,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return m;function m(b){return b===60?(e.enter(r),e.enter(a),e.enter(i),e.consume(b),e.exit(i),h):b===null||b===32||b===41||As(b)?n(b):(e.enter(r),e.enter(s),e.enter(o),e.enter("chunkString",{contentType:"string"}),f(b))}function h(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(a),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===62?(e.exit("chunkString"),e.exit(o),h(b)):b===null||b===60||ye(b)?n(b):(e.consume(b),b===92?g:p)}function g(b){return b===60||b===62||b===92?(e.consume(b),p):p(b)}function f(b){return!c&&(b===null||b===41||ft(b))?(e.exit("chunkString"),e.exit(o),e.exit(s),e.exit(r),t(b)):c<u&&b===40?(e.consume(b),c++,f):b===41?(e.consume(b),c--,f):b===null||b===32||b===40||As(b)?n(b):(e.consume(b),b===92?y:f)}function y(b){return b===40||b===41||b===92?(e.consume(b),f):f(b)}}function of(e,t,n,r,a,i){const s=this;let o=0,l;return u;function u(p){return e.enter(r),e.enter(a),e.consume(p),e.exit(a),e.enter(i),c}function c(p){return o>999||p===null||p===91||p===93&&!l||p===94&&!o&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(e.exit(i),e.enter(a),e.consume(p),e.exit(a),e.exit(r),t):ye(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),m(p))}function m(p){return p===null||p===91||p===93||ye(p)||o++>999?(e.exit("chunkString"),c(p)):(e.consume(p),l||(l=!Te(p)),p===92?h:m)}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,m):m(p)}}function uf(e,t,n,r,a,i){let s;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(a),e.consume(h),e.exit(a),s=h===40?41:h,l):n(h)}function l(h){return h===s?(e.enter(a),e.consume(h),e.exit(a),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===s?(e.exit(i),l(s)):h===null?n(h):ye(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Me(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(h))}function c(h){return h===s||h===null||ye(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?m:c)}function m(h){return h===s||h===92?(e.consume(h),c):c(h)}}function yr(e,t){let n;return r;function r(a){return ye(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):Te(a)?Me(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const Z1={name:"definition",tokenize:G1},Y1={tokenize:Q1,partial:!0};function G1(e,t,n){const r=this;let a;return i;function i(p){return e.enter("definition"),s(p)}function s(p){return of.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return a=Wn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return ft(p)?yr(e,u)(p):u(p)}function u(p){return sf(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return e.attempt(Y1,m,m)(p)}function m(p){return Te(p)?Me(e,h,"whitespace")(p):h(p)}function h(p){return p===null||ye(p)?(e.exit("definition"),r.parser.defined.push(a),t(p)):n(p)}}function Q1(e,t,n){return r;function r(o){return ft(o)?yr(e,a)(o):n(o)}function a(o){return uf(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Te(o)?Me(e,s,"whitespace")(o):s(o)}function s(o){return o===null||ye(o)?t(o):n(o)}}const J1={name:"hardBreakEscape",tokenize:X1};function X1(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 eD={name:"headingAtx",tokenize:nD,resolve:tD};function tD(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"},Rt(e,r,n-r+1,[["enter",a,t],["enter",i,t],["exit",i,t],["exit",a,t]])),e}function nD(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||ye(c)?(e.exit("atxHeading"),t(c)):Te(c)?Me(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 rD=["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"],Pl=["pre","script","style","textarea"],aD={name:"htmlFlow",tokenize:uD,resolveTo:oD,concrete:!0},iD={tokenize:cD,partial:!0},sD={tokenize:lD,partial:!0};function oD(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function uD(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(_),m}function m(_){return _===33?(e.consume(_),h):_===47?(e.consume(_),i=!0,f):_===63?(e.consume(_),a=3,r.interrupt?t:D):jt(_)?(e.consume(_),s=String.fromCharCode(_),y):n(_)}function h(_){return _===45?(e.consume(_),a=2,p):_===91?(e.consume(_),a=5,o=0,g):jt(_)?(e.consume(_),a=4,r.interrupt?t:D):n(_)}function p(_){return _===45?(e.consume(_),r.interrupt?t:D):n(_)}function g(_){const S="CDATA[";return _===S.charCodeAt(o++)?(e.consume(_),o===S.length?r.interrupt?t:x:g):n(_)}function f(_){return jt(_)?(e.consume(_),s=String.fromCharCode(_),y):n(_)}function y(_){if(_===null||_===47||_===62||ft(_)){const S=_===47,W=s.toLowerCase();return!S&&!i&&Pl.includes(W)?(a=1,r.interrupt?t(_):x(_)):rD.includes(s.toLowerCase())?(a=6,S?(e.consume(_),b):r.interrupt?t(_):x(_)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(_):i?w(_):A(_))}return _===45||_t(_)?(e.consume(_),s+=String.fromCharCode(_),y):n(_)}function b(_){return _===62?(e.consume(_),r.interrupt?t:x):n(_)}function w(_){return Te(_)?(e.consume(_),w):$(_)}function A(_){return _===47?(e.consume(_),$):_===58||_===95||jt(_)?(e.consume(_),k):Te(_)?(e.consume(_),A):$(_)}function k(_){return _===45||_===46||_===58||_===95||_t(_)?(e.consume(_),k):E(_)}function E(_){return _===61?(e.consume(_),T):Te(_)?(e.consume(_),E):A(_)}function T(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),l=_,j):Te(_)?(e.consume(_),T):z(_)}function j(_){return _===l?(e.consume(_),l=null,R):_===null||ye(_)?n(_):(e.consume(_),j)}function z(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||ft(_)?E(_):(e.consume(_),z)}function R(_){return _===47||_===62||Te(_)?A(_):n(_)}function $(_){return _===62?(e.consume(_),M):n(_)}function M(_){return _===null||ye(_)?x(_):Te(_)?(e.consume(_),M):n(_)}function x(_){return _===45&&a===2?(e.consume(_),L):_===60&&a===1?(e.consume(_),q):_===62&&a===4?(e.consume(_),H):_===63&&a===3?(e.consume(_),D):_===93&&a===5?(e.consume(_),ne):ye(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(iD,X,B)(_)):_===null||ye(_)?(e.exit("htmlFlowData"),B(_)):(e.consume(_),x)}function B(_){return e.check(sD,F,X)(_)}function F(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),N}function N(_){return _===null||ye(_)?B(_):(e.enter("htmlFlowData"),x(_))}function L(_){return _===45?(e.consume(_),D):x(_)}function q(_){return _===47?(e.consume(_),s="",oe):x(_)}function oe(_){if(_===62){const S=s.toLowerCase();return Pl.includes(S)?(e.consume(_),H):x(_)}return jt(_)&&s.length<8?(e.consume(_),s+=String.fromCharCode(_),oe):x(_)}function ne(_){return _===93?(e.consume(_),D):x(_)}function D(_){return _===62?(e.consume(_),H):_===45&&a===2?(e.consume(_),D):x(_)}function H(_){return _===null||ye(_)?(e.exit("htmlFlowData"),X(_)):(e.consume(_),H)}function X(_){return e.exit("htmlFlow"),t(_)}}function lD(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 cD(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Ya,t,n)}}const dD={name:"htmlText",tokenize:fD};function fD(e,t,n){const r=this;let a,i,s;return o;function o(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),l}function l(D){return D===33?(e.consume(D),u):D===47?(e.consume(D),E):D===63?(e.consume(D),A):jt(D)?(e.consume(D),z):n(D)}function u(D){return D===45?(e.consume(D),c):D===91?(e.consume(D),i=0,g):jt(D)?(e.consume(D),w):n(D)}function c(D){return D===45?(e.consume(D),p):n(D)}function m(D){return D===null?n(D):D===45?(e.consume(D),h):ye(D)?(s=m,q(D)):(e.consume(D),m)}function h(D){return D===45?(e.consume(D),p):m(D)}function p(D){return D===62?L(D):D===45?h(D):m(D)}function g(D){const H="CDATA[";return D===H.charCodeAt(i++)?(e.consume(D),i===H.length?f:g):n(D)}function f(D){return D===null?n(D):D===93?(e.consume(D),y):ye(D)?(s=f,q(D)):(e.consume(D),f)}function y(D){return D===93?(e.consume(D),b):f(D)}function b(D){return D===62?L(D):D===93?(e.consume(D),b):f(D)}function w(D){return D===null||D===62?L(D):ye(D)?(s=w,q(D)):(e.consume(D),w)}function A(D){return D===null?n(D):D===63?(e.consume(D),k):ye(D)?(s=A,q(D)):(e.consume(D),A)}function k(D){return D===62?L(D):A(D)}function E(D){return jt(D)?(e.consume(D),T):n(D)}function T(D){return D===45||_t(D)?(e.consume(D),T):j(D)}function j(D){return ye(D)?(s=j,q(D)):Te(D)?(e.consume(D),j):L(D)}function z(D){return D===45||_t(D)?(e.consume(D),z):D===47||D===62||ft(D)?R(D):n(D)}function R(D){return D===47?(e.consume(D),L):D===58||D===95||jt(D)?(e.consume(D),$):ye(D)?(s=R,q(D)):Te(D)?(e.consume(D),R):L(D)}function $(D){return D===45||D===46||D===58||D===95||_t(D)?(e.consume(D),$):M(D)}function M(D){return D===61?(e.consume(D),x):ye(D)?(s=M,q(D)):Te(D)?(e.consume(D),M):R(D)}function x(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),a=D,B):ye(D)?(s=x,q(D)):Te(D)?(e.consume(D),x):(e.consume(D),F)}function B(D){return D===a?(e.consume(D),a=void 0,N):D===null?n(D):ye(D)?(s=B,q(D)):(e.consume(D),B)}function F(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||ft(D)?R(D):(e.consume(D),F)}function N(D){return D===47||D===62||ft(D)?R(D):n(D)}function L(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function q(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),oe}function oe(D){return Te(D)?Me(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):ne(D)}function ne(D){return e.enter("htmlTextData"),s(D)}}const ho={name:"labelEnd",tokenize:bD,resolveTo:vD,resolveAll:gD},hD={tokenize:yD},mD={tokenize:DD},pD={tokenize:CD};function gD(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 vD(e,t){let n=e.length,r=0,a,i,s,o;for(;n--;)if(a=e[n][1],i){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(i=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},u={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},c={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return o=[["enter",l,t],["enter",u,t]],o=Dt(o,e.slice(i+1,i+r+3)),o=Dt(o,[["enter",c,t]]),o=Dt(o,fo(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),o=Dt(o,[["exit",c,t],e[s-2],e[s-1],["exit",u,t]]),o=Dt(o,e.slice(s+1)),o=Dt(o,[["exit",l,t]]),Rt(e,i,e.length,o),e}function bD(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(h){return i?i._inactive?m(h):(s=r.parser.defined.includes(Wn(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(hD,c,s?c:m)(h):h===91?e.attempt(mD,c,s?u:m)(h):s?c(h):m(h)}function u(h){return e.attempt(pD,c,m)(h)}function c(h){return t(h)}function m(h){return i._balanced=!0,n(h)}}function yD(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),a}function a(m){return ft(m)?yr(e,i)(m):i(m)}function i(m){return m===41?c(m):sf(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function s(m){return ft(m)?yr(e,l)(m):c(m)}function o(m){return n(m)}function l(m){return m===34||m===39||m===40?uf(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):c(m)}function u(m){return ft(m)?yr(e,c)(m):c(m)}function c(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function DD(e,t,n){const r=this;return a;function a(o){return of.call(r,e,i,s,"reference","referenceMarker","referenceString")(o)}function i(o){return r.parser.defined.includes(Wn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(o):n(o)}function s(o){return n(o)}}function CD(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),a}function a(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const xD={name:"labelStartImage",tokenize:wD,resolveAll:ho.resolveAll};function wD(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 ED={name:"labelStartLink",tokenize:kD,resolveAll:ho.resolveAll};function kD(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 Si={name:"lineEnding",tokenize:_D};function _D(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Me(e,t,"linePrefix")}}const ha={name:"thematicBreak",tokenize:BD};function BD(e,t,n){let r=0,a;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(u){return a=u,o(u)}function o(u){return u===a?(e.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||ye(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===a?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),Te(u)?Me(e,o,"whitespace")(u):o(u))}}const lt={name:"list",tokenize:TD,continuation:{tokenize:SD},exit:OD},AD={tokenize:PD,partial:!0},FD={tokenize:jD,partial:!0};function TD(e,t,n){const r=this,a=r.events[r.events.length-1];let i=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,s=0;return o;function o(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Fs(p)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ha,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Fs(p)&&++s<10?(e.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Ya,r.interrupt?n:c,e.attempt(AD,h,m))}function c(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function m(p){return Te(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function SD(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Ya,a,i);function a(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Me(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Te(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(FD,t,s)(o))}function s(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Me(e,e.attempt(lt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function jD(e,t,n){const r=this;return Me(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 OD(e){e.exit(this.containerState.type)}function PD(e,t,n){const r=this;return Me(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!Te(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Nl={name:"setextUnderline",tokenize:RD,resolveTo:ND};function ND(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 RD(e,t,n){const r=this;let a;return i;function i(u){let c=r.events.length,m;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){m=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),a=u,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===a?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),Te(u)?Me(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||ye(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const MD={tokenize:ID};function ID(e){const t=this,n=e.attempt(Ya,r,e.attempt(this.parser.constructs.flowInitial,a,Me(e,e.attempt(this.parser.constructs.flow,a,e.attempt(W1,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 $D={resolveAll:cf()},LD=lf("string"),zD=lf("text");function lf(e){return{tokenize:t,resolveAll:cf(e==="text"?qD: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 m=a[c];let h=-1;if(m)for(;++h<m.length;){const p=m[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function cf(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 qD(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 WD(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const a={},i=[];let s=[],o=[];const l={consume:w,enter:A,exit:k,attempt:j(E),check:j(T),interrupt:j(T,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:p,sliceSerialize:h,now:g,defineSkip:f,write:m};let c=t.tokenize.call(u,l);return t.resolveAll&&i.push(t),u;function m(M){return s=Dt(s,M),y(),s[s.length-1]!==null?[]:(z(t,0),u.events=fo(i,u.events,u),u.events)}function h(M,x){return UD(p(M),x)}function p(M){return HD(s,M)}function g(){const{line:M,column:x,offset:B,_index:F,_bufferIndex:N}=r;return{line:M,column:x,offset:B,_index:F,_bufferIndex:N}}function f(M){a[M.line]=M.column,$()}function y(){let M;for(;r._index<s.length;){const x=s[r._index];if(typeof x=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<x.length;)b(x.charCodeAt(r._bufferIndex));else b(x)}}function b(M){c=c(M)}function w(M){ye(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,$()):M!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=M}function A(M,x){const B=x||{};return B.type=M,B.start=g(),u.events.push(["enter",B,u]),o.push(B),B}function k(M){const x=o.pop();return x.end=g(),u.events.push(["exit",x,u]),x}function E(M,x){z(M,x.from)}function T(M,x){x.restore()}function j(M,x){return B;function B(F,N,L){let q,oe,ne,D;return Array.isArray(F)?X(F):"tokenize"in F?X([F]):H(F);function H(I){return V;function V(te){const ee=te!==null&&I[te],ae=te!==null&&I.null,fe=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(ae)?ae:ae?[ae]:[]];return X(fe)(te)}}function X(I){return q=I,oe=0,I.length===0?L:_(I[oe])}function _(I){return V;function V(te){return D=R(),ne=I,I.partial||(u.currentConstruct=I),I.name&&u.parser.constructs.disable.null.includes(I.name)?W():I.tokenize.call(x?Object.assign(Object.create(u),x):u,l,S,W)(te)}}function S(I){return M(ne,D),N}function W(I){return D.restore(),++oe<q.length?_(q[oe]):L}}}function z(M,x){M.resolveAll&&!i.includes(M)&&i.push(M),M.resolve&&Rt(u.events,x,u.events.length-x,M.resolve(u.events.slice(x),u)),M.resolveTo&&(u.events=M.resolveTo(u.events,u))}function R(){const M=g(),x=u.previous,B=u.currentConstruct,F=u.events.length,N=Array.from(o);return{restore:L,from:F};function L(){r=M,u.previous=x,u.currentConstruct=B,u.events.length=F,o=N,$()}}function $(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function HD(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 UD(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
|
|
113
113
|
`;break}case-3:{s=`\r
|
|
114
|
-
`;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const ID={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:Kd},$D={91:L1},LD={[-2]:Fi,[-1]:Fi,32:Fi},zD={35:V1,42:ha,45:[Sl,ha],60:G1,61:Sl,95:ha,96:Fl,126:Fl},qD={38:Yd,92:Zd},WD={[-5]:Ti,[-4]:Ti,[-3]:Ti,33:mD,38:Yd,42:_s,60:[v1,rD],91:gD,92:[H1,Zd],93:uo,95:_s,96:T1},HD={null:[_s,SD]},UD={null:[42,95]},VD={null:[]},KD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:UD,contentInitial:$D,disable:VD,document:ID,flow:zD,flowInitial:LD,insideSpan:HD,string:qD,text:WD},Symbol.toStringTag,{value:"Module"}));function ZD(e){const n=n1([KD,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(c1),document:a(f1),flow:a(FD),string:a(jD),text:a(OD)};return r;function a(i){return s;function s(o){return ND(r,i,o)}}}function YD(e){for(;!Gd(e););return e}const jl=/[\0\t\n\r]/g;function GD(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,f,m,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(jl.lastIndex=f,u=jl.exec(i),m=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(m),!u){t=i.slice(f);break}if(p===10&&f===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),f<m&&(l.push(i.slice(f,m)),e+=m-f),p){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}f=m+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const QD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function JD(e){return e.replace(QD,XD)}function XD(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return Vd(n.slice(i?2:1),i?16:10)}return so(n)||e}const nf={}.hasOwnProperty;function eC(e,t,n){return typeof t!="string"&&(n=t,t=void 0),tC(n)(YD(ZD(n).document().write(GD()(e,t,!0))))}function tC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ne),autolinkProtocol:I,autolinkEmail:I,atxHeading:i(ge),blockQuote:i(ee),characterEscape:I,characterReference:I,codeFenced:i(ae),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ae,s),codeText:i(de,s),codeTextData:I,data:I,codeFlowValue:I,definition:i(Y),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(pe),hardBreakEscape:i(_e),hardBreakTrailing:i(_e),htmlFlow:i(Oe,s),htmlFlowData:I,htmlText:i(Oe,s),htmlTextData:I,image:i(he),label:s,link:i(Ne),listItem:i(Ue),listItemValue:m,listOrdered:i(He,f),listUnordered:i(He),paragraph:i(Qe),reference:B,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(ge),strong:i(Ae),thematicBreak:i(We)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:te,autolinkProtocol:K,blockQuote:l(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:z,characterReferenceMarkerNumeric:z,characterReferenceValue:$,codeFenced:l(y),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:N,codeIndented:l(v),codeText:l(R),codeTextData:N,data:N,definition:l(),definitionDestinationString:E,definitionLabelString:w,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(x),hardBreakTrailing:l(x),htmlFlow:l(_),htmlFlowData:N,htmlText:l(j),htmlTextData:N,image:l(V),label:ne,labelText:ue,lineEnding:M,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:T,resourceDestinationString:D,resourceTitleString:W,resource:X,setextHeading:l(L),setextHeadingLineSequence:S,setextHeadingText:F,strong:l(),thematicBreak:l()}};rf(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},be=[];let xe=-1;for(;++xe<U.length;)if(U[xe][1].type==="listOrdered"||U[xe][1].type==="listUnordered")if(U[xe][0]==="enter")be.push(xe);else{const Ye=be.pop();xe=a(U,Ye,xe)}for(xe=-1;++xe<U.length;){const Ye=t[U[xe][0]];nf.call(Ye,U[xe][1].type)&&Ye[U[xe][1].type].call(Object.assign({sliceSerialize:U[xe][2].sliceSerialize},me),U[xe][1])}if(me.tokenStack.length>0){const Ye=me.tokenStack[me.tokenStack.length-1];(Ye[1]||Ol).call(me,void 0,Ye[0])}for(ie.position={start:Zt(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:Zt(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<t.transforms.length;)ie=t.transforms[xe](ie)||ie;return ie}function a(U,ie,me){let be=ie-1,xe=-1,Ye=!1,Ge,mt,Mt,Et;for(;++be<=me;){const Xe=U[be];switch(Xe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Xe[0]==="enter"?xe++:xe--,Et=void 0;break}case"lineEndingBlank":{Xe[0]==="enter"&&(Ge&&!Et&&!xe&&!Mt&&(Mt=be),Et=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Et=void 0}if(!xe&&Xe[0]==="enter"&&Xe[1].type==="listItemPrefix"||xe===-1&&Xe[0]==="exit"&&(Xe[1].type==="listUnordered"||Xe[1].type==="listOrdered")){if(Ge){let Bt=be;for(mt=void 0;Bt--;){const pt=U[Bt];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;mt&&(U[mt][1].type="lineEndingBlank",Ye=!0),pt[1].type="lineEnding",mt=Bt}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}Mt&&(!mt||Mt<mt)&&(Ge._spread=!0),Ge.end=Object.assign({},mt?U[mt][1].start:Xe[1].end),U.splice(mt||be,0,["exit",Ge,Xe[2]]),be++,me++}if(Xe[1].type==="listItemPrefix"){const Bt={type:"listItem",_spread:!1,start:Object.assign({},Xe[1].start),end:void 0};Ge=Bt,U.splice(be,0,["enter",Bt,Xe[2]]),be++,me++,Mt=void 0,Et=!0}}}return U[ie][1]._spread=Ye,me}function i(U,ie){return me;function me(be){o.call(this,U(be),be),ie&&ie.call(this,be)}}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:Zt(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(),be=this.tokenStack.pop();if(be)be[0].type!==U.type&&(ie?ie.call(this,U,be[0]):(be[1]||Ol).call(this,U,be[0]));else throw new Error("Cannot close `"+U.type+"` ("+vr({start:U.start,end:U.end})+"): it’s not open");me.position.end=Zt(U.end)}function c(){return e1(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function m(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 p(){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 h(){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 w(U){const ie=this.resume(),me=this.stack[this.stack.length-1];me.label=ie,me.identifier=qn(this.sliceSerialize(U)).toLowerCase()}function A(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.title=U}function E(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.url=U}function k(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 L(){this.data.setextHeadingSlurpLineEnding=void 0}function I(U){const me=this.stack[this.stack.length-1].children;let be=me[me.length-1];(!be||be.type!=="text")&&(be=ze(),be.position={start:Zt(U.start),end:void 0},me.push(be)),this.stack.push(be)}function N(U){const ie=this.stack.pop();ie.value+=this.sliceSerialize(U),ie.position.end=Zt(U.end)}function M(U){const ie=this.stack[this.stack.length-1];if(this.data.atHardBreak){const me=ie.children[ie.children.length-1];me.position.end=Zt(U.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ie.type)&&(I.call(this,U),N.call(this,U))}function x(){this.data.atHardBreak=!0}function _(){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 R(){const U=this.resume(),ie=this.stack[this.stack.length-1];ie.value=U}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 V(){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 ue(U){const ie=this.sliceSerialize(U),me=this.stack[this.stack.length-2];me.label=JD(ie),me.identifier=qn(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 be=U.children;me.children=be}else me.alt=ie}function D(){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 X(){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=qn(this.sliceSerialize(U)).toLowerCase(),this.data.referenceType="full"}function z(U){this.data.characterReferenceType=U.type}function $(U){const ie=this.sliceSerialize(U),me=this.data.characterReferenceType;let be;me?(be=Vd(ie,me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):be=so(ie);const xe=this.stack.pop();xe.value+=be,xe.position.end=Zt(U.end)}function K(U){N.call(this,U);const ie=this.stack[this.stack.length-1];ie.url=this.sliceSerialize(U)}function te(U){N.call(this,U);const ie=this.stack[this.stack.length-1];ie.url="mailto:"+this.sliceSerialize(U)}function ee(){return{type:"blockquote",children:[]}}function ae(){return{type:"code",lang:null,meta:null,value:""}}function de(){return{type:"inlineCode",value:""}}function Y(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pe(){return{type:"emphasis",children:[]}}function ge(){return{type:"heading",depth:0,children:[]}}function _e(){return{type:"break"}}function Oe(){return{type:"html",value:""}}function he(){return{type:"image",title:null,url:"",alt:null}}function Ne(){return{type:"link",title:null,url:"",children:[]}}function He(U){return{type:"list",ordered:U.type==="listOrdered",start:null,spread:U._spread,children:[]}}function Ue(U){return{type:"listItem",spread:U._spread,checked:null,children:[]}}function Qe(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function ze(){return{type:"text",value:""}}function We(){return{type:"thematicBreak"}}}function Zt(e){return{line:e.line,column:e.column,offset:e.offset}}function rf(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?rf(e,r):nC(e,r)}}function nC(e,t){let n;for(n in t)if(nf.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 Ol(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+vr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+vr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+vr({start:t.start,end:t.end})+") is still open")}function rC(e){const t=this;t.parser=n;function n(r){return eC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function af(e,t){var l,u,c;const n={...$n,...t==null?void 0:t.nodeTypes,[G.heading]:{...$n[G.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[G.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(f=>af({...f,ordered:e.ordered||!1},t))),e.type){case it.heading:return{type:n[G.heading][e.depth||1],children:s};case it.list:return{type:e.ordered?n[G.ol]:n[G.ul],children:s};case it.listItem:return{type:n[G.li],children:s};case it.paragraph:return{type:n[G.paragraph],children:s};case it.link:return{type:n[G.link],[r]:e.url,children:s};case it.image:return{type:n[G.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case it.blockquote:return{type:n[G.blockquote],children:s};case it.code:return{type:n[G.codeblock],language:e.lang,children:[{text:e.value}]};case it.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[G.paragraph],children:[{text:((c=e.value)==null?void 0:c.replace(/<br>/g,""))||""}]}:{type:G.paragraph,children:[{text:e.value||""}]};case it.emphasis:return{[n[Wt.emphasis]]:!0,...Si(s),...Gr(s)};case it.strong:return{[n[Wt.strong]]:!0,...Si(s),...Gr(s)};case it.delete:return{[n[Wt.delete]]:!0,...Si(s),...Gr(s)};case it.inlineCode:return{[n[Wt.code]]:!0,text:e.value,...Gr(s)};case it.thematicBreak:return{type:n[G.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const Si=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Gr(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const aC=function(t){const n=r=>r.children.map(a=>af(a,t));this.Compiler=n},iC=(e,t=n=>{})=>{Yy().use(rC).use(aC).process(e).then(n=>{const r=mn(n.result),a=i=>{const s=i;[G.li,G.blockquote].includes(s.type)&&s.children.map((o,l)=>{const u=o;u.type===G.paragraph&&s.children.splice(l,1,...u.children)}),"children"in i&&i.children&&i.children.forEach(o=>a(o))};r.forEach(a),r.map(i=>{"children"in i&&i.children&&i.children.map((s,o)=>{if("text"in s&&s.text){const l=s.text.match(/~~(.*?)~~/g);l&&l.map(u=>{const c=u.replace(/~~/g,""),f=s.text.indexOf(u),m=s.text.substring(0,f),p=s.text.substring(f+u.length),g=[{text:m},{text:c,[G.strikethrough]:!0},{text:p}];i.children.splice(o,1,...g)})}})}),t(r)})},sC=e=>{const{selection:t}=e;return t?b.string(e,t):null},Pl=e=>{let t="";for(const n of se.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},Nl={"mod+b":G.bold,"mod+i":G.italic,"mod+shift+x":G.strikethrough,"mod+k":G.link,"mod+shift+7":G.ol,"mod+shift+8":G.ul,"mod+shift+9":G.blockquote},oC=(e,t,n,r)=>{for(const a in Nl)if(Q0(a,e)){e.stopPropagation(),e.preventDefault();const i=Nl[a];if(i===G.link){n([{type:"showLinkEditor",value:!0}]);return}if(mC(i)){cf(t,i,r);return}Wd(t,i,r)}},jn=e=>typeof e.text=="string",uC=[G.hr,G.image],Rl="<br>";function sf(e,t={nodeTypes:$n}){const{nodeTypes:n=$n,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...$n,...n,heading:{...$n[G.heading],...n[G.heading]}},l=[o[G.ul],o[G.ol]];let u=i;if(jn(e)||(u=e.children.map(c=>{const f=jn(c)?!1:l.includes(c.type||""),m=l.includes(e.type||"");let p=!1;return!jn(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!jn(g)&&g.type===o.link)),sf({...c,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||f||m||p)&&!c.break,listDepth:l.includes(c.type||"")?a+1:a,inBlockquote:s===o[G.blockquote]||e.parentType===o[G.blockquote]})}).join("")),!r&&(i===""||i===`
|
|
115
|
-
`)&&e.parentType===o[
|
|
116
|
-
`;case o[
|
|
117
|
-
`;case o[
|
|
118
|
-
`;case o[
|
|
119
|
-
`;case o[
|
|
120
|
-
`;case o[
|
|
121
|
-
`;case o[
|
|
122
|
-
|
|
123
|
-
`;case o[
|
|
114
|
+
`;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&a)continue;s=" ";break}default:s=String.fromCharCode(i)}a=i===-2,r.push(s)}return r.join("")}const VD={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:tf},KD={91:Z1},ZD={[-2]:Ti,[-1]:Ti,32:Ti},YD={35:eD,42:ha,45:[Nl,ha],60:aD,61:Nl,95:ha,96:Ol,126:Ol},GD={38:rf,92:nf},QD={[-5]:Si,[-4]:Si,[-3]:Si,33:xD,38:rf,42:Ts,60:[k1,dD],91:ED,92:[J1,nf],93:ho,95:Ts,96:I1},JD={null:[Ts,$D]},XD={null:[42,95]},eC={null:[]},tC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:XD,contentInitial:KD,disable:eC,document:VD,flow:YD,flowInitial:ZD,insideSpan:JD,string:GD,text:QD},Symbol.toStringTag,{value:"Module"}));function nC(e){const n=c1([tC,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:a(b1),document:a(D1),flow:a(MD),string:a(LD),text:a(zD)};return r;function a(i){return s;function s(o){return WD(r,i,o)}}}function rC(e){for(;!af(e););return e}const Rl=/[\0\t\n\r]/g;function aC(){let e=1,t="",n=!0,r;return a;function a(i,s,o){const l=[];let u,c,m,h,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),m=0,t="",n&&(i.charCodeAt(0)===65279&&m++,n=void 0);m<i.length;){if(Rl.lastIndex=m,u=Rl.exec(i),h=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(h),!u){t=i.slice(m);break}if(p===10&&m===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),m<h&&(l.push(i.slice(m,h)),e+=h-m),p){case 0:{l.push(65533),e++;break}case 9:{for(c=Math.ceil(e/4)*4,l.push(-2);e++<c;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}m=h+1}return o&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const iC=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function sC(e){return e.replace(iC,oC)}function oC(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),i=a===120||a===88;return ef(n.slice(i?2:1),i?16:10)}return co(n)||e}const df={}.hasOwnProperty;function uC(e,t,n){return typeof t!="string"&&(n=t,t=void 0),lC(n)(rC(nC(n).document().write(aC()(e,t,!0))))}function lC(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Pe),autolinkProtocol:R,autolinkEmail:R,atxHeading:i(ge),blockQuote:i(ee),characterEscape:R,characterReference:R,codeFenced:i(ae),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(ae,s),codeText:i(fe,s),codeTextData:R,data:R,codeFlowValue:R,definition:i(G),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(he),hardBreakEscape:i(Ee),hardBreakTrailing:i(Ee),htmlFlow:i(Oe,s),htmlFlowData:R,htmlText:i(Oe,s),htmlTextData:R,image:i(me),label:s,link:i(Pe),listItem:i(Ue),listItemValue:h,listOrdered:i(He,m),listUnordered:i(He),paragraph:i(Qe),reference:_,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(ge),strong:i(Ae),thematicBreak:i(We)},exit:{atxHeading:l(),atxHeadingSequence:E,autolink:l(),autolinkEmail:te,autolinkProtocol:V,blockQuote:l(),characterEscapeValue:$,characterReferenceMarkerHexadecimal:W,characterReferenceMarkerNumeric:W,characterReferenceValue:I,codeFenced:l(y),codeFencedFence:f,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:$,codeIndented:l(b),codeText:l(N),codeTextData:$,data:$,definition:l(),definitionDestinationString:k,definitionLabelString:w,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(x),hardBreakTrailing:l(x),htmlFlow:l(B),htmlFlowData:$,htmlText:l(F),htmlTextData:$,image:l(q),label:ne,labelText:oe,lineEnding:M,link:l(L),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:S,resourceDestinationString:D,resourceTitleString:H,resource:X,setextHeading:l(z),setextHeadingLineSequence:j,setextHeadingText:T,strong:l(),thematicBreak:l()}};ff(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Z){let se={type:"root",children:[]};const pe={stack:[se],tokenStack:[],config:t,enter:o,exit:u,buffer:s,resume:c,data:n},be=[];let xe=-1;for(;++xe<Z.length;)if(Z[xe][1].type==="listOrdered"||Z[xe][1].type==="listUnordered")if(Z[xe][0]==="enter")be.push(xe);else{const Ye=be.pop();xe=a(Z,Ye,xe)}for(xe=-1;++xe<Z.length;){const Ye=t[Z[xe][0]];df.call(Ye,Z[xe][1].type)&&Ye[Z[xe][1].type].call(Object.assign({sliceSerialize:Z[xe][2].sliceSerialize},pe),Z[xe][1])}if(pe.tokenStack.length>0){const Ye=pe.tokenStack[pe.tokenStack.length-1];(Ye[1]||Ml).call(pe,void 0,Ye[0])}for(se.position={start:Yt(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:Yt(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<t.transforms.length;)se=t.transforms[xe](se)||se;return se}function a(Z,se,pe){let be=se-1,xe=-1,Ye=!1,Ge,mt,It,Et;for(;++be<=pe;){const Xe=Z[be];switch(Xe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Xe[0]==="enter"?xe++:xe--,Et=void 0;break}case"lineEndingBlank":{Xe[0]==="enter"&&(Ge&&!Et&&!xe&&!It&&(It=be),Et=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Et=void 0}if(!xe&&Xe[0]==="enter"&&Xe[1].type==="listItemPrefix"||xe===-1&&Xe[0]==="exit"&&(Xe[1].type==="listUnordered"||Xe[1].type==="listOrdered")){if(Ge){let Bt=be;for(mt=void 0;Bt--;){const pt=Z[Bt];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;mt&&(Z[mt][1].type="lineEndingBlank",Ye=!0),pt[1].type="lineEnding",mt=Bt}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}It&&(!mt||It<mt)&&(Ge._spread=!0),Ge.end=Object.assign({},mt?Z[mt][1].start:Xe[1].end),Z.splice(mt||be,0,["exit",Ge,Xe[2]]),be++,pe++}if(Xe[1].type==="listItemPrefix"){const Bt={type:"listItem",_spread:!1,start:Object.assign({},Xe[1].start),end:void 0};Ge=Bt,Z.splice(be,0,["enter",Bt,Xe[2]]),be++,pe++,It=void 0,Et=!0}}}return Z[se][1]._spread=Ye,pe}function i(Z,se){return pe;function pe(be){o.call(this,Z(be),be),se&&se.call(this,be)}}function s(){this.stack.push({type:"fragment",children:[]})}function o(Z,se,pe){this.stack[this.stack.length-1].children.push(Z),this.stack.push(Z),this.tokenStack.push([se,pe]),Z.position={start:Yt(se.start),end:void 0}}function l(Z){return se;function se(pe){Z&&Z.call(this,pe),u.call(this,pe)}}function u(Z,se){const pe=this.stack.pop(),be=this.tokenStack.pop();if(be)be[0].type!==Z.type&&(se?se.call(this,Z,be[0]):(be[1]||Ml).call(this,Z,be[0]));else throw new Error("Cannot close `"+Z.type+"` ("+br({start:Z.start,end:Z.end})+"): it’s not open");pe.position.end=Yt(Z.end)}function c(){return u1(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function h(Z){if(this.data.expectingFirstListItemValue){const se=this.stack[this.stack.length-2];se.start=Number.parseInt(this.sliceSerialize(Z),10),this.data.expectingFirstListItemValue=void 0}}function p(){const Z=this.resume(),se=this.stack[this.stack.length-1];se.lang=Z}function g(){const Z=this.resume(),se=this.stack[this.stack.length-1];se.meta=Z}function f(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function y(){const Z=this.resume(),se=this.stack[this.stack.length-1];se.value=Z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const Z=this.resume(),se=this.stack[this.stack.length-1];se.value=Z.replace(/(\r?\n|\r)$/g,"")}function w(Z){const se=this.resume(),pe=this.stack[this.stack.length-1];pe.label=se,pe.identifier=Wn(this.sliceSerialize(Z)).toLowerCase()}function A(){const Z=this.resume(),se=this.stack[this.stack.length-1];se.title=Z}function k(){const Z=this.resume(),se=this.stack[this.stack.length-1];se.url=Z}function E(Z){const se=this.stack[this.stack.length-1];if(!se.depth){const pe=this.sliceSerialize(Z).length;se.depth=pe}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function j(Z){const se=this.stack[this.stack.length-1];se.depth=this.sliceSerialize(Z).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function R(Z){const pe=this.stack[this.stack.length-1].children;let be=pe[pe.length-1];(!be||be.type!=="text")&&(be=ze(),be.position={start:Yt(Z.start),end:void 0},pe.push(be)),this.stack.push(be)}function $(Z){const se=this.stack.pop();se.value+=this.sliceSerialize(Z),se.position.end=Yt(Z.end)}function M(Z){const se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const pe=se.children[se.children.length-1];pe.position.end=Yt(Z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(se.type)&&(R.call(this,Z),$.call(this,Z))}function x(){this.data.atHardBreak=!0}function B(){const Z=this.resume(),se=this.stack[this.stack.length-1];se.value=Z}function F(){const Z=this.resume(),se=this.stack[this.stack.length-1];se.value=Z}function N(){const Z=this.resume(),se=this.stack[this.stack.length-1];se.value=Z}function L(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=se,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function q(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const se=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=se,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function oe(Z){const se=this.sliceSerialize(Z),pe=this.stack[this.stack.length-2];pe.label=sC(se),pe.identifier=Wn(se).toLowerCase()}function ne(){const Z=this.stack[this.stack.length-1],se=this.resume(),pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,pe.type==="link"){const be=Z.children;pe.children=be}else pe.alt=se}function D(){const Z=this.resume(),se=this.stack[this.stack.length-1];se.url=Z}function H(){const Z=this.resume(),se=this.stack[this.stack.length-1];se.title=Z}function X(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function S(Z){const se=this.resume(),pe=this.stack[this.stack.length-1];pe.label=se,pe.identifier=Wn(this.sliceSerialize(Z)).toLowerCase(),this.data.referenceType="full"}function W(Z){this.data.characterReferenceType=Z.type}function I(Z){const se=this.sliceSerialize(Z),pe=this.data.characterReferenceType;let be;pe?(be=ef(se,pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):be=co(se);const xe=this.stack.pop();xe.value+=be,xe.position.end=Yt(Z.end)}function V(Z){$.call(this,Z);const se=this.stack[this.stack.length-1];se.url=this.sliceSerialize(Z)}function te(Z){$.call(this,Z);const se=this.stack[this.stack.length-1];se.url="mailto:"+this.sliceSerialize(Z)}function ee(){return{type:"blockquote",children:[]}}function ae(){return{type:"code",lang:null,meta:null,value:""}}function fe(){return{type:"inlineCode",value:""}}function G(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function he(){return{type:"emphasis",children:[]}}function ge(){return{type:"heading",depth:0,children:[]}}function Ee(){return{type:"break"}}function Oe(){return{type:"html",value:""}}function me(){return{type:"image",title:null,url:"",alt:null}}function Pe(){return{type:"link",title:null,url:"",children:[]}}function He(Z){return{type:"list",ordered:Z.type==="listOrdered",start:null,spread:Z._spread,children:[]}}function Ue(Z){return{type:"listItem",spread:Z._spread,checked:null,children:[]}}function Qe(){return{type:"paragraph",children:[]}}function Ae(){return{type:"strong",children:[]}}function ze(){return{type:"text",value:""}}function We(){return{type:"thematicBreak"}}}function Yt(e){return{line:e.line,column:e.column,offset:e.offset}}function ff(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?ff(e,r):cC(e,r)}}function cC(e,t){let n;for(n in t)if(df.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 Ml(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+br({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+br({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+br({start:t.start,end:t.end})+") is still open")}function dC(e){const t=this;t.parser=n;function n(r){return uC(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function hf(e,t){var l,u,c;const n={...Ln,...t==null?void 0:t.nodeTypes,[K.heading]:{...Ln[K.heading],...(l=t==null?void 0:t.nodeTypes)==null?void 0:l[K.heading]}},r=(t==null?void 0:t.linkDestinationKey)??"link",a=(t==null?void 0:t.imageSourceKey)??"link",i=(t==null?void 0:t.imageCaptionKey)??"caption";let s=[{text:""}];const o=e.children;switch(o&&Array.isArray(o)&&o.length>0&&(s=o.flatMap(m=>hf({...m,ordered:e.ordered||!1},t))),e.type){case it.heading:return{type:n[K.heading][e.depth||1],children:s};case it.list:return{type:e.ordered?n[K.ol]:n[K.ul],children:s};case it.listItem:return{type:n[K.li],children:s};case it.paragraph:return{type:n[K.paragraph],children:s};case it.link:return{type:n[K.link],[r]:e.url,children:s};case it.image:return{type:n[K.image],children:[{text:""}],[a]:e.url,[i]:e.alt};case it.blockquote:return{type:n[K.blockquote],children:s};case it.code:return{type:n[K.codeblock],language:e.lang,children:[{text:e.value}]};case it.html:return(u=e.value)!=null&&u.includes("<br>")?{break:!0,type:n[K.paragraph],children:[{text:((c=e.value)==null?void 0:c.replace(/<br>/g,""))||""}]}:{type:K.paragraph,children:[{text:e.value||""}]};case it.emphasis:return{[n[Ot.emphasis]]:!0,...ji(s),...Gr(s)};case it.strong:return{[n[Ot.strong]]:!0,...ji(s),...Gr(s)};case it.delete:return{[n[Ot.delete]]:!0,...ji(s),...Gr(s)};case it.inlineCode:return{[n[Ot.code]]:!0,text:e.value,...Gr(s)};case it.thematicBreak:return{type:n[K.hr],children:[{text:""}]};case"text":default:return{text:e.value||""}}}const ji=e=>({text:e.map(t=>t==null?void 0:t.text).join("")});function Gr(e){return e.reduce((t,n)=>(Object.keys(n).forEach(function(r){r==="children"||r==="type"||r==="text"||(t[r]=n[r])}),t),{})}const fC=function(t){const n=r=>r.children.map(a=>hf(a,t));this.Compiler=n},hC=(e,t=n=>{})=>{r1().use(dC).use(fC).process(e).then(n=>{const r=pn(n.result),a=s=>{const o=s;[K.li,K.blockquote].includes(o.type)&&o.children.map((l,u)=>{const c=l;c.type===K.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=>{const o=s;if(o.type===K.link){const l=o.children&&o.children[0];if(l&&"text"in l&&l.text.includes(Es)){const u=o,c=l.text.replace(Es,""),m="link"in u&&u.link?u.link:"";u.type=K.mention,u.id=m,u.name=c,u.children=[{text:""}]}}"children"in s&&s.children&&s.children.forEach(l=>i(l))};r.forEach(i),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 m=c.replace(/~~/g,""),h=o.text.indexOf(c),p=o.text.substring(0,h),g=o.text.substring(h+c.length),f=[{text:p},{text:m,[K.strikethrough]:!0},{text:g}];s.children.splice(l,1,...f)})}})}),t(r)})},mC=e=>{const{selection:t}=e;return t?v.string(e,t):null},Il=e=>{let t="";for(const n of ie.descendants(e)){const[r]=n,a=r;a.text&&(t+=a.text)}return t},$l={"mod+b":K.bold,"mod+i":K.italic,"mod+shift+x":K.strikethrough,"mod+k":K.link,"mod+shift+7":K.ol,"mod+shift+8":K.ul,"mod+shift+9":K.blockquote},pC=(e,t,n,r)=>{for(const a in $l)if(lb(a,e)){e.stopPropagation(),e.preventDefault();const i=$l[a];if(i===K.link){n([{type:"showLinkEditor",value:!0}]);return}if(_C(i)){Cf(t,i,r);return}vf(t,i,r)}},mf=(e,t,n)=>{var u;const{selectedUser:r,possibleUsers:a}=t,i=a[r];if(!i)return;const s=i.userId||"",o=(u=i.user)==null?void 0:u.name;n([{type:"mentionPopover",value:{...t,show:!1}}]);const l={type:K.mention,id:s,name:o,children:[{text:""}]};Q.select(e,(t==null?void 0:t.position)||Gd),Q.insertNodes(e,[l,{text:" "}]),Q.move(e,{distance:1,unit:"offset"})},gC=async(e,t,n,r)=>{const{selection:a}=e;if(a&&U.isCollapsed(a)){const[i]=U.edges(a),s=v.before(e,i,{unit:"word"}),o=s&&v.before(e,s),l=o&&v.range(e,o,i),u=l&&v.string(e,l),c=u&&u.match(Sc),m=v.after(e,i),h=v.range(e,i,m),g=v.string(e,h).match(/^(\s|$)/);if(c&&g){const f=c[1];let y=[];n&&(y=await n({name:f})),r([{type:"mentionPopover",value:{show:!0,selectedUser:0,possibleUsers:y,position:l}}]);return}}t&&r([{type:"mentionPopover",value:{show:!1,selectedUser:0,possibleUsers:[],position:null}}])},On=e=>typeof e.text=="string",vC=[K.hr,K.image,K.mention],Ll="<br>";function pf(e,t={nodeTypes:Ln}){const{nodeTypes:n=Ln,ignoreParagraphNewline:r=!1,listDepth:a=0}=t,i=e.text||"";let s=e.type||"";const o={...Ln,...n,heading:{...Ln[K.heading],...n[K.heading]}},l=[o[K.ul],o[K.ol]];let u=i;if(!On(e)&&s!==K.mention&&(u=e.children.map(c=>{const m=On(c)?!1:l.includes(c.type||""),h=l.includes(e.type||"");let p=!1;return!On(e)&&Array.isArray(e.children)&&(p=e.children.some(g=>!On(g)&&g.type===o.link)),pf({...c,parentType:s},{nodeTypes:o,ignoreParagraphNewline:(r||m||h||p)&&!c.break,listDepth:l.includes(c.type||"")?a+1:a,inBlockquote:s===o[K.blockquote]||e.parentType===o[K.blockquote]})}).join("")),!r&&(i===""||i===`
|
|
115
|
+
`)&&e.parentType===o[K.paragraph]&&s!==o[K.mention]&&(s=o[K.paragraph],u=Ll),!(u===""&&!vC.find(c=>o[c]===s)))switch(u!==Ll&&On(e)&&(e[K.strikethrough]&&e[K.bold]&&e[K.italic]?u=Pn(u,"~~***"):e[K.bold]&&e[K.italic]?u=Pn(u,"***"):(e[K.bold]&&(u=Pn(u,"**")),e[K.italic]&&(u=Pn(u,"_")),e[K.strikethrough]&&(u=Pn(u,"~~")),e[K.code]&&(u=Pn(u,"`")))),s){case o[K.heading][1]:return`# ${u}
|
|
116
|
+
`;case o[K.heading][2]:return`## ${u}
|
|
117
|
+
`;case o[K.heading][3]:return`### ${u}
|
|
118
|
+
`;case o[K.heading][4]:return`#### ${u}
|
|
119
|
+
`;case o[K.heading][5]:return`##### ${u}
|
|
120
|
+
`;case o[K.heading][6]:return`###### ${u}
|
|
121
|
+
`;case o[K.blockquote]:return`> ${u}
|
|
122
|
+
|
|
123
|
+
`;case o[K.codeblock]:return`\`\`\`${e.language||""}
|
|
124
124
|
${u}
|
|
125
125
|
\`\`\`
|
|
126
|
-
`;case o[
|
|
126
|
+
`;case o[K.link]:return`[${u}](${e.link||""})`;case o.image:return``;case o[K.mention]:const{id:c}=e;return e?`@{{${c}}}`:u;case o[K.ul]:case o[K.ol]:return`
|
|
127
127
|
${u}
|
|
128
|
-
`;case o[
|
|
129
|
-
`:""}`;case o[
|
|
128
|
+
`;case o[K.li]:const m=e&&e.parentType===o[K.ol],h=e.children.length===1&&On(e.children[0]);let p="";for(let g=0;a>g;g++)m?p+=" ":p+=" ";return t.inBlockquote&&(p="> "+p),`${p}${m?"1.":"-"} ${u}${h?`
|
|
129
|
+
`:""}`;case o[K.paragraph]:return`${u}
|
|
130
130
|
|
|
131
|
-
`;case o[
|
|
132
|
-
`;default:return u}}function On(e,t){const n=e.trim(),r=n,a=`${t}${r}${Ml(t)}`;if(r.length===e.length)return a;const i=t+r+Ml(t);return e.replace(n,i)}const Ml=e=>e.split("").reverse().join(""),lC=e=>e.map(t=>sf(t)).join("").trim(),yr=e=>{const[t]=b.nodes(e,{match:n=>{const r=n;return!b.isEditor(n)&&ce.isElement(n)&&r.type===G.link}});return!!t},cC=(e,t,n,r)=>{e.selection&&lo(e,t,n,r)},dC=(e,t,n,r)=>{const{selection:a}=e;if(a&&H.isCollapsed(a)){const[s]=b.nodes(e,{match:o=>{const l=o;return!b.isEditor(o)&&ce.isElement(o)&&l.type===G.link}});if(s){const[o,l]=s,u={link:t};Q.setNodes(e,u,{at:l}),of(n)}}else lo(e,t,n,r)},lo=(e,t,n,r=a=>{console.error(a)})=>{try{yr(e)&&uf(e);const{selection:a}=e,i=a&&H.isCollapsed(a),s={type:G.link,link:t,children:i?[{text:t}]:[]};i?(Q.insertNodes(e,s),Q.move(e,{distance:1,unit:"offset"})):(Q.wrapNodes(e,s,{split:!0}),Q.collapse(e,{edge:"end"}),Q.insertNodes(e,{text:""}),Q.move(e,{distance:1,unit:"offset"})),of(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},of=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},uf=e=>{Q.unwrapNodes(e,{match:t=>{const n=t;return!b.isEditor(t)&&ce.isElement(t)&&n.type===G.link}})};let ji=null;const fC=()=>{const e=oe.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,dispatch:a,reportError:i}=C.useContext(_n),s=nr(),o=Sy(s),l=(o==null?void 0:o.text)||sC(s),[u,c]=C.useState(yr(s)),f=Ty(s,"link-editor",`${n}-link`),m=C.useRef(null);C.useEffect(()=>{var y;!u&&r&&((y=m.current)==null||y.focus())},[u]),C.useEffect(()=>{ji&&clearTimeout(ji),ji=setTimeout(()=>{c(yr(s))},500)},[s.selection]);const p=[],g=["open","edit","remove"].map(y=>{const v={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${y}`},{link:o==null?void 0:o.pretty})};switch(p.push({className:y}),y){case"open":v.href=(o==null?void 0:o.full)||"",v.onClick=w=>{w.preventDefault(),w.stopPropagation(),window.open((o==null?void 0:o.full)||"","_blank"),a([{type:"showLinkEditor",value:!1}])},v.children=d.jsxs(d.Fragment,{children:[v.children,d.jsx(Ie,{children:e.formatMessage({id:`${t}${y}_text`})})]});break;case"edit":v.onClick=()=>{c(!1)};break;case"remove":v.onClick=()=>{const w=[{type:"showLinkEditor",value:!1}];yr(s)&&(uf(s),w.push({type:"lastAnchor",value:null})),a(w)};break}return v}),h=[{id:"url",type:"url",inputRef:m,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(o==null?void 0:o.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];return l&&h.unshift({component:()=>d.jsxs("p",{children:[d.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",l]})}),d.jsx(Fc,{children:d.jsx(wn,{ref:f,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!u},functions:{onBlur:()=>{a([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var y;return(y=m.current)==null?void 0:y.focus()})}},children:u?d.jsx(En,{wrappers:p,buttons:g}):d.jsx(er,{element:"fieldset",id:`${n}-link-editor`,className:Z({"show-labels":l}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async y=>{setTimeout(()=>{const v=[{type:"showLinkEditor",value:!1}];if(y.url){const{full:w}=Ac(y.url);o!=null&&o.full?dC(s,w,n,i):cC(s,w,n,i),v.push({type:"lastAnchor",value:null})}a(v)})}},fields:h,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},hC=()=>{const e=nr(),{setFocus:t,dispatch:n}=C.useContext(_n),[r,a]=C.useState(!1);return C.useEffect(()=>{a(yr(e))},[e.selection]),d.jsx(ao,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},mC=e=>[G.bold,G.italic,G.strikethrough].includes(e),lf=(e,t)=>{const n=b.marks(e);return n?n[t]===!0:!1},cf=(e,t,n)=>{try{lf(e,t)?b.removeMark(e,t):b.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},pC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(_n),a=nr(),i=lf(a,e);return d.jsx(ao,{id:e,active:i,hasDivider:t,callback:()=>{cf(a,e,r),n(i?null:e)}})},_a=[G.bold,G.italic,G.strikethrough],gC=[G.ol,G.ul,G.blockquote];const vC=({...e})=>{const t=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsxs("fieldset",{className:"toolbar",...e,children:[d.jsx(Ie,{element:"legend",showOnFocus:!1,children:t.formatMessage({id:"richTextEditor_toolbar"})}),d.jsxs("ul",{children:[_a.map((n,r)=>d.jsx(pC,{format:n,hasDivider:r===_a.length-1},n)),d.jsx(hC,{}),gC.map((n,r)=>d.jsx(Ay,{format:n,hasDivider:r===1},n))]})]}),d.jsx(fC,{})]})};var bC=xC,yC=/^(?:\w+:)?\/\/(\S+)$/,DC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,CC=/^[^\s\.]+\.\S{2,}$/;function xC(e){if(typeof e!="string")return!1;var t=e.match(yC);if(!t)return!1;var n=t[1];return n?!!(DC.test(n)||CC.test(n)):!1}const wC=xn(bC),EC=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[G.link].includes(s.type)||a(i)},e.insertText=i=>{i&&wC(i)?lo(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},kC=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===G.link&&se.string(r).trim()===""){Q.removeNodes(e,{at:a});return}n([r,a])}}catch(r){const a=r.message;t(`Error in withoutEmptyLinks: ${a}`)}return e};const df=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,functions:a,autoFocus:i=!0,...s})=>{const o=oe.useIntl(),l=wh(),{onChange:u=()=>{},reportError:c=N=>{console.error(N)}}=a||{},f=[{type:G.paragraph,children:[{text:""}]}],m={originalValue:t||"",initialValue:t?null:f,tabbableOption:_a[0],openTooltip:null,showLinkEditor:!1,lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1},[p,g]=C.useReducer(Sr,m),{originalValue:h,initialValue:y,stringValue:v,lastAnchor:w,lastKey:A,hasInteracted:E}=p,k=N=>{const M=N||_a[0];N&&g([{type:"tabbableOption",value:M}])};C.useEffect(()=>{if(t){let N=mn(t);N.includes("<")&&(N=new ya().turndown(N)),iC(N,M=>{g([{type:"initialValue",value:M}]),setTimeout(()=>{g([{type:"stringValue",value:Pl(I)}])},150)})}},[]),C.useEffect(()=>{t!==""||!I||fc(h,t)&&!E||(b.withoutNormalizing(I,()=>{Q.delete(I,{at:{anchor:b.start(I,[]),focus:b.end(I,[])}}),Q.deselect(I),I.children.length!==0&&Q.unwrapNodes(I,{at:[0]}),Q.insertNodes(I,f,{at:[0]})}),g([{type:"initialValue",value:f},{type:"lastAnchor",value:null}]))},[t]);const F=`rte-${e}`,S=C.useCallback(N=>d.jsx(ky,{...N}),[]),L=C.useCallback(N=>d.jsx(_y,{...N}),[]),I=C.useMemo(()=>EC(kC(fv(wy(cv())),c),F,c),[]);return y?d.jsx("div",{id:F,className:"rich-text-editor",children:d.jsxs(_n.Provider,{value:{...p,id:F,setFocus:k,dispatch:g,reportError:c},children:[d.jsxs(Cy,{editor:I,initialValue:y,onChange:N=>{if(I.operations.some(x=>x.type!=="set_selection")){const x=lC(N);u(x),g([{type:"stringValue",value:Pl(I)}]),E||g([{type:"hasInteracted",value:!0}]),l&&console.log({serialized:x,json:N})}},...s,children:[d.jsx(fy,{className:"input",renderElement:S,renderLeaf:L,placeholder:n||o.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:i,tabIndex:0,onKeyDown:N=>{if(N.key==="Enter"){const{selection:M}=I;if(M){const x=H.isCollapsed(M),[_,j]=b.node(I,M,{depth:1});let R=_,q=R.type;const V=R.children[0];if(V&&[G.ol,G.ul].includes(V.type)&&(R=V,q=V.type),R&&ce.isElement(R)&&q!==G.paragraph){if(q===G.blockquote&&!N.shiftKey){N.stopPropagation(),N.preventDefault(),Q.insertNodes(I,f);return}if(x){const[ue]=b.parent(I,M,{edge:"end"}),D=ue.type;if(A==="Enter"&&D===G.li&&[G.ul,G.ol].includes(q)){N.stopPropagation(),N.preventDefault(),Q.insertNodes(I,f,{at:P.next(j)}),Q.select(I,b.end(I,P.next(j)));return}}}}}g([{type:"lastKey",value:N.key}]),oC(N,I,g,c)},onBlur:()=>{I.selection&&g([{type:"lastAnchor",value:I.selection.anchor}])},onFocus:()=>{if(w){if(!P.isPath(w.path)||!se.has(I,w.path))return;const N=se.get(I,w.path);let M=0;if(fe.isText(N)?M=N.text.length:N.children&&(M=N.children.length),w.offset>M)return;try{Q.select(I,{anchor:w,focus:w})}catch(x){const _=x.message;c(`Error focusing editor: ${_}`)}}}}),d.jsx(vC,{})]}),d.jsx(Is,{limit:r,valueLength:qa(v)})]})}):null};const _C=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=C.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);C.useEffect(()=>{r&&l(r)},[r]);const u=c=>{i||(l(c),a(c))};return d.jsxs("div",{className:Z("toggle",s),onClick:c=>{c.preventDefault(),c.stopPropagation(),u(o===n[0].value?n[1].value:n[0].value)},children:[d.jsx("p",{children:t}),d.jsx("ul",{className:Z("toggle-options",{disabled:i,on:o===n[1].value}),children:n.map(c=>{const f=`${e}-${c.value}`;return d.jsxs("li",{className:"hidden",children:[d.jsx("input",{type:"radio",id:f,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:i}),d.jsx("label",{htmlFor:f,children:c.label})]},f)})})]})};function BC({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=C.useState(!1),[l,u]=C.useState(!1),c=C.useRef(null),f=async m=>{o(!0),u(!1);try{const p=m.target.files&&m.target.files[0];if(!p||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:p,userId:t});a(h=>({...h,image:{thumbnail:g.thumbnailURL,full:g.originalURL}}))}catch{u(!0)}finally{o(!1)}o(!1)};return d.jsxs("div",{className:Z("profile-image-change-figure",e),children:[d.jsx(an,{className:"profile-image-change-picture",name:n,src:r,"data-testid":"profile-picture"}),l&&d.jsx("p",{className:"error text-small",children:d.jsx(oe.FormattedMessage,{id:"profile_image_change_error"})}),d.jsx("input",{id:"file",type:"file",accept:"image/*",ref:c,onChange:f,hidden:!0,"data-testid":"file-input"}),d.jsx(Ee,{onClick:()=>c.current&&c.current.click(),variant:"secondary","data-gtm-event-context":"ImageField","data-gtm-event-type":`${r?"change-photo":"add-photo"}-click`,className:"gtm-trackable",disabled:s,children:d.jsx(oe.FormattedMessage,{id:s?"profile_image_change_uploading_text":r?"profile_image_change_cta_with_picture":"profile_image_change_cta_without_picture"})})]})}const ff=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(er,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const hf=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[c,f]=C.useState([]),[m,p]=C.useState(!0),[g,h]=C.useState(u),{formatMessage:y}=oe.useIntl(),v=async E=>{E.preventDefault();try{await l(c),f([]),h("SUCCESS")}catch(k){h("ERROR"),o(k)}},w=E=>{E.preventDefault(),h("NOT_SUBMITTED"),p(!0),f([])},A=E=>{E.preventDefault(),s(),h("CLOSED")};return g==="CLOSED"?null:g==="ERROR"||g==="SUCCESS"?d.jsxs("div",{className:"invite-form-wrapper",children:[d.jsx("div",{className:"content centred",children:g==="SUCCESS"?d.jsx("h2",{className:"success-title",children:y({id:"inviteForm_success"})}):d.jsxs("h2",{className:"error-title",children:[" ",y({id:"inviteForm_error"})]})}),d.jsx(en,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(Ee,{variant:"secondary",onClick:w,children:y({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(Ee,{onClick:A,children:y({id:"inviteForm_ctaDone"})})]}):d.jsx(Ee,{onClick:w,children:y({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:v,className:Z("invite-form gtm-trackable"),children:[d.jsxs("fieldset",{className:"content",children:[d.jsx("h2",{className:"title",style:{color:r},children:e}),d.jsx("label",{htmlFor:"email-input",className:"label",style:{color:a},children:t}),d.jsx(ch.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:y({id:"inviteForm_email_placeholder"}),emails:c,onChange:E=>{f(E),p(!E.length)},autoFocus:!1,getLabel:(E,k,F)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:E}),d.jsx(Ee,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{F(k),p(!c.length)},className:"remove-email-button",screenreaderText:y({id:"overlay_close"})})]},k)})]}),d.jsx(en,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(Ee,{className:"sendEmailsButton",disabled:m,children:n})})]})})},ma=e=>e.map(t=>({condition:t})),yt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},AC=({functions:e,...t})=>{const{formatMessage:n}=oe.useIntl(),[r,a]=C.useState(null),[i,s]=C.useState(!1),[o,l]=C.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[yt.NEW_PASSWORD]!==p[yt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=p=>!ns(p[yt.NEW_PASSWORD]).isValid,f=[{"data-testid":yt.NEW_PASSWORD,id:yt.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ma(["required",c]),functions:{onChange:p=>l(ns(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":yt.CONFIRMED_PASSWORD,id:yt.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ma(["required",u])}];t.isPasswordChange&&f.unshift({"data-testid":yt.CURRENT_PASSWORD,id:yt.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ma(["required"])}),i&&f.push({component:Wc,props:{matchingRules:o}});const m={id:yt.FORM_ID,fields:f,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>a(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(yt.NEW_PASSWORD)||g.includes(yt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(er,{...m}),r&&d.jsx(rn,{variant:"error",text:r})]})};const mf=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=oe.useIntl(),u=C.useRef(null);Hn(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=f=>{f.preventDefault(),f.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return d.jsx("form",{onSubmit:c,className:Z("search-form gtm-trackable",t),role:"search","data-gtm-event-context":a,"data-gtm-event-type":i,children:d.jsx("fieldset",{id:`${e}-form`,hidden:n?!s:!1,children:d.jsxs("p",{children:[d.jsx(Ie,{element:"label",htmlFor:e,children:l.formatMessage({id:"search_label"})}),d.jsx("input",{ref:u,type:"search",id:e,name:e,defaultValue:r,placeholder:l.formatMessage({id:"search_placeholder"}),onKeyDown:f=>{f.key==="Enter"&&c(f)}}),d.jsx("button",{className:"clear",onClick:f=>{f.preventDefault(),f.stopPropagation(),u.current&&u.current.value&&(u.current.value="")},children:d.jsx(Ie,{children:l.formatMessage({id:"search_clear"})})}),d.jsx("button",{className:"search",onClick:c,children:d.jsx(Ie,{children:l.formatMessage({id:"search_cta"})})})]})})})},Il=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}])},FC=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"]}},TC=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=FC(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}])},SC=({shouldShow:e,placeholders:t,labels:n,functions:{validateEmail:r,resendVerificationCode:a},refs:i,state:s,dispatch:o,dataToSubmit:l,intl:u})=>{const{emailDetails:c}=s,f=(p,g)=>{p.current&&s.validFields[g]!==p.current.validity.valid&&o([{type:`validFields.${g}`,value:p.current.validity.valid}])},m=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>f(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{Il({ref:i.email,validateEmail:r,dispatch:o})},onChange:(p,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Ic,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(m.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>f(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{f(i.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),e.url&&m.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>d.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&m.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>d.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),m.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>d.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:p}),privacy:p=>d.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const g=[];["name","email"].forEach(h=>{s.validFields[h]!==i[h].current.validity.valid&&(g.push({type:`validFields.${h}`,value:i[h].current.validity.valid}),h==="email"&&Il({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),m};const jC=({className:e=""})=>d.jsxs("div",{className:Z("success-message",e),"data-testid":"success-message",children:[d.jsx("p",{className:"success-title",children:d.jsx(oe.FormattedMessage,{id:"signup_success_title"})}),d.jsx(oe.FormattedMessage,{id:"signup_success_text",values:{p:t=>d.jsx("p",{children:t})}})]});const OC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},PC=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=oe.useIntl(),{title:u=!0,expectation:c=!1,url:f=!0,logInButton:m=!0,successMessage:p=!0}=a,g={title:u,expectation:c,url:f,logInButton:m,successMessage:p},[h,y]=C.useReducer(Sr,OC),{validFields:v,emailDetails:w,shouldManuallyApprove:A,shouldDisableButton:E,showSuccessMessage:k,showError:F}=h,[S,L]=Ts.useCookies(["signup-this-session","functional-cookie-consent"]),I={form:C.createRef(),name:C.createRef(),email:C.createRef(),jobTitle:C.createRef(),organisation:C.createRef(),tc:C.createRef(),hiddenValidation:C.createRef()};C.useEffect(()=>{A===!0&&I.jobTitle.current&&I.jobTitle.current.focus()},[A]),C.useEffect(()=>{S["signup-this-session"]&&y([{type:"showSuccessMessage",value:!0}])},[S]),C.useEffect(()=>{k&&S["functional-cookie-consent"]&&L("signup-this-session","true",{path:"/",maxAge:3600})},[k]);const N=C.useMemo(()=>SC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:I,state:h,dispatch:y,dataToSubmit:s,intl:l}),[s,r,l,I,g,h]),M=E?!0:A?!Object.values(v).every(x=>x===!0):!v.name||!v.email||["exists","pending","verify"].includes(w.boxType);return g.successMessage&&k?d.jsx(jC,{className:e}):d.jsxs("fieldset",{className:Z("signup-form-fieldset",e),"data-testid":"signup-form",children:[g.title&&d.jsx("p",{className:"signup-title",children:d.jsx(oe.FormattedMessage,{id:"signup_title"})}),F&&d.jsx(rn,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(er,{className:"signup-form",formRef:I.form,id:"sign-up-form",fields:N,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:M?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/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 TC({refs:I,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:y,state:h})},onCatch:x=>{r.handleError(x),y([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:I.hiddenValidation})]})};var Bs={exports:{}},Qr={exports:{}},Se={};/** @license React v16.13.1
|
|
131
|
+
`;case o[K.hr]:return`---
|
|
132
|
+
`;default:return u}}function Pn(e,t){const n=e.trim(),r=n,a=`${t}${r}${zl(t)}`;if(r.length===e.length)return a;const i=t+r+zl(t);return e.replace(n,i)}const zl=e=>e.split("").reverse().join(""),bC=e=>e.map(t=>pf(t)).join("").trim();const yC=()=>{const e=Bn(),{dispatch:t,mentionPopover:n,id:r}=C.useContext(Kt),{show:a,selectedUser:i,possibleUsers:s}=n,o=Qd(e,"mention-popover",`toolbar-${r}`);return!a||!s.length?null:d.jsx(Is,{children:d.jsx(Mc,{ref:o,className:"mention-popover",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),t([{type:"showMentionPopover",value:!1}]))},children:d.jsx("ul",{children:s.map(({userId:l,user:u},c)=>d.jsx(tr,{element:"li",className:Y({selected:c===i}),member:{id:l,...u,link:!1},functions:{onClick:m=>{m.preventDefault(),m.stopPropagation();const h={...n,selectedUser:c};t([{type:"mentionPopover",value:h}]),mf(e,h,t)}}},l))})})})},mo=({id:e,active:t,hasDivider:n=!1,callback:r,className:a="",children:i,...s})=>{const o=ue.useIntl(),l=Bn(),{id:u,tabbableOption:c,setFocus:m,openTooltip:h,dispatch:p}=C.useContext(Kt),g={};return e!==c&&(g.tabIndex=-1),d.jsxs("li",{id:`${u}-${e}`,className:Y(e,{"has-divider":n}),onMouseEnter:()=>{p([{type:"openTooltip",value:e}])},onMouseLeave:()=>{p([{type:"openTooltip",value:null}])},onFocus:()=>{p([{type:"openTooltip",value:e}])},onBlur:f=>{f.stopPropagation();const y=[{type:"openTooltip",value:null}];l.selection&&y.push({type:"lastAnchor",value:l.selection.anchor}),p(y)},contentEditable:!1,children:[d.jsxs("button",{...s,...g,className:Y(e,a,{active:t}),onClick:f=>{f.stopPropagation(),f.preventDefault()},onMouseDown:f=>{f.stopPropagation(),f.preventDefault(),r()},onKeyDown:f=>{var y,b,w,A;if(f.key!=="Tab")switch(f.key){case"Enter":f.stopPropagation(),f.preventDefault(),r();break;case"ArrowLeft":case"ArrowRight":f.stopPropagation(),f.preventDefault();const k=f.currentTarget.closest("li");let E=k==null?void 0:k.nextElementSibling;if(f.key==="ArrowLeft"){const z=k==null?void 0:k.previousElementSibling;z?E=z:E=(y=k==null?void 0:k.parentElement)==null?void 0:y.lastElementChild}else E||(E=(b=k==null?void 0:k.parentElement)==null?void 0:b.firstElementChild);const T=E==null?void 0:E.className.split(" ")[0];T&&(m(T),(w=E==null?void 0:E.querySelector("button"))==null||w.focus());break;default:const j=f.currentTarget.closest("fieldset");if(j){(A=j==null?void 0:j.previousElementSibling)==null||A.focus();break}}},children:[d.jsx(Ie,{showOnFocus:!1,children:o.formatMessage({id:`richTextEditor_${e}`})}),d.jsx(En,{id:`tooltip-${e}`,styling:{extraPadding:!1,hasPointer:"bottom"},isOpen:h===e,"aria-hidden":!0,children:o.formatMessage({id:`richTextEditor_${e}`})})]}),i]})},ql=[K.ol,K.ul],gf=(e,t)=>{const{selection:n}=e;if(!n)return!1;const[r]=Array.from(v.nodes(e,{at:v.unhangRange(e,n),match:a=>{const i=a;return!v.isEditor(a)&&ce.isElement(a)&&i.type===t}}));return!!r},DC=e=>{const[t]=v.nodes(e,{match:n=>n.type===K.blockquote});return!!t},vf=(e,t,n)=>{try{const r=DC(e),a=gf(e,t),i=ql.includes(t);Q.unwrapNodes(e,{match:l=>{const u=l;return!v.isEditor(u)&&ce.isElement(u)&&ql.includes(u.type)},split:!0});const o={type:a?K.paragraph:i?K.li:t};if(Q.setNodes(e,o),i)if(a){const{selection:l}=e;if(!l)return;const[u,c]=v.parent(e,l,{edge:"end"});Array.from(v.nodes(e,{at:c,match:h=>{const p=h;return!v.isEditor(h)&&ce.isElement(h)&&p.type===K.li}})).forEach(([h,p])=>{ie.string(h).trim()===""&&Q.removeNodes(e,{at:p})})}else{if(r){const u={type:K.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}`)}},CC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(Kt),a=Bn(),i=gf(a,e);return d.jsx(mo,{id:e,active:i,hasDivider:t,callback:()=>{vf(a,e,r),n(i?null:e)}})},Dr=e=>{const[t]=v.nodes(e,{match:n=>{const r=n;return!v.isEditor(n)&&ce.isElement(n)&&r.type===K.link}});return!!t},xC=(e,t,n,r)=>{e.selection&&po(e,t,n,r)},wC=(e,t,n,r)=>{const{selection:a}=e;if(a&&U.isCollapsed(a)){const[s]=v.nodes(e,{match:o=>{const l=o;return!v.isEditor(o)&&ce.isElement(o)&&l.type===K.link}});if(s){const[o,l]=s,u={link:t};Q.setNodes(e,u,{at:l}),bf(n)}}else po(e,t,n,r)},po=(e,t,n,r=a=>{console.error(a)})=>{try{Dr(e)&&yf(e);const{selection:a}=e,i=a&&U.isCollapsed(a),s={type:K.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"})),bf(n)}catch(a){const i=a.message;r(`Error in wrapLink: ${i}`)}},bf=e=>{const t=document.getElementById(e);if(t){const n=t.querySelector(".input");n&&(n==null||n.focus())}},yf=e=>{Q.unwrapNodes(e,{match:t=>{const n=t;return!v.isEditor(t)&&ce.isElement(t)&&n.type===K.link}})};let Oi=null;const EC=()=>{const e=ue.useIntl(),t="richTextEditor_link_",{id:n,showLinkEditor:r,dispatch:a,reportError:i}=C.useContext(Kt),s=Bn(),o=$y(s),l=(o==null?void 0:o.text)||mC(s),[u,c]=C.useState(Dr(s)),m=Qd(s,"link-editor",`${n}-link`),h=C.useRef(null);C.useEffect(()=>{var y;!u&&r&&((y=h.current)==null||y.focus())},[u]),C.useEffect(()=>{Oi&&clearTimeout(Oi),Oi=setTimeout(()=>{c(Dr(s))},500)},[s.selection]);const p=[],g=["open","edit","remove"].map(y=>{const b={variant:"tertiary",size:"small",children:e.formatMessage({id:`${t}${y}`},{link:o==null?void 0:o.pretty})};switch(p.push({className:y}),y){case"open":b.href=(o==null?void 0:o.full)||"",b.onClick=w=>{w.preventDefault(),w.stopPropagation(),window.open((o==null?void 0:o.full)||"","_blank"),a([{type:"showLinkEditor",value:!1}])},b.children=d.jsxs(d.Fragment,{children:[b.children,d.jsx(Ie,{children:e.formatMessage({id:`${t}${y}_text`})})]});break;case"edit":b.onClick=()=>{c(!1)};break;case"remove":b.onClick=()=>{const w=[{type:"showLinkEditor",value:!1}];Dr(s)&&(yf(s),w.push({type:"lastAnchor",value:null})),a(w)};break}return b}),f=[{id:"url",type:"url",inputRef:h,label:e.formatMessage({id:`${t}url`}),placeholder:e.formatMessage({id:`${t}placeholder`}),value:(o==null?void 0:o.full)||"",validation:[{condition:"required",error:e.formatMessage({id:`${t}error_required`})},{condition:"valid-url"}],submitOnEnter:!0,autoFocus:!0}];return l&&f.unshift({component:()=>d.jsxs("p",{children:[d.jsx("strong",{"aria-label":e.formatMessage({id:`${t}text_aria`}),children:e.formatMessage({id:`${t}text`})})," ",l]})}),d.jsx(Is,{children:d.jsx(En,{ref:m,className:"link-editor",isOpen:r,styling:{extraPadding:!1,hasForm:!u},functions:{onBlur:()=>{a([{type:"showLinkEditor",value:!1}])}},callbacks:{onOpen:()=>{setTimeout(()=>{var y;return(y=h.current)==null?void 0:y.focus()})}},children:u?d.jsx(kn,{wrappers:p,buttons:g}):d.jsx(nr,{element:"fieldset",id:`${n}-link-editor`,className:Y({"show-labels":l}),meta:{shouldReset:!0,showRequiredLabels:!1},functions:{onSuccess:async y=>{setTimeout(()=>{const b=[{type:"showLinkEditor",value:!1}];if(y.url){const{full:w}=Rc(y.url);o!=null&&o.full?wC(s,w,n,i):xC(s,w,n,i),b.push({type:"lastAnchor",value:null})}a(b)})}},fields:f,button:{text:e.formatMessage({id:`${t}button`}),variant:"tertiary",size:"small"}})})})},kC=()=>{const e=Bn(),{setFocus:t,dispatch:n}=C.useContext(Kt),[r,a]=C.useState(!1);return C.useEffect(()=>{a(Dr(e))},[e.selection]),d.jsx(mo,{id:"link",active:r,hasDivider:!0,callback:()=>{n([{type:"showLinkEditor",value:!0}]),t(r?null:"link"),a(!0)}})},_C=e=>[K.bold,K.italic,K.strikethrough].includes(e),Df=(e,t)=>{const n=v.marks(e);return n?n[t]===!0:!1},Cf=(e,t,n)=>{try{Df(e,t)?v.removeMark(e,t):v.addMark(e,t,!0)}catch(r){const a=r.message;n(`Error toggling mark: ${a}`)}},BC=({format:e,hasDivider:t=!1})=>{const{setFocus:n,reportError:r}=C.useContext(Kt),a=Bn(),i=Df(a,e);return d.jsx(mo,{id:e,active:i,hasDivider:t,callback:()=>{Cf(a,e,r),n(i?null:e)}})},_a=[K.bold,K.italic,K.strikethrough],AC=[K.ol,K.ul,K.blockquote];const FC=({...e})=>{const t=ue.useIntl(),{id:n}=C.useContext(Kt);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:[_a.map((r,a)=>d.jsx(BC,{format:r,hasDivider:a===_a.length-1},r)),d.jsx(kC,{}),AC.map((r,a)=>d.jsx(CC,{format:r,hasDivider:a===1},r))]})]}),d.jsx(EC,{})]})};var TC=PC,SC=/^(?:\w+:)?\/\/(\S+)$/,jC=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,OC=/^[^\s\.]+\.\S{2,}$/;function PC(e){if(typeof e!="string")return!1;var t=e.match(SC);if(!t)return!1;var n=t[1];return n?!!(jC.test(n)||OC.test(n)):!1}const NC=wn(TC),RC=(e,t,n)=>{const{insertText:r,isInline:a}=e;try{e.isInline=i=>{const s=i;return[K.link].includes(s.type)||a(i)},e.insertText=i=>{i&&NC(i)?po(e,i,t):r(i)}}catch(i){const s=i.message;n(`Error in withInlines: ${s}`)}return e},MC=(e,t)=>{const{isInline:n,isVoid:r,markableVoid:a}=e;try{e.isInline=i=>i.type===K.mention?!0:n(i),e.isVoid=i=>i.type===K.mention?!0:r(i),e.markableVoid=i=>i.type===K.mention||a(i)}catch(i){const s=i.message;t(`Error in withMentions: ${s}`)}return e},IC=(e,t)=>{const{normalizeNode:n}=e;try{e.normalizeNode=([r,a])=>{if(r.type===K.link&&ie.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 xf=({id:e="rich-text-editor",value:t,placeholder:n,maxLength:r=0,functions:a,autoFocus:i=!0,data:s,...o})=>{const l=ue.useIntl(),u=Ph(),{listMembers:c,onChange:m=()=>{},reportError:h=F=>{console.error(F)}}=a||{},p=[{type:K.paragraph,children:[{text:""}]}],g={originalValue:t||"",initialValue:t?null:p,tabbableOption:_a[0],openTooltip:null,showLinkEditor:!1,mentionPopover:{show:!1,selectedUser:0,possibleUsers:[],position:null},lastAnchor:null,stringValue:"",lastKey:null,hasInteracted:!1},[f,y]=C.useReducer(jr,g),{originalValue:b,initialValue:w,stringValue:A,lastAnchor:k,lastKey:E,hasInteracted:T,mentionPopover:j}=f,z=F=>{const N=F||_a[0];F&&y([{type:"tabbableOption",value:N}])};C.useEffect(()=>{t&&(async()=>{let N=pn(t);N.includes("<")&&(N=new ya().turndown(N)),s&&s.mentions&&(N=await Nc({text:N,template:`[${Es}{{name}}]({{id}})`,mentions:s.mentions,listMembers:c||(()=>Promise.resolve([]))})),hC(N,L=>{y([{type:"initialValue",value:L}]),setTimeout(()=>{y([{type:"stringValue",value:Il(x)}])},150)})})()},[]),C.useEffect(()=>{t!==""||!x||vc(b,t)&&!T||(v.withoutNormalizing(x,()=>{Q.delete(x,{at:{anchor:v.start(x,[]),focus:v.end(x,[])}}),Q.deselect(x),x.children.length!==0&&Q.unwrapNodes(x,{at:[0]}),Q.insertNodes(x,p,{at:[0]})}),y([{type:"initialValue",value:p},{type:"lastAnchor",value:null}]))},[t]);const R=`rte-${e}`,$=C.useCallback(F=>d.jsx(My,{...F}),[]),M=C.useCallback(F=>d.jsx(Iy,{...F}),[]),x=C.useMemo(()=>RC(MC(IC(Ev(Ny(xv())),h),h),R,h),[]),B=xc(()=>{gC(x,j.show,c,y)},100);return w?d.jsx("div",{id:R,className:"rich-text-editor",children:d.jsxs(Kt.Provider,{value:{...f,id:R,setFocus:z,dispatch:y,reportError:h},children:[d.jsxs(Oy,{editor:x,initialValue:w,onChange:F=>{if(x.operations.some(L=>L.type!=="set_selection")){const L=bC(F);m(L),y([{type:"stringValue",value:Il(x)}]),T||y([{type:"hasInteracted",value:!0}]),B(),u&&console.log({serialized:L,json:F})}},...o,children:[d.jsx(Ey,{className:"input",renderElement:$,renderLeaf:M,placeholder:n||l.formatMessage({id:"richTextEditor_placeholder"}),autoFocus:i,tabIndex:0,onKeyDown:F=>{if(F.key==="Enter"){j.show&&(F.preventDefault(),F.stopPropagation(),mf(x,j,y));const{selection:N}=x;if(N){const L=U.isCollapsed(N),[q,oe]=v.node(x,N,{depth:1});let ne=q,D=ne.type;const H=ne.children[0];if(H&&[K.ol,K.ul].includes(H.type)&&(ne=H,D=H.type),ne&&ce.isElement(ne)&&D!==K.paragraph){if(D===K.blockquote&&!F.shiftKey){F.stopPropagation(),F.preventDefault(),Q.insertNodes(x,p);return}if(L){const[X]=v.parent(x,N,{edge:"end"}),S=X.type;if(E==="Enter"&&S===K.li&&[K.ul,K.ol].includes(D)){F.stopPropagation(),F.preventDefault(),Q.insertNodes(x,p,{at:P.next(oe)}),Q.select(x,v.end(x,P.next(oe)));return}}}}}else if(F.key==="Escape"){if(j.show){F.preventDefault(),F.stopPropagation(),y([{type:"mentionPopover",value:{...j,show:!1}}]);return}}else if(["ArrowUp","ArrowDown"].includes(F.key)&&j.show){F.preventDefault(),F.stopPropagation();const{selectedUser:N,possibleUsers:L}=j;let q=F.key==="ArrowUp"?N-1:N+1;q<0&&(q=L.length-1),q>=L.length&&(q=0),y([{type:"mentionPopover",value:{...j,selectedUser:q}}])}y([{type:"lastKey",value:F.key}]),pC(F,x,y,h)},onBlur:()=>{x.selection&&y([{type:"lastAnchor",value:x.selection.anchor}])},onFocus:()=>{if(k){if(!P.isPath(k.path)||!ie.has(x,k.path))return;const F=ie.get(x,k.path);let N=0;if(de.isText(F)?N=F.text.length:F.children&&(N=F.children.length),k.offset>N)return;try{Q.select(x,{anchor:k,focus:k})}catch(L){const q=L.message;h(`Error focusing editor: ${q}`)}}}}),d.jsx(FC,{}),c?d.jsx(yC,{}):null]}),d.jsx(Ws,{limit:r,valueLength:qa(A)})]})}):null};const $C=({id:e="form-toggle",label:t,options:n,initialValue:r,functions:{onChange:a=()=>{}},isDisabled:i=!1,className:s=""})=>{const[o,l]=C.useState(typeof r=="boolean"||typeof r=="string"?r:n[0].value);C.useEffect(()=>{r&&l(r)},[r]);const u=c=>{i||(l(c),a(c))};return d.jsxs("div",{className: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 m=`${e}-${c.value}`;return d.jsxs("li",{className:"hidden",children:[d.jsx("input",{type:"radio",id:m,name:e,value:c.value,checked:o===c.value,onChange:()=>u(c.value),disabled:i}),d.jsx("label",{htmlFor:m,children:c.label})]},m)})})]})};function LC({className:e="",userId:t,userName:n,src:r,setUserImage:a,uploadImage:i}){const[s,o]=C.useState(!1),[l,u]=C.useState(!1),c=C.useRef(null),m=async h=>{o(!0),u(!1);try{const p=h.target.files&&h.target.files[0];if(!p||!t)throw o(!1),new Error("Image file or userID is missing");const g=await i({fileObject:p,userId:t});a(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(sn,{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:m,hidden:!0,"data-testid":"file-input"}),d.jsx(ke,{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 wf=({gtm:e,functions:{onSuccess:t=async()=>{},onFailure:n=()=>{}}})=>{const{context:r="FooterContactUsForm",event:a="contact-form-submit-click"}=e||{};return d.jsx(nr,{id:"contact-us-form",fields:[{id:"name",type:"text",className:"short",validation:[{condition:"required"}]},{id:"email",type:"email",className:"short",validation:[{condition:"required"},{condition:"valid-email"}]},{id:"organisation",type:"text"},{id:"interests",type:"checkboxes",options:[{id:"publishingCourse",label:"Publishing or creating a course"},{id:"buyingCourse",label:"Buying courses for my team"},{id:"learningExperience",label:"Customised learning experiences"},{id:"somethingElse",label:"Something else"}]},{id:"message",type:"textarea",limit:1e3,validation:[{condition:"required"}]}],intlPath:"contactForm",gtm:{context:r,event:a},functions:{onSuccess:t,onFailure:n}})};const Ef=({title:e,label:t,ctaMessage:n,titleColor:r,labelColor:a,backgroundColor:i,onClose:s,reportError:o,sendInvites:l,initialFormStatus:u="NOT_SUBMITTED"})=>{const[c,m]=C.useState([]),[h,p]=C.useState(!0),[g,f]=C.useState(u),{formatMessage:y}=ue.useIntl(),b=async k=>{k.preventDefault();try{await l(c),m([]),f("SUCCESS")}catch(E){f("ERROR"),o(E)}},w=k=>{k.preventDefault(),f("NOT_SUBMITTED"),p(!0),m([])},A=k=>{k.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(tn,{}),d.jsx("div",{className:"footer",children:g==="SUCCESS"?d.jsxs(d.Fragment,{children:[d.jsx(ke,{variant:"secondary",onClick:w,children:y({id:"inviteForm_ctaSendMoreInvites"})}),d.jsx(ke,{onClick:A,children:y({id:"inviteForm_ctaDone"})})]}):d.jsx(ke,{onClick:w,children:y({id:"inviteForm_ctaTryAgain"})})})]}):d.jsx("div",{className:"invite-form-wrapper",children:d.jsxs("form",{style:{backgroundColor:i},onSubmit:b,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(Ch.ReactMultiEmail,{id:"email-input",inputClassName:"email-input input",placeholder:y({id:"inviteForm_email_placeholder"}),emails:c,onChange:k=>{m(k),p(!k.length)},autoFocus:!1,getLabel:(k,E,T)=>d.jsxs("div",{className:"email text-medium",children:[d.jsx("div",{"data-tag-item":!0,children:k}),d.jsx(ke,{variant:"tertiary",size:"small",icon:{icon:"close"},onClick:()=>{T(E),p(!c.length)},className:"remove-email-button",screenreaderText:y({id:"overlay_close"})})]},E)})]}),d.jsx(tn,{}),d.jsx("fieldset",{className:"footer",children:d.jsx(ke,{className:"sendEmailsButton",disabled:h,children:n})})]})})},ma=e=>e.map(t=>({condition:t})),yt={FORM_ID:"manage-account-password-change",NEW_PASSWORD:"newPassword",CONFIRMED_PASSWORD:"confirmedPassword",CURRENT_PASSWORD:"oldPassword"},zC=({functions:e,...t})=>{const{formatMessage:n}=ue.useIntl(),[r,a]=C.useState(null),[i,s]=C.useState(!1),[o,l]=C.useState({isMoreThanEightCharacters:!1,includesNumberAndSymbol:!1,includesLowerAndUppercase:!1}),u=p=>p[yt.NEW_PASSWORD]!==p[yt.CONFIRMED_PASSWORD]?n({id:"passwordRules_unmatched_text"}):null,c=p=>!is(p[yt.NEW_PASSWORD]).isValid,m=[{"data-testid":yt.NEW_PASSWORD,id:yt.NEW_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_newPassword_label"}),validation:ma(["required",c]),functions:{onChange:p=>l(is(p).matchingRules),onFocus:()=>s(!0),onBlur:()=>s(!1)}},{"data-testid":yt.CONFIRMED_PASSWORD,id:yt.CONFIRMED_PASSWORD,type:"password",autoComplete:"password",placeholder:"",label:n({id:"passwordRules_confirmPassword_label"}),validation:ma(["required",u])}];t.isPasswordChange&&m.unshift({"data-testid":yt.CURRENT_PASSWORD,id:yt.CURRENT_PASSWORD,type:"password",placeholder:"",label:n({id:"passwordRules_currentPassword_label"}),validation:ma(["required"])}),i&&m.push({component:Qc,props:{matchingRules:o}});const h={id:yt.FORM_ID,fields:m,functions:{...e,onSuccess:async p=>(e.createPassword(p),e.onSuccess&&e.onSuccess(p)),onCatch:p=>a(p==null?void 0:p.statusCode),onFailure:(p,g)=>{(g.includes(yt.NEW_PASSWORD)||g.includes(yt.CONFIRMED_PASSWORD))&&s(!0)}},meta:{shouldReset:!0},...t};return d.jsxs(d.Fragment,{children:[d.jsx(nr,{...h}),r&&d.jsx(an,{variant:"error",text:r})]})};const kf=({id:e="search",className:t="",handleToggle:n=!1,defaultValue:r="",gtmContext:a="search-bar",gtmEvent:i="form-submission"})=>{const{searchIsOpen:s=!0,isDesktopVersion:o=!1}=n||{},l=ue.useIntl(),u=C.useRef(null);Un(()=>{!n||o||!s||u.current&&u.current.focus()},[s]);const c=m=>{m.preventDefault(),m.stopPropagation(),!(!u.current||!u.current.value||u.current.value.length<1)&&(window.location.href=`/search?search=${encodeURIComponent(u.current.value)}`)};return 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:m=>{m.key==="Enter"&&c(m)}}),d.jsx("button",{className:"clear",onClick:m=>{m.preventDefault(),m.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"})})})]})})})},Wl=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}])},qC=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"]}},WC=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=qC(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}])},HC=({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,m=(p,g)=>{p.current&&s.validFields[g]!==p.current.validity.valid&&o([{type:`validFields.${g}`,value:p.current.validity.valid}])},h=[{id:"full_name",type:"text",inputRef:i.name,placeholder:u.formatMessage({id:"signup_full_name_placeholder"}),functions:{onChange:()=>m(i.name,"name"),onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"name",validation:[{condition:"required"},{condition:"no-numbers"}],"data-testid":"signup-name-input"},{id:"email_address",type:"email",inputRef:i.email,placeholder:u.formatMessage({id:"signup_email_address_placeholder"}),functions:{onBlur:()=>{Wl({ref:i.email,validateEmail:r,dispatch:o})},onChange:(p,g)=>{o([{type:"shouldDisableButton",value:!0}]),g&&g({type:"updateValue",payload:{key:"terms",value:!1}})},onFocus:()=>o([{type:"loadRecaptcha",value:!0}])},autoComplete:"email",validation:[{condition:"required"},{condition:"valid-email"}],"data-testid":"signup-email-input"},{component:Vc,props:{email:c.email,type:c.boxType,resendVerificationCode:a}}];return s.shouldManuallyApprove&&(h.push({id:"job_title",type:"text",inputRef:i.jobTitle,placeholder:u.formatMessage({id:"signup_job_title_placeholder"}),functions:{onChange:()=>m(i.jobTitle,"jobTitle")},validation:[{condition:"required"}],"data-testid":"signup-job-input"},{id:"organization",type:"text",inputRef:i.organisation,placeholder:u.formatMessage({id:"signup_organization_placeholder"}),functions:{onChange:()=>{m(i.organisation,"organisation")}},validation:[{condition:"required"}],"data-testid":"signup-org-input"}),e.url&&h.push({id:"url",type:"text",label:u.formatMessage({id:"signup_url"},{small:p=>d.jsx("small",{children:p})}),placeholder:u.formatMessage({id:"signup_url_placeholder"}),validation:[{condition:"valid-url"}],"data-testid":"signup-url-input"})),e.expectation&&h.push({id:"expectation",className:"expectation",type:"text",label:(n==null?void 0:n.expectation)||u.formatMessage({id:"signup_expectation"},{small:p=>d.jsx("small",{className:"notes text-small",children:p})}),placeholder:(t==null?void 0:t.expectation)||u.formatMessage({id:"signup_expectation_placeholder"}),"data-testid":"signup-events-question"}),h.push({id:"terms",className:"text-small",type:"checkbox",inputRef:i.tc,label:u.formatMessage({id:"signup_terms"},{terms:p=>d.jsx("a",{href:"https://about.apolitical.co/terms-and-conditions","data-gtm-event-context":"SignupForm","data-gtm-event-type":"terms-of-service-click",className:"gtm-trackable",children:p}),privacy:p=>d.jsx("a",{href:"https://about.apolitical.co/privacy-policy","data-gtm-event-context":"SignupForm","data-gtm-event-type":"privacy-policy-click",className:"gtm-trackable",children:p})}),shownValue:"accepted",functions:{onChange:p=>{if(!p)return;const g=[];["name","email"].forEach(f=>{s.validFields[f]!==i[f].current.validity.valid&&(g.push({type:`validFields.${f}`,value:i[f].current.validity.valid}),f==="email"&&Wl({ref:i.email,validateEmail:r,dispatch:o}))}),g.length&&o(g)}},validation:[{condition:"required"}],"data-testid":"signup-terms-checkbox"}),h};const UC=({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 VC={validFields:{name:!1,email:!1,jobTitle:!1,organisation:!1},emailDetails:{email:"",boxType:"",isEnd2End:!1},shouldManuallyApprove:!1,shouldDisableButton:!0,loadRecaptcha:!1,showSuccessMessage:!1,showError:!1},KC=({className:e="",labels:t={},placeholders:n={},functions:r={validateEmail:()=>Promise.resolve(),createAccount:()=>Promise.resolve(),handleError:()=>{},resendVerificationCode:()=>{}},shouldShow:a={},submitButton:i,dataToSubmit:s={ref:"sign-up-form"},...o})=>{const l=ue.useIntl(),{title:u=!0,expectation:c=!1,url:m=!0,logInButton:h=!0,successMessage:p=!0}=a,g={title:u,expectation:c,url:m,logInButton:h,successMessage:p},[f,y]=C.useReducer(jr,VC),{validFields:b,emailDetails:w,shouldManuallyApprove:A,shouldDisableButton:k,showSuccessMessage:E,showError:T}=f,[j,z]=Ps.useCookies(["signup-this-session","functional-cookie-consent"]),R={form:C.createRef(),name:C.createRef(),email:C.createRef(),jobTitle:C.createRef(),organisation:C.createRef(),tc:C.createRef(),hiddenValidation:C.createRef()};C.useEffect(()=>{A===!0&&R.jobTitle.current&&R.jobTitle.current.focus()},[A]),C.useEffect(()=>{j["signup-this-session"]&&y([{type:"showSuccessMessage",value:!0}])},[j]),C.useEffect(()=>{E&&j["functional-cookie-consent"]&&z("signup-this-session","true",{path:"/",maxAge:3600})},[E]);const $=C.useMemo(()=>HC({placeholders:n,labels:t,shouldShow:g,functions:r,refs:R,state:f,dispatch:y,dataToSubmit:s,intl:l}),[s,r,l,R,g,f]),M=k?!0:A?!Object.values(b).every(x=>x===!0):!b.name||!b.email||["exists","pending","verify"].includes(w.boxType);return g.successMessage&&E?d.jsx(UC,{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(an,{variant:"error",text:l.formatMessage({id:"signup_error"})}),d.jsx(nr,{className:"signup-form",formRef:R.form,id:"sign-up-form",fields:$,intlPath:"signup",button:{variant:"primary",size:"medium",text:i||l.formatMessage({id:"signup_button_join"}),disabled:M?{isClickable:!0}:!1,styling:{fullWidth:!0},"data-testid":"signup-button"},secondaryActionButton:{className:"login-button",styling:{fullWidth:!0},variant:"tertiary",size:"medium",href:"/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 WC({refs:R,dataToSubmit:s,createAccount:r.createAccount,onSuccess:r.onSuccess,dispatch:y,state:f})},onCatch:x=>{r.handleError(x),y([{type:"showSuccessMessage",value:!1},{type:"showError",value:!0}])}}}),d.jsx("button",{className:"validation-button",ref:R.hiddenValidation})]})};var Ss={exports:{}},Qr={exports:{}},Se={};/** @license React v16.13.1
|
|
133
133
|
* react-is.production.min.js
|
|
134
134
|
*
|
|
135
135
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
136
136
|
*
|
|
137
137
|
* This source code is licensed under the MIT license found in the
|
|
138
138
|
* LICENSE file in the root directory of this source tree.
|
|
139
|
-
*/var
|
|
139
|
+
*/var Hl;function ZC(){if(Hl)return Se;Hl=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,m=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,p=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,b=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function A(E){if(typeof E=="object"&&E!==null){var T=E.$$typeof;switch(T){case t:switch(E=E.type,E){case l:case u:case r:case i:case a:case m:return E;default:switch(E=E&&E.$$typeof,E){case o:case c:case g:case p:case s:return E;default:return T}}case n:return T}}}function k(E){return A(E)===u}return Se.AsyncMode=l,Se.ConcurrentMode=u,Se.ContextConsumer=o,Se.ContextProvider=s,Se.Element=t,Se.ForwardRef=c,Se.Fragment=r,Se.Lazy=g,Se.Memo=p,Se.Portal=n,Se.Profiler=i,Se.StrictMode=a,Se.Suspense=m,Se.isAsyncMode=function(E){return k(E)||A(E)===l},Se.isConcurrentMode=k,Se.isContextConsumer=function(E){return A(E)===o},Se.isContextProvider=function(E){return A(E)===s},Se.isElement=function(E){return typeof E=="object"&&E!==null&&E.$$typeof===t},Se.isForwardRef=function(E){return A(E)===c},Se.isFragment=function(E){return A(E)===r},Se.isLazy=function(E){return A(E)===g},Se.isMemo=function(E){return A(E)===p},Se.isPortal=function(E){return A(E)===n},Se.isProfiler=function(E){return A(E)===i},Se.isStrictMode=function(E){return A(E)===a},Se.isSuspense=function(E){return A(E)===m},Se.isValidElementType=function(E){return typeof E=="string"||typeof E=="function"||E===r||E===u||E===i||E===a||E===m||E===h||typeof E=="object"&&E!==null&&(E.$$typeof===g||E.$$typeof===p||E.$$typeof===s||E.$$typeof===o||E.$$typeof===c||E.$$typeof===y||E.$$typeof===b||E.$$typeof===w||E.$$typeof===f)},Se.typeOf=A,Se}var je={};/** @license React v16.13.1
|
|
140
140
|
* react-is.development.js
|
|
141
141
|
*
|
|
142
142
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
143
143
|
*
|
|
144
144
|
* This source code is licensed under the MIT license found in the
|
|
145
145
|
* LICENSE file in the root directory of this source tree.
|
|
146
|
-
*/var
|
|
146
|
+
*/var Ul;function YC(){return Ul||(Ul=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,m=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,p=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,b=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function A(G){return typeof G=="string"||typeof G=="function"||G===r||G===u||G===i||G===a||G===m||G===h||typeof G=="object"&&G!==null&&(G.$$typeof===g||G.$$typeof===p||G.$$typeof===s||G.$$typeof===o||G.$$typeof===c||G.$$typeof===y||G.$$typeof===b||G.$$typeof===w||G.$$typeof===f)}function k(G){if(typeof G=="object"&&G!==null){var he=G.$$typeof;switch(he){case t:var ge=G.type;switch(ge){case l:case u:case r:case i:case a:case m:return ge;default:var Ee=ge&&ge.$$typeof;switch(Ee){case o:case c:case g:case p:case s:return Ee;default:return he}}case n:return he}}}var E=l,T=u,j=o,z=s,R=t,$=c,M=r,x=g,B=p,F=n,N=i,L=a,q=m,oe=!1;function ne(G){return oe||(oe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),D(G)||k(G)===l}function D(G){return k(G)===u}function H(G){return k(G)===o}function X(G){return k(G)===s}function _(G){return typeof G=="object"&&G!==null&&G.$$typeof===t}function S(G){return k(G)===c}function W(G){return k(G)===r}function I(G){return k(G)===g}function V(G){return k(G)===p}function te(G){return k(G)===n}function ee(G){return k(G)===i}function ae(G){return k(G)===a}function fe(G){return k(G)===m}je.AsyncMode=E,je.ConcurrentMode=T,je.ContextConsumer=j,je.ContextProvider=z,je.Element=R,je.ForwardRef=$,je.Fragment=M,je.Lazy=x,je.Memo=B,je.Portal=F,je.Profiler=N,je.StrictMode=L,je.Suspense=q,je.isAsyncMode=ne,je.isConcurrentMode=D,je.isContextConsumer=H,je.isContextProvider=X,je.isElement=_,je.isForwardRef=S,je.isFragment=W,je.isLazy=I,je.isMemo=V,je.isPortal=te,je.isProfiler=ee,je.isStrictMode=ae,je.isSuspense=fe,je.isValidElementType=A,je.typeOf=k}()),je}var Vl;function _f(){return Vl||(Vl=1,process.env.NODE_ENV==="production"?Qr.exports=ZC():Qr.exports=YC()),Qr.exports}/*
|
|
147
147
|
object-assign
|
|
148
148
|
(c) Sindre Sorhus
|
|
149
149
|
@license MIT
|
|
150
|
-
*/var
|
|
151
|
-
Valid keys: `+JSON.stringify(Object.keys(D),null," "));var
|
|
150
|
+
*/var Pi,Kl;function GC(){if(Kl)return Pi;Kl=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 Pi=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 m in o)t.call(o,m)&&(l[m]=o[m]);if(e){u=e(o);for(var h=0;h<u.length;h++)n.call(o,u[h])&&(l[u[h]]=o[u[h]])}}return l},Pi}var Ni,Zl;function go(){if(Zl)return Ni;Zl=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ni=e,Ni}var Ri,Yl;function Bf(){return Yl||(Yl=1,Ri=Function.call.bind(Object.prototype.hasOwnProperty)),Ri}var Mi,Gl;function QC(){if(Gl)return Mi;Gl=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=go(),n={},r=Bf();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 m;try{if(typeof i[c]!="function"){var h=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 h.name="Invariant Violation",h}m=i[c](s,c,l,o,null,t)}catch(g){m=g}if(m&&!(m 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 m+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),m instanceof Error&&!(m.message in n)){n[m.message]=!0;var p=u?u():"";e("Failed "+o+" type: "+m.message+(p??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Mi=a,Mi}var Ii,Ql;function JC(){if(Ql)return Ii;Ql=1;var e=_f(),t=GC(),n=go(),r=Bf(),a=QC(),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 Ii=function(o,l){var u=typeof Symbol=="function"&&Symbol.iterator,c="@@iterator";function m(D){var H=D&&(u&&D[u]||D[c]);if(typeof H=="function")return H}var h="<<anonymous>>",p={array:b("array"),bigint:b("bigint"),bool:b("boolean"),func:b("function"),number:b("number"),object:b("object"),string:b("string"),symbol:b("symbol"),any:w(),arrayOf:A,element:k(),elementType:E(),instanceOf:T,node:$(),objectOf:z,oneOf:j,oneOfType:R,shape:x,exact:B};function g(D,H){return D===H?D!==0||1/D===1/H:D!==D&&H!==H}function f(D,H){this.message=D,this.data=H&&typeof H=="object"?H:{},this.stack=""}f.prototype=Error.prototype;function y(D){if(process.env.NODE_ENV!=="production")var H={},X=0;function _(W,I,V,te,ee,ae,fe){if(te=te||h,ae=ae||V,fe!==n){if(l){var G=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 G.name="Invariant Violation",G}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var he=te+":"+V;!H[he]&&X<3&&(i("You are manually calling a React.PropTypes validation function for the `"+ae+"` prop on `"+te+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),H[he]=!0,X++)}}return I[V]==null?W?I[V]===null?new f("The "+ee+" `"+ae+"` is marked as required "+("in `"+te+"`, but its value is `null`.")):new f("The "+ee+" `"+ae+"` is marked as required in "+("`"+te+"`, but its value is `undefined`.")):null:D(I,V,te,ee,ae)}var S=_.bind(null,!1);return S.isRequired=_.bind(null,!0),S}function b(D){function H(X,_,S,W,I,V){var te=X[_],ee=L(te);if(ee!==D){var ae=q(te);return new f("Invalid "+W+" `"+I+"` of type "+("`"+ae+"` supplied to `"+S+"`, expected ")+("`"+D+"`."),{expectedType:D})}return null}return y(H)}function w(){return y(s)}function A(D){function H(X,_,S,W,I){if(typeof D!="function")return new f("Property `"+I+"` of component `"+S+"` has invalid PropType notation inside arrayOf.");var V=X[_];if(!Array.isArray(V)){var te=L(V);return new f("Invalid "+W+" `"+I+"` of type "+("`"+te+"` supplied to `"+S+"`, expected an array."))}for(var ee=0;ee<V.length;ee++){var ae=D(V,ee,S,W,I+"["+ee+"]",n);if(ae instanceof Error)return ae}return null}return y(H)}function k(){function D(H,X,_,S,W){var I=H[X];if(!o(I)){var V=L(I);return new f("Invalid "+S+" `"+W+"` of type "+("`"+V+"` supplied to `"+_+"`, expected a single ReactElement."))}return null}return y(D)}function E(){function D(H,X,_,S,W){var I=H[X];if(!e.isValidElementType(I)){var V=L(I);return new f("Invalid "+S+" `"+W+"` of type "+("`"+V+"` supplied to `"+_+"`, expected a single ReactElement type."))}return null}return y(D)}function T(D){function H(X,_,S,W,I){if(!(X[_]instanceof D)){var V=D.name||h,te=ne(X[_]);return new f("Invalid "+W+" `"+I+"` of type "+("`"+te+"` supplied to `"+S+"`, expected ")+("instance of `"+V+"`."))}return null}return y(H)}function j(D){if(!Array.isArray(D))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function H(X,_,S,W,I){for(var V=X[_],te=0;te<D.length;te++)if(g(V,D[te]))return null;var ee=JSON.stringify(D,function(fe,G){var he=q(G);return he==="symbol"?String(G):G});return new f("Invalid "+W+" `"+I+"` of value `"+String(V)+"` "+("supplied to `"+S+"`, expected one of "+ee+"."))}return y(H)}function z(D){function H(X,_,S,W,I){if(typeof D!="function")return new f("Property `"+I+"` of component `"+S+"` has invalid PropType notation inside objectOf.");var V=X[_],te=L(V);if(te!=="object")return new f("Invalid "+W+" `"+I+"` of type "+("`"+te+"` supplied to `"+S+"`, expected an object."));for(var ee in V)if(r(V,ee)){var ae=D(V,ee,S,W,I+"."+ee,n);if(ae instanceof Error)return ae}return null}return y(H)}function R(D){if(!Array.isArray(D))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var H=0;H<D.length;H++){var X=D[H];if(typeof X!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+oe(X)+" at index "+H+"."),s}function _(S,W,I,V,te){for(var ee=[],ae=0;ae<D.length;ae++){var fe=D[ae],G=fe(S,W,I,V,te,n);if(G==null)return null;G.data&&r(G.data,"expectedType")&&ee.push(G.data.expectedType)}var he=ee.length>0?", expected one of type ["+ee.join(", ")+"]":"";return new f("Invalid "+V+" `"+te+"` supplied to "+("`"+I+"`"+he+"."))}return y(_)}function $(){function D(H,X,_,S,W){return F(H[X])?null:new f("Invalid "+S+" `"+W+"` supplied to "+("`"+_+"`, expected a ReactNode."))}return y(D)}function M(D,H,X,_,S){return new f((D||"React class")+": "+H+" type `"+X+"."+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+S+"`.")}function x(D){function H(X,_,S,W,I){var V=X[_],te=L(V);if(te!=="object")return new f("Invalid "+W+" `"+I+"` of type `"+te+"` "+("supplied to `"+S+"`, expected `object`."));for(var ee in D){var ae=D[ee];if(typeof ae!="function")return M(S,W,I,ee,q(ae));var fe=ae(V,ee,S,W,I+"."+ee,n);if(fe)return fe}return null}return y(H)}function B(D){function H(X,_,S,W,I){var V=X[_],te=L(V);if(te!=="object")return new f("Invalid "+W+" `"+I+"` of type `"+te+"` "+("supplied to `"+S+"`, expected `object`."));var ee=t({},X[_],D);for(var ae in ee){var fe=D[ae];if(r(D,ae)&&typeof fe!="function")return M(S,W,I,ae,q(fe));if(!fe)return new f("Invalid "+W+" `"+I+"` key `"+ae+"` supplied to `"+S+"`.\nBad object: "+JSON.stringify(X[_],null," ")+`
|
|
151
|
+
Valid keys: `+JSON.stringify(Object.keys(D),null," "));var G=fe(V,ae,S,W,I+"."+ae,n);if(G)return G}return null}return y(H)}function F(D){switch(typeof D){case"number":case"string":case"undefined":return!0;case"boolean":return!D;case"object":if(Array.isArray(D))return D.every(F);if(D===null||o(D))return!0;var H=m(D);if(H){var X=H.call(D),_;if(H!==D.entries){for(;!(_=X.next()).done;)if(!F(_.value))return!1}else for(;!(_=X.next()).done;){var S=_.value;if(S&&!F(S[1]))return!1}}else return!1;return!0;default:return!1}}function N(D,H){return D==="symbol"?!0:H?H["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&H instanceof Symbol:!1}function L(D){var H=typeof D;return Array.isArray(D)?"array":D instanceof RegExp?"object":N(H,D)?"symbol":H}function q(D){if(typeof D>"u"||D===null)return""+D;var H=L(D);if(H==="object"){if(D instanceof Date)return"date";if(D instanceof RegExp)return"regexp"}return H}function oe(D){var H=q(D);switch(H){case"array":case"object":return"an "+H;case"boolean":case"date":case"regexp":return"a "+H;default:return H}}function ne(D){return!D.constructor||!D.constructor.name?h:D.constructor.name}return p.checkPropTypes=a,p.resetWarningCache=a.resetWarningCache,p.PropTypes=p,p},Ii}var $i,Jl;function XC(){if(Jl)return $i;Jl=1;var e=go();function t(){}function n(){}return n.resetWarningCache=t,$i=function(){function r(s,o,l,u,c,m){if(m!==e){var h=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 h.name="Invariant Violation",h}}r.isRequired=r;function a(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:a,element:r,elementType:r,instanceOf:a,node:r,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},$i}if(process.env.NODE_ENV!=="production"){var ex=_f(),tx=!0;Ss.exports=JC()(ex.isElement,tx)}else Ss.exports=XC()();var nx=Ss.exports;/*!
|
|
152
152
|
* tabbable 6.2.0
|
|
153
153
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
154
|
-
*/var
|
|
154
|
+
*/var Af=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Ba=Af.join(","),Ff=typeof Element>"u",xn=Ff?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Aa=!Ff&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},Fa=function e(t,n){var r;n===void 0&&(n=!0);var a=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=a===""||a==="true",s=i||n&&t&&e(t.parentNode);return s},rx=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},Tf=function(t,n,r){if(Fa(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(Ba));return n&&xn.call(t,Ba)&&a.unshift(t),a=a.filter(r),a},Sf=function e(t,n,r){for(var a=[],i=Array.from(t);i.length;){var s=i.shift();if(!Fa(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),l=o.length?o:s.children,u=e(l,!0,r);r.flatten?a.push.apply(a,u):a.push({scopeParent:s,candidates:u})}else{var c=xn.call(s,Ba);c&&r.filter(s)&&(n||!t.includes(s))&&a.push(s);var m=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),h=!Fa(m,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(m&&h){var p=e(m===!0?s.children:m.children,!0,r);r.flatten?a.push.apply(a,p):a.push({scopeParent:s,candidates:p})}else i.unshift.apply(i,s.children)}}return a},jf=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Jt=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||rx(t))&&!jf(t)?0:t.tabIndex},ax=function(t,n){var r=Jt(t);return r<0&&n&&!jf(t)?0:r},ix=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Of=function(t){return t.tagName==="INPUT"},sx=function(t){return Of(t)&&t.type==="hidden"},ox=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},ux=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},lx=function(t){if(!t.name)return!0;var n=t.form||Aa(t),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},a;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")a=r(window.CSS.escape(t.name));else try{a=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=ux(a,t.form);return!i||i===t},cx=function(t){return Of(t)&&t.type==="radio"},dx=function(t){return cx(t)&&!lx(t)},fx=function(t){var n,r=t&&Aa(t),a=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,o,l;for(i=!!((s=a)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(a)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&a;){var u,c,m;r=Aa(a),a=(u=r)===null||u===void 0?void 0:u.host,i=!!((c=a)!==null&&c!==void 0&&(m=c.ownerDocument)!==null&&m!==void 0&&m.contains(a))}}return i},Xl=function(t){var n=t.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},hx=function(t,n){var r=n.displayCheck,a=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=xn.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(xn.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof a=="function"){for(var o=t;t;){var l=t.parentElement,u=Aa(t);if(l&&!l.shadowRoot&&a(l)===!0)return Xl(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=o}if(fx(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Xl(t);return!1},mx=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 xn.call(n,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}n=n.parentElement}return!1},Ta=function(t,n){return!(n.disabled||Fa(n)||sx(n)||hx(n,t)||ox(n)||mx(n))},js=function(t,n){return!(dx(n)||Jt(n)<0||!Ta(t,n))},px=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},gx=function e(t){var n=[],r=[];return t.forEach(function(a,i){var s=!!a.scopeParent,o=s?a.scopeParent:a,l=ax(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(ix).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(n)},Pf=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Sf([t],n.includeContainer,{filter:js.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:px}):r=Tf(t,n.includeContainer,js.bind(null,n)),gx(r)},Nf=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Sf([t],n.includeContainer,{filter:Ta.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Tf(t,n.includeContainer,Ta.bind(null,n)),r},dn=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return xn.call(t,Ba)===!1?!1:js(n,t)},vx=Af.concat("iframe").join(","),pa=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return xn.call(t,vx)===!1?!1:Ta(n,t)};const bx=Object.freeze(Object.defineProperty({__proto__:null,focusable:Nf,getTabIndex:Jt,isFocusable:pa,isTabbable:dn,tabbable:Pf},Symbol.toStringTag,{value:"Module"}));/*!
|
|
155
155
|
* focus-trap 7.5.4
|
|
156
156
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
157
|
-
*/function Yl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Gl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Yl(Object(n),!0).forEach(function(r){sx(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yl(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function sx(e,t,n){return t=ux(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ox(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 ux(e){var t=ox(e,"string");return typeof t=="symbol"?t:String(t)}var Ql={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()}},lx=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},cx=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},Dr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},dx=function(t){return Dr(t)&&!t.shiftKey},fx=function(t){return Dr(t)&&t.shiftKey},Jl=function(t){return setTimeout(t,0)},Xl=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},ur=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return typeof t=="function"?t.apply(void 0,r):t},Jr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},hx=[],mx=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||hx,i=Gl({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:dx,isKeyBackward:fx},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(x,_,j){return x&&x[_]!==void 0?x[_]:i[j||_]},u=function(x,_){var j=typeof(_==null?void 0:_.composedPath)=="function"?_.composedPath():void 0;return s.containerGroups.findIndex(function(R){var q=R.container,V=R.tabbableNodes;return q.contains(x)||(j==null?void 0:j.includes(q))||V.find(function(ue){return ue===x})})},c=function(x){var _=i[x];if(typeof _=="function"){for(var j=arguments.length,R=new Array(j>1?j-1:0),q=1;q<j;q++)R[q-1]=arguments[q];_=_.apply(void 0,R)}if(_===!0&&(_=void 0),!_){if(_===void 0||_===!1)return _;throw new Error("`".concat(x,"` was specified but was not a node, or did not return a node"))}var V=_;if(typeof _=="string"&&(V=r.querySelector(_),!V))throw new Error("`".concat(x,"` as selector refers to no known node"));return V},f=function(){var x=c("initialFocus");if(x===!1)return!1;if(x===void 0||!pa(x,i.tabbableOptions))if(u(r.activeElement)>=0)x=r.activeElement;else{var _=s.tabbableGroups[0],j=_&&_.firstTabbableNode;x=j||c("fallbackFocus")}if(!x)throw new Error("Your focus-trap needs to have at least one focusable element");return x},m=function(){if(s.containerGroups=s.containers.map(function(x){var _=wf(x,i.tabbableOptions),j=Ef(x,i.tabbableOptions),R=_.length>0?_[0]:void 0,q=_.length>0?_[_.length-1]:void 0,V=j.find(function(D){return cn(D)}),ue=j.slice().reverse().find(function(D){return cn(D)}),ne=!!_.find(function(D){return Qt(D)>0});return{container:x,tabbableNodes:_,focusableNodes:j,posTabIndexesFound:ne,firstTabbableNode:R,lastTabbableNode:q,firstDomTabbableNode:V,lastDomTabbableNode:ue,nextTabbableNode:function(W){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,B=_.indexOf(W);return B<0?X?j.slice(j.indexOf(W)+1).find(function(T){return cn(T)}):j.slice(0,j.indexOf(W)).reverse().find(function(T){return cn(T)}):_[B+(X?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(x){return x.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(x){return x.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function M(x){var _=x.activeElement;if(_)return _.shadowRoot&&_.shadowRoot.activeElement!==null?M(_.shadowRoot):_},g=function M(x){if(x!==!1&&x!==p(document)){if(!x||!x.focus){M(f());return}x.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=x,lx(x)&&x.select()}},h=function(x){var _=c("setReturnFocus",x);return _||(_===!1?!1:x)},y=function(x){var _=x.target,j=x.event,R=x.isBackward,q=R===void 0?!1:R;_=_||Jr(j),m();var V=null;if(s.tabbableGroups.length>0){var ue=u(_,j),ne=ue>=0?s.containerGroups[ue]:void 0;if(ue<0)q?V=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:V=s.tabbableGroups[0].firstTabbableNode;else if(q){var D=Xl(s.tabbableGroups,function($){var K=$.firstTabbableNode;return _===K});if(D<0&&(ne.container===_||pa(_,i.tabbableOptions)&&!cn(_,i.tabbableOptions)&&!ne.nextTabbableNode(_,!1))&&(D=ue),D>=0){var W=D===0?s.tabbableGroups.length-1:D-1,X=s.tabbableGroups[W];V=Qt(_)>=0?X.lastTabbableNode:X.lastDomTabbableNode}else Dr(j)||(V=ne.nextTabbableNode(_,!1))}else{var B=Xl(s.tabbableGroups,function($){var K=$.lastTabbableNode;return _===K});if(B<0&&(ne.container===_||pa(_,i.tabbableOptions)&&!cn(_,i.tabbableOptions)&&!ne.nextTabbableNode(_))&&(B=ue),B>=0){var T=B===s.tabbableGroups.length-1?0:B+1,z=s.tabbableGroups[T];V=Qt(_)>=0?z.firstTabbableNode:z.firstDomTabbableNode}else Dr(j)||(V=ne.nextTabbableNode(_))}}else V=c("fallbackFocus");return V},v=function(x){var _=Jr(x);if(!(u(_,x)>=0)){if(ur(i.clickOutsideDeactivates,x)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}ur(i.allowOutsideClick,x)||x.preventDefault()}},w=function(x){var _=Jr(x),j=u(_,x)>=0;if(j||_ instanceof Document)j&&(s.mostRecentlyFocusedNode=_);else{x.stopImmediatePropagation();var R,q=!0;if(s.mostRecentlyFocusedNode)if(Qt(s.mostRecentlyFocusedNode)>0){var V=u(s.mostRecentlyFocusedNode),ue=s.containerGroups[V].tabbableNodes;if(ue.length>0){var ne=ue.findIndex(function(D){return D===s.mostRecentlyFocusedNode});ne>=0&&(i.isKeyForward(s.recentNavEvent)?ne+1<ue.length&&(R=ue[ne+1],q=!1):ne-1>=0&&(R=ue[ne-1],q=!1))}}else s.containerGroups.some(function(D){return D.tabbableNodes.some(function(W){return Qt(W)>0})})||(q=!1);else q=!1;q&&(R=y({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(R||s.mostRecentlyFocusedNode||f())}s.recentNavEvent=void 0},A=function(x){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=x;var j=y({event:x,isBackward:_});j&&(Dr(x)&&x.preventDefault(),g(j))},E=function(x){if(cx(x)&&ur(i.escapeDeactivates,x)!==!1){x.preventDefault(),o.deactivate();return}(i.isKeyForward(x)||i.isKeyBackward(x))&&A(x,i.isKeyBackward(x))},k=function(x){var _=Jr(x);u(_,x)>=0||ur(i.clickOutsideDeactivates,x)||ur(i.allowOutsideClick,x)||(x.preventDefault(),x.stopImmediatePropagation())},F=function(){if(s.active)return Ql.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?Jl(function(){g(f())}):g(f()),r.addEventListener("focusin",w,!0),r.addEventListener("mousedown",v,{capture:!0,passive:!1}),r.addEventListener("touchstart",v,{capture:!0,passive:!1}),r.addEventListener("click",k,{capture:!0,passive:!1}),r.addEventListener("keydown",E,{capture:!0,passive:!1}),o},S=function(){if(s.active)return r.removeEventListener("focusin",w,!0),r.removeEventListener("mousedown",v,!0),r.removeEventListener("touchstart",v,!0),r.removeEventListener("click",k,!0),r.removeEventListener("keydown",E,!0),o},L=function(x){var _=x.some(function(j){var R=Array.from(j.removedNodes);return R.some(function(q){return q===s.mostRecentlyFocusedNode})});_&&g(f())},I=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(L):void 0,N=function(){I&&(I.disconnect(),s.active&&!s.paused&&s.containers.map(function(x){I.observe(x,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(x){if(s.active)return this;var _=l(x,"onActivate"),j=l(x,"onPostActivate"),R=l(x,"checkCanFocusTrap");R||m(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,_==null||_();var q=function(){R&&m(),F(),N(),j==null||j()};return R?(R(s.containers.concat()).then(q,q),this):(q(),this)},deactivate:function(x){if(!s.active)return this;var _=Gl({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},x);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,S(),s.active=!1,s.paused=!1,N(),Ql.deactivateTrap(a,o);var j=l(_,"onDeactivate"),R=l(_,"onPostDeactivate"),q=l(_,"checkCanReturnFocus"),V=l(_,"returnFocus","returnFocusOnDeactivate");j==null||j();var ue=function(){Jl(function(){V&&g(h(s.nodeFocusedBeforeActivation)),R==null||R()})};return V&&q?(q(h(s.nodeFocusedBeforeActivation)).then(ue,ue),this):(ue(),this)},pause:function(x){if(s.paused||!s.active)return this;var _=l(x,"onPause"),j=l(x,"onPostPause");return s.paused=!0,_==null||_(),S(),N(),j==null||j(),this},unpause:function(x){if(!s.paused||!s.active)return this;var _=l(x,"onUnpause"),j=l(x,"onPostUnpause");return s.paused=!1,_==null||_(),m(),F(),N(),j==null||j(),this},updateContainerElements:function(x){var _=[].concat(x).filter(Boolean);return s.containers=_.map(function(j){return typeof j=="string"?r.querySelector(j):j}),s.active&&m(),N(),this}},o.updateContainerElements(t),o};const px=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:mx},Symbol.toStringTag,{value:"Module"})),gx=mc(px),vx=mc(ix);function Yn(e){"@babel/helpers - typeof";return Yn=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},Yn(e)}function bx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ec(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,kf(r.key),r)}}function yx(e,t,n){return t&&ec(e.prototype,t),n&&ec(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Dx(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&&Fs(e,t)}function Fs(e,t){return Fs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Fs(e,t)}function Cx(e){var t=wx();return function(){var r=Sa(e),a;if(t){var i=Sa(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return xx(this,a)}}function xx(e,t){if(t&&(Yn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hr(e)}function hr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function wx(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Sa(e){return Sa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Sa(e)}function Ex(e,t,n){return t=kf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kf(e){var t=kx(e,"string");return Yn(t)==="symbol"?t:String(t)}function kx(e,t){if(Yn(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Yn(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Xr=C,ve=WC,_x=gx,Bx=_x.createFocusTrap,Ax=vx,Fx=Ax.isFocusable,fo=function(e){Dx(n,e);var t=Cx(n);function n(r){var a;bx(this,n),a=t.call(this,r),Ex(hr(a),"getNodeForOption",function(o){var l,u=(l=this.internalOptions[o])!==null&&l!==void 0?l:this.originalOptions[o];if(typeof u=="function"){for(var c=arguments.length,f=new Array(c>1?c-1:0),m=1;m<c;m++)f[m-1]=arguments[m];u=u.apply(void 0,f)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var p=u;if(typeof u=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),a.handleDeactivate=a.handleDeactivate.bind(hr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(hr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(hr(a)),a.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:a.handleDeactivate,onPostDeactivate:a.handlePostDeactivate,clickOutsideDeactivates:a.handleClickOutsideDeactivates},a.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var i=r.focusTrapOptions;for(var s in i)if(Object.prototype.hasOwnProperty.call(i,s)){if(s==="returnFocusOnDeactivate"||s==="onDeactivate"||s==="onPostDeactivate"||s==="checkCanReturnFocus"||s==="clickOutsideDeactivates"){a.originalOptions[s]=i[s];continue}a.internalOptions[s]=i[s]}return a.outsideClick=null,a.focusTrapElements=r.containerElements||[],a.updatePreviousElement(),a}return yx(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&&!Fx(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,c=u===void 0?!1:u;l&&o.focus({preventScroll:c}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?Xr.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===Xr.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var c=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=c||[u]},o=Xr.cloneElement(i,{ref:s});return o}return null}}]),n}(Xr.Component),lr=typeof Element>"u"?Function:Element;fo.propTypes={active:ve.bool,paused:ve.bool,focusTrapOptions:ve.shape({document:ve.object,onActivate:ve.func,onPostActivate:ve.func,checkCanFocusTrap:ve.func,onPause:ve.func,onPostPause:ve.func,onUnpause:ve.func,onPostUnpause:ve.func,onDeactivate:ve.func,onPostDeactivate:ve.func,checkCanReturnFocus:ve.func,initialFocus:ve.oneOfType([ve.instanceOf(lr),ve.string,ve.bool,ve.func]),fallbackFocus:ve.oneOfType([ve.instanceOf(lr),ve.string,ve.func]),escapeDeactivates:ve.oneOfType([ve.bool,ve.func]),clickOutsideDeactivates:ve.oneOfType([ve.bool,ve.func]),returnFocusOnDeactivate:ve.bool,setReturnFocus:ve.oneOfType([ve.instanceOf(lr),ve.string,ve.bool,ve.func]),allowOutsideClick:ve.oneOfType([ve.bool,ve.func]),preventScroll:ve.bool,tabbableOptions:ve.shape({displayCheck:ve.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:ve.oneOfType([ve.bool,ve.func])}),trapStack:ve.array,isKeyForward:ve.func,isKeyBackward:ve.func}),containerElements:ve.arrayOf(ve.instanceOf(lr)),children:ve.oneOfType([ve.element,ve.instanceOf(lr)])};fo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:Bx};var Tx=fo;const Sx=xn(Tx),_f=({showDevTools:e=!0,children:t})=>{const n=new Ke.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return d.jsxs(Ke.QueryClientProvider,{client:n,children:[t,e&&d.jsx(lh.ReactQueryDevtools,{initialIsOpen:!1})]})};var jx=C.createContext({client:sa});function Ox(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=C.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(sa.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),sa.init(r,a)),sa)},[n,r]);return C.createElement(jx.Provider,{value:{client:i}},t)}const Bf=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(Ox,{apiKey:atob(process.env.REACT_APP_PUBLIC_POSTHOG_KEY),options:{api_host:"/ph",autocapture:!1,disable_session_recording:!0,persistence_name:"flags",secure_cookie:!0,ui_host:"eu.posthog.com",bootstrap:{distinctID:t.id||"00000000-0000-0000-0000-000000000000",isIdentifiedID:!!t.id}},children:e}):d.jsx(d.Fragment,{children:e}),Af=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Bh[r],...n||{}};return d.jsx(oe.IntlProvider,{locale:r,messages:a,children:e})},ho=C.createContext({}),ga={en:"English",es:"Español",fr:"Français",pt:"Português"},Rt=C.createContext({isLoading:!0});function Ga(){return C.useContext(Rt)}const Ff=({children:e,user:t})=>d.jsx(Rt.Provider,{value:t,children:e}),mo=C.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),Tf=()=>C.useContext(mo),Sf=({children:e})=>{const[t,n]=C.useState([]);C.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=C.useCallback(i=>{n(s=>[...s,i])},[]),a=C.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return d.jsx(mo.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Px=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=C.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=C.useState(s),u=c=>{localStorage.setItem("language",c),l(c)};return C.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),Bc(5e3)}).catch(c=>{c.message===Ec&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(ho.Provider,{value:{language:o,updateLanguage:u},children:d.jsx(Af,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(Ts.CookiesProvider,{children:d.jsx(Ff,{user:a,children:d.jsx(Sf,{children:d.jsx(_f,{showDevTools:r,children:d.jsx(Bf,{user:a,children:t})})})})})})})};const po=({element:e="section",children:t,className:n,...r})=>C.createElement(e,{className:Z("modal",n),children:typeof t=="string"?d.jsx("p",{children:t}):t,...r});const Pr=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:c="",gtmContext:f="Modal"})=>{const m=oe.useIntl(),{registerOverlay:p,unregisterOverlay:g}=Tf(),[h,y]=C.useState(t),v=E=>{E.key==="Escape"&&w(!1)};C.useEffect(()=>(window.addEventListener("keyup",v),()=>{window.removeEventListener("keyup",v)}));const w=E=>{y(E),E?(a(),p(e)):(i(),g(e))};C.useEffect(()=>(w(t),()=>{h&&g(e)}),[t]);const A=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{className:Z("overlay",{open:h}),role:"dialog",children:d.jsx(po,{id:e,className:Z("overlay-modal",c,{"has-max-width":r}),hidden:!h,style:A,children:t&&d.jsx(Sx,{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(Ee,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>w(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":f,screenreaderText:m.formatMessage({id:"overlay_close"})})]}),n&&d.jsx(en,{}),l,u&&d.jsxs("div",{className:"bottom",children:[d.jsx(en,{}),d.jsx(En,{buttons:u})]}),s&&d.jsx(xr,{className:"error",children:s})]})})})})},jf=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Nx=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const c=oe.useIntl();return r||(r=c.formatMessage({id:"inviteModal_formTitle"})),a||(a=c.formatMessage({id:"inviteModal_formLabel"})),i||(i=c.formatMessage({id:"inviteModal_cta"})),d.jsx(Pr,{title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:Z("invite-modal",e,{success:!!n}),children:d.jsx(hf,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const Rx=({members:e})=>{const[t,n]=C.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return d.jsxs(d.Fragment,{children:[d.jsx(an,{name:i,src:l}),d.jsx("p",{children:i}),d.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return d.jsxs("div",{className:"directory-wrapper",children:[d.jsx("ul",{className:"directory",children:e.map(a=>d.jsx("li",{children:d.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),d.jsx(Pr,{isOpen:t!==!1,children:t===!1?"":d.jsxs(d.Fragment,{children:[r(t),d.jsx(Un,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const Mx=({author:e,authorCite:t,content:n,member:r,className:a=""})=>d.jsxs("blockquote",{className:Z("testimonial-block",a),children:[d.jsx(Ot,{className:"testimonial",children:n}),r?d.jsx(jr,{member:r,styling:{size:"large"}}):d.jsxs(d.Fragment,{children:[e&&d.jsx("p",{className:Z("author",{"text-small":!a.includes("new")}),children:e}),t&&d.jsx("p",{className:Z("author-cite",{"text-small":!a.includes("new")}),children:d.jsx("cite",{children:t})})]})]}),Ix=C.memo(Mx);const $x=({items:e=[],selector:t="",className:n=""})=>{const r=oe.useIntl(),[a,i]=C.useState(e);return C.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,c)=>{s+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&d.jsxs(Pt,{variant:"subtle",className:Z("table-of-contents",n),children:[d.jsx("h2",{children:r.formatMessage({id:"tableOfContents"})}),d.jsx("nav",{children:d.jsx("ul",{children:a.map(({id:s,text:o})=>d.jsx("li",{children:d.jsx("a",{href:`#${s}`,children:o})},s))})})]})};const Qa=({time:e,rangeTime:t,prependedText:n,appendedText:r,className:a=""})=>{const i=oe.useIntl(),s="timeToComplete_";if(!e||typeof e!="number")return null;const o=c=>{const f=c/60,m=Math.floor(f),p=(f-m)*60,g=Math.round(p),h=`${i.formatMessage({id:`${s}hours`},{time:m})}${m>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${m>0?`${i.formatMessage({id:`${s}hours_short`},{time:m})} `:""}${g>0?i.formatMessage({id:`${s}minutes_short`},{time:g}):""}`,ariaText:h}};let{text:l,ariaText:u}=o(e);if(t){const{text:c,ariaText:f}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:c}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:f})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),d.jsx("span",{className:Z("time-to-complete",a),"aria-label":u,children:l})};const Lx=({className:e="",image:t,...n})=>t?(typeof t=="string"&&(t={width:1080,height:200,type:"image/png",url:t}),t.range=[{height:124,width:425},{height:200,width:768},{height:200,width:1368}],t.query="fit=thumb&f=center",d.jsx(Xn,{...n,className:Z("banner",e),image:{...t,aspect:"banner"}})):null;const un=({children:e,className:t="",styling:n={},...r})=>{const{background:a="default"}=n;return d.jsx("section",{className:Z("full-width-section",t,{[a]:a!=="default"}),...r,children:e})};const zx=({text:e,buttons:t,className:n=""})=>{const r=[];return t.forEach(a=>{r.push({href:a.link,variant:"secondary",size:{mobile:"medium",1024:"large"},className:"gtm-trackable","data-gtm-event-type":"download-click","data-gtm-event-context":a.eventContext||"Download",target:"_blank",children:a.text})}),d.jsx(un,{className:Z("download-section",n),children:d.jsxs("div",{className:"content-default",children:[C.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),d.jsx(En,{buttons:r})]})})};function Of({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const qx=({icon:e,description:t,ctaMessage:n,href:r,showEditButton:a,setShowModal:i})=>{const{formatMessage:s}=oe.useIntl();return d.jsxs("div",{className:Z("edit-section-placeholder",{"has-icon":!!e}),style:kc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(Ee,{href:r,variant:"secondary",size:"small",onClick:()=>Of({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},Wx=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=C.useState(!1),c=typeof r=="string"||!!n,f=()=>u(!1);return d.jsxs("section",{className:Z("edit-section",t),children:[n&&d.jsx(Pr,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:f},className:Z("edit-section-modal"),children:d.jsx(er,{...n,fields:n.fields,meta:{...n==null?void 0:n.meta,shouldShowCancelButton:!0,shouldReset:!1,showSuccessMessage:!0},functions:{...n==null?void 0:n.functions,onSuccess:async m=>{var p,g;(p=n==null?void 0:n.functions)!=null&&p.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(m)),u(!1)},onCancel:f}})}),d.jsxs("div",{className:"edit-section-header",children:[d.jsx("h2",{className:"edit-section-header-title",children:a}),c&&d.jsx(Ee,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Of({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(qx,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(en,{})]})};const Hx=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return d.jsxs("div",{className:Z("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&C.createElement(s.element,{className:Z("title",s.className)},s.text),t&&d.jsx("p",{children:t}),d.jsx("ul",{className:Z({"two-col":i===2||i===4,"three-col":i===5||i<=10&&i%3===0}),children:n.map(({logo:c,nameOfBusiness:f,link:m=!1,description:p=!1},g)=>{if(!c||!c.url)return null;const h=d.jsx("img",{src:c.url,width:c.width||"auto",height:c.height||"auto",alt:f});return d.jsxs("li",{children:[d.jsx("p",{className:"img-wrapper",children:m?d.jsx("a",{href:m,target:"_blank",rel:"nofollow noreferrer noopener",children:h}):h}),p&&d.jsx("small",{children:p})]},window.btoa(`${c.url}_${g}`))})})]})};const Ux=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],Vx=({className:e="",content:t,image:n,variant:r,spacing:a="normal",styling:i,hideElements:s={eyebrow:!1,title:!1,text:!1},cta:o,children:l})=>{var g,h;const u={imageFullWidth:!0,...i};r||(r=u.imageFullWidth?"default":"light");const c=["eyebrow","title","text"],f={eyebrow:"small",title:"h1",text:"p"},m={};c.forEach(y=>{if(!t[y]){m[y]=!1;return}if(!s[y]){if(typeof t[y]=="object"){m[y]=t[y];const{text:v,element:w}=t[y];if(w&&Ux.includes(w.toLowerCase()))return;m[y]={text:v,element:f[y]};return}m[y]={text:t[y],element:f[y]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=y=>{y.preventDefault(),y.stopPropagation();const v=document.getElementById(o.link.substring(1));v&&v.scrollIntoView({behavior:"smooth"})}),d.jsx(un,{className:Z("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&a==="normal"&&m.eyebrow&&m.title}),children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"content-wrapper",children:[c.map(y=>{if(m[y]&&typeof m[y]=="object"){const{text:v,element:w=""}=m[y];return y==="text"?d.jsx(Un,{overrideType:"text-only",className:"text",children:v},y):C.createElement(w,{key:y,className:y},v)}return null}),l,p&&d.jsx(Ee,{variant:n||["light","subtle"].includes(r)?"primary":"secondary",size:{mobile:"medium",768:"large"},href:o.link,...o.props,className:Z({new:r==="subtle",[(g=o.props)==null?void 0:g.className]:(h=o.props)==null?void 0:h.className}),children:o.text})]}),n&&d.jsx(Xn,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},Kx=C.memo(Vx);const Zx=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),d.jsx(un,{className:Z("custom-content-banner",t,r,{"has-image":e}),style:a,children:d.jsx("div",{className:"content-slim",children:n})})};const Yx=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx(Un,{children:n}):n;return d.jsxs(un,{className:Z("highlight-section",t),children:[r&&d.jsx("div",{className:Z("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:d.jsx(Xn,{image:r})}),d.jsx("div",{className:Z("highlight-container highlight-content-wrapper",{"no-image":!r}),children:d.jsx("div",{className:Z("highlight-content",{"highlight-content-right":e==="left"}),children:r?a:d.jsx("div",{className:"content-default",children:a})})})]})},Gx=C.memo(Yx);const Qx=({variant:e="primary",button:t=null,title:n,text:r,gtmContext:a})=>!n&&!r?null:d.jsxs("aside",{className:Z("marketing-block",e),children:[n&&d.jsx("p",{className:"title",children:n}),r&&d.jsx("p",{children:r}),t&&d.jsx(Ee,{variant:"secondary",size:"medium",href:t.link,className:"gtm-trackable","data-gtm-event-context":a,"data-gtm-event-type":"learn-more-click",children:t.text})]}),Jx=({type:e,data:t})=>{const n=oe.useIntl(),{answers:r,createdAt:a,dateHasPassed:i,isOngoingEvent:s,pill:o,readingTime:l,publishedDate:u,startDate:c}=t;if(e==="question"){const f=a&&ts(a);return d.jsxs("p",{className:"details answers","data-testid":"question-answers",children:[n.formatMessage({id:"card_answers"},{number:r}),a&&d.jsxs("span",{"data-testid":"question-created-at",children:[" ","·"," ",n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})]})]})}if(c&&!i||s)return d.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):Os(c)});if(o)return d.jsx(fn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const f=u&&ts(u);return d.jsxs("ul",{className:"details",children:[l&&d.jsx("li",{"data-testid":"reading-time",children:n.formatMessage({id:"card_time_read"},{time:l})}),u&&d.jsx("li",{"data-testid":"published-date",children:n.formatMessage({id:"card_time_ago"},{time:f?n.formatMessage({id:`dates_${f.path}`},{number:f.number}):0})})]})}return null},ja={communityPage:{basePath:"/communities/",className:"communityPage",gtmEvent:"community"},customCard:{className:"custom",gtmEvent:"custom",length:{text:335,secondaryText:150}},event:{basePath:"/events/",className:"event",gtmEvent:"event"},microcourse:{basePath:"/microcourses/en/",className:"course",gtmEvent:"microcourse-overview"},solutionArticle:{basePath:"/solution-articles/en/",className:"article",length:{title:60},gtmEvent:"article"},qaQuestion:{basePath:"/questions-answers/",className:"question",length:{title:190},gtmEvent:"q-and-a-question"},listPage:{basePath:"/list/en/",className:"list",gtmEvent:"list"},people:{basePath:"/profiles/",className:"people",length:{people:1e3},gtmEvent:"person"},learningHub:{basePath:"/learning-hub/",className:"learning-hub",length:{title:190},gtmEvent:"learning-hub"}},Xx=({data:e,cta:t,link:n,gtmContext:r})=>{var h,y;const a=oe.useIntl(),[i,s]=C.useState({loading:!1,registered:e.registered||!1});C.useEffect(()=>{e.registered&&s(v=>({...v,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:c,slug:f}=e,m=e.contentType;let p="";if((h=ja[m])!=null&&h.gtmEvent&&(p=ja[m].gtmEvent),l&&u)return n?d.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(m==="people")return n?d.jsx(Ee,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(m)&&c!=="premium"){const v=i.loading||i.registered||((y=e==null?void 0:e.members)==null?void 0:y.isMember),w=async A=>{if(A.preventDefault(),A.stopPropagation(),!(v||!t||!t.onClick)){s(E=>({...E,loading:!0}));try{const E=await t.onClick(e);s(E==="success"?()=>({registered:!0,loading:!1}):k=>({...k,loading:!1}))}catch{s(k=>({...k,loading:!1}))}}};return d.jsx("p",{className:Z("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:d.jsx(Ee,{onClick:w,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:v,"data-gtm-event-context":`${r}Page-${m}: ${f}`,"data-gtm-event-type":`${r}-${m}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${m}${v?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const ew={title:66,text:3e3,secondaryText:1e3,partner:25},go=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s})=>{var I,N,M;const o=oe.useIntl(),l=C.useContext(Rt),u=l&&typeof l.id=="string",[c,f]=C.useState({data:null,isLoading:!0}),{data:m,isLoading:p}=c,g=C.useCallback(()=>{n(t,u).then(x=>{f(()=>({data:x,isLoading:!1}))}).catch(()=>f(x=>({...x,isLoading:!1})))},[e]);if(C.useEffect(()=>{g()},[]),p||!m)return d.jsx(wt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:o.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:h}=m;if(!h||!ja[h])return d.jsx(wt,{element:"li",className:"card-wrapper"});const{basePath:y="",className:v,length:w,gtmEvent:A}=ja[h];let E=m.slug?`${y}${m.slug}`:!1;m.slug&&(m.slug.slice(0,4)==="http"||m.slug.slice(0,2)==="//"||m.slug.slice(0,6)==="mailto"||m.slug.slice(0,3)==="tel")&&(E=m.slug);const k=x=>{E&&(x.preventDefault(),x.stopPropagation(),window.location.href=E)},F={...ew,...w};let S={className:"card"},L={};return E&&(L={href:E,className:"gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${A}-click`,"data-testid":"link"},m.openInNewTab&&(L.target="_blank"),S={onClick:k,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${A}-click`}),d.jsx("li",{className:Z("card-wrapper text-medium",v,i,{"has-link":E,"no-link":!E,"has-image":m.banner}),"data-testid":`${h}-card`,children:d.jsxs("div",{...S,children:[d.jsx(Tc,{className:"card-label",contentType:h,customIcon:m.isPrivate?"lock-locked":m.customIcon,customLabel:m.customLabel}),h==="communityPage"&&(m==null?void 0:m.createdAt)&&Ch(m==null?void 0:m.createdAt,60)&&d.jsx(fn,{size:"small",variant:"information","data-testid":"new-community",children:o.formatMessage({id:"card_new"})}),m.startDate&&!m.isOngoingEvent&&d.jsx(fn,{size:"small",variant:m.dateHasPassed?"default":"information","data-testid":"date",children:m.dateHasPassed?o.formatMessage({id:"card_ended"}):_c(m.startDate)}),m.banner?d.jsxs("p",{className:"img",children:[m.registered&&d.jsx(fn,{size:"small",variant:"registered",children:o.formatMessage({id:"card_registered"})}),d.jsx(Xn,{image:{...m.banner,description:""}})]}):v==="people"?d.jsx(an,{name:m.title||"",src:m.profile,"data-testid":"people-profile-picture"}):null,m.contributors&&d.jsx(Ms,{contributors:{data:m.contributors},styling:{size:"small",showGap:v!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(h)?o.formatMessage({id:`card_contributors_${h}`}):void 0,"data-testid":"contributors"}),m.partner&&d.jsx("p",{className:"partners","data-testid":"partners",children:m.partner.length>1?o.formatMessage({id:"card_partner"},{partner:m.partner[0],number:m.partner.length-1}):Wn(m.partner[0],F.partner)}),["title","text","secondaryText"].map(x=>{const _=m[x];if(!_)return null;const j=Cc(x),R={key:x,className:j,"data-testid":j},q={wrapper:"p",forceWrapper:!0,forceInline:!0},V=Wn(_,F[x]);return["title","text"].includes(x)&&E?(q.wrapper="a",d.jsx("p",{...R,children:d.jsx(Ot,{options:q,...L,children:V})})):d.jsx(Ot,{options:q,...R,children:V})}),(l==null?void 0:l.id)&&(m==null?void 0:m.members)&&d.jsxs("span",{className:"member-information",children:[((I=m==null?void 0:m.members)==null?void 0:I.isMember)&&d.jsx(fn,{size:"small",variant:"registered",icon:((N=m==null?void 0:m.members)==null?void 0:N.memberType)==="owner"?"user":"tick",children:o.formatMessage({id:`card_member_type_${(M=m==null?void 0:m.members)==null?void 0:M.memberType}`})}),d.jsx("br",{}),d.jsx("span",{className:"label member-count",children:o.formatMessage({id:"card_member_count"},{count:m==null?void 0:m.members.count})})]}),d.jsx(Jx,{type:v||"",data:m}),d.jsx(Xx,{data:m,cta:r,link:E||"",gtmContext:a})]})})};const Pf=({cards:e,cardTypes:t,className:n="",...r})=>d.jsx("ul",{className:Z("card-block",n),children:e.map((a,i)=>{const s=a.slug?`${a.slug}-${t[i]}`:`${t[i]}-${i}`;return d.jsx(go,{id:s,card:{...a,contentType:t[i]},...r},s)})}),tw=(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},nw=({id:e,title:t})=>{const n=oe.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return C.createElement(a,{className:Z("title",i,s,{"highlighted-title":i==="highlighted"}),children:d.jsxs(d.Fragment,{children:[r,o&&d.jsx("a",{href:o,className:"text-medium gtm-trackable","data-gtm-event-context":"CarouselViewAll","data-gtm-event-type":`${e||window.btoa(r)}-view-all-click`,children:n.formatMessage({id:"card_carousel_viewAll"})})]})})};const $i={fourCards:1024,threeCards:769,twoCards:480};let ea=null;const rw=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=oe.useIntl(),[u,c]=C.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:f,isLoading:m}=u,[p,g]=C.useState({currentPage:0,loadedPages:[0]}),{currentPage:h,loadedPages:y}=p,[v,w]=C.useState(""),A=t.length,E=Math.ceil(A/f),k=C.useRef(null),F=Qn(!0,!0,k==null?void 0:k.current);C.useEffect(()=>{let x=1;F&&(F>=$i.fourCards?x=4:F>=$i.threeCards?x=3:F>=$i.twoCards&&(x=2),x>A&&(x=A)),c(_=>({..._,cardsPerPage:x,isLoading:!1}))},[F,A]);const S=(x="next")=>{let _=h;if(typeof x=="string")if(x==="next")if(h<E-1)_=h+1;else return;else if(h>0)_=h-1;else return;else _=x;g(R=>({...R,currentPage:_,loadedPages:[...new Set([...y,_])]}));const j=()=>{const R=_*u.cardsPerPage,q=R+u.cardsPerPage;return t.slice(R,q).length};w(l.formatMessage({id:"carousel_pagination_aria_live"},{direction:x,count:j()}))},L=x=>{ea=x.touches[0].clientX},I=x=>{if(ea===null)return;const _=x.touches[0].clientX,j=ea-_;j>5?S("next"):j<-5&&S("previous"),ea=null},N={"--width":`${F||0}px`,"--total-cards":A,"--cards-per-page":f,"--page":h};if(m)return d.jsx(Ns,{layout:`carousel${a?"-with-title":""}`});const M=(x,_)=>{var R;let j=null;return(R=x==null?void 0:x.sys)!=null&&R.id?j=`card-${x.sys.id}`:x!=null&&x.slug?j=`card-${x.slug}`:[n[_],x.contentType].includes("customCard")&&(j=`card-${window.btoa(`${x.title} ${x.createdAt}`)}-${_}`),j};return d.jsxs("section",{ref:k,className:Z("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx(nw,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:L,onTouchMove:I,style:N,"data-testid":"carousel-list",children:t.map((x,_)=>{let j=M(x,_);return j&&tw(_,f,h,y)?d.jsx(go,{id:j,card:{...x,contentType:n[_]},buildCardData:r,gtmContext:s,...o},j):(j=j||`${e}-card-${_}`,d.jsx(wt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},j))})}),E<=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(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:x=>{x.preventDefault(),x.stopPropagation(),S("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:h<=0})}),[...Array(E)].map((x,_)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:Z("page-indicator",{selected:_===h}),onClick:j=>{j.preventDefault(),j.stopPropagation(),S(_)},children:d.jsx(Ie,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:_+1,total:E})})})},`page-indicator-${_}`)),d.jsx("li",{className:"arrow next",children:d.jsx(Ee,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:x=>{x.preventDefault(),x.stopPropagation(),S("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:h>=E-1})})]}),d.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:v})]})]})},aw=({carousels:e=[],isLoading:t,title:n,className:r="",...a})=>!e||!e.length?null:e.map(({title:i,viewAllUrl:s,cards:o,cardsTypes:l},u)=>{const c=i?window.btoa(i):`carousel-${u}`,f=u===e.length-1;return t?d.jsxs(C.Fragment,{children:[d.jsx(Ns,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),f?null:d.jsx(en,{})]},`placeholder-${c}`):d.jsxs(C.Fragment,{children:[d.jsx(rw,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),f?null:d.jsx(en,{})]},`carousel-${c}`)});const ta="joinCommunityButton",vo=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=oe.useIntl(),o=C.useContext(Rt),l=o&&typeof o.id=="string",u=r||!l,[c,f]=C.useState(e),[m,p]=C.useState(e?"joined":"notJoined");C.useEffect(()=>{m==="joining"?p("joined"):m==="leaving"&&p("notJoined")},[c]);const g={},h={};return c&&m!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${ta}_leave`}),g["aria-label"]=s.formatMessage({id:`${ta}_member_aria`}),h["aria-hidden"]="true"),d.jsx(Ee,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&m!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!c?s.formatMessage({id:`${ta}_closed_tooltip`}):"",onClick:async y=>{u||(y.currentTarget.blur(),c?(p("leaving"),typeof i=="function"&&await i()):(p("joining"),typeof a=="function"&&await a()),f(!c))},className:Z("join-community-button",m,{active:m==="joining"}),disabled:u,...g,children:d.jsx("span",{className:"text",...h,children:s.formatMessage({id:`${ta}${["joining","leaving"].includes(m)?`_${m}`:c?"_member":n?"_short":""}`})})})};const Li="communityDetails_",iw=({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=oe.useIntl(),u=5,c=a||i.length,f=i.length?i:Array(u).fill({}),m=`/communities/${r}/members`===window.location.pathname,p=t||n,g=!n&&!t;return d.jsxs("div",{className:Z("community-details",e),children:[p&&d.jsxs("div",{className:"member-details",children:[d.jsxs("div",{className:"top",children:[d.jsxs("h4",{children:[l.formatMessage({id:`${Li}members`}),d.jsx("span",{className:"count",children:c})]}),!m&&d.jsx("p",{className:"text-small",children:d.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${Li}viewAll`})})})]}),d.jsx(Ms,{contributors:{total:a,data:f},styling:{size:"medium",showGap:!0,showPlaceholders:c===0},cutoff:u})]}),d.jsx(vo,{isMember:t,isOpen:n,disabled:g,functions:{...o}}),t&&d.jsx(Ee,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${Li}invite`})})]})};const sw=({breadcrumbs:e,cutoff:t=20,className:n=""})=>{const r=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Ie,{element:"p",children:r.formatMessage({id:"breadcrumbs_label"})}),d.jsx("ul",{className:Z("breadcrumbs text-small",n),children:e.map(({text:a,href:i,current:s=!1},o)=>{const l={};return s&&(l["aria-current"]="location"),d.jsxs("li",{children:[s&&d.jsx(Ie,{element:"span",children:r.formatMessage({id:"breadcrumbs_currentPage"})}),d.jsx(kn,{href:s?void 0:i,...l,children:Wn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const ow=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=oe.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=C.useState(t?["all"]:[]),u=(c,f)=>{let m=[];o.includes(c)?m=o.filter(p=>p!==c):c==="all"?m=["all"]:n?m=[...o.filter(p=>p!=="all"),c]:m=[c],l(p=>(r&&typeof r=="function"&&r({current:m,previous:p}),m)),f&&typeof f=="function"&&f()};return d.jsx("ul",{className:Z("filters",a),children:s.map(({id:c,text:f,disabled:m=!1,callback:p=()=>{}})=>{let g={};return m&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:f})}),d.jsx("li",{children:d.jsx("button",{className:Z(c,{selected:o.includes(c)}),onClick:h=>{h.preventDefault(),h.stopPropagation(),u(c,p)},...g,children:f})},c)})})},uw=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let a="",i=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(a+=`/${s}`,i=!0):(a.includes(`/${r}/`)||(a+=`/${r}`),a+=`/${s}`)}),a.includes(`/${r}/`)||(a+=`/${r}`),t&&(a+=`/${t}`),i?{url:a,urlForRouter:`/${a.split("/").slice(2).join("/")}`}:a};const na="languageSwitcher_",lw=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=oe.useIntl(),{updateLanguage:c=()=>{}}=C.useContext(ho),[f,m]=C.useState(e);if(C.useEffect(()=>{e!==f&&m(e)},[e]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const g=Object.keys(r),h=f!==e;return d.jsxs("div",{className:Z("language-switcher text-small",s,l),children:[d.jsxs("nav",{children:[s!=="short"&&d.jsx("p",{children:o||u.formatMessage({id:`${na}label`})}),d.jsx("ul",{children:g.map(y=>{var A;if(!ga[y])return null;const v=(A=r[y])==null?void 0:A.post_name;let w={className:y};if(f===y)w["aria-label"]=u.formatMessage({id:`${na}selected`},{language:ga[y]});else{const E=uw(y,v,i);w={...w,href:typeof E=="string"?E:E.url,onClick:k=>{m(y),c(y),typeof a<"u"&&(k.preventDefault(),k.stopPropagation(),a(y,typeof E=="string"?E:E.urlForRouter))}}}return d.jsx("li",{children:d.jsx(kn,{...w,fallbackElement:"span",children:ga[y]})},y)})}),s!=="short"&&!h&&d.jsx("p",{children:u.formatMessage({id:`${na}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!h&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${na}disclaimer`},{email:Pn.support,link:y=>{const v=`mailto:${y}`;return d.jsx("a",{href:v,children:y})}})})]})};const zi=oe.createIntl({locale:"en",messages:Jn}),Nr=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:a="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:zi.formatMessage({id:"loadMore_button"}),endOfFeed:zi.formatMessage({id:"loadMore_endOfFeed"}),error:zi.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,f]=C.useState(""),m=async p=>{if(!n)try{await t(p)}catch(g){g instanceof Error?f(g.message):f("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:d.jsx("footer",{className:Z("load-more",l),children:!c&&e?d.jsx(Ee,{variant:r,size:a,styling:i,icon:s,onClick:m,"data-gtm-event-context":u,"data-gtm-event-type":"load-more-click",disabled:n,className:"gtm-trackable","data-testid":"load-more-button",children:o.button}):o.endOfFeed&&(!c||c!=null&&c.includes("Cannot read items"))?d.jsx("p",{children:o.endOfFeed}):c&&d.jsx("p",{className:"error",children:o.error})})};const bo=({variant:e="default",version:t="default",className:n="",...r})=>d.jsx("p",{className:"logo-wrapper",children:d.jsx("a",{href:"/home/",className:Z("logo",e,t,n),...r,children:d.jsx(Ie,{children:d.jsx(oe.FormattedMessage,{id:"apolitical"})})})});let ra=!1;const Nf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=oe.useIntl(),i=C.useRef(null),[s,o]=C.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return C.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),C.createElement(e,{ref:i,className:Z("more-menu text-medium",r),children:d.jsxs(d.Fragment,{children:[d.jsx(Ee,{variant:"tertiary",size:"medium",icon:{icon:"ellipsis"},onClick:()=>o(!s),"aria-haspopup":"true","aria-expanded":s,"aria-controls":t,screenreaderText:a.formatMessage({id:"moreMenu"}),className:"more-menu-button"}),d.jsx("ul",{id:t,hidden:!s,children:n.map(({href:u,onClick:c,text:f,icon:m,...p},g)=>{const h={...p,onClick:y=>{o(!1),typeof c=="function"&&c(y)},onFocus:()=>{ra&&(clearTimeout(ra),ra=!1)},onBlur:()=>{ra=setTimeout(()=>{o(!1)},100)}};return u&&(h.href=u),d.jsx("li",{className:"more-menu-list-item",children:d.jsx(Ee,{variant:"tertiary",size:"medium",icon:m?{icon:m,position:"left"}:!1,...h,children:f})},`${window.btoa(f)}_${g}`)})})]})})},cw=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const dw=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Rf=({activeLink:e})=>{const t=oe.useIntl(),n=C.useContext(Rt),r=n&&typeof n.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[dw.map(({key:a,href:i})=>{const s=cw(i,e),o={};return s&&(o["aria-current"]="page"),d.jsx("li",{className:Z(a,{active:s}),children:d.jsx("a",{href:i,"data-gtm-event-type":`${a}-click`,"data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",...o,children:t.formatMessage({id:`navigationMenu_links_${a}`})})},a)}),r&&d.jsx("li",{className:"profile","data-testid":"profile-link",children:d.jsxs("a",{href:"/profiles/me","data-gtm-event-type":"profile-click","data-gtm-event-context":"NavigationMenu",className:"gtm-trackable",children:[d.jsx(an,{name:(n==null?void 0:n.name)||"",src:n!=null&&n.image?n.image.thumbnail:""}),d.jsx("span",{children:t.formatMessage({id:"navigationMenu_profile"})})]})})]})},cr=(e,t,n)=>`${e}?share=${t}${n?`&uuid=${n}`:""}`,fw=({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}
|
|
157
|
+
*/function ec(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 tc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ec(Object(n),!0).forEach(function(r){yx(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ec(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yx(e,t,n){return t=Cx(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dx(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 Cx(e){var t=Dx(e,"string");return typeof t=="symbol"?t:String(t)}var nc={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()}},xx=function(t){return t.tagName&&t.tagName.toLowerCase()==="input"&&typeof t.select=="function"},wx=function(t){return(t==null?void 0:t.key)==="Escape"||(t==null?void 0:t.key)==="Esc"||(t==null?void 0:t.keyCode)===27},Cr=function(t){return(t==null?void 0:t.key)==="Tab"||(t==null?void 0:t.keyCode)===9},Ex=function(t){return Cr(t)&&!t.shiftKey},kx=function(t){return Cr(t)&&t.shiftKey},rc=function(t){return setTimeout(t,0)},ac=function(t,n){var r=-1;return t.every(function(a,i){return n(a)?(r=i,!1):!0}),r},lr=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return typeof t=="function"?t.apply(void 0,r):t},Jr=function(t){return t.target.shadowRoot&&typeof t.composedPath=="function"?t.composedPath()[0]:t.target},_x=[],Bx=function(t,n){var r=(n==null?void 0:n.document)||document,a=(n==null?void 0:n.trapStack)||_x,i=tc({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Ex,isKeyBackward:kx},n),s={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},o,l=function(x,B,F){return x&&x[B]!==void 0?x[B]:i[F||B]},u=function(x,B){var F=typeof(B==null?void 0:B.composedPath)=="function"?B.composedPath():void 0;return s.containerGroups.findIndex(function(N){var L=N.container,q=N.tabbableNodes;return L.contains(x)||(F==null?void 0:F.includes(L))||q.find(function(oe){return oe===x})})},c=function(x){var B=i[x];if(typeof B=="function"){for(var F=arguments.length,N=new Array(F>1?F-1:0),L=1;L<F;L++)N[L-1]=arguments[L];B=B.apply(void 0,N)}if(B===!0&&(B=void 0),!B){if(B===void 0||B===!1)return B;throw new Error("`".concat(x,"` was specified but was not a node, or did not return a node"))}var q=B;if(typeof B=="string"&&(q=r.querySelector(B),!q))throw new Error("`".concat(x,"` as selector refers to no known node"));return q},m=function(){var x=c("initialFocus");if(x===!1)return!1;if(x===void 0||!pa(x,i.tabbableOptions))if(u(r.activeElement)>=0)x=r.activeElement;else{var B=s.tabbableGroups[0],F=B&&B.firstTabbableNode;x=F||c("fallbackFocus")}if(!x)throw new Error("Your focus-trap needs to have at least one focusable element");return x},h=function(){if(s.containerGroups=s.containers.map(function(x){var B=Pf(x,i.tabbableOptions),F=Nf(x,i.tabbableOptions),N=B.length>0?B[0]:void 0,L=B.length>0?B[B.length-1]:void 0,q=F.find(function(D){return dn(D)}),oe=F.slice().reverse().find(function(D){return dn(D)}),ne=!!B.find(function(D){return Jt(D)>0});return{container:x,tabbableNodes:B,focusableNodes:F,posTabIndexesFound:ne,firstTabbableNode:N,lastTabbableNode:L,firstDomTabbableNode:q,lastDomTabbableNode:oe,nextTabbableNode:function(H){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=B.indexOf(H);return _<0?X?F.slice(F.indexOf(H)+1).find(function(S){return dn(S)}):F.slice(0,F.indexOf(H)).reverse().find(function(S){return dn(S)}):B[_+(X?1:-1)]}}}),s.tabbableGroups=s.containerGroups.filter(function(x){return x.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(x){return x.posTabIndexesFound})&&s.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},p=function M(x){var B=x.activeElement;if(B)return B.shadowRoot&&B.shadowRoot.activeElement!==null?M(B.shadowRoot):B},g=function M(x){if(x!==!1&&x!==p(document)){if(!x||!x.focus){M(m());return}x.focus({preventScroll:!!i.preventScroll}),s.mostRecentlyFocusedNode=x,xx(x)&&x.select()}},f=function(x){var B=c("setReturnFocus",x);return B||(B===!1?!1:x)},y=function(x){var B=x.target,F=x.event,N=x.isBackward,L=N===void 0?!1:N;B=B||Jr(F),h();var q=null;if(s.tabbableGroups.length>0){var oe=u(B,F),ne=oe>=0?s.containerGroups[oe]:void 0;if(oe<0)L?q=s.tabbableGroups[s.tabbableGroups.length-1].lastTabbableNode:q=s.tabbableGroups[0].firstTabbableNode;else if(L){var D=ac(s.tabbableGroups,function(I){var V=I.firstTabbableNode;return B===V});if(D<0&&(ne.container===B||pa(B,i.tabbableOptions)&&!dn(B,i.tabbableOptions)&&!ne.nextTabbableNode(B,!1))&&(D=oe),D>=0){var H=D===0?s.tabbableGroups.length-1:D-1,X=s.tabbableGroups[H];q=Jt(B)>=0?X.lastTabbableNode:X.lastDomTabbableNode}else Cr(F)||(q=ne.nextTabbableNode(B,!1))}else{var _=ac(s.tabbableGroups,function(I){var V=I.lastTabbableNode;return B===V});if(_<0&&(ne.container===B||pa(B,i.tabbableOptions)&&!dn(B,i.tabbableOptions)&&!ne.nextTabbableNode(B))&&(_=oe),_>=0){var S=_===s.tabbableGroups.length-1?0:_+1,W=s.tabbableGroups[S];q=Jt(B)>=0?W.firstTabbableNode:W.firstDomTabbableNode}else Cr(F)||(q=ne.nextTabbableNode(B))}}else q=c("fallbackFocus");return q},b=function(x){var B=Jr(x);if(!(u(B,x)>=0)){if(lr(i.clickOutsideDeactivates,x)){o.deactivate({returnFocus:i.returnFocusOnDeactivate});return}lr(i.allowOutsideClick,x)||x.preventDefault()}},w=function(x){var B=Jr(x),F=u(B,x)>=0;if(F||B instanceof Document)F&&(s.mostRecentlyFocusedNode=B);else{x.stopImmediatePropagation();var N,L=!0;if(s.mostRecentlyFocusedNode)if(Jt(s.mostRecentlyFocusedNode)>0){var q=u(s.mostRecentlyFocusedNode),oe=s.containerGroups[q].tabbableNodes;if(oe.length>0){var ne=oe.findIndex(function(D){return D===s.mostRecentlyFocusedNode});ne>=0&&(i.isKeyForward(s.recentNavEvent)?ne+1<oe.length&&(N=oe[ne+1],L=!1):ne-1>=0&&(N=oe[ne-1],L=!1))}}else s.containerGroups.some(function(D){return D.tabbableNodes.some(function(H){return Jt(H)>0})})||(L=!1);else L=!1;L&&(N=y({target:s.mostRecentlyFocusedNode,isBackward:i.isKeyBackward(s.recentNavEvent)})),g(N||s.mostRecentlyFocusedNode||m())}s.recentNavEvent=void 0},A=function(x){var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;s.recentNavEvent=x;var F=y({event:x,isBackward:B});F&&(Cr(x)&&x.preventDefault(),g(F))},k=function(x){if(wx(x)&&lr(i.escapeDeactivates,x)!==!1){x.preventDefault(),o.deactivate();return}(i.isKeyForward(x)||i.isKeyBackward(x))&&A(x,i.isKeyBackward(x))},E=function(x){var B=Jr(x);u(B,x)>=0||lr(i.clickOutsideDeactivates,x)||lr(i.allowOutsideClick,x)||(x.preventDefault(),x.stopImmediatePropagation())},T=function(){if(s.active)return nc.activateTrap(a,o),s.delayInitialFocusTimer=i.delayInitialFocus?rc(function(){g(m())}):g(m()),r.addEventListener("focusin",w,!0),r.addEventListener("mousedown",b,{capture:!0,passive:!1}),r.addEventListener("touchstart",b,{capture:!0,passive:!1}),r.addEventListener("click",E,{capture:!0,passive:!1}),r.addEventListener("keydown",k,{capture:!0,passive:!1}),o},j=function(){if(s.active)return r.removeEventListener("focusin",w,!0),r.removeEventListener("mousedown",b,!0),r.removeEventListener("touchstart",b,!0),r.removeEventListener("click",E,!0),r.removeEventListener("keydown",k,!0),o},z=function(x){var B=x.some(function(F){var N=Array.from(F.removedNodes);return N.some(function(L){return L===s.mostRecentlyFocusedNode})});B&&g(m())},R=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(z):void 0,$=function(){R&&(R.disconnect(),s.active&&!s.paused&&s.containers.map(function(x){R.observe(x,{subtree:!0,childList:!0})}))};return o={get active(){return s.active},get paused(){return s.paused},activate:function(x){if(s.active)return this;var B=l(x,"onActivate"),F=l(x,"onPostActivate"),N=l(x,"checkCanFocusTrap");N||h(),s.active=!0,s.paused=!1,s.nodeFocusedBeforeActivation=r.activeElement,B==null||B();var L=function(){N&&h(),T(),$(),F==null||F()};return N?(N(s.containers.concat()).then(L,L),this):(L(),this)},deactivate:function(x){if(!s.active)return this;var B=tc({onDeactivate:i.onDeactivate,onPostDeactivate:i.onPostDeactivate,checkCanReturnFocus:i.checkCanReturnFocus},x);clearTimeout(s.delayInitialFocusTimer),s.delayInitialFocusTimer=void 0,j(),s.active=!1,s.paused=!1,$(),nc.deactivateTrap(a,o);var F=l(B,"onDeactivate"),N=l(B,"onPostDeactivate"),L=l(B,"checkCanReturnFocus"),q=l(B,"returnFocus","returnFocusOnDeactivate");F==null||F();var oe=function(){rc(function(){q&&g(f(s.nodeFocusedBeforeActivation)),N==null||N()})};return q&&L?(L(f(s.nodeFocusedBeforeActivation)).then(oe,oe),this):(oe(),this)},pause:function(x){if(s.paused||!s.active)return this;var B=l(x,"onPause"),F=l(x,"onPostPause");return s.paused=!0,B==null||B(),j(),$(),F==null||F(),this},unpause:function(x){if(!s.paused||!s.active)return this;var B=l(x,"onUnpause"),F=l(x,"onPostUnpause");return s.paused=!1,B==null||B(),h(),T(),$(),F==null||F(),this},updateContainerElements:function(x){var B=[].concat(x).filter(Boolean);return s.containers=B.map(function(F){return typeof F=="string"?r.querySelector(F):F}),s.active&&h(),$(),this}},o.updateContainerElements(t),o};const Ax=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:Bx},Symbol.toStringTag,{value:"Module"})),Fx=yc(Ax),Tx=yc(bx);function Gn(e){"@babel/helpers - typeof";return Gn=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},Gn(e)}function Sx(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ic(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,Rf(r.key),r)}}function jx(e,t,n){return t&&ic(e.prototype,t),n&&ic(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ox(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Os(e,t)}function Os(e,t){return Os=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},Os(e,t)}function Px(e){var t=Rx();return function(){var r=Sa(e),a;if(t){var i=Sa(this).constructor;a=Reflect.construct(r,arguments,i)}else a=r.apply(this,arguments);return Nx(this,a)}}function Nx(e,t){if(t&&(Gn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mr(e)}function mr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Rx(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Sa(e){return Sa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Sa(e)}function Mx(e,t,n){return t=Rf(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rf(e){var t=Ix(e,"string");return Gn(t)==="symbol"?t:String(t)}function Ix(e,t){if(Gn(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Gn(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Xr=C,ve=nx,$x=Fx,Lx=$x.createFocusTrap,zx=Tx,qx=zx.isFocusable,vo=function(e){Ox(n,e);var t=Px(n);function n(r){var a;Sx(this,n),a=t.call(this,r),Mx(mr(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,m=new Array(c>1?c-1:0),h=1;h<c;h++)m[h-1]=arguments[h];u=u.apply(void 0,m)}if(u===!0&&(u=void 0),!u){if(u===void 0||u===!1)return u;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var p=u;if(typeof u=="string"){var g;if(p=(g=this.getDocument())===null||g===void 0?void 0:g.querySelector(u),!p)throw new Error("`".concat(o,"` as selector refers to no known node"))}return p}),a.handleDeactivate=a.handleDeactivate.bind(mr(a)),a.handlePostDeactivate=a.handlePostDeactivate.bind(mr(a)),a.handleClickOutsideDeactivates=a.handleClickOutsideDeactivates.bind(mr(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 jx(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&&!qx(a.outsideClick.target,a.internalOptions.tabbableOptions))),u=a.internalOptions.preventScroll,c=u===void 0?!1:u;l&&o.focus({preventScroll:c}),a.originalOptions.onPostDeactivate&&a.originalOptions.onPostDeactivate.call(null),a.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(i,i):i()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var a=this.focusTrapElements.some(Boolean);a&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(a){if(this.focusTrap){a.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var i=!a.active&&this.props.active,s=a.active&&!this.props.active,o=!a.paused&&this.props.paused,l=a.paused&&!this.props.paused;if(i&&(this.updatePreviousElement(),this.focusTrap.activate()),s){this.deactivateTrap();return}o&&this.focusTrap.pause(),l&&this.focusTrap.unpause()}else a.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var a=this,i=this.props.children?Xr.Children.only(this.props.children):void 0;if(i){if(i.type&&i.type===Xr.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var s=function(u){var c=a.props.containerElements;i&&(typeof i.ref=="function"?i.ref(u):i.ref&&(i.ref.current=u)),a.focusTrapElements=c||[u]},o=Xr.cloneElement(i,{ref:s});return o}return null}}]),n}(Xr.Component),cr=typeof Element>"u"?Function:Element;vo.propTypes={active:ve.bool,paused:ve.bool,focusTrapOptions:ve.shape({document:ve.object,onActivate:ve.func,onPostActivate:ve.func,checkCanFocusTrap:ve.func,onPause:ve.func,onPostPause:ve.func,onUnpause:ve.func,onPostUnpause:ve.func,onDeactivate:ve.func,onPostDeactivate:ve.func,checkCanReturnFocus:ve.func,initialFocus:ve.oneOfType([ve.instanceOf(cr),ve.string,ve.bool,ve.func]),fallbackFocus:ve.oneOfType([ve.instanceOf(cr),ve.string,ve.func]),escapeDeactivates:ve.oneOfType([ve.bool,ve.func]),clickOutsideDeactivates:ve.oneOfType([ve.bool,ve.func]),returnFocusOnDeactivate:ve.bool,setReturnFocus:ve.oneOfType([ve.instanceOf(cr),ve.string,ve.bool,ve.func]),allowOutsideClick:ve.oneOfType([ve.bool,ve.func]),preventScroll:ve.bool,tabbableOptions:ve.shape({displayCheck:ve.oneOf(["full","legacy-full","non-zero-area","none"]),getShadowRoot:ve.oneOfType([ve.bool,ve.func])}),trapStack:ve.array,isKeyForward:ve.func,isKeyBackward:ve.func}),containerElements:ve.arrayOf(ve.instanceOf(cr)),children:ve.oneOfType([ve.element,ve.instanceOf(cr)])};vo.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:Lx};var Wx=vo;const Hx=wn(Wx),Mf=({showDevTools:e=!0,children:t})=>{const n=new Ke.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,staleTime:6e4}}});return d.jsxs(Ke.QueryClientProvider,{client:n,children:[t,e&&d.jsx(Dh.ReactQueryDevtools,{initialIsOpen:!1})]})};var Ux=C.createContext({client:sa});function Vx(e){var t=e.children,n=e.client,r=e.apiKey,a=e.options,i=C.useMemo(function(){return n&&r&&console.warn("[PostHog.js] You have provided both a client and an apiKey to PostHogProvider. The apiKey will be ignored in favour of the client."),n&&a&&console.warn("[PostHog.js] You have provided both a client and options to PostHogProvider. The options will be ignored in favour of the client."),n||(r&&(sa.__loaded&&console.warn("[PostHog.js] was already loaded elsewhere. This may cause issues."),sa.init(r,a)),sa)},[n,r]);return C.createElement(Ux.Provider,{value:{client:i}},t)}const If=({children:e,user:t})=>t.isLoading?null:process.env.REACT_APP_PUBLIC_POSTHOG_KEY?d.jsx(Vx,{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}),$f=({children:e,locale:t,messages:n})=>{const r=t||"en",a={...Ih[r],...n||{}};return d.jsx(ue.IntlProvider,{locale:r,messages:a,children:e})},bo=C.createContext({}),ga={en:"English",es:"Español",fr:"Français",pt:"Português"},Mt=C.createContext({isLoading:!0});function Ga(){return C.useContext(Mt)}const Lf=({children:e,user:t})=>d.jsx(Mt.Provider,{value:t,children:e}),yo=C.createContext({registerOverlay:()=>{},unregisterOverlay:()=>{}}),zf=()=>C.useContext(yo),qf=({children:e})=>{const[t,n]=C.useState([]);C.useEffect(()=>{t.length>0?document.body.classList.add("has-overlay"):document.body.classList.remove("has-overlay")},[t]);const r=C.useCallback(i=>{n(s=>[...s,i])},[]),a=C.useCallback(i=>{n(s=>s.filter(o=>o!==i))},[]);return d.jsx(yo.Provider,{value:{registerOverlay:r,unregisterOverlay:a},children:e})},Kx=({bootstrap:e,children:t,intl:n,showDevTools:r})=>{const[a,i]=C.useState({isLoading:!0}),s=(n==null?void 0:n.locale)||localStorage.getItem("language")||"en",[o,l]=C.useState(s),u=c=>{localStorage.setItem("language",c),l(c)};return C.useEffect(()=>{e().then(c=>{i({...c,isLoading:!1}),Pc(5e3)}).catch(c=>{c.message===Tc&&window.location.pathname!=="/user-onboarding/logout"&&(window.location.href="/user-onboarding/logout"),i({isLoading:!1})})},[]),d.jsx(bo.Provider,{value:{language:o,updateLanguage:u},children:d.jsx($f,{locale:o,messages:n==null?void 0:n.messages,children:d.jsx(Ps.CookiesProvider,{children:d.jsx(Lf,{user:a,children:d.jsx(qf,{children:d.jsx(Mf,{showDevTools:r,children:d.jsx(If,{user:a,children:t})})})})})})})};const Do=({element:e="section",children:t,className:n,...r})=>C.createElement(e,{className:Y("modal",n),children:typeof t=="string"?d.jsx("p",{children:t}):t,...r});const Pr=({id:e="content-overlay",isOpen:t=!1,showDivider:n=!0,maxWidth:r,functions:{onOpen:a=()=>{},onClose:i=()=>{}}={},forceShow:{error:s=!1}={},title:o,children:l,buttons:u,className:c="",gtmContext:m="Modal"})=>{const h=ue.useIntl(),{registerOverlay:p,unregisterOverlay:g}=zf(),[f,y]=C.useState(t),b=k=>{k.key==="Escape"&&w(!1)};C.useEffect(()=>(window.addEventListener("keyup",b),()=>{window.removeEventListener("keyup",b)}));const w=k=>{y(k),k?(a(),p(e)):(i(),g(e))};C.useEffect(()=>(w(t),()=>{f&&g(e)}),[t]);const A=r?{"--max-width":`${r/16}rem`}:{};return d.jsx("div",{className:Y("overlay",{open:f}),role:"dialog",children:d.jsx(Do,{id:e,className:Y("overlay-modal",c,{"has-max-width":r}),hidden:!f,style:A,children:t&&d.jsx(Hx,{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(ke,{variant:"tertiary",size:"medium",icon:{icon:"close"},onClick:()=>w(!1),className:"gtm-trackable","data-gtm-event-type":"close-modal-click","data-gtm-event-context":m,screenreaderText:h.formatMessage({id:"overlay_close"})})]}),n&&d.jsx(tn,{}),l,u&&d.jsxs("div",{className:"bottom",children:[d.jsx(tn,{}),d.jsx(kn,{buttons:u})]}),s&&d.jsx(wr,{className:"error",children:s})]})})})})},Wf=(e,t)=>({"aria-haspopup":!0,"aria-expanded":t,"aria-controls":e});const Zx=({className:e,showModal:t=!0,title:n,formTitle:r,formLabel:a,ctaMessage:i,showIcon:s,onClose:o,reportError:l=()=>{},sendInvites:u})=>{const c=ue.useIntl();return r||(r=c.formatMessage({id:"inviteModal_formTitle"})),a||(a=c.formatMessage({id:"inviteModal_formLabel"})),i||(i=c.formatMessage({id:"inviteModal_cta"})),d.jsx(Pr,{title:n,isOpen:t,showDivider:!1,showIcon:s,functions:{onClose:o},className:Y("invite-modal",e,{success:!!n}),children:d.jsx(Ef,{title:r,label:a,ctaMessage:i,onClose:o,sendInvites:u,reportError:l})})};const Yx=({members:e})=>{const[t,n]=C.useState(!1),r=a=>{const{fullName:i,jobTitle:s,organisation:o,photo:l}=a||{};return d.jsxs(d.Fragment,{children:[d.jsx(sn,{name:i,src:l}),d.jsx("p",{children:i}),d.jsx("small",{className:"text-medium",children:o?`${s}, ${o}`:s})]})};return d.jsxs("div",{className:"directory-wrapper",children:[d.jsx("ul",{className:"directory",children:e.map(a=>d.jsx("li",{children:d.jsx("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),n(a)},children:r(a)})},a.fullName))}),d.jsx(Pr,{isOpen:t!==!1,children:t===!1?"":d.jsxs(d.Fragment,{children:[r(t),d.jsx(Vn,{children:t.text})]}),buttons:[{size:"small",variant:"tertiary",onClick:()=>n(!1),children:"Close"}],functions:{onClose:()=>n(!1)}})]})};const Gx=({author:e,authorCite:t,content:n,member:r,className:a=""})=>d.jsxs("blockquote",{className:Y("testimonial-block",a),children:[d.jsx(Pt,{className:"testimonial",children:n}),r?d.jsx(tr,{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})})]})]}),Qx=C.memo(Gx);const Jx=({items:e=[],selector:t="",className:n=""})=>{const r=ue.useIntl(),[a,i]=C.useState(e);return C.useEffect(()=>{if(e.length)return;let s="";Array(6).fill(0).forEach((u,c)=>{s+=`${c>0?", ":""}${t} h${c+1}`});const l=Array.from(document.querySelectorAll(s)).filter(u=>u.id).map(u=>({id:u.id,text:u.textContent||""}));i(l)},[]),a&&a.length>0&&d.jsxs(Nt,{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 Qa=({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 m=c/60,h=Math.floor(m),p=(m-h)*60,g=Math.round(p),f=`${i.formatMessage({id:`${s}hours`},{time:h})}${h>0&&g>0?", ":""}${i.formatMessage({id:`${s}minutes`},{time:g})}`;return{text:`${h>0?`${i.formatMessage({id:`${s}hours_short`},{time:h})} `:""}${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:m}=o(e+t);l=i.formatMessage({id:`${s}range`},{early:l,late:c}),u=i.formatMessage({id:`${s}range_aria`},{early:u,late:m})}return n&&(u=`${n} ${u}`,l=`${n} ${l}`),r&&(u=`${u} ${r}`,l=`${l} ${r}`),d.jsx("span",{className:Y("time-to-complete",a),"aria-label":u,children:l})};const Xx=({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(er,{...n,className:Y("banner",e),image:{...t,aspect:"banner"}})):null;const ln=({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 ew=({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(ln,{className:Y("download-section",n),children:d.jsxs("div",{className:"content-default",children:[C.createElement(typeof e=="string"?"h2":e.element,{className:"text"},typeof e=="string"?e:e.text),d.jsx(kn,{buttons:r})]})})};function Hf({href:e,setShowModal:t}){typeof e!="string"&&t(!0)}const tw=({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:jc(e),children:[d.jsx("p",{children:t||s({id:"edit_section_placeholder_description"})}),a&&d.jsx(ke,{href:r,variant:"secondary",size:"small",onClick:()=>Hf({href:r,setShowModal:i}),children:n||s({id:"edit_section_placeholder_cta"})})]})},nw=({children:e,className:t="",formProps:n,href:r,title:a,modalTitle:i,placeholder:s,showDivider:o=!0})=>{const[l,u]=C.useState(!1),c=typeof r=="string"||!!n,m=()=>u(!1);return d.jsxs("section",{className:Y("edit-section",t),children:[n&&d.jsx(Pr,{title:i||`Edit ${a}`,isOpen:l,showDivider:!1,showIcon:!1,functions:{onClose:m},className:Y("edit-section-modal"),children:d.jsx(nr,{...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 h=>{var p,g;(p=n==null?void 0:n.functions)!=null&&p.onSuccess&&await((g=n==null?void 0:n.functions)==null?void 0:g.onSuccess(h)),u(!1)},onCancel:m}})}),d.jsxs("div",{className:"edit-section-header",children:[d.jsx("h2",{className:"edit-section-header-title",children:a}),c&&d.jsx(ke,{href:r,variant:"tertiary",size:"small",icon:"pencil",onClick:()=>Hf({href:r,setShowModal:u}),children:"Edit"})]}),e||d.jsx(tw,{...s,href:r,setShowModal:u,showEditButton:c}),o&&d.jsx(tn,{})]})};const rw=({title:e=!1,text:t,logos:n=[],styling:r={},className:a=""})=>{const i=n.length;if(i===0)return null;const s={element:typeof e=="object"?e.element:"h2",text:typeof e=="string"?e:typeof e=="object"?e.text:"",className:typeof e=="object"?e.className:""},{wrapLogos:o=!1,align:l="center",display:u="block"}=r;return d.jsxs("div",{className:Y("logos",a,`align-${l}`,{[u]:u!=="block","wrap-logos":o}),children:[e&&C.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:m,link:h=!1,description:p=!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:m});return d.jsxs("li",{children:[d.jsx("p",{className:"img-wrapper",children:h?d.jsx("a",{href:h,target:"_blank",rel:"nofollow noreferrer noopener",children:f}):f}),p&&d.jsx("small",{children:p})]},window.btoa(`${c.url}_${g}`))})})]})};const aw=["small","span","strong","em","p","h1","h2","h3","h4","h5","h6","blockquote","q"],iw=({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"],m={eyebrow:"small",title:"h1",text:"p"},h={};c.forEach(y=>{if(!t[y]){h[y]=!1;return}if(!s[y]){if(typeof t[y]=="object"){h[y]=t[y];const{text:b,element:w}=t[y];if(w&&aw.includes(w.toLowerCase()))return;h[y]={text:b,element:m[y]};return}h[y]={text:t[y],element:m[y]}}});const p=o&&o.text&&o.link;return p&&o.link[0]==="#"&&(o.props||(o.props={}),o.props.onClick=y=>{y.preventDefault(),y.stopPropagation();const b=document.getElementById(o.link.substring(1));b&&b.scrollIntoView({behavior:"smooth"})}),d.jsx(ln,{className:Y("banner-section",r,a,e,{"has-image":n,"image-full-width":n&&u.imageFullWidth,"image-inline":n&&!u.imageFullWidth,"has-cta":p,"has-extra-spacing":r!=="subtle"&&a==="normal"&&h.eyebrow&&h.title}),children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"content-wrapper",children:[c.map(y=>{if(h[y]&&typeof h[y]=="object"){const{text:b,element:w=""}=h[y];return y==="text"?d.jsx(Vn,{overrideType:"text-only",className:"text",children:b},y):C.createElement(w,{key:y,className:y},b)}return null}),l,p&&d.jsx(ke,{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(er,{image:{...n,aspect:u.imageFullWidth?"banner":n.aspect||void 0}})]})})},sw=C.memo(iw);const ow=({image:e,variant:t="default",children:n,className:r=""})=>{const a={};return e&&(a["--image"]=`url(${e})`),d.jsx(ln,{className:Y("custom-content-banner",t,r,{"has-image":e}),style:a,children:d.jsx("div",{className:"content-slim",children:n})})};const uw=({alignImage:e="left",className:t,content:n,image:r})=>{const a=typeof n=="string"?d.jsx(Vn,{children:n}):n;return d.jsxs(ln,{className:Y("highlight-section",t),children:[r&&d.jsx("div",{className:Y("highlight-container highlight-image",{[`highlight-image-${e}`]:e==="right"}),children:d.jsx(er,{image:r})}),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})})})]})},lw=C.memo(uw);const cw=({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(ke,{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})]}),dw=({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 m=a&&as(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:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})]})]})}if(c&&!i||s)return d.jsx("p",{className:"details",children:s?n.formatMessage({id:"card_bootcamp"}):Ms(c)});if(o)return d.jsx(hn,{variant:o==="free"?"subtle":"highlighted",className:o,"data-testid":"course-type",children:o});if(l||u){const m=u&&as(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:m?n.formatMessage({id:`dates_${m.path}`},{number:m.number}):0})})]})}return null},ja={communityPage:{basePath:"/communities/",className:"communityPage",gtmEvent:"community"},customCard:{className:"custom",gtmEvent:"custom",length:{text:335,secondaryText:150}},event:{basePath:"/events/",className:"event",gtmEvent:"event"},microcourse:{basePath:"/microcourses/en/",className:"course",gtmEvent:"microcourse-overview"},solutionArticle:{basePath:"/solution-articles/en/",className:"article",length:{title:60},gtmEvent:"article"},qaQuestion:{basePath:"/questions-answers/",className:"question",length:{title:190},gtmEvent:"q-and-a-question"},listPage:{basePath:"/list/en/",className:"list",gtmEvent:"list"},people:{basePath:"/profiles/",className:"people",length:{people:1e3},gtmEvent:"person"},learningHub:{basePath:"/learning-hub/",className:"learning-hub",length:{title:190},gtmEvent:"learning-hub"}},fw=({data:e,cta:t,link:n,gtmContext:r})=>{var f,y;const a=ue.useIntl(),[i,s]=C.useState({loading:!1,registered:e.registered||!1});C.useEffect(()=>{e.registered&&s(b=>({...b,registered:!0}))},[e.registered]);const{customLinkText:o,startDate:l,dateHasPassed:u,pill:c,slug:m}=e,h=e.contentType;let p="";if((f=ja[h])!=null&&f.gtmEvent&&(p=ja[h].gtmEvent),l&&u)return n?d.jsx("a",{href:n,className:"details additional-link gtm-trackable","data-gtm-event-context":`${r}-CarouselCard`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_watch"})}):null;if(h==="people")return n?d.jsx(ke,{variant:"tertiary",size:"small",href:n,className:"gtm-trackable","data-gtm-event-context":`${r}-Card-Button`,"data-gtm-event-type":`${p}-click`,children:o||a.formatMessage({id:"card_cta_people"})}):null;const g=["communityPage","microcourse","event"];if(t&&t.onClick&&g.includes(h)&&c!=="premium"){const b=i.loading||i.registered||((y=e==null?void 0:e.members)==null?void 0:y.isMember),w=async A=>{if(A.preventDefault(),A.stopPropagation(),!(b||!t||!t.onClick)){s(k=>({...k,loading:!0}));try{const k=await t.onClick(e);s(k==="success"?()=>({registered:!0,loading:!1}):E=>({...E,loading:!1}))}catch{s(E=>({...E,loading:!1}))}}};return d.jsx("p",{className:Y("cta-wrapper",{"has-member-section":e==null?void 0:e.members}),children:d.jsx(ke,{onClick:w,className:"gtm-trackable",size:"small",styling:{fullWidth:!0},disabled:b,"data-gtm-event-context":`${r}Page-${h}: ${m}`,"data-gtm-event-type":`${r}-${h}-register-click`,"data-testid":"in-card-button",children:o||a.formatMessage({id:`card_cta_${h}${b?`_${i.loading?"loading":"done"}`:""}`})})})}return null};const hw={title:66,text:3e3,secondaryText:1e3,partner:25},Co=({id:e="",card:t,buildCardData:n,cta:r,gtmContext:a="Carousel",className:i="",handleCardClick:s})=>{var R,$,M;const o=ue.useIntl(),l=C.useContext(Mt),u=l&&typeof l.id=="string",[c,m]=C.useState({data:null,isLoading:!0}),{data:h,isLoading:p}=c,g=C.useCallback(()=>{n(t,u).then(x=>{m(()=>({data:x,isLoading:!1}))}).catch(()=>m(x=>({...x,isLoading:!1})))},[e]);if(C.useEffect(()=>{g()},[]),p||!h)return d.jsx(wt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"});s&&!r&&(r={text:o.formatMessage({id:`card_cta_${t.contentType}`}),onClick:s});const{contentType:f}=h;if(!f||!ja[f])return d.jsx(wt,{element:"li",className:"card-wrapper"});const{basePath:y="",className:b,length:w,gtmEvent:A}=ja[f];let k=h.slug?`${y}${h.slug}`:!1;h.slug&&(h.slug.slice(0,4)==="http"||h.slug.slice(0,2)==="//"||h.slug.slice(0,6)==="mailto"||h.slug.slice(0,3)==="tel")&&(k=h.slug);const E=x=>{k&&(x.preventDefault(),x.stopPropagation(),window.location.href=k)},T={...hw,...w};let j={className:"card"},z={};return k&&(z={href:k,className:"gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${A}-click`,"data-testid":"link"},h.openInNewTab&&(z.target="_blank"),j={onClick:E,className:"card gtm-trackable","data-gtm-event-context":`${a}-CarouselCard`,"data-gtm-event-type":`${A}-click`}),d.jsx("li",{className:Y("card-wrapper text-medium",b,i,{"has-link":k,"no-link":!k,"has-image":h.banner}),"data-testid":`${f}-card`,children:d.jsxs("div",{...j,children:[d.jsx(Ic,{className:"card-label",contentType:f,customIcon:h.isPrivate?"lock-locked":h.customIcon,customLabel:h.customLabel}),f==="communityPage"&&(h==null?void 0:h.createdAt)&&jh(h==null?void 0:h.createdAt,60)&&d.jsx(hn,{size:"small",variant:"information","data-testid":"new-community",children:o.formatMessage({id:"card_new"})}),h.startDate&&!h.isOngoingEvent&&d.jsx(hn,{size:"small",variant:h.dateHasPassed?"default":"information","data-testid":"date",children:h.dateHasPassed?o.formatMessage({id:"card_ended"}):Oc(h.startDate)}),h.banner?d.jsxs("p",{className:"img",children:[h.registered&&d.jsx(hn,{size:"small",variant:"registered",children:o.formatMessage({id:"card_registered"})}),d.jsx(er,{image:{...h.banner,description:""}})]}):b==="people"?d.jsx(sn,{name:h.title||"",src:h.profile,"data-testid":"people-profile-picture"}):null,h.contributors&&d.jsx(qs,{contributors:{data:h.contributors},styling:{size:"small",showGap:b!=="question",showText:!0},multipleText:["event","solutionArticle"].includes(f)?o.formatMessage({id:`card_contributors_${f}`}):void 0,"data-testid":"contributors"}),h.partner&&d.jsx("p",{className:"partners","data-testid":"partners",children:h.partner.length>1?o.formatMessage({id:"card_partner"},{partner:h.partner[0],number:h.partner.length-1}):Hn(h.partner[0],T.partner)}),["title","text","secondaryText"].map(x=>{const B=h[x];if(!B)return null;const F=Bc(x),N={key:x,className:F,"data-testid":F},L={wrapper:"p",forceWrapper:!0,forceInline:!0},q=Hn(B,T[x]);return["title","text"].includes(x)&&k?(L.wrapper="a",d.jsx("p",{...N,children:d.jsx(Pt,{options:L,...z,children:q})})):d.jsx(Pt,{options:L,...N,children:q})}),(l==null?void 0:l.id)&&(h==null?void 0:h.members)&&d.jsxs("span",{className:"member-information",children:[((R=h==null?void 0:h.members)==null?void 0:R.isMember)&&d.jsx(hn,{size:"small",variant:"registered",icon:(($=h==null?void 0:h.members)==null?void 0:$.memberType)==="owner"?"user":"tick",children:o.formatMessage({id:`card_member_type_${(M=h==null?void 0:h.members)==null?void 0:M.memberType}`})}),d.jsx("br",{}),d.jsx("span",{className:"label member-count",children:o.formatMessage({id:"card_member_count"},{count:h==null?void 0:h.members.count})})]}),d.jsx(dw,{type:b||"",data:h}),d.jsx(fw,{data:h,cta:r,link:k||"",gtmContext:a})]})})};const Uf=({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(Co,{id:s,card:{...a,contentType:t[i]},...r},s)})}),mw=(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},pw=({id:e,title:t})=>{const n=ue.useIntl();if(!t||!t.text)return null;const{text:r,element:a="h2",variant:i="default",size:s="medium",link:o}=t;return C.createElement(a,{className: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 Li={fourCards:1024,threeCards:769,twoCards:480};let ea=null;const gw=({id:e,cards:t,cardTypes:n,buildCardData:r,title:a,className:i,gtmContext:s,...o})=>{const l=ue.useIntl(),[u,c]=C.useState({cardsPerPage:4,isLoading:!0}),{cardsPerPage:m,isLoading:h}=u,[p,g]=C.useState({currentPage:0,loadedPages:[0]}),{currentPage:f,loadedPages:y}=p,[b,w]=C.useState(""),A=t.length,k=Math.ceil(A/m),E=C.useRef(null),T=Jn(!0,!0,E==null?void 0:E.current);C.useEffect(()=>{let x=1;T&&(T>=Li.fourCards?x=4:T>=Li.threeCards?x=3:T>=Li.twoCards&&(x=2),x>A&&(x=A)),c(B=>({...B,cardsPerPage:x,isLoading:!1}))},[T,A]);const j=(x="next")=>{let B=f;if(typeof x=="string")if(x==="next")if(f<k-1)B=f+1;else return;else if(f>0)B=f-1;else return;else B=x;g(N=>({...N,currentPage:B,loadedPages:[...new Set([...y,B])]}));const F=()=>{const N=B*u.cardsPerPage,L=N+u.cardsPerPage;return t.slice(N,L).length};w(l.formatMessage({id:"carousel_pagination_aria_live"},{direction:x,count:F()}))},z=x=>{ea=x.touches[0].clientX},R=x=>{if(ea===null)return;const B=x.touches[0].clientX,F=ea-B;F>5?j("next"):F<-5&&j("previous"),ea=null},$={"--width":`${T||0}px`,"--total-cards":A,"--cards-per-page":m,"--page":f};if(h)return d.jsx(Ls,{layout:`carousel${a?"-with-title":""}`});const M=(x,B)=>{var N;let F=null;return(N=x==null?void 0:x.sys)!=null&&N.id?F=`card-${x.sys.id}`:x!=null&&x.slug?F=`card-${x.slug}`:[n[B],x.contentType].includes("customCard")&&(F=`card-${window.btoa(`${x.title} ${x.createdAt}`)}-${B}`),F};return d.jsxs("section",{ref:E,className:Y("carousel-wrapper",i),"data-testid":"carousel",children:[d.jsx(pw,{id:e,title:a}),d.jsx("ul",{className:"carousel",onTouchStart:z,onTouchMove:R,style:$,"data-testid":"carousel-list",children:t.map((x,B)=>{let F=M(x,B);return F&&mw(B,m,f,y)?d.jsx(Co,{id:F,card:{...x,contentType:n[B]},buildCardData:r,gtmContext:s,...o},F):(F=F||`${e}-card-${B}`,d.jsx(wt,{element:"li",className:"card-wrapper","data-testid":"card-placeholder"},F))})}),k<=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(ke,{variant:"secondary",size:"large",icon:{icon:"chevron_left"},onClick:x=>{x.preventDefault(),x.stopPropagation(),j("previous")},screenreaderText:l.formatMessage({id:"carousel_pagination_previous"}),disabled:f<=0})}),[...Array(k)].map((x,B)=>d.jsx("li",{"data-testid":"carousel-controls-button",children:d.jsx("button",{className:Y("page-indicator",{selected:B===f}),onClick:F=>{F.preventDefault(),F.stopPropagation(),j(B)},children:d.jsx(Ie,{showOnFocus:!1,children:l.formatMessage({id:"carousel_pagination_page"},{number:B+1,total:k})})})},`page-indicator-${B}`)),d.jsx("li",{className:"arrow next",children:d.jsx(ke,{variant:"secondary",size:"large",icon:{icon:"chevron_right"},onClick:x=>{x.preventDefault(),x.stopPropagation(),j("next")},screenreaderText:l.formatMessage({id:"carousel_pagination_next"}),disabled:f>=k-1})})]}),d.jsx(Ie,{"aria-live":"polite",showOnFocus:!1,children:b})]})]})},vw=({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}`,m=u===e.length-1;return t?d.jsxs(C.Fragment,{children:[d.jsx(Ls,{layout:`carousel${i?"-with-title":""}`,"data-testid":"carousel-placeholder"}),m?null:d.jsx(tn,{})]},`placeholder-${c}`):d.jsxs(C.Fragment,{children:[d.jsx(gw,{cards:o,cardTypes:l,title:n!=null&&n.hidden?{}:{...n,text:i,link:s},...a}),m?null:d.jsx(tn,{})]},`carousel-${c}`)});const ta="joinCommunityButton",xo=({isMember:e=!1,isOpen:t=!1,isShort:n=!1,disabled:r=!1,functions:{join:a,leave:i}={join:()=>{},leave:()=>{}}})=>{const s=ue.useIntl(),o=C.useContext(Mt),l=o&&typeof o.id=="string",u=r||!l,[c,m]=C.useState(e),[h,p]=C.useState(e?"joined":"notJoined");C.useEffect(()=>{h==="joining"?p("joined"):h==="leaving"&&p("notJoined")},[c]);const g={},f={};return c&&h!=="leaving"&&(g["data-hover-text"]=s.formatMessage({id:`${ta}_leave`}),g["aria-label"]=s.formatMessage({id:`${ta}_member_aria`}),f["aria-hidden"]="true"),d.jsx(ke,{variant:c?"secondary":"primary",size:"medium",styling:{fullWidth:!0},icon:c&&h!=="leaving"?{icon:"tick",position:"left"}:!1,tooltip:!t&&!c?s.formatMessage({id:`${ta}_closed_tooltip`}):"",onClick:async y=>{u||(y.currentTarget.blur(),c?(p("leaving"),typeof i=="function"&&await i()):(p("joining"),typeof a=="function"&&await a()),m(!c))},className:Y("join-community-button",h,{active:h==="joining"}),disabled:u,...g,children:d.jsx("span",{className:"text",...f,children:s.formatMessage({id:`${ta}${["joining","leaving"].includes(h)?`_${h}`:c?"_member":n?"_short":""}`})})})};const zi="communityDetails_",bw=({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,m=i.length?i:Array(u).fill({}),h=`/communities/${r}/members`===window.location.pathname,p=t||n,g=!n&&!t;return d.jsxs("div",{className:Y("community-details",e),children:[p&&d.jsxs("div",{className:"member-details",children:[d.jsxs("div",{className:"top",children:[d.jsxs("h4",{children:[l.formatMessage({id:`${zi}members`}),d.jsx("span",{className:"count",children:c})]}),!h&&d.jsx("p",{className:"text-small",children:d.jsx("a",{href:`/communities/${r}/members`,children:l.formatMessage({id:`${zi}viewAll`})})})]}),d.jsx(qs,{contributors:{total:a,data:m},styling:{size:"medium",showGap:!0,showPlaceholders:c===0},cutoff:u})]}),d.jsx(xo,{isMember:t,isOpen:n,disabled:g,functions:{...o}}),t&&d.jsx(ke,{variant:"primary",onClick:s,icon:{icon:"plus"},styling:{fullWidth:!0},children:l.formatMessage({id:`${zi}invite`})})]})};const yw=({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(_n,{href:s?void 0:i,...l,children:Hn(a,t)})]},`${window.btoa(a)}_${o}`)})})]})};const Dw=({options:e,allOption:t=!1,allowMultiple:n=!0,onChange:r=()=>{},className:a=""})=>{const i=ue.useIntl(),s=t?[{id:"all",text:typeof t!="boolean"&&t.text||i.formatMessage({id:"filters_all"})},...e]:e,[o,l]=C.useState(t?["all"]:[]),u=(c,m)=>{let h=[];o.includes(c)?h=o.filter(p=>p!==c):c==="all"?h=["all"]:n?h=[...o.filter(p=>p!=="all"),c]:h=[c],l(p=>(r&&typeof r=="function"&&r({current:h,previous:p}),h)),m&&typeof m=="function"&&m()};return d.jsx("ul",{className:Y("filters",a),children:s.map(({id:c,text:m,disabled:h=!1,callback:p=()=>{}})=>{let g={};return h&&(g={disabled:!0,"aria-label":i.formatMessage({id:"filters_disabled"},{name:m})}),d.jsx("li",{children:d.jsx("button",{className:Y(c,{selected:o.includes(c)}),onClick:f=>{f.preventDefault(),f.stopPropagation(),u(c,p)},...g,children:m})},c)})})},Cw=(e,t,n)=>{const r=String(e);if(!n||!n.length)return t?`/${r}/${t}`:`/${r}`;let a="",i=!1;return n.forEach(({url:s,position:o})=>{o==="before-lang"?(a+=`/${s}`,i=!0):(a.includes(`/${r}/`)||(a+=`/${r}`),a+=`/${s}`)}),a.includes(`/${r}/`)||(a+=`/${r}`),t&&(a+=`/${t}`),i?{url:a,urlForRouter:`/${a.split("/").slice(2).join("/")}`}:a};const na="languageSwitcher_",xw=({currentLanguage:e,isOriginalLanguage:t=!1,isHumanTranslation:n=!1,translations:r,onChange:a,urlParts:i,variant:s="default",label:o,className:l=""})=>{const u=ue.useIntl(),{updateLanguage:c=()=>{}}=C.useContext(bo),[m,h]=C.useState(e);if(C.useEffect(()=>{e!==m&&h(e)},[e]),!r||!Object.values(r).some(y=>y&&y.post_name))return null;const g=Object.keys(r),f=m!==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:`${na}label`})}),d.jsx("ul",{children:g.map(y=>{var A;if(!ga[y])return null;const b=(A=r[y])==null?void 0:A.post_name;let w={className:y};if(m===y)w["aria-label"]=u.formatMessage({id:`${na}selected`},{language:ga[y]});else{const k=Cw(y,b,i);w={...w,href:typeof k=="string"?k:k.url,onClick:E=>{h(y),c(y),typeof a<"u"&&(E.preventDefault(),E.stopPropagation(),a(y,typeof k=="string"?k:k.urlForRouter))}}}return d.jsx("li",{children:d.jsx(_n,{...w,fallbackElement:"span",children:ga[y]})},y)})}),s!=="short"&&!f&&d.jsx("p",{children:u.formatMessage({id:`${na}translation_${t?"original":n?"human":"machine"}`})})]}),s!=="short"&&!f&&!t&&!n&&d.jsx("small",{children:u.formatMessage({id:`${na}disclaimer`},{email:Nn.support,link:y=>{const b=`mailto:${y}`;return d.jsx("a",{href:b,children:y})}})})]})};const qi=ue.createIntl({locale:"en",messages:Xn}),Nr=({hasNextPage:e=!0,loadNextPage:t=()=>{},isLoading:n=!1,variant:r="secondary",size:a="medium",styling:i={muted:!1,fullWidth:!1},icon:s=!1,messages:o={button:qi.formatMessage({id:"loadMore_button"}),endOfFeed:qi.formatMessage({id:"loadMore_endOfFeed"}),error:qi.formatMessage({id:"loadMore_error"})},className:l="",gtmContext:u="LoadMore"})=>{const[c,m]=C.useState(""),h=async p=>{if(!n)try{await t(p)}catch(g){g instanceof Error?m(g.message):m("Unknown error")}};return!c&&!e&&!o.endOfFeed?null:d.jsx("footer",{className:Y("load-more",l),children:!c&&e?d.jsx(ke,{variant:r,size:a,styling:i,icon:s,onClick:h,"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 wo=({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 ra=!1;const Vf=({element:e="div",id:t="more-menu",options:n,className:r=""})=>{const a=ue.useIntl(),i=C.useRef(null),[s,o]=C.useState(!1),l=u=>{i.current&&u.target instanceof HTMLElement&&!i.current.contains(u.target)&&o(!1)};return C.useEffect(()=>(document.addEventListener("click",l,!0),()=>{document.removeEventListener("click",l,!0)})),C.createElement(e,{ref:i,className:Y("more-menu text-medium",r),children:d.jsxs(d.Fragment,{children:[d.jsx(ke,{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:m,icon:h,...p},g)=>{const f={...p,onClick:y=>{o(!1),typeof c=="function"&&c(y)},onFocus:()=>{ra&&(clearTimeout(ra),ra=!1)},onBlur:()=>{ra=setTimeout(()=>{o(!1)},100)}};return u&&(f.href=u),d.jsx("li",{className:"more-menu-list-item",children:d.jsx(ke,{variant:"tertiary",size:"medium",icon:h?{icon:h,position:"left"}:!1,...f,children:m})},`${window.btoa(m)}_${g}`)})})]})})},ww=(e,t=!1)=>t?e.replaceAll("/","")===t:typeof window<"u"&&window.location&&window.location.pathname===e;const Ew=[{key:"homepage",href:"/home/"},{key:"events",href:"/events/"},{key:"microcourses",href:"/microcourses/"},{key:"articles",href:"/solution-articles/"},{key:"communities",href:"/communities/"}],Kf=({activeLink:e})=>{const t=ue.useIntl(),n=C.useContext(Mt),r=n&&typeof n.id=="string";return d.jsxs("ul",{id:"navigation-menu",className:"text-medium",children:[Ew.map(({key:a,href:i})=>{const s=ww(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(sn,{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}`:""}`,kw=({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}
|
|
158
158
|
|
|
159
|
-
${cr(t,"mailto",n)}&src=email`)}`},{key:"clipboard-copy",icon:"share_copy-link",url:cr(t,"copy",n),shouldRender:()=>navigator&&navigator.clipboard&&navigator.clipboard.writeText,onClick:(r,a)=>(r.preventDefault(),r.stopPropagation(),navigator.clipboard.writeText(a))}];const hw="shareLinks_",mw=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=oe.useIntl(),l=fw({title:e,link:t,referrer:n});return d.jsxs("aside",{className:Z("share-links",a,i,s),children:[d.jsx("p",{className:"text-small",children:o.formatMessage({id:"shareLinks_label"})}),d.jsx("ul",{children:l.map(({key:u,icon:c,url:f,shouldRender:m=!0,onClick:p})=>{if(typeof m=="function"&&!m())return null;const g={};return p&&(g.onClick=h=>p(h,f)),d.jsx("li",{children:d.jsx(Ee,{size:a,variant:"tertiary",icon:{icon:c||u},href:f,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${hw}link_${u}`}),...g})},u)})})]})};const pw=({tabs:e,className:t="",preventLocationChange:n})=>{var u;const r=(c,f,m)=>(c||(c=`panel-${window.btoa(f)}-${m}`),c);let a=e.findIndex(c=>c.current===!0);if(a<0&&(a=0),window.location.hash){const c=window.location.hash.replace("#","");if(e.find(m=>m.id===c)){for(let m=0;m<e.length;m++)if(r(e[m].id,e[m].text,m)===c){a=m;break}}}const[i,s]=C.useState((u=e[a])!=null&&u.id?e[a].id:r(e[a].id,e[a].text,a));C.useEffect(()=>{if(e[a].hasCarousel){const c=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(c)}},[i]);const o=[],l=[];return e.forEach(({id:c,text:f,content:m,href:p,hasCarousel:g},h)=>{c=r(c,f,h);const y=i===c,v={};p||(v["aria-controls"]=c,v.onClick=w=>{w.preventDefault(),w.stopPropagation(),s(c),!n&&(window.location.hash=`#${c}`)},l.push(d.jsx("section",{id:c,hidden:!y,role:"tabpanel","aria-labelledby":`tab-${c}`,"aria-live":y?"assertive":"off",children:typeof m=="string"?d.jsx("p",{children:m}):m},`section-${c}`))),o.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:p||`#${c}`,id:`tab-${c}`,className:Z({selected:y}),role:"tab","aria-selected":y,...v,children:f})},`tab-${c}`))}),d.jsxs("div",{className:Z("tabs-wrapper",t),children:[d.jsx("ul",{className:"tabs",role:"tablist",children:o}),d.jsx("div",{className:"tab-content",children:l})]})};const gw={"2-1":901,"1-3":769,"1-1":769},Mf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Qn(!0);let s=a;return C.Children.count(a)===1&&(s=C.Children.toArray(a)[0],s.props&&(s=s.props.children)),d.jsx("section",{className:Z("columns",`layout-${e}`,r,{"has-containers":n}),children:C.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<gw[e]?null:o)})};let qi;const Wi="contactFooter_",vw=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=C.useRef(null),[r,a]=C.useState(0),[i,s]=C.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(qi),qi=setTimeout(()=>{o(),s(!1)},500))};return C.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(qi),window.removeEventListener("resize",l)}),[]),d.jsx(un,{id:"contactForm",className:"contact-footer",children:d.jsxs("div",{className:"inner-wrapper",children:[d.jsx("h2",{children:d.jsx(oe.FormattedMessage,{id:`${Wi}title`})}),d.jsxs("div",{className:"content-wrapper",ref:n,"data-testid":"content-wrapper",style:i?{}:{minHeight:r},children:[d.jsxs("aside",{children:[d.jsx("p",{children:d.jsx(oe.FormattedMessage,{id:`${Wi}text`})}),d.jsx(kn,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(oe.FormattedMessage,{id:`${Wi}email`})})]}),d.jsx(ff,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},bw=({activeLink:e,...t})=>d.jsx(un,{children:d.jsx(Mf,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(Rf,{activeLink:e}),d.jsx(Pc,{...t})]})})});const Hi="cookieBanner_",Ui=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Vi=new Date(Date.now()+12*30*24*60*60*1e3),If=()=>{const e=oe.useIntl(),[t,n,r]=Ts.useCookies(Ui),[a,i]=C.useState(!t["apol-cookie-banner"]),s=()=>{Ui.forEach(c=>{n(c,!0,{path:"/",expires:Vi,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Vi}),Ui.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:Vi});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:`${Hi}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${Hi}title`})}),d.jsx("p",{children:e.formatMessage({id:`${Hi}text`})}),d.jsx(En,{buttons:u})]})},zt={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Pn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Pn["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:Pn.support,gtmType:"concierge-email-click"},business:{email:Pn.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 Ln="footer_",Oa="SiteFooter",tc=({group:e})=>{const t=zt[e].order||[];let n=!1;return"text"in zt[e]&&(n=zt[e].text),d.jsxs(C.Fragment,{children:[d.jsx("p",{className:"pre-title",children:d.jsx(oe.FormattedMessage,{id:`${Ln}${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}=zt[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),d.jsx("li",{children:d.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":i,...s,children:d.jsx(oe.FormattedMessage,{id:`${Ln}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&d.jsx("dl",{className:"text-medium",children:n.order.map(r=>d.jsxs(C.Fragment,{children:[d.jsx("dt",{children:d.jsx(oe.FormattedMessage,{id:`${Ln}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(oe.FormattedMessage,{id:`${Ln}${e}_${r}_address`,values:{br:d.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&d.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},yo=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx($a,{element:"hr"}),d.jsx(bo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":"logo-homepage-link"}),d.jsx("footer",{children:["platform","community","company","contact"].map(e=>d.jsxs("div",{className:"group",children:[d.jsx(tc,{group:e}),Object.keys(zt[e]).includes("child")&&d.jsx(tc,{group:zt[e].child})]},e))}),d.jsx("hr",{}),d.jsxs("div",{className:"sub-footer",children:[d.jsx("ul",{children:Array.isArray(zt.social.order)&&zt.social.order.map(e=>{const t=zt.social[e];return d.jsx("li",{className:e,children:d.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(oe.FormattedMessage,{id:`${Ln}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(oe.FormattedMessage,{id:`${Ln}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Pe={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e==="account"&&t===!1&&n.navigation===!0)return;const i=Date.now();if(!a&&!t&&Pe.handlerCalled[e]&&i-Pe.handlerCalled[e]<500)return;Pe.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case"navigation":o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation > li.parent"));break;case"search":o=document.querySelector("#header .toggle-search-button");break;case"account":o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=hc(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?Pe.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case"navigation":if(n){const u=Pe.findFirstChild(t.current.children,"attributes.aria-controls","navigation");s=Pe.findFirstChild(u.children,"href")}else s=Pe.findFirstChild(t.current.children,"href");break;case"account":if(o=Pe.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Pe.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(Pe.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Pe.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Pe.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Pe.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Tr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},Pa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=oe.useIntl(),o=hc(Tr,e);if(!o||o.onlyShow&&(o.onlyShow==="logged-in"&&!t||o.onlyShow==="logged-out"&&t))return null;const l="doTrack"in o,u=i===null?l?o.doTrack:!0:i,c=e.includes("buttons.");let f=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(f+=`_logged${t?"In":"Out"}`);let m=!1;if(o.href){let w=o.gtmType||`${e}-click`;if(w.includes(".")){const A=w.split("."),E=A[A.length-2];w=`${E==="topics"?`${E}-`:""}${A[A.length-1]}`}m={href:o.href},u&&(m={...m,className:"gtm-trackable","data-gtm-event-type":w,"data-gtm-event-context":"HeaderButtons"}),c&&(m={...m,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],g=p&&o[o.order[0]].order,h=m&&window.location.pathname===o.href;let y={},v={};if(h&&(y={...y,"aria-current":"page"}),p){const w=o.menuId||e,A={onClick:E=>Pe.events.onClick(E,{id:w,callback:a,isOpen:r[w]}),onFocus:()=>Pe.events.onFocus({id:w}),onBlur:()=>Pe.events.onBlur({id:w,callback:a}),onMouseLeave:()=>Pe.events.onBlur({id:w,callback:a}),onMouseEnter:()=>Pe.events.onMouseEnter({id:w,callback:a})};n&&(g&&(y={...A,onKeyPress:E=>{E.key==="Enter"&&Pe.events.onClick(E,{id:w,callback:a,isOpen:r[w]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[w],"aria-controls":w}),v={hidden:w in r?!r[w]:!0}),g||(v={...v,...A})}return d.jsxs("li",{className:Z({[o.className]:o.className,"has-submenu":p,parent:g,active:h}),...y,children:[m?C.createElement(c?Ee:"a",m,s.formatMessage({id:f})):s.formatMessage({id:f}),o.order&&d.jsx("ul",{...v,children:o.order.map(w=>{if(!o[w])return null;const A={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[w].order?d.jsxs("li",{className:Z({[o[w].className]:o[w].className}),children:[s.formatMessage({id:`${f}_${w}`}),d.jsx("ul",{children:o[w].order.map(E=>d.jsx(Pa,{id:`${e}.${w}.${E}`,...A},E))})]},w):d.jsx(Pa,{id:`${e}.${w}`,...A},w)})})]},e)};const yw={height:67,height_desktop:83},Do=({showNavigation:e=!0})=>{const t=oe.useIntl(),n=C.useContext(Rt),r=Qn(!0,!0),a=n&&typeof n.id=="string",i=C.useMemo(()=>Pe.getIsDesktopVersion(a,r),[a,r]),[s,o]=C.useReducer(Sr,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:c}=s,f=C.useRef(s);C.useEffect(()=>{f.current=s},[s]),bc({scrollPosition:yw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const h=f.current.menus;!i&&h.navigation||Pe.shouldChangeHeaderIsVisible(!0,h,o)},scrollDown:()=>{const h=f.current.menus;!i&&h.navigation||Pe.shouldChangeHeaderIsVisible(!1,h,o)}}});const m=(h,y,v=!1)=>{Pe.handleMenus({id:h,value:y,menus:f.current.menus,dispatch:o,forceHandle:v})},p=C.useRef(null),g=h=>{h.key==="Escape"&&["navigation","search","account"].forEach(y=>{f.current.menus[y]&&m(y,!1,!0)})};return C.useEffect(()=>{var h;return(h=document.getElementById("header"))==null||h.addEventListener("keydown",g),()=>{var y;(y=document.getElementById("header"))==null||y.removeEventListener("keydown",g)}},[]),Hn(()=>{u.navigation&&Pe.autoFocus({menu:"navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.navigation]),Hn(()=>{u.account&&Pe.autoFocus({menu:"account",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.account]),n&&n.isLoading?null:d.jsxs(d.Fragment,{children:[d.jsxs("nav",{id:"header",className:Z({"logged-in":a,"logged-out":!a,visible:l}),children:[d.jsx(Ie,{element:"a",href:"#content-of-page",children:t.formatMessage({id:"header_skip"})}),d.jsx(bo,{variant:"monochrome"}),e&&d.jsxs(d.Fragment,{children:[!i.navigation&&d.jsx("button",{className:"menu-button gtm-trackable",onClick:h=>{h.preventDefault(),h.stopPropagation(),m("navigation",!u.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u.navigation,"aria-controls":"navigation",children:d.jsx(Ie,{children:t.formatMessage({id:`header_menu_${u.navigation?"hide":"show"}`})})}),d.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||u.account?!1:!u.navigation,"data-showing":!i.navigation&&u.account?"account":"default",children:Tr.order.map(h=>d.jsx(Pa,{id:h,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{navigation:u.navigation,account:u.account},callback:m},h))}),!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:h=>{h.preventDefault(),h.stopPropagation(),m("search",!u.search)},"aria-haspopup":"true","aria-expanded":u.search,"aria-controls":"search-form",children:d.jsx(Ie,{children:t.formatMessage({id:`header_search_${u.search?"hide":"show"}`})})}),d.jsx(mf,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),a?d.jsxs("button",{className:"account-button",onClick:h=>Pe.events.onClick(h,{id:"account",callback:m,isOpen:u.account}),onMouseEnter:()=>Pe.events.onMouseEnter({id:"account",callback:m}),onMouseLeave:()=>Pe.events.onBlur({id:"account",callback:m}),"aria-haspopup":"true","aria-expanded":u.account,"aria-controls":"navigation",children:[d.jsx(Ie,{children:t.formatMessage({id:`header_account_${u.account?"hide":"show"}`})}),d.jsx(an,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):d.jsx("ul",{className:"sign-in-buttons",children:Tr.buttons.order.map(h=>d.jsx(Pa,{id:`buttons.${h}`},h))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:Z("overlay",{open:u.navigation||u.account||!i.search&&u.search})})]})};const Dw=()=>{const e=oe.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(Do,{}),d.jsx("div",{id:"content",children:d.jsx(rn,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(yo,{})]})},$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:c="default",variant:f="default",circle:m="default",modal:p="default"}=i,g=gc();C.useEffect(()=>{window.scrollTo(0,0)},[g]);const h=oa(e,{locale:o}),y=oa(t,{locale:o}),v=oa(n,{locale:o}),w={};return c!=="default"&&(w[c]=!0),f!=="default"&&(w[f]=!0),m!=="default"&&(w[m]=!0),d.jsx(dh.ErrorBoundary,{onError:r,fallback:d.jsx(Dw,{}),children:d.jsx(C.Suspense,{fallback:null,children:d.jsxs("div",{id:"wrapper",className:Z(s,w,{"has-footer":u}),children:[d.jsx(Do,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[y&&d.jsx("div",{className:Z("additional-content prepended",{"large-modal":p==="large"}),children:y}),C.createElement(c==="bold"?po:"div",{id:"content",children:h,className:Z({"large-modal":p==="large"})})]}),v&&d.jsx("div",{className:"additional-content appended",children:v}),u&&d.jsx(yo,{}),d.jsx(If,{})]})})})},nc={default:"tags_",headerTopics:"header_topics_topics_"},Ki={topic:{Climate:"climate",CitiesAndLocalGovernment:"cities-and-local-government",DigitalAndData:"digital-and-data",Education:"education",EquityJusticeAndInclusion:"equity-justice-and-inclusion",HealthAndSocialCare:"health-and-social-care",Innovation:"innovation",LeadershipAndSkills:"leadership-and-skills",LifeInGovernment:"life-in-government",Policymaking:"policymaking",TransportAndInfrastructure:"transport-and-infrastructure",WorkAndTheEconomy:"work-and-the-economy"},"from the community":"community"},Cw={getTagDetails:e=>{if(e.includes("topic_")){if(e=Ki.topic[e.replace("topic_","")],e){const t=Tr.topics.topics[e].href;return t?{id:e,href:t,text:`${nc.headerTopics}${e}`}:null}return null}return Ki[e]?(e=Ki[e],{id:e,text:`${nc.default}${e}`}):null}};const xw=({tags:e=[],color:t="default",forceOneLine:n=!1,canHaveLinks:r=!0,className:a="",gtmType:i="tag-click",gtmContext:s="tags"})=>{const o=oe.useIntl();if(!e||e.length<1)return null;const l=[];return e.forEach(u=>{if(!u)return;const c=Cw.getTagDetails(u);c&&l.push(c)}),l.length<1?null:d.jsx("ul",{className:Z("tags text-small",t,a,{"one-line":n}),children:l.map(u=>{const c=o.formatMessage({id:u.text});return d.jsx("li",{children:u.href&&r?d.jsx("a",{href:u.href,className:"gtm-trackable","data-gtm-event-type":i,"data-gtm-event-context":s,children:c}):c},u.id)})})};const ww=({members:{data:e=[],total:t=e.length},hasNextPage:n=!1,loadNextPage:r=()=>{},gtmContext:a="member",gtmType:i="member-click",className:s=""})=>{const o=oe.useIntl();return e.length===0?null:d.jsxs("div",{className:Z("members-list",s),children:[d.jsxs("h1",{children:[o.formatMessage({id:"membersList"}),d.jsx("span",{className:"count",children:t})]}),d.jsx("ul",{children:e.map((l,u)=>d.jsxs("li",{children:[d.jsx(jr,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(fn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx(Nr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const Ew=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=oe.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=s;return C.createElement(e,{className:Z("course-progression",o,{"highlight-percentage":c,"has-circle-graph":i==="circle"}),children:d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"percentage",children:l.formatMessage({id:"courseProgression_done"},{percent:f=>d.jsx("strong",{children:f}),number:u})}),u<100&&a&&d.jsx(Qa,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx(Ps,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Lf=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>C.createElement(e,{className:Z("lesson-name",a),"data-number":`${t}.${n}`,children:r});const zf=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=oe.useIntl(),o=La(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):wc(a||"");return d.jsxs("small",{className:Z("content-type",{[e]:e!=="default"}),children:[d.jsx("span",{className:Z("type",n),children:o})," ",t>0&&!r&&d.jsx(Qa,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const kw=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const f=oe.useIntl(),m="courseStructure_",p=u.toLowerCase().includes("course conclusion");return d.jsxs(za,{className:"course-structure",label:d.jsxs(d.Fragment,{children:[d.jsxs("small",{children:[f.formatMessage({id:`${m}section${p?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?f.formatMessage({id:`${m}time_completed`}):d.jsx(Qa,{time:s,appendedText:a?f.formatMessage({id:`${m}time_left`}):""})})]}),d.jsx("h3",{children:u})]}),shouldAnimate:!0,children:[d.jsx("p",{children:n}),d.jsx("ol",{children:e&&e.length>0&&e.map(({completed:g,completionTime:h,contentType:y,icon:v,image:w,isIntroduction:A,optional:E,slug:k,subsectionId:F,title:S,type:L})=>{const I=a&&t||A,N={};return w&&(N.style={"--image":`url(${w})`}),d.jsx("li",{className:Z({article:y===dr.ARTICLE,discussion:y===dr.DISCUSSION,quiz:y===dr.QUIZ,completed:g&&y===dr.ARTICLE,locked:!I}),...N,children:d.jsx(kn,{href:I?`/microcourses/en/${o}/${k}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${xc(S)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(Lf,{sectionId:i,subsectionId:F,title:S,className:"course-title"})," ",d.jsx(zf,{completionTime:h,icon:v,optional:E,type:L,children:c&&c[k]&&d.jsx("span",{className:"quiz-score",children:`${c[k]}%`})})]})})},k)})})]})};const _w=({isComplete:e=!1,onClick:t,...n})=>{const r=oe.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),d.jsx(Ee,{...n,variant:"tertiary",icon:e?{icon:"check-inside-circle_no-overlap_inverted"}:{icon:"check-inside-circle_no-overlap",hover:"check-inside-circle_no-overlap_inverted"},onClick:t,className:Z("mark-complete-button center gtm-trackable",{completed:e}),"data-gtm-event-type":"mark-as-complete",disabled:e,children:r.formatMessage({id:`markCompleteButton${e?"_completed":""}`})})};let aa=null;const ut="discussion_form_",Ja=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},placeholder:a,maxLength:i=0,forceShow:s={cancel:!1,error:!1},functions:o={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},props:{create:{projectNames:["questions-answers"]}}},gtmContext:l="DiscussionForm"})=>{var L,I,N;const u=oe.useIntl(),c=C.useContext(Rt),[f,m]=C.useState(r.isEditing&&r.isEditing.text||""),[p,g]=C.useState(s.error||!1),[h,y]=C.useState(!1);if(r.isLoading)return d.jsx(wt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const v=M=>{m(M);let x;!c||!c.id?x=Ft(u.formatMessage,`${ut}error_loggedOut`,t.type,"action"):n?i>0&&M.length>=i&&(x=`${ut}error_tooLong`):x=Ft(u.formatMessage,`${ut}error_noPermission`,t.type,"action"),x?g(x):p&&g(!1)};let w=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const M=((L=t.slugs)==null?void 0:L.reply)||((I=t.slugs)==null?void 0:I.answer)||((N=t.slugs)==null?void 0:N.question)||"";M&&(w=`${w}-${M.slice(-15)}`)}e&&(w=`${e}-${w}`);const A=async M=>{var _;if(M.preventDefault(),M.stopPropagation(),!c||!c.id||!n||k)return;aa&&clearTimeout(aa),y("submitting");const x=window.location.pathname;try{let j;switch(t.type){case"post":j=await o.create({content:f});break;case"question":j=await o.create({title:f,authorId:c&&c.id,...(_=o.props)==null?void 0:_.create});break;case"response":j=await o.create({questionSlug:t.slugs.question},{body:f,authorId:c&&c.id,contentPath:x});break;case"reply":j=await o.create({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:f,authorId:c&&c.id,contentPath:x});break;default:break}await xh(1e3),o.callback&&await o.callback(j),aa=setTimeout(()=>{m(""),y("submitted");const R=new Event("discussionFormSubmitted");document.dispatchEvent(R),E()},500)}catch(j){const R=j;let q=`${ut}error`;R!=null&&R.message.includes("entry already exists")&&(q=Ft(u.formatMessage,`${ut}error_alreadyExists`,t.type,"action")),R!=null&&R.message.includes("429")?q=Ft(u.formatMessage,`${ut}error_tooMany`,t.type,"action"):R!=null&&R.message.includes("400")&&(q=`${ut}error`),g(q),E()}},E=()=>{aa=setTimeout(()=>{g(!1),y(!1)},5e3)},k=!f||!Fh(f),F=h==="submitting",S=[];return(r.isEditing&&!F||s.cancel)&&S.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!s.cancel&&(!c||!c.id||!f),children:u.formatMessage({id:`${ut}cancel`})}),S.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:M=>{if(r.isEditing){y("submitting"),o.handleSaveEdit&&o.handleSaveEdit(f);return}A(M)},className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":`${r.isEditing?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:!c||!c.id||!n||k||F||r.isEditing&&f===r.isEditing.text,children:u.formatMessage({id:`${ut}${F?r.isEditing?"saving":"posting":r.isEditing?"save":"post"}`})}),d.jsxs("form",{id:w,className:Z("discussion-card discussion-form",{"no-styling":r.isInWrapper&&r.isEditing}),"data-testid":`discussion-${t.type}-form`,children:[(r==null?void 0:r.showTitle)&&!r.isEditing&&["question"].includes(t.type)&&d.jsx("h2",{children:Ft(u.formatMessage,`${ut}title`,t.type,"action")}),d.jsx(jr,{member:c||"community",gtmContext:l,gtmType:"profile-click"}),d.jsx(Ie,{element:"label",showOnFocus:!1,htmlFor:`${w}-input`,children:Ft(u.formatMessage,`${ut}label`,t.type,"action")}),d.jsx(df,{id:`${w}-input`,value:h==="submitting"&&!p?"":f,placeholder:a||Ft(u.formatMessage,`${ut}placeholder`,t.type,"action"),maxLength:i,functions:{onChange:v},autoFocus:!!r.isEditing,"aria-invalid":!!p,"aria-errormessage":"error-message"}),d.jsx("small",{children:Ft(u.formatMessage,`${ut}explainer`,t.type,"action",{a:M=>d.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":l,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:M})})}),d.jsx(En,{buttons:S}),h==="submitted"&&r.showSuccessMessage&&d.jsx(xr,{className:"success","data-testid":"success",children:Ft(u.formatMessage,`${ut}success`,t.type,"action")}),p&&d.jsx(xr,{id:"error-message",className:"error","data-testid":"error",children:s.error?s.error:typeof p=="string"?p.includes(" ")?p:u.formatMessage({id:p},{action:u.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):p})]})},Co=({form:e,membershipRequiredToPost:{isMember:t,required:n,join:r,leave:a,notMemberStateText:i}})=>{if(n&&!t)return d.jsx(rn,{text:i,button:{breakpoints:{mobile:!0,901:!1},component:d.jsx(vo,{isShort:!0,functions:{join:r,leave:a}})}});const{content:s,functions:o,meta:l,...u}=e;return d.jsx(Ja,{content:{type:(s==null?void 0:s.type)||"reply",slugs:(s==null?void 0:s.slugs)||{}},functions:{...o,create:(o==null?void 0:o.create)||(()=>{})},meta:{...l,isEditing:(l==null?void 0:l.isEditing)||!1,showSuccessMessage:!1},...u,id:`add-post-${u.id||""}`})},Bw={showForm:!1},Xa=C.createContext(Bw),qf=({children:e})=>{const[t,n]=C.useState({showForm:!1});return d.jsx(Xa.Provider,{value:{...t,updateConversation:n},children:e})},Aw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),Fw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Na=({icon:e,...t})=>d.jsx(Ee,{className:"discussion-button",variant:"tertiary",icon:e,...t});let Cr=!1;const Zi=()=>{Cr!==!1&&(clearTimeout(Cr),Cr=!1)},Yi=5;let Gi=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=oe.useIntl(),c={numberOfLikes:t,userLikedContent:a,ignoreInteractions:!1,showLikers:!1,tabbableLink:0},[f,m]=C.useReducer(Sr,c),{numberOfLikes:p,userLikedContent:g,ignoreInteractions:h,showLikers:y,tabbableLink:v}=f;C.useEffect(()=>{m([{type:"userLikedContent",value:a}])},[a]);const w=C.useMemo(()=>Fw(n,Yi),[n]),A=S=>{if(S.preventDefault(),S.stopPropagation(),m([{type:"showLikers",value:!1}]),Cr)return Zi(),!1;if(Zi(),h||!s)return!1;Cr=setTimeout(E,350)},E=async()=>{if(Zi(),h||!s)return!1;let S=g?p-1:p+1;S<0&&(S=0),m([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:S},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const L=Aw(i.slugs);g?await l(L):await o({...L,payload:{contentPath:window.location.pathname}})}}catch{m([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{m([{type:"ignoreInteractions",value:!1}])}},k=()=>{Gi=setTimeout(()=>{m([{type:"showLikers",value:!1}])},500)},F=()=>{Gi&&clearTimeout(Gi)};return C.createElement(e,{className:"likes-wrapper",onKeyDown:S=>{S.key==="Escape"&&m([{type:"showLikers",value:!1}])},onMouseEnter:()=>{F(),m([{type:"showLikers",value:!0}])},onMouseLeave:()=>{k()}},d.jsxs(d.Fragment,{children:[d.jsx(Na,{className:Z("discussion-button text-medium action-button",{"show-spinner":h,"is-liked":g,disabled:!s}),icon:{icon:g?"heart":"heart_empty",animate:"bounce"},disabled:!s,"data-testid":"like-button","data-gtm-event-context":"Likes","data-gtm-event-type":`like-${i.type}-click`,onClick:A,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:p})})}),n&&d.jsxs(d.Fragment,{children:[d.jsx(Ie,{element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{F()},onBlur:()=>k,onClick:S=>{var I;S.preventDefault(),S.stopPropagation(),F(),m([{type:"showLikers",value:!0}]);const L=(I=S.currentTarget.nextSibling)==null?void 0:I.childNodes[0];if(L){const N=L.querySelector("li:first-child a");N&&(m([{type:"tabbableLink",value:0}]),setTimeout(()=>{N.focus()},100))}},onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),k())},"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(wn,{id:`likes-tooltip-${i.slug}`,isOpen:y,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[w.map((S,L)=>{if(typeof S=="string"||!S.name)return null;const I={};return v!==L&&(I.tabIndex=-1),d.jsx("li",{"data-index":L,children:d.jsx(kn,{href:S.id?`/profiles/${S.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:N=>N==null?void 0:N.stopPropagation(),onFocus:()=>F(),onKeyDown:N=>{var R,q,V,ue;if(!N||!["ArrowUp","ArrowDown"].includes(N.key||""))return;N.stopPropagation(),N.preventDefault();const M=N.key==="ArrowUp"?"up":"down",x=(R=N.currentTarget)==null?void 0:R.parentElement;let _=x==null?void 0:x.nextElementSibling;if(M==="up"){const ne=x==null?void 0:x.previousElementSibling;ne?_=ne:(_=(q=x==null?void 0:x.parentElement)==null?void 0:q.lastElementChild,(_==null?void 0:_.getAttribute("data-index"))==="-1"&&(_=_==null?void 0:_.previousElementSibling))}else(!_||(_==null?void 0:_.getAttribute("data-index"))==="-1")&&(_=(V=x==null?void 0:x.parentElement)==null?void 0:V.firstElementChild);if(!_)return;const j=(_==null?void 0:_.getAttribute("data-index"))||"0";m([{type:"tabbableLink",value:j}]),(ue=_==null?void 0:_.querySelector("a"))==null||ue.focus()},...I,children:S.name})},S.id||window.btoa(S.name))}),t>Yi&&d.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Yi})})]})})]})]}))},rc=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},ei=(e,t)=>e&&!t,Qi=({children:e,class:t,...n})=>{const r={...n,class:Z("subtle",t)};return d.jsx("blockquote",{...r,children:e})},Tw=/@{{([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})}}/g,Sw=280,jw=(e,t,n)=>{let r=t?Wn(e,Sw):e;return r=r.trim(),n&&(r=r.replace(Tw,(a,i)=>{const s=n[i];return s?`<a href="/profiles/${s.id}" class="mentioned-user">@${s.data.name}</a>`:a})),r};const Ow=3e3,Pw=({url:e})=>{const t=oe.useIntl(),[n,r]=C.useState({isOpen:!1,isCopied:!1});return d.jsxs("li",{children:[d.jsx(wn,{className:Z("tooltip-share-link",{"tooltip-share-link-copied":n.isCopied}),isOpen:n.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.isCopied?t.formatMessage({id:"discussion_share_copy_link_success"}):t.formatMessage({id:"discussion_share_copy_link"})}),d.jsx(Na,{icon:{icon:"link_chain"},onMouseOver:()=>r({...n,isOpen:!0}),onFocus:()=>r({...n,isOpen:!0}),onMouseOut:()=>r({isOpen:!1,isCopied:!1}),onBlur:()=>r({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{r({isOpen:!0,isCopied:!0}),setTimeout(()=>{r({isOpen:!1,isCopied:!1})},Ow)})}})]})},Lt="discussion_",Nw=195,Rr=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,forceHide:i={actionBar:!1,comments:!1,likes:!1},functions:{content:{createContent:s,deleteContent:o,updateContent:l}={createContent:async()=>{},deleteContent:async()=>{},updateContent:async()=>{}},likes:{createLike:u,deleteLike:c}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:f}={openComments:()=>{}}},links:m={},className:p,gtmContext:g="DiscussionAnswer",children:h,isTruncated:y=!1})=>{var de,Y,pe,ge,_e,Oe;const v=oe.useIntl(),w=C.useContext(Rt),A=C.useContext(Xa),{author:E,canLike:k,createdAt:F,id:S,likes:L=0,userLiked:I,comments:N=0,mentions:M}=t,x=w&&w.id&&typeof E!="string"&&E.id&&E.id===w.id||!1,_=typeof k=="boolean"?k:n?!x:!1,j=x&&(!t.createdAt||Dh(t.createdAt,10,"seconds")),R=C.useRef(null),[q,V]=C.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1}),[ue,ne]=C.useState(!1),[D,W]=C.useState(j?"highlighted":"default"),[X,B]=C.useState("");C.useEffect(()=>{const he=R.current;if(!(!he||D==="default"))return document.addEventListener("discussionFormSubmitted",T),he.addEventListener("transitionend",z),()=>{document.removeEventListener("discussionFormSubmitted",T),he.removeEventListener("transitionend",z)}},[]),C.useEffect(()=>{V({...q,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]);const T=()=>{setTimeout(()=>{W("fading")},1e3)},z=({propertyName:he})=>{he==="background-color"&&W(Ne=>(Ne==="default"&&(document.removeEventListener("discussionFormSubmitted",T),R.current&&R.current.removeEventListener("transitionend",z)),Ne==="fading"?"default":Ne))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question))return d.jsx(wt,{className:"discussion-card discussion-post"});const $=jw(q.body,y,M),K=async he=>{he||(he=""),B("");try{if(!fc(he,q.body)){const Ne=t.type==="question"?{title:he}:{body:he};await l(rc(t.slugs),Ne)}V({body:he,isEditing:!1,didEdit:!0})}catch{B(`${Lt}form_error`)}},te=()=>{A&&A.updateConversation&&A.updateConversation({showForm:!0}),setTimeout(()=>{var Qe,Ae,ze;const Ne=`reply-form-${(t.type==="answer"?t.slug:((Qe=t.slugs)==null?void 0:Qe.reply)||((Ae=t.slugs)==null?void 0:Ae.answer)||((ze=t.slugs)==null?void 0:ze.question)||"").toLowerCase().slice(-15)}`,He=document.getElementById(Ne),Ue=document.getElementById(`${Ne}-input`);Ue&&Ue.focus(),He&&He.scrollIntoView({behavior:"smooth"})},0)},ee=async()=>{ne(!1);try{await o(rc(t.slugs))}catch{B("delete-error")}},ae=[{text:v.formatMessage({id:`${Lt}moreMenu_report`}),onClick:he=>{he.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(v.formatMessage({id:`${Lt}report_subject`}))}&body=${encodeURI(v.formatMessage({id:`${Lt}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&&x&&ae.push({text:v.formatMessage({id:`${Lt}moreMenu_edit`}),onClick:()=>V({...q,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`edit-${t.type}-click`},{text:v.formatMessage({id:`${Lt}moreMenu_delete`}),onClick:he=>{he.preventDefault(),he.stopPropagation(),ne(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":g,"data-gtm-event-type":`delete-${t.type}-click`,...jf(`delete-${t.slug}-modal`,ue)}),C.createElement(e,{className:Z("discussion-post",p,{[D]:!p||!p.includes("highlighted-text-box"),"has-link":m.post&&!q.isEditing}),ref:R,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${g}-post-click`,onClick:he=>{!m.post||q.isEditing||(he.preventDefault(),he.stopPropagation(),window.location.href=m.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:S||t.slug,className:Z("discussion-card",t.type,{editing:q.isEditing,"has-link":m.post&&!q.isEditing}),children:[!q.isEditing&&d.jsx(jr,{member:E,additionalContent:{createdAt:F,didEdit:q.didEdit},className:typeof E!="string"&&E.id===a?"highlighted":"",gtmContext:g,gtmType:"profile-click"}),q.isEditing?d.jsx(Ja,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:q.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:X!==""&&X!=="delete-error"?v.formatMessage({id:X},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:s,handleSaveEdit:K,handleCancel:()=>{B(""),V({...q,isEditing:!1})}},gtmContext:`${g}Form`}):m.post?d.jsxs("a",{href:m.post,children:[(t==null?void 0:t.title)&&d.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),$.length>Nw?d.jsx(Oc,{text:$,markdownOptions:{overrides:{a:as,blockquote:{component:Qi}}}}):d.jsx(Un,{options:{overrides:{a:as,blockquote:{component:Qi}}},children:$})]}):d.jsx(Un,{options:{wrapper:t.type==="question"?"h1":C.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:Qi}}},children:$}),!q.isEditing&&!(i!=null&&i.actionBar)&&d.jsxs("ul",{className:Z("actions text-medium",t.type),"data-testid":`${t.type}-actions`,children:[!i.likes&&d.jsx(Wf,{element:"li",likes:L,isShort:!1,userLiked:I,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:_,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:u,deleteLike:c}}),!i.comments&&(["question","post"].includes(t.type)||m.comments||typeof f=="function")&&d.jsx("li",{children:d.jsx(Na,{onClick:he=>{he.preventDefault(),he.stopPropagation(),m.comments&&(window.location.href=m.comments),typeof f=="function"&&f()},icon:{icon:"speech-bubble_square_thick"},"data-gtm-event-context":g,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:v.formatMessage({id:`${Lt}comments_screenReader`},{count:N}),children:v.formatMessage({id:`${Lt}comments`},{count:N})})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(Na,{styling:{muted:!0},onClick:te,icon:{icon:"speech-bubble_square_thick"},children:v.formatMessage({id:`${Lt}reply`})})}),d.jsx(Pw,{url:(de=t.slugs)!=null&&de.reply?`${window.location.origin}${(Y=t.slugs)==null?void 0:Y.question}/${(pe=t.slugs)==null?void 0:pe.answer}#${(ge=t.slugs)==null?void 0:ge.reply}`:`${window.location.origin}${(_e=t.slugs)==null?void 0:_e.question}/${(Oe=t.slugs)==null?void 0:Oe.answer}`}),d.jsx(Nf,{element:"li",id:`more-${t.slug}`,options:ae})]})]}),h,d.jsx(Pr,{id:`delete-${t.slug}-modal`,isOpen:ue,functions:{onOpen:()=>{},onClose:()=>ne(!1)},forceShow:{error:X==="delete-error"?v.formatMessage({id:"discussion_delete_error"},{action:v.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:v.formatMessage({id:"discussion_delete_title"},{action:v.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>ne(!1),children:v.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:ee,children:v.formatMessage({id:"discussion_delete_delete"})}],gtmContext:`${t.type.charAt(0).toUpperCase()}${t.type.slice(1)}:${t.slug}`,children:d.jsx(oe.FormattedMessage,{id:"discussion_delete_text",values:{p:he=>d.jsx("p",{children:he}),action:v.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Ji="discussion_responses_",Hf=({type:e="answer",responses:t=0})=>{const n=oe.useIntl();return t=parseInt(t),d.jsxs("div",{className:"responses-heading",children:[d.jsx("h4",{children:n.formatMessage({id:`${Ji}title`},{action:n.formatMessage({id:`${Ji}${e}`}),count:t})}),t===0&&d.jsx("p",{children:Ft(n.formatMessage,`${Ji}empty`,e,e)})]})};const Uf=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=oe.useIntl(),s=C.useContext(Xa),o=oa(a,{element:"li"});return d.jsxs("div",{className:Z("thread-wrapper",{"empty-thread":!o}),children:[!Object.is(o,null)&&d.jsx("ul",{className:"thread",children:o}),!e&&d.jsx(Nr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&d.jsx(Ja,{...r})]})},Rw="post",Mw="reply",Vf="00000000-0000-0000-0000-000000000000";function xo({queryClient:e,queryKey:t}){function n(r,a,i){e.setQueryData(t,i)}return n}function wo({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 Iw(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function $w(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function Kf(e){const{id:t="",name:n="",organization:r="",jobTitle:a="",image:i={}}=e,{thumbnail:s=""}=i;return{id:t,data:{name:n,organization:r,jobTitle:a,thumbnail:s}}}function Lw({content:e}){return{content:e,id:Vf,time:new Date().toISOString(),verb:Rw}}function ac({activity:e,user:t}){return{...e,actor:Kf(t),...Iw()}}function Ra({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((a=e.own_reactions)==null?void 0:a.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function Zf({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 zw({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:Vf,kind:Mw,parent:t||""}}function ic({reply:e,user:t}){const n=Kf(t);return{...e,user_id:n.id,user:n,...$w()}}function sc({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 qw({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 Yf=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let oc,Xi=0;const Gf=()=>{C.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(oc);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),Xi=0;return}Xi++,!(Xi>10)&&(oc=setTimeout(()=>{e(t)},50))}},Gn=Object.freeze({id:"some-user-id-1",name:"some user name 1",organization:"some user organization 1",jobTitle:"some user job title 1",image:{thumbnail:"https://some-user-thumbnail.com/avatar1.png"},isLoading:!1}),nn=Object.freeze({id:"some-user-id-2",name:"some user name 2",organization:"some user organization 2",jobTitle:"some user job title 2",image:{thumbnail:"https://some-user-thumbnail.com/avatar2.png"},isLoading:!1}),Qf=Object.freeze({actor:`SU:${Gn.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"}),Ww=Object.freeze({actor:`SU:${nn.id}`,content:"some content 2",duration:"5.53ms",feed_id:"some-feed-id-2",foreign_id:"post:some-foriegn-id-2",id:"some-activity-id-2",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"}),Hw=Object.freeze({actor:`SU:${Gn.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"}),Uw=Object.freeze({actor:`SU:${nn.id}`,content:"some content 4",duration:"5.53ms",feed_id:"some-feed-id-4",foreign_id:"post:some-foriegn-id-4",id:"some-activity-id-4",object:"comment",time:"2023-11-24T17:54:36.162000",verb:"post"});Object.freeze({id:"some-reaction-id-1",activity_id:Qf.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:nn.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:nn.id,data:{},created_at:"2023-11-24T17:58:36.162000",updated_at:"2023-11-24T17:58:36.162000"}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-1",user_id:nn.id,user:{id:nn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Qf.id,data:{content:"Some content 1..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-2",user_id:Gn.id,user:{id:Gn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Ww.id,data:{content:"Some content 2..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:nn.id,user:{id:nn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Hw.id,data:{content:"Some content 3..."},parent:"",latest_children:{},children_counts:{}});Object.freeze({created_at:"2023-12-03T21:53:45.999851Z",updated_at:"2023-12-03T21:53:45.999851Z",id:"some-reply-id-3",user_id:Gn.id,user:{id:Gn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:Uw.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function Vw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=ac({activity:Lw(o),user:i});return uc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=ac({activity:o,user:i});r.setQueryData(a,uc(c,u,!0)),setTimeout(()=>{Yf(c.id)},0)}});return s}function Kw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Ma(a,s);return o&&(o.content=i),s}),onError:n});return r}function Zw({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ke.useQueryClient(),l=Ga(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:xo(u),mutate:wo(u)},user:l,...u},f=Vw({...c,mutationFn:e}),m=Kw({...c,mutationFn:t}),p=Yw({...c,mutationFn:n}),g=Qw({...c,mutationFn:a}),h=Jw({...c,mutationFn:i}),{activities:y,...v}=Gw({queryKey:s,queryFn:r});return{activities:y,mutations:{create:f,edit:m,remove:g,like:p,unlike:h},user:l,...v}}function Yw({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Ma(s,o);return l&&Ra({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Ma(o,l);u&&Ra({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function Gw({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{activities:eE(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function Qw({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>Xw(a,i)),onError:n});return r}function Jw({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Ma(i,s);return o&&Zf({activity:o,user:r}),s}),onError:n});return a}function uc(e,t,n=!1){return t?(n?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t):{pages:[{next:"",results:[e]}],pageParams:[""]}}function Ma(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function Xw(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function eE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const tE=({basePath:e,parentId:t,isMember:n,functions:{activities:r,join:a,leave:i}})=>{const s=oe.useIntl(),{activities:o,error:l,fetchNextPage:u,hasNextPage:c,isLoading:f,mutations:{create:m,edit:p,remove:g,like:h,unlike:y},user:v}=Zw({queryKey:[e,t,"activities"],queryFns:r});return Gf(),l?d.jsx(rn,{variant:"error",text:l.message}):d.jsxs("section",{children:[d.jsx(Co,{form:{content:{type:"post",slugs:{}},functions:{create:m},meta:{isEditing:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:a,leave:i,notMemberStateText:s.formatMessage({id:"community_joinToPost"})}}),o==null?void 0:o.map((w,A)=>{var R,q,V,ue,ne,D,W,X;const{id:E,own_reactions:k,latest_reactions:F,reaction_counts:S,mentioned_users:L}=w,I=(((R=F==null?void 0:F.like)==null?void 0:R.length)||0)>0,N=(((q=k==null?void 0:k.like)==null?void 0:q.length)||0)>0,M=N?k==null?void 0:k.like[0].id:"",x=I?(V=F==null?void 0:F.like)==null?void 0:V.map(B=>{var T,z,$;return{id:(T=B==null?void 0:B.user)==null?void 0:T.id,name:($=(z=B==null?void 0:B.user)==null?void 0:z.data)==null?void 0:$.name}}):!1,_=w==null?void 0:w.actor,j=(_==null?void 0:_.id)===(v==null?void 0:v.id);return d.jsx(C.Fragment,{children:d.jsx(Rr,{content:{type:"post",title:w==null?void 0:w.title,body:w==null?void 0:w.content,canLike:ei(n,j),createdAt:(w==null?void 0:w.time)||"",slugs:{question:`${e}/${t}`,answer:E},slug:E,author:{id:_==null?void 0:_.id,name:(ue=_==null?void 0:_.data)==null?void 0:ue.name,organization:(ne=_==null?void 0:_.data)==null?void 0:ne.organization,jobTitle:(D=_==null?void 0:_.data)==null?void 0:D.jobTitle,location:(W=_==null?void 0:_.data)==null?void 0:W.location,image:{thumbnail:((X=_==null?void 0:_.data)==null?void 0:X.thumbnail)||void 0}},userLiked:N,likes:(S==null?void 0:S.like)||0,comments:(S==null?void 0:S.reply)||0,peopleWhoLiked:x,mentions:L},links:{post:`${e}/${t}/${E}`,comments:`${e}/${t}/${E}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>g({activityId:E}),updateContent:(B,{body:T})=>p({activityId:E,content:T})},likes:{createLike:()=>h({activityId:E}),deleteLike:()=>y({activityId:E,reactionId:M})},comments:{openComments:()=>null}},isTruncated:!0})},E)}),!f&&d.jsx(Nr,{hasNextPage:c,loadNextPage:()=>u(),icon:{icon:"arrow-down",position:"right"},messages:{button:s.formatMessage({id:"loadMore_button"}),error:s.formatMessage({id:"loadMore_error"})}})]})},nE={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 rE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=ic({reply:zw(o),user:i});return lc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=ic({reply:o,user:i});r.setQueryData(a,lc(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{Yf(c.id)},0)}});return s}function aE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ia(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function Jf({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ke.useQueryClient(),l=Ga(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:xo(u),mutate:wo(u)},user:l,...u},f=rE({...c,mutationFn:e}),m=aE({...c,mutationFn:t}),p=iE({...c,mutationFn:n}),g=oE({...c,mutationFn:a}),h=uE({...c,mutationFn:i}),{replies:y,...v}=sE({queryKey:s,queryFn:r});return{replies:y,mutations:{create:f,edit:m,remove:g,like:p,unlike:h},user:l,...v}}function iE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Ia(s,o);return l&&sc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ia(o,l);u&&sc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function sE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=hE(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function oE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>fE(a,i)),onError:n});return r}function uE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ia(i,s);return o&&qw({reply:o,user:r}),s}),onError:n});return a}function lE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function cE(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 dE(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 lc(e,t,n){return t?n!=null&&n.append?cE(e,t,n):dE(e,t,n):lE(e)}function Ia(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function fE(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function hE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const mE=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=oe.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:c,isLoading:f,mutations:{create:m,edit:p,like:g,remove:h,unlike:y},user:v}=Jf({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:E=>i.list({...E,reactionId:r})}});Ss([f]);const[w,A]=C.useState(!0);return d.jsxs(d.Fragment,{children:[(l==null?void 0:l.length)>=o&&d.jsx(Ee,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${w?"up_left":"down_right"}`,position:"left"},onClick:()=>A(!w),children:s.formatMessage({id:`discussion_thread_${w?"hide":"show"}`},{count:l==null?void 0:l.length})}),w&&d.jsx(Uf,{loadMore:{isLoading:f,hasNextPage:c,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(E,{body:k})=>m({activityId:n,replyId:r,content:k})},meta:{isEditing:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(E=>{var D,W,X,B,T,z,$,K,te,ee,ae,de;const{id:k,own_children:F,latest_children:S,children_counts:L,mentioned_users:I}=E,M=(((D=F==null?void 0:F.like)==null?void 0:D.length)||0)>0?(W=F==null?void 0:F.like)==null?void 0:W.find(Y=>{var pe;return((pe=Y==null?void 0:Y.user)==null?void 0:pe.id)===(v==null?void 0:v.id)}):!1,x=M?M==null?void 0:M.id:"",_=!!M,R=(((X=S==null?void 0:S.like)==null?void 0:X.length)||0)>0?(B=S==null?void 0:S.like)==null?void 0:B.map(Y=>{var pe,ge,_e;return{id:(pe=Y==null?void 0:Y.user)==null?void 0:pe.id,name:(_e=(ge=Y==null?void 0:Y.user)==null?void 0:ge.data)==null?void 0:_e.name}}):!1,q=E==null?void 0:E.user,V=(q==null?void 0:q.id)===(v==null?void 0:v.id),ue=ei(a,V),ne=typeof E.data.content=="string"?(T=E==null?void 0:E.data)==null?void 0:T.content:(($=(z=E==null?void 0:E.data)==null?void 0:z.content)==null?void 0:$.text)||"";return d.jsx(Rr,{content:{id:k,type:"reply",body:ne,canLike:ue,createdAt:E==null?void 0:E.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:E==null?void 0:E.parent},slug:"",author:{id:q==null?void 0:q.id,name:(K=q.data)==null?void 0:K.name,organization:(te=q.data)==null?void 0:te.organization,jobTitle:(ee=q.data)==null?void 0:ee.jobTitle,location:(ae=q.data)==null?void 0:ae.location,image:{thumbnail:((de=q.data)==null?void 0:de.thumbnail)||void 0}},userLiked:_,likes:(L==null?void 0:L.like)||0,peopleWhoLiked:R,mentions:I},functions:{content:{createContent:()=>null,deleteContent:()=>h({replyId:k}),updateContent:(Y,{body:pe})=>p({replyId:k,content:pe})},likes:{createLike:()=>g({replyId:k}),deleteLike:()=>y({replyId:k,reactionId:x})},comments:{}}},k)}):null})]})};const Xf=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:a,join:i,leave:s}})=>{const o=oe.useIntl(),{replies:l,repliesCount:u,fetchNextPage:c,hasNextPage:f,isLoading:m,mutations:{create:p,edit:g,like:h,remove:y,unlike:v},user:w}=Jf({queryKey:[e,t,n,"replies"],queryFns:a});return Ss([m]),Gf(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(Hf,{type:"comment",responses:u}),d.jsx(Co,{form:{content:{type:"reply",slugs:{}},functions:{create:(A,{body:E})=>p({activityId:n,content:E})},meta:{isEditing:!1,showSuccessMessage:!1},placeholder:o.formatMessage({id:"discussion_responses_placeholder"})},membershipRequiredToPost:{isMember:r,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),l==null?void 0:l.map(A=>{var ne,D,W,X,B,T,z,$,K,te,ee,ae;const{id:E,own_children:k,latest_children:F,children_counts:S,mentioned_users:L}=A,N=(((ne=k==null?void 0:k.like)==null?void 0:ne.length)||0)>0?(D=k==null?void 0:k.like)==null?void 0:D.find(de=>{var Y;return((Y=de==null?void 0:de.user)==null?void 0:Y.id)===(w==null?void 0:w.id)}):!1,M=N?N==null?void 0:N.id:"",x=!!N,j=(((W=F==null?void 0:F.like)==null?void 0:W.length)||0)>0?(X=F==null?void 0:F.like)==null?void 0:X.map(de=>{var Y,pe,ge;return{id:(Y=de==null?void 0:de.user)==null?void 0:Y.id,name:(ge=(pe=de==null?void 0:de.user)==null?void 0:pe.data)==null?void 0:ge.name}}):!1,R=A==null?void 0:A.user,q=(R==null?void 0:R.id)===(w==null?void 0:w.id),V=ei(r,q),ue=typeof A.data.content=="string"?(B=A==null?void 0:A.data)==null?void 0:B.content:((z=(T=A==null?void 0:A.data)==null?void 0:T.content)==null?void 0:z.text)||"";return d.jsx(qf,{children:d.jsx(Rr,{content:{id:E,type:"reply",body:ue,canLike:V,createdAt:A==null?void 0:A.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:E},slug:E,author:{id:R==null?void 0:R.id,name:($=R.data)==null?void 0:$.name,organization:(K=R.data)==null?void 0:K.organization,jobTitle:(te=R.data)==null?void 0:te.jobTitle,location:(ee=R.data)==null?void 0:ee.location,image:{thumbnail:((ae=R.data)==null?void 0:ae.thumbnail)||void 0}},userLiked:x,likes:(S==null?void 0:S.like)||0,peopleWhoLiked:j,mentions:L},functions:{content:{createContent:()=>null,deleteContent:()=>y({replyId:E}),updateContent:(de,{body:Y})=>g({replyId:E,content:Y})},likes:{createLike:()=>h({replyId:E}),deleteLike:()=>v({replyId:E,reactionId:M})},comments:{}},children:d.jsx(mE,{basePath:e,parentId:t,activityId:n,replyId:E,isMember:r,functions:{...a}})},E)},E)}),!m&&d.jsx(Nr,{hasNextPage:f,loadNextPage:()=>c(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})};function pE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({content:a})=>t(i=>(i&&(i.content=a),i)),onError:n});return r}function gE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=Ke.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function vE({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=Ke.useQueryClient(),s=Ga(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:xo(o),mutate:wo(o)},user:s,...o},u=pE({...l,mutationFn:t}),c=bE({...l,mutationFn:n}),f=yE({...l,mutationFn:r}),{activity:m,...p}=gE({queryKey:a,queryFn:e});return{activity:m,mutations:{edit:u,like:c,unlike:f},user:s,...p}}function bE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ra({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ra({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function yE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&Zf({activity:s,user:r}),s)),onError:n});return a}const DE=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,join:o,leave:l}})=>{var N,M,x,_,j,R,q,V,ue,ne;const u=oe.useIntl(),c=C.useContext(Rt),{activity:f,error:m,isLoading:p,mutations:{edit:g,like:h,unlike:y}}=vE({queryFns:i,queryKey:[e,t,n]});if(p)return d.jsx(wt,{style:{height:"400px"}});if(m||!f)return d.jsx(rn,{variant:"error",text:u.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:v,latest_reactions:w,mentioned_users:A}=f,E=(((N=w==null?void 0:w.like)==null?void 0:N.length)||0)>0,k=(((M=v==null?void 0:v.like)==null?void 0:M.length)||0)>0,F=k?v==null?void 0:v.like[0].id:"",S=E?(x=w==null?void 0:w.like)==null?void 0:x.map(D=>{var W,X,B;return{id:(W=D==null?void 0:D.user)==null?void 0:W.id,name:(B=(X=D==null?void 0:D.user)==null?void 0:X.data)==null?void 0:B.name}}):!1,L=f==null?void 0:f.actor,I=(L==null?void 0:L.id)===(c==null?void 0:c.id);return d.jsxs("section",{className:"activity-section",children:[d.jsx(Rr,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:f==null?void 0:f.content,canLike:ei(r,I),createdAt:(f==null?void 0:f.time)||"",slugs:{question:`${e}/${t}`,answer:f==null?void 0:f.id},slug:n,author:{id:L.id,name:(_=L.data)==null?void 0:_.name,organization:(j=L.data)==null?void 0:j.organization,jobTitle:(R=L.data)==null?void 0:R.jobTitle,location:(q=L.data)==null?void 0:q.location,image:{thumbnail:((V=L.data)==null?void 0:V.thumbnail)||void 0}},userLiked:k,likes:((ue=f==null?void 0:f.reaction_counts)==null?void 0:ue.like)||0,comments:((ne=f==null?void 0:f.reaction_counts)==null?void 0:ne.reply)||0,peopleWhoLiked:S,mentions:A},originalAuthorId:L==null?void 0:L.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(D,{body:W})=>g({content:W})},likes:{createLike:()=>h({activityId:n}),deleteLike:()=>y({activityId:n,reactionId:F})},comments:{openComments:()=>{}}}},n),d.jsx(Xf,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,join:o,leave:l}})]})},CE=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),cc=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ia="notFoundError_",xE=()=>{const e=oe.useIntl(),t=[];return cc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ia}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs($f,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(un,{children:[d.jsx(Pf,{cards:cc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(Ee,{href:"/solution-articles/",children:e.formatMessage({id:`${ia}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ia}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ia}text`})})]})};exports.ASSETS_BUCKET=Ht;exports.ActivitiesFeed=tE;exports.ActivitySection=DE;exports.AddPost=Co;exports.Banner=Lx;exports.BannerSection=Kx;exports.Breadcrumbs=sw;exports.Buckets=Nh;exports.Button=Ee;exports.ButtonWrapper=En;exports.COURSE_CONTENT_TYPES=dr;exports.CacheProvider=_f;exports.Card=go;exports.CardBlock=Pf;exports.Carousel=aw;exports.CharacterLimit=Is;exports.CollapsibleSection=za;exports.Columns=Mf;exports.CommunityDetails=iw;exports.ContactFooter=vw;exports.ContactForm=ff;exports.ContentTypeLabel=Tc;exports.Contributors=Ms;exports.ConversationContext=Xa;exports.CookieBanner=If;exports.CourseProgression=Ew;exports.CourseStructure=kw;exports.CustomContentBanner=Zx;exports.Directory=Rx;exports.DiscussionConversation=qf;exports.DiscussionForm=Ja;exports.DiscussionLikes=Wf;exports.DiscussionPost=Rr;exports.DiscussionThread=Uf;exports.Divider=en;exports.DownloadSection=zx;exports.EMAILS=Pn;exports.EditSection=Wx;exports.EmailHelperTextBox=Ic;exports.EmptyStateBox=rn;exports.Filters=ow;exports.FlagsProvider=Bf;exports.Footer=yo;exports.Form=er;exports.FullWidthSection=un;exports.GlobalProviders=Px;exports.Header=Do;exports.HelperTextBox=jc;exports.HiddenFromScreenReaders=$a;exports.HideShowTextBox=Oc;exports.HighlightSection=Gx;exports.HighlightedTextBox=Pt;exports.INVALID_TOKEN=Ec;exports.IconBulletedList=Ih;exports.ImageContainer=jh;exports.IntlProvider=Af;exports.InviteForm=hf;exports.InviteModal=Nx;exports.JoinButton=vo;exports.LanguageContext=ho;exports.LanguageSwitcher=lw;exports.LessonName=Lf;exports.LessonType=zf;exports.Link=kn;exports.LoadMore=Nr;exports.LoadingBlock=Yh;exports.LoadingPlaceholder=wt;exports.LoadingState=Ns;exports.Logo=bo;exports.LogoSection=Hx;exports.MarkCompleteButton=_w;exports.MarkdownText=Un;exports.MarketingBlock=Qx;exports.Member=jr;exports.MembersList=ww;exports.Modal=po;exports.MoreMenu=Nf;exports.NUMBER_OF_COUNTRIES=yh;exports.NUMBER_OF_USERS=bh;exports.NavigationMenu=Rf;exports.NotFoundError=xE;exports.Overlay=Pr;exports.OverlayContext=mo;exports.OverlayProvider=Sf;exports.PageHeading=Pc;exports.PageLayout=$f;exports.PasswordForm=AC;exports.PasswordRules=Wc;exports.Pill=fn;exports.Portal=Fc;exports.ProfileImageChange=BC;exports.ProfilePicture=an;exports.ProgressBar=Ps;exports.ProgressTracker=Oh;exports.Rating=um;exports.RepliesFeed=Xf;exports.ResponsesHeading=Hf;exports.ResponsiveImage=Xn;exports.ReturnToNavButton=Ph;exports.RichTextEditor=df;exports.SearchForm=mf;exports.ShareLinks=mw;exports.SignupForm=PC;exports.Span=as;exports.StatusBanner=xr;exports.TableOfContents=$x;exports.Tabs=pw;exports.Tags=xw;exports.TestimonialBlock=Ix;exports.TimeToComplete=Qa;exports.Toggle=_C;exports.Tooltip=wn;exports.TopLevelPage=bw;exports.UserContext=Rt;exports.UserProvider=Ff;exports.VisuallyHidden=Ie;exports.addAriaProps=jf;exports.basicReducer=Sr;exports.camelCaseToDashCase=Cc;exports.checkIntlPathExists=La;exports.generateConditions=ma;exports.generateCssIcon=kc;exports.getCharacterLimitProps=Mc;exports.getLongDate=Os;exports.getMember=Rs;exports.getShortDate=_c;exports.getValueLength=qa;exports.headerData=Tr;exports.mapGetStreamData=CE;exports.pageReady=Bc;exports.passwordValidator=ns;exports.repliesFeedMock=nE;exports.supportedLanguages=ga;exports.toCamelCase=xc;exports.toSentenceCase=wc;exports.useCurrentPath=gc;exports.useEffectAfterMount=Hn;exports.useElementWidth=Qn;exports.useOverlay=Tf;exports.useScrollListener=bc;exports.useScrollToHash=Ss;exports.useTooltips=js;exports.useUser=Ga;
|
|
159
|
+
${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 _w="shareLinks_",Bw=({title:e,link:t,referrer:n,gtmContext:r="ShareLinks",size:a="large",variant:i="default",className:s=""})=>{const o=ue.useIntl(),l=kw({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:m,shouldRender:h=!0,onClick:p})=>{if(typeof h=="function"&&!h())return null;const g={};return p&&(g.onClick=f=>p(f,m)),d.jsx("li",{children:d.jsx(ke,{size:a,variant:"tertiary",icon:{icon:c||u},href:m,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":`${r}-SocialButtons`,"data-gtm-event-type":`${u}-click`,"data-testid":"link",screenreaderText:o.formatMessage({id:`${_w}link_${u}`}),...g})},u)})})]})};const Aw=({tabs:e,className:t="",preventLocationChange:n})=>{var u;const r=(c,m,h)=>(c||(c=`panel-${window.btoa(m)}-${h}`),c);let a=e.findIndex(c=>c.current===!0);if(a<0&&(a=0),window.location.hash){const c=window.location.hash.replace("#","");if(e.find(h=>h.id===c)){for(let h=0;h<e.length;h++)if(r(e[h].id,e[h].text,h)===c){a=h;break}}}const[i,s]=C.useState((u=e[a])!=null&&u.id?e[a].id:r(e[a].id,e[a].text,a));C.useEffect(()=>{if(e[a].hasCarousel){const c=new CustomEvent("hiddenSectionVisible",{detail:{id:i}});window.dispatchEvent(c)}},[i]);const o=[],l=[];return e.forEach(({id:c,text:m,content:h,href:p,hasCarousel:g},f)=>{c=r(c,m,f);const y=i===c,b={};p||(b["aria-controls"]=c,b.onClick=w=>{w.preventDefault(),w.stopPropagation(),s(c),!n&&(window.location.hash=`#${c}`)},l.push(d.jsx("section",{id:c,hidden:!y,role:"tabpanel","aria-labelledby":`tab-${c}`,"aria-live":y?"assertive":"off",children:typeof h=="string"?d.jsx("p",{children:h}):h},`section-${c}`))),o.push(d.jsx("li",{"data-testid":"navigation-tab",children:d.jsx("a",{href:p||`#${c}`,id:`tab-${c}`,className:Y({selected:y}),role:"tab","aria-selected":y,...b,children:m})},`tab-${c}`))}),d.jsxs("div",{className:Y("tabs-wrapper",t),children:[d.jsx("ul",{className:"tabs",role:"tablist",children:o}),d.jsx("div",{className:"tab-content",children:l})]})};const Fw={"2-1":901,"1-3":769,"1-1":769},Zf=({layout:e="2-1",hideOnMobile:t=!1,hasCSSContainers:n=!1,className:r="",children:a})=>{const i=Jn(!0);let s=a;return C.Children.count(a)===1&&(s=C.Children.toArray(a)[0],s.props&&(s=s.props.children)),d.jsx("section",{className:Y("columns",`layout-${e}`,r,{"has-containers":n}),children:C.Children.map(s,(o,l)=>t!==!1&&l===t&&i&&i<Fw[e]?null:o)})};let Wi;const Hi="contactFooter_",Tw=({onSuccess:e=async()=>{},onFailure:t=()=>{}})=>{const n=C.useRef(null),[r,a]=C.useState(0),[i,s]=C.useState(!1),o=()=>{n.current&&a(n.current.clientHeight)},l=()=>{i||(s(!0),clearTimeout(Wi),Wi=setTimeout(()=>{o(),s(!1)},500))};return C.useEffect(()=>(o(),window.addEventListener("resize",l),()=>{clearTimeout(Wi),window.removeEventListener("resize",l)}),[]),d.jsx(ln,{id:"contactForm",className:"contact-footer",children:d.jsxs("div",{className:"inner-wrapper",children:[d.jsx("h2",{children:d.jsx(ue.FormattedMessage,{id:`${Hi}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:`${Hi}text`})}),d.jsx(_n,{className:"mailto-link",href:"mailto:hello@apolitical.co",children:d.jsx(ue.FormattedMessage,{id:`${Hi}email`})})]}),d.jsx(wf,{functions:{onSuccess:e,onFailure:t},gtm:{context:"FooterContactUsForm",event:"contact-form-submit-click"}})]})]})})},Sw=({activeLink:e,...t})=>d.jsx(ln,{children:d.jsx(Zf,{layout:"1-3",children:d.jsxs(d.Fragment,{children:[d.jsx(Kf,{activeLink:e}),d.jsx(qc,{...t})]})})});const Ui="cookieBanner_",Vi=["apol-cookie-banner","apolitical-performance-cookie-consent","functional-cookie-consent"],Ki=new Date(Date.now()+12*30*24*60*60*1e3),Yf=()=>{const e=ue.useIntl(),[t,n,r]=Ps.useCookies(Vi),[a,i]=C.useState(!t["apol-cookie-banner"]),s=()=>{Vi.forEach(c=>{n(c,!0,{path:"/",expires:Ki,domain:c==="apolitical-performance-cookie-consent"?".apolitical.co":void 0})}),i(!1),window.location.reload()},o=()=>{n("apol-cookie-banner",!0,{path:"/",expires:Ki}),Vi.forEach(c=>{if(c==="apol-cookie-banner"){n(c,!0,{path:"/",expires:Ki});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:`${Ui}buttons_${c.id}`})})}),d.jsxs("aside",{id:"cookie-banner",className:"text-medium",children:[d.jsx("h6",{children:e.formatMessage({id:`${Ui}title`})}),d.jsx("p",{children:e.formatMessage({id:`${Ui}text`})}),d.jsx(kn,{buttons:u})]})},qt={platform:{order:["events","courses","articles","communities"],events:{href:"/events/",gtmType:"events-click"},courses:{href:"/microcourses/",gtmType:"microcourses-click"},articles:{href:"/solution-articles/",gtmType:"articles-click"},communities:{href:"/communities/",gtmType:"communities-click"}},community:{order:["support","post","join","guidelines"],support:{name:"Support FAQ",href:"/pages/support-faq",gtmType:"support-faq-click"},post:{href:"/pages/post-an-article",gtmType:"post-an-article-click"},join:{href:"/pages/who-can-join-the-community",gtmType:"who-can-join-click"},guidelines:{href:"/pages/values-and-guidelines",gtmType:"guidelines-and-values-click"}},company:{order:["news","story","team","careers","partner","contact"],news:{href:"/learning-hub/updates/",gtmType:"news-click"},story:{href:"/pages/our-story",gtmType:"our-story-click"},team:{href:"/pages/meet-our-team",gtmType:"team-click"},careers:{href:"/pages/careers",gtmType:"careers-click"},partner:{href:"/partnerships/",gtmType:"partner-with-us-click"},contact:{href:"/pages/get-in-touch",gtmType:"contact-click"},child:"legal"},legal:{order:["privacy","terms","cookie","accessibility","ai"],privacy:{href:"https://about.apolitical.co/privacy-policy",gtmType:"privacy-policy-link"},terms:{href:"https://about.apolitical.co/terms-and-conditions",gtmType:"terms-conditions-link"},cookie:{href:"/pages/cookie-policy",gtmType:"cookie-policy-link"},ai:{href:"/pages/ai-principles",gtmType:"ai-principles-link"},accessibility:{href:"/pages/accessibility-statement",gtmType:"accessibility-link"},text:{order:["dataProtection","euDataProtection"],dataProtection:{email:Nn["data-protection"].default,gtmType:"email-dpo-link"},euDataProtection:{email:Nn["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:Nn.support,gtmType:"concierge-email-click"},business:{email:Nn.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 zn="footer_",Oa="SiteFooter",sc=({group:e})=>{const t=qt[e].order||[];let n=!1;return"text"in qt[e]&&(n=qt[e].text),d.jsxs(C.Fragment,{children:[d.jsx("p",{className:"pre-title",children:d.jsx(ue.FormattedMessage,{id:`${zn}${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}=qt[e][r],s={};return["legal"].includes(e)&&(s.target="_blank",s.rel="noopener"),d.jsx("li",{children:d.jsx("a",{href:a,className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":i,...s,children:d.jsx(ue.FormattedMessage,{id:`${zn}${e}_${r}`})})},`${e}_${r}`)})}),typeof n!="boolean"&&"order"in n&&Array.isArray(n.order)&&d.jsx("dl",{className:"text-medium",children:n.order.map(r=>d.jsxs(C.Fragment,{children:[d.jsx("dt",{children:d.jsx(ue.FormattedMessage,{id:`${zn}${e}_${r}`})}),d.jsxs("dd",{children:[typeof n!="boolean"&&n[r].address&&d.jsx("address",{children:d.jsx(ue.FormattedMessage,{id:`${zn}${e}_${r}_address`,values:{br:d.jsx("br",{})}})}),typeof n!="boolean"&&n[r].email&&d.jsx("a",{href:`mailto:${n[r].email}`,className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":n[r].gtmType,children:n[r].email})]})]},`dl-${e}-${r}`))})]},e)},Eo=()=>d.jsx("div",{id:"footer",children:d.jsxs("div",{className:"wrapper",children:[d.jsx($a,{element:"hr"}),d.jsx(wo,{variant:"inverted",version:"full",className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":"logo-homepage-link"}),d.jsx("footer",{children:["platform","community","company","contact"].map(e=>d.jsxs("div",{className:"group",children:[d.jsx(sc,{group:e}),Object.keys(qt[e]).includes("child")&&d.jsx(sc,{group:qt[e].child})]},e))}),d.jsx("hr",{}),d.jsxs("div",{className:"sub-footer",children:[d.jsx("ul",{children:Array.isArray(qt.social.order)&&qt.social.order.map(e=>{const t=qt.social[e];return d.jsx("li",{className:e,children:d.jsx("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"gtm-trackable","data-gtm-event-context":Oa,"data-gtm-event-type":"social-click",children:d.jsx("span",{className:"hidden",children:d.jsx(ue.FormattedMessage,{id:`${zn}social_${e}`})})})},e)})}),d.jsx("small",{children:d.jsx(ue.FormattedMessage,{id:`${zn}copyright`,values:{currentYear:new Date().getFullYear()}})})]})]})}),Ne={timeouts:{},handlerCalled:{},getIsDesktopVersion:(e,t)=>{const n={navigation:{loggedIn:769,loggedOut:881},search:{loggedIn:961,loggedOut:1121}},r=i=>{const s=`logged${e?"In":"Out"}`;return t>=n[i][s]};let a={};return["navigation","search"].forEach(i=>{a[i]=r(i)}),a},shouldChangeHeaderIsVisible:(e,t,n)=>{Object.values(t).filter(a=>a===!0).length||n([{type:"headerIsVisible",value:e}])},handleMenus:({id:e,value:t,menus:n,dispatch:r,forceHandle:a=!1})=>{if(!a&&n[e]===t||!a&&e==="account"&&t===!1&&n.navigation===!0)return;const i=Date.now();if(!a&&!t&&Ne.handlerCalled[e]&&i-Ne.handlerCalled[e]<500)return;Ne.handlerCalled[e]=i;let s=[{type:`menus.${e}`,value:t}];if(t===!0)Object.keys(n).forEach(o=>{o===e||n[o]===!1||s.push({type:`menus.${o}`,value:!1})});else{let o=null;switch(e){case"navigation":o=document.querySelector("#header .menu-button"),o||(o=document.querySelector("#navigation > li.parent"));break;case"search":o=document.querySelector("#header .toggle-search-button");break;case"account":o=document.querySelector("#header .account-button");break;default:return}o&&o.focus()}r(s)},findFirstChild:(e,t,n=!1)=>{if(!e||!e[0])return!1;for(let r=0;r<=e.length;r++){if(!e[r])continue;if(e[r][t]&&(!n||e[r][t].includes(n)))return e[r];if(!t.includes("."))continue;const a=bc(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?Ne.findFirstChild(e[0].children,t,n):!1},autoFocus:({menu:e,navigationRef:t,isDesktopVersion:n,focusElements:r,dispatch:a})=>{var l;if(!t.current||!t.current.children)return;const i=n?"desktop":"default";if(r[e][i]){(l=document.querySelector(`#header ul a[href="${r[e][i]}"]:last-child`))==null||l.focus();return}let s,o;switch(e){case"navigation":if(n){const u=Ne.findFirstChild(t.current.children,"attributes.aria-controls","navigation");s=Ne.findFirstChild(u.children,"href")}else s=Ne.findFirstChild(t.current.children,"href");break;case"account":if(o=Ne.findFirstChild(t.current.children,"className","account"),!o||!o.children)return;s=Ne.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(Ne.timeouts[t]),n(t,!r))},onFocus:({id:e})=>{clearTimeout(Ne.timeouts[e])},onMouseEnter:({id:e,callback:t})=>{clearTimeout(Ne.timeouts[e]),t(e,!0)},onBlur:({id:e,callback:t})=>{Ne.timeouts[e]=setTimeout(()=>{t(e,!1)},250)}}},Sr={order:["home","topics","partners","account"],home:{href:"/home/",hasVariantText:!0,gtmType:"homepage-click"},topics:{order:["explore","topics"],menuId:"navigation",explore:{order:["events","courses","articles","communities"],events:{href:"/events/",className:"icon events"},courses:{href:"/microcourses/",gtmType:"microcourses-click",className:"icon courses"},articles:{href:"/solution-articles/",gtmType:"articles-click",className:"icon articles"},communities:{href:"/communities/",gtmType:"communities-click",className:"icon communities"}},topics:{order:["climate","cities-and-local-government","digital-and-data","education","equity-justice-and-inclusion","health-and-social-care","innovation","leadership-and-skills","life-in-government","policymaking","transport-and-infrastructure","work-and-the-economy"],className:"columns",climate:{href:"/topics/climate/"},"cities-and-local-government":{href:"/topics/cities-and-local-government/"},"digital-and-data":{href:"/topics/digital-and-data/"},education:{href:"/topics/education/"},"equity-justice-and-inclusion":{href:"/topics/equity-justice-and-inclusion/"},"health-and-social-care":{href:"/topics/health-and-social-care/"},innovation:{href:"/topics/innovation/"},"leadership-and-skills":{href:"/topics/leadership-and-skills/"},"life-in-government":{href:"/topics/life-in-government/"},policymaking:{href:"/topics/policymaking/"},"transport-and-infrastructure":{href:"/topics/transport-and-infrastructure/"},"work-and-the-economy":{href:"/topics/work-and-the-economy/"}}},partners:{href:"/partnerships/",onlyShow:"logged-out"},account:{order:["profile","settings","log-out"],className:"account",onlyShow:"logged-in",doTrack:!1,profile:{href:"/profiles/me"},settings:{href:"/profiles/me/manage-account"},"log-out":{href:"/user-onboarding/logout",className:"divider"}},buttons:{order:["login","signup"],login:{href:"/user-onboarding/login"},signup:{href:"/signup/?ref=header-banner",props:{variant:"primary"}}}},Pa=({id:e,isLoggedIn:t=!1,isDesktopVersion:n=!1,menus:r={},callback:a=()=>{},doTrack:i=null})=>{const s=ue.useIntl(),o=bc(Sr,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 m=`header_${e.replaceAll(".","_")}`;o.hasVariantText&&(m+=`_logged${t?"In":"Out"}`);let h=!1;if(o.href){let w=o.gtmType||`${e}-click`;if(w.includes(".")){const A=w.split("."),k=A[A.length-2];w=`${k==="topics"?`${k}-`:""}${A[A.length-1]}`}h={href:o.href},u&&(h={...h,className:"gtm-trackable","data-gtm-event-type":w,"data-gtm-event-context":"HeaderButtons"}),c&&(h={...h,variant:"secondary",size:{mobile:"small",881:"large"},...o.props||{}})}const p=o.order&&o.order[0]&&o[o.order[0]],g=p&&o[o.order[0]].order,f=h&&window.location.pathname===o.href;let y={},b={};if(f&&(y={...y,"aria-current":"page"}),p){const w=o.menuId||e,A={onClick:k=>Ne.events.onClick(k,{id:w,callback:a,isOpen:r[w]}),onFocus:()=>Ne.events.onFocus({id:w}),onBlur:()=>Ne.events.onBlur({id:w,callback:a}),onMouseLeave:()=>Ne.events.onBlur({id:w,callback:a}),onMouseEnter:()=>Ne.events.onMouseEnter({id:w,callback:a})};n&&(g&&(y={...A,onKeyPress:k=>{k.key==="Enter"&&Ne.events.onClick(k,{id:w,callback:a,isOpen:r[w]})},tabIndex:"0","aria-haspopup":!0,"aria-expanded":r[w],"aria-controls":w}),b={hidden:w in r?!r[w]:!0}),g||(b={...b,...A})}return d.jsxs("li",{className:Y({[o.className]:o.className,"has-submenu":p,parent:g,active:f}),...y,children:[h?C.createElement(c?ke:"a",h,s.formatMessage({id:m})):s.formatMessage({id:m}),o.order&&d.jsx("ul",{...b,children:o.order.map(w=>{if(!o[w])return null;const A={isLoggedIn:t,isDesktopVersion:n,menus:r,callback:a,doTrack:l?u:null};return o[w].order?d.jsxs("li",{className:Y({[o[w].className]:o[w].className}),children:[s.formatMessage({id:`${m}_${w}`}),d.jsx("ul",{children:o[w].order.map(k=>d.jsx(Pa,{id:`${e}.${w}.${k}`,...A},k))})]},w):d.jsx(Pa,{id:`${e}.${w}`,...A},w)})})]},e)};const jw={height:67,height_desktop:83},ko=({showNavigation:e=!0})=>{const t=ue.useIntl(),n=C.useContext(Mt),r=Jn(!0,!0),a=n&&typeof n.id=="string",i=C.useMemo(()=>Ne.getIsDesktopVersion(a,r),[a,r]),[s,o]=C.useReducer(jr,{headerIsVisible:!0,menus:{navigation:!1,search:!1,account:!1},focusElements:{navigation:{desktop:!1,default:!1},account:{desktop:!1,default:!1}}}),{headerIsVisible:l,menus:u,focusElements:c}=s,m=C.useRef(s);C.useEffect(()=>{m.current=s},[s]),Ec({scrollPosition:jw[`height${i.navigation?"_desktop":""}`],callbacks:{scrollUp:()=>{const f=m.current.menus;!i&&f.navigation||Ne.shouldChangeHeaderIsVisible(!0,f,o)},scrollDown:()=>{const f=m.current.menus;!i&&f.navigation||Ne.shouldChangeHeaderIsVisible(!1,f,o)}}});const h=(f,y,b=!1)=>{Ne.handleMenus({id:f,value:y,menus:m.current.menus,dispatch:o,forceHandle:b})},p=C.useRef(null),g=f=>{f.key==="Escape"&&["navigation","search","account"].forEach(y=>{m.current.menus[y]&&h(y,!1,!0)})};return C.useEffect(()=>{var f;return(f=document.getElementById("header"))==null||f.addEventListener("keydown",g),()=>{var y;(y=document.getElementById("header"))==null||y.removeEventListener("keydown",g)}},[]),Un(()=>{u.navigation&&Ne.autoFocus({menu:"navigation",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.navigation]),Un(()=>{u.account&&Ne.autoFocus({menu:"account",navigationRef:p,isDesktopVersion:i.navigation,focusElements:c,dispatch:o})},[u.account]),n&&n.isLoading?null:d.jsxs(d.Fragment,{children:[d.jsxs("nav",{id:"header",className: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(wo,{variant:"monochrome"}),e&&d.jsxs(d.Fragment,{children:[!i.navigation&&d.jsx("button",{className:"menu-button gtm-trackable",onClick:f=>{f.preventDefault(),f.stopPropagation(),h("navigation",!u.navigation)},"data-gtm-event-type":"open-tab-menu-click","data-gtm-event-context":"HeaderLeft-Chevron","aria-haspopup":"true","aria-expanded":u.navigation,"aria-controls":"navigation",children:d.jsx(Ie,{children:t.formatMessage({id:`header_menu_${u.navigation?"hide":"show"}`})})}),d.jsx("ul",{ref:p,id:"navigation",hidden:i.navigation||u.account?!1:!u.navigation,"data-showing":!i.navigation&&u.account?"account":"default",children:Sr.order.map(f=>d.jsx(Pa,{id:f,isLoggedIn:a,isDesktopVersion:i.navigation,menus:{navigation:u.navigation,account:u.account},callback:h},f))}),!i.search&&d.jsx("button",{className:"search toggle-search-button",onClick:f=>{f.preventDefault(),f.stopPropagation(),h("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(kf,{id:"global-search",handleToggle:{searchIsOpen:u.search,isDesktopVersion:i.search},gtmContext:"search-bar-header",gtmEvent:"form-submission"}),a?d.jsxs("button",{className:"account-button",onClick:f=>Ne.events.onClick(f,{id:"account",callback:h,isOpen:u.account}),onMouseEnter:()=>Ne.events.onMouseEnter({id:"account",callback:h}),onMouseLeave:()=>Ne.events.onBlur({id:"account",callback:h}),"aria-haspopup":"true","aria-expanded":u.account,"aria-controls":"navigation",children:[d.jsx(Ie,{children:t.formatMessage({id:`header_account_${u.account?"hide":"show"}`})}),d.jsx(sn,{name:n&&n.name||"",src:n&&n.image&&n.image.thumbnail||""})]}):d.jsx("ul",{className:"sign-in-buttons",children:Sr.buttons.order.map(f=>d.jsx(Pa,{id:`buttons.${f}`},f))})]})]}),d.jsx("hr",{id:"content-of-page"}),d.jsx("div",{className:Y("overlay",{open:u.navigation||u.account||!i.search&&u.search})})]})};const Ow=()=>{const e=ue.useIntl();return d.jsxs(d.Fragment,{children:[d.jsx(ko,{}),d.jsx("div",{id:"content",children:d.jsx(an,{variant:"error",text:e.formatMessage({id:"pageLayout_error"})})}),d.jsx(Eo,{})]})},Gf=({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:m="default",circle:h="default",modal:p="default"}=i,g=Cc();C.useEffect(()=>{window.scrollTo(0,0)},[g]);const f=oa(e,{locale:o}),y=oa(t,{locale:o}),b=oa(n,{locale:o}),w={};return c!=="default"&&(w[c]=!0),m!=="default"&&(w[m]=!0),h!=="default"&&(w[h]=!0),d.jsx(xh.ErrorBoundary,{onError:r,fallback:d.jsx(Ow,{}),children:d.jsx(C.Suspense,{fallback:null,children:d.jsxs("div",{id:"wrapper",className:Y(s,w,{"has-footer":u}),children:[d.jsx(ko,{showNavigation:l}),d.jsxs("main",{id:"content-wrapper",children:[y&&d.jsx("div",{className:Y("additional-content prepended",{"large-modal":p==="large"}),children:y}),C.createElement(c==="bold"?Do:"div",{id:"content",children:f,className:Y({"large-modal":p==="large"})})]}),b&&d.jsx("div",{className:"additional-content appended",children:b}),u&&d.jsx(Eo,{}),d.jsx(Yf,{})]})})})},oc={default:"tags_",headerTopics:"header_topics_topics_"},Zi={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"},Pw={getTagDetails:e=>{if(e.includes("topic_")){if(e=Zi.topic[e.replace("topic_","")],e){const t=Sr.topics.topics[e].href;return t?{id:e,href:t,text:`${oc.headerTopics}${e}`}:null}return null}return Zi[e]?(e=Zi[e],{id:e,text:`${oc.default}${e}`}):null}};const Nw=({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=Pw.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 Rw=({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(tr,{member:l,gtmContext:a,gtmType:i}),l.isAdmin&&d.jsx(hn,{children:o.formatMessage({id:"membersList_admin"})})]},u))}),n&&d.jsx(Nr,{hasNextPage:n,loadNextPage:r,icon:{icon:"arrow-down",position:"right"},gtmContext:a})]})};const Mw=({element:e="p",data:{timeLeftToFinish:t,percentageCompleted:{inTime:n=0,inLessons:r=0},shouldShowTimes:a=!0},graph:i,styling:s={},className:o=""})=>{const l=ue.useIntl();let u=a?n:r;u>99?u=100:u<1&&(u=0);const{highlightPercentage:c=!1}=s;return C.createElement(e,{className: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:m=>d.jsx("strong",{children:m}),number:u})}),u<100&&a&&d.jsx(Qa,{time:t,appendedText:l.formatMessage({id:"courseProgression_timeLeft"})}),d.jsx($s,{progress:u,styling:{layout:i||"bar",size:i&&i==="circle"?"small":"default"}})]})})};const Qf=({element:e="span",sectionId:t,subsectionId:n,title:r,className:a=""})=>C.createElement(e,{className:Y("lesson-name",a),"data-number":`${t}.${n}`,children:r});const Jf=({size:e="default",completionTime:t,icon:n,optional:r,type:a,children:i})=>{const s=ue.useIntl(),o=La(`lessonType_${a}`)?s.formatMessage({id:`lessonType_${a}`}):Fc(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(Qa,{time:t})," ",i?d.jsx("span",{className:"additional",children:i}):null]})};const Iw=({course:{articles:e,canAccessCourse:t,description:n,hideTimes:r,isEnrolled:a,sectionId:i,sectionTime:s,slug:o,timeLeft:l,title:u},quizScores:c})=>{const m=ue.useIntl(),h="courseStructure_",p=u.toLowerCase().includes("course conclusion");return d.jsxs(za,{className:"course-structure",label:d.jsxs(d.Fragment,{children:[d.jsxs("small",{children:[m.formatMessage({id:`${h}section${p?"_end":""}`},{number:i})," ",!r&&s>=0&&d.jsx("span",{className:"time",children:a&&l===0?m.formatMessage({id:`${h}time_completed`}):d.jsx(Qa,{time:s,appendedText:a?m.formatMessage({id:`${h}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:b,image:w,isIntroduction:A,optional:k,slug:E,subsectionId:T,title:j,type:z})=>{const R=a&&t||A,$={};return w&&($.style={"--image":`url(${w})`}),d.jsx("li",{className:Y({article:y===fr.ARTICLE,discussion:y===fr.DISCUSSION,quiz:y===fr.QUIZ,completed:g&&y===fr.ARTICLE,locked:!R}),...$,children:d.jsx(_n,{href:R?`/microcourses/en/${o}/${E}`:void 0,fallbackElement:"span",className:"inner",gtmContext:`MicrocourseOutline${Ac(j)}`,gtmType:"article-click",children:d.jsxs(d.Fragment,{children:[d.jsx(Qf,{sectionId:i,subsectionId:T,title:j,className:"course-title"})," ",d.jsx(Jf,{completionTime:f,icon:b,optional:k,type:z,children:c&&c[E]&&d.jsx("span",{className:"quiz-score",children:`${c[E]}%`})})]})})},E)})})]})};const $w=({isComplete:e=!1,onClick:t,...n})=>{const r=ue.useIntl();return n["data-gtm-event-context"]||(n["data-gtm-event-context"]="LessonIntroduction"),d.jsx(ke,{...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":""}`})})};let aa=null;const ut="discussion_form_",Ja=({id:e,content:t={type:"response",slugs:{}},userHasPermissions:n=!0,meta:r={isLoading:!1,isInWrapper:!1,isEditing:!1,showTitle:!1,showSuccessMessage:!0},placeholder:a,maxLength:i=0,forceShow:s={cancel:!1,error:!1},functions:o={create:()=>{},handleSaveEdit:()=>{},handleCancel:()=>{},callback:()=>{},listMembers:()=>Promise.resolve([]),props:{create:{projectNames:["questions-answers"]}}},data:l={},gtmContext:u="DiscussionForm"})=>{var R,$,M;const c=ue.useIntl(),m=C.useContext(Mt),[h,p]=C.useState(r.isEditing&&r.isEditing.text||""),[g,f]=C.useState(s.error||!1),[y,b]=C.useState(!1);if(r.isLoading)return d.jsx(wt,{className:"discussion-card discussion-form","data-testid":"loading-placeholder"});const w=x=>{p(x);let B;!m||!m.id?B=Ft(c.formatMessage,`${ut}error_loggedOut`,t.type,"action"):n?i>0&&x.length>=i&&(B=`${ut}error_tooLong`):B=Ft(c.formatMessage,`${ut}error_noPermission`,t.type,"action"),B?f(B):g&&f(!1)};let A=`${t.type}-form`;if(t.type==="response"||t.type==="reply"){const x=((R=t.slugs)==null?void 0:R.reply)||(($=t.slugs)==null?void 0:$.answer)||((M=t.slugs)==null?void 0:M.question)||"";x&&(A=`${A}-${x.slice(-15)}`)}e&&(A=`${e}-${A}`);const k=async x=>{var F;if(x.preventDefault(),x.stopPropagation(),!m||!m.id||!n||T)return;aa&&clearTimeout(aa),b("submitting");const B=window.location.pathname;try{let N;switch(t.type){case"post":N=await o.create({content:h});break;case"question":N=await o.create({title:h,authorId:m&&m.id,...(F=o.props)==null?void 0:F.create});break;case"response":N=await o.create({questionSlug:t.slugs.question},{body:h,authorId:m&&m.id,contentPath:B});break;case"reply":N=await o.create({questionSlug:t.slugs.question,answerSlug:t.slugs.answer},{body:h,authorId:m&&m.id,contentPath:B});break;default:break}await Oh(1e3),o.callback&&await o.callback(N),aa=setTimeout(()=>{p(""),b("submitted");const L=new Event("discussionFormSubmitted");document.dispatchEvent(L),E()},500)}catch(N){const L=N;let q=`${ut}error`;L!=null&&L.message.includes("entry already exists")&&(q=Ft(c.formatMessage,`${ut}error_alreadyExists`,t.type,"action")),L!=null&&L.message.includes("429")?q=Ft(c.formatMessage,`${ut}error_tooMany`,t.type,"action"):L!=null&&L.message.includes("400")&&(q=`${ut}error`),f(q),E()}},E=()=>{aa=setTimeout(()=>{f(!1),b(!1)},5e3)},T=!h||!zh(h),j=y==="submitting",z=[];return(r.isEditing&&!j||s.cancel)&&z.push({variant:"secondary",size:{mobile:"small",600:"medium"},onClick:o.handleCancel,className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`cancel-${t.type}-click`,disabled:!s.cancel&&(!m||!m.id||!h),children:c.formatMessage({id:`${ut}cancel`})}),z.push({variant:"primary",size:{mobile:"small",600:"medium"},onClick:x=>{if(r.isEditing){b("submitting"),o.handleSaveEdit&&o.handleSaveEdit(h);return}k(x)},className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":`${r.isEditing?"save":"submit"}-${t.type}-click`,"data-testid":"save-button",disabled:!m||!m.id||!n||T||j||r.isEditing&&h===r.isEditing.text,children:c.formatMessage({id:`${ut}${j?r.isEditing?"saving":"posting":r.isEditing?"save":"post"}`})}),d.jsxs("form",{id:A,className:Y("discussion-card discussion-form",{"no-styling":r.isInWrapper&&r.isEditing}),"data-testid":`discussion-${t.type}-form`,children:[(r==null?void 0:r.showTitle)&&!r.isEditing&&["question"].includes(t.type)&&d.jsx("h2",{children:Ft(c.formatMessage,`${ut}title`,t.type,"action")}),d.jsx(tr,{member:m||"community",gtmContext:u,gtmType:"profile-click"}),d.jsx(Ie,{element:"label",showOnFocus:!1,htmlFor:`${A}-input`,children:Ft(c.formatMessage,`${ut}label`,t.type,"action")}),d.jsx(xf,{id:`${A}-input`,value:y==="submitting"&&!g?"":h,placeholder:a||Ft(c.formatMessage,`${ut}placeholder`,t.type,"action"),maxLength:i,functions:{onChange:w,listMembers:o.listMembers},data:l,autoFocus:!!r.isEditing,"aria-invalid":!!g,"aria-errormessage":"error-message"}),d.jsx("small",{children:Ft(c.formatMessage,`${ut}explainer`,t.type,"action",{a:x=>d.jsx("a",{href:"https://about.apolitical.co/q-and-a-community-guidelines",target:"_blank",className:"gtm-trackable","data-gtm-event-context":u,"data-gtm-event-type":"community-guidelines-link",rel:"noreferrer",children:x})})}),d.jsx(kn,{buttons:z}),y==="submitted"&&r.showSuccessMessage&&d.jsx(wr,{className:"success","data-testid":"success",children:Ft(c.formatMessage,`${ut}success`,t.type,"action")}),g&&d.jsx(wr,{id:"error-message",className:"error","data-testid":"error",children:s.error?s.error:typeof g=="string"?g.includes(" ")?g:c.formatMessage({id:g},{action:c.formatMessage({id:`discussion_action_${t.type}`}),maxLength:i}):g})]})},_o=({form:e,membershipRequiredToPost:{isMember:t,required:n,join:r,leave:a,notMemberStateText:i}})=>{if(n&&!t)return d.jsx(an,{text:i,button:{breakpoints:{mobile:!0,901:!1},component:d.jsx(xo,{isShort:!0,functions:{join:r,leave:a}})}});const{content:s,functions:o,meta:l,...u}=e;return d.jsx(Ja,{content:{type:(s==null?void 0:s.type)||"reply",slugs:(s==null?void 0:s.slugs)||{}},functions:{...o,create:(o==null?void 0:o.create)||(()=>{})},meta:{...l,isEditing:(l==null?void 0:l.isEditing)||!1,showSuccessMessage:!1},...u,id:`add-post-${u.id||""}`})},Lw={showForm:!1},Xa=C.createContext(Lw),Xf=({children:e})=>{const[t,n]=C.useState({showForm:!1});return d.jsx(Xa.Provider,{value:{...t,updateConversation:n},children:e})},zw=({question:e,answer:t,reply:n})=>({...e&&{questionSlug:e},...t&&{answerSlug:t},...n&&{replySlug:n}}),qw=(e,t=10)=>!e||e.length===0?[]:e.slice(0,t);const Na=({icon:e,...t})=>d.jsx(ke,{className:"discussion-button",variant:"tertiary",icon:e,...t});let xr=!1;const Yi=()=>{xr!==!1&&(clearTimeout(xr),xr=!1)},Gi=5;let Qi=null;const eh=({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},[m,h]=C.useReducer(jr,c),{numberOfLikes:p,userLikedContent:g,ignoreInteractions:f,showLikers:y,tabbableLink:b}=m;C.useEffect(()=>{h([{type:"userLikedContent",value:a}])},[a]);const w=C.useMemo(()=>qw(n,Gi),[n]),A=j=>{if(j.preventDefault(),j.stopPropagation(),h([{type:"showLikers",value:!1}]),xr)return Yi(),!1;if(Yi(),f||!s)return!1;xr=setTimeout(k,350)},k=async()=>{if(Yi(),f||!s)return!1;let j=g?p-1:p+1;j<0&&(j=0),h([{type:"ignoreInteractions",value:!0},{type:"numberOfLikes",value:j},{type:"userLikedContent",value:!g}]);try{if(i&&i.slugs){const z=zw(i.slugs);g?await l(z):await o({...z,payload:{contentPath:window.location.pathname}})}}catch{h([{type:"numberOfLikes",value:t},{type:"userLikedContent",value:a}])}finally{h([{type:"ignoreInteractions",value:!1}])}},E=()=>{Qi=setTimeout(()=>{h([{type:"showLikers",value:!1}])},500)},T=()=>{Qi&&clearTimeout(Qi)};return C.createElement(e,{className:"likes-wrapper",onKeyDown:j=>{j.key==="Escape"&&h([{type:"showLikers",value:!1}])},onMouseEnter:()=>{T(),h([{type:"showLikers",value:!0}])},onMouseLeave:()=>{E()}},d.jsxs(d.Fragment,{children:[d.jsx(Na,{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:A,screenreaderText:s?u.formatMessage({id:`discussion_likes_${g?"unlike":"like"}`},{action:u.formatMessage({id:`discussion_action_${i.type}`})}):!1,"aria-pressed":g,children:d.jsx("span",{"data-testid":"number-of-likes",className:"number-of-likes",children:u.formatMessage({id:`discussion_likes${r?"_short":""}`},{number:p})})}),n&&d.jsxs(d.Fragment,{children:[d.jsx(Ie,{element:"button",className:"tertiary small icon navigation_arrow",onFocus:()=>{T()},onBlur:()=>E,onClick:j=>{var R;j.preventDefault(),j.stopPropagation(),T(),h([{type:"showLikers",value:!0}]);const z=(R=j.currentTarget.nextSibling)==null?void 0:R.childNodes[0];if(z){const $=z.querySelector("li:first-child a");$&&(h([{type:"tabbableLink",value:0}]),setTimeout(()=>{$.focus()},100))}},onKeyDown:j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),E())},"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(En,{id:`likes-tooltip-${i.slug}`,isOpen:y,isLoading:n.length===0,children:n.length&&d.jsxs("ul",{children:[w.map((j,z)=>{if(typeof j=="string"||!j.name)return null;const R={};return b!==z&&(R.tabIndex=-1),d.jsx("li",{"data-index":z,children:d.jsx(_n,{href:j.id?`/profiles/${j.id}`:void 0,gtmContext:"Likes",gtmType:"liked-name-click",onClick:$=>$==null?void 0:$.stopPropagation(),onFocus:()=>T(),onKeyDown:$=>{var N,L,q,oe;if(!$||!["ArrowUp","ArrowDown"].includes($.key||""))return;$.stopPropagation(),$.preventDefault();const M=$.key==="ArrowUp"?"up":"down",x=(N=$.currentTarget)==null?void 0:N.parentElement;let B=x==null?void 0:x.nextElementSibling;if(M==="up"){const ne=x==null?void 0:x.previousElementSibling;ne?B=ne:(B=(L=x==null?void 0:x.parentElement)==null?void 0:L.lastElementChild,(B==null?void 0:B.getAttribute("data-index"))==="-1"&&(B=B==null?void 0:B.previousElementSibling))}else(!B||(B==null?void 0:B.getAttribute("data-index"))==="-1")&&(B=(q=x==null?void 0:x.parentElement)==null?void 0:q.firstElementChild);if(!B)return;const F=(B==null?void 0:B.getAttribute("data-index"))||"0";h([{type:"tabbableLink",value:F}]),(oe=B==null?void 0:B.querySelector("a"))==null||oe.focus()},...R,children:j.name})},j.id||window.btoa(j.name))}),t>Gi&&d.jsx("li",{"data-index":"-1",children:u.formatMessage({id:"discussion_likes_more"},{number:t-Gi})})]})})]})]}))},uc=e=>{const t={};return Object.keys(e).forEach(n=>n.includes("Id")?t[n]=e[n]:t[`${n}Slug`]=e[n]),t},ei=(e,t)=>e&&!t,Ji=({children:e,class:t,...n})=>{const r={...n,class:Y("subtle",t)};return d.jsx("blockquote",{...r,children:e})},Ww=280,Hw=async(e,t,n,r=()=>Promise.resolve([]))=>{let a=t?Hn(e,Ww):e;return a=a.trim(),n?await Nc({text:a,template:'<a href="/profiles/{{id}}" class="mentioned-user">@{{name}}</a>',mentions:n,listMembers:r}):a};const Uw=3e3,Vw=({url:e})=>{const t=ue.useIntl(),[n,r]=C.useState({isOpen:!1,isCopied:!1});return d.jsxs("li",{children:[d.jsx(En,{className:Y("tooltip-share-link",{"tooltip-share-link-copied":n.isCopied}),isOpen:n.isOpen,styling:{hasPointer:"bottom",extraPadding:!1},children:n.isCopied?t.formatMessage({id:"discussion_share_copy_link_success"}):t.formatMessage({id:"discussion_share_copy_link"})}),d.jsx(Na,{icon:{icon:"link_chain"},onMouseOver:()=>r({...n,isOpen:!0}),onFocus:()=>r({...n,isOpen:!0}),onMouseOut:()=>r({isOpen:!1,isCopied:!1}),onBlur:()=>r({isOpen:!1,isCopied:!1}),onClick:()=>{navigator.clipboard.writeText(e).then(()=>{r({isOpen:!0,isCopied:!0}),setTimeout(()=>{r({isOpen:!1,isCopied:!1})},Uw)})}})]})},zt="discussion_",Kw=195,Rr=({element:e="div",content:t,userHasPermissions:n=!0,isLoading:r=!1,originalAuthorId:a,forceHide:i={actionBar:!1,comments:!1,likes:!1},functions:{content:{createContent:s,deleteContent:o,updateContent:l}={createContent:async()=>{},deleteContent:async()=>{},updateContent:async()=>{}},likes:{createLike:u,deleteLike:c}={createLike:()=>{},deleteLike:()=>{}},comments:{openComments:m}={openComments:()=>{}},mentions:{listMembers:h}={listMembers:()=>Promise.resolve([])}},links:p={},className:g,gtmContext:f="DiscussionAnswer",children:y,isTruncated:b=!1})=>{var fe,G,he,ge,Ee,Oe;const w=ue.useIntl(),A=C.useContext(Mt),k=C.useContext(Xa),{author:E,canLike:T,createdAt:j,id:z,likes:R=0,userLiked:$,comments:M=0,mentions:x}=t,B=A&&A.id&&typeof E!="string"&&E.id&&E.id===A.id||!1,F=typeof T=="boolean"?T:n?!B:!1,N=B&&(!t.createdAt||Sh(t.createdAt,10,"seconds")),L=C.useRef(null),[q,oe]=C.useState({body:t&&t.body||"",isEditing:!1,didEdit:t&&t.isEdited||!1,postBody:""}),[ne,D]=C.useState(!1),[H,X]=C.useState(N?"highlighted":"default"),[_,S]=C.useState("");C.useEffect(()=>{const me=L.current;if(!(!me||H==="default"))return document.addEventListener("discussionFormSubmitted",W),me.addEventListener("transitionend",I),()=>{document.removeEventListener("discussionFormSubmitted",W),me.removeEventListener("transitionend",I)}},[]),C.useEffect(()=>{oe({...q,body:t&&t.body||"",didEdit:t&&t.isEdited||!1})},[t.isEdited]),C.useEffect(()=>{(async()=>{const Pe=await Hw(q.body,b,x,h);oe({...q,postBody:Pe})})()},[q.body,x]);const W=()=>{setTimeout(()=>{X("fading")},1e3)},I=({propertyName:me})=>{me==="background-color"&&X(Pe=>(Pe==="default"&&(document.removeEventListener("discussionFormSubmitted",W),L.current&&L.current.removeEventListener("transitionend",I)),Pe==="fading"?"default":Pe))};if(r||!t||t.type==="answer"&&(!t.slugs||!t.slugs.question)||q.postBody==="")return d.jsx(wt,{className:"discussion-card discussion-post"});const V=async me=>{me||(me=""),S("");try{if(!vc(me,q.body)){const Pe=t.type==="question"?{title:me}:{body:me};await l(uc(t.slugs),Pe)}oe({...q,body:me,isEditing:!1,didEdit:!0})}catch{S(`${zt}form_error`)}},te=()=>{k&&k.updateConversation&&k.updateConversation({showForm:!0}),setTimeout(()=>{var Qe,Ae,ze;const Pe=`reply-form-${(t.type==="answer"?t.slug:((Qe=t.slugs)==null?void 0:Qe.reply)||((Ae=t.slugs)==null?void 0:Ae.answer)||((ze=t.slugs)==null?void 0:ze.question)||"").toLowerCase().slice(-15)}`,He=document.getElementById(Pe),Ue=document.getElementById(`${Pe}-input`);Ue&&Ue.focus(),He&&He.scrollIntoView({behavior:"smooth"})},0)},ee=async()=>{D(!1);try{await o(uc(t.slugs))}catch{S("delete-error")}},ae=[{text:w.formatMessage({id:`${zt}moreMenu_report`}),onClick:me=>{me.stopPropagation()},href:`mailto:community@apolitical.co?subject=${encodeURI(w.formatMessage({id:`${zt}report_subject`}))}&body=${encodeURI(w.formatMessage({id:`${zt}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&&B&&ae.push({text:w.formatMessage({id:`${zt}moreMenu_edit`}),onClick:()=>oe({...q,isEditing:!0}),icon:"pencil-paper",className:"gtm-trackable","data-gtm-event-context":f,"data-gtm-event-type":`edit-${t.type}-click`},{text:w.formatMessage({id:`${zt}moreMenu_delete`}),onClick:me=>{me.preventDefault(),me.stopPropagation(),D(!0)},icon:"trash",className:"gtm-trackable","data-gtm-event-context":f,"data-gtm-event-type":`delete-${t.type}-click`,...Wf(`delete-${t.slug}-modal`,ne)}),C.createElement(e,{className:Y("discussion-post",g,{[H]:!g||!g.includes("highlighted-text-box"),"has-link":p.post&&!q.isEditing}),ref:L,"data-testid":`discussion-${t.type}-thread`,"data-gtm-event-context":`${f}-post-click`,onClick:me=>{!p.post||q.isEditing||(me.preventDefault(),me.stopPropagation(),window.location.href=p.post)},children:d.jsxs(d.Fragment,{children:[d.jsxs("div",{id:z||t.slug,className:Y("discussion-card",t.type,{editing:q.isEditing,"has-link":p.post&&!q.isEditing}),children:[!q.isEditing&&d.jsx(tr,{member:E,additionalContent:{createdAt:j,didEdit:q.didEdit},className:typeof E!="string"&&E.id===a?"highlighted":"",gtmContext:f,gtmType:"profile-click"}),q.isEditing?d.jsx(Ja,{id:`editing-${t.slug}`,content:{type:t.type,slugs:t.slugs},userHasPermissions:n,meta:{isLoading:r,isInWrapper:!0,isEditing:{text:q.body}},maxLength:t.type==="question"?250:5e4,forceShow:{error:_!==""&&_!=="delete-error"?w.formatMessage({id:_},{action:w.formatMessage({id:`discussion_action_${t.type}`})}):!1},functions:{create:s,handleSaveEdit:V,handleCancel:()=>{S(""),oe({...q,isEditing:!1})},listMembers:h},gtmContext:`${f}Form`,data:{mentions:t.mentions}}):p.post?d.jsxs("a",{href:p.post,children:[(t==null?void 0:t.title)&&d.jsx("p",{className:"content-title",children:t==null?void 0:t.title}),q.postBody.length>Kw?d.jsx(zc,{text:q.postBody,markdownOptions:{overrides:{a:os,blockquote:{component:Ji}}}}):d.jsx(Vn,{options:{overrides:{a:os,blockquote:{component:Ji}}},children:q.postBody})]}):d.jsx(Vn,{options:{wrapper:t.type==="question"?"h1":C.Fragment,forceWrapper:t.type==="question",forceInline:t.type==="question",forceBlock:t.type!=="question",overrides:{blockquote:{component:Ji}}},children:q.postBody}),!q.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(eh,{element:"li",likes:R,isShort:!1,userLiked:$,content:{type:t.type,slugs:t.slugs,slug:t.slug},canLike:F,peopleWhoLiked:t.peopleWhoLiked,functions:{createLike:u,deleteLike:c}}),!i.comments&&(["question","post"].includes(t.type)||p.comments||typeof m=="function")&&d.jsx("li",{children:d.jsx(Na,{onClick:me=>{me.preventDefault(),me.stopPropagation(),p.comments&&(window.location.href=p.comments),typeof m=="function"&&m()},icon:{icon:"speech-bubble_square_thick"},"data-gtm-event-context":f,"data-gtm-event-type":`answer-${t.type}-click`,screenreaderText:w.formatMessage({id:`${zt}comments_screenReader`},{count:M}),children:w.formatMessage({id:`${zt}comments`},{count:M})})}),(t.type==="answer"||t.type==="reply")&&d.jsx("li",{children:d.jsx(Na,{styling:{muted:!0},onClick:te,icon:{icon:"speech-bubble_square_thick"},children:w.formatMessage({id:`${zt}reply`})})}),d.jsx(Vw,{url:(fe=t.slugs)!=null&&fe.reply?`${window.location.origin}${(G=t.slugs)==null?void 0:G.question}/${(he=t.slugs)==null?void 0:he.answer}#${(ge=t.slugs)==null?void 0:ge.reply}`:`${window.location.origin}${(Ee=t.slugs)==null?void 0:Ee.question}/${(Oe=t.slugs)==null?void 0:Oe.answer}`}),d.jsx(Vf,{element:"li",id:`more-${t.slug}`,options:ae})]})]}),y,d.jsx(Pr,{id:`delete-${t.slug}-modal`,isOpen:ne,functions:{onOpen:()=>{},onClose:()=>D(!1)},forceShow:{error:_==="delete-error"?w.formatMessage({id:"discussion_delete_error"},{action:w.formatMessage({id:`discussion_action_${t.type}`})}):!1},title:w.formatMessage({id:"discussion_delete_title"},{action:w.formatMessage({id:`discussion_action_${t.type}`})}),buttons:[{variant:"secondary",onClick:()=>D(!1),children:w.formatMessage({id:"discussion_delete_cancel"})},{variant:"primary",className:"destructive",onClick:ee,children:w.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:me=>d.jsx("p",{children:me}),action:w.formatMessage({id:`discussion_action_${t.type}`})}})})]})})};const Xi="discussion_responses_",th=({type:e="answer",responses:t=0})=>{const n=ue.useIntl();return t=parseInt(t),d.jsxs("div",{className:"responses-heading",children:[d.jsx("h4",{children:n.formatMessage({id:`${Xi}title`},{action:n.formatMessage({id:`${Xi}${e}`}),count:t})}),t===0&&d.jsx("p",{children:Ft(n.formatMessage,`${Xi}empty`,e,e)})]})};const nh=({loadMore:{isLoading:e,hasNextPage:t,loadNextPage:n}={isLoading:!1,hasNextPage:!1,loadNextPage:()=>{}},form:r,children:a})=>{const i=ue.useIntl(),s=C.useContext(Xa),o=oa(a,{element:"li"});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(Nr,{hasNextPage:t,loadNextPage:n,size:"small",styling:{muted:!0},icon:{icon:"arrow_corner-down_right",position:"left"},messages:{button:i.formatMessage({id:"discussion_thread_loadMore"}),error:i.formatMessage({id:"loadMore_error"})}}),r&&s.showForm&&d.jsx(Ja,{...r})]})},Zw="post",Yw="reply",rh="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 Gw(){return{latest_reactions:{like:[],reply:[]},reaction_counts:{like:0,reply:0},own_reactions:{like:[],reply:[]}}}function Qw(){return{latest_children:{like:[],reply:[]},children_counts:{like:0,reply:0},own_children:{like:[],reply:[]}}}function ah(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 Jw({content:e}){return{content:e,id:rh,time:new Date().toISOString(),verb:Zw}}function lc({activity:e,user:t}){return{...e,actor:ah(t),...Gw()}}function Ra({activity:e,reaction:t}){var n,r,a;t?(e.latest_reactions={...e.latest_reactions||{},like:[...((r=e.latest_reactions)==null?void 0:r.like)||[],t]},e.own_reactions={...e.own_reactions||{},like:[...((a=e.own_reactions)==null?void 0:a.like)||[],t]}):e.reaction_counts={...e.reaction_counts||{},like:(n=e.reaction_counts)!=null&&n.like?e.reaction_counts.like+1:1}}function ih({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 Xw({activityId:e,replyId:t,content:n}){return{activity_id:e,data:{content:n},id:rh,kind:Yw,parent:t||""}}function cc({reply:e,user:t}){const n=ah(t);return{...e,user_id:n.id,user:n,...Qw()}}function dc({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 eE({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 sh=e=>{const t=new CustomEvent("discussionPostAdded",{detail:e});document.dispatchEvent(t)};let fc,es=0;const oh=()=>{C.useEffect(()=>(document.addEventListener("discussionPostAdded",e),()=>{document.removeEventListener("discussionPostAdded",e)}),[]);const e=t=>{const n=t.detail;if(!n)return;clearTimeout(fc);const r=document.getElementById(n);if(r){r.scrollIntoView({behavior:"smooth",block:"start"}),es=0;return}es++,!(es>10)&&(fc=setTimeout(()=>{e(t)},50))}},Qn=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}),rn=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}),uh=Object.freeze({actor:`SU:${Qn.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"}),tE=Object.freeze({actor:`SU:${rn.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"}),nE=Object.freeze({actor:`SU:${Qn.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"}),rE=Object.freeze({actor:`SU:${rn.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:uh.id,kind:"like",created_at:"2023-11-24T17:58:36.162000",data:{},parent:"",updated_at:"2023-11-24T17:58:36.162000",user_id:rn.id,children_counts:{},latest_children:{},latest_children_extra:{},own_children:{},user:{id:rn.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:rn.id,user:{id:rn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:uh.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:Qn.id,user:{id:Qn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:tE.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:rn.id,user:{id:rn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:nE.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:Qn.id,user:{id:Qn.id,data:{},created_at:"2023-08-31T07:11:38.677184Z",updated_at:"2023-08-31T07:11:38.677184Z"},kind:"reply",activity_id:rE.id,data:{content:"Some content 4..."},parent:"",latest_children:{},children_counts:{}});function aE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=lc({activity:Jw(o),user:i});return hc(u,l)}),onError:n,onSuccess:(o,l,u)=>{const c=lc({activity:o,user:i});r.setQueryData(a,hc(c,u,!0)),setTimeout(()=>{sh(c.id)},0)}});return s}function iE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a,content:i})=>t(s=>{const o=Ma(a,s);return o&&(o.content=i),s}),onError:n});return r}function sE({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ke.useQueryClient(),l=Ga(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:Bo(u),mutate:Ao(u)},user:l,...u},m=aE({...c,mutationFn:e}),h=iE({...c,mutationFn:t}),p=oE({...c,mutationFn:n}),g=lE({...c,mutationFn:a}),f=cE({...c,mutationFn:i}),{activities:y,...b}=uE({queryKey:s,queryFn:r});return{activities:y,mutations:{create:m,edit:h,remove:g,like:p,unlike:f},user:l,...b}}function oE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({activityId:s})=>t(o=>{const l=Ma(s,o);return l&&Ra({activity:l}),o}),onError:n,onSuccess:(s,{activityId:o},l)=>{const u=Ma(o,l);u&&Ra({activity:u,reaction:s}),r.setQueryData(a,l)}});return i}function uE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:null},getNextPageParam:o=>(o==null?void 0:o.next)||null});return{activities:fE(n),error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function lE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({activityId:a})=>t(i=>dE(a,i)),onError:n});return r}function cE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({activityId:i})=>t(s=>{const o=Ma(i,s);return o&&ih({activity:o,user:r}),s}),onError:n});return a}function hc(e,t,n=!1){return t?(n?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t):{pages:[{next:"",results:[e]}],pageParams:[""]}}function Ma(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function dE(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 fE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,{results:r})=>[...n,...r],[]))||[]}const hE=({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:m,isLoading:h,mutations:{create:p,edit:g,remove:f,like:y,unlike:b},user:w}=sE({queryKey:[e,t,"activities"],queryFns:r});return oh(),u?d.jsx(an,{variant:"error",text:u.message}):d.jsxs("section",{children:[d.jsx(_o,{form:{content:{type:"post",slugs:{}},functions:{create:p,listMembers:a.listMembers},meta:{isEditing:!1,showSuccessMessage:!1}},membershipRequiredToPost:{isMember:n,required:!0,join:i,leave:s,notMemberStateText:o.formatMessage({id:"community_joinToPost"})}}),l==null?void 0:l.map((A,k)=>{var L,q,oe,ne,D,H,X,_;const{id:E,own_reactions:T,latest_reactions:j,reaction_counts:z,mentioned_users:R}=A,$=(((L=j==null?void 0:j.like)==null?void 0:L.length)||0)>0,M=(((q=T==null?void 0:T.like)==null?void 0:q.length)||0)>0,x=M?T==null?void 0:T.like[0].id:"",B=$?(oe=j==null?void 0:j.like)==null?void 0:oe.map(S=>{var W,I,V;return{id:(W=S==null?void 0:S.user)==null?void 0:W.id,name:(V=(I=S==null?void 0:S.user)==null?void 0:I.data)==null?void 0:V.name}}):!1,F=A==null?void 0:A.actor,N=(F==null?void 0:F.id)===(w==null?void 0:w.id);return d.jsx(C.Fragment,{children:d.jsx(Rr,{content:{type:"post",title:A==null?void 0:A.title,body:A==null?void 0:A.content,canLike:ei(n,N),createdAt:(A==null?void 0:A.time)||"",slugs:{question:`${e}/${t}`,answer:E},slug:E,author:{id:F==null?void 0:F.id,name:(ne=F==null?void 0:F.data)==null?void 0:ne.name,organization:(D=F==null?void 0:F.data)==null?void 0:D.organization,jobTitle:(H=F==null?void 0:F.data)==null?void 0:H.jobTitle,location:(X=F==null?void 0:F.data)==null?void 0:X.location,image:{thumbnail:((_=F==null?void 0:F.data)==null?void 0:_.thumbnail)||void 0}},userLiked:M,likes:(z==null?void 0:z.like)||0,comments:(z==null?void 0:z.reply)||0,peopleWhoLiked:B,mentions:R},links:{post:`${e}/${t}/${E}`,comments:`${e}/${t}/${E}`},gtmContext:"community",functions:{content:{createContent:()=>null,deleteContent:()=>f({activityId:E}),updateContent:(S,{body:W})=>g({activityId:E,content:W})},likes:{createLike:()=>y({activityId:E}),deleteLike:()=>b({activityId:E,reactionId:x})},comments:{openComments:()=>null},mentions:a},isTruncated:!0})},E)}),!h&&d.jsx(Nr,{hasNextPage:m,loadNextPage:()=>c(),icon:{icon:"arrow-down",position:"right"},messages:{button:o.formatMessage({id:"loadMore_button"}),error:o.formatMessage({id:"loadMore_error"})}})]})},mE={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 pE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a,user:i}){const{mutate:s}=Ke.useMutation({mutationFn:e,onMutate:o=>t(l=>{const u=cc({reply:Xw(o),user:i});return mc(u,l,{replace:!1,append:(o==null?void 0:o.replyId)!==void 0})}),onError:n,onSuccess:(o,l,u)=>{const c=cc({reply:o,user:i});r.setQueryData(a,mc(c,u,{replace:!0,append:(l==null?void 0:l.replyId)!==void 0})),setTimeout(()=>{sh(c.id)},0)}});return s}function gE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a,content:i})=>t(s=>{const o=Ia(a,s);return o&&(o.data.content=i),s}),onError:n});return r}function lh({queryFns:{create:e,edit:t,like:n,list:r,remove:a,unlike:i},queryKey:s}){const o=Ke.useQueryClient(),l=Ga(),u={queryClient:o,queryKey:s},c={mutationHandlers:{error:Bo(u),mutate:Ao(u)},user:l,...u},m=pE({...c,mutationFn:e}),h=gE({...c,mutationFn:t}),p=vE({...c,mutationFn:n}),g=yE({...c,mutationFn:a}),f=DE({...c,mutationFn:i}),{replies:y,...b}=bE({queryKey:s,queryFn:r});return{replies:y,mutations:{create:m,edit:h,remove:g,like:p,unlike:f},user:l,...b}}function vE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:({replyId:s})=>t(o=>{const l=Ia(s,o);return l&&dc({reply:l}),o}),onError:n,onSuccess:(s,{replyId:o},l)=>{const u=Ia(o,l);u&&dc({reply:u,reaction:s}),r.setQueryData(a,l)}});return i}function bE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}=Ke.useInfiniteQuery({queryKey:t,queryFn:e,initialPageParam:{next:""},getNextPageParam:u=>(u==null?void 0:u.next)||null}),o=kE(n),l=`${o.length||0}${i?"+":""}`;return{replies:o,repliesCount:l,error:r,isLoading:a,hasNextPage:i,fetchNextPage:s}}function yE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({replyId:a})=>t(i=>EE(a,i)),onError:n});return r}function DE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:({replyId:i})=>t(s=>{const o=Ia(i,s);return o&&eE({reply:o,user:r}),s}),onError:n});return a}function CE(e){return{pages:[{next:"",results:[e]}],pageParams:[""]}}function xE(e,t,n){const r=t.pages.length-1,a=t.pages[r].results.length-1;return n!=null&&n.replace?t.pages[r].results[a]=e:t.pages[r].results.push(e),t}function wE(e,t,n){return n!=null&&n.replace?t.pages[0].results[0]=e:t.pages[0].results=[e,...t.pages[0].results],t}function mc(e,t,n){return t?n!=null&&n.append?xE(e,t,n):wE(e,t,n):CE(e)}function Ia(e,t){if(t)for(const{results:n}of t.pages){const r=n.find(({id:a})=>a===e);if(r)return r}}function EE(e,t){for(const{results:n}of t.pages){const r=n.findIndex(({id:a})=>a===e);if(r!==-1){n.splice(r,1);break}}return t}function kE(e){var t;return((t=e==null?void 0:e.pages)==null?void 0:t.reduce((n,r)=>[...n,...r==null?void 0:r.results],[]))||[]}const _E=({basePath:e,parentId:t,activityId:n,replyId:r,isMember:a,functions:i})=>{const s=ue.useIntl(),o=3,{replies:l,fetchNextPage:u,hasNextPage:c,isLoading:m,mutations:{create:h,edit:p,like:g,remove:f,unlike:y},user:b}=lh({queryKey:[e,t,n,r,"replies"],queryFns:{...i,list:k=>i.list({...k,reactionId:r})}});Ns([m]);const[w,A]=C.useState(!0);return d.jsxs(d.Fragment,{children:[(l==null?void 0:l.length)>=o&&d.jsx(ke,{className:"nested-replies-show-toggle",variant:"secondary",size:"small",icon:{icon:`arrow_corner-${w?"up_left":"down_right"}`,position:"left"},onClick:()=>A(!w),children:s.formatMessage({id:`discussion_thread_${w?"hide":"show"}`},{count:l==null?void 0:l.length})}),w&&d.jsx(nh,{loadMore:{isLoading:m,hasNextPage:c,loadNextPage:()=>u()},form:{content:{type:"reply",slugs:{question:`${e}/${t}`,answer:n,reply:r}},functions:{create:(k,{body:E})=>h({activityId:n,replyId:r,content:E}),listMembers:i.listMembers},meta:{isEditing:!1,showSuccessMessage:!1}},children:l&&l.length>0?l==null?void 0:l.map(k=>{var D,H,X,_,S,W,I,V,te,ee,ae,fe;const{id:E,own_children:T,latest_children:j,children_counts:z,data:{mentioned_users:R}}=k,M=(((D=T==null?void 0:T.like)==null?void 0:D.length)||0)>0?(H=T==null?void 0:T.like)==null?void 0:H.find(G=>{var he;return((he=G==null?void 0:G.user)==null?void 0:he.id)===(b==null?void 0:b.id)}):!1,x=M?M==null?void 0:M.id:"",B=!!M,N=(((X=j==null?void 0:j.like)==null?void 0:X.length)||0)>0?(_=j==null?void 0:j.like)==null?void 0:_.map(G=>{var he,ge,Ee;return{id:(he=G==null?void 0:G.user)==null?void 0:he.id,name:(Ee=(ge=G==null?void 0:G.user)==null?void 0:ge.data)==null?void 0:Ee.name}}):!1,L=k==null?void 0:k.user,q=(L==null?void 0:L.id)===(b==null?void 0:b.id),oe=ei(a,q),ne=typeof k.data.content=="string"?(S=k==null?void 0:k.data)==null?void 0:S.content:((I=(W=k==null?void 0:k.data)==null?void 0:W.content)==null?void 0:I.text)||"";return d.jsx(Rr,{content:{id:E,type:"reply",body:ne,canLike:oe,createdAt:k==null?void 0:k.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:k==null?void 0:k.parent},slug:"",author:{id:L==null?void 0:L.id,name:(V=L.data)==null?void 0:V.name,organization:(te=L.data)==null?void 0:te.organization,jobTitle:(ee=L.data)==null?void 0:ee.jobTitle,location:(ae=L.data)==null?void 0:ae.location,image:{thumbnail:((fe=L.data)==null?void 0:fe.thumbnail)||void 0}},userLiked:B,likes:(z==null?void 0:z.like)||0,peopleWhoLiked:N,mentions:R},functions:{content:{createContent:()=>null,deleteContent:()=>f({replyId:E}),updateContent:(G,{body:he})=>p({replyId:E,content:he})},likes:{createLike:()=>g({replyId:E}),deleteLike:()=>y({replyId:E,reactionId:x})},comments:{},mentions:{listMembers:i.listMembers}}},E)}):null})]})};const ch=({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:m,hasNextPage:h,isLoading:p,mutations:{create:g,edit:f,like:y,remove:b,unlike:w},user:A}=lh({queryKey:[e,t,n,"replies"],queryFns:a});return Ns([p]),oh(),d.jsxs("section",{className:"replies-feed",children:[d.jsx(th,{type:"comment",responses:c}),d.jsx(_o,{form:{content:{type:"reply",slugs:{}},functions:{create:(k,{body:E})=>g({activityId:n,content:E}),...i},meta:{isEditing:!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(k=>{var D,H,X,_,S,W,I,V,te,ee,ae,fe;const{id:E,own_children:T,latest_children:j,children_counts:z,data:{mentioned_users:R}}=k,M=(((D=T==null?void 0:T.like)==null?void 0:D.length)||0)>0?(H=T==null?void 0:T.like)==null?void 0:H.find(G=>{var he;return((he=G==null?void 0:G.user)==null?void 0:he.id)===(A==null?void 0:A.id)}):!1,x=M?M==null?void 0:M.id:"",B=!!M,N=(((X=j==null?void 0:j.like)==null?void 0:X.length)||0)>0?(_=j==null?void 0:j.like)==null?void 0:_.map(G=>{var he,ge,Ee;return{id:(he=G==null?void 0:G.user)==null?void 0:he.id,name:(Ee=(ge=G==null?void 0:G.user)==null?void 0:ge.data)==null?void 0:Ee.name}}):!1,L=k==null?void 0:k.user,q=(L==null?void 0:L.id)===(A==null?void 0:A.id),oe=ei(r,q),ne=typeof k.data.content=="string"?(S=k==null?void 0:k.data)==null?void 0:S.content:((I=(W=k==null?void 0:k.data)==null?void 0:W.content)==null?void 0:I.text)||"";return d.jsx(Xf,{children:d.jsx(Rr,{content:{id:E,type:"reply",body:ne,canLike:oe,createdAt:k==null?void 0:k.created_at,slugs:{question:`${e}/${t}`,answer:n,reply:E},slug:E,author:{id:L==null?void 0:L.id,name:(V=L.data)==null?void 0:V.name,organization:(te=L.data)==null?void 0:te.organization,jobTitle:(ee=L.data)==null?void 0:ee.jobTitle,location:(ae=L.data)==null?void 0:ae.location,image:{thumbnail:((fe=L.data)==null?void 0:fe.thumbnail)||void 0}},userLiked:B,likes:(z==null?void 0:z.like)||0,peopleWhoLiked:N,mentions:R},functions:{content:{createContent:()=>null,deleteContent:()=>b({replyId:E}),updateContent:(G,{body:he})=>f({replyId:E,content:he})},likes:{createLike:()=>y({replyId:E}),deleteLike:()=>w({replyId:E,reactionId:x})},comments:{},mentions:i},children:d.jsx(_E,{basePath:e,parentId:t,activityId:n,replyId:E,isMember:r,functions:{...a,...i}})},E)},E)}),!p&&d.jsx(Nr,{hasNextPage:h,loadNextPage:()=>m(),icon:{icon:"arrow-down",position:"right"},messages:{button:l.formatMessage({id:"loadMore_button"}),error:l.formatMessage({id:"loadMore_error"})}})]})};function BE({mutationFn:e,mutationHandlers:{mutate:t,error:n}}){const{mutate:r}=Ke.useMutation({mutationFn:e,onMutate:({content:a})=>t(i=>(i&&(i.content=a),i)),onError:n});return r}function AE({queryFn:e,queryKey:t}){const{data:n,error:r,isLoading:a,isFetching:i}=Ke.useQuery({queryFn:e,queryKey:t});return{activity:n,error:r,isLoading:a,isFetching:i}}function FE({queryFns:{read:e,edit:t,like:n,unlike:r},queryKey:a}){const i=Ke.useQueryClient(),s=Ga(),o={queryClient:i,queryKey:a},l={mutationHandlers:{error:Bo(o),mutate:Ao(o)},user:s,...o},u=BE({...l,mutationFn:t}),c=TE({...l,mutationFn:n}),m=SE({...l,mutationFn:r}),{activity:h,...p}=AE({queryKey:a,queryFn:e});return{activity:h,mutations:{edit:u,like:c,unlike:m},user:s,...p}}function TE({mutationFn:e,mutationHandlers:{mutate:t,error:n},queryClient:r,queryKey:a}){const{mutate:i}=Ke.useMutation({mutationFn:e,onMutate:s=>t(o=>(o&&Ra({activity:o}),o)),onError:n,onSuccess:(s,o,l)=>{l&&Ra({activity:l,reaction:s}),r.setQueryData(a,l)}});return i}function SE({mutationFn:e,mutationHandlers:{mutate:t,error:n},user:r}){const{mutate:a}=Ke.useMutation({mutationFn:e,onMutate:i=>t(s=>(s&&ih({activity:s,user:r}),s)),onError:n});return a}const jE=({basePath:e,parentId:t,activityId:n,isMember:r,functions:{activities:{remove:a,...i},reactions:s,mentions:o,join:l,leave:u}})=>{var M,x,B,F,N,L,q,oe,ne,D;const c=ue.useIntl(),m=C.useContext(Mt),{activity:h,error:p,isLoading:g,mutations:{edit:f,like:y,unlike:b}}=FE({queryFns:i,queryKey:[e,t,n]});if(g)return d.jsx(wt,{style:{height:"400px"}});if(p||!h)return d.jsx(an,{variant:"error",text:c.formatMessage({id:"activitySection_notFoundError"})});const{own_reactions:w,latest_reactions:A,mentioned_users:k}=h,E=(((M=A==null?void 0:A.like)==null?void 0:M.length)||0)>0,T=(((x=w==null?void 0:w.like)==null?void 0:x.length)||0)>0,j=T?w==null?void 0:w.like[0].id:"",z=E?(B=A==null?void 0:A.like)==null?void 0:B.map(H=>{var X,_,S;return{id:(X=H==null?void 0:H.user)==null?void 0:X.id,name:(S=(_=H==null?void 0:H.user)==null?void 0:_.data)==null?void 0:S.name}}):!1,R=h==null?void 0:h.actor,$=(R==null?void 0:R.id)===(m==null?void 0:m.id);return d.jsxs("section",{className:"activity-section",children:[d.jsx(Rr,{className:"highlighted-text-box subtle",content:{id:n,type:"post",body:h==null?void 0:h.content,canLike:ei(r,$),createdAt:(h==null?void 0:h.time)||"",slugs:{question:`${e}/${t}`,answer:h==null?void 0:h.id},slug:n,author:{id:R.id,name:(F=R.data)==null?void 0:F.name,organization:(N=R.data)==null?void 0:N.organization,jobTitle:(L=R.data)==null?void 0:L.jobTitle,location:(q=R.data)==null?void 0:q.location,image:{thumbnail:((oe=R.data)==null?void 0:oe.thumbnail)||void 0}},userLiked:T,likes:((ne=h==null?void 0:h.reaction_counts)==null?void 0:ne.like)||0,comments:((D=h==null?void 0:h.reaction_counts)==null?void 0:D.reply)||0,peopleWhoLiked:z,mentions:k},originalAuthorId:R==null?void 0:R.id,forceHide:{comments:!0},functions:{content:{createContent:()=>null,deleteContent:a,updateContent:(H,{body:X})=>f({content:X})},likes:{createLike:()=>y({activityId:n}),deleteLike:()=>b({activityId:n,reactionId:j})},comments:{openComments:()=>{}},mentions:o}},n),d.jsx(ch,{basePath:e,parentId:t,activityId:n,isMember:r,functions:{reactions:s,mentions:o,join:l,leave:u}})]})},OE=({id:e,data:{jobTitle:t,name:n,organization:r,thumbnail:a}})=>({id:e,name:n,jobTitle:t,organization:r,image:{thumbnail:a}}),pc=[{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/kCcBdXurt3uOKu6NdTPm0/1b6d19179b21f98dbdadf2477c03d267/devin-avery-7gwqj0yyrhm-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"why-public-servants-must-learn-to-fail",contributors:["community"]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/12Y0W1K0zVcDKzgLZlbfyC/6eb0757a02cbeea19b1b42d7da04d553/ashkan-forouzani-m0l9nbcivuk-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"organisational-culture-change-and-failure",contributors:[{name:"Mari-Liis",id:"bdb7509c-89ed-4633-8bc0-dbf11f5d9be1"}]},{contentType:"solutionArticle",banner:{description:"",url:"//images.ctfassets.net/txbhe1wabmyx/26TEwu0xVkbQDguuW89fY6/d54ce406cdd652d68979770d526398ab/nik-shuliahin-bunwp1bl0nc-unsplash.jpg",width:295,height:180,type:"image/jpeg",aspect:"responsiveCard",query:"w=295&h=180&fit=thumb&f=center"},slug:"how-to-learn-from-failure-without-causing-a-scandal",contributors:["community"]}];const ia="notFoundError_",PE=()=>{const e=ue.useIntl(),t=[];return pc.forEach((n,r)=>{n.title=e.formatMessage({id:`${ia}post_${r+1}`}),t.push("solutionArticle")}),d.jsxs(Gf,{styling:{background:"bold",circle:"small",variant:"alt-2"},additionalContent:{appended:d.jsxs(ln,{children:[d.jsx(Uf,{cards:pc,cardTypes:t,buildCardData:n=>new Promise((r,a)=>{r(n)})}),d.jsx(ke,{href:"/solution-articles/",children:e.formatMessage({id:`${ia}cta`})})]})},reportError:()=>{},className:"not-found-error",children:[d.jsx("h1",{children:e.formatMessage({id:`${ia}title`})}),d.jsx("p",{children:e.formatMessage({id:`${ia}text`})})]})};exports.ASSETS_BUCKET=Ht;exports.ActivitiesFeed=hE;exports.ActivitySection=jE;exports.AddPost=_o;exports.Banner=Xx;exports.BannerSection=sw;exports.Breadcrumbs=yw;exports.Buckets=Kh;exports.Button=ke;exports.ButtonWrapper=kn;exports.COURSE_CONTENT_TYPES=fr;exports.CacheProvider=Mf;exports.Card=Co;exports.CardBlock=Uf;exports.Carousel=vw;exports.CharacterLimit=Ws;exports.CollapsibleSection=za;exports.Columns=Zf;exports.CommunityDetails=bw;exports.ContactFooter=Tw;exports.ContactForm=wf;exports.ContentTypeLabel=Ic;exports.Contributors=qs;exports.ConversationContext=Xa;exports.CookieBanner=Yf;exports.CourseProgression=Mw;exports.CourseStructure=Iw;exports.CustomContentBanner=ow;exports.Directory=Yx;exports.DiscussionConversation=Xf;exports.DiscussionForm=Ja;exports.DiscussionLikes=eh;exports.DiscussionPost=Rr;exports.DiscussionThread=nh;exports.Divider=tn;exports.DownloadSection=ew;exports.EMAILS=Nn;exports.EditSection=nw;exports.EmailHelperTextBox=Vc;exports.EmptyStateBox=an;exports.Filters=Dw;exports.FlagsProvider=If;exports.Footer=Eo;exports.Form=nr;exports.Formatting=K;exports.FullWidthSection=ln;exports.GET_STREAM_USER_PREFIX=ns;exports.GlobalProviders=Kx;exports.Header=ko;exports.HelperTextBox=Lc;exports.HiddenFromScreenReaders=$a;exports.HideShowTextBox=zc;exports.HighlightSection=lw;exports.HighlightedTextBox=Nt;exports.INVALID_TOKEN=Tc;exports.IconBulletedList=Gh;exports.ImageContainer=Hh;exports.IntlProvider=$f;exports.InviteForm=Ef;exports.InviteModal=Zx;exports.JoinButton=xo;exports.LanguageContext=bo;exports.LanguageSwitcher=xw;exports.LessonName=Qf;exports.LessonType=Jf;exports.Link=_n;exports.LoadMore=Nr;exports.LoadingBlock=om;exports.LoadingPlaceholder=wt;exports.LoadingState=Ls;exports.Logo=wo;exports.LogoSection=rw;exports.MENTION_REGEX=Sc;exports.MarkCompleteButton=$w;exports.MarkdownText=Vn;exports.MarketingBlock=cw;exports.Marks=Ot;exports.Member=tr;exports.MembersList=Rw;exports.Modal=Do;exports.MoreMenu=Vf;exports.NUMBER_OF_COUNTRIES=Th;exports.NUMBER_OF_USERS=Fh;exports.NavigationMenu=Kf;exports.NotFoundError=PE;exports.Overlay=Pr;exports.OverlayContext=yo;exports.OverlayProvider=qf;exports.PageHeading=qc;exports.PageLayout=Gf;exports.PasswordForm=zC;exports.PasswordRules=Qc;exports.Pill=hn;exports.Popover=Mc;exports.Portal=Is;exports.ProfileImageChange=LC;exports.ProfilePicture=sn;exports.ProgressBar=$s;exports.ProgressTracker=Uh;exports.Rating=Dm;exports.RepliesFeed=ch;exports.ResponsesHeading=th;exports.ResponsiveImage=er;exports.ReturnToNavButton=Vh;exports.RichTextEditor=xf;exports.SearchForm=kf;exports.ShareLinks=Bw;exports.SignupForm=KC;exports.Span=os;exports.StatusBanner=wr;exports.TableOfContents=Jx;exports.Tabs=Aw;exports.Tags=Nw;exports.TestimonialBlock=Qx;exports.TimeToComplete=Qa;exports.Toggle=$C;exports.Tooltip=En;exports.TopLevelPage=Sw;exports.UUID_V4_REGEX=rs;exports.UserContext=Mt;exports.UserProvider=Lf;exports.VisuallyHidden=Ie;exports.addAriaProps=Wf;exports.basicReducer=jr;exports.camelCaseToDashCase=Bc;exports.checkIntlPathExists=La;exports.generateConditions=ma;exports.generateCssIcon=jc;exports.getCharacterLimitProps=Uc;exports.getLongDate=Ms;exports.getMember=zs;exports.getShortDate=Oc;exports.getValueLength=qa;exports.headerData=Sr;exports.mapGetStreamData=OE;exports.pageReady=Pc;exports.passwordValidator=is;exports.repliesFeedMock=mE;exports.supportedLanguages=ga;exports.toCamelCase=Ac;exports.toCapitalisedCase=Ah;exports.toSentenceCase=Fc;exports.useCurrentPath=Cc;exports.useEffectAfterMount=Un;exports.useElementWidth=Jn;exports.useOverlay=zf;exports.useScrollListener=Ec;exports.useScrollToHash=Ns;exports.useTooltips=Rs;exports.useUser=Ga;
|